Christoph Egger
2008-Jun-09 13:59 UTC
[Xen-devel] [PATCH][TOOLS] libfsimage: make pygrub work on ufs
Hi! Attached patch makes pygrub work on ufs. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2008-Jun-09 15:50 UTC
Re: [Xen-devel] [PATCH][TOOLS] libfsimage: make pygrub work on ufs
On Mon, Jun 09, 2008 at 03:59:45PM +0200, Christoph Egger wrote:> Attached patch makes pygrub work on ufs.> @@ -32,8 +32,9 @@ > #define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) > #define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) > #define DIRENT (FSYS_BUF + 0x4000) > +#define MAXBSIZE ((FSYS_BUFLEN - 0x4000) / 2) > #define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indir blk */ > -#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1st indirect blk */ > +#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x4000 + MAXBSIZE)) /* 1st indirect blk */This is a no-op, right? I''m not sure why you made this change?> #define indirblk0 (*fsig_int1(ffi)) > #define indirblk1 (*fsig_int2(ffi)) > @@ -48,7 +49,8 @@ ufs_mount(fsi_file_t *ffi, const char *o > { > if (/*! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || */ > !devread(ffi, UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) || > - SUPERBLOCK->fs_magic != UFS_MAGIC) > + SUPERBLOCK->fs_magic != UFS_MAGIC || > + MAXBSIZE < SUPERBLOCK->fs_bsize) > return 0;And all this does is make the mount checks stricter? regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christoph Egger
2008-Jun-10 08:24 UTC
Re: [Xen-devel] [PATCH][TOOLS] libfsimage: make pygrub work on ufs
On Monday 09 June 2008 17:50:33 John Levon wrote:> On Mon, Jun 09, 2008 at 03:59:45PM +0200, Christoph Egger wrote: > > Attached patch makes pygrub work on ufs. > > > > @@ -32,8 +32,9 @@ > > #define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) > > #define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) > > #define DIRENT (FSYS_BUF + 0x4000) > > +#define MAXBSIZE ((FSYS_BUFLEN - 0x4000) / 2) > > #define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indirblk*/> > -#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1stindirect blk */> > +#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x4000 + MAXBSIZE)) /*1st indirect blk */> > This is a no-op, right?No, FSYS_BUFLEN is used now which wasn''t before.> I''m not sure why you made this change?It deals with differences between UFS implementations such as FFSv1 and FFSv2.> > #define indirblk0 (*fsig_int1(ffi)) > > #define indirblk1 (*fsig_int2(ffi)) > > @@ -48,7 +49,8 @@ ufs_mount(fsi_file_t *ffi, const char *o > > { > > if (/*! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || */ > > !devread(ffi, UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) || > > - SUPERBLOCK->fs_magic != UFS_MAGIC) > > + SUPERBLOCK->fs_magic != UFS_MAGIC || > > + MAXBSIZE < SUPERBLOCK->fs_bsize) > > return 0; > > And all this does is make the mount checks stricter?Right. Christoph -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2008-Jun-10 11:40 UTC
Re: [Xen-devel] [PATCH][TOOLS] libfsimage: make pygrub work on ufs
On Tue, Jun 10, 2008 at 10:24:56AM +0200, Christoph Egger wrote:> > > @@ -32,8 +32,9 @@ > > > #define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) > > > #define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) > > > #define DIRENT (FSYS_BUF + 0x4000) > > > +#define MAXBSIZE ((FSYS_BUFLEN - 0x4000) / 2) > > > #define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indirblk > */ > > > -#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1st > indirect blk */ > > > +#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x4000 + MAXBSIZE)) /* > 1st indirect blk */ > > > > This is a no-op, right? > > No, FSYS_BUFLEN is used now which wasn''t before.Ooops, I mis-read the value of FSYS_BUFLEN. So you need this because indirect blocks don''t fit in the original space available? regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christoph Egger
2008-Jun-10 12:14 UTC
Re: [Xen-devel] [PATCH][TOOLS] libfsimage: make pygrub work on ufs
On Tuesday 10 June 2008 13:40:57 John Levon wrote:> On Tue, Jun 10, 2008 at 10:24:56AM +0200, Christoph Egger wrote: > > > > @@ -32,8 +32,9 @@ > > > > #define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000)) > > > > #define INODE ((struct icommon *)(FSYS_BUF + 0x1000)) > > > > #define DIRENT (FSYS_BUF + 0x4000) > > > > +#define MAXBSIZE ((FSYS_BUFLEN - 0x4000) / 2) > > > > #define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ > > > > indirblk > > > > */ > > > > > > -#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000)) /* 1st > > > > indirect blk */ > > > > > > +#define INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x4000 + MAXBSIZE)) > > > > /* > > > > 1st indirect blk */ > > > > > This is a no-op, right? > > > > No, FSYS_BUFLEN is used now which wasn''t before. > > Ooops, I mis-read the value of FSYS_BUFLEN. So you need this because > indirect blocks don''t fit in the original space available?Yes. Also to reach alternative/other superblocks. Just imagine, the guest crashed and the filesystem wasn''t cleanly unmounted. Christoph -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel