hal: Branch 'master' - 15 commits

Joe Marcus Clarke marcus at kemper.freedesktop.org
Wed Jan 9 18:59:36 PST 2008


 fdi/policy/10osvendor/20-storage-methods.fdi |   17 +++++++++---
 hald/freebsd/hal-file-monitor.c              |   12 ---------
 hald/freebsd/hf-computer.c                   |    4 ++-
 hald/freebsd/hf-net.c                        |    9 +++---
 hald/freebsd/hf-scsi.c                       |    1 
 hald/freebsd/hf-storage.c                    |    3 ++
 hald/freebsd/hf-util.c                       |   18 ++++++++-----
 hald/freebsd/osspec.c                        |   12 ++++-----
 hald/freebsd/probing/freebsd_dvd_rw_utils.c  |   36 +++++++++++++++++++++++++++
 hald/freebsd/probing/freebsd_dvd_rw_utils.h  |    6 ++++
 hald/freebsd/probing/probe-smbios.c          |   28 +++++++++++++++++++++
 hald/freebsd/probing/probe-storage.c         |   18 +++++++++++++
 hald/freebsd/probing/probe-volume.c          |    2 -
 tools/hal-storage-shared.c                   |   11 ++++++++
 14 files changed, 142 insertions(+), 35 deletions(-)

New commits:
commit 14ae594c305b203d803dade1f562faea884d8037
Merge: c1db8be... 71e1141...
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Mon Jan 7 19:44:39 2008 -0500

    Merge branch 'master' of ssh://marcus@git.freedesktop.org/git/hal

commit c1db8be156e8ad06cd18267c81922c07cc71a348
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sun Jan 6 13:40:51 2008 -0500

    properly add the Eject method to Volumes on FreeBSD
    
    FreeBSD doesn't have a volume.linux.is_device_mapper property, so Eject was
    not being added as a Volume method on FreeBSD.  Only check for
    volume.linux.is_device_mapper if we are on Linux.  On FreeBSD, add Eject
    no matter what.

diff --git a/fdi/policy/10osvendor/20-storage-methods.fdi b/fdi/policy/10osvendor/20-storage-methods.fdi
index 9a0cbf5..e1b77ce 100644
--- a/fdi/policy/10osvendor/20-storage-methods.fdi
+++ b/fdi/policy/10osvendor/20-storage-methods.fdi
@@ -167,11 +167,20 @@
       <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
       <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>
 
-      <match key="volume.linux.is_device_mapper" bool="false">
+      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="Linux">
+        <match key="volume.linux.is_device_mapper" bool="false">
+          <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
+          <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
+          <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
+          <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
+        </match>
+      </match>
+
+      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="FreeBSD">
         <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
-        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
+	<append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
+	<append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
+	<append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
       </match>
 
       <!-- allow these mount options for all file systems -->
commit 9bcdfd451640df870d5ff6b2ca2ef200067cb16b
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Jan 5 08:21:10 2008 -0500

    fix up the device store searching code
    
    Optimize the code that searches the device store for devices with matching
    properties.

diff --git a/hald/freebsd/hf-util.c b/hald/freebsd/hf-util.c
index 39d1033..86870b3 100644
--- a/hald/freebsd/hf-util.c
+++ b/hald/freebsd/hf-util.c
@@ -639,19 +639,16 @@ hf_device_store_match (HalDeviceStore *store, ...)
         {
           PropertyBag *bag;
 
-          if (! device)
-            break;
-
           bag = (PropertyBag *) b->data;
 
           switch (bag->type)
             {
               case HAL_PROPERTY_TYPE_STRING:
 	        {
-		  char *pstr;
+		  const char *pstr;
 
 		  pstr = hal_device_property_get_string(device, bag->key);
-                  if (!pstr || strcmp(pstr, bag->strval))
+                  if (! pstr || strcmp(pstr, bag->strval))
                     device = NULL;
                   break;
 		}
@@ -663,6 +660,9 @@ hf_device_store_match (HalDeviceStore *store, ...)
               default:
                 g_assert_not_reached();
             }
+
+	  if (! device)
+	    break;
         }
 
       if (device)
commit 4890d18d8ca50770aae5790508abf35045eb0ed0
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Jan 5 08:20:18 2008 -0500

    set the storage.removable.support_async_notification property
    
    Set the storage.removable.support_async_notification to FALSE universally
    so that hald-addon-storage will run to detect media changes.

