bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add support for SD/MMC storage cards on Linux


From: Harald Welte
Subject: [PATCH] Add support for SD/MMC storage cards on Linux
Date: Wed, 17 Sep 2008 08:52:22 +0800
User-agent: Mutt/1.5.18 (2008-05-17)

Hi!

Can you please review (and possibly apply) the following patch? I think it's
pretty straight forward and not copytightable, thus no copyright assignment
(and no Authors entry) should be required.   If you believe different, please
point me where to get the copyright assignment form that I need to sign.

Cheers,

commit f08cf81fad42a6c9c8bca83dc91a0fe1cdf9081a
Author: Harald Welte <address@hidden>
Date:   Wed Sep 17 08:44:54 2008 +0800

    Ad SD/MMC Storage Card support on Linux
    
    This patch adds a new SDMMC device type to represent SD/MMC
    cards.  There is nothing special about handling those devices,
    they are just standard block devices with different names.
    
    They use device major ID 179 and are usually called
    /dev/mmcblkN (where N is the card number) and the individual partitions
    /dev/mmcblkNpM (where M is the partition number).
    
    This patch was developed as part of an effort to make debian-installer
    support installation of Debian GNU/Linux on SD/MMC cards, as boot-from-SD
    is becoming a feature seen in mobile x86 devices.

:100644 100644 e955e6f... 568e019... M  AUTHORS
:100644 100644 fdfcb1f... 2a3421f... M  include/parted/device.h
:100644 100644 333f818... 983f232... M  libparted/arch/linux.c
:100644 100644 5e67584... d7c0292... M  parted/parted.c

diff --git a/AUTHORS b/AUTHORS
index e955e6f..568e019 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -231,3 +231,6 @@ Debarshi Ray            <address@hidden>
         * Introduce 'print devices' and alias 'print list' to 'print all'.
         * Alias 'mktable' to 'mklabel'.
         * Code and API clean-up, bug fixes, and other miscellaneous stuff.
+
+Harald Welte            <address@hidden>
+        * SD/MMC Storage card support on Linux
diff --git a/include/parted/device.h b/include/parted/device.h
index fdfcb1f..2a3421f 100644
--- a/include/parted/device.h
+++ b/include/parted/device.h
@@ -44,7 +44,8 @@ typedef enum {
         PED_DEVICE_VIODASD      = 10,
         PED_DEVICE_SX8          = 11,
         PED_DEVICE_DM           = 12,
-        PED_DEVICE_XVD          = 13
+        PED_DEVICE_XVD          = 13,
+        PED_DEVICE_SDMMC        = 14
 } PedDeviceType;
 
 typedef struct _PedDevice PedDevice;
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 333f818..983f232 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -255,6 +255,7 @@ struct blkdev_ioctl_param {
 #define SX8_MAJOR1              160
 #define SX8_MAJOR2              161
 #define XVD_MAJOR               202
+#define SDMMC_MAJOR             179
 
 #define SCSI_BLK_MAJOR(M) (                                             \
                 (M) == SCSI_DISK0_MAJOR                                 \
@@ -537,6 +538,8 @@ _device_probe_type (PedDevice* dev)
 #endif
         } else if (dev_major == XVD_MAJOR && (dev_minor % 0x10 == 0)) {
                 dev->type = PED_DEVICE_XVD;
+        } else if (dev_major == SDMMC_MAJOR && (dev_minor % 0x08 == 0)) {
+                dev->type = PED_DEVICE_SDMMC;
         } else {
                 dev->type = PED_DEVICE_UNKNOWN;
         }
@@ -1259,6 +1262,11 @@ linux_new (const char* path)
                         goto error_free_arch_specific;
                 break;
 
+        case PED_DEVICE_SDMMC:
+                if (!init_generic (dev, _("SD/MMC Storage Card")))
+                        goto error_free_arch_specific;
+                break;
+
         default:
                 ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                                 PED_EXCEPTION_CANCEL,
diff --git a/parted/parted.c b/parted/parted.c
index 5e67584..d7c0292 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1268,10 +1268,10 @@ do_print (PedDevice** dev)
         int             has_free_arg = 0;
         int             has_list_arg = 0;
         int             has_num_arg = 0;
-        const char *const transport[14] = {"unknown", "scsi", "ide", "dac960",
+        const char *const transport[15] = {"unknown", "scsi", "ide", "dac960",
                                           "cpqarray", "file", "ataraid", "i2o",
                                           "ubd", "dasd", "viodasd", "sx8", 
"dm",
-                                          "xvd"};
+                                          "xvd", "sd/mmc"};
         char*           peek_word;
         char*           start;
         char*           end;


-- 
- Harald Welte <address@hidden>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]