]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - freeze/xfs_freeze.c
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / freeze / xfs_freeze.c
index c946e073f7167c566737a9a24c12acf33ad217b4..a4403b341f99dfb3a7ffede507aad964f602db07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2001-2003 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
  */
 
 #include <libxfs.h>
-#include <sys/ioctl.h>
 
 char   *progname;
 
 static void
 usage(void)
 {
-       fprintf(stderr,
+       fprintf(stderr, _(
 "Usage: %s [options] mountpoint\n\n\
 Options:\n\
-        -f          freeze filesystem access\n\
-        -u          unfreeze filesystem access\n",
+       -f          freeze filesystem access\n\
+       -u          unfreeze filesystem access\n"),
                progname);
        exit(2);
 }
@@ -54,10 +53,14 @@ main(int argc, char **argv)
        int                     ffd;    /* mount point file descriptor */
        int                     fflag, uflag;
        int                     level;
-       struct statfs           buf;
+       char                    *fname;
 
        fflag = uflag = 0;
        progname = basename(argv[0]);
+       setlocale(LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        while ((c = getopt(argc, argv, "fu")) != EOF) {
                switch (c) {
                case 'f':
@@ -76,33 +79,34 @@ main(int argc, char **argv)
        if ((fflag + uflag) != 1)
                usage();
 
-       ffd = open(argv[optind], O_RDONLY);
+       fname = argv[optind];
+       ffd = open(fname, O_RDONLY);
        if (ffd < 0) {
-               perror(argv[optind]);
+               perror(fname);
                return 1;
        }
-       fstatfs(ffd, &buf);
-       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
-               fprintf(stderr,
-                       "%s: specified file is not on an XFS filesystem\n",
-                       progname);
+
+       if (!platform_test_xfs_fd(ffd)) {
+               fprintf(stderr, _("%s: specified file "
+                       "[\"%s\"] is not on an XFS filesystem\n"),
+                       progname, argv[optind]);
                exit(1);
        }
 
        if (fflag) {
                level = 1;
-               if (ioctl(ffd, XFS_IOC_FREEZE, &level) < 0) {
-                       fprintf(stderr, "%s: cannot freeze filesystem"
-                               " mounted at %s: %s\n",
+               if (xfsctl(fname, ffd, XFS_IOC_FREEZE, &level) < 0) {
+                       fprintf(stderr, _("%s: cannot freeze filesystem"
+                               " mounted at %s: %s\n"),
                                progname, argv[optind], strerror(errno));
                        exit(1);
                }
        }
 
        if (uflag) {
-               if (ioctl(ffd, XFS_IOC_THAW, &level) < 0) {
-                       fprintf(stderr, "%s: cannot unfreeze filesystem"
-                               " mounted at %s: %s\n",
+               if (xfsctl(fname, ffd, XFS_IOC_THAW, &level) < 0) {
+                       fprintf(stderr, _("%s: cannot unfreeze filesystem"
+                               " mounted at %s: %s\n"),
                                progname, argv[optind], strerror(errno));
                        exit(1);
                }