The VM fs interface has changed to better match the one of the device interface.
Added an fs call for the file cache. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8852 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
14d725bb50
commit
d5a48f5dcf
|
@ -306,15 +306,17 @@ bfs_remove_vnode(void *_ns, void *_node, bool reenter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static bool
|
||||||
bfs_can_page(fs_volume _fs, fs_vnode _v)
|
bfs_can_page(fs_volume _fs, fs_vnode _v)
|
||||||
{
|
{
|
||||||
return 0;
|
// ToDo: we're obviously not even asked...
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
bfs_read_pages(fs_volume _fs, fs_vnode _node, iovecs *vecs, off_t pos)
|
bfs_read_pages(fs_volume _fs, fs_vnode _node, off_t pos,
|
||||||
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
Inode *inode = (Inode *)_node;
|
Inode *inode = (Inode *)_node;
|
||||||
|
|
||||||
|
@ -323,21 +325,24 @@ bfs_read_pages(fs_volume _fs, fs_vnode _node, iovecs *vecs, off_t pos)
|
||||||
|
|
||||||
ReadLocked locked(inode->Lock());
|
ReadLocked locked(inode->Lock());
|
||||||
|
|
||||||
for (uint32 i = 0; i < vecs->num; i++) {
|
for (uint32 i = 0; i < count; i++) {
|
||||||
if (pos >= inode->Size()) {
|
if (pos >= inode->Size()) {
|
||||||
memset(vecs->vec[i].iov_base, 0, vecs->vec[i].iov_len);
|
memset(vecs[i].iov_base, 0, vecs[i].iov_len);
|
||||||
pos += vecs->vec[i].iov_len;
|
pos += vecs[i].iov_len;
|
||||||
|
*_numBytes -= vecs[i].iov_len;
|
||||||
} else {
|
} else {
|
||||||
uint32 length = vecs->vec[i].iov_len;
|
uint32 length = vecs[i].iov_len;
|
||||||
if (length > inode->Size() - pos)
|
if (length > inode->Size() - pos)
|
||||||
length = inode->Size() - pos;
|
length = inode->Size() - pos;
|
||||||
|
|
||||||
inode->ReadAt(pos, (uint8 *)vecs->vec[i].iov_base, &length);
|
inode->ReadAt(pos, (uint8 *)vecs[i].iov_base, &length);
|
||||||
|
|
||||||
if (length < vecs->vec[i].iov_len)
|
if (length < vecs[i].iov_len) {
|
||||||
memset((char *)vecs->vec[i].iov_base + length, 0, vecs->vec[i].iov_len - length);
|
memset((char *)vecs[i].iov_base + length, 0, vecs[i].iov_len - length);
|
||||||
|
*_numBytes -= vecs[i].iov_len - length;
|
||||||
|
}
|
||||||
|
|
||||||
pos += vecs->vec[i].iov_len;
|
pos += vecs[i].iov_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,8 +350,8 @@ bfs_read_pages(fs_volume _fs, fs_vnode _node, iovecs *vecs, off_t pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
bfs_write_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
|
bfs_write_pages(fs_volume _fs, fs_vnode _v, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return EPERM;
|
return EPERM;
|
||||||
}
|
}
|
||||||
|
@ -2001,6 +2006,8 @@ static file_system_info sBeFileSystem = {
|
||||||
&bfs_can_page,
|
&bfs_can_page,
|
||||||
&bfs_read_pages,
|
&bfs_read_pages,
|
||||||
&bfs_write_pages,
|
&bfs_write_pages,
|
||||||
|
|
||||||
|
NULL, // get_file_map()
|
||||||
|
|
||||||
&bfs_ioctl, // ioctl
|
&bfs_ioctl, // ioctl
|
||||||
&bfs_fsync, // sync
|
&bfs_fsync, // sync
|
||||||
|
|
Loading…
Reference in New Issue