All of lore.kernel.org
 help / color / mirror / Atom feed
From: JONGMAN HEO <jongman.heo@samsung.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Erasing MMC partition from kernel module, what's best way to do that?
Date: Mon, 09 Jan 2012 10:14:28 +0000 (GMT)	[thread overview]
Message-ID: <21845361.155711326104068000.JavaMail.weblogic@epml02> (raw)


Hi all,
Please excuse me, I have some noob question regarding MMC.

I'd like to erase(discard) certain MMC partition from kernel space (i.e. kernel module).
I know this is quite ugly design, but I have no choice but to implement the feature (erasing given MMC partition) within kernel space for other reasons.

Assume /dev/mmcblk0p2 needs to be erased.

First, I tried to use BLKDISCARD ioctl. From user space, it works.
In kernel space, I had to use ugly code, like set_fs(), filp_open(), etc in order to access "/dev/mmcblk0p2" device.
I stuck at sys_ioctl(), which is not exported symbol so that I couldn't use the sys_ioctl() from my module for the BLKDISCARD ioctl.

Alternatively, I want to make a new exported API to execute the discard request for "/dev/mmcblk0p2" device (like mmc_test_area_erase() in mmc_test.c).
Here, it seems that I need to get "struct mmc_card *card" instance, which is a first parameter of mmc_erase().

How can I get the "card" instance for current MMC device? Is there any way to do that?

Thanks in advance,
Jongman.

             reply	other threads:[~2012-01-09 10:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 10:14 JONGMAN HEO [this message]
2012-01-11 19:19 ` Erasing MMC partition from kernel module, what's best way to do that? Chris Ball

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=21845361.155711326104068000.JavaMail.weblogic@epml02 \
    --to=jongman.heo@samsung.com \
    --cc=linux-mmc@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.