[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Cleanup MV/MD macros a little.
From:       gerrit () rockbox ! org
Date:       2013-08-17 16:24:35
Message-ID: 201308171624.r7HGOZor032428 () giant ! haxx ! se
[Download RAW message or body]

commit a56f1ca1ed63b93eb61fd5319f47347b3eb1e364
Author: Michael Sevakis <jethead71@rockbox.org>
Date:   Sat Aug 17 12:18:22 2013 -0400

    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

diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 265d898..bd8406c 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1424,7 +1424,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
     simplelist_addline(
              "Size: %s", buf);
     unsigned long free;
-    fat_size( IF_MV2(0,) NULL, &free );
+    fat_size( IF_MV(0,) NULL, &free );
     simplelist_addline(
              "Free: %ld MB", free / 1024);
     simplelist_addline(
@@ -1543,7 +1543,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
     simplelist_addline(
              "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024);
     unsigned long free;
-    fat_size( IF_MV2(0,) NULL, &free );
+    fat_size( IF_MV(0,) NULL, &free );
     simplelist_addline(
              "Free: %ld MB", free / 1024);
     simplelist_addline(
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index f4b7543..8445d67 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -160,7 +160,7 @@ static const char* info_getname(int selected_item, void *data,
 #endif
     if (info->new_data)
     {
-        fat_size(IF_MV2(0,) &info->size, &info->free);
+        fat_size(IF_MV(0,) &info->size, &info->free);
 #ifdef HAVE_MULTIVOLUME
         if (fat_ismounted(1))
             fat_size(1, &info->size2, &info->free2);
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));
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index ec04ac1..4b365a5 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -567,7 +567,7 @@ static int ata_transfer_sectors(unsigned long start,
 }
 
 #ifndef MAX_PHYS_SECTOR_SIZE
-int ata_read_sectors(IF_MD2(int drive,)
+int ata_read_sectors(IF_MD(int drive,)
                      unsigned long start,
                      int incount,
                      void* inbuf)
@@ -581,7 +581,7 @@ int ata_read_sectors(IF_MD2(int drive,)
 #endif
 
 #ifndef MAX_PHYS_SECTOR_SIZE
-int ata_write_sectors(IF_MD2(int drive,)
+int ata_write_sectors(IF_MD(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
@@ -623,7 +623,7 @@ static inline int flush_current_sector(void)
                                 sector_cache.data, true);
 }
 
-int ata_read_sectors(IF_MD2(int drive,)
+int ata_read_sectors(IF_MD(int drive,)
                      unsigned long start,
                      int incount,
                      void* inbuf)
@@ -689,7 +689,7 @@ int ata_read_sectors(IF_MD2(int drive,)
     return rc;
 }
 
-int ata_write_sectors(IF_MD2(int drive,)
+int ata_write_sectors(IF_MD(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
@@ -1480,7 +1480,7 @@ int ata_spinup_time(void)
 }
 
 #ifdef STORAGE_GET_INFO
-void ata_get_info(IF_MD2(int drive,)struct storage_info *info)
+void ata_get_info(IF_MD(int drive,)struct storage_info *info)
 {
     unsigned short *src,*dest;
     static char vendor[8];
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
index 2d31b41..de2988b 100644
--- a/firmware/drivers/ata_flash.c
+++ b/firmware/drivers/ata_flash.c
@@ -384,7 +384,7 @@ int flash_disk_read_sectors(unsigned long start,
     return done;
 }
 
-int nand_read_sectors(IF_MD2(int drive,)
+int nand_read_sectors(IF_MD(int drive,)
                      unsigned long start,
                      int incount,
                      void* inbuf)
@@ -401,7 +401,7 @@ int nand_read_sectors(IF_MD2(int drive,)
     return 0;
 }
 
-int nand_write_sectors(IF_MD2(int drive,)
+int nand_write_sectors(IF_MD(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index e22f950..0b8451a 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -189,13 +189,13 @@ static bool initialized = false;
 static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb));
 static int flush_fat(IF_MV_NONVOID(struct bpb* fat_bpb));
 static int bpb_is_sane(IF_MV_NONVOID(struct bpb* fat_bpb));
-static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
+static void *cache_fat_sector(IF_MV(struct bpb* fat_bpb,)
                               long secnum, bool dirty);
 static void create_dos_name(const unsigned char *name, unsigned char *newname);
 static void randomize_dos_name(unsigned char *name);
-static unsigned long find_free_cluster(IF_MV2(struct bpb* fat_bpb,)
+static unsigned long find_free_cluster(IF_MV(struct bpb* fat_bpb,)
                                        unsigned long start);
-static int transfer(IF_MV2(struct bpb* fat_bpb,) unsigned long start,
+static int transfer(IF_MV(struct bpb* fat_bpb,) unsigned long start,
                     long count, char* buf, bool write );
 
 #define FAT_CACHE_SIZE 0x20
@@ -230,7 +230,7 @@ void fat_unlock(void)
 }
 #endif
 
-static long cluster2sec(IF_MV2(struct bpb* fat_bpb,) long cluster)
+static long cluster2sec(IF_MV(struct bpb* fat_bpb,) long cluster)
 {
 #ifndef HAVE_MULTIVOLUME
     struct bpb* fat_bpb = &fat_bpbs[0];
@@ -252,7 +252,7 @@ static long cluster2sec(IF_MV2(struct bpb* fat_bpb,) long \
cluster)  + fat_bpb->firstdatasector;
 }
 
-void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free)
+void fat_size(IF_MV(int volume,) unsigned long* size, unsigned long* free)
 {
 #ifndef HAVE_MULTIVOLUME
     const int volume = 0;
@@ -303,7 +303,7 @@ void fat_init(void)
 
 /* fat_mount_internal is split out of fat_mount() to avoid having both the sector
  * buffer used here and the sector buffer used by update_fsinfo() on stack */
-static int fat_mount_internal(IF_MV2(int volume,) IF_MD2(int drive,) long \
startsector) +static int fat_mount_internal(IF_MV(int volume,) IF_MD(int drive,) long \
startsector)  {
 #ifndef HAVE_MULTIVOLUME
     const int volume = 0;
@@ -318,7 +318,7 @@ static int fat_mount_internal(IF_MV2(int volume,) IF_MD2(int \
drive,) long starts  
     unsigned char* buf = fat_get_sector_buffer();
     /* Read the sector */
-    rc = storage_read_sectors(IF_MD2(drive,) startsector,1,buf);
+    rc = storage_read_sectors(IF_MD(drive,) startsector,1,buf);
     if(rc)
     {
         fat_release_sector_buffer();
@@ -428,7 +428,7 @@ static int fat_mount_internal(IF_MV2(int volume,) IF_MD2(int \
drive,) long starts  { /* FAT32 specific part of BPB */
         fat_bpb->bpb_rootclus  = BYTES2INT32(buf,BPB_ROOTCLUS);
         fat_bpb->bpb_fsinfo    = secmult * BYTES2INT16(buf,BPB_FSINFO);
-        fat_bpb->rootdirsector = cluster2sec(IF_MV2(fat_bpb,)
+        fat_bpb->rootdirsector = cluster2sec(IF_MV(fat_bpb,)
                                              fat_bpb->bpb_rootclus);
     }
 
@@ -450,7 +450,7 @@ static int fat_mount_internal(IF_MV2(int volume,) IF_MD2(int \
drive,) long starts  #endif /* #ifdef HAVE_FAT16SUPPORT */
     {
         /* Read the fsinfo sector */
-        rc = storage_read_sectors(IF_MD2(drive,)
+        rc = storage_read_sectors(IF_MD(drive,)
             startsector + fat_bpb->bpb_fsinfo, 1, buf);
         if (rc < 0)
         {
@@ -493,7 +493,7 @@ int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume))
 }
 #endif
 
-int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector)
+int fat_mount(IF_MV(int volume,) IF_MD(int drive,) long startsector)
 {
 #ifndef HAVE_MULTIVOLUME
     const int volume = 0;
@@ -501,7 +501,7 @@ int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long \
startsector)  struct bpb* fat_bpb = &fat_bpbs[volume];
     int rc;
 
-    rc = fat_mount_internal(IF_MV2(volume,) IF_MD2(drive,) startsector);
+    rc = fat_mount_internal(IF_MV(volume,) IF_MD(drive,) startsector);
 
     if(rc!=0) return rc;
 
@@ -576,7 +576,7 @@ void fat_recalc_free(IF_MV_NONVOID(int volume))
     {
         for (i = 0; i<fat_bpb->fatsize; i++) {
             unsigned int j;
-            uint16_t* fat = cache_fat_sector(IF_MV2(fat_bpb,) i, false);
+            uint16_t* fat = cache_fat_sector(IF_MV(fat_bpb,) i, false);
             for (j = 0; j < CLUSTERS_PER_FAT16_SECTOR; j++) {
                 unsigned int c = i * CLUSTERS_PER_FAT16_SECTOR + j;
                 if ( c > fat_bpb->dataclusters+1 ) /* nr 0 is unused */
@@ -595,7 +595,7 @@ void fat_recalc_free(IF_MV_NONVOID(int volume))
     {
         for (i = 0; i<fat_bpb->fatsize; i++) {
             unsigned int j;
-            uint32_t* fat = cache_fat_sector(IF_MV2(fat_bpb,) i, false);
+            uint32_t* fat = cache_fat_sector(IF_MV(fat_bpb,) i, false);
             for (j = 0; j < CLUSTERS_PER_FAT_SECTOR; j++) {
                 unsigned long c = i * CLUSTERS_PER_FAT_SECTOR + j;
                 if ( c > fat_bpb->dataclusters+1 ) /* nr 0 is unused */
@@ -677,7 +677,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
 #endif
 
     /* Write to the first FAT */
-    rc = storage_write_sectors(IF_MD2(fce->fat_vol->drive,)
+    rc = storage_write_sectors(IF_MD(fce->fat_vol->drive,)
                            secnum, 1,
                            sectorbuf);
     if(rc < 0)
@@ -698,7 +698,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
 #else
         secnum += fat_bpbs[0].fatsize;
 #endif
-        rc = storage_write_sectors(IF_MD2(fce->fat_vol->drive,)
+        rc = storage_write_sectors(IF_MD(fce->fat_vol->drive,)
                                secnum, 1, sectorbuf);
         if(rc < 0)
         {
@@ -712,7 +712,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
 
 /* Note: The returned pointer is only safely valid until the next
          task switch! (Any subsequent ata read/write may yield.) */
-static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
+static void *cache_fat_sector(IF_MV(struct bpb* fat_bpb,)
                               long fatsector, bool dirty)
 {
 #ifndef HAVE_MULTIVOLUME
@@ -744,7 +744,7 @@ static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
     /* Load the sector if it is not cached */
     if(!fce->inuse)
     {
-        rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
+        rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
                               secnum + fat_bpb->startsector,1,
                               sectorbuf);
         if(rc < 0)
@@ -766,7 +766,7 @@ static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
     return sectorbuf;
 }
 
-static unsigned long find_free_cluster(IF_MV2(struct bpb* fat_bpb,)
+static unsigned long find_free_cluster(IF_MV(struct bpb* fat_bpb,)
                                        unsigned long startcluster)
 {
 #ifndef HAVE_MULTIVOLUME
@@ -785,7 +785,7 @@ static unsigned long find_free_cluster(IF_MV2(struct bpb* \
fat_bpb,)  for (i = 0; i<fat_bpb->fatsize; i++) {
             unsigned int j;
             unsigned int nr = (i + sector) % fat_bpb->fatsize;
-            uint16_t* fat = cache_fat_sector(IF_MV2(fat_bpb,) nr, false);
+            uint16_t* fat = cache_fat_sector(IF_MV(fat_bpb,) nr, false);
             if ( !fat )
                 break;
             for (j = 0; j < CLUSTERS_PER_FAT16_SECTOR; j++) {
@@ -813,7 +813,7 @@ static unsigned long find_free_cluster(IF_MV2(struct bpb* \
fat_bpb,)  for (i = 0; i<fat_bpb->fatsize; i++) {
             unsigned int j;
             unsigned long nr = (i + sector) % fat_bpb->fatsize;
-            uint32_t* fat = cache_fat_sector(IF_MV2(fat_bpb,) nr, false);
+            uint32_t* fat = cache_fat_sector(IF_MV(fat_bpb,) nr, false);
             if ( !fat )
                 break;
             for (j = 0; j < CLUSTERS_PER_FAT_SECTOR; j++) {
@@ -837,7 +837,7 @@ static unsigned long find_free_cluster(IF_MV2(struct bpb* \
fat_bpb,)  return 0; /* 0 is an illegal cluster number */
 }
 
-static int update_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned long entry,
+static int update_fat_entry(IF_MV(struct bpb* fat_bpb,) unsigned long entry,
                             unsigned long val)
 {
 #ifndef HAVE_MULTIVOLUME
@@ -860,7 +860,7 @@ static int update_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry,  if ( entry < 2 )
             panicf("Updating reserved FAT entry %ld.\n",entry);
 
-        sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, true);
+        sec = cache_fat_sector(IF_MV(fat_bpb,) sector, true);
         if (!sec)
         {
             DEBUGF( "update_fat_entry() - Could not cache sector %d\n", sector);
@@ -896,7 +896,7 @@ static int update_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry,  if ( entry < 2 )
             panicf("Updating reserved FAT entry %ld.\n",entry);
 
-        sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, true);
+        sec = cache_fat_sector(IF_MV(fat_bpb,) sector, true);
         if (!sec)
         {
             DEBUGF("update_fat_entry() - Could not cache sector %ld\n", sector);
@@ -924,7 +924,7 @@ static int update_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry,  return 0;
 }
 
-static long read_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned long entry)
+static long read_fat_entry(IF_MV(struct bpb* fat_bpb,) unsigned long entry)
 {
 #ifdef HAVE_FAT16SUPPORT
 #ifndef HAVE_MULTIVOLUME
@@ -936,7 +936,7 @@ static long read_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry)  int offset = entry % CLUSTERS_PER_FAT16_SECTOR;
         unsigned short* sec;
 
-        sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, false);
+        sec = cache_fat_sector(IF_MV(fat_bpb,) sector, false);
         if (!sec)
         {
             DEBUGF( "read_fat_entry() - Could not cache sector %d\n", sector);
@@ -952,7 +952,7 @@ static long read_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry)  int offset = entry % CLUSTERS_PER_FAT_SECTOR;
         uint32_t* sec;
 
-        sec = cache_fat_sector(IF_MV2(fat_bpb,) sector, false);
+        sec = cache_fat_sector(IF_MV(fat_bpb,) sector, false);
         if (!sec)
         {
             DEBUGF( "read_fat_entry() - Could not cache sector %ld\n", sector);
@@ -963,7 +963,7 @@ static long read_fat_entry(IF_MV2(struct bpb* fat_bpb,) unsigned \
long entry)  }
 }
 
-static long get_next_cluster(IF_MV2(struct bpb* fat_bpb,) long cluster)
+static long get_next_cluster(IF_MV(struct bpb* fat_bpb,) long cluster)
 {
     long next_cluster;
     long eof_mark = FAT_EOF_MARK;
@@ -979,7 +979,7 @@ static long get_next_cluster(IF_MV2(struct bpb* fat_bpb,) long \
cluster)  return cluster + 1; /* don't use the FAT */
     }
 #endif
-    next_cluster = read_fat_entry(IF_MV2(fat_bpb,) cluster);
+    next_cluster = read_fat_entry(IF_MV(fat_bpb,) cluster);
 
     /* is this last cluster in chain? */
     if ( next_cluster >= eof_mark )
@@ -1003,7 +1003,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
 
     unsigned char* fsinfo = fat_get_sector_buffer();
     /* update fsinfo */
-    rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
+    rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
                           fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo);
     if (rc < 0)
     {
@@ -1017,7 +1017,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
     intptr = (uint32_t*)&(fsinfo[FSINFO_NEXTFREE]);
     *intptr = htole32(fat_bpb->fsinfo.nextfree);
 
-    rc = storage_write_sectors(IF_MD2(fat_bpb->drive,)
+    rc = storage_write_sectors(IF_MD(fat_bpb->drive,)
                            fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo);
     fat_release_sector_buffer();
     if (rc < 0)
@@ -1634,7 +1634,7 @@ static int update_short_entry( struct fat_file* file, long \
size, int attr )  file->firstcluster, file->direntry, size);
 
     /* create a temporary file handle for the dir holding this file */
-    rc = fat_open(IF_MV2(file->volume,) file->dircluster, &dir, NULL);
+    rc = fat_open(IF_MV(file->volume,) file->dircluster, &dir, NULL);
     if (rc < 0)
         return rc * 10 - 1;
 
@@ -1739,7 +1739,7 @@ static int parse_direntry(struct fat_direntry *de, const \
unsigned char *buf)  return 1;
 }
 
-int fat_open(IF_MV2(int volume,)
+int fat_open(IF_MV(int volume,)
              long startcluster,
              struct fat_file *file,
              const struct fat_dir* dir)
@@ -1803,7 +1803,7 @@ static __attribute__((noinline)) int fat_clear_cluster(int \
sector,  int i,rc;
     memset(buf, 0, SECTOR_SIZE);
     for(i = 0;i < (int)fat_bpb->bpb_secperclus;i++) {
-        rc = transfer(IF_MV2(fat_bpb,) sector + i, 1, buf, true );
+        rc = transfer(IF_MV(fat_bpb,) sector + i, 1, buf, true );
         if (rc < 0)
         {
             fat_release_sector_buffer();
@@ -1838,15 +1838,15 @@ int fat_create_dir(const char* name,
         return rc * 10 - 1;
 
     /* Allocate a new cluster for the directory */
-    newdir->file.firstcluster = find_free_cluster(IF_MV2(fat_bpb,)
+    newdir->file.firstcluster = find_free_cluster(IF_MV(fat_bpb,)
                                                   fat_bpb->fsinfo.nextfree);
     if(newdir->file.firstcluster == 0)
         return -1;
 
-    update_fat_entry(IF_MV2(fat_bpb,) newdir->file.firstcluster, FAT_EOF_MARK);
+    update_fat_entry(IF_MV(fat_bpb,) newdir->file.firstcluster, FAT_EOF_MARK);
 
     /* Clear the entire cluster */
-    sector = cluster2sec(IF_MV2(fat_bpb,) newdir->file.firstcluster);
+    sector = cluster2sec(IF_MV(fat_bpb,) newdir->file.firstcluster);
     rc = fat_clear_cluster(sector,fat_bpb);
     if (rc < 0)
         return rc;
@@ -1892,12 +1892,12 @@ int fat_truncate(const struct fat_file *file)
 
     LDEBUGF("fat_truncate(%lx, %lx)\n", file->firstcluster, last);
 
-    for ( last = get_next_cluster(IF_MV2(fat_bpb,) last); last; last = next ) {
-        next = get_next_cluster(IF_MV2(fat_bpb,) last);
-        update_fat_entry(IF_MV2(fat_bpb,) last,0);
+    for ( last = get_next_cluster(IF_MV(fat_bpb,) last); last; last = next ) {
+        next = get_next_cluster(IF_MV(fat_bpb,) last);
+        update_fat_entry(IF_MV(fat_bpb,) last,0);
     }
     if (file->lastcluster)
-        update_fat_entry(IF_MV2(fat_bpb,) file->lastcluster,FAT_EOF_MARK);
+        update_fat_entry(IF_MV(fat_bpb,) file->lastcluster,FAT_EOF_MARK);
 
     return 0;
 }
@@ -1913,7 +1913,7 @@ int fat_closewrite(struct fat_file *file, long size, int attr)
     if (!size) {
         /* empty file */
         if ( file->firstcluster ) {
-            update_fat_entry(IF_MV2(fat_bpb,) file->firstcluster, 0);
+            update_fat_entry(IF_MV(fat_bpb,) file->firstcluster, 0);
             file->firstcluster = 0;
         }
     }
@@ -1938,7 +1938,7 @@ int fat_closewrite(struct fat_file *file, long size, int attr)
         long len;
         long next;
         for ( next = file->firstcluster; next;
-              next = get_next_cluster(IF_MV2(fat_bpb,) next) ) {
+              next = get_next_cluster(IF_MV(fat_bpb,) next) ) {
             LDEBUGF("cluster %ld: %lx\n", count, next);
             count++;
         }
@@ -1965,7 +1965,7 @@ static int free_direntries(struct fat_file* file)
     int rc;
 
     /* create a temporary file handle for the dir holding this file */
-    rc = fat_open(IF_MV2(file->volume,) file->dircluster, &dir, NULL);
+    rc = fat_open(IF_MV(file->volume,) file->dircluster, &dir, NULL);
     if (rc < 0)
         return rc * 10 - 1;
 
@@ -2048,8 +2048,8 @@ int fat_remove(struct fat_file* file)
     LDEBUGF("fat_remove(%lx)\n",last);
 
     while ( last ) {
-        next = get_next_cluster(IF_MV2(fat_bpb,) last);
-        update_fat_entry(IF_MV2(fat_bpb,) last,0);
+        next = get_next_cluster(IF_MV(fat_bpb,) last);
+        update_fat_entry(IF_MV(fat_bpb,) last,0);
         last = next;
     }
 
@@ -2120,7 +2120,7 @@ int fat_rename(struct fat_file* file,
        it points to its parent directory (we don't check if it was a move) */
     if(FAT_ATTR_DIRECTORY == attr) {
         /* open the dir that was renamed, we re-use the olddir_file struct */
-        rc = fat_open(IF_MV2(file->volume,) newfile.firstcluster, &olddir_file, \
NULL); +        rc = fat_open(IF_MV(file->volume,) newfile.firstcluster, \
&olddir_file, NULL);  if (rc < 0)
             return rc * 10 - 6;
 
@@ -2189,13 +2189,13 @@ static long next_write_cluster(struct fat_file* file,
     LDEBUGF("next_write_cluster(%lx,%lx)\n",file->firstcluster, oldcluster);
 
     if (oldcluster)
-        cluster = get_next_cluster(IF_MV2(fat_bpb,) oldcluster);
+        cluster = get_next_cluster(IF_MV(fat_bpb,) oldcluster);
 
     if (!cluster) {
         if (oldcluster > 0)
-            cluster = find_free_cluster(IF_MV2(fat_bpb,) oldcluster+1);
+            cluster = find_free_cluster(IF_MV(fat_bpb,) oldcluster+1);
         else if (oldcluster == 0)
-            cluster = find_free_cluster(IF_MV2(fat_bpb,)
+            cluster = find_free_cluster(IF_MV(fat_bpb,)
                                         fat_bpb->fsinfo.nextfree);
 #ifdef HAVE_FAT16SUPPORT
         else /* negative, pseudo-cluster of the root dir */
@@ -2204,10 +2204,10 @@ static long next_write_cluster(struct fat_file* file,
 
         if (cluster) {
             if (oldcluster)
-                update_fat_entry(IF_MV2(fat_bpb,) oldcluster, cluster);
+                update_fat_entry(IF_MV(fat_bpb,) oldcluster, cluster);
             else
                 file->firstcluster = cluster;
-            update_fat_entry(IF_MV2(fat_bpb,) cluster, FAT_EOF_MARK);
+            update_fat_entry(IF_MV(fat_bpb,) cluster, FAT_EOF_MARK);
         }
         else {
 #ifdef TEST_FAT
@@ -2219,7 +2219,7 @@ static long next_write_cluster(struct fat_file* file,
             return 0;
         }
     }
-    sector = cluster2sec(IF_MV2(fat_bpb,) cluster);
+    sector = cluster2sec(IF_MV(fat_bpb,) cluster);
     if (sector<0)
         return 0;
 
@@ -2227,7 +2227,7 @@ static long next_write_cluster(struct fat_file* file,
     return cluster;
 }
 
-static int transfer(IF_MV2(struct bpb* fat_bpb,) 
+static int transfer(IF_MV(struct bpb* fat_bpb,) 
                     unsigned long start, long count, char* buf, bool write )
 {
 #ifndef HAVE_MULTIVOLUME
@@ -2251,11 +2251,11 @@ static int transfer(IF_MV2(struct bpb* fat_bpb,)
         if (start + count > fat_bpb->totalsectors)
             panicf("Write %ld after data\n",
                 start + count - fat_bpb->totalsectors);
-        rc = storage_write_sectors(IF_MD2(fat_bpb->drive,)
+        rc = storage_write_sectors(IF_MD(fat_bpb->drive,)
                                start + fat_bpb->startsector, count, buf);
     }
     else
-        rc = storage_read_sectors(IF_MD2(fat_bpb->drive,)
+        rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
                               start + fat_bpb->startsector, count, buf);
     if (rc < 0) {
         DEBUGF( "transfer() - Couldn't %s sector %lx"
@@ -2302,8 +2302,8 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
             if (write)
                 cluster = next_write_cluster(file, cluster, &sector);
             else {
-                cluster = get_next_cluster(IF_MV2(fat_bpb,) cluster);
-                sector = cluster2sec(IF_MV2(fat_bpb,) cluster);
+                cluster = get_next_cluster(IF_MV(fat_bpb,) cluster);
+                sector = cluster2sec(IF_MV(fat_bpb,) cluster);
             }
 
             clusternum++;
@@ -2330,7 +2330,7 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
                 sector++;
             else {
                 /* look up first sector of file */
-                sector = cluster2sec(IF_MV2(fat_bpb,) file->firstcluster);
+                sector = cluster2sec(IF_MV(fat_bpb,) file->firstcluster);
                 numsec=1;
 #ifdef HAVE_FAT16SUPPORT
                 if (file->firstcluster < 0)
@@ -2348,7 +2348,7 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
         if ( ((sector != first) && (sector != last+1)) || /* not sequential */
              (last-first+1 == 256) ) { /* max 256 sectors per ata request */
             long count = last - first + 1;
-            rc = transfer(IF_MV2(fat_bpb,) first, count, buf, write );
+            rc = transfer(IF_MV(fat_bpb,) first, count, buf, write );
             if (rc < 0)
                 return rc * 10 - 1;
 
@@ -2360,7 +2360,7 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
             (!eof))
         {
             long count = sector - first + 1;
-            rc = transfer(IF_MV2(fat_bpb,) first, count, buf, write );
+            rc = transfer(IF_MV(fat_bpb,) first, count, buf, write );
             if (rc < 0)
                 return rc * 10 - 2;
         }
@@ -2413,7 +2413,7 @@ int fat_seek(struct fat_file *file, unsigned long seeksector )
         }
 
         for (i=0; i<numclusters; i++) {
-            cluster = get_next_cluster(IF_MV2(fat_bpb,) cluster);
+            cluster = get_next_cluster(IF_MV(fat_bpb,) cluster);
             if (!cluster) {
                 DEBUGF("Seeking beyond the end of the file! "
                        "(sector %ld, cluster %ld)\n", seeksector, i);
@@ -2421,7 +2421,7 @@ int fat_seek(struct fat_file *file, unsigned long seeksector )
             }
         }
 
-        sector = cluster2sec(IF_MV2(fat_bpb,) cluster) + sectornum;
+        sector = cluster2sec(IF_MV(fat_bpb,) cluster) + sectornum;
     }
     else {
         sectornum = -1;
@@ -2437,7 +2437,7 @@ int fat_seek(struct fat_file *file, unsigned long seeksector )
     return 0;
 }
 
-int fat_opendir(IF_MV2(int volume,) 
+int fat_opendir(IF_MV(int volume,) 
                 struct fat_dir *dir, unsigned long startcluster,
                 const struct fat_dir *parent_dir)
 {
@@ -2457,7 +2457,7 @@ int fat_opendir(IF_MV2(int volume,)
     if (startcluster == 0)
         startcluster = fat_bpb->bpb_rootclus;
 
-    rc = fat_open(IF_MV2(volume,) startcluster, &dir->file, parent_dir);
+    rc = fat_open(IF_MV(volume,) startcluster, &dir->file, parent_dir);
     if(rc)
     {
         DEBUGF( "fat_opendir() - Couldn't open dir"
diff --git a/firmware/drivers/ramdisk.c b/firmware/drivers/ramdisk.c
index 7324af9..c1f8824 100644
--- a/firmware/drivers/ramdisk.c
+++ b/firmware/drivers/ramdisk.c
@@ -31,7 +31,7 @@ unsigned char ramdisk[SECTOR_SIZE * NUM_SECTORS];
 
 long last_disk_activity = -1;
 
-int ramdisk_read_sectors(IF_MD2(int drive,)
+int ramdisk_read_sectors(IF_MD(int drive,)
                      unsigned long start,
                      int count,
                      void* buf)
@@ -47,7 +47,7 @@ int ramdisk_read_sectors(IF_MD2(int drive,)
     return 0;
 }
 
-int ramdisk_write_sectors(IF_MD2(int drive,)
+int ramdisk_write_sectors(IF_MD(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
@@ -110,7 +110,7 @@ void ramdisk_spindown(int seconds)
     (void)seconds;
 }
 #ifdef STORAGE_GET_INFO
-void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info)
+void ramdisk_get_info(IF_MD(int drive,) struct storage_info *info)
 {
 #ifdef HAVE_MULTIDRIVE
     (void)drive; /* unused for now */
diff --git a/firmware/drivers/sd.c b/firmware/drivers/sd.c
index 3c4543f..6185d53 100644
--- a/firmware/drivers/sd.c
+++ b/firmware/drivers/sd.c
@@ -80,7 +80,7 @@ void sd_spindown(int seconds)
 }
 
 #ifdef STORAGE_GET_INFO
-void sd_get_info(IF_MD2(int drive,) struct storage_info *info)
+void sd_get_info(IF_MD(int drive,) struct storage_info *info)
 {
 #ifndef HAVE_MULTIDRIVE
     const int drive=0;
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index 41a2fd5..0bcb144 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -39,8 +39,8 @@ bool ata_disk_is_active(void);
 int ata_soft_reset(void);
 int ata_init(void) STORAGE_INIT_ATTR;
 void ata_close(void);
-int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
-int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* \
buf); +int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* \
buf); +int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const \
void* buf);  void ata_spin(void);
 #if (CONFIG_LED == LED_REAL)
 void ata_set_led_enabled(bool enabled);
@@ -48,7 +48,7 @@ void ata_set_led_enabled(bool enabled);
 unsigned short* ata_get_identify(void);
 
 #ifdef STORAGE_GET_INFO
-void ata_get_info(IF_MD2(int drive,) struct storage_info *info);
+void ata_get_info(IF_MD(int drive,) struct storage_info *info);
 #endif
 #ifdef HAVE_HOTSWAP
 bool ata_removable(IF_MD_NONVOID(int drive));
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 1551107..a0d52ac 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -101,16 +101,16 @@ extern void fat_unlock(void);
 
 extern void fat_init(void);
 extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume));
-extern int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector);
+extern int fat_mount(IF_MV(int volume,) IF_MD(int drive,) long startsector);
 extern int fat_unmount(int volume, bool flush);
-extern void fat_size(IF_MV2(int volume,) /* public for info */
+extern void fat_size(IF_MV(int volume,) /* public for info */
                      unsigned long* size,
                      unsigned long* free);
 extern void fat_recalc_free(IF_MV_NONVOID(int volume)); /* public for debug info \
screen */  extern int fat_create_dir(const char* name,
                           struct fat_dir* newdir,
                           struct fat_dir* dir);
-extern int fat_open(IF_MV2(int volume,)
+extern int fat_open(IF_MV(int volume,)
                     long cluster,
                     struct fat_file* ent,
                     const struct fat_dir* dir);
@@ -128,7 +128,7 @@ extern int fat_rename(struct fat_file* file,
                       const unsigned char* newname,
                       long size, int attr);
 
-extern int fat_opendir(IF_MV2(int volume,)
+extern int fat_opendir(IF_MV(int volume,)
                        struct fat_dir *ent, unsigned long startcluster,
                        const struct fat_dir *parent_dir);
 extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry);
diff --git a/firmware/export/mmc.h b/firmware/export/mmc.h
index 8d20f81..0d27e20 100644
--- a/firmware/export/mmc.h
+++ b/firmware/export/mmc.h
@@ -36,13 +36,13 @@ bool mmc_disk_is_active(void);
 int mmc_soft_reset(void);
 int mmc_init(void) STORAGE_INIT_ATTR;
 void mmc_close(void);
-int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
-int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* \
buf); +int mmc_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* \
buf); +int mmc_write_sectors(IF_MD(int drive,) unsigned long start, int count, const \
void* buf);  void mmc_spin(void);
 int mmc_spinup_time(void);
 
 #ifdef STORAGE_GET_INFO
-void mmc_get_info(IF_MD2(int drive,) struct storage_info *info);
+void mmc_get_info(IF_MD(int drive,) struct storage_info *info);
 #endif
 #ifdef HAVE_HOTSWAP
 bool mmc_removable(IF_MD_NONVOID(int drive));
diff --git a/firmware/export/mv.h b/firmware/export/mv.h
index b1d16a7..b1c8a83 100644
--- a/firmware/export/mv.h
+++ b/firmware/export/mv.h
@@ -27,27 +27,28 @@
 /* FixMe: These macros are a bit nasty and perhaps misplaced here.
    We'll get rid of them once decided on how to proceed with multivolume. */
 
-/* Drives are things like a disk, a card, a flash chip. They can have volumes on \
them */ +/* Drives are things like a disk, a card, a flash chip. They can have \
volumes +   on them */
 #ifdef HAVE_MULTIDRIVE
-#define IF_MD(x) x /* optional drive parameter */
-#define IF_MD2(x,y) x,y /* same, for a list of arguments */
-#define IF_MD_NONVOID(x) x /* for prototype with sole volume parameter */
+#define IF_MD(x...) x          /* valist contents or empty */
+#define IF_MD_NONVOID(x...) x  /* valist contents or 'void' */
+#define IF_MD_DRV(d)  d        /* drive argument or '0' */
 #else /* empty definitions if no multi-drive */
-#define IF_MD(x)
-#define IF_MD2(x,y)
-#define IF_MD_NONVOID(x) void
+#define IF_MD(x...)
+#define IF_MD_NONVOID(x...) void
+#define IF_MD_DRV(d)  0
 #endif
 
 /* Volumes mean things that have filesystems on them, like partitions */
 #ifdef HAVE_MULTIVOLUME
-#define IF_MV(x) x /* optional volume parameter */
-#define IF_MV2(x,y) x,y /* same, for a list of arguments */
-#define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */
+#define IF_MV(x...) x          /* valist contents or empty */
+#define IF_MV_NONVOID(x...) x  /* valist contents or 'void' */
+#define IF_MV_VOL(v) v         /* volume argument or '0' */
 #else /* empty definitions if no multi-volume */
-#define IF_MV(x)
-#define IF_MV2(x,y)
-#define IF_MV_NONVOID(x) void
+#define IF_MV(x...)
+#define IF_MV_NONVOID(x...) void
+#define IF_MV_VOL(v) 0
 #endif
 
 
-#endif
+#endif /* __MV_H__ */
diff --git a/firmware/export/nand.h b/firmware/export/nand.h
index 58751ab..fe25c9b 100644
--- a/firmware/export/nand.h
+++ b/firmware/export/nand.h
@@ -36,8 +36,8 @@ bool nand_disk_is_active(void);
 int  nand_soft_reset(void);
 int  nand_init(void) STORAGE_INIT_ATTR;
 void nand_close(void);
-int  nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* \
                buf);
-int  nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const \
void* buf); +int  nand_read_sectors(IF_MD(int drive,) unsigned long start, int count, \
void* buf); +int  nand_write_sectors(IF_MD(int drive,) unsigned long start, int \
count, const void* buf);  #ifdef HAVE_STORAGE_FLUSH
 int  nand_flush(void);
 #endif
@@ -45,7 +45,7 @@ void nand_spin(void);
 int  nand_spinup_time(void); /* ticks */
 
 #ifdef STORAGE_GET_INFO
-void nand_get_info(IF_MD2(int drive,) struct storage_info *info);
+void nand_get_info(IF_MD(int drive,) struct storage_info *info);
 #endif
 
 long nand_last_disk_activity(void);
diff --git a/firmware/export/ramdisk.h b/firmware/export/ramdisk.h
index c478c78..d79ac50 100644
--- a/firmware/export/ramdisk.h
+++ b/firmware/export/ramdisk.h
@@ -35,14 +35,14 @@ bool ramdisk_disk_is_active(void);
 int ramdisk_soft_reset(void);
 int ramdisk_init(void) STORAGE_INIT_ATTR;
 void ramdisk_close(void);
-int ramdisk_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* \
                buf);
-int ramdisk_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const \
void* buf); +int ramdisk_read_sectors(IF_MD(int drive,) unsigned long start, int \
count, void* buf); +int ramdisk_write_sectors(IF_MD(int drive,) unsigned long start, \
int count, const void* buf);  void ramdisk_spin(void);
 void ramdisk_sleepnow(void);
 int ramdisk_spinup_time(void);
 
 #ifdef STORAGE_GET_INFO
-void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info);
+void ramdisk_get_info(IF_MD(int drive,) struct storage_info *info);
 #endif
 
 long ramdisk_last_disk_activity(void);
diff --git a/firmware/export/sd.h b/firmware/export/sd.h
index 1c3c429..a5942dd 100644
--- a/firmware/export/sd.h
+++ b/firmware/export/sd.h
@@ -42,13 +42,13 @@ bool sd_disk_is_active(void);
 int  sd_soft_reset(void);
 int  sd_init(void) STORAGE_INIT_ATTR;
 void sd_close(void);
-int  sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
-int  sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* \
buf); +int  sd_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* \
buf); +int  sd_write_sectors(IF_MD(int drive,) unsigned long start, int count, const \
void* buf);  void sd_spin(void);
 int  sd_spinup_time(void); /* ticks */
 
 #ifdef STORAGE_GET_INFO
-void sd_get_info(IF_MD2(int drive,) struct storage_info *info);
+void sd_get_info(IF_MD(int drive,) struct storage_info *info);
 #endif
 #ifdef HAVE_HOTSWAP
 bool sd_removable(IF_MV_NONVOID(int drive));
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index 6c875bc..1793e38 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -95,7 +95,7 @@ static inline void stub_storage_spindown(int timeout) { \
(void)timeout; }  #define storage_get_identify() ata_get_identify()
 
         #ifdef STORAGE_GET_INFO
-            #define storage_get_info(drive, info) ata_get_info(IF_MD2(drive,) info)
+            #define storage_get_info(drive, info) ata_get_info(IF_MD(drive,) info)
         #endif
         #ifdef HAVE_HOTSWAP
             #define storage_removable(drive) ata_removable(IF_MD(drive))
@@ -121,7 +121,7 @@ static inline void stub_storage_spindown(int timeout) { \
(void)timeout; }  #define storage_get_identify() sd_get_identify()
 
         #ifdef STORAGE_GET_INFO
-            #define storage_get_info(drive, info) sd_get_info(IF_MD2(drive,) info)
+            #define storage_get_info(drive, info) sd_get_info(IF_MD(drive,) info)
         #endif
         #ifdef HAVE_HOTSWAP
             #define storage_removable(drive) sd_removable(IF_MD(drive))
@@ -146,7 +146,7 @@ static inline void stub_storage_spindown(int timeout) { \
(void)timeout; }  #define storage_get_identify() mmc_get_identify()
        
         #ifdef STORAGE_GET_INFO
-            #define storage_get_info(drive, info) mmc_get_info(IF_MD2(drive,) info)
+            #define storage_get_info(drive, info) mmc_get_info(IF_MD(drive,) info)
         #endif
         #ifdef HAVE_HOTSWAP
             #define storage_removable(drive) mmc_removable(IF_MD(drive))
@@ -171,7 +171,7 @@ static inline void stub_storage_spindown(int timeout) { \
(void)timeout; }  #define storage_get_identify() nand_get_identify()
        
         #ifdef STORAGE_GET_INFO
-            #define storage_get_info(drive, info) nand_get_info(IF_MD2(drive,) info)
+            #define storage_get_info(drive, info) nand_get_info(IF_MD(drive,) info)
         #endif
         #ifdef HAVE_HOTSWAP
             #define storage_removable(drive) nand_removable(IF_MD(drive))
@@ -196,7 +196,7 @@ static inline void stub_storage_spindown(int timeout) { \
(void)timeout; }  #define storage_get_identify() ramdisk_get_identify()
        
         #ifdef STORAGE_GET_INFO
-            #define storage_get_info(drive, info) ramdisk_get_info(IF_MD2(drive,) \
info) +            #define storage_get_info(drive, info) \
ramdisk_get_info(IF_MD(drive,) info)  #endif
         #ifdef HAVE_HOTSWAP
             #define storage_removable(drive) ramdisk_removable(IF_MD(drive))
@@ -231,6 +231,6 @@ bool storage_present(int drive);
 
 #endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
 
-int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* \
                buf);
-int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const \
void* buf); +int storage_read_sectors(IF_MD(int drive,) unsigned long start, int \
count, void* buf); +int storage_write_sectors(IF_MD(int drive,) unsigned long start, \
int count, const void* buf);  #endif
diff --git a/firmware/storage.c b/firmware/storage.c
index 0f78712..8740e4e 100644
--- a/firmware/storage.c
+++ b/firmware/storage.c
@@ -83,7 +83,7 @@ static void storage_wait_turn(IF_MD_NONVOID(int drive))
 }
 #endif
 
-int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
                          void* buf)
 {
 #ifdef HAVE_IO_PRIORITY
@@ -98,38 +98,38 @@ int storage_read_sectors(IF_MD2(int drive,) unsigned long start, \
int count,  {
 #if (CONFIG_STORAGE & STORAGE_ATA)
     case STORAGE_ATA:
-        return ata_read_sectors(IF_MD2(ldrive,) start,count,buf);
+        return ata_read_sectors(IF_MD(ldrive,) start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_MMC)
     case STORAGE_MMC:
-        return mmc_read_sectors(IF_MD2(ldrive,) start,count,buf);
+        return mmc_read_sectors(IF_MD(ldrive,) start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_SD)
     case STORAGE_SD:
-        return sd_read_sectors(IF_MD2(ldrive,) start,count,buf);
+        return sd_read_sectors(IF_MD(ldrive,) start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_NAND)
     case STORAGE_NAND:
-        return nand_read_sectors(IF_MD2(ldrive,) start,count,buf);
+        return nand_read_sectors(IF_MD(ldrive,) start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_RAMDISK)
     case STORAGE_RAMDISK:
-        return ramdisk_read_sectors(IF_MD2(ldrive,) start,count,buf);
+        return ramdisk_read_sectors(IF_MD(ldrive,) start,count,buf);
 #endif
     }
     
     return -1;
 #else /* CONFIG_STORAGE_MULTI */
-    return STORAGE_FUNCTION(read_sectors)(IF_MD2(drive,)start,count,buf);
+    return STORAGE_FUNCTION(read_sectors)(IF_MD(drive,)start,count,buf);
 #endif /* CONFIG_STORAGE_MULTI */
 
 }
 
-int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                           const void* buf)
 {
 #ifdef HAVE_IO_PRIORITY
@@ -144,33 +144,33 @@ int storage_write_sectors(IF_MD2(int drive,) unsigned long \
start, int count,  {
 #if (CONFIG_STORAGE & STORAGE_ATA)
     case STORAGE_ATA:
-        return ata_write_sectors(IF_MD2(ldrive,)start,count,buf);
+        return ata_write_sectors(IF_MD(ldrive,)start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_MMC)
     case STORAGE_MMC:
-        return mmc_write_sectors(IF_MD2(ldrive,)start,count,buf);
+        return mmc_write_sectors(IF_MD(ldrive,)start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_SD)
     case STORAGE_SD:
-        return sd_write_sectors(IF_MD2(ldrive,)start,count,buf);
+        return sd_write_sectors(IF_MD(ldrive,)start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_NAND)
     case STORAGE_NAND:
-        return nand_write_sectors(IF_MD2(ldrive,)start,count,buf);
+        return nand_write_sectors(IF_MD(ldrive,)start,count,buf);
 #endif
 
 #if (CONFIG_STORAGE & STORAGE_RAMDISK)
     case STORAGE_RAMDISK:
-        return ramdisk_write_sectors(IF_MD2(ldrive,)start,count,buf);
+        return ramdisk_write_sectors(IF_MD(ldrive,)start,count,buf);
 #endif
     }
     
     return -1;
 #else /* CONFIG_STORAGE_MULTI */
-    return STORAGE_FUNCTION(write_sectors)(IF_MD2(drive,)start,count,buf);
+    return STORAGE_FUNCTION(write_sectors)(IF_MD(drive,)start,count,buf);
 #endif /* CONFIG_STORAGE_MULTI */
 }
 
diff --git a/firmware/target/arm/as3525/sd-as3525.c \
b/firmware/target/arm/as3525/sd-as3525.c index 5bed36e..c80c7f7 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -693,7 +693,7 @@ static int sd_select_bank(signed char bank)
     return 0;
 }
 
-static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
+static int sd_transfer_sectors(IF_MD(int drive,) unsigned long start,
                                int count, void* buf, const bool write)
 {
 #ifndef HAVE_MULTIDRIVE
@@ -887,19 +887,19 @@ sd_transfer_error_nodma:
     return ret;
 }
 
-int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count,
                      void* buf)
 {
     int ret;
 
     mutex_lock(&sd_mtx);
-    ret = sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false);
+    ret = sd_transfer_sectors(IF_MD(drive,) start, count, buf, false);
     mutex_unlock(&sd_mtx);
 
     return ret;
 }
 
-int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                      const void* buf)
 {
 #ifdef VERIFY_WRITE
@@ -911,7 +911,7 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int \
count,  
     mutex_lock(&sd_mtx);
 
-    ret = sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
+    ret = sd_transfer_sectors(IF_MD(drive,) start, count, (void*)buf, true);
 
 #ifdef VERIFY_WRITE
     if (ret) {
@@ -928,10 +928,10 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, \
int count,  if(transfer > UNALIGNED_NUM_SECTORS)
             transfer = UNALIGNED_NUM_SECTORS;
 
-        sd_transfer_sectors(IF_MD2(drive,) start, transfer, aligned_buffer, false);
+        sd_transfer_sectors(IF_MD(drive,) start, transfer, aligned_buffer, false);
         if (memcmp(buf, aligned_buffer, transfer * 512) != 0) {
             /* try the write again in the hope to repair the damage */
-            sd_transfer_sectors(IF_MD2(drive,) saved_start, saved_count, saved_buf, \
true); +            sd_transfer_sectors(IF_MD(drive,) saved_start, saved_count, \
saved_buf, true);  panicf("sd: verify failed: sec=%ld n=%d!", start, transfer);
         }
 
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c \
b/firmware/target/arm/as3525/sd-as3525v2.c index 9edc598..ae3dde4 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -773,7 +773,7 @@ int sd_init(void)
     return 0;
 }
 
-static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
+static int sd_transfer_sectors(IF_MD(int drive,) unsigned long start,
                                 int count, void* buf, bool write)
 {
     unsigned long response;
@@ -969,16 +969,16 @@ sd_transfer_error_no_dma:
     }
 }
 
-int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count,
                     void* buf)
 {
-    return sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false);
+    return sd_transfer_sectors(IF_MD(drive,) start, count, buf, false);
 }
 
-int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                      const void* buf)
 {
-    return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
+    return sd_transfer_sectors(IF_MD(drive,) start, count, (void*)buf, true);
 }
 
 #ifndef BOOTLOADER
diff --git a/firmware/target/arm/ata-nand-telechips.c \
b/firmware/target/arm/ata-nand-telechips.c index 2ae425f..fe1314d 100644
--- a/firmware/target/arm/ata-nand-telechips.c
+++ b/firmware/target/arm/ata-nand-telechips.c
@@ -800,7 +800,7 @@ static void read_inplace_writes_cache(int bank, int phys_segment)
 }
 
 
-int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
+int nand_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
                      void* inbuf)
 {
 #ifdef HAVE_MULTIDRIVE
@@ -855,7 +855,7 @@ nand_read_error:
     return ret;
 }
 
-int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
 #ifdef HAVE_MULTIDRIVE
@@ -877,7 +877,7 @@ int nand_flush(void)
 #endif
 
 #ifdef STORAGE_GET_INFO
-void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
+void nand_get_info(IF_MD(int drive,) struct storage_info *info)
 {
 #ifdef HAVE_MULTIDRIVE
     (void)drive; /* unused for now */
diff --git a/firmware/target/arm/imx233/nand-imx233.c \
b/firmware/target/arm/imx233/nand-imx233.c index ec584b5..22c4fc2 100644
--- a/firmware/target/arm/imx233/nand-imx233.c
+++ b/firmware/target/arm/imx233/nand-imx233.c
@@ -36,13 +36,13 @@ int nand_init(void)
 {
     return -1;
 }
-int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int nand_read_sectors(IF_MD(int drive,) unsigned long start, int count,
                      void* buf)
 {
     return -1;
 }
 
-int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                      const void* buf)
 {
     return -1;
@@ -54,7 +54,7 @@ int nand_num_drives(int first_drive)
     return 1;
 }
 
-void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
+void nand_get_info(IF_MD(int drive,) struct storage_info *info)
 {
     IF_MD((void)drive);
     info->sector_size = SECTOR_SIZE;
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c \
b/firmware/target/arm/imx233/sdmmc-imx233.c index c389a1d..e520fcc 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -845,7 +845,7 @@ void sd_enable(bool on)
     (void) on;
 }
 
-int sd_read_sectors(IF_MD2(int sd_drive,) unsigned long start, int count, void *buf)
+int sd_read_sectors(IF_MD(int sd_drive,) unsigned long start, int count, void *buf)
 {
 #ifndef HAVE_MULTIDRIVE
     int sd_drive = 0;
@@ -853,7 +853,7 @@ int sd_read_sectors(IF_MD2(int sd_drive,) unsigned long start, \
int count, void *  return transfer_sectors(sd_map[sd_drive], start, count, buf, \
true);  }
 
-int sd_write_sectors(IF_MD2(int sd_drive,) unsigned long start, int count, const \
void* buf) +int sd_write_sectors(IF_MD(int sd_drive,) unsigned long start, int count, \
const void* buf)  {
 #ifndef HAVE_MULTIDRIVE
     int sd_drive = 0;
@@ -878,7 +878,7 @@ int mmc_init(void)
     return 0;
 }
 
-void mmc_get_info(IF_MD2(int mmc_drive,) struct storage_info *info)
+void mmc_get_info(IF_MD(int mmc_drive,) struct storage_info *info)
 {
 #ifndef HAVE_MULTIDRIVE
     int mmc_drive = 0;
@@ -968,7 +968,7 @@ int mmc_spinup_time(void)
     return 0;
 }
 
-int mmc_read_sectors(IF_MD2(int mmc_drive,) unsigned long start, int count, void \
*buf) +int mmc_read_sectors(IF_MD(int mmc_drive,) unsigned long start, int count, \
void *buf)  {
 #ifndef HAVE_MULTIDRIVE
     int mmc_drive = 0;
@@ -976,7 +976,7 @@ int mmc_read_sectors(IF_MD2(int mmc_drive,) unsigned long start, \
int count, void  return transfer_sectors(mmc_map[mmc_drive], start, count, buf, \
true);  }
 
-int mmc_write_sectors(IF_MD2(int mmc_drive,) unsigned long start, int count, const \
void* buf) +int mmc_write_sectors(IF_MD(int mmc_drive,) unsigned long start, int \
count, const void* buf)  {
 #ifndef HAVE_MULTIDRIVE
     int mmc_drive = 0;
diff --git a/firmware/target/arm/pp/ata-sd-pp.c b/firmware/target/arm/pp/ata-sd-pp.c
index f83bb60..bcf8a66 100644
--- a/firmware/target/arm/pp/ata-sd-pp.c
+++ b/firmware/target/arm/pp/ata-sd-pp.c
@@ -864,7 +864,7 @@ static void sd_select_device(int card_no)
 
 /* API Functions */
 
-int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
+int sd_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
                      void* inbuf)
 {
 #ifndef HAVE_MULTIDRIVE
@@ -981,7 +981,7 @@ sd_read_error:
     }
 }
 
-int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
 /* Write support is not finished yet */
diff --git a/firmware/target/arm/rk27xx/ata-nand-rk27xx.c \
b/firmware/target/arm/rk27xx/ata-nand-rk27xx.c index fc150ec..a32963b 100644
--- a/firmware/target/arm/rk27xx/ata-nand-rk27xx.c
+++ b/firmware/target/arm/rk27xx/ata-nand-rk27xx.c
@@ -35,14 +35,14 @@
 static bool initialized = false;
 
 /* API Functions */
-int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
+int nand_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
                      void* inbuf)
 {
     (void)drive;
     return ftl_read(start, incount, inbuf);
 }
 
-int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
     (void)drive;
@@ -74,7 +74,7 @@ void nand_enable(bool on)
     (void)on;
 }
 
-void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
+void nand_get_info(IF_MD(int drive,) struct storage_info *info)
 {
     (void)drive;
     uint32_t ppb = ftl_banks * (*ftl_nand_type).pagesperblock;
diff --git a/firmware/target/arm/rk27xx/sd-rk27xx.c \
b/firmware/target/arm/rk27xx/sd-rk27xx.c index cb870c9..ef9845d 100644
--- a/firmware/target/arm/rk27xx/sd-rk27xx.c
+++ b/firmware/target/arm/rk27xx/sd-rk27xx.c
@@ -495,7 +495,7 @@ static inline void write_sd_data(unsigned char **src)
     *src += 512;
 }
 
-int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count,
                     void* buf)
 {
 #ifdef HAVE_MULTIDRIVE
@@ -618,7 +618,7 @@ int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int \
count,  }
 
 /* Not tested */
-int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                      const void* buf)
 {
 #ifdef HAVE_MULTIDRIVE
diff --git a/firmware/target/arm/s3c2440/sd-s3c2440.c \
b/firmware/target/arm/s3c2440/sd-s3c2440.c index 8695b65..6658fa1 100644
--- a/firmware/target/arm/s3c2440/sd-s3c2440.c
+++ b/firmware/target/arm/s3c2440/sd-s3c2440.c
@@ -847,7 +847,7 @@ sd_transfer_error:
     return ret;
 }
 
-int sd_read_sectors(IF_MD2(int card_no,) unsigned long start, int incount,
+int sd_read_sectors(IF_MD(int card_no,) unsigned long start, int incount,
                      void* inbuf)
 {
     int ret;
@@ -868,7 +868,7 @@ int sd_read_sectors(IF_MD2(int card_no,) unsigned long start, int \
incount,  }
 
 /*****************************************************************************/
-int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
 #ifdef BOOTLOADER /* we don't need write support in bootloader */
diff --git a/firmware/target/arm/s5l8700/ata-nand-s5l8700.c \
b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c index a5dcb4b..227f6b7 100644
--- a/firmware/target/arm/s5l8700/ata-nand-s5l8700.c
+++ b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c
@@ -33,13 +33,13 @@
 static bool initialized = false;
 
 /* API Functions */
-int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
+int nand_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
                      void* inbuf)
 {
     return ftl_read(start, incount, inbuf);
 }
 
-int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
     return ftl_write(start, count, outbuf);
@@ -70,7 +70,7 @@ void nand_enable(bool on)
     (void)on;
 }
 
-void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
+void nand_get_info(IF_MD(int drive,) struct storage_info *info)
 {
     uint32_t ppb = ftl_banks * (*ftl_nand_type).pagesperblock;
     (*info).sector_size = SECTOR_SIZE;
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c \
b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c index dbf0ce9..395c0f4 \
                100644
--- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
@@ -962,7 +962,7 @@ int ata_soft_reset(void)
     return rc;
 }
 
-int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
+int ata_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
                      void* inbuf)
 {
     mutex_lock(&ata_mutex);
@@ -971,7 +971,7 @@ int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int \
incount,  return rc;
 }
 
-int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
+int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count,
                       const void* outbuf)
 {
     mutex_lock(&ata_mutex);
@@ -1007,7 +1007,7 @@ void ata_spin(void)
     ata_set_active();
 }
 
-void ata_get_info(IF_MD2(int drive,) struct storage_info *info)
+void ata_get_info(IF_MD(int drive,) struct storage_info *info)
 {
     (*info).sector_size = SECTOR_SIZE;
 #ifdef ATA_HAVE_BBT
diff --git a/firmware/target/arm/tcc780x/sd-tcc780x.c \
b/firmware/target/arm/tcc780x/sd-tcc780x.c index 3b67d21..55ae4e7 100644
--- a/firmware/target/arm/tcc780x/sd-tcc780x.c
+++ b/firmware/target/arm/tcc780x/sd-tcc780x.c
@@ -398,7 +398,7 @@ static void sd_select_device(int card_no)
     }
 }
 
-int sd_read_sectors(IF_MD2(int card_no,) unsigned long start, int incount,
+int sd_read_sectors(IF_MD(int card_no,) unsigned long start, int incount,
                      void* inbuf)
 {
 #ifndef HAVE_MULTIDRIVE
@@ -512,7 +512,7 @@ sd_read_error:
     }
 }
 
-int sd_write_sectors(IF_MD2(int card_no,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int card_no,) unsigned long start, int count,
                       const void* outbuf)
 {
 /* Write support is not finished yet */
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c \
b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c index \
                4ff39e2..f139046 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
@@ -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;
 
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h \
b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h index 5b66d19..d0aa12e \
                100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h
@@ -36,8 +36,8 @@
 /* Nasty hack, but Creative is nasty... */
 #define ata_read_sectors _ata_read_sectors
 #define ata_write_sectors _ata_write_sectors
-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);  
 /* General purpose memory region #1 */
 #define ATA_IOBASE      0x50FEE000
diff --git a/firmware/target/arm/tms320dm320/sdmmc-dm320.c \
b/firmware/target/arm/tms320dm320/sdmmc-dm320.c index 2a7e173..284061e 100644
--- a/firmware/target/arm/tms320dm320/sdmmc-dm320.c
+++ b/firmware/target/arm/tms320dm320/sdmmc-dm320.c
@@ -849,7 +849,7 @@ sd_transfer_error:
     }
 }
 
-int sd_read_sectors(IF_MD2(int card_no,) unsigned long start, int incount,
+int sd_read_sectors(IF_MD(int card_no,) unsigned long start, int incount,
                      void* inbuf)
 {
 #ifndef HAVE_MULTIDRIVE
@@ -858,7 +858,7 @@ int sd_read_sectors(IF_MD2(int card_no,) unsigned long start, int \
incount,  return sd_transfer_sectors(card_no, start, incount, inbuf, false);
 }
 
-int sd_write_sectors(IF_MD2(int card_no,) unsigned long start, int count,
+int sd_write_sectors(IF_MD(int card_no,) unsigned long start, int count,
                       const void* outbuf)
 {
 #ifndef BOOTLOADER
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c \
b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c index f201983..ac4092f 100644
--- a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c
@@ -628,7 +628,7 @@ static inline int read_sector(unsigned long start, unsigned int \
count,  return ret;
 }
 
-int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf)
+int nand_read_sectors(IF_MV(int drive,) unsigned long start, int count, void* buf)
 {
 #ifdef HAVE_MULTIVOLUME
     (void)drive;
@@ -671,7 +671,7 @@ int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int \
count, void* b  }
 
 /* TODO */
-int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const \
void* buf) +int nand_write_sectors(IF_MV(int drive,) unsigned long start, int count, \
const void* buf)  {
     (void)start;
     (void)count;
@@ -728,7 +728,7 @@ void nand_sleepnow(void)
 }
 
 #ifdef STORAGE_GET_INFO
-void nand_get_info(IF_MV2(int drive,) struct storage_info *info)
+void nand_get_info(IF_MV(int drive,) struct storage_info *info)
 {
 #ifdef HAVE_MULTIVOLUME
     (void)drive;
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c \
b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c index 846b909..9c0d198 100644
--- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
@@ -1266,7 +1266,7 @@ static inline void sd_stop_transfer(void)
     mutex_unlock(&sd_mtx);
 }
 
-int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf)
+int sd_read_sectors(IF_MV(int drive,) unsigned long start, int count, void* buf)
 {
 #ifdef HAVE_MULTIVOLUME
     (void)drive;
@@ -1320,7 +1320,7 @@ err:
     return retval;
 }
 
-int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* \
buf) +int sd_write_sectors(IF_MV(int drive,) unsigned long start, int count, const \
void* buf)  {
 #ifdef HAVE_MULTIVOLUME
     (void)drive;
diff --git a/firmware/target/sh/archos/ondio/ata_mmc.c \
b/firmware/target/sh/archos/ondio/ata_mmc.c index fc2efcd..5d95a0e 100644
--- a/firmware/target/sh/archos/ondio/ata_mmc.c
+++ b/firmware/target/sh/archos/ondio/ata_mmc.c
@@ -603,7 +603,7 @@ static int send_block_send(unsigned char start_token, long \
timeout,  return rc;
 }
 
-int mmc_read_sectors(IF_MD2(int drive,)
+int mmc_read_sectors(IF_MD(int drive,)
                      unsigned long start,
                      int incount,
                      void* inbuf)
@@ -689,7 +689,7 @@ int mmc_read_sectors(IF_MD2(int drive,)
     return rc;
 }
 
-int mmc_write_sectors(IF_MD2(int drive,)
+int mmc_write_sectors(IF_MD(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
@@ -953,7 +953,7 @@ long mmc_last_disk_activity(void)
 }
 
 #ifdef STORAGE_GET_INFO
-void mmc_get_info(IF_MD2(int drive,) struct storage_info *info)
+void mmc_get_info(IF_MD(int drive,) struct storage_info *info)
 {
 #ifndef HAVE_MULTIDRIVE
     const int drive=0;
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c
index 756f326..96a95a8 100644
--- a/firmware/test/fat/main.c
+++ b/firmware/test/fat/main.c
@@ -697,7 +697,7 @@ int main(int argc, char *argv[])
 #endif
         ) {
             DEBUGF("*** Mounting at block %ld\n",pinfo[i].start);
-            rc = fat_mount(IF_MV2(0,) IF_MD2(0,) pinfo[i].start);
+            rc = fat_mount(IF_MV(0,) IF_MD(0,) pinfo[i].start);
             if(rc) {
                 DEBUGF("mount: %d",rc);
                 return -1;
@@ -706,7 +706,7 @@ int main(int argc, char *argv[])
         }
     }
     if ( i==4 ) {
-        if(fat_mount(IF_MV2(0,) IF_MD2(0,) 0)) {
+        if(fat_mount(IF_MV(0,) IF_MD(0,) 0)) {
             DEBUGF("No FAT32 partition!");
             return -1;
         }
diff --git a/firmware/test/i2c/main.c b/firmware/test/i2c/main.c
index ad68482..990369e 100644
--- a/firmware/test/i2c/main.c
+++ b/firmware/test/i2c/main.c
@@ -642,7 +642,7 @@ int main(void)
 
     
 
-    i = fat_mount(IF_MV2(0,) IF_MD2(0,) part[0].start);
+    i = fat_mount(IF_MV(0,) IF_MD(0,) part[0].start);
 
     debugf("fat_mount() returned %d\n", i);
 
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index b898978..d1279d0 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -353,7 +353,7 @@ static bool check_disk_present(IF_MD_NONVOID(int volume))
     return true;
 #else
     unsigned char* sector = fat_get_sector_buffer();
-    bool success = storage_read_sectors(IF_MD2(volume,)0,1,sector) == 0;
+    bool success = storage_read_sectors(IF_MD(volume,)0,1,sector) == 0;
     fat_release_sector_buffer();
     return success;
 #endif
@@ -526,7 +526,7 @@ void usb_storage_transfer_complete(int ep,int dir,int status,int \
length)  int result = USBSTOR_WRITE_SECTORS_FILTER();
 
                 if (result == 0) {
-                    result = storage_write_sectors(IF_MD2(cur_cmd.lun,)
+                    result = storage_write_sectors(IF_MD(cur_cmd.lun,)
                         cur_cmd.sector,
                         MIN(WRITE_BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count),
                         cur_cmd.data[cur_cmd.data_select]);
@@ -728,7 +728,7 @@ static void send_and_read_next(void)
                 ramdisk_buffer + cur_cmd.sector*SECTOR_SIZE,
                 MIN(READ_BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count)*SECTOR_SIZE);
 #else
-        result = storage_read_sectors(IF_MD2(cur_cmd.lun,)
+        result = storage_read_sectors(IF_MD(cur_cmd.lun,)
                 cur_cmd.sector,
                 MIN(READ_BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count),
                 cur_cmd.data[cur_cmd.data_select]);
@@ -1087,7 +1087,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
                         ramdisk_buffer + cur_cmd.sector*SECTOR_SIZE,
                         \
MIN(READ_BUFFER_SIZE/SECTOR_SIZE,cur_cmd.count)*SECTOR_SIZE);  #else
-                cur_cmd.last_result = storage_read_sectors(IF_MD2(cur_cmd.lun,)
+                cur_cmd.last_result = storage_read_sectors(IF_MD(cur_cmd.lun,)
                         cur_cmd.sector,
                         MIN(READ_BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count),
                         cur_cmd.data[cur_cmd.data_select]);
diff --git a/rbutil/mkrk27boot/mkrk27boot.c b/rbutil/mkrk27boot/mkrk27boot.c
index 4b51e28..0ecdf93 100644
--- a/rbutil/mkrk27boot/mkrk27boot.c
+++ b/rbutil/mkrk27boot/mkrk27boot.c
@@ -170,7 +170,7 @@ static int mkrk27_init(const char *filename) {
              || pinfo[i].type == PARTITION_TYPE_FAT16
 #endif
             ) {
-            rc = fat_mount(IF_MV2(0,) IF_MD2(0,) pinfo[i].start);
+            rc = fat_mount(IF_MV(0,) IF_MD(0,) pinfo[i].start);
             if(rc) {
                 mkrk27_set_error("mount: %d",rc);
                 return -1;
@@ -179,7 +179,7 @@ static int mkrk27_init(const char *filename) {
         }
     }
     if ( i==4 ) {
-        if(fat_mount(IF_MV2(0,) IF_MD2(0,) 0)) {
+        if(fat_mount(IF_MV(0,) IF_MD(0,) 0)) {
             mkrk27_set_error("FAT32 partition!");
             return -1;
         }
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 7538788..690ef39 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -57,7 +57,7 @@
 #include "thread.h"
 #include "kernel.h"
 #include "debug.h"
-#include "ata.h" /* for IF_MV2 et al. */
+#include "ata.h" /* for IF_MV et al. */
 #include "rbpaths.h"
 #include "load_code.h"
 
@@ -534,7 +534,7 @@ long filesize(int fd)
 #endif
 }
 
-void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free)
+void fat_size(IF_MV(int volume,) unsigned long* size, unsigned long* free)
 {
 #ifdef HAVE_MULTIVOLUME
     if (volume != 0) {
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 51706ca..6ad0b98 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -169,7 +169,7 @@ int storage_init(void)
     return 1;
 }
 
-int storage_write_sectors(IF_MV2(int drive,)
+int storage_write_sectors(IF_MV(int drive,)
                       unsigned long start,
                       int count,
                       const void* buf)
@@ -197,7 +197,7 @@ int storage_write_sectors(IF_MV2(int drive,)
     return 0;
 }
 
-int storage_read_sectors(IF_MV2(int drive,)
+int storage_read_sectors(IF_MV(int drive,)
                      unsigned long start,
                      int count,
                      void* buf)
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic