Changeset c1bf5cb in mainline
- Timestamp:
- 2007-12-26T00:50:49Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d46bf2
- Parents:
- ee1b8ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
ree1b8ca rc1bf5cb 346 346 347 347 /* 348 * Check whether the file needs to grow. 349 */ 350 if (pos + size <= dentry->size) { 351 /* The file size is not changing. */ 352 (void) ipc_data_write_deliver(callid, dentry->data + pos, size); 353 ipc_answer_1(rid, EOK, size); 354 return; 355 } 356 size_t delta = (pos + size) - dentry->size; 357 /* 348 358 * At this point, we are deliberately extremely straightforward and 349 * simply realloc the contents of the file on every write. In the end, 350 * the situation might not be as bad as it may look: our heap allocator 351 * can save us and just grow the block whenever possible. 352 */ 353 void *newdata = realloc(dentry->data, size); 359 * simply realloc the contents of the file on every write that grows the 360 * file. In the end, the situation might not be as bad as it may look: 361 * our heap allocator can save us and just grow the block whenever 362 * possible. 363 */ 364 void *newdata = realloc(dentry->data, dentry->size + delta); 354 365 if (!newdata) { 355 366 ipc_answer_0(callid, ENOMEM); … … 357 368 return; 358 369 } 359 dentry->size = size;370 dentry->size += delta; 360 371 dentry->data = newdata; 361 372 (void) ipc_data_write_deliver(callid, dentry->data + pos, size); 362 363 /*364 * Answer the VFS_WRITE call.365 */366 373 ipc_answer_1(rid, EOK, size); 367 374 }
Note:
See TracChangeset
for help on using the changeset viewer.