public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Ball <cjb@laptop.org>
To: Ulf Hansson <ulf.hansson@stericsson.com>
Cc: Sebastian Rasmussen <sebras@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andrei Warkentin <awarkentin@vmware.com>,
	Per FORLIN <per.forlin@stericsson.com>,
	Lee Jones <lee.jones@linaro.org>,
	Johan RUDHOLM <johan.rudholm@stericsson.com>,
	John BECKETT <john.beckett@stericsson.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH] mmc: boot partition ro lock support
Date: Mon, 24 Oct 2011 06:08:34 -0400	[thread overview]
Message-ID: <m2sjmi4s7x.fsf@bob.laptop.org> (raw)
In-Reply-To: <4EA52E92.1010406@stericsson.com> (Ulf Hansson's message of "Mon, 24 Oct 2011 11:23:30 +0200")

Hi Ulf,

On Mon, Oct 24 2011, Ulf Hansson wrote:
> The kernel could very much be used in manufacturing environment as
> well. Don't know if and how we should consider this.
>
> Do you think a change to an ioctl is a better alternative than sysfs?
> Then let's change to that!

Ah, we're not proposing a new ioctl for this -- we're proposing that the
perm-r/o command could be sent from a userspace binary that *uses* the
arbitrary command ioctl that we already have.

The arbitrary command ioctl is drivers/mmc/card/block.c:mmc_blk_ioctl_cmd().

Please could you send a version of the patch that supports power-on r/o
but not perm r/o, and perhaps also post userspace code for submitting
the perm r/o command through the ioctl interface?  (Perhaps this code
should eventually be submitted to a disk management tool..)

Also, it looks like it's possible to set read-only for the whole device,
as well as for boot partitions.  Could you update the patch to allow
setting power-on r/o for the entire card, not just the boot partitions?

> Enable boot partitions to be power and permanently read-only locked via
> a sysfs entry. There will be one sysfs entry for the main mmc device:
> 
> /sys/block/mmcblkX/boot_partition_ro_lock

I don't follow why this node is necessary, instead of just having the
nodes in the mmcblkXbootY/ directories.  Could you explain?

> and one for each boot partition:
> 
> /sys/block/mmcblkXbootY/ro_lock
>
> The boot partitions are power or permanently locked by writing "pwr_ro"
> or "perm_ro" to one of the files.

Now that we're only having one type of r/o lock, let's do:

  echo 1 > /sys/block/mmcblkXbootY/ro_lock_until_next_power_on

to lock just a boot partition, and:

  echo 1 > /sys/block/mmcblkX/ro_lock_until_next_power_on

to lock the entire card (which will cover the boot partition too), with
echo 0 to unlock.

Other review comments:  I noticed that your pr_*(); statements are
missing "\n"s on the end, and you should add documentation on the new
sysfs nodes to:
   Documentation/mmc/mmc-dev-parts.txt

I think the overlap between your patch and Andrei's mmcblkXbootY/force_ro
node is going to be confusing -- one operates purely in the kernel and
the other is sent to the card.  Do you have any proposal for making the
difference clearer?

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

  reply	other threads:[~2011-10-24 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 13:17 [PATCH] mmc: boot partition ro lock support Ulf Hansson
2011-10-22  1:44 ` Andrei Warkentin
2011-10-22 10:32   ` Chris Ball
2011-10-22 16:33     ` Linus Walleij
2011-10-22 16:55       ` Chris Ball
2011-10-23  0:51         ` Sebastian Rasmussen
2011-10-23  6:38           ` Chris Ball
2011-10-24  9:23             ` Ulf Hansson
2011-10-24 10:08               ` Chris Ball [this message]
2011-10-24 12:22                 ` Johan RUDHOLM
2011-10-25 21:31                   ` Andrei E. Warkentin
2011-11-22 12:15                 ` Johan RUDHOLM
2011-10-24 18:20             ` J Freyensee

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=m2sjmi4s7x.fsf@bob.laptop.org \
    --to=cjb@laptop.org \
    --cc=awarkentin@vmware.com \
    --cc=johan.rudholm@stericsson.com \
    --cc=john.beckett@stericsson.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=per.forlin@stericsson.com \
    --cc=sebras@gmail.com \
    --cc=ulf.hansson@stericsson.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox