Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196875
b: refs/heads/master
c: 1493bf2
h: refs/heads/master
i:
  196873: d033e49
  196871: b29eed4
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed May 21, 2010
1 parent bf36a00 commit ffbf4f7
Show file tree
Hide file tree
Showing 31 changed files with 226 additions and 240 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3e33e043f5e9c583aa59d5591a614b2a8243d3a
refs/heads/master: 1493bf217f7f59a5d9e2095a7dbcec00fb36ca8b
68 changes: 32 additions & 36 deletions trunk/fs/partitions/acorn.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ struct riscix_record {

#if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
defined(CONFIG_ACORN_PARTITION_ADFS)
static int
riscix_partition(struct parsed_partitions *state, struct block_device *bdev,
unsigned long first_sect, int slot, unsigned long nr_sects)
static int riscix_partition(struct parsed_partitions *state,
unsigned long first_sect, int slot,
unsigned long nr_sects)
{
Sector sect;
struct riscix_record *rr;

rr = (struct riscix_record *)read_dev_sector(bdev, first_sect, &sect);
rr = read_part_sector(state, first_sect, &sect);
if (!rr)
return -1;

Expand Down Expand Up @@ -123,9 +123,9 @@ struct linux_part {

#if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
defined(CONFIG_ACORN_PARTITION_ADFS)
static int
linux_partition(struct parsed_partitions *state, struct block_device *bdev,
unsigned long first_sect, int slot, unsigned long nr_sects)
static int linux_partition(struct parsed_partitions *state,
unsigned long first_sect, int slot,
unsigned long nr_sects)
{
Sector sect;
struct linux_part *linuxp;
Expand All @@ -135,7 +135,7 @@ linux_partition(struct parsed_partitions *state, struct block_device *bdev,

put_partition(state, slot++, first_sect, size);

linuxp = (struct linux_part *)read_dev_sector(bdev, first_sect, &sect);
linuxp = read_part_sector(state, first_sect, &sect);
if (!linuxp)
return -1;

Expand All @@ -157,8 +157,7 @@ linux_partition(struct parsed_partitions *state, struct block_device *bdev,
#endif

#ifdef CONFIG_ACORN_PARTITION_CUMANA
int
adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev)
int adfspart_check_CUMANA(struct parsed_partitions *state)
{
unsigned long first_sector = 0;
unsigned int start_blk = 0;
Expand All @@ -185,7 +184,7 @@ adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev
struct adfs_discrecord *dr;
unsigned int nr_sects;

data = read_dev_sector(bdev, start_blk * 2 + 6, &sect);
data = read_part_sector(state, start_blk * 2 + 6, &sect);
if (!data)
return -1;

Expand Down Expand Up @@ -217,14 +216,14 @@ adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev
#ifdef CONFIG_ACORN_PARTITION_RISCIX
case PARTITION_RISCIX_SCSI:
/* RISCiX - we don't know how to find the next one. */
slot = riscix_partition(state, bdev, first_sector,
slot, nr_sects);
slot = riscix_partition(state, first_sector, slot,
nr_sects);
break;
#endif

case PARTITION_LINUX:
slot = linux_partition(state, bdev, first_sector,
slot, nr_sects);
slot = linux_partition(state, first_sector, slot,
nr_sects);
break;
}
put_dev_sector(sect);
Expand All @@ -249,8 +248,7 @@ adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev
* hda1 = ADFS partition on first drive.
* hda2 = non-ADFS partition.
*/
int
adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev)
int adfspart_check_ADFS(struct parsed_partitions *state)
{
unsigned long start_sect, nr_sects, sectscyl, heads;
Sector sect;
Expand All @@ -259,7 +257,7 @@ adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev)
unsigned char id;
int slot = 1;

data = read_dev_sector(bdev, 6, &sect);
data = read_part_sector(state, 6, &sect);
if (!data)
return -1;

Expand All @@ -278,21 +276,21 @@ adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev)
/*
* Work out start of non-adfs partition.
*/
nr_sects = (bdev->bd_inode->i_size >> 9) - start_sect;
nr_sects = (state->bdev->bd_inode->i_size >> 9) - start_sect;

if (start_sect) {
switch (id) {
#ifdef CONFIG_ACORN_PARTITION_RISCIX
case PARTITION_RISCIX_SCSI:
case PARTITION_RISCIX_MFM:
slot = riscix_partition(state, bdev, start_sect,
slot, nr_sects);
slot = riscix_partition(state, start_sect, slot,
nr_sects);
break;
#endif

case PARTITION_LINUX:
slot = linux_partition(state, bdev, start_sect,
slot, nr_sects);
slot = linux_partition(state, start_sect, slot,
nr_sects);
break;
}
}
Expand All @@ -308,10 +306,11 @@ struct ics_part {
__le32 size;
};

static int adfspart_check_ICSLinux(struct block_device *bdev, unsigned long block)
static int adfspart_check_ICSLinux(struct parsed_partitions *state,
unsigned long block)
{
Sector sect;
unsigned char *data = read_dev_sector(bdev, block, &sect);
unsigned char *data = read_part_sector(state, block, &sect);
int result = 0;

if (data) {
Expand Down Expand Up @@ -349,8 +348,7 @@ static inline int valid_ics_sector(const unsigned char *data)
* hda2 = ADFS partition 1 on first drive.
* ..etc..
*/
int
adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev)
int adfspart_check_ICS(struct parsed_partitions *state)
{
const unsigned char *data;
const struct ics_part *p;
Expand All @@ -360,7 +358,7 @@ adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev)
/*
* Try ICS style partitions - sector 0 contains partition info.
*/
data = read_dev_sector(bdev, 0, &sect);
data = read_part_sector(state, 0, &sect);
if (!data)
return -1;

Expand Down Expand Up @@ -392,7 +390,7 @@ adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev)
* partition is. We must not make this visible
* to the filesystem.
*/
if (size > 1 && adfspart_check_ICSLinux(bdev, start)) {
if (size > 1 && adfspart_check_ICSLinux(state, start)) {
start += 1;
size -= 1;
}
Expand Down Expand Up @@ -446,16 +444,15 @@ static inline int valid_ptec_sector(const unsigned char *data)
* hda2 = ADFS partition 1 on first drive.
* ..etc..
*/
int
adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev)
int adfspart_check_POWERTEC(struct parsed_partitions *state)
{
Sector sect;
const unsigned char *data;
const struct ptec_part *p;
int slot = 1;
int i;

data = read_dev_sector(bdev, 0, &sect);
data = read_part_sector(state, 0, &sect);
if (!data)
return -1;

Expand Down Expand Up @@ -508,8 +505,7 @@ static const char eesox_name[] = {
* 1. The individual ADFS boot block entries that are placed on the disk.
* 2. The start address of the next entry.
*/
int
adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev)
int adfspart_check_EESOX(struct parsed_partitions *state)
{
Sector sect;
const unsigned char *data;
Expand All @@ -518,7 +514,7 @@ adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev)
sector_t start = 0;
int i, slot = 1;

data = read_dev_sector(bdev, 7, &sect);
data = read_part_sector(state, 7, &sect);
if (!data)
return -1;

Expand All @@ -545,7 +541,7 @@ adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev)
if (i != 0) {
sector_t size;

size = get_capacity(bdev->bd_disk);
size = get_capacity(state->bdev->bd_disk);
put_partition(state, slot++, start, size - start);
printk("\n");
}
Expand Down
10 changes: 5 additions & 5 deletions trunk/fs/partitions/acorn.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* format, and everyone stick to it?
*/

int adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev);
int adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev);
int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev);
int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev);
int adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev);
int adfspart_check_CUMANA(struct parsed_partitions *state);
int adfspart_check_ADFS(struct parsed_partitions *state);
int adfspart_check_ICS(struct parsed_partitions *state);
int adfspart_check_POWERTEC(struct parsed_partitions *state);
int adfspart_check_EESOX(struct parsed_partitions *state);
13 changes: 6 additions & 7 deletions trunk/fs/partitions/amiga.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ checksum_block(__be32 *m, int size)
return sum;
}

