Hi Tom,

I ended up figuring this out myself. I slightly modified the vold code.
Im not entirely sure that it is all needed, but it works for me :)

Attached is a diff file (in SVN diff output format, so you will have to 
do the changes by hand if you cant use it, but dont worry, the changes 
are small).
Also attached in the vold.conf that I am now using with these changes. 
You will need to change media_path to your block device file locations.

Hope that helps.

Regards,

Bob


Tom wrote:
> Hi Robert,
>
> I would really be interested by the answer too.
> Could someone from Google please reply?
> Or will we have to look inside vold code alone?
>
> Thks
>
> Tom
>
>
>
>
> On 24 août, 13:15, Robert Beckett <[email protected]> wrote:
>   
>> Hello all,
>>
>> Does anyone know ifvoldcan be used like mountd to mount any generic
>> block device?
>>
>> I have an sd host that is not SD Host Controller Spec compliant, and the
>> driver is not based on the linux mmc subsystem. With mountd it was
>> trivial to get it to mount any block device. Is there a similar mode 
>> forvold? or do I need to write my ownvold/mmc.c equivalent?
>>
>> Thanks
>>
>> Bob
>>     
> >
>   


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Index: system/core/vold/volmgr.c
===================================================================
--- system/core/vold/volmgr.c	(revision 18)
+++ system/core/vold/volmgr.c	(revision 46)
@@ -868,6 +868,8 @@
                 new->media_type = media_mmc;
             else if (!strcmp(child->value, "devmapper"))
                 new->media_type = media_devmapper;
+            else if (!strcmp(child->value, "block"))
+                new->media_type = media_block;
             else {
                 LOGE("Invalid media type '%s'", child->value);
                 rc = -EINVAL;
@@ -916,6 +918,20 @@
         }
         LOG_VOL("media path for devmapper volume = '%s'", dm_mediapath);
         volmgr_add_mediapath_to_volume(new, dm_mediapath);
+    } else if (new->media_type == media_block) {
+        media_t * media = NULL;
+        if (!new->media_paths[0] || !new->mount_point ) {
+            LOGE("Required configuration parameter missing for block volume");
+            rc = -EINVAL;
+            goto out_free;
+        }
+        media = media_create(new->media_paths[0], "unknown", "unknown", media_block);
+        if(!media)
+        {
+          LOGE("Unable to create media for block device!");
+          rc = -EINVAL;
+          goto out_free;
+        }
     }
 
     if (!vol_root)
Index: system/core/vold/uevent.c
===================================================================
--- system/core/vold/uevent.c	(revision 18)
+++ system/core/vold/uevent.c	(revision 46)
@@ -298,15 +298,18 @@
                  strlen("/devices/virtual/"))) {
         n = 0;
     } else if (!strcmp(get_uevent_param(event, "DEVTYPE"), "disk"))
-        n = 2;
+        n = 0;
     else if (!strcmp(get_uevent_param(event, "DEVTYPE"), "partition"))
-        n = 3;
+        n = 0;
     else {
         LOGE("Bad blockdev type '%s'", get_uevent_param(event, "DEVTYPE"));
         return -EINVAL;
     }
 
     truncate_sysfs_path(event->path, n, mediapath, sizeof(mediapath));
+#if DEBUG_UEVENT
+    LOG_VOL("truncated path '%s' to '%s'", event->path, mediapath);
+#endif
 
     if (!(media = media_lookup_by_path(mediapath, false))) {
 #if DEBUG_UEVENT
@@ -352,6 +355,27 @@
                 blkdev->major, blkdev->minor, media->name, mediapath,
                 blkdev_get_num_pending_partitions(blkdev->disk));
 
+#if DEBUG_UEVENT
+        {
+          int tmp = blkdev_get_num_pending_partitions(blkdev->disk);
+          
+          LOG_VOL("Num Parts = %d", tmp);
+          if(tmp == 0)
+          {
+            tmp = volmgr_consider_disk(blkdev->disk);
+            LOG_VOL("volmgr_consider_disk returned %d", tmp);
+            if(tmp < 0)
+            {
+              if (rc == -EBUSY) {
+                LOGI("Volmgr not ready to handle device");
+              } else {
+                LOGE("Volmgr failed to handle device (%d)", rc);
+                return rc;
+              }
+            }
+          }
+        }
+#else
         if (blkdev_get_num_pending_partitions(blkdev->disk) == 0) {
             if ((rc = volmgr_consider_disk(blkdev->disk)) < 0) {
                 if (rc == -EBUSY) {
@@ -362,6 +386,7 @@
                 }
             }
         }
+#endif
     } else if (event->action == action_remove) {
         if (!(blkdev = blkdev_lookup_by_devno(maj, min)))
             return 0;
Index: system/core/vold/media.h
===================================================================
--- system/core/vold/media.h	(revision 18)
+++ system/core/vold/media.h	(revision 46)
@@ -26,6 +26,7 @@
     media_unknown,
     media_mmc,
     media_devmapper,
+    media_block,
 } media_type_t;
 
 typedef struct media {
volume_sdcard {
    media_path /block/mmcblk01
    media_type block
    mount_point /sdcard
}
volume_sdcardp1 {
    media_path /block/mmcblk01/mmcblk01p1
    media_type block
    mount_point /sdcard
}

Reply via email to