예제 #1
0
파일: open.c 프로젝트: PeteGozz/fskit
// get the user-supplied handle data for opening a file
// NOTE: fent *cannot* be locked--it's lock status will be set through the route consistency discipline
int fskit_run_user_open( struct fskit_core* core, char const* path, struct fskit_entry* fent, int flags, void** handle_data ) {

   int rc = 0;
   int cbrc = 0;
   struct fskit_route_dispatch_args dargs;
   char name[FSKIT_FILESYSTEM_NAMEMAX+1];
   
   memset( name, 0, FSKIT_FILESYSTEM_NAMEMAX+1 );
   fskit_basename( path, name );

   fskit_route_open_args( &dargs, name, flags );

   rc = fskit_route_call_open( core, path, fent, &dargs, &cbrc );

   if( rc == -EPERM || rc == -ENOSYS ) {
      // no routes
      *handle_data = NULL;
      return 0;
   }

   else if( cbrc != 0 ) {
      // callback failed
      return cbrc;
   }

   else {
      // callback succeded
      *handle_data = dargs.handle_data;

      return 0;
   }
}
예제 #2
0
파일: open.c 프로젝트: jaromil/fskit
// get the user-supplied handle data for opening a file
// NOTE: fent *cannot* be locked--it's lock status will be set through the route consistency discipline
int fskit_run_user_open( struct fskit_core* core, char const* path, struct fskit_entry* fent, int flags, void** handle_data ) {

   int rc = 0;
   int cbrc = 0;
   struct fskit_route_dispatch_args dargs;

   fskit_route_open_args( &dargs, flags );

   rc = fskit_route_call_open( core, path, fent, &dargs, &cbrc );

   if( rc == -EPERM || rc == -ENOSYS ) {
      // no routes
      *handle_data = NULL;
      return 0;
   }

   else if( cbrc != 0 ) {
      // callback failed
      return cbrc;
   }

   else {
      // callback succeded
      *handle_data = dargs.handle_data;

      return 0;
   }
}