Skip to contentSkip to conversation

JFS support (PATCH) and filesystem improvements

PATCH Marco Gerards 3 participants 8 messages Aug 23, 2004 – Sep 10, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

Here is a patch to add JFS support to GRUB 2. It has all features you might expect from it, except support for journaling and HUGE filesystems. I was not able to test this on filesystems with a blocksize other than 4096 bytes, so that might not work either. Another thing I have not implemented is looking up files using the B+ tree, if that is really a big problem for someone, please tell me. I have tested this implementation with a huge directory and I think the slowdown is less important than the amount of code I have to write for this.

Because filenames are stored in UTF-16, I had to do a conversion to UTF-8/ Okuji wrote some code for this for fat.c. I have moved this to kern/misc.c so ufs.c can use this as well.

Please read the code or test it and send in suggestions for improvements or bug reports. If I do not hear anything before Friday I will commit this patch Friday.

The next filesystem on my todo is iso9660fs. I moved it up on my todo because we already have CDROM support (for free! :)) for the PPC port.

Before I will do that, I want to have a close look at the filesystems currently implemented. There are some (minor) mistakes I made because of a lack of experience, I want to fix those first. And there is a lot of code duplication for some tasks.

The two main functions that are more or less duplicated every time is the function to read in a file and the one to lookup files by the path. The best way to implement this properly is writing some filesystem helper functions (kern/fshelp.c or so). Most filesystems can use those functions to avoid code duplication and thus bugs.

Another way to solve this problem is changing the interfaces for the filesystems. But I do not want to do that because I like the way things are, filesystems are in control and know what is best (some filesystems can lookup files in B+ trees, for example).

If someone does not agree with this improvement, please tell me.

Thanks,
Marco

2004-08-23 Marco Gerards <[email protected]>

Add support for the JFS filesystem.

