Lines Matching refs:mount

79 #define HAS_FS_MOUNT_CALL(mount, op)	(mount->volume->ops->op != NULL)
84 vnode->ops->op(vnode->mount->volume, vnode, params) \
88 vnode->ops->op(vnode->mount->volume, vnode) \
90 # define FS_MOUNT_CALL(mount, op, params...) \
91 ( HAS_FS_MOUNT_CALL(mount, op) ? \
92 mount->volume->ops->op(mount->volume, params) \
94 # define FS_MOUNT_CALL_NO_PARAMS(mount, op) \
95 ( HAS_FS_MOUNT_CALL(mount, op) ? \
96 mount->volume->ops->op(mount->volume) \
100 vnode->ops->op(vnode->mount->volume, vnode, params)
102 vnode->ops->op(vnode->mount->volume, vnode)
103 # define FS_MOUNT_CALL(mount, op, params...) \
104 mount->volume->ops->op(mount->volume, params)
105 # define FS_MOUNT_CALL_NO_PARAMS(mount, op) \
106 mount->volume->ops->op(mount->volume)
126 as the mount is mounted and it is made sure it won't be unmounted
127 (e.g. by holding a reference to a vnode of that mount) (read) access
129 while mounted the mount holds a reference to the root_vnode->covers vnode,
130 and thus making the access path vnode->mount->root_vnode->covers->mount->...
131 safe if a reference to vnode is held (note that for the root mount
140 recursive_lock_init(&rlock, "mount rlock");
215 /*! \brief Guards mount/unmount operations.
233 private_node, mount) to which only read-only access is allowed.
552 fMountID(vnode->mount->id),
647 struct fs_mount* mount = (fs_mount*)_m;
650 if (mount->id == *id)
660 struct fs_mount* mount = (fs_mount*)_m;
663 if (mount)
664 return mount->id % range;
685 struct fs_mount* mount;
690 mount = find_mount(id);
691 if (mount == NULL)
694 struct vnode* rootNode = mount->root_vnode;
696 // might have been called during a mount/unmount operation
700 inc_vnode_ref_count(mount->root_vnode);
701 *_mount = mount;
707 put_mount(struct fs_mount* mount)
709 if (mount)
710 put_vnode(mount->root_vnode);
837 add_vnode_to_mount_list(struct vnode* vnode, struct fs_mount* mount)
839 RecursiveLocker _(mount->rlock);
840 mount->vnodes.Add(vnode);
845 remove_vnode_from_mount_list(struct vnode* vnode, struct fs_mount* mount)
847 RecursiveLocker _(mount->rlock);
848 mount->vnodes.Remove(vnode);
852 /*! \brief Looks up a vnode by mount and node ID in the sVnodeTable.
856 \param mountID the mount ID.
874 /*! Creates a new vnode with the given mount and node ID.
880 \param mountID The mount ID.
918 // get the mount structure
920 vnode->mount = find_mount(mountID);
921 if (!vnode->mount || vnode->mount->unmounting) {
928 // add the vnode to the mount's node list and the hash table
930 add_vnode_to_mount_list(vnode, vnode->mount);
943 it from the vnode hash as well as from its mount structure.
998 remove_vnode_from_mount_list(vnode, vnode->mount);
1098 return create_fifo_vnode(vnode->mount->volume, vnode);
1104 /*! \brief Retrieves a vnode for a given mount ID, node ID pair.
1110 \param mountID the mount ID.
1180 status = FS_MOUNT_CALL(vnode->mount, get_vnode, vnodeID, vnode, &type,
1202 remove_vnode_from_mount_list(vnode, vnode->mount);
1823 replace_vnode_if_disconnected(struct fs_mount* mount,
1835 while (vnode != NULL && vnode->mount == mount
1862 \a mount object.
1872 disconnect_mount_or_vnode_fds(struct fs_mount* mount,
1884 replace_vnode_if_disconnected(mount, vnodeToDisconnect, context->root,
1886 replace_vnode_if_disconnected(mount, vnodeToDisconnect, context->cwd,
1893 // if this descriptor points at this mount, we
1899 } else if ((vnode != NULL && vnode->mount == mount)
1900 || (vnode == NULL && descriptor->u.mount == mount))
1944 Given an arbitrary vnode (identified by mount and node ID), the function
1946 function returns the mount and node ID of the covering vnode. Otherwise
1947 it simply returns the supplied mount and node ID.
1950 for storing the resolved mount and node ID remain untouched and an error
1953 \param mountID The mount ID of the vnode in question.
1955 \param resolvedMountID Pointer to storage for the resolved mount ID.
2077 if (dir->mount->entry_cache.Lookup(dir->id, name, id))
2097 // "%p (%ld, %lld)", dir, dir->mount->id, dir->id, name, *_vnode,
2098 // (*_vnode)->mount->id, (*_vnode)->id);
2795 get_new_fd(int type, struct fs_mount* mount, struct vnode* vnode,
2814 descriptor->u.mount = mount;
2832 // mount types
2972 _dump_mount(struct fs_mount* mount)
2974 kprintf("MOUNT: %p\n", mount);
2975 kprintf(" id: %" B_PRIdDEV "\n", mount->id);
2976 kprintf(" device_name: %s\n", mount->device_name);
2977 kprintf(" root_vnode: %p\n", mount->root_vnode);
2978 kprintf(" covers: %p\n", mount->root_vnode->covers);
2979 kprintf(" partition: %p\n", mount->partition);
2980 kprintf(" lock: %p\n", &mount->rlock);
2981 kprintf(" flags: %s%s\n", mount->unmounting ? " unmounting" : "",
2982 mount->owns_file_device ? " owns_file_device" : "");
2984 fs_volume* volume = mount->volume;
2995 set_debug_variable("_volume", (addr_t)mount->volume->private_volume);
2996 set_debug_variable("_root", (addr_t)mount->root_vnode);
2997 set_debug_variable("_covers", (addr_t)mount->root_vnode->covers);
2998 set_debug_variable("_partition", (addr_t)mount->partition);
3069 const char* name = vnode->mount->entry_cache.DebugReverseLookup(
3074 vnode->mount->id, vnode->id);
3085 struct vnode* nextVnode = lookup_vnode(vnode->mount->id, dirID);
3088 vnode->mount->id, dirID);
3105 kprintf(" mount: %p\n", vnode->mount);
3137 set_debug_variable("_mount", (addr_t)vnode->mount);
3155 struct fs_mount* mount = (fs_mount*)hash_lookup(sMountsTable, (void*)&id);
3156 if (mount == NULL) {
3161 mount = (fs_mount*)val;
3164 _dump_mount(mount);
3182 struct fs_mount* mount;
3185 while ((mount = (struct fs_mount*)hash_next(sMountsTable, &iterator))
3187 kprintf("%p%4" B_PRIdDEV " %p %p %p %s\n", mount, mount->id, mount->root_vnode,
3188 mount->root_vnode->covers, mount->volume->private_volume,
3189 mount->volume->file_system_name);
3191 fs_volume* volume = mount->volume;
3366 ? "mount" : "vnode",
3726 remove_vnode_from_mount_list(vnode, vnode->mount);
3887 return vnode->mount->volume;
3976 // lookup mount -- the caller is required to make sure that the mount
3979 struct fs_mount* mount = find_mount(mountID);
3980 if (mount == NULL)
3984 return mount->entry_cache.Add(dirID, name, nodeID);
3991 // lookup mount -- the caller is required to make sure that the mount
3994 struct fs_mount* mount = find_mount(mountID);
3995 if (mount == NULL)
3999 return mount->entry_cache.Remove(dirID, name);
4126 /*! Looks up a vnode with the given mount and vnode ID.
4157 fs_mount* mount;
4158 status_t status = get_mount(volume->id, &mount);
4165 struct vnode* vnode = mount->root_vnode;
4176 put_mount(mount);
4182 // wrong mount ID - must not gain access on foreign file system nodes
4427 *_createdVnode = lookup_vnode(dirNode->mount->id, nodeID);
4482 disconnect_mount_or_vnode_fds(vnode->mount, vnode);
4995 struct fs_mount* mount = find_mount(mountID);
4996 if (mount == NULL)
4999 Vnode* mountPoint = mount->covers_vnode;
5030 || vnode->mount->unmounting || coveredVnode->mount->unmounting) {
5154 add_debugger_command("mount", &dump_mount,
5214 // the node the entry refers to (e.g. in case of mount points or FIFOs). So
5287 "mount ID %" B_PRIdDEV "!\n", directory->device);
6204 if (directory->mount != vnode->mount) {
6785 struct fs_mount* mount;
6790 status_t status = get_mount(mountID, &mount);
6794 if (!HAS_FS_MOUNT_CALL(mount, open_index_dir)) {
6799 status = FS_MOUNT_CALL(mount, open_index_dir, &cookie);
6805 fd = get_new_fd(FDTYPE_INDEX_DIR, mount, NULL, cookie, O_CLOEXEC, kernel);
6810 FS_MOUNT_CALL(mount, close_index_dir, cookie);
6811 FS_MOUNT_CALL(mount, free_index_dir_cookie, cookie);
6816 put_mount(mount);
6824 struct fs_mount* mount = descriptor->u.mount;
6828 if (HAS_FS_MOUNT_CALL(mount, close_index_dir))
6829 return FS_MOUNT_CALL(mount, close_index_dir, descriptor->cookie);
6838 struct fs_mount* mount = descriptor->u.mount;
6840 if (mount != NULL) {
6841 FS_MOUNT_CALL(mount, free_index_dir_cookie, descriptor->cookie);
6842 put_mount(mount);
6851 struct fs_mount* mount = descriptor->u.mount;
6853 if (HAS_FS_MOUNT_CALL(mount, read_index_dir)) {
6854 return FS_MOUNT_CALL(mount, read_index_dir, descriptor->cookie, buffer,
6865 struct fs_mount* mount = descriptor->u.mount;
6867 if (HAS_FS_MOUNT_CALL(mount, rewind_index_dir))
6868 return FS_MOUNT_CALL(mount, rewind_index_dir, descriptor->cookie);
6881 struct fs_mount* mount;
6882 status_t status = get_mount(mountID, &mount);
6886 if (!HAS_FS_MOUNT_CALL(mount, create_index)) {
6891 status = FS_MOUNT_CALL(mount, create_index, name, type, flags);
6894 put_mount(mount);
6935 struct fs_mount* mount;
6936 status_t status = get_mount(mountID, &mount);
6940 if (!HAS_FS_MOUNT_CALL(mount, read_index_stat)) {
6945 status = FS_MOUNT_CALL(mount, read_index_stat, name, stat);
6948 put_mount(mount);
6959 struct fs_mount* mount;
6960 status_t status = get_mount(mountID, &mount);
6964 if (!HAS_FS_MOUNT_CALL(mount, remove_index)) {
6969 status = FS_MOUNT_CALL(mount, remove_index, name);
6972 put_mount(mount);
6986 struct fs_mount* mount;
6992 status_t status = get_mount(device, &mount);
6996 if (!HAS_FS_MOUNT_CALL(mount, open_query)) {
7001 status = FS_MOUNT_CALL(mount, open_query, query, flags, port, token,
7008 fd = get_new_fd(FDTYPE_QUERY, mount, NULL, cookie, O_CLOEXEC, kernel);
7015 FS_MOUNT_CALL(mount, close_query, cookie);
7016 FS_MOUNT_CALL(mount, free_query_cookie, cookie);
7019 put_mount(mount);
7027 struct fs_mount* mount = descriptor->u.mount;
7031 if (HAS_FS_MOUNT_CALL(mount, close_query))
7032 return FS_MOUNT_CALL(mount, close_query, descriptor->cookie);
7041 struct fs_mount* mount = descriptor->u.mount;
7043 if (mount != NULL) {
7044 FS_MOUNT_CALL(mount, free_query_cookie, descriptor->cookie);
7045 put_mount(mount);
7054 struct fs_mount* mount = descriptor->u.mount;
7056 if (HAS_FS_MOUNT_CALL(mount, read_query)) {
7057 return FS_MOUNT_CALL(mount, read_query, descriptor->cookie, buffer,
7068 struct fs_mount* mount = descriptor->u.mount;
7070 if (HAS_FS_MOUNT_CALL(mount, rewind_query))
7071 return FS_MOUNT_CALL(mount, rewind_query, descriptor->cookie);
7084 struct ::fs_mount* mount;
7201 mount = new(std::nothrow) (struct ::fs_mount);
7202 if (mount == NULL)
7205 mount->device_name = strdup(device);
7208 status = mount->entry_cache.Init();
7213 mount->id = sNextMountID++;
7214 mount->partition = NULL;
7215 mount->root_vnode = NULL;
7216 mount->covers_vnode = NULL;
7217 mount->unmounting = false;
7218 mount->owns_file_device = false;
7219 mount->volume = NULL;
7240 volume->id = mount->id;
7267 if (mount->volume == NULL)
7268 mount->volume = volume;
7270 volume->super_volume = mount->volume;
7271 mount->volume->sub_volume = volume;
7272 mount->volume = volume;
7276 // insert mount struct into list before we call FS's mount() function
7277 // so that vnodes can be created for this mount
7279 hash_insert(sMountsTable, mount);
7291 status = mount->volume->file_system->mount(mount->volume, device, flags,
7300 mount->covers_vnode = coveredNode;
7314 // mount it/them
7315 fs_volume* volume = mount->volume;
7317 status = volume->file_system->mount(volume, device, flags, args,
7328 volume = mount->volume;
7338 mount->root_vnode = lookup_vnode(mount->id, rootID);
7339 if (mount->root_vnode == NULL || mount->root_vnode->ref_count != 1) {
7355 mount->root_vnode->covers = coveredNode;
7356 mount->root_vnode->SetCovering(true);
7358 coveredNode->covered_by = mount->root_vnode;
7364 sRoot = mount->root_vnode;
7371 // supply the partition (if any) with the mount cookie and mark it mounted
7373 partition->SetMountCookie(mount->volume->private_volume);
7374 partition->SetVolumeID(mount->id);
7378 mount->partition = partition;
7379 mount->owns_file_device = newlyCreatedFileDevice;
7383 notify_mount(mount->id,
7387 return mount->id;
7390 FS_MOUNT_CALL_NO_PARAMS(mount, unmount);
7396 hash_remove(sMountsTable, mount);
7399 delete mount;
7408 struct fs_mount* mount;
7426 mount = find_mount(path != NULL ? pathVnode->device : mountID);
7428 if (mount == NULL) {
7429 panic("fs_unmount: find_mount() failed on root vnode @%p of mount\n",
7436 if (mount->root_vnode != pathVnode) {
7445 KPartition* partition = mount->partition;
7477 // cycle through the list of vnodes associated with this mount and
7479 VnodeList::Iterator iterator = mount->vnodes.GetIterator();
7495 // there are still vnodes in use on this mount, so we cannot
7521 mount->unmounting = true;
7526 disconnect_mount_or_vnode_fds(mount, NULL);
7532 // We can safely continue. Mark all of the vnodes busy and this mount
7535 mount->unmounting = true;
7537 VnodeList::Iterator iterator = mount->vnodes.GetIterator();
7563 if (coveredNode->mount == mount) {
7577 if (coveringNode->mount == mount) {
7589 // Free all vnodes associated with this mount.
7590 // They will be removed from the mount list by free_vnode(), so
7592 while (struct vnode* vnode = mount->vnodes.Head()) {
7602 // remove the mount structure from the hash table
7604 hash_remove(sMountsTable, mount);
7609 FS_MOUNT_CALL_NO_PARAMS(mount, unmount);
7610 notify_unmount(mount->id);
7617 if (mount->owns_file_device)
7622 delete mount;
7630 struct fs_mount* mount;
7631 status_t status = get_mount(device, &mount);
7652 recursive_lock_lock(&mount->rlock);
7656 vnode = mount->vnodes.GetNext(&marker);
7657 mount->vnodes.Remove(&marker);
7660 vnode = mount->vnodes.First();
7666 vnode = mount->vnodes.GetNext(vnode);
7671 mount->vnodes.Insert(mount->vnodes.GetNext(vnode), &marker);
7675 recursive_lock_unlock(&mount->rlock);
7680 vnode = lookup_vnode(mount->id, vnode->id);
7700 if (HAS_FS_MOUNT_CALL(mount, sync))
7701 status = FS_MOUNT_CALL_NO_PARAMS(mount, sync);
7703 put_mount(mount);
7711 struct fs_mount* mount;
7712 status_t status = get_mount(device, &mount);
7718 if (HAS_FS_MOUNT_CALL(mount, read_fs_info))
7719 status = FS_MOUNT_CALL(mount, read_fs_info, info);
7723 info->dev = mount->id;
7724 info->root = mount->root_vnode->id;
7726 fs_volume* volume = mount->volume;
7732 if (mount->device_name != NULL) {
7733 strlcpy(info->device_name, mount->device_name,
7741 put_mount(mount);
7749 struct fs_mount* mount;
7750 status_t status = get_mount(device, &mount);
7754 if (HAS_FS_MOUNT_CALL(mount, write_fs_info))
7755 status = FS_MOUNT_CALL(mount, write_fs_info, info, mask);
7759 put_mount(mount);
7767 struct fs_mount* mount = NULL;
7778 mount = find_mount(device++);
7779 if (mount != NULL && mount->volume->private_volume != NULL)
7785 if (mount != NULL)
7786 device = mount->id;
7987 } else if (descriptor->u.mount != NULL) {
7988 info->device = descriptor->u.mount->id;
9202 put_vnode(dir->mount->volume, nodeID);
9225 status = get_vnode(sRoot->mount->id, nodeID, &vnode, true, false);
9229 "%" B_PRIdINO ")\n", sRoot->mount->id, sRoot->id);