[maemo-commits] [maemo-commits] r18035 - in projects/haf/trunk/ke-recv: debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Apr 8 16:50:26 EEST 2009
- Previous message: [maemo-commits] r18034 - projects/haf/trunk/clutter0.8/debian
- Next message: [maemo-commits] r18036 - in projects/haf/trunk/libmatchbox2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2009-04-08 16:50:22 +0300 (Wed, 08 Apr 2009) New Revision: 18035 Modified: projects/haf/trunk/ke-recv/debian/changelog projects/haf/trunk/ke-recv/src/events.c projects/haf/trunk/ke-recv/src/events.h projects/haf/trunk/ke-recv/src/ke-recv.c projects/haf/trunk/ke-recv/src/mmc-format.c projects/haf/trunk/ke-recv/src/osso-mmc-umount.sh Log: lots of fixes Modified: projects/haf/trunk/ke-recv/debian/changelog =================================================================== --- projects/haf/trunk/ke-recv/debian/changelog 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/debian/changelog 2009-04-08 13:50:22 UTC (rev 18035) @@ -2,6 +2,15 @@ * Added more FAT partition types as supported types to the mount script. * Fixes: NB#109543 - ke-recv regards FAT16 as unsupported format + * init_card(): Do not assume card as external if HAL does not give the + information about which one is it. + * device_removed(): Do not check if USB storage/volume was removed if the + storage list is empty (avoids a bogus error message). + * mmc-format: Remove "-F 32" command line option to avoid 'Not enough + clusters for a 32 bit FAT' error encountered in NB#90175. + * Now do lazy unmount in osso-mmc-umount.sh in case the cover is opened. + * Fixes: NB#109742 - External MMC card cannot be unmounted when filesystem + is busy, even if the card is physically removed. -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Mon, 6 Apr 2009 10:15:20 +0300 Modified: projects/haf/trunk/ke-recv/src/events.c =================================================================== --- projects/haf/trunk/ke-recv/src/events.c 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/src/events.c 2009-04-08 13:50:22 UTC (rev 18035) @@ -43,7 +43,7 @@ static void usb_share_card(mmc_info_t *mmc, gboolean show); static int mount_volumes(mmc_info_t *mmc, gboolean show_errors); -static int do_unmount(const char *mountpoint); +static int do_unmount(const char *mountpoint, gboolean lazy); static void open_dialog_helper(mmc_info_t *mmc); static volume_list_t *get_nth_volume(mmc_info_t *mmc, int n); @@ -659,7 +659,7 @@ /* Currently renaming is done to unmounted memory card. This would * not be necessary, but there is a problem of updating the volume * label otherwise (sending GnomeVFS signals didn't work). */ - if (do_unmount(mmc->mount_point)) { + if (do_unmount(mmc->mount_point, FALSE)) { ret = exec_prog(args[0], args); if (ret != 0) { ULOG_ERR_F("mlabel failed: exec_prog returned %d", @@ -730,10 +730,10 @@ ULOG_DEBUG_F("using device file %s", args[1]); if (vol->mountpoint != NULL) - ret = do_unmount(vol->mountpoint); + ret = do_unmount(vol->mountpoint, FALSE); else { ULOG_DEBUG_F("no mountpoint, using dev_name"); - ret = do_unmount(vol->dev_name); + ret = do_unmount(vol->dev_name, FALSE); } } else { args[1] = mmc->whole_device; @@ -745,7 +745,7 @@ args[2] = buf; args[3] = mmc->desired_label; - ret = unmount_volumes(mmc); + ret = unmount_volumes(mmc, FALSE); } if (!ret) { ULOG_INFO_F("memory card %s is in use", mmc->name); @@ -963,13 +963,16 @@ return count; } -static int do_unmount(const char *mountpoint) +static int do_unmount(const char *mountpoint, gboolean lazy) { - const char* umount_args[] = {MMC_UMOUNT_COMMAND, NULL, NULL}; + const char* umount_args[] = {MMC_UMOUNT_COMMAND, NULL, NULL, NULL}; int ret; emit_gnomevfs_pre_unmount(mountpoint); umount_args[1] = mountpoint; + + if (lazy) umount_args[2] = "lazy"; + ret = exec_prog(MMC_UMOUNT_COMMAND, umount_args); if (ret == 0) { return 1; @@ -999,14 +1002,14 @@ rm_volume_from_list(&mmc->volumes, udi); return; } - if (!do_unmount(l->mountpoint)) { + if (!do_unmount(l->mountpoint, TRUE)) { ULOG_INFO_F("couldn't unmount %s", udi); } rm_volume_from_list(&mmc->volumes, udi); } /* try to unmount all volumes on the list */ -int unmount_volumes(mmc_info_t *mmc) +int unmount_volumes(mmc_info_t *mmc, gboolean lazy) { int all_unmounted = 1; @@ -1023,7 +1026,7 @@ * lower-level issues. Sometimes is_mounted * property cannot be trusted. */ if (l->mountpoint != NULL - && do_unmount(l->mountpoint)) { + && do_unmount(l->mountpoint, lazy)) { /* unmount succeeded or it * was not mounted */ } @@ -1034,7 +1037,7 @@ l->udi); continue; } - if (do_unmount(l->mountpoint)) { + if (do_unmount(l->mountpoint, lazy)) { ULOG_DEBUG_F("unmounted %s", l->udi); } else { ULOG_INFO_F("couldn't unmount %s", l->udi); @@ -1051,7 +1054,8 @@ mmc->preferred_volume); all_unmounted = 0; } else { - if (vol->mountpoint && do_unmount(vol->mountpoint)) { + if (vol->mountpoint && + do_unmount(vol->mountpoint, lazy)) { ULOG_DEBUG_F("unmounted %s", vol->udi); } else { ULOG_INFO_F("couldn't unmount %s", vol->udi); @@ -1238,7 +1242,7 @@ break; } possibly_turn_swap_off(NORMAL_DIALOG, mmc); - if (!unmount_volumes(mmc)) { + if (!unmount_volumes(mmc, TRUE)) { open_dialog_helper(mmc); setup_s_unmount_pending(mmc); mmc->state = S_UNMOUNT_PENDING; @@ -1250,7 +1254,7 @@ if (!ignore_cable && in_mass_storage_mode() && !device_locked) { possibly_turn_swap_off(NO_DIALOG, mmc); - if (!unmount_volumes(mmc)) { + if (!unmount_volumes(mmc, FALSE)) { ret = 0; } else { usb_share_card(mmc, TRUE); @@ -1315,7 +1319,7 @@ if (!ignore_cable && in_mass_storage_mode()) { unshare_usb_shared_card(mmc); } else { - unmount_volumes(mmc); + unmount_volumes(mmc, TRUE); } break; case E_ENABLE_SWAP: @@ -1383,7 +1387,7 @@ case E_UNMOUNT_TIMEOUT: ULOG_DEBUG_F("E_UNMOUNT_TIMEOUT for %s", mmc->name); mmc->unmount_pending_timer_id = 0; - if (!unmount_volumes(mmc)) { + if (!unmount_volumes(mmc, FALSE)) { open_dialog_helper(mmc); setup_s_unmount_pending(mmc); } else { @@ -1395,7 +1399,7 @@ case E_VOLUME_REMOVED: ULOG_DEBUG_F("E_VOLUME_REMOVED for %s", mmc->name); discard_volume(mmc, arg); - if (unmount_volumes(mmc)) { + if (unmount_volumes(mmc, TRUE)) { dismantle_s_unmount_pending(mmc); CLOSE_DIALOG CLOSE_SWAP_DIALOG Modified: projects/haf/trunk/ke-recv/src/events.h =================================================================== --- projects/haf/trunk/ke-recv/src/events.h 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/src/events.h 2009-04-08 13:50:22 UTC (rev 18035) @@ -140,7 +140,7 @@ int handle_event(mmc_event_t e, mmc_info_t *mmc, const char *arg); void do_global_init(void); -int unmount_volumes(mmc_info_t *mmc); +int unmount_volumes(mmc_info_t *mmc, gboolean lazy); void inform_camera_out(gboolean value); void inform_camera_turned_out(gboolean value); void inform_slide_keyboard(gboolean value); Modified: projects/haf/trunk/ke-recv/src/ke-recv.c =================================================================== --- projects/haf/trunk/ke-recv/src/ke-recv.c 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/src/ke-recv.c 2009-04-08 13:50:22 UTC (rev 18035) @@ -1310,6 +1310,7 @@ return num_volumes; } +#ifndef FREMANTLE_MODE static void init_usb_volumes() { storage_info_t *si; @@ -1346,6 +1347,7 @@ libhal_free_string_array(list); } } +#endif #if 0 static void init_camera_state() @@ -1510,10 +1512,10 @@ slot = get_prop_string(udi, "mmc_host.slot_name"); - if (slot == NULL || strcmp(slot, "external") == 0) { + if (slot && strcmp(slot, "external") == 0) { mmc = &ext_mmc; internal = 0; - } else if (strcmp(slot, "internal") == 0) { + } else if (slot && strcmp(slot, "internal") == 0) { mmc = &int_mmc; internal = 1; } else { @@ -2182,7 +2184,7 @@ si = storage_list; while (si != NULL) { if (si->storage_udi != NULL) { - if (!unmount_volumes(&si->volumes)) { + if (!unmount_volumes(&si->volumes, FALSE)) { ULOG_WARN("couldn't unmount all volumes" " for %s", si->storage_udi); all_unmounted = 0; @@ -2491,6 +2493,7 @@ handle_event(E_DEVICE_ADDED, mmc, storage_udi); } +#ifndef FREMANTLE_MODE static void init_usb_storages() { int num_devices = 0; @@ -2524,6 +2527,7 @@ } libhal_free_string_array(list); } +#endif static void device_added(LibHalContext *ctx, const char *udi) { @@ -2657,26 +2661,28 @@ return; } - /* check if it's one of the USB mass storages */ - si = storage_from_list(udi); - if (si != NULL) { - ULOG_DEBUG_F("USB STORAGE REMOVED %s", udi); - zero_storage_info(si); - if (usb_storage_count() == 0 - && usb_device_name != NULL) { - /* invalidate the device name */ - free(usb_device_name); - usb_device_name = NULL; - } - } else if ((vol = usb_volume_from_list(udi)) != NULL) { - ULOG_DEBUG_F("USB VOLUME REMOVED %s", udi); - if (usb_state == S_HOST) { - if (!unmount_volume(vol)) { - ULOG_WARN_F("couldn't unmount USB " - "VOLUME %s", udi); + if (storage_list != NULL) { + /* check if it's one of the USB mass storages */ + si = storage_from_list(udi); + if (si != NULL) { + ULOG_DEBUG_F("USB STORAGE REMOVED %s", udi); + zero_storage_info(si); + if (usb_storage_count() == 0 + && usb_device_name != NULL) { + /* invalidate the device name */ + free(usb_device_name); + usb_device_name = NULL; } + } else if ((vol = usb_volume_from_list(udi)) != NULL) { + ULOG_DEBUG_F("USB VOLUME REMOVED %s", udi); + if (usb_state == S_HOST) { + if (!unmount_volume(vol)) { + ULOG_WARN_F("couldn't unmount USB " + "VOLUME %s", udi); + } + } + zero_volume_info(vol); } - zero_volume_info(vol); } } Modified: projects/haf/trunk/ke-recv/src/mmc-format.c =================================================================== --- projects/haf/trunk/ke-recv/src/mmc-format.c 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/src/mmc-format.c 2009-04-08 13:50:22 UTC (rev 18035) @@ -163,7 +163,6 @@ const char* args[] = {MMC_FORMAT_COMMAND, NULL, "-n", NULL, /* volume label */ "-S", NULL, /* logical sector size */ - "-F", "32", /* FAT32 */ "-R", "38", /* reserved sectors */ "-s", "128", /* sectors per cluster */ NULL}; Modified: projects/haf/trunk/ke-recv/src/osso-mmc-umount.sh =================================================================== --- projects/haf/trunk/ke-recv/src/osso-mmc-umount.sh 2009-04-08 11:37:49 UTC (rev 18034) +++ projects/haf/trunk/ke-recv/src/osso-mmc-umount.sh 2009-04-08 13:50:22 UTC (rev 18035) @@ -20,7 +20,7 @@ # 02110-1301 USA if [ $# -lt 1 ]; then - echo "Usage: $0 <mount point>" + echo "Usage: $0 <mount point> [\"lazy\"]" exit 1 fi @@ -30,8 +30,13 @@ if [ $? = 0 ]; then # first try in gvfs way mmc-unmount $MP 2> /dev/null - if [ $? != 0 ]; then - # try if old-fashioned way works + RC=$? + if [ $RC != 0 -a $# = 2 ]; then + # lazy unmounting if mmc-unmount failed + echo "$0: lazy umount for $MP" + umount -l $MP 2> /dev/null + elif [ $RC != 0 ]; then + # old-fashioned unmounting if mmc-unmount failed umount $MP 2> /dev/null fi RC=$?
- Previous message: [maemo-commits] r18034 - projects/haf/trunk/clutter0.8/debian
- Next message: [maemo-commits] r18036 - in projects/haf/trunk/libmatchbox2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]