* bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since this is no longer the case, the argument has become superfluous. For read_pages() it always was. Removed the argument from the functions and all functions that propagated it. * Some whitespace at the end of lines was removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -119,11 +119,10 @@ struct fs_vnode_ops {
|
|||||||
/* VM file access */
|
/* VM file access */
|
||||||
bool (*can_page)(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
bool (*can_page)(fs_volume *volume, fs_vnode *vnode, void *cookie);
|
||||||
status_t (*read_pages)(fs_volume *volume, fs_vnode *vnode, void *cookie,
|
status_t (*read_pages)(fs_volume *volume, fs_vnode *vnode, void *cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes,
|
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes);
|
||||||
bool reenter);
|
|
||||||
status_t (*write_pages)(fs_volume *volume, fs_vnode *vnode,
|
status_t (*write_pages)(fs_volume *volume, fs_vnode *vnode,
|
||||||
void *cookie, off_t pos, const iovec *vecs, size_t count,
|
void *cookie, off_t pos, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool reenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
/* cache file access */
|
/* cache file access */
|
||||||
status_t (*get_file_map)(fs_volume *volume, fs_vnode *vnode, off_t offset,
|
status_t (*get_file_map)(fs_volume *volume, fs_vnode *vnode, off_t offset,
|
||||||
@@ -299,9 +298,9 @@ extern status_t get_vnode_removed(fs_volume *volume, ino_t vnodeID,
|
|||||||
bool *removed);
|
bool *removed);
|
||||||
|
|
||||||
extern status_t read_pages(int fd, off_t pos, const struct iovec *vecs,
|
extern status_t read_pages(int fd, off_t pos, const struct iovec *vecs,
|
||||||
size_t count, size_t *_numBytes, bool fsReenter);
|
size_t count, size_t *_numBytes);
|
||||||
extern status_t write_pages(int fd, off_t pos, const struct iovec *vecs,
|
extern status_t write_pages(int fd, off_t pos, const struct iovec *vecs,
|
||||||
size_t count, size_t *_numBytes, bool fsReenter);
|
size_t count, size_t *_numBytes);
|
||||||
extern status_t read_file_io_vec_pages(int fd,
|
extern status_t read_file_io_vec_pages(int fd,
|
||||||
const struct file_io_vec *fileVecs, size_t fileVecCount,
|
const struct file_io_vec *fileVecs, size_t fileVecCount,
|
||||||
const struct iovec *vecs, size_t vecCount,
|
const struct iovec *vecs, size_t vecCount,
|
||||||
|
|||||||
@@ -137,10 +137,10 @@ struct fssh_fs_vnode_ops {
|
|||||||
fssh_fs_cookie cookie);
|
fssh_fs_cookie cookie);
|
||||||
fssh_status_t (*read_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
fssh_status_t (*read_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||||
fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs,
|
fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs,
|
||||||
fssh_size_t count, fssh_size_t *_numBytes, bool reenter);
|
fssh_size_t count, fssh_size_t *_numBytes);
|
||||||
fssh_status_t (*write_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
fssh_status_t (*write_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||||
fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs,
|
fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs,
|
||||||
fssh_size_t count, fssh_size_t *_numBytes, bool reenter);
|
fssh_size_t count, fssh_size_t *_numBytes);
|
||||||
|
|
||||||
/* cache file access */
|
/* cache file access */
|
||||||
fssh_status_t (*get_file_map)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
fssh_status_t (*get_file_map)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||||
@@ -339,10 +339,10 @@ extern fssh_status_t fssh_get_vnode_removed(fssh_fs_volume *volume,
|
|||||||
|
|
||||||
extern fssh_status_t fssh_read_pages(int fd, fssh_off_t pos,
|
extern fssh_status_t fssh_read_pages(int fd, fssh_off_t pos,
|
||||||
const struct fssh_iovec *vecs, fssh_size_t count,
|
const struct fssh_iovec *vecs, fssh_size_t count,
|
||||||
fssh_size_t *_numBytes, bool fsReenter);
|
fssh_size_t *_numBytes);
|
||||||
extern fssh_status_t fssh_write_pages(int fd, fssh_off_t pos,
|
extern fssh_status_t fssh_write_pages(int fd, fssh_off_t pos,
|
||||||
const struct fssh_iovec *vecs, fssh_size_t count,
|
const struct fssh_iovec *vecs, fssh_size_t count,
|
||||||
fssh_size_t *_numBytes, bool fsReenter);
|
fssh_size_t *_numBytes);
|
||||||
extern fssh_status_t fssh_read_file_io_vec_pages(int fd,
|
extern fssh_status_t fssh_read_file_io_vec_pages(int fd,
|
||||||
const struct fssh_file_io_vec *fileVecs,
|
const struct fssh_file_io_vec *fileVecs,
|
||||||
fssh_size_t fileVecCount, const struct fssh_iovec *vecs,
|
fssh_size_t fileVecCount, const struct fssh_iovec *vecs,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define DEFAULT_FD_TABLE_SIZE 256
|
#define DEFAULT_FD_TABLE_SIZE 256
|
||||||
#define MAX_FD_TABLE_SIZE 8192
|
#define MAX_FD_TABLE_SIZE 8192
|
||||||
#define DEFAULT_NODE_MONITORS 4096
|
#define DEFAULT_NODE_MONITORS 4096
|
||||||
#define MAX_NODE_MONITORS 65536
|
#define MAX_NODE_MONITORS 65536
|
||||||
|
|
||||||
#define B_UNMOUNT_BUSY_PARTITION 0x80000000
|
#define B_UNMOUNT_BUSY_PARTITION 0x80000000
|
||||||
@@ -64,7 +64,7 @@ typedef struct io_context {
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status_t vfs_init(struct kernel_args *args);
|
status_t vfs_init(struct kernel_args *args);
|
||||||
status_t vfs_bootstrap_file_systems(void);
|
status_t vfs_bootstrap_file_systems(void);
|
||||||
@@ -94,9 +94,9 @@ void vfs_acquire_vnode(struct vnode *vnode);
|
|||||||
status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
||||||
bool vfs_can_page(struct vnode *vnode, void *cookie);
|
bool vfs_can_page(struct vnode *vnode, void *cookie);
|
||||||
status_t vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos,
|
status_t vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
|
const iovec *vecs, size_t count, size_t *_numBytes);
|
||||||
status_t vfs_write_pages(struct vnode *vnode, void *cookie, off_t pos,
|
status_t vfs_write_pages(struct vnode *vnode, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
|
const iovec *vecs, size_t count, size_t *_numBytes);
|
||||||
status_t vfs_get_vnode_cache(struct vnode *vnode, struct VMCache **_cache,
|
status_t vfs_get_vnode_cache(struct vnode *vnode, struct VMCache **_cache,
|
||||||
bool allocate);
|
bool allocate);
|
||||||
status_t vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size,
|
status_t vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size,
|
||||||
@@ -250,6 +250,6 @@ extern status_t _user_get_next_socket_stat(int family, uint32 *cookie,
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _KERNEL_VFS_H */
|
#endif /* _KERNEL_VFS_H */
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ size_t vm_page_num_free_pages(void);
|
|||||||
size_t vm_page_num_available_pages(void);
|
size_t vm_page_num_available_pages(void);
|
||||||
|
|
||||||
status_t vm_page_write_modified_page_range(struct VMCache *cache,
|
status_t vm_page_write_modified_page_range(struct VMCache *cache,
|
||||||
uint32 firstPage, uint32 endPage, bool fsReenter);
|
uint32 firstPage, uint32 endPage);
|
||||||
status_t vm_page_write_modified_pages(struct VMCache *cache, bool fsReenter);
|
status_t vm_page_write_modified_pages(struct VMCache *cache);
|
||||||
void vm_page_schedule_write_page(struct vm_page *page);
|
void vm_page_schedule_write_page(struct vm_page *page);
|
||||||
void vm_page_schedule_write_page_range(struct VMCache *cache,
|
void vm_page_schedule_write_page_range(struct VMCache *cache,
|
||||||
uint32 firstPage, uint32 endPage);
|
uint32 firstPage, uint32 endPage);
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public:
|
|||||||
status_t InsertAreaLocked(vm_area* area);
|
status_t InsertAreaLocked(vm_area* area);
|
||||||
status_t RemoveArea(vm_area* area);
|
status_t RemoveArea(vm_area* area);
|
||||||
|
|
||||||
status_t WriteModified(bool fsReenter);
|
status_t WriteModified();
|
||||||
status_t SetMinimalCommitment(off_t commitment);
|
status_t SetMinimalCommitment(off_t commitment);
|
||||||
status_t Resize(off_t newSize);
|
status_t Resize(off_t newSize);
|
||||||
|
|
||||||
@@ -217,9 +217,9 @@ public:
|
|||||||
virtual bool HasPage(off_t offset);
|
virtual bool HasPage(off_t offset);
|
||||||
|
|
||||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
||||||
|
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ bfs_can_page(fs_volume *_volume, fs_vnode *_v, void *_cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
Volume *volume = (Volume *)_volume->private_volume;
|
Volume *volume = (Volume *)_volume->private_volume;
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode *inode = (Inode *)_node->private_node;
|
||||||
@@ -340,8 +340,7 @@ bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
if (inode->FileCache() == NULL)
|
if (inode->FileCache() == NULL)
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_lock(&inode->Lock());
|
||||||
rw_lock_read_lock(&inode->Lock());
|
|
||||||
|
|
||||||
uint32 vecIndex = 0;
|
uint32 vecIndex = 0;
|
||||||
size_t vecOffset = 0;
|
size_t vecOffset = 0;
|
||||||
@@ -369,8 +368,7 @@ bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
bytesLeft -= bytes;
|
bytesLeft -= bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_unlock(&inode->Lock());
|
||||||
rw_lock_read_unlock(&inode->Lock());
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -378,7 +376,7 @@ bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_write_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
bfs_write_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
Volume *volume = (Volume *)_volume->private_volume;
|
Volume *volume = (Volume *)_volume->private_volume;
|
||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode *inode = (Inode *)_node->private_node;
|
||||||
@@ -389,8 +387,7 @@ bfs_write_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
if (inode->FileCache() == NULL)
|
if (inode->FileCache() == NULL)
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_lock(&inode->Lock());
|
||||||
rw_lock_read_lock(&inode->Lock());
|
|
||||||
|
|
||||||
uint32 vecIndex = 0;
|
uint32 vecIndex = 0;
|
||||||
size_t vecOffset = 0;
|
size_t vecOffset = 0;
|
||||||
@@ -418,8 +415,7 @@ bfs_write_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
bytesLeft -= bytes;
|
bytesLeft -= bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_unlock(&inode->Lock());
|
||||||
rw_lock_read_unlock(&inode->Lock());
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1584,7 +1584,7 @@ cdda_can_page(fs_volume *_volume, fs_vnode *_node, void *cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
cdda_read_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos,
|
cdda_read_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
@@ -1592,7 +1592,7 @@ cdda_read_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
cdda_write_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos,
|
cdda_write_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ ext2_can_page(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||||
off_t pos, const iovec* vecs, size_t count, size_t* _numBytes, bool reenter)
|
off_t pos, const iovec* vecs, size_t count, size_t* _numBytes)
|
||||||
{
|
{
|
||||||
Volume* volume = (Volume*)_volume->private_volume;
|
Volume* volume = (Volume*)_volume->private_volume;
|
||||||
Inode* inode = (Inode*)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
@@ -207,8 +207,7 @@ ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
|||||||
if (inode->FileCache() == NULL)
|
if (inode->FileCache() == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_lock(inode->Lock());
|
||||||
rw_lock_read_lock(inode->Lock());
|
|
||||||
|
|
||||||
uint32 vecIndex = 0;
|
uint32 vecIndex = 0;
|
||||||
size_t vecOffset = 0;
|
size_t vecOffset = 0;
|
||||||
@@ -236,8 +235,7 @@ ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
|||||||
bytesLeft -= bytes;
|
bytesLeft -= bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reenter)
|
rw_lock_read_unlock(inode->Lock());
|
||||||
rw_lock_read_unlock(inode->Lock());
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ fs_mount(fs_volume *_volume, const char *device, uint32 flags,
|
|||||||
|
|
||||||
uint32 len = strlen(buf);
|
uint32 len = strlen(buf);
|
||||||
// lower case the parms data
|
// lower case the parms data
|
||||||
for (i = 0; i < len + 1; i++)
|
for (i = 0; i < len + 1; i++)
|
||||||
buf[i] = tolower(buf[i]);
|
buf[i] = tolower(buf[i]);
|
||||||
|
|
||||||
// look for nojoliet
|
// look for nojoliet
|
||||||
@@ -252,7 +252,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
|
|||||||
TRACE(("fs_walk - read buffer from disk at LBN %Ld into buffer 0x%x.\n",
|
TRACE(("fs_walk - read buffer from disk at LBN %Ld into buffer 0x%x.\n",
|
||||||
block, blockData));
|
block, blockData));
|
||||||
|
|
||||||
// Move to the next 2-block set if necessary
|
// Move to the next 2-block set if necessary
|
||||||
// Don't go over end of buffer, if dir record sits on boundary.
|
// Don't go over end of buffer, if dir record sits on boundary.
|
||||||
|
|
||||||
node.fileIDString = NULL;
|
node.fileIDString = NULL;
|
||||||
@@ -285,7 +285,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
|
|||||||
free(node.attr.slName);
|
free(node.attr.slName);
|
||||||
node.attr.slName = NULL;
|
node.attr.slName = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = initResult;
|
result = initResult;
|
||||||
if (bytesRead == 0)
|
if (bytesRead == 0)
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
@@ -298,7 +298,7 @@ fs_walk(fs_volume *_vol, fs_vnode *_base, const char *file, ino_t *_vnodeID)
|
|||||||
}
|
}
|
||||||
totalRead += ns->logicalBlkSize[FS_DATA_FORMAT];
|
totalRead += ns->logicalBlkSize[FS_DATA_FORMAT];
|
||||||
block++;
|
block++;
|
||||||
|
|
||||||
TRACE(("fs_walk - moving to next block %Ld, total read %Ld\n", block, totalRead));
|
TRACE(("fs_walk - moving to next block %Ld, total read %Ld\n", block, totalRead));
|
||||||
block_cache_put(ns->fBlockCache, cachedBlock);
|
block_cache_put(ns->fBlockCache, cachedBlock);
|
||||||
|
|
||||||
@@ -340,12 +340,12 @@ fs_read_vnode(fs_volume *_vol, ino_t vnodeID, fs_vnode *_node,
|
|||||||
|
|
||||||
status_t result = InitNode(newNode, data + pos, NULL, ns->joliet_level);
|
status_t result = InitNode(newNode, data + pos, NULL, ns->joliet_level);
|
||||||
block_cache_put(ns->fBlockCache, block);
|
block_cache_put(ns->fBlockCache, block);
|
||||||
|
|
||||||
if (result < B_OK) {
|
if (result < B_OK) {
|
||||||
free(newNode);
|
free(newNode);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
newNode->id = vnodeID;
|
newNode->id = vnodeID;
|
||||||
_node->private_node = newNode;
|
_node->private_node = newNode;
|
||||||
_node->ops = &gISO9660VnodeOps;
|
_node->ops = &gISO9660VnodeOps;
|
||||||
@@ -372,7 +372,7 @@ fs_release_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
|||||||
|
|
||||||
TRACE(("fs_release_vnode - ENTER (0x%x)\n", node));
|
TRACE(("fs_release_vnode - ENTER (0x%x)\n", node));
|
||||||
|
|
||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
if (node->id != ISO_ROOTNODE_ID) {
|
if (node->id != ISO_ROOTNODE_ID) {
|
||||||
if (node->fileIDString != NULL)
|
if (node->fileIDString != NULL)
|
||||||
free (node->fileIDString);
|
free (node->fileIDString);
|
||||||
@@ -392,7 +392,7 @@ fs_release_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fs_read_pages(fs_volume *_vol, fs_vnode *_node, void * _cookie, off_t pos,
|
fs_read_pages(fs_volume *_vol, fs_vnode *_node, void * _cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace *)_vol->private_volume;
|
nspace *ns = (nspace *)_vol->private_volume;
|
||||||
vnode *node = (vnode *)_node->private_node;
|
vnode *node = (vnode *)_node->private_node;
|
||||||
@@ -441,7 +441,7 @@ fs_read_stat(fs_volume *_vol, fs_vnode *_node, struct stat *st)
|
|||||||
|
|
||||||
// Same for file/dir in ISO9660
|
// Same for file/dir in ISO9660
|
||||||
st->st_size = node->dataLen[FS_DATA_FORMAT];
|
st->st_size = node->dataLen[FS_DATA_FORMAT];
|
||||||
if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR)
|
if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR)
|
||||||
st->st_ctime = st->st_mtime = st->st_atime = time;
|
st->st_ctime = st->st_mtime = st->st_atime = time;
|
||||||
|
|
||||||
TRACE(("fs_read_stat - EXIT, result is %s\n", strerror(result)));
|
TRACE(("fs_read_stat - EXIT, result is %s\n", strerror(result)));
|
||||||
@@ -595,7 +595,7 @@ fs_read_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buff
|
|||||||
TRACE(("fs_read_dir - EXIT, result is %s\n", strerror(result)));
|
TRACE(("fs_read_dir - EXIT, result is %s\n", strerror(result)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fs_rewind_dir(fs_volume *_vol, fs_vnode *_node, void* _cookie)
|
fs_rewind_dir(fs_volume *_vol, fs_vnode *_node, void* _cookie)
|
||||||
|
|||||||
+8
-8
@@ -211,7 +211,7 @@ read_into_cache(file_cache_ref *ref, void *cookie, off_t offset,
|
|||||||
|
|
||||||
// read file into reserved pages
|
// read file into reserved pages
|
||||||
status_t status = vfs_read_pages(ref->vnode, cookie, offset, vecs,
|
status_t status = vfs_read_pages(ref->vnode, cookie, offset, vecs,
|
||||||
vecCount, &numBytes, false);
|
vecCount, &numBytes);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
// reading failed, free allocated pages
|
// reading failed, free allocated pages
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ read_from_file(file_cache_ref *ref, void *cookie, off_t offset,
|
|||||||
vm_page_unreserve_pages(lastReservedPages);
|
vm_page_unreserve_pages(lastReservedPages);
|
||||||
|
|
||||||
status_t status = vfs_read_pages(ref->vnode, cookie, offset + pageOffset,
|
status_t status = vfs_read_pages(ref->vnode, cookie, offset + pageOffset,
|
||||||
&vec, 1, &bufferSize, false);
|
&vec, 1, &bufferSize);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
reserve_pages(ref, reservePages, false);
|
reserve_pages(ref, reservePages, false);
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ write_to_cache(file_cache_ref *ref, void *cookie, off_t offset,
|
|||||||
size_t bytesRead = B_PAGE_SIZE;
|
size_t bytesRead = B_PAGE_SIZE;
|
||||||
|
|
||||||
status = vfs_read_pages(ref->vnode, cookie, offset, &readVec, 1,
|
status = vfs_read_pages(ref->vnode, cookie, offset, &readVec, 1,
|
||||||
&bytesRead, false);
|
&bytesRead);
|
||||||
// ToDo: handle errors for real!
|
// ToDo: handle errors for real!
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
panic("1. vfs_read_pages() failed: %s!\n", strerror(status));
|
panic("1. vfs_read_pages() failed: %s!\n", strerror(status));
|
||||||
@@ -385,7 +385,7 @@ write_to_cache(file_cache_ref *ref, void *cookie, off_t offset,
|
|||||||
|
|
||||||
status = vfs_read_pages(ref->vnode, cookie,
|
status = vfs_read_pages(ref->vnode, cookie,
|
||||||
PAGE_ALIGN(offset + pageOffset + bufferSize) - B_PAGE_SIZE,
|
PAGE_ALIGN(offset + pageOffset + bufferSize) - B_PAGE_SIZE,
|
||||||
&readVec, 1, &bytesRead, false);
|
&readVec, 1, &bytesRead);
|
||||||
// ToDo: handle errors for real!
|
// ToDo: handle errors for real!
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
panic("vfs_read_pages() failed: %s!\n", strerror(status));
|
panic("vfs_read_pages() failed: %s!\n", strerror(status));
|
||||||
@@ -420,7 +420,7 @@ write_to_cache(file_cache_ref *ref, void *cookie, off_t offset,
|
|||||||
if (writeThrough) {
|
if (writeThrough) {
|
||||||
// write cached pages back to the file if we were asked to do that
|
// write cached pages back to the file if we were asked to do that
|
||||||
status_t status = vfs_write_pages(ref->vnode, cookie, offset, vecs,
|
status_t status = vfs_write_pages(ref->vnode, cookie, offset, vecs,
|
||||||
vecCount, &numBytes, false);
|
vecCount, &numBytes);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
// ToDo: remove allocated pages, ...?
|
// ToDo: remove allocated pages, ...?
|
||||||
panic("file_cache: remove allocated pages! write pages failed: %s\n",
|
panic("file_cache: remove allocated pages! write pages failed: %s\n",
|
||||||
@@ -491,7 +491,7 @@ write_to_file(file_cache_ref *ref, void *cookie, off_t offset, int32 pageOffset,
|
|||||||
chunkSize = bufferSize;
|
chunkSize = bufferSize;
|
||||||
|
|
||||||
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
||||||
&vec, 1, &chunkSize, false);
|
&vec, 1, &chunkSize);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -502,7 +502,7 @@ write_to_file(file_cache_ref *ref, void *cookie, off_t offset, int32 pageOffset,
|
|||||||
free((void*)buffer);
|
free((void*)buffer);
|
||||||
} else {
|
} else {
|
||||||
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset,
|
||||||
&vec, 1, &bufferSize, false);
|
&vec, 1, &bufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
@@ -958,7 +958,7 @@ file_cache_sync(void *_cacheRef)
|
|||||||
if (ref == NULL)
|
if (ref == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
return ref->cache->WriteModified(false);
|
return ref->cache->WriteModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -41,12 +41,12 @@ VMVnodeCache::HasPage(off_t offset)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMVnodeCache::Read(off_t offset, const iovec *vecs, size_t count,
|
VMVnodeCache::Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
size_t bytesUntouched = *_numBytes;
|
size_t bytesUntouched = *_numBytes;
|
||||||
|
|
||||||
status_t status = vfs_read_pages(fVnode, NULL, offset, vecs, count,
|
status_t status = vfs_read_pages(fVnode, NULL, offset, vecs, count,
|
||||||
_numBytes, fsReenter);
|
_numBytes);
|
||||||
|
|
||||||
bytesUntouched -= *_numBytes;
|
bytesUntouched -= *_numBytes;
|
||||||
|
|
||||||
@@ -73,10 +73,9 @@ VMVnodeCache::Read(off_t offset, const iovec *vecs, size_t count,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMVnodeCache::Write(off_t offset, const iovec *vecs, size_t count,
|
VMVnodeCache::Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return vfs_write_pages(fVnode, NULL, offset, vecs, count, _numBytes,
|
return vfs_write_pages(fVnode, NULL, offset, vecs, count, _numBytes);
|
||||||
fsReenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -20,9 +20,9 @@ public:
|
|||||||
virtual bool HasPage(off_t offset);
|
virtual bool HasPage(off_t offset);
|
||||||
|
|
||||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
||||||
|
|
||||||
|
|||||||
@@ -1593,7 +1593,7 @@ devfs_can_page(fs_volume *_volume, fs_vnode *_vnode, void *cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
devfs_read_pages(fs_volume *_volume, fs_vnode *_vnode, void *_cookie,
|
devfs_read_pages(fs_volume *_volume, fs_vnode *_vnode, void *_cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
struct devfs_vnode *vnode = (devfs_vnode *)_vnode->private_node;
|
struct devfs_vnode *vnode = (devfs_vnode *)_vnode->private_node;
|
||||||
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
|
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
|
||||||
@@ -1651,7 +1651,7 @@ devfs_read_pages(fs_volume *_volume, fs_vnode *_vnode, void *_cookie,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
devfs_write_pages(fs_volume* _volume, fs_vnode* _vnode, void* _cookie,
|
devfs_write_pages(fs_volume* _volume, fs_vnode* _vnode, void* _cookie,
|
||||||
off_t pos, const iovec* vecs, size_t count, size_t* _numBytes, bool reenter)
|
off_t pos, const iovec* vecs, size_t count, size_t* _numBytes)
|
||||||
{
|
{
|
||||||
struct devfs_vnode *vnode = (devfs_vnode *)_vnode->private_node;
|
struct devfs_vnode *vnode = (devfs_vnode *)_vnode->private_node;
|
||||||
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
|
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ Inode::~Inode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::InitCheck()
|
Inode::InitCheck()
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -920,7 +920,7 @@ fifo_deselect(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
|||||||
Inode *inode = (Inode *)_node->private_node;
|
Inode *inode = (Inode *)_node->private_node;
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
MutexLocker locker(inode->RequestLock());
|
MutexLocker locker(inode->RequestLock());
|
||||||
return inode->Deselect(event, sync, cookie->open_mode);
|
return inode->Deselect(event, sync, cookie->open_mode);
|
||||||
}
|
}
|
||||||
@@ -935,7 +935,7 @@ fifo_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
@@ -943,7 +943,7 @@ fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
fifo_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie,
|
fifo_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie,
|
||||||
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
off_t pos, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ rootfs_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
rootfs_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
rootfs_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
@@ -821,7 +821,7 @@ rootfs_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
rootfs_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
rootfs_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool reenter)
|
const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1056,7 +1056,7 @@ vnode_low_resource_handler(void */*data*/, uint32 resources, int32 level)
|
|||||||
mutex_unlock(&sVnodeMutex);
|
mutex_unlock(&sVnodeMutex);
|
||||||
|
|
||||||
if (vnode->cache != NULL)
|
if (vnode->cache != NULL)
|
||||||
vnode->cache->WriteModified(false);
|
vnode->cache->WriteModified();
|
||||||
|
|
||||||
dec_vnode_ref_count(vnode, true, false);
|
dec_vnode_ref_count(vnode, true, false);
|
||||||
// this should free the vnode when it's still unused
|
// this should free the vnode when it's still unused
|
||||||
@@ -2912,7 +2912,7 @@ common_file_io_vec_pages(struct vnode *vnode, void *cookie,
|
|||||||
size = numBytes;
|
size = numBytes;
|
||||||
|
|
||||||
status = FS_CALL(vnode, read_pages, cookie, fileVecs[0].offset,
|
status = FS_CALL(vnode, read_pages, cookie, fileVecs[0].offset,
|
||||||
&vecs[vecIndex], vecCount - vecIndex, &size, false);
|
&vecs[vecIndex], vecCount - vecIndex, &size);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -3007,10 +3007,10 @@ common_file_io_vec_pages(struct vnode *vnode, void *cookie,
|
|||||||
size_t bytes = size;
|
size_t bytes = size;
|
||||||
if (doWrite) {
|
if (doWrite) {
|
||||||
status = FS_CALL(vnode, write_pages, cookie, fileOffset,
|
status = FS_CALL(vnode, write_pages, cookie, fileOffset,
|
||||||
tempVecs, tempCount, &bytes, false);
|
tempVecs, tempCount, &bytes);
|
||||||
} else {
|
} else {
|
||||||
status = FS_CALL(vnode, read_pages, cookie, fileOffset,
|
status = FS_CALL(vnode, read_pages, cookie, fileOffset,
|
||||||
tempVecs, tempCount, &bytes, false);
|
tempVecs, tempCount, &bytes);
|
||||||
}
|
}
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -3282,7 +3282,7 @@ get_vnode_removed(fs_volume *volume, ino_t vnodeID, bool* removed)
|
|||||||
|
|
||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
read_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
read_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
struct file_descriptor *descriptor;
|
struct file_descriptor *descriptor;
|
||||||
struct vnode *vnode;
|
struct vnode *vnode;
|
||||||
@@ -3292,7 +3292,7 @@ read_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
|||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
status_t status = FS_CALL(vnode, read_pages, descriptor->cookie, pos, vecs,
|
status_t status = FS_CALL(vnode, read_pages, descriptor->cookie, pos, vecs,
|
||||||
count, _numBytes, fsReenter);
|
count, _numBytes);
|
||||||
|
|
||||||
put_fd(descriptor);
|
put_fd(descriptor);
|
||||||
return status;
|
return status;
|
||||||
@@ -3301,7 +3301,7 @@ read_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
|||||||
|
|
||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
write_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
write_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
struct file_descriptor *descriptor;
|
struct file_descriptor *descriptor;
|
||||||
struct vnode *vnode;
|
struct vnode *vnode;
|
||||||
@@ -3311,7 +3311,7 @@ write_pages(int fd, off_t pos, const iovec *vecs, size_t count,
|
|||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
status_t status = FS_CALL(vnode, write_pages, descriptor->cookie, pos, vecs,
|
status_t status = FS_CALL(vnode, write_pages, descriptor->cookie, pos, vecs,
|
||||||
count, _numBytes, fsReenter);
|
count, _numBytes);
|
||||||
|
|
||||||
put_fd(descriptor);
|
put_fd(descriptor);
|
||||||
return status;
|
return status;
|
||||||
@@ -3888,23 +3888,21 @@ vfs_can_page(struct vnode *vnode, void *cookie)
|
|||||||
|
|
||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos, const iovec *vecs,
|
vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos, const iovec *vecs,
|
||||||
size_t count, size_t *_numBytes, bool fsReenter)
|
size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
FUNCTION(("vfs_read_pages: vnode %p, vecs %p, pos %Ld\n", vnode, vecs, pos));
|
FUNCTION(("vfs_read_pages: vnode %p, vecs %p, pos %Ld\n", vnode, vecs, pos));
|
||||||
|
|
||||||
return FS_CALL(vnode, read_pages, cookie, pos, vecs, count, _numBytes,
|
return FS_CALL(vnode, read_pages, cookie, pos, vecs, count, _numBytes);
|
||||||
fsReenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
vfs_write_pages(struct vnode *vnode, void *cookie, off_t pos, const iovec *vecs,
|
vfs_write_pages(struct vnode *vnode, void *cookie, off_t pos, const iovec *vecs,
|
||||||
size_t count, size_t *_numBytes, bool fsReenter)
|
size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
FUNCTION(("vfs_write_pages: vnode %p, vecs %p, pos %Ld\n", vnode, vecs, pos));
|
FUNCTION(("vfs_write_pages: vnode %p, vecs %p, pos %Ld\n", vnode, vecs, pos));
|
||||||
|
|
||||||
return FS_CALL(vnode, write_pages, cookie, pos, vecs, count, _numBytes,
|
return FS_CALL(vnode, write_pages, cookie, pos, vecs, count, _numBytes);
|
||||||
fsReenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6712,7 +6710,7 @@ fs_sync(dev_t device)
|
|||||||
put_vnode(previousVnode);
|
put_vnode(previousVnode);
|
||||||
|
|
||||||
if (vnode->cache != NULL)
|
if (vnode->cache != NULL)
|
||||||
vnode->cache->WriteModified(false);
|
vnode->cache->WriteModified();
|
||||||
|
|
||||||
// the next vnode might change until we lock the vnode list again,
|
// the next vnode might change until we lock the vnode list again,
|
||||||
// but this vnode won't go away since we keep a reference to it.
|
// but this vnode won't go away since we keep a reference to it.
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ VMAnonymousCache::HasPage(off_t offset)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count,
|
VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
off_t cacheOffset = offset >> PAGE_SHIFT;
|
off_t cacheOffset = offset >> PAGE_SHIFT;
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count,
|
|||||||
off_t pos = (startPageIndex - swapFile->first_page) * PAGE_SIZE;
|
off_t pos = (startPageIndex - swapFile->first_page) * PAGE_SIZE;
|
||||||
|
|
||||||
status_t status = vfs_read_pages(swapFile->vnode, NULL, pos, vecs + i,
|
status_t status = vfs_read_pages(swapFile->vnode, NULL, pos, vecs + i,
|
||||||
j - i, _numBytes, fsReenter);
|
j - i, _numBytes);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMAnonymousCache::Write(off_t offset, const iovec *vecs, size_t count,
|
VMAnonymousCache::Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
offset >>= PAGE_SHIFT;
|
offset >>= PAGE_SHIFT;
|
||||||
uint32 n = count;
|
uint32 n = count;
|
||||||
@@ -243,7 +243,7 @@ VMAnonymousCache::Write(off_t offset, const iovec *vecs, size_t count,
|
|||||||
off_t pos = (pageIndex - swapFile->first_page) * PAGE_SIZE;
|
off_t pos = (pageIndex - swapFile->first_page) * PAGE_SIZE;
|
||||||
|
|
||||||
status_t status = vfs_write_pages(swapFile->vnode, NULL, pos, vecs + i ,
|
status_t status = vfs_write_pages(swapFile->vnode, NULL, pos, vecs + i ,
|
||||||
n, _numBytes, fsReenter);
|
n, _numBytes);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ public:
|
|||||||
virtual bool HasPage(off_t offset);
|
virtual bool HasPage(off_t offset);
|
||||||
|
|
||||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ VMAnonymousNoSwapCache::HasPage(off_t offset)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMAnonymousNoSwapCache::Read(off_t offset, const iovec *vecs, size_t count,
|
VMAnonymousNoSwapCache::Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
panic("anonymous_store: read called. Invalid!\n");
|
panic("anonymous_store: read called. Invalid!\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -105,7 +105,7 @@ VMAnonymousNoSwapCache::Read(off_t offset, const iovec *vecs, size_t count,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMAnonymousNoSwapCache::Write(off_t offset, const iovec *vecs, size_t count,
|
VMAnonymousNoSwapCache::Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
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 B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ public:
|
|||||||
virtual bool HasPage(off_t offset);
|
virtual bool HasPage(off_t offset);
|
||||||
|
|
||||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
virtual status_t Fault(struct vm_address_space *aspace, off_t offset);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ VMDeviceCache::HasPage(off_t offset)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMDeviceCache::Read(off_t offset, const iovec *vecs, size_t count,
|
VMDeviceCache::Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
size_t *_numBytes)
|
||||||
{
|
{
|
||||||
panic("device_store: read called. Invalid!\n");
|
panic("device_store: read called. Invalid!\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -36,7 +36,7 @@ VMDeviceCache::Read(off_t offset, const iovec *vecs, size_t count,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMDeviceCache::Write(off_t offset, const iovec *vecs, size_t count,
|
VMDeviceCache::Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter)
|
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 B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public:
|
|||||||
virtual bool HasPage(off_t offset);
|
virtual bool HasPage(off_t offset);
|
||||||
|
|
||||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||||
size_t *_numBytes, bool fsReenter);
|
size_t *_numBytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
addr_t fBaseAddress;
|
addr_t fBaseAddress;
|
||||||
|
|||||||
@@ -2249,7 +2249,7 @@ delete_area(vm_address_space *addressSpace, vm_area *area)
|
|||||||
vm_unmap_pages(area, area->base, area->size, !area->cache->temporary);
|
vm_unmap_pages(area, area->base, area->size, !area->cache->temporary);
|
||||||
|
|
||||||
if (!area->cache->temporary)
|
if (!area->cache->temporary)
|
||||||
area->cache->WriteModified(false);
|
area->cache->WriteModified();
|
||||||
|
|
||||||
arch_vm_unset_memory_type(area);
|
arch_vm_unset_memory_type(area);
|
||||||
remove_area_from_address_space(addressSpace, area);
|
remove_area_from_address_space(addressSpace, area);
|
||||||
@@ -4195,8 +4195,7 @@ fault_find_page(vm_translation_map *map, vm_cache *topCache,
|
|||||||
size_t bytesRead = vec.iov_len = B_PAGE_SIZE;
|
size_t bytesRead = vec.iov_len = B_PAGE_SIZE;
|
||||||
|
|
||||||
// read it in
|
// read it in
|
||||||
status_t status = cache->Read(cacheOffset, &vec, 1, &bytesRead,
|
status_t status = cache->Read(cacheOffset, &vec, 1, &bytesRead);
|
||||||
false);
|
|
||||||
|
|
||||||
map->ops->put_physical_page((addr_t)vec.iov_base);
|
map->ops->put_physical_page((addr_t)vec.iov_base);
|
||||||
|
|
||||||
@@ -5759,7 +5758,7 @@ _user_sync_memory(void *_address, addr_t size, int flags)
|
|||||||
if (writeSync) {
|
if (writeSync) {
|
||||||
// synchronous
|
// synchronous
|
||||||
error = vm_page_write_modified_page_range(cache, firstPage,
|
error = vm_page_write_modified_page_range(cache, firstPage,
|
||||||
endPage, false);
|
endPage);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ VMCache::RemoveArea(vm_area* area)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMCache::WriteModified(bool fsReenter)
|
VMCache::WriteModified()
|
||||||
{
|
{
|
||||||
TRACE(("VMCache::WriteModified(cache = %p)\n", this));
|
TRACE(("VMCache::WriteModified(cache = %p)\n", this));
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ VMCache::WriteModified(bool fsReenter)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
status_t status = vm_page_write_modified_pages(this, fsReenter);
|
status_t status = vm_page_write_modified_pages(this);
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -813,16 +813,14 @@ VMCache::HasPage(off_t offset)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMCache::Read(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes,
|
VMCache::Read(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
bool fsReenter)
|
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VMCache::Write(off_t offset, const iovec *vecs, size_t count,
|
VMCache::Write(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
size_t *_numBytes, bool fsReenter)
|
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ page_scrubber(void *unused)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
write_page(vm_page *page, bool fsReenter)
|
write_page(vm_page *page)
|
||||||
{
|
{
|
||||||
size_t length = B_PAGE_SIZE;
|
size_t length = B_PAGE_SIZE;
|
||||||
status_t status;
|
status_t status;
|
||||||
@@ -859,7 +859,7 @@ write_page(vm_page *page, bool fsReenter)
|
|||||||
vecs->iov_len = B_PAGE_SIZE;
|
vecs->iov_len = B_PAGE_SIZE;
|
||||||
|
|
||||||
status = page->cache->Write((off_t)page->cache_offset << PAGE_SHIFT,
|
status = page->cache->Write((off_t)page->cache_offset << PAGE_SHIFT,
|
||||||
vecs, 1, &length, fsReenter);
|
vecs, 1, &length);
|
||||||
|
|
||||||
vm_put_physical_page((addr_t)vecs[0].iov_base);
|
vm_put_physical_page((addr_t)vecs[0].iov_base);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1035,7 +1035,7 @@ page_writer(void* /*unused*/)
|
|||||||
// TODO: put this as requests into the I/O scheduler
|
// TODO: put this as requests into the I/O scheduler
|
||||||
status_t writeStatus[kNumPages];
|
status_t writeStatus[kNumPages];
|
||||||
for (uint32 i = 0; i < numPages; i++) {
|
for (uint32 i = 0; i < numPages; i++) {
|
||||||
writeStatus[i] = write_page(u.pages[i], false);
|
writeStatus[i] = write_page(u.pages[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark pages depending on whether they could be written or not
|
// mark pages depending on whether they could be written or not
|
||||||
@@ -1280,7 +1280,7 @@ steal_pages(vm_page **pages, size_t count, bool reserve)
|
|||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage,
|
vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage,
|
||||||
uint32 endPage, bool fsReenter)
|
uint32 endPage)
|
||||||
{
|
{
|
||||||
// TODO: join adjacent pages into one vec list
|
// TODO: join adjacent pages into one vec list
|
||||||
|
|
||||||
@@ -1321,7 +1321,7 @@ vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage,
|
|||||||
vm_clear_map_flags(page, PAGE_MODIFIED);
|
vm_clear_map_flags(page, PAGE_MODIFIED);
|
||||||
|
|
||||||
cache->Unlock();
|
cache->Unlock();
|
||||||
status_t status = write_page(page, fsReenter);
|
status_t status = write_page(page);
|
||||||
cache->Lock();
|
cache->Lock();
|
||||||
|
|
||||||
InterruptsSpinLocker locker(&sPageLock);
|
InterruptsSpinLocker locker(&sPageLock);
|
||||||
@@ -1361,10 +1361,10 @@ vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage,
|
|||||||
Note that the cache lock is released in this function.
|
Note that the cache lock is released in this function.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
vm_page_write_modified_pages(vm_cache *cache, bool fsReenter)
|
vm_page_write_modified_pages(vm_cache *cache)
|
||||||
{
|
{
|
||||||
return vm_page_write_modified_page_range(cache, 0,
|
return vm_page_write_modified_page_range(cache, 0,
|
||||||
(cache->virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT, fsReenter);
|
(cache->virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ read_from_file(file_cache_ref *ref, void *cookie, fssh_off_t offset,
|
|||||||
fssh_mutex_unlock(&ref->lock);
|
fssh_mutex_unlock(&ref->lock);
|
||||||
|
|
||||||
fssh_status_t status = vfs_read_pages(ref->node, cookie,
|
fssh_status_t status = vfs_read_pages(ref->node, cookie,
|
||||||
offset + pageOffset, &vec, 1, &bufferSize, false);
|
offset + pageOffset, &vec, 1, &bufferSize);
|
||||||
|
|
||||||
fssh_mutex_lock(&ref->lock);
|
fssh_mutex_lock(&ref->lock);
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ write_to_file(file_cache_ref *ref, void *cookie, fssh_off_t offset,
|
|||||||
fssh_mutex_unlock(&ref->lock);
|
fssh_mutex_unlock(&ref->lock);
|
||||||
|
|
||||||
fssh_status_t status = vfs_write_pages(ref->node, cookie,
|
fssh_status_t status = vfs_write_pages(ref->node, cookie,
|
||||||
offset + pageOffset, &vec, 1, &bufferSize, false);
|
offset + pageOffset, &vec, 1, &bufferSize);
|
||||||
|
|
||||||
fssh_mutex_lock(&ref->lock);
|
fssh_mutex_lock(&ref->lock);
|
||||||
|
|
||||||
|
|||||||
+44
-46
@@ -141,7 +141,7 @@ static fssh_mutex sMountMutex;
|
|||||||
* - the fields immutable after initialization of the fs_mount structures in
|
* - the fields immutable after initialization of the fs_mount structures in
|
||||||
* sMountsTable will not be modified,
|
* sMountsTable will not be modified,
|
||||||
* - vnode::covered_by of any vnode in sVnodeTable will not be modified.
|
* - vnode::covered_by of any vnode in sVnodeTable will not be modified.
|
||||||
*
|
*
|
||||||
* The thread trying to lock the lock must not hold sVnodeMutex or
|
* The thread trying to lock the lock must not hold sVnodeMutex or
|
||||||
* sMountMutex.
|
* sMountMutex.
|
||||||
*/
|
*/
|
||||||
@@ -612,7 +612,7 @@ create_new_vnode(struct vnode **_vnode, fssh_mount_id mountID, fssh_vnode_id vno
|
|||||||
vnode->id = vnodeID;
|
vnode->id = vnodeID;
|
||||||
|
|
||||||
// add the vnode to the mount structure
|
// add the vnode to the mount structure
|
||||||
fssh_mutex_lock(&sMountMutex);
|
fssh_mutex_lock(&sMountMutex);
|
||||||
vnode->mount = find_mount(mountID);
|
vnode->mount = find_mount(mountID);
|
||||||
if (!vnode->mount || vnode->mount->unmounting) {
|
if (!vnode->mount || vnode->mount->unmounting) {
|
||||||
fssh_mutex_unlock(&sMountMutex);
|
fssh_mutex_unlock(&sMountMutex);
|
||||||
@@ -862,7 +862,7 @@ err:
|
|||||||
* The caller must, of course, own a reference to the vnode to call this
|
* The caller must, of course, own a reference to the vnode to call this
|
||||||
* function.
|
* function.
|
||||||
* The caller must not hold the sVnodeMutex or the sMountMutex.
|
* The caller must not hold the sVnodeMutex or the sMountMutex.
|
||||||
*
|
*
|
||||||
* \param vnode the vnode.
|
* \param vnode the vnode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -873,7 +873,7 @@ put_vnode(struct vnode *vnode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Disconnects all file descriptors that are associated with the
|
/** Disconnects all file descriptors that are associated with the
|
||||||
* \a vnodeToDisconnect, or if this is NULL, all vnodes of the specified
|
* \a vnodeToDisconnect, or if this is NULL, all vnodes of the specified
|
||||||
* \a mount object.
|
* \a mount object.
|
||||||
*
|
*
|
||||||
@@ -1760,7 +1760,7 @@ common_file_io_vec_pages(int fd, const fssh_file_io_vec *fileVecs,
|
|||||||
size = numBytes;
|
size = numBytes;
|
||||||
|
|
||||||
status = fssh_read_pages(fd, fileVecs[0].offset, &vecs[vecIndex],
|
status = fssh_read_pages(fd, fileVecs[0].offset, &vecs[vecIndex],
|
||||||
vecCount - vecIndex, &size, false);
|
vecCount - vecIndex, &size);
|
||||||
if (status < FSSH_B_OK)
|
if (status < FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -1820,7 +1820,7 @@ common_file_io_vec_pages(int fd, const fssh_file_io_vec *fileVecs,
|
|||||||
uint32_t tempCount = 0;
|
uint32_t tempCount = 0;
|
||||||
|
|
||||||
// size tracks how much of what is left of the current fileVec
|
// size tracks how much of what is left of the current fileVec
|
||||||
// (fileLeft) has been assigned to tempVecs
|
// (fileLeft) has been assigned to tempVecs
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
// assign what is left of the current fileVec to the tempVecs
|
// assign what is left of the current fileVec to the tempVecs
|
||||||
@@ -1855,10 +1855,10 @@ common_file_io_vec_pages(int fd, const fssh_file_io_vec *fileVecs,
|
|||||||
fssh_size_t bytes = size;
|
fssh_size_t bytes = size;
|
||||||
if (doWrite) {
|
if (doWrite) {
|
||||||
status = fssh_write_pages(fd, fileOffset, tempVecs,
|
status = fssh_write_pages(fd, fileOffset, tempVecs,
|
||||||
tempCount, &bytes, false);
|
tempCount, &bytes);
|
||||||
} else {
|
} else {
|
||||||
status = fssh_read_pages(fd, fileOffset, tempVecs,
|
status = fssh_read_pages(fd, fileOffset, tempVecs,
|
||||||
tempCount, &bytes, false);
|
tempCount, &bytes);
|
||||||
}
|
}
|
||||||
if (status < FSSH_B_OK)
|
if (status < FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -2059,7 +2059,7 @@ fssh_remove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
if (remove) {
|
if (remove) {
|
||||||
// if the vnode hasn't been published yet, we delete it here
|
// if the vnode hasn't been published yet, we delete it here
|
||||||
fssh_atomic_add(&vnode->ref_count, -1);
|
fssh_atomic_add(&vnode->ref_count, -1);
|
||||||
@@ -2070,7 +2070,7 @@ fssh_remove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" fssh_status_t
|
extern "C" fssh_status_t
|
||||||
fssh_unremove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
|
fssh_unremove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
|
||||||
{
|
{
|
||||||
struct vnode *vnode;
|
struct vnode *vnode;
|
||||||
@@ -2086,7 +2086,7 @@ fssh_unremove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" fssh_status_t
|
extern "C" fssh_status_t
|
||||||
fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* removed)
|
fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* removed)
|
||||||
{
|
{
|
||||||
fssh_mutex_lock(&sVnodeMutex);
|
fssh_mutex_lock(&sVnodeMutex);
|
||||||
@@ -2108,7 +2108,7 @@ fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* remo
|
|||||||
//! Works directly on the host's file system
|
//! Works directly on the host's file system
|
||||||
extern "C" fssh_status_t
|
extern "C" fssh_status_t
|
||||||
fssh_read_pages(int fd, fssh_off_t pos, const fssh_iovec *vecs,
|
fssh_read_pages(int fd, fssh_off_t pos, const fssh_iovec *vecs,
|
||||||
fssh_size_t count, fssh_size_t *_numBytes, bool fsReenter)
|
fssh_size_t count, fssh_size_t *_numBytes)
|
||||||
{
|
{
|
||||||
// check how much the iovecs allow us to read
|
// check how much the iovecs allow us to read
|
||||||
fssh_size_t toRead = 0;
|
fssh_size_t toRead = 0;
|
||||||
@@ -2149,7 +2149,7 @@ fssh_read_pages(int fd, fssh_off_t pos, const fssh_iovec *vecs,
|
|||||||
//! Works directly on the host's file system
|
//! Works directly on the host's file system
|
||||||
extern "C" fssh_status_t
|
extern "C" fssh_status_t
|
||||||
fssh_write_pages(int fd, fssh_off_t pos, const fssh_iovec *vecs,
|
fssh_write_pages(int fd, fssh_off_t pos, const fssh_iovec *vecs,
|
||||||
fssh_size_t count, fssh_size_t *_numBytes, bool fsReenter)
|
fssh_size_t count, fssh_size_t *_numBytes)
|
||||||
{
|
{
|
||||||
// check how much the iovecs allow us to write
|
// check how much the iovecs allow us to write
|
||||||
fssh_size_t toWrite = 0;
|
fssh_size_t toWrite = 0;
|
||||||
@@ -2296,25 +2296,23 @@ vfs_get_vnode(fssh_mount_id mountID, fssh_vnode_id vnodeID, void **_vnode)
|
|||||||
|
|
||||||
fssh_status_t
|
fssh_status_t
|
||||||
vfs_read_pages(void *_vnode, void *cookie, fssh_off_t pos,
|
vfs_read_pages(void *_vnode, void *cookie, fssh_off_t pos,
|
||||||
const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes,
|
const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes)
|
||||||
bool fsReenter)
|
|
||||||
{
|
{
|
||||||
struct vnode *vnode = (struct vnode *)_vnode;
|
struct vnode *vnode = (struct vnode *)_vnode;
|
||||||
|
|
||||||
return FS_CALL(vnode, read_pages,
|
return FS_CALL(vnode, read_pages,
|
||||||
cookie, pos, vecs, count, _numBytes, fsReenter);
|
cookie, pos, vecs, count, _numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fssh_status_t
|
fssh_status_t
|
||||||
vfs_write_pages(void *_vnode, void *cookie, fssh_off_t pos,
|
vfs_write_pages(void *_vnode, void *cookie, fssh_off_t pos,
|
||||||
const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes,
|
const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes)
|
||||||
bool fsReenter)
|
|
||||||
{
|
{
|
||||||
struct vnode *vnode = (struct vnode *)_vnode;
|
struct vnode *vnode = (struct vnode *)_vnode;
|
||||||
|
|
||||||
return FS_CALL(vnode, write_pages,
|
return FS_CALL(vnode, write_pages,
|
||||||
cookie, pos, vecs, count, _numBytes, fsReenter);
|
cookie, pos, vecs, count, _numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2901,7 +2899,7 @@ create_vnode(struct vnode *directory, const char *name, int openMode, int perms,
|
|||||||
put_vnode(vnode);
|
put_vnode(vnode);
|
||||||
|
|
||||||
FS_CALL(directory, unlink, name);
|
FS_CALL(directory, unlink, name);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2993,7 +2991,7 @@ file_create_entry_ref(fssh_mount_id mountID, fssh_vnode_id directoryID, const ch
|
|||||||
|
|
||||||
FUNCTION(("file_create_entry_ref: name = '%s', omode %x, perms %d, kernel %d\n", name, openMode, perms, kernel));
|
FUNCTION(("file_create_entry_ref: name = '%s', omode %x, perms %d, kernel %d\n", name, openMode, perms, kernel));
|
||||||
|
|
||||||
// get directory to put the new file in
|
// get directory to put the new file in
|
||||||
status = get_vnode(mountID, directoryID, &directory, false);
|
status = get_vnode(mountID, directoryID, &directory, false);
|
||||||
if (status < FSSH_B_OK)
|
if (status < FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -3014,7 +3012,7 @@ file_create(int fd, char *path, int openMode, int perms, bool kernel)
|
|||||||
|
|
||||||
FUNCTION(("file_create: path '%s', omode %x, perms %d, kernel %d\n", path, openMode, perms, kernel));
|
FUNCTION(("file_create: path '%s', omode %x, perms %d, kernel %d\n", path, openMode, perms, kernel));
|
||||||
|
|
||||||
// get directory to put the new file in
|
// get directory to put the new file in
|
||||||
status = fd_and_path_to_dir_vnode(fd, path, &directory, name, kernel);
|
status = fd_and_path_to_dir_vnode(fd, path, &directory, name, kernel);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
@@ -3182,7 +3180,7 @@ dir_create_entry_ref(fssh_mount_id mountID, fssh_vnode_id parentID, const char *
|
|||||||
return FSSH_B_BAD_VALUE;
|
return FSSH_B_BAD_VALUE;
|
||||||
|
|
||||||
FUNCTION(("dir_create_entry_ref(dev = %ld, ino = %Ld, name = '%s', perms = %d)\n", mountID, parentID, name, perms));
|
FUNCTION(("dir_create_entry_ref(dev = %ld, ino = %Ld, name = '%s', perms = %d)\n", mountID, parentID, name, perms));
|
||||||
|
|
||||||
status = get_vnode(mountID, parentID, &vnode, kernel);
|
status = get_vnode(mountID, parentID, &vnode, kernel);
|
||||||
if (status < FSSH_B_OK)
|
if (status < FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -3297,7 +3295,7 @@ dir_free_fd(struct file_descriptor *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
||||||
fssh_size_t bufferSize, uint32_t *_count)
|
fssh_size_t bufferSize, uint32_t *_count)
|
||||||
{
|
{
|
||||||
@@ -3348,7 +3346,7 @@ fix_dirent(struct vnode *parent, struct fssh_dirent *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
dir_read(struct vnode *vnode, void *cookie, struct fssh_dirent *buffer,
|
dir_read(struct vnode *vnode, void *cookie, struct fssh_dirent *buffer,
|
||||||
fssh_size_t bufferSize, uint32_t *_count)
|
fssh_size_t bufferSize, uint32_t *_count)
|
||||||
{
|
{
|
||||||
@@ -3369,7 +3367,7 @@ dir_read(struct vnode *vnode, void *cookie, struct fssh_dirent *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
dir_rewind(struct file_descriptor *descriptor)
|
dir_rewind(struct file_descriptor *descriptor)
|
||||||
{
|
{
|
||||||
struct vnode *vnode = descriptor->u.vnode;
|
struct vnode *vnode = descriptor->u.vnode;
|
||||||
@@ -3401,7 +3399,7 @@ dir_remove(int fd, char *path, bool kernel)
|
|||||||
lastSlash--;
|
lastSlash--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!leaf[0]
|
if (!leaf[0]
|
||||||
|| !fssh_strcmp(leaf, ".")) {
|
|| !fssh_strcmp(leaf, ".")) {
|
||||||
// "name/" -> "name", or "name/." -> "name"
|
// "name/" -> "name", or "name/." -> "name"
|
||||||
lastSlash[0] = '\0';
|
lastSlash[0] = '\0';
|
||||||
@@ -3439,7 +3437,7 @@ common_ioctl(struct file_descriptor *descriptor, uint32_t op, void *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
common_fcntl(int fd, int op, uint32_t argument, bool kernel)
|
common_fcntl(int fd, int op, uint32_t argument, bool kernel)
|
||||||
{
|
{
|
||||||
struct file_descriptor *descriptor;
|
struct file_descriptor *descriptor;
|
||||||
@@ -3463,7 +3461,7 @@ common_fcntl(int fd, int op, uint32_t argument, bool kernel)
|
|||||||
fssh_mutex_lock(&context->io_mutex);
|
fssh_mutex_lock(&context->io_mutex);
|
||||||
fd_set_close_on_exec(context, fd, argument == FSSH_FD_CLOEXEC);
|
fd_set_close_on_exec(context, fd, argument == FSSH_FD_CLOEXEC);
|
||||||
fssh_mutex_unlock(&context->io_mutex);
|
fssh_mutex_unlock(&context->io_mutex);
|
||||||
|
|
||||||
status = FSSH_B_OK;
|
status = FSSH_B_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3801,7 +3799,7 @@ common_write_stat(struct file_descriptor *descriptor,
|
|||||||
const struct fssh_stat *stat, int statMask)
|
const struct fssh_stat *stat, int statMask)
|
||||||
{
|
{
|
||||||
struct vnode *vnode = descriptor->u.vnode;
|
struct vnode *vnode = descriptor->u.vnode;
|
||||||
|
|
||||||
FUNCTION(("common_write_stat(vnode = %p, stat = %p, statMask = %d)\n", vnode, stat, statMask));
|
FUNCTION(("common_write_stat(vnode = %p, stat = %p, statMask = %d)\n", vnode, stat, statMask));
|
||||||
if (!HAS_FS_CALL(vnode, write_stat))
|
if (!HAS_FS_CALL(vnode, write_stat))
|
||||||
return FSSH_EROFS;
|
return FSSH_EROFS;
|
||||||
@@ -3906,7 +3904,7 @@ attr_dir_free_fd(struct file_descriptor *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
attr_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
attr_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
||||||
fssh_size_t bufferSize, uint32_t *_count)
|
fssh_size_t bufferSize, uint32_t *_count)
|
||||||
{
|
{
|
||||||
@@ -3921,7 +3919,7 @@ attr_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
attr_dir_rewind(struct file_descriptor *descriptor)
|
attr_dir_rewind(struct file_descriptor *descriptor)
|
||||||
{
|
{
|
||||||
struct vnode *vnode = descriptor->u.vnode;
|
struct vnode *vnode = descriptor->u.vnode;
|
||||||
@@ -4267,7 +4265,7 @@ index_dir_free_fd(struct file_descriptor *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
index_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
index_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
||||||
fssh_size_t bufferSize, uint32_t *_count)
|
fssh_size_t bufferSize, uint32_t *_count)
|
||||||
{
|
{
|
||||||
@@ -4280,7 +4278,7 @@ index_dir_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
index_dir_rewind(struct file_descriptor *descriptor)
|
index_dir_rewind(struct file_descriptor *descriptor)
|
||||||
{
|
{
|
||||||
struct fs_mount *mount = descriptor->u.mount;
|
struct fs_mount *mount = descriptor->u.mount;
|
||||||
@@ -4431,7 +4429,7 @@ query_free_fd(struct file_descriptor *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
query_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
query_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
||||||
fssh_size_t bufferSize, uint32_t *_count)
|
fssh_size_t bufferSize, uint32_t *_count)
|
||||||
{
|
{
|
||||||
@@ -4444,7 +4442,7 @@ query_read(struct file_descriptor *descriptor, struct fssh_dirent *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
query_rewind(struct file_descriptor *descriptor)
|
query_rewind(struct file_descriptor *descriptor)
|
||||||
{
|
{
|
||||||
struct fs_mount *mount = descriptor->u.mount;
|
struct fs_mount *mount = descriptor->u.mount;
|
||||||
@@ -4888,7 +4886,7 @@ fs_next_device(int32_t *_cookie)
|
|||||||
struct fs_mount *mount = NULL;
|
struct fs_mount *mount = NULL;
|
||||||
fssh_dev_t device = *_cookie;
|
fssh_dev_t device = *_cookie;
|
||||||
|
|
||||||
fssh_mutex_lock(&sMountMutex);
|
fssh_mutex_lock(&sMountMutex);
|
||||||
|
|
||||||
// Since device IDs are assigned sequentially, this algorithm
|
// Since device IDs are assigned sequentially, this algorithm
|
||||||
// does work good enough. It makes sure that the device list
|
// does work good enough. It makes sure that the device list
|
||||||
@@ -4909,7 +4907,7 @@ fs_next_device(int32_t *_cookie)
|
|||||||
device = FSSH_B_BAD_VALUE;
|
device = FSSH_B_BAD_VALUE;
|
||||||
|
|
||||||
fssh_mutex_unlock(&sMountMutex);
|
fssh_mutex_unlock(&sMountMutex);
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4931,7 +4929,7 @@ get_cwd(char *buffer, fssh_size_t size, bool kernel)
|
|||||||
status = FSSH_B_ERROR;
|
status = FSSH_B_ERROR;
|
||||||
|
|
||||||
fssh_mutex_unlock(&context->io_mutex);
|
fssh_mutex_unlock(&context->io_mutex);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5142,7 +5140,7 @@ _kern_open_dir(int fd, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fssh_status_t
|
fssh_status_t
|
||||||
_kern_fcntl(int fd, int op, uint32_t argument)
|
_kern_fcntl(int fd, int op, uint32_t argument)
|
||||||
{
|
{
|
||||||
return common_fcntl(fd, op, argument, true);
|
return common_fcntl(fd, op, argument, true);
|
||||||
@@ -5245,7 +5243,7 @@ _kern_read_link(int fd, const char *path, char *buffer, fssh_size_t *_bufferSize
|
|||||||
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
||||||
return FSSH_B_NO_MEMORY;
|
return FSSH_B_NO_MEMORY;
|
||||||
|
|
||||||
return common_read_link(fd, pathBuffer.LockBuffer(),
|
return common_read_link(fd, pathBuffer.LockBuffer(),
|
||||||
buffer, _bufferSize, true);
|
buffer, _bufferSize, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5282,7 +5280,7 @@ _kern_create_symlink(int fd, const char *path, const char *toPath, int mode)
|
|||||||
if (status < FSSH_B_OK)
|
if (status < FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return common_create_symlink(fd, pathBuffer.LockBuffer(),
|
return common_create_symlink(fd, pathBuffer.LockBuffer(),
|
||||||
toBuffer, mode, true);
|
toBuffer, mode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5295,7 +5293,7 @@ _kern_create_link(const char *path, const char *toPath)
|
|||||||
if (pathBuffer.InitCheck() != FSSH_B_OK || toPathBuffer.InitCheck() != FSSH_B_OK)
|
if (pathBuffer.InitCheck() != FSSH_B_OK || toPathBuffer.InitCheck() != FSSH_B_OK)
|
||||||
return FSSH_B_NO_MEMORY;
|
return FSSH_B_NO_MEMORY;
|
||||||
|
|
||||||
return common_create_link(pathBuffer.LockBuffer(),
|
return common_create_link(pathBuffer.LockBuffer(),
|
||||||
toPathBuffer.LockBuffer(), true);
|
toPathBuffer.LockBuffer(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5352,7 +5350,7 @@ _kern_rename(int oldFD, const char *oldPath, int newFD, const char *newPath)
|
|||||||
if (oldPathBuffer.InitCheck() != FSSH_B_OK || newPathBuffer.InitCheck() != FSSH_B_OK)
|
if (oldPathBuffer.InitCheck() != FSSH_B_OK || newPathBuffer.InitCheck() != FSSH_B_OK)
|
||||||
return FSSH_B_NO_MEMORY;
|
return FSSH_B_NO_MEMORY;
|
||||||
|
|
||||||
return common_rename(oldFD, oldPathBuffer.LockBuffer(),
|
return common_rename(oldFD, oldPathBuffer.LockBuffer(),
|
||||||
newFD, newPathBuffer.LockBuffer(), true);
|
newFD, newPathBuffer.LockBuffer(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5411,7 +5409,7 @@ _kern_read_stat(int fd, const char *path, bool traverseLeafLink,
|
|||||||
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
||||||
return FSSH_B_NO_MEMORY;
|
return FSSH_B_NO_MEMORY;
|
||||||
|
|
||||||
status = common_path_read_stat(fd, pathBuffer.LockBuffer(),
|
status = common_path_read_stat(fd, pathBuffer.LockBuffer(),
|
||||||
traverseLeafLink, stat, true);
|
traverseLeafLink, stat, true);
|
||||||
} else {
|
} else {
|
||||||
// no path given: get the FD and use the FD operation
|
// no path given: get the FD and use the FD operation
|
||||||
@@ -5481,7 +5479,7 @@ _kern_write_stat(int fd, const char *path, bool traverseLeafLink,
|
|||||||
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
if (pathBuffer.InitCheck() != FSSH_B_OK)
|
||||||
return FSSH_B_NO_MEMORY;
|
return FSSH_B_NO_MEMORY;
|
||||||
|
|
||||||
status = common_path_write_stat(fd, pathBuffer.LockBuffer(),
|
status = common_path_write_stat(fd, pathBuffer.LockBuffer(),
|
||||||
traverseLeafLink, stat, statMask, true);
|
traverseLeafLink, stat, statMask, true);
|
||||||
} else {
|
} else {
|
||||||
// no path given: get the FD and use the FD operation
|
// no path given: get the FD and use the FD operation
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace FSShell {
|
|||||||
/* R5 figures, but we don't use a table for monitors anyway */
|
/* R5 figures, but we don't use a table for monitors anyway */
|
||||||
#define DEFAULT_FD_TABLE_SIZE 128
|
#define DEFAULT_FD_TABLE_SIZE 128
|
||||||
#define MAX_FD_TABLE_SIZE 8192
|
#define MAX_FD_TABLE_SIZE 8192
|
||||||
#define DEFAULT_NODE_MONITORS 4096
|
#define DEFAULT_NODE_MONITORS 4096
|
||||||
#define MAX_NODE_MONITORS 65536
|
#define MAX_NODE_MONITORS 65536
|
||||||
|
|
||||||
struct kernel_args;
|
struct kernel_args;
|
||||||
@@ -75,10 +75,10 @@ void vfs_acquire_vnode(void *vnode);
|
|||||||
fssh_status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
fssh_status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
||||||
fssh_status_t vfs_read_pages(void *vnode, void *cookie, fssh_off_t pos,
|
fssh_status_t vfs_read_pages(void *vnode, void *cookie, fssh_off_t pos,
|
||||||
const fssh_iovec *vecs, fssh_size_t count,
|
const fssh_iovec *vecs, fssh_size_t count,
|
||||||
fssh_size_t *_numBytes, bool fsReenter);
|
fssh_size_t *_numBytes);
|
||||||
fssh_status_t vfs_write_pages(void *vnode, void *cookie,
|
fssh_status_t vfs_write_pages(void *vnode, void *cookie,
|
||||||
fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count,
|
fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count,
|
||||||
fssh_size_t *_numBytes, bool fsReenter);
|
fssh_size_t *_numBytes);
|
||||||
fssh_status_t vfs_get_file_map(void *_vnode, fssh_off_t offset,
|
fssh_status_t vfs_get_file_map(void *_vnode, fssh_off_t offset,
|
||||||
fssh_size_t size, fssh_file_io_vec *vecs,
|
fssh_size_t size, fssh_file_io_vec *vecs,
|
||||||
fssh_size_t *_count);
|
fssh_size_t *_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user