[maemo-commits] [maemo-commits] r19007 - in projects/haf/tags/ke-recv/3.19-3: debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Jul 29 10:59:39 EEST 2009
- Previous message: [maemo-commits] r19006 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Next message: [maemo-commits] r19008 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2009-07-29 10:59:35 +0300 (Wed, 29 Jul 2009) New Revision: 19007 Modified: projects/haf/tags/ke-recv/3.19-3/debian/changelog projects/haf/tags/ke-recv/3.19-3/src/events.c projects/haf/tags/ke-recv/3.19-3/src/ke-recv.c projects/haf/tags/ke-recv/3.19-3/src/ke-recv.h Log: Fixes: NB#128388 - vfat should sit at the first partition Modified: projects/haf/tags/ke-recv/3.19-3/debian/changelog =================================================================== --- projects/haf/tags/ke-recv/3.19-3/debian/changelog 2009-07-28 16:59:15 UTC (rev 19006) +++ projects/haf/tags/ke-recv/3.19-3/debian/changelog 2009-07-29 07:59:35 UTC (rev 19007) @@ -1,3 +1,10 @@ +ke-recv (3.19-3) unstable; urgency=low + + * Changes to support the new partition layout. + * Fixes: NB#128388 - vfat should sit at the first partition + + -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Wed, 29 Jul 2009 10:57:40 +0300 + ke-recv (3.19-2fixes) unstable; urgency=low * Fixes: NB#127339 - AppCert-ke-recv doesn't export card if the partition Modified: projects/haf/tags/ke-recv/3.19-3/src/events.c =================================================================== --- projects/haf/tags/ke-recv/3.19-3/src/events.c 2009-07-28 16:59:15 UTC (rev 19006) +++ projects/haf/tags/ke-recv/3.19-3/src/events.c 2009-07-29 07:59:35 UTC (rev 19007) @@ -99,6 +99,26 @@ } } +/* helper to hide backwards compatibility for the old layout */ +static volume_list_t *get_internal_mmc_volume(mmc_info_t *mmc) +{ + volume_list_t *vol; + vol = get_nth_volume(mmc, mmc->preferred_volume); + if (vol && vol->dev_name && vol->fstype + && strcmp(vol->fstype, "vfat")) { + /* workaround for not yet partitioned systems */ + ULOG_DEBUG_F("falling back to partition 3!"); + vol = get_nth_volume(mmc, 3); + if (vol == NULL || vol->dev_name == NULL) + return NULL; + } else if (vol == NULL || vol->dev_name == NULL) { + ULOG_ERR_F("could not find partition number %d", + mmc->preferred_volume); + return NULL; + } + return vol; +} + #define UPDATE_MMC_LABEL_SCRIPT "/usr/sbin/osso-update-mmc-label.sh" void update_mmc_label(mmc_info_t *mmc) @@ -111,19 +131,16 @@ char *part_device = NULL; volume_list_t *vol; - vol = get_nth_volume(mmc, mmc->preferred_volume); - if (vol == NULL) { - ULOG_ERR_F("could not find partition number %d", - mmc->preferred_volume); - if (mmc->preferred_volume != 1 && mmc->internal_card) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - vol = get_nth_volume(mmc, 1); - if (vol == NULL) - return; - } else - return; + if (mmc->internal_card) + vol = get_internal_mmc_volume(mmc); + else + vol = get_nth_volume(mmc, mmc->preferred_volume); + + if (vol == NULL || vol->dev_name == NULL) { + ULOG_ERR_F("could not find partition"); + return; } + part_device = vol->dev_name; if (part_device == NULL) { @@ -547,20 +564,10 @@ const char *args[] = {NULL, NULL}; char *dev; - if (!mmc->control_partitions) { + if (mmc->internal_card) { volume_list_t *vol; - - vol = get_nth_volume(mmc, mmc->preferred_volume); - if (vol == NULL) { - if (mmc->preferred_volume != 1) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - vol = get_nth_volume(mmc, 1); - if (vol == NULL || vol->dev_name == NULL) - return; - } else - return; - } + if ((vol = get_internal_mmc_volume(mmc)) == NULL) + return; dev = vol->dev_name; } else dev = mmc->whole_device; @@ -584,21 +591,11 @@ const char *args[] = {NULL, NULL}; char *dev; - if (!mmc->control_partitions) { + if (mmc->internal_card) { volume_list_t *vol; - - vol = get_nth_volume(mmc, mmc->preferred_volume); - if (vol == NULL) { - ULOG_ERR_F("volume %d not found from %s", - mmc->preferred_volume, mmc->name); - if (mmc->preferred_volume != 1) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - vol = get_nth_volume(mmc, 1); - if (vol == NULL || vol->dev_name == NULL) - return 0; - } else - return 0; + if ((vol = get_internal_mmc_volume(mmc)) == NULL) { + ULOG_ERR_F("volume not found for %s", mmc->name); + return 0; } dev = vol->dev_name; } else @@ -637,19 +634,14 @@ int ret; volume_list_t *vol; - vol = get_nth_volume(mmc, mmc->preferred_volume); + if (mmc->internal_card) + vol = get_internal_mmc_volume(mmc); + else + vol = get_nth_volume(mmc, mmc->preferred_volume); if (vol == NULL || vol->dev_name == NULL) { - ULOG_ERR_F("could not find partition number %d", - mmc->preferred_volume); - if (mmc->preferred_volume != 1 && mmc->internal_card) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - vol = get_nth_volume(mmc, 1); - if (vol == NULL || vol->dev_name == NULL) - return; - } else - return; + ULOG_ERR_F("could not find partition"); + return; } ULOG_DEBUG_F("using device file %s", vol->dev_name); @@ -719,20 +711,14 @@ ULOG_DEBUG_F("label for %s is '%s'", mmc->name, mmc->desired_label); - vol = get_nth_volume(mmc, mmc->preferred_volume); + if (mmc->internal_card) + vol = get_internal_mmc_volume(mmc); + else + vol = get_nth_volume(mmc, mmc->preferred_volume); - if ((vol == NULL || vol->dev_name == NULL) - && !mmc->control_partitions) { - ULOG_ERR_F("could not find partition number %d", - mmc->preferred_volume); - if (mmc->preferred_volume != 1 && mmc->internal_card) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - vol = get_nth_volume(mmc, 1); - if (vol == NULL || vol->dev_name == NULL) - return; - } else - return; + if (vol == NULL || vol->dev_name == NULL) { + ULOG_ERR_F("could not find partition"); + return; } if (!mmc->control_partitions) { @@ -904,38 +890,21 @@ static int mount_volumes(mmc_info_t *mmc, gboolean show_errors) { const char *mount_args[] = {MMC_MOUNT_COMMAND, NULL, NULL, NULL}; - volume_list_t *l; + volume_list_t *l, *l_on_first_try = NULL; const char *udi = NULL, *device = NULL; int ret, count = 0; l = get_nth_volume(mmc, mmc->preferred_volume); - /* - if (l && l->corrupt) { - ULOG_DEBUG_F("partition %d is corrupt", - mmc->preferred_volume); - return 0; - } - */ - if (l == NULL || l->udi == NULL) { + if (l == NULL || l->udi == NULL || l->dev_name == NULL) { ULOG_DEBUG_F("partition %d not found", mmc->preferred_volume); - if (mmc->preferred_volume != 1 && mmc->internal_card) { - /* workaround for not yet partitioned systems */ - ULOG_DEBUG_F("falling back to partition 1!"); - l = get_nth_volume(mmc, 1); - if (l == NULL || l->udi == NULL) - return 0; - } else - return 0; + return 0; } + +try_again: udi = l->udi; device = l->dev_name; - if (device == NULL) { - ULOG_ERR_F("couldn't get device for %s", udi); - return 0; - } - ULOG_DEBUG_F("trying to mount %s", device); mount_args[1] = device; @@ -947,6 +916,13 @@ possibly_turn_swap_on(mmc); set_mmc_corrupted_flag(FALSE, mmc); count = 1; + if (mmc->internal_card && l_on_first_try) { + /* fallback partition was mounted, mark the + * preferred one as 'swap' to counter a HAL bug + * where it reports the swap partition as 'vfat' */ + free(l_on_first_try->fstype); + l_on_first_try->fstype = strdup("swap"); + } } else if (ret == 2) { /* is was mounted read-only */ ULOG_DEBUG_F("exec_prog returned %d", ret); @@ -954,14 +930,31 @@ l->corrupt = 1; inform_mmc_swapping(FALSE, mmc); set_mmc_corrupted_flag(TRUE, mmc); - /* This is now done from hulda due to fix for NB#114795. - if (show_errors) - open_closeable_dialog(OSSO_GN_NOTICE, - _("card_ia_corrupted"), "OMG!"); - */ + if (mmc->internal_card && l_on_first_try) { + /* fallback partition was mounted, mark the + * preferred one as 'swap' to counter a HAL bug + * where it reports the swap partition as 'vfat' */ + free(l_on_first_try->fstype); + l_on_first_try->fstype = strdup("swap"); + } } else { /* corrupt beyond mounting, or unsupported format */ ULOG_DEBUG_F("exec_prog returned %d", ret); + + if (!l_on_first_try && l->volume_number == 1 && + mmc->internal_card) { + /* try partition 3 for not yet partitioned systems */ + ULOG_DEBUG_F("falling back to partition 3"); + l_on_first_try = l; + l = get_nth_volume(mmc, 3); + if (l == NULL || l->udi == NULL || l->dev_name == NULL) + l = l_on_first_try; + else + goto try_again; + } else if (l_on_first_try) + /* the partition on first try was just corrupt */ + l = l_on_first_try; + l->mountpoint = NULL; l->corrupt = 1; inform_mmc_swapping(FALSE, mmc); @@ -1029,27 +1022,10 @@ { int all_unmounted = 1; - if (mmc->control_partitions) { + if (!mmc->internal_card) { volume_list_t *l; for (l = &mmc->volumes; l != NULL; l = l->next) { if (l->udi != NULL) { -#if 0 /* not necessary to check is_mounted, mountpoint should be enough */ - int prop; - /* TODO: cache is_mounted info for speed */ - prop = get_prop_bool(l->udi, "volume.is_mounted"); - if (!prop) { - ULOG_DEBUG_F("%s is not mounted", l->udi); - /* FIXME: This is a workaround for - * lower-level issues. Sometimes is_mounted - * property cannot be trusted. */ - if (l->mountpoint != NULL - && do_unmount(l->mountpoint, lazy)) { - /* unmount succeeded or it - * was not mounted */ - } - continue; - } -#endif if (l->mountpoint == NULL) { ULOG_DEBUG_F("mount point not known for %s", l->udi); @@ -1066,10 +1042,9 @@ } else { /* we only control single FAT volume */ volume_list_t *vol; - vol = get_nth_volume(mmc, mmc->preferred_volume); + vol = get_internal_mmc_volume(mmc); if (vol == NULL) { - ULOG_ERR_F("could not find partition number %d", - mmc->preferred_volume); + ULOG_ERR_F("couldn't find partition for internal card"); all_unmounted = 0; } else { char *arg; Modified: projects/haf/tags/ke-recv/3.19-3/src/ke-recv.c =================================================================== --- projects/haf/tags/ke-recv/3.19-3/src/ke-recv.c 2009-07-28 16:59:15 UTC (rev 19006) +++ projects/haf/tags/ke-recv/3.19-3/src/ke-recv.c 2009-07-29 07:59:35 UTC (rev 19007) @@ -1569,7 +1569,7 @@ mmc->swap_off_op = INTERNAL_MMC_SWAP_OFF_OP; #ifdef FREMANTLE_MODE - mmc->preferred_volume = 3; + mmc->preferred_volume = 1; mmc->control_partitions = 0; #else mmc->preferred_volume = 1; @@ -1994,6 +1994,16 @@ libhal_free_string(dev); } + /* fstype is needed for supporting old partition layout */ + dev = get_prop_string(l->udi, "volume.fstype"); + if (dev == NULL) { + ULOG_ERR_F("couldn't get volume.fstype for %s", l->udi); + } else { + ULOG_DEBUG_F("got volume.fstype '%s' for %s", dev, l->udi); + l->fstype = strdup(dev); + libhal_free_string(dev); + } + l->corrupt = 0; if (get_prop_bool(l->udi, "volume.is_partition") == 1) { @@ -2032,6 +2042,10 @@ free(l->dev_name); l->dev_name = NULL; } + if (l->fstype != NULL) { + free(l->fstype); + l->fstype = NULL; + } l->volume_number = 0; l->corrupt = 0; } Modified: projects/haf/tags/ke-recv/3.19-3/src/ke-recv.h =================================================================== --- projects/haf/tags/ke-recv/3.19-3/src/ke-recv.h 2009-07-28 16:59:15 UTC (rev 19006) +++ projects/haf/tags/ke-recv/3.19-3/src/ke-recv.h 2009-07-29 07:59:35 UTC (rev 19007) @@ -201,6 +201,7 @@ char *udi; char *mountpoint; char *dev_name; + char *fstype; int volume_number; int corrupt; struct volume_list_t_ *next;
- Previous message: [maemo-commits] r19006 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Next message: [maemo-commits] r19008 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]