Changeset 35b7d86e in mainline for uspace/srv/vfs/vfs_ops.c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.