summaryrefslogtreecommitdiff
path: root/sysutils/hal/files/patch-hald_hf-storage.c
diff options
context:
space:
mode:
authorKoop Mast <kwm@FreeBSD.org>2010-05-10 21:19:08 +0000
committerKoop Mast <kwm@FreeBSD.org>2010-05-10 21:19:08 +0000
commit48e62d9a379cd45a15f6ae89d564f81b3c13d16e (patch)
treeb627baa77f19bb1eab2fa4dee08aab1908131cd0 /sysutils/hal/files/patch-hald_hf-storage.c
parentRegister conflict between opal and opal3. (diff)
Presenting GNOME 2.30.1 for FreeBSD. The offical release notes for this
release can be found at http://library.gnome.org/misc/release-notes/2.30/ . This release brings initial PackageKit support, Upower (replaces power management part of hal), cuse4bsd integration with HAL and cheese, and a faster Evolution. Sadly GNOME 2.30.x will be the last release with FreeBSD 6.X support. This will also be the last of the 2.x releases. The next release will be the highly-anticipated GNOME 3.0 which will bring with it a new UI experience. Currently, there are a few bugs with GNOME 2.30 that may be of note for our users. Be sure to consult the UPGRADING note or the 2.30 upgrade FAQ at http://www.freebsd.org/gnome/docs/faq230.html for specific upgrading instructions, and the up-to-date list of known issues. This release features commits by avl, ahze, bland, marcus, mezz, and myself. The FreeBSD GNOME Team would like to thank Anders F Bjorklund for doing the initual packagekit porting. And the following contributors & testers for there help with this release: Eric L. Chen Vladimir Grebenschikov Sergio de Almeida Lenzi DomiX walder crsd Kevin Oberman Michal Varga Pavel Plesov Bapt kevin and ITetcu for two exp-run PR: ports/143852 ports/145347 ports/144980 ports/145830 ports/145511
Diffstat (limited to 'sysutils/hal/files/patch-hald_hf-storage.c')
-rw-r--r--sysutils/hal/files/patch-hald_hf-storage.c242
1 files changed, 21 insertions, 221 deletions
diff --git a/sysutils/hal/files/patch-hald_hf-storage.c b/sysutils/hal/files/patch-hald_hf-storage.c
index a699ca827e57..162079ac7086 100644
--- a/sysutils/hal/files/patch-hald_hf-storage.c
+++ b/sysutils/hal/files/patch-hald_hf-storage.c
@@ -1,86 +1,27 @@
---- 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 @@
+--- hald/freebsd/hf-storage.c.orig 2009-08-24 08:42:29.000000000 -0400
++++ hald/freebsd/hf-storage.c 2010-02-26 08:29:38.000000000 -0500
+@@ -30,6 +30,7 @@
#include <limits.h>
#include <inttypes.h>
#include <string.h>
+#include <unistd.h>
-+#include <sys/param.h>
+ #include <sys/param.h>
#include <sys/types.h>
#include <sys/disklabel.h>
-
-@@ -38,6 +40,7 @@
-
- #include "hf-storage.h"
- #include "hf-block.h"
-+#include "hf-devd.h"
- #include "hf-devtree.h"
- #include "hf-volume.h"
- #include "hf-util.h"
-@@ -64,7 +67,7 @@ typedef struct
- static GNode *hf_storage_geom_tree = NULL;
- static GHashTable *hf_storage_geom_hash = NULL;
-
--static void hf_storage_init_geom (void);
-+static void hf_storage_init_geom (gboolean force);
- static gboolean hf_storage_device_has_addon (HalDevice *device);
-
- static void
-@@ -104,6 +107,8 @@ hf_storage_class_is_partitionable (const
- {
- return (! strcmp(geom_class, "MBR") ||
- ! strcmp(geom_class, "MBREXT") ||
-+ ! strcmp(geom_class, "PART") ||
-+ ! strcmp(geom_class, "JOURNAL") ||
- ! strcmp(geom_class, "GPT") ||
- ! strcmp(geom_class, "APPLE") || ! strcmp(geom_class, "SUN"));
- }
-@@ -117,6 +122,7 @@ hf_storage_geom_has_partitions (const Ge
- if (g_node_n_children(node) > 0)
- return TRUE;
-
-+ /*
- if (hf_storage_class_is_partitionable(geom_obj->class) &&
- g_node_next_sibling(node) != NULL)
- {
-@@ -135,6 +141,7 @@ hf_storage_geom_has_partitions (const Ge
- return TRUE;
- }
- }
-+ */
-
- return FALSE;
- }
-@@ -294,7 +301,7 @@ hf_storage_device_probe (HalDevice *devi
- {
- g_return_if_fail(HAL_IS_DEVICE(device));
-
-- hf_storage_init_geom();
-+ hf_storage_init_geom(TRUE);
-
- 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 +410,49 @@ hf_storage_parse_conftxt (const char *co
- continue;
+@@ -418,10 +419,41 @@ hf_storage_parse_conftxt (const char *co
+ continue;
}
-+ depth = atoi(fields[0]);
-+ hash = g_str_hash(fields[2]);
-+ if (g_hash_table_lookup(table, GUINT_TO_POINTER(hash)) != NULL)
-+ {
-+ g_strfreev(fields);
-+ curr_depth = depth;
-+ 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/")))
++ ! strcmp(fields[1], "BSD") ||
++ ! strcmp(fields[1], "PART")) &&
++ ! (strncmp(fields[2], "ufsid/", strlen("ufsid/")) ||
++ ! strncmp(fields[2], "ufs/", strlen("ufs/"))))
+ {
+ g_strfreev(fields);
+ continue;
@@ -88,7 +29,6 @@
+
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. */
@@ -108,172 +48,32 @@
+ }
+
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 +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]);
-+ else if (! strcmp (geom_obj->class, "PART"))
-+ {
-+ geom_obj->str_type = g_strdup(fields[10]);
-+ if (g_strv_length(fields) >= 15)
-+ {
-+ if (! strcmp(fields[13], "xt"))
-+ {
-+ geom_obj->type = atoi(fields[14]);
-+ if (! strcmp(fields[11], "xs"))
-+ {
-+ g_free(geom_obj->class);
-+ geom_obj->class = g_strdup(fields[12]);
-+ }
-+ }
-+ }
-+ }
-+ else if (fields[10][0] == '!')
-+ {
-+ char *nottype;
-+
-+ nottype = fields[10];
-+ nottype++;
-+ geom_obj->type = atoi(nottype);
-+ }
- else
- geom_obj->type = atoi(fields[10]);
- }
-@@ -541,17 +608,27 @@ hf_storage_device_rescan_real (HalDevice
- }
-
- static gboolean
--hf_storage_conftxt_timeout_cb (gpointer data)
-+hf_storage_devd_notify (const char *system,
-+ const char *subsystem,
-+ const char *type,
-+ const char *data)
- {
- static GSList *disks = NULL;
- static gboolean first = TRUE;
-+ gboolean handled = FALSE;
+@@ -589,11 +621,16 @@ hf_storage_devd_notify (const char *syst
char *conftxt;
GSList *new_disks;
-- 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;
-+
+ (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);
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) */
-+ handled = TRUE;
- break;
- }
- }
-@@ -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))
-- hf_storage_device_rescan_real(device);
-+ {
-+ hf_storage_device_rescan_real(device);
-+ handled = TRUE;
-+ }
- }
- }
- else
-@@ -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"))
-- hf_device_remove_tree(device);
-+ {
-+ hf_device_remove_tree(device);
-+ handled = TRUE;
-+ }
- }
- }
- }
-@@ -610,17 +694,30 @@ hf_storage_conftxt_timeout_cb (gpointer
- g_slist_free(disks);
- disks = new_disks;
+@@ -669,7 +706,7 @@ hf_storage_conftxt_timeout_cb (gpointer
+ if (hf_is_waiting)
+ return TRUE;
-+ return handled;
-+}
-+
-+#if __FreeBSD_version < 700110
-+static gboolean
-+hf_storage_conftxt_timeout_cb (gpointer data)
-+{
-+ if (hf_is_waiting)
-+ return TRUE;
-+
+- hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", NULL);
+ hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", "");
-+
- return TRUE;
- }
-+#endif
- static void
--hf_storage_init_geom (void)
-+hf_storage_init_geom (gboolean force)
- {
- char *conftxt;
- static gboolean inited = FALSE;
- GSList *disks;
-
-- if (inited)
-+ if (inited && ! force)
- return;
-
- conftxt = hf_get_string_sysctl(NULL, "kern.geom.conftxt");
-@@ -636,8 +733,10 @@ hf_storage_init_geom (void)
- static void
- hf_storage_init (void)
- {
-- hf_storage_init_geom();
-+ hf_storage_init_geom(FALSE);
-+#if __FreeBSD_version < 700110
- g_timeout_add(3000, hf_storage_conftxt_timeout_cb, NULL);
-+#endif
+ return TRUE;
}
-
- void
-@@ -719,8 +818,6 @@ hf_storage_device_add (HalDevice *device
- {
- g_return_if_fail(HAL_IS_DEVICE(device));
-
-- hf_storage_init_geom();
--
- if (hf_device_preprobe(device))
- {
- hf_storage_device_probe(device, FALSE);
-@@ -738,7 +835,7 @@ hf_storage_get_geoms (const char *devnam
-
- g_return_val_if_fail(devname != NULL, NULL);
-
-- hf_storage_init_geom();
-+ hf_storage_init_geom(FALSE);
-
- hash = g_str_hash(devname);
- node = g_node_find(hf_storage_geom_tree, G_PRE_ORDER, G_TRAVERSE_ALL,
-@@ -801,3 +898,7 @@ HFHandler hf_storage_handler = {
- .probe = hf_storage_probe,
- .device_rescan = hf_storage_device_rescan
- };
-+
-+HFDevdHandler hf_storage_devd_handler = {
-+ .notify = hf_storage_devd_notify
-+};