Changes in uspace/srv/fs/devfs/devfs.c [efcebe1:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/devfs/devfs.c
refcebe1 rffa2c8ef 41 41 #include <stdio.h> 42 42 #include <ipc/services.h> 43 #include < ns.h>43 #include <ipc/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 59 119 int main(int argc, char *argv[]) 60 120 { 61 printf( "%s: HelenOS Device Filesystem\n", NAME);121 printf(NAME ": HelenOS Device Filesystem\n"); 62 122 63 123 if (!devfs_init()) { 64 printf( "%s: failed to initialize devfs\n", NAME);124 printf(NAME ": failed to initialize devfs\n"); 65 125 return -1; 66 126 } 67 127 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); 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"); 72 131 return -1; 73 132 } 74 133 75 int rc = fs_register(vfs_ sess, &devfs_vfs_info, &devfs_ops,76 &devfs_libfs_ops);134 int rc = fs_register(vfs_phone, &devfs_reg, &devfs_vfs_info, 135 devfs_connection); 77 136 if (rc != EOK) { 78 printf( "%s: Failed to register file system (%d)\n", NAME, rc);137 printf(NAME ": Failed to register file system (%d)\n", rc); 79 138 return rc; 80 139 } 81 140 82 printf( "%s: Accepting connections\n", NAME);141 printf(NAME ": Accepting connections\n"); 83 142 task_retval(0); 84 143 async_manager(); … … 91 150 * @} 92 151 */ 93
Note:
See TracChangeset
for help on using the changeset viewer.