Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 147805 Details for
Bug 227945
GFS2: Final notes on the state of GFS2 and GFS2_KP
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
User space changes or gfs2_KP
gfs2_kp_userspace (text/plain), 56.51 KB, created by
Russell Cattelan
on 2007-02-09 20:45:41 UTC
(
hide
)
Description:
User space changes or gfs2_KP
Filename:
MIME Type:
Creator:
Russell Cattelan
Created:
2007-02-09 20:45:41 UTC
Size:
56.51 KB
patch
obsolete
>Index: cluster_patchme/gfs2/debug/Makefile >=================================================================== >--- cluster_patchme.orig/gfs2/debug/Makefile 2005-05-19 14:51:12.000000000 -0500 >+++ cluster_patchme/gfs2/debug/Makefile 2007-02-09 14:36:43.546658537 -0600 >@@ -41,7 +41,7 @@ INCLUDE += -I${incdir} > endif > > LDFLAGS+= -L${iddevlibdir} -L${libdir} >-LOADLIBES+= -liddev >+#LOADLIBES+= -liddev > > all: ${TARGET} > >Index: cluster_patchme/gfs2/include/gfs2_disk_hash.h >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/include/gfs2_disk_hash.h 2007-02-09 14:36:43.566658801 -0600 >@@ -0,0 +1,86 @@ >+/****************************************************************************** >+******************************************************************************* >+** >+** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. >+** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. >+** >+** This copyrighted material is made available to anyone wishing to use, >+** modify, copy, or redistribute it subject to the terms and conditions >+** of the GNU General Public License v.2. >+** >+******************************************************************************* >+******************************************************************************/ >+ >+#ifndef __GFS2_DISK_HASH_DOT_H__ >+#define __GFS2_DISK_HASH_DOT_H__ >+ >+static const uint32_t crc_32_tab[] = >+{ >+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, >+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, >+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, >+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, >+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, >+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, >+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, >+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, >+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, >+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, >+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, >+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, >+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, >+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, >+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, >+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, >+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, >+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, >+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, >+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, >+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, >+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, >+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, >+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, >+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, >+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, >+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, >+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, >+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, >+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, >+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, >+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d >+}; >+ >+/** >+ * gfs2_disk_hash - hash an array of data >+ * @data: the data to be hashed >+ * @len: the length of data to be hashed >+ * >+ * This function must produce the same results as the one in the kernel: >+ * crc32_le(0xFFFFFFFF, data, len) ^ 0xFFFFFFFF >+ * >+ * Take some data and convert it to a 32-bit hash. >+ * >+ * The hash function is a 32-bit CRC of the data. The algorithm uses >+ * the crc_32_tab table above. >+ * >+ * This may not be the fastest hash function, but it does a fair bit better >+ * at providing uniform results than the others I've looked at. That's >+ * really important for efficient directories. >+ * >+ * Returns: the hash >+ */ >+ >+uint32_t gfs2_disk_hash(const char *data, int len) >+{ >+ uint32_t hash = 0xFFFFFFFF; >+ >+ for (; len--; data++) >+ hash = crc_32_tab[(hash ^ *data) & 0xFF] ^ (hash >> 8); >+ >+ hash = ~hash; >+ >+ return hash; >+} >+ >+#endif >+ >Index: cluster_patchme/gfs2-kernel/src/gfs2/gfs2_ondisk.h >=================================================================== >--- cluster_patchme.orig/gfs2-kernel/src/gfs2/gfs2_ondisk.h 2005-05-10 16:50:31.000000000 -0500 >+++ cluster_patchme/gfs2-kernel/src/gfs2/gfs2_ondisk.h 2007-02-09 14:36:44.236667645 -0600 >@@ -84,7 +84,7 @@ > #ifndef __GFS2_ONDISK_DOT_H__ > #define __GFS2_ONDISK_DOT_H__ > >-#define GFS2_MAGIC (0x07131974) /* for all on-disk headers */ >+//#define GFS2_MAGIC (0x07131974) /* for all on-disk headers */ > #define GFS2_BASIC_BLOCK (512) /* "basic block" = "sector" = 512B */ > #define GFS2_BASIC_BLOCK_SHIFT (9) > >@@ -559,10 +559,11 @@ struct gfs2_quota_change { > > /* Endian functions */ > >-#undef GFS2_ENDIAN_BIG >+//#undef GFS2_ENDIAN_BIG > > #ifdef GFS2_ENDIAN_BIG > >+#warning GFS2_ENDIAN_BIG > #define gfs2_16_to_cpu be16_to_cpu > #define gfs2_32_to_cpu be32_to_cpu > #define gfs2_64_to_cpu be64_to_cpu >@@ -573,6 +574,7 @@ struct gfs2_quota_change { > > #else /* GFS2_ENDIAN_BIG */ > >+#warning GFS2_ENDIAN_LITTLE > #define gfs2_16_to_cpu le16_to_cpu > #define gfs2_32_to_cpu le32_to_cpu > #define gfs2_64_to_cpu le64_to_cpu >Index: cluster_patchme/gfs2/mkfs/gfs2_mkfs.h >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/gfs2_mkfs.h 2005-05-10 16:50:53.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/gfs2_mkfs.h 2007-02-09 14:36:43.586659065 -0600 >@@ -15,7 +15,7 @@ > #define __GFS2_MKFS_DOT_H__ > > #include <linux_endian.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ondisk.h> > #include <osi_list.h> > #include <iddev.h> > #include <copyright.cf> >Index: cluster_patchme/gfs2/mkfs/live.c >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/live.c 2005-05-10 16:50:53.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/live.c 2007-02-09 14:36:43.636659725 -0600 >@@ -27,8 +27,8 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > > #include "gfs2_mkfs.h" > >Index: cluster_patchme/gfs2/mkfs/main_jadd.c >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/main_jadd.c 2005-05-10 16:50:53.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/main_jadd.c 2007-02-09 14:36:43.656659989 -0600 >@@ -26,8 +26,8 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > > #include "gfs2_mkfs.h" > >Index: cluster_patchme/gfs2/mkfs/Makefile >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/Makefile 2005-05-19 14:51:14.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/Makefile 2007-02-09 14:36:43.666660121 -0600 >@@ -16,7 +16,7 @@ include ${top_srcdir}/make/defines.mk > > TARGET= gfs2_mkfs > >-SOURCE= \ >+C = \ > buf.c \ > device_geometry.c \ > fs_geometry.c \ >@@ -32,29 +32,44 @@ SOURCE= \ > ondisk.c \ > structures.c > >+O=$(subst .c,.o,${C}) >+ > CFLAGS+= -O2 -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 \ > -DGFS2_RELEASE_NAME=\"${RELEASE}\" -D_GNU_SOURCE > >-INCLUDE= -I${top_srcdir}/include -I${top_srcdir}/config \ >- -I${gfs2kincdir} -I${iddevincdir} -I${incdir} >+KERNEL_SRC = /go/cattelan/RedHat/gfs2_ken2 >+INCLUDE += -I${KERNEL_SRC}/fs/gfs2 >+INCLUDE += -I${top_srcdir}/include -I${top_srcdir}/config \ >+ -I${iddevincdir} \ >+ -I${incdir} \ >+ -I. >+ > >-ifneq (${KERNEL_SRC}, ) >+#ifneq (${KERNEL_SRC}, ) > # Use the kernel tree if patched, otherwise, look where cluster headers > # should be installed >-INCLUDE += $(shell if [ -e ${KERNEL_SRC}/include/linux/gfs2_ondisk.h ]; then \ >- echo '-I${KERNEL_SRC}/include'; else \ >- echo '-I${incdir}'; fi) >-else >-INCLUDE += -I${incdir} >-endif >+#INCLUDE += $(shell if [ -e ${KERNEL_SRC}/include/linux/gfs2_ondisk.h ]; then \ >+#INCLUDE += $(shell if [ -e ${KERNEL_SRC}/fs/gfs2/gfs2_ondisk.h ]; then \ >+# echo '-I${KERNEL_SRC}/include'; else \ >+# echo '-I${incdir}'; fi) >+#else >+#INCLUDE += -I${incdir} >+#endif > > LDFLAGS+= -L${iddevlibdir} -L${libdir} > LOADLIBES+= -liddev > > all: ${TARGET} > >-gfs2_mkfs: ${SOURCE} >- ${CC} ${CFLAGS} ${INCLUDE} ${LDFLAGS} ${SOURCE} ${LOADLIBES} ${LDLIBS} -o $@ >+#gfs2_mkfs: ${SOURCE} >+# ${CC} ${CFLAGS} ${INCLUDE} ${LDFLAGS} ${SOURCE} ${LOADLIBES} ${LDLIBS} -o $@ >+ >+gfs2_mkfs: ${O} >+ cc ${LDFLAGS} ${O} -o ${@} -liddev >+ >+.c.o: $< >+ ${CC} ${CFLAGS} -c -o $@ $^ >+ > > copytobin: ${TARGET} > cp ${TARGET} ${top_srcdir}/bin >Index: cluster_patchme/gfs2/mkfs/ondisk.c >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/ondisk.c 2005-04-25 21:58:57.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/ondisk.c 2007-02-09 14:36:43.696660517 -0600 >@@ -27,4 +27,4 @@ > #define RETURN(x, y) return y > > #define WANT_GFS2_CONVERSION_FUNCTIONS >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ondisk.h> >Index: cluster_patchme/gfs2/mkfs/structures.c >=================================================================== >--- cluster_patchme.orig/gfs2/mkfs/structures.c 2005-05-10 16:50:53.000000000 -0500 >+++ cluster_patchme/gfs2/mkfs/structures.c 2007-02-09 14:36:43.716660781 -0600 >@@ -201,6 +201,9 @@ build_unlinked_tag(struct gfs2_inode *pe > unsigned int blocks = sdp->utsize << (20 - sdp->bsize_shift); > unsigned int x; > >+ >+ printf("build_unlink_tag: num blocks %d\n",blocks); >+ > memset(&mh, 0, sizeof(struct gfs2_meta_header)); > mh.mh_magic = GFS2_MAGIC; > mh.mh_type = GFS2_METATYPE_UT; >Index: cluster_patchme/gfs2/mount/Makefile >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/Makefile 2007-02-09 14:36:43.796661837 -0600 >@@ -0,0 +1,79 @@ >+############################################################################### >+############################################################################### >+## >+## Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+## >+## This copyrighted material is made available to anyone wishing to use, >+## modify, copy, or redistribute it subject to the terms and conditions >+## of the GNU General Public License v.2. >+## >+############################################################################### >+############################################################################### >+ >+top_srcdir=.. >+include ${top_srcdir}/make/defines.mk >+UNINSTALL=${top_srcdir}/scripts/uninstall.pl >+ >+TARGET1= mount.gfs2 >+TARGET2= umount.gfs2 >+ >+CFLAGS+= -g3 -O2 -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 \ >+ -DGFS2_RELEASE_NAME=\"${RELEASE}\" -D_GNU_SOURCE >+ >+#KERNEL_SRC = /go/cattelan/RedHat/gfs2_ken2 >+#INCLUDE += -I${KERNEL_SRC}/fs/gfs2 >+#INCLUDE += -I${KERNEL_SRC}/include/linux >+INCLUDE = -I${top_srcdir}/include \ >+ -I${top_srcdir}/config \ >+ -I${incdir} \ >+ -I. >+ >+# -I${gfs2kincdir} >+ >+ifneq (${KERNEL_SRC}, ) >+# Use the kernel tree if patched, otherwise, look where cluster headers >+# should be installed >+INCLUDE += $(shell if [ -e ${KERNEL_SRC}/include/linux/gfs2_ondisk.h ]; then \ >+ echo '-I${KERNEL_SRC}/include'; else \ >+ echo '-I${incdir}'; fi) >+else >+INCLUDE += -I${incdir} >+endif >+ >+ >+all: ${TARGET1} ${TARGET2} >+ >+mount.gfs2.o: mount.gfs2.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+ondisk1.o: ondisk1.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+ondisk2.o: ondisk2.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+util.o: util.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+mtab.o: mtab.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+umount.gfs2.o: umount.gfs2.c >+ ${CC} ${CFLAGS} ${INCLUDE} -c -o $@ $< >+ >+mount.gfs2: mount.gfs2.o ondisk1.o ondisk2.o util.o mtab.o >+ ${CC} ${LDFLAGS} -o $@ $^ >+ >+umount.gfs2: umount.gfs2.o ondisk1.o ondisk2.o util.o mtab.o >+ ${CC} ${LDFLAGS} -o $@ $^ >+ >+install: all >+ install mount.gfs2 ${sbindir} >+ install umount.gfs2 ${sbindir} >+ >+uninstall: >+ ${UNINSTALL} mount.gfs2 umount.gfs2 mount.gfs umount.gfs ${sbindir} >+ >+clean: >+ rm -f *.o ${TARGET1} ${TARGET2} >+ >Index: cluster_patchme/gfs2/mount/mount.gfs2.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/mount.gfs2.c 2007-02-09 14:36:43.836662365 -0600 >@@ -0,0 +1,211 @@ >+/* >+ * Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+ * >+ * This copyrighted material is made available to anyone wishing to use, >+ * modify, copy, or redistribute it subject to the terms and conditions >+ * of the GNU General Public License v.2. >+ */ >+ >+#include <unistd.h> >+#include <stdio.h> >+#include <stdlib.h> >+ >+#include "util.h" >+ >+char *prog_name; >+char *fsname; >+int verbose; >+ >+static void print_version(void) >+{ >+ printf("mount.gfs2 %s (built %s %s)\n", GFS2_RELEASE_NAME, >+ __DATE__, __TIME__); >+} >+ >+static void print_usage(void) >+{ >+ printf("Usage:\n"); >+ printf("This program is called by mount(8), it should not be used directly.\n"); >+} >+ >+static void block_signals(int how) >+{ >+ sigset_t sigs; >+ sigfillset(&sigs); >+ sigdelset(&sigs, SIGTRAP); >+ sigdelset(&sigs, SIGSEGV); >+ sigdelset(&sigs, SIGINT); >+ sigprocmask(how, &sigs, (sigset_t *) 0); >+} >+ >+static void read_options(int argc, char **argv, struct mount_options *mo) >+{ >+ int cont = 1; >+ int optchar; >+ int l; >+ >+ /* FIXME: check for "quiet" option and don't print in that case */ >+ >+ while (cont) { >+ optchar = getopt(argc, argv, "hVo:t:v"); >+ >+ switch (optchar) { >+ case EOF: >+ cont = 0; >+ break; >+ >+ case 'h': >+ print_usage(); >+ exit(EXIT_SUCCESS); >+ >+ case 'V': >+ print_version(); >+ exit(EXIT_SUCCESS); >+ >+ case 'v': >+ ++verbose; >+ break; >+ >+ case 'o': >+ if (optarg) >+ strncpy(mo->opts, optarg, PATH_MAX); >+ break; >+ >+ case 't': >+ if (optarg) >+ strncpy(mo->type, optarg, 4); >+ break; >+ >+ default: >+ break; >+ } >+ } >+ >+ if (optind < argc && argv[optind]) >+ strncpy(mo->dev, argv[optind], PATH_MAX); >+ >+ ++optind; >+ >+ if (optind < argc && argv[optind]) { >+ strncpy(mo->dir, argv[optind], PATH_MAX); >+ l = strlen(mo->dir) - 1; >+ while (l > 0 && mo->dir[l] == '/') { >+ mo->dir[l] = '\0'; >+ l--; >+ }; >+ } >+ >+ log_debug("mount %s %s", mo->dev, mo->dir); >+} >+ >+static void check_options(struct mount_options *mo) >+{ >+ struct stat buf; >+ >+ if (!strlen(mo->dev)) >+ die("no device name specified\n"); >+ >+ if (!strlen(mo->dir)) >+ die("no mount point specified\n"); >+ >+ if (strlen(mo->type) && strcmp(mo->type, fsname)) >+ die("unknown file system type \"%s\"\n", mo->type); >+ >+ if (stat(mo->dir, &buf) < 0) >+ die("mount point %s does not exist\n", mo->dir); >+ >+ if (!S_ISDIR(buf.st_mode)) >+ die("mount point %s is not a directory\n", mo->dir); >+} >+ >+static int mount_lockproto(char *proto, struct mount_options *mo, >+ struct gen_sb *sb) >+{ >+ int rv = 0; >+ >+ if (!strcmp(proto, "lock_dlm")) { >+ if (mo->flags & MS_REMOUNT) { >+ rv = lock_dlm_remount(mo, sb); >+ strncpy(mo->extra_plus, mo->extra, PATH_MAX); >+ } >+ else >+ rv = lock_dlm_join(mo, sb); >+ } else >+ strncpy(mo->extra_plus, mo->extra, PATH_MAX); >+ >+ return rv; >+} >+ >+static void mount_result_lockproto(char *proto, struct mount_options *mo, >+ struct gen_sb *sb, int result) >+{ >+ if (!strcmp(proto, "lock_dlm")) >+ lock_dlm_mount_result(mo, sb, result); >+} >+ >+static void umount_lockproto(char *proto, struct mount_options *mo, >+ struct gen_sb *sb, int mnterr) >+{ >+ if (!strcmp(proto, "lock_dlm")) >+ lock_dlm_leave(mo, sb, mnterr); >+} >+ >+int main(int argc, char **argv) >+{ >+ struct mount_options mo; >+ struct gen_sb sb; >+ char *proto; >+ int rv; >+ >+ memset(&mo, 0, sizeof(mo)); >+ memset(&sb, 0, sizeof(sb)); >+ >+ prog_name = argv[0]; >+ >+ if (!strstr(prog_name, "gfs")) >+ die("invalid mount helper name \"%s\"\n", prog_name); >+ >+ fsname = (strstr(prog_name, "gfs2")) ? "gfs2" : "gfs"; >+ >+ if (argc < 2) { >+ print_usage(); >+ exit(EXIT_SUCCESS); >+ } >+ >+ read_options(argc, argv, &mo); >+ check_options(&mo); >+ get_sb(mo.dev, &sb); >+ parse_opts(&mo); >+ >+ proto = select_lockproto(&mo, &sb); >+ >+ rv = mount_lockproto(proto, &mo, &sb); >+ if (rv < 0) >+ die("error mounting lockproto %s\n", proto); >+ >+ block_signals(SIG_BLOCK); >+ >+ rv = mount(mo.dev, mo.dir, fsname, mo.flags, mo.extra_plus); >+ if (rv) { >+ log_debug("mount(2) failed error %d errno %d", rv, errno); >+ mount_result_lockproto(proto, &mo, &sb, rv); >+ >+ if (!(mo.flags & MS_REMOUNT)) >+ umount_lockproto(proto, &mo, &sb, errno); >+ >+ block_signals(SIG_UNBLOCK); >+ if (errno == EBUSY) >+ die("%s already mounted or %s busy\n", mo.dev, mo.dir); >+ die("error %d mounting %s on %s\n", errno, mo.dev, mo.dir); >+ } >+ log_debug("mount(2) ok"); >+ mount_result_lockproto(proto, &mo, &sb, 0); >+ >+ block_signals(SIG_UNBLOCK); >+ >+ if (!(mo.flags & MS_REMOUNT)) >+ add_mtab_entry(&mo); >+ >+ return rv ? 1 : 0; >+} >+ >Index: cluster_patchme/gfs2/mount/mtab.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/mtab.c 2007-02-09 14:36:43.836662365 -0600 >@@ -0,0 +1,197 @@ >+/* >+ * Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+ * >+ * This copyrighted material is made available to anyone wishing to use, >+ * modify, copy, or redistribute it subject to the terms and conditions >+ * of the GNU General Public License v.2. >+ */ >+ >+#include "util.h" >+ >+extern char *prog_name; >+extern char *fsname; >+extern int verbose; >+static int ignoring_mtab; >+ >+/* Don't bother with /etc/mtab if: >+ - /etc/mtab is a link to /proc/mounts >+ - there is no /etc/mtab file >+ - we can't write to /etc/mtab */ >+ >+static int ignore_mtab(void) >+{ >+ struct stat sbuf; >+ int fd; >+ >+ if (ignoring_mtab) >+ return 1; >+ >+ if (lstat("/etc/mtab", &sbuf) < 0) >+ goto do_ignore; >+ >+ if (S_ISLNK(sbuf.st_mode)) >+ goto do_ignore; >+ >+ fd = open("/etc/mtab", O_RDWR, 0644); >+ if (fd < 0) >+ goto do_ignore; >+ >+ close(fd); >+ return 0; >+ >+ do_ignore: >+ ignoring_mtab = 1; >+ return 1; >+} >+ >+/* Whichever process successfully links their own /etc/mtab~pid file to >+ /etc/mtab~ gets the lock. We just sleep/retry until we get the lock. >+ This is the locking method used by util-linux/mount/fstab.c which we >+ need to keep in sync with. */ >+ >+static void lock_mtab(void) >+{ >+ char fname[32]; >+ int rv, fd, e, retries = 0; >+ >+ if (ignore_mtab()) >+ return; >+ >+ sprintf(fname, "/etc/mtab~%d", getpid()); >+ retry: >+ fd = open(fname, O_WRONLY|O_CREAT, 0); >+ e = errno; >+ if (fd < 0) >+ die("can't create mtab lock file %s: %s\n", fname, strerror(e)); >+ close(fd); >+ >+ rv = link(fname, "/etc/mtab~"); >+ e = errno; >+ >+ unlink(fname); >+ >+ if (rv < 0 && e != EEXIST) >+ die("can't link %s to /etc/mtab~: %s\n", fname, strerror(e)); >+ >+ if (rv < 0) { >+ if (++retries > 5) >+ warn("waiting to lock /etc/mtab~: try unlinking " >+ "stale /etc/mtab~ file\n"); >+ sleep(1); >+ goto retry; >+ } >+} >+ >+static void unlock_mtab(void) >+{ >+ if (ignore_mtab()) >+ return; >+ unlink("/etc/mtab~"); >+} >+ >+void add_mtab_entry(struct mount_options *mo) >+{ >+ FILE *file; >+ >+ read_proc_mounts(mo); >+ >+ lock_mtab(); >+ >+ file = fopen("/etc/mtab", "a"); >+ if (!file) { >+ warn("can't add entry to /etc/mtab"); >+ return; >+ } >+ >+ fprintf(file, "%s", mo->proc_entry); >+ >+ fclose(file); >+ >+ unlock_mtab(); >+} >+ >+/* This follows what util-linux/mount/fstab.c does wrt writing new mtab.tmp >+ and replacing /etc/mtab with it, we need to keep in sync with fstab.c's >+ procedure for this. */ >+ >+void del_mtab_entry(struct mount_options *mo) >+{ >+ char line[PATH_MAX]; >+ char device[PATH_MAX]; >+ char path[PATH_MAX]; >+ char type[16]; >+ FILE *mtab, *mtmp; >+ mode_t old_umask; >+ struct stat sbuf; >+ int found = 0; >+ >+ lock_mtab(); >+ >+ old_umask = umask(077); >+ >+ mtmp = fopen("/etc/mtab.tmp", "w"); >+ mtab = fopen("/etc/mtab", "r"); >+ >+ umask(old_umask); >+ >+ if (!mtmp || !mtab) >+ goto fail; >+ >+ while (fgets(line, PATH_MAX, mtab)) { >+ /* exclude the line matching the fs being unmounted >+ from the next version of mtab */ >+ >+ if ((sscanf(line, "%s %s %s", device, path, type) == 3) && >+ (strncmp(type, "gfs", 3) == 0) && >+ (strcmp(path, mo->dir) == 0) && >+ (strcmp(device, mo->dev) == 0)) { >+ found = 1; >+ continue; >+ } >+ >+ /* all other lines from mtab are included in >+ the next version of mtab */ >+ >+ if (fprintf(mtmp, "%s", line) < 0) { >+ int e = errno; >+ warn("error writing to /etc/mtab.tmp: %s", strerror(e)); >+ } >+ } >+ >+ if (!found) { >+ warn("file system mounted on %s not found in mtab", mo->dir); >+ goto fail; >+ } >+ >+ if (fchmod(fileno(mtmp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) { >+ int e = errno; >+ warn("error changing mode of /etc/mtab.tmp: %s", strerror(e)); >+ } >+ >+ if (stat("/etc/mtab", &sbuf) < 0) { >+ int e = errno; >+ warn("error stating /etc/mtab: %s", strerror(e)); >+ } else >+ chown("/etc/mtab.tmp", sbuf.st_uid, sbuf.st_gid); >+ >+ fclose(mtmp); >+ fclose(mtab); >+ >+ if (rename("/etc/mtab.tmp", "/etc/mtab") < 0) { >+ int e = errno; >+ warn("can't rename /etc/mtab.tmp to /etc/mtab: %s", >+ strerror(e)); >+ goto fail_unlink; >+ } >+ >+ unlock_mtab(); >+ return; >+ >+ fail: >+ fclose(mtmp); >+ fclose(mtab); >+ fail_unlink: >+ unlink("/etc/mtab.tmp"); >+ unlock_mtab(); >+} >+ >Index: cluster_patchme/gfs2/mount/ondisk1.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/ondisk1.c 2007-02-09 14:36:43.866662761 -0600 >@@ -0,0 +1,32 @@ >+/****************************************************************************** >+******************************************************************************* >+** >+** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. >+** Copyright (C) 2004 Red Hat, Inc. All rights reserved. >+** >+** This copyrighted material is made available to anyone wishing to use, >+** modify, copy, or redistribute it subject to the terms and conditions >+** of the GNU General Public License v.2. >+** >+******************************************************************************* >+******************************************************************************/ >+ >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+#include <stdint.h> >+#include <inttypes.h> >+ >+#include "linux_endian.h" >+ >+#define printk printf >+#define pv(struct, member, fmt) printf(" "#member" = "fmt"\n", struct->member); >+ >+#define ENTER(x) >+#define EXIT(x) >+#define RET(x) return >+#define RETURN(x, y) return y >+ >+#define WANT_GFS_CONVERSION_FUNCTIONS >+#include "gfs_ondisk.h" >+ >Index: cluster_patchme/gfs2/mount/ondisk2.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/ondisk2.c 2007-02-09 14:36:43.876662893 -0600 >@@ -0,0 +1,36 @@ >+/****************************************************************************** >+******************************************************************************* >+** >+** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. >+** Copyright (C) 2004 Red Hat, Inc. All rights reserved. >+** >+** This copyrighted material is made available to anyone wishing to use, >+** modify, copy, or redistribute it subject to the terms and conditions >+** of the GNU General Public License v.2. >+** >+******************************************************************************* >+******************************************************************************/ >+ >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+#include <stdint.h> >+#include <inttypes.h> >+ >+#include "linux_endian.h" >+ >+#define printk printf >+ >+#define __be16 uint16_t >+#define __be32 uint32_t >+#define __be64 uint64_t >+#define __u16 uint16_t >+#define __u32 uint32_t >+#define __u64 uint64_t >+#define __u8 uint8_t >+ >+//#define WANT_GFS2_CONVERSION_FUNCTIONS >+#include <gfs2_ondisk.h> >+ >+//#include "gfs2_disk_hash.h" >+ >Index: cluster_patchme/gfs2/mount/umount.gfs2.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/umount.gfs2.c 2007-02-09 14:36:43.906663289 -0600 >@@ -0,0 +1,146 @@ >+/* >+ * Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+ * >+ * This copyrighted material is made available to anyone wishing to use, >+ * modify, copy, or redistribute it subject to the terms and conditions >+ * of the GNU General Public License v.2. >+ */ >+ >+#include "util.h" >+ >+char *prog_name; >+char *fsname; >+char *expert; >+int verbose; >+ >+static void print_version(void) >+{ >+ printf("umount.gfs2 %s (built %s %s)\n", GFS2_RELEASE_NAME, >+ __DATE__, __TIME__); >+} >+ >+static void print_usage(void) >+{ >+ printf("Usage:\n"); >+ printf("This program is called by umount(8), it should not be used directly.\n"); >+ printf("If umount(8) fails to call umount.gfs2, you can clean up with\n"); >+ printf("> umount.gfs2 -v -X lock_dlm <mountpoint>\n"); >+ >+} >+ >+static void read_options(int argc, char **argv, struct mount_options *mo) >+{ >+ int cont = 1; >+ int optchar; >+ int l; >+ >+ /* FIXME: check for "quiet" option and don't print in that case */ >+ >+ while (cont) { >+ optchar = getopt(argc, argv, "fhVvX:"); >+ >+ switch (optchar) { >+ case EOF: >+ cont = 0; >+ break; >+ >+ case 'f': /* autofs umount from /sbin/halt uses this */ >+ break; >+ >+ case 'v': >+ ++verbose; >+ break; >+ >+ case 'X': >+ expert = strdup(optarg); >+ log_debug("umount expert override: %s", expert); >+ break; >+ >+ case 'h': >+ print_usage(); >+ exit(EXIT_SUCCESS); >+ >+ case 'V': >+ print_version(); >+ exit(EXIT_SUCCESS); >+ >+ default: >+ break; >+ } >+ } >+ >+ if (optind < argc && argv[optind]) { >+ strncpy(mo->dir, argv[optind], PATH_MAX); >+ l = strlen(mo->dir) - 1; >+ while (l > 0 && mo->dir[l] == '/') { >+ mo->dir[l] = '\0'; >+ l--; >+ }; >+ } >+ >+ log_debug("umount %s", mo->dir); >+} >+ >+static void check_options(struct mount_options *mo) >+{ >+ if (!strlen(mo->dir)) >+ die("no mount point specified\n"); >+} >+ >+static int umount_lockproto(char *proto, struct mount_options *mo, >+ struct gen_sb *sb) >+{ >+ int rv = 0; >+ >+ if (!strcmp(proto, "lock_dlm")) >+ rv = lock_dlm_leave(mo, sb, 0); >+ return rv; >+} >+ >+int main(int argc, char **argv) >+{ >+ struct mount_options mo; >+ struct gen_sb sb; >+ char *proto; >+ int rv; >+ >+ memset(&mo, 0, sizeof(mo)); >+ memset(&sb, 0, sizeof(sb)); >+ >+ prog_name = argv[0]; >+ >+ if (!strstr(prog_name, "gfs")) >+ die("invalid umount helper name \"%s\"\n", prog_name); >+ >+ fsname = (strstr(prog_name, "gfs2")) ? "gfs2" : "gfs"; >+ >+ if (argc < 2) { >+ print_usage(); >+ exit(EXIT_SUCCESS); >+ } >+ >+ read_options(argc, argv, &mo); >+ >+ if (expert) >+ return umount_lockproto(expert, &mo, &sb); >+ >+ check_options(&mo); >+ read_proc_mounts(&mo); >+ get_sb(mo.dev, &sb); >+ parse_opts(&mo); >+ >+ rv = umount(mo.dir); >+ if (rv) { >+ if (errno == EBUSY) >+ die("%s: device is busy.\n", mo.dir); >+ else >+ die("error %d unmounting %s\n", errno, mo.dir); >+ } >+ proto = select_lockproto(&mo, &sb); >+ umount_lockproto(proto, &mo, &sb); >+ >+ del_mtab_entry(&mo); >+ >+ return 0; >+} >+ >Index: cluster_patchme/gfs2/mount/util.c >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/util.c 2007-02-09 14:36:43.936663685 -0600 >@@ -0,0 +1,764 @@ >+/* >+ * Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+ * >+ * This copyrighted material is made available to anyone wishing to use, >+ * modify, copy, or redistribute it subject to the terms and conditions >+ * of the GNU General Public License v.2. >+ */ >+ >+#include "util.h" >+ >+extern char *prog_name; >+extern char *fsname; >+extern int verbose; >+static int gfs_controld_fd = -1; >+static int adding_another_mountpoint; >+ >+#define LOCK_DLM_SOCK_PATH "gfs_controld_sock" /* FIXME: use a header */ >+#define MAXLINE 256 /* size of messages with gfs_controld */ >+ >+/* opt_map stuff from util-linux */ >+ >+struct opt_map { >+ char *opt; /* option name */ >+ int skip; /* skip in mtab option string (gfs: not used) */ >+ int inv; /* true if flag value should be inverted */ >+ int mask; /* flag mask value */ >+}; >+ >+static struct opt_map opt_map[] = { >+ { "defaults", 0, 0, 0 }, /* default options */ >+ { "ro", 1, 0, MS_RDONLY }, /* read-only */ >+ { "rw", 1, 1, MS_RDONLY }, /* read-write */ >+ { "exec", 0, 1, MS_NOEXEC }, /* permit execution of binaries */ >+ { "noexec", 0, 0, MS_NOEXEC }, /* don't execute binaries */ >+ { "suid", 0, 1, MS_NOSUID }, /* honor suid executables */ >+ { "nosuid", 0, 0, MS_NOSUID }, /* don't honor suid executables */ >+ { "dev", 0, 1, MS_NODEV }, /* interpret device files */ >+ { "nodev", 0, 0, MS_NODEV }, /* don't interpret devices */ >+ { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */ >+ { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */ >+ { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */ >+ { "bind", 0, 0, MS_BIND }, /* Remount part of tree elsewhere */ >+ { "mand", 0, 0, MS_MANDLOCK }, /* Allow mandatory locks on this FS */ >+ { "nomand", 0, 1, MS_MANDLOCK }, /* Forbid mandatory locks on this FS */ >+ { "atime", 0, 1, MS_NOATIME }, /* Update access time */ >+ { "noatime", 0, 0, MS_NOATIME }, /* Do not update access time */ >+ { "diratime", 0, 1, MS_NODIRATIME }, /* Update dir access times */ >+ { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */ >+ >+ /* options used by the mount command only (not in sys/mount.h): */ >+ { "dirsync", 0, 0, 0 }, /* synchronous directory modifications */ >+ { "loop", 1, 0, 0 }, /* use a loop device */ >+ { "auto", 0, 1, 0 }, /* Can be mounted using -a */ >+ { "noauto", 0, 0, 0 }, /* Can only be mounted explicitly */ >+ { "users", 0, 0, 0 }, /* Allow ordinary user to mount */ >+ { "nousers", 0, 1, 0 }, /* Forbid ordinary user to mount */ >+ { "user", 0, 0, 0 }, /* Allow ordinary user to mount */ >+ { "nouser", 0, 1, 0 }, /* Forbid ordinary user to mount */ >+ { "owner", 0, 0, 0 }, /* Let the owner of the device mount */ >+ { "noowner", 0, 1, 0 }, /* Device owner has no special privs */ >+ { NULL, 0, 0, 0 } >+}; >+ >+/* if option has a corresponding MS_XXX, set the bit in the flags */ >+ >+static int set_flag(char *o, int *flags) >+{ >+ struct opt_map *om; >+ >+ for (om = opt_map; om->opt; om++) { >+ if (strcmp(om->opt, o)) >+ continue; >+ >+ if (om->inv) >+ *flags &= ~om->mask; >+ else >+ *flags |= om->mask; >+ >+ log_debug(" %s flag %x for \"%s\", flags = %x", >+ om->inv ? "clear" : "set", om->mask, om->opt, *flags); >+ >+ return 1; >+ } >+ >+ return 0; >+} >+ >+/* opts is the string of all mount options, this function finds >+ the options that have MS_XXX flags and sets the appropriate flag >+ bit. The options without an MS_ flag are copied into the extra >+ string. The values of some specific options are saved for later >+ internal use. */ >+ >+void parse_opts(struct mount_options *mo) >+{ >+ char data[PATH_MAX+1]; >+ char *options, *o, *v; >+ int extra_len = 0; >+ >+ log_debug("parse_opts: opts = \"%s\"", mo->opts); >+ >+ memset(data, 0, sizeof(data)); >+ strncpy(data, mo->opts, PATH_MAX); >+ >+ for (options = data; (o = strsep(&options, ",")); ) { >+ if (!*o) >+ continue; >+ >+ if (set_flag(o, &mo->flags)) >+ continue; >+ >+ if (!strncmp("hostdata", o, 8)) { >+ if (mo->hostdata[0]) >+ warn("duplicate hostdata strings"); >+ else >+ strcat(mo->hostdata, o); >+ continue; >+ } >+ >+ if (extra_len + 1 + strlen(o) > PATH_MAX) >+ die("extra options string is too long\n"); >+ >+ if (mo->extra[0]) { >+ strcat(mo->extra, ","); >+ extra_len += 1; >+ } >+ >+ log_debug(" add extra %s", o); >+ >+ strcat(mo->extra, o); >+ extra_len += strlen(o); >+ >+ v = strchr(o, '='); >+ if (v) >+ *v++ = 0; >+ >+ /* we grab these now so we don't have to parse them out >+ again later when doing proto-specific stuff */ >+ >+ if (!strcmp(o, "lockproto")) { >+ if (!v) >+ die("option lockproto needs value\n"); >+ strncpy(mo->lockproto, v, 255); >+ } >+ >+ if (!strcmp(o, "locktable")) { >+ if (!v) >+ die("option locktable needs value\n"); >+ strncpy(mo->locktable, v, 255); >+ } >+ } >+ >+ log_debug("parse_opts: flags = %x", mo->flags); >+ log_debug("parse_opts: extra = \"%s\"", mo->extra); >+ log_debug("parse_opts: hostdata = \"%s\"", mo->hostdata); >+ log_debug("parse_opts: lockproto = \"%s\"", mo->lockproto); >+ log_debug("parse_opts: locktable = \"%s\"", mo->locktable); >+} >+ >+/* - when unmounting, we don't know the dev and need this function to set it; >+ we also want to select the _last_ line with a matching dir since it will >+ be the top-most fs that the umount(2) will unmount >+ - when mounting, we do know the dev and need this function to use it in the >+ comparison (for multiple fs's with the same mountpoint) */ >+ >+void read_proc_mounts(struct mount_options *mo) >+{ >+ FILE *file; >+ char line[PATH_MAX]; >+ char path[PATH_MAX]; >+ char type[PATH_MAX]; >+ char opts[PATH_MAX]; >+ char device[PATH_MAX]; >+ char save_line[PATH_MAX]; >+ char save_opts[PATH_MAX]; >+ char save_device[PATH_MAX]; >+ int found = 0; >+ >+ file = fopen("/proc/mounts", "r"); >+ if (!file) >+ die("can't open /proc/mounts: %s\n", strerror(errno)); >+ >+ while (fgets(line, PATH_MAX, file)) { >+ if (sscanf(line, "%s %s %s %s", device, path, type, opts) != 4) >+ continue; >+ if (strcmp(path, mo->dir)) >+ continue; >+ if (mo->dev[0] && strcmp(device, mo->dev)) >+ continue; >+ if (strcmp(type, fsname)) >+ die("%s is not a %s filesystem\n", mo->dir, fsname); >+ >+ /* when there is an input dev specified (mount), we should get >+ only one matching line; when there is no input dev specified >+ (umount), we want the _last_ matching line */ >+ >+ strncpy(save_device, device, PATH_MAX); >+ strncpy(save_opts, opts, PATH_MAX); >+ strncpy(save_line, line, PATH_MAX); >+ found = 1; >+ } >+ >+ fclose(file); >+ >+ if (!found) >+ die("can't find /proc/mounts entry for directory %s\n", mo->dir); >+ else { >+ strncpy(mo->dev, save_device, PATH_MAX); >+ strncpy(mo->opts, save_opts, PATH_MAX); >+ strncpy(mo->proc_entry, save_line, PATH_MAX); >+ } >+ >+ log_debug("read_proc_mounts: device = \"%s\"", mo->dev); >+ log_debug("read_proc_mounts: opts = \"%s\"", mo->opts); >+} >+ >+void gfs2_inum_in(struct gfs2_inum *no, char *buf) >+{ >+ struct gfs2_inum *str = (struct gfs2_inum *)buf; >+ >+ no->no_formal_ino = be64_to_cpu(str->no_formal_ino); >+ no->no_addr = be64_to_cpu(str->no_addr); >+} >+ >+void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf) >+{ >+ struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf; >+ >+ mh->mh_magic = be32_to_cpu(str->mh_magic); >+ mh->mh_type = be32_to_cpu(str->mh_type); >+ mh->mh_format = be32_to_cpu(str->mh_format); >+} >+ >+void gfs2_sb_in(struct gfs2_sb *sb, char *buf) >+{ >+ struct gfs2_sb *str = (struct gfs2_sb *)buf; >+ >+ gfs2_meta_header_in(&sb->sb_header, buf); >+ >+ sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); >+ sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); >+ sb->sb_bsize = be32_to_cpu(str->sb_bsize); >+ sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); >+ >+ gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir); >+// gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir); >+ >+ memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); >+ memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); >+} >+ >+int get_sb(char *device, struct gen_sb *sb_out) >+{ >+ int fd; >+ >+ fd = open(device, O_RDONLY); >+ if (fd < 0) >+ die("can't open %s: %s\n", device, strerror(errno)); >+ >+ if (!strcmp(fsname, "gfs2")) { >+ char buf[GFS2_BASIC_BLOCK]; >+ struct gfs2_sb sb; >+ >+ do_lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK); >+ do_read(fd, buf, GFS2_BASIC_BLOCK); >+ gfs2_sb_in(&sb, buf); >+ >+ if (sb.sb_header.mh_magic != GFS2_MAGIC || >+ sb.sb_header.mh_type != GFS2_METATYPE_SB) { >+ warn("there isn't a GFS2 filesystem on %s, " >+ "magic=%x type=%x\n", device, >+ sb.sb_header.mh_magic, sb.sb_header.mh_type); >+ } >+ >+ if (sb.sb_fs_format != GFS2_FORMAT_FS || >+ sb.sb_multihost_format != GFS2_FORMAT_MULTI) { >+ warn("there appears to be a GFS, not GFS2, filesystem " >+ "on %s\n", device); >+ } >+ >+ strncpy(sb_out->lockproto, sb.sb_lockproto, 256); >+ strncpy(sb_out->locktable, sb.sb_locktable, 256); >+ >+ } else if (!strcmp(fsname, "gfs")) { >+ char buf[GFS_BASIC_BLOCK]; >+ struct gfs_sb sb; >+ >+ do_lseek(fd, GFS_SB_ADDR * GFS_BASIC_BLOCK); >+ do_read(fd, buf, GFS2_BASIC_BLOCK); >+ gfs_sb_in(&sb, buf); >+ >+ if (sb.sb_header.mh_magic != GFS_MAGIC || >+ sb.sb_header.mh_type != GFS_METATYPE_SB) { >+ gfs_sb_print(&sb); >+ die("there isn't a GFS filesystem on %s\n", device); >+ } >+ >+ if (sb.sb_fs_format != GFS_FORMAT_FS || >+ sb.sb_multihost_format != GFS_FORMAT_MULTI) { >+ die("there appears to be a GFS2, not GFS, filesystem " >+ "on %s\n", device); >+ } >+ >+ strncpy(sb_out->lockproto, sb.sb_lockproto, 256); >+ strncpy(sb_out->locktable, sb.sb_locktable, 256); >+ } >+ >+ close(fd); >+ return 0; >+} >+ >+char *select_lockproto(struct mount_options *mo, struct gen_sb *sb) >+{ >+ /* find the effective lockproto, proto specified in mount options >+ overrides the sb lockproto */ >+ >+ if (mo->lockproto[0]) >+ return mo->lockproto; >+ else >+ return sb->lockproto; >+} >+ >+static int gfs_controld_connect(void) >+{ >+ struct sockaddr_un sun; >+ socklen_t addrlen; >+ int rv, fd; >+ >+ fd = socket(PF_UNIX, SOCK_STREAM, 0); >+ if (fd < 0) >+ goto out; >+ >+ memset(&sun, 0, sizeof(sun)); >+ sun.sun_family = AF_UNIX; >+ strcpy(&sun.sun_path[1], LOCK_DLM_SOCK_PATH); >+ addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1; >+ >+ rv = connect(fd, (struct sockaddr *) &sun, addrlen); >+ if (rv < 0) { >+ close(fd); >+ fd = rv; >+ } >+ out: >+ return fd; >+} >+ >+#if 0 >+/* We create a pipe and pass the receiving end to gfs_controld. If the >+ mount fails, we write an error message to this pipe. gfs_controld monitors >+ this fd outside its main poll loop because it may need to detect a mount >+ failure while watching for the kernel mount (while waiting for the kernel >+ mount, gfs_controld is _not_ in its main poll loop which is why the normal >+ leave message w/ mnterr we send isn't sufficient.) */ >+ >+void setup_mount_error_fd(int socket) >+{ >+ struct msghdr msg; >+ struct cmsghdr *cmsg; >+ struct iovec vec; >+ char tmp[CMSG_SPACE(sizeof(int))]; >+ char ch = '\0'; >+ ssize_t n; >+ int rv, fds[2]; >+ >+ rv = pipe(fds); >+ if (rv < 0) { >+ log_debug("setup_mount_error_fd pipe error %d %d", rv, errno); >+ return; >+ } >+ >+ memset(&msg, 0, sizeof(msg)); >+ >+ msg.msg_control = (caddr_t)tmp; >+ msg.msg_controllen = CMSG_LEN(sizeof(int)); >+ cmsg = CMSG_FIRSTHDR(&msg); >+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)); >+ cmsg->cmsg_level = SOL_SOCKET; >+ cmsg->cmsg_type = SCM_RIGHTS; >+ *(int *)CMSG_DATA(cmsg) = fds[0]; >+ >+ vec.iov_base = &ch; >+ vec.iov_len = 1; >+ msg.msg_iov = &vec; >+ msg.msg_iovlen = 1; >+ >+ n = sendmsg(socket, &msg, 0); >+ if (n < 0) { >+ log_debug("setup_mount_error_fd sendmsg error %d %d", n, errno); >+ close(fds[0]); >+ close(fds[1]); >+ return; >+ } >+ >+ mount_error_fd = fds[1]; >+ >+ log_debug("setup_mount_error_fd %d %d", fds[0], fds[1]); >+} >+#endif >+ >+int lock_dlm_join(struct mount_options *mo, struct gen_sb *sb) >+{ >+ int i, fd, rv; >+ char buf[MAXLINE]; >+ char *dir, *proto, *table, *options; >+ >+ i = 0; >+ do { >+ fd = gfs_controld_connect(); >+ if (fd <= 0) { >+ warn("waiting for gfs_controld to start"); >+ sleep(1); >+ } >+ } while (fd <= 0 && ++i < 10); >+ >+ /* FIXME: should we start the daemon here? */ >+ if (fd < 0) { >+ warn("gfs_controld not running"); >+ rv = -1; >+ goto out; >+ } >+ >+ dir = mo->dir; >+ proto = "lock_dlm"; >+ options = mo->opts; >+ >+ if (mo->locktable[0]) >+ table = mo->locktable; >+ else >+ table = sb->locktable; >+ >+ /* >+ * send request to gfs_controld for it to join mountgroup: >+ * "join <mountpoint> gfs2 lock_dlm <locktable> <options> <dev>" >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = snprintf(buf, MAXLINE, "join %s %s %s %s %s %s", >+ dir, fsname, proto, table, options, mo->dev); >+ if (rv >= MAXLINE) { >+ warn("lock_dlm_join: message too long: %d \"%s\"", rv, buf); >+ rv = -1; >+ goto out; >+ } >+ >+ log_debug("message to gfs_controld: asking to join mountgroup:"); >+ log_debug("write \"%s\"", buf); >+ >+ rv = write(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_join: gfs_controld write error: %d", rv); >+ goto out; >+ } >+ >+#if 0 >+ setup_mount_error_fd(fd); >+#endif >+ >+ /* >+ * read response from gfs_controld to our join request: >+ * it sends back an int as a string, 0 or -EXXX >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = read(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_join: gfs_controld read 1 error: %d", rv); >+ goto out; >+ } >+ rv = atoi(buf); >+ >+ if (rv == -EALREADY) { >+ log_debug("fs already mounted, adding mountpoint"); >+ adding_another_mountpoint = 1; >+ rv = 0; >+ goto out; >+ } >+ if (rv < 0) { >+ warn("lock_dlm_join: gfs_controld join error: %d", rv); >+ if (rv == -EEXIST) >+ warn("lock_dlm_join: mountgroup already exists. " >+ "Duplicate locktable name %s, or %s already " >+ "mounted\n", table, mo->dev); >+ goto out; >+ } >+ >+ log_debug("message from gfs_controld: response to join request:"); >+ log_debug("lock_dlm_join: read \"%s\"", buf); >+ >+ /* >+ * read mount-option string from gfs_controld that we are to >+ * use for the mount syscall; or possibly error message >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = read(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("gfs_controld options read error: %d", rv); >+ goto out; >+ } >+ >+ log_debug("message from gfs_controld: mount options:"); >+ log_debug("lock_dlm_join: read \"%s\"", buf); >+ >+ /* >+ * gfs_controld returns "hostdata=jid=X:id=Y:first=Z" >+ * this is first combined with any hostdata the user gave on >+ * the command line and then the full hostdata is combined >+ * with the "extra" mount otions into the "extra_plus" string. >+ * If we're not allowed to mount, "error: foo" is returned. >+ */ >+ >+ if (!strncmp(buf, "error", 5)) { >+ warn("%s", buf); >+ rv = -1; >+ goto out; >+ } >+ >+ if (strlen(mo->hostdata) + strlen(buf) + 1 > PATH_MAX) { >+ warn("hostdata too long"); >+ rv = -1; >+ goto out; >+ } >+ >+ if (!mo->hostdata[0]) >+ snprintf(mo->hostdata, PATH_MAX, "%s", buf); >+ else { >+ char *p = strstr(buf, "=") + 1; >+ strcat(mo->hostdata, ":"); >+ strcat(mo->hostdata, p); >+ } >+ >+ log_debug("lock_dlm_join: hostdata: \"%s\"", mo->hostdata); >+ >+ if (strlen(mo->extra) == 0) >+ snprintf(mo->extra_plus, PATH_MAX, "%s", mo->hostdata); >+ else >+ snprintf(mo->extra_plus, PATH_MAX, "%s,%s", >+ mo->extra, mo->hostdata); >+ >+ log_debug("lock_dlm_join: extra_plus: \"%s\"", mo->extra_plus); >+ rv = 0; >+ out: >+#if 0 >+ close(fd); >+#endif >+ gfs_controld_fd = fd; >+ return rv; >+} >+ >+void lock_dlm_mount_result(struct mount_options *mo, struct gen_sb *sb, >+ int result) >+{ >+ int rv; >+ char buf[MAXLINE]; >+ >+ /* if we didn't do the lock_dlm_join */ >+ if (gfs_controld_fd <= 0) >+ return; >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = snprintf(buf, MAXLINE, "mount_result %s %s %d", mo->dir, fsname, >+ result); >+ if (rv >= MAXLINE) { >+ warn("lock_dlm_mount_result: message too long: %d \"%s\"\n", >+ rv, buf); >+ goto out; >+ } >+ >+ log_debug("lock_dlm_mount_result: write \"%s\"", buf); >+ >+ rv = write(gfs_controld_fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_mount_result: gfs_controld write error: %d", rv); >+ } >+ out: >+ close(gfs_controld_fd); >+} >+ >+int lock_dlm_leave(struct mount_options *mo, struct gen_sb *sb, int mnterr) >+{ >+ int i, fd, rv; >+ char buf[MAXLINE]; >+ >+ if (mnterr && adding_another_mountpoint) >+ return 0; >+ >+ i = 0; >+ do { >+ fd = gfs_controld_connect(); >+ if (fd <= 0) { >+ warn("waiting for gfs_controld to start"); >+ sleep(1); >+ } >+ } while (fd <= 0 && ++i < 10); >+ >+ if (fd <= 0) { >+ warn("gfs_controld not running"); >+ rv = -1; >+ goto out; >+ } >+ >+ /* >+ * send request to gfs_controld for it to leave mountgroup: >+ * "leave <mountpoint> <fstype> <mnterr>" >+ * >+ * mnterr is 0 if this leave is associated with an unmount. >+ * mnterr is !0 if this leave is due to a failed kernel mount >+ * in which case gfs_controld shouldn't wait for the kernel mount >+ * to complete before doing the leave. >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = snprintf(buf, MAXLINE, "leave %s %s %d", mo->dir, fsname, mnterr); >+ if (rv >= MAXLINE) { >+ warn("lock_dlm_leave: message too long: %d \"%s\"\n", rv, buf); >+ rv = -1; >+ goto out; >+ } >+ >+ log_debug("message to gfs_controld: asking to leave mountgroup:"); >+ log_debug("lock_dlm_leave: write \"%s\"", buf); >+ >+#if 0 >+ if (mnterr && mount_error_fd) { >+ rv = write(mount_error_fd, buf, sizeof(buf)); >+ log_debug("lock_dlm_leave: write to mount_error_fd %d", rv); >+ } >+#endif >+ >+ rv = write(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_leave: gfs_controld write error: %d", rv); >+ goto out; >+ } >+ >+ /* >+ * read response from gfs_controld to our leave request: >+ * int as a string, 0 or -EXXX >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = read(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_leave: gfs_controld read error: %d", rv); >+ goto out; >+ } >+ rv = atoi(buf); >+ if (rv < 0) { >+ warn("lock_dlm_leave: gfs_controld leave error: %d", rv); >+ goto out; >+ } >+ >+ log_debug("message from gfs_controld: response to leave request:"); >+ log_debug("lock_dlm_leave: read \"%s\"", buf); >+ rv = 0; >+ out: >+ close(fd); >+ return rv; >+} >+ >+int lock_dlm_remount(struct mount_options *mo, struct gen_sb *sb) >+{ >+ int i, fd, rv; >+ char buf[MAXLINE]; >+ char *mode; >+ >+ i = 0; >+ do { >+ fd = gfs_controld_connect(); >+ if (fd <= 0) { >+ warn("waiting for gfs_controld to start"); >+ sleep(1); >+ } >+ } while (fd <= 0 && ++i < 10); >+ >+ if (fd <= 0) { >+ warn("gfs_controld not running"); >+ rv = -1; >+ goto out; >+ } >+ >+ /* FIXME: how to check for spectator remounts, we want >+ to disallow remount to/from spectator */ >+ >+ if (mo->flags & MS_RDONLY) >+ mode = "ro"; >+ else >+ mode = "rw"; >+ >+ /* >+ * send request to gfs_controld for it to remount: >+ * "remount <mountpoint> gfs2 <mode>" >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = snprintf(buf, MAXLINE, "remount %s %s %s", mo->dir, fsname, mode); >+ if (rv >= MAXLINE) { >+ warn("remount message too large: %d \"%s\"\n", rv, buf); >+ rv = -1; >+ goto out; >+ } >+ >+ log_debug("message to gfs_controld: asking to remount:"); >+ log_debug("lock_dlm_remount: write \"%s\"", buf); >+ >+ rv = write(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_remount: gfs_controld write error: %d", rv); >+ goto out; >+ } >+ >+ /* >+ * read response from gfs_controld >+ * int as a string >+ * 1: go ahead >+ * -EXXX: error >+ * 0: wait for second result >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = read(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_remount: gfs_controld read1 error: %d", rv); >+ goto out; >+ } >+ rv = atoi(buf); >+ if (rv < 0) { >+ warn("lock_dlm_remount: gfs_controld remount error: %d", rv); >+ goto out; >+ } >+ if (rv == 1) { >+ rv = 0; >+ goto out; >+ } >+ >+ log_debug("message from gfs_controld: response to remount request:"); >+ log_debug("lock_dlm_remount: read \"%s\"", buf); >+ >+ /* >+ * read second result from gfs_controld >+ */ >+ >+ memset(buf, 0, sizeof(buf)); >+ rv = read(fd, buf, sizeof(buf)); >+ if (rv < 0) { >+ warn("lock_dlm_remount: gfs_controld read2 error: %d", rv); >+ goto out; >+ } >+ >+ log_debug("message from gfs_controld: remount result:"); >+ log_debug("lock_dlm_remount: read \"%s\"", buf); >+ >+ if (!strncmp(buf, "error", 5)) { >+ warn("%s", buf); >+ rv = -1; >+ goto out; >+ } >+ >+ rv = 0; >+ out: >+ close(fd); >+ return rv; >+} >+ >Index: cluster_patchme/gfs2/mount/util.h >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/mount/util.h 2007-02-09 14:36:43.986664345 -0600 >@@ -0,0 +1,100 @@ >+/* >+ * Copyright (C) 2005 Red Hat, Inc. All rights reserved. >+ * >+ * This copyrighted material is made available to anyone wishing to use, >+ * modify, copy, or redistribute it subject to the terms and conditions >+ * of the GNU General Public License v.2. >+ */ >+ >+#ifndef __MOUNT_DOT_H__ >+#define __MOUNT_DOT_H__ >+ >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+#include <stdint.h> >+#include <inttypes.h> >+#include <sys/types.h> >+#include <sys/stat.h> >+#include <sys/mount.h> >+#include <fcntl.h> >+#include <unistd.h> >+#include <limits.h> >+#include <errno.h> >+#include <signal.h> >+#include <sys/socket.h> >+#include <sys/un.h> >+#include <linux/types.h> >+#include <gfs2_ondisk.h> >+#include "gfs_ondisk.h" >+#include "linux_endian.h" >+ >+#define die(fmt, args...) \ >+do { \ >+ fprintf(stderr, "%s: ", prog_name); \ >+ fprintf(stderr, fmt, ##args); \ >+ exit(EXIT_FAILURE); \ >+} while (0) >+ >+#define warn(fmt, args...) \ >+do { \ >+ fprintf(stderr, "%s: " fmt "\n", prog_name, ##args); \ >+} while (0) >+ >+#define log_debug(fmt, args...) \ >+do { \ >+ if (verbose) \ >+ printf("%s: " fmt "\n", prog_name, ##args); \ >+} while (0) >+ >+#define do_lseek(fd, off) \ >+do { \ >+ if (lseek((fd), (off), SEEK_SET) != (off)) \ >+ die("bad seek: %s on line %d of file %s\n", \ >+ strerror(errno),__LINE__, __FILE__); \ >+} while (0) >+ >+#define do_read(fd, buff, len) \ >+do { \ >+ if (read((fd), (buff), (len)) != (len)) \ >+ die("bad read: %s on line %d of file %s\n", \ >+ strerror(errno), __LINE__, __FILE__); \ >+} while (0) >+ >+struct mount_options { >+ char dev[PATH_MAX+1]; >+ char dir[PATH_MAX+1]; >+ char opts[PATH_MAX+1]; >+ char hostdata[PATH_MAX+1]; >+ char extra[PATH_MAX+1]; >+ char extra_plus[PATH_MAX+1]; >+ char type[5]; >+ char lockproto[256]; >+ char locktable[256]; >+ char proc_entry[PATH_MAX+1]; >+ int flags; >+}; >+ >+struct gen_sb { >+ char lockproto[256]; >+ char locktable[256]; >+}; >+ >+/* util.c */ >+ >+char *select_lockproto(struct mount_options *mo, struct gen_sb *sb); >+void parse_opts(struct mount_options *mo); >+void read_proc_mounts(struct mount_options *mo); >+int get_sb(char *device, struct gen_sb *sb_out); >+int lock_dlm_join(struct mount_options *mo, struct gen_sb *sb); >+void lock_dlm_mount_result(struct mount_options *mo, struct gen_sb *sb, int result); >+int lock_dlm_leave(struct mount_options *mo, struct gen_sb *sb, int mnterr); >+int lock_dlm_remount(struct mount_options *mo, struct gen_sb *sb); >+ >+/* mtab.c */ >+ >+void add_mtab_entry(struct mount_options *mo); >+void del_mtab_entry(struct mount_options *mo); >+ >+#endif >+ >Index: cluster_patchme/gfs2/tool/counters.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/counters.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/counters.c 2007-02-09 14:36:43.986664345 -0600 >@@ -25,7 +25,7 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >+#include <gfs2_ioctl.h> > #include "osi_list.h" > > #include "gfs2_tool.h" >Index: cluster_patchme/gfs2/tool/df.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/df.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/df.c 2007-02-09 14:36:44.026664873 -0600 >@@ -25,11 +25,13 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > struct file { int x; }; > struct file_lock { int x; }; >-#include <linux/lm_interface.h> >+ >+typedef unsigned long u64; >+#include <lm_interface.h> > > #include "gfs2_tool.h" > >Index: cluster_patchme/gfs2/tool/gfs2_ioctl.h >=================================================================== >--- /dev/null 1970-01-01 00:00:00.000000000 +0000 >+++ cluster_patchme/gfs2/tool/gfs2_ioctl.h 2007-02-09 14:36:44.036665005 -0600 >@@ -0,0 +1,33 @@ >+/****************************************************************************** >+******************************************************************************* >+** >+** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. >+** Copyright (C) 2004 Red Hat, Inc. All rights reserved. >+** >+** This copyrighted material is made available to anyone wishing to use, >+** modify, copy, or redistribute it subject to the terms and conditions >+** of the GNU General Public License v.2. >+** >+******************************************************************************* >+******************************************************************************/ >+ >+#ifndef __GFS2_IOCTL_DOT_H__ >+#define __GFS2_IOCTL_DOT_H__ >+ >+#define _GFS2C_(x) (('G' << 16) | ('2' << 8) | (x)) >+ >+/* Ioctls implemented */ >+ >+#define GFS2_IOCTL_IDENTIFY _GFS2C_(1) >+#define GFS2_IOCTL_SUPER _GFS2C_(2) >+ >+struct gfs2_ioctl { >+ unsigned int gi_argc; >+ char **gi_argv; >+ >+ char __user *gi_data; >+ unsigned int gi_size; >+ uint64_t gi_offset; >+}; >+ >+#endif /* ___GFS2_IOCTL_DOT_H__ */ >Index: cluster_patchme/gfs2/tool/layout.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/layout.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/layout.c 2007-02-09 14:36:44.076665533 -0600 >@@ -25,8 +25,8 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > > #include "osi_list.h" > #include "linux_endian.h" >Index: cluster_patchme/gfs2/tool/Makefile >=================================================================== >--- cluster_patchme.orig/gfs2/tool/Makefile 2005-05-19 14:51:15.000000000 -0500 >+++ cluster_patchme/gfs2/tool/Makefile 2007-02-09 14:36:44.096665797 -0600 >@@ -28,17 +28,9 @@ SOURCE= counters.c \ > CFLAGS+= -O2 -Wall -D_FILE_OFFSET_BITS=64 \ > -DGFS2_RELEASE_NAME=\"${RELEASE}\" > >-INCLUDE= -I${top_srcdir}/include -I${top_srcdir}/config -I${gfs2kincdir} >+INCLUDE= -I${top_srcdir}/include -I${top_srcdir}/config \ >+ -I. > >-ifneq (${KERNEL_SRC}, ) >-# Use the kernel tree if patched, otherwise, look where cluster headers >-# should be installed >-INCLUDE += $(shell if [ -e ${KERNEL_SRC}/include/linux/gfs2_ondisk.h ]; then \ >- echo '-I${KERNEL_SRC}/include'; else \ >- echo '-I${incdir}'; fi) >-else >-INCLUDE += -I${incdir} >-endif > > all: ${TARGET} > >Index: cluster_patchme/gfs2/tool/misc.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/misc.c 2005-05-07 01:38:02.000000000 -0500 >+++ cluster_patchme/gfs2/tool/misc.c 2007-02-09 14:36:44.106665929 -0600 >@@ -25,8 +25,8 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > > #include "gfs2_tool.h" > >Index: cluster_patchme/gfs2/tool/ondisk.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/ondisk.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/ondisk.c 2007-02-09 14:36:44.116666061 -0600 >@@ -27,6 +27,6 @@ > #define RETURN(x, y) return y > > #define WANT_GFS2_CONVERSION_FUNCTIONS >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ondisk.h> > > >Index: cluster_patchme/gfs2/tool/sb.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/sb.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/sb.c 2007-02-09 14:36:44.156666589 -0600 >@@ -24,7 +24,7 @@ > #include <limits.h> > #include <errno.h> > >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ondisk.h> > > #include "gfs2_tool.h" > >Index: cluster_patchme/gfs2/tool/tune.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/tune.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/tune.c 2007-02-09 14:36:44.166666721 -0600 >@@ -25,7 +25,7 @@ > #include <errno.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >+#include <gfs2_ioctl.h> > > #include "gfs2_tool.h" > >Index: cluster_patchme/gfs2/tool/util.c >=================================================================== >--- cluster_patchme.orig/gfs2/tool/util.c 2005-04-25 21:58:58.000000000 -0500 >+++ cluster_patchme/gfs2/tool/util.c 2007-02-09 14:36:44.216667381 -0600 >@@ -26,8 +26,8 @@ > #include <libgen.h> > > #define __user >-#include <linux/gfs2_ioctl.h> >-#include <linux/gfs2_ondisk.h> >+#include <gfs2_ioctl.h> >+#include <gfs2_ondisk.h> > > #include "gfs2_tool.h" >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 227945
:
147717
| 147805