diff mbox

[android/system/core] init: support mmc device mount (by partition)

Message ID AANLkTimQQgZSeYmA1cFbqCgpZrY2kB4x9w_QV_MsMEBg@mail.gmail.com
State New
Headers show

Commit Message

Jim Huang Feb. 23, 2011, 9:45 a.m. UTC
init.rc usage example:
    mount vfat mmc@blk1p3 /mnt/sdcard2
---
 init/builtins.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Alexander Sack Feb. 23, 2011, 12:58 p.m. UTC | #1
On Wed, Feb 23, 2011 at 10:45 AM, Jim Huang <jim.huang@linaro.org> wrote:
> init.rc usage example:
>    mount vfat mmc@blk1p3 /mnt/sdcard2

this feels like a weird split of the device name with mmc before and
blk1 after the @. especially if you look how its used with mtd@FSNAME

how about using mmcblkX@FSNAME or even mmc@uuid:UUID ?


> ---
>  init/builtins.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/init/builtins.c b/init/builtins.c
> index e0ccf9f..32d9d7f 100644
> --- a/init/builtins.c
> +++ b/init/builtins.c
> @@ -356,6 +356,16 @@ int do_mount(int nargs, char **args)
>         close(fd);
>         ERROR("out of loopback devices");
>         return -1;
> +    } else if (!strncmp(source, "mmc@blk", 7)) {
> +        sprintf(tmp, "/dev/block/mmcblk%s", source + 7);
> +
> +        if (wait)
> +            wait_for_file(tmp, COMMAND_RETRY_TIMEOUT);
> +        if (mount(tmp, target, system, flags, options) < 0) {
> +            return -1;
> +        }
> +
> +        return 0;
>     } else {
>         if (wait)
>             wait_for_file(source, COMMAND_RETRY_TIMEOUT);
> --
> 1.7.2.3
>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
>
Jim Huang Feb. 23, 2011, 1:30 p.m. UTC | #2
On 23 February 2011 20:58, Alexander Sack <asac@linaro.org> wrote:
> On Wed, Feb 23, 2011 at 10:45 AM, Jim Huang <jim.huang@linaro.org> wrote:
>> init.rc usage example:
>>    mount vfat mmc@blk1p3 /mnt/sdcard2
>
> this feels like a weird split of the device name with mmc before and
> blk1 after the @. especially if you look how its used with mtd@FSNAME
>
> how about using mmcblkX@FSNAME or even mmc@uuid:UUID ?

Initially, I wanted to support find-by-name as
device/samsung/crespo/init.herring.rc does in Android 2.3:

    mount ext4 /dev/block/platform/s3c-sdhci.0/by-name/system /system wait ro

So, the naming scheme is followed as mmc@system.  However, I have to
consider the label attribute about
different file system implementations, and the similar functionality
like 'blkid' must exist in order to take care
about find-by-name.  Since /init is statically-linked, no other
libraries should be imported, we should always
keep it compact.

Therefore, considering the backward compatibility, I take "mmc@blk1p3"
now, and it can become "mmc@system"
in next patches once the facility is implemented.

Yes, I agree with you.  It looks weird, but we should consider the
consistency: mmc, mtd, loop, etc.
"mmcblk" has different meaning rather than "mmc" as far as I know.

I have no idea about the naming, and I would just focus on how to
implement a generic approach to mount
each MMC partition in early Android userspace.

Thanks for your input.

-jserv

>> ---
>>  init/builtins.c |   10 ++++++++++
>>  1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/init/builtins.c b/init/builtins.c
>> index e0ccf9f..32d9d7f 100644
>> --- a/init/builtins.c
>> +++ b/init/builtins.c
>> @@ -356,6 +356,16 @@ int do_mount(int nargs, char **args)
>>         close(fd);
>>         ERROR("out of loopback devices");
>>         return -1;
>> +    } else if (!strncmp(source, "mmc@blk", 7)) {
>> +        sprintf(tmp, "/dev/block/mmcblk%s", source + 7);
>> +
>> +        if (wait)
>> +            wait_for_file(tmp, COMMAND_RETRY_TIMEOUT);
>> +        if (mount(tmp, target, system, flags, options) < 0) {
>> +            return -1;
>> +        }
>> +
>> +        return 0;
>>     } else {
>>         if (wait)
>>             wait_for_file(source, COMMAND_RETRY_TIMEOUT);
>> --
>> 1.7.2.3
diff mbox

Patch

diff --git a/init/builtins.c b/init/builtins.c
index e0ccf9f..32d9d7f 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -356,6 +356,16 @@  int do_mount(int nargs, char **args)
         close(fd);
         ERROR("out of loopback devices");
         return -1;
+    } else if (!strncmp(source, "mmc@blk", 7)) {
+        sprintf(tmp, "/dev/block/mmcblk%s", source + 7);
+
+        if (wait)
+            wait_for_file(tmp, COMMAND_RETRY_TIMEOUT);
+        if (mount(tmp, target, system, flags, options) < 0) {
+            return -1;
+        }
+
+        return 0;
     } else {
         if (wait)
             wait_for_file(source, COMMAND_RETRY_TIMEOUT);