int
amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
int amiga_partition(struct parsed_partitions *state)
{
Sector sect;
unsigned char *data;
Expand All @@ -38,11 +37,11 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
for (blk = 0; ; blk++, put_dev_sector(sect)) {
if (blk == RDB_ALLOCATION_LIMIT)
goto rdb_done;
data = read_dev_sector(bdev, blk, &sect);
data = read_part_sector(state, blk, &sect);
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read RDB block %d\n",
bdevname(bdev, b), blk);
bdevname(state->bdev, b), blk);
res = -1;
goto rdb_done;
}
Expand All @@ -64,7 +63,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
}

printk("Dev %s: RDB in block %d has bad checksum\n",
bdevname(bdev, b), blk);
bdevname(state->bdev, b), blk);
}

/* blksize is blocks per 512 byte standard block */
Expand All @@ -75,11 +74,11 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
put_dev_sector(sect);
for (part = 1; blk>0 && part<=16; part++, put_dev_sector(sect)) {
blk *= blksize; /* Read in terms partition table understands */
data = read_dev_sector(bdev, blk, &sect);
data = read_part_sector(state, blk, &sect);
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read partition block %d\n",
bdevname(bdev, b), blk);
bdevname(state->bdev, b), blk);
res = -1;
goto rdb_done;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/partitions/amiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
* fs/partitions/amiga.h
*/

