Changeset f17667a in mainline
- Timestamp:
- 2008-02-17T13:32:53Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2616965d
- Parents:
- b5553a2
- Location:
- uspace/srv
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.c
rb5553a2 rf17667a 52 52 .ops = { 53 53 [IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] = VFS_OP_DEFINED, 54 [IPC_METHOD_TO_VFS_OP(VFS_OPEN)] = VFS_OP_DEFINED,55 [IPC_METHOD_TO_VFS_OP(VFS_CLOSE)] = VFS_OP_DEFINED,56 54 [IPC_METHOD_TO_VFS_OP(VFS_READ)] = VFS_OP_DEFINED, 57 55 [IPC_METHOD_TO_VFS_OP(VFS_WRITE)] = VFS_OP_NULL, 58 56 [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_NULL, 59 [IPC_METHOD_TO_VFS_OP(VFS_RENAME)] = VFS_OP_NULL,60 [IPC_METHOD_TO_VFS_OP(VFS_OPENDIR)] = VFS_OP_NULL,61 [IPC_METHOD_TO_VFS_OP(VFS_READDIR)] = VFS_OP_NULL,62 [IPC_METHOD_TO_VFS_OP(VFS_CLOSEDIR)] = VFS_OP_NULL,63 [IPC_METHOD_TO_VFS_OP(VFS_UNLINK)] = VFS_OP_NULL,64 57 [IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_NULL, 65 58 [IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL, -
uspace/srv/fs/tmpfs/tmpfs.c
rb5553a2 rf17667a 56 56 .ops = { 57 57 [IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] = VFS_OP_DEFINED, 58 [IPC_METHOD_TO_VFS_OP(VFS_OPEN)] = VFS_OP_DEFINED,59 [IPC_METHOD_TO_VFS_OP(VFS_CLOSE)] = VFS_OP_DEFINED,60 58 [IPC_METHOD_TO_VFS_OP(VFS_READ)] = VFS_OP_DEFINED, 61 59 [IPC_METHOD_TO_VFS_OP(VFS_WRITE)] = VFS_OP_DEFINED, 62 [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_NULL, 63 [IPC_METHOD_TO_VFS_OP(VFS_RENAME)] = VFS_OP_NULL, 64 [IPC_METHOD_TO_VFS_OP(VFS_OPENDIR)] = VFS_OP_NULL, 65 [IPC_METHOD_TO_VFS_OP(VFS_READDIR)] = VFS_OP_NULL, 66 [IPC_METHOD_TO_VFS_OP(VFS_CLOSEDIR)] = VFS_OP_NULL, 67 [IPC_METHOD_TO_VFS_OP(VFS_UNLINK)] = VFS_OP_NULL, 60 [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_DEFINED, 68 61 [IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_NULL, 69 62 [IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL, 63 [IPC_METHOD_TO_VFS_OP(VFS_FREE)] = VFS_OP_DEFINED, 70 64 } 71 65 }; … … 119 113 tmpfs_write(callid, &call); 120 114 break; 115 case VFS_TRUNCATE: 116 tmpfs_truncate(callid, &call); 117 break; 118 case VFS_FREE: 119 tmpfs_free(callid, &call); 120 break; 121 121 default: 122 122 ipc_answer_0(callid, ENOTSUP); -
uspace/srv/fs/tmpfs/tmpfs.h
rb5553a2 rf17667a 65 65 extern void tmpfs_write(ipc_callid_t, ipc_call_t *); 66 66 extern void tmpfs_truncate(ipc_callid_t, ipc_call_t *); 67 extern void tmpfs_free(ipc_callid_t, ipc_call_t *); 67 68 68 69 #endif -
uspace/srv/fs/tmpfs/tmpfs_ops.c
rb5553a2 rf17667a 497 497 } 498 498 499 void tmpfs_free(ipc_callid_t rid, ipc_call_t *request) 500 { 501 int dev_handle = IPC_GET_ARG1(*request); 502 unsigned long index = IPC_GET_ARG2(*request); 503 504 link_t *hlp; 505 hlp = hash_table_find(&dentries, &index); 506 if (!hlp) { 507 ipc_answer_0(rid, ENOENT); 508 return; 509 } 510 tmpfs_dentry_t *dentry = hash_table_get_instance(hlp, tmpfs_dentry_t, 511 dh_link); 512 513 assert(!dentry->parent); 514 assert(!dentry->child); 515 assert(!dentry->sibling); 516 517 if (dentry->type == TMPFS_FILE) 518 free(dentry->data); 519 free(dentry->name); 520 free(dentry); 521 522 ipc_answer_0(rid, EOK); 523 } 524 499 525 /** 500 526 * @} -
uspace/srv/vfs/vfs.h
rb5553a2 rf17667a 48 48 49 49 typedef enum { 50 VFS_OPEN = VFS_FIRST, 51 VFS_CLOSE, 52 VFS_READ, 50 VFS_READ = VFS_FIRST, 53 51 VFS_WRITE, 54 52 VFS_TRUNCATE, 55 VFS_RENAME,56 VFS_OPENDIR,57 VFS_READDIR,58 VFS_CLOSEDIR,59 VFS_MKDIR,60 VFS_UNLINK,61 53 VFS_MOUNT, 62 54 VFS_UNMOUNT, … … 66 58 typedef enum { 67 59 VFS_LOOKUP = VFS_LAST_CMN, 60 VFS_FREE, 68 61 VFS_LAST_CLNT, /* keep this the last member of this enum */ 69 62 } vfs_request_clnt_t; … … 71 64 typedef enum { 72 65 VFS_REGISTER = VFS_LAST_CMN, 66 VFS_OPEN, 67 VFS_CLOSE, 73 68 VFS_SEEK, 69 VFS_MKDIR, 70 VFS_UNLINK, 71 VFS_RENAME, 74 72 VFS_LAST_SRV, /* keep this the last member of this enum */ 75 73 } vfs_request_srv_t; -
uspace/srv/vfs/vfs_file.c
rb5553a2 rf17667a 131 131 if (file->refcnt-- == 1) { 132 132 /* 133 * Lost last reference to a file, need to drop our reference133 * Lost the last reference to a file, need to drop our reference 134 134 * to the underlying VFS node. 135 135 */ -
uspace/srv/vfs/vfs_node.c
rb5553a2 rf17667a 44 44 #include <libadt/hash_table.h> 45 45 #include <assert.h> 46 #include <async.h> 47 #include <errno.h> 46 48 47 49 /** Futex protecting the VFS node hash table. */ … … 102 104 void vfs_node_delref(vfs_node_t *node) 103 105 { 106 bool free_vfs_node = false; 107 bool free_fs_node = false; 108 104 109 futex_down(&nodes_futex); 105 110 if (node->refcnt-- == 1) { 111 /* 112 * We are dropping the last reference to this node. 113 * Remove it from the VFS node hash table. 114 */ 106 115 unsigned long key[] = { 107 116 [KEY_FS_HANDLE] = node->fs_handle, … … 110 119 }; 111 120 hash_table_remove(&nodes, key, 3); 121 free_vfs_node = true; 122 if (!node->lnkcnt) 123 free_fs_node = true; 112 124 } 113 125 futex_up(&nodes_futex); 126 127 if (free_fs_node) { 128 /* 129 * The node is not visible in the file system namespace. 130 * Free up its resources. 131 */ 132 int phone = vfs_grab_phone(node->fs_handle); 133 ipcarg_t rc; 134 rc = async_req_2_0(phone, VFS_FREE, (ipcarg_t)node->dev_handle, 135 (ipcarg_t)node->index); 136 assert(rc == EOK); 137 vfs_release_phone(phone); 138 } 139 if (free_vfs_node) 140 free(node); 114 141 } 115 142 … … 197 224 void nodes_remove_callback(link_t *item) 198 225 { 199 vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link);200 free(node);201 226 } 202 227 -
uspace/srv/vfs/vfs_register.c
rb5553a2 rf17667a 105 105 if (info->ops[IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] != VFS_OP_DEFINED) { 106 106 dprintf("Operation VFS_LOOKUP not defined by the client.\n"); 107 return false;108 }109 if (info->ops[IPC_METHOD_TO_VFS_OP(VFS_OPEN)] != VFS_OP_DEFINED) {110 dprintf("Operation VFS_OPEN not defined by the client.\n");111 return false;112 }113 if (info->ops[IPC_METHOD_TO_VFS_OP(VFS_CLOSE)] != VFS_OP_DEFINED) {114 dprintf("Operation VFS_CLOSE not defined by the client.\n");115 107 return false; 116 108 }
Note:
See TracChangeset
for help on using the changeset viewer.