mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC][FAT] Handle MBR on the first sector
@ 2012-09-13 12:13 Franck Jullien
  2012-09-14  7:18 ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Franck Jullien @ 2012-09-13 12:13 UTC (permalink / raw)
  To: barebox

*** Did not send this email with git because it's no working where I am **

We may have some disk with MBR as a first sector. In this case, the
current FAT check returns an error. However, the FAT sector exist and
the MBR can tell us where it is.

This patch make the FAT fs try to find the FAT boot sector on the first
sector of the first partition in case it is not on sector 0.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 fs/fat/ff.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/fs/fat/ff.c b/fs/fat/ff.c
index 66db1d6..6a4ae32 100644
--- a/fs/fat/ff.c
+++ b/fs/fat/ff.c
@@ -191,6 +191,7 @@
 #define	FSI_Nxt_Free		492	/* FSI: Last allocated cluster (4) */
 #define MBR_Table		446	/* MBR: Partition table offset (2) */
 #define	SZ_PTE			16	/* MBR: Size of a partition table entry */
+#define MBR_StartSector		8	/* MBR: Offset of Starting Sector in
Partition Table Entry */
 #define BS_55AA			510	/* Boot sector signature (2) */

 #define	DIR_Name		0	/* Short file name (11) */
@@ -1533,11 +1534,15 @@ int follow_path (	/* 0(0): successful, !=0:
error code */
  */
 static int check_fs (	/* 0:The FAT BR, 1:Valid BR but not an FAT,
2:Not a BR, 3:Disk error */
 	FATFS *fs,	/* File system object */
-	DWORD sect	/* Sector# (lba) to check if it is an FAT boot record or not */
+	DWORD sect,	/* Sector# (lba) to check if it is an FAT boot record or not */
+	DWORD *bootsec
 )
 {
 	int ret;

+	if(bootsec)
+		*bootsec = 0;
+
 	/* Load boot record */
 	ret = disk_read(fs, fs->win, sect, 1);
 	if (ret)
@@ -1553,6 +1558,12 @@ static int check_fs (	/* 0:The FAT BR, 1:Valid
BR but not an FAT, 2:Not a BR, 3:
 	if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
 		return 0;

+	if(bootsec)
+		/* This must be an MBR, so return the starting sector of the
+		 * first partition so we could check if there is a FAT boot
+		 * sector there */
+		*bootsec = LD_WORD(&fs->win[MBR_Table + MBR_StartSector]);
+
 	return -ENODEV;
 }

@@ -1565,6 +1576,7 @@ static int chk_mounted (	/* 0(0): successful,
!=0: any error occurred */
 )
 {
 	BYTE fmt, b;
+	DWORD first_boot_sect;
 	DWORD bsect, fasize, tsect, sysect, nclst, szbfat;
 	WORD nrsv;

@@ -1579,9 +1591,13 @@ static int chk_mounted (	/* 0(0): successful,
!=0: any error occurred */
 		return -EIO;
 #endif
 	/* Search FAT partition on the drive. Supports only generic
partitionings, FDISK and SFD. */
-	fmt = check_fs(fs, bsect = 0);	/* Check sector 0 if it is a VBR */
-	if (fmt)
-		return fmt; /* No FAT volume is found */
+	fmt = check_fs(fs, bsect = 0, &first_boot_sect);	/* Check sector 0
if it is a VBR */
+	if (fmt && first_boot_sect != 0) {
+		/* Sector 0 is an MBR, now check for FAT in the first partition */
+		fmt = check_fs(fs, bsect = first_boot_sect, NULL);
+		if(fmt)
+			return fmt; /* No FAT volume is found */
+	}

 	/* Following code initializes the file system object */

-- 
1.7.1

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-13 12:13 [RFC][FAT] Handle MBR on the first sector Franck Jullien
@ 2012-09-14  7:18 ` Sascha Hauer
  2012-09-14  7:22   ` Franck Jullien
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2012-09-14  7:18 UTC (permalink / raw)
  To: Franck Jullien; +Cc: barebox

Hi Franck,

On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
> *** Did not send this email with git because it's no working where I am **
> 
> We may have some disk with MBR as a first sector. In this case, the
> current FAT check returns an error. However, the FAT sector exist and
> the MBR can tell us where it is.
> 
> This patch make the FAT fs try to find the FAT boot sector on the first
> sector of the first partition in case it is not on sector 0.

The patch looks good. Not applying it because it's RFC, but I would if
you give your ok.

Sascha

> 
> Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
> ---
>  fs/fat/ff.c |   24 ++++++++++++++++++++----
>  1 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/fat/ff.c b/fs/fat/ff.c
> index 66db1d6..6a4ae32 100644
> --- a/fs/fat/ff.c
> +++ b/fs/fat/ff.c
> @@ -191,6 +191,7 @@
>  #define	FSI_Nxt_Free		492	/* FSI: Last allocated cluster (4) */
>  #define MBR_Table		446	/* MBR: Partition table offset (2) */
>  #define	SZ_PTE			16	/* MBR: Size of a partition table entry */
> +#define MBR_StartSector		8	/* MBR: Offset of Starting Sector in
> Partition Table Entry */
>  #define BS_55AA			510	/* Boot sector signature (2) */
> 
>  #define	DIR_Name		0	/* Short file name (11) */
> @@ -1533,11 +1534,15 @@ int follow_path (	/* 0(0): successful, !=0:
> error code */
>   */
>  static int check_fs (	/* 0:The FAT BR, 1:Valid BR but not an FAT,
> 2:Not a BR, 3:Disk error */
>  	FATFS *fs,	/* File system object */
> -	DWORD sect	/* Sector# (lba) to check if it is an FAT boot record or not */
> +	DWORD sect,	/* Sector# (lba) to check if it is an FAT boot record or not */
> +	DWORD *bootsec
>  )
>  {
>  	int ret;
> 
> +	if(bootsec)
> +		*bootsec = 0;
> +
>  	/* Load boot record */
>  	ret = disk_read(fs, fs->win, sect, 1);
>  	if (ret)
> @@ -1553,6 +1558,12 @@ static int check_fs (	/* 0:The FAT BR, 1:Valid
> BR but not an FAT, 2:Not a BR, 3:
>  	if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
>  		return 0;
> 
> +	if(bootsec)
> +		/* This must be an MBR, so return the starting sector of the
> +		 * first partition so we could check if there is a FAT boot
> +		 * sector there */
> +		*bootsec = LD_WORD(&fs->win[MBR_Table + MBR_StartSector]);
> +
>  	return -ENODEV;
>  }
> 
> @@ -1565,6 +1576,7 @@ static int chk_mounted (	/* 0(0): successful,
> !=0: any error occurred */
>  )
>  {
>  	BYTE fmt, b;
> +	DWORD first_boot_sect;
>  	DWORD bsect, fasize, tsect, sysect, nclst, szbfat;
>  	WORD nrsv;
> 
> @@ -1579,9 +1591,13 @@ static int chk_mounted (	/* 0(0): successful,
> !=0: any error occurred */
>  		return -EIO;
>  #endif
>  	/* Search FAT partition on the drive. Supports only generic
> partitionings, FDISK and SFD. */
> -	fmt = check_fs(fs, bsect = 0);	/* Check sector 0 if it is a VBR */
> -	if (fmt)
> -		return fmt; /* No FAT volume is found */
> +	fmt = check_fs(fs, bsect = 0, &first_boot_sect);	/* Check sector 0
> if it is a VBR */
> +	if (fmt && first_boot_sect != 0) {
> +		/* Sector 0 is an MBR, now check for FAT in the first partition */
> +		fmt = check_fs(fs, bsect = first_boot_sect, NULL);
> +		if(fmt)
> +			return fmt; /* No FAT volume is found */
> +	}
> 
>  	/* Following code initializes the file system object */
> 
> -- 
> 1.7.1
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  7:18 ` Sascha Hauer
@ 2012-09-14  7:22   ` Franck Jullien
  2012-09-14  7:25     ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Franck Jullien @ 2012-09-14  7:22 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
> Hi Franck,
>
> On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
>> *** Did not send this email with git because it's no working where I am **
>>
>> We may have some disk with MBR as a first sector. In this case, the
>> current FAT check returns an error. However, the FAT sector exist and
>> the MBR can tell us where it is.
>>
>> This patch make the FAT fs try to find the FAT boot sector on the first
>> sector of the first partition in case it is not on sector 0.
>
> The patch looks good. Not applying it because it's RFC, but I would if
> you give your ok.
>

You have it.

> Sascha
>
>>
>> Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
>> ---
>>  fs/fat/ff.c |   24 ++++++++++++++++++++----
>>  1 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/fat/ff.c b/fs/fat/ff.c
>> index 66db1d6..6a4ae32 100644
>> --- a/fs/fat/ff.c
>> +++ b/fs/fat/ff.c
>> @@ -191,6 +191,7 @@
>>  #define      FSI_Nxt_Free            492     /* FSI: Last allocated cluster (4) */
>>  #define MBR_Table            446     /* MBR: Partition table offset (2) */
>>  #define      SZ_PTE                  16      /* MBR: Size of a partition table entry */
>> +#define MBR_StartSector              8       /* MBR: Offset of Starting Sector in
>> Partition Table Entry */
>>  #define BS_55AA                      510     /* Boot sector signature (2) */
>>
>>  #define      DIR_Name                0       /* Short file name (11) */
>> @@ -1533,11 +1534,15 @@ int follow_path (     /* 0(0): successful, !=0:
>> error code */
>>   */
>>  static int check_fs (        /* 0:The FAT BR, 1:Valid BR but not an FAT,
>> 2:Not a BR, 3:Disk error */
>>       FATFS *fs,      /* File system object */
>> -     DWORD sect      /* Sector# (lba) to check if it is an FAT boot record or not */
>> +     DWORD sect,     /* Sector# (lba) to check if it is an FAT boot record or not */
>> +     DWORD *bootsec
>>  )
>>  {
>>       int ret;
>>
>> +     if(bootsec)
>> +             *bootsec = 0;
>> +
>>       /* Load boot record */
>>       ret = disk_read(fs, fs->win, sect, 1);
>>       if (ret)
>> @@ -1553,6 +1558,12 @@ static int check_fs (  /* 0:The FAT BR, 1:Valid
>> BR but not an FAT, 2:Not a BR, 3:
>>       if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
>>               return 0;
>>
>> +     if(bootsec)
>> +             /* This must be an MBR, so return the starting sector of the
>> +              * first partition so we could check if there is a FAT boot
>> +              * sector there */
>> +             *bootsec = LD_WORD(&fs->win[MBR_Table + MBR_StartSector]);
>> +
>>       return -ENODEV;
>>  }
>>
>> @@ -1565,6 +1576,7 @@ static int chk_mounted (        /* 0(0): successful,
>> !=0: any error occurred */
>>  )
>>  {
>>       BYTE fmt, b;
>> +     DWORD first_boot_sect;
>>       DWORD bsect, fasize, tsect, sysect, nclst, szbfat;
>>       WORD nrsv;
>>
>> @@ -1579,9 +1591,13 @@ static int chk_mounted (       /* 0(0): successful,
>> !=0: any error occurred */
>>               return -EIO;
>>  #endif
>>       /* Search FAT partition on the drive. Supports only generic
>> partitionings, FDISK and SFD. */
>> -     fmt = check_fs(fs, bsect = 0);  /* Check sector 0 if it is a VBR */
>> -     if (fmt)
>> -             return fmt; /* No FAT volume is found */
>> +     fmt = check_fs(fs, bsect = 0, &first_boot_sect);        /* Check sector 0
>> if it is a VBR */
>> +     if (fmt && first_boot_sect != 0) {
>> +             /* Sector 0 is an MBR, now check for FAT in the first partition */
>> +             fmt = check_fs(fs, bsect = first_boot_sect, NULL);
>> +             if(fmt)
>> +                     return fmt; /* No FAT volume is found */
>> +     }
>>
>>       /* Following code initializes the file system object */
>>
>> --
>> 1.7.1
>>
>> _______________________________________________
>> barebox mailing list
>> barebox@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/barebox
>>
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  7:22   ` Franck Jullien
@ 2012-09-14  7:25     ` Sascha Hauer
  2012-09-14  7:44       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2012-09-14  7:25 UTC (permalink / raw)
  To: Franck Jullien; +Cc: barebox

On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
> 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
> > Hi Franck,
> >
> > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
> >> *** Did not send this email with git because it's no working where I am **
> >>
> >> We may have some disk with MBR as a first sector. In this case, the
> >> current FAT check returns an error. However, the FAT sector exist and
> >> the MBR can tell us where it is.
> >>
> >> This patch make the FAT fs try to find the FAT boot sector on the first
> >> sector of the first partition in case it is not on sector 0.
> >
> > The patch looks good. Not applying it because it's RFC, but I would if
> > you give your ok.
> >
> 
> You have it.

Thanks, applied

Sascha

> 
> > Sascha
> >
> >>
> >> Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
> >> ---
> >>  fs/fat/ff.c |   24 ++++++++++++++++++++----
> >>  1 files changed, 20 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/fs/fat/ff.c b/fs/fat/ff.c
> >> index 66db1d6..6a4ae32 100644
> >> --- a/fs/fat/ff.c
> >> +++ b/fs/fat/ff.c
> >> @@ -191,6 +191,7 @@
> >>  #define      FSI_Nxt_Free            492     /* FSI: Last allocated cluster (4) */
> >>  #define MBR_Table            446     /* MBR: Partition table offset (2) */
> >>  #define      SZ_PTE                  16      /* MBR: Size of a partition table entry */
> >> +#define MBR_StartSector              8       /* MBR: Offset of Starting Sector in
> >> Partition Table Entry */
> >>  #define BS_55AA                      510     /* Boot sector signature (2) */
> >>
> >>  #define      DIR_Name                0       /* Short file name (11) */
> >> @@ -1533,11 +1534,15 @@ int follow_path (     /* 0(0): successful, !=0:
> >> error code */
> >>   */
> >>  static int check_fs (        /* 0:The FAT BR, 1:Valid BR but not an FAT,
> >> 2:Not a BR, 3:Disk error */
> >>       FATFS *fs,      /* File system object */
> >> -     DWORD sect      /* Sector# (lba) to check if it is an FAT boot record or not */
> >> +     DWORD sect,     /* Sector# (lba) to check if it is an FAT boot record or not */
> >> +     DWORD *bootsec
> >>  )
> >>  {
> >>       int ret;
> >>
> >> +     if(bootsec)
> >> +             *bootsec = 0;
> >> +
> >>       /* Load boot record */
> >>       ret = disk_read(fs, fs->win, sect, 1);
> >>       if (ret)
> >> @@ -1553,6 +1558,12 @@ static int check_fs (  /* 0:The FAT BR, 1:Valid
> >> BR but not an FAT, 2:Not a BR, 3:
> >>       if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
> >>               return 0;
> >>
> >> +     if(bootsec)
> >> +             /* This must be an MBR, so return the starting sector of the
> >> +              * first partition so we could check if there is a FAT boot
> >> +              * sector there */
> >> +             *bootsec = LD_WORD(&fs->win[MBR_Table + MBR_StartSector]);
> >> +
> >>       return -ENODEV;
> >>  }
> >>
> >> @@ -1565,6 +1576,7 @@ static int chk_mounted (        /* 0(0): successful,
> >> !=0: any error occurred */
> >>  )
> >>  {
> >>       BYTE fmt, b;
> >> +     DWORD first_boot_sect;
> >>       DWORD bsect, fasize, tsect, sysect, nclst, szbfat;
> >>       WORD nrsv;
> >>
> >> @@ -1579,9 +1591,13 @@ static int chk_mounted (       /* 0(0): successful,
> >> !=0: any error occurred */
> >>               return -EIO;
> >>  #endif
> >>       /* Search FAT partition on the drive. Supports only generic
> >> partitionings, FDISK and SFD. */
> >> -     fmt = check_fs(fs, bsect = 0);  /* Check sector 0 if it is a VBR */
> >> -     if (fmt)
> >> -             return fmt; /* No FAT volume is found */
> >> +     fmt = check_fs(fs, bsect = 0, &first_boot_sect);        /* Check sector 0
> >> if it is a VBR */
> >> +     if (fmt && first_boot_sect != 0) {
> >> +             /* Sector 0 is an MBR, now check for FAT in the first partition */
> >> +             fmt = check_fs(fs, bsect = first_boot_sect, NULL);
> >> +             if(fmt)
> >> +                     return fmt; /* No FAT volume is found */
> >> +     }
> >>
> >>       /* Following code initializes the file system object */
> >>
> >> --
> >> 1.7.1
> >>
> >> _______________________________________________
> >> barebox mailing list
> >> barebox@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/barebox
> >>
> >
> > --
> > Pengutronix e.K.                           |                             |
> > Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  7:25     ` Sascha Hauer
@ 2012-09-14  7:44       ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-14  8:47         ` Franck Jullien
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-14  7:44 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox


On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
> 
> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
> > > Hi Franck,
> > >
> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
> > >> *** Did not send this email with git because it's no working where I am **
> > >>
> > >> We may have some disk with MBR as a first sector. In this case, the
> > >> current FAT check returns an error. However, the FAT sector exist and
> > >> the MBR can tell us where it is.
> > >>
> > >> This patch make the FAT fs try to find the FAT boot sector on the first
> > >> sector of the first partition in case it is not on sector 0.
> > >
> > > The patch looks good. Not applying it because it's RFC, but I would if
> > > you give your ok.
> > >
> > 
> > You have it.
> 
> Thanks, applied

Does this work with the fat autodetection

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  7:44       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-14  8:47         ` Franck Jullien
  2012-09-14  8:50           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 10+ messages in thread
From: Franck Jullien @ 2012-09-14  8:47 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>
> On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
>>
>> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
>> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
>> > > Hi Franck,
>> > >
>> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
>> > >> *** Did not send this email with git because it's no working where I am **
>> > >>
>> > >> We may have some disk with MBR as a first sector. In this case, the
>> > >> current FAT check returns an error. However, the FAT sector exist and
>> > >> the MBR can tell us where it is.
>> > >>
>> > >> This patch make the FAT fs try to find the FAT boot sector on the first
>> > >> sector of the first partition in case it is not on sector 0.
>> > >
>> > > The patch looks good. Not applying it because it's RFC, but I would if
>> > > you give your ok.
>> > >
>> >
>> > You have it.
>>
>> Thanks, applied
>
> Does this work with the fat autodetection
>
> Best Regards,
> J.

What do you mean ?

It works when you mount your device as FAT. The FAT fs check is the
first sector is FAT boot sector. If not, it suppose it is an MBR and
the FAT boot sector is in the first partition.

Franck.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  8:47         ` Franck Jullien
@ 2012-09-14  8:50           ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-14  9:02             ` Franck Jullien
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-14  8:50 UTC (permalink / raw)
  To: Franck Jullien; +Cc: barebox


On 10:47 Fri 14 Sep     , Franck Jullien wrote:
> 
> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> >
> > On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
> >>
> >> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
> >> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
> >> > > Hi Franck,
> >> > >
> >> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
> >> > >> *** Did not send this email with git because it's no working where I am **
> >> > >>
> >> > >> We may have some disk with MBR as a first sector. In this case, the
> >> > >> current FAT check returns an error. However, the FAT sector exist and
> >> > >> the MBR can tell us where it is.
> >> > >>
> >> > >> This patch make the FAT fs try to find the FAT boot sector on the first
> >> > >> sector of the first partition in case it is not on sector 0.
> >> > >
> >> > > The patch looks good. Not applying it because it's RFC, but I would if
> >> > > you give your ok.
> >> > >
> >> >
> >> > You have it.
> >>
> >> Thanks, applied
> >
> > Does this work with the fat autodetection
> >
> > Best Regards,
> > J.
> 
> What do you mean ?
> 
> It works when you mount your device as FAT. The FAT fs check is the
> first sector is FAT boot sector. If not, it suppose it is an MBR and
> the FAT boot sector is in the first partition.
check the the next branch

I add the fs detection to do not specify the filesystem type anymore in mount

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  8:50           ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-14  9:02             ` Franck Jullien
  2012-09-14  9:04               ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-14  9:06               ` Franck Jullien
  0 siblings, 2 replies; 10+ messages in thread
From: Franck Jullien @ 2012-09-14  9:02 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>
> On 10:47 Fri 14 Sep     , Franck Jullien wrote:
>>
>> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>> >
>> > On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
>> >>
>> >> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
>> >> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
>> >> > > Hi Franck,
>> >> > >
>> >> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
>> >> > >> *** Did not send this email with git because it's no working where I am **
>> >> > >>
>> >> > >> We may have some disk with MBR as a first sector. In this case, the
>> >> > >> current FAT check returns an error. However, the FAT sector exist and
>> >> > >> the MBR can tell us where it is.
>> >> > >>
>> >> > >> This patch make the FAT fs try to find the FAT boot sector on the first
>> >> > >> sector of the first partition in case it is not on sector 0.
>> >> > >
>> >> > > The patch looks good. Not applying it because it's RFC, but I would if
>> >> > > you give your ok.
>> >> > >
>> >> >
>> >> > You have it.
>> >>
>> >> Thanks, applied
>> >
>> > Does this work with the fat autodetection
>> >
>> > Best Regards,
>> > J.
>>
>> What do you mean ?
>>
>> It works when you mount your device as FAT. The FAT fs check is the
>> first sector is FAT boot sector. If not, it suppose it is an MBR and
>> the FAT boot sector is in the first partition.
> check the the next branch
>
> I add the fs detection to do not specify the filesystem type anymore in mount
>
> Best Regards,
> J.

It won't. We need to check if it is an MBR here too (static int
is_fat(u8 *buf)) ....

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  9:02             ` Franck Jullien
@ 2012-09-14  9:04               ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-14  9:06               ` Franck Jullien
  1 sibling, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-14  9:04 UTC (permalink / raw)
  To: Franck Jullien; +Cc: barebox


On 11:02 Fri 14 Sep     , Franck Jullien wrote:
> 
> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> >
> > On 10:47 Fri 14 Sep     , Franck Jullien wrote:
> >>
> >> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> >> >
> >> > On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
> >> >>
> >> >> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
> >> >> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
> >> >> > > Hi Franck,
> >> >> > >
> >> >> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
> >> >> > >> *** Did not send this email with git because it's no working where I am **
> >> >> > >>
> >> >> > >> We may have some disk with MBR as a first sector. In this case, the
> >> >> > >> current FAT check returns an error. However, the FAT sector exist and
> >> >> > >> the MBR can tell us where it is.
> >> >> > >>
> >> >> > >> This patch make the FAT fs try to find the FAT boot sector on the first
> >> >> > >> sector of the first partition in case it is not on sector 0.
> >> >> > >
> >> >> > > The patch looks good. Not applying it because it's RFC, but I would if
> >> >> > > you give your ok.
> >> >> > >
> >> >> >
> >> >> > You have it.
> >> >>
> >> >> Thanks, applied
> >> >
> >> > Does this work with the fat autodetection
> >> >
> >> > Best Regards,
> >> > J.
> >>
> >> What do you mean ?
> >>
> >> It works when you mount your device as FAT. The FAT fs check is the
> >> first sector is FAT boot sector. If not, it suppose it is an MBR and
> >> the FAT boot sector is in the first partition.
> > check the the next branch
> >
> > I add the fs detection to do not specify the filesystem type anymore in mount
> >
> > Best Regards,
> > J.
> 
> It won't. We need to check if it is an MBR here too (static int
> is_fat(u8 *buf)) ....
please fix it there too

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC][FAT] Handle MBR on the first sector
  2012-09-14  9:02             ` Franck Jullien
  2012-09-14  9:04               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-14  9:06               ` Franck Jullien
  1 sibling, 0 replies; 10+ messages in thread
From: Franck Jullien @ 2012-09-14  9:06 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

2012/9/14 Franck Jullien <franck.jullien@gmail.com>:
> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>>
>> On 10:47 Fri 14 Sep     , Franck Jullien wrote:
>>>
>>> 2012/9/14 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>>> >
>>> > On 09:25 Fri 14 Sep     , Sascha Hauer wrote:
>>> >>
>>> >> On Fri, Sep 14, 2012 at 09:22:07AM +0200, Franck Jullien wrote:
>>> >> > 2012/9/14 Sascha Hauer <s.hauer@pengutronix.de>:
>>> >> > > Hi Franck,
>>> >> > >
>>> >> > > On Thu, Sep 13, 2012 at 02:13:29PM +0200, Franck Jullien wrote:
>>> >> > >> *** Did not send this email with git because it's no working where I am **
>>> >> > >>
>>> >> > >> We may have some disk with MBR as a first sector. In this case, the
>>> >> > >> current FAT check returns an error. However, the FAT sector exist and
>>> >> > >> the MBR can tell us where it is.
>>> >> > >>
>>> >> > >> This patch make the FAT fs try to find the FAT boot sector on the first
>>> >> > >> sector of the first partition in case it is not on sector 0.
>>> >> > >
>>> >> > > The patch looks good. Not applying it because it's RFC, but I would if
>>> >> > > you give your ok.
>>> >> > >
>>> >> >
>>> >> > You have it.
>>> >>
>>> >> Thanks, applied
>>> >
>>> > Does this work with the fat autodetection
>>> >
>>> > Best Regards,
>>> > J.
>>>
>>> What do you mean ?
>>>
>>> It works when you mount your device as FAT. The FAT fs check is the
>>> first sector is FAT boot sector. If not, it suppose it is an MBR and
>>> the FAT boot sector is in the first partition.
>> check the the next branch
>>
>> I add the fs detection to do not specify the filesystem type anymore in mount
>>
>> Best Regards,
>> J.
>
> It won't. We need to check if it is an MBR here too (static int
> is_fat(u8 *buf)) ....

We should factorise the fat type detection code in ff.c than use it in
filetype.c

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-09-14  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13 12:13 [RFC][FAT] Handle MBR on the first sector Franck Jullien
2012-09-14  7:18 ` Sascha Hauer
2012-09-14  7:22   ` Franck Jullien
2012-09-14  7:25     ` Sascha Hauer
2012-09-14  7:44       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-14  8:47         ` Franck Jullien
2012-09-14  8:50           ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-14  9:02             ` Franck Jullien
2012-09-14  9:04               ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-14  9:06               ` Franck Jullien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox