Changes in uspace/srv/vfs/vfs.c [c1f7a315:d60ce4a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
rc1f7a315 rd60ce4a 37 37 38 38 #include <vfs/vfs.h> 39 #include <stdlib.h>40 39 #include <ipc/services.h> 41 #include <abi/ipc/ methods.h>42 #include < libarch/config.h>40 #include <abi/ipc/event.h> 41 #include <event.h> 43 42 #include <ns.h> 44 43 #include <async.h> … … 54 53 #define NAME "vfs" 55 54 56 static void vfs_pager(ipc_callid_t iid, ipc_call_t *icall, void *arg) 57 { 58 async_answer_0(iid, EOK); 59 60 while (true) { 61 ipc_call_t call; 62 ipc_callid_t callid = async_get_call(&call); 63 64 if (!IPC_GET_IMETHOD(call)) 65 break; 66 67 switch (IPC_GET_IMETHOD(call)) { 68 case IPC_M_PAGE_IN: 69 vfs_page_in(callid, &call); 70 break; 71 default: 72 async_answer_0(callid, ENOTSUP); 73 break; 74 } 75 } 76 } 55 enum { 56 VFS_TASK_STATE_CHANGE 57 }; 77 58 78 59 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) … … 99 80 break; 100 81 case VFS_IN_MOUNT: 101 vfs_mount _srv(callid, &call);82 vfs_mount(callid, &call); 102 83 break; 103 84 case VFS_IN_UNMOUNT: 104 vfs_unmount_srv(callid, &call); 105 break; 106 case VFS_IN_OPEN: 107 vfs_open(callid, &call); 85 vfs_unmount(callid, &call); 86 break; 87 case VFS_IN_WALK: 88 vfs_walk(callid, &call); 89 break; 90 case VFS_IN_OPEN2: 91 vfs_open2(callid, &call); 108 92 break; 109 93 case VFS_IN_CLOSE: … … 125 109 vfs_fstat(callid, &call); 126 110 break; 127 case VFS_IN_STAT: 128 vfs_stat(callid, &call); 129 break; 130 case VFS_IN_MKDIR: 131 vfs_mkdir(callid, &call); 132 break; 133 case VFS_IN_UNLINK: 134 vfs_unlink(callid, &call); 111 case VFS_IN_UNLINK2: 112 vfs_unlink2(callid, &call); 135 113 break; 136 114 case VFS_IN_RENAME: … … 149 127 vfs_get_mtab(callid, &call); 150 128 break; 151 case VFS_IN_STATFS:152 vfs_statfs(callid, &call);153 break;154 129 default: 155 130 async_answer_0(callid, ENOTSUP); … … 164 139 } 165 140 166 static void notification_ handler(ipc_callid_t callid, ipc_call_t *call, void *arg)141 static void notification_received(ipc_callid_t callid, ipc_call_t *call) 167 142 { 168 if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE) 169 vfs_pass_handle( 170 (task_id_t) MERGE_LOUP32(IPC_GET_ARG4(*call), 171 IPC_GET_ARG5(*call)), call->in_task_id, 172 (int) IPC_GET_ARG2(*call)); 143 switch (IPC_GET_IMETHOD(*call)) { 144 case VFS_TASK_STATE_CHANGE: 145 if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE) 146 vfs_pass_handle( 147 (task_id_t) MERGE_LOUP32(IPC_GET_ARG4(*call), 148 IPC_GET_ARG5(*call)), call->in_task_id, 149 (int) IPC_GET_ARG2(*call)); 150 break; 151 default: 152 break; 153 } 173 154 } 174 155 175 156 int main(int argc, char **argv) 176 157 { 177 int rc;178 179 158 printf("%s: HelenOS VFS server\n", NAME); 180 159 … … 192 171 */ 193 172 plb = as_area_create(AS_AREA_ANY, PLB_SIZE, 194 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE , AS_AREA_UNPAGED);173 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 195 174 if (plb == AS_MAP_FAILED) { 196 175 printf("%s: Cannot create address space area\n", NAME); … … 206 185 207 186 /* 208 * Create a port for the pager.209 */210 port_id_t port;211 rc = async_create_port(INTERFACE_PAGER, vfs_pager, NULL, &port);212 if (rc != EOK)213 return rc;214 215 /*216 187 * Set a connection handling function/fibril. 217 188 */ 218 async_set_ fallback_port_handler(vfs_connection, NULL);219 220 /* 221 * S ubscribe to notifications.222 */ 223 async_ event_task_subscribe(EVENT_TASK_STATE_CHANGE, notification_handler,224 NULL);189 async_set_client_connection(vfs_connection); 190 191 /* 192 * Set notification handler and subscribe to notifications. 193 */ 194 async_set_interrupt_received(notification_received); 195 event_task_subscribe(EVENT_TASK_STATE_CHANGE, VFS_TASK_STATE_CHANGE); 225 196 226 197 /* 227 198 * Register at the naming service. 228 199 */ 229 rc = service_register(SERVICE_VFS);200 int rc = service_register(SERVICE_VFS); 230 201 if (rc != EOK) { 231 202 printf("%s: Cannot register VFS service\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.