ia64/xen-unstable

changeset 17814:db466cd3412c

libfsimage: make pygrub work on ufs
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 09 15:06:26 2008 +0100 (2008-06-09)
parents adf05a812edb
children 09dd5492651c
files tools/libfsimage/ufs/fsys_ufs.c
line diff
     1.1 --- a/tools/libfsimage/ufs/fsys_ufs.c	Mon Jun 09 15:05:18 2008 +0100
     1.2 +++ b/tools/libfsimage/ufs/fsys_ufs.c	Mon Jun 09 15:06:26 2008 +0100
     1.3 @@ -32,8 +32,9 @@
     1.4  #define SUPERBLOCK ((struct fs *)(FSYS_BUF + 0x2000))
     1.5  #define	INODE ((struct icommon *)(FSYS_BUF + 0x1000))
     1.6  #define DIRENT (FSYS_BUF + 0x4000)
     1.7 +#define MAXBSIZE ((FSYS_BUFLEN - 0x4000) / 2)
     1.8  #define INDIRBLK1 ((grub_daddr32_t *)(FSYS_BUF + 0x4000)) /* 2+ indir blk */
     1.9 -#define	INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x6000))  /* 1st indirect blk */
    1.10 +#define	INDIRBLK0 ((grub_daddr32_t *)(FSYS_BUF+ 0x4000 + MAXBSIZE))  /* 1st indirect blk */
    1.11  
    1.12  #define	indirblk0 (*fsig_int1(ffi))
    1.13  #define	indirblk1 (*fsig_int2(ffi))
    1.14 @@ -48,7 +49,8 @@ ufs_mount(fsi_file_t *ffi, const char *o
    1.15  {
    1.16  	if (/*! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || */
    1.17  	    !devread(ffi, UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) ||
    1.18 -	    SUPERBLOCK->fs_magic != UFS_MAGIC)
    1.19 +	    SUPERBLOCK->fs_magic != UFS_MAGIC ||
    1.20 +	    MAXBSIZE < SUPERBLOCK->fs_bsize)
    1.21  		return 0;
    1.22  
    1.23  	return 1;