The VM store interface has changed to better match the one of the device interface.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8848 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+8
-8
@@ -35,30 +35,30 @@ store_commit(struct vm_store *_store, off_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
store_has_page(struct vm_store *_store, off_t offset)
|
store_has_page(struct vm_store *_store, off_t offset)
|
||||||
{
|
{
|
||||||
// We always pretend to have the page - even if it's beyond the size of
|
// We always pretend to have the page - even if it's beyond the size of
|
||||||
// the file. The read function will only cut down the size of the read,
|
// the file. The read function will only cut down the size of the read,
|
||||||
// it won't fail because of that.
|
// it won't fail because of that.
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
store_read(struct vm_store *_store, off_t offset, iovecs *vecs)
|
store_read(struct vm_store *_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
vnode_store *store = (vnode_store *)_store;
|
vnode_store *store = (vnode_store *)_store;
|
||||||
return vfs_read_page(store->vnode, vecs, offset);
|
return vfs_read_pages(store->vnode, offset, vecs, count, _numBytes);
|
||||||
// ToDo: the file system must currently clear out the remainder of the last page...
|
// ToDo: the file system must currently clear out the remainder of the last page...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
store_write(struct vm_store *_store, off_t offset, iovecs *vecs)
|
store_write(struct vm_store *_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
vnode_store *store = (vnode_store *)_store;
|
vnode_store *store = (vnode_store *)_store;
|
||||||
return vfs_write_page(store->vnode, vecs, offset);
|
return vfs_write_pages(store->vnode, offset, vecs, count, _numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2326,21 +2326,20 @@ vm_soft_fault(addr_t originalAddress, bool isWrite, bool isUser)
|
|||||||
// see if the vm_store has it
|
// see if the vm_store has it
|
||||||
if (cache_ref->cache->store->ops->has_page != NULL
|
if (cache_ref->cache->store->ops->has_page != NULL
|
||||||
&& cache_ref->cache->store->ops->has_page(cache_ref->cache->store, cache_offset)) {
|
&& cache_ref->cache->store->ops->has_page(cache_ref->cache->store, cache_offset)) {
|
||||||
IOVECS(vecs, 1);
|
size_t bytesRead;
|
||||||
|
iovec vec;
|
||||||
|
|
||||||
|
vec.iov_len = bytesRead = B_PAGE_SIZE;
|
||||||
|
|
||||||
TRACEPFAULT;
|
TRACEPFAULT;
|
||||||
|
|
||||||
mutex_unlock(&cache_ref->lock);
|
mutex_unlock(&cache_ref->lock);
|
||||||
|
|
||||||
vecs->num = 1;
|
|
||||||
vecs->total_len = PAGE_SIZE;
|
|
||||||
vecs->vec[0].iov_len = PAGE_SIZE;
|
|
||||||
|
|
||||||
page = vm_page_allocate_page(PAGE_STATE_FREE);
|
page = vm_page_allocate_page(PAGE_STATE_FREE);
|
||||||
(*aspace->translation_map.ops->get_physical_page)(page->ppn * PAGE_SIZE, (addr_t *)&vecs->vec[0].iov_base, PHYSICAL_PAGE_CAN_WAIT);
|
aspace->translation_map.ops->get_physical_page(page->ppn * PAGE_SIZE, (addr_t *)&vec.iov_base, PHYSICAL_PAGE_CAN_WAIT);
|
||||||
// ToDo: handle errors here
|
// ToDo: handle errors here
|
||||||
err = cache_ref->cache->store->ops->read(cache_ref->cache->store, cache_offset, vecs);
|
err = cache_ref->cache->store->ops->read(cache_ref->cache->store, cache_offset, &vec, 1, &bytesRead);
|
||||||
(*aspace->translation_map.ops->put_physical_page)((addr_t)vecs->vec[0].iov_base);
|
aspace->translation_map.ops->put_physical_page((addr_t)vec.iov_base);
|
||||||
|
|
||||||
mutex_lock(&cache_ref->lock);
|
mutex_lock(&cache_ref->lock);
|
||||||
|
|
||||||
|
|||||||
@@ -38,23 +38,23 @@ anonymous_commit(struct vm_store *store, off_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
anonymous_has_page(struct vm_store *store, off_t offset)
|
anonymous_has_page(struct vm_store *store, off_t offset)
|
||||||
{
|
{
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
anonymous_read(struct vm_store *store, off_t offset, iovecs *vecs)
|
anonymous_read(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
panic("anonymous_store: read called. Invalid!\n");
|
panic("anonymous_store: read called. Invalid!\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
anonymous_write(struct vm_store *store, off_t offset, iovecs *vecs)
|
anonymous_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
// no place to write, this will cause the page daemon to skip this store
|
// no place to write, this will cause the page daemon to skip this store
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -31,24 +31,24 @@ device_commit(struct vm_store *store, off_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
device_has_page(struct vm_store *store, off_t offset)
|
device_has_page(struct vm_store *store, off_t offset)
|
||||||
{
|
{
|
||||||
// this should never be called
|
// this should never be called
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
device_read(struct vm_store *store, off_t offset, iovecs *vecs)
|
device_read(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
panic("device_store: read called. Invalid!\n");
|
panic("device_store: read called. Invalid!\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
device_write(struct vm_store *store, off_t offset, iovecs *vecs)
|
device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
// no place to write, this will cause the page daemon to skip this store
|
// no place to write, this will cause the page daemon to skip this store
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -25,22 +25,22 @@ null_commit(struct vm_store *store, off_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
null_has_page(struct vm_store *store, off_t offset)
|
null_has_page(struct vm_store *store, off_t offset)
|
||||||
{
|
{
|
||||||
return 1; // we always have the page, man
|
return true; // we always have the page, man
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
null_read(struct vm_store *store, off_t offset, iovecs *vecs)
|
null_read(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static status_t
|
||||||
null_write(struct vm_store *store, off_t offset, iovecs *vecs)
|
null_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user