* fs/jfs.c: New file.
* include/grub/fs.h (grub_hfs_init): New prototype. (grub_hfs_fini): New prototype.
(grub_jfs_init): New prototype.
(grub_jfs_fini): New prototype.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/jfs.c. (grub_emu_SOURCES): Likewise.
(pkgdata_MODULES): Add jfs.mod.
(jfs_mod_SOURCES): New variable.
(jfs_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs.jfs.c. (grubof_SOURCES): Likewise.
* util/grub-emu.c (main): Initialize and deinitialize JFS support.

* fs/fat.c (grub_fat_find_dir): Convert the filename little endian to the host endian.
(grub_fat_utf16_to_utf8): Move function from there...
* kern/misc.c (grub_utf16_to_utf8): ...to here. Do not convert the endianess of the source string anymore.
* include/grub/misc.h (grub_utf16_to_utf8): New prototype.

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.16

i386-pc.rmk +7 -3
diff -u -p -u -p -r1.16 i386-pc.rmk
@@ -61,7 +61,7 @@ grub_mkimage_LDFLAGS = -llzo
 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
 	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
 	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
-	fs/ufs.c fs/minix.c fs/hfs.c kern/file.c kern/fs.c kern/env.c
+	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c
 
 # For grub
 grub_emu_SOURCES = kern/main.c kern/device.c				\
@@ -69,7 +69,7 @@ grub_emu_SOURCES = kern/main.c kern/devi
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
 	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
-	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c		\
+	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c\
 	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
 	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
 grub_emu_LDFLAGS = -lncurses
@@ -79,7 +79,7 @@ genmoddep_SOURCES = util/genmoddep.c
 
 # Modules.
 pkgdata_MODULES = _chain.mod _linux.mod fat.mod ufs.mod ext2.mod minix.mod \
-	hfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
+	hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
 	boot.mod cmp.mod cat.mod terminal.mod
 
 # For _chain.mod.
@@ -106,6 +106,10 @@ minix_mod_CFLAGS = $(COMMON_CFLAGS)
 hfs_mod_SOURCES = fs/hfs.c
 hfs_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For jfs.mod.
+jfs_mod_SOURCES = fs/jfs.c
+jfs_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For _linux.mod.
 _linux_mod_SOURCES = loader/i386/pc/linux.c
 _linux_mod_CFLAGS = $(COMMON_CFLAGS)

Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v retrieving revision 1.6

powerpc-ieee1275.rmk +2 -2
diff -u -p -u -p -r1.6 powerpc-ieee1275.rmk
@@ -26,7 +26,7 @@ grub_emu_SOURCES = kern/main.c kern/devi
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	disk/powerpc/ieee1275/partition.c 					\
 	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c	\
-	normal/cmdline.c normal/command.c normal/main.c normal/menu.c	\
+	fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c	\
 	normal/arg.c	\
 	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
 	kern/env.c commands/ls.c		\
@@ -39,7 +39,7 @@ grubof_SOURCES = boot/powerpc/ieee1275/c
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
 	kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
 	kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
-	normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
+	fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
 	disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \
 	kern/env.c normal/arg.c loader/powerpc/ieee1275/linux.c \
 	loader/powerpc/ieee1275/linux_normal.c commands/boot.c

Index: fs/fat.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/fat.c,v
retrieving revision 1.8

fat.c +6 -63

81 lines not on this page · raw message

Index: fs/jfs.c
===================================================================
RCS file: fs/jfs.c

jfs.c new file +892 -0

892 lines not on this page · raw message

Index: include/grub/fs.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/fs.h,v
retrieving revision 1.7

grub/fs.h +4 -0
diff -u -p -u -p -r1.7 fs.h
@@ -74,6 +74,10 @@ void grub_ufs_init (void);
 void grub_ufs_fini (void);
 void grub_minix_init (void);
 void grub_minix_fini (void);
+void grub_hfs_init (void);
+void grub_hfs_fini (void);
+void grub_jfs_init (void);
+void grub_jfs_fini (void);
 #endif /* GRUB_UTIL */
 
 #endif /* ! GRUB_FS_HEADER */

Index: include/grub/misc.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/misc.h,v retrieving revision 1.9

grub/misc.h +4 -0
diff -u -p -u -p -r1.9 misc.h
@@ -58,6 +58,10 @@ int EXPORT_FUNC(grub_vprintf) (const cha
 int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
 int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
 void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
+grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
+					       grub_uint16_t *src,
+					       grub_size_t size);
+
 grub_err_t EXPORT_FUNC(grub_split_cmdline) (const char *str, 
 					    grub_err_t (* getline) (char **),
 					    int *argc, char ***argv);

Index: kern/misc.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/misc.c,v
retrieving revision 1.13

misc.c +62 -0

68 lines not on this page · raw message

Index: util/grub-emu.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/grub-emu.c,v
retrieving revision 1.6

grub-emu.c +2 -0
diff -u -p -u -p -r1.6 grub-emu.c
@@ -161,6 +161,7 @@ main (int argc, char *argv[])
   grub_ufs_init ();
   grub_minix_init ();
   grub_hfs_init ();
+  grub_jfs_init ();
   grub_ls_init ();
   grub_boot_init ();
   grub_cmp_init ();
@@ -179,6 +180,7 @@ main (int argc, char *argv[])
   grub_ext2_fini ();
   grub_minix_fini ();
   grub_hfs_fini ();
+  grub_jfs_fini ();
   grub_fat_fini ();
   grub_boot_fini ();
   grub_cmp_fini ();
#1 lore raw
Quoted 3 lines · Marco Gerards

Please read the code or test it and send in suggestions for improvements or bug reports. If I do not hear anything before Friday I will commit this patch Friday.

Committed.

Quoted 4 lines

Before I will do that, I want to have a close look at the filesystems currently implemented. There are some (minor) mistakes I made because of a lack of experience, I want to fix those first. And there is a lot of code duplication for some tasks.

And here is a patch for that.

To avoid code duplication I wrote kern/fshelp.c, which has the following two functions:

- grub_fshelp_find_file

A function that can be used to lookup nodes using a path. This code is required in almost any filesystem. It can also handle symlinks and check for many errors.

- grub_fshelp_read_file

This function takes a number of a offset in a file and the length to read and read that part of the file into a buffer supplied by the filesystem.

These two functions are helper functions for filesystems. It is used to avoid bugs and code duplication and making my live easier :). The filesystem has to define grub_fshelp_node which describes a single filesystem node and a few callback functions to help the functions I described above.

I would really appreciate it if someone takes a look at the code and especially fshelp.c and fshelp.h to see if the interfaces are right, etc. Of course I have tested the code and I think it is ready to be committed, but I don't want to do that silently, so please reply...

