Public feed #891751

Vermischtes

public diff v1 · immutable
Raw Edit
·published 2008-02-04 21:49 UTC
rendered paste body
diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs.h ../bsdext2fs/ext2fs.h--- /home/pluknet/tmp/ext2fs_stock/ext2fs.h	2008-02-05 00:20:39.000000000 +0300+++ ../bsdext2fs/ext2fs.h	2008-02-05 00:40:08.000000000 +0300@@ -30,6 +30,8 @@  *  *	@(#)fs.h	8.10 (Berkeley) 10/27/94  *  Modified for ext2fs by Manuel Bouyer.+ *+ * $FreeBSD$  */  /*@@ -67,7 +69,7 @@ #ifndef _UFS_EXT2FS_EXT2FS_H_ #define _UFS_EXT2FS_EXT2FS_H_ -#include <sys/bswap.h>+#include <sys/endian.h>  /*  * Each disk drive contains some number of file systems.diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_alloc.c ../bsdext2fs/ext2fs_alloc.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_alloc.c	2008-02-05 00:20:54.000000000 +0300+++ ../bsdext2fs/ext2fs_alloc.c	2008-02-05 00:30:03.000000000 +0300@@ -65,7 +65,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.35 2007/10/08 18:01:27 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -75,14 +75,13 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc #include <sys/mount.h> #include <sys/kernel.h> #include <sys/syslog.h>-#include <sys/kauth.h>  #include <ufs/ufs/inode.h> #include <ufs/ufs/ufs_extern.h> #include <ufs/ufs/ufsmount.h> -#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>  u_long ext2gennumber; @@ -114,7 +113,7 @@ static daddr_t	ext2fs_mapsearch(struct m  */ int ext2fs_alloc(struct inode *ip, daddr_t lbn, daddr_t bpref,-    kauth_cred_t cred, daddr_t *bnp)+    struct ucred *cred, daddr_t *bnp) { 	struct m_ext2fs *fs; 	daddr_t bno;@@ -128,8 +127,7 @@ ext2fs_alloc(struct inode *ip, daddr_t l #endif /* DIAGNOSTIC */ 	if (fs->e2fs.e2fs_fbcount == 0) 		goto nospace;-	if (kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL) != 0 &&-	    freespace(fs) <= 0)+	if (cred->cr_uid != 0 && freespace(fs) <= 0) 		goto nospace; 	if (bpref >= fs->e2fs.e2fs_bcount) 		bpref = 0;@@ -146,7 +144,7 @@ ext2fs_alloc(struct inode *ip, daddr_t l 		return (0); 	} nospace:-	ext2fs_fserr(fs, kauth_cred_geteuid(cred), "file system full");+	ext2fs_fserr(fs, cred->cr_uid, "file system full"); 	uprintf("\n%s: write failed, file system is full\n", fs->e2fs_fsmnt); 	return (ENOSPC); }@@ -167,7 +165,7 @@ nospace:  *	  available inode is located.  */ int-ext2fs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred,+ext2fs_valloc(struct vnode *pvp, int mode, struct ucred *cred,     struct vnode **vpp) { 	struct inode *pip;@@ -213,7 +211,7 @@ ext2fs_valloc(struct vnode *pvp, int mod 	ip->i_e2fs_gen = ext2gennumber; 	return (0); noinodes:-	ext2fs_fserr(fs, kauth_cred_geteuid(cred), "out of inodes");+	ext2fs_fserr(fs, cred->cr_uid, "out of inodes"); 	uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt); 	return (ENOSPC); }diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_balloc.c ../bsdext2fs/ext2fs_balloc.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_balloc.c	2008-02-05 00:21:09.000000000 +0300+++ ../bsdext2fs/ext2fs_balloc.c	2008-02-05 00:41:18.000000000 +0300@@ -65,11 +65,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.32 2007/10/08 18:01:27 ad Exp $");--#if defined(_KERNEL_OPT)-#include "opt_uvmhist.h"-#endif+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -78,15 +74,14 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_ballo #include <sys/file.h> #include <sys/vnode.h> #include <sys/mount.h>-#include <sys/kauth.h> -#include <uvm/uvm.h>+//#include <uvm/uvm.h>  #include <ufs/ufs/inode.h> #include <ufs/ufs/ufs_extern.h> -#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>  /*  * Balloc defines the structure of file system storage@@ -94,8 +89,8 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_ballo  * the inode and the logical block number in a file.  */ int-ext2fs_balloc(struct inode *ip, daddr_t bn, int size,-    kauth_cred_t cred, struct buf **bpp, int flags)+ext2fs_balloc(struct inode *ip, daddr_t bn, int size, struct ucred *cred,+		struct buf **bpp, int flags) { 	struct m_ext2fs *fs; 	daddr_t nb;@@ -109,9 +104,6 @@ ext2fs_balloc(struct inode *ip, daddr_t  	daddr_t *blkp, *allocblk, allociblk[NIADDR + 1]; 	int32_t *allocib;	/* XXX ondisk32 */ 	int unwindidx = -1;-	UVMHIST_FUNC("ext2fs_balloc"); UVMHIST_CALLED(ubchist);--	UVMHIST_LOG(ubchist, "bn 0x%x", bn,0,0,0);  	if (bpp != NULL) { 		*bpp = NULL;@@ -356,12 +348,11 @@ fail:  int ext2fs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,-    kauth_cred_t cred)+    struct ucred *cred) { 	struct inode *ip = VTOI(vp); 	struct m_ext2fs *fs = ip->i_e2fs; 	int error, delta, bshift, bsize;-	UVMHIST_FUNC("ext2fs_gop_alloc"); UVMHIST_CALLED(ubchist);  	bshift = fs->e2fs_bshift; 	bsize = 1 << bshift;@@ -372,13 +363,10 @@ ext2fs_gop_alloc(struct vnode *vp, off_t  	while (len > 0) { 		bsize = min(bsize, len);-		UVMHIST_LOG(ubchist, "off 0x%x len 0x%x bsize 0x%x",-			    off, len, bsize, 0);  		error = ext2fs_balloc(ip, lblkno(fs, off), bsize, cred, 		    NULL, flags); 		if (error) {-			UVMHIST_LOG(ubchist, "error %d", error, 0,0,0); 			return error; 		} @@ -388,15 +376,8 @@ ext2fs_gop_alloc(struct vnode *vp, off_t 		 */  		if (ext2fs_size(ip) < off + bsize) {-			UVMHIST_LOG(ubchist, "old 0x%lx%8lx new 0x%lx%8lx",-			    /* Note that arguments are always cast to u_long. */-				    ext2fs_size(ip) >> 32,-				    ext2fs_size(ip) & 0xffffffff,-				    (off + bsize) >> 32,-				    (off + bsize) & 0xffffffff); 			error = ext2fs_setsize(ip, off + bsize); 			if (error) {-				UVMHIST_LOG(ubchist, "error %d", error, 0,0,0); 				return error; 			} 		}diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_bmap.c ../bsdext2fs/ext2fs_bmap.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_bmap.c	2008-02-05 00:21:19.000000000 +0300+++ ../bsdext2fs/ext2fs_bmap.c	2008-02-05 00:31:07.000000000 +0300@@ -70,7 +70,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.23 2008/01/02 11:49:08 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -86,8 +86,8 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap. #include <ufs/ufs/inode.h> #include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h>-#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>  static int ext2fs_bmaparray(struct vnode *, daddr_t, daddr_t *, 				struct indir *, int *, int *);diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_bswap.c ../bsdext2fs/ext2fs_bswap.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_bswap.c	2008-02-05 00:21:30.000000000 +0300+++ ../bsdext2fs/ext2fs_bswap.c	2008-02-05 00:31:36.000000000 +0300@@ -31,11 +31,11 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_bswap.c,v 1.13 2007/11/17 08:34:38 tsutsui Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/types.h>-#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_dinode.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_dinode.h>  #if defined(_KERNEL) #include <sys/systm.h>diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_dinode.h ../bsdext2fs/ext2fs_dinode.h--- /home/pluknet/tmp/ext2fs_stock/ext2fs_dinode.h	2008-02-05 00:21:40.000000000 +0300+++ ../bsdext2fs/ext2fs_dinode.h	2008-02-05 00:33:17.000000000 +0300@@ -35,6 +35,8 @@  *  *	@(#)dinode.h	8.6 (Berkeley) 9/13/94  *  Modified for ext2fs by Manuel Bouyer.+ *+ * $FreeBSD$  */  /*diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_dir.h ../bsdext2fs/ext2fs_dir.h--- /home/pluknet/tmp/ext2fs_stock/ext2fs_dir.h	2008-02-05 00:21:57.000000000 +0300+++ ../bsdext2fs/ext2fs_dir.h	2008-02-05 00:33:10.000000000 +0300@@ -35,6 +35,8 @@  *  *	@(#)dir.h	8.4 (Berkeley) 8/10/94  * Modified for ext2fs by Manuel Bouyer.+ *+ * $FreeBSD$  */  /*diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_extern.h ../bsdext2fs/ext2fs_extern.h--- /home/pluknet/tmp/ext2fs_stock/ext2fs_extern.h	2008-02-05 00:22:05.000000000 +0300+++ ../bsdext2fs/ext2fs_extern.h	2008-02-05 00:33:32.000000000 +0300@@ -30,6 +30,8 @@  *  *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94  * Modified for ext2fs by Manuel Bouyer.+ *+ * $FreeBSD$  */  /*-@@ -83,8 +85,8 @@ struct vnode; struct mbuf; struct componentname; -extern struct pool ext2fs_inode_pool;		/* memory pool for inodes */-extern struct pool ext2fs_dinode_pool;		/* memory pool for dinodes */+extern uma_zone_t ext2fs_inode_pool;		/* memory pool for inodes */+extern uma_zone_t ext2fs_dinode_pool;		/* memory pool for dinodes */  #define	EXT2FS_ITIMES(ip, acc, mod, cre) \ 	while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \@@ -93,20 +95,20 @@ extern struct pool ext2fs_dinode_pool;		 __BEGIN_DECLS  /* ext2fs_alloc.c */-int ext2fs_alloc(struct inode *, daddr_t, daddr_t , kauth_cred_t,+int ext2fs_alloc(struct inode *, daddr_t, daddr_t , struct ucred, 		   daddr_t *); int ext2fs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,-			  kauth_cred_t, struct buf **);-int ext2fs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);+			  struct ucred, struct buf **);+int ext2fs_valloc(struct vnode *, int, struct ucred, struct vnode **); /* XXX ondisk32 */ daddr_t ext2fs_blkpref(struct inode *, daddr_t, int, int32_t *); void ext2fs_blkfree(struct inode *, daddr_t); int ext2fs_vfree(struct vnode *, ino_t, int);  /* ext2fs_balloc.c */-int ext2fs_balloc(struct inode *, daddr_t, int, kauth_cred_t,+int ext2fs_balloc(struct inode *, daddr_t, int, struct ucred, 			struct buf **, int);-int ext2fs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);+int ext2fs_gop_alloc(struct vnode *, off_t, off_t, int, struct ucred);  /* ext2fs_bmap.c */ int ext2fs_bmap(void *);@@ -116,7 +118,7 @@ u_int64_t ext2fs_size(struct inode *); int ext2fs_setsize(struct inode *, u_int64_t); int ext2fs_update(struct vnode *, const struct timespec *,     const struct timespec *, int);-int ext2fs_truncate(struct vnode *, off_t, int, kauth_cred_t);+int ext2fs_truncate(struct vnode *, off_t, int, struct ucred); int ext2fs_inactive(void *);  /* ext2fs_lookup.c */@@ -127,8 +129,8 @@ int ext2fs_direnter(struct inode *, stru int ext2fs_dirremove(struct vnode *, struct componentname *); int ext2fs_dirrewrite(struct inode *, struct inode *, 			   struct componentname *);-int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t);-int ext2fs_checkpath(struct inode *, struct inode *, kauth_cred_t);+int ext2fs_dirempty(struct inode *, ino_t, struct ucred);+int ext2fs_checkpath(struct inode *, struct inode *, struct ucred);  /* ext2fs_subr.c */ int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **);@@ -138,7 +140,7 @@ void ext2fs_itimes(struct inode *, const  /* ext2fs_vfsops.c */ VFS_PROTOS(ext2fs);-int ext2fs_reload(struct mount *, kauth_cred_t);+int ext2fs_reload(struct mount *, struct ucred); int ext2fs_mountfs(struct vnode *, struct mount *); int ext2fs_flushfiles(struct mount *, int); int ext2fs_sbupdate(struct ufsmount *, int);diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_inode.c ../bsdext2fs/ext2fs_inode.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_inode.c	2008-02-05 00:22:13.000000000 +0300+++ ../bsdext2fs/ext2fs_inode.c	2008-02-05 00:33:56.000000000 +0300@@ -65,7 +65,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.64 2008/01/09 16:15:23 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -78,14 +78,13 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_inode #include <sys/malloc.h> #include <sys/trace.h> #include <sys/resourcevar.h>-#include <sys/kauth.h>  #include <ufs/ufs/inode.h> #include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h> -#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>  extern int prtactive; @@ -242,7 +241,7 @@ ext2fs_update(struct vnode *vp, const st  */ int ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,-    kauth_cred_t cred)+    struct ucred *cred) { 	daddr_t lastblock; 	struct inode *oip = VTOI(ovp);diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_lookup.c ../bsdext2fs/ext2fs_lookup.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_lookup.c	2008-02-05 00:22:22.000000000 +0300+++ ../bsdext2fs/ext2fs_lookup.c	2008-02-05 00:34:30.000000000 +0300@@ -48,7 +48,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.55 2007/12/08 19:29:53 pooka Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -59,16 +59,15 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_looku #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/dirent.h>-#include <sys/kauth.h> #include <sys/proc.h>  #include <ufs/ufs/inode.h> #include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h> -#include <ufs/ext2fs/ext2fs_extern.h>-#include <ufs/ext2fs/ext2fs_dir.h>-#include <ufs/ext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs_dir.h>+#include <fs/bsdext2fs/ext2fs.h>  extern	int dirchk; @@ -131,7 +130,7 @@ ext2fs_readdir(void *v) 	struct vop_readdir_args /* { 		struct vnode *a_vp; 		struct uio *a_uio;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 		int **a_eofflag; 		off_t **a_cookies; 		int ncookies;@@ -284,7 +283,7 @@ ext2fs_lookup(void *v) 	int namlen, error; 	struct vnode **vpp = ap->a_vpp; 	struct componentname *cnp = ap->a_cnp;-	kauth_cred_t cred = cnp->cn_cred;+	struct ucred *cred = cnp->cn_cred; 	int flags; 	int nameiop = cnp->cn_nameiop; 	struct ufsmount *ump = dp->i_ump;@@ -602,9 +601,9 @@ found: 		 * implements append-only directories. 		 */ 		if ((dp->i_e2fs_mode & ISVTX) &&-		    kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL) &&-		    kauth_cred_geteuid(cred) != dp->i_e2fs_uid &&-		    VTOI(tdp)->i_e2fs_uid != kauth_cred_geteuid(cred)) {+		    cred->cr_uid != 0 &&+		    cred->cr_uid != dp->i_e2fs_uid &&+		    VTOI(tdp)->i_e2fs_uid != cred->cr_uid) { 			vput(tdp); 			return (EPERM); 		}@@ -960,7 +959,7 @@ ext2fs_dirrewrite(struct inode *dp, stru  * NB: does not handle corrupted directories.  */ int-ext2fs_dirempty(struct inode *ip, ino_t parentino, kauth_cred_t cred)+ext2fs_dirempty(struct inode *ip, ino_t parentino, struct ucred *cred) { 	off_t off; 	struct ext2fs_dirtemplate dbuf;@@ -1012,7 +1011,7 @@ ext2fs_dirempty(struct inode *ip, ino_t   */ int ext2fs_checkpath(struct inode *source, struct inode *target,-	kauth_cred_t cred)+	struct ucred *cred) { 	struct vnode *vp; 	int error, rootino, namlen;diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_readwrite.c ../bsdext2fs/ext2fs_readwrite.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_readwrite.c	2008-02-05 00:22:29.000000000 +0300+++ ../bsdext2fs/ext2fs_readwrite.c	2008-02-05 00:34:56.000000000 +0300@@ -65,7 +65,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.50 2008/01/02 11:49:08 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -79,13 +79,12 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_readw #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/signalvar.h>-#include <sys/kauth.h>  #include <ufs/ufs/inode.h> #include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h>-#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>   #define doclusterread 0 /* XXX underway */@@ -102,7 +101,7 @@ ext2fs_read(void *v) 		struct vnode *a_vp; 		struct uio *a_uio; 		int a_ioflag;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vnode *vp; 	struct inode *ip;@@ -226,7 +225,7 @@ ext2fs_write(void *v) 		struct vnode *a_vp; 		struct uio *a_uio; 		int a_ioflag;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vnode *vp; 	struct uio *uio;@@ -399,8 +398,7 @@ ext2fs_write(void *v)  out: 	ip->i_flag |= IN_CHANGE | IN_UPDATE;-	if (resid > uio->uio_resid && ap->a_cred &&-	    kauth_authorize_generic(ap->a_cred, KAUTH_GENERIC_ISSUSER, NULL))+	if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0) 		ip->i_e2fs_mode &= ~(ISUID | ISGID); 	if (resid > uio->uio_resid) 		VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_subr.c ../bsdext2fs/ext2fs_subr.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_subr.c	2008-02-05 00:22:37.000000000 +0300+++ ../bsdext2fs/ext2fs_subr.c	2008-02-05 00:35:13.000000000 +0300@@ -65,18 +65,17 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.25 2007/10/08 18:01:28 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h> #include <sys/vnode.h> #include <sys/buf.h>-#include <sys/inttypes.h>-#include <sys/kauth.h>+#include <machine/_inttypes.h>  #include <ufs/ufs/inode.h>-#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include "ext2fs.h"+#include  "ext2fs_extern.h"  /*  * Return buffer with the contents of block "offset" from the beginning ofdiff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_vfsops.c ../bsdext2fs/ext2fs_vfsops.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_vfsops.c	2008-02-05 00:22:45.000000000 +0300+++ ../bsdext2fs/ext2fs_vfsops.c	2008-02-05 00:35:31.000000000 +0300@@ -65,7 +65,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.130 2008/01/30 11:47:03 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h"@@ -81,17 +81,15 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsop #include <sys/socket.h> #include <sys/mount.h> #include <sys/buf.h>-#include <sys/device.h>+//#include <sys/device.h> #include <sys/mbuf.h> #include <sys/file.h> #include <sys/disklabel.h> #include <sys/ioctl.h> #include <sys/errno.h> #include <sys/malloc.h>-#include <sys/pool.h> #include <sys/lock.h> #include <sys/conf.h>-#include <sys/kauth.h>  #include <miscfs/genfs/genfs.h> #include <miscfs/specfs/specdev.h>@@ -102,9 +100,9 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsop #include <ufs/ufs/dir.h> #include <ufs/ufs/ufs_extern.h> -#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_dir.h>-#include <ufs/ext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_dir.h>+#include <fs/bsdext2fs/ext2fs_extern.h>  extern kmutex_t ufs_hashlock; @@ -123,32 +121,18 @@ const struct vnodeopv_desc * const ext2f };  struct vfsops ext2fs_vfsops = {-	MOUNT_EXT2FS,-	sizeof (struct ufs_args),-	ext2fs_mount,-	ufs_start,-	ext2fs_unmount,-	ufs_root,-	ufs_quotactl,-	ext2fs_statvfs,-	ext2fs_sync,-	ext2fs_vget,-	ext2fs_fhtovp,-	ext2fs_vptofh,-	ext2fs_init,-	ext2fs_reinit,-	ext2fs_done,-	ext2fs_mountroot,-	(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,-	vfs_stdextattrctl,-	(void *)eopnotsupp,	/* vfs_suspendctl */-	genfs_renamelock_enter,-	genfs_renamelock_exit,-	ext2fs_vnodeopv_descs,-	0,-	{ NULL, NULL },+	.vfs_mount =			ext2fs_mount,+	.vfs_unmount =			ext2fs_unmount,+	.vfs_quotactl =			ufs_quotactl,+	.vfs_statfs =			ext2fs_statvfs,+	.vfs_sync =			ext2fs_sync,+	.vfs_vget =			ext2fs_vget,+	.vfs_fhtovp =			ext2fs_fhtovp,+	.vfs_init =			ext2fs_init,+	.vfs_uninit =			ext2fs_done,+	.vfs_root =			ext2fs_mountroot, };-VFS_ATTACH(ext2fs_vfsops);+VFS_SET(ext2fs_vfsops, ext2fs, 0);  static const struct genfs_ops ext2fs_genfsops = { 	.gop_size = genfs_size,@@ -166,19 +150,18 @@ static const struct ufs_ops ext2fs_ufsop /*  * XXX Same structure as FFS inodes?  Should we share a common pool?  */-struct pool ext2fs_inode_pool;-struct pool ext2fs_dinode_pool;+uma_zone_t ext2fs_inode_pool;+uma_zone_t ext2fs_dinode_pool;  extern u_long ext2gennumber;  void ext2fs_init(void) {--	pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0,-	    "ext2fsinopl", &pool_allocator_nointr, IPL_NONE);-	pool_init(&ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0, 0,-	    "ext2dinopl", &pool_allocator_nointr, IPL_NONE);+	ext2fs_inode_pool = uma_zcreate("ext2fs node", sizeof(struct inode),+	    0, 0, 0, 0, UMA_ALIGN_PTR, M_WAITOK);+	ex2fs_dinode_pool = uma_zcreate("ext2fs dirent",+	    sizeof(struct ext2fs_dinode), 0, 0, 0, 0, UMA_ALIGN_PTR, M_WAITOK); 	ufs_init(); } @@ -193,8 +176,8 @@ ext2fs_done(void) {  	ufs_done();-	pool_destroy(&ext2fs_inode_pool);-	pool_destroy(&ext2fs_dinode_pool);+	uma_zdestroy(ext2fs_inode_pool);+	uma_zdestroy(ext2fs_dinode_pool); }  /*@@ -320,7 +303,7 @@ ext2fs_mount(struct mount *mp, const cha 	 * If mount by non-root, then verify that user has necessary 	 * permissions on the device. 	 */-	if (error == 0 && kauth_authorize_generic(l->l_cred,+	if (error == 0 && l->l_cred->cr_uid != 0, 	    KAUTH_GENERIC_ISSUSER, NULL) != 0) { 		accessmode = VREAD; 		if (update ?@@ -328,7 +311,7 @@ ext2fs_mount(struct mount *mp, const cha 		    (mp->mnt_flag & MNT_RDONLY) == 0) 			accessmode |= VWRITE; 		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);-		error = VOP_ACCESS(devvp, accessmode, l->l_cred);+		error = VOP_ACCESS(devvp, accessmode, l->l_cred->cr_uid); 		VOP_UNLOCK(devvp, 0); 	} @@ -452,7 +435,7 @@ fail:  *	6) re-read inode data for all active vnodes.  */ int-ext2fs_reload(struct mount *mountp, kauth_cred_t cred)+ext2fs_reload(struct mount *mountp, struct ucred *cred) { 	struct lwp *l = curlwp; 	struct vnode *vp, *mvp, *devvp;@@ -604,12 +587,12 @@ ext2fs_mountfs(struct vnode *devvp, stru 	dev_t dev; 	struct partinfo dpart; 	int error, i, size, ronly;-	kauth_cred_t cred;+	struct ucred *cred; 	struct proc *p;  	dev = devvp->v_rdev; 	p = l ? l->l_proc : NULL;-	cred = l ? l->l_cred : NOCRED;+	cred = l ? l->l_cred->cr_uid : NOCRED;  	/* Flush out any old buffers remaining from a previous use. */ 	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);@@ -843,7 +826,7 @@ ext2fs_statvfs(struct mount *mp, struct   * Note: we are always called with the filesystem marked `MPBUSY'.  */ int-ext2fs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)+ext2fs_sync(struct mount *mp, int waitfor, struct ucred *cred) { 	struct vnode *vp, *mvp; 	struct inode *ip;@@ -960,13 +943,13 @@ retry: 		*vpp = NULL; 		return (error); 	}-	ip = pool_get(&ext2fs_inode_pool, PR_WAITOK);+	ip = uma_zalloc(ext2fs_inode_pool, M_WAITOK);  	mutex_enter(&ufs_hashlock); 	if ((*vpp = ufs_ihashget(dev, ino, 0)) != NULL) { 		mutex_exit(&ufs_hashlock); 		ungetnewvnode(vp);-		pool_put(&ext2fs_inode_pool, ip);+		uma_zfree(ext2fs_inode_pool, ip); 		goto retry; 	} @@ -1010,7 +993,7 @@ retry: 		return (error); 	} 	cp = (char *)bp->b_data + (ino_to_fsbo(fs, ino) * EXT2_DINODE_SIZE);-	ip->i_din.e2fs_din = pool_get(&ext2fs_dinode_pool, PR_WAITOK);+	ip->i_din.e2fs_din = uma_zalloc(ext2fs_dinode_pool, M_WAITOK); 	e2fs_iload((struct ext2fs_dinode *)cp, ip->i_din.e2fs_din); 	brelse(bp, 0); diff -uNp /home/pluknet/tmp/ext2fs_stock/ext2fs_vnops.c ../bsdext2fs/ext2fs_vnops.c--- /home/pluknet/tmp/ext2fs_stock/ext2fs_vnops.c	2008-02-05 00:22:54.000000000 +0300+++ ../bsdext2fs/ext2fs_vnops.c	2008-02-05 00:35:52.000000000 +0300@@ -70,7 +70,7 @@  */  #include <sys/cdefs.h>-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.81 2008/01/25 14:32:16 ad Exp $");+__FBSDID(0, "$FreeBSD$");  #include <sys/param.h> #include <sys/systm.h>@@ -85,11 +85,9 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops #include <sys/vnode.h> #include <sys/lockf.h> #include <sys/malloc.h>-#include <sys/pool.h> #include <sys/signalvar.h>-#include <sys/kauth.h> -#include <miscfs/fifofs/fifo.h>+#include <fs/fifofs/fifo.h> #include <miscfs/genfs/genfs.h> #include <miscfs/specfs/specdev.h> @@ -97,14 +95,14 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops #include <ufs/ufs/ufs_extern.h> #include <ufs/ufs/ufsmount.h> -#include <ufs/ext2fs/ext2fs.h>-#include <ufs/ext2fs/ext2fs_extern.h>-#include <ufs/ext2fs/ext2fs_dir.h>+#include <fs/bsdext2fs/ext2fs.h>+#include <fs/bsdext2fs/ext2fs_extern.h>+#include <fs/bsdext2fs/ext2fs_dir.h>  extern int prtactive; -static int ext2fs_chmod(struct vnode *, int, kauth_cred_t, struct lwp *);-static int ext2fs_chown(struct vnode *, uid_t, gid_t, kauth_cred_t,+static int ext2fs_chmod(struct vnode *, int, struct ucred *, struct lwp *);+static int ext2fs_chown(struct vnode *, uid_t, gid_t, struct ucred *, 				struct lwp *);  union _qcvt {@@ -212,7 +210,7 @@ ext2fs_open(void *v) 	struct vop_open_args /* { 		struct vnode *a_vp; 		int  a_mode;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v;  	/*@@ -230,7 +228,7 @@ ext2fs_access(void *v) 	struct vop_access_args /* { 		struct vnode *a_vp; 		int  a_mode;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vnode *vp = ap->a_vp; 	struct inode *ip = VTOI(vp);@@ -269,7 +267,7 @@ ext2fs_getattr(void *v) 	struct vop_getattr_args /* { 		struct vnode *a_vp; 		struct vattr *a_vap;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vnode *vp = ap->a_vp; 	struct inode *ip = VTOI(vp);@@ -323,12 +321,12 @@ ext2fs_setattr(void *v) 	struct vop_setattr_args /* { 		struct vnode *a_vp; 		struct vattr *a_vap;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vattr *vap = ap->a_vap; 	struct vnode *vp = ap->a_vp; 	struct inode *ip = VTOI(vp);-	kauth_cred_t cred = ap->a_cred;+	struct ucred *cred = ap->a_cred; 	struct lwp *l = curlwp; 	int error; @@ -344,17 +342,13 @@ ext2fs_setattr(void *v) 	if (vap->va_flags != VNOVAL) { 		if (vp->v_mount->mnt_flag & MNT_RDONLY) 			return (EROFS);-		if (kauth_cred_geteuid(cred) != ip->i_e2fs_uid &&-		    (error = kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER,-		    NULL)))+		if (cred->cr_uid != ip->i_e2fs_uid &&+		    (error = suser(cred, &l->l_proc->p_acflag))) 			return (error); #ifdef EXT2FS_SYSTEM_FLAGS-		if (kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER,-		    NULL) == 0) {+		if (cred->cr_uid == 0) { 			if ((ip->i_e2fs_flags &-			    (EXT2_APPEND | EXT2_IMMUTABLE)) &&-			    kauth_authorize_system(l->l_cred,-			     KAUTH_SYSTEM_CHSYSFLAGS, 0, NULL, NULL, NULL))+			    (EXT2_APPEND | EXT2_IMMUTABLE)) && securelevel > 0) 				return (EPERM); 			ip->i_e2fs_flags &= ~(EXT2_APPEND | EXT2_IMMUTABLE); 			ip->i_e2fs_flags |=@@ -408,9 +402,8 @@ ext2fs_setattr(void *v) 	if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { 		if (vp->v_mount->mnt_flag & MNT_RDONLY) 			return (EROFS);-		if (kauth_cred_geteuid(cred) != ip->i_e2fs_uid &&-			(error = kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, -			NULL)) &&+		if (cred->cr_uid != ip->i_e2fs_uid &&+			(error = suser(cred, &l->l_proc->p_acflag)) && 			((vap->va_vaflags & VA_UTIMES_NULL) == 0 || 			(error = VOP_ACCESS(vp, VWRITE, cred)))) 			return (error);@@ -439,20 +432,18 @@ ext2fs_setattr(void *v)  * Inode must be locked before calling.  */ static int-ext2fs_chmod(struct vnode *vp, int mode, kauth_cred_t cred, struct lwp *l)+ext2fs_chmod(struct vnode *vp, int mode, struct ucred *cred, struct lwp *l) { 	struct inode *ip = VTOI(vp); 	int error, ismember = 0; -	if (kauth_cred_geteuid(cred) != ip->i_e2fs_uid &&-	    (error = kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER,-	    NULL)))+	if (cred->cr_uid != ip->i_e2fs_uid &&+	    (error = suser(cred, &p->p_acflag))) 		return (error);-	if (kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL)) {+	if (cred->cr_uid) { 		if (vp->v_type != VDIR && (mode & S_ISTXT)) 			return (EFTYPE);-		if ((kauth_cred_ismember_gid(cred, ip->i_e2fs_gid, &ismember) != 0 ||-		    !ismember) && (mode & ISGID))+		if (!groupmember(ip->i_e2fs_gid, cred) && (mode & S_ISGID)) 			return (EPERM); 	} 	ip->i_e2fs_mode &= ~ALLPERMS;@@ -483,11 +474,10 @@ ext2fs_chown(struct vnode *vp, uid_t uid 	 * of the file, or are not a member of the target group, 	 * the caller must be superuser or the call fails. 	 */-	if ((kauth_cred_geteuid(cred) != ip->i_e2fs_uid || uid != ip->i_e2fs_uid ||+	if ((cred->cr_uid != ip->i_e2fs_uid || uid != ip->i_e2fs_uid ||  	    (gid != ip->i_e2fs_gid &&-	    !(kauth_cred_getegid(cred) == gid ||-	    (kauth_cred_ismember_gid(cred, gid, &ismember) == 0 && ismember)))) &&-	    (error = kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL)))+	    !(cred->cr_uid == gid || groupmember((gid_t)gid, cred)))) &&+	    (error = suser(cred, &p->p_acflag))) 		return (error); 	ogid = ip->i_e2fs_gid; 	ouid = ip->i_e2fs_uid;@@ -496,11 +486,9 @@ ext2fs_chown(struct vnode *vp, uid_t uid 	ip->i_e2fs_uid = uid; 	if (ouid != uid || ogid != gid) 		ip->i_flag |= IN_CHANGE;-	if (ouid != uid && kauth_authorize_generic(cred,-	    KAUTH_GENERIC_ISSUSER, NULL) != 0)+	if (ouid != uid && cred->cr_uid != 0) 		ip->i_e2fs_mode &= ~ISUID;-	if (ogid != gid && kauth_authorize_generic(cred,-	    KAUTH_GENERIC_ISSUSER, NULL) != 0)+	if (ogid != gid && cred->cr_uid != 0) 		ip->i_e2fs_mode &= ~ISGID; 	return (0); }@@ -862,11 +850,9 @@ abortit: 		 * otherwise the destination may not be changed (except by 		 * root). This implements append-only directories. 		 */-		if ((dp->i_e2fs_mode & S_ISTXT) &&-		    kauth_authorize_generic(tcnp->cn_cred,-		     KAUTH_GENERIC_ISSUSER, NULL) != 0 &&-		    kauth_cred_geteuid(tcnp->cn_cred) != dp->i_e2fs_uid &&-		    xp->i_e2fs_uid != kauth_cred_geteuid(tcnp->cn_cred)) {+		if ((dp->i_e2fs_mode & S_ISTXT) && tcnp->cn_cred->cr_uid) != 0 &&+		    tcnp->cn_cred->cr_uid != dp->i_e2fs_uid &&+		    xp->i_e2fs_uid != tcnp->cn_cred->cr_uid) { 			error = EPERM; 			goto bad; 		}@@ -1069,7 +1055,7 @@ ext2fs_mkdir(void *v) 	if ((error = ext2fs_valloc(dvp, dmode, cnp->cn_cred, &tvp)) != 0) 		goto out; 	ip = VTOI(tvp);-	ip->i_e2fs_uid = kauth_cred_geteuid(cnp->cn_cred);+	ip->i_e2fs_uid = cnp->cn_cred->cr_uid; 	ip->i_e2fs_gid = dp->i_e2fs_gid; 	ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; 	ip->i_e2fs_mode = dmode;@@ -1284,7 +1270,7 @@ ext2fs_readlink(void *v) 	struct vop_readlink_args /* { 		struct vnode *a_vp; 		struct uio *a_uio;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 	} */ *ap = v; 	struct vnode	*vp = ap->a_vp; 	struct inode	*ip = VTOI(vp);@@ -1323,7 +1309,7 @@ ext2fs_fsync(void *v) { 	struct vop_fsync_args /* { 		struct vnode *a_vp;-		kauth_cred_t a_cred;+		struct ucred *a_cred; 		int a_flags; 		off_t offlo; 		off_t offhi;@@ -1419,14 +1405,14 @@ ext2fs_makeinode(int mode, struct vnode  	} 	ip = VTOI(tvp); 	ip->i_e2fs_gid = pdir->i_e2fs_gid;-	ip->i_e2fs_uid = kauth_cred_geteuid(cnp->cn_cred);+	ip->i_e2fs_uid = cnp->cn_cred->cr_uid; 	ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; 	ip->i_e2fs_mode = mode; 	tvp->v_type = IFTOVT(mode);	/* Rest init'd in getnewvnode(). */ 	ip->i_e2fs_nlink = 1;-	if ((ip->i_e2fs_mode & ISGID) && (kauth_cred_ismember_gid(cnp->cn_cred,-	    ip->i_e2fs_gid, &ismember) != 0 || !ismember) &&-	    kauth_authorize_generic(cnp->cn_cred, KAUTH_GENERIC_ISSUSER, NULL))+	if ((ip->i_e2fs_mode & ISGID) &&+		!groupmember(ip->i_e2fs_gid, cnp->cn_cred) &&+	    suser(cnp->cn_cred, NULL)) 		ip->i_e2fs_mode &= ~ISGID;  	/*@@ -1473,9 +1459,9 @@ ext2fs_reclaim(void *v) 	if ((error = ufs_reclaim(vp)) != 0) 		return (error); 	if (ip->i_din.e2fs_din != NULL)-		pool_put(&ext2fs_dinode_pool, ip->i_din.e2fs_din);+		uma_zfree(ext2fs_dinode_pool, ip->i_din.e2fs_din); 	genfs_node_destroy(vp);-	pool_put(&ext2fs_inode_pool, vp->v_data);+	uma_zfree(ext2fs_inode_pool, vp->v_data); 	vp->v_data = NULL; 	return (0); }