freemyipod r153 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r152‎ | r153 | r154 >
Date:14:12, 18 August 2010
Author:theseven
Status:new
Tags:
Comment:
Make storage_get_info exposable
Modified paths:
  • /embios/trunk/storage.c (modified) (history)
  • /embios/trunk/storage.h (modified) (history)

Diff [purge]

Index: embios/trunk/storage.c
@@ -127,8 +127,48 @@
128128 return storage_write_sectors(IF_MD2(drive,) start, count, buf);
129129 }
130130
 131+#ifdef STORAGE_GET_INFO
 132+void storage_get_info(int drive, struct storage_info *info)
 133+{
131134 #ifdef CONFIG_STORAGE_MULTI
 135+ int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
 136+ int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
 137+
 138+ switch(driver)
 139+ {
 140+#if (CONFIG_STORAGE & STORAGE_ATA)
 141+ case STORAGE_ATA:
 142+ return ata_get_info(ldrive,info);
 143+#endif
132144
 145+#if (CONFIG_STORAGE & STORAGE_MMC)
 146+ case STORAGE_MMC:
 147+ return mmc_get_info(ldrive,info);
 148+#endif
 149+
 150+#if (CONFIG_STORAGE & STORAGE_SD)
 151+ case STORAGE_SD:
 152+ return sd_get_info(ldrive,info);
 153+#endif
 154+
 155+#if (CONFIG_STORAGE & STORAGE_NAND)
 156+ case STORAGE_NAND:
 157+ return nand_get_info(ldrive,info);
 158+#endif
 159+
 160+#if (CONFIG_STORAGE & STORAGE_RAMDISK)
 161+ case STORAGE_RAMDISK:
 162+ return ramdisk_get_info(ldrive,info);
 163+#endif
 164+ }
 165+#else /* CONFIG_STORAGE_MULTI */
 166+ return STORAGE_FUNCTION(get_info)(IF_MD2(drive,)info);
 167+#endif /* CONFIG_STORAGE_MULTI */
 168+}
 169+#endif /* STORAGE_GET_INFO */
 170+
 171+#ifdef CONFIG_STORAGE_MULTI
 172+
133173 int storage_num_drives(void)
134174 {
135175 return num_drives;
@@ -453,42 +493,6 @@
454494 return max;
455495 }
456496
457 -#ifdef STORAGE_GET_INFO
458 -void storage_get_info(int drive, struct storage_info *info)
459 -{
460 - int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
461 - int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
462 -
463 - switch(driver)
464 - {
465 -#if (CONFIG_STORAGE & STORAGE_ATA)
466 - case STORAGE_ATA:
467 - return ata_get_info(ldrive,info);
468 -#endif
469 -
470 -#if (CONFIG_STORAGE & STORAGE_MMC)
471 - case STORAGE_MMC:
472 - return mmc_get_info(ldrive,info);
473 -#endif
474 -
475 -#if (CONFIG_STORAGE & STORAGE_SD)
476 - case STORAGE_SD:
477 - return sd_get_info(ldrive,info);
478 -#endif
479 -
480 -#if (CONFIG_STORAGE & STORAGE_NAND)
481 - case STORAGE_NAND:
482 - return nand_get_info(ldrive,info);
483 -#endif
484 -
485 -#if (CONFIG_STORAGE & STORAGE_RAMDISK)
486 - case STORAGE_RAMDISK:
487 - return ramdisk_get_info(ldrive,info);
488 -#endif
489 - }
490 -}
491 -#endif /* STORAGE_GET_INFO */
492 -
493497 #ifdef HAVE_HOTSWAP
494498 bool storage_removable(int drive)
495499 {
Index: embios/trunk/storage.h
@@ -25,6 +25,8 @@
2626 #include "global.h"
2727 #include "mv.h"
2828
 29+#define STORAGE_GET_INFO
 30+
2931 #if (CONFIG_STORAGE & STORAGE_SD)
3032 #include "storage_sd.h"
3133 #endif
@@ -73,9 +75,6 @@
7476 #define storage_last_disk_activity() ata_last_disk_activity()
7577 #define storage_get_identify() ata_get_identify()
7678
77 - #ifdef STORAGE_GET_INFO
78 - #define storage_get_info(drive, info) ata_get_info(IF_MD2(drive,) info)
79 - #endif
8079 #ifdef HAVE_HOTSWAP
8180 #define storage_removable(drive) ata_removable(IF_MD(drive))
8281 #define storage_present(drive) ata_present(IF_MD(drive))
@@ -97,9 +96,6 @@
9897 #define storage_last_disk_activity() sd_last_disk_activity()
9998 #define storage_get_identify() sd_get_identify()
10099
101 - #ifdef STORAGE_GET_INFO
102 - #define storage_get_info(drive, info) sd_get_info(IF_MD2(drive,) info)
103 - #endif
104100 #ifdef HAVE_HOTSWAP
105101 #define storage_removable(drive) sd_removable(IF_MD(drive))
106102 #define storage_present(drive) sd_present(IF_MD(drive))
@@ -121,9 +117,6 @@
122118 #define storage_last_disk_activity() mmc_last_disk_activity()
123119 #define storage_get_identify() mmc_get_identify()
124120
125 - #ifdef STORAGE_GET_INFO
126 - #define storage_get_info(drive, info) mmc_get_info(IF_MD2(drive,) info)
127 - #endif
128121 #ifdef HAVE_HOTSWAP
129122 #define storage_removable(drive) mmc_removable(IF_MD(drive))
130123 #define storage_present(drive) mmc_present(IF_MD(drive))
@@ -145,9 +138,6 @@
146139 #define storage_last_disk_activity() nand_last_disk_activity()
147140 #define storage_get_identify() nand_get_identify()
148141
149 - #ifdef STORAGE_GET_INFO
150 - #define storage_get_info(drive, info) nand_get_info(IF_MD2(drive,) info)
151 - #endif
152142 #ifdef HAVE_HOTSWAP
153143 #define storage_removable(drive) nand_removable(IF_MD(drive))
154144 #define storage_present(drive) nand_present(IF_MD(drive))
@@ -169,9 +159,6 @@
170160 #define storage_last_disk_activity() ramdisk_last_disk_activity()
171161 #define storage_get_identify() ramdisk_get_identify()
172162
173 - #ifdef STORAGE_GET_INFO
174 - #define storage_get_info(drive, info) ramdisk_get_info(IF_MD2(drive,) info)
175 - #endif
176163 #ifdef HAVE_HOTSWAP
177164 #define storage_removable(drive) ramdisk_removable(IF_MD(drive))
178165 #define storage_present(drive) ramdisk_present(IF_MD(drive))
@@ -194,9 +181,6 @@
195182 void storage_spindown(int seconds);
196183 long storage_last_disk_activity(void);
197184 int storage_num_drives(void);
198 -#ifdef STORAGE_GET_INFO
199 -void storage_get_info(int drive, struct storage_info *info);
200 -#endif
201185 #ifdef HAVE_HOTSWAP
202186 bool storage_removable(int drive);
203187 bool storage_present(int drive);
@@ -208,4 +192,7 @@
209193 int storage_read_sectors_md(int drive, unsigned long start, int count, void* buf);
210194 int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);
211195 int storage_write_sectors_md(int drive, unsigned long start, int count, const void* buf);
 196+#ifdef STORAGE_GET_INFO
 197+void storage_get_info(int drive, struct storage_info *info);
212198 #endif
 199+#endif