When this patch is in I will make these changes for other filesystems as well.

Thanks,
Marco

2004-08-28 Marco Gerards <[email protected]>

* conf/i386-pc.rmk (kernel_img_SOURCES): Added kern/fshelp.c. (grub_mkimage_LDFLAGS): Likewise.
(grub_emu_SOURCES): Likewise.
(kernel_img_HEADERS): Added fshelp.h.
* fs/ext2.c: Include <grub/fshelp.h>.
(FILETYPE_REG): New macro.
(FILETYPE_INO_REG): Likewise.
(grub_ext_sblock): Renamed to `grub_ext2_sblock'. Changed all users.
(ext2_block_group): Renamed to `grub_ext2_block_group'. Changed all users.
(grub_fshelp_node): New struct.
(grub_ext2_data): Added member diropen'. Changed member inode' to a pointer.
(grub_ext2_get_file_block): Removed function. (grub_ext2_read_block): New function. (grub_ext2_read_file): Replaced parameter data' by node'. This function was written.
(grub_ext2_mount): Read the root inode. Create a diropen struct. (grub_ext2_find_file): Removed function. (grub_ext2_read_symlink): New function. (grub_ext2_iterate_dir): Likewise.
(grub_ext2_open): Rewritten.
(grub_ext2_dir): Rewritten.
* include/grub/fshelp.h: New file.
* kern/fshelp.c: Likewise.

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.17

i386-pc.rmk +4 -4
diff -u -p -u -p -r1.17 i386-pc.rmk
@@ -23,7 +23,7 @@ diskboot_img_LDFLAGS = -nostdlib -Wl,-N,
 
 # For kernel.img.
 kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
-	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c kern/fshelp.c \
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
 	kern/i386/dl.c kern/i386/pc/init.c disk/i386/pc/partition.c \
 	kern/env.c disk/i386/pc/biosdisk.c \
@@ -33,7 +33,7 @@ kernel_img_HEADERS = boot.h device.h dis
 	file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
 	term.h types.h machine/biosdisk.h machine/boot.h \
 	machine/console.h machine/init.h machine/memory.h \
-	machine/loader.h machine/partition.h machine/vga.h arg.h env.h
+	machine/loader.h machine/partition.h machine/vga.h arg.h env.h fshelp.h
 kernel_img_CFLAGS = $(COMMON_CFLAGS)
 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
@@ -61,10 +61,10 @@ grub_mkimage_LDFLAGS = -llzo
 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
 	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
 	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
-	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c
+	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c kern/fshelp.c
 
 # For grub
-grub_emu_SOURCES = kern/main.c kern/device.c				\
+grub_emu_SOURCES = kern/main.c kern/device.c  kern/fshelp.c		\
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	disk/i386/pc/partition.c kern/env.c commands/ls.c		\

Index: fs/ext2.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/ext2.c,v
retrieving revision 1.8

ext2.c +212 -335

731 lines not on this page · raw message

Index: include/grub/fshelp.h
===================================================================
RCS file: include/grub/fshelp.h

grub/fshelp.h new file +59 -0

59 lines not on this page · raw message

Index: kern/fshelp.c
===================================================================
RCS file: kern/fshelp.c

fshelp.c new file +286 -0

286 lines not on this page · raw message

#2 lore raw

Only some comments of very small importance as proof that I have read the patch.

--- slashes: ---
sub-function find_file():

fshelp.c line 96

Quoted 2 lines
fshelp.c new file +2 -0
+      if (*name == '/')
+	name++;

what about 'while' ? I mean if we remove first one slash, why not the second (as in linux, a sequence of slashes acts as one slash).

fshelp.c line 100

Quoted 4 lines
fshelp.c new file +4 -0
+  
+      /* Remove trailing "/".  */
+      if (name[grub_strlen (name) - 1] == '/')
+	name[grub_strlen (name) - 1] = '\0';

This is not need if we skip _all_ slashes ...

fshelp.c line 118

Quoted 7 lines
fshelp.c new file +7 -0
+	  /* Extract the actual part from the pathname.  */
+	  next = grub_strchr (name, '/');
+	  if (next)
+	    {
+	      next[0] = '\0';
+	      next++;
+	    }

