X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libsysio%2Finclude%2Finode.h;h=baedc507af50ef2453ae861fb3694d766bcf9337;hp=d6ee2ffeacb2dcd74a70467cd4e6440fc6381995;hb=79e65c81349f539aa2960a1889144ce71d91351e;hpb=b8292c00324fbe9a25910ce53d03569186ea3e2c diff --git a/libsysio/include/inode.h b/libsysio/include/inode.h index d6ee2ff..baedc50 100644 --- a/libsysio/include/inode.h +++ b/libsysio/include/inode.h @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-2006 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -86,10 +86,10 @@ struct inode_ops { struct inode *ino, unsigned mask, struct intnl_stat *stbuf); - ssize_t (*inop_getdirentries)(struct inode *ino, - char *buf, - size_t nbytes, - _SYSIO_OFF_T *basep); + ssize_t (*inop_filldirentries)(struct inode *ino, + _SYSIO_OFF_T *posp, + char *buf, + size_t nbytes); int (*inop_mkdir)(struct pnode *pno, mode_t mode); int (*inop_rmdir)(struct pnode *pno); int (*inop_symlink)(struct pnode *pno, const char *data); @@ -103,7 +103,7 @@ struct inode_ops { int (*inop_write)(struct inode *ino, struct ioctx *ioctx); _SYSIO_OFF_T (*inop_pos)(struct inode *ino, _SYSIO_OFF_T off); int (*inop_iodone)(struct ioctx *iocp); - int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap); + int (*inop_fcntl)(struct inode *ino, int cmd, va_list ap, int *rtn); 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); @@ -135,9 +135,8 @@ struct inode { i_immune : 1, /* immune from GC */ i_zombie : 1; /* stale inode */ unsigned i_ref; /* soft ref counter */ - mode_t i_mode; /* mode (see stat.h) */ - dev_t i_rdev; /* dev (if device) */ struct inode_ops i_ops; /* operations */ + struct intnl_stat i_stbuf; /* attrs */ struct filesys *i_fs; /* file system ptr */ struct file_identifier *i_fid; /* file ident */ void *i_private; /* driver data */ @@ -147,14 +146,13 @@ struct inode { /* * Init an i-node record. */ -#define I_INIT(ino, fs, mode, rdev, ops, fid, immunity, private) \ +#define I_INIT(ino, fs, stat, ops, fid, immunity, private) \ do { \ (ino)->i_immune = (immunity) ? 1 : 0; \ (ino)->i_zombie = 0; \ (ino)->i_ref = 0; \ - (ino)->i_mode = (mode); \ - (ino)->i_rdev = (rdev); \ (ino)->i_ops = *(ops); \ + (ino)->i_stbuf = *(stat); \ (ino)->i_fs = (fs); \ (ino)->i_fid = (fid); \ (ino)->i_private = (private); \ @@ -325,8 +323,9 @@ struct nameidata { /* * Values for nameidata flags field. */ -#define ND_NOFOLLOW 0x01 /* no follow symlinks */ -#define ND_NEGOK 0x02 /* last missing is ok */ +#define ND_NOFOLLOW 0x01 /* no follow symlinks */ +#define ND_NEGOK 0x02 /* last missing is ok */ +#define ND_NOPERMCHECK 0x04 /* don't check perms */ #ifdef AUTOMOUNT_FILE_NAME #define _ND_INIT_AUTOMOUNT(nd) ((nd)->nd_amcnt = 0) @@ -370,7 +369,6 @@ struct ioctx { ioctx_fast : 1, /* from stack space */ ioctx_done : 1, /* transfer complete */ ioctx_write : 1; /* op is a write */ - ioid_t ioctx_id; /* unique ident */ struct inode *ioctx_ino; /* i-node */ const struct iovec *ioctx_iov; /* scatter/gather vec */ size_t ioctx_iovlen; /* iovec length */ @@ -385,12 +383,11 @@ struct ioctx { /* * Init IO context record. */ -#define IOCTX_INIT(ioctx, fast, id, wr, ino, iov, iovlen, xtv, xtvlen) \ +#define IOCTX_INIT(ioctx, fast, wr, ino, iov, iovlen, xtv, xtvlen) \ do { \ (ioctx)->ioctx_fast = (fast); \ (ioctx)->ioctx_done = 0; \ (ioctx)->ioctx_write = (wr) ? 1 : 0; \ - (ioctx)->ioctx_id = (id); \ (ioctx)->ioctx_ino = (ino); \ (ioctx)->ioctx_iov = (iov); \ (ioctx)->ioctx_iovlen = (iovlen); \ @@ -403,16 +400,10 @@ struct ioctx { } while (0) /* - * Return whether a pnode/inode is on a read-only mount or file system. + * Return whether access to a pnode is read-only. */ -#define IS_RDONLY(pno, ino) \ - ((((struct pnode *)(pno)) && \ - ((((struct pnode *)(pno))->p_mount->mnt_flags & MOUNT_F_RO) || \ - (((struct pnode *)(pno))->p_base->pb_ino && \ - (((struct pnode *)(pno))->p_base->pb_ino->i_fs->fs_flags & \ - FS_F_RO)))) || \ - (((struct inode *)(ino)) && \ - (((struct inode *)(ino))->i_fs->fs_flags & FS_F_RO))) +#define IS_RDONLY(pno) \ + ((pno)->p_mount->mnt_flags & MOUNT_F_RO) extern struct pnode *_sysio_root; @@ -420,13 +411,12 @@ extern TAILQ_HEAD(inodes_head, inode) _sysio_inodes; extern TAILQ_HEAD(pnodes_head, pnode) _sysio_pnodes; extern int _sysio_i_init(void); -#if ZERO_SUM_MEMORY +#ifdef ZERO_SUM_MEMORY extern void _sysio_i_shutdown(void); #endif extern struct inode *_sysio_i_new(struct filesys *fs, struct file_identifier *fid, - mode_t type, - dev_t rdev, + struct intnl_stat *stat, unsigned immunity, struct inode_ops *ops, void *private); @@ -460,6 +450,7 @@ extern void _sysio_do_illop(void); extern int _sysio_do_ebadf(void); extern int _sysio_do_einval(void); extern int _sysio_do_enoent(void); +extern int _sysio_do_enodev(void); extern int _sysio_do_espipe(void); extern int _sysio_do_eisdir(void); extern int _sysio_do_enosys(void); @@ -467,6 +458,7 @@ extern int _sysio_path_walk(struct pnode *parent, struct nameidata *nd); #ifdef AUTOMOUNT_FILE_NAME extern void _sysio_next_component(const char *path, struct qstr *name); #endif +extern int _sysio_permitted(struct pnode *pno, int amode); extern int _sysio_namei(struct pnode *pno, const char *path, unsigned flags, @@ -485,33 +477,10 @@ extern int _sysio_ioctx_cb(struct ioctx *ioctx, void (*f)(struct ioctx *, void *), void *data); extern void _sysio_ioctx_cb_free(struct ioctx_callback *cb); -extern struct ioctx *_sysio_ioctx_find(ioid_t id); +extern struct ioctx *_sysio_ioctx_find(void *id); +extern int _sysio_ioctx_done(struct ioctx *ioctx); extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx); extern void _sysio_ioctx_complete(struct ioctx *ioctx); -extern ssize_t _sysio_validx(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - _SYSIO_OFF_T limit); -extern ssize_t _sysio_enumerate_extents(const struct intnl_xtvec *xtv, - size_t xtvlen, - const struct iovec *iov, - size_t iovlen, - ssize_t (*f)(const struct iovec *, - int, - _SYSIO_OFF_T, - ssize_t, - void *), - void *arg); -extern ssize_t _sysio_enumerate_iovec(const struct iovec *iov, - size_t count, - _SYSIO_OFF_T off, - ssize_t limit, - ssize_t (*f)(void *, - size_t, - _SYSIO_OFF_T, - void *), - void *arg); -extern ssize_t _sysio_doio(const struct intnl_xtvec *xtv, size_t xtvlen, - const struct iovec *iov, size_t iovlen, - ssize_t (*f)(void *, size_t, _SYSIO_OFF_T, void *), - void *arg); extern int _sysio_open(struct pnode *pno, int flags, mode_t mode); +extern int _sysio_mkdir(struct pnode *where, mode_t mode); +extern int _sysio_mknod(struct pnode *where, mode_t mode, dev_t dev);