Changeset 5973fd0 in mainline for uspace/srv/fs/tmpfs
- Timestamp:
- 2008-01-18T23:45:16Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ae78b530
- Parents:
- 62da45a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r62da45a r5973fd0 46 46 #include <string.h> 47 47 #include <stdio.h> 48 #include <assert.h> 48 49 #include <sys/types.h> 49 50 #include <libadt/hash_table.h> … … 308 309 } 309 310 310 size_t bytes = max(0, min(dentry->size - pos, len)); 311 (void) ipc_data_read_finalize(callid, dentry->data + pos, bytes); 311 size_t bytes; 312 if (dentry->type == TMPFS_FILE) { 313 bytes = max(0, min(dentry->size - pos, len)); 314 (void) ipc_data_read_finalize(callid, dentry->data + pos, 315 bytes); 316 } else { 317 int i; 318 tmpfs_dentry_t *cur = dentry->child; 319 320 assert(dentry->type == TMPFS_DIRECTORY); 321 322 /* 323 * Yes, we really use O(n) algorithm here. 324 * If it bothers someone, it could be fixed by introducing a 325 * hash table. 326 */ 327 for (i = 0, cur = dentry->child; i < pos && cur; i++, 328 cur = cur->sibling) 329 ; 330 331 if (!cur) { 332 ipc_answer_0(callid, ENOENT); 333 ipc_answer_1(rid, ENOENT, 0); 334 return; 335 } 336 337 (void) ipc_data_read_finalize(callid, cur->name, 338 strlen(cur->name) + 1); 339 bytes = 1; 340 } 312 341 313 342 /*
Note:
See TracChangeset
for help on using the changeset viewer.