* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c util.h
@ 2007-04-26 18:45 teigland
0 siblings, 0 replies; 2+ messages in thread
From: teigland @ 2007-04-26 18:45 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2007-04-26 19:45:37
Modified files:
gfs2/mount : mount.gfs2.c util.h
Log message:
Check right away if the kernel has gfs/gfs2 support by looking in
/sys/fs/. This results in a user-friendly error message instead of
something like "gfs_controld error 19".
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.h.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- cluster/gfs2/mount/mount.gfs2.c 2007/04/23 19:18:09 1.21
+++ cluster/gfs2/mount/mount.gfs2.c 2007/04/26 18:45:37 1.22
@@ -150,6 +150,25 @@
lock_dlm_leave(mo, sb, mnterr);
}
+static void check_sys_fs(char *fsname)
+{
+ DIR *d;
+ struct dirent *de;
+
+ d = opendir("/sys/fs/");
+ if (!d)
+ die("no /sys/fs/ directory found: %d\n", errno);
+
+ while ((de = readdir(d))) {
+ if (strnlen(fsname, 5) != strnlen(de->d_name, 5))
+ continue;
+ if (!strncmp(fsname, de->d_name, strnlen(fsname, 5)))
+ return;
+ }
+ die("fs type \"%s\" not found in /sys/fs/, is the module loaded?\n",
+ fsname);
+}
+
int main(int argc, char **argv)
{
struct mount_options mo;
@@ -172,6 +191,8 @@
exit(EXIT_SUCCESS);
}
+ check_sys_fs(fsname);
+
read_options(argc, argv, &mo);
check_options(&mo);
get_sb(mo.dev, &sb);
--- cluster/gfs2/mount/util.h 2006/10/13 20:01:19 1.10
+++ cluster/gfs2/mount/util.h 2007/04/26 18:45:37 1.11
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
+#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <sys/socket.h>
^ permalink raw reply [flat|nested] 2+ messages in thread* [Cluster-devel] cluster/gfs2/mount mount.gfs2.c util.h
@ 2007-04-26 18:45 teigland
0 siblings, 0 replies; 2+ messages in thread
From: teigland @ 2007-04-26 18:45 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-04-26 19:45:44
Modified files:
gfs2/mount : mount.gfs2.c util.h
Log message:
Check right away if the kernel has gfs/gfs2 support by looking in
/sys/fs/. This results in a user-friendly error message instead of
something like "gfs_controld error 19".
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/mount.gfs2.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.1&r2=1.20.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.10&r2=1.10.2.1
--- cluster/gfs2/mount/mount.gfs2.c 2007/04/23 19:18:17 1.20.2.1
+++ cluster/gfs2/mount/mount.gfs2.c 2007/04/26 18:45:44 1.20.2.2
@@ -150,6 +150,25 @@
lock_dlm_leave(mo, sb, mnterr);
}
+static void check_sys_fs(char *fsname)
+{
+ DIR *d;
+ struct dirent *de;
+
+ d = opendir("/sys/fs/");
+ if (!d)
+ die("no /sys/fs/ directory found: %d\n", errno);
+
+ while ((de = readdir(d))) {
+ if (strnlen(fsname, 5) != strnlen(de->d_name, 5))
+ continue;
+ if (!strncmp(fsname, de->d_name, strnlen(fsname, 5)))
+ return;
+ }
+ die("fs type \"%s\" not found in /sys/fs/, is the module loaded?\n",
+ fsname);
+}
+
int main(int argc, char **argv)
{
struct mount_options mo;
@@ -172,6 +191,8 @@
exit(EXIT_SUCCESS);
}
+ check_sys_fs(fsname);
+
read_options(argc, argv, &mo);
check_options(&mo);
get_sb(mo.dev, &sb);
--- cluster/gfs2/mount/util.h 2006/10/13 20:01:19 1.10
+++ cluster/gfs2/mount/util.h 2007/04/26 18:45:44 1.10.2.1
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
+#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <sys/socket.h>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-26 18:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-26 18:45 [Cluster-devel] cluster/gfs2/mount mount.gfs2.c util.h teigland
-- strict thread matches above, loose matches on Subject: below --
2007-04-26 18:45 teigland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).