diff options
Diffstat (limited to 'sysutils/hal/files/patch-hald_hf-storage.c')
-rw-r--r-- | sysutils/hal/files/patch-hald_hf-storage.c | 81 |
1 files changed, 59 insertions, 22 deletions
diff --git a/sysutils/hal/files/patch-hald_hf-storage.c b/sysutils/hal/files/patch-hald_hf-storage.c index 605342c36b3b..a699ca827e57 100644 --- a/sysutils/hal/files/patch-hald_hf-storage.c +++ b/sysutils/hal/files/patch-hald_hf-storage.c @@ -1,14 +1,15 @@ ---- hald/freebsd/hf-storage.c.orig 2008-08-10 09:50:10.000000000 -0400 -+++ hald/freebsd/hf-storage.c 2009-05-23 18:52:52.000000000 -0400 -@@ -30,6 +30,7 @@ +--- hald/freebsd/hf-storage.c.orig 2009-05-12 08:24:28.000000000 -0400 ++++ hald/freebsd/hf-storage.c 2009-10-24 02:30:22.000000000 -0400 +@@ -30,6 +30,8 @@ #include <limits.h> #include <inttypes.h> #include <string.h> ++#include <unistd.h> +#include <sys/param.h> #include <sys/types.h> #include <sys/disklabel.h> -@@ -38,6 +39,7 @@ +@@ -38,6 +40,7 @@ #include "hf-storage.h" #include "hf-block.h" @@ -16,7 +17,7 @@ #include "hf-devtree.h" #include "hf-volume.h" #include "hf-util.h" -@@ -64,7 +66,7 @@ typedef struct +@@ -64,7 +67,7 @@ typedef struct static GNode *hf_storage_geom_tree = NULL; static GHashTable *hf_storage_geom_hash = NULL; @@ -25,7 +26,7 @@ static gboolean hf_storage_device_has_addon (HalDevice *device); static void -@@ -104,6 +106,8 @@ hf_storage_class_is_partitionable (const +@@ -104,6 +107,8 @@ hf_storage_class_is_partitionable (const { return (! strcmp(geom_class, "MBR") || ! strcmp(geom_class, "MBREXT") || @@ -34,7 +35,7 @@ ! strcmp(geom_class, "GPT") || ! strcmp(geom_class, "APPLE") || ! strcmp(geom_class, "SUN")); } -@@ -117,6 +121,7 @@ hf_storage_geom_has_partitions (const Ge +@@ -117,6 +122,7 @@ hf_storage_geom_has_partitions (const Ge if (g_node_n_children(node) > 0) return TRUE; @@ -42,7 +43,7 @@ if (hf_storage_class_is_partitionable(geom_obj->class) && g_node_next_sibling(node) != NULL) { -@@ -135,6 +140,7 @@ hf_storage_geom_has_partitions (const Ge +@@ -135,6 +141,7 @@ hf_storage_geom_has_partitions (const Ge return TRUE; } } @@ -50,7 +51,7 @@ return FALSE; } -@@ -294,7 +300,7 @@ hf_storage_device_probe (HalDevice *devi +@@ -294,7 +301,7 @@ hf_storage_device_probe (HalDevice *devi { g_return_if_fail(HAL_IS_DEVICE(device)); @@ -59,7 +60,7 @@ if (hf_runner_run_sync(device, 0, "hald-probe-storage", "HF_HAS_CHILDREN", HF_BOOL_TO_STRING(hf_storage_device_has_partitions(device)), -@@ -403,13 +409,20 @@ hf_storage_parse_conftxt (const char *co +@@ -403,13 +410,49 @@ hf_storage_parse_conftxt (const char *co continue; } @@ -72,17 +73,46 @@ + continue; + } + ++ /* XXX This is a hack, but we need to ignore dynamic labels like ++ * ufsids which are created and destroyed based on whether or not ++ * the actual device is mounted or not. If we don't then strange ++ * things happen in applications like nautilus. ++ */ ++ if ((! strcmp(fields[1], "LABEL") || ++ ! strcmp(fields[1], "BSD")) && ++ ! strncmp(fields[2], "ufsid/", strlen("ufsid/"))) ++ { ++ g_strfreev(fields); ++ continue; ++ } ++ geom_obj = g_new0(Geom_Object, 1); - depth = atoi(fields[0]); geom_obj->class = g_strdup(fields[1]); geom_obj->dev = g_strdup(fields[2]); ++ /* Allow for spaces in label names. */ ++ if (! strcmp(fields[1], "LABEL")) ++ { ++ int j; ++ ++ for (j = 3; g_strv_length(fields) > (j + 2) && ++ strcmp(fields[j + 2], "i"); j++) ++ { ++ char *tmp; ++ ++ tmp = g_strdup_printf("%s %s", geom_obj->dev, fields[j]); ++ g_free(geom_obj->dev); ++ geom_obj->dev = tmp; ++ } ++ } ++ geom_obj->type = -1; /* We use -1 here to denote a missing type. */ - hash = g_str_hash(geom_obj->dev); geom_obj->hash = hash; if (g_strv_length(fields) >= 5) -@@ -433,6 +446,30 @@ hf_storage_parse_conftxt (const char *co +@@ -433,6 +476,30 @@ hf_storage_parse_conftxt (const char *co if (! strcmp (geom_obj->class, "GPT") || ! strcmp (geom_obj->class, "APPLE")) geom_obj->str_type = g_strdup(fields[10]); @@ -113,7 +143,7 @@ else geom_obj->type = atoi(fields[10]); } -@@ -541,15 +578,20 @@ hf_storage_device_rescan_real (HalDevice +@@ -541,17 +608,27 @@ hf_storage_device_rescan_real (HalDevice } static gboolean @@ -131,13 +161,20 @@ - if (hf_is_waiting) - return TRUE; -+ if (strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || ++ if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || + (strcmp(type, "CREATE") && strcmp(type, "DESTROY"))) + return FALSE; ++ ++ if (! strcmp(type, "DESTROY")) ++ g_usleep(G_USEC_PER_SEC/2); conftxt = hf_get_string_sysctl(NULL, "kern.geom.conftxt"); ++ if (! conftxt) ++ return FALSE; new_disks = hf_storage_parse_conftxt(conftxt); -@@ -572,6 +614,7 @@ hf_storage_conftxt_timeout_cb (gpointer + g_free(conftxt); + +@@ -572,6 +649,7 @@ hf_storage_conftxt_timeout_cb (gpointer if (! hf_storage_find_disk(disks, disk->name)) { osspec_probe(); /* catch new disk(s) */ @@ -145,7 +182,7 @@ break; } } -@@ -593,7 +636,10 @@ hf_storage_conftxt_timeout_cb (gpointer +@@ -593,7 +671,10 @@ hf_storage_conftxt_timeout_cb (gpointer device = hf_devtree_find_from_name(hald_get_gdl(), disk->name); if (device && hal_device_has_capability(device, "storage") && ! hf_storage_device_has_addon(device)) @@ -157,7 +194,7 @@ } } else -@@ -601,7 +647,10 @@ hf_storage_conftxt_timeout_cb (gpointer +@@ -601,7 +682,10 @@ hf_storage_conftxt_timeout_cb (gpointer /* disk removed */ device = hf_devtree_find_from_name(hald_get_gdl(), disk->name); if (device && hal_device_has_capability(device, "storage")) @@ -169,7 +206,7 @@ } } } -@@ -610,17 +659,30 @@ hf_storage_conftxt_timeout_cb (gpointer +@@ -610,17 +694,30 @@ hf_storage_conftxt_timeout_cb (gpointer g_slist_free(disks); disks = new_disks; @@ -183,7 +220,7 @@ + if (hf_is_waiting) + return TRUE; + -+ hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", NULL); ++ hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", ""); + return TRUE; } @@ -202,7 +239,7 @@ return; conftxt = hf_get_string_sysctl(NULL, "kern.geom.conftxt"); -@@ -636,8 +698,10 @@ hf_storage_init_geom (void) +@@ -636,8 +733,10 @@ hf_storage_init_geom (void) static void hf_storage_init (void) { @@ -214,7 +251,7 @@ } void -@@ -720,8 +784,6 @@ hf_storage_device_add (HalDevice *device +@@ -719,8 +818,6 @@ hf_storage_device_add (HalDevice *device { g_return_if_fail(HAL_IS_DEVICE(device)); @@ -223,7 +260,7 @@ if (hf_device_preprobe(device)) { hf_storage_device_probe(device, FALSE); -@@ -739,7 +801,7 @@ hf_storage_get_geoms (const char *devnam +@@ -738,7 +835,7 @@ hf_storage_get_geoms (const char *devnam g_return_val_if_fail(devname != NULL, NULL); @@ -232,7 +269,7 @@ hash = g_str_hash(devname); node = g_node_find(hf_storage_geom_tree, G_PRE_ORDER, G_TRAVERSE_ALL, -@@ -802,3 +864,7 @@ HFHandler hf_storage_handler = { +@@ -801,3 +898,7 @@ HFHandler hf_storage_handler = { .probe = hf_storage_probe, .device_rescan = hf_storage_device_rescan }; |