Changeset b17186d in mainline
- Timestamp:
- 2008-11-29T15:39:24Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dfd77382
- Parents:
- abd36f7
- Location:
- uspace/srv/vfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
rabd36f7 rb17186d 191 191 #define L_PARENT 64 192 192 193 typedef enum vfs_node_type { 194 VFS_NODE_UNKNOWN, 195 VFS_NODE_FILE, 196 VFS_NODE_DIRECTORY, 197 } vfs_node_type_t; 198 193 199 typedef struct { 194 200 vfs_triplet_t triplet; 201 vfs_node_type_t type; 195 202 size_t size; 196 203 unsigned lnkcnt; … … 214 221 215 222 link_t nh_link; /**< Node hash-table link. */ 223 224 vfs_node_type_t type; /**< Partial info about the node type. */ 225 216 226 size_t size; /**< Cached size if the node is a file. */ 217 227 -
uspace/srv/vfs/vfs_lookup.c
rabd36f7 rb17186d 183 183 result->size = (size_t) IPC_GET_ARG4(answer); 184 184 result->lnkcnt = (unsigned) IPC_GET_ARG5(answer); 185 if (lflag & L_FILE) 186 result->type = VFS_NODE_FILE; 187 else if (lflag & L_DIRECTORY) 188 result->type = VFS_NODE_DIRECTORY; 189 else 190 result->type = VFS_NODE_UNKNOWN; 185 191 } 186 192 -
uspace/srv/vfs/vfs_node.c
rabd36f7 rb17186d 176 176 node->size = result->size; 177 177 node->lnkcnt = result->lnkcnt; 178 node->type = result->type; 178 179 link_initialize(&node->nh_link); 179 180 rwlock_initialize(&node->contents_rwlock); … … 181 182 } else { 182 183 node = hash_table_get_instance(tmp, vfs_node_t, nh_link); 184 if (node->type == VFS_NODE_UNKNOWN && 185 result->type != VFS_NODE_UNKNOWN) { 186 /* Upgrade the node type. */ 187 node->type = result->type; 188 } 183 189 } 184 190 185 191 assert(node->size == result->size); 186 192 assert(node->lnkcnt == result->lnkcnt); 193 assert(node->type == result->type || result->type == VFS_NODE_UNKNOWN); 187 194 188 195 _vfs_node_addref(node); -
uspace/srv/vfs/vfs_ops.c
rabd36f7 rb17186d 235 235 mr_res.size = (size_t) rsize; 236 236 mr_res.lnkcnt = (unsigned) rlnkcnt; 237 mr_res.type = VFS_NODE_DIRECTORY; 237 238 238 239 rootfs.fs_handle = fs_handle; … … 302 303 int mode = IPC_GET_ARG3(*request); 303 304 size_t len; 305 306 /* 307 * Make sure that we are called with exactly one of L_FILE and 308 * L_DIRECTORY. 309 */ 310 if ((lflag & (L_FILE | L_DIRECTORY)) == 0 || 311 (lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) { 312 ipc_answer_0(rid, EINVAL); 313 return; 314 } 304 315 305 316 if (oflag & O_CREAT) … … 457 468 */ 458 469 futex_down(&file->lock); 459 470 460 471 /* 461 472 * Lock the file's node so that no other client can read/write to it at … … 466 477 else 467 478 rwlock_write_lock(&file->node->contents_rwlock); 479 480 if (file->node->type == VFS_NODE_DIRECTORY) { 481 /* 482 * Make sure that no one is modifying the namespace 483 * while we are in readdir(). 484 */ 485 assert(read); 486 rwlock_read_lock(&namespace_rwlock); 487 } 468 488 469 489 int fs_phone = vfs_grab_phone(file->node->fs_handle); … … 491 511 async_wait_for(msg, &rc); 492 512 size_t bytes = IPC_GET_ARG1(answer); 513 514 if (file->node->type == VFS_NODE_DIRECTORY) 515 rwlock_read_unlock(&namespace_rwlock); 493 516 494 517 /* Unlock the VFS node. */
Note:
See TracChangeset
for help on using the changeset viewer.