All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpio and tar filesystem
@ 2007-12-23 19:52 Bean
  2007-12-23 20:04 ` Bean
  2007-12-23 21:17 ` Robert Millan
  0 siblings, 2 replies; 7+ messages in thread
From: Bean @ 2007-12-23 19:52 UTC (permalink / raw)
  To: The development of GRUB 2

I write a filesystem driver for cpio and tar archive file. now you can
open the archive with loopback command:

loopback aa (hd0,1)/cpio_file

loopback bb (hd0,1)/tar_file

If you also apply my previous patch on transparent decompression, you
can even open a gzip archive, for example:

loopback aa (hd0,1)/aa.tar.gz

I also fix a serious bug in the loopback device.

Note: I only write code for binary mode cpio and new format tar, text
mode cpio and old format tar is not supported.


2007-12-24  Bean  <bean123ch@gmail.com>

	* conf/common.rmk (pkgdata_MODULES): Add cpio.mod.
	(cpio_mod_SOURCES): New variable.
	(cpio_mod_CFLAGS): Likewise.
	(cpio_mod_LDFLAGS): Likewise.

	* fs/cpio.c: New file.

	* disk/loopback.c (grub_loopback_read): Bug fix.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add cpio.c.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.

	* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Likewise.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.


diff --git a/conf/common.rmk b/conf/common.rmk
index 0e6b81b..f7c8fdb 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -81,7 +81,7 @@ update-grub_DATA += util/grub.d/README
 # Filing systems.
 pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod ntfs.mod		\
 	ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod	\
-	affs.mod sfs.mod hfsplus.mod
+	affs.mod sfs.mod hfsplus.mod cpio.mod

 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -153,6 +153,11 @@ hfsplus_mod_SOURCES = fs/hfsplus.c
 hfsplus_mod_CFLAGS = $(COMMON_CFLAGS)
 hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS)

+# For cpio.mod.
+cpio_mod_SOURCES = fs/cpio.c
+cpio_mod_CFLAGS = $(COMMON_CFLAGS)
+cpio_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # Partition maps.
 pkgdata_MODULES += amiga.mod apple.mod pc.mod sun.mod acorn.mod gpt.mod

diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk
index 305cbe4..397cfbb 100644
--- a/conf/i386-efi.rmk
+++ b/conf/i386-efi.rmk
@@ -51,7 +51,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c
commands/cmp.c 	\
 	disk/loopback.c							\
 	fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c	\
 	fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c	\
-	fs/ntfs.c fs/ntfscomp.c						\
+	fs/ntfs.c fs/ntfscomp.c	fs/cpio.c				\
 	io/gzio.c							\
 	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
 	kern/err.c							\
diff --git a/conf/i386-linuxbios.rmk b/conf/i386-linuxbios.rmk
index 8b98d3b..c33d937 100644
--- a/conf/i386-linuxbios.rmk
+++ b/conf/i386-linuxbios.rmk
@@ -76,7 +76,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c
commands/cmp.c	\
 	disk/host.c disk/loopback.c	disk/raid.c disk/lvm.c		\
 	fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c	\
 	fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c	\
-	fs/ntfs.c fs/ntfscomp.c						\
+	fs/ntfs.c fs/ntfscomp.c	fs/cpio.c				\
 	io/gzio.c							\
 	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
 	kern/err.c							\
diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk
index 8c100d7..8e0f31b 100644
--- a/conf/i386-pc.rmk
+++ b/conf/i386-pc.rmk
@@ -103,7 +103,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c
commands/cmp.c	\
 	disk/host.c disk/loopback.c	disk/raid.c disk/lvm.c		\
 	fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c	\
 	fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c	\
-	fs/ntfs.c fs/ntfscomp.c						\
+	fs/ntfs.c fs/ntfscomp.c	fs/cpio.c				\
 	io/gzio.c							\
 	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
 	kern/err.c							\
diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk
index eb440f1..af0773b 100644
--- a/conf/powerpc-ieee1275.rmk
+++ b/conf/powerpc-ieee1275.rmk
@@ -62,7 +62,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c
commands/cmp.c 	\
 	disk/loopback.c							\
 	fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c	\
 	fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c	\
-	fs/ntfs.c fs/ntfscomp.c						\
+	fs/ntfs.c fs/ntfscomp.c	fs/cpio.c				\
 	io/gzio.c							\
 	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
 	kern/err.c kern/file.c kern/fs.c kern/loader.c kern/main.c	\
diff --git a/disk/loopback.c b/disk/loopback.c
index 9d48def..31d8116 100644
--- a/disk/loopback.c
+++ b/disk/loopback.c
@@ -214,7 +214,7 @@ grub_loopback_read (grub_disk_t disk,
grub_disk_addr_t sector,
   if (pos > file->size)
     {
       grub_size_t amount = pos - file->size;
-      grub_memset (buf + size - amount, 0, amount);
+      grub_memset (buf + (size << GRUB_DISK_SECTOR_BITS) - amount, 0, amount);
     }

   return 0;

-- 
Bean



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-12-26  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-23 19:52 [PATCH] cpio and tar filesystem Bean
2007-12-23 20:04 ` Bean
2007-12-23 21:48   ` Robert Millan
2007-12-24  4:40     ` Bean
2007-12-24 12:59       ` Robert Millan
2007-12-26  7:51         ` Robert Millan
2007-12-23 21:17 ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.