* Erasing MMC partition from kernel module, what's best way to do that?
@ 2012-01-09 10:14 JONGMAN HEO
2012-01-11 19:19 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: JONGMAN HEO @ 2012-01-09 10:14 UTC (permalink / raw)
To: linux-mmc@vger.kernel.org
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Erasing MMC partition from kernel module, what's best way to do that?
2012-01-09 10:14 Erasing MMC partition from kernel module, what's best way to do that? JONGMAN HEO
@ 2012-01-11 19:19 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2012-01-11 19:19 UTC (permalink / raw)
To: jongman.heo; +Cc: linux-mmc@vger.kernel.org
Hi,
On Mon, Jan 09 2012, JONGMAN HEO wrote:
> 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?
I don't think we'll be interested in helping you with this -- as you
say, this is a very ugly design, and we already have the proper
userspace solution.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-11 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 10:14 Erasing MMC partition from kernel module, what's best way to do that? JONGMAN HEO
2012-01-11 19:19 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox