* Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
supported) I/O request support. It will eventually replace
{read,write}_pages(). None of the FS implementations implement them
yet.
* Implemented some support functions for request-based I/O. File system
implementations can use do_fd_io() which passes an I/O request to the
layer responsible for a given FD, and do_iterative_fd_io(), which
translates a request for a file to subrequests for the underlying
device and passes them on. Both fall back to synchrounous processing
when the io() hook is not supported.
Furthermore added vfs_synchronous_io() which should be handy for the
devfs to perform io_requests synchronously for devices that don't
support the io() hook.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26655 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,6 +21,9 @@ struct stat;
|
||||
struct fs_info;
|
||||
struct select_sync;
|
||||
|
||||
typedef struct IORequest io_request;
|
||||
|
||||
|
||||
/* additional flags passed to write_stat() (see NodeMonitor.h for the others) */
|
||||
// NOTE: Changing the constants here or in NodeMonitor.h will break
|
||||
// src/kits/storage/LibBeAdapter.cpp:_kern_write_stat().
|
||||
@@ -124,6 +127,12 @@ struct fs_vnode_ops {
|
||||
void *cookie, off_t pos, const iovec *vecs, size_t count,
|
||||
size_t *_numBytes);
|
||||
|
||||
/* asynchronous I/O */
|
||||
status_t (*io)(fs_volume *volume, fs_vnode *vnode, void *cookie,
|
||||
io_request *request);
|
||||
status_t (*cancel_io)(fs_volume *volume, fs_vnode *vnode, void *cookie,
|
||||
io_request *request);
|
||||
|
||||
/* cache file access */
|
||||
status_t (*get_file_map)(fs_volume *volume, fs_vnode *vnode, off_t offset,
|
||||
size_t size, struct file_io_vec *vecs, size_t *_count);
|
||||
@@ -284,6 +293,14 @@ typedef struct file_system_module_info {
|
||||
|
||||
|
||||
/* file system add-ons only prototypes */
|
||||
|
||||
// callbacks for do_iterative_fd_io()
|
||||
typedef status_t (*iterative_io_get_vecs)(void *cookie, io_request* request,
|
||||
off_t offset, size_t size, struct file_io_vec *vecs,
|
||||
size_t *_count);
|
||||
typedef status_t (*iterative_io_finished)(void* cookie, io_request* request,
|
||||
status_t status);
|
||||
|
||||
extern status_t new_vnode(fs_volume *volume, ino_t vnodeID, void *privateNode,
|
||||
fs_vnode_ops *ops);
|
||||
extern status_t publish_vnode(fs_volume *volume, ino_t vnodeID,
|
||||
@@ -309,6 +326,10 @@ extern status_t write_file_io_vec_pages(int fd,
|
||||
const struct file_io_vec *fileVecs, size_t fileVecCount,
|
||||
const struct iovec *vecs, size_t vecCount,
|
||||
uint32 *_vecIndex, size_t *_vecOffset, size_t *_bytes);
|
||||
extern status_t do_fd_io(int fd, io_request *request);
|
||||
extern status_t do_iterative_fd_io(int fd, io_request *request,
|
||||
iterative_io_get_vecs getVecs,
|
||||
iterative_io_finished finished, void *cookie);
|
||||
|
||||
extern status_t notify_entry_created(dev_t device, ino_t directory,
|
||||
const char *name, ino_t node);
|
||||
|
||||
@@ -26,6 +26,8 @@ typedef fssh_ino_t fssh_vnode_id;
|
||||
/* the file system's private data structures */
|
||||
typedef void *fssh_fs_cookie;
|
||||
|
||||
typedef struct FSSHIORequest fssh_io_request;
|
||||
|
||||
/* additional flags passed to write_stat() */
|
||||
#define FSSH_B_STAT_SIZE_INSECURE 0x2000
|
||||
|
||||
@@ -142,6 +144,12 @@ struct fssh_fs_vnode_ops {
|
||||
fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs,
|
||||
fssh_size_t count, fssh_size_t *_numBytes);
|
||||
|
||||
/* asynchronous I/O */
|
||||
fssh_status_t (*io)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||
void *cookie, fssh_io_request *request);
|
||||
fssh_status_t (*cancel_io)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||
void *cookie, fssh_io_request *request);
|
||||
|
||||
/* cache file access */
|
||||
fssh_status_t (*get_file_map)(fssh_fs_volume *volume, fssh_fs_vnode *vnode,
|
||||
fssh_off_t offset, fssh_size_t size,
|
||||
|
||||
@@ -97,6 +97,10 @@ status_t vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos,
|
||||
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);
|
||||
status_t vfs_synchronous_io(io_request* request,
|
||||
status_t (*doIO)(void* cookie, off_t offset, void* buffer,
|
||||
size_t length),
|
||||
void* cookie);
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user