diff options
author | bde <bde@FreeBSD.org> | 2000-03-03 08:00:27 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2000-03-03 08:00:27 +0000 |
commit | f65ec8e11c58da643a6549059860b51d2435f3b2 (patch) | |
tree | 1c6f8ad31f20a7a424cc57521069a5771e5cbdbc /sys/gnu | |
parent | 891b0548a23b2f2c09ad656227248f5216eedd44 (diff) | |
download | FreeBSD-src-f65ec8e11c58da643a6549059860b51d2435f3b2.zip FreeBSD-src-f65ec8e11c58da643a6549059860b51d2435f3b2.tar.gz |
MFS (ext2_lookup.c 1.17.2.2, ext2_vnops.c 1.42.2.2: fix "filetype" support).
Approved by: jkh
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/ext2fs/ext2_lookup.c | 2 | ||||
-rw-r--r-- | sys/gnu/ext2fs/ext2_vnops.c | 34 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_lookup.c | 2 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 34 |
4 files changed, 48 insertions, 24 deletions
diff --git a/sys/gnu/ext2fs/ext2_lookup.c b/sys/gnu/ext2fs/ext2_lookup.c index 79eb7cd..985dcf3 100644 --- a/sys/gnu/ext2fs/ext2_lookup.c +++ b/sys/gnu/ext2fs/ext2_lookup.c @@ -1039,7 +1039,7 @@ ext2_checkpath(source, target, cred) IO_NODELOCKED, cred, (int *)0, (struct proc *)0); if (error != 0) break; - namlen = ((struct odirtemplate *)&dirbuf)->dotdot_namlen; /* XXX */ + namlen = dirbuf.dotdot_type; /* like ufs little-endian */ if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || dirbuf.dotdot_name[1] != '.') { diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index d7b84ad..0e57f30 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -76,6 +76,7 @@ #include <gnu/ext2fs/ext2_fs_sb.h> #include <gnu/ext2fs/fs.h> #include <gnu/ext2fs/ext2_extern.h> +#include <gnu/ext2fs/ext2_fs.h> static int ext2_makeinode __P((int mode, struct vnode *, struct vnode **, struct componentname *)); @@ -147,6 +148,21 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc = #include <gnu/ext2fs/ext2_readwrite.c> /* + * A virgin directory (no blushing please). + * Note that the type and namlen fields are reversed relative to ufs. + * Also, we don't use `struct odirtemplate', since it would just cause + * endianness problems. + */ +static struct dirtemplate mastertemplate = { + 0, 12, 1, EXT2_FT_DIR, ".", + 0, DIRBLKSIZ - 12, 2, EXT2_FT_DIR, ".." +}; +static struct dirtemplate omastertemplate = { + 0, 12, 1, EXT2_FT_UNKNOWN, ".", + 0, DIRBLKSIZ - 12, 2, EXT2_FT_UNKNOWN, ".." +}; + +/* * Create a regular file */ static int @@ -719,8 +735,8 @@ abortit: UIO_SYSSPACE, IO_NODELOCKED, tcnp->cn_cred, (int *)0, (struct proc *)0); if (error == 0) { - namlen = ((struct odirtemplate *) - &dirbuf)->dotdot_namlen; + /* Like ufs little-endian: */ + namlen = dirbuf.dotdot_type; if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || dirbuf.dotdot_name[1] != '.') { @@ -771,14 +787,6 @@ out: } /* - * A virgin directory (no blushing please). - */ -static struct odirtemplate omastertemplate = { - 0, 12, 1, { '.', 0 }, - 0, DIRBLKSIZ - 12, 2, { '.', '.', 0 } -}; - -/* * Mkdir system call */ static int @@ -897,7 +905,11 @@ ext2_mkdir(ap) goto bad; /* Initialize directory with "." and ".." from static template. */ - dtp = (struct dirtemplate *)&omastertemplate; + if (EXT2_HAS_INCOMPAT_FEATURE(ip->i_e2fs->s_es, + EXT2_FEATURE_INCOMPAT_FILETYPE)) + dtp = &mastertemplate; + else + dtp = &omastertemplate; dirtemplate = *dtp; dirtemplate.dot_ino = ip->i_number; dirtemplate.dotdot_ino = dp->i_number; diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index 79eb7cd..985dcf3 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -1039,7 +1039,7 @@ ext2_checkpath(source, target, cred) IO_NODELOCKED, cred, (int *)0, (struct proc *)0); if (error != 0) break; - namlen = ((struct odirtemplate *)&dirbuf)->dotdot_namlen; /* XXX */ + namlen = dirbuf.dotdot_type; /* like ufs little-endian */ if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || dirbuf.dotdot_name[1] != '.') { diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index d7b84ad..0e57f30 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -76,6 +76,7 @@ #include <gnu/ext2fs/ext2_fs_sb.h> #include <gnu/ext2fs/fs.h> #include <gnu/ext2fs/ext2_extern.h> +#include <gnu/ext2fs/ext2_fs.h> static int ext2_makeinode __P((int mode, struct vnode *, struct vnode **, struct componentname *)); @@ -147,6 +148,21 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc = #include <gnu/ext2fs/ext2_readwrite.c> /* + * A virgin directory (no blushing please). + * Note that the type and namlen fields are reversed relative to ufs. + * Also, we don't use `struct odirtemplate', since it would just cause + * endianness problems. + */ +static struct dirtemplate mastertemplate = { + 0, 12, 1, EXT2_FT_DIR, ".", + 0, DIRBLKSIZ - 12, 2, EXT2_FT_DIR, ".." +}; +static struct dirtemplate omastertemplate = { + 0, 12, 1, EXT2_FT_UNKNOWN, ".", + 0, DIRBLKSIZ - 12, 2, EXT2_FT_UNKNOWN, ".." +}; + +/* * Create a regular file */ static int @@ -719,8 +735,8 @@ abortit: UIO_SYSSPACE, IO_NODELOCKED, tcnp->cn_cred, (int *)0, (struct proc *)0); if (error == 0) { - namlen = ((struct odirtemplate *) - &dirbuf)->dotdot_namlen; + /* Like ufs little-endian: */ + namlen = dirbuf.dotdot_type; if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || dirbuf.dotdot_name[1] != '.') { @@ -771,14 +787,6 @@ out: } /* - * A virgin directory (no blushing please). - */ -static struct odirtemplate omastertemplate = { - 0, 12, 1, { '.', 0 }, - 0, DIRBLKSIZ - 12, 2, { '.', '.', 0 } -}; - -/* * Mkdir system call */ static int @@ -897,7 +905,11 @@ ext2_mkdir(ap) goto bad; /* Initialize directory with "." and ".." from static template. */ - dtp = (struct dirtemplate *)&omastertemplate; + if (EXT2_HAS_INCOMPAT_FEATURE(ip->i_e2fs->s_es, + EXT2_FEATURE_INCOMPAT_FILETYPE)) + dtp = &mastertemplate; + else + dtp = &omastertemplate; dirtemplate = *dtp; dirtemplate.dot_ino = ip->i_number; dirtemplate.dotdot_ino = dp->i_number; |