Changes in uspace/srv/fs/ext2fs/ext2fs.c [79ae36dd:efcebe1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext2fs/ext2fs.c
r79ae36dd refcebe1 1 1 /* 2 2 * Copyright (c) 2006 Martin Decky 3 * Copyright (c) 2008 Jakub Jermar4 3 * Copyright (c) 2011 Martin Sucha 5 4 * All rights reserved. … … 55 54 }; 56 55 57 fs_reg_t ext2fs_reg;58 59 /**60 * This connection fibril processes VFS requests from VFS.61 *62 * In order to support simultaneous VFS requests, our design is as follows.63 * The connection fibril accepts VFS requests from VFS. If there is only one64 * instance of the fibril, VFS will need to serialize all VFS requests it sends65 * to EXT2FS. To overcome this bottleneck, VFS can send EXT2FS the IPC_M_CONNECT_ME_TO66 * call. In that case, a new connection fibril will be created, which in turn67 * will accept the call. Thus, a new phone will be opened for VFS.68 *69 * There are few issues with this arrangement. First, VFS can run out of70 * available phones. In that case, VFS can close some other phones or use one71 * phone for more serialized requests. Similarily, EXT2FS can refuse to duplicate72 * the connection. VFS should then just make use of already existing phones and73 * route its requests through them. To avoid paying the fibril creation price74 * upon each request, EXT2FS might want to keep the connections open after the75 * request has been completed.76 */77 static void ext2fs_connection(ipc_callid_t iid, ipc_call_t *icall)78 {79 if (iid) {80 /*81 * This only happens for connections opened by82 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections83 * created by IPC_M_CONNECT_TO_ME.84 */85 async_answer_0(iid, EOK);86 }87 88 dprintf(NAME ": connection opened\n");89 while (true) {90 ipc_call_t call;91 ipc_callid_t callid = async_get_call(&call);92 93 if (!IPC_GET_IMETHOD(call))94 return;95 96 switch (IPC_GET_IMETHOD(call)) {97 case VFS_OUT_MOUNTED:98 ext2fs_mounted(callid, &call);99 break;100 case VFS_OUT_MOUNT:101 ext2fs_mount(callid, &call);102 break;103 case VFS_OUT_UNMOUNTED:104 ext2fs_unmounted(callid, &call);105 break;106 case VFS_OUT_UNMOUNT:107 ext2fs_unmount(callid, &call);108 break;109 case VFS_OUT_LOOKUP:110 ext2fs_lookup(callid, &call);111 break;112 case VFS_OUT_READ:113 ext2fs_read(callid, &call);114 break;115 case VFS_OUT_WRITE:116 ext2fs_write(callid, &call);117 break;118 case VFS_OUT_TRUNCATE:119 ext2fs_truncate(callid, &call);120 break;121 case VFS_OUT_STAT:122 ext2fs_stat(callid, &call);123 break;124 case VFS_OUT_CLOSE:125 ext2fs_close(callid, &call);126 break;127 case VFS_OUT_DESTROY:128 ext2fs_destroy(callid, &call);129 break;130 case VFS_OUT_OPEN_NODE:131 ext2fs_open_node(callid, &call);132 break;133 case VFS_OUT_SYNC:134 ext2fs_sync(callid, &call);135 break;136 default:137 async_answer_0(callid, ENOTSUP);138 break;139 }140 }141 }142 143 56 int main(int argc, char **argv) 144 57 { … … 158 71 } 159 72 160 rc = fs_register(vfs_sess, &ext2fs_reg, &ext2fs_vfs_info, ext2fs_connection); 73 rc = fs_register(vfs_sess, &ext2fs_vfs_info, &ext2fs_ops, 74 &ext2fs_libfs_ops); 161 75 if (rc != EOK) { 162 76 fprintf(stdout, NAME ": Failed to register fs (%d)\n", rc);
Note:
See TracChangeset
for help on using the changeset viewer.