aboutsummaryrefslogtreecommitdiff
path: root/sys/gnu/fs/ext2fs/ext2_vnops.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2000-03-03 08:00:27 +0000
committerBruce Evans <bde@FreeBSD.org>2000-03-03 08:00:27 +0000
commitfc47f29c64601554da697a295151ba21d2d0f8aa (patch)
tree0bfd2394bdc4d0c53a146b174add4cab248a7816 /sys/gnu/fs/ext2fs/ext2_vnops.c
parent1765c30eb8f9ed07dbeae53c9c091b5d51588e71 (diff)
downloadsrc-fc47f29c64601554da697a295151ba21d2d0f8aa.tar.gz
src-fc47f29c64601554da697a295151ba21d2d0f8aa.zip
MFS (ext2_lookup.c 1.17.2.2, ext2_vnops.c 1.42.2.2: fix "filetype" support).
Approved by: jkh
Notes
Notes: svn path=/head/; revision=57710
Diffstat (limited to 'sys/gnu/fs/ext2fs/ext2_vnops.c')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index d7b84adf75c9..0e57f30af44c 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;