mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
block: store a gendisk in struct parsed_partitions
Partition scanning only happens on the whole device, so pass a struct gendisk instead of the whole device block_device to the scanners. This allows to simplify printing the device name in various places as the disk name is available in disk->name. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Link: https://lore.kernel.org/r/20210810154512.1809898-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
50b4aecfbb
commit
a08aa9bccd
@ -275,7 +275,7 @@ int adfspart_check_ADFS(struct parsed_partitions *state)
|
|||||||
/*
|
/*
|
||||||
* Work out start of non-adfs partition.
|
* Work out start of non-adfs partition.
|
||||||
*/
|
*/
|
||||||
nr_sects = (state->bdev->bd_inode->i_size >> 9) - start_sect;
|
nr_sects = get_capacity(state->disk) - start_sect;
|
||||||
|
|
||||||
if (start_sect) {
|
if (start_sect) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@ -540,7 +540,7 @@ int adfspart_check_EESOX(struct parsed_partitions *state)
|
|||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
sector_t size;
|
sector_t size;
|
||||||
|
|
||||||
size = get_capacity(state->bdev->bd_disk);
|
size = get_capacity(state->disk);
|
||||||
put_partition(state, slot++, start, size - start);
|
put_partition(state, slot++, start, size - start);
|
||||||
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -66,22 +66,6 @@ struct pvd {
|
|||||||
|
|
||||||
#define LVM_MAXLVS 256
|
#define LVM_MAXLVS 256
|
||||||
|
|
||||||
/**
|
|
||||||
* last_lba(): return number of last logical block of device
|
|
||||||
* @bdev: block device
|
|
||||||
*
|
|
||||||
* Description: Returns last LBA value on success, 0 on error.
|
|
||||||
* This is stored (by sd and ide-geometry) in
|
|
||||||
* the part[0] entry for this disk, and is the number of
|
|
||||||
* physical sectors available on the disk.
|
|
||||||
*/
|
|
||||||
static u64 last_lba(struct block_device *bdev)
|
|
||||||
{
|
|
||||||
if (!bdev || !bdev->bd_inode)
|
|
||||||
return 0;
|
|
||||||
return (bdev->bd_inode->i_size >> 9) - 1ULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read_lba(): Read bytes from disk, starting at given LBA
|
* read_lba(): Read bytes from disk, starting at given LBA
|
||||||
* @state
|
* @state
|
||||||
@ -89,7 +73,7 @@ static u64 last_lba(struct block_device *bdev)
|
|||||||
* @buffer
|
* @buffer
|
||||||
* @count
|
* @count
|
||||||
*
|
*
|
||||||
* Description: Reads @count bytes from @state->bdev into @buffer.
|
* Description: Reads @count bytes from @state->disk into @buffer.
|
||||||
* Returns number of bytes read on success, 0 on error.
|
* Returns number of bytes read on success, 0 on error.
|
||||||
*/
|
*/
|
||||||
static size_t read_lba(struct parsed_partitions *state, u64 lba, u8 *buffer,
|
static size_t read_lba(struct parsed_partitions *state, u64 lba, u8 *buffer,
|
||||||
@ -97,7 +81,7 @@ static size_t read_lba(struct parsed_partitions *state, u64 lba, u8 *buffer,
|
|||||||
{
|
{
|
||||||
size_t totalreadcount = 0;
|
size_t totalreadcount = 0;
|
||||||
|
|
||||||
if (!buffer || lba + count / 512 > last_lba(state->bdev))
|
if (!buffer || lba + count / 512 > get_capacity(state->disk) - 1ULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
|
@ -34,7 +34,6 @@ int amiga_partition(struct parsed_partitions *state)
|
|||||||
int start_sect, nr_sects, blk, part, res = 0;
|
int start_sect, nr_sects, blk, part, res = 0;
|
||||||
int blksize = 1; /* Multiplier for disk block size */
|
int blksize = 1; /* Multiplier for disk block size */
|
||||||
int slot = 1;
|
int slot = 1;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
for (blk = 0; ; blk++, put_dev_sector(sect)) {
|
for (blk = 0; ; blk++, put_dev_sector(sect)) {
|
||||||
if (blk == RDB_ALLOCATION_LIMIT)
|
if (blk == RDB_ALLOCATION_LIMIT)
|
||||||
@ -42,7 +41,7 @@ int amiga_partition(struct parsed_partitions *state)
|
|||||||
data = read_part_sector(state, blk, §);
|
data = read_part_sector(state, blk, §);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
pr_err("Dev %s: unable to read RDB block %d\n",
|
pr_err("Dev %s: unable to read RDB block %d\n",
|
||||||
bdevname(state->bdev, b), blk);
|
state->disk->disk_name, blk);
|
||||||
res = -1;
|
res = -1;
|
||||||
goto rdb_done;
|
goto rdb_done;
|
||||||
}
|
}
|
||||||
@ -64,7 +63,7 @@ int amiga_partition(struct parsed_partitions *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pr_err("Dev %s: RDB in block %d has bad checksum\n",
|
pr_err("Dev %s: RDB in block %d has bad checksum\n",
|
||||||
bdevname(state->bdev, b), blk);
|
state->disk->disk_name, blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* blksize is blocks per 512 byte standard block */
|
/* blksize is blocks per 512 byte standard block */
|
||||||
@ -84,7 +83,7 @@ int amiga_partition(struct parsed_partitions *state)
|
|||||||
data = read_part_sector(state, blk, §);
|
data = read_part_sector(state, blk, §);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
pr_err("Dev %s: unable to read partition block %d\n",
|
pr_err("Dev %s: unable to read partition block %d\n",
|
||||||
bdevname(state->bdev, b), blk);
|
state->disk->disk_name, blk);
|
||||||
res = -1;
|
res = -1;
|
||||||
goto rdb_done;
|
goto rdb_done;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ int atari_partition(struct parsed_partitions *state)
|
|||||||
* ATARI partition scheme supports 512 lba only. If this is not
|
* ATARI partition scheme supports 512 lba only. If this is not
|
||||||
* the case, bail early to avoid miscalculating hd_size.
|
* the case, bail early to avoid miscalculating hd_size.
|
||||||
*/
|
*/
|
||||||
if (bdev_logical_block_size(state->bdev) != 512)
|
if (queue_logical_block_size(state->disk->queue) != 512)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rs = read_part_sector(state, 0, §);
|
rs = read_part_sector(state, 0, §);
|
||||||
@ -55,7 +55,7 @@ int atari_partition(struct parsed_partitions *state)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Verify this is an Atari rootsector: */
|
/* Verify this is an Atari rootsector: */
|
||||||
hd_size = state->bdev->bd_inode->i_size >> 9;
|
hd_size = get_capacity(state->disk);
|
||||||
if (!VALID_PARTITION(&rs->part[0], hd_size) &&
|
if (!VALID_PARTITION(&rs->part[0], hd_size) &&
|
||||||
!VALID_PARTITION(&rs->part[1], hd_size) &&
|
!VALID_PARTITION(&rs->part[1], hd_size) &&
|
||||||
!VALID_PARTITION(&rs->part[2], hd_size) &&
|
!VALID_PARTITION(&rs->part[2], hd_size) &&
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* description.
|
* description.
|
||||||
*/
|
*/
|
||||||
struct parsed_partitions {
|
struct parsed_partitions {
|
||||||
struct block_device *bdev;
|
struct gendisk *disk;
|
||||||
char name[BDEVNAME_SIZE];
|
char name[BDEVNAME_SIZE];
|
||||||
struct {
|
struct {
|
||||||
sector_t from;
|
sector_t from;
|
||||||
|
@ -380,7 +380,6 @@ static void cmdline_parts_verifier(int slot, struct parsed_partitions *state)
|
|||||||
int cmdline_partition(struct parsed_partitions *state)
|
int cmdline_partition(struct parsed_partitions *state)
|
||||||
{
|
{
|
||||||
sector_t disk_size;
|
sector_t disk_size;
|
||||||
char bdev[BDEVNAME_SIZE];
|
|
||||||
struct cmdline_parts *parts;
|
struct cmdline_parts *parts;
|
||||||
|
|
||||||
if (cmdline) {
|
if (cmdline) {
|
||||||
@ -397,12 +396,11 @@ int cmdline_partition(struct parsed_partitions *state)
|
|||||||
if (!bdev_parts)
|
if (!bdev_parts)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bdevname(state->bdev, bdev);
|
parts = cmdline_parts_find(bdev_parts, state->disk->disk_name);
|
||||||
parts = cmdline_parts_find(bdev_parts, bdev);
|
|
||||||
if (!parts)
|
if (!parts)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
disk_size = get_capacity(state->bdev->bd_disk) << 9;
|
disk_size = get_capacity(state->disk) << 9;
|
||||||
|
|
||||||
cmdline_parts_set(parts, disk_size, state);
|
cmdline_parts_set(parts, disk_size, state);
|
||||||
cmdline_parts_verifier(1, state);
|
cmdline_parts_verifier(1, state);
|
||||||
|
@ -135,7 +135,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd)
|
|||||||
}
|
}
|
||||||
state->pp_buf[0] = '\0';
|
state->pp_buf[0] = '\0';
|
||||||
|
|
||||||
state->bdev = hd->part0;
|
state->disk = hd;
|
||||||
snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name);
|
snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name);
|
||||||
snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
|
snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
|
||||||
if (isdigit(state->name[strlen(state->name)-1]))
|
if (isdigit(state->name[strlen(state->name)-1]))
|
||||||
@ -717,10 +717,10 @@ EXPORT_SYMBOL_GPL(bdev_disk_changed);
|
|||||||
|
|
||||||
void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p)
|
void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = state->bdev->bd_inode->i_mapping;
|
struct address_space *mapping = state->disk->part0->bd_inode->i_mapping;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
|
||||||
if (n >= get_capacity(state->bdev->bd_disk)) {
|
if (n >= get_capacity(state->disk)) {
|
||||||
state->access_beyond_eod = true;
|
state->access_beyond_eod = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -124,19 +124,17 @@ efi_crc32(const void *buf, unsigned long len)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* last_lba(): return number of last logical block of device
|
* last_lba(): return number of last logical block of device
|
||||||
* @bdev: block device
|
* @disk: block device
|
||||||
*
|
*
|
||||||
* Description: Returns last LBA value on success, 0 on error.
|
* Description: Returns last LBA value on success, 0 on error.
|
||||||
* This is stored (by sd and ide-geometry) in
|
* This is stored (by sd and ide-geometry) in
|
||||||
* the part[0] entry for this disk, and is the number of
|
* the part[0] entry for this disk, and is the number of
|
||||||
* physical sectors available on the disk.
|
* physical sectors available on the disk.
|
||||||
*/
|
*/
|
||||||
static u64 last_lba(struct block_device *bdev)
|
static u64 last_lba(struct gendisk *disk)
|
||||||
{
|
{
|
||||||
if (!bdev || !bdev->bd_inode)
|
return div_u64(disk->part0->bd_inode->i_size,
|
||||||
return 0;
|
queue_logical_block_size(disk->queue)) - 1ULL;
|
||||||
return div_u64(bdev->bd_inode->i_size,
|
|
||||||
bdev_logical_block_size(bdev)) - 1ULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int pmbr_part_valid(gpt_mbr_record *part)
|
static inline int pmbr_part_valid(gpt_mbr_record *part)
|
||||||
@ -231,17 +229,17 @@ done:
|
|||||||
* @buffer: destination buffer
|
* @buffer: destination buffer
|
||||||
* @count: bytes to read
|
* @count: bytes to read
|
||||||
*
|
*
|
||||||
* Description: Reads @count bytes from @state->bdev into @buffer.
|
* Description: Reads @count bytes from @state->disk into @buffer.
|
||||||
* Returns number of bytes read on success, 0 on error.
|
* Returns number of bytes read on success, 0 on error.
|
||||||
*/
|
*/
|
||||||
static size_t read_lba(struct parsed_partitions *state,
|
static size_t read_lba(struct parsed_partitions *state,
|
||||||
u64 lba, u8 *buffer, size_t count)
|
u64 lba, u8 *buffer, size_t count)
|
||||||
{
|
{
|
||||||
size_t totalreadcount = 0;
|
size_t totalreadcount = 0;
|
||||||
struct block_device *bdev = state->bdev;
|
sector_t n = lba *
|
||||||
sector_t n = lba * (bdev_logical_block_size(bdev) / 512);
|
(queue_logical_block_size(state->disk->queue) / 512);
|
||||||
|
|
||||||
if (!buffer || lba > last_lba(bdev))
|
if (!buffer || lba > last_lba(state->disk))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
@ -302,14 +300,14 @@ static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state,
|
|||||||
* @lba: the Logical Block Address of the partition table
|
* @lba: the Logical Block Address of the partition table
|
||||||
*
|
*
|
||||||
* Description: returns GPT header on success, NULL on error. Allocates
|
* Description: returns GPT header on success, NULL on error. Allocates
|
||||||
* and fills a GPT header starting at @ from @state->bdev.
|
* and fills a GPT header starting at @ from @state->disk.
|
||||||
* Note: remember to free gpt when finished with it.
|
* Note: remember to free gpt when finished with it.
|
||||||
*/
|
*/
|
||||||
static gpt_header *alloc_read_gpt_header(struct parsed_partitions *state,
|
static gpt_header *alloc_read_gpt_header(struct parsed_partitions *state,
|
||||||
u64 lba)
|
u64 lba)
|
||||||
{
|
{
|
||||||
gpt_header *gpt;
|
gpt_header *gpt;
|
||||||
unsigned ssz = bdev_logical_block_size(state->bdev);
|
unsigned ssz = queue_logical_block_size(state->disk->queue);
|
||||||
|
|
||||||
gpt = kmalloc(ssz, GFP_KERNEL);
|
gpt = kmalloc(ssz, GFP_KERNEL);
|
||||||
if (!gpt)
|
if (!gpt)
|
||||||
@ -356,10 +354,10 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
|
|||||||
|
|
||||||
/* Check the GUID Partition Table header size is too big */
|
/* Check the GUID Partition Table header size is too big */
|
||||||
if (le32_to_cpu((*gpt)->header_size) >
|
if (le32_to_cpu((*gpt)->header_size) >
|
||||||
bdev_logical_block_size(state->bdev)) {
|
queue_logical_block_size(state->disk->queue)) {
|
||||||
pr_debug("GUID Partition Table Header size is too large: %u > %u\n",
|
pr_debug("GUID Partition Table Header size is too large: %u > %u\n",
|
||||||
le32_to_cpu((*gpt)->header_size),
|
le32_to_cpu((*gpt)->header_size),
|
||||||
bdev_logical_block_size(state->bdev));
|
queue_logical_block_size(state->disk->queue));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +393,7 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
|
|||||||
/* Check the first_usable_lba and last_usable_lba are
|
/* Check the first_usable_lba and last_usable_lba are
|
||||||
* within the disk.
|
* within the disk.
|
||||||
*/
|
*/
|
||||||
lastlba = last_lba(state->bdev);
|
lastlba = last_lba(state->disk);
|
||||||
if (le64_to_cpu((*gpt)->first_usable_lba) > lastlba) {
|
if (le64_to_cpu((*gpt)->first_usable_lba) > lastlba) {
|
||||||
pr_debug("GPT: first_usable_lba incorrect: %lld > %lld\n",
|
pr_debug("GPT: first_usable_lba incorrect: %lld > %lld\n",
|
||||||
(unsigned long long)le64_to_cpu((*gpt)->first_usable_lba),
|
(unsigned long long)le64_to_cpu((*gpt)->first_usable_lba),
|
||||||
@ -587,13 +585,13 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
|
|||||||
gpt_header *pgpt = NULL, *agpt = NULL;
|
gpt_header *pgpt = NULL, *agpt = NULL;
|
||||||
gpt_entry *pptes = NULL, *aptes = NULL;
|
gpt_entry *pptes = NULL, *aptes = NULL;
|
||||||
legacy_mbr *legacymbr;
|
legacy_mbr *legacymbr;
|
||||||
sector_t total_sectors = i_size_read(state->bdev->bd_inode) >> 9;
|
sector_t total_sectors = get_capacity(state->disk);
|
||||||
u64 lastlba;
|
u64 lastlba;
|
||||||
|
|
||||||
if (!ptes)
|
if (!ptes)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lastlba = last_lba(state->bdev);
|
lastlba = last_lba(state->disk);
|
||||||
if (!force_gpt) {
|
if (!force_gpt) {
|
||||||
/* This will be added to the EFI Spec. per Intel after v1.02. */
|
/* This will be added to the EFI Spec. per Intel after v1.02. */
|
||||||
legacymbr = kzalloc(sizeof(*legacymbr), GFP_KERNEL);
|
legacymbr = kzalloc(sizeof(*legacymbr), GFP_KERNEL);
|
||||||
@ -705,7 +703,7 @@ int efi_partition(struct parsed_partitions *state)
|
|||||||
gpt_header *gpt = NULL;
|
gpt_header *gpt = NULL;
|
||||||
gpt_entry *ptes = NULL;
|
gpt_entry *ptes = NULL;
|
||||||
u32 i;
|
u32 i;
|
||||||
unsigned ssz = bdev_logical_block_size(state->bdev) / 512;
|
unsigned ssz = queue_logical_block_size(state->disk->queue) / 512;
|
||||||
|
|
||||||
if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
|
if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
|
||||||
kfree(gpt);
|
kfree(gpt);
|
||||||
@ -722,7 +720,7 @@ int efi_partition(struct parsed_partitions *state)
|
|||||||
u64 size = le64_to_cpu(ptes[i].ending_lba) -
|
u64 size = le64_to_cpu(ptes[i].ending_lba) -
|
||||||
le64_to_cpu(ptes[i].starting_lba) + 1ULL;
|
le64_to_cpu(ptes[i].starting_lba) + 1ULL;
|
||||||
|
|
||||||
if (!is_pte_valid(&ptes[i], last_lba(state->bdev)))
|
if (!is_pte_valid(&ptes[i], last_lba(state->disk)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
put_partition(state, i+1, start * ssz, size * ssz);
|
put_partition(state, i+1, start * ssz, size * ssz);
|
||||||
|
@ -290,8 +290,8 @@ static int find_cms1_partitions(struct parsed_partitions *state,
|
|||||||
int ibm_partition(struct parsed_partitions *state)
|
int ibm_partition(struct parsed_partitions *state)
|
||||||
{
|
{
|
||||||
int (*fn)(struct gendisk *disk, dasd_information2_t *info);
|
int (*fn)(struct gendisk *disk, dasd_information2_t *info);
|
||||||
struct block_device *bdev = state->bdev;
|
struct gendisk *disk = state->disk;
|
||||||
struct gendisk *disk = bdev->bd_disk;
|
struct block_device *bdev = disk->part0;
|
||||||
int blocksize, res;
|
int blocksize, res;
|
||||||
loff_t i_size, offset, size;
|
loff_t i_size, offset, size;
|
||||||
dasd_information2_t *info;
|
dasd_information2_t *info;
|
||||||
|
@ -304,7 +304,7 @@ static bool ldm_validate_privheads(struct parsed_partitions *state,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
num_sects = state->bdev->bd_inode->i_size >> 9;
|
num_sects = get_capacity(state->disk);
|
||||||
|
|
||||||
if ((ph[0]->config_start > num_sects) ||
|
if ((ph[0]->config_start > num_sects) ||
|
||||||
((ph[0]->config_start + ph[0]->config_size) > num_sects)) {
|
((ph[0]->config_start + ph[0]->config_size) > num_sects)) {
|
||||||
@ -339,11 +339,11 @@ out:
|
|||||||
/**
|
/**
|
||||||
* ldm_validate_tocblocks - Validate the table of contents and its backups
|
* ldm_validate_tocblocks - Validate the table of contents and its backups
|
||||||
* @state: Partition check state including device holding the LDM Database
|
* @state: Partition check state including device holding the LDM Database
|
||||||
* @base: Offset, into @state->bdev, of the database
|
* @base: Offset, into @state->disk, of the database
|
||||||
* @ldb: Cache of the database structures
|
* @ldb: Cache of the database structures
|
||||||
*
|
*
|
||||||
* Find and compare the four tables of contents of the LDM Database stored on
|
* Find and compare the four tables of contents of the LDM Database stored on
|
||||||
* @state->bdev and return the parsed information into @toc1.
|
* @state->disk and return the parsed information into @toc1.
|
||||||
*
|
*
|
||||||
* The offsets and sizes of the configs are range-checked against a privhead.
|
* The offsets and sizes of the configs are range-checked against a privhead.
|
||||||
*
|
*
|
||||||
@ -486,8 +486,8 @@ out:
|
|||||||
* only likely to happen if the underlying device is strange. If that IS
|
* only likely to happen if the underlying device is strange. If that IS
|
||||||
* the case we should return zero to let someone else try.
|
* the case we should return zero to let someone else try.
|
||||||
*
|
*
|
||||||
* Return: 'true' @state->bdev is a dynamic disk
|
* Return: 'true' @state->disk is a dynamic disk
|
||||||
* 'false' @state->bdev is not a dynamic disk, or an error occurred
|
* 'false' @state->disk is not a dynamic disk, or an error occurred
|
||||||
*/
|
*/
|
||||||
static bool ldm_validate_partition_table(struct parsed_partitions *state)
|
static bool ldm_validate_partition_table(struct parsed_partitions *state)
|
||||||
{
|
{
|
||||||
@ -1340,7 +1340,7 @@ static bool ldm_frag_commit (struct list_head *frags, struct ldmdb *ldb)
|
|||||||
/**
|
/**
|
||||||
* ldm_get_vblks - Read the on-disk database of VBLKs into memory
|
* ldm_get_vblks - Read the on-disk database of VBLKs into memory
|
||||||
* @state: Partition check state including device holding the LDM Database
|
* @state: Partition check state including device holding the LDM Database
|
||||||
* @base: Offset, into @state->bdev, of the database
|
* @base: Offset, into @state->disk, of the database
|
||||||
* @ldb: Cache of the database structures
|
* @ldb: Cache of the database structures
|
||||||
*
|
*
|
||||||
* To use the information from the VBLKs, they need to be read from the disk,
|
* To use the information from the VBLKs, they need to be read from the disk,
|
||||||
@ -1432,10 +1432,10 @@ static void ldm_free_vblks (struct list_head *lh)
|
|||||||
* example, if the device is hda, we would have: hda1: LDM database, hda2, hda3,
|
* example, if the device is hda, we would have: hda1: LDM database, hda2, hda3,
|
||||||
* and so on: the actual data containing partitions.
|
* and so on: the actual data containing partitions.
|
||||||
*
|
*
|
||||||
* Return: 1 Success, @state->bdev is a dynamic disk and we handled it
|
* Return: 1 Success, @state->disk is a dynamic disk and we handled it
|
||||||
* 0 Success, @state->bdev is not a dynamic disk
|
* 0 Success, @state->disk is not a dynamic disk
|
||||||
* -1 An error occurred before enough information had been read
|
* -1 An error occurred before enough information had been read
|
||||||
* Or @state->bdev is a dynamic disk, but it may be corrupted
|
* Or @state->disk is a dynamic disk, but it may be corrupted
|
||||||
*/
|
*/
|
||||||
int ldm_partition(struct parsed_partitions *state)
|
int ldm_partition(struct parsed_partitions *state)
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ int mac_partition(struct parsed_partitions *state)
|
|||||||
}
|
}
|
||||||
#ifdef CONFIG_PPC_PMAC
|
#ifdef CONFIG_PPC_PMAC
|
||||||
if (found_root_goodness)
|
if (found_root_goodness)
|
||||||
note_bootable_part(state->bdev->bd_dev, found_root,
|
note_bootable_part(state->disk->part0->bd_dev, found_root,
|
||||||
found_root_goodness);
|
found_root_goodness);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -135,11 +135,12 @@ static void parse_extended(struct parsed_partitions *state,
|
|||||||
Sector sect;
|
Sector sect;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
sector_t this_sector, this_size;
|
sector_t this_sector, this_size;
|
||||||
sector_t sector_size = bdev_logical_block_size(state->bdev) / 512;
|
sector_t sector_size;
|
||||||
int loopct = 0; /* number of links followed
|
int loopct = 0; /* number of links followed
|
||||||
without finding a data partition */
|
without finding a data partition */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
sector_size = queue_logical_block_size(state->disk->queue) / 512;
|
||||||
this_sector = first_sector;
|
this_sector = first_sector;
|
||||||
this_size = first_size;
|
this_size = first_size;
|
||||||
|
|
||||||
@ -579,7 +580,7 @@ static struct {
|
|||||||
|
|
||||||
int msdos_partition(struct parsed_partitions *state)
|
int msdos_partition(struct parsed_partitions *state)
|
||||||
{
|
{
|
||||||
sector_t sector_size = bdev_logical_block_size(state->bdev) / 512;
|
sector_t sector_size;
|
||||||
Sector sect;
|
Sector sect;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
struct msdos_partition *p;
|
struct msdos_partition *p;
|
||||||
@ -587,6 +588,7 @@ int msdos_partition(struct parsed_partitions *state)
|
|||||||
int slot;
|
int slot;
|
||||||
u32 disksig;
|
u32 disksig;
|
||||||
|
|
||||||
|
sector_size = queue_logical_block_size(state->disk->queue) / 512;
|
||||||
data = read_part_sector(state, 0, §);
|
data = read_part_sector(state, 0, §);
|
||||||
if (!data)
|
if (!data)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -43,7 +43,6 @@ int sgi_partition(struct parsed_partitions *state)
|
|||||||
Sector sect;
|
Sector sect;
|
||||||
struct sgi_disklabel *label;
|
struct sgi_disklabel *label;
|
||||||
struct sgi_partition *p;
|
struct sgi_partition *p;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
label = read_part_sector(state, 0, §);
|
label = read_part_sector(state, 0, §);
|
||||||
if (!label)
|
if (!label)
|
||||||
@ -52,7 +51,7 @@ int sgi_partition(struct parsed_partitions *state)
|
|||||||
magic = label->magic_mushroom;
|
magic = label->magic_mushroom;
|
||||||
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
|
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
|
||||||
/*printk("Dev %s SGI disklabel: bad magic %08x\n",
|
/*printk("Dev %s SGI disklabel: bad magic %08x\n",
|
||||||
bdevname(bdev, b), be32_to_cpu(magic));*/
|
state->disk->disk_name, be32_to_cpu(magic));*/
|
||||||
put_dev_sector(sect);
|
put_dev_sector(sect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -63,7 +62,7 @@ int sgi_partition(struct parsed_partitions *state)
|
|||||||
}
|
}
|
||||||
if(csum) {
|
if(csum) {
|
||||||
printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n",
|
printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n",
|
||||||
bdevname(state->bdev, b));
|
state->disk->disk_name);
|
||||||
put_dev_sector(sect);
|
put_dev_sector(sect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ int sun_partition(struct parsed_partitions *state)
|
|||||||
} * label;
|
} * label;
|
||||||
struct sun_partition *p;
|
struct sun_partition *p;
|
||||||
unsigned long spc;
|
unsigned long spc;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
int use_vtoc;
|
int use_vtoc;
|
||||||
int nparts;
|
int nparts;
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ int sun_partition(struct parsed_partitions *state)
|
|||||||
p = label->partitions;
|
p = label->partitions;
|
||||||
if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
|
if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
|
||||||
/* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
|
/* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
|
||||||
bdevname(bdev, b), be16_to_cpu(label->magic)); */
|
state->disk->disk_name, be16_to_cpu(label->magic)); */
|
||||||
put_dev_sector(sect);
|
put_dev_sector(sect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -86,7 +85,7 @@ int sun_partition(struct parsed_partitions *state)
|
|||||||
csum ^= *ush--;
|
csum ^= *ush--;
|
||||||
if (csum) {
|
if (csum) {
|
||||||
printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
|
printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
|
||||||
bdevname(state->bdev, b));
|
state->disk->disk_name);
|
||||||
put_dev_sector(sect);
|
put_dev_sector(sect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user