[Libsysio-commit] HEAD: libsysio/include dev.h file.h inode.h
Brought to you by:
lward
|
From: Lee W. <lw...@us...> - 2003-10-13 01:04:43
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv31768/include
Modified Files:
dev.h file.h inode.h
Log Message:
The IO context record supported one call-back. It now supports a
chain. This was changed to accommodate the Sandia-PVFS driver. Also, it's
needed for the, coming, {read,write}_strided calls.
To add a callback to the chain use:
_sysio_ioctx_cb(struct ioctx *ioctx,
void (*func)(struct ioctx *, void *),
void *data)
Callbacks are added to the end of the existing chain. When called, by
_sysio_io_complete, they are run in order. So... If you're freeing
things using callbacks be careful not to depend on something in a
later callback that you previously free'd.
Also, _sysio_io_complete no longer waits for the driver. To call this, now,
is to signal completion.
Index: dev.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -b -B -p -r1.4 -r1.5
--- dev.h 10 Oct 2003 18:50:31 -0000 1.4
+++ dev.h 13 Oct 2003 01:04:34 -0000 1.5
@@ -111,12 +111,10 @@ extern const struct inode_ops _sysio_nod
(int (*)(struct pnode *, struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_ipreadv \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_illop
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_ipwritev \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_illop
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_iodone \
(int (*)(struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_fcntl \
Index: file.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/file.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -b -B -p -r1.6 -r1.7
--- file.h 10 Oct 2003 18:50:31 -0000 1.6
+++ file.h 13 Oct 2003 01:04:35 -0000 1.7
@@ -92,7 +92,7 @@ struct ioctx;
extern struct file *_sysio_fnew(struct inode *ino, int flags);
extern void _sysio_fgone(struct file *fil);
-extern void _sysio_fcompletio(struct ioctx *ioctx);
+extern void _sysio_fcompletio(struct ioctx *ioctx, struct file *fil);
extern int _sysio_fd_close(int fd);
extern struct file *_sysio_fd_find(int fd);
extern int _sysio_fd_set(struct file *fil, int fd);
Index: inode.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -b -B -p -r1.10 -r1.11
--- inode.h 10 Oct 2003 18:50:31 -0000 1.10
+++ inode.h 13 Oct 2003 01:04:35 -0000 1.11
@@ -99,12 +99,8 @@ struct inode_ops {
int (*inop_link)(struct pnode *old, struct pnode *new);
int (*inop_unlink)(struct pnode *pno);
int (*inop_rename)(struct pnode *old, struct pnode *new);
- int (*inop_ipreadv)(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
- int (*inop_ipwritev)(struct inode *ino,
- struct io_arguments *ioargs,
- struct ioctx **ioctxp);
+ int (*inop_ipreadv)(struct inode *ino, struct ioctx *ioctx);
+ int (*inop_ipwritev)(struct inode *ino, struct ioctx *ioctx);
int (*inop_iodone)(struct ioctx *iocp);
int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap);
int (*inop_sync)(struct inode *ino);
@@ -347,34 +343,22 @@ struct nameidata {
} while (0)
/*
- * Bundled up arguments to file system driver IO calls.
+ * IO completion callback record.
*/
-struct io_arguments {
- const struct iovec *ioarg_iovec; /* io vector */
- size_t ioarg_iovlen; /* iovec length */
- _SYSIO_OFF_T ioarg_offset; /* beginning offset */
- void (*ioarg_completion)(void *); /* callback */
- void *ioarg_completion_arg; /* callback data */
+struct ioctx_callback {
+ TAILQ_ENTRY(ioctx_callback) iocb_next; /* list link */
+ void (*iocb_f)(struct ioctx *, void *); /* cb func */
+ void *iocb_data; /* cb data */
};
/*
- * Init IO arguments bundle.
- */
-#define IOARG_INIT(ioarg, iov, len, off, cb, data) \
- do { \
- (ioarg)->ioarg_iovec = (iov); \
- (ioarg)->ioarg_iovlen = (len); \
- (ioarg)->ioarg_offset = (off); \
- (ioarg)->ioarg_completion = (cb); \
- (ioarg)->ioarg_completion_arg = (data); \
- } while (0)
-
-/*
* All IO internally is done with an asynchronous mechanism. This record
* holds the completion information. It's too big :-(
*/
struct ioctx {
LIST_ENTRY(ioctx) ioctx_link; /* AIO list link */
+ unsigned
+ ioctx_fast : 1; /* from stack space */
ioid_t ioctx_id; /* unique ident */
struct inode *ioctx_ino; /* i-node */
const struct iovec *ioctx_iovec; /* scatter/gather vec */
@@ -382,11 +366,25 @@ struct ioctx {
_SYSIO_OFF_T ioctx_offset; /* file offset */
ssize_t ioctx_cc; /* rtn char count */
int ioctx_errno; /* error number */
- void (*ioctx_cb)(void *); /* callback */
- void *ioctx_data; /* callback data */
+ TAILQ_HEAD(, ioctx_callback) ioctx_cbq; /* error number */
};
/*
+ * Init IO context record.
+ */
+#define IOCTX_INIT(ioctx, fast, id, ino, iov, iovlen, off) \
+ do { \
+ (ioctx)->ioctx_fast = (fast); \
+ (ioctx)->ioctx_id = (id); \
+ (ioctx)->ioctx_ino = (ino); \
+ (ioctx)->ioctx_iovec = (iov); \
+ (ioctx)->ioctx_iovlen = (iovlen); \
+ (ioctx)->ioctx_offset = (off); \
+ (ioctx)->ioctx_cc = 0; \
+ (ioctx)->ioctx_errno = 0; \
+ TAILQ_INIT(&(ioctx)->ioctx_cbq); \
+ } while (0)
+/*
* Return whether a pnode/inode is on a read-only mount or file system.
*/
#define IS_RDONLY(pno, ino) \
@@ -450,7 +448,12 @@ extern int _sysio_namei(struct pnode *pn
extern int _sysio_p_chdir(struct pnode *pno);
extern int _sysio_ioctx_init(void);
extern struct ioctx *_sysio_ioctx_new(struct inode *ino,
- struct io_arguments *ioargs);
+ const struct iovec *iov,
+ size_t iovlen,
+ _SYSIO_OFF_T offset);
+extern int _sysio_ioctx_cb(struct ioctx *ioctx,
+ void (*f)(struct ioctx *, void *),
+ void *data);
extern struct ioctx *_sysio_ioctx_find(ioid_t id);
extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx);
extern void _sysio_ioctx_complete(struct ioctx *ioctx);
|