From e037fd7e193ecccbb5c0888e49f6d58c224bc11d Mon Sep 17 00:00:00 2001
From: The Android Open Source Project <initial-contribution@android.com>
Date: Fri, 13 Mar 2009 13:04:37 -0700
Subject: auto import from //branches/cupcake_rel/...@138607

---
 vold/blkdev.c      | 10 +++++-----
 vold/media.c       |  4 +---
 vold/uevent.c      | 12 +++++-------
 vold/vold.c        |  4 ++--
 vold/volmgr.c      | 28 ++++++++++++++--------------
 vold/volmgr_vfat.c |  2 --
 6 files changed, 27 insertions(+), 33 deletions(-)

(limited to 'vold')

diff --git a/vold/blkdev.c b/vold/blkdev.c
index 533bc35..981d0f2 100644
--- a/vold/blkdev.c
+++ b/vold/blkdev.c
@@ -107,8 +107,8 @@ int blkdev_refresh(blkdev_t *blk)
         blk->nr_parts = 0;
 
         if ((block[0x1fe] != 0x55) || (block[0x1ff] != 0xAA)) {
-            LOG_VOL("Disk %d:%d does not contain a partition table",
-                    blk->major, blk->minor);
+            LOGI("Disk %d:%d does not contain a partition table",
+                 blk->major, blk->minor);
             goto out;
         }
 
@@ -120,10 +120,10 @@ int blkdev_refresh(blkdev_t *blk)
                 struct fat_boot_sector *fb = (struct fat_boot_sector *) &block[0];
              
                 if (!i && fb->reserved && fb->fats && fat_valid_media(fb->media)) {
-                    LOG_VOL("Detected FAT filesystem in partition table");
+                    LOGI("Detected FAT filesystem in partition table");
                     break;
                 } else {
-                    LOG_VOL("Partition table looks corrupt");
+                    LOGI("Partition table looks corrupt");
                     break;
                 }
             }
@@ -157,7 +157,7 @@ int blkdev_refresh(blkdev_t *blk)
         sprintf(tmp2, " type 0x%x", blk->part_type);
 
     strcat(tmp, tmp2);
-    LOG_VOL(tmp);
+    LOGI(tmp);
 
     close(fd);
 
diff --git a/vold/media.c b/vold/media.c
index 40637ff..db42a3e 100644
--- a/vold/media.c
+++ b/vold/media.c
@@ -114,10 +114,8 @@ int media_add_blkdev(media_t *card, blkdev_t *dev)
 {
     blkdev_list_t *list_entry;
 
-    if (!(list_entry = malloc(sizeof(blkdev_list_t)))) {
-        LOGE("Out of memory");
+    if (!(list_entry = malloc(sizeof(blkdev_list_t))))
         return -ENOMEM;
-    }
     
     list_entry->next = NULL;
     list_entry->dev = dev;
diff --git a/vold/uevent.c b/vold/uevent.c
index b1a6944..d16f315 100644
--- a/vold/uevent.c
+++ b/vold/uevent.c
@@ -248,7 +248,6 @@ static int handle_powersupply_event(struct uevent *event)
             low_batt = true;
         else
             low_batt = false;
-LOG_VOL("handle_powersupply_event(): low_batt = %d, door_open = %d", low_batt, door_open);
         volmgr_safe_mode(low_batt || door_open);
     }
     return 0;
@@ -272,7 +271,6 @@ static int handle_switch_event(struct uevent *event)
             door_open = true;
         else
             door_open = false;
-LOG_VOL("handle_powersupply_event(): low_batt = %d, door_open = %d", low_batt, door_open);
         volmgr_safe_mode(low_batt || door_open);
     } else
         LOG_VOL("handle_switch_event(): Ignoring switch '%s'", name);
@@ -351,7 +349,7 @@ static int handle_block_event(struct uevent *event)
             return rc;
         }
 
