From: adas@sourceware.org <adas@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs2 tool/misc.c mkfs/gfs2_mkfs.h mkfs ...
Date: 26 Oct 2006 18:42:26 -0000 [thread overview]
Message-ID: <20061026184226.30925.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: adas at sourceware.org 2006-10-26 18:42:25
Modified files:
gfs2/tool : misc.c
gfs2/mkfs : gfs2_mkfs.h main_jadd.c
Log message:
bz 211418. Modified gfs2_tool and gfs2_jadd to use the new inode flags in fs.h instead of deprecated iflags.h
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/misc.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mkfs/gfs2_mkfs.h.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mkfs/main_jadd.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
--- cluster/gfs2/tool/misc.c 2006/06/09 19:44:26 1.7
+++ cluster/gfs2/tool/misc.c 2006/10/26 18:42:25 1.8
@@ -28,7 +28,7 @@
#define __user
#include <linux/gfs2_ondisk.h>
-#include <linux/iflags.h>
+#include <linux/fs.h>
#include "gfs2_tool.h"
@@ -158,7 +158,7 @@
}
/*
- * Use IFLAG_XXX defined in <linux/iflags.h> which correspond to
+ * Use FS_XXX_FL flags defined in <linux/fs.h> which correspond to
* GFS2_DIF_XXX
*/
static unsigned int
@@ -167,17 +167,17 @@
if (strncmp(name, "system", 6) == 0)
return GFS2_DIF_SYSTEM;
else if (strncmp(name, "jdata", 5) == 0)
- return IFLAG_JOURNAL_DATA;
+ return FS_JOURNAL_DATA_FL;
else if (strncmp(name, "directio", 8) == 0)
- return IFLAG_DIRECTIO;
+ return FS_DIRECTIO_FL;
else if (strncmp(name, "immutable", 9) == 0)
- return IFLAG_IMMUTABLE;
+ return FS_IMMUTABLE_FL;
else if (strncmp(name, "appendonly", 10) == 0)
- return IFLAG_APPEND;
+ return FS_APPEND_FL;
else if (strncmp(name, "noatime", 7) == 0)
- return IFLAG_NOATIME;
+ return FS_NOATIME_FL;
else if (strncmp(name, "sync", 4) == 0)
- return IFLAG_SYNC;
+ return FS_SYNC_FL;
else
return 0;
}
@@ -208,18 +208,17 @@
die("unrecognized flag %s\n", argv[optind -1]);
for (; optind < argc; optind++) {
- fprintf(stdout, "opening %s\n", argv[optind]);
fd = open(argv[optind], O_RDONLY);
if (fd < 0)
die("can't open %s: %s\n", argv[optind], strerror(errno));
/* first get the existing flags on the file */
- error = ioctl(fd, IFLAGS_GET_IOC, &newflags);
+ error = ioctl(fd, FS_IOC_GETFLAGS, &newflags);
if (error)
die("can't get flags on %s: %s\n",
argv[optind], strerror(errno));
newflags = set ? newflags | flag : newflags & ~flag;
/* new flags */
- error = ioctl(fd, IFLAGS_SET_IOC, &newflags);
+ error = ioctl(fd, FS_IOC_SETFLAGS, &newflags);
if (error)
die("can't set flags on %s: %s\n",
argv[optind], strerror(errno));
--- cluster/gfs2/mkfs/gfs2_mkfs.h 2006/07/10 22:51:10 1.8
+++ cluster/gfs2/mkfs/gfs2_mkfs.h 2006/10/26 18:42:25 1.9
@@ -75,4 +75,52 @@
#define do_lseek(fd, off) \
__do_lseek((fd), (off), __FILE__, __LINE__)
+/*
+ * The following inode IOCTL macros and inode flags
+ * are copied from linux/fs.h, because we have duplicate
+ * definition of symbols when we include both linux/fs.h and
+ * sys/mount.h in our program
+ */
+
+#define FS_IOC_GETFLAGS _IOR('f', 1, long)
+#define FS_IOC_SETFLAGS _IOW('f', 2, long)
+#define FS_IOC_GETVERSION _IOR('v', 1, long)
+#define FS_IOC_SETVERSION _IOW('v', 2, long)
+#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
+#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
+#define FS_IOC32_GETVERSION _IOR('v', 1, int)
+#define FS_IOC32_SETVERSION _IOW('v', 2, int)
+
+/*
+ * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
+ */
+#define FS_SECRM_FL 0x00000001 /* Secure deletion */
+#define FS_UNRM_FL 0x00000002 /* Undelete */
+#define FS_COMPR_FL 0x00000004 /* Compress file */
+#define FS_SYNC_FL 0x00000008 /* Synchronous updates */
+#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
+#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
+#define FS_NODUMP_FL 0x00000040 /* do not dump file */
+#define FS_NOATIME_FL 0x00000080 /* do not update atime */
+/* Reserved for compression usage... */
+#define FS_DIRTY_FL 0x00000100
+#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
+#define FS_NOCOMP_FL 0x00000400 /* Don't compress */
+#define FS_ECOMPR_FL 0x00000800 /* Compression error */
+/* End compression flags --- maybe not all used */
+#define FS_BTREE_FL 0x00001000 /* btree format dir */
+#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */
+#define FS_IMAGIC_FL 0x00002000 /* AFS directory */
+#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */
+#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
+#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
+#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
+#define FS_EXTENT_FL 0x00080000 /* Extents */
+#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
+#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
+
+#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
+#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
+
+
#endif /* __GFS2_MKFS_DOT_H__ */
--- cluster/gfs2/mkfs/main_jadd.c 2006/09/28 16:23:57 1.9
+++ cluster/gfs2/mkfs/main_jadd.c 2006/10/26 18:42:25 1.10
@@ -10,6 +10,7 @@
#include <sys/file.h>
#include <sys/vfs.h>
#include <sys/mount.h>
+//#include <linux/fs.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
@@ -17,7 +18,6 @@
#include <stdarg.h>
#include <linux/types.h>
-#include <linux/iflags.h>
#include "libgfs2.h"
#include "gfs2_mkfs.h"
@@ -38,14 +38,14 @@
int err;
uint32_t val;
- err = ioctl(fd, IFLAGS_GET_IOC, &val);
+ err = ioctl(fd, FS_IOC_GETFLAGS, &val);
if (err)
die("error doing get flags (%d): %s\n", err, strerror(errno));
if (strcmp(value, "set") == 0)
- val |= IFLAG_JOURNAL_DATA;
+ val |= FS_JOURNAL_DATA_FL;
if (strcmp(value, "clear") == 0)
- val &= ~IFLAG_JOURNAL_DATA;
- err = ioctl(fd, IFLAGS_SET_IOC, &val);
+ val &= ~FS_JOURNAL_DATA_FL;
+ err = ioctl(fd, FS_IOC_SETFLAGS, &val);
if (err)
die("error doing set flags (%d): %s\n", err, strerror(errno));
}
reply other threads:[~2006-10-26 18:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061026184226.30925.qmail@sourceware.org \
--to=adas@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).