From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24909 invoked by alias); 27 May 2009 10:22:38 -0000 Received: (qmail 24903 invoked by alias); 27 May 2009 10:22:38 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_46,SPF_HELO_PASS X-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_46,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - gfs2_tool: Use FIFREEZE/FITHAW ioctl To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 8ff7eeb48e16833685a9b2232cd7f4a9921cad83 X-Git-Newrev: 873360edd9ae4417fa11379928ecf0f54216cb42 From: Steven Whitehouse Message-Id: <20090527101941.1248E120368@lists.fedorahosted.org> Date: Wed, 27 May 2009 10:22:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00421.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=873360edd9ae4417fa11379928ecf0f54216cb42 Commit: 873360edd9ae4417fa11379928ecf0f54216cb42 Parent: 8ff7eeb48e16833685a9b2232cd7f4a9921cad83 Author: Steven Whitehouse AuthorDate: Fri May 22 12:27:42 2009 +0100 Committer: Steven Whitehouse CommitterDate: Wed May 27 10:03:47 2009 +0100 gfs2_tool: Use FIFREEZE/FITHAW ioctl Updates gfs2_tool to use the generic ioctl rather than the GFS2 specific interface. Eventually that interface will be removed, and to the best of my knowledge, this tool is the only userland package using it. Signed-off-by: Steven Whitehouse --- gfs2/tool/misc.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index df422bd..649c354 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -23,6 +23,11 @@ #include "gfs2_tool.h" #include "iflags.h" +#ifndef FIFREZE +#define FIFREEZE _IOWR('X', 119, int) /* Freeze */ +#define FITHAW _IOWR('X', 120, int) /* Thaw */ +#endif + #define SYS_BASE "/sys/fs/gfs2" /* FIXME: Look in /proc/mounts to find this */ /** @@ -32,37 +37,35 @@ * */ -void -do_freeze(int argc, char **argv) +void do_freeze(int argc, char **argv) { char *command = argv[optind - 1]; - char *name; + int fd; if (optind == argc) die("Usage: gfs2_tool %s \n", command); - name = mp2fsname2(argv[optind]); - if (!name) { + fd = open(argv[optind], O_NOCTTY|O_RDONLY); + if (fd < 0) { fprintf(stderr, _("Couldn't find a GFS2 filesystem mounted at %s\n"), argv[optind]); exit(-1); } if (strcmp(command, "freeze") == 0) { - if (set_sysfs(name, "freeze", "1")) { - fprintf(stderr, _("Error writing to sysfs freeze file: %s\n"), + if (ioctl(fd, FIFREEZE, 0)) { + fprintf(stderr, _("Error freezing fs: %s\n"), strerror(errno)); exit(-1); } } else if (strcmp(command, "unfreeze") == 0) { - if (set_sysfs(name, "freeze", "0")) { - fprintf(stderr, _("Error writing to sysfs freeze file: %s\n"), + if (ioctl(fd, FITHAW, 0)) { + fprintf(stderr, _("Error thawing fs: %s\n"), strerror(errno)); exit(-1); } } - - sync(); + close(fd); } /**