Skip to content

Commit

Permalink
dm: Drop the block_dev_desc_t typedef
Browse files Browse the repository at this point in the history
Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Tested-by: Stephen Warren <[email protected]>
  • Loading branch information
sjg20 committed Mar 14, 2016
1 parent b391d74 commit 4101f68
Show file tree
Hide file tree
Showing 66 changed files with 338 additions and 331 deletions.
2 changes: 1 addition & 1 deletion api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int API_get_timer(va_list ap)
*
* - net: &eth_device struct address from list pointed to by eth_devices
*
* - storage: block_dev_desc_t struct address from &ide_dev_desc[n],
* - storage: struct blk_desc struct address from &ide_dev_desc[n],
* &scsi_dev_desc[n] and similar tables
*
****************************************************************************/
Expand Down
14 changes: 7 additions & 7 deletions api/api_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)

int i;

block_dev_desc_t *dd;
struct blk_desc *dd;

if (first) {
di->cookie = (void *)get_dev(specs[type].name, 0);
Expand Down Expand Up @@ -148,7 +148,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
di->type = specs[type].type;

if (di->cookie != NULL) {
dd = (block_dev_desc_t *)di->cookie;
dd = (struct blk_desc *)di->cookie;
if (dd->type == DEV_TYPE_UNKNOWN) {
debugf("device instance exists, but is not active..");
found = 0;
Expand All @@ -166,9 +166,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)


/*
* returns: ENUM_IDE, ENUM_USB etc. based on block_dev_desc_t
* returns: ENUM_IDE, ENUM_USB etc. based on struct blk_desc
*/
static int dev_stor_type(block_dev_desc_t *dd)
static int dev_stor_type(struct blk_desc *dd)
{
int i, j;

Expand Down Expand Up @@ -308,7 +308,7 @@ int dev_enum_storage(struct device_info *di)
return 0;
}

static int dev_stor_is_valid(int type, block_dev_desc_t *dd)
static int dev_stor_is_valid(int type, struct blk_desc *dd)
{
int i;

Expand All @@ -328,7 +328,7 @@ int dev_open_stor(void *cookie)
if (type == ENUM_MAX)
return API_ENODEV;

if (dev_stor_is_valid(type, (block_dev_desc_t *)cookie))
if (dev_stor_is_valid(type, (struct blk_desc *)cookie))
return 0;

return API_ENODEV;
Expand All @@ -348,7 +348,7 @@ int dev_close_stor(void *cookie)
lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start)
{
int type;
block_dev_desc_t *dd = (block_dev_desc_t *)cookie;
struct blk_desc *dd = (struct blk_desc *)cookie;

if ((type = dev_stor_type(dd)) == ENUM_MAX)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion board/cm5200/fwupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int load_rescue_image(ulong addr)
char dev[7];
char addr_str[16];
char * const argv[6] = { "fatload", "usb", dev, addr_str, nxri, NULL };
block_dev_desc_t *stor_dev = NULL;
struct blk_desc *stor_dev = NULL;
cmd_tbl_t *bcmd;

/* Get name of firmware directory */
Expand Down
4 changes: 2 additions & 2 deletions board/mpl/pip405/README
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ Added files:
Block device changes:
---------------------
To allow the use of dos_part.c, mac_part.c and iso_part.c, the parameter
block_dev_desc will be used when accessing the functions in these files. The block
device descriptor (block_dev_desc) contains a pointer to the read routine of the
blk_desc will be used when accessing the functions in these files. The block
device descriptor (blk_desc) contains a pointer to the read routine of the
device, which will be used to read blocks from the device.
Renamed function ide_print to dev_print and moved it to the file disk/part.c to use
it for IDE ATAPI and SCSI devices.
Expand Down
2 changes: 1 addition & 1 deletion cmd/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
image_header_t *hdr;
#endif
block_dev_desc_t *dev_desc;
struct blk_desc *dev_desc;

#if defined(CONFIG_FIT)
const void *fit_hdr = NULL;
Expand Down
4 changes: 2 additions & 2 deletions cmd/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
int dev, part;
block_dev_desc_t *dev_desc;
struct blk_desc *dev_desc;
disk_partition_t info;

if (argc < 2) {
Expand Down Expand Up @@ -105,7 +105,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
int ret;
unsigned long addr;
unsigned long count;
block_dev_desc_t *dev_desc = NULL;
struct blk_desc *dev_desc = NULL;
disk_partition_t info;
int dev = 0;
int part = 1;
Expand Down
8 changes: 4 additions & 4 deletions cmd/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static bool found_key(const char *str, const char *key)
* @return - zero on success, otherwise error
*
*/
static int set_gpt_info(block_dev_desc_t *dev_desc,
static int set_gpt_info(struct blk_desc *dev_desc,
const char *str_part,
char **str_disk_guid,
disk_partition_t **partitions,
Expand Down Expand Up @@ -328,7 +328,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
return errno;
}

static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
{
int ret;
char *str_disk_guid;
Expand Down Expand Up @@ -356,7 +356,7 @@ static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
return ret;
}

static int gpt_verify(block_dev_desc_t *blk_dev_desc, const char *str_part)
static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part)
{
ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1,
blk_dev_desc->blksz);
Expand Down Expand Up @@ -408,7 +408,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int ret = CMD_RET_SUCCESS;
int dev = 0;
char *ep;
block_dev_desc_t *blk_dev_desc = NULL;
struct blk_desc *blk_dev_desc = NULL;

if (argc < 4 || argc > 5)
return CMD_RET_USAGE;
Expand Down
4 changes: 2 additions & 2 deletions cmd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
int dev;
printf("%3s %12s %s\n", "dev", "blocks", "path");
for (dev = min_dev; dev <= max_dev; dev++) {
block_dev_desc_t *blk_dev;
struct blk_desc *blk_dev;
int ret;

printf("%3d ", dev);
Expand All @@ -92,7 +92,7 @@ static int do_host_dev(cmd_tbl_t *cmdtp, int flag, int argc,
{
int dev;
char *ep;
block_dev_desc_t *blk_dev;
struct blk_desc *blk_dev;
int ret;

if (argc < 1 || argc > 3)
Expand Down
22 changes: 11 additions & 11 deletions cmd/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = {

static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];

block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
struct blk_desc ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
/* ------------------------------------------------------------------------- */

#ifdef CONFIG_IDE_RESET
Expand All @@ -62,7 +62,7 @@ static void ide_reset (void);
#define ide_reset() /* dummy */
#endif

static void ide_ident (block_dev_desc_t *dev_desc);
static void ide_ident(struct blk_desc *dev_desc);
static uchar ide_wait (int dev, ulong t);

#define IDE_TIME_OUT 2000 /* 2 sec timeout */
Expand All @@ -78,8 +78,8 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
#endif

#ifdef CONFIG_ATAPI
static void atapi_inquiry(block_dev_desc_t *dev_desc);
static ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
static void atapi_inquiry(struct blk_desc *dev_desc);
static ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer);
#endif

Expand Down Expand Up @@ -187,7 +187,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (strcmp(argv[1], "read") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
block_dev_desc_t *dev_desc;
struct blk_desc *dev_desc;
ulong n;

#ifdef CONFIG_SYS_64BIT_LBA
Expand Down Expand Up @@ -446,7 +446,7 @@ void ide_init(void)
/* ------------------------------------------------------------------------- */

#ifdef CONFIG_PARTITIONS
block_dev_desc_t *ide_get_dev(int dev)
struct blk_desc *ide_get_dev(int dev)
{
return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL;
}
Expand Down Expand Up @@ -541,7 +541,7 @@ __weak void ide_input_data(int dev, ulong *sect_buf, int words)

/* -------------------------------------------------------------------------
*/
static void ide_ident(block_dev_desc_t *dev_desc)
static void ide_ident(struct blk_desc *dev_desc)
{
unsigned char c;
hd_driveid_t iop;
Expand Down Expand Up @@ -713,7 +713,7 @@ static void ide_ident(block_dev_desc_t *dev_desc)

/* ------------------------------------------------------------------------- */

ulong ide_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer)
{
int device = block_dev->dev;
Expand Down Expand Up @@ -839,7 +839,7 @@ ulong ide_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
/* ------------------------------------------------------------------------- */


ulong ide_write(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
const void *buffer)
{
int device = block_dev->dev;
Expand Down Expand Up @@ -1301,7 +1301,7 @@ unsigned char atapi_issue_autoreq(int device,
}


static void atapi_inquiry(block_dev_desc_t *dev_desc)
static void atapi_inquiry(struct blk_desc *dev_desc)
{
unsigned char ccb[12]; /* Command descriptor block */
unsigned char iobuf[64]; /* temp buf */
Expand Down Expand Up @@ -1394,7 +1394,7 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
#define ATAPI_READ_MAX_BLOCK (ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)

ulong atapi_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer)
{
int device = block_dev->dev;
Expand Down
2 changes: 1 addition & 1 deletion cmd/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
block_dev_desc_t *mmc_dev;
struct blk_desc *mmc_dev;
struct mmc *mmc;

mmc = init_mmc_device(curr_device, false);
Expand Down
8 changes: 4 additions & 4 deletions cmd/part.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
static int do_part_uuid(int argc, char * const argv[])
{
int part;
block_dev_desc_t *dev_desc;
struct blk_desc *dev_desc;
disk_partition_t info;

if (argc < 2)
Expand All @@ -52,7 +52,7 @@ static int do_part_uuid(int argc, char * const argv[])
static int do_part_list(int argc, char * const argv[])
{
int ret;
block_dev_desc_t *desc;
struct blk_desc *desc;
char *var = NULL;
bool bootable = false;
int i;
Expand Down Expand Up @@ -114,7 +114,7 @@ static int do_part_list(int argc, char * const argv[])

static int do_part_start(int argc, char * const argv[])
{
block_dev_desc_t *desc;
struct blk_desc *desc;
disk_partition_t info;
char buf[512] = { 0 };
int part;
Expand Down Expand Up @@ -148,7 +148,7 @@ static int do_part_start(int argc, char * const argv[])

static int do_part_size(int argc, char * const argv[])
{
block_dev_desc_t *desc;
struct blk_desc *desc;
disk_partition_t info;
char buf[512] = { 0 };
int part;
Expand Down
4 changes: 2 additions & 2 deletions cmd/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *ep;
block_dev_desc_t *dev_desc = NULL;
struct blk_desc *dev_desc = NULL;
int dev;
int part = 0;
disk_partition_t part_info;
Expand Down Expand Up @@ -57,7 +57,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
offset = part_info.start;
limit = part_info.size;
} else {
/* Largest address not available in block_dev_desc_t. */
/* Largest address not available in struct blk_desc. */
limit = ~0;
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/reiser.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *filename = "/";
int dev, part;
block_dev_desc_t *dev_desc=NULL;
struct blk_desc *dev_desc = NULL;
disk_partition_t info;

if (argc < 3)
Expand Down Expand Up @@ -82,7 +82,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int dev, part;
ulong addr = 0, filelen;
disk_partition_t info;
block_dev_desc_t *dev_desc = NULL;
struct blk_desc *dev_desc = NULL;
unsigned long count;
char *addr_str;

Expand Down
10 changes: 5 additions & 5 deletions cmd/sata.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#include <sata.h>

static int sata_curr_device = -1;
block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
struct blk_desc sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];

static unsigned long sata_bread(block_dev_desc_t *block_dev, lbaint_t start,
static unsigned long sata_bread(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, void *dst)
{
return sata_read(block_dev->dev, start, blkcnt, dst);
}

static unsigned long sata_bwrite(block_dev_desc_t *block_dev, lbaint_t start,
static unsigned long sata_bwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
return sata_write(block_dev->dev, start, blkcnt, buffer);
Expand All @@ -36,7 +36,7 @@ int __sata_initialize(void)
int i;

for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
memset(&sata_dev_desc[i], 0, sizeof(struct block_dev_desc));
memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
sata_dev_desc[i].if_type = IF_TYPE_SATA;
sata_dev_desc[i].dev = i;
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
Expand Down Expand Up @@ -75,7 +75,7 @@ __weak int __sata_stop(void)
int sata_stop(void) __attribute__((weak, alias("__sata_stop")));

#ifdef CONFIG_PARTITIONS
block_dev_desc_t *sata_get_dev(int dev)
struct blk_desc *sata_get_dev(int dev)
{
return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL;
}
Expand Down
Loading

0 comments on commit 4101f68

Please sign in to comment.