... here. I propose: while (*next == '/') next++; instead of simply incrementing.
--- :slashes end ---

fshelp.c line 166

Quoted 6 lines
fshelp.c new file +6 -0
+	      /* The symlink is an absolute path, go back to the root inode.  */
+	      if (symlink[0] == '/')
+		{
+		  free_node (oldnode);
+		  oldnode = rootnode;
+		}

And for relative path ... :
Please write somewhere that you expect correct behavior for '..' entry. (e.g., in fshelp.h). When someone will implement weird fs, he must know what this function expects.

fshelp.c line 179

Quoted 2 lines
fshelp.c new file +2 -0
+	  
+	  /* Fond the node!  */

Typo in comment :-).

fshelp.c line 266

Quoted 6 lines
fshelp.c new file +6 -0
+      /* First block.  */
+      if (i == pos / blocksize)
+	{
+	  skipfirst = blockoff;
+	  blockend -= skipfirst;
+	}

blockend ... not a good name: blockbytes? (hmm, also not very good.)

Signature · 3 lines
                                 Tomas 'ebi' Ebenlendr
                                 http://get.to/ebik
                                 PF 2004.66118890407
#3 lore raw
Quoted 4 lines · [email protected] (Tomas Ebenlendr) writes:

Only some comments of very small importance as proof that I have read the patch.

--- slashes: ---

[...]

Quoted 1 line

--- :slashes end ---

Done.

Quoted 3 lines

Please write somewhere that you expect correct behavior for '..' entry. (e.g., in fshelp.h). When someone will implement weird fs, he must know what this function expects.

If the filesystem supports it, the iterate function should support "..". Actually, it should support anything that is a part of a symlink. This is just filesystem dependent, it is not a concern of fshelp.

Quoted 7 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+      /* First block.  */
+      if (i == pos / blocksize)
+	{
+	  skipfirst = blockoff;
+	  blockend -= skipfirst;
+	}

blockend ... not a good name: blockbytes? (hmm, also not very good.)

Well, I just left it this way. It is what it commonly used.

Here is the new patch. I have moved fshelp.c to fs/. I also changed i386-pc.rmk so it makes fshelp.mod.

Okuji, I really like how you implemented module loading. It is nice to see grub-mkimage automatically includes fshelp.mod in the core image when using ext2. :)

