Skip to contentSkip to conversation

Remove nested functions from filesystem directory iterators

PATCH In review Colin Watson 2 participants 2 messages Jan 21, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove nested functions from filesystem directory iterators

Part six. This increases the size of the uncompressed kernel a bit (though by less than was gained from un-nesting device iterators), but it seems to still decrease the size of typical compressed core images.

This is the biggest remaining single patch in this set. Disk/file read hooks still need to be un-nested, but that's less complex, and then I believe it's just a collection of little bits and pieces.

  UP:   obj/i386-coreboot/grub-core/kernel.img (27848 < 27868) - change: 20
  UP:   obj/i386-efi/grub-core/kernel.img (59488 < 59496) - change: 8
  UP:   obj/i386-ieee1275/grub-core/kernel.img (48344 < 48364) - change: 20
  UP:   obj/i386-pc/grub-core/kernel.img (28832 < 28852) - change: 20
  DOWN: obj/amd64-efi/grub-core/bfs.mod (10688 > 10672) - change: -16
  UP:   obj/amd64-efi/grub-core/btrfs.mod (19200 < 19232) - change: 32
  UP:   obj/amd64-efi/grub-core/cpio_be.mod (7384 < 7400) - change: 16
  UP:   obj/amd64-efi/grub-core/exfat.mod (8240 < 8272) - change: 32
  DOWN: obj/amd64-efi/grub-core/ext2.mod (9112 > 9096) - change: -16
  UP:   obj/amd64-efi/grub-core/fat.mod (8616 < 8648) - change: 32
  DOWN: obj/amd64-efi/grub-core/fshelp.mod (4152 > 4128) - change: -24
  UP:   obj/amd64-efi/grub-core/hfs.mod (10784 < 10800) - change: 16
  DOWN: obj/amd64-efi/grub-core/hfsplus.mod (10096 > 10080) - change: -16
  DOWN: obj/amd64-efi/grub-core/iso9660.mod (13136 > 13120) - change: -16
  DOWN: obj/amd64-efi/grub-core/ls.mod (7000 > 6920) - change: -80
  UP:   obj/amd64-efi/grub-core/minix.mod (5928 < 5944) - change: 16
  UP:   obj/amd64-efi/grub-core/minix2.mod (6016 < 6032) - change: 16
  UP:   obj/amd64-efi/grub-core/minix2_be.mod (6128 < 6144) - change: 16
  UP:   obj/amd64-efi/grub-core/minix3.mod (6000 < 6016) - change: 16
  UP:   obj/amd64-efi/grub-core/minix3_be.mod (6080 < 6096) - change: 16
  UP:   obj/amd64-efi/grub-core/minix_be.mod (6040 < 6056) - change: 16
  UP:   obj/amd64-efi/grub-core/newc.mod (7544 < 7560) - change: 16
  DOWN: obj/amd64-efi/grub-core/nilfs2.mod (9992 > 9976) - change: -16
  DOWN: obj/amd64-efi/grub-core/ntfs.mod (15616 > 15600) - change: -16
  DOWN: obj/amd64-efi/grub-core/regexp.mod (78976 > 78848) - change: -128
  DOWN: obj/amd64-efi/grub-core/romfs.mod (5816 > 5784) - change: -32
  DOWN: obj/amd64-efi/grub-core/sfs.mod (8024 > 7992) - change: -32
  DOWN: obj/amd64-efi/grub-core/test.mod (7880 > 7808) - change: -72
  DOWN: obj/amd64-efi/grub-core/udf.mod (11256 > 11240) - change: -16
  UP:   obj/amd64-efi/grub-core/ufs1.mod (8128 < 8144) - change: 16
  UP:   obj/amd64-efi/grub-core/ufs1_be.mod (8240 < 8256) - change: 16
  UP:   obj/amd64-efi/grub-core/ufs2.mod (8144 < 8160) - change: 16
  UP:   obj/amd64-efi/grub-core/xfs.mod (8952 < 8968) - change: 16
  DOWN: obj/amd64-efi/grub-core/xnu.mod (52064 > 51920) - change: -144
  DOWN: obj/amd64-efi/grub-core/zfs.mod (54168 > 53928) - change: -240
  UP:   obj/i386-coreboot/grub-core/affs.mod (5600 < 5652) - change: 52
  UP:   obj/i386-coreboot/grub-core/afs.mod (6876 < 6912) - change: 36
  UP:   obj/i386-coreboot/grub-core/bfs.mod (7644 < 7656) - change: 12
  UP:   obj/i386-coreboot/grub-core/btrfs.mod (14232 < 14272) - change: 40
  UP:   obj/i386-coreboot/grub-core/cpio.mod (4372 < 4376) - change: 4
  UP:   obj/i386-coreboot/grub-core/cpio_be.mod (4468 < 4472) - change: 4
  UP:   obj/i386-coreboot/grub-core/exfat.mod (5288 < 5296) - change: 8
  UP:   obj/i386-coreboot/grub-core/ext2.mod (5964 < 5976) - change: 12
  UP:   obj/i386-coreboot/grub-core/fat.mod (5596 < 5620) - change: 24
  DOWN: obj/i386-coreboot/grub-core/fshelp.mod (2832 > 2812) - change: -20
  UP:   obj/i386-coreboot/grub-core/hfs.mod (7212 < 7228) - change: 16
  UP:   obj/i386-coreboot/grub-core/hfsplus.mod (6580 < 6596) - change: 16
  DOWN: obj/i386-coreboot/grub-core/iso9660.mod (8804 > 8796) - change: -8
  UP:   obj/i386-coreboot/grub-core/jfs.mod (6556 < 6560) - change: 4
  DOWN: obj/i386-coreboot/grub-core/ls.mod (4292 > 4264) - change: -28
  UP:   obj/i386-coreboot/grub-core/minix.mod (3764 < 3768) - change: 4
  UP:   obj/i386-coreboot/grub-core/minix2.mod (3828 < 3836) - change: 8
  UP:   obj/i386-coreboot/grub-core/minix2_be.mod (3920 < 3924) - change: 4
  UP:   obj/i386-coreboot/grub-core/minix3.mod (3792 < 3800) - change: 8
  UP:   obj/i386-coreboot/grub-core/minix3_be.mod (3868 < 3872) - change: 4
  UP:   obj/i386-coreboot/grub-core/minix_be.mod (3860 < 3864) - change: 4
  UP:   obj/i386-coreboot/grub-core/net.mod (43812 < 43816) - change: 4
  UP:   obj/i386-coreboot/grub-core/newc.mod (4636 < 4644) - change: 8
  UP:   obj/i386-coreboot/grub-core/nilfs2.mod (6588 < 6600) - change: 12
  UP:   obj/i386-coreboot/grub-core/normal.mod (111964 < 111972) - change: 8
  UP:   obj/i386-coreboot/grub-core/ntfs.mod (10468 < 10492) - change: 24
  UP:   obj/i386-coreboot/grub-core/odc.mod (4464 < 4472) - change: 8
  DOWN: obj/i386-coreboot/grub-core/regexp.mod (51512 > 51432) - change: -80
  DOWN: obj/i386-coreboot/grub-core/reiserfs.mod (8956 > 8952) - change: -4
  UP:   obj/i386-coreboot/grub-core/romfs.mod (4052 < 4068) - change: 16
  UP:   obj/i386-coreboot/grub-core/sfs.mod (5068 < 5072) - change: 4
  UP:   obj/i386-coreboot/grub-core/squash4.mod (6828 < 6864) - change: 36
  UP:   obj/i386-coreboot/grub-core/tar.mod (5108 < 5112) - change: 4
  DOWN: obj/i386-coreboot/grub-core/test.mod (4944 > 4916) - change: -28
  UP:   obj/i386-coreboot/grub-core/udf.mod (7624 < 7644) - change: 20
  UP:   obj/i386-coreboot/grub-core/ufs1.mod (5460 < 5468) - change: 8
  UP:   obj/i386-coreboot/grub-core/ufs1_be.mod (5588 < 5596) - change: 8
  UP:   obj/i386-coreboot/grub-core/ufs2.mod (5548 < 5552) - change: 4
  UP:   obj/i386-coreboot/grub-core/xfs.mod (6008 < 6036) - change: 28
  DOWN: obj/i386-coreboot/grub-core/xnu.mod (33224 > 33200) - change: -24
  DOWN: obj/i386-coreboot/grub-core/zfs.mod (36504 > 36384) - change: -120
  DOWN: obj/i386-efi/grub-core/affs.mod (5752 > 5748) - change: -4
  DOWN: obj/i386-efi/grub-core/afs.mod (6988 > 6976) - change: -12
  DOWN: obj/i386-efi/grub-core/bfs.mod (7796 > 7780) - change: -16
  UP:   obj/i386-efi/grub-core/cpio.mod (4628 < 4632) - change: 4
  UP:   obj/i386-efi/grub-core/exfat.mod (5444 < 5452) - change: 8
  DOWN: obj/i386-efi/grub-core/ext2.mod (6152 > 6144) - change: -8
  UP:   obj/i386-efi/grub-core/fat.mod (5800 < 5808) - change: 8
  DOWN: obj/i386-efi/grub-core/fshelp.mod (2868 > 2856) - change: -12
  UP:   obj/i386-efi/grub-core/hfs.mod (7340 < 7344) - change: 4
  DOWN: obj/i386-efi/grub-core/hfsplus.mod (6836 > 6832) - change: -4
  DOWN: obj/i386-efi/grub-core/iso9660.mod (9164 > 9140) - change: -24
  UP:   obj/i386-efi/grub-core/jfs.mod (6628 < 6632) - change: 4
  DOWN: obj/i386-efi/grub-core/ls.mod (4476 > 4436) - change: -40
  UP:   obj/i386-efi/grub-core/minix2.mod (3876 < 3880) - change: 4
  UP:   obj/i386-efi/grub-core/newc.mod (4888 < 4892) - change: 4
  DOWN: obj/i386-efi/grub-core/nilfs2.mod (6720 > 6712) - change: -8
  UP:   obj/i386-efi/grub-core/ntfs.mod (10796 < 10800) - change: 4
  UP:   obj/i386-efi/grub-core/odc.mod (4724 < 4728) - change: 4
  DOWN: obj/i386-efi/grub-core/regexp.mod (53412 > 53280) - change: -132
  DOWN: obj/i386-efi/grub-core/reiserfs.mod (9232 > 9216) - change: -16
  DOWN: obj/i386-efi/grub-core/romfs.mod (4128 > 4116) - change: -12
  DOWN: obj/i386-efi/grub-core/sfs.mod (5304 > 5288) - change: -16
  DOWN: obj/i386-efi/grub-core/squash4.mod (7068 > 7056) - change: -12
  DOWN: obj/i386-efi/grub-core/test.mod (5232 > 5200) - change: -32
  DOWN: obj/i386-efi/grub-core/udf.mod (7928 > 7916) - change: -12
  UP:   obj/i386-efi/grub-core/ufs1_be.mod (5696 < 5700) - change: 4
  UP:   obj/i386-efi/grub-core/xfs.mod (6232 < 6236) - change: 4
  DOWN: obj/i386-efi/grub-core/xnu.mod (33940 > 33892) - change: -48
  DOWN: obj/i386-efi/grub-core/zfs.mod (37680 > 37528) - change: -152
  UP:   obj/i386-ieee1275/grub-core/affs.mod (5600 < 5652) - change: 52
  UP:   obj/i386-ieee1275/grub-core/afs.mod (6876 < 6912) - change: 36
  UP:   obj/i386-ieee1275/grub-core/bfs.mod (7644 < 7656) - change: 12
  UP:   obj/i386-ieee1275/grub-core/btrfs.mod (14232 < 14272) - change: 40
  UP:   obj/i386-ieee1275/grub-core/cpio.mod (4372 < 4376) - change: 4
  UP:   obj/i386-ieee1275/grub-core/cpio_be.mod (4468 < 4472) - change: 4
  UP:   obj/i386-ieee1275/grub-core/exfat.mod (5288 < 5296) - change: 8
  UP:   obj/i386-ieee1275/grub-core/ext2.mod (5964 < 5976) - change: 12
  UP:   obj/i386-ieee1275/grub-core/fat.mod (5596 < 5620) - change: 24
  DOWN: obj/i386-ieee1275/grub-core/fshelp.mod (2832 > 2812) - change: -20
  UP:   obj/i386-ieee1275/grub-core/hfs.mod (7212 < 7228) - change: 16
  UP:   obj/i386-ieee1275/grub-core/hfsplus.mod (6580 < 6596) - change: 16
  DOWN: obj/i386-ieee1275/grub-core/iso9660.mod (8804 > 8796) - change: -8
  UP:   obj/i386-ieee1275/grub-core/jfs.mod (6556 < 6560) - change: 4
  DOWN: obj/i386-ieee1275/grub-core/ls.mod (4284 > 4256) - change: -28
  UP:   obj/i386-ieee1275/grub-core/minix.mod (3764 < 3768) - change: 4
  UP:   obj/i386-ieee1275/grub-core/minix2.mod (3828 < 3836) - change: 8
  UP:   obj/i386-ieee1275/grub-core/minix2_be.mod (3920 < 3924) - change: 4
  UP:   obj/i386-ieee1275/grub-core/minix3.mod (3792 < 3800) - change: 8
  UP:   obj/i386-ieee1275/grub-core/minix3_be.mod (3868 < 3872) - change: 4
  UP:   obj/i386-ieee1275/grub-core/minix_be.mod (3860 < 3864) - change: 4
  UP:   obj/i386-ieee1275/grub-core/net.mod (43812 < 43816) - change: 4
  UP:   obj/i386-ieee1275/grub-core/newc.mod (4636 < 4644) - change: 8
  UP:   obj/i386-ieee1275/grub-core/nilfs2.mod (6588 < 6600) - change: 12
  UP:   obj/i386-ieee1275/grub-core/normal.mod (111956 < 111964) - change: 8
  UP:   obj/i386-ieee1275/grub-core/ntfs.mod (10468 < 10492) - change: 24
  UP:   obj/i386-ieee1275/grub-core/odc.mod (4464 < 4472) - change: 8
  DOWN: obj/i386-ieee1275/grub-core/regexp.mod (51504 > 51424) - change: -80
  DOWN: obj/i386-ieee1275/grub-core/reiserfs.mod (8956 > 8952) - change: -4
  UP:   obj/i386-ieee1275/grub-core/romfs.mod (4052 < 4068) - change: 16
  UP:   obj/i386-ieee1275/grub-core/sfs.mod (5068 < 5072) - change: 4
  UP:   obj/i386-ieee1275/grub-core/squash4.mod (6828 < 6864) - change: 36
  UP:   obj/i386-ieee1275/grub-core/tar.mod (5108 < 5112) - change: 4
  DOWN: obj/i386-ieee1275/grub-core/test.mod (4944 > 4916) - change: -28
  UP:   obj/i386-ieee1275/grub-core/udf.mod (7624 < 7644) - change: 20
  UP:   obj/i386-ieee1275/grub-core/ufs1.mod (5460 < 5468) - change: 8
  UP:   obj/i386-ieee1275/grub-core/ufs1_be.mod (5588 < 5596) - change: 8
  UP:   obj/i386-ieee1275/grub-core/ufs2.mod (5548 < 5552) - change: 4
  UP:   obj/i386-ieee1275/grub-core/xfs.mod (6008 < 6036) - change: 28
  DOWN: obj/i386-ieee1275/grub-core/xnu.mod (33220 > 33196) - change: -24
  DOWN: obj/i386-ieee1275/grub-core/zfs.mod (36504 > 36384) - change: -120
  UP:   obj/i386-pc/grub-core/affs.mod (5600 < 5652) - change: 52
  UP:   obj/i386-pc/grub-core/afs.mod (6876 < 6912) - change: 36
  UP:   obj/i386-pc/grub-core/bfs.mod (7644 < 7656) - change: 12
  UP:   obj/i386-pc/grub-core/btrfs.mod (14232 < 14272) - change: 40
  UP:   obj/i386-pc/grub-core/cpio.mod (4372 < 4376) - change: 4
  UP:   obj/i386-pc/grub-core/cpio_be.mod (4468 < 4472) - change: 4
  UP:   obj/i386-pc/grub-core/exfat.mod (5288 < 5296) - change: 8
  UP:   obj/i386-pc/grub-core/ext2.mod (5964 < 5976) - change: 12
  UP:   obj/i386-pc/grub-core/fat.mod (5596 < 5620) - change: 24
  DOWN: obj/i386-pc/grub-core/fshelp.mod (2832 > 2812) - change: -20
  UP:   obj/i386-pc/grub-core/hfs.mod (7212 < 7228) - change: 16
  UP:   obj/i386-pc/grub-core/hfsplus.mod (6580 < 6596) - change: 16
  DOWN: obj/i386-pc/grub-core/iso9660.mod (8804 > 8796) - change: -8
  UP:   obj/i386-pc/grub-core/jfs.mod (6556 < 6560) - change: 4
  DOWN: obj/i386-pc/grub-core/ls.mod (4292 > 4264) - change: -28
  UP:   obj/i386-pc/grub-core/minix.mod (3764 < 3768) - change: 4
  UP:   obj/i386-pc/grub-core/minix2.mod (3828 < 3836) - change: 8
  UP:   obj/i386-pc/grub-core/minix2_be.mod (3920 < 3924) - change: 4
  UP:   obj/i386-pc/grub-core/minix3.mod (3792 < 3800) - change: 8
  UP:   obj/i386-pc/grub-core/minix3_be.mod (3868 < 3872) - change: 4
  UP:   obj/i386-pc/grub-core/minix_be.mod (3860 < 3864) - change: 4
  UP:   obj/i386-pc/grub-core/net.mod (43812 < 43816) - change: 4
  UP:   obj/i386-pc/grub-core/newc.mod (4636 < 4644) - change: 8
  UP:   obj/i386-pc/grub-core/nilfs2.mod (6588 < 6600) - change: 12
  UP:   obj/i386-pc/grub-core/normal.mod (111936 < 111944) - change: 8
  UP:   obj/i386-pc/grub-core/ntfs.mod (10468 < 10492) - change: 24
  UP:   obj/i386-pc/grub-core/odc.mod (4464 < 4472) - change: 8
  DOWN: obj/i386-pc/grub-core/regexp.mod (51512 > 51432) - change: -80
  DOWN: obj/i386-pc/grub-core/reiserfs.mod (8956 > 8952) - change: -4
  UP:   obj/i386-pc/grub-core/romfs.mod (4052 < 4068) - change: 16
  UP:   obj/i386-pc/grub-core/sfs.mod (5068 < 5072) - change: 4
  UP:   obj/i386-pc/grub-core/squash4.mod (6828 < 6864) - change: 36
  UP:   obj/i386-pc/grub-core/tar.mod (5108 < 5112) - change: 4
  DOWN: obj/i386-pc/grub-core/test.mod (4944 > 4916) - change: -28
  UP:   obj/i386-pc/grub-core/udf.mod (7624 < 7644) - change: 20
  UP:   obj/i386-pc/grub-core/ufs1.mod (5460 < 5468) - change: 8
  UP:   obj/i386-pc/grub-core/ufs1_be.mod (5588 < 5596) - change: 8
  UP:   obj/i386-pc/grub-core/ufs2.mod (5548 < 5552) - change: 4
  UP:   obj/i386-pc/grub-core/xfs.mod (6008 < 6036) - change: 28

