static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; #ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* * Do not try to open special files like device nodes, fifos etc * We can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { return 0; } err = local_open(ctx, path, O_RDONLY, &fid_open); if (err < 0) { return err; } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx, &fid_open); #else err = -ENOTTY; #endif return err; }
int GIGAopen(const char *path, struct fuse_file_info *fi) { logMessage(LOG_TRACE, __func__, " ==> open(path=[%s], fi=[0x%08x])", path, fi); int ret = 0; char fpath[MAX_LEN] = {0}; int fd; switch (giga_options_t.backend_type) { case BACKEND_LOCAL_FS: get_full_path(fpath, path); if ((ret = local_open(fpath, fi->flags, &fd)) < 0) ret = FUSE_ERROR(ret); fi->fh = fd; break; case BACKEND_RPC_LEVELDB: break; default: break; } /* if ((fd = open(fpath, fi->flags)) < 0) { logMessage(LOG_FATAL, __func__, "open(%s) failed: %s", fpath, strerror(errno)); ret = FUSE_ERROR(errno); } fi->fh = fd; */ logMessage(LOG_TRACE, __func__, " ret_open(path=[%s], fi=[%d])", path, fi->fh); return ret; }