[fedfs-utils] [PATCH 2/6] mount.fedfs: clean up after recent changes

Chuck Lever chuck.lever at oracle.com
Wed May 4 15:13:00 PDT 2011


Clean up some unused kruft left over from recent overhaul, and add
language support.

Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---

 doc/man/mount.fedfs.8 |    1 -
 src/mount/main.c      |   26 ++++++++++++++++----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/doc/man/mount.fedfs.8 b/doc/man/mount.fedfs.8
index 21d8feb..355301c 100644
--- a/doc/man/mount.fedfs.8
+++ b/doc/man/mount.fedfs.8
@@ -23,7 +23,6 @@
 .\"
 .\"	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
 .\"
-.\"
 .TH MOUNT.FEDFS 8 "31 Mar 2011"
 .SH NAME
 mount.fedfs \- mount a FedFS domain root
diff --git a/src/mount/main.c b/src/mount/main.c
index fd5172b..f76f355 100644
--- a/src/mount/main.c
+++ b/src/mount/main.c
@@ -41,7 +41,9 @@
 #include <libgen.h>
 #include <errno.h>
 #include <getopt.h>
+#include <locale.h>
 #include <netdb.h>
+#include <langinfo.h>
 
 #include "nls.h"
 #include "getsrvinfo.h"
@@ -49,16 +51,6 @@
 #include "gpl-boiler.h"
 
 /**
- * Reserved keyword replaced with constructed value of mounted-on directory
- */
-#define MNT_DEFAULT_TARGET		"default"
-
-/**
- * Mount option keyword for choosing r/w or r/o replica
- */
-#define FEDFS_REPLICA_OPTION		"fedfs_replica"
-
-/**
  * Top-level directory on client under which we mount NFSv4 domain roots
  */
 #define FEDFS_NFS4_TLDIR		"nfs4"
@@ -423,11 +415,25 @@ out:
 	return result;
 }
 
+/**
+ * Program entry point
+ *
+ * @param argc count of command line arguments
+ * @param argv array of NUL-terminated C strings containing command line arguments
+ * @return program exit status
+ */
 int main(int argc, char *argv[])
 {
 	char *source, *target, *text_options;
 	int c, mnt_err;
 
+	/* Ensure UTF-8 strings can be handled transparently */
+	if (setlocale(LC_CTYPE, "") == NULL ||
+	    strcmp(nl_langinfo(CODESET), "UTF-8") != 0) {
+		fprintf(stderr, _("Failed to set locale and langinfo\n"));
+		return 1;
+	}
+
 	progname = basename(argv[0]);
 
 	if (argv[1] && argv[1][0] == '-') {




More information about the fedfs-utils-devel mailing list