Changeset 84b86dcb in mainline
- Timestamp:
- 2007-09-28T13:42:04Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 12a56fa
- Parents:
- 13125d3
- Location:
- uspace/srv/vfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
r13125d3 r84b86dcb 148 148 extern void vfs_release_phone(int); 149 149 150 extern int fs_name_to_handle(char *name, bool lock); 151 150 152 extern int vfs_lookup_internal(char *path, size_t len, vfs_node_t *result); 151 153 -
uspace/srv/vfs/vfs_register.c
r13125d3 r84b86dcb 219 219 * Check for duplicit registrations. 220 220 */ 221 link_t *cur; 222 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 223 fs_info_t *fi = list_get_instance(cur, fs_info_t, 224 fs_link); 225 /* TODO: replace strcmp with strncmp once we have it */ 226 if (strcmp(fs_info->vfs_info.name, fi->vfs_info.name) == 0) { 227 /* 228 * We already register a fs like this. 229 */ 230 dprintf("FS is already registered.\n"); 231 futex_up(&fs_head_futex); 232 free(fs_info); 233 ipc_answer_fast(callid, EEXISTS, 0, 0); 234 ipc_answer_fast(rid, EEXISTS, 0, 0); 235 return; 236 } 221 if (fs_name_to_handle(fs_info->vfs_info.name, false)) { 222 /* 223 * We already register a fs like this. 224 */ 225 dprintf("FS is already registered.\n"); 226 futex_up(&fs_head_futex); 227 free(fs_info); 228 ipc_answer_fast(callid, EEXISTS, 0, 0); 229 ipc_answer_fast(rid, EEXISTS, 0, 0); 230 return; 237 231 } 238 232 … … 307 301 dprintf("Sharing PLB.\n"); 308 302 309 futex_up(&fs_head_futex);310 311 303 /* 312 304 * That was it. The FS has been registered. … … 316 308 fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); 317 309 ipc_answer_fast(rid, EOK, (ipcarg_t) fs_info->fs_handle, 0); 310 311 futex_up(&fs_head_futex); 312 318 313 dprintf("\"%s\" filesystem successfully registered, handle=%d.\n", 319 314 fs_info->vfs_info.name, fs_info->fs_handle); … … 385 380 } 386 381 382 /** Convert file system name to its handle. 383 * 384 * @param name File system name. 385 * @param lock If true, the function will down and up the 386 * fs_head_futex. 387 * 388 * @return File system handle or zero if file system not found. 389 */ 390 int fs_name_to_handle(char *name, bool lock) 391 { 392 int handle = 0; 393 394 if (lock) 395 futex_down(&fs_head_futex); 396 link_t *cur; 397 for (cur = fs_head.next; cur != &fs_head; cur = cur->next) { 398 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 399 if (strcmp(fs->vfs_info.name, name) == 0) { /* XXX: strncmp() */ 400 handle = fs->fs_handle; 401 break; 402 } 403 } 404 if (lock) 405 futex_up(&fs_head_futex); 406 return handle; 407 } 408 387 409 /** 388 410 * @}
Note:
See TracChangeset
for help on using the changeset viewer.