int amiga_partition(struct parsed_partitions *state, struct block_device *bdev);
int amiga_partition(struct parsed_partitions *state);

8 changes: 4 additions & 4 deletions trunk/fs/partitions/atari.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline int OK_id(char *s)
memcmp (s, "RAW", 3) == 0 ;
}

int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
int atari_partition(struct parsed_partitions *state)
{
Sector sect;
struct rootsector *rs;
Expand All @@ -42,12 +42,12 @@ int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
int part_fmt = 0; /* 0:unknown, 1:AHDI, 2:ICD/Supra */
#endif

rs = (struct rootsector *) read_dev_sector(bdev, 0, &sect);
rs = read_part_sector(state, 0, &sect);
if (!rs)
return -1;

/* Verify this is an Atari rootsector: */
hd_size = bdev->bd_inode->i_size >> 9;
hd_size = state->bdev->bd_inode->i_size >> 9;
if (!VALID_PARTITION(&rs->part[0], hd_size) &&
!VALID_PARTITION(&rs->part[1], hd_size) &&
!VALID_PARTITION(&rs->part[2], hd_size) &&
Expand Down Expand Up @@ -84,7 +84,7 @@ int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
printk(" XGM<");
partsect = extensect = be32_to_cpu(pi->st);
while (1) {
xrs = (struct rootsector *)read_dev_sector(bdev, partsect, &sect2);
xrs = read_part_sector(state, partsect, &sect2);
if (!xrs) {
printk (" block %ld read failed\n", partsect);
put_dev_sector(sect);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/partitions/atari.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ struct rootsector
u16 checksum; /* checksum for bootable disks */
} __attribute__((__packed__));

int atari_partition(struct parsed_partitions *state, struct block_device *bdev);
int atari_partition(struct parsed_partitions *state);
5 changes: 3 additions & 2 deletions trunk/fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern void md_autodetect_dev(dev_t dev);

int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/

static int (*check_part[])(struct parsed_partitions *, struct block_device *) = {
static int (*check_part[])(struct parsed_partitions *) = {
/*
* Probe partition formats with tables at disk address 0
* that also have an ADFS boot block at 0xdc0.
Expand Down Expand Up @@ -165,6 +165,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
if (!state)
return NULL;

state->bdev = bdev;
disk_name(hd, 0, state->name);
printk(KERN_INFO " %s:", state->name);
if (isdigit(state->name[strlen(state->name)-1]))
Expand All @@ -174,7 +175,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
i = res = err = 0;
while (!res && check_part[i]) {
memset(&state->parts, 0, sizeof(state->parts));
res = check_part[i++](state, bdev);
res = check_part[i++](state);
if (res < 0) {
/* We have hit an I/O error which we don't report now.
* But record it, and let the others do their job.
Expand Down
7 changes: 7 additions & 0 deletions trunk/fs/partitions/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* description.
*/
struct parsed_partitions {
struct block_device *bdev;
char name[BDEVNAME_SIZE];
struct {
sector_t from;
Expand All @@ -16,6 +17,12 @@ struct parsed_partitions {
int limit;
};

static inline void *read_part_sector(struct parsed_partitions *state,
sector_t n, Sector *p)
{
return read_dev_sector(state->bdev, n, p);
}

static inline void
put_partition(struct parsed_partitions *p, int n, sector_t from, sector_t size)
{
Expand Down
Loading

0 comments on commit ffbf4f7

Please sign in to comment.