Changes in uspace/srv/vfs/vfs.c [852b801:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
r852b801 rffa2c8ef 36 36 */ 37 37 38 #include <ipc/ipc.h>39 38 #include <ipc/services.h> 39 #include <ipc/ns.h> 40 40 #include <async.h> 41 41 #include <errno.h> 42 42 #include <stdio.h> 43 43 #include <bool.h> 44 #include <str ing.h>44 #include <str.h> 45 45 #include <as.h> 46 46 #include <atomic.h> 47 47 #include "vfs.h" 48 48 49 #define NAME "vfs"49 #define NAME "vfs" 50 50 51 51 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall) … … 57 57 * This call needs to be answered. 58 58 */ 59 ipc_answer_0(iid, EOK);59 async_answer_0(iid, EOK); 60 60 61 /*62 * Here we enter the main connection fibril loop.63 * The logic behind this loop and the protocol is that we'd like to keep64 * each connection open until the client hangs up. When the client hangs65 * up, we will free its VFS state. The act of hanging up the connection66 * by the client is equivalent to client termination because we cannot67 * distinguish one from the other. On the other hand, the client can68 * hang up arbitrarily if it has no open files and reestablish the69 * connection later.70 */71 61 while (keep_on_going) { 72 62 ipc_call_t call; 73 63 ipc_callid_t callid = async_get_call(&call); 74 64 75 fs_handle_t fs_handle; 76 int phone; 77 78 switch (IPC_GET_METHOD(call)) { 65 switch (IPC_GET_IMETHOD(call)) { 79 66 case IPC_M_PHONE_HUNGUP: 80 67 keep_on_going = false; … … 86 73 case VFS_IN_MOUNT: 87 74 vfs_mount(callid, &call); 75 break; 76 case VFS_IN_UNMOUNT: 77 vfs_unmount(callid, &call); 88 78 break; 89 79 case VFS_IN_OPEN: … … 126 116 vfs_sync(callid, &call); 127 117 break; 118 case VFS_IN_DUP: 119 vfs_dup(callid, &call); 128 120 default: 129 ipc_answer_0(callid, ENOTSUP);121 async_answer_0(callid, ENOTSUP); 130 122 break; 131 123 } 132 124 } 133 134 /* TODO: cleanup after the client */ 125 126 /* 127 * Open files for this client will be cleaned up when its last 128 * connection fibril terminates. 129 */ 135 130 } 136 131 … … 164 159 165 160 /* 161 * Set client data constructor and destructor. 162 */ 163 async_set_client_data_constructor(vfs_client_data_create); 164 async_set_client_data_destructor(vfs_client_data_destroy); 165 166 /* 166 167 * Set a connection handling function/fibril. 167 168 */ … … 171 172 * Register at the naming service. 172 173 */ 173 ipcarg_t phonead; 174 ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, 0, &phonead); 174 if (service_register(SERVICE_VFS) != EOK) { 175 printf("%s: Cannot register VFS service\n", NAME); 176 return EINVAL; 177 } 175 178 176 179 /*
Note:
See TracChangeset
for help on using the changeset viewer.