FAT, UFS and mtime
Subsystems (2)
PATCH 1/1 FAT, UFS and mtime
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
i386-coreboot.rmk +3 -1
@@ -75,6 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/completion.c normal/main.c normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \
@@ -121,7 +123,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
i386-efi.rmk +3 -2
@@ -52,7 +52,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -119,10 +125,10 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \ normal/menu_viewer.c normal/menu_entry.c \ normal/misc.c grub_script.tab.c \ normal/script.c \
normal/i386/setjmp.S
normal_mod_CFLAGS = $(COMMON_CFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
@@ -177,7 +183,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
-datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-ieee1275.rmk +2 -1
@@ -74,4 +74,5 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/menu_text.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/misc.c normal/script.c \
normal/color.c \
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
@@ -111,7 +113,7 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod su
# keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \ @@ -191,7 +195,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
-datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-pc.rmk +4 -3
@@ -128,7 +128,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/color.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/color.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -209,7 +248,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -351,7 +394,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS) pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
powerpc-ieee1275.rmk +2 -2
@@ -56,7 +56,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/misc.c kern/parser.c kern/partition.c kern/rescue.c \ kern/term.c fs/fshelp.c \ normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/menu_entry.c normal/menu_viewer.c normal/misc.c \
@@ -132,7 +132,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
sparc64-ieee1275.rmk +3 -2
@@ -56,7 +56,8 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub- # kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \ # kern/parser.c kern/partition.c kern/rescue.c kern/term.c \ # normal/arg.c normal/cmdline.c normal/command.c \ -# normal/completion.c normal/context.c normal/execute.c \ +# normal/completion.c normal/datetime.c normal/context.c \ +# normal/execute.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c \ # normal/menu_text.c \
@@ -165,7 +166,7 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
x86_64-efi.rmk +4 -3
@@ -54,7 +54,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -121,7 +122,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -179,7 +180,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
fs.c +3 -2
@@ -65,10 +65,11 @@ grub_fs_t grub_fs_probe (grub_device_t device) {grub_fs_t p; - autoint dummy_func (const char *filename,int dir); + autoint dummy_func (const char *filename, +const struct grub_dirhook_info *info);int dummy_func (const char *filename __attribute__ ((unused)), -int dir __attribute__ ((unused))) +const struct grub_dirhook_info *info __attribute__ ((unused))) {return 1 ; }
rescue.c +3 -2
@@ -176,9 +176,10 @@ grub_rescue_print_devices (const char *name) }static int -grub_rescue_print_files (const char *filename,int dir) +grub_rescue_print_files (const char *filename, +const struct grub_dirhook_info *info) { -grub_printf ("%s%s " , filename, dir ?"/" :"" ); +grub_printf ("%s%s " , filename, info->dir ?"/" :"" );return 0 ; }
datehook.c +1 -1
@@ -22,7 +22,7 @@#include <grub/env.h> #include <grub/misc.h> #include <grub/normal.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> static char *grub_datetime_names[] = {
efi/datetime.c +1 -1
@@ -21,7 +21,7 @@#include <grub/symbol.h> #include <grub/efi/api.h> #include <grub/efi/efi.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> grub_err_t grub_get_datetime (struct grub_datetime *datetime)
datetime.c +0 -49
49 lines not on this page · raw message
xfs.c +6 -8
@@ -620,7 +620,8 @@ grub_xfs_mount (grub_disk_t disk)static grub_err_t grub_xfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_xfs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -633,14 +634,11 @@ grub_xfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
afs.c +6 -8
@@ -562,7 +562,8 @@ grub_afs_close (grub_file_t file)static grub_err_t grub_afs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_afs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -575,14 +576,11 @@ grub_afs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ntfs.c +7 -9
@@ -864,7 +864,8 @@ fail:static grub_err_t grub_ntfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_ntfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -877,14 +878,11 @@ grub_ntfs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
fat.c +128 -121
324 lines not on this page · raw message
udf.c +7 -9
@@ -768,7 +768,8 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_udf_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_udf_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -782,14 +783,11 @@ grub_udf_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
iso9660.c +6 -8
@@ -666,7 +666,8 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_iso9660_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_iso9660_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -680,14 +681,11 @@ grub_iso9660_dir (grub_device_t device, const char enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
affs.c +6 -8
@@ -456,7 +456,8 @@ grub_affs_read (grub_file_t file, char *buf, grub_static grub_err_t grub_affs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_affs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -469,14 +470,11 @@ grub_affs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
hfs.c +10 -5
@@ -721,7 +721,8 @@ grub_hfs_find_dir (struct grub_hfs_data *data, constatic grub_err_t grub_hfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {int inode;
@@ -732,13 +733,17 @@ grub_hfs_dir (grub_device_t device, const char *pachar fname[32 ] = {0 };char *filetype = rec->data;struct grub_hfs_catalog_key *ckey = rec->key; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));grub_strncpy (fname, (char *) (ckey->str), ckey->strlen); -if (*filetype ==GRUB_HFS_FILETYPE_DIR ) -return hook (fname,1 ); -else if (*filetype ==GRUB_HFS_FILETYPE_FILE ) -return hook (fname,0 ); +if (*filetype ==GRUB_HFS_FILETYPE_DIR + || *filetype ==GRUB_HFS_FILETYPE_FILE ) + { + info.dir = (*filetype ==GRUB_HFS_FILETYPE_DIR ); +return hook (fname, &info); + }return 0 ; }
reiserfs.c +6 -6
@@ -1266,7 +1266,8 @@ grub_reiserfs_close (grub_file_t file)/* Call HOOK with each file under DIR. */ static grub_err_t grub_reiserfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_reiserfs_data *data =0 ;struct grub_fshelp_node root, *found;
@@ -1280,12 +1281,11 @@ grub_reiserfs_dir (grub_device_t device, const cha enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); +return hook (filename, &info); }#ifndef GRUB_UTIL grub_dl_ref (my_mod);
jfs.c +7 -5
@@ -728,7 +728,8 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *datstatic grub_err_t grub_jfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_jfs_data *data =0 ;struct grub_jfs_diropen *diro =0 ;
@@ -752,14 +753,15 @@ grub_jfs_dir (grub_device_t device, const char *pawhile (grub_jfs_getent (diro) !=GRUB_ERR_OUT_OF_RANGE ) {struct grub_jfs_inode inode; -int isdir; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));if (grub_jfs_read_inode (data, diro->ino, &inode)) goto fail; - isdir = (grub_le_to_cpu32 (inode.mode) - &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; -if (hook (diro->name, isdir)) + info.dir = (grub_le_to_cpu32 (inode.mode) + &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; +if (hook (diro->name, &info)) goto fail; }
ext2.c +48 -8
81 lines not on this page · raw message
hfsplus.c +48 -12
111 lines not on this page · raw message
minix.c +8 -3
@@ -461,7 +461,8 @@ grub_minix_mount (grub_disk_t disk)static grub_err_t grub_minix_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_minix_data *data =0 ;struct grub_minix_sblock *sblock;
@@ -492,6 +493,9 @@ grub_minix_dir (grub_device_t device, const char *grub_uint16_t ino;char filename[data->filename_size +1 ];int dirino = data->ino; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); +if (grub_minix_read_file (data,0 , pos,sizeof (ino), (char *) &ino) <0 )
@@ -506,8 +510,9 @@ grub_minix_dir (grub_device_t device, const char */* The filetype is not stored in the dirent. Read the inode to find out the filetype. This *REALLY* sucks. */ grub_minix_read_inode (data,grub_le_to_cpu16 (ino)); -if (hook (filename, ((GRUB_MINIX_INODE_MODE (data) - &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR )) ?1 :0 ) + info.dir = ((GRUB_MINIX_INODE_MODE (data) + &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR ); +if (hook (filename, &info) ?1 :0 )break ;/* Load the old inode back in. */
cpio.c +7 -2
@@ -183,7 +183,8 @@ fail:static grub_err_t grub_cpio_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_cpio_data *data;grub_uint32_t ofs;
@@ -227,7 +228,11 @@ grub_cpio_dir (grub_device_t device, const char *pif ((!prev) || (grub_strcmp (prev, name) !=0 )) { -hook (name + len, p !=NULL ); +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = (p !=NULL ); + +hook (name + len, &info);if (prev)grub_free (prev); prev = name;
sfs.c +6 -8
@@ -519,7 +519,8 @@ grub_sfs_read (grub_file_t file, char *buf, grub_sstatic grub_err_t grub_sfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_sfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -532,14 +533,11 @@ grub_sfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ufs.c +128 -44
359 lines not on this page · raw message
grub/fs.h +13 -1
@@ -27,6 +27,14 @@/* Forward declaration is required, because of mutual reference. */ struct grub_file ; +struct grub_dirhook_info +{ +int dir:1 ; +int mtimeset:1 ; +int case_insensitive:1 ; +grub_int32_t mtime; +}; +/* Filesystem descriptor. */ struct grub_fs {
@@ -35,7 +43,8 @@ struct grub_fs/* Call HOOK with each file under DIR. */ grub_err_t (*dir) (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)); +int (*hook) (const char *filename, +const struct grub_dirhook_info *info));/* Open a file named NAME and initialize FILE. */ grub_err_t (*open) (struct grub_file *file,const char *name);
@@ -56,6 +65,9 @@ struct grub_fscaller. */ grub_err_t (*uuid) (grub_device_t device,char **uuid); +/* Get writing time of filesystem. */ +grub_err_t (*mtime) (grub_device_t device,grub_int32_t *timebuf); +/* The next filesystem. */ struct grub_fs *next; };
grub/fshelp.h +2 -0
@@ -27,6 +27,8 @@typedef struct grub_fshelp_node *grub_fshelp_node_t ;#define GRUB_FSHELP_CASE_INSENSITIVE 0x100 +#define GRUB_FSHELP_TYPE_MASK 0xff +#define GRUB_FSHELP_FLAGS_MASK 0x100enum grub_fshelp_filetype {
completion.c +2 -2
@@ -123,9 +123,9 @@ iterate_partition (grub_disk_t disk, const grub_pa }static int -iterate_dir (const char *filename,int dir) +iterate_dir (const char *filename,const struct grub_dirhook_info *info) { -if (! dir) +if (! info->dir) {const char *prefix;if (cmdline_state ==GRUB_PARSER_STATE_DQUOTE )
datetime.c +52 -1
62 lines not on this page · raw message
Property changes on: normal/datetime.c
___________________________________________________________________
Added: svn:mergeinfo
date.c +1 -1
@@ -22,7 +22,7 @@#include <grub/arg.h> #include <grub/err.h> #include <grub/misc.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> #define GRUB_DATETIME_SET_YEAR 1#define GRUB_DATETIME_SET_MONTH 2
ls.c +32 -10
87 lines not on this page · raw message
hostfs.c +9 -4
@@ -16,7 +16,7 @@* You should have received a copy of the GNU General Public License * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ - +#define _BSD_SOURCE#include <grub/fs.h> #include <grub/file.h> #include <grub/disk.h>
@@ -57,7 +57,8 @@ is_dir (const char *path, const char *name)static grub_err_t grub_hostfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {DIR *dir;
@@ -73,16 +74,20 @@ grub_hostfs_dir (grub_device_t device, const charwhile (1 ) {struct dirent *de; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); de =readdir (dir);if (! de)break ;#ifdef DT_DIR -hook (de->d_name, de->d_type ==DT_DIR ); + info.dir = (de->d_type ==DT_DIR );#else -hook (de->d_name,is_dir (path, de->d_name)); + info.dir = !!is_dir (path, de->d_name);#endif +hook (de->d_name, &info); + }closedir (dir);
ChangeLog +74 -0
77 lines not on this page · raw message
Quoted 7 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Hi,
Please don't merge patch, it makes it harder to track down bugs later.
Also, perhaps you should keep datetime.c as it is. I'm planning to split the normal mode into separate components, it'd be nice if you don't add files to the normal directory.
Signature · 1 line
Bean
Quoted 9 lines · Bean
Quoted 7 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Quoted 4 lines
Hi,
Please don't merge patch, it makes it harder to track down bugs later.
Actually these patches aren't merged. The problem is that my copyright assignment hasn't been signed by FSF yet so uncommited patches accumulate in my grub2 tree
Quoted 5 lines
Also, perhaps you should keep
datetime.cas it is. I'm planning to split the normal mode into separate components, it'd be nice if you don't add files to the normal directory.
Feel free to put datetime.c wherever you want
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Quoted 15 lines · phcoder
Quoted 14 lines · Bean
Quoted 11 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed
as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also
with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch
with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Quoted 7 lines
Quoted 4 lines
Hi,
Please don't merge patch, it makes it harder to track down bugs later.
Actually these patches aren't merged. The problem is that my copyright assignment hasn't been signed by FSF yet so uncommited patches accumulate in my grub2 tree
Hi,
I suggest that you try some VCS that supports local commits, such as bzr or git. This make it easier to manage your patches before it's committed to upstream.
Signature · 1 line
Bean
Quoting Bean <[email protected]>:
Quoted 3 lines
I suggest that you try some VCS that supports local commits, such as bzr or git. This make it easier to manage your patches before it's committed to upstream.
I'm maintaining a git mirror. The details are here:
http://repo.or.cz/w/grub2.git
The synchronization stopped a few days ago because an entry needed to be made for a new committer, but now the git mirror is up-to-date again.
I suggest using stgit with the repository. It's a wrapper around git made specifically for working with patches.
Signature · 2 lines
Regards, Pavel Roskin
Rediffed. Is the splitting in 3 patches actually necessary? If yes in which order do you want them to be applied?
Quoted 3 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
i386-pc.rmk +4 -3
@@ -128,7 +128,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/color.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/color.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -209,7 +210,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -351,7 +352,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS) pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-efi.rmk +4 -3
@@ -52,7 +52,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -119,7 +120,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -177,7 +178,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
x86_64-efi.rmk +4 -3
@@ -54,7 +54,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -121,7 +122,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -179,7 +180,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-coreboot.rmk +3 -1
@@ -75,6 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/completion.c normal/main.c normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \
@@ -121,7 +123,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
powerpc-ieee1275.rmk +2 -2
@@ -56,7 +56,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/misc.c kern/parser.c kern/partition.c kern/rescue.c \ kern/term.c kern/list.c kern/handler.c fs/fshelp.c \ normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/menu_entry.c normal/menu_viewer.c normal/misc.c \
@@ -133,7 +133,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
sparc64-ieee1275.rmk +3 -2
@@ -57,7 +57,8 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub- # kern/parser.c kern/partition.c kern/rescue.c kern/term.c \ # kern/list.c kern/handler.c \ # normal/arg.c normal/cmdline.c normal/command.c \ -# normal/completion.c normal/context.c normal/execute.c \ +# normal/completion.c normal/datetime.c normal/context.c \ +# normal/execute.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c \ # normal/menu_text.c \
@@ -166,7 +167,7 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
i386-ieee1275.rmk +4 -3
@@ -75,7 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/menu_text.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \ normal/color.c \
@@ -112,7 +113,7 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod su # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -192,7 +193,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
fs.c +3 -2
@@ -65,10 +65,11 @@ grub_fs_t grub_fs_probe (grub_device_t device) {grub_fs_t p; - autoint dummy_func (const char *filename,int dir); + autoint dummy_func (const char *filename, +const struct grub_dirhook_info *info);int dummy_func (const char *filename __attribute__ ((unused)), -int dir __attribute__ ((unused))) +const struct grub_dirhook_info *info __attribute__ ((unused))) {return 1 ; }
rescue.c +3 -2
@@ -176,9 +176,10 @@ grub_rescue_print_devices (const char *name) }static int -grub_rescue_print_files (const char *filename,int dir) +grub_rescue_print_files (const char *filename, +const struct grub_dirhook_info *info) { -grub_printf ("%s%s " , filename, dir ?"/" :"" ); +grub_printf ("%s%s " , filename, info->dir ?"/" :"" );return 0 ; }
datehook.c +1 -1
@@ -22,7 +22,7 @@#include <grub/env.h> #include <grub/misc.h> #include <grub/normal.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> static char *grub_datetime_names[] = {
efi/datetime.c +1 -1
@@ -21,7 +21,7 @@#include <grub/symbol.h> #include <grub/efi/api.h> #include <grub/efi/efi.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> grub_err_t grub_get_datetime (struct grub_datetime *datetime)
datetime.c +0 -49
49 lines not on this page · raw message
xfs.c +6 -8
@@ -620,7 +620,8 @@ grub_xfs_mount (grub_disk_t disk)static grub_err_t grub_xfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_xfs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -633,14 +634,11 @@ grub_xfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
afs.c +6 -8
@@ -562,7 +562,8 @@ grub_afs_close (grub_file_t file)static grub_err_t grub_afs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_afs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -575,14 +576,11 @@ grub_afs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ntfs.c +7 -9
@@ -864,7 +864,8 @@ fail:static grub_err_t grub_ntfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_ntfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -877,14 +878,11 @@ grub_ntfs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
fat.c +128 -121
324 lines not on this page · raw message
udf.c +7 -9
@@ -768,7 +768,8 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_udf_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_udf_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -782,14 +783,11 @@ grub_udf_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
iso9660.c +6 -8
@@ -666,7 +666,8 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_iso9660_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_iso9660_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -680,14 +681,11 @@ grub_iso9660_dir (grub_device_t device, const char enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
affs.c +6 -8
@@ -456,7 +456,8 @@ grub_affs_read (grub_file_t file, char *buf, grub_static grub_err_t grub_affs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_affs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -469,14 +470,11 @@ grub_affs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
hfs.c +10 -5
@@ -721,7 +721,8 @@ grub_hfs_find_dir (struct grub_hfs_data *data, constatic grub_err_t grub_hfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {int inode;
@@ -732,13 +733,17 @@ grub_hfs_dir (grub_device_t device, const char *pachar fname[32 ] = {0 };char *filetype = rec->data;struct grub_hfs_catalog_key *ckey = rec->key; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));grub_strncpy (fname, (char *) (ckey->str), ckey->strlen); -if (*filetype ==GRUB_HFS_FILETYPE_DIR ) -return hook (fname,1 ); -else if (*filetype ==GRUB_HFS_FILETYPE_FILE ) -return hook (fname,0 ); +if (*filetype ==GRUB_HFS_FILETYPE_DIR + || *filetype ==GRUB_HFS_FILETYPE_FILE ) + { + info.dir = (*filetype ==GRUB_HFS_FILETYPE_DIR ); +return hook (fname, &info); + }return 0 ; }
reiserfs.c +6 -6
@@ -1266,7 +1266,8 @@ grub_reiserfs_close (grub_file_t file)/* Call HOOK with each file under DIR. */ static grub_err_t grub_reiserfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_reiserfs_data *data =0 ;struct grub_fshelp_node root, *found;
@@ -1280,12 +1281,11 @@ grub_reiserfs_dir (grub_device_t device, const cha enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); +return hook (filename, &info); }#ifndef GRUB_UTIL grub_dl_ref (my_mod);
jfs.c +7 -5
@@ -728,7 +728,8 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *datstatic grub_err_t grub_jfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_jfs_data *data =0 ;struct grub_jfs_diropen *diro =0 ;
@@ -752,14 +753,15 @@ grub_jfs_dir (grub_device_t device, const char *pawhile (grub_jfs_getent (diro) !=GRUB_ERR_OUT_OF_RANGE ) {struct grub_jfs_inode inode; -int isdir; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));if (grub_jfs_read_inode (data, diro->ino, &inode)) goto fail; - isdir = (grub_le_to_cpu32 (inode.mode) - &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; -if (hook (diro->name, isdir)) + info.dir = (grub_le_to_cpu32 (inode.mode) + &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; +if (hook (diro->name, &info)) goto fail; }
ext2.c +48 -8
81 lines not on this page · raw message
minix.c +8 -3
@@ -461,7 +461,8 @@ grub_minix_mount (grub_disk_t disk)static grub_err_t grub_minix_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_minix_data *data =0 ;struct grub_minix_sblock *sblock;
@@ -492,6 +493,9 @@ grub_minix_dir (grub_device_t device, const char *grub_uint16_t ino;char filename[data->filename_size +1 ];int dirino = data->ino; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); +if (grub_minix_read_file (data,0 , pos,sizeof (ino), (char *) &ino) <0 )
@@ -506,8 +510,9 @@ grub_minix_dir (grub_device_t device, const char */* The filetype is not stored in the dirent. Read the inode to find out the filetype. This *REALLY* sucks. */ grub_minix_read_inode (data,grub_le_to_cpu16 (ino)); -if (hook (filename, ((GRUB_MINIX_INODE_MODE (data) - &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR )) ?1 :0 ) + info.dir = ((GRUB_MINIX_INODE_MODE (data) + &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR ); +if (hook (filename, &info) ?1 :0 )break ;/* Load the old inode back in. */
hfsplus.c +48 -12
111 lines not on this page · raw message
cpio.c +7 -2
@@ -183,7 +183,8 @@ fail:static grub_err_t grub_cpio_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_cpio_data *data;grub_uint32_t ofs;
@@ -227,7 +228,11 @@ grub_cpio_dir (grub_device_t device, const char *pif ((!prev) || (grub_strcmp (prev, name) !=0 )) { -hook (name + len, p !=NULL ); +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = (p !=NULL ); + +hook (name + len, &info);if (prev)grub_free (prev); prev = name;
sfs.c +6 -8
@@ -519,7 +519,8 @@ grub_sfs_read (grub_file_t file, char *buf, grub_sstatic grub_err_t grub_sfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_sfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -532,14 +533,11 @@ grub_sfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ufs.c +128 -44
359 lines not on this page · raw message
grub/fs.h +13 -1
@@ -27,6 +27,14 @@/* Forward declaration is required, because of mutual reference. */ struct grub_file ; +struct grub_dirhook_info +{ +int dir:1 ; +int mtimeset:1 ; +int case_insensitive:1 ; +grub_int32_t mtime; +}; +/* Filesystem descriptor. */ struct grub_fs {
@@ -35,7 +43,8 @@ struct grub_fs/* Call HOOK with each file under DIR. */ grub_err_t (*dir) (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)); +int (*hook) (const char *filename, +const struct grub_dirhook_info *info));/* Open a file named NAME and initialize FILE. */ grub_err_t (*open) (struct grub_file *file,const char *name);
@@ -56,6 +65,9 @@ struct grub_fscaller. */ grub_err_t (*uuid) (grub_device_t device,char **uuid); +/* Get writing time of filesystem. */ +grub_err_t (*mtime) (grub_device_t device,grub_int32_t *timebuf); +/* The next filesystem. */ struct grub_fs *next; };
grub/fshelp.h +2 -0
@@ -27,6 +27,8 @@typedef struct grub_fshelp_node *grub_fshelp_node_t ;#define GRUB_FSHELP_CASE_INSENSITIVE 0x100 +#define GRUB_FSHELP_TYPE_MASK 0xff +#define GRUB_FSHELP_FLAGS_MASK 0x100enum grub_fshelp_filetype {
ChangeLog +74 -0
77 lines not on this page · raw message
completion.c +2 -2
@@ -123,9 +123,9 @@ iterate_partition (grub_disk_t disk, const grub_pa }static int -iterate_dir (const char *filename,int dir) +iterate_dir (const char *filename,const struct grub_dirhook_info *info) { -if (! dir) +if (! info->dir) {const char *prefix;if (cmdline_state ==GRUB_PARSER_STATE_DQUOTE )
misc.c +18 -0
@@ -23,6 +23,7 @@#include <grub/err.h> #include <grub/misc.h> #include <grub/mm.h> +#include <grub/datetime.h> /* Print the information on the device NAME. */ grub_err_t
@@ -63,6 +64,23 @@ grub_normal_print_device_info (const char *name) } grub_errno =GRUB_ERR_NONE ; } +if (fs->mtime) + { +grub_int32_t tm; +struct grub_datetime datetime; + (fs->mtime) (dev, &tm); +if (grub_errno ==GRUB_ERR_NONE ) + { +grub_unixtime2datetime (tm, &datetime); +grub_printf (", Last modification time %d-%02d-%02d " +"%02d:%02d:%02d %s" , + datetime.year, datetime.month, datetime.day, + datetime.hour, datetime.minute, datetime.second, +grub_get_weekday_name (&datetime)); + + } + grub_errno =GRUB_ERR_NONE ; + }if (fs->uuid) {char *uuid;
date.c +1 -1
@@ -22,7 +22,7 @@#include <grub/arg.h> #include <grub/err.h> #include <grub/misc.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> #define GRUB_DATETIME_SET_YEAR 1#define GRUB_DATETIME_SET_MONTH 2
ls.c +32 -10
87 lines not on this page · raw message
hostfs.c +9 -4
@@ -16,7 +16,7 @@* You should have received a copy of the GNU General Public License * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ - +#define _BSD_SOURCE#include <grub/fs.h> #include <grub/file.h> #include <grub/disk.h>
@@ -57,7 +57,8 @@ is_dir (const char *path, const char *name)static grub_err_t grub_hostfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {DIR *dir;
@@ -73,16 +74,20 @@ grub_hostfs_dir (grub_device_t device, const charwhile (1 ) {struct dirent *de; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); de =readdir (dir);if (! de)break ;#ifdef DT_DIR -hook (de->d_name, de->d_type ==DT_DIR ); + info.dir = (de->d_type ==DT_DIR );#else -hook (de->d_name,is_dir (path, de->d_name)); + info.dir = !!is_dir (path, de->d_name);#endif +hook (de->d_name, &info); + }closedir (dir);
normal/datetime.c was missing
Quoted 7 lines · phcoder
Rediffed. Is the splitting in 3 patches actually necessary? If yes in which order do you want them to be applied?
Quoted 3 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
i386-pc.rmk +4 -3
@@ -128,7 +128,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/color.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/color.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -209,7 +210,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -351,7 +352,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS) pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-efi.rmk +4 -3
@@ -52,7 +52,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -119,7 +120,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -177,7 +178,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
x86_64-efi.rmk +4 -3
@@ -54,7 +54,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -121,7 +122,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kerne # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -179,7 +180,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-coreboot.rmk +3 -1
@@ -75,6 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/completion.c normal/main.c normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \
@@ -121,7 +123,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
powerpc-ieee1275.rmk +2 -2
@@ -56,7 +56,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/misc.c kern/parser.c kern/partition.c kern/rescue.c \ kern/term.c kern/list.c kern/handler.c fs/fshelp.c \ normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/menu_entry.c normal/menu_viewer.c normal/misc.c \
@@ -133,7 +133,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
sparc64-ieee1275.rmk +3 -2
@@ -57,7 +57,8 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub- # kern/parser.c kern/partition.c kern/rescue.c kern/term.c \ # kern/list.c kern/handler.c \ # normal/arg.c normal/cmdline.c normal/command.c \ -# normal/completion.c normal/context.c normal/execute.c \ +# normal/completion.c normal/datetime.c normal/context.c \ +# normal/execute.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c \ # normal/menu_text.c \
@@ -166,7 +167,7 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
i386-ieee1275.rmk +4 -3
@@ -75,7 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/menu_text.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \ normal/color.c \
@@ -112,7 +113,7 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod su # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -192,7 +193,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
fs.c +3 -2
@@ -65,10 +65,11 @@ grub_fs_t grub_fs_probe (grub_device_t device) {grub_fs_t p; - autoint dummy_func (const char *filename,int dir); + autoint dummy_func (const char *filename, +const struct grub_dirhook_info *info);int dummy_func (const char *filename __attribute__ ((unused)), -int dir __attribute__ ((unused))) +const struct grub_dirhook_info *info __attribute__ ((unused))) {return 1 ; }
rescue.c +3 -2
@@ -176,9 +176,10 @@ grub_rescue_print_devices (const char *name) }static int -grub_rescue_print_files (const char *filename,int dir) +grub_rescue_print_files (const char *filename, +const struct grub_dirhook_info *info) { -grub_printf ("%s%s " , filename, dir ?"/" :"" ); +grub_printf ("%s%s " , filename, info->dir ?"/" :"" );return 0 ; }
datehook.c +1 -1
@@ -22,7 +22,7 @@#include <grub/env.h> #include <grub/misc.h> #include <grub/normal.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> static char *grub_datetime_names[] = {
efi/datetime.c +1 -1
@@ -21,7 +21,7 @@#include <grub/symbol.h> #include <grub/efi/api.h> #include <grub/efi/efi.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> grub_err_t grub_get_datetime (struct grub_datetime *datetime)
datetime.c +0 -49
49 lines not on this page · raw message
xfs.c +6 -8
@@ -620,7 +620,8 @@ grub_xfs_mount (grub_disk_t disk)static grub_err_t grub_xfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_xfs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -633,14 +634,11 @@ grub_xfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
afs.c +6 -8
@@ -562,7 +562,8 @@ grub_afs_close (grub_file_t file)static grub_err_t grub_afs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_afs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -575,14 +576,11 @@ grub_afs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ntfs.c +7 -9
@@ -864,7 +864,8 @@ fail:static grub_err_t grub_ntfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_ntfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -877,14 +878,11 @@ grub_ntfs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
fat.c +128 -121
324 lines not on this page · raw message
udf.c +7 -9
@@ -768,7 +768,8 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_udf_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_udf_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -782,14 +783,11 @@ grub_udf_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
iso9660.c +6 -8
@@ -666,7 +666,8 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_iso9660_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_iso9660_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -680,14 +681,11 @@ grub_iso9660_dir (grub_device_t device, const char enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
affs.c +6 -8
@@ -456,7 +456,8 @@ grub_affs_read (grub_file_t file, char *buf, grub_static grub_err_t grub_affs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_affs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -469,14 +470,11 @@ grub_affs_dir (grub_device_t device, const char *p enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
hfs.c +10 -5
@@ -960,7 +960,8 @@ grub_hfs_find_dir (struct grub_hfs_data *data, constatic grub_err_t grub_hfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {int inode;
@@ -971,13 +972,17 @@ grub_hfs_dir (grub_device_t device, const char *pachar fname[32 ] = {0 };char *filetype = rec->data;struct grub_hfs_catalog_key *ckey = rec->key; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));grub_strncpy (fname, (char *) (ckey->str), ckey->strlen); -if (*filetype ==GRUB_HFS_FILETYPE_DIR ) -return hook (fname,1 ); -else if (*filetype ==GRUB_HFS_FILETYPE_FILE ) -return hook (fname,0 ); +if (*filetype ==GRUB_HFS_FILETYPE_DIR + || *filetype ==GRUB_HFS_FILETYPE_FILE ) + { + info.dir = (*filetype ==GRUB_HFS_FILETYPE_DIR ); +return hook (fname, &info); + }return 0 ; }
reiserfs.c +6 -6
@@ -1266,7 +1266,8 @@ grub_reiserfs_close (grub_file_t file)/* Call HOOK with each file under DIR. */ static grub_err_t grub_reiserfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_reiserfs_data *data =0 ;struct grub_fshelp_node root, *found;
@@ -1280,12 +1281,11 @@ grub_reiserfs_dir (grub_device_t device, const cha enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); +return hook (filename, &info); }#ifndef GRUB_UTIL grub_dl_ref (my_mod);
jfs.c +7 -5
@@ -728,7 +728,8 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *datstatic grub_err_t grub_jfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_jfs_data *data =0 ;struct grub_jfs_diropen *diro =0 ;
@@ -752,14 +753,15 @@ grub_jfs_dir (grub_device_t device, const char *pawhile (grub_jfs_getent (diro) !=GRUB_ERR_OUT_OF_RANGE ) {struct grub_jfs_inode inode; -int isdir; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));if (grub_jfs_read_inode (data, diro->ino, &inode)) goto fail; - isdir = (grub_le_to_cpu32 (inode.mode) - &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; -if (hook (diro->name, isdir)) + info.dir = (grub_le_to_cpu32 (inode.mode) + &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; +if (hook (diro->name, &info)) goto fail; }
ext2.c +48 -8
81 lines not on this page · raw message
minix.c +8 -3
@@ -461,7 +461,8 @@ grub_minix_mount (grub_disk_t disk)static grub_err_t grub_minix_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_minix_data *data =0 ;struct grub_minix_sblock *sblock;
@@ -492,6 +493,9 @@ grub_minix_dir (grub_device_t device, const char *grub_uint16_t ino;char filename[data->filename_size +1 ];int dirino = data->ino; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); +if (grub_minix_read_file (data,0 , pos,sizeof (ino), (char *) &ino) <0 )
@@ -506,8 +510,9 @@ grub_minix_dir (grub_device_t device, const char */* The filetype is not stored in the dirent. Read the inode to find out the filetype. This *REALLY* sucks. */ grub_minix_read_inode (data,grub_le_to_cpu16 (ino)); -if (hook (filename, ((GRUB_MINIX_INODE_MODE (data) - &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR )) ?1 :0 ) + info.dir = ((GRUB_MINIX_INODE_MODE (data) + &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR ); +if (hook (filename, &info) ?1 :0 )break ;/* Load the old inode back in. */
hfsplus.c +48 -12
111 lines not on this page · raw message
cpio.c +7 -2
@@ -183,7 +183,8 @@ fail:static grub_err_t grub_cpio_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_cpio_data *data;grub_uint32_t ofs;
@@ -227,7 +228,11 @@ grub_cpio_dir (grub_device_t device, const char *pif ((!prev) || (grub_strcmp (prev, name) !=0 )) { -hook (name + len, p !=NULL ); +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = (p !=NULL ); + +hook (name + len, &info);if (prev)grub_free (prev); prev = name;
sfs.c +6 -8
@@ -519,7 +519,8 @@ grub_sfs_read (grub_file_t file, char *buf, grub_sstatic grub_err_t grub_sfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_sfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -532,14 +533,11 @@ grub_sfs_dir (grub_device_t device, const char *pa enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
ufs.c +128 -44
359 lines not on this page · raw message
grub/fs.h +13 -1
@@ -27,6 +27,14 @@/* Forward declaration is required, because of mutual reference. */ struct grub_file ; +struct grub_dirhook_info +{ +int dir:1 ; +int mtimeset:1 ; +int case_insensitive:1 ; +grub_int32_t mtime; +}; +/* Filesystem descriptor. */ struct grub_fs {
@@ -35,7 +43,8 @@ struct grub_fs/* Call HOOK with each file under DIR. */ grub_err_t (*dir) (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)); +int (*hook) (const char *filename, +const struct grub_dirhook_info *info));/* Open a file named NAME and initialize FILE. */ grub_err_t (*open) (struct grub_file *file,const char *name);
@@ -56,6 +65,9 @@ struct grub_fscaller. */ grub_err_t (*uuid) (grub_device_t device,char **uuid); +/* Get writing time of filesystem. */ +grub_err_t (*mtime) (grub_device_t device,grub_int32_t *timebuf); +/* The next filesystem. */ struct grub_fs *next; };
grub/fshelp.h +2 -0
@@ -27,6 +27,8 @@typedef struct grub_fshelp_node *grub_fshelp_node_t ;#define GRUB_FSHELP_CASE_INSENSITIVE 0x100 +#define GRUB_FSHELP_TYPE_MASK 0xff +#define GRUB_FSHELP_FLAGS_MASK 0x100enum grub_fshelp_filetype {
ChangeLog +74 -0
77 lines not on this page · raw message
completion.c +2 -2
@@ -123,9 +123,9 @@ iterate_partition (grub_disk_t disk, const grub_pa }static int -iterate_dir (const char *filename,int dir) +iterate_dir (const char *filename,const struct grub_dirhook_info *info) { -if (! dir) +if (! info->dir) {const char *prefix;if (cmdline_state ==GRUB_PARSER_STATE_DQUOTE )
misc.c +18 -0
@@ -23,6 +23,7 @@#include <grub/err.h> #include <grub/misc.h> #include <grub/mm.h> +#include <grub/datetime.h> /* Print the information on the device NAME. */ grub_err_t
@@ -63,6 +64,23 @@ grub_normal_print_device_info (const char *name) } grub_errno =GRUB_ERR_NONE ; } +if (fs->mtime) + { +grub_int32_t tm; +struct grub_datetime datetime; + (fs->mtime) (dev, &tm); +if (grub_errno ==GRUB_ERR_NONE ) + { +grub_unixtime2datetime (tm, &datetime); +grub_printf (", Last modification time %d-%02d-%02d " +"%02d:%02d:%02d %s" , + datetime.year, datetime.month, datetime.day, + datetime.hour, datetime.minute, datetime.second, +grub_get_weekday_name (&datetime)); + + } + grub_errno =GRUB_ERR_NONE ; + }if (fs->uuid) {char *uuid;
datetime.c +100 -0
100 lines not on this page · raw message
date.c +1 -1
@@ -22,7 +22,7 @@#include <grub/arg.h> #include <grub/err.h> #include <grub/misc.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> #define GRUB_DATETIME_SET_YEAR 1#define GRUB_DATETIME_SET_MONTH 2
ls.c +32 -10
87 lines not on this page · raw message
hostfs.c +9 -4
@@ -16,7 +16,7 @@* You should have received a copy of the GNU General Public License * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ - +#define _BSD_SOURCE#include <grub/fs.h> #include <grub/file.h> #include <grub/disk.h>
@@ -57,7 +57,8 @@ is_dir (const char *path, const char *name)static grub_err_t grub_hostfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {DIR *dir;
@@ -73,16 +74,20 @@ grub_hostfs_dir (grub_device_t device, const charwhile (1 ) {struct dirent *de; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); de =readdir (dir);if (! de)break ;#ifdef DT_DIR -hook (de->d_name, de->d_type ==DT_DIR ); + info.dir = (de->d_type ==DT_DIR );#else -hook (de->d_name,is_dir (path, de->d_name)); + info.dir = !!is_dir (path, de->d_name);#endif +hook (de->d_name, &info); + }closedir (dir);
Quoted 7 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Please do. It is definitely confusing to review patches that merge unrelated things.
Also, please don't include the changelog entry in your patch, since those break too easily. Just paste it at the top of your mail.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
mtime part
2009-03-15 Vladimir Serbinenko <[email protected]>
Support for mtime and further expandability of dir command
* include/grub/lib/datetime.h: moved to ...
* include/grub/datetime.h: ... moved here and added declaration of grub_unixtime2datetime. All users updated
* include/grub/fs.h: new syntax for dir and mtime functionin struct grub_fs
* include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK and GRUB_FSHELP_FLAGS_MASK
* commands/ls.c (grub_ls_list_files): Write mtime in long format
* fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function
* fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function
* fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise
(GRUB_UFS_ATTR_LNK): likewise
(struct grub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated
(grub_ufs_dir): mtime support
(grub_ufs_mtime): new function
* fs/affs.c (grub_affs_dir): use new dir syntax
* fs/afs.c (grub_afs_dir): likewise
* fs/cpio.c (grub_cpio_dir): likewise
* fs/fat.c (grub_fat_find_dir): likewise
* fs/hfs.c (grub_hfs_dir): likewise
* fs/iso9660.c (grub_iso9660_dir): likewise
* fs/jfs.c (grub_jfs_dir): likewise
* fs/minix.c (grub_minix_dir): likewise
* fs/ntfs.c (grub_ntfs_dir): likewise
* fs/reiserfs.c (grub_reiserfs_dir): likewise
* fs/sfs.c (grub_sfs_dir): likewise
* fs/xfs.c (grub_xfs_dir): likewise
* util/hostfs.c (grub_hostfs_dir): likewise
* lib/datetime.c: moved to ...
* normal/datetime.c: ... moved here (grub_unixtime2datetime): new function
* kern/rescue.c (grub_rescue_print_files): use new dir syntax
* normal/completition.c (iterate_dir): use new dir syntax
* normal/misc.c (grub_normal_print_device_info): tell the last modification time of a volume
* kern/fs.c (grub_fs_probe): updated dummy function to use new syntax
* conf/i386-coreboot.rmk: added normal/datetime.c to grub-emu and normal.mod. Removed lib/datetime.c from datetime.mod
* conf/i386-efi.rmk: likewise
* conf/i386-ieee1275.rmk: likewise
* conf/i386-pc.rmk: likewise
* conf/powerpc-ieee1275.rmk: likewise
* conf/sparc64-ieee1275.rmk: likewise
* conf/x86_64-efi.rmk: likewise
Quoted 10 lines · Robert Millan
Quoted 2 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Please do. It is definitely confusing to review patches that merge unrelated things.
Also, please don't include the changelog entry in your patch, since those break too easily. Just paste it at the top of your mail.
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
commands/date.c +1 -1
@@ -22,7 +22,7 @@#include <grub/arg.h> #include <grub/err.h> #include <grub/misc.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> #define GRUB_DATETIME_SET_YEAR 1#define GRUB_DATETIME_SET_MONTH 2
commands/ls.c +32 -10
87 lines not on this page · raw message
conf/i386-coreboot.rmk +4 -2
@@ -75,6 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/completion.c normal/main.c normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \
@@ -121,7 +123,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -192,7 +194,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-efi.rmk +4 -3
@@ -52,7 +52,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -119,7 +120,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genke # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -177,7 +178,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-ieee1275.rmk +4 -3
@@ -75,7 +75,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/menu_text.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/menu_text.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/misc.c normal/script.c \ normal/color.c \
@@ -112,7 +113,7 @@ pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod \ # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -192,7 +193,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-pc.rmk +4 -3
@@ -128,7 +128,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/main.c normal/color.c \ + normal/completion.c normal/datetime.c normal/main.c \ + normal/color.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -209,7 +210,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -351,7 +352,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS) pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/i386/datetime.c +datetime_mod_SOURCES = lib/i386/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/powerpc-ieee1275.rmk +2 -2
@@ -56,7 +56,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/misc.c kern/parser.c kern/partition.c kern/rescue.c \ kern/term.c kern/list.c kern/handler.c fs/fshelp.c \ normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/menu_entry.c normal/menu_viewer.c normal/misc.c \
@@ -133,7 +133,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
conf/sparc64-ieee1275.rmk +3 -2
@@ -57,7 +57,8 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ # kern/parser.c kern/partition.c kern/rescue.c kern/term.c \ # kern/list.c kern/handler.c \ # normal/arg.c normal/cmdline.c normal/command.c \ -# normal/completion.c normal/context.c normal/execute.c \ +# normal/completion.c normal/datetime.c normal/context.c \ +# normal/execute.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c \ # normal/menu_text.c \
@@ -166,7 +167,7 @@ sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
conf/x86_64-efi.rmk +4 -3
@@ -54,7 +54,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ kern/loader.c kern/main.c kern/misc.c kern/parser.c \ grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ - normal/completion.c normal/context.c normal/main.c \ + normal/completion.c normal/datetime.c normal/context.c \ + normal/main.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu_text.c \ normal/misc.c normal/script.c \
@@ -121,7 +122,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genke # keep it simpler to update to different architectures. # normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ - normal/completion.c normal/execute.c \ + normal/completion.c normal/datetime.c normal/execute.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_text.c \ normal/color.c \
@@ -179,7 +180,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) # For datetime.mod -datetime_mod_SOURCES = lib/datetime.c lib/efi/datetime.c +datetime_mod_SOURCES = lib/efi/datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
fs/affs.c +6 -8
@@ -456,7 +456,8 @@ grub_affs_read (grub_file_t file, char *buf, grub_size_t len)static grub_err_t grub_affs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_affs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -469,14 +470,11 @@ grub_affs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/afs.c +6 -8
@@ -562,7 +562,8 @@ grub_afs_close (grub_file_t file)static grub_err_t grub_afs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_afs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -575,14 +576,11 @@ grub_afs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/cpio.c +7 -2
@@ -183,7 +183,8 @@ fail:static grub_err_t grub_cpio_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_cpio_data *data;grub_uint32_t ofs;
@@ -227,7 +228,11 @@ grub_cpio_dir (grub_device_t device, const char *path,if ((!prev) || (grub_strcmp (prev, name) !=0 )) { -hook (name + len, p !=NULL ); +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = (p !=NULL ); + +hook (name + len, &info);if (prev)grub_free (prev); prev = name;
fs/ext2.c +48 -8
81 lines not on this page · raw message
fs/fat.c +12 -4
@@ -606,7 +606,8 @@ grub_fat_iterate_dir (grub_disk_t disk, struct grub_fat_data *data,static char *grub_fat_find_dir (grub_disk_t disk,struct grub_fat_data *data,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {char *dirname, *dirp;int call_hook;
@@ -615,10 +616,16 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, autoint iter_hook (const char *filename,struct grub_fat_dir_entry *dir);int iter_hook (const char *filename,struct grub_fat_dir_entry *dir) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + + info.dir = !!(dir->attr &GRUB_FAT_ATTR_DIRECTORY ); + info.case_insensitive =1 ; +if (dir->attr &GRUB_FAT_ATTR_VOLUME_ID )return 0 ;if (*dirname =='\0' && call_hook) -return hook (filename, dir->attr &GRUB_FAT_ATTR_DIRECTORY ); +return hook (filename, &info);if (grub_strcasecmp (dirname, filename) ==0 ) {
@@ -630,7 +637,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, data->cur_cluster_num = ~0U ;if (call_hook) -hook (filename, dir->attr &GRUB_FAT_ATTR_DIRECTORY ); +hook (filename, &info);return 1 ; }
@@ -676,7 +683,8 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,static grub_err_t grub_fat_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_fat_data *data =0 ;grub_disk_t disk = device->disk;
fs/hfs.c +10 -5
@@ -960,7 +960,8 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,static grub_err_t grub_hfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {int inode;
@@ -971,13 +972,17 @@ grub_hfs_dir (grub_device_t device, const char *path,char fname[32 ] = {0 };char *filetype = rec->data;struct grub_hfs_catalog_key *ckey = rec->key; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));grub_strncpy (fname, (char *) (ckey->str), ckey->strlen); -if (*filetype ==GRUB_HFS_FILETYPE_DIR ) -return hook (fname,1 ); -else if (*filetype ==GRUB_HFS_FILETYPE_FILE ) -return hook (fname,0 ); +if (*filetype ==GRUB_HFS_FILETYPE_DIR + || *filetype ==GRUB_HFS_FILETYPE_FILE ) + { + info.dir = (*filetype ==GRUB_HFS_FILETYPE_DIR ); +return hook (fname, &info); + }return 0 ; }
fs/hfsplus.c +48 -12
111 lines not on this page · raw message
fs/iso9660.c +6 -8
@@ -666,7 +666,8 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_iso9660_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_iso9660_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -680,14 +681,11 @@ grub_iso9660_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/jfs.c +7 -5
@@ -728,7 +728,8 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)static grub_err_t grub_jfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_jfs_data *data =0 ;struct grub_jfs_diropen *diro =0 ;
@@ -752,14 +753,15 @@ grub_jfs_dir (grub_device_t device, const char *path,while (grub_jfs_getent (diro) !=GRUB_ERR_OUT_OF_RANGE ) {struct grub_jfs_inode inode; -int isdir; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info));if (grub_jfs_read_inode (data, diro->ino, &inode)) goto fail; - isdir = (grub_le_to_cpu32 (inode.mode) - &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; -if (hook (diro->name, isdir)) + info.dir = (grub_le_to_cpu32 (inode.mode) + &GRUB_JFS_FILETYPE_MASK ) ==GRUB_JFS_FILETYPE_DIR ; +if (hook (diro->name, &info)) goto fail; }
fs/minix.c +8 -3
@@ -461,7 +461,8 @@ grub_minix_mount (grub_disk_t disk)static grub_err_t grub_minix_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_minix_data *data =0 ;struct grub_minix_sblock *sblock;
@@ -492,6 +493,9 @@ grub_minix_dir (grub_device_t device, const char *path,grub_uint16_t ino;char filename[data->filename_size +1 ];int dirino = data->ino; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); +if (grub_minix_read_file (data,0 , pos,sizeof (ino), (char *) &ino) <0 )
@@ -506,8 +510,9 @@ grub_minix_dir (grub_device_t device, const char *path,/* The filetype is not stored in the dirent. Read the inode to find out the filetype. This *REALLY* sucks. */ grub_minix_read_inode (data,grub_le_to_cpu16 (ino)); -if (hook (filename, ((GRUB_MINIX_INODE_MODE (data) - &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR )) ?1 :0 ) + info.dir = ((GRUB_MINIX_INODE_MODE (data) + &GRUB_MINIX_IFDIR ) ==GRUB_MINIX_IFDIR ); +if (hook (filename, &info) ?1 :0 )break ;/* Load the old inode back in. */
fs/ntfs.c +7 -9
@@ -864,7 +864,8 @@ fail:static grub_err_t grub_ntfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_ntfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -877,14 +878,11 @@ grub_ntfs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/reiserfs.c +6 -6
@@ -1266,7 +1266,8 @@ grub_reiserfs_close (grub_file_t file)/* Call HOOK with each file under DIR. */ static grub_err_t grub_reiserfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_reiserfs_data *data =0 ;struct grub_fshelp_node root, *found;
@@ -1280,12 +1281,11 @@ grub_reiserfs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); +return hook (filename, &info); }#ifndef GRUB_UTIL grub_dl_ref (my_mod);
fs/sfs.c +6 -8
@@ -519,7 +519,8 @@ grub_sfs_read (grub_file_t file, char *buf, grub_size_t len)static grub_err_t grub_sfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_sfs_data *data =0 ;struct grub_fshelp_node *fdiro =0 ;
@@ -532,14 +533,11 @@ grub_sfs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/udf.c +7 -9
@@ -768,7 +768,8 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,static grub_err_t grub_udf_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_udf_data *data =0 ;struct grub_fshelp_node rootnode;
@@ -782,14 +783,11 @@ grub_udf_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { -grub_free (node ); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR ); +grub_free (node); +return hook (filename, &info); }#ifndef GRUB_UTIL
fs/ufs.c +91 -25
249 lines not on this page · raw message
fs/xfs.c +6 -8
@@ -620,7 +620,8 @@ grub_xfs_mount (grub_disk_t disk)static grub_err_t grub_xfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {struct grub_xfs_data *data =0 ;;struct grub_fshelp_node *fdiro =0 ;
@@ -633,14 +634,11 @@ grub_xfs_dir (grub_device_t device, const char *path, enum grub_fshelp_filetype filetype, grub_fshelp_node_t node) { +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); + info.dir = ((filetype &GRUB_FSHELP_TYPE_MASK ) ==GRUB_FSHELP_DIR );grub_free (node); - -if (filetype ==GRUB_FSHELP_DIR ) -return hook (filename,1 ); -else -return hook (filename,0 ); - -return 0 ; +return hook (filename, &info); }#ifndef GRUB_UTIL
hook/datehook.c +1 -1
@@ -22,7 +22,7 @@#include <grub/env.h> #include <grub/misc.h> #include <grub/normal.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> static char *grub_datetime_names[] = {
include/grub/datetime.h new file +48 -0
48 lines not on this page · raw message
include/grub/fs.h +13 -1
@@ -27,6 +27,14 @@/* Forward declaration is required, because of mutual reference. */ struct grub_file ; +struct grub_dirhook_info +{ +int dir:1 ; +int mtimeset:1 ; +int case_insensitive:1 ; +grub_int32_t mtime; +}; +/* Filesystem descriptor. */ struct grub_fs {
@@ -35,7 +43,8 @@ struct grub_fs/* Call HOOK with each file under DIR. */ grub_err_t (*dir) (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)); +int (*hook) (const char *filename, +const struct grub_dirhook_info *info));/* Open a file named NAME and initialize FILE. */ grub_err_t (*open) (struct grub_file *file,const char *name);
@@ -56,6 +65,9 @@ struct grub_fscaller. */ grub_err_t (*uuid) (grub_device_t device,char **uuid); +/* Get writing time of filesystem. */ +grub_err_t (*mtime) (grub_device_t device,grub_int32_t *timebuf); +/* The next filesystem. */ struct grub_fs *next; };
include/grub/fshelp.h +2 -0
@@ -27,6 +27,8 @@typedef struct grub_fshelp_node *grub_fshelp_node_t ;#define GRUB_FSHELP_CASE_INSENSITIVE 0x100 +#define GRUB_FSHELP_TYPE_MASK 0xff +#define GRUB_FSHELP_FLAGS_MASK 0x100enum grub_fshelp_filetype {
include/grub/lib/datetime.h +0 -44
44 lines not on this page · raw message
kern/fs.c +3 -2
@@ -65,10 +65,11 @@ grub_fs_t grub_fs_probe (grub_device_t device) {grub_fs_t p; - autoint dummy_func (const char *filename,int dir); + autoint dummy_func (const char *filename, +const struct grub_dirhook_info *info);int dummy_func (const char *filename __attribute__ ((unused)), -int dir __attribute__ ((unused))) +const struct grub_dirhook_info *info __attribute__ ((unused))) {return 1 ; }
kern/rescue.c +3 -2
@@ -176,9 +176,10 @@ grub_rescue_print_devices (const char *name) }static int -grub_rescue_print_files (const char *filename,int dir) +grub_rescue_print_files (const char *filename, +const struct grub_dirhook_info *info) { -grub_printf ("%s%s " , filename, dir ?"/" :"" ); +grub_printf ("%s%s " , filename, info->dir ?"/" :"" );return 0 ; }
lib/datetime.c +0 -49
49 lines not on this page · raw message
lib/efi/datetime.c +1 -1
@@ -21,7 +21,7 @@#include <grub/symbol.h> #include <grub/efi/api.h> #include <grub/efi/efi.h> -#include <grub/lib/datetime.h> +#include <grub/datetime.h> grub_err_t grub_get_datetime (struct grub_datetime *datetime)
lib/i386/datetime.c +1 -1
@@ -17,7 +17,7 @@* along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ -#include <grub/lib/datetime.h> +#include <grub/datetime.h> #include <grub/i386/cmos.h> grub_err_t
normal/completion.c +2 -2
@@ -123,9 +123,9 @@ iterate_partition (grub_disk_t disk, const grub_partition_t p) }static int -iterate_dir (const char *filename,int dir) +iterate_dir (const char *filename,const struct grub_dirhook_info *info) { -if (! dir) +if (! info->dir) {const char *prefix;if (cmdline_state ==GRUB_PARSER_STATE_DQUOTE )
normal/datetime.c new file +100 -0
100 lines not on this page · raw message
normal/misc.c +18 -0
@@ -23,6 +23,7 @@#include <grub/err.h> #include <grub/misc.h> #include <grub/mm.h> +#include <grub/datetime.h> /* Print the information on the device NAME. */ grub_err_t
@@ -63,6 +64,23 @@ grub_normal_print_device_info (const char *name) } grub_errno =GRUB_ERR_NONE ; } +if (fs->mtime) + { +grub_int32_t tm; +struct grub_datetime datetime; + (fs->mtime) (dev, &tm); +if (grub_errno ==GRUB_ERR_NONE ) + { +grub_unixtime2datetime (tm, &datetime); +grub_printf (", Last modification time %d-%02d-%02d " +"%02d:%02d:%02d %s" , + datetime.year, datetime.month, datetime.day, + datetime.hour, datetime.minute, datetime.second, +grub_get_weekday_name (&datetime)); + + } + grub_errno =GRUB_ERR_NONE ; + }if (fs->uuid) {char *uuid;
util/hostfs.c +9 -4
@@ -16,7 +16,7 @@* You should have received a copy of the GNU General Public License * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ - +#define _BSD_SOURCE#include <grub/fs.h> #include <grub/file.h> #include <grub/disk.h>
@@ -57,7 +57,8 @@ is_dir (const char *path, const char *name)static grub_err_t grub_hostfs_dir (grub_device_t device,const char *path, -int (*hook) (const char *filename,int dir)) +int (*hook) (const char *filename, +const struct grub_dirhook_info *info)) {DIR *dir;
@@ -73,16 +74,20 @@ grub_hostfs_dir (grub_device_t device, const char *path,while (1 ) {struct dirent *de; +struct grub_dirhook_info info; +grub_memset (&info,0 ,sizeof (info)); de =readdir (dir);if (! de)break ;#ifdef DT_DIR -hook (de->d_name, de->d_type ==DT_DIR ); + info.dir = (de->d_type ==DT_DIR );#else -hook (de->d_name,is_dir (path, de->d_name)); + info.dir = !!is_dir (path, de->d_name);#endif +hook (de->d_name, &info); + }closedir (dir);
UFS part (not related to mtime)
2009-03-15 Vladimir Serbinenko <[email protected]>
UFS improvements
* fs/ufs.c (GRUB_UFS_BSD_DIRENT): new definition (struct grub_ufs_dirent): added fields for non-BSD dirents (grub_ufs_get_file_block): fixed double indirect handling (grub_ufs_find_file): support for non-BSD dirents (grub_ufs_dir): support for non-BSD dirents
Quoted 10 lines · Robert Millan
Quoted 2 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Please do. It is definitely confusing to review patches that merge unrelated things.
Also, please don't include the changelog entry in your patch, since those break too easily. Just paste it at the top of your mail.
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
fs/ufs.c +32 -15
@@ -54,6 +54,8 @@ grub_le_to_cpu##bits1 (data->inode.field) : \ grub_le_to_cpu##bits2 (data->inode2.field))#define INODE_SIZE (data) INODE_ENDIAN (data,size,32,64) +#define INODE_NBLOCKS (data) INODE_ENDIAN (data,nblocks,32,64) +#define INODE_MODE (data) INODE_ENDIAN (data,mode,16,16)#define INODE_BLKSZ (data) (data->ufs_type == UFS1 ? 4 : 8)#define INODE_DIRBLOCKS (data,blk) INODE_ENDIAN \
@@ -174,8 +176,15 @@ struct grub_ufs_dirent {grub_uint32_t ino;grub_uint16_t direntlen; -grub_uint8_t filetype; -grub_uint8_t namelen; +union + { +grub_uint16_t namelen; +struct + { +grub_uint8_t filetype_bsd; +grub_uint8_t namelen_bsd; + }; + }; } __attribute__ ((packed));/* Information about a "mounted" ufs filesystem. */
@@ -234,22 +243,23 @@ grub_ufs_get_file_block (struct grub_ufs_data *data, unsigned int blk) blk -= indirsz;/* Double indirect block. */ -if (blk <UFS_BLKSZ (sblock) / indirsz) +if (blk < indirsz * indirsz) {grub_uint32_t indir[UFS_BLKSZ (sblock) >>2 ];grub_disk_read (data->disk,INODE_INDIRBLOCKS (data,1 ) << log2_blksz,0 ,sizeof (indir), (char *) indir);grub_disk_read (data->disk, - (data->ufs_type ==UFS1 ) ? - indir[blk / indirsz] : indir [(blk / indirsz) <<1 ], + ((data->ufs_type ==UFS1 ) ? + indir[blk / indirsz] : indir [(blk / indirsz) <<1 ]) + << log2_blksz,0 ,sizeof (indir), (char *) indir);return (data->ufs_type ==UFS1 ) ? indir[blk % indirsz] : indir[(blk % indirsz) <<1 ]; } - +grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET ,"ufs does not support triple indirect blocks" );return 0 ;
@@ -386,9 +396,8 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)if (++data->linknest >GRUB_UFS_MAX_SYMLNK_CNT )return grub_error (GRUB_ERR_SYMLINK_LOOP ,"too deep nesting of symlinks" ); - -if (INODE_SIZE (data) < (GRUB_UFS_DIRBLKS +GRUB_UFS_INDIRBLKS - *INODE_BLKSZ (data))) + +if (INODE_NBLOCKS (data) ==0 )grub_strcpy (symlink, (char *)INODE (data, symlink));else {
@@ -447,6 +456,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) do { struct grub_ufs_dirent dirent; + int namelen; if (grub_strlen (name) == 0) return GRUB_ERR_NONE;
@@ -454,15 +464,18 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)if (grub_ufs_read_file (data,0 , pos,sizeof (dirent), (char *) &dirent) <0 )return grub_errno; + + namelen = (data->ufs_type ==UFS2 ) + ? dirent.namelen_bsd :grub_le_to_cpu16 (dirent.namelen); { -char filename[dirent.namelen +1 ]; +char filename[namelen +1 ];if (grub_ufs_read_file (data,0 , pos +sizeof (dirent), - dirent.namelen, filename) <0 ) + namelen, filename) <0 )return grub_errno; - filename[dirent.namelen] ='\0' ; + filename[namelen] ='\0' ;if (!grub_strcmp (name, filename)) {
@@ -595,21 +608,25 @@ grub_ufs_dir (grub_device_t device, const char *path,while (pos <INODE_SIZE (data)) {struct grub_ufs_dirent dirent; +int namelen;if (grub_ufs_read_file (data,0 , pos,sizeof (dirent), (char *) &dirent) <0 )break ; + + namelen = (data->ufs_type ==UFS2 ) + ? dirent.namelen_bsd :grub_le_to_cpu16 (dirent.namelen); { -char filename[dirent.namelen +1 ]; +char filename[namelen +1 ];struct grub_dirhook_info info;grub_memset (&info,0 ,sizeof (info));if (grub_ufs_read_file (data,0 , pos +sizeof (dirent), - dirent.namelen, filename) <0 ) + namelen, filename) <0 )break ; - filename[dirent.namelen] ='\0' ; + filename[namelen] ='\0' ;if (data->ufs_type ==UFS1 ) {struct grub_ufs_inode inode;
Can someone review this patch?
Quoted 69 lines · phcoder
mtime part
2009-03-15 Vladimir Serbinenko <[email protected]>Support for mtime and further expandability of dir command
*
include/grub/lib/datetime.h: moved to ...
*include/grub/datetime.h: ... moved here and added declaration ofgrub_unixtime2datetime. All users updated
*include/grub/fs.h: new syntax for dir and mtime functionin structgrub_fs
*include/grub/fshelp.h: new declarations ofGRUB_FSHELP_TYPE_MASKandGRUB_FSHELP_FLAGS_MASK
*commands/ls.c(grub_ls_list_files): Write mtime in long format
*fs/ext2.c(grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function
*fs/hfsplus.c(grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function
*fs/ufs.c(GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise
(GRUB_UFS_ATTR_LNK): likewise
(structgrub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated
(grub_ufs_dir): mtime support
(grub_ufs_mtime): new function
*fs/affs.c(grub_affs_dir): use new dir syntax
*fs/afs.c(grub_afs_dir): likewise
*fs/cpio.c(grub_cpio_dir): likewise
*fs/fat.c(grub_fat_find_dir): likewise
*fs/hfs.c(grub_hfs_dir): likewise
*fs/iso9660.c(grub_iso9660_dir): likewise
*fs/jfs.c(grub_jfs_dir): likewise
*fs/minix.c(grub_minix_dir): likewise
*fs/ntfs.c(grub_ntfs_dir): likewise
*fs/reiserfs.c(grub_reiserfs_dir): likewise
*fs/sfs.c(grub_sfs_dir): likewise
*fs/xfs.c(grub_xfs_dir): likewise
*util/hostfs.c(grub_hostfs_dir): likewise
*lib/datetime.c: moved to ...
*normal/datetime.c: ... moved here (grub_unixtime2datetime): new function
*kern/rescue.c(grub_rescue_print_files): use new dir syntax
*normal/completition.c(iterate_dir): use new dir syntax
*normal/misc.c(grub_normal_print_device_info): tell the last modification time of a volume
*kern/fs.c(grub_fs_probe): updated dummy function to use new syntax
* conf/i386-coreboot.rmk: addednormal/datetime.cto grub-emu and normal.mod. Removedlib/datetime.cfrom datetime.mod
* conf/i386-efi.rmk: likewise
* conf/i386-ieee1275.rmk: likewise
* conf/i386-pc.rmk: likewise
* conf/powerpc-ieee1275.rmk: likewise
* conf/sparc64-ieee1275.rmk: likewise
* conf/x86_64-efi.rmk: likewiseQuoted 10 lines · Robert Millan
Quoted 2 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too. As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary work
Please do. It is definitely confusing to review patches that merge unrelated things.
Also, please don't include the changelog entry in your patch, since those break too easily. Just paste it at the top of your mail.
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Quoted 1 line · On Saturday 04 April 2009 18:21:40 phcoder wrote:
Can someone review this patch?
Looks good to me.
Thanks,
Okuji
Quoted 72 lines
Quoted 71 lines · phcoder
mtime part
2009-03-15 Vladimir Serbinenko <[email protected]>Support for mtime and further expandability of dir command
*
include/grub/lib/datetime.h: moved to ...
*include/grub/datetime.h: ... moved here and added declaration ofgrub_unixtime2datetime. All users updated
*include/grub/fs.h: new syntax for dir and mtime functionin structgrub_fs
*include/grub/fshelp.h: new declarations ofGRUB_FSHELP_TYPE_MASKandGRUB_FSHELP_FLAGS_MASK
*commands/ls.c(grub_ls_list_files): Write mtime in long format
*fs/ext2.c(grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function
*fs/hfsplus.c(grub_hfsplus_dir): use new dir syntax and supply
mtime (grub_hfsplus_mtime): new function
*fs/ufs.c(GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise
(GRUB_UFS_ATTR_LNK): likewise
(structgrub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate
buffer all users updated
(grub_ufs_dir): mtime support
(grub_ufs_mtime): new function
*fs/affs.c(grub_affs_dir): use new dir syntax
*fs/afs.c(grub_afs_dir): likewise
*fs/cpio.c(grub_cpio_dir): likewise
*fs/fat.c(grub_fat_find_dir): likewise
*fs/hfs.c(grub_hfs_dir): likewise
*fs/iso9660.c(grub_iso9660_dir): likewise
*fs/jfs.c(grub_jfs_dir): likewise
*fs/minix.c(grub_minix_dir): likewise
*fs/ntfs.c(grub_ntfs_dir): likewise
*fs/reiserfs.c(grub_reiserfs_dir): likewise
*fs/sfs.c(grub_sfs_dir): likewise
*fs/xfs.c(grub_xfs_dir): likewise
*util/hostfs.c(grub_hostfs_dir): likewise
*lib/datetime.c: moved to ...
*normal/datetime.c: ... moved here (grub_unixtime2datetime): new function
*kern/rescue.c(grub_rescue_print_files): use new dir syntax
*normal/completition.c(iterate_dir): use new dir syntax
*normal/misc.c(grub_normal_print_device_info): tell the last modification time of a volume
*kern/fs.c(grub_fs_probe): updated dummy function to use new syntax
* conf/i386-coreboot.rmk: addednormal/datetime.cto grub-emu and normal.mod. Removedlib/datetime.cfrom datetime.mod
* conf/i386-efi.rmk: likewise
* conf/i386-ieee1275.rmk: likewise
* conf/i386-pc.rmk: likewise
* conf/powerpc-ieee1275.rmk: likewise
* conf/sparc64-ieee1275.rmk: likewise
* conf/x86_64-efi.rmk: likewiseQuoted 15 lines · Robert Millan
Quoted 8 lines · phcoder
Hello all. It seems that gcc has trouble with -m32 when structure is passed as argument. So I replaced that part by a pointer. Also I made some improvements to ufs code to support solaris branch of ufs. I tested it also with freebsd and netbsd's branch and it works fine on it too.
As my 3 FS patches: mtime, FAT and UFS are interdependent I submit a patch with all 3 features. If it's really necessary I can split them but it requires a lot of unnecessary workPlease do. It is definitely confusing to review patches that merge unrelated things.
Also, please don't include the changelog entry in your patch, since those break too easily. Just paste it at the top of your mail.