mkdir.c (ext2fs_mkdir): Pass EXT2_FT_DIR flag to ext2fs_link().
link.c (ext2fs_link): This call now uses the low three bits of the
flags parameter to pass the directory filetype information; it will
set the directory entry FILETYPE information if the filesystem
supports it.
newdir.c (ext2fs_new_dir_block): If the FILETYPE superblock option is
set, then create the '.' and '..' entries with the filetype set to
EXT2_FT_DIR.
+1999-10-22 <tytso@valinux.com>
+
+ * mkdir.c (ext2fs_mkdir): Pass EXT2_FT_DIR flag to ext2fs_link().
+
+ * link.c (ext2fs_link): This call now uses the low three bits of
+ the flags parameter to pass the directory filetype
+ information; it will set the directory entry FILETYPE
+ information if the filesystem supports it.
+
+ * newdir.c (ext2fs_new_dir_block): If the FILETYPE superblock
+ option is set, then create the '.' and '..' entries with
+ the filetype set to EXT2_FT_DIR.
+
1999-09-24 <tytso@valinux.com>
* nt_io.c: New file which supports I/O under Windows NT.
ino_t inode;
int flags;
int done;
+ struct ext2fs_sb *sb;
};
static int link_proc(struct ext2_dir_entry *dirent,
dirent->inode = ls->inode;
dirent->name_len = ls->namelen;
strncpy(dirent->name, ls->name, ls->namelen);
+ if (ls->sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)
+ dirent->name_len |= (ls->flags & 0x7) << 8;
ls->done++;
return DIRENT_ABORT|DIRENT_CHANGED;
}
+/*
+ * Note: the low 3 bits of the flags field are used as the directory
+ * entry filetype.
+ */
#ifdef __TURBOC__
#pragma argsused
#endif
ls.name = name;
ls.namelen = name ? strlen(name) : 0;
ls.inode = ino;
- ls.flags = 0;
+ ls.flags = flags;
ls.done = 0;
+ ls.sb = (struct ext2fs_sb *) fs->super;
retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY,
0, link_proc, &ls);
#include "ext2fs.h"
+#ifndef EXT2_FT_DIR
+#define EXT2_FT_DIR 2
+#endif
+
errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
const char *name)
{
}
if (retval != EXT2_ET_FILE_NOT_FOUND)
goto cleanup;
- retval = ext2fs_link(fs, parent, name, ino, 0);
+ retval = ext2fs_link(fs, parent, name, ino, EXT2_FT_DIR);
if (retval)
goto cleanup;
}
#include "ext2fs.h"
+#ifndef EXT2_FT_DIR
+#define EXT2_FT_DIR 2
+#endif
+
/*
* Create new directory block
*/
errcode_t retval;
char *buf;
int rec_len;
+ int filetype = 0;
+ struct ext2fs_sb *sb;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
dir->rec_len = fs->blocksize;
if (dir_ino) {
+ sb = (struct ext2fs_sb *) fs->super;
+ if (sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)
+ filetype = EXT2_FT_DIR << 8;
/*
* Set up entry for '.'
*/
dir->inode = dir_ino;
- dir->name_len = 1;
+ dir->name_len = 1 | filetype;
dir->name[0] = '.';
- rec_len = dir->rec_len - EXT2_DIR_REC_LEN(dir->name_len);
- dir->rec_len = EXT2_DIR_REC_LEN(dir->name_len);
+ rec_len = dir->rec_len - EXT2_DIR_REC_LEN(1);
+ dir->rec_len = EXT2_DIR_REC_LEN(1);
/*
* Set up entry for '..'
dir = (struct ext2_dir_entry *) (buf + dir->rec_len);
dir->rec_len = rec_len;
dir->inode = parent_ino;
- dir->name_len = 2;
+ dir->name_len = 2 | filetype;
dir->name[0] = '.';
dir->name[1] = '.';