Changeset ccfbf71 in mainline
- Timestamp:
- 2011-08-03T18:58:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e97b8c6
- Parents:
- f1119e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat.c
rf1119e5 rccfbf71 40 40 #include "exfat.h" 41 41 #include <ipc/services.h> 42 #include < ipc/ns.h>42 #include <ns.h> 43 43 #include <async.h> 44 44 #include <errno.h> … … 57 57 }; 58 58 59 fs_reg_t exfat_reg;60 61 /**62 * This connection fibril processes VFS requests from VFS.63 *64 * In order to support simultaneous VFS requests, our design is as follows.65 * The connection fibril accepts VFS requests from VFS. If there is only one66 * instance of the fibril, VFS will need to serialize all VFS requests it sends67 * to FAT. To overcome this bottleneck, VFS can send exFAT the IPC_M_CONNECT_ME_TO68 * call. In that case, a new connection fibril will be created, which in turn69 * will accept the call. Thus, a new phone will be opened for VFS.70 *71 * There are few issues with this arrangement. First, VFS can run out of72 * available phones. In that case, VFS can close some other phones or use one73 * phone for more serialized requests. Similarily, exFAT can refuse to duplicate74 * the connection. VFS should then just make use of already existing phones and75 * route its requests through them. To avoid paying the fibril creation price76 * upon each request, exFAT might want to keep the connections open after the77 * request has been completed.78 */79 static void exfat_connection(ipc_callid_t iid, ipc_call_t *icall)80 {81 if (iid) {82 /*83 * This only happens for connections opened by84 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections85 * created by IPC_M_CONNECT_TO_ME.86 */87 async_answer_0(iid, EOK);88 }89 90 dprintf(NAME ": connection opened\n");91 while (1) {92 ipc_callid_t callid;93 ipc_call_t call;94 95 callid = async_get_call(&call);96 switch (IPC_GET_IMETHOD(call)) {97 case IPC_M_PHONE_HUNGUP:98 return;99 case VFS_OUT_MOUNTED:100 exfat_mounted(callid, &call);101 break;102 case VFS_OUT_MOUNT:103 exfat_mount(callid, &call);104 break;105 case VFS_OUT_UNMOUNTED:106 exfat_unmounted(callid, &call);107 break;108 case VFS_OUT_UNMOUNT:109 exfat_unmount(callid, &call);110 break;111 case VFS_OUT_LOOKUP:112 exfat_lookup(callid, &call);113 break;114 case VFS_OUT_READ:115 exfat_read(callid, &call);116 break;117 case VFS_OUT_WRITE:118 /* exfat_write(callid, &call); */119 async_answer_0(callid, ENOTSUP);120 break;121 case VFS_OUT_TRUNCATE:122 /* exfat_truncate(callid, &call); */123 async_answer_0(callid, ENOTSUP);124 break;125 case VFS_OUT_STAT:126 exfat_stat(callid, &call);127 break;128 case VFS_OUT_CLOSE:129 exfat_close(callid, &call);130 break;131 case VFS_OUT_DESTROY:132 /* exfat_destroy(callid, &call); */133 async_answer_0(callid, ENOTSUP);134 break;135 case VFS_OUT_OPEN_NODE:136 exfat_open_node(callid, &call);137 break;138 case VFS_OUT_SYNC:139 exfat_sync(callid, &call);140 break;141 default:142 async_answer_0(callid, ENOTSUP);143 break;144 }145 }146 }147 148 59 int main(int argc, char **argv) 149 60 { 150 int vfs_phone;151 int rc;152 153 61 printf(NAME ": HelenOS exFAT file system server\n"); 154 62 155 rc = exfat_idx_init();63 int rc = exfat_idx_init(); 156 64 if (rc != EOK) 157 65 goto err; 158 66 159 vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0); 160 if (vfs_phone < EOK) { 67 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 68 SERVICE_VFS, 0, 0); 69 if (!vfs_sess) { 161 70 printf(NAME ": failed to connect to VFS\n"); 162 71 return -1; 163 72 } 164 73 165 rc = fs_register(vfs_ phone, &exfat_reg, &exfat_vfs_info, exfat_connection);74 rc = fs_register(vfs_sess, &exfat_vfs_info, &exfat_ops, &exfat_libfs_ops); 166 75 if (rc != EOK) { 167 76 exfat_idx_fini(); … … 172 81 task_retval(0); 173 82 async_manager(); 83 174 84 /* not reached */ 175 85 return 0; … … 183 93 /** 184 94 * @} 185 */ 95 */
Note:
See TracChangeset
for help on using the changeset viewer.