From 68085f7cec8bcd162513d752d97ebfe97e41f0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 6 Sep 2004 22:32:00 +0000 Subject: [PATCH] Added a "cookie" parameter to the fs_read|write|has_page[s](). Fixed the calculation of the amount of bytes read in bootfs_read_pages(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8874 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/fs/bootfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kernel/core/fs/bootfs.c b/src/kernel/core/fs/bootfs.c index 51d41ac510..6d57b3a817 100755 --- a/src/kernel/core/fs/bootfs.c +++ b/src/kernel/core/fs/bootfs.c @@ -811,7 +811,7 @@ bootfs_ioctl(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, ulong op, void *buf, static bool -bootfs_can_page(fs_volume _fs, fs_vnode _v) +bootfs_can_page(fs_volume _fs, fs_vnode _v, fs_cookie cookie) { struct bootfs_vnode *v = _v; @@ -825,7 +825,7 @@ bootfs_can_page(fs_volume _fs, fs_vnode _v) static status_t -bootfs_read_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes) +bootfs_read_pages(fs_volume _fs, fs_vnode _v, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes) { struct bootfs_vnode *v = _v; unsigned int i; @@ -836,6 +836,7 @@ bootfs_read_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size if (pos >= v->stream.u.file.len) { memset(vecs[i].iov_base, 0, vecs[i].iov_len); pos += vecs[i].iov_len; + *_numBytes -= vecs[i].iov_len; } else { unsigned int copy_len; @@ -845,7 +846,7 @@ bootfs_read_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size if (copy_len < vecs[i].iov_len) { memset((char *)vecs[i].iov_base + copy_len, 0, vecs[i].iov_len - copy_len); - *_numBytes = v->stream.u.file.len - pos; + *_numBytes -= v->stream.u.file.len - copy_len; } pos += vecs[i].iov_len; @@ -857,7 +858,7 @@ bootfs_read_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size static status_t -bootfs_write_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes) +bootfs_write_pages(fs_volume _fs, fs_vnode _v, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes) { TRACE(("bootfs_writepage: fs_cookie %p vnode %p, vecs %p, pos %Ld \n", _fs, _v, vecs, pos)); @@ -971,7 +972,7 @@ file_system_info gBootFileSystem = { &bootfs_can_page, &bootfs_read_pages, &bootfs_write_pages, - + NULL, // get_file_map() /* common */