DOWN: obj/i386-pc/grub-core/xnu.mod (33224 > 33200) - change: -24
DOWN: obj/i386-pc/grub-core/zfs.mod (36504 > 36384) - change: -120
DOWN: i386-pc core image (biosdisk ext2 part_msdos) (26627 > 26604) - change: -23
DOWN: i386-pc core image (biosdisk ext2 part_msdos lvm mdraid1x) (34008 > 33959) - change: -49

=== modified file 'ChangeLog'

ChangeLog +9 -0
@@ -10,6 +10,15 @@
 
 2013-01-20  Colin Watson  <[email protected]>
 
+	Remove nested functions from filesystem directory iterators.
+
+	* include/grub/fs.h (grub_fs_dir_hook_t): New type.
+	(struct grub_fs.dir): Add hook_data argument.
+
+	Update all implementations and callers.
+
+2013-01-20  Colin Watson  <[email protected]>
+
 	* grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't add the
 	initrd size to addr_min, since the initrd will be allocated after
 	this address.

=== modified file 'grub-core/commands/ls.c'

commands/ls.c +110 -92

243 lines not on this page · raw message

=== modified file 'grub-core/commands/test.c'

commands/test.c +161 -142

485 lines not on this page · raw message

=== modified file 'grub-core/commands/wildcard.c'