diff --git a/hald/freebsd/hf-scsi.c b/hald/freebsd/hf-scsi.c
index f6d0c45..f4fd1ea 100644
--- a/hald/freebsd/hf-scsi.c
+++ b/hald/freebsd/hf-scsi.c
@@ -188,6 +188,7 @@ hf_scsi_block_device_new (HalDevice *parent,
     {
       hal_device_property_set_bool(device, "storage.removable", TRUE);
       hal_device_property_set_bool(device, "storage.media_check_enabled", TRUE);
+      hal_device_property_set_bool(device, "storage.removable.support_async_notification", FALSE);
     }
 
   cam_strvis(revision, match->inq_data.revision, sizeof(match->inq_data.revision), sizeof(revision));
diff --git a/hald/freebsd/hf-storage.c b/hald/freebsd/hf-storage.c
index 06b5f04..f4c4e71 100644
--- a/hald/freebsd/hf-storage.c
+++ b/hald/freebsd/hf-storage.c
@@ -655,6 +655,7 @@ hf_storage_device_enable (HalDevice *device)
   hal_device_property_set_bool(device, "storage.media_check_enabled", FALSE);
   hal_device_property_set_bool(device, "storage.automount_enabled_hint", TRUE);
   hal_device_property_set_bool(device, "storage.no_partitions_hint", FALSE);
+  hal_device_property_set_bool(device, "storage.removable.support_async_notification", FALSE);
 
   hal_device_property_set_string(device, "storage.originating_device", NULL);
   hal_device_property_set_string(device, "storage.physical_device", NULL);
@@ -689,6 +690,8 @@ hf_storage_device_enable_cdrom (HalDevice *device)
   hal_device_property_set_bool(device, "storage.no_partitions_hint", TRUE);
   /* the linux backend sets this one */
   hal_device_property_set_bool(device, "storage.requires_eject", TRUE);
+  /* allow the storage addon to watch for media changes */
+  hal_device_property_set_bool(device, "storage.removable.support_async_notification", FALSE);
 
   /* some of these will be set by probe-storage */
   hal_device_property_set_bool(device, "storage.cdrom.cdr", FALSE);
commit b55ced4d6e9c04b9eb845580a99c962b893be416
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Jan 5 08:18:28 2008 -0500

    initialize the file monitor in osspec_privileged_init
    
    Even though kqueue doesn't require root privileges, the file monitor
    must be initialized in osspec_privileged_init() so that it is setup when
    di_cache_coherency_check() is called.

diff --git a/hald/freebsd/osspec.c b/hald/freebsd/osspec.c
index e406b5c..b7140d7 100644
--- a/hald/freebsd/osspec.c
+++ b/hald/freebsd/osspec.c
@@ -76,6 +76,12 @@ osspec_privileged_init (void)
 {
   int i;
 
+  file_monitor = hal_file_monitor_new ();
+  if (file_monitor == NULL)
+    {
+      HAL_INFO(("Cannot initialize file monitor"));
+    }
+
   for (i = 0; i < (int) G_N_ELEMENTS(handlers); i++)
     if (handlers[i]->privileged_init)
       handlers[i]->privileged_init();
@@ -88,12 +94,6 @@ osspec_init (void)
 
   pci_ids_init();
 
-  file_monitor = hal_file_monitor_new ();
-  if (file_monitor == NULL)
-    {
-      HAL_INFO(("Cannot initialize file monitor"));
-    }
-
   for (i = 0; i < (int) G_N_ELEMENTS(handlers); i++)
     if (handlers[i]->init)
       handlers[i]->init();
commit 5339844db307b061bf13a869f26e59d0f7664fe8
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Fri Jan 4 23:02:06 2008 -0500

    restore deprecated properties
    
    Adapt changes to Linux's probe-smbios to restore the old smbios.*
    properties.

diff --git a/hald/freebsd/probing/probe-smbios.c b/hald/freebsd/probing/probe-smbios.c
index 2b3b6fa..42cbb26 100644
--- a/hald/freebsd/probing/probe-smbios.c
+++ b/hald/freebsd/probing/probe-smbios.c
@@ -67,13 +67,29 @@ setstr (char *buf, char *str, char *prop)
 	if (strbegin (buf, str)) {
 		dbus_error_init (&error);
 		value = buf + strlen (str) + 1;
+		if (strcmp (value, "Not Specified") == 0)
+			goto out;
+
 		libhal_device_set_property_string (hfp_ctx, hfp_udi, prop, value, &hfp_error);
 		hfp_info ("Setting %s='%s'", prop, value);
 		return TRUE;
 	}
+out:
 	return FALSE;
 }
 
+static void
+copykeyval (char *key, char *compat_key)
+{
+	char *value;
+
+	value = libhal_device_get_property_string (hfp_ctx, hfp_udi, key, NULL);
+	if (value != NULL) {
+		hfp_info ("Copying %s -> %s", key, compat_key);
+		libhal_device_set_property_string (hfp_ctx, hfp_udi, compat_key, value, NULL);
+	}
+}
+
 /** 
  *  main:
  *  @argc:	Number of arguments given to program
@@ -221,6 +237,18 @@ main (int argc, char *argv[])
 	/* as read to EOF, close */
 	fclose (f);
 
+	/* compatibility keys, remove 28 Feb 2008 */
+	copykeyval ("system.hardware.vendor", "smbios.system.manufacturer");
+	copykeyval ("system.hardware.product", "smbios.system.product");
+	copykeyval ("system.hardware.version", "smbios.system.version");
+	copykeyval ("system.hardware.serial", "smbios.system.serial");
+	copykeyval ("system.hardware.uuid", "smbios.system.uuid");
+	copykeyval ("system.firmware.vendor", "smbios.bios.vendor");
+	copykeyval ("system.firmware.version", "smbios.bios.version");
+	copykeyval ("system.firmware.release_date", "smbios.bios.release_date");
+	copykeyval ("system.chassis.manufacturer", "smbios.chassis.manufacturer");
+	copykeyval ("system.chassis.type", "smbios.chassis.type");
+
 	/* return success */
 	ret = 0;
 
commit b3485cf167d9b1fce809f9c6cf6eb29e077cb4a6
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Fri Jan 4 22:48:55 2008 -0500

    add two new form factors
    
    Add CompactPCI and AdvancedTCA form factors from the Linux backend.

diff --git a/hald/freebsd/hf-computer.c b/hald/freebsd/hf-computer.c
index e07e24c..350cdd5 100644
--- a/hald/freebsd/hf-computer.c
+++ b/hald/freebsd/hf-computer.c
@@ -97,7 +97,9 @@ hf_computer_device_probe (HalDevice *device)
 	"RAID Chassis",			"unknown",
 	"Rack Mount Chassis",		"unknown",
 	"Sealed-case PC",		"unknown",
-	"Multi-system",			"unknown"
+	"Multi-system",			"unknown",
+	"CompactPCI",			"unknown",
+	"AdvancedTCA",			"unknown" /* 0x1B */
       };
 
       for (i = 0; i < (int) G_N_ELEMENTS(chassis_map); i += 2)
