building without volume_id
Frederic Peters
fpeters at entrouvert.com
Thu Jul 13 03:37:50 PDT 2006
I forgot :
> - adding a new configure check to HAL, specifically checking for
> volume_id, and disabling volume_id calls in probe-storage/volume if
> it was not found. This is the path taken in the attached patch.
The attachment.
Regards,
Frederic
-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /cvs/hal/hal/configure.in,v
retrieving revision 1.135
diff -u -r1.135 configure.in
--- configure.in 10 Jul 2006 23:47:42 -0000 1.135
+++ configure.in 13 Jul 2006 10:07:41 -0000
@@ -181,7 +181,7 @@
dbus_module="dbus-1 >= 0.33"
polkit_module="polkit >= 0.2"
volume_id_module="libvolume_id >= 0.66"
-pkg_modules="$glib_module, gobject-2.0 >= 2.6.0, dbus-glib-1 >= 0.33, $dbus_module, $polkit_module, $volume_id_module"
+pkg_modules="$glib_module, gobject-2.0 >= 2.6.0, dbus-glib-1 >= 0.33, $dbus_module, $polkit_module"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
EXPAT_LIB=""
@@ -265,9 +265,13 @@
AC_SUBST(POLKIT_LIBS)
# volume_id
-PKG_CHECK_MODULES(VOLUME_ID, [$volume_id_module])
+PKG_CHECK_MODULES(VOLUME_ID, [$volume_id_module], have_volume_id=yes, have_volume_id=no)
AC_SUBST(VOLUME_ID_CFLAGS)
AC_SUBST(VOLUME_ID_LIBS)
+if test "x$have_volume_id" = "xyes"
+then
+ AC_DEFINE(HAVE_VOLUME_ID, 1, [define if libvolume_id is installed])
+fi
# Check for BLKGETSIZE64
AC_CHECK_TYPE(pgoff_t, ,
@@ -488,6 +492,7 @@
use acpid interface: ${acpi_acpid}
use libusb: ${USE_LIBUSB}
use libpci: ${USE_LIBPCI}
+ use libvolume_id: ${have_volume_id}
Maintainer mode: ${USE_MAINTAINER_MODE}
Building verbose mode: ${enable_verbose_mode}
Index: hald/linux2/probing/probe-storage.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-storage.c,v
retrieving revision 1.25
diff -u -r1.25 probe-storage.c
--- hald/linux2/probing/probe-storage.c 11 Jul 2006 00:00:35 -0000 1.25
+++ hald/linux2/probing/probe-storage.c 13 Jul 2006 10:07:41 -0000
@@ -45,12 +45,15 @@
#include <mntent.h>
#include <glib.h>
+#ifdef HAVE_VOLUME_ID
#include <libvolume_id.h>
+#endif
#include "libhal/libhal.h"
#include "linux_dvd_rw_utils.h"
#include "shared.h"
+#ifdef HAVE_VOLUME_ID
static void vid_log(int priority, const char *file, int line, const char *format, ...)
{
char log_str[1024];
@@ -61,6 +64,7 @@
dbg("%s:%i %s", file, line, log_str);
va_end(args);
}
+#endif
static char *
strdup_valid_utf8 ( const char *String )
@@ -134,8 +138,10 @@
fd = -1;
+#ifdef HAVE_VOLUME_ID
/* hook in our debug into libvolume_id */
volume_id_log_fn = vid_log;
+#endif
/* assume failure */
ret = 1;
@@ -356,7 +362,9 @@
close (fd);
} else {
+#ifdef HAVE_VOLUME_ID
struct volume_id *vid;
+#endif
GDir *dir;
const gchar *partition;
const gchar *main_device;
@@ -397,6 +405,7 @@
}
g_dir_close (dir);
+#ifdef HAVE_VOLUME_ID
/* probe for file system */
vid = volume_id_open_fd (fd);
if (vid != NULL) {
@@ -412,6 +421,7 @@
}
volume_id_close(vid);
}
+#endif
close (fd);
}
Index: hald/linux2/probing/probe-volume.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-volume.c,v
retrieving revision 1.32
diff -u -r1.32 probe-volume.c
--- hald/linux2/probing/probe-volume.c 10 Jul 2006 23:47:42 -0000 1.32
+++ hald/linux2/probing/probe-volume.c 13 Jul 2006 10:07:41 -0000
@@ -46,7 +46,9 @@
#include <sys/time.h>
#include <glib.h>
+#ifdef HAVE_VOLUME_ID
#include <libvolume_id.h>
+#endif
#include "libhal/libhal.h"
#include "linux_dvd_rw_utils.h"
@@ -222,6 +224,7 @@
return partition_id_index;
}
+#ifdef HAVE_VOLUME_ID
static void
set_volume_id_values (LibHalContext *ctx, const char *udi, struct volume_id *vid)
{
@@ -284,6 +287,7 @@
libhal_device_set_property_string (ctx, udi, "info.product", buf, &error);
}
}
+#endif
static void
advanced_disc_detect (LibHalContext *ctx, const char *udi,
@@ -431,7 +435,9 @@
DBusError error;
char *parent_udi;
char *sysfs_path;
+#ifdef HAVE_VOLUME_ID
struct volume_id *vid;
+#endif
char *stordev_dev_file;
char *partition_number_str;
char *is_disc_str;
@@ -443,8 +449,10 @@
dbus_uint64_t vol_probe_offset = 0;
fd = -1;
+#ifdef HAVE_VOLUME_ID
/* hook in our debug into libvolume_id */
volume_id_log_fn = vid_log;
+#endif
/* assume failure */
ret = 1;
@@ -681,6 +689,7 @@
if (is_disc)
vol_size = 0;
+#ifdef HAVE_VOLUME_ID
/* probe for file system */
vid = volume_id_open_fd (fd);
if (vid != NULL) {
@@ -691,6 +700,7 @@
}
volume_id_close(vid);
}
+#endif
/* get partition type number, if we find a msdos partition table */
if (partition_number_str != NULL) {
More information about the hal
mailing list