Changes to existing files for ext2fs support. The UFS mods need rework
in the future as they are a bit crufty -- but at least the stuff is in the tree now.
This commit is contained in:
parent
48adf4aa3d
commit
909789a8fb
@ -347,6 +347,16 @@ ufs/lfs/lfs_vfsops.c optional lfs
|
||||
ufs/lfs/lfs_vnops.c optional lfs
|
||||
ufs/mfs/mfs_vfsops.c optional mfs
|
||||
ufs/mfs/mfs_vnops.c optional mfs
|
||||
gnu/ext2fs/ext2_balloc.c optional ext2fs
|
||||
gnu/ext2fs/ext2_inode.c optional ext2fs
|
||||
gnu/ext2fs/ext2_subr.c optional ext2fs
|
||||
gnu/ext2fs/ext2_vfsops.c optional ext2fs
|
||||
gnu/ext2fs/ext2_vnops.c optional ext2fs
|
||||
gnu/ext2fs/ext2_inode_cnv.c optional ext2fs
|
||||
gnu/ext2fs/ext2_lookup.c optional ext2fs
|
||||
gnu/ext2fs/ext2_linux_ialloc.c optional ext2fs
|
||||
gnu/ext2fs/ext2_linux_balloc.c optional ext2fs
|
||||
gnu/ext2fs/ext2_alloc.c optional ext2fs
|
||||
ufs/ufs/ufs_bmap.c standard
|
||||
ufs/ufs/ufs_disksubr.c standard
|
||||
ufs/ufs/ufs_ihash.c standard
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufsmount.h 8.2 (Berkeley) 1/12/94
|
||||
* $Id: ufsmount.h,v 1.2 1994/08/02 07:55:04 davidg Exp $
|
||||
* $Id: ufsmount.h,v 1.3 1994/08/21 07:16:18 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_UFSMOUNT_H_
|
||||
@ -54,9 +54,12 @@ struct ufsmount {
|
||||
union { /* pointer to superblock */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct fs *fs; /* FFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} ufsmount_u;
|
||||
#define um_fs ufsmount_u.fs
|
||||
#define um_lfs ufsmount_u.lfs
|
||||
#define um_e2fs ufsmount_u.e2fs
|
||||
#define um_e2fsb ufsmount_u.e2fs->s_es
|
||||
struct vnode *um_quotas[MAXQUOTAS]; /* pointer to quota files */
|
||||
struct ucred *um_cred[MAXQUOTAS]; /* quota file access cred */
|
||||
u_long um_nindir; /* indirect ptrs per block */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)inode.h 8.4 (Berkeley) 1/21/94
|
||||
* $Id: inode.h,v 1.5 1995/04/24 05:13:11 dyson Exp $
|
||||
* $Id: inode.h,v 1.6 1995/05/30 08:15:30 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_INODE_H_
|
||||
@ -74,9 +74,11 @@ struct inode {
|
||||
union { /* Associated filesystem. */
|
||||
struct fs *fs; /* FFS */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} inode_u;
|
||||
#define i_fs inode_u.fs
|
||||
#define i_lfs inode_u.lfs
|
||||
#define i_e2fs inode_u.e2fs
|
||||
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
|
||||
u_quad_t i_modrev; /* Revision level for lease. */
|
||||
struct lockf *i_lockf; /* Head of byte-level lock list. */
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufsmount.h 8.2 (Berkeley) 1/12/94
|
||||
* $Id: ufsmount.h,v 1.2 1994/08/02 07:55:04 davidg Exp $
|
||||
* $Id: ufsmount.h,v 1.3 1994/08/21 07:16:18 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_UFSMOUNT_H_
|
||||
@ -54,9 +54,12 @@ struct ufsmount {
|
||||
union { /* pointer to superblock */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct fs *fs; /* FFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} ufsmount_u;
|
||||
#define um_fs ufsmount_u.fs
|
||||
#define um_lfs ufsmount_u.lfs
|
||||
#define um_e2fs ufsmount_u.e2fs
|
||||
#define um_e2fsb ufsmount_u.e2fs->s_es
|
||||
struct vnode *um_quotas[MAXQUOTAS]; /* pointer to quota files */
|
||||
struct ucred *um_cred[MAXQUOTAS]; /* quota file access cred */
|
||||
u_long um_nindir; /* indirect ptrs per block */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)inode.h 8.4 (Berkeley) 1/21/94
|
||||
* $Id: inode.h,v 1.5 1995/04/24 05:13:11 dyson Exp $
|
||||
* $Id: inode.h,v 1.6 1995/05/30 08:15:30 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_INODE_H_
|
||||
@ -74,9 +74,11 @@ struct inode {
|
||||
union { /* Associated filesystem. */
|
||||
struct fs *fs; /* FFS */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} inode_u;
|
||||
#define i_fs inode_u.fs
|
||||
#define i_lfs inode_u.lfs
|
||||
#define i_e2fs inode_u.e2fs
|
||||
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
|
||||
u_quad_t i_modrev; /* Revision level for lease. */
|
||||
struct lockf *i_lockf; /* Head of byte-level lock list. */
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mount.h 8.13 (Berkeley) 3/27/94
|
||||
* $Id: mount.h,v 1.26 1995/08/30 01:34:14 bde Exp $
|
||||
* $Id: mount.h,v 1.27 1995/09/09 18:10:30 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MOUNT_H_
|
||||
@ -98,7 +98,8 @@ struct statfs {
|
||||
#define MOUNT_CD9660 14 /* ISO9660 (aka CDROM) Filesystem */
|
||||
#define MOUNT_UNION 15 /* Union (translucent) Filesystem */
|
||||
#define MOUNT_DEVFS 16 /* existing device Filesystem */
|
||||
#define MOUNT_MAXTYPE 16
|
||||
#define MOUNT_EXT2FS 17 /* Linux EXT2FS */
|
||||
#define MOUNT_MAXTYPE 17
|
||||
|
||||
#define INITMOUNTNAMES { \
|
||||
"none", /* 0 MOUNT_NONE */ \
|
||||
@ -117,8 +118,9 @@ struct statfs {
|
||||
"afs", /* 13 MOUNT_AFS */ \
|
||||
"cd9660", /* 14 MOUNT_CD9660 */ \
|
||||
"union", /* 15 MOUNT_UNION */ \
|
||||
"devfs", /* 15 MOUNT_DEVFS */ \
|
||||
0, /* 16 MOUNT_SPARE */ \
|
||||
"devfs", /* 16 MOUNT_DEVFS */ \
|
||||
"ext2fs", /* 17 MOUNT_EXT2FS */ \
|
||||
0, /* 17 MOUNT_SPARE */ \
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)inode.h 8.4 (Berkeley) 1/21/94
|
||||
* $Id: inode.h,v 1.5 1995/04/24 05:13:11 dyson Exp $
|
||||
* $Id: inode.h,v 1.6 1995/05/30 08:15:30 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_INODE_H_
|
||||
@ -74,9 +74,11 @@ struct inode {
|
||||
union { /* Associated filesystem. */
|
||||
struct fs *fs; /* FFS */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} inode_u;
|
||||
#define i_fs inode_u.fs
|
||||
#define i_lfs inode_u.lfs
|
||||
#define i_e2fs inode_u.e2fs
|
||||
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
|
||||
u_quad_t i_modrev; /* Revision level for lease. */
|
||||
struct lockf *i_lockf; /* Head of byte-level lock list. */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_inode.c 8.4 (Berkeley) 1/21/94
|
||||
* $Id: ufs_inode.c,v 1.5 1994/10/15 04:08:44 ache Exp $
|
||||
* $Id: ufs_inode.c,v 1.6 1995/01/04 23:48:04 gibbs Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -173,6 +173,9 @@ ufs_reclaim(ap)
|
||||
}
|
||||
#endif
|
||||
switch (vp->v_mount->mnt_stat.f_type) {
|
||||
case MOUNT_EXT2FS:
|
||||
type = M_FFSNODE;
|
||||
break;
|
||||
case MOUNT_UFS:
|
||||
type = M_FFSNODE;
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94
|
||||
* $Id: ufs_vnops.c,v 1.30 1995/10/07 10:13:41 bde Exp $
|
||||
* $Id: ufs_vnops.c,v 1.31 1995/10/22 09:32:48 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -70,6 +70,12 @@ static int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
|
||||
static int ufs_chown
|
||||
__P((struct vnode *, uid_t, gid_t, struct ucred *, struct proc *));
|
||||
|
||||
#if EXT2FS
|
||||
#include <gnu/ext2fs/ext2_extern.h>
|
||||
#include <gnu/ext2fs/ext2_fs.h>
|
||||
#include <gnu/ext2fs/ext2_fs_sb.h>
|
||||
#endif /* EXT2FS */
|
||||
|
||||
union _qcvt {
|
||||
quad_t qcvt;
|
||||
long val[2];
|
||||
@ -667,7 +673,16 @@ ufs_remove(ap)
|
||||
error = EPERM;
|
||||
goto out;
|
||||
}
|
||||
if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(dvp)) {
|
||||
error = ext2_dirremove(dvp, ap->a_cnp);
|
||||
} else {
|
||||
error = ufs_dirremove(dvp, ap->a_cnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_dirremove(dvp, ap->a_cnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error == 0) {
|
||||
ip->i_nlink--;
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
}
|
||||
@ -726,8 +741,18 @@ ufs_link(ap)
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
tv = time;
|
||||
error = VOP_UPDATE(vp, &tv, &tv, 1);
|
||||
if (!error)
|
||||
if (!error) {
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(tdvp)) {
|
||||
error = ext2_direnter(ip, tdvp, cnp);
|
||||
} else {
|
||||
error = ufs_direnter(ip, tdvp, cnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_direnter(ip, tdvp, cnp);
|
||||
#endif /* EXT2FS */
|
||||
}
|
||||
|
||||
if (error) {
|
||||
ip->i_nlink--;
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
@ -915,7 +940,15 @@ ufs_rename(ap)
|
||||
goto bad;
|
||||
if (xp != NULL)
|
||||
vput(tvp);
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(tdvp)) {
|
||||
error = ext2_checkpath(ip, dp, tcnp->cn_cred);
|
||||
} else {
|
||||
error = ufs_checkpath(ip, dp, tcnp->cn_cred);
|
||||
}
|
||||
#else
|
||||
error = ufs_checkpath(ip, dp, tcnp->cn_cred);
|
||||
#endif /* EXT2FS */
|
||||
if (error)
|
||||
goto out;
|
||||
if ((tcnp->cn_flags & SAVESTART) == 0)
|
||||
@ -954,7 +987,15 @@ ufs_rename(ap)
|
||||
if (error)
|
||||
goto bad;
|
||||
}
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(tdvp)) {
|
||||
error = ext2_direnter(ip, tdvp, tcnp);
|
||||
} else {
|
||||
error = ufs_direnter(ip, tdvp, tcnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_direnter(ip, tdvp, tcnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error) {
|
||||
if (doingdirectory && newparent) {
|
||||
dp->i_nlink--;
|
||||
@ -990,7 +1031,13 @@ ufs_rename(ap)
|
||||
* (both directories, or both not directories).
|
||||
*/
|
||||
if ((xp->i_mode&IFMT) == IFDIR) {
|
||||
if (!ufs_dirempty(xp, dp->i_number, tcnp->cn_cred) ||
|
||||
#if EXT2FS
|
||||
if (! (IS_EXT2_VNODE(ITOV(xp)) ?
|
||||
ext2_dirempty : ufs_dirempty)
|
||||
#else
|
||||
if (! ufs_dirempty
|
||||
#endif /* EXT2FS */
|
||||
(xp, dp->i_number, tcnp->cn_cred) ||
|
||||
xp->i_nlink > 2) {
|
||||
error = ENOTEMPTY;
|
||||
goto bad;
|
||||
@ -1004,7 +1051,15 @@ ufs_rename(ap)
|
||||
error = EISDIR;
|
||||
goto bad;
|
||||
}
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(ITOV(dp))) {
|
||||
error = ext2_dirrewrite(dp, ip, tcnp);
|
||||
} else {
|
||||
error = ufs_dirrewrite(dp, ip, tcnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_dirrewrite(dp, ip, tcnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error)
|
||||
goto bad;
|
||||
/*
|
||||
@ -1096,6 +1151,11 @@ ufs_rename(ap)
|
||||
# else
|
||||
namlen = dirbuf.dotdot_namlen;
|
||||
# endif
|
||||
#if EXT2FS
|
||||
if(IS_EXT2_VNODE(fvp))
|
||||
namlen = ((struct odirtemplate *)
|
||||
&dirbuf)->dotdot_namlen;
|
||||
#endif /* EXT2FS */
|
||||
if (namlen != 2 ||
|
||||
dirbuf.dotdot_name[0] != '.' ||
|
||||
dirbuf.dotdot_name[1] != '.') {
|
||||
@ -1114,7 +1174,15 @@ ufs_rename(ap)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(fdvp)) {
|
||||
error = ext2_dirremove(fdvp, fcnp);
|
||||
} else {
|
||||
error = ufs_dirremove(fdvp, fcnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_dirremove(fdvp, fcnp);
|
||||
#endif /* EXT2FS */
|
||||
if (!error) {
|
||||
xp->i_nlink--;
|
||||
xp->i_flag |= IN_CHANGE;
|
||||
@ -1228,13 +1296,28 @@ ufs_mkdir(ap)
|
||||
goto bad;
|
||||
|
||||
/* Initialize directory with "." and ".." from static template. */
|
||||
if (dvp->v_mount->mnt_maxsymlinklen > 0)
|
||||
if (dvp->v_mount->mnt_maxsymlinklen > 0
|
||||
#if EXT2FS
|
||||
/* omastertemplate is want we want for EXT2 */
|
||||
&& !IS_EXT2_VNODE(dvp)
|
||||
#endif /* EXT2FS */
|
||||
)
|
||||
dtp = &mastertemplate;
|
||||
else
|
||||
dtp = (struct dirtemplate *)&omastertemplate;
|
||||
dirtemplate = *dtp;
|
||||
dirtemplate.dot_ino = ip->i_number;
|
||||
dirtemplate.dotdot_ino = dp->i_number;
|
||||
#if EXT2FS
|
||||
/* note that in ext2 DIRBLKSIZ == blocksize, not DEV_BSIZE
|
||||
* so let's just redefine it - for this function only
|
||||
*/
|
||||
#undef DIRBLKSIZ
|
||||
#define DIRBLKSIZ (IS_EXT2_VNODE(dvp) ? \
|
||||
VTOI(dvp)->i_e2fs->s_blocksize : DEV_BSIZE)
|
||||
if(IS_EXT2_VNODE(dvp))
|
||||
dirtemplate.dotdot_reclen = DIRBLKSIZ - 12;
|
||||
#endif /* EXT2FS */
|
||||
error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate,
|
||||
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
|
||||
IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
|
||||
@ -1251,7 +1334,15 @@ ufs_mkdir(ap)
|
||||
}
|
||||
|
||||
/* Directory set up, now install it's entry in the parent directory. */
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(dvp)) {
|
||||
error = ext2_direnter(ip, dvp, cnp);
|
||||
} else {
|
||||
error = ufs_direnter(ip, dvp, cnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_direnter(ip, dvp, cnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error) {
|
||||
dp->i_nlink--;
|
||||
dp->i_flag |= IN_CHANGE;
|
||||
@ -1271,6 +1362,10 @@ ufs_mkdir(ap)
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
vput(dvp);
|
||||
return (error);
|
||||
#if EXT2FS
|
||||
#undef DIRBLKSIZ
|
||||
#define DIRBLKSIZ DEV_BSIZE
|
||||
#endif /* EXT2FS */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1309,7 +1404,12 @@ ufs_rmdir(ap)
|
||||
*/
|
||||
error = 0;
|
||||
if (ip->i_nlink != 2 ||
|
||||
#if EXT2FS
|
||||
!(IS_EXT2_VNODE(ITOV(ip)) ? ext2_dirempty : ufs_dirempty)
|
||||
(ip, dp->i_number, cnp->cn_cred)) {
|
||||
#else
|
||||
!ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
|
||||
#endif /* EXT2FS */
|
||||
error = ENOTEMPTY;
|
||||
goto out;
|
||||
}
|
||||
@ -1322,7 +1422,15 @@ ufs_rmdir(ap)
|
||||
* inode. If we crash in between, the directory
|
||||
* will be reattached to lost+found,
|
||||
*/
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(dvp)) {
|
||||
error = ext2_dirremove(dvp, cnp);
|
||||
} else {
|
||||
error = ufs_dirremove(dvp, cnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_dirremove(dvp, cnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error)
|
||||
goto out;
|
||||
dp->i_nlink--;
|
||||
@ -2014,7 +2122,15 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
error = VOP_UPDATE(tvp, &tv, &tv, 1);
|
||||
if (error)
|
||||
goto bad;
|
||||
#if EXT2FS
|
||||
if (IS_EXT2_VNODE(dvp)) {
|
||||
error = ext2_direnter(ip, dvp, cnp);
|
||||
} else {
|
||||
error = ufs_direnter(ip, dvp, cnp);
|
||||
}
|
||||
#else
|
||||
error = ufs_direnter(ip, dvp, cnp);
|
||||
#endif /* EXT2FS */
|
||||
if (error)
|
||||
goto bad;
|
||||
if ((cnp->cn_flags & SAVESTART) == 0)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufsmount.h 8.2 (Berkeley) 1/12/94
|
||||
* $Id: ufsmount.h,v 1.2 1994/08/02 07:55:04 davidg Exp $
|
||||
* $Id: ufsmount.h,v 1.3 1994/08/21 07:16:18 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_UFS_UFSMOUNT_H_
|
||||
@ -54,9 +54,12 @@ struct ufsmount {
|
||||
union { /* pointer to superblock */
|
||||
struct lfs *lfs; /* LFS */
|
||||
struct fs *fs; /* FFS */
|
||||
struct ext2_sb_info *e2fs; /* EXT2FS */
|
||||
} ufsmount_u;
|
||||
#define um_fs ufsmount_u.fs
|
||||
#define um_lfs ufsmount_u.lfs
|
||||
#define um_e2fs ufsmount_u.e2fs
|
||||
#define um_e2fsb ufsmount_u.e2fs->s_es
|
||||
struct vnode *um_quotas[MAXQUOTAS]; /* pointer to quota files */
|
||||
struct ucred *um_cred[MAXQUOTAS]; /* quota file access cred */
|
||||
u_long um_nindir; /* indirect ptrs per block */
|
||||
|
Loading…
Reference in New Issue
Block a user