commit 56551b11ffa6fff33a1cbf3431b1ffced095d5f5
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Fri Jan 4 22:44:51 2008 -0500

    correct some typos
    
    Correct a typoe (s/infindex/ifindex/) and fix the sysctl MIB for obtaining
    the interface rate.

diff --git a/hald/freebsd/hf-net.c b/hald/freebsd/hf-net.c
index b5ea85f..8648e6f 100644
--- a/hald/freebsd/hf-net.c
+++ b/hald/freebsd/hf-net.c
@@ -81,9 +81,10 @@ hf_net_get_rate (int ifindex)
 
   oid[0] = CTL_NET;
   oid[1] = PF_LINK;
-  oid[2] = IFMIB_IFDATA;
-  oid[3] = ifindex;
-  oid[4] = IFDATA_GENERAL;
+  oid[2] = NETLINK_GENERIC;
+  oid[3] = IFMIB_IFDATA;
+  oid[4] = ifindex;
+  oid[5] = IFDATA_GENERAL;
 
   len = sizeof(ifmd);
 
@@ -171,7 +172,7 @@ hf_net_device_new (const char *interface, HalDevice *parent, GError **err)
   /* FIXME Add additional net.arp_proto_hw_id support */
 
   ifindex = if_nametoindex(interface);
-  hal_device_property_set_int(device, "net.freebsd.infindex", ifindex);
+  hal_device_property_set_int(device, "net.freebsd.ifindex", ifindex);
 
   if (is_ethernet)
     {
commit e01cf421b268da5846228548aaf22e9fd8f8e313
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Fri Jan 4 09:21:06 2008 -0500

    do not probe audio and blank CDs for file systems
    
    If a disc does not have data, do not bother checking it for file system
    information.
    
    Submitted by:	Andriy Gapon <avg at icyb.net.ua>

diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c
index 4736788..ee01927 100644
--- a/hald/freebsd/probing/probe-volume.c
+++ b/hald/freebsd/probing/probe-volume.c
@@ -377,7 +377,7 @@ main (int argc, char **argv)
    * is a swap partition, we probe it nevertheless in case the
    * partition type is incorrect.
    */
-  if (! has_children)
+  if (! has_children && ! (is_cdrom && ! has_data))
     {
       vid = volume_id_open_fd(fd);
       if (vid)
commit 7971e101df854bb5c1a05ced7eaf1eb62834cd38
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Thu Jan 3 22:33:22 2008 -0500

    fix a crash searching for devices
    
    Make sure that we do not dereference a NULL pointer when looking for
    devices that have a given property value.

diff --git a/hald/freebsd/hf-util.c b/hald/freebsd/hf-util.c
index f472570..39d1033 100644
--- a/hald/freebsd/hf-util.c
+++ b/hald/freebsd/hf-util.c
@@ -647,10 +647,14 @@ hf_device_store_match (HalDeviceStore *store, ...)
           switch (bag->type)
             {
               case HAL_PROPERTY_TYPE_STRING:
-                if (strcmp(hal_device_property_get_string(device, bag->key),
-                           bag->strval))
-                  device = NULL;
-                break;
+	        {
+		  char *pstr;
+
+		  pstr = hal_device_property_get_string(device, bag->key);
+                  if (!pstr || strcmp(pstr, bag->strval))
+                    device = NULL;
+                  break;
+		}
               case HAL_PROPERTY_TYPE_INT32:
                 if (hal_device_property_get_int(device, bag->key) !=
                     bag->intval)
commit e37ddc660da2103585ec713ed41f1a07dc2cb041
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Thu Jan 3 21:32:37 2008 -0500

    fix a typo with HD-DVD support
    
    Properly declare the HD-DVD variables.

diff --git a/hald/freebsd/probing/probe-storage.c b/hald/freebsd/probing/probe-storage.c
index 2dfae13..b9498c4 100644
--- a/hald/freebsd/probing/probe-storage.c
+++ b/hald/freebsd/probing/probe-storage.c
@@ -102,8 +102,8 @@ hf_probe_storage_get_cdrom_capabilities (const char *device_file,
       gboolean bd;
       gboolean bdr;
       gboolean bdre;
-      gboolean hdvd;
-      gboolean hdvdr;
+      gboolean hddvd;
+      gboolean hddvdr;
       gboolean hddvdrw;
 
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvd", TRUE, &hfp_error);
commit 26b532903ad6e7a9482754c1aa5efb38b2b409a0
Merge: 43a6b15... f018f64...
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Thu Jan 3 21:05:17 2008 -0500

    Merge branch 'master' of ssh://marcus@git.freedesktop.org/git/hal

commit 43a6b153e5326b1163588db263930cd0e52477f6
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Thu Jan 3 16:31:27 2008 -0500

    add Blu-Ray and HD-DVD support
    
    Adapt the Linux dvd_rw_utils code to FreeBSD to add Blu-Ray and HD-DVD
    support.

diff --git a/hald/freebsd/probing/freebsd_dvd_rw_utils.c b/hald/freebsd/probing/freebsd_dvd_rw_utils.c
index 351e50d..230c829 100644
--- a/hald/freebsd/probing/freebsd_dvd_rw_utils.c
+++ b/hald/freebsd/probing/freebsd_dvd_rw_utils.c
@@ -116,6 +116,13 @@ get_dvd_r_rw_profile (HFPCDROM *cdrom)
 		 * 0x1A: DVD+RW
 		 * 0x2A: DVD+RW DL
 		 * 0x2B: DVD+R DL
+		 * 0x40: BD-ROM
+		 * 0x41: BD-R SRM
+		 * 0x42: BD-R RRM
+		 * 0x43: BD-RE
+		 * 0x50: HD DVD-ROM
+		 * 0x51: HD DVD-R
+		 * 0x52: HD DVD-Rewritable
 		 */
 
 		switch (profile) {
@@ -135,6 +142,25 @@ get_dvd_r_rw_profile (HFPCDROM *cdrom)
 			case 0x2B:
 				retval |= DRIVE_CDROM_CAPS_DVDPLUSRDL;
 				break;
+			case 0x40:
+				retval |= DRIVE_CDROM_CAPS_BDROM;
+				break;
+			case 0x41:
+			case 0x42:
+				retval |= DRIVE_CDROM_CAPS_BDR;
+				break;
+			case 0x43:
+				retval |= DRIVE_CDROM_CAPS_BDRE;
+				break;
+			case 0x50:
+				retval |= DRIVE_CDROM_CAPS_HDDVDROM;
+				break;
+			case 0x51:
+				retval |= DRIVE_CDROM_CAPS_HDDVDR;
+				break;
+			case 0x52:
+				retval |= DRIVE_CDROM_CAPS_HDDVDRW;
+				break;
 			default:
 				break;
 		}
@@ -557,6 +583,7 @@ get_disc_capacity_dvdr_from_type (HFPCDROM *cdrom, int type, guint64 *size)
 	case 0x11:		/* DVD-R */
 	case 0x1B:		/* DVD+R */
 	case 0x2B:		/* DVD+R Double Layer */
+	case 0x41:		/* BD-R SRM */
 
 		/* READ TRACK INFORMATION */
 		scsi_command_init (cmd, 0, 0x52);
@@ -582,6 +609,13 @@ get_disc_capacity_dvdr_from_type (HFPCDROM *cdrom, int type, guint64 *size)
 
 		retval = 0;
 		break;
+	case 0x43:	/* DB-RE */
+		/* Pull the formatted capacity */
+		blocks  = formats [4 + 0] << 24;
+		blocks |= formats [4 + 1] << 16;
+		blocks |= formats [4 + 2] << 8;
+		blocks |= formats [4 + 3];
+		break;
 	default:
 		blocks = 0;
 		break;
@@ -624,6 +658,8 @@ get_disc_capacity_for_type (HFPCDROM *cdrom, int type, guint64 *size)
 	case 0x2B:
 	case 0x1A:
 	case 0x12:
+	case 0x41:
+	case 0x43:
 		retval = get_disc_capacity_dvdr_from_type (cdrom, type, size);
 		break;
 	default:
diff --git a/hald/freebsd/probing/freebsd_dvd_rw_utils.h b/hald/freebsd/probing/freebsd_dvd_rw_utils.h
index f84c59e..bf93c4f 100644
--- a/hald/freebsd/probing/freebsd_dvd_rw_utils.h
+++ b/hald/freebsd/probing/freebsd_dvd_rw_utils.h
@@ -22,6 +22,12 @@
 #define DRIVE_CDROM_CAPS_DVDPLUSRW	4
 #define DRIVE_CDROM_CAPS_DVDPLUSRWDL	8
 #define DRIVE_CDROM_CAPS_DVDPLUSRDL	16
+#define DRIVE_CDROM_CAPS_BDROM		32
+#define DRIVE_CDROM_CAPS_BDR		64
+#define DRIVE_CDROM_CAPS_BDRE		128
+#define DRIVE_CDROM_CAPS_HDDVDROM	256
+#define DRIVE_CDROM_CAPS_HDDVDR		512
+#define DRIVE_CDROM_CAPS_HDDVDRW	1024
 
 int get_dvd_r_rw_profile (HFPCDROM *cdrom);
 int get_read_write_speed (HFPCDROM *cdrom, int *read_speed, int *write_speed, char **write_speeds);
diff --git a/hald/freebsd/probing/probe-storage.c b/hald/freebsd/probing/probe-storage.c
index 1d06c32..2dfae13 100644
--- a/hald/freebsd/probing/probe-storage.c
+++ b/hald/freebsd/probing/probe-storage.c
@@ -99,6 +99,12 @@ hf_probe_storage_get_cdrom_capabilities (const char *device_file,
       gboolean rw;
       gboolean rdl;
       gboolean rwdl;
+      gboolean bd;
+      gboolean bdr;
+      gboolean bdre;
+      gboolean hdvd;
+      gboolean hdvdr;
+      gboolean hddvdrw;
 
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvd", TRUE, &hfp_error);
 
@@ -107,11 +113,23 @@ hf_probe_storage_get_cdrom_capabilities (const char *device_file,
       rw = (profile & DRIVE_CDROM_CAPS_DVDRW) != 0;
       rdl = (profile & DRIVE_CDROM_CAPS_DVDPLUSRDL) != 0;
       rwdl = (profile & DRIVE_CDROM_CAPS_DVDPLUSRWDL) != 0;
+      bd = (profile & DRIVE_CDROM_CAPS_BDROM) != 0;
+      bdr = (profile & DRIVE_CDROM_CAPS_BDR) != 0;
+      bdre = (profile & DRIVE_CDROM_CAPS_BDRE) != 0;
+      hddvd = (profile & DRIVE_CDROM_CAPS_HDDVDROM) != 0;
+      hddvdr = (profile & DRIVE_CDROM_CAPS_HDDVDR) != 0;
+      hddvdrw = (profile & DRIVE_CDROM_CAPS_HDDVDRW) != 0;
 
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvdplusr", r, &hfp_error);
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvdplusrw", rw, &hfp_error);
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvdplusrdl", rdl, &hfp_error);
       libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvdplusrwdl", rwdl, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.bd", bd, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.bdr", bdr, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.bdre", bdre, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.hddvd", hddvd, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.hddvdr", hddvdr, &hfp_error);
+      libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.hddvdrw", hddvdrw, &hfp_error);
     }
   if ((caps.media & HFP_CDROM_MST_WRITE_DVDR) != 0)
     libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.cdrom.dvdr", TRUE, &hfp_error);
commit 91031af06a0d6b6d5e395ed05dc7adc1927e89eb
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Wed Jan 2 13:04:43 2008 -0500

    adapt mount and eject functions for FreeBSD
    
    FreeBSD uses cdcontrol for ejecting and does not support a -l option
    to umount.

diff --git a/tools/hal-storage-shared.c b/tools/hal-storage-shared.c
index 19be0c9..92646ae 100644
--- a/tools/hal-storage-shared.c
+++ b/tools/hal-storage-shared.c
@@ -467,8 +467,10 @@ line_found:
 	/* construct arguments to /bin/umount */
 	na = 0;
 	args[na++] = UMOUNT;
+#ifndef __FreeBSD__
 	if (option_lazy)
 		args[na++] = "-l";
+#endif
 	if (option_force)
 		args[na++] = "-f";
 	args[na++] = (char *) device;
@@ -624,10 +626,19 @@ try_open_excl_again:
 	/* construct arguments to EJECT_PROGRAM (e.g. /usr/bin/eject) */
 	na = 0;
 	args[na++] = EJECT_PROGRAM;
+#ifdef __FreeBSD__
+	args[na++] = "-f";
+	args[na++] = (char *) device;
+	if (closetray)
+		args[na++] = "close";
+	else
+		args[na++] = "eject";
+#else
 	if (closetray) {
 		args[na++] = "-t";
 	}
 	args[na++] = (char *) device;
+#endif
 	args[na++] = NULL;
 
 #ifdef DEBUG
commit 865b0e2b1f0f480fcefd438c9813ef9bcc87acf1
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Wed Jan 2 13:00:35 2008 -0500

    do not check the return of g_new0
    
    The GLib allocation functions abort if memory allocation fails, so there
    is no need to check the result.

diff --git a/hald/freebsd/hal-file-monitor.c b/hald/freebsd/hal-file-monitor.c
index 3630971..5fe52e5 100644
--- a/hald/freebsd/hal-file-monitor.c
+++ b/hald/freebsd/hal-file-monitor.c
@@ -168,13 +168,6 @@ hal_file_monitor_add_notify (HalFileMonitor *monitor,
       FileAccessData *adata;
 
       adata = g_new0 (FileAccessData, 1);
-      if (adata == NULL)
-        {
-          /* If we can't allocate an adata, we might as well bail now. */
-          g_warning ("Failed to allocate memory for adata");
-          close (fd);
-          return id;
-        }
       adata->path = g_strdup (path);
       adata->atime = sb.st_atime;
       adata->func = notify_func;
@@ -208,11 +201,6 @@ hal_file_monitor_add_notify (HalFileMonitor *monitor,
         }
 
       kdata = g_new0 (FileKqueueData, 1);
-      if (kdata == NULL)
-        {
-          g_warning ("Failed to allocate memory for kdata");
-          goto done;
-        }
       kdata->path = g_strdup (path);
       kdata->omask = mask;
       kdata->isdir = isdir;


More information about the hal-commit mailing list