All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] udev callout for reading filesystem labels
Date: Fri, 07 May 2004 21:52:56 +0000	[thread overview]
Message-ID: <20040507215256.GA3906@vrfy.org> (raw)
In-Reply-To: <20040429210446.GA9836@vrfy.org>

On Fri, May 07, 2004 at 08:25:34PM +0200, Arnd Bergmann wrote:
> - Call set_label_string() to normalize the dasd label like fs labels.
> - Improve set_label_string() to fix up other problems with the label
>   beside just trailing blanks.

> -static void set_label_string(struct volume_id *id, char *buf, int count)
> +void set_label_string(struct volume_id *id, char *buf, int count)
>  {
>  	int i;
>  
>  	memcpy(id->label_string, buf, count);
>  
> -	/* remove trailing whitespace */
> -	i = strlen(id->label_string);
> +	/* remove trailing whitespace and garbage */
> +	i = strnlen(id->label_string, VOLUME_ID_LABEL_SIZE);
>  	while (i--) {
> -		if (! isspace(id->label_string[i]))
> +		id->label_string[i+1] = '\0';
> +		if (isalnum(id->label_string[i]))
>  			break;
>  	}
> -	id->label_string[i+1] = '\0';
> +	/* replace remaining garbage with '_' */
> +	while (i--) {
> +		if (!isalnum(id->label_string[i]))
> +			id->label_string[i] = '_';

Hmm, doesn't it break UTF-8 characters, which are common in udf labels?
Should we better do it only for dasd and keep the set_label_string() private?

Kay


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-05-07 21:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29 21:04 [PATCH] udev callout for reading filesystem labels Kay Sievers
2004-04-30 13:35 ` Kevin P. Fleming
2004-04-30 14:36 ` Oliver Neukum
2004-04-30 22:29 ` Greg KH
2004-05-05  1:14 ` Kay Sievers
2004-05-05 21:24 ` Greg KH
2004-05-06  9:30 ` Arnd Bergmann
2004-05-06 20:18 ` Kay Sievers
2004-05-06 22:59 ` Kay Sievers
2004-05-07 14:02 ` Kay Sievers
2004-05-07 18:25 ` Arnd Bergmann
2004-05-07 21:52 ` Kay Sievers [this message]
2004-05-08 11:29 ` Kay Sievers
  -- strict thread matches above, loose matches on Subject: below --
2004-05-08 16:52 arndb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040507215256.GA3906@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.