commands/wildcard.c +95 -69

233 lines not on this page · raw message

=== modified file 'grub-core/fs/affs.c'

fs/affs.c +104 -97

256 lines not on this page · raw message

=== modified file 'grub-core/fs/bfs.c'

fs/bfs.c +57 -38

137 lines not on this page · raw message

=== modified file 'grub-core/fs/btrfs.c'

fs/btrfs.c +2 -3
@@ -1491,8 +1491,7 @@ find_path (struct grub_btrfs_data *data,
 
 static grub_err_t
 grub_btrfs_dir (grub_device_t device, const char *path,
-		int (*hook) (const char *filename,
-			     const struct grub_dirhook_info *info))
+		grub_fs_dir_hook_t hook, void *hook_data)
 {
   struct grub_btrfs_data *data = grub_btrfs_mount (device);
   struct grub_btrfs_key key_in, key_out;
@@ -1586,7 +1585,7 @@ grub_btrfs_dir (grub_device_t device, co
 	  c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
 	  cdirel->name[grub_le_to_cpu16 (cdirel->n)] = 0;
 	  info.dir = (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY);
-	  if (hook (cdirel->name, &info))
+	  if (hook (cdirel->name, &info, hook_data))
 	    goto out;
 	  cdirel->name[grub_le_to_cpu16 (cdirel->n)] = c;
 	}

=== modified file 'grub-core/fs/cpio.c'

fs/cpio.c +2 -3
@@ -513,8 +513,7 @@ handle_symlink (struct grub_cpio_data *d
 
 static grub_err_t
 grub_cpio_dir (grub_device_t device, const char *path_in,
-	       int (*hook) (const char *filename,
-			    const struct grub_dirhook_info *info))
+	       grub_fs_dir_hook_t hook, void *hook_data)
 {
   struct grub_cpio_data *data;
   grub_disk_addr_t ofs;
@@ -575,7 +574,7 @@ grub_cpio_dir (grub_device_t device, con
 	      info.mtime = mtime;
 	      info.mtimeset = 1;
 
-	      if (hook (n, &info))
+	      if (hook (n, &info, hook_data))
 		{
 		  grub_free (name);
 		  goto fail;

=== modified file 'grub-core/fs/ext2.c'

fs/ext2.c +50 -43

126 lines not on this page · raw message

=== modified file 'grub-core/fs/fat.c'

fs/fat.c +7 -9
@@ -844,8 +844,7 @@ grub_fat_iterate_dir_next (grub_disk_t d
 static char *
 grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
 		   const char *path, const char *origpath,
-		   int (*hook) (const char *filename,
-				const struct grub_dirhook_info *info))
+		   grub_fs_dir_hook_t hook, void *hook_data)
 {
   char *dirname, *dirp;
   int call_hook;
@@ -905,7 +904,7 @@ grub_fat_find_dir (grub_disk_t disk, str
 #endif
       if (*dirname == '\0' && call_hook)
 	{
-	  if (hook (ctxt.filename, &info))
+	  if (hook (ctxt.filename, &info, hook_data))
 	    break;
 	  else
 	    continue;
@@ -926,7 +925,7 @@ grub_fat_find_dir (grub_disk_t disk, str
 	  data->cur_cluster_num = ~0U;
 
 	  if (call_hook)
-	    hook (ctxt.filename, &info);
+	    hook (ctxt.filename, &info, hook_data);
 
 	  break;
 	}
@@ -946,9 +945,8 @@ grub_fat_find_dir (grub_disk_t disk, str
 }
 
 static grub_err_t
-grub_fat_dir (grub_device_t device, const char *path,
-	      int (*hook) (const char *filename,
-			   const struct grub_dirhook_info *info))
+grub_fat_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook,
+	      void *hook_data)
 {
   struct grub_fat_data *data = 0;
   grub_disk_t disk = device->disk;
@@ -976,7 +974,7 @@ grub_fat_dir (grub_device_t device, cons
 
   do
     {
-      p = grub_fat_find_dir (disk, data, p, path, hook);
+      p = grub_fat_find_dir (disk, data, p, path, hook, hook_data);
     }
   while (p && grub_errno == GRUB_ERR_NONE);
 
@@ -1004,7 +1002,7 @@ grub_fat_open (grub_file_t file, const c
 
   do
     {
-      p = grub_fat_find_dir (file->device->disk, data, p, name, 0);
+      p = grub_fat_find_dir (file->device->disk, data, p, name, 0, 0);
       if (grub_errno != GRUB_ERR_NONE)
 	goto fail;
     }

=== modified file 'grub-core/fs/fshelp.c'

fs/fshelp.c +163 -148

362 lines not on this page · raw message

=== modified file 'grub-core/fs/hfs.c'

fs/hfs.c +4 -5
@@ -1151,9 +1151,8 @@ grub_hfs_find_dir (struct grub_hfs_data
 
 
 static grub_err_t
-grub_hfs_dir (grub_device_t device, const char *path,
-		  int (*hook) (const char *filename,
-			       const struct grub_dirhook_info *info))
+grub_hfs_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook,
+	      void *hook_data)
 {
   int inode;
 
@@ -1184,14 +1183,14 @@ grub_hfs_dir (grub_device_t device, cons
 	  info.dir = 1;
 	  info.mtimeset = 1;
 	  info.mtime = grub_be_to_cpu32 (drec->mtime) - 2082844800;
-	  return hook (fname, &info);
+	  return hook (fname, &info, hook_data);
 	}
       if (frec->type == GRUB_HFS_FILETYPE_FILE)
 	{
 	  info.dir = 0;
 	  info.mtimeset = 1;
 	  info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
-	  return hook (fname, &info);
+	  return hook (fname, &info, hook_data);
 	}
 
       return 0;

=== modified file 'grub-core/fs/hfsplus.c'

fs/hfsplus.c +32 -28

102 lines not on this page · raw message

=== modified file 'grub-core/fs/iso9660.c'

fs/iso9660.c +29 -25

85 lines not on this page · raw message

=== modified file 'grub-core/fs/jfs.c'

fs/jfs.c +2 -3
@@ -799,8 +799,7 @@ grub_jfs_lookup_symlink (struct grub_jfs
 
 static grub_err_t
 grub_jfs_dir (grub_device_t device, const char *path,
-	      int (*hook) (const char *filename,
-			   const struct grub_dirhook_info *info))
+	      grub_fs_dir_hook_t hook, void *hook_data)
 {
   struct grub_jfs_data *data = 0;
   struct grub_jfs_diropen *diro = 0;
@@ -832,7 +831,7 @@ grub_jfs_dir (grub_device_t device, cons
 		  & GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
       info.mtimeset = 1;
       info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
-      if (hook (diro->name, &info))
+      if (hook (diro->name, &info, hook_data))
 	goto fail;
     }
 

=== modified file 'grub-core/fs/minix.c'

fs/minix.c +2 -3
@@ -536,8 +536,7 @@ 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,
-			       const struct grub_dirhook_info *info))
+		grub_fs_dir_hook_t hook, void *hook_data)
 {
   struct grub_minix_data *data = 0;
   unsigned int pos = 0;
@@ -590,7 +589,7 @@ grub_minix_dir (grub_device_t device, co
       info.mtimeset = 1;
       info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
 
-      if (hook (filename, &info) ? 1 : 0)
+      if (hook (filename, &info, hook_data) ? 1 : 0)
 	break;
 
       /* Load the old inode back in.  */

=== modified file 'grub-core/fs/nilfs2.c'

fs/nilfs2.c +48 -42

125 lines not on this page · raw message

=== modified file 'grub-core/fs/ntfs.c'

fs/ntfs.c +34 -33

115 lines not on this page · raw message

=== modified file 'grub-core/fs/reiserfs.c'

fs/reiserfs.c +30 -24

86 lines not on this page · raw message

=== modified file 'grub-core/fs/romfs.c'

fs/romfs.c +27 -24

81 lines not on this page · raw message

=== modified file 'grub-core/fs/sfs.c'

fs/sfs.c +70 -67

176 lines not on this page · raw message

=== modified file 'grub-core/fs/squash4.c'

fs/squash4.c +30 -27

96 lines not on this page · raw message

=== modified file 'grub-core/fs/udf.c'

fs/udf.c +56 -53

130 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/fs/ufs.c'

fs/ufs.c +2 -3

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/fs/xfs.c'

fs/xfs.c +77 -61

138 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/fs/zfs/zfs.c'

fs/zfs/zfs.c +231 -185

416 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/kern/corecmd.c'

kern/corecmd.c +3 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/kern/emu/hostfs.c'

kern/emu/hostfs.c +2 -3

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/kern/fs.c'

kern/fs.c +7 -6

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/loader/xnu.c'

loader/xnu.c +120 -85

205 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/net/net.c'

net/net.c +2 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'grub-core/normal/completion.c'

normal/completion.c +3 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/fs.h'

grub/fs.h +5 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/fshelp.h'

grub/fshelp.h +8 -7

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'util/grub-mount.c'

grub-mount.c +83 -59

142 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Thanks,

Signature · 1 line
Colin Watson                                       [[email protected]]

Part of the diff is not shown here. View the raw message.

#1 lore raw

Go ahead.

Quoted 7 lines · Colin Watson

Part six. This increases the size of the uncompressed kernel a bit (though by less than was gained from un-nesting device iterators), but it seems to still decrease the size of typical compressed core images.

This is the biggest remaining single patch in this set. Disk/file read hooks still need to be un-nested, but that's less complex, and then I believe it's just a collection of little bits and pieces.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko