static status_t nfs4_read_fs_info(fs_volume* volume, struct fs_info* info) { TRACE("volume = %p", volume); FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume); RootInode* inode = reinterpret_cast<RootInode*>(fs->Root()); return inode->ReadInfo(info); }
static status_t nfs4_remove_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter) { FileSystem* fs = reinterpret_cast<FileSystem*>(volume->private_volume); VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(vnode->private_node); TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); if (fs->Root() == vti->GetPointer()) return B_OK; ASSERT(vti->GetPointer() == NULL); delete vti; return B_OK; }
static status_t nfs4_mount(fs_volume* volume, const char* device, uint32 flags, const char* args, ino_t* _rootVnodeID) { TRACE("volume = %p, device = %s, flags = %" B_PRIu32 ", args = %s", volume, device, flags, args); status_t result; /* prepare idmapper server */ MutexLocker locker(gIdMapperLock); gIdMapper = new(std::nothrow) IdMap; if (gIdMapper == NULL) return B_NO_MEMORY; result = gIdMapper->InitStatus(); if (result != B_OK) { delete gIdMapper; gIdMapper = NULL; return result; } locker.Unlock(); AddressResolver* resolver; MountConfiguration config; char* path; result = ParseArguments(args, &resolver, &path, &config); if (result != B_OK) return result; MemoryDeleter pathDeleter(path); RPC::Server* server; result = gRPCServerManager->Acquire(&server, resolver, CreateNFS4Server); delete resolver; if (result != B_OK) return result; FileSystem* fs; result = FileSystem::Mount(&fs, server, path, volume->id, config); if (result != B_OK) { gRPCServerManager->Release(server); return result; } Inode* inode = fs->Root(); if (inode == NULL) { delete fs; gRPCServerManager->Release(server); return B_IO_ERROR; } volume->private_volume = fs; volume->ops = &gNFSv4VolumeOps; VnodeToInode* vti = new VnodeToInode(inode->ID(), fs); if (vti == NULL) { delete fs; gRPCServerManager->Release(server); return B_NO_MEMORY; } vti->Replace(inode); result = publish_vnode(volume, inode->ID(), vti, &gNFSv4VnodeOps, inode->Type(), 0); if (result != B_OK) return result; *_rootVnodeID = inode->ID(); TRACE("*_rootVnodeID = %" B_PRIi64, inode->ID()); return B_OK; }