From df3fc52608daa1e10332f59cd2f226ba400d1c98 Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Tue, 24 May 2011 05:31:19 +0000 Subject: disk/part.c: Make features optional If we don't want to build support for any partition types we can now add #undef CONFIG_PARTITIONS in a board config file to keep this from being compiled in. Otherwise boards assume this is compiled in by default Signed-off-by: Matthew McClintock diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 7fbc053..2e8c6e0 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -719,10 +719,12 @@ void ide_init (void) /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t * ide_get_dev(int dev) { return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL; } +#endif #ifdef CONFIG_IDE_8xx_DIRECT diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 7efa859..f62c0cb 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -57,10 +57,12 @@ int __sata_initialize(void) } int sata_initialize(void) __attribute__((weak,alias("__sata_initialize"))); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *sata_get_dev(int dev) { return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL; } +#endif int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 8e8e930..fa10751 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -194,11 +194,12 @@ void scsi_init(void) } #endif +#ifdef CONFIG_PARTITIONS block_dev_desc_t * scsi_get_dev(int dev) { return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; } - +#endif /****************************************************************************** * scsi boot command intepreter. Derived from diskboot diff --git a/common/usb_storage.c b/common/usb_storage.c index 9ecf165..16667f3 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -173,11 +173,12 @@ unsigned long usb_stor_write(int device, unsigned long blknr, struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *usb_stor_get_dev(int index) { return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL; } - +#endif void usb_show_progress(void) { diff --git a/disk/Makefile b/disk/Makefile index 17266a2..5affe34 100644 --- a/disk/Makefile +++ b/disk/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)libdisk.o -COBJS-y += part.o +COBJS-$(CONFIG_PARTITIONS) += part.o COBJS-$(CONFIG_MAC_PARTITION) += part_mac.o COBJS-$(CONFIG_DOS_PARTITION) += part_dos.o COBJS-$(CONFIG_ISO_PARTITION) += part_iso.o diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index b74307a..f9e175d 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -522,10 +522,12 @@ mg_write_exit: return err; } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *mg_disk_get_dev(int dev) { return ((block_dev_desc_t *) & mg_disk_dev); } +#endif /* must override this function */ struct mg_drv_data * __attribute__((weak)) mg_get_drv_data (void) diff --git a/drivers/block/systemace.c b/drivers/block/systemace.c index e8dff0a..58402b9 100644 --- a/drivers/block/systemace.c +++ b/drivers/block/systemace.c @@ -104,6 +104,7 @@ static void release_cf_lock(void) ace_writew((val & 0xffff), 0x18); } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *systemace_get_dev(int dev) { /* The first time through this, the systemace_dev object is @@ -128,6 +129,7 @@ block_dev_desc_t *systemace_get_dev(int dev) return &systemace_dev; } +#endif /* * This function is called (by dereferencing the block_read pointer in diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index cbd7567..7e703c0 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1167,12 +1167,14 @@ int mmc_register(struct mmc *mmc) return 0; } +#ifdef CONFIG_PARTITIONS block_dev_desc_t *mmc_get_dev(int dev) { struct mmc *mmc = find_mmc_device(dev); return mmc ? &mmc->block_dev : NULL; } +#endif int mmc_init(struct mmc *mmc) { diff --git a/include/config_defaults.h b/include/config_defaults.h index 0337163..d023c63 100644 --- a/include/config_defaults.h +++ b/include/config_defaults.h @@ -16,5 +16,6 @@ #define CONFIG_GZIP 1 #define CONFIG_ZLIB 1 +#define CONFIG_PARTITIONS 1 #endif diff --git a/include/part.h b/include/part.h index 5243511..1827767 100644 --- a/include/part.h +++ b/include/part.h @@ -96,6 +96,7 @@ typedef struct disk_partition { } disk_partition_t; /* Misc _get_dev functions */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t* get_dev(char* ifname, int dev); block_dev_desc_t* ide_get_dev(int dev); block_dev_desc_t* sata_get_dev(int dev); @@ -110,7 +111,22 @@ int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t void print_part (block_dev_desc_t *dev_desc); void init_part (block_dev_desc_t *dev_desc); void dev_print(block_dev_desc_t *dev_desc); - +#else +static inline block_dev_desc_t* get_dev(char* ifname, int dev) { return NULL; } +static inline block_dev_desc_t* ide_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; } +static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; } + +static inline int get_partition_info (block_dev_desc_t * dev_desc, int part, + disk_partition_t *info) { return -1; } +static inline void print_part (block_dev_desc_t *dev_desc) {} +static inline void init_part (block_dev_desc_t *dev_desc) {} +static inline void dev_print(block_dev_desc_t *dev_desc) {} +#endif #ifdef CONFIG_MAC_PARTITION /* disk/part_mac.c */ -- cgit v0.10.2