All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: ext Richard Titmuss <richard_titmuss@logitech.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: Adding -N volume name to ubi utils
Date: Tue, 25 Nov 2008 10:53:39 +0200	[thread overview]
Message-ID: <492BBD13.7040408@nokia.com> (raw)
In-Reply-To: <492ADF69.8060602@logitech.com>

Richard Titmuss wrote:
> I am trying to modify the ubi tools in mtd_utils to allow the ubi volume 
> name to be specified on the command line, the relevant commands are 
> ubinfo, ubirmvol and ubiupdatevol. The idea is that you could use any of 
> the following command arguments to specify a ubi volume:
> 
>    ubirmvol /dev/ubi0 -N rootfs    # ubi device node and volume name
>    ubirmvol /dev/ubi0 -n 1    # ubi device node and volume id
>    ubirmvol /dev/ubi0_1    # ubi volume node
> 
> Other than consistency the main feature this adds is support for using 
> -N to specify the volume by name to all the commands.
> 
> The problem is these commands need different information to work:
> - ubinfo loads information from the /sys file system, it's easy to 
> support for all the above command arguments.
> - ubirmvol needs a ubi device node and a volume id, how can this work if 
> a volume node is specified?
> - ubiupdatevol needs a ubi volume node, how can this work if a device 
> node is specified?
> 
> So my questions is how can the appropriate device node be generated by 
> these commands if it is not specified on the command line. It would be 
> possible to use something like:
>   sprintf(node, "/dev/ubi%d_%d", args.devn, args.vol_id);
> 
> However I don't think that hard coding the /dev path is an acceptable 
> solution, and assume that's why the -d (device number) argument was 
> deprecated. Does anyone have any suggestions on a better solution?

In principle, you should use udev rules to create device nodes that
are easy to work with e.g.

/dev/ubi/rootfs/vol
/dev/ubi/rootfs/dev

so then you can make a script say ubirmvolbyname

#!/bin/sh
ubirmvol /dev/ubi/$1/dev -N $1

  reply	other threads:[~2008-11-25  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 17:07 Adding -N volume name to ubi utils Richard Titmuss
2008-11-25  8:53 ` Adrian Hunter [this message]
2008-12-02  8:56 ` Artem Bityutskiy

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=492BBD13.7040408@nokia.com \
    --to=ext-adrian.hunter@nokia.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard_titmuss@logitech.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.