Changeset 7fff5eab in mainline
- Timestamp:
- 2008-01-08T20:38:59Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67f63c4
- Parents:
- 752ccee
- Location:
- uspace/srv
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r752ccee r7fff5eab 275 275 } 276 276 277 ipc_answer_3(rid, EOK, tmpfs_reg.fs_handle, dev_handle, dcur->index); 277 ipc_answer_4(rid, EOK, tmpfs_reg.fs_handle, dev_handle, dcur->index, 278 dcur->size); 278 279 } 279 280 … … 373 374 dentry->data = newdata; 374 375 (void) ipc_data_write_finalize(callid, dentry->data + pos, len); 375 ipc_answer_ 1(rid, EOK, len);376 ipc_answer_2(rid, EOK, len, dentry->size); 376 377 } 377 378 -
uspace/srv/vfs/vfs.h
r752ccee r7fff5eab 188 188 extern int fs_name_to_handle(char *, bool); 189 189 190 extern int vfs_lookup_internal(char *, size_t, vfs_triplet_t *, vfs_pair_t *); 190 extern int vfs_lookup_internal(char *, size_t, vfs_triplet_t *, size_t *, 191 vfs_pair_t *); 191 192 192 193 extern bool vfs_nodes_init(void); 193 extern vfs_node_t *vfs_node_get(vfs_triplet_t * );194 extern vfs_node_t *vfs_node_get(vfs_triplet_t *, size_t); 194 195 extern void vfs_node_put(vfs_node_t *); 195 196 -
uspace/srv/vfs/vfs_lookup.c
r752ccee r7fff5eab 57 57 * @param len Number of path characters pointed by path. 58 58 * @param result Empty node structure where the result will be stored. 59 * @param size Storage where the size of the node will be stored. Can 60 * be NULL. 59 61 * @param altroot If non-empty, will be used instead of rootfs as the root 60 62 * of the whole VFS tree. … … 63 65 */ 64 66 int vfs_lookup_internal(char *path, size_t len, vfs_triplet_t *result, 65 vfs_pair_t *altroot)67 size_t *size, vfs_pair_t *altroot) 66 68 { 67 69 vfs_pair_t *root; … … 166 168 result->dev_handle = (int) IPC_GET_ARG2(answer); 167 169 result->index = (int) IPC_GET_ARG3(answer); 170 if (size) 171 *size = (size_t) IPC_GET_ARG4(answer); 168 172 } 169 173 -
uspace/srv/vfs/vfs_mount.c
r752ccee r7fff5eab 53 53 }; 54 54 55 static int lookup_root(int fs_handle, int dev_handle, vfs_triplet_t *root) 55 static int lookup_root(int fs_handle, int dev_handle, vfs_triplet_t *root, 56 size_t *size) 56 57 { 57 58 vfs_pair_t altroot = { … … 60 61 }; 61 62 62 return vfs_lookup_internal("/", strlen("/"), root, &altroot);63 return vfs_lookup_internal("/", strlen("/"), root, size, &altroot); 63 64 } 64 65 … … 161 162 int rc; 162 163 vfs_triplet_t mounted_root; 163 rc = lookup_root(fs_handle, dev_handle, &mounted_root); 164 size_t mrsz; 165 rc = lookup_root(fs_handle, dev_handle, &mounted_root, &mrsz); 164 166 if (rc != EOK) { 165 167 free(buf); … … 167 169 return; 168 170 } 169 vfs_node_t *mr_node = vfs_node_get(&mounted_root );171 vfs_node_t *mr_node = vfs_node_get(&mounted_root, mrsz); 170 172 if (!mr_node) { 171 173 free(buf); … … 178 180 */ 179 181 vfs_triplet_t mp; 182 size_t mpsz; 180 183 futex_down(&rootfs_futex); 181 184 if (rootfs.fs_handle) { … … 184 187 */ 185 188 rwlock_writer_lock(&namespace_rwlock); 186 rc = vfs_lookup_internal(buf, size, &mp, NULL);189 rc = vfs_lookup_internal(buf, size, &mp, &mpsz, NULL); 187 190 if (rc != EOK) { 188 191 /* … … 196 199 return; 197 200 } 198 mp_node = vfs_node_get(&mp );201 mp_node = vfs_node_get(&mp, mpsz); 199 202 if (!mp_node) { 200 203 rwlock_writer_unlock(&namespace_rwlock); -
uspace/srv/vfs/vfs_node.c
r752ccee r7fff5eab 43 43 #include <rwlock.h> 44 44 #include <libadt/hash_table.h> 45 #include <assert.h> 45 46 46 47 /** Futex protecting the VFS node hash table. */ … … 122 123 * 123 124 * @param triplet Triplet encoding the identity of the VFS node. 125 * @param size Size of the node as filled by vfs_lookup_internal(). 124 126 * 125 127 * @return VFS node corresponding to the given triplet. 126 128 */ 127 vfs_node_t *vfs_node_get(vfs_triplet_t *triplet )129 vfs_node_t *vfs_node_get(vfs_triplet_t *triplet, size_t size) 128 130 { 129 131 unsigned long key[] = { … … 147 149 node->dev_handle = triplet->fs_handle; 148 150 node->index = triplet->index; 151 node->size = size; 149 152 link_initialize(&node->nh_link); 150 153 rwlock_initialize(&node->contents_rwlock); … … 153 156 node = hash_table_get_instance(tmp, vfs_node_t, nh_link); 154 157 } 158 159 assert(node->size == size); 160 155 161 _vfs_node_addref(node); 156 162 futex_up(&nodes_futex); -
uspace/srv/vfs/vfs_open.c
r752ccee r7fff5eab 58 58 int flags = IPC_GET_ARG1(*request); 59 59 int mode = IPC_GET_ARG2(*request); 60 size_t size;60 size_t len; 61 61 62 62 ipc_callid_t callid; 63 63 64 if (!ipc_data_write_receive(&callid, & size)) {64 if (!ipc_data_write_receive(&callid, &len)) { 65 65 ipc_answer_0(callid, EINVAL); 66 66 ipc_answer_0(rid, EINVAL); … … 74 74 * directly into the PLB using some kind of a callback. 75 75 */ 76 char *path = malloc( size);76 char *path = malloc(len); 77 77 78 78 if (!path) { … … 83 83 84 84 int rc; 85 if ((rc = ipc_data_write_finalize(callid, path, size))) {85 if ((rc = ipc_data_write_finalize(callid, path, len))) { 86 86 ipc_answer_0(rid, rc); 87 87 free(path); … … 100 100 */ 101 101 vfs_triplet_t triplet; 102 rc = vfs_lookup_internal(path, size, &triplet, NULL); 102 size_t size; 103 rc = vfs_lookup_internal(path, len, &triplet, &size, NULL); 103 104 if (rc) { 104 105 rwlock_reader_unlock(&namespace_rwlock); … … 113 114 free(path); 114 115 115 vfs_node_t *node = vfs_node_get(&triplet );116 vfs_node_t *node = vfs_node_get(&triplet, size); 116 117 rwlock_reader_unlock(&namespace_rwlock); 117 118 -
uspace/srv/vfs/vfs_rdwr.c
r752ccee r7fff5eab 130 130 if (read) 131 131 rwlock_reader_unlock(&file->node->contents_rwlock); 132 else 132 else { 133 /* Update the cached version of node's size. */ 134 file->node->size = IPC_GET_ARG2(answer); 133 135 rwlock_writer_unlock(&file->node->contents_rwlock); 136 } 134 137 135 138 /*
Note:
See TracChangeset
for help on using the changeset viewer.