-        LOG_VOL("New blkdev %d.%d on media %s, media path %s, Dpp %d",
+        LOGI("New blkdev %d.%d on media %s, media path %s, Dpp %d",
                 blkdev->major, blkdev->minor, media->name, mediapath,
                 blkdev_get_num_pending_partitions(blkdev->disk));
 
@@ -365,7 +363,7 @@ static int handle_block_event(struct uevent *event)
         if (!(blkdev = blkdev_lookup_by_devno(maj, min)))
             return 0;
 
-        LOG_VOL("Destroying blkdev %d.%d @ %s on media %s", blkdev->major,
+        LOGI("Destroying blkdev %d.%d @ %s on media %s", blkdev->major,
                 blkdev->minor, blkdev->devpath, media->name);
         volmgr_notify_eject(blkdev, _cb_blkdev_ok_to_destroy);
 
@@ -373,7 +371,7 @@ static int handle_block_event(struct uevent *event)
         if (!(blkdev = blkdev_lookup_by_devno(maj, min)))
             return 0;
 
-        LOG_VOL("Modified blkdev %d.%d @ %s on media %s", blkdev->major,
+        LOGI("Modified blkdev %d.%d @ %s on media %s", blkdev->major,
                 blkdev->minor, blkdev->devpath, media->name);
         
         blkdev_refresh(blkdev);
@@ -420,7 +418,7 @@ static int handle_mmc_event(struct uevent *event)
             LOGE("Unable to allocate new media (%m)");
             return -1;
         }
-        LOG_VOL("New MMC card '%s' (serial %u) added @ %s", media->name,
+        LOGI("New MMC card '%s' (serial %u) added @ %s", media->name,
                   media->serial, media->devpath);
     } else if (event->action == action_remove) {
         media_t *media;
@@ -430,7 +428,7 @@ static int handle_mmc_event(struct uevent *event)
             return -1;
         }
 
-        LOG_VOL("MMC card '%s' (serial %u) @ %s removed", media->name, 
+        LOGI("MMC card '%s' (serial %u) @ %s removed", media->name, 
                   media->serial, media->devpath);
         media_destroy(media);
     } else {
diff --git a/vold/vold.c b/vold/vold.c
index 17331ac..7d50a2f 100644
--- a/vold/vold.c
+++ b/vold/vold.c
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
     struct sockaddr_nl nladdr;
     int uevent_sz = 64 * 1024;
 
-    LOG_VOL("Android Volume Daemon version %d.%d", ver_major, ver_minor);
+    LOGI("Android Volume Daemon version %d.%d", ver_major, ver_minor);
 
     /*
      * Create all the various sockets we'll need
@@ -208,7 +208,7 @@ int send_msg(char* message)
 
     pthread_mutex_lock(&write_mutex);
 
-    LOG_VOL("send_msg(%s):", message);
+//    LOG_VOL("send_msg(%s):", message);
 
     if (fw_sock >= 0)
         result = write(fw_sock, message, strlen(message) + 1);
diff --git a/vold/volmgr.c b/vold/volmgr.c
index c3ce8d1..7c4c077 100644
--- a/vold/volmgr.c
+++ b/vold/volmgr.c
@@ -205,7 +205,7 @@ int volmgr_bootstrap(void)
     volume_t *v = vol_root;
     while (v) {
         if (_mountpoint_mounted(v->mount_point)) {
-            LOG_VOL("Volume '%s' already mounted at startup", v->mount_point);
+            LOGW("Volume '%s' already mounted at startup", v->mount_point);
             v->state = volstate_mounted;
         }
         v = v->next;
@@ -229,7 +229,7 @@ int volmgr_safe_mode(boolean enable)
         if (v->state == volstate_mounted && v->fs) {
             rc = v->fs->mount_fn(v->dev, v, safe_mode);
             if (!rc) {
-                LOG_VOL("Safe mode %s on %s", (enable ? "enabled" : "disabled"), v->mount_point);
+                LOGI("Safe mode %s on %s", (enable ? "enabled" : "disabled"), v->mount_point);
             } else {
                 LOGE("Failed to %s safe-mode on %s (%s)",
                      (enable ? "enable" : "disable" ), v->mount_point, strerror(-rc));
@@ -555,7 +555,7 @@ static int _volmgr_consider_disk_and_vol(volume_t *vol, blkdev_t *dev)
         
     }
 
-    LOG_VOL("Evaluating dev '%s' for mountable filesystems for '%s'",
+    LOGI("Evaluating dev '%s' for mountable filesystems for '%s'",
             dev->devpath, vol->mount_point);
 
     if (dev->nr_parts == 0) {
@@ -642,7 +642,7 @@ static void *volmgr_reaper_thread(void *arg)
     actions.sa_handler = volmgr_reaper_thread_sighandler;
     sigaction(SIGUSR1, &actions, NULL);
 
-    LOG_VOL("Reaper here - working on %s", vol->mount_point);
+    LOGW("Reaper here - working on %s", vol->mount_point);
 
     boolean send_sig_kill = false;
     int i, rc;
@@ -650,7 +650,7 @@ static void *volmgr_reaper_thread(void *arg)
     for (i = 0; i < 10; i++) {
         errno = 0;
         rc = umount(vol->mount_point);
-        LOG_VOL("volmngr reaper umount(%s) attempt %d (%s)",
+        LOGW("volmngr reaper umount(%s) attempt %d (%s)",
                 vol->mount_point, i + 1, strerror(errno));
         if (!rc)
             break;
@@ -667,7 +667,7 @@ static void *volmgr_reaper_thread(void *arg)
     }
 
     if (!rc) {
-        LOG_VOL("Reaper sucessfully unmounted %s", vol->mount_point);
+        LOGI("Reaper sucessfully unmounted %s", vol->mount_point);
         vol->fs = NULL;
         volume_setstate(vol, volstate_unmounted);
     } else {
@@ -687,7 +687,7 @@ static void volmgr_uncage_reaper(volume_t *vol, void (* cb) (volume_t *, void *a
     if (vol->worker_running) {
         LOGE("Worker thread is currently running.. waiting..");
         pthread_mutex_lock(&vol->worker_sem);
-        LOG_VOL("Worker thread now available");
+        LOGI("Worker thread now available");
     }
 
     vol->worker_args.reaper_args.cb = cb;
@@ -716,7 +716,7 @@ static int volmgr_stop_volume(volume_t *v, void (*cb) (volume_t *, void *), void
                 break;
             }
 
-            LOG_VOL("volmngr quick stop umount(%s) attempt %d (%s)",
+            LOGI("volmngr quick stop umount(%s) attempt %d (%s)",
                     v->mount_point, i + 1, strerror(errno));
 
             if (i == 0)
@@ -726,7 +726,7 @@ static int volmgr_stop_volume(volume_t *v, void (*cb) (volume_t *, void *), void
         }
 
         if (!rc) {
-            LOG_VOL("volmgr_stop_volume(%s): Volume unmounted sucessfully",
+            LOGI("volmgr_stop_volume(%s): Volume unmounted sucessfully",
                     v->mount_point);
             if (emit_statechange)
                 volume_setstate(v, volstate_unmounted);
@@ -738,7 +738,7 @@ static int volmgr_stop_volume(volume_t *v, void (*cb) (volume_t *, void *), void
          * Since the volume is still in use, dispatch the stopping to
          * a thread
          */
-        LOG_VOL("Volume %s is busy (%d) - uncaging the reaper", v->mount_point, rc);
+        LOGW("Volume %s is busy (%d) - uncaging the reaper", v->mount_point, rc);
         volmgr_uncage_reaper(v, cb, arg);
         return -EINPROGRESS;
     } else if (v->state == volstate_checking) {
@@ -1061,7 +1061,7 @@ static int volmgr_start_fs(struct volmgr_fstable_entry *fs, volume_t *vol, blkde
     if (vol->worker_running) {
         LOGE("Worker thread is currently running.. waiting..");
         pthread_mutex_lock(&vol->worker_sem);
-        LOG_VOL("Worker thread now available");
+        LOGI("Worker thread now available");
     }
 
     vol->dev = dev; 
@@ -1132,7 +1132,7 @@ static void *volmgr_start_fs_thread(void *arg)
         rc = fs->check_fn(dev);
         pthread_mutex_lock(&vol->lock);
         if (vol->state != volstate_checking) {
-            LOG_VOL("filesystem check aborted");
+            LOGE("filesystem check aborted");
             goto out;
         }
         
@@ -1146,14 +1146,14 @@ static void *volmgr_start_fs_thread(void *arg)
             goto out_unmountable;
         }
 #if DEBUG_VOLMGR
-        LOG_VOL("%s filesystem check of %d:%d OK", fs->name,
+        LOGI("%s filesystem check of %d:%d OK", fs->name,
                 dev->major, dev->minor);
 #endif
     }
 
     rc = fs->mount_fn(dev, vol, safe_mode);
     if (!rc) {
-        LOG_VOL("Sucessfully mounted %s filesystem %d:%d on %s (safe-mode %s)",
+        LOGI("Sucessfully mounted %s filesystem %d:%d on %s (safe-mode %s)",
                 fs->name, dev->major, dev->minor, vol->mount_point,
                 (safe_mode ? "on" : "off"));
         vol->fs = fs;
diff --git a/vold/volmgr_vfat.c b/vold/volmgr_vfat.c
index b08e6a5..344a166 100644
--- a/vold/volmgr_vfat.c
+++ b/vold/volmgr_vfat.c
@@ -107,8 +107,6 @@ int vfat_mount(blkdev_t *dev, volume_t *vol, boolean safe_mode)
 
     flags = MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_DIRSYNC;
 
-    if (safe_mode)
-        flags |= MS_SYNCHRONOUS;
     if (vol->state == volstate_mounted) {
         LOG_VOL("Remounting %d:%d on %s, safe mode %d", dev->major,
                 dev->minor, vol->mount_point, safe_mode);
-- 
cgit v1.1