Changes in / [ce8c848:64af8f1] in mainline


Ignore:
Location:
uspace
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/include/ipc/vfs.h

    rce8c848 r64af8f1  
    101101 * No lookup flags used.
    102102 */
    103 #define L_NONE                  0
     103#define L_NONE  0
    104104
    105105/**
     
    108108 * with L_DIRECTORY.
    109109 */
    110 #define L_FILE                  1
     110#define L_FILE  1
    111111
    112112/**
    113  * Lookup will succeed only if the object is a directory. If L_CREATE is
     113 * Lookup wil succeed only if the object is a directory. If L_CREATE is
    114114 * specified, an empty directory will be created. This flag is mutually
    115115 * exclusive with L_FILE.
    116116 */
    117 #define L_DIRECTORY             2
    118 
    119 /**
    120  * Lookup will succeed only if the object is a root directory. The flag is
    121  * mutually exclusive with L_FILE and L_MP.
    122  */
    123 #define L_ROOT                  4
    124 
    125 /**
    126  * Lookup will succeed only if the object is a mount point. The flag is mutually
    127  * exclusive with L_FILE and L_ROOT.
    128  */
    129 #define L_MP                    8
    130 
     117#define L_DIRECTORY  2
    131118
    132119/**
     
    134121 * object already exists. L_EXCLUSIVE is implied when L_DIRECTORY is used.
    135122 */
    136 #define L_EXCLUSIVE             16
     123#define L_EXCLUSIVE  4
    137124
    138125/**
    139126 * L_CREATE is used for creating both regular files and directories.
    140127 */
    141 #define L_CREATE                32
     128#define L_CREATE  8
    142129
    143130/**
    144131 * L_LINK is used for linking to an already existing nodes.
    145132 */
    146 #define L_LINK                  64
     133#define L_LINK  16
    147134
    148135/**
     
    151138 * VFS_UNLINK.
    152139 */
    153 #define L_UNLINK                128
     140#define L_UNLINK  32
    154141
    155142/**
     
    159146 * client.
    160147 */
    161 #define L_OPEN                  256
     148#define L_OPEN  64
     149
     150/**
     151 * L_NOCROSS_LAST_MP is used exclusively during the VFS_IN_UNMOUNT operation. It
     152 * tells the lookup routine not to cross the last mount point in the lookup
     153 * path.
     154 */
     155#define L_NOCROSS_LAST_MP       128
    162156
    163157#endif
  • uspace/lib/libfs/libfs.c

    rce8c848 r64af8f1  
    224224        ipc_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
    225225            IPC_GET_ARG3(answer));
    226 }
    227 
    228 void libfs_unmount(libfs_ops_t *ops, ipc_callid_t rid, ipc_call_t *request)
    229 {
    230         dev_handle_t mp_dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
    231         fs_index_t mp_fs_index = (fs_index_t) IPC_GET_ARG2(*request);
    232         fs_node_t *fn;
    233         int res;
    234 
    235         res = ops->node_get(&fn, mp_dev_handle, mp_fs_index);
    236         if ((res != EOK) || (!fn)) {
    237                 ipc_answer_0(rid, combine_rc(res, ENOENT));
    238                 return;
    239         }
    240 
    241         /*
    242          * We are clearly expecting to find the mount point active.
    243          */
    244         if (!fn->mp_data.mp_active) {
    245                 (void) ops->node_put(fn);
    246                 ipc_answer_0(rid, EINVAL);
    247                 return;
    248         }
    249 
    250         /*
    251          * Tell the mounted file system to unmount.
    252          */
    253         res = async_req_1_0(fn->mp_data.phone, VFS_OUT_UNMOUNTED,
    254             fn->mp_data.dev_handle);
    255 
    256         /*
    257          * If everything went well, perform the clean-up on our side.
    258          */
    259         if (res == EOK) {
    260                 ipc_hangup(fn->mp_data.phone);
    261                 fn->mp_data.mp_active = false;
    262                 fn->mp_data.fs_handle = 0;
    263                 fn->mp_data.dev_handle = 0;
    264                 fn->mp_data.phone = 0;
    265                 /* Drop the reference created in libfs_mount(). */
    266                 (void) ops->node_put(fn);
    267         }
    268 
    269         (void) ops->node_put(fn);
    270         ipc_answer_0(rid, res);
    271226}
    272227
     
    360315
    361316                if ((tmp) && (tmp->mp_data.mp_active) &&
    362                     (!(lflag & L_MP) || (next <= last))) {
     317                    (!(lflag & L_NOCROSS_LAST_MP) || (next <= last))) {
    363318                        if (next > last)
    364319                                next = last = first;
     
    531486                goto out;
    532487        }
    533 
    534         if ((lflag & L_ROOT) && par) {
    535                 ipc_answer_0(rid, EINVAL);
    536                 goto out;
    537         }
    538488       
    539489out_with_answer:
  • uspace/lib/libfs/libfs.h

    rce8c848 r64af8f1  
    9595
    9696extern void libfs_mount(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
    97 extern void libfs_unmount(libfs_ops_t *, ipc_callid_t, ipc_call_t *);
    9897extern void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
    9998extern void libfs_stat(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
  • uspace/srv/fs/devfs/devfs.c

    rce8c848 r64af8f1  
    7575                        devfs_mount(callid, &call);
    7676                        break;
    77                 case VFS_OUT_UNMOUNTED:
    78                         devfs_unmounted(callid, &call);
    79                         break;
    80                 case VFS_OUT_UNMOUNT:
    81                         devfs_unmount(callid, &call);
    82                         break;
    8377                case VFS_OUT_LOOKUP:
    8478                        devfs_lookup(callid, &call);
  • uspace/srv/fs/devfs/devfs_ops.c

    rce8c848 r64af8f1  
    434434}
    435435
    436 void devfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    437 {
    438         ipc_answer_0(rid, ENOTSUP);
    439 }
    440 
    441 void devfs_unmount(ipc_callid_t rid, ipc_call_t *request)
    442 {
    443         libfs_unmount(&devfs_libfs_ops, rid, request);
    444 }
    445 
    446436void devfs_lookup(ipc_callid_t rid, ipc_call_t *request)
    447437{
  • uspace/srv/fs/devfs/devfs_ops.h

    rce8c848 r64af8f1  
    4141extern void devfs_mounted(ipc_callid_t, ipc_call_t *);
    4242extern void devfs_mount(ipc_callid_t, ipc_call_t *);
    43 extern void devfs_unmounted(ipc_callid_t, ipc_call_t *);
    44 extern void devfs_unmount(ipc_callid_t, ipc_call_t *);
    4543extern void devfs_lookup(ipc_callid_t, ipc_call_t *);
    4644extern void devfs_open_node(ipc_callid_t, ipc_call_t *);
  • uspace/srv/fs/fat/fat.c

    rce8c848 r64af8f1  
    100100                        fat_mount(callid, &call);
    101101                        break;
    102                 case VFS_OUT_UNMOUNTED:
    103                         fat_unmounted(callid, &call);
    104                         break;
    105                 case VFS_OUT_UNMOUNT:
    106                         fat_unmount(callid, &call);
    107                         break;
    108102                case VFS_OUT_LOOKUP:
    109103                        fat_lookup(callid, &call);
  • uspace/srv/fs/fat/fat.h

    rce8c848 r64af8f1  
    204204extern void fat_mounted(ipc_callid_t, ipc_call_t *);
    205205extern void fat_mount(ipc_callid_t, ipc_call_t *);
    206 extern void fat_unmounted(ipc_callid_t, ipc_call_t *);
    207 extern void fat_unmount(ipc_callid_t, ipc_call_t *);
    208206extern void fat_lookup(ipc_callid_t, ipc_call_t *);
    209207extern void fat_read(ipc_callid_t, ipc_call_t *);
  • uspace/srv/fs/fat/fat_ops.c

    rce8c848 r64af8f1  
    11171117}
    11181118
    1119 void fat_unmounted(ipc_callid_t rid, ipc_call_t *request)
    1120 {
    1121         ipc_answer_0(rid, ENOTSUP);
    1122 }
    1123 
    1124 void fat_unmount(ipc_callid_t rid, ipc_call_t *request)
    1125 {
    1126         libfs_unmount(&fat_libfs_ops, rid, request);
    1127 }
    1128 
    11291119void fat_lookup(ipc_callid_t rid, ipc_call_t *request)
    11301120{
  • uspace/srv/fs/tmpfs/tmpfs.c

    rce8c848 r64af8f1  
    106106                        tmpfs_mount(callid, &call);
    107107                        break;
    108                 case VFS_OUT_UNMOUNTED:
    109                         tmpfs_unmounted(callid, &call);
    110                         break;
    111                 case VFS_OUT_UNMOUNT:
    112                         tmpfs_unmount(callid, &call);
    113                         break;
    114108                case VFS_OUT_LOOKUP:
    115109                        tmpfs_lookup(callid, &call);
  • uspace/srv/fs/tmpfs/tmpfs.h

    rce8c848 r64af8f1  
    8383extern void tmpfs_mounted(ipc_callid_t, ipc_call_t *);
    8484extern void tmpfs_mount(ipc_callid_t, ipc_call_t *);
    85 extern void tmpfs_unmounted(ipc_callid_t, ipc_call_t *);
    86 extern void tmpfs_unmount(ipc_callid_t, ipc_call_t *);
    8785extern void tmpfs_lookup(ipc_callid_t, ipc_call_t *);
    8886extern void tmpfs_read(ipc_callid_t, ipc_call_t *);
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    rce8c848 r64af8f1  
    449449}
    450450
    451 void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    452 {
    453         ipc_answer_0(rid, ENOTSUP);
    454 }
    455 
    456 void tmpfs_unmount(ipc_callid_t rid, ipc_call_t *request)
    457 {
    458         libfs_unmount(&tmpfs_libfs_ops, rid, request);
    459 }
    460 
    461451void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
    462452{
  • uspace/srv/vfs/vfs_ops.c

    rce8c848 r64af8f1  
    9292                }
    9393               
    94                 rc = vfs_lookup_internal(mp, L_MP, &mp_res, NULL);
     94                rc = vfs_lookup_internal(mp, L_DIRECTORY, &mp_res, NULL);
    9595                if (rc != EOK) {
    9696                        /* The lookup failed for some reason. */
     
    459459         * Lookup the mounted root and instantiate it.
    460460         */
    461         rc = vfs_lookup_internal(mp, L_ROOT, &mr_res, NULL);
     461        rc = vfs_lookup_internal(mp, L_NONE, &mr_res, NULL);
    462462        if (rc != EOK) {
    463463                fibril_rwlock_write_unlock(&namespace_rwlock);
     
    521521                 */
    522522
    523                 rc = vfs_lookup_internal(mp, L_MP, &mp_res, NULL);
     523                /*
     524                 * The L_NOCROSS_LAST_MP flag is essential if we really want to
     525                 * lookup the mount point and not the mounted root.
     526                 */
     527                rc = vfs_lookup_internal(mp, L_NOCROSS_LAST_MP, &mp_res, NULL);
    524528                free(mp);
    525529                if (rc != EOK) {
     
    538542
    539543                phone = vfs_grab_phone(mp_node->fs_handle);
    540                 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->dev_handle,
    541                     mp_node->index);
     544                rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->fs_handle,
     545                    mp_node->dev_handle);
    542546                vfs_release_phone(phone);
    543547                if (rc != EOK) {
     
    591595        /*
    592596         * Make sure that we are called with exactly one of L_FILE and
    593          * L_DIRECTORY. Make sure that the user does not pass L_OPEN,
    594          * L_ROOT or L_MP.
     597         * L_DIRECTORY. Make sure that the user does not pass L_OPEN or
     598         * L_NOCROSS_LAST_MP.
    595599         */
    596600        if (((lflag & (L_FILE | L_DIRECTORY)) == 0) ||
    597601            ((lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) ||
    598             (lflag & (L_OPEN | L_ROOT | L_MP))) {
     602            (lflag & L_OPEN) || (lflag & L_NOCROSS_LAST_MP)) {
    599603                ipc_answer_0(rid, EINVAL);
    600604                return;
Note: See TracChangeset for help on using the changeset viewer.