Example #1
0
int fskit_fuse_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) {

   struct fskit_fuse_state* state = fskit_fuse_get_state();
   if( (state->callbacks & FSKIT_FUSE_FGETATTR) == 0 ) {
      return -ENOSYS;
   }

   fskit_debug("fgetattr(%s, %p, %p)\n", path, statbuf, fi );

   struct fskit_fuse_file_info* ffi = NULL;

   ffi = (struct fskit_fuse_file_info*)((uintptr_t)fi->fh);

   int rc = 0;

   if( ffi->type == FSKIT_ENTRY_TYPE_FILE ) {
      rc = fskit_fstat( state->core, fskit_file_handle_get_path( ffi->handle.fh ), fskit_file_handle_get_entry( ffi->handle.fh ), statbuf );
   }
   else {
      rc = fskit_fstat( state->core, fskit_dir_handle_get_path( ffi->handle.dh ), fskit_dir_handle_get_entry( ffi->handle.dh ), statbuf );
   }

   fskit_debug("fgetattr(%s, %p, %p) rc = %d\n", path, statbuf, fi, rc );

   return rc;
}
Example #2
0
File: stat.c Project: jaromil/fskit
// stat a path.
// fill in the stat buffer on success.
// return the usual path resolution errors.
int fskit_stat( struct fskit_core* core, char const* fs_path, uint64_t user, uint64_t group, struct stat* sb ) {

   int rc = 0;

   // ref this entry, so it won't disappear on stat
   struct fskit_entry* fent = fskit_entry_ref( core, fs_path, &rc );
   if( fent == NULL ) {
      
      return rc;
   }
   
   // stat it
   rc = fskit_fstat( core, fs_path, fent, sb );

   fskit_entry_unref( core, fs_path, fent );
   
   return rc;
}