Changes in uspace/srv/vfs/vfs.c [d60ce4a:c1f7a315] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.c
rd60ce4a rc1f7a315 37 37 38 38 #include <vfs/vfs.h> 39 #include <stdlib.h> 39 40 #include <ipc/services.h> 40 #include <abi/ipc/ event.h>41 #include < event.h>41 #include <abi/ipc/methods.h> 42 #include <libarch/config.h> 42 43 #include <ns.h> 43 44 #include <async.h> … … 53 54 #define NAME "vfs" 54 55 55 enum { 56 VFS_TASK_STATE_CHANGE 57 }; 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 } 58 77 59 78 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) … … 80 99 break; 81 100 case VFS_IN_MOUNT: 82 vfs_mount (callid, &call);101 vfs_mount_srv(callid, &call); 83 102 break; 84 103 case VFS_IN_UNMOUNT: 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); 104 vfs_unmount_srv(callid, &call); 105 break; 106 case VFS_IN_OPEN: 107 vfs_open(callid, &call); 92 108 break; 93 109 case VFS_IN_CLOSE: … … 109 125 vfs_fstat(callid, &call); 110 126 break; 111 case VFS_IN_UNLINK2: 112 vfs_unlink2(callid, &call); 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); 113 135 break; 114 136 case VFS_IN_RENAME: … … 127 149 vfs_get_mtab(callid, &call); 128 150 break; 151 case VFS_IN_STATFS: 152 vfs_statfs(callid, &call); 153 break; 129 154 default: 130 155 async_answer_0(callid, ENOTSUP); … … 139 164 } 140 165 141 static void notification_received(ipc_callid_t callid, ipc_call_t *call) 142 { 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 } 166 static void notification_handler(ipc_callid_t callid, ipc_call_t *call, void *arg) 167 { 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)); 154 173 } 155 174 156 175 int main(int argc, char **argv) 157 176 { 177 int rc; 178 158 179 printf("%s: HelenOS VFS server\n", NAME); 159 180 … … 171 192 */ 172 193 plb = as_area_create(AS_AREA_ANY, PLB_SIZE, 173 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE );194 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED); 174 195 if (plb == AS_MAP_FAILED) { 175 196 printf("%s: Cannot create address space area\n", NAME); … … 185 206 186 207 /* 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 /* 187 216 * Set a connection handling function/fibril. 188 217 */ 189 async_set_ client_connection(vfs_connection);190 191 /* 192 * S et 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);218 async_set_fallback_port_handler(vfs_connection, NULL); 219 220 /* 221 * Subscribe to notifications. 222 */ 223 async_event_task_subscribe(EVENT_TASK_STATE_CHANGE, notification_handler, 224 NULL); 196 225 197 226 /* 198 227 * Register at the naming service. 199 228 */ 200 intrc = service_register(SERVICE_VFS);229 rc = service_register(SERVICE_VFS); 201 230 if (rc != EOK) { 202 231 printf("%s: Cannot register VFS service\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.