hal/hald/linux2 Makefile.am,1.9,1.10 osspec.c,1.24,1.25

David Zeuthen david at freedesktop.org
Thu Jun 23 07:50:08 PDT 2005


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv4965/hald/linux2

Modified Files:
	Makefile.am osspec.c 
Log Message:
2005-06-23  David Zeuthen  <davidz at redhat.com>

        Patch from Alvaro Lopez Ortega <alvaro at sun.com> to add an empty
        Solaris backend to HAL.

        * hald/solaris/osspec.c: New file

        * hald/solaris/Makefile.am: New file

        * configure.in: Add checks for Solaris



Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am	24 Feb 2005 17:33:03 -0000	1.9
+++ Makefile.am	23 Jun 2005 14:50:04 -0000	1.10
@@ -10,7 +10,9 @@
 	-I$(top_srcdir) -I.. \
 	@PACKAGE_CFLAGS@
 
+if HALD_COMPILE_LINUX2
 noinst_LTLIBRARIES = libhald_linux2.la
+endif
 
 libhald_linux2_la_SOURCES =					\
 				osspec.c			\

Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/osspec.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- osspec.c	27 Apr 2005 18:53:39 -0000	1.24
+++ osspec.c	23 Jun 2005 14:50:04 -0000	1.25
@@ -262,6 +262,52 @@
 	return TRUE;
 }
 
+gboolean 
+hal_util_get_fs_mnt_path (const gchar *fs_type, gchar *mnt_path, gsize len)
+{
+	FILE *mnt;
+	struct mntent *mntent;
+	gboolean rc;
+	gsize dirlen;
+
+	rc = FALSE;
+	dirlen = 0;
+
+	if (fs_type == NULL || mnt_path == NULL || len == 0) {
+		HAL_ERROR (("Arguments not sane"));
+		return -1;
+	}
+
+	if ((mnt = setmntent ("/proc/mounts", "r")) == NULL) {
+		HAL_ERROR (("Error getting mount information"));
+		return -1;
+	}
+
+	while (rc == FALSE && dirlen == 0 && (mntent = getmntent(mnt)) != NULL) {
+		if (strcmp (mntent->mnt_type, fs_type) == 0) {
+			dirlen = strlen (mntent->mnt_dir);
+			if (dirlen <= (len - 1)) {
+				g_strlcpy (mnt_path, mntent->mnt_dir, len);
+				rc = TRUE;
+			} else {
+				HAL_ERROR (("Error - mount path too long"));
+				rc = FALSE;
+			}
+		}
+	}
+	endmntent (mnt);
+	
+	if (dirlen == 0 && rc == TRUE) {
+		HAL_ERROR (("Filesystem %s not found", fs_type));
+		rc = FALSE;
+	}
+
+	if ((!hal_util_remove_trailing_slash (mnt_path)))
+		rc = FALSE;
+	
+	return rc;
+}
+
 void
 osspec_init (void)
 {




More information about the hal-commit mailing list