Orion
Barry Adding pipes e59e4fe (2 years, 4 months ago)diff --git a/vfs/tmpfs/file.c b/vfs/tmpfs/file.c index 252c88f..bc320ed 100644 --- a/vfs/tmpfs/file.c +++ b/vfs/tmpfs/file.c @@ -33,7 +33,7 @@ tmpfs_read(File *file, char *buf, size_t size, off_t offset) if (size + offset > file->inode->size) size = file->inode->size - offset; - uint16_t min; + uint16_t min, indent = offset % 4096; size_t count = 0; Page *page; page_t oldPage; @@ -44,11 +44,12 @@ tmpfs_read(File *file, char *buf, size_t size, off_t offset) break; acquire(&quickPageLock); oldPage = quick_page(page->frame); - memcpy(buf + count, QUICK_PAGE, min); + memcpy(buf + count, QUICK_PAGE + indent, min); quick_page(oldPage); release(&quickPageLock); size -= min; count += min; + indent = 0; } return count; } @@ -60,7 +61,7 @@ tmpfs_write(File *file, char *buf, size_t size, off_t offset) if (size + offset > file->inode->size) file->inode->size = size + offset; - uint16_t min; + uint16_t min, indent = offset % 4096; size_t count = 0; Page *page; page_t oldPage; @@ -72,11 +73,12 @@ tmpfs_write(File *file, char *buf, size_t size, off_t offset) offset); acquire(&quickPageLock); oldPage = quick_page(page->frame); - memcpy(QUICK_PAGE, buf + count, min); + memcpy(QUICK_PAGE + indent, buf + count, min); quick_page(oldPage); release(&quickPageLock); size -= min; count += min; + indent = 0; } return count; }