Changes in uspace/srv/fs/devfs/devfs.c [ffa2c8ef:efcebe1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/devfs/devfs.c
rffa2c8ef refcebe1 41 41 #include <stdio.h> 42 42 #include <ipc/services.h> 43 #include < ipc/ns.h>43 #include <ns.h> 44 44 #include <async.h> 45 45 #include <errno.h> … … 57 57 }; 58 58 59 fs_reg_t devfs_reg;60 61 static void devfs_connection(ipc_callid_t iid, ipc_call_t *icall)62 {63 if (iid)64 async_answer_0(iid, EOK);65 66 while (true) {67 ipc_call_t call;68 ipc_callid_t callid = async_get_call(&call);69 70 switch (IPC_GET_IMETHOD(call)) {71 case IPC_M_PHONE_HUNGUP:72 return;73 case VFS_OUT_MOUNTED:74 devfs_mounted(callid, &call);75 break;76 case VFS_OUT_MOUNT:77 devfs_mount(callid, &call);78 break;79 case VFS_OUT_UNMOUNTED:80 devfs_unmounted(callid, &call);81 break;82 case VFS_OUT_UNMOUNT:83 devfs_unmount(callid, &call);84 break;85 case VFS_OUT_LOOKUP:86 devfs_lookup(callid, &call);87 break;88 case VFS_OUT_OPEN_NODE:89 devfs_open_node(callid, &call);90 break;91 case VFS_OUT_STAT:92 devfs_stat(callid, &call);93 break;94 case VFS_OUT_READ:95 devfs_read(callid, &call);96 break;97 case VFS_OUT_WRITE:98 devfs_write(callid, &call);99 break;100 case VFS_OUT_TRUNCATE:101 devfs_truncate(callid, &call);102 break;103 case VFS_OUT_CLOSE:104 devfs_close(callid, &call);105 break;106 case VFS_OUT_SYNC:107 devfs_sync(callid, &call);108 break;109 case VFS_OUT_DESTROY:110 devfs_destroy(callid, &call);111 break;112 default:113 async_answer_0(callid, ENOTSUP);114 break;115 }116 }117 }118 119 59 int main(int argc, char *argv[]) 120 60 { 121 printf( NAME ": HelenOS Device Filesystem\n");61 printf("%s: HelenOS Device Filesystem\n", NAME); 122 62 123 63 if (!devfs_init()) { 124 printf( NAME ": failed to initialize devfs\n");64 printf("%s: failed to initialize devfs\n", NAME); 125 65 return -1; 126 66 } 127 67 128 int vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0); 129 if (vfs_phone < EOK) { 130 printf(NAME ": Unable to connect to VFS\n"); 68 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 69 SERVICE_VFS, 0, 0); 70 if (!vfs_sess) { 71 printf("%s: Unable to connect to VFS\n", NAME); 131 72 return -1; 132 73 } 133 74 134 int rc = fs_register(vfs_ phone, &devfs_reg, &devfs_vfs_info,135 devfs_connection);75 int rc = fs_register(vfs_sess, &devfs_vfs_info, &devfs_ops, 76 &devfs_libfs_ops); 136 77 if (rc != EOK) { 137 printf( NAME ": Failed to register file system (%d)\n", rc);78 printf("%s: Failed to register file system (%d)\n", NAME, rc); 138 79 return rc; 139 80 } 140 81 141 printf( NAME ": Accepting connections\n");82 printf("%s: Accepting connections\n", NAME); 142 83 task_retval(0); 143 84 async_manager(); … … 150 91 * @} 151 92 */ 93
Note:
See TracChangeset
for help on using the changeset viewer.