diff --git a/config/spl-build.m4 b/config/spl-build.m4 index c18db70d..3ae1830b 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -74,6 +74,10 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_KVASPRINTF SPL_AC_3ARGS_FILE_FSYNC SPL_AC_EXPORTED_RWSEM_IS_LOCKED + SPL_AC_3ARGS_BLKDEV_GET + SPL_AC_1ARGS_BLKDEV_PUT + SPL_AC_2ARGS_FOLLOW_DOWN + SPL_AC_D_ALLOC_ANON ]) AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ @@ -1680,3 +1684,79 @@ AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [ [rwsem_is_locked() acquires sem->wait_lock])], []) ]) + + + +dnl # +dnl # 2.6.26 API change, +dnl # change in blkdev_get +dnl # +AC_DEFUN([SPL_AC_3ARGS_BLKDEV_GET], [ + AC_MSG_CHECKING([whether blkdev_get() wants 3 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + blkdev_get(NULL, NULL, 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_3ARGS_BLKDEV_GET, 1, + [blkdev_get() wants 3 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.26 API change, +dnl # change in blkdev_put +dnl # +AC_DEFUN([SPL_AC_1ARGS_BLKDEV_PUT], [ + AC_MSG_CHECKING([whether blkdev_put() wants 1 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + blkdev_put(NULL); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_1ARGS_BLKDEV_PUT, 1, + [blkdev_put() wants 1 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + + +dnl # +dnl # 2.6.26 API change, +dnl # change in follow_down +dnl # +AC_DEFUN([SPL_AC_2ARGS_FOLLOW_DOWN], [ + AC_MSG_CHECKING([whether follow_down() wants 2 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + follow_down(NULL, NULL); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_2ARGS_FOLLOW_DOWN, 1, + [follow_down() wants 2 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + + + +dnl # +dnl # 2.6.28 API change, check whether d_alloc_anon() is available. +dnl # d_alloc_anon() which was fully removed in 2.6.28 +dnl # +AC_DEFUN([SPL_AC_D_ALLOC_ANON], [ + SPL_CHECK_SYMBOL_EXPORT( + [d_alloc_anon], + [fs/dcache.c], + [AC_DEFINE(HAVE_D_ALLOC_ANON, 1, + [d_alloc_anon() is available])], + []) +]) + diff --git a/include/sys/cred.h b/include/sys/cred.h index 9c94874c..32952d3c 100644 --- a/include/sys/cred.h +++ b/include/sys/cred.h @@ -41,8 +41,12 @@ typedef struct cred cred_t; typedef struct task_struct cred_t; -#define kcred ((cred_t *)&init_task) -#define CRED() ((cred_t *)current) +#define kcred ((cred_t *)&init_task) +#define CRED() ((cred_t *)current) +#define current_fsuid(cred) (current->fsuid) +#define current_fsgid(cred) (current->fsgid) +#define put_cred(cred) NULL +#define get_current_cred() ((cred_t *)(get_current)) #endif /* HAVE_CRED_STRUCT */ diff --git a/include/sys/vnode.h b/include/sys/vnode.h index 28e31af5..3d7ec822 100644 --- a/include/sys/vnode.h +++ b/include/sys/vnode.h @@ -214,7 +214,7 @@ typedef struct vnode { (vp)->v_rdev = (dev); \ } -vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr); +vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, cred_t *cr); #define LZFS_ITOV(inode) (container_of(inode, vnode_t, v_inode)) #define LZFS_VTOI(vp) (&(vp)->v_inode) @@ -341,47 +341,47 @@ extern vnode_t *rootdir; void -zfs_inactive(vnode_t *vp, struct cred *cr, caller_context_t *ct); +zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct); int zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, - int flags, vnode_t *rdir, struct cred *cr, caller_context_t *ct, + int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct, int *direntflags, pathname_t *realpnp); int zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, - int mode, vnode_t **vpp, struct cred *cr, int flag, caller_context_t *ct, + int mode, vnode_t **vpp, cred_t *cr, int flag, caller_context_t *ct, vsecattr_t *vsecp); int -zfs_readdir(vnode_t *vp, uio_t *uio, struct cred *cr, int *eofp, +zfs_readdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, caller_context_t *ct, int flags, filldir_t filldir, uint64_t *pos); int -zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, struct cred *cr, +zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, caller_context_t *ct, int flags); int -zfs_remove(vnode_t *dvp, char *name, struct cred *cr, caller_context_t *ct, +zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, int flags); int zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, - struct cred *cr, + cred_t *cr, caller_context_t *ct, int flags, vsecattr_t *vsecp); int -zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, struct cred *cr, +zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, caller_context_t *ct, int flags); int zfs_symlink(vnode_t *dvp, char *name, vattr_t *vap, char *link, - struct cred *cr, + cred_t *cr, caller_context_t *ct, int flags, vnode_t **vpp); int -zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, struct cred *cr, +zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr, caller_context_t *ct, int flags); int -zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, struct cred *cr, +zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct); int -zfs_readlink(vnode_t *vp, uio_t *uio, struct cred *cr, caller_context_t *ct); +zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct); int zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, @@ -396,16 +396,16 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct); int -zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, struct cred *cr, +zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct); int -zfs_fsync(vnode_t *vp, int syncflag, struct cred *cr, +zfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct); void xva_init(xvattr_t *xvap); int zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, - offset_t offset, struct cred *cr, caller_context_t *ct); + offset_t offset, cred_t *cr, caller_context_t *ct); #ifdef __cplusplus } diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 795deea0..ed6ef008 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -131,7 +131,7 @@ EXPORT_SYMBOL(vn_get_lin_type); * inode device type in this function */ vnode_t * -specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr) +specvp(struct vnode *vp, dev_t dev, vtype_t type, cred_t *cr) { VN_HOLD(vp); init_special_inode(&vp->v_inode,vn_get_lin_type(type) , dev); diff --git a/spl_config.h.in b/spl_config.h.in index df213d74..f8135f28 100644 --- a/spl_config.h.in +++ b/spl_config.h.in @@ -9,6 +9,12 @@ /* Define to 1 to enable detailed kmem tracking */ #undef DEBUG_KMEM_TRACKING +/* blkdev_put() wants 1 args */ +#undef HAVE_1ARGS_BLKDEV_PUT + +/* follow_down() wants 2 args */ +#undef HAVE_2ARGS_FOLLOW_DOWN + /* register_sysctl_table() wants 2 args */ #undef HAVE_2ARGS_REGISTER_SYSCTL @@ -18,6 +24,9 @@ /* vfs_unlink() wants 2 args */ #undef HAVE_2ARGS_VFS_UNLINK +/* blkdev_get() wants 3 args */ +#undef HAVE_3ARGS_BLKDEV_GET + /* file_fsync() wants 3 args */ #undef HAVE_3ARGS_FILE_FSYNC @@ -66,6 +75,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* d_alloc_anon() is available */ +#undef HAVE_D_ALLOC_ANON + /* linux/fdtable.h exists */ #undef HAVE_FDTABLE_HEADER