From 7e3c2024785ffeda47ee3497dd43182c3b38c469 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 28 Jul 2008 23:36:08 +0000 Subject: [PATCH] Added fssh_volume_for_vnode() and fssh_do[_iterative]_fd_io() to the FS shell. The latter two lack an implementation yet, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26670 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/fs_shell/fssh_api_wrapper.h | 10 +++++++ headers/private/fs_shell/fssh_fs_interface.h | 14 ++++++++++ src/tools/fs_shell/vfs.cpp | 14 ++++++++++ src/tools/fs_shell/vfs_request_io.cpp | 29 ++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 src/tools/fs_shell/vfs_request_io.cpp diff --git a/headers/private/fs_shell/fssh_api_wrapper.h b/headers/private/fs_shell/fssh_api_wrapper.h index e7138e75a7..46d591ea65 100644 --- a/headers/private/fs_shell/fssh_api_wrapper.h +++ b/headers/private/fs_shell/fssh_api_wrapper.h @@ -871,6 +871,10 @@ #define mount_id fssh_mount_id #define vnode_id fssh_vnode_id +// TODO: These two don't belong here! +#define IORequest FSSHIORequest +#define io_request fssh_io_request + /* additional flags passed to write_stat() */ #define B_STAT_SIZE_INSECURE FSSH_B_STAT_SIZE_INSECURE @@ -893,6 +897,9 @@ /* file system add-ons only prototypes */ +#define iterative_io_get_vecs fssh_iterative_io_get_vecs +#define iterative_io_finished fssh_iterative_io_finished + #define new_vnode fssh_new_vnode #define publish_vnode fssh_publish_vnode #define get_vnode fssh_get_vnode @@ -900,10 +907,13 @@ #define remove_vnode fssh_remove_vnode #define unremove_vnode fssh_unremove_vnode #define get_vnode_removed fssh_get_vnode_removed +#define volume_for_vnode fssh_volume_for_vnode #define read_pages fssh_read_pages #define write_pages fssh_write_pages #define read_file_io_vec_pages fssh_read_file_io_vec_pages #define write_file_io_vec_pages fssh_write_file_io_vec_pages +#define do_fd_io fssh_do_fd_io +#define do_iterative_fd_io fssh_do_iterative_fd_io #define notify_entry_created fssh_notify_entry_created #define notify_entry_removed fssh_notify_entry_removed diff --git a/headers/private/fs_shell/fssh_fs_interface.h b/headers/private/fs_shell/fssh_fs_interface.h index d479a07d3d..9d25a09965 100644 --- a/headers/private/fs_shell/fssh_fs_interface.h +++ b/headers/private/fs_shell/fssh_fs_interface.h @@ -328,6 +328,14 @@ typedef struct fssh_file_system_module_info { /* file system add-ons only prototypes */ + +// callbacks for do_iterative_fd_io() +typedef fssh_status_t (*fssh_iterative_io_get_vecs)(void *cookie, + fssh_io_request* request, fssh_off_t offset, fssh_size_t size, + struct fssh_file_io_vec *vecs, fssh_size_t *_count); +typedef fssh_status_t (*fssh_iterative_io_finished)(void* cookie, + fssh_io_request* request, fssh_status_t status); + extern fssh_status_t fssh_new_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID, void *privateNode, fssh_fs_vnode_ops *ops); @@ -344,6 +352,8 @@ extern fssh_status_t fssh_unremove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID); extern fssh_status_t fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* removed); +extern fssh_fs_volume* fssh_volume_for_vnode(fssh_fs_vnode *vnode); + extern fssh_status_t fssh_read_pages(int fd, fssh_off_t pos, const struct fssh_iovec *vecs, fssh_size_t count, @@ -361,6 +371,10 @@ extern fssh_status_t fssh_write_file_io_vec_pages(int fd, fssh_size_t fileVecCount, const struct fssh_iovec *vecs, fssh_size_t vecCount, uint32_t *_vecIndex, fssh_size_t *_vecOffset, fssh_size_t *_bytes); +extern fssh_status_t fssh_do_fd_io(int fd, fssh_io_request *request); +extern fssh_status_t fssh_do_iterative_fd_io(int fd, fssh_io_request *request, + fssh_iterative_io_get_vecs getVecs, + fssh_iterative_io_finished finished, void *cookie); extern fssh_status_t fssh_notify_entry_created(fssh_mount_id device, fssh_vnode_id directory, const char *name, fssh_vnode_id node); diff --git a/src/tools/fs_shell/vfs.cpp b/src/tools/fs_shell/vfs.cpp index eda77dd39c..795491d15e 100644 --- a/src/tools/fs_shell/vfs.cpp +++ b/src/tools/fs_shell/vfs.cpp @@ -2105,6 +2105,17 @@ fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* remo } +extern "C" fssh_fs_volume* +fssh_volume_for_vnode(fssh_fs_vnode *_vnode) +{ + if (_vnode == NULL) + return NULL; + + struct vnode* vnode = static_cast(_vnode); + return vnode->mount->volume; +} + + //! 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, @@ -5650,3 +5661,6 @@ _kern_open_query(fssh_dev_t device, const char *query, fssh_size_t queryLength, } // namespace FSShell + + +#include "vfs_request_io.cpp" diff --git a/src/tools/fs_shell/vfs_request_io.cpp b/src/tools/fs_shell/vfs_request_io.cpp new file mode 100644 index 0000000000..dd2a7c7a56 --- /dev/null +++ b/src/tools/fs_shell/vfs_request_io.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + +// included by vfs.cpp + +//#include "io_requests.h" + + +// #pragma mark - public API + + +extern "C" fssh_status_t +fssh_do_fd_io(int fd, fssh_io_request* request) +{ + fssh_panic("fssh_do_fd_io() not yet implemented"); + return FSSH_B_BAD_VALUE; +} + + +extern "C" fssh_status_t +fssh_do_iterative_fd_io(int fd, fssh_io_request* request, + fssh_iterative_io_get_vecs getVecs, + fssh_iterative_io_finished finished, void* cookie) +{ + fssh_panic("fssh_do_iterative_fd_io() not yet implemented"); + return FSSH_B_BAD_VALUE; +}