[PATCH] adapt mount and eject functions for FreeBSD

Joe Marcus Clarke marcus at FreeBSD.org
Mon Jan 7 11:01:28 PST 2008


FreeBSD uses cdcontrol for ejecting and does not support a -l option
to umount.
---
 tools/hal-storage-shared.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

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
-- 
1.5.3.2



More information about the hal mailing list