![Tejun Heo](/assets/img/avatar_default.png)
Make the following changes to partition check code. * Add ->bdev to struct parsed_partitions. * Introduce read_part_sector() which is a simple wrapper around read_dev_sector() which takes struct parsed_partitions *state instead of @bdev. * For functions which used to take @state and @bdev, drop @bdev. For functions which used to take @bdev, replace it with @state. * While updating, drop superflous checks on NULL state/bdev in ldm.c. This cleans up the API a bit and enables better handling of IO errors during partition check as the generic partition check code now has much better visibility into what went wrong in the low level code paths. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ben Hutchings <ben@decadent.org.uk> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
/*
|
|
* fs/partitions/ultrix.c
|
|
*
|
|
* Code extracted from drivers/block/genhd.c
|
|
*
|
|
* Re-organised Jul 1999 Russell King
|
|
*/
|
|
|
|
#include "check.h"
|
|
#include "ultrix.h"
|
|
|
|
int ultrix_partition(struct parsed_partitions *state)
|
|
{
|
|
int i;
|
|
Sector sect;
|
|
unsigned char *data;
|
|
struct ultrix_disklabel {
|
|
s32 pt_magic; /* magic no. indicating part. info exits */
|
|
s32 pt_valid; /* set by driver if pt is current */
|
|
struct pt_info {
|
|
s32 pi_nblocks; /* no. of sectors */
|
|
u32 pi_blkoff; /* block offset for start */
|
|
} pt_part[8];
|
|
} *label;
|
|
|
|
#define PT_MAGIC 0x032957 /* Partition magic number */
|
|
#define PT_VALID 1 /* Indicates if struct is valid */
|
|
|
|
data = read_part_sector(state, (16384 - sizeof(*label))/512, §);
|
|
if (!data)
|
|
return -1;
|
|
|
|
label = (struct ultrix_disklabel *)(data + 512 - sizeof(*label));
|
|
|
|
if (label->pt_magic == PT_MAGIC && label->pt_valid == PT_VALID) {
|
|
for (i=0; i<8; i++)
|
|
if (label->pt_part[i].pi_nblocks)
|
|
put_partition(state, i+1,
|
|
label->pt_part[i].pi_blkoff,
|
|
label->pt_part[i].pi_nblocks);
|
|
put_dev_sector(sect);
|
|
printk ("\n");
|
|
return 1;
|
|
} else {
|
|
put_dev_sector(sect);
|
|
return 0;
|
|
}
|
|
}
|