Changeset 35b7d86e in mainline
- Timestamp:
- 2017-03-13T20:33:06Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8ffedd8
- Parents:
- ea56098
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mount/mount.c
rea56098 r35b7d86e 32 32 #include <str_error.h> 33 33 #include <vfs/vfs.h> 34 #include <vfs/vfs_mtab.h> 34 35 #include <adt/list.h> 35 36 #include <errno.h> -
uspace/app/df/df.c
rea56098 r35b7d86e 44 44 #include <adt/list.h> 45 45 #include <vfs/vfs.h> 46 #include <vfs/vfs_mtab.h> 46 47 47 48 #define NAME "df" -
uspace/lib/c/generic/vfs/vfs.c
rea56098 r35b7d86e 1106 1106 int vfs_get_mtab_list(list_t *mtab_list) 1107 1107 { 1108 sysarg_t rc; 1109 aid_t req; 1110 size_t i; 1111 sysarg_t num_mounted_fs; 1112 1113 async_exch_t *exch = vfs_exchange_begin(); 1114 1115 req = async_send_0(exch, VFS_IN_MTAB_GET, NULL); 1116 1117 /* Ask VFS how many filesystems are mounted */ 1118 rc = async_req_0_1(exch, VFS_IN_PING, &num_mounted_fs); 1119 if (rc != EOK) 1120 goto exit; 1121 1122 for (i = 0; i < num_mounted_fs; ++i) { 1123 mtab_ent_t *mtab_ent; 1124 1125 mtab_ent = malloc(sizeof(mtab_ent_t)); 1126 if (mtab_ent == NULL) { 1127 rc = ENOMEM; 1128 goto exit; 1129 } 1130 1131 memset(mtab_ent, 0, sizeof(mtab_ent_t)); 1132 1133 rc = async_data_read_start(exch, (void *) mtab_ent->mp, 1134 MAX_PATH_LEN); 1135 if (rc != EOK) 1136 goto exit; 1137 1138 rc = async_data_read_start(exch, (void *) mtab_ent->opts, 1139 MAX_MNTOPTS_LEN); 1140 if (rc != EOK) 1141 goto exit; 1142 1143 rc = async_data_read_start(exch, (void *) mtab_ent->fs_name, 1144 FS_NAME_MAXLEN); 1145 if (rc != EOK) 1146 goto exit; 1147 1148 sysarg_t p[2]; 1149 1150 rc = async_req_0_2(exch, VFS_IN_PING, &p[0], &p[1]); 1151 if (rc != EOK) 1152 goto exit; 1153 1154 mtab_ent->instance = p[0]; 1155 mtab_ent->service_id = p[1]; 1156 1157 link_initialize(&mtab_ent->link); 1158 list_append(&mtab_ent->link, mtab_list); 1159 } 1160 1161 exit: 1162 async_wait_for(req, &rc); 1163 vfs_exchange_end(exch); 1108 sysarg_t rc = ENOTSUP; 1109 1164 1110 return rc; 1165 1111 } -
uspace/lib/c/include/ipc/vfs.h
rea56098 r35b7d86e 69 69 VFS_IN_FSTAT, 70 70 VFS_IN_CLOSE, 71 VFS_IN_PING,72 71 VFS_IN_MOUNT, 73 72 VFS_IN_UNMOUNT, … … 78 77 VFS_IN_DUP, 79 78 VFS_IN_WAIT_HANDLE, 80 VFS_IN_MTAB_GET,81 79 VFS_IN_STATFS, 82 80 VFS_IN_WALK, -
uspace/lib/c/include/vfs/vfs.h
rea56098 r35b7d86e 42 42 #include <stdio.h> 43 43 #include <async.h> 44 #include "vfs_mtab.h"45 46 44 47 45 enum vfs_change_state_type { 48 46 VFS_PASS_HANDLE 49 47 }; 50 51 48 52 49 extern char *vfs_absolutize(const char *, size_t *); -
uspace/srv/vfs/vfs_ipc.c
rea56098 r35b7d86e 110 110 } 111 111 112 static void vfs_in_mtab_get(ipc_callid_t rid, ipc_call_t *request)113 {114 int rc = vfs_op_mtab_get();115 async_answer_0(rid, rc);116 }117 118 112 static void vfs_in_open2(ipc_callid_t rid, ipc_call_t *request) 119 113 { … … 306 300 vfs_in_mount(callid, &call); 307 301 break; 308 case VFS_IN_MTAB_GET:309 vfs_in_mtab_get(callid, &call);310 break;311 302 case VFS_IN_OPEN2: 312 303 vfs_in_open2(callid, &call); -
uspace/srv/vfs/vfs_ops.c
rea56098 r35b7d86e 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;59 54 60 55 /* Forward declarations of static functions. */ … … 243 238 vfs_file_t *file = NULL; 244 239 int fd = -1; 245 mtab_ent_t *mtab_ent = NULL;246 240 247 241 if (!(flags & VFS_MOUNT_CONNECT_ONLY)) { … … 274 268 goto out; 275 269 } 276 }277 278 /* Add the filesystem info to the list of mounted filesystems */279 mtab_ent = malloc(sizeof(mtab_ent_t));280 if (!mtab_ent) {281 rc = ENOMEM;282 goto out;283 270 } 284 271 … … 301 288 } 302 289 303 304 290 if (flags & VFS_MOUNT_NO_REF) { 305 291 vfs_node_delref(root); … … 313 299 } 314 300 315 /* Add the filesystem info to the list of mounted filesystems */316 str_cpy(mtab_ent->mp, MAX_PATH_LEN, "fixme");317 str_cpy(mtab_ent->fs_name, FS_NAME_MAXLEN, fs_name);318 str_cpy(mtab_ent->opts, MAX_MNTOPTS_LEN, opts);319 mtab_ent->instance = instance;320 mtab_ent->service_id = service_id;321 322 link_initialize(&mtab_ent->link);323 324 fibril_mutex_lock(&mtab_list_lock);325 list_append(&mtab_ent->link, &mtab_list);326 mtab_size++;327 fibril_mutex_unlock(&mtab_list_lock);328 329 301 out: 330 302 if (mp) { … … 340 312 341 313 *outfd = fd; 342 return rc;343 }344 345 int vfs_op_mtab_get(void)346 {347 ipc_callid_t callid;348 ipc_call_t data;349 sysarg_t rc = EOK;350 size_t len;351 352 fibril_mutex_lock(&mtab_list_lock);353 354 /* Send to the caller the number of mounted filesystems */355 callid = async_get_call(&data);356 if (IPC_GET_IMETHOD(data) != VFS_IN_PING) {357 rc = ENOTSUP;358 async_answer_0(callid, rc);359 goto exit;360 }361 async_answer_1(callid, EOK, mtab_size);362 363 list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {364 rc = ENOTSUP;365 366 if (!async_data_read_receive(&callid, &len)) {367 async_answer_0(callid, rc);368 goto exit;369 }370 371 (void) async_data_read_finalize(callid, mtab_ent->mp,372 str_size(mtab_ent->mp));373 374 if (!async_data_read_receive(&callid, &len)) {375 async_answer_0(callid, rc);376 goto exit;377 }378 379 (void) async_data_read_finalize(callid, mtab_ent->opts,380 str_size(mtab_ent->opts));381 382 if (!async_data_read_receive(&callid, &len)) {383 async_answer_0(callid, rc);384 goto exit;385 }386 387 (void) async_data_read_finalize(callid, mtab_ent->fs_name,388 str_size(mtab_ent->fs_name));389 390 callid = async_get_call(&data);391 392 if (IPC_GET_IMETHOD(data) != VFS_IN_PING) {393 async_answer_0(callid, rc);394 goto exit;395 }396 397 rc = EOK;398 async_answer_2(callid, rc, mtab_ent->instance,399 mtab_ent->service_id);400 }401 402 exit:403 fibril_mutex_unlock(&mtab_list_lock);404 314 return rc; 405 315 } … … 984 894 fibril_rwlock_write_unlock(&namespace_rwlock); 985 895 986 fibril_mutex_lock(&mtab_list_lock);987 int found = 0;988 989 list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {990 // FIXME: mp name991 if (str_cmp(mtab_ent->mp, "fixme") == 0) {992 list_remove(&mtab_ent->link);993 mtab_size--;994 free(mtab_ent);995 found = 1;996 break;997 }998 }999 assert(found);1000 fibril_mutex_unlock(&mtab_list_lock);1001 1002 896 vfs_file_put(mp); 1003 897 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.