diff options
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | configure.in | 10 | ||||
-rw-r--r-- | hald/linux/probing/Makefile.am | 6 | ||||
-rw-r--r-- | hald/linux/probing/probe-storage.c | 46 | ||||
-rw-r--r-- | hald/linux/probing/probe-volume.c | 81 | ||||
-rw-r--r-- | hald/logger.c | 2 | ||||
-rw-r--r-- | tools/hal-storage-mount.c | 2 |
7 files changed, 68 insertions, 88 deletions
@@ -2,15 +2,14 @@ HAL 0.5.12 ========== -Released Month 00, 2008. +Released Month 00, 2009. Requirements for HAL 0.5.12: - - Linux kernel >= 2.6.19 - - util-linux >= 2.12r1 (--enable-umount-helper requires patch - from RH #188193; it's in util-linux-ng 2.13) - - bash >= 2.0 + - Linux kernel >= 2.6.22 (CONFIG_SYSFS_DEPRECATED=n) - udev >= 125 (Linux only) + - util-linux-ng >= 2.15-rc1 + - bash >= 2.0 - dbus >= 0.61 (with glib bindings) - glib >= 2.10.0 - expat >= 1.95.8 diff --git a/configure.in b/configure.in index 0630d601..ee98b998 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ AM_MAINTAINER_MODE glib_module="glib-2.0 >= 2.10.0 gobject-2.0 > 2.10.0 dbus-glib-1 >= 0.61" dbus_module="dbus-1 >= 0.61" -volume_id_module="libvolume_id >= 0.77" +blkid_module="blkid >= 1.43" polkit_module="polkit >= 0.5" # libtool versioning - this applies to libhal and libhal-storage @@ -685,14 +685,14 @@ else fi AC_MSG_RESULT($have_glib_2_14) -# volume_id +# blkid case "$host" in *-*-solaris*) ;; *) - PKG_CHECK_MODULES(VOLUME_ID, [$volume_id_module]) - AC_SUBST(VOLUME_ID_CFLAGS) - AC_SUBST(VOLUME_ID_LIBS) + PKG_CHECK_MODULES(BLKID, [$blkid_module]) + AC_SUBST(BLKID_CFLAGS) + AC_SUBST(BLKID_LIBS) esac # OS specific libs diff --git a/hald/linux/probing/Makefile.am b/hald/linux/probing/Makefile.am index 10bba43a..74409249 100644 --- a/hald/linux/probing/Makefile.am +++ b/hald/linux/probing/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ -I$(top_srcdir) \ - @GLIB_CFLAGS@ @DBUS_CFLAGS@ @VOLUME_ID_CFLAGS@ + @GLIB_CFLAGS@ @DBUS_CFLAGS@ @BLKID_CFLAGS@ if HALD_COMPILE_LINUX libexec_PROGRAMS = \ @@ -40,12 +40,12 @@ hald_probe_serial_SOURCES = probe-serial.c ../../logger.c hald_probe_serial_LDADD = $(top_builddir)/libhal/libhal.la hald_probe_storage_SOURCES = probe-storage.c linux_dvd_rw_utils.c linux_dvd_rw_utils.h ../../util_helper.c ../../logger.c -hald_probe_storage_LDADD = @GLIB_LIBS@ @VOLUME_ID_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/partutil/libpartutil.la +hald_probe_storage_LDADD = @GLIB_LIBS@ @BLKID_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/partutil/libpartutil.la hald_probe_pc_floppy_SOURCES = probe-pc-floppy.c ../../logger.c hald_probe_volume_SOURCES = probe-volume.c linux_dvd_rw_utils.c ../../logger.c -hald_probe_volume_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/partutil/libpartutil.la @GLIB_LIBS@ @VOLUME_ID_LIBS@ +hald_probe_volume_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/partutil/libpartutil.la @GLIB_LIBS@ @BLKID_LIBS@ hald_probe_ieee1394_unit_SOURCES = probe-ieee1394-unit.c ../../logger.c hald_probe_ieee1394_unit_LDADD = $(top_builddir)/libhal/libhal.la diff --git a/hald/linux/probing/probe-storage.c b/hald/linux/probing/probe-storage.c index dd5681c3..1d088935 100644 --- a/hald/linux/probing/probe-storage.c +++ b/hald/linux/probing/probe-storage.c @@ -44,7 +44,7 @@ #include <unistd.h> #include <glib.h> -#include <libvolume_id.h> +#include <blkid.h> #include "libhal/libhal.h" #include "partutil/partutil.h" @@ -53,19 +53,6 @@ #include "../../logger.h" #include "../../util_helper.h" - -static void vid_log(int priority, const char *file, int line, const char *format, ...) -{ - char log_str[1024]; - va_list args; - - va_start(args, format); - vsnprintf(log_str, sizeof(log_str), format, args); - logger_forward_debug("%s:%i %s\n", file, line, log_str); - va_end(args); -} - - /** Check if a filesystem on a special device file is mounted * * @param device_file Special device file, e.g. /dev/cdrom @@ -117,9 +104,6 @@ main (int argc, char *argv[]) fd = -1; - /* hook in our debug into libvolume_id */ - volume_id_log_fn = vid_log; - fprintf (stderr, "woohoo\n"); /* assume failure */ @@ -445,7 +429,7 @@ main (int argc, char *argv[]) close (fd); HAL_DEBUG (("PROBE CLOSED LOCK ON CDROM")); } else { - struct volume_id *vid; + blkid_probe pr; GDir *dir; const gchar *partition; const gchar *main_device; @@ -515,25 +499,27 @@ main (int argc, char *argv[]) libhal_changeset_set_property_string (cs, "storage.partitioning_scheme", "none"); /* probe for file system */ - vid = volume_id_open_fd (fd); - if (vid != NULL) { - if (volume_id_probe_all (vid, 0, size) == 0) { + pr = blkid_new_probe (); + if (pr != NULL) { + blkid_probe_set_request (pr, BLKID_PROBREQ_LABEL | BLKID_PROBREQ_UUID | + BLKID_PROBREQ_TYPE | BLKID_PROBREQ_SECTYPE | + BLKID_PROBREQ_USAGE | BLKID_PROBREQ_VERSION); + if (blkid_probe_set_device (pr, fd, 0, size) == 0 && + blkid_do_safeprobe (pr) == 0) { const char *usage; + /* signal to hald that we've found something and a fakevolume * should be added - see hald/linux/blockdev.c:add_blockdev_probing_helper_done() * and hald/linux/blockdev.c:block_rescan_storage_done(). */ - - if (volume_id_get_usage(vid, &usage) && - ( strcmp(usage, "filesystem") == 0 || - strcmp(usage, "raid") == 0 || - strcmp(usage, "other") == 0 || - strcmp(usage, "crypto") == 0)) + if (blkid_probe_lookup_value (pr, "USAGE", &usage, NULL) == 0 && + (strcmp (usage, "filesystem") == 0 || + strcmp (usage, "raid") == 0 || + strcmp (usage, "other") == 0 || + strcmp (usage, "crypto") == 0)) ret = 2; - } else { - ; } - volume_id_close(vid); + blkid_free_probe (pr); } close (fd); } diff --git a/hald/linux/probing/probe-volume.c b/hald/linux/probing/probe-volume.c index 8ce557e6..882de885 100644 --- a/hald/linux/probing/probe-volume.c +++ b/hald/linux/probing/probe-volume.c @@ -42,24 +42,13 @@ #include <signal.h> #include <glib.h> -#include <libvolume_id.h> +#include <blkid.h> #include "libhal/libhal.h" #include "partutil/partutil.h" #include "linux_dvd_rw_utils.h" #include "../../logger.h" -static void vid_log(int priority, const char *file, int line, const char *format, ...) -{ - char log_str[1024]; - va_list args; - - va_start(args, format); - vsnprintf(log_str, sizeof(log_str), format, args); - logger_forward_debug("%s:%i %s\n", file, line, log_str); - va_end(args); -} - static gchar * strdup_valid_utf8 (const char *str) { @@ -89,7 +78,7 @@ strdup_valid_utf8 (const char *str) static void -set_volume_id_values (LibHalChangeSet *cs, struct volume_id *vid) +set_blkid_values (LibHalChangeSet *cs, blkid_probe pr) { char buf[256]; const char *usage; @@ -101,28 +90,28 @@ set_volume_id_values (LibHalChangeSet *cs, struct volume_id *vid) dbus_error_init (&error); - if (!volume_id_get_usage(vid, &usage)) + if (blkid_probe_lookup_value(pr, "USAGE", &usage, NULL)) usage = ""; libhal_changeset_set_property_string (cs, "volume.fsusage", usage); HAL_DEBUG (("volume.fsusage = '%s'", usage)); - if (!volume_id_get_type(vid, &type)) + if (blkid_probe_lookup_value(pr, "TYPE", &type, NULL)) type = ""; - if (!libhal_changeset_set_property_string (cs, "volume.fstype", type)) + if (libhal_changeset_set_property_string (cs, "volume.fstype", type)) libhal_changeset_set_property_string (cs, "volume.fstype", ""); HAL_DEBUG(("volume.fstype = '%s'", type)); - if (!volume_id_get_type_version(vid, &type_version)) + if (blkid_probe_lookup_value(pr, "VERSION", &type_version, NULL)) type_version = ""; libhal_changeset_set_property_string (cs, "volume.fsversion", type_version); HAL_DEBUG(("volume.fsversion = '%s'", type_version)); - if (!volume_id_get_uuid(vid, &uuid)) + if (blkid_probe_lookup_value(pr, "UUID", &uuid, NULL)) uuid = ""; libhal_changeset_set_property_string (cs, "volume.uuid", uuid); HAL_DEBUG(("volume.uuid = '%s'", uuid)); - if (!volume_id_get_label(vid, &label)) + if (blkid_probe_lookup_value(pr, "LABEL", &label, NULL)) label = ""; if (label[0] != '\0') { @@ -311,7 +300,7 @@ main (int argc, char *argv[]) LibHalContext *ctx = NULL; DBusError error; char *parent_udi; - struct volume_id *vid; + blkid_probe pr; char *stordev_dev_file; char *partition_number_str; char *partition_start_str; @@ -331,9 +320,6 @@ main (int argc, char *argv[]) cs = NULL; disc_may_have_data = FALSE; - /* hook in our debug into libvolume_id */ - volume_id_log_fn = vid_log; - setup_logger (); /* assume failure */ @@ -631,23 +617,33 @@ main (int argc, char *argv[]) } /* probe for file system */ - vid = volume_id_open_fd (fd); - if (vid != NULL) { - int vid_ret; - HAL_INFO (("invoking volume_id_probe_all, offset=%d, size=%d", vol_probe_offset, vol_size)); - vid_ret = volume_id_probe_all (vid, vol_probe_offset, vol_size); - HAL_INFO (("volume_id_probe_all returned %d", vid_ret)); - - if (vid_ret != 0 && is_disc && vol_probe_offset != 0) { + pr = blkid_new_probe (); + if (pr != NULL) { + int bid_ret; + + blkid_probe_set_request (pr, BLKID_PROBREQ_LABEL | BLKID_PROBREQ_UUID | + BLKID_PROBREQ_TYPE | BLKID_PROBREQ_SECTYPE | + BLKID_PROBREQ_USAGE | BLKID_PROBREQ_VERSION); + + HAL_INFO (("invoking blkid_do_safeprobe, offset=%d, size=%d", vol_probe_offset, vol_size)); + bid_ret = blkid_probe_set_device (pr, fd, vol_probe_offset, vol_size); + if (bid_ret == 0) { + bid_ret = blkid_do_safeprobe (pr); + HAL_INFO (("blkid_do_safeprobe returned %d", bid_ret)); + } + + if (bid_ret != 0 && is_disc && vol_probe_offset != 0) { /* Some cd-rom drives report the offset of the session in the cd's TOC * wrong. Fallback to probing at offset 0, just to be sure */ - HAL_INFO (("invoking volume_id_probe_all, offset=0, size=%d", vol_size)); - vid_ret = volume_id_probe_all (vid, 0 , vol_size); - HAL_INFO (("volume_id_probe_all returned %d", vid_ret)); + HAL_INFO (("invoking blkid_do_safeprobe, offset=0, size=%d", vol_size)); + bid_ret = blkid_probe_set_device (pr, fd, 0, vol_size); + if (bid_ret == 0) + bid_ret = blkid_do_safeprobe (pr); + HAL_INFO (("blkid_do_safeprobe returned %d", bid_ret)); } - if (vid_ret == 0) { - set_volume_id_values(cs, vid); + if (bid_ret == 0) { + set_blkid_values(cs, pr); if (disc_may_have_data) { libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", FALSE); libhal_changeset_set_property_bool (cs, "volume.disc.has_data", TRUE); @@ -663,7 +659,7 @@ main (int argc, char *argv[]) * this is good enough for now... the only discs I know of that does this * is in fact Apple's install disc.) */ - if (vid_ret != 0 && is_disc) { + if (bid_ret != 0 && is_disc) { PartitionTable *p; p = part_table_load_from_disk (stordev_dev_file); if (p != NULL) { @@ -681,11 +677,10 @@ main (int argc, char *argv[]) guint64 part_offset; part_offset = part_table_entry_get_offset (p, i); - if (volume_id_probe_all ( - vid, vol_probe_offset + part_offset, 0) == 0) { - - set_volume_id_values(cs, vid); - } + if (blkid_probe_set_device (pr, fd, + vol_probe_offset + part_offset, 0) == 0 && + blkid_do_safeprobe (pr) == 0) + set_blkid_values(cs, pr); /* and we're done */ break; @@ -699,7 +694,7 @@ main (int argc, char *argv[]) } } - volume_id_close(vid); + blkid_free_probe (pr); } /* get partition type number, if we find a msdos partition table */ diff --git a/hald/logger.c b/hald/logger.c index a2d04b52..6ee17570 100644 --- a/hald/logger.c +++ b/hald/logger.c @@ -222,7 +222,7 @@ logger_emit (const char *format, ...) * @format: Message format string, printf style * @...: Parameters for message, printf style * - * Forward debug messages as e.g. from udev/libvolume_id. + * Forward debug messages */ void logger_forward_debug (const char *format, ...) diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c index a29c8f30..e48b4b9e 100644 --- a/tools/hal-storage-mount.c +++ b/tools/hal-storage-mount.c @@ -417,7 +417,7 @@ device_is_mounted (const char *device, char **mount_point) return ret; } -/* maps volume_id fs types to the appropriate -t mount option */ +/* maps blkid fs types to the appropriate -t mount option */ static const char * map_fstype (const char *fstype) { |