haiku/src/system/kernel/cache/vnode_store.h

54 lines
1.3 KiB
C
Raw Normal View History

/*
* Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#ifndef VNODE_STORE_H
#define VNODE_STORE_H
#include <vm/VMCache.h>
struct file_cache_ref;
class VMVnodeCache : public VMCache {
public:
status_t Init(struct vnode *vnode);
virtual bool HasPage(off_t offset);
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
uint32 flags, size_t *_numBytes);
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
uint32 flags, size_t *_numBytes);
virtual status_t WriteAsync(off_t offset, const iovec* vecs,
size_t count, size_t numBytes, uint32 flags,
AsyncIOCallback* callback);
virtual bool CanWritePage(off_t offset);
virtual status_t Fault(struct VMAddressSpace *aspace, off_t offset);
virtual status_t AcquireUnreferencedStoreRef();
virtual void AcquireStoreRef();
virtual void ReleaseStoreRef();
void SetFileCacheRef(file_cache_ref* ref)
{ fFileCacheRef = ref; }
file_cache_ref* FileCacheRef() const
{ return fFileCacheRef; }
void VnodeDeleted() { fVnodeDeleted = true; }
private:
struct vnode* fVnode;
file_cache_ref* fFileCacheRef;
ino_t fInode;
dev_t fDevice;
volatile bool fVnodeDeleted;
};
#endif /* VNODE_STORE_H */