Changeset 10e4cd7 in mainline
- Timestamp:
- 2011-11-03T21:45:35Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 76a67ce
- Parents:
- 3ce78580
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r3ce78580 r10e4cd7 35 35 #include <vfs/canonify.h> 36 36 #include <vfs/vfs.h> 37 #include <vfs/vfs_mtab.h> 37 38 #include <vfs/vfs_sess.h> 38 39 #include <macros.h> … … 831 832 } 832 833 834 int get_mtab_list(list_t *mtab_list) 835 { 836 sysarg_t rc; 837 size_t i; 838 size_t num_mounted_fs; 839 840 async_exch_t *exch = vfs_exchange_begin(); 841 842 rc = async_req_0_0(exch, VFS_IN_GET_MTAB); 843 if (rc != EOK) 844 goto exit; 845 846 /* Ask VFS how many filesystems are mounted */ 847 rc = async_req_0_1(exch, VFS_IN_PING, &num_mounted_fs); 848 if (rc != EOK) 849 goto exit; 850 851 for (i = 0; i < num_mounted_fs; ++i) { 852 mtab_list_ent_t *mtab_list_ent; 853 mtab_ent_t *mtab_ent; 854 855 mtab_list_ent = malloc(sizeof(mtab_list_ent_t)); 856 if (!mtab_list_ent) { 857 rc = ENOMEM; 858 goto exit; 859 } 860 861 mtab_ent = &mtab_list_ent->mtab_ent; 862 863 rc = async_data_read_start(exch, (void *) &mtab_ent->mp, 864 MAX_PATH_LEN); 865 if (rc != EOK) 866 goto exit; 867 868 rc = async_data_read_start(exch, (void *) &mtab_ent->opts, 869 MAX_MNTOPTS_LEN); 870 if (rc != EOK) 871 goto exit; 872 873 rc = async_data_read_start(exch, (void *) &mtab_ent->fs_name, 874 FS_NAME_MAXLEN); 875 if (rc != EOK) 876 goto exit; 877 878 sysarg_t p[3]; 879 int j; 880 881 for (j = 0; j < 3; ++j) { 882 rc = async_req_0_1(exch, VFS_IN_PING, &p[j]); 883 if (rc != EOK) 884 goto exit; 885 } 886 887 mtab_ent->flags = p[0]; 888 mtab_ent->instance = p[1]; 889 mtab_ent->fs_handle = p[2]; 890 891 link_initialize(&mtab_list_ent->link); 892 list_append(&mtab_list_ent->link, mtab_list); 893 } 894 895 exit: 896 vfs_exchange_end(exch); 897 return rc; 898 } 899 833 900 /** @} 834 901 */ -
uspace/lib/c/include/ipc/vfs.h
r3ce78580 r10e4cd7 42 42 #define FS_NAME_MAXLEN 20 43 43 #define MAX_PATH_LEN (64 * 1024) 44 #define MAX_MNTOPTS_LEN 256 44 45 #define PLB_SIZE (2 * MAX_PATH_LEN) 45 46 … … 80 81 VFS_IN_DUP, 81 82 VFS_IN_WAIT_HANDLE, 83 VFS_IN_GET_MTAB, 82 84 } vfs_in_request_t; 83 85 -
uspace/lib/c/include/vfs/vfs.h
r3ce78580 r10e4cd7 39 39 #include <ipc/vfs.h> 40 40 #include <ipc/loc.h> 41 #include <adt/list.h> 41 42 #include <stdio.h> 42 43 #include <async.h> … … 55 56 56 57 extern int fd_wait(void); 58 extern int get_mtab_list(list_t *mtab_list); 57 59 58 60 extern async_exch_t *vfs_exchange_begin(void); -
uspace/srv/vfs/vfs.c
r3ce78580 r10e4cd7 127 127 vfs_wait_handle(callid, &call); 128 128 break; 129 case VFS_IN_GET_MTAB: 130 //vfs_get_mounted_fs_info(callid, &call); 131 break; 129 132 default: 130 133 async_answer_0(callid, ENOTSUP); -
uspace/srv/vfs/vfs.h
r3ce78580 r10e4cd7 150 150 extern list_t fs_list; /**< List of registered file systems. */ 151 151 152 extern fibril_mutex_t fs_mntlist_lock; 153 extern list_t fs_mntlist; /**< List of mounted file systems. */ 154 152 155 extern vfs_pair_t rootfs; /**< Root file system. */ 153 156 … … 162 165 extern uint8_t *plb; /**< Path Lookup Buffer */ 163 166 extern list_t plb_entries; /**< List of active PLB entries. */ 164 165 #define MAX_MNTOPTS_LEN 256166 167 167 168 /** Holding this rwlock prevents changes in file system namespace. */ -
uspace/srv/vfs/vfs_ops.c
r3ce78580 r10e4cd7 52 52 #include <assert.h> 53 53 #include <vfs/canonify.h> 54 #include <vfs/vfs_mtab.h> 55 56 FIBRIL_MUTEX_INITIALIZE(mtab_list_lock); 57 LIST_INITIALIZE(mtab_list); 58 static size_t mtab_size = 0; 54 59 55 60 /* Forward declarations of static functions. */ … … 353 358 fibril_mutex_unlock(&fs_list_lock); 354 359 360 /* Do the mount */ 361 vfs_mount_internal(rid, service_id, fs_handle, mp, opts); 362 363 /* Add the filesystem info to the list of mounted filesystems */ 364 mtab_list_ent_t *mtab_list_ent = malloc(sizeof(mtab_list_ent_t)); 365 if (!mtab_list_ent) { 366 async_answer_0(callid, ENOMEM); 367 async_answer_0(rid, ENOMEM); 368 free(mp); 369 free(fs_name); 370 free(opts); 371 return; 372 } 373 374 mtab_ent_t *mtab_ent = &mtab_list_ent->mtab_ent; 375 376 mtab_ent->fs_handle = fs_handle; 377 str_cpy(mtab_ent->mp, MAX_PATH_LEN, mp); 378 str_cpy(mtab_ent->fs_name, FS_NAME_MAXLEN, fs_name); 379 str_cpy(mtab_ent->opts, MAX_MNTOPTS_LEN, opts); 380 mtab_ent->flags = flags; 381 mtab_ent->instance = instance; 382 383 link_initialize(&mtab_list_ent->link); 384 385 fibril_mutex_lock(&mtab_list_lock); 386 list_append(&mtab_list_ent->link, &mtab_list); 387 mtab_size++; 388 fibril_mutex_unlock(&mtab_list_lock); 389 390 free(mp); 391 355 392 /* Acknowledge that we know fs_name. */ 356 393 async_answer_0(callid, EOK); 357 358 /* Do the mount */359 vfs_mount_internal(rid, service_id, fs_handle, mp, opts);360 free(mp);361 free(fs_name);362 free(opts);363 394 } 364 395
Note:
See TracChangeset
for help on using the changeset viewer.