* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)
* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)
This commit is contained in:
@@ -103,11 +103,10 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(CONFIG_MAC_PARTITION) || \
|
||||
defined(CONFIG_DOS_PARTITION) || \
|
||||
defined(CONFIG_ISO_PARTITION) || \
|
||||
defined(CONFIG_AMIGA_PARTITION)
|
||||
defined(CONFIG_AMIGA_PARTITION)
|
||||
|
||||
void init_part (block_dev_desc_t * dev_desc)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Hans-Joerg Frieden, Hyperion Entertainment
|
||||
* Hans-Joerg Frieden, Hyperion Entertainment
|
||||
* Hans-JoergF@hyperion-entertainment.com
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -72,7 +72,7 @@ static void bstr_print(char *string)
|
||||
int len = *string++;
|
||||
char buffer[256];
|
||||
int i;
|
||||
|
||||
|
||||
i = 0;
|
||||
while (len)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ int sum_block(struct block_header *header)
|
||||
|
||||
for (i = 0; i < header->summed_longs; i++)
|
||||
sum += *block++;
|
||||
|
||||
|
||||
return (sum != 0);
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ static void print_disk_type(u32 disk_type)
|
||||
static void print_part_info(struct partition_block *p)
|
||||
{
|
||||
struct amiga_part_geometry *g;
|
||||
|
||||
|
||||
g = (struct amiga_part_geometry *)&(p->environment);
|
||||
|
||||
bstr_print(p->drive_name);
|
||||
printf("%6d\t%6d\t",
|
||||
g->low_cyl * g->block_per_track * g->surfaces ,
|
||||
printf("%6d\t%6d\t",
|
||||
g->low_cyl * g->block_per_track * g->surfaces ,
|
||||
(g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1);
|
||||
print_disk_type(g->dos_type);
|
||||
printf("\t%5d\n", g->boot_priority);
|
||||
@@ -178,7 +178,7 @@ struct rigid_disk_block *get_rdisk(block_dev_desc_t *dev_desc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Search for boot code
|
||||
* Again, the first boot block must be located somewhere in the first 16 blocks, or rooted in the
|
||||
* Ridgid disk block
|
||||
@@ -221,7 +221,7 @@ struct bootcode_block *get_bootcode(block_dev_desc_t *dev_desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Test if the given partition has an Amiga partition table/Rigid
|
||||
* Disk block
|
||||
*/
|
||||
@@ -231,7 +231,7 @@ int test_part_amiga(block_dev_desc_t *dev_desc)
|
||||
struct bootcode_block *bootcode;
|
||||
|
||||
PRINTF("test_part_amiga: Testing for an Amiga RDB partition\n");
|
||||
|
||||
|
||||
rdb = get_rdisk(dev_desc);
|
||||
if (rdb)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ int test_part_amiga(block_dev_desc_t *dev_desc)
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
PRINTF("test_part_amiga: no RDB found\n");
|
||||
return -1;
|
||||
@@ -251,7 +251,7 @@ int test_part_amiga(block_dev_desc_t *dev_desc)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Find partition number partnum on the given drive.
|
||||
*/
|
||||
static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int partnum)
|
||||
@@ -262,12 +262,12 @@ static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int pa
|
||||
|
||||
PRINTF("Trying to find partition block %d\n", partnum);
|
||||
rdb = get_rdisk(dev_desc);
|
||||
if (!rdb)
|
||||
if (!rdb)
|
||||
{
|
||||
PRINTF("find_partition: no rdb found\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PRINTF("find_partition: Scanning partition list\n");
|
||||
|
||||
block = rdb->partition_list;
|
||||
@@ -286,7 +286,7 @@ static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int pa
|
||||
if (sum_block((struct block_header *)p) == 0)
|
||||
{
|
||||
if (partnum == 0) break;
|
||||
else
|
||||
else
|
||||
{
|
||||
partnum--;
|
||||
block = p->next;
|
||||
@@ -296,7 +296,7 @@ static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int pa
|
||||
} else block = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
if (block == 0xFFFFFFFF)
|
||||
if (block == 0xFFFFFFFF)
|
||||
{
|
||||
PRINTF("PART block not found\n");
|
||||
return NULL;
|
||||
@@ -305,7 +305,7 @@ static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int pa
|
||||
return (struct partition_block *)block_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Get info about a partition
|
||||
*/
|
||||
int get_partition_info_amiga (block_dev_desc_t *dev_desc, int part, disk_partition_t *info)
|
||||
@@ -321,7 +321,7 @@ int get_partition_info_amiga (block_dev_desc_t *dev_desc, int part, disk_partiti
|
||||
info->size = (g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1;
|
||||
info->blksz = rdb.block_bytes;
|
||||
bcpl_strcpy(info->name, p->drive_name);
|
||||
|
||||
|
||||
|
||||
disk_type = g->dos_type;
|
||||
|
||||
@@ -331,12 +331,12 @@ int get_partition_info_amiga (block_dev_desc_t *dev_desc, int part, disk_partiti
|
||||
info->type[3] = '\\';
|
||||
info->type[4] = (disk_type & 0x000000FF) + '0';
|
||||
info->type[5] = 0;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_part_amiga (block_dev_desc_t *dev_desc)
|
||||
{
|
||||
{
|
||||
struct rigid_disk_block *rdb;
|
||||
struct bootcode_block *boot;
|
||||
struct partition_block *p;
|
||||
@@ -344,12 +344,12 @@ void print_part_amiga (block_dev_desc_t *dev_desc)
|
||||
int i = 1;
|
||||
|
||||
rdb = get_rdisk(dev_desc);
|
||||
if (!rdb)
|
||||
if (!rdb)
|
||||
{
|
||||
PRINTF("print_part_amiga: no rdb found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PRINTF("print_part_amiga: Scanning partition list\n");
|
||||
|
||||
block = rdb->partition_list;
|
||||
@@ -370,7 +370,7 @@ void print_part_amiga (block_dev_desc_t *dev_desc)
|
||||
ulong res;
|
||||
|
||||
PRINTF("Trying to load block #0x%X\n", block);
|
||||
|
||||
|
||||
res = dev_desc->block_read(dev_desc->dev, block, 1,
|
||||
(ulong *)block_buffer);
|
||||
if (res == 1)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
* "RigidDiskBlock".
|
||||
*/
|
||||
|
||||
struct rigid_disk_block
|
||||
struct rigid_disk_block
|
||||
{
|
||||
u32 id;
|
||||
u32 summed_longs;
|
||||
@@ -57,7 +57,7 @@ struct rigid_disk_block
|
||||
u32 drive_init;
|
||||
u32 bootcode_block;
|
||||
u32 reserved_1[5];
|
||||
|
||||
|
||||
/* Physical drive geometry */
|
||||
u32 cylinders;
|
||||
u32 sectors;
|
||||
@@ -79,14 +79,14 @@ struct rigid_disk_block
|
||||
u32 auto_park_seconds;
|
||||
u32 high_rdsk_block;
|
||||
u32 reserved_4;
|
||||
|
||||
|
||||
char disk_vendor[8];
|
||||
char disk_product[16];
|
||||
char disk_revision[4];
|
||||
char controller_vendor[8];
|
||||
char controller_product[16];
|
||||
char controller_revision[4];
|
||||
|
||||
|
||||
u32 reserved_5[10];
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ struct rigid_disk_block
|
||||
* Each partition on this drive is defined by such a block
|
||||
*/
|
||||
|
||||
struct partition_block
|
||||
struct partition_block
|
||||
{
|
||||
u32 id;
|
||||
u32 summed_longs;
|
||||
@@ -110,7 +110,7 @@ struct partition_block
|
||||
u32 reserved_3[15];
|
||||
};
|
||||
|
||||
struct bootcode_block
|
||||
struct bootcode_block
|
||||
{
|
||||
u32 id;
|
||||
u32 summed_longs;
|
||||
@@ -125,12 +125,12 @@ struct bootcode_block
|
||||
#define AMIGA_ID_PART 0x50415254
|
||||
#define AMIGA_ID_BOOT 0x424f4f54
|
||||
|
||||
/*
|
||||
/*
|
||||
* The environment array in the partition block
|
||||
* describes the partition
|
||||
*/
|
||||
|
||||
struct amiga_part_geometry
|
||||
struct amiga_part_geometry
|
||||
{
|
||||
u32 table_size;
|
||||
u32 size_blocks;
|
||||
|
||||
@@ -67,7 +67,6 @@ static void print_one_part (dos_partition_t *p, int ext_part_sector, int part_nu
|
||||
}
|
||||
|
||||
|
||||
|
||||
int test_part_dos (block_dev_desc_t *dev_desc)
|
||||
{
|
||||
unsigned char buffer[DEFAULT_SECTOR_SIZE];
|
||||
@@ -75,7 +74,7 @@ int test_part_dos (block_dev_desc_t *dev_desc)
|
||||
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) ||
|
||||
(buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
|
||||
(buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
|
||||
return (-1);
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -106,7 +105,7 @@ static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_s
|
||||
pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
|
||||
for (i = 0; i < 4; i++, pt++) {
|
||||
/*
|
||||
* fdisk does not show the extended partitions that
|
||||
* fdisk does not show the extended partitions that
|
||||
* are not in the MBR
|
||||
*/
|
||||
|
||||
@@ -166,8 +165,8 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
|
||||
pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
|
||||
for (i = 0; i < 4; i++, pt++) {
|
||||
/*
|
||||
* fdisk does not show the extended partitions that
|
||||
* are not in the MBR
|
||||
* fdisk does not show the extended partitions that
|
||||
* are not in the MBR
|
||||
*/
|
||||
if ((pt->sys_ind != 0) &&
|
||||
(part_num == which_part) &&
|
||||
@@ -231,5 +230,4 @@ int get_partition_info_dos (block_dev_desc_t *dev_desc, int part, disk_partition
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_IDE) && CONFIG_DOS_PARTITION */
|
||||
|
||||
@@ -230,7 +230,6 @@ int get_partition_info_iso(block_dev_desc_t * dev_desc, int part_num, disk_parti
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_part_iso(block_dev_desc_t * dev_desc)
|
||||
{
|
||||
disk_partition_t info;
|
||||
|
||||
@@ -127,8 +127,6 @@ typedef struct iso_part_rec {
|
||||
}iso_part_rec_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct iso_val_entry {
|
||||
unsigned char header_id; /* Header ID must be 0x01 */
|
||||
unsigned char platform; /* Platform: 0=x86, 1=PowerPC, 2=MAC */
|
||||
@@ -159,13 +157,4 @@ typedef struct iso_init_def_entry {
|
||||
|
||||
void print_partition_cd(int dev);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _PART_CD_H */
|
||||
|
||||
|
||||
|
||||
@@ -190,9 +190,9 @@ static int part_mac_read_pdb (block_dev_desc_t *dev_desc, int part, mac_partitio
|
||||
|
||||
for (;;) {
|
||||
/*
|
||||
* We must always read the descritpor block for
|
||||
* partition 1 first since this is the only way to
|
||||
* know how many partitions we have.
|
||||
* We must always read the descritpor block for
|
||||
* partition 1 first since this is the only way to
|
||||
* know how many partitions we have.
|
||||
*/
|
||||
if (dev_desc->block_read (dev_desc->dev, n, 1, (ulong *)pdb_p) != 1) {
|
||||
printf ("** Can't read Partition Map on %d:%d **\n",
|
||||
|
||||
@@ -90,7 +90,7 @@ typedef struct mac_partition {
|
||||
uchar processor[16]; /* Type of Processor */
|
||||
__u16 part_pad[188]; /* reserved */
|
||||
#ifdef CONFIG_ISO_PARTITION
|
||||
uchar iso_dummy[2048];/* Reservere enough room for an ISO partition block to fit */
|
||||
uchar iso_dummy[2048];/* Reservere enough room for an ISO partition block to fit */
|
||||
#endif
|
||||
} mac_partition_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user