Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1J6WsN-0007Hc-5S for mharc-grub-devel@gnu.org; Sun, 23 Dec 2007 14:52:43 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J6WsL-0007FY-61 for grub-devel@gnu.org; Sun, 23 Dec 2007 14:52:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J6WsK-0007EE-3b for grub-devel@gnu.org; Sun, 23 Dec 2007 14:52:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6WsK-0007E8-1g for grub-devel@gnu.org; Sun, 23 Dec 2007 14:52:40 -0500 Received: from py-out-1112.google.com ([64.233.166.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J6WsJ-0004Fs-NU for grub-devel@gnu.org; Sun, 23 Dec 2007 14:52:39 -0500 Received: by py-out-1112.google.com with SMTP id a73so2731348pye.14 for ; Sun, 23 Dec 2007 11:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=t4yLMLPcumKMt2SJ4Mfq2ZdmzDWQ41WjsRJJom0XrmM=; b=v17T1ftIFxMFriklDVfduTtWSr2I6hZVG1EjfB9U11xuW75rbVgV/aLYaFTJmpKTP/O0AXEEdpZ0K4/EC9pIqH65ocEe/coaP+1dP9OGm2d9PTyNA0MrRUd5SRihwATYFPW9wHgojhVeVzxVjF6i/LselHmOkF8GBQM1JXIxbio= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=mUpRDbQvwi4ChQtOk/E7GamriwD0y2u+DjEoLzuLaBZOp2EHvvQ10vzvtEoF4CZNVhQCBPi7Xwi1MWwBucDezSOnIasBkLtlosJwLeuPCFsAPGD9n/xHIFeDJCpDCVNND19V5Nhtck44OUQAghFx73P0IFyQFXa8x0/qIek8TKQ= Received: by 10.65.203.3 with SMTP id f3mr6179057qbq.18.1198439557959; Sun, 23 Dec 2007 11:52:37 -0800 (PST) Received: by 10.35.76.20 with HTTP; Sun, 23 Dec 2007 11:52:37 -0800 (PST) Message-ID: Date: Mon, 24 Dec 2007 03:52:37 +0800 From: Bean To: "The development of GRUB 2" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: [PATCH] cpio and tar filesystem X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2007 19:52:41 -0000 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 * 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