[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add support for SD/MMC storage cards on Linux
From: |
Jim Meyering |
Subject: |
Re: [PATCH] Add support for SD/MMC storage cards on Linux |
Date: |
Wed, 17 Sep 2008 14:49:54 +0200 |
Harald Welte <address@hidden> wrote:
> On Wed, Sep 17, 2008 at 08:52:22AM +0800, Harald Welte wrote:
>
>> Can you please review (and possibly apply) the following patch?
>
> Here is an incremental patch to add support for the SD/MMC card type and name
> from sysfs to the parted device name.
Hi Harald,
Thanks for working on Parted!
Your patches look fine modulo the point below.
I agree with Otavio that we'll need a copyright assignment.
While we wait for the copyright paperwork to go through,
it'd be nice for me if you'd resubmit the patches in
"git format-patch" form. For example, there are instructions here:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=HACKING;hb=HEAD
That makes it easier for me to apply while retaining
the attribution that you wrote the patches.
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
...
> +static int
> +init_sdmmc (PedDevice* dev)
> +{
> + char id[128];
> + char *type, *name;
> +
> + if (sdmmc_get_product_info (dev, &type, &name)) {
> + snprintf (id, sizeof(id)-1, "%s %s", type, name);
> + free (type);
> + free (name);
> +
> + } else {
> + snprintf (id, sizeof(id, -1), "%s",
I presume that should be "sizeof(id) - 1".
> + _("Generic SD/MMC Storage Card"));
> + }
> + return init_generic(dev, id);
> +}
Also, you might want to use asprintf in place of snprintf.
Then you don't have to worry about pathologically long type+name
being truncated.