Changes in uspace/srv/fs/tmpfs/tmpfs.c [79ae36dd:efcebe1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs.c
r79ae36dd refcebe1 61 61 }; 62 62 63 fs_reg_t tmpfs_reg;64 65 /**66 * This connection fibril processes VFS requests from VFS.67 *68 * In order to support simultaneous VFS requests, our design is as follows.69 * The connection fibril accepts VFS requests from VFS. If there is only one70 * instance of the fibril, VFS will need to serialize all VFS requests it sends71 * to FAT. To overcome this bottleneck, VFS can send TMPFS the72 * IPC_M_CONNECT_ME_TO call. In that case, a new connection fibril will be73 * created, which in turn will accept the call. Thus, a new phone will be74 * opened for VFS.75 *76 * There are few issues with this arrangement. First, VFS can run out of77 * available phones. In that case, VFS can close some other phones or use one78 * phone for more serialized requests. Similarily, TMPFS can refuse to duplicate79 * the connection. VFS should then just make use of already existing phones and80 * route its requests through them. To avoid paying the fibril creation price81 * upon each request, TMPFS might want to keep the connections open after the82 * request has been completed.83 */84 static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall)85 {86 if (iid) {87 /*88 * This only happens for connections opened by89 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections90 * created by IPC_M_CONNECT_TO_ME.91 */92 async_answer_0(iid, EOK);93 }94 95 dprintf(NAME ": connection opened\n");96 97 while (true) {98 ipc_call_t call;99 ipc_callid_t callid = async_get_call(&call);100 101 if (!IPC_GET_IMETHOD(call))102 return;103 104 switch (IPC_GET_IMETHOD(call)) {105 case VFS_OUT_MOUNTED:106 tmpfs_mounted(callid, &call);107 break;108 case VFS_OUT_MOUNT:109 tmpfs_mount(callid, &call);110 break;111 case VFS_OUT_UNMOUNTED:112 tmpfs_unmounted(callid, &call);113 break;114 case VFS_OUT_UNMOUNT:115 tmpfs_unmount(callid, &call);116 break;117 case VFS_OUT_LOOKUP:118 tmpfs_lookup(callid, &call);119 break;120 case VFS_OUT_READ:121 tmpfs_read(callid, &call);122 break;123 case VFS_OUT_WRITE:124 tmpfs_write(callid, &call);125 break;126 case VFS_OUT_TRUNCATE:127 tmpfs_truncate(callid, &call);128 break;129 case VFS_OUT_CLOSE:130 tmpfs_close(callid, &call);131 break;132 case VFS_OUT_DESTROY:133 tmpfs_destroy(callid, &call);134 break;135 case VFS_OUT_OPEN_NODE:136 tmpfs_open_node(callid, &call);137 break;138 case VFS_OUT_STAT:139 tmpfs_stat(callid, &call);140 break;141 case VFS_OUT_SYNC:142 tmpfs_sync(callid, &call);143 break;144 default:145 async_answer_0(callid, ENOTSUP);146 break;147 }148 }149 }150 151 63 int main(int argc, char **argv) 152 64 { … … 165 77 } 166 78 167 int rc = fs_register(vfs_sess, &tmpfs_ reg, &tmpfs_vfs_info,168 tmpfs_connection);79 int rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops, 80 &tmpfs_libfs_ops); 169 81 if (rc != EOK) { 170 82 printf(NAME ": Failed to register file system (%d)\n", rc);
Note:
See TracChangeset
for help on using the changeset viewer.