[Libsysio-commit] b_lustre: libsysio/include cplant-yod.h dev.h file.h inode.h sysio.h
Brought to you by:
lward
|
From: Mei <me...@us...> - 2003-11-01 03:08:25
|
Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1:/tmp/cvs-serv28091/include
Modified Files:
Tag: b_lustre
cplant-yod.h dev.h file.h inode.h sysio.h
Log Message:
merge HEAD into b_lustre, some fixes
Index: cplant-yod.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/cplant-yod.h,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -w -b -B -p -r1.2.2.1 -r1.2.2.2
--- cplant-yod.h 15 Aug 2003 07:43:15 -0000 1.2.2.1
+++ cplant-yod.h 1 Nov 2003 03:08:22 -0000 1.2.2.2
@@ -48,14 +48,17 @@ extern int chmod_yod(const char* path, m
extern int chown_yod(const char* path, uid_t, gid_t);
extern int stat_yod(const char *path, struct stat *sbuf);
extern int fstat_yod(int fd, struct stat *buf);
+#ifdef _HAVE_STATVFS
extern int statfs_yod(const char *path, struct statfs *sbuf);
extern int fstatfs_yod(int fd, struct statfs *buf);
+#endif
extern int mkdir_yod(const char *path, mode_t mode);
extern int rmdir_yod(const char *path);
extern int getdirentries_yod(int fd, char *buf, size_t nbytes, loff_t *basep);
extern int link_yod(const char *path1, const char *path2);
extern int unlink_yod(const char *path);
extern int symlink_yod(const char *path1, const char *path2 );
+extern int rename_yod( const char *path1, const char *path2 );
extern int open_yod(const char *fname, int flags, mode_t mode);
extern int close_yod(int);
extern ssize_t write_yod(int fd, const void *buff, size_t nbytes);
Index: dev.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/dev.h,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -w -b -B -p -r1.2 -r1.2.4.1
--- dev.h 24 Mar 2003 22:09:04 -0000 1.2
+++ dev.h 1 Nov 2003 03:08:22 -0000 1.2.4.1
@@ -70,71 +70,75 @@ extern const struct inode_ops _sysio_nod
(int (*)(struct pnode *, \
struct inode **, \
struct intent *, \
- const char *))_sysio_dev_e_notdir
+ const char *))_sysio_dev_illop
#define _sysio_nodev_inop_getattr \
(int (*)(struct pnode *, \
struct inode *, \
- struct intnl_stat *))_sysio_dev_e_badf
+ struct intnl_stat *))_sysio_dev_illop
#define _sysio_nodev_inop_setattr \
(int (*)(struct pnode *, \
struct inode *, \
unsigned , \
- struct intnl_stat *))_sysio_dev_e_badf
+ struct intnl_stat *))_sysio_dev_illop
#define _sysio_nodev_getdirentries \
(ssize_t (*)(struct inode *, \
char *, \
size_t , \
- off64_t *))_sysio_dev_e_notdir
+ _SYSIO_OFF_T *))_sysio_dev_illop
#define _sysio_nodev_inop_mkdir \
(int (*)(struct pnode *, \
- mode_t))_sysio_dev_e_notdir
+ mode_t))_sysio_dev_illop
#define _sysio_nodev_inop_rmdir \
- (int (*)(struct pnode *))_sysio_dev_e_notdir
+ (int (*)(struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_symlink \
(int (*)(struct pnode *, \
- const char *))_sysio_dev_e_notdir
+ const char *))_sysio_dev_illop
#define _sysio_nodev_inop_readlink \
(int (*)(struct pnode *, \
char *, \
- size_t))_sysio_dev_e_inval
+ size_t))_sysio_dev_illop
#define _sysio_nodev_inop_open \
(int (*)(struct pnode *, \
int, \
- mode_t))_sysio_dev_e_nxio
+ mode_t))_sysio_dev_illop
#define _sysio_nodev_inop_close \
- (int (*)(struct inode *))_sysio_dev_e_badf
+ (int (*)(struct inode *))_sysio_dev_illop
+#define _sysio_nodev_inop_link \
+ (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_unlink \
- (int (*)(struct pnode *))_sysio_dev_e_notdir
+ (int (*)(struct pnode *))_sysio_dev_illop
+#define _sysio_nodev_inop_rename \
+ (int (*)(struct pnode *, struct pnode *))_sysio_dev_illop
#define _sysio_nodev_inop_ipreadv \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_e_inval
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_ipwritev \
(int (*)(struct inode *, \
- struct io_arguments *, \
- struct ioctx **))_sysio_dev_e_inval
+ struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_iodone \
- (int (*)(struct ioctx *))_sysio_dev_e_illop
+ (int (*)(struct ioctx *))_sysio_dev_illop
#define _sysio_nodev_inop_fcntl \
(int (*)(struct inode *, \
int, \
- va_list))_sysio_dev_e_inval
+ va_list))_sysio_dev_illop
#define _sysio_nodev_inop_sync \
- (int (*)(struct inode *))_sysio_dev_e_inval
+ (int (*)(struct inode *))_sysio_dev_illop
#define _sysio_nodev_inop_datasync \
- (int (*)(struct inode *))_sysio_dev_e_inval
+ (int (*)(struct inode *))_sysio_dev_illop
#define _sysio_nodev_inop_ioctl \
(int (*)(struct inode *, \
unsigned long int, \
- va_list))_sysio_dev_e_notty
+ va_list))_sysio_dev_illop
#define _sysio_nodev_inop_mknod \
(int (*)(struct pnode *, \
mode_t, \
- dev_t))_sysio_dev_e_notdir
+ dev_t))_sysio_dev_illop
+#ifdef _HAVE_STATVFS
#define _sysio_nodev_inop_statvfs \
(int (*)(struct pnode *, \
struct inode *, \
- struct intnl_statvfs *))_sysio_dev_e_inval
+ struct intnl_statvfs *))_sysio_dev_illop
+#endif
#define _sysio_nodev_inop_gone \
(void (*)(struct inode *ino))_sysio_dev_noop
@@ -144,10 +148,5 @@ extern struct inode_ops *_sysio_dev_look
extern int _sysio_char_dev_register(int major,
const char *name,
struct inode_ops *ops);
-extern int _sysio_dev_e_notdir(void);
-extern int _sysio_dev_e_badf(void);
-extern int _sysio_dev_e_inval(void);
-extern int _sysio_dev_e_nxio(void);
-extern int _sysio_dev_e_illop(void);
-extern int _sysio_dev_e_notty(void);
+extern int _sysio_dev_illop(void);
extern void _sysio_dev_noop(void);
Index: file.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/file.h,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -w -b -B -p -r1.5 -r1.5.4.1
--- file.h 24 Mar 2003 22:09:05 -0000 1.5
+++ file.h 1 Nov 2003 03:08:22 -0000 1.5.4.1
@@ -52,7 +52,7 @@
*/
struct file {
struct inode *f_ino; /* path node */
- off64_t f_pos; /* current stream pos */
+ _SYSIO_OFF_T f_pos; /* current stream pos */
unsigned f_ref; /* ref count */
int f_flags; /* open/fcntl flags */
};
@@ -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.6.2.1
retrieving revision 1.6.2.2
diff -u -w -b -B -p -r1.6.2.1 -r1.6.2.2
--- inode.h 15 Aug 2003 07:43:15 -0000 1.6.2.1
+++ inode.h 1 Nov 2003 03:08:22 -0000 1.6.2.2
@@ -63,7 +63,9 @@ struct inode;
struct intent;
struct intnl_dirent;
struct intnl_stat;
+#ifdef _HAVE_STATVFS
struct intnl_statvfs;
+#endif
struct io_arguments;
struct ioctx;
@@ -87,29 +89,29 @@ struct inode_ops {
ssize_t (*inop_getdirentries)(struct inode *ino,
char *buf,
size_t nbytes,
- off64_t *basep);
+ _SYSIO_OFF_T *basep);
int (*inop_mkdir)(struct pnode *pno, mode_t mode);
int (*inop_rmdir)(struct pnode *pno);
int (*inop_symlink)(struct pnode *pno, const char *data);
int (*inop_readlink)(struct pnode *pno, char *buf, size_t bufsiz);
int (*inop_open)(struct pnode *pno, int flags, mode_t mode);
int (*inop_close)(struct inode *ino);
+ int (*inop_link)(struct pnode *old, struct pnode *new);
int (*inop_unlink)(struct pnode *pno);
- 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_rename)(struct pnode *old, struct pnode *new);
+ 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);
int (*inop_datasync)(struct inode *ino);
int (*inop_ioctl)(struct inode *ino, unsigned long int request, va_list ap);
int (*inop_mknod)(struct pnode *pno, mode_t mode, dev_t dev);
+#ifdef _HAVE_STATVFS
int (*inop_statvfs)(struct pnode *pno,
struct inode *ino,
struct intnl_statvfs *buf);
+#endif
void (*inop_gone)(struct inode *ino);
};
@@ -128,10 +130,10 @@ struct inode_ops {
*/
struct inode {
LIST_ENTRY(inode) i_link; /* FS i-nodes link */
- unsigned i_immune : 1; /* immune from GC */
- unsigned i_zombie : 1; /* stale inode */
+ unsigned
+ i_immune : 1, /* immune from GC */
+ i_zombie : 1; /* stale inode */
unsigned i_ref; /* soft ref counter */
- ino_t i_num; /* i-num (deprecate!) */
mode_t i_mode; /* mode (see stat.h) */
dev_t i_rdev; /* dev (if device) */
struct inode_ops i_ops; /* operations */
@@ -144,12 +146,11 @@ struct inode {
/*
* Init an i-node record.
*/
-#define I_INIT(ino, fs, inum, mode, rdev, ops, fid, immunity, private) \
+#define I_INIT(ino, fs, mode, rdev, ops, fid, immunity, private) \
do { \
(ino)->i_immune = (immunity) ? 1 : 0; \
(ino)->i_zombie = 0; \
(ino)->i_ref = 0; \
- (ino)->i_num = (inum); \
(ino)->i_mode = (mode); \
(ino)->i_rdev = (rdev); \
(ino)->i_ops = *(ops); \
@@ -340,46 +341,53 @@ 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 */
- off64_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 */
+ ioctx_done : 1; /* transfer complete */
ioid_t ioctx_id; /* unique ident */
struct inode *ioctx_ino; /* i-node */
const struct iovec *ioctx_iovec; /* scatter/gather vec */
size_t ioctx_iovlen; /* iovec length */
- off64_t ioctx_offset; /* file offset */
+ _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; /* callback queue */
+ void *ioctx_private; /* driver data */
};
/*
+ * Init IO context record.
+ */
+#define IOCTX_INIT(ioctx, fast, id, ino, iov, iovlen, off) \
+ do { \
+ (ioctx)->ioctx_fast = (fast); \
+ (ioctx)->ioctx_done = 0; \
+ (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); \
+ (ioctx)->ioctx_private = NULL; \
+ } while (0)
+
+/*
* Return whether a pnode/inode is on a read-only mount or file system.
*/
#define IS_RDONLY(pno, ino) \
@@ -398,7 +406,6 @@ extern TAILQ_HEAD(pnodes_head, pnode) _s
extern int _sysio_i_init(void);
extern struct inode *_sysio_i_new(struct filesys *fs,
- ino_t ino,
struct file_identifier *fid,
mode_t type,
dev_t rdev,
@@ -406,7 +413,6 @@ extern struct inode *_sysio_i_new(struct
struct inode_ops *ops,
void *private);
extern struct inode *_sysio_i_find(struct filesys *fs,
- ino_t ino,
struct file_identifier *fid);
extern void _sysio_i_gone(struct inode *ino);
extern void _sysio_i_undead(struct inode *ino);
@@ -440,9 +446,15 @@ extern int _sysio_namei(struct pnode *pn
unsigned flags,
struct intent *intnt,
struct pnode **pnop);
+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);
Index: sysio.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v
retrieving revision 1.7.4.4
retrieving revision 1.7.4.5
diff -u -w -b -B -p -r1.7.4.4 -r1.7.4.5
--- sysio.h 8 Sep 2003 03:58:17 -0000 1.7.4.4
+++ sysio.h 1 Nov 2003 03:08:22 -0000 1.7.4.5
@@ -84,11 +84,27 @@ typedef void *ioid_t;
#include "cygwin-defs.h"
#endif
+#ifndef _LARGEFILE64_SOURCE
+/*
+ * Not glibc. Define this ourselves.
+ */
+#define _LARGEFILE64_SOURCE 0
+#endif
+
+/*
+ * Define internal file-offset type.
+ */
+#if _LARGEFILE64_SOURCE
+#define _SYSIO_OFF_T off64_t
+#else
+#define _SYSIO_OFF_T off_t
+#endif
+
/*
* Internally, all directory entries are carried in the 64-bit capable
* structure.
*/
-#ifdef _LARGEFILE64_SOURCE
+#if _LARGEFILE64_SOURCE
#define intnl_dirent dirent64
#else
#define intnl_dirent dirent
@@ -99,22 +115,29 @@ struct dirent;
* Internally, all file status is carried in the 64-bit capable
* structure.
*/
-#ifdef _LARGEFILE64_SOURCE
+#if _LARGEFILE64_SOURCE
#define intnl_stat stat64
#else
#define intnl_stat stat
#endif
struct stat;
-#ifdef _LARGEFILE64_SOURCE
+#ifdef _HAVE_STATVFS
+#if _LARGEFILE64_SOURCE
#define intnl_statvfs statvfs64
#else
#define intnl_statvfs statvfs
#define INTNL_STATVFS_IS_NATURAL 1
#endif
struct statvfs;
+struct intnl_statvfs;
+#endif
struct iovec;
+struct utimbuf;
+
+struct intnl_stat;
+
struct pnode;
extern struct pnode *_sysio_cwd;
@@ -132,28 +155,68 @@ extern void _sysio_shutdown(void);
extern int access(const char *path, int amode);
extern int chdir(const char *path);
extern int chmod(const char *path, mode_t mode);
+extern int fchmod(int fd, mode_t mode);
extern int chown(const char *path, uid_t owner, gid_t group);
+extern int fchown(int fd, uid_t owner, gid_t group);
extern int close(int d);
extern int dup(int oldfd);
extern int dup2(int oldfd, int newfd);
extern int fcntl(int fd, int cmd, ...);
extern int fstat(int fd, struct stat *buf);
extern int fsync(int fd);
-extern int ftruncate(int fd, off_t length);
extern char *getcwd(char *buf, size_t size);
extern off_t lseek(int fd, off_t offset, int whence);
+#if _LARGEFILE64_SOURCE
+extern off64_t lseek64(int fd, off64_t offset, int whence);
+#endif
extern int lstat(const char *path, struct stat *buf);
+#if defined(BSD) || defined(REDSTORM)
+extern int getdirentries(int fd, char *buf, int nbytes , long *basep);
+#else
extern ssize_t getdirentries(int fd, char *buf, size_t nbytes , off_t *basep);
+#if _LARGEFILE64_SOURCE
+extern ssize_t getdirentries64(int fd,
+ char *buf,
+ size_t nbytes,
+ off64_t *basep);
+#endif
+#endif
extern int mkdir(const char *path, mode_t mode);
extern int open(const char *path, int flag, ...);
+#if _LARGEFILE64_SOURCE
+extern int open64(const char *path, int flag, ...);
+#endif
extern int creat(const char *path, mode_t mode);
+#if _LARGEFILE64_SOURCE
+extern int creat64(const char *path, mode_t mode);
+#endif
extern int stat(const char *path, struct stat *buf);
+#if _LARGEFILE64_SOURCE
+extern int stat64(const char *path, struct stat64 *buf);
+#endif
+#ifdef _HAVE_STATVFS
extern int statvfs(const char *path, struct statvfs *buf);
-extern int truncate(const char *path, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int statvfs64(const char *path, struct statvfs64 *buf);
+#endif
extern int fstatvfs(int fd, struct statvfs *buf);
+#if _LARGEFILE64_SOURCE
+extern int fstatvfs64(int fd, struct statvfs64 *buf);
+#endif
+#endif
+extern int truncate(const char *path, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int truncate64(const char *path, off64_t length);
+#endif
+extern int ftruncate(int fd, off_t length);
+#if _LARGEFILE64_SOURCE
+extern int ftruncate64(int fd, off64_t length);
+#endif
extern int rmdir(const char *path);
extern int symlink(const char *path1, const char *path2);
+extern int link(const char *oldpath, const char *newpath);
extern int unlink(const char *path);
+extern int rename(const char *oldpath, const char *newpath);
extern int fdatasync(int fd);
#ifndef __CYGWIN__
extern int ioctl(int fd, unsigned long request, ...);
@@ -165,26 +228,40 @@ extern int iodone(ioid_t ioid);
extern ssize_t iowait(ioid_t ioid);
extern int iodone(ioid_t ioid);
extern ioid_t ipreadv(int fd, const struct iovec *iov, size_t count,
- off_t offset);
-extern ioid_t ipread(int fd, void *buf, size_t count, off_t offset);
+ _SYSIO_OFF_T offset);
+extern ioid_t ipread(int fd, void *buf, size_t count, _SYSIO_OFF_T offset);
extern ssize_t preadv(int fd, const struct iovec *iov, size_t count,
- off_t offset);
+ _SYSIO_OFF_T offset);
extern ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+#if _LARGEFILE64_SOURCE
+extern ssize_t pread64(int fd, void *buf, size_t count, off64_t offset);
+#endif
extern ioid_t ireadv(int fd, const struct iovec *iov, int count);
extern ioid_t iread(int fd, void *buf, size_t count);
extern ssize_t readv(int fd, const struct iovec *iov, int count);
extern ssize_t read(int fd, void *buf, size_t count);
+#if _LARGEFILE64_SOURCE
+extern ssize_t read64(int fd, void *buf, size_t count);
+#endif
extern ioid_t ipwritev(int fd, const struct iovec *iov, size_t count,
- off_t offset);
-extern ioid_t ipwrite(int fd, const void *buf, size_t count, off_t offset);
+ _SYSIO_OFF_T offset);
+extern ioid_t ipwrite(int fd, const void *buf, size_t count,
+ _SYSIO_OFF_T offset);
extern ssize_t pwritev(int fd, const struct iovec *iov, size_t count,
- off_t offset);
+ _SYSIO_OFF_T offset);
extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+#if _LARGEFILE64_SOURCE
+extern ssize_t pwrite64(int fd, const void *buf, size_t count, off64_t offset);
+#endif
extern ioid_t iwritev(int fd, const struct iovec *iov, int count);
extern ioid_t iwrite(int fd, const void *buf, size_t count);
extern ssize_t writev(int fd, const struct iovec *iov, int count);
extern ssize_t write(int fd, const void *buf, size_t count);
+#if _LARGEFILE64_SOURCE
+extern ssize_t write64(int fd, const void *buf, size_t count);
+#endif
extern int mknod(const char *path, mode_t mode, dev_t dev);
+extern int utime(const char *path, const struct utimbuf *buf);
extern int mount(const char *source, const char *target,
const char *filesystemtype,
unsigned long mountflags,
|