Changeset a4627c4 in mainline for uspace/srv/fs/fat/fat.c
- Timestamp:
- 2007-09-22T20:08:12Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 56bc4a3
- Parents:
- 8f9ede5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.c
r8f9ede5 ra4627c4 42 42 #include <errno.h> 43 43 #include <unistd.h> 44 #include <stdio.h> >44 #include <stdio.h> 45 45 #include "../../vfs/vfs.h" 46 46 … … 63 63 }; 64 64 65 /* 66 * This fibril processes request from the VFS server. 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 one 70 * instance of the fibril, VFS will need to serialize all VFS requests it sends 71 * to FAT. To overcome this bottleneck, VFS can send FAT the IPC_M_CONNECT_ME_TO 72 * call. In that case, a new connection fibril will be created, which in turn 73 * will accept the call. Thus, a new phone will be opened for VFS. 74 * 75 * There are few issues with this arrangement. First, VFS can run out of 76 * available phones. In that case, VFS can close some other phones or use one 77 * phone for more serialized requests. Similarly, FAT can refuse to duplicate 78 * the connection. VFS should then just make use of already existing phones and 79 * route its requests through them. To avoid paying the fibril creation price 80 * upon each request, FAT might want to keep the connections open after the 81 * request has been completed. 67 82 */ 68 void fat_connection(ipc_callid_t iid, ipc_call_t *icall)83 static void fat_connection(ipc_callid_t iid, ipc_call_t *icall) 69 84 { 70 dprintf("Callback connection established.\n"); 85 if (iid) { 86 /* 87 * This only happens for connections opened by 88 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections 89 * created by IPC_M_CONNECT_TO_ME. 90 */ 91 ipc_answer_fast(iid, EOK, 0, 0); 92 } 93 94 dprintf("VFS-FAT connection established.\n"); 71 95 while (1) { 72 96 ipc_callid_t callid; … … 74 98 75 99 callid = async_get_call(&call); 76 ipc_answer_fast(callid, ENOTSUP, 0, 0); 100 switch (IPC_GET_METHOD(call)) { 101 default: 102 ipc_answer_fast(callid, ENOTSUP, 0, 0); 103 break; 104 } 77 105 } 78 106 } … … 113 141 ipc_connect_to_me(vfs_phone, 0, 0, &phonehash); 114 142 143 /* 144 * Create a connection fibril to handle the callback connection. 145 */ 115 146 async_new_connection(phonehash, 0, NULL, fat_connection); 147 148 /* 149 * Tell the async framework that other connections are to be handled by 150 * the same connection fibril as well. 151 */ 152 async_set_client_connection(fat_connection); 116 153 117 154 /* … … 121 158 dprintf("FAT filesystem registered.\n"); 122 159 160 async_create_manager(); 161 123 162 /* 124 163 * TODO: Interestingly, if we merely return, the only thread dies. 125 * 126 * 164 * If the only thread dies, the whole task is destroyed. 165 * Prevent the thread from exiting when there are active fibrils. 127 166 */ 128 167 fibril_schedule_next_adv(FIBRIL_FROM_DEAD);
Note:
See TracChangeset
for help on using the changeset viewer.