All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alasdair G Kergon <agk@redhat.com>
To: Jim Meyering <jim@meyering.net>
Cc: device-mapper development <dm-devel@redhat.com>,
	LVM <lvm-devel@redhat.com>
Subject: Re: [lvm-devel] Allow $DM_DEVDIR envvar to override default of "/dev".
Date: Tue, 9 Oct 2007 03:00:40 +0100	[thread overview]
Message-ID: <20071009020040.GR10006@agk.fab.redhat.com> (raw)
In-Reply-To: <87przp1psr.fsf@rho.meyering.net>

On Mon, Oct 08, 2007 at 07:25:56PM +0200, Jim Meyering wrote:
> any existing LVM set-up, I've been using LVM_SYSTEM_DIR to specify

> Here's a patch to make dmsetup honor a new DM_DEVDIR envvar,

Small point, but should that be DM_DEV_DIR for consistency with
LVM_SYSTEM_DIR ?

> +	} else {
> +		dev_dir = "/dev";

Can you make that a #define at the top of the file?
(Try to keep hard-coded values easy to spot.)

> +	if (*dev_dir != '/')
> +		return 0;

log_error ?
(Functions should produce an error message as close as possible to the
place the problem is detected; all functions that return failure must
log a message before returning - using a macro like 'stack' if you don't
want the user to see it.  The only exceptions (very rare) are functions
expected to fail frequently that would produce too many log messages.)

> +	if (snprintf(_dm_dir, sizeof _dm_dir, "%s%s%s", dev_dir, slash, DM_DIR)
> +	    >= sizeof _dm_dir)
> +		return 0;

and here

Also consider dm_snprintf rather than snprintf.
[lvm2 uses this, but bits of dm haven't been converted]

Alasdair
-- 
agk@redhat.com

WARNING: multiple messages have this Message-ID (diff)
From: Alasdair G Kergon <agk@redhat.com>
To: lvm-devel@redhat.com
Subject: Allow $DM_DEVDIR envvar to override default of "/dev".
Date: Tue, 9 Oct 2007 03:00:40 +0100	[thread overview]
Message-ID: <20071009020040.GR10006@agk.fab.redhat.com> (raw)
In-Reply-To: <87przp1psr.fsf@rho.meyering.net>

On Mon, Oct 08, 2007 at 07:25:56PM +0200, Jim Meyering wrote:
> any existing LVM set-up, I've been using LVM_SYSTEM_DIR to specify

> Here's a patch to make dmsetup honor a new DM_DEVDIR envvar,

Small point, but should that be DM_DEV_DIR for consistency with
LVM_SYSTEM_DIR ?

> +	} else {
> +		dev_dir = "/dev";

Can you make that a #define at the top of the file?
(Try to keep hard-coded values easy to spot.)

> +	if (*dev_dir != '/')
> +		return 0;

log_error ?
(Functions should produce an error message as close as possible to the
place the problem is detected; all functions that return failure must
log a message before returning - using a macro like 'stack' if you don't
want the user to see it.  The only exceptions (very rare) are functions
expected to fail frequently that would produce too many log messages.)

> +	if (snprintf(_dm_dir, sizeof _dm_dir, "%s%s%s", dev_dir, slash, DM_DIR)
> +	    >= sizeof _dm_dir)
> +		return 0;

and here

Also consider dm_snprintf rather than snprintf.
[lvm2 uses this, but bits of dm haven't been converted]

Alasdair
-- 
agk at redhat.com



  reply	other threads:[~2007-10-09  2:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 17:25 Allow $DM_DEVDIR envvar to override default of "/dev" Jim Meyering
2007-10-08 17:25 ` Jim Meyering
2007-10-09  2:00 ` Alasdair G Kergon [this message]
2007-10-09  2:00   ` Alasdair G Kergon
2007-10-09 11:43   ` [lvm-devel] " Jim Meyering
2007-10-09 11:43     ` Jim Meyering
2007-10-09 11:56     ` [lvm-devel] " Alasdair G Kergon
2007-10-09 11:56       ` Alasdair G Kergon
2007-10-09 11:54   ` [lvm-devel] " Jim Meyering
2007-10-09 11:54     ` Jim Meyering
2007-10-09 12:04     ` Re: [lvm-devel] " Jim Meyering
2007-10-09 12:04       ` [dm-devel] " Jim Meyering

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=20071009020040.GR10006@agk.fab.redhat.com \
    --to=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=jim@meyering.net \
    --cc=lvm-devel@redhat.com \
    /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.