hal/hald/linux2/probing Makefile.am, 1.11, 1.12 probe-storage.c,
1.19, 1.20 probe-volume.c, 1.23, 1.24
Kay Sievers
kay at freedesktop.org
Mon Jan 23 04:15:52 PST 2006
Update of /cvs/hal/hal/hald/linux2/probing
In directory gabe:/tmp/cvs-serv27406/hald/linux2/probing
Modified Files:
Makefile.am probe-storage.c probe-volume.c
Log Message:
2006-01-23 Kay Sievers <kay.sievers at vrfy.org>
Remove drive_id and use the udev provided data for block device
serial numbers and vendor/product information.
* Makefile.am:
* configure.in:
* drive_id/Makefile.am:
* drive_id/ata.c:
* drive_id/ata.h:
* drive_id/drive_id.c:
* drive_id/drive_id.h:
* drive_id/logging.h:
* drive_id/scsi.c:
* drive_id/scsi.h:
* drive_id/util.c:
* drive_id/util.h:
* hald/linux2/blockdev.c: (add_blockdev_probing_helper_done),
(blockdev_callouts_preprobing_storage_done),
(blockdev_callouts_preprobing_volume_done),
(hotplug_event_begin_add_blockdev):
* hald/linux2/coldplug.c: (hal_util_get_udevinfo_path),
(hal_util_init_sysfs_to_udev_map), (coldplug_get_hotplug_event),
(coldplug_synthesize_events), (coldplug_synthesize_block_event),
(coldplug_compute_visit_device):
* hald/linux2/hotplug.c: (fixup_net_device_for_renaming),
(hotplug_event_begin_sysfs):
* hald/linux2/hotplug.h:
* hald/linux2/osspec.c: (hald_udev_data), (osspec_init):
* hald/linux2/probing/Makefile.am:
* hald/linux2/probing/probe-storage.c: (main):
* hald/linux2/probing/probe-volume.c: (volume_id_log),
(strdup_valid_utf8), (set_volume_id_values):
* hald/util.c: (hal_util_strdup_valid_utf8):
* hald/util.h:
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.am 10 Nov 2005 19:28:34 -0000 1.11
+++ Makefile.am 23 Jan 2006 12:15:50 -0000 1.12
@@ -30,14 +30,10 @@
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 shared.h
-hald_probe_storage_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/drive_id/libdrive_id.la $(top_builddir)/volume_id/libvolume_id.la @PACKAGE_LIBS@
+hald_probe_storage_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/volume_id/libvolume_id.la @PACKAGE_LIBS@
hald_probe_pc_floppy_SOURCES = probe-pc-floppy.c
hald_probe_volume_SOURCES = probe-volume.c linux_dvd_rw_utils.c linux_dvd_rw_utils.h shared.h
-hald_probe_volume_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/drive_id/libdrive_id.la $(top_builddir)/volume_id/libvolume_id.la @PACKAGE_LIBS@
-
-
-
-
+hald_probe_volume_LDADD = $(top_builddir)/libhal/libhal.la $(top_builddir)/volume_id/libvolume_id.la @PACKAGE_LIBS@
Index: probe-storage.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-storage.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- probe-storage.c 16 Jan 2006 21:56:42 -0000 1.19
+++ probe-storage.c 23 Jan 2006 12:15:50 -0000 1.20
@@ -47,7 +47,6 @@
#include "libhal/libhal.h"
-#include "drive_id/drive_id.h"
#include "volume_id/volume_id.h"
#include "linux_dvd_rw_utils.h"
@@ -61,14 +60,6 @@
_do_dbg (format, args);
}
-void
-drive_id_log (const char *format, ...)
-{
- va_list args;
- va_start (args, format);
- _do_dbg (format, args);
-}
-
static char *
strdup_valid_utf8 ( const char *String )
{
@@ -169,71 +160,6 @@
device_file, bus, drive_type, udi, only_check_for_fs);
if (!only_check_for_fs) {
- /* Only do drive_id on IDE and real SCSI disks - specifically
- * not on USB which uses emulated SCSI since an INQUIRY on
- * most USB devices may crash the storage device if the
- * transfer length isn't exactly 36 bytes. See Red Hat bug
- * #145256 for details.
- */
- if (strcmp (bus, "ide") == 0 ||
- strcmp (bus, "scsi") == 0) {
- struct drive_id *did;
- char *serial;
-
- dbg ("Doing open (\"%s\", O_RDONLY | O_NONBLOCK)", device_file);
- fd = open (device_file, O_RDONLY | O_NONBLOCK);
- if (fd < 0) {
- dbg ("Cannot open %s: %s", device_file, strerror (errno));
- goto out;
- }
- dbg ("Returned from open(2)");
-
- did = drive_id_open_fd (fd);
- if (drive_id_probe_all (did) == 0) {
- dbg ("serial = '%s', firmware = '%s'", did->serial, did->firmware);
-
- /* validate this string to UTF8 to prevent problems with dbus if there is garbage */
- serial = strdup_valid_utf8 ((const char *) did->serial);
-
- if (did->serial[0] != '\0' && serial != NULL) {
- dbus_error_init (&error);
- if (!libhal_device_set_property_string (ctx, udi, "storage.serial",
- serial, &error)) {
- dbg ("Error setting storage.serial");
- }
- }
-
- if (did->firmware[0] != '\0') {
- dbus_error_init (&error);
- if (!libhal_device_set_property_string (ctx, udi, "storage.firmware_version",
- (char *) did->firmware, &error)) {
- dbg ("Error setting storage.firmware_version");
- }
- }
-
- dbus_error_init (&error);
-
- }
- drive_id_close (did);
-
- close (fd);
- }
-
-#if 0
- /* TODO: test for SATA drives once that gets exported to user space */
- {
- int fd;
- unsigned char unused;
-
- if ((fd = open (device_file, O_RDONLY|O_NDELAY)) != -1) {
- if (ioctl (fd, ATA_IOC_GET_IO32, &unused) >= 0) {
- hal_device_property_set_string (stordev, "storage.bus", "sata");
- }
- close (fd);
- }
- }
-#endif
-
/* Get properties for CD-ROM drive */
if (strcmp (drive_type, "cdrom") == 0) {
int capabilities;
Index: probe-volume.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-volume.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- probe-volume.c 21 Jan 2006 03:26:30 -0000 1.23
+++ probe-volume.c 23 Jan 2006 12:15:50 -0000 1.24
@@ -48,36 +48,34 @@
#include <glib.h>
#include "libhal/libhal.h"
-
-#include "drive_id/drive_id.h"
#include "volume_id/volume_id.h"
#include "linux_dvd_rw_utils.h"
#include "shared.h"
-static char *
-strdup_valid_utf8 ( const char *String )
+void
+volume_id_log (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ _do_dbg (format, args);
+}
+
+static gchar *
+strdup_valid_utf8 (const char *str)
{
char *endchar;
- char *newString;
+ char *newstr;
- if (String == NULL)
+ if (str == NULL)
return NULL;
- newString = g_strdup( String );
-
- while (!g_utf8_validate (newString, -1, (const char **) &endchar)) {
+ newstr = g_strdup (str);
+
+ while (!g_utf8_validate (str, -1, (const char **) &endchar)) {
*endchar = '?';
}
- return newString;
-}
-
-void
-volume_id_log (const char *format, ...)
-{
- va_list args;
- va_start (args, format);
- _do_dbg (format, args);
+ return newstr;
}
static void
@@ -127,7 +125,7 @@
dbg ("volume.uuid = '%s'", vid->uuid);
/* we need to be sure for a utf8 valid label, because dbus accept only utf8 valid strings */
- volume_label = strdup_valid_utf8 ( vid->label );
+ volume_label = strdup_valid_utf8 (vid->label);
if( volume_label != NULL ) {
libhal_device_set_property_string (ctx, udi, "volume.label", volume_label, &error);
dbg ("volume.label = '%s'", volume_label);
More information about the hal-commit
mailing list