Changeset 5ab597d in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2008-08-22T19:44:52Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
be8f92d
Parents:
2e4bd1f
Message:

Add reference to the mounted FS root.

This makes it possible to keep the FS root logically unlinked (i.e. lnkcnt == 0)
because it prevents VFS from attempting to destroy it during closedir().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r2e4bd1f r5ab597d  
    206206                /* We still don't have the root file system mounted. */
    207207                if ((size == 1) && (buf[0] == '/')) {
     208                        vfs_lookup_res_t mr_res;
     209                        vfs_node_t *mr_node;
     210                        ipcarg_t rindex;
     211                        ipcarg_t rsize;
     212                        ipcarg_t rlnkcnt;
     213               
    208214                        /*
    209215                         * For this simple, but important case,
     
    214220                        /* Tell the mountee that it is being mounted. */
    215221                        phone = vfs_grab_phone(fs_handle);
    216                         rc = async_req_1_0(phone, VFS_MOUNTED,
    217                             (ipcarg_t) dev_handle);
     222                        rc = async_req_1_3(phone, VFS_MOUNTED,
     223                            (ipcarg_t) dev_handle, &rindex, &rsize, &rlnkcnt);
    218224                        vfs_release_phone(phone);
    219 
    220                         if (rc == EOK) {
    221                                 rootfs.fs_handle = fs_handle;
    222                                 rootfs.dev_handle = dev_handle;
     225                       
     226                        if (rc != EOK) {
     227                                futex_up(&rootfs_futex);
     228                                ipc_answer_0(rid, rc);
     229                                return;
    223230                        }
    224231
     232                        mr_res.triplet.fs_handle = fs_handle;
     233                        mr_res.triplet.dev_handle = dev_handle;
     234                        mr_res.triplet.index = (fs_index_t) rindex;
     235                        mr_res.size = (size_t) rsize;
     236                        mr_res.lnkcnt = (unsigned) rlnkcnt;
     237
     238                        rootfs.fs_handle = fs_handle;
     239                        rootfs.dev_handle = dev_handle;
    225240                        futex_up(&rootfs_futex);
     241
     242                        /* Add reference to the mounted root. */
     243                        mr_node = vfs_node_get(&mr_res);
     244                        assert(mr_node);
     245
    226246                        ipc_answer_0(rid, rc);
    227247                        return;
Note: See TracChangeset for help on using the changeset viewer.