int fskit_fuse_rmdir(const char *path) { struct fskit_fuse_state* state = fskit_fuse_get_state(); if( (state->callbacks & FSKIT_FUSE_RMDIR) == 0 ) { return -ENOSYS; } fskit_debug("rmdir(%s)\n", path ); uid_t uid = fskit_fuse_get_uid( state ); gid_t gid = fskit_fuse_get_gid( state ); int rc = fskit_rmdir( state->core, path, uid, gid ); fskit_debug("rmdir(%s) rc = %d\n", path, rc ); return rc; }
// detach a file // return 0 on success // return -errno on error static int UG_impl_detach( struct SG_gateway* gateway, struct SG_request_data* reqdat, void* cls ) { int rc = 0; struct UG_state* ug = (struct UG_state*)SG_gateway_cls( gateway ); struct fskit_core* fs = UG_state_fs( ug ); struct ms_client* ms = (struct ms_client*)SG_gateway_ms( gateway ); uint64_t volume_id = ms_client_get_volume_id( ms ); struct stat sb; char const* method = NULL; // file or directory? rc = fskit_stat( fs, reqdat->fs_path, 0, 0, &sb ); if( rc != 0 ) { return rc; } if( S_ISREG( sb.st_mode ) ) { // unlink locally. The MS will be informed as part of the user route. method = "fskit_unlink"; rc = fskit_unlink( fs, reqdat->fs_path, reqdat->user_id, volume_id ); } else { // rmdir locally. The MS will be informed as part of the user route method = "fskit_rmdir"; rc = fskit_rmdir( fs, reqdat->fs_path, reqdat->user_id, volume_id ); } if( rc != 0 ) { SG_error("%s( '%s' ) rc = %d\n", method, reqdat->fs_path, rc); } return 0; }