Changeset d2c8533 in mainline for uspace/srv/vfs


Ignore:
Timestamp:
2017-05-08T20:38:47Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f066a87
Parents:
582a0b8
Message:

File system probing groundwork. Only MFS can do it for now.

Location:
uspace/srv/vfs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    r582a0b8 rd2c8533  
    206206
    207207extern int vfs_op_clone(int oldfd, int newfd, bool desc);
     208extern int vfs_op_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
    208209extern int vfs_op_mount(int mpfd, unsigned servid, unsigned flags, unsigned instance, const char *opts, const char *fsname, int *outfd);
    209210extern int vfs_op_mtab_get(void);
  • uspace/srv/vfs/vfs_ipc.c

    r582a0b8 rd2c8533  
    4545}
    4646
     47static void vfs_in_fsprobe(ipc_callid_t rid, ipc_call_t *request)
     48{
     49        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
     50        char *fs_name = NULL;
     51        ipc_callid_t callid;
     52        vfs_fs_probe_info_t info;
     53        size_t len;
     54        int rc;
     55       
     56        /*
     57         * Now we expect the client to send us data with the name of the file
     58         * system.
     59         */
     60        rc = async_data_write_accept((void **) &fs_name, true, 0,
     61            FS_NAME_MAXLEN, 0, NULL);
     62        if (rc != EOK) {
     63                async_answer_0(rid, rc);
     64                return;
     65        }
     66       
     67        rc = vfs_op_fsprobe(fs_name, service_id, &info);
     68        async_answer_0(rid, rc);
     69        if (rc != EOK)
     70                goto out;
     71       
     72        /* Now we should get a read request */
     73        if (!async_data_read_receive(&callid, &len))
     74                goto out;
     75
     76        if (len > sizeof(info))
     77                len = sizeof(info);
     78        (void) async_data_read_finalize(callid, &info, len);
     79
     80out:
     81        free(fs_name);
     82}
     83
    4784static void vfs_in_fstypes(ipc_callid_t rid, ipc_call_t *request)
    4885{
     
    297334                        vfs_in_clone(callid, &call);
    298335                        break;
     336                case VFS_IN_FSPROBE:
     337                        vfs_in_fsprobe(callid, &call);
     338                        break;
    299339                case VFS_IN_FSTYPES:
    300340                        vfs_in_fstypes(callid, &call);
  • uspace/srv/vfs/vfs_ops.c

    r582a0b8 rd2c8533  
    190190}
    191191
     192int vfs_op_fsprobe(const char *fs_name, service_id_t sid,
     193    vfs_fs_probe_info_t *info)
     194{
     195        fs_handle_t fs_handle = 0;
     196        sysarg_t rc;
     197        int retval;
     198       
     199        fibril_mutex_lock(&fs_list_lock);
     200        fs_handle = fs_name_to_handle(0, fs_name, false);
     201        fibril_mutex_unlock(&fs_list_lock);
     202       
     203        if (fs_handle == 0)
     204                return ENOFS;
     205       
     206        /* Send probe request to the file system server */
     207        ipc_call_t answer;
     208        async_exch_t *exch = vfs_exchange_grab(fs_handle);
     209        aid_t msg = async_send_1(exch, VFS_OUT_FSPROBE, (sysarg_t) sid,
     210            &answer);
     211        if (msg == 0)
     212                return EINVAL;
     213       
     214        /* Read probe information */
     215        retval = async_data_read_start(exch, info, sizeof(*info));
     216        if (retval != EOK) {
     217                async_forget(msg);
     218                return retval;
     219        }
     220       
     221        async_wait_for(msg, &rc);
     222        vfs_exchange_release(exch);
     223        return rc;
     224}
     225
    192226int vfs_op_mount(int mpfd, unsigned service_id, unsigned flags,
    193227    unsigned instance, const char *opts, const char *fs_name, int *outfd)
Note: See TracChangeset for help on using the changeset viewer.