hal: Branch 'master' - 2 commits

Joe Marcus Clarke marcus at kemper.freedesktop.org
Sat Feb 10 11:05:14 PST 2007


 hald/freebsd/hf-scsi.c              |    8 ++++----
 hald/freebsd/probing/probe-volume.c |    6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
diff-tree 7c89fcb406bac11e92570ec71dbfb4e66789f87c (from 36766d5e49114ef7b27679e63431c45ce49926a5)
Author: Jean-Yves Lefort <jylefort at FreeBSD.org>
Date:   Sat Feb 10 14:05:11 2007 -0500

    correct SCSI to atapi mapping
    
    Fix SCSI->atapi mapping by matching the target ID instead of the target LUN.

diff --git a/hald/freebsd/hf-scsi.c b/hald/freebsd/hf-scsi.c
index 70102fc..41e204b 100644
--- a/hald/freebsd/hf-scsi.c
+++ b/hald/freebsd/hf-scsi.c
@@ -275,13 +275,13 @@ hf_scsi_get_ata_channel (HalDevice *scsi
 }
 
 static HalDevice *
-hf_scsi_get_atapi_device (HalDevice *ata_channel, int lun)
+hf_scsi_get_atapi_device (HalDevice *ata_channel, int target_id)
 {
   HalDevice *device = NULL;
   GList *l;
 
   g_return_val_if_fail(HAL_IS_DEVICE(ata_channel), NULL);
-  g_return_val_if_fail(lun == 0 || lun == 1, NULL); /* ATA master or slave*/
+  g_return_val_if_fail(target_id == 0 || target_id == 1, NULL); /* ATA master or slave*/
 
   /*
    * If there's an ATAPI device it will be in hf_ata_pending_devices,
@@ -298,7 +298,7 @@ hf_scsi_get_atapi_device (HalDevice *ata
       if (driver && (! strcmp(driver, "acd") || ! strcmp(driver, "ast") || ! strcmp(driver, "afd")))
 	{
 	  device = child;
-	  if (lun == 0)
+	  if (target_id == 0)
 	    break;		/* we wanted the first device, done */
 	}
     }
@@ -338,7 +338,7 @@ hf_scsi_handle_pending_device (struct de
 	      ata_channel = hf_scsi_get_ata_channel(parent);
 	      if (ata_channel)
 		{
-		  atapi_device = hf_scsi_get_atapi_device(ata_channel, (*match)->target_lun);
+		  atapi_device = hf_scsi_get_atapi_device(ata_channel, (*match)->target_id);
 		  if (atapi_device)
                     {
 		      char *cam_devname;
diff-tree 36766d5e49114ef7b27679e63431c45ce49926a5 (from 3a56233f78b98c460b81589022ffc1b22a08cfd7)
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Feb 10 14:01:54 2007 -0500

    fix disc volume detection on FreeBSD 5.X
    
    Fix a bug in which the correct ATA host and channel were not obtained when
    probing ATA disc volumes on FreeBSD 5.X.

diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c
index 259f3e3..9268e00 100644
--- a/hald/freebsd/probing/probe-volume.c
+++ b/hald/freebsd/probing/probe-volume.c
@@ -264,6 +264,7 @@ main (int argc, char **argv)
 {
   char *device_file;
   char *parent_udi;
+  char *grandparent_udi;
   char *parent_drive_type;
   int fd = -1;
   struct volume_id *vid = NULL;
@@ -304,6 +305,9 @@ main (int argc, char **argv)
   parent_drive_type = libhal_device_get_property_string(hfp_ctx, parent_udi, "storage.drive_type", &hfp_error);
   dbus_error_free(&hfp_error);
 
+  grandparent_udi = libhal_device_get_property_string(hfp_ctx, parent_udi, "info.parent", &hfp_error);
+  dbus_error_free(&hfp_error);
+
   is_cdrom = parent_drive_type && ! strcmp(parent_drive_type, "cdrom");
   g_free(parent_drive_type);
 
@@ -364,7 +368,7 @@ main (int argc, char **argv)
 
       /* the following code was adapted from linux's probe-volume.c */
 
-      cdrom = hfp_cdrom_new_from_fd(fd, device_file, parent_udi);
+      cdrom = hfp_cdrom_new_from_fd(fd, device_file, grandparent_udi);
       if (cdrom)
 	{
 	  type = get_disc_type(cdrom);


More information about the hal-commit mailing list