Changeset b14d9f9 in mainline for uspace/srv/vfs
- Timestamp:
- 2017-05-05T17:37:36Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 951f6b9e
- Parents:
- 75b24cd
- Location:
- uspace/srv/vfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
r75b24cd rb14d9f9 43 43 #include <ipc/vfs.h> 44 44 #include <task.h> 45 #include <vfs/vfs.h> 45 46 46 47 #ifndef dprintf … … 174 175 extern fs_handle_t fs_name_to_handle(unsigned int instance, const char *, bool); 175 176 extern vfs_info_t *fs_handle_to_info(fs_handle_t); 177 extern int vfs_get_fstypes(vfs_fstypes_t *); 176 178 177 179 extern int vfs_lookup_internal(vfs_node_t *, char *, int, vfs_lookup_res_t *); -
uspace/srv/vfs/vfs_ipc.c
r75b24cd rb14d9f9 27 27 */ 28 28 29 #include <vfs/vfs.h> 29 30 #include "vfs.h" 30 31 … … 42 43 int ret = vfs_op_clone(oldfd, newfd, desc); 43 44 async_answer_0(rid, ret); 45 } 46 47 static void vfs_in_fstypes(ipc_callid_t rid, ipc_call_t *request) 48 { 49 ipc_callid_t callid; 50 size_t len; 51 vfs_fstypes_t fstypes; 52 int rc; 53 54 rc = vfs_get_fstypes(&fstypes); 55 if (rc != EOK) { 56 async_answer_0(rid, ENOMEM); 57 return; 58 } 59 60 /* Send size of the data */ 61 async_answer_1(rid, EOK, fstypes.size); 62 63 /* Now we should get a read request */ 64 if (!async_data_read_receive(&callid, &len)) 65 goto out; 66 67 if (len > fstypes.size) 68 len = fstypes.size; 69 (void) async_data_read_finalize(callid, fstypes.buf, len); 70 71 out: 72 vfs_fstypes_free(&fstypes); 44 73 } 45 74 … … 268 297 vfs_in_clone(callid, &call); 269 298 break; 299 case VFS_IN_FSTYPES: 300 vfs_in_fstypes(callid, &call); 301 break; 270 302 case VFS_IN_MOUNT: 271 303 vfs_in_mount(callid, &call); -
uspace/srv/vfs/vfs_ops.c
r75b24cd rb14d9f9 147 147 148 148 if (fs_handle == 0) 149 return ENO ENT;149 return ENOFS; 150 150 151 151 /* Tell the mountee that it is being mounted. */ -
uspace/srv/vfs/vfs_register.c
r75b24cd rb14d9f9 50 50 #include <assert.h> 51 51 #include <atomic.h> 52 #include <vfs/vfs.h> 52 53 #include "vfs.h" 53 54 … … 340 341 } 341 342 343 /** Get list of file system types. 344 * 345 * @param fstypes Place to store list of file system types. Free using 346 * vfs_fstypes_free(). 347 * 348 * @return EOK on success or negative error code 349 */ 350 int vfs_get_fstypes(vfs_fstypes_t *fstypes) 351 { 352 size_t size; 353 size_t count; 354 size_t l; 355 356 fibril_mutex_lock(&fs_list_lock); 357 358 size = 0; 359 count = 0; 360 list_foreach(fs_list, fs_link, fs_info_t, fs) { 361 size += str_size(fs->vfs_info.name) + 1; 362 count++; 363 } 364 365 if (size == 0) 366 size = 1; 367 368 fstypes->buf = calloc(1, size); 369 if (fstypes->buf == NULL) { 370 fibril_mutex_unlock(&fs_list_lock); 371 return ENOMEM; 372 } 373 374 fstypes->fstypes = calloc(sizeof(char *), count); 375 if (fstypes->fstypes == NULL) { 376 free(fstypes->buf); 377 fstypes->buf = NULL; 378 fibril_mutex_unlock(&fs_list_lock); 379 return ENOMEM; 380 } 381 382 fstypes->size = size; 383 384 size = 0; count = 0; 385 list_foreach(fs_list, fs_link, fs_info_t, fs) { 386 l = str_size(fs->vfs_info.name) + 1; 387 memcpy(fstypes->buf + size, fs->vfs_info.name, l); 388 fstypes->fstypes[count] = &fstypes->buf[size]; 389 size += l; 390 count++; 391 } 392 393 fibril_mutex_unlock(&fs_list_lock); 394 return EOK; 395 } 396 342 397 /** 343 398 * @}
Note:
See TracChangeset
for help on using the changeset viewer.