Cleanup MV/MD macros a little.

When using variadic macros there's no need for IF_MD2/IF_MV2 to deal
with function parameters. IF_MD/IF_MV are enough.

Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0
if not.

Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
This commit is contained in:
Michael Sevakis 2013-08-17 12:18:22 -04:00
parent c13f21a4d5
commit a56f1ca1ed
44 changed files with 219 additions and 218 deletions

View file

@ -126,8 +126,8 @@ void GIO2(void)
#define VFAT_SECTOR_SIZE(x) ( (x)/0x8000 ) /* 1GB array requires 80kB of RAM */
extern int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
extern int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);
extern int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
extern int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
struct main_header
{
@ -396,14 +396,14 @@ static inline unsigned long map_sector(unsigned long sector)
return cfs_start+sectors[sector/64]*64+sector%64;
}
int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf)
int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf)
{
if(!cfs_inited)
cfs_init();
/* Check if count is lesser than or equal to 1 native CFS sector */
if(count <= 64)
return _ata_read_sectors(IF_MD2(drive,) map_sector(start), count, buf);
return _ata_read_sectors(IF_MD(drive,) map_sector(start), count, buf);
else
{
int i;
@ -412,7 +412,7 @@ int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* bu
/* Read sectors in parts of 0x8000 */
for(i=0; i<count; i+=64)
{
int ret = _ata_read_sectors(IF_MD2(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (void*)dest);
int ret = _ata_read_sectors(IF_MD(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (void*)dest);
if(ret != 0)
return ret;
@ -423,7 +423,7 @@ int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* bu
}
}
int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf)
int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf)
{
if(!cfs_inited)
cfs_init();
@ -431,7 +431,7 @@ int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const v
#if 0 /* Disabled for now */
/* Check if count is lesser than or equal to 1 native CFS sector */
if(count <= 64)
return _ata_write_sectors(IF_MD2(drive,) map_sector(start), count, buf);
return _ata_write_sectors(IF_MD(drive,) map_sector(start), count, buf);
else
{
int i, ret;
@ -440,7 +440,7 @@ int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const v
/* Read sectors in parts of 0x8000 */
for(i=0; i<count; i+=64)
{
ret = _ata_write_sectors(IF_MD2(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (const void*)dest);
ret = _ata_write_sectors(IF_MD(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (const void*)dest);
if(ret != 0)
return ret;