There is one nasty thing that I had to do and that is adding `NESTED_FUNC_ATTR' to the iterate function because it is a nested function normally. But other than that all issues should be resolved.

So I assume this patch is ok. To be sure, I will wait until Sunday before I commit this patch.

My iso9660fs code depends on fshelp. I will send it in after fshelp is committed.

In the meanwhile I will work a bit more on the PPC port. I want to have a look at module loading because it is getting really important now.

Thanks,
Marco

2004-09-09 Marco Gerards <[email protected]>

* conf/i386-pc.rmk (kernel_img_SOURCES): Added kern/fshelp.c. (grub_mkimage_LDFLAGS): Likewise.
(grub_emu_SOURCES): Likewise.
(kernel_img_HEADERS): Added fshelp.h.
* fs/ext2.c: Include <grub/fshelp.h>.
(FILETYPE_REG): New macro.
(FILETYPE_INO_REG): Likewise.
(grub_ext_sblock): Renamed to `grub_ext2_sblock'. Changed all users.
(ext2_block_group): Renamed to `grub_ext2_block_group'. Changed all users.
(grub_fshelp_node): New struct.
(grub_ext2_data): Added member diropen'. Changed member inode' to a pointer.
(grub_ext2_get_file_block): Removed function. (grub_ext2_read_block): New function. (grub_ext2_read_file): Replaced parameter data' by node'. This function was written.
(grub_ext2_mount): Read the root inode. Create a diropen struct. (grub_ext2_find_file): Removed function. (grub_ext2_read_symlink): New function. (grub_ext2_iterate_dir): Likewise.
(grub_ext2_open): Rewritten.
(grub_ext2_dir): Rewritten.
* include/grub/fshelp.h: New file.
* fs/fshelp.c: Likewise.

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.17

i386-pc.rmk +7 -3
diff -u -p -u -p -r1.17 i386-pc.rmk
@@ -61,10 +61,10 @@ grub_mkimage_LDFLAGS = -llzo
 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
 	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
 	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
-	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c
+	fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub
-grub_emu_SOURCES = kern/main.c kern/device.c				\
+grub_emu_SOURCES = kern/main.c kern/device.c fs/fshelp.c		\
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
 	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
@@ -80,12 +80,16 @@ genmoddep_SOURCES = util/genmoddep.c
 # Modules.
 pkgdata_MODULES = _chain.mod _linux.mod fat.mod ufs.mod ext2.mod minix.mod \
 	hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
-	boot.mod cmp.mod cat.mod terminal.mod
+	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
 _chain_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For fshelp.mod.
+fshelp_mod_SOURCES = fs/fshelp.c
+fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For fat.mod.
 fat_mod_SOURCES = fs/fat.c
 fat_mod_CFLAGS = $(COMMON_CFLAGS)

Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v retrieving revision 1.7

powerpc-ieee1275.rmk +2 -2
diff -u -p -u -p -r1.7 powerpc-ieee1275.rmk
@@ -24,7 +24,7 @@ noinst_UTILITIES = genmoddep
 grub_emu_SOURCES = kern/main.c kern/device.c				\
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
         kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
-	disk/powerpc/ieee1275/partition.c 					\
+	disk/powerpc/ieee1275/partition.c fs/fshelp.c			\
 	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c	\
 	fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c	\
 	normal/arg.c	\
@@ -35,7 +35,7 @@ grub_emu_LDFLAGS = -lncurses
 
 grubof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \
 	boot/powerpc/ieee1275/crt0.S kern/main.c kern/device.c \
-	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c fs/fshelp.c \
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
 	kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
 	kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \

Index: fs/ext2.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/ext2.c,v
retrieving revision 1.8

ext2.c +218 -337

737 lines not on this page · raw message

Index: fs/fshelp.c
===================================================================
RCS file: fs/fshelp.c

fshelp.c new file +292 -0

292 lines not on this page · raw message

Index: include/grub/fshelp.h
===================================================================
RCS file: include/grub/fshelp.h

grub/fshelp.h new file +75 -0

75 lines not on this page · raw message

#4 lore raw
Quoted 2 lines · Marco Gerards

So I assume this patch is ok. To be sure, I will wait until Sunday before I commit this patch.

It looks okay to me.

Okuji

#5 lore raw
In reply to Marco Gerards
Quoted 1 line · Marco Gerards

Committed.

Thank you.

Quoted 4 lines

And here is a patch for that.

To avoid code duplication I wrote kern/fshelp.c, which has the following two functions:

That is a good idea, but why are the functions in the kernel? Imagine that GRUB 2 supports TFTP and the user uses GRUB as a network-based loader. Probably the user does not have to compile the helper functions, because network-based filesystems are very different at the implementation level.

So I think they should be in a module rather than the kernel. fshelp.mod sounds good for me.

Okuji

#6 lore raw
Quoted 8 lines · Yoshinori K. Okuji
Quoted 2 lines

To avoid code duplication I wrote kern/fshelp.c, which has the following two functions:

That is a good idea, but why are the functions in the kernel? Imagine that GRUB 2 supports TFTP and the user uses GRUB as a network-based loader. Probably the user does not have to compile the helper functions, because network-based filesystems are very different at the implementation level.

True.

Quoted 2 lines

So I think they should be in a module rather than the kernel. fshelp.mod sounds good for me.

This is a good idea. Is it possible to do this already? How do I make a filesystem depend on fshelp.mod? I assume by using one of its symbols. Is the dependancy code in CVS already?

I will change this and make the changes suggested by Thomas before committing this. I have some ideas to make things more efficient for some kinds of filesystems, I will implemented this as well.

Thanks,
Marco

#7 lore raw
Quoted 6 lines
Quoted 2 lines

So I think they should be in a module rather than the kernel. fshelp.mod sounds good for me.

This is a good idea. Is it possible to do this already? How do I make a filesystem depend on fshelp.mod? I assume by using one of its symbols. Is the dependancy code in CVS already?

Yes it is. It is there all the time since I know grub2.

Signature · 3 lines
                                 Tomas 'ebi' Ebenlendr
                                 http://get.to/ebik
                                 PF 2004.66591204336