diff --git a/headers/os/drivers/fs_interface.h b/headers/os/drivers/fs_interface.h index 14227120f6..03929e57ef 100644 --- a/headers/os/drivers/fs_interface.h +++ b/headers/os/drivers/fs_interface.h @@ -119,11 +119,10 @@ struct fs_vnode_ops { /* VM file access */ bool (*can_page)(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, - bool reenter); + off_t pos, const iovec *vecs, size_t count, size_t *_numBytes); status_t (*write_pages)(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const iovec *vecs, size_t count, - size_t *_numBytes, bool reenter); + size_t *_numBytes); /* cache file access */ 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); 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, - size_t count, size_t *_numBytes, bool fsReenter); + size_t count, size_t *_numBytes); extern status_t read_file_io_vec_pages(int fd, const struct file_io_vec *fileVecs, size_t fileVecCount, const struct iovec *vecs, size_t vecCount, diff --git a/headers/private/fs_shell/fssh_fs_interface.h b/headers/private/fs_shell/fssh_fs_interface.h index b7bb50fa5f..e5bfcdc96d 100644 --- a/headers/private/fs_shell/fssh_fs_interface.h +++ b/headers/private/fs_shell/fssh_fs_interface.h @@ -137,10 +137,10 @@ struct fssh_fs_vnode_ops { fssh_fs_cookie cookie); 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_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_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 */ 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, 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, 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, const struct fssh_file_io_vec *fileVecs, fssh_size_t fileVecCount, const struct fssh_iovec *vecs, diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index e194a0f806..b1b9f2d258 100644 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -26,7 +26,7 @@ #define DEFAULT_FD_TABLE_SIZE 256 #define MAX_FD_TABLE_SIZE 8192 -#define DEFAULT_NODE_MONITORS 4096 +#define DEFAULT_NODE_MONITORS 4096 #define MAX_NODE_MONITORS 65536 #define B_UNMOUNT_BUSY_PARTITION 0x80000000 @@ -64,7 +64,7 @@ typedef struct io_context { #ifdef __cplusplus extern "C" { -#endif +#endif status_t vfs_init(struct kernel_args *args); 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); bool vfs_can_page(struct vnode *vnode, void *cookie); 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, - 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, bool allocate); 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 } -#endif +#endif #endif /* _KERNEL_VFS_H */ diff --git a/headers/private/kernel/vm_page.h b/headers/private/kernel/vm_page.h index 690cf06fbd..bedd21c650 100644 --- a/headers/private/kernel/vm_page.h +++ b/headers/private/kernel/vm_page.h @@ -36,8 +36,8 @@ size_t vm_page_num_free_pages(void); size_t vm_page_num_available_pages(void); status_t vm_page_write_modified_page_range(struct VMCache *cache, - uint32 firstPage, uint32 endPage, bool fsReenter); -status_t vm_page_write_modified_pages(struct VMCache *cache, bool fsReenter); + uint32 firstPage, uint32 endPage); +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_range(struct VMCache *cache, uint32 firstPage, uint32 endPage); diff --git a/headers/private/kernel/vm_types.h b/headers/private/kernel/vm_types.h index 1051daf1e5..7d625933bd 100644 --- a/headers/private/kernel/vm_types.h +++ b/headers/private/kernel/vm_types.h @@ -202,7 +202,7 @@ public: status_t InsertAreaLocked(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 Resize(off_t newSize); @@ -217,9 +217,9 @@ public: virtual bool HasPage(off_t offset); 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, - size_t *_numBytes, bool fsReenter); + size_t *_numBytes); virtual status_t Fault(struct vm_address_space *aspace, off_t offset); diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 6e7b9b6bd4..7e618cea49 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -332,7 +332,7 @@ bfs_can_page(fs_volume *_volume, fs_vnode *_v, void *_cookie) static status_t 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; 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) RETURN_ERROR(B_BAD_VALUE); - if (!reenter) - rw_lock_read_lock(&inode->Lock()); + rw_lock_read_lock(&inode->Lock()); uint32 vecIndex = 0; size_t vecOffset = 0; @@ -369,8 +368,7 @@ bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie, bytesLeft -= bytes; } - if (!reenter) - rw_lock_read_unlock(&inode->Lock()); + rw_lock_read_unlock(&inode->Lock()); return status; } @@ -378,7 +376,7 @@ bfs_read_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie, static status_t 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; 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) RETURN_ERROR(B_BAD_VALUE); - if (!reenter) - rw_lock_read_lock(&inode->Lock()); + rw_lock_read_lock(&inode->Lock()); uint32 vecIndex = 0; size_t vecOffset = 0; @@ -418,8 +415,7 @@ bfs_write_pages(fs_volume *_volume, fs_vnode *_node, void *_cookie, bytesLeft -= bytes; } - if (!reenter) - rw_lock_read_unlock(&inode->Lock()); + rw_lock_read_unlock(&inode->Lock()); return status; } diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index 439b3cef6d..e7f16e645e 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -1584,7 +1584,7 @@ cdda_can_page(fs_volume *_volume, fs_vnode *_node, void *cookie) static status_t 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; } @@ -1592,7 +1592,7 @@ cdda_read_pages(fs_volume *_volume, fs_vnode *_node, void *cookie, off_t pos, static status_t 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; } diff --git a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp index dc6309bb3c..81ef63dcc7 100644 --- a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp @@ -199,7 +199,7 @@ ext2_can_page(fs_volume* _volume, fs_vnode* _node, void* _cookie) static status_t 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; 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) return B_BAD_VALUE; - if (!reenter) - rw_lock_read_lock(inode->Lock()); + rw_lock_read_lock(inode->Lock()); uint32 vecIndex = 0; size_t vecOffset = 0; @@ -236,8 +235,7 @@ ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, bytesLeft -= bytes; } - if (!reenter) - rw_lock_read_unlock(inode->Lock()); + rw_lock_read_unlock(inode->Lock()); return status; } diff --git a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp index fb5bb6a03b..309ad8c2c1 100644 --- a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp @@ -115,7 +115,7 @@ fs_mount(fs_volume *_volume, const char *device, uint32 flags, uint32 len = strlen(buf); // lower case the parms data - for (i = 0; i < len + 1; i++) + for (i = 0; i < len + 1; i++) buf[i] = tolower(buf[i]); // 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", 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. 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); node.attr.slName = NULL; } - } else { + } else { result = initResult; if (bytesRead == 0) 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]; block++; - + TRACE(("fs_walk - moving to next block %Ld, total read %Ld\n", block, totalRead)); 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); block_cache_put(ns->fBlockCache, block); - + if (result < B_OK) { free(newNode); return result; } - + newNode->id = vnodeID; _node->private_node = newNode; _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)); - if (node != NULL) { + if (node != NULL) { if (node->id != ISO_ROOTNODE_ID) { if (node->fileIDString != NULL) free (node->fileIDString); @@ -392,7 +392,7 @@ fs_release_vnode(fs_volume *_vol, fs_vnode *_node, bool reenter) static status_t 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; 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 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; 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))); return result; } - + static status_t fs_rewind_dir(fs_volume *_vol, fs_vnode *_node, void* _cookie) diff --git a/src/system/kernel/cache/file_cache.cpp b/src/system/kernel/cache/file_cache.cpp index a66a00b08d..ac5c601f08 100644 --- a/src/system/kernel/cache/file_cache.cpp +++ b/src/system/kernel/cache/file_cache.cpp @@ -211,7 +211,7 @@ read_into_cache(file_cache_ref *ref, void *cookie, off_t offset, // read file into reserved pages status_t status = vfs_read_pages(ref->vnode, cookie, offset, vecs, - vecCount, &numBytes, false); + vecCount, &numBytes); if (status < B_OK) { // 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); status_t status = vfs_read_pages(ref->vnode, cookie, offset + pageOffset, - &vec, 1, &bufferSize, false); + &vec, 1, &bufferSize); if (status == B_OK) 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; status = vfs_read_pages(ref->vnode, cookie, offset, &readVec, 1, - &bytesRead, false); + &bytesRead); // ToDo: handle errors for real! if (status < B_OK) 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, PAGE_ALIGN(offset + pageOffset + bufferSize) - B_PAGE_SIZE, - &readVec, 1, &bytesRead, false); + &readVec, 1, &bytesRead); // ToDo: handle errors for real! if (status < B_OK) 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) { // 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, - vecCount, &numBytes, false); + vecCount, &numBytes); if (status < B_OK) { // ToDo: remove allocated pages, ...? 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; status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset, - &vec, 1, &chunkSize, false); + &vec, 1, &chunkSize); if (status < B_OK) break; @@ -502,7 +502,7 @@ write_to_file(file_cache_ref *ref, void *cookie, off_t offset, int32 pageOffset, free((void*)buffer); } else { status = vfs_write_pages(ref->vnode, cookie, offset + pageOffset, - &vec, 1, &bufferSize, false); + &vec, 1, &bufferSize); } if (status == B_OK) @@ -958,7 +958,7 @@ file_cache_sync(void *_cacheRef) if (ref == NULL) return B_BAD_VALUE; - return ref->cache->WriteModified(false); + return ref->cache->WriteModified(); } diff --git a/src/system/kernel/cache/vnode_store.cpp b/src/system/kernel/cache/vnode_store.cpp index e84503b1a8..777ecdc270 100644 --- a/src/system/kernel/cache/vnode_store.cpp +++ b/src/system/kernel/cache/vnode_store.cpp @@ -41,12 +41,12 @@ VMVnodeCache::HasPage(off_t offset) status_t VMVnodeCache::Read(off_t offset, const iovec *vecs, size_t count, - size_t *_numBytes, bool fsReenter) + size_t *_numBytes) { size_t bytesUntouched = *_numBytes; status_t status = vfs_read_pages(fVnode, NULL, offset, vecs, count, - _numBytes, fsReenter); + _numBytes); bytesUntouched -= *_numBytes; @@ -73,10 +73,9 @@ VMVnodeCache::Read(off_t offset, const iovec *vecs, size_t count, status_t 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, - fsReenter); + return vfs_write_pages(fVnode, NULL, offset, vecs, count, _numBytes); } diff --git a/src/system/kernel/cache/vnode_store.h b/src/system/kernel/cache/vnode_store.h index 558c59f2f3..89a695f58c 100644 --- a/src/system/kernel/cache/vnode_store.h +++ b/src/system/kernel/cache/vnode_store.h @@ -20,9 +20,9 @@ public: virtual bool HasPage(off_t offset); 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, - size_t *_numBytes, bool fsReenter); + size_t *_numBytes); virtual status_t Fault(struct vm_address_space *aspace, off_t offset); diff --git a/src/system/kernel/device_manager/devfs.cpp b/src/system/kernel/device_manager/devfs.cpp index 17a598bfed..21b6dd11ac 100644 --- a/src/system/kernel/device_manager/devfs.cpp +++ b/src/system/kernel/device_manager/devfs.cpp @@ -1593,7 +1593,7 @@ devfs_can_page(fs_volume *_volume, fs_vnode *_vnode, void *cookie) static status_t 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_cookie *cookie = (struct devfs_cookie *)_cookie; @@ -1651,7 +1651,7 @@ devfs_read_pages(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, static status_t 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_cookie *cookie = (struct devfs_cookie *)_cookie; diff --git a/src/system/kernel/fs/fifo.cpp b/src/system/kernel/fs/fifo.cpp index 1130d10f33..a6d2e17dd5 100644 --- a/src/system/kernel/fs/fifo.cpp +++ b/src/system/kernel/fs/fifo.cpp @@ -319,7 +319,7 @@ Inode::~Inode() } -status_t +status_t Inode::InitCheck() { return B_OK; @@ -920,7 +920,7 @@ fifo_deselect(fs_volume *_volume, fs_vnode *_node, void *_cookie, Inode *inode = (Inode *)_node->private_node; if (!inode) return B_ERROR; - + MutexLocker locker(inode->RequestLock()); 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 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; } @@ -943,7 +943,7 @@ fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos, static status_t 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; } diff --git a/src/system/kernel/fs/rootfs.cpp b/src/system/kernel/fs/rootfs.cpp index 9701f3e45a..dc4544e0af 100644 --- a/src/system/kernel/fs/rootfs.cpp +++ b/src/system/kernel/fs/rootfs.cpp @@ -813,7 +813,7 @@ rootfs_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie) static status_t 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; } @@ -821,7 +821,7 @@ rootfs_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos, static status_t 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; } diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index bd6bf49550..56bf6ab2fe 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -1056,7 +1056,7 @@ vnode_low_resource_handler(void */*data*/, uint32 resources, int32 level) mutex_unlock(&sVnodeMutex); if (vnode->cache != NULL) - vnode->cache->WriteModified(false); + vnode->cache->WriteModified(); dec_vnode_ref_count(vnode, true, false); // 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; 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) return status; @@ -3007,10 +3007,10 @@ common_file_io_vec_pages(struct vnode *vnode, void *cookie, size_t bytes = size; if (doWrite) { status = FS_CALL(vnode, write_pages, cookie, fileOffset, - tempVecs, tempCount, &bytes, false); + tempVecs, tempCount, &bytes); } else { status = FS_CALL(vnode, read_pages, cookie, fileOffset, - tempVecs, tempCount, &bytes, false); + tempVecs, tempCount, &bytes); } if (status < B_OK) return status; @@ -3282,7 +3282,7 @@ get_vnode_removed(fs_volume *volume, ino_t vnodeID, bool* removed) extern "C" status_t 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 vnode *vnode; @@ -3292,7 +3292,7 @@ read_pages(int fd, off_t pos, const iovec *vecs, size_t count, return B_FILE_ERROR; status_t status = FS_CALL(vnode, read_pages, descriptor->cookie, pos, vecs, - count, _numBytes, fsReenter); + count, _numBytes); put_fd(descriptor); return status; @@ -3301,7 +3301,7 @@ read_pages(int fd, off_t pos, const iovec *vecs, size_t count, extern "C" status_t 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 vnode *vnode; @@ -3311,7 +3311,7 @@ write_pages(int fd, off_t pos, const iovec *vecs, size_t count, return B_FILE_ERROR; status_t status = FS_CALL(vnode, write_pages, descriptor->cookie, pos, vecs, - count, _numBytes, fsReenter); + count, _numBytes); put_fd(descriptor); return status; @@ -3888,23 +3888,21 @@ vfs_can_page(struct vnode *vnode, void *cookie) extern "C" status_t 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)); - return FS_CALL(vnode, read_pages, cookie, pos, vecs, count, _numBytes, - fsReenter); + return FS_CALL(vnode, read_pages, cookie, pos, vecs, count, _numBytes); } extern "C" status_t 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)); - return FS_CALL(vnode, write_pages, cookie, pos, vecs, count, _numBytes, - fsReenter); + return FS_CALL(vnode, write_pages, cookie, pos, vecs, count, _numBytes); } @@ -6712,7 +6710,7 @@ fs_sync(dev_t device) put_vnode(previousVnode); if (vnode->cache != NULL) - vnode->cache->WriteModified(false); + vnode->cache->WriteModified(); // 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. diff --git a/src/system/kernel/vm/VMAnonymousCache.cpp b/src/system/kernel/vm/VMAnonymousCache.cpp index 6ec0715e24..c3aa106ccb 100644 --- a/src/system/kernel/vm/VMAnonymousCache.cpp +++ b/src/system/kernel/vm/VMAnonymousCache.cpp @@ -186,7 +186,7 @@ VMAnonymousCache::HasPage(off_t offset) status_t 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; @@ -207,7 +207,7 @@ VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count, off_t pos = (startPageIndex - swapFile->first_page) * PAGE_SIZE; status_t status = vfs_read_pages(swapFile->vnode, NULL, pos, vecs + i, - j - i, _numBytes, fsReenter); + j - i, _numBytes); if (status != B_OK) return status; } @@ -218,7 +218,7 @@ VMAnonymousCache::Read(off_t offset, const iovec *vecs, size_t count, status_t VMAnonymousCache::Write(off_t offset, const iovec *vecs, size_t count, - size_t *_numBytes, bool fsReenter) + size_t *_numBytes) { offset >>= PAGE_SHIFT; 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; status_t status = vfs_write_pages(swapFile->vnode, NULL, pos, vecs + i , - n, _numBytes, fsReenter); + n, _numBytes); if (status != B_OK) return status; } diff --git a/src/system/kernel/vm/VMAnonymousCache.h b/src/system/kernel/vm/VMAnonymousCache.h index cf918e61a3..01913a4474 100644 --- a/src/system/kernel/vm/VMAnonymousCache.h +++ b/src/system/kernel/vm/VMAnonymousCache.h @@ -26,9 +26,9 @@ public: virtual bool HasPage(off_t offset); 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, - size_t *_numBytes, bool fsReenter); + size_t *_numBytes); virtual status_t Fault(struct vm_address_space *aspace, off_t offset); diff --git a/src/system/kernel/vm/VMAnonymousNoSwapCache.cpp b/src/system/kernel/vm/VMAnonymousNoSwapCache.cpp index d4d7338b86..eb6e4ecffa 100644 --- a/src/system/kernel/vm/VMAnonymousNoSwapCache.cpp +++ b/src/system/kernel/vm/VMAnonymousNoSwapCache.cpp @@ -96,7 +96,7 @@ VMAnonymousNoSwapCache::HasPage(off_t offset) status_t 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"); return B_ERROR; @@ -105,7 +105,7 @@ VMAnonymousNoSwapCache::Read(off_t offset, const iovec *vecs, size_t count, status_t 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 return B_ERROR; diff --git a/src/system/kernel/vm/VMAnonymousNoSwapCache.h b/src/system/kernel/vm/VMAnonymousNoSwapCache.h index c7ab577f21..5777b51bb1 100644 --- a/src/system/kernel/vm/VMAnonymousNoSwapCache.h +++ b/src/system/kernel/vm/VMAnonymousNoSwapCache.h @@ -23,9 +23,9 @@ public: virtual bool HasPage(off_t offset); 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, - size_t *_numBytes, bool fsReenter); + size_t *_numBytes); virtual status_t Fault(struct vm_address_space *aspace, off_t offset); diff --git a/src/system/kernel/vm/VMDeviceCache.cpp b/src/system/kernel/vm/VMDeviceCache.cpp index 6ac6cf9d4b..f18af82d6d 100644 --- a/src/system/kernel/vm/VMDeviceCache.cpp +++ b/src/system/kernel/vm/VMDeviceCache.cpp @@ -27,7 +27,7 @@ VMDeviceCache::HasPage(off_t offset) status_t 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"); return B_ERROR; @@ -36,7 +36,7 @@ VMDeviceCache::Read(off_t offset, const iovec *vecs, size_t count, status_t 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 return B_OK; diff --git a/src/system/kernel/vm/VMDeviceCache.h b/src/system/kernel/vm/VMDeviceCache.h index f00ee88ac5..1039a3c8ae 100644 --- a/src/system/kernel/vm/VMDeviceCache.h +++ b/src/system/kernel/vm/VMDeviceCache.h @@ -19,9 +19,9 @@ public: virtual bool HasPage(off_t offset); 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, - size_t *_numBytes, bool fsReenter); + size_t *_numBytes); private: addr_t fBaseAddress; diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 753dafd29f..a0c6db2972 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -2249,7 +2249,7 @@ delete_area(vm_address_space *addressSpace, vm_area *area) vm_unmap_pages(area, area->base, area->size, !area->cache->temporary); if (!area->cache->temporary) - area->cache->WriteModified(false); + area->cache->WriteModified(); arch_vm_unset_memory_type(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; // read it in - status_t status = cache->Read(cacheOffset, &vec, 1, &bytesRead, - false); + status_t status = cache->Read(cacheOffset, &vec, 1, &bytesRead); 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) { // synchronous error = vm_page_write_modified_page_range(cache, firstPage, - endPage, false); + endPage); if (error != B_OK) return error; } else { diff --git a/src/system/kernel/vm/vm_cache.cpp b/src/system/kernel/vm/vm_cache.cpp index fb94474049..5434c5b13c 100644 --- a/src/system/kernel/vm/vm_cache.cpp +++ b/src/system/kernel/vm/vm_cache.cpp @@ -688,7 +688,7 @@ VMCache::RemoveArea(vm_area* area) status_t -VMCache::WriteModified(bool fsReenter) +VMCache::WriteModified() { TRACE(("VMCache::WriteModified(cache = %p)\n", this)); @@ -696,7 +696,7 @@ VMCache::WriteModified(bool fsReenter) return B_OK; Lock(); - status_t status = vm_page_write_modified_pages(this, fsReenter); + status_t status = vm_page_write_modified_pages(this); Unlock(); return status; @@ -813,16 +813,14 @@ VMCache::HasPage(off_t offset) status_t -VMCache::Read(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes, - bool fsReenter) +VMCache::Read(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes) { return B_ERROR; } status_t -VMCache::Write(off_t offset, const iovec *vecs, size_t count, - size_t *_numBytes, bool fsReenter) +VMCache::Write(off_t offset, const iovec *vecs, size_t count, size_t *_numBytes) { return B_ERROR; } diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 7e9e9d3418..c662fb8e7f 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -844,7 +844,7 @@ page_scrubber(void *unused) static status_t -write_page(vm_page *page, bool fsReenter) +write_page(vm_page *page) { size_t length = B_PAGE_SIZE; status_t status; @@ -859,7 +859,7 @@ write_page(vm_page *page, bool fsReenter) vecs->iov_len = B_PAGE_SIZE; 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); #if 0 @@ -1035,7 +1035,7 @@ page_writer(void* /*unused*/) // TODO: put this as requests into the I/O scheduler status_t writeStatus[kNumPages]; 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 @@ -1280,7 +1280,7 @@ steal_pages(vm_page **pages, size_t count, bool reserve) */ status_t 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 @@ -1321,7 +1321,7 @@ vm_page_write_modified_page_range(struct VMCache *cache, uint32 firstPage, vm_clear_map_flags(page, PAGE_MODIFIED); cache->Unlock(); - status_t status = write_page(page, fsReenter); + status_t status = write_page(page); cache->Lock(); 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. */ 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, - (cache->virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT, fsReenter); + (cache->virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT); } diff --git a/src/tools/fs_shell/file_cache.cpp b/src/tools/fs_shell/file_cache.cpp index 6e8baf3759..62d667a58e 100644 --- a/src/tools/fs_shell/file_cache.cpp +++ b/src/tools/fs_shell/file_cache.cpp @@ -90,7 +90,7 @@ read_from_file(file_cache_ref *ref, void *cookie, fssh_off_t offset, fssh_mutex_unlock(&ref->lock); 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); @@ -109,7 +109,7 @@ write_to_file(file_cache_ref *ref, void *cookie, fssh_off_t offset, fssh_mutex_unlock(&ref->lock); 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); diff --git a/src/tools/fs_shell/vfs.cpp b/src/tools/fs_shell/vfs.cpp index 5a57266e2a..eda77dd39c 100644 --- a/src/tools/fs_shell/vfs.cpp +++ b/src/tools/fs_shell/vfs.cpp @@ -141,7 +141,7 @@ static fssh_mutex sMountMutex; * - the fields immutable after initialization of the fs_mount structures in * sMountsTable 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 * sMountMutex. */ @@ -612,7 +612,7 @@ create_new_vnode(struct vnode **_vnode, fssh_mount_id mountID, fssh_vnode_id vno vnode->id = vnodeID; // add the vnode to the mount structure - fssh_mutex_lock(&sMountMutex); + fssh_mutex_lock(&sMountMutex); vnode->mount = find_mount(mountID); if (!vnode->mount || vnode->mount->unmounting) { fssh_mutex_unlock(&sMountMutex); @@ -862,7 +862,7 @@ err: * The caller must, of course, own a reference to the vnode to call this * function. * The caller must not hold the sVnodeMutex or the sMountMutex. - * + * * \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 mount object. * @@ -1760,7 +1760,7 @@ common_file_io_vec_pages(int fd, const fssh_file_io_vec *fileVecs, size = numBytes; status = fssh_read_pages(fd, fileVecs[0].offset, &vecs[vecIndex], - vecCount - vecIndex, &size, false); + vecCount - vecIndex, &size); if (status < FSSH_B_OK) return status; @@ -1820,7 +1820,7 @@ common_file_io_vec_pages(int fd, const fssh_file_io_vec *fileVecs, uint32_t tempCount = 0; // 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; // 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; if (doWrite) { status = fssh_write_pages(fd, fileOffset, tempVecs, - tempCount, &bytes, false); + tempCount, &bytes); } else { status = fssh_read_pages(fd, fileOffset, tempVecs, - tempCount, &bytes, false); + tempCount, &bytes); } if (status < FSSH_B_OK) return status; @@ -2059,7 +2059,7 @@ fssh_remove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID) } locker.Unlock(); - + if (remove) { // if the vnode hasn't been published yet, we delete it here 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) { 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_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 extern "C" fssh_status_t 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 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 extern "C" fssh_status_t 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 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 vfs_read_pages(void *_vnode, void *cookie, fssh_off_t pos, - const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes, - bool fsReenter) + const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes) { struct vnode *vnode = (struct vnode *)_vnode; return FS_CALL(vnode, read_pages, - cookie, pos, vecs, count, _numBytes, fsReenter); + cookie, pos, vecs, count, _numBytes); } fssh_status_t vfs_write_pages(void *_vnode, void *cookie, fssh_off_t pos, - const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes, - bool fsReenter) + const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes) { struct vnode *vnode = (struct vnode *)_vnode; 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); FS_CALL(directory, unlink, name); - + 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)); - // get directory to put the new file in + // get directory to put the new file in status = get_vnode(mountID, directoryID, &directory, false); if (status < FSSH_B_OK) 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)); - // 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); if (status < 0) 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; 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); if (status < FSSH_B_OK) 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, 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, 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) { struct vnode *vnode = descriptor->u.vnode; @@ -3401,7 +3399,7 @@ dir_remove(int fd, char *path, bool kernel) lastSlash--; } - if (!leaf[0] + if (!leaf[0] || !fssh_strcmp(leaf, ".")) { // "name/" -> "name", or "name/." -> "name" 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) { 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); fd_set_close_on_exec(context, fd, argument == FSSH_FD_CLOEXEC); fssh_mutex_unlock(&context->io_mutex); - + status = FSSH_B_OK; break; } @@ -3801,7 +3799,7 @@ common_write_stat(struct file_descriptor *descriptor, const struct fssh_stat *stat, int statMask) { struct vnode *vnode = descriptor->u.vnode; - + FUNCTION(("common_write_stat(vnode = %p, stat = %p, statMask = %d)\n", vnode, stat, statMask)); if (!HAS_FS_CALL(vnode, write_stat)) 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, 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) { 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, 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) { 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, 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) { struct fs_mount *mount = descriptor->u.mount; @@ -4888,7 +4886,7 @@ fs_next_device(int32_t *_cookie) struct fs_mount *mount = NULL; fssh_dev_t device = *_cookie; - fssh_mutex_lock(&sMountMutex); + fssh_mutex_lock(&sMountMutex); // Since device IDs are assigned sequentially, this algorithm // 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; fssh_mutex_unlock(&sMountMutex); - + return device; } @@ -4931,7 +4929,7 @@ get_cwd(char *buffer, fssh_size_t size, bool kernel) status = FSSH_B_ERROR; 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) { 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) return FSSH_B_NO_MEMORY; - return common_read_link(fd, pathBuffer.LockBuffer(), + return common_read_link(fd, pathBuffer.LockBuffer(), 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) return status; - return common_create_symlink(fd, pathBuffer.LockBuffer(), + return common_create_symlink(fd, pathBuffer.LockBuffer(), 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) return FSSH_B_NO_MEMORY; - return common_create_link(pathBuffer.LockBuffer(), + return common_create_link(pathBuffer.LockBuffer(), 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) return FSSH_B_NO_MEMORY; - return common_rename(oldFD, oldPathBuffer.LockBuffer(), + return common_rename(oldFD, oldPathBuffer.LockBuffer(), newFD, newPathBuffer.LockBuffer(), true); } @@ -5411,7 +5409,7 @@ _kern_read_stat(int fd, const char *path, bool traverseLeafLink, if (pathBuffer.InitCheck() != FSSH_B_OK) return FSSH_B_NO_MEMORY; - status = common_path_read_stat(fd, pathBuffer.LockBuffer(), + status = common_path_read_stat(fd, pathBuffer.LockBuffer(), traverseLeafLink, stat, true); } else { // 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) 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); } else { // no path given: get the FD and use the FD operation diff --git a/src/tools/fs_shell/vfs.h b/src/tools/fs_shell/vfs.h index cf40410092..a6edaa6d87 100644 --- a/src/tools/fs_shell/vfs.h +++ b/src/tools/fs_shell/vfs.h @@ -20,7 +20,7 @@ namespace FSShell { /* R5 figures, but we don't use a table for monitors anyway */ #define DEFAULT_FD_TABLE_SIZE 128 #define MAX_FD_TABLE_SIZE 8192 -#define DEFAULT_NODE_MONITORS 4096 +#define DEFAULT_NODE_MONITORS 4096 #define MAX_NODE_MONITORS 65536 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_read_pages(void *vnode, void *cookie, 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_write_pages(void *vnode, void *cookie, 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_size_t size, fssh_file_io_vec *vecs, fssh_size_t *_count);