diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
commit | a56f1ca1ed63b93eb61fd5319f47347b3eb1e364 (patch) | |
tree | 62a253ba44b23c1867cef59fee40b40092719ee1 /firmware/common | |
parent | c13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682 (diff) | |
download | rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.gz rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.zip |
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.c | 4 | ||||
-rw-r--r-- | firmware/common/dircache.c | 10 | ||||
-rw-r--r-- | firmware/common/disk.c | 8 | ||||
-rw-r--r-- | firmware/common/file.c | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index 14c8522822..b850a514e7 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c | |||
@@ -95,7 +95,7 @@ DIR_UNCACHED* opendir_uncached(const char* name) | |||
95 | strlcpy(namecopy, name, sizeof(namecopy)); /* just copy */ | 95 | strlcpy(namecopy, name, sizeof(namecopy)); /* just copy */ |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | if ( fat_opendir(IF_MV2(volume,) &pdir->fatdir, 0, NULL) < 0 ) { | 98 | if ( fat_opendir(IF_MV(volume,) &pdir->fatdir, 0, NULL) < 0 ) { |
99 | DEBUGF("Failed opening root dir\n"); | 99 | DEBUGF("Failed opening root dir\n"); |
100 | pdir->busy = false; | 100 | pdir->busy = false; |
101 | return NULL; | 101 | return NULL; |
@@ -122,7 +122,7 @@ DIR_UNCACHED* opendir_uncached(const char* name) | |||
122 | * as the parent directory and the resulting one (this is safe, | 122 | * as the parent directory and the resulting one (this is safe, |
123 | * in doubt, check fat_open(dir) code) which will allow this kind of | 123 | * in doubt, check fat_open(dir) code) which will allow this kind of |
124 | * (ugly) things */ | 124 | * (ugly) things */ |
125 | if ( fat_opendir(IF_MV2(volume,) | 125 | if ( fat_opendir(IF_MV(volume,) |
126 | &pdir->fatdir, | 126 | &pdir->fatdir, |
127 | entry.firstcluster, | 127 | entry.firstcluster, |
128 | &pdir->fatdir) < 0 ) { | 128 | &pdir->fatdir) < 0 ) { |
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 21ae71fd5d..b53fc4d7a6 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 | |||
303 | sab.dir->entrycount = 0; | 303 | sab.dir->entrycount = 0; |
304 | sab.dir->file.firstcluster = 0; | 304 | sab.dir->file.firstcluster = 0; |
305 | /* open directory */ | 305 | /* open directory */ |
306 | int rc = fat_opendir(IF_MV2(sab.volume,) sab.dir, startcluster, sab.dir); | 306 | int rc = fat_opendir(IF_MV(sab.volume,) sab.dir, startcluster, sab.dir); |
307 | if(rc < 0) | 307 | if(rc < 0) |
308 | { | 308 | { |
309 | logf("fat_opendir failed: %d", rc); | 309 | logf("fat_opendir failed: %d", rc); |
@@ -381,7 +381,7 @@ static int sab_process_dir(unsigned long startcluster, struct dircache_entry *ce | |||
381 | /* used during the generation */ | 381 | /* used during the generation */ |
382 | static struct fat_dir sab_fat_dir; | 382 | static struct fat_dir sab_fat_dir; |
383 | 383 | ||
384 | static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce) | 384 | static int dircache_scan_and_build(IF_MV(int volume,) struct dircache_entry *ce) |
385 | { | 385 | { |
386 | memset(ce, 0, sizeof(struct dircache_entry)); | 386 | memset(ce, 0, sizeof(struct dircache_entry)); |
387 | 387 | ||
@@ -493,7 +493,7 @@ static int sab_process_dir(struct dircache_entry *ce) | |||
493 | return 0; | 493 | return 0; |
494 | } | 494 | } |
495 | 495 | ||
496 | static int dircache_scan_and_build(IF_MV2(int volume,) struct dircache_entry *ce) | 496 | static int dircache_scan_and_build(IF_MV(int volume,) struct dircache_entry *ce) |
497 | { | 497 | { |
498 | #ifdef HAVE_MULTIVOLUME | 498 | #ifdef HAVE_MULTIVOLUME |
499 | (void) volume; | 499 | (void) volume; |
@@ -786,9 +786,9 @@ static int dircache_do_rebuild(void) | |||
786 | #endif | 786 | #endif |
787 | cpu_boost(true); | 787 | cpu_boost(true); |
788 | #ifdef HAVE_MULTIVOLUME | 788 | #ifdef HAVE_MULTIVOLUME |
789 | if (dircache_scan_and_build(IF_MV2(i,) append_position) < 0) | 789 | if (dircache_scan_and_build(IF_MV(i,) append_position) < 0) |
790 | #else | 790 | #else |
791 | if (dircache_scan_and_build(IF_MV2(0,) root_entry) < 0) | 791 | if (dircache_scan_and_build(IF_MV(0,) root_entry) < 0) |
792 | #endif /* HAVE_MULTIVOLUME */ | 792 | #endif /* HAVE_MULTIVOLUME */ |
793 | { | 793 | { |
794 | logf("dircache_scan_and_build failed"); | 794 | logf("dircache_scan_and_build failed"); |
diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 1a7ddd9eb4..fb6daee174 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c | |||
@@ -90,7 +90,7 @@ struct partinfo* disk_init(IF_MD_NONVOID(int drive)) | |||
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | unsigned char* sector = fat_get_sector_buffer(); | 92 | unsigned char* sector = fat_get_sector_buffer(); |
93 | storage_read_sectors(IF_MD2(drive,) 0,1, sector); | 93 | storage_read_sectors(IF_MD(drive,) 0,1, sector); |
94 | /* check that the boot sector is initialized */ | 94 | /* check that the boot sector is initialized */ |
95 | if ( (sector[510] != 0x55) || | 95 | if ( (sector[510] != 0x55) || |
96 | (sector[511] != 0xaa)) { | 96 | (sector[511] != 0xaa)) { |
@@ -210,7 +210,7 @@ int disk_mount(int drive) | |||
210 | 210 | ||
211 | for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1) | 211 | for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1) |
212 | { | 212 | { |
213 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start * j)) | 213 | if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start * j)) |
214 | { | 214 | { |
215 | pinfo[i].start *= j; | 215 | pinfo[i].start *= j; |
216 | pinfo[i].size *= j; | 216 | pinfo[i].size *= j; |
@@ -222,7 +222,7 @@ int disk_mount(int drive) | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | #else | 224 | #else |
225 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start)) | 225 | if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start)) |
226 | { | 226 | { |
227 | mounted++; | 227 | mounted++; |
228 | vol_drive[volume] = drive; /* remember the drive for this volume */ | 228 | vol_drive[volume] = drive; /* remember the drive for this volume */ |
@@ -234,7 +234,7 @@ int disk_mount(int drive) | |||
234 | if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ | 234 | if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ |
235 | { /* try "superfloppy" mode */ | 235 | { /* try "superfloppy" mode */ |
236 | DEBUGF("No partition found, trying to mount sector 0.\n"); | 236 | DEBUGF("No partition found, trying to mount sector 0.\n"); |
237 | if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) | 237 | if (!fat_mount(IF_MV(volume,) IF_MD(drive,) 0)) |
238 | { | 238 | { |
239 | #ifdef MAX_LOG_SECTOR_SIZE | 239 | #ifdef MAX_LOG_SECTOR_SIZE |
240 | disk_sector_multiplier[drive] = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE; | 240 | 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 cfebd0622f..920eada84e 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) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | long startcluster = _dircache_get_entry_startcluster(ce); | 123 | long startcluster = _dircache_get_entry_startcluster(ce); |
124 | fat_open(IF_MV2(volume,) | 124 | fat_open(IF_MV(volume,) |
125 | startcluster, | 125 | startcluster, |
126 | &(file->fatfile), | 126 | &(file->fatfile), |
127 | NULL); | 127 | NULL); |
@@ -167,7 +167,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache) | |||
167 | /* scan dir for name */ | 167 | /* scan dir for name */ |
168 | while ((entry = readdir_uncached(dir))) { | 168 | while ((entry = readdir_uncached(dir))) { |
169 | if ( !strcasecmp(name, entry->d_name) ) { | 169 | if ( !strcasecmp(name, entry->d_name) ) { |
170 | fat_open(IF_MV2(dir->fatdir.file.volume,) | 170 | fat_open(IF_MV(dir->fatdir.file.volume,) |
171 | entry->startcluster, | 171 | entry->startcluster, |
172 | &(file->fatfile), | 172 | &(file->fatfile), |
173 | &(dir->fatdir)); | 173 | &(dir->fatdir)); |