diff --git a/ChangeLog b/ChangeLog index 77940676e..67513ce9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-08-14 Marco Gerards + + * include/grub/arg.h (GRUB_ARG_OPTION_OPTIONAL): Surround macro + with parentheses. + + * fs/ext2.c (FILETYPE_UNKNOWN): New macro. + (grub_ext2_dir): In case the directory entry type is unknown, read + it from the inode. + 2004-08-02 Peter Bruin * loader/powerpc/ieee1275/linux.c (grub_linux_init): Pass diff --git a/fs/ext2.c b/fs/ext2.c index 7c4cbd03d..ed6e68caf 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -28,6 +28,7 @@ #define EXT2_MAX_SYMLINKCNT 8 /* Filetype used in directory entry. */ +#define FILETYPE_UNKNOWN 0 #define FILETYPE_DIRECTORY 2 #define FILETYPE_SYMLINK 7 @@ -688,7 +689,16 @@ grub_ext2_dir (grub_device_t device, const char *path, filename[dirent.namelen] = '\0'; - hook (filename, dirent.filetype == FILETYPE_DIRECTORY); + if (dirent.filetype != FILETYPE_UNKNOWN) + hook (filename, dirent.filetype == FILETYPE_DIRECTORY); + else + { + struct grub_ext2_inode inode; + grub_ext2_read_inode (data, grub_le_to_cpu32 (dirent.inode), &inode); + + hook (filename, (grub_le_to_cpu16 (inode.mode) + & FILETYPE_INO_MASK) == FILETYPE_INO_DIRECTORY); + } } fpos += grub_le_to_cpu16 (dirent.direntlen); diff --git a/include/grub/arg.h b/include/grub/arg.h index d08177807..4bdad966d 100644 --- a/include/grub/arg.h +++ b/include/grub/arg.h @@ -38,7 +38,7 @@ enum grub_arg_type typedef enum grub_arg_type grub_arg_type_t; /* Flags for the option field op grub_arg_option. */ -#define GRUB_ARG_OPTION_OPTIONAL 1 << 1 +#define GRUB_ARG_OPTION_OPTIONAL (1 << 1) enum grub_key_type {