summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-08-17 12:18:22 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-08-17 12:18:22 -0400
commita56f1ca1ed63b93eb61fd5319f47347b3eb1e364 (patch)
tree62a253ba44b23c1867cef59fee40b40092719ee1 /firmware/common
parentc13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682 (diff)
downloadrockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.zip
rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.gz
rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.bz2
rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.xz
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
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/dir_uncached.c4
-rw-r--r--firmware/common/dircache.c10
-rw-r--r--firmware/common/disk.c8
-rw-r--r--firmware/common/file.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c
index 14c8522..b850a51 100644
--- a/firmware/common/dir_uncached.c
+++ b/firmware/common/dir_uncached.c
@@ -95,7 +95,7 @@ DIR_UNCACHED* opendir_uncached(const char* name)
strlcpy(namecopy, name, sizeof(namecopy)); /* just copy */
#endif
- if ( fat_opendir(IF_MV2(volume,) &pdir->fatdir, 0, NULL) < 0 ) {
+ if ( fat_opendir(IF_MV(volume,) &pdir->fatdir, 0, NULL) < 0 ) {
DEBUGF("Failed opening root dir\n");
pdir->busy = false;
return NULL;
@@ -122,7 +122,7 @@ DIR_UNCACHED* opendir_uncached(const char* name)
* as the parent directory and the resulting one (this is safe,
* in doubt, check fat_open(dir) code) which will allow this kind of
* (ugly) things */
- if ( fat_opendir(IF_MV2(volume,)
+ if ( fat_opendir(IF_MV(volume,)
&pdir->fatdir,
entry.firstcluster,
&pdir->fatdir) < 0 ) {
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 21ae71f..b53fc4d 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -303,7 +303,7 @@ static int sab_process_dir(unsigned long startcluster, struct dircache_entry *ce
sab.dir->entrycount = 0;
sab.dir->file.firstcluster = 0;
/* open directory */
- int rc = fat_opendir(IF_MV2(sab.volume,) sab.dir, startcluster, sab.dir);
+ int rc = fat_opendir(IF_MV(sab.volume,) sab.dir, startcluster, sab.dir);
if(rc < 0)
{
logf("fat_opendir failed: %d", rc);
@@ -381,7 +381,7 @@ static int sab_process_dir(unsigned long startcluster, struct dircache_entry *ce
/* used during the generation */
static struct fat_dir sab_fat_dir;
-static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce)
+static int dircache_scan_and_build(IF_MV(int volume,) struct dircache_entry *ce)
{
memset(ce, 0, sizeof(struct dircache_entry));
@@ -493,7 +493,7 @@ static int sab_process_dir(struct dircache_entry *ce)
return 0;
}
-static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce)
+static int dircache_scan_and_build(IF_MV(int volume,) struct dircache_entry *ce)
{
#ifdef HAVE_MULTIVOLUME
(void) volume;
@@ -786,9 +786,9 @@ static int dircache_do_rebuild(void)
#endif
cpu_boost(true);
#ifdef HAVE_MULTIVOLUME
- if (dircache_scan_and_build(IF_MV2(i,) append_position) < 0)
+ if (dircache_scan_and_build(IF_MV(i,) append_position) < 0)
#else
- if (dircache_scan_and_build(IF_MV2(0,) root_entry) < 0)
+ if (dircache_scan_and_build(IF_MV(0,) root_entry) < 0)
#endif /* HAVE_MULTIVOLUME */
{
logf("dircache_scan_and_build failed");
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 1a7ddd9..fb6daee 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -90,7 +90,7 @@ struct partinfo* disk_init(IF_MD_NONVOID(int drive))
#endif
unsigned char* sector = fat_get_sector_buffer();
- storage_read_sectors(IF_MD2(drive,) 0,1, sector);
+ storage_read_sectors(IF_MD(drive,) 0,1, sector);
/* check that the boot sector is initialized */
if ( (sector[510] != 0x55) ||
(sector[511] != 0xaa)) {
@@ -210,7 +210,7 @@ int disk_mount(int drive)
for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1)
{
- if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start * j))
+ if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start * j))
{
pinfo[i].start *= j;
pinfo[i].size *= j;
@@ -222,7 +222,7 @@ int disk_mount(int drive)
}
}
#else
- if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start))
+ if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start))
{
mounted++;
vol_drive[volume] = drive; /* remember the drive for this volume */
@@ -234,7 +234,7 @@ int disk_mount(int drive)
if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */
{ /* try "superfloppy" mode */
DEBUGF("No partition found, trying to mount sector 0.\n");
- if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0))
+ if (!fat_mount(IF_MV(volume,) IF_MD(drive,) 0))
{
#ifdef MAX_LOG_SECTOR_SIZE
disk_sector_multiplier[drive] = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE;
diff --git a/firmware/common/file.c b/firmware/common/file.c
index cfebd06..920eada 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -121,7 +121,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
}
long startcluster = _dircache_get_entry_startcluster(ce);
- fat_open(IF_MV2(volume,)
+ fat_open(IF_MV(volume,)
startcluster,
&(file->fatfile),
NULL);
@@ -167,7 +167,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
/* scan dir for name */
while ((entry = readdir_uncached(dir))) {
if ( !strcasecmp(name, entry->d_name) ) {
- fat_open(IF_MV2(dir->fatdir.file.volume,)
+ fat_open(IF_MV(dir->fatdir.file.volume,)
entry->startcluster,
&(file->fatfile),
&(dir->fatdir));