Changeset 6c89f20 in mainline
- Timestamp:
- 2008-06-03T15:07:16Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 21c5d41
- Parents:
- d51db07
- Location:
- uspace/srv/vfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
rd51db07 r6c89f20 48 48 #include "vfs.h" 49 49 50 #define NAME "vfs" 51 50 52 #define dprintf(...) printf(__VA_ARGS__) 51 53 … … 53 55 { 54 56 bool keep_on_going = 1; 55 56 printf("Connection opened from %p\n", icall->in_phone_hash);57 57 58 58 /* … … 78 78 callid = async_get_call(&call); 79 79 80 printf("Received call, method=%d\n", IPC_GET_METHOD(call));81 82 80 switch (IPC_GET_METHOD(call)) { 83 81 case IPC_M_PHONE_HUNGUP: … … 132 130 ipcarg_t phonead; 133 131 134 printf( "VFS: HelenOS VFS server\n");132 printf(NAME ": HelenOS VFS server\n"); 135 133 136 134 /* … … 143 141 */ 144 142 if (!vfs_nodes_init()) { 145 printf( "Failed to initialize the VFS node hash table.\n");143 printf(NAME ": Failed to initialize VFS node hash table\n"); 146 144 return ENOMEM; 147 145 } … … 153 151 plb = as_get_mappable_page(PLB_SIZE); 154 152 if (!plb) { 155 printf( "Cannot allocate a mappable piece of address space\n");153 printf(NAME ": Cannot allocate a mappable piece of address space\n"); 156 154 return ENOMEM; 157 155 } 158 156 if (as_area_create(plb, PLB_SIZE, AS_AREA_READ | AS_AREA_WRITE | 159 157 AS_AREA_CACHEABLE) != plb) { 160 printf( "Cannot create address space area.\n");158 printf(NAME ": Cannot create address space area\n"); 161 159 return ENOMEM; 162 160 } … … 176 174 * Start accepting connections. 177 175 */ 176 printf(NAME ": Accepting connections\n"); 178 177 async_manager(); 179 178 return 0; -
uspace/srv/vfs/vfs.h
rd51db07 r6c89f20 41 41 #include <bool.h> 42 42 43 #define dprintf(...) printf(__VA_ARGS__) 43 // FIXME: according to CONFIG_DEBUG 44 // #define dprintf(...) printf(__VA_ARGS__) 45 46 #define dprintf(...) 44 47 45 48 #define VFS_FIRST IPC_FIRST_USER_METHOD -
uspace/srv/vfs/vfs_ops.c
rd51db07 r6c89f20 445 445 446 446 int fd = IPC_GET_ARG1(*request); 447 447 448 448 /* Lookup the file structure corresponding to the file descriptor. */ 449 449 vfs_file_t *file = vfs_file_get(fd); … … 452 452 return; 453 453 } 454 454 455 455 /* 456 456 * Now we need to receive a call with client's … … 468 468 return; 469 469 } 470 470 471 471 /* 472 472 * Lock the open file structure so that no other thread can manipulate … … 474 474 */ 475 475 futex_down(&file->lock); 476 476 477 477 /* 478 478 * Lock the file's node so that no other client can read/write to it at … … 483 483 else 484 484 rwlock_write_lock(&file->node->contents_rwlock); 485 485 486 486 int fs_phone = vfs_grab_phone(file->node->fs_handle); 487 487 … … 501 501 */ 502 502 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 503 503 504 504 vfs_release_phone(fs_phone); 505 505 506 506 /* Wait for reply from the FS server. */ 507 507 ipcarg_t rc; 508 508 async_wait_for(msg, &rc); 509 509 size_t bytes = IPC_GET_ARG1(answer); 510 510 511 511 /* Unlock the VFS node. */ 512 512 if (read) … … 518 518 rwlock_write_unlock(&file->node->contents_rwlock); 519 519 } 520 520 521 521 /* Update the position pointer and unlock the open file. */ 522 522 if (rc == EOK) 523 523 file->pos += bytes; 524 524 futex_up(&file->lock); 525 525 526 526 /* 527 527 * FS server's reply is the final result of the whole operation we
Note:
See TracChangeset
for help on using the changeset viewer.