#include <sys/xattr.h>
#include <paths.h>
-#ifndef XFS_XFLAG_NODEFRAG
-#define XFS_XFLAG_NODEFRAG 0x00002000 /* src dependancy, remove later */
-#endif
-
#define _PATH_FSRLAST "/var/tmp/.fsrlast_xfs"
#define _PATH_PROC_MOUNTS "/proc/mounts"
return 1;
}
- if ((ioctl(fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+ if ((ioctl(fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
fsrprintf(_("failed to get inode attrs: %s\n"), fname);
return(-1);
}
- if (fsx.fsx_xflags & (XFS_XFLAG_IMMUTABLE|XFS_XFLAG_APPEND)) {
+ if (fsx.fsx_xflags & (FS_XFLAG_IMMUTABLE|FS_XFLAG_APPEND)) {
if (vflag)
fsrprintf(_("%s: immutable/append, ignoring\n"), fname);
return(0);
}
- if (fsx.fsx_xflags & XFS_XFLAG_NODEFRAG) {
+ if (fsx.fsx_xflags & FS_XFLAG_NODEFRAG) {
if (vflag)
fsrprintf(_("%s: marked as don't defrag, ignoring\n"),
fname);
return(0);
}
- if (fsx.fsx_xflags & XFS_XFLAG_REALTIME) {
+ if (fsx.fsx_xflags & FS_XFLAG_REALTIME) {
if (xfs_getrt(fd, &vfss) < 0) {
fsrprintf(_("cannot get realtime geometry for: %s\n"),
fname);
int no_change_cnt = 0;
int ret;
- if (!(bstatp->bs_xflags & XFS_XFLAG_HASATTR))
+ if (!(bstatp->bs_xflags & FS_XFLAG_HASATTR))
return 0;
/*
/* Setup extended inode flags, project identifier, etc */
if (fsxp->fsx_xflags || fsxp->fsx_projid) {
- if (ioctl(tfd, XFS_IOC_FSSETXATTR, fsxp) < 0) {
+ if (ioctl(tfd, FS_IOC_FSSETXATTR, fsxp) < 0) {
fsrprintf(_("could not set inode attrs on tmp: %s\n"),
tname);
goto out;
cursor->i = 0;
}
+/* check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves */
+#ifndef HAVE_FSXATTR
+struct fsxattr {
+ __u32 fsx_xflags; /* xflags field value (get/set) */
+ __u32 fsx_extsize; /* extsize field value (get/set)*/
+ __u32 fsx_nextents; /* nextents field value (get) */
+ __u32 fsx_projid; /* project identifier (get/set) */
+ unsigned char fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
+#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
+#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
+#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
+#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
+#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
+#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
+#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
+#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+
+#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
+#define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
+
+#endif
+
#endif /* __XFS_DARWIN_H__ */
endmntent(cursor->mtabp);
}
+/* check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves */
+#ifndef HAVE_FSXATTR
+struct fsxattr {
+ __u32 fsx_xflags; /* xflags field value (get/set) */
+ __u32 fsx_extsize; /* extsize field value (get/set)*/
+ __u32 fsx_nextents; /* nextents field value (get) */
+ __u32 fsx_projid; /* project identifier (get/set) */
+ unsigned char fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
+#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
+#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
+#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
+#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
+#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
+#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
+#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
+#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+
+#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
+#define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
+
+#endif
+
#endif /* __XFS_FREEBSD_H__ */
#define __XFS_FS_H__ 1
#define XFS_IOC_DIOINFO F_DIOINFO
-#define XFS_IOC_FSGETXATTR F_FSGETXATTR
-#define XFS_IOC_FSSETXATTR F_FSSETXATTR
#define XFS_IOC_ALLOCSP64 F_ALLOCSP64
#define XFS_IOC_FREESP64 F_FREESP64
#define XFS_IOC_GETBMAP F_GETBMAP
#define _AIOCB64_T_DEFINED 1
-#define XFS_XFLAG_NODEFRAG 0x00002000
+/* check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves */
+#ifndef HAVE_FSXATTR
+struct fsxattr {
+ __u32 fsx_xflags; /* xflags field value (get/set) */
+ __u32 fsx_extsize; /* extsize field value (get/set)*/
+ __u32 fsx_nextents; /* nextents field value (get) */
+ __u32 fsx_projid; /* project identifier (get/set) */
+ unsigned char fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
+#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
+#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
+#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
+#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
+#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
+#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
+#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
+#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+
+#define FS_IOC_FSGETXATTR F_FSGETXATTR
+#define FS_IOC_FSSETXATTR F_FSSETXATTR
+
+#endif
+
/**
* Abstraction of mountpoints.
endmntent(cursor->mtabp);
}
+/*
+ * Check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves. These
+ * are a copy of the definitions moved to linux/uapi/fs.h in the 4.5 kernel,
+ * so this is purely for supporting builds against old kernel headers.
+ */
+#ifndef FS_IOC_FSGETXATTR
+struct fsxattr {
+ __u32 fsx_xflags; /* xflags field value (get/set) */
+ __u32 fsx_extsize; /* extsize field value (get/set)*/
+ __u32 fsx_nextents; /* nextents field value (get) */
+ __u32 fsx_projid; /* project identifier (get/set) */
+ unsigned char fsx_pad[12];
+};
+
+/*
+ * Flags for the fsx_xflags field
+ */
+#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
+#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
+#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
+#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
+#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
+#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
+#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
+#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
+#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
+#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
+#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
+#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
+#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
+#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
+#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+
+#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
+#define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
+
+#endif
+
#endif /* __XFS_LINUX_H__ */
char *shortname;
char *longname;
} xflags[] = {
- { XFS_XFLAG_REALTIME, "r", "realtime" },
- { XFS_XFLAG_PREALLOC, "p", "prealloc" },
- { XFS_XFLAG_IMMUTABLE, "i", "immutable" },
- { XFS_XFLAG_APPEND, "a", "append-only" },
- { XFS_XFLAG_SYNC, "s", "sync" },
- { XFS_XFLAG_NOATIME, "A", "no-atime" },
- { XFS_XFLAG_NODUMP, "d", "no-dump" },
- { XFS_XFLAG_RTINHERIT, "t", "rt-inherit" },
- { XFS_XFLAG_PROJINHERIT, "P", "proj-inherit" },
- { XFS_XFLAG_NOSYMLINKS, "n", "nosymlinks" },
- { XFS_XFLAG_EXTSIZE, "e", "extsize" },
- { XFS_XFLAG_EXTSZINHERIT, "E", "extsz-inherit" },
- { XFS_XFLAG_NODEFRAG, "f", "no-defrag" },
- { XFS_XFLAG_FILESTREAM, "S", "filestream" },
+ { FS_XFLAG_REALTIME, "r", "realtime" },
+ { FS_XFLAG_PREALLOC, "p", "prealloc" },
+ { FS_XFLAG_IMMUTABLE, "i", "immutable" },
+ { FS_XFLAG_APPEND, "a", "append-only" },
+ { FS_XFLAG_SYNC, "s", "sync" },
+ { FS_XFLAG_NOATIME, "A", "no-atime" },
+ { FS_XFLAG_NODUMP, "d", "no-dump" },
+ { FS_XFLAG_RTINHERIT, "t", "rt-inherit" },
+ { FS_XFLAG_PROJINHERIT, "P", "proj-inherit" },
+ { FS_XFLAG_NOSYMLINKS, "n", "nosymlinks" },
+ { FS_XFLAG_EXTSIZE, "e", "extsize" },
+ { FS_XFLAG_EXTSZINHERIT, "E", "extsz-inherit" },
+ { FS_XFLAG_NODEFRAG, "f", "no-defrag" },
+ { FS_XFLAG_FILESTREAM, "S", "filestream" },
{ 0, NULL, NULL }
};
#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS"
if ((fd = open(path, O_RDONLY)) == -1)
fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
- else if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0)
+ else if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0)
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, path, strerror(errno));
else
if (recurse_all || recurse_dir) {
nftw(name, lsattr_callback,
100, FTW_PHYS | FTW_MOUNT | FTW_DEPTH);
- } else if ((xfsctl(name, file->fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+ } else if ((xfsctl(name, file->fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, name, strerror(errno));
} else {
if ((fd = open(path, O_RDONLY)) == -1) {
fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
- } else if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &attr) < 0) {
+ } else if (xfsctl(path, fd, FS_IOC_FSGETXATTR, &attr) < 0) {
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, path, strerror(errno));
} else {
attr.fsx_xflags |= orflags;
attr.fsx_xflags &= ~andflags;
- if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &attr) < 0)
+ if (xfsctl(path, fd, FS_IOC_FSSETXATTR, &attr) < 0)
fprintf(stderr, _("%s: cannot set flags on %s: %s\n"),
progname, path, strerror(errno));
}
if (recurse_all || recurse_dir) {
nftw(name, chattr_callback,
100, FTW_PHYS | FTW_MOUNT | FTW_DEPTH);
- } else if (xfsctl(name, file->fd, XFS_IOC_FSGETXATTR, &attr) < 0) {
+ } else if (xfsctl(name, file->fd, FS_IOC_FSGETXATTR, &attr) < 0) {
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, name, strerror(errno));
} else {
attr.fsx_xflags |= orflags;
attr.fsx_xflags &= ~andflags;
- if (xfsctl(name, file->fd, XFS_IOC_FSSETXATTR, &attr) < 0)
+ if (xfsctl(name, file->fd, FS_IOC_FSSETXATTR, &attr) < 0)
fprintf(stderr, _("%s: cannot set flags on %s: %s\n"),
progname, name, strerror(errno));
}
exitcode = 1;
return 0;
}
- c = xfsctl(file->name, file->fd, XFS_IOC_FSGETXATTR, &fsx);
+ c = xfsctl(file->name, file->fd, FS_IOC_FSGETXATTR, &fsx);
if (c < 0) {
fprintf(stderr,
_("%s: cannot read attrs on \"%s\": %s\n"),
return 0;
}
- if (fsx.fsx_xflags == XFS_XFLAG_REALTIME) {
+ if (fsx.fsx_xflags == FS_XFLAG_REALTIME) {
/*
* ag info not applicable to rt, continue
* without ag output.
* by nflag, or the initial guess number of extents (32).
*
* If there are more extents than we guessed, use xfsctl
- * (XFS_IOC_FSGETXATTR[A]) to get the extent count, realloc some more
+ * (FS_IOC_FSGETXATTR[A]) to get the extent count, realloc some more
* space based on this count, and try again.
*
* If the initial FGETBMAPX attempt returns EINVAL, this may mean
* EINVAL, check the length with fstat() and return "no extents"
* if the length == 0.
*
- * Why not do the xfsctl(XFS_IOC_FSGETXATTR[A]) first? Two reasons:
+ * Why not do the xfsctl(FS_IOC_FSGETXATTR[A]) first? Two reasons:
* (1) The extent count may be wrong for a file with delayed
* allocation blocks. The XFS_IOC_GETBMAPX forces the real
* allocation and fixes up the extent count.
* (2) For XFS_IOC_GETBMAP[X] on a DMAPI file that has been moved
* offline by a DMAPI application (e.g., DMF) the
- * XFS_IOC_FSGETXATTR only reflects the extents actually online.
+ * FS_IOC_FSGETXATTR only reflects the extents actually online.
* Doing XFS_IOC_GETBMAPX call first forces that data blocks online
* and then everything proceeds normally (see PV #545725).
*
break;
if (map->bmv_entries < map->bmv_count-1)
break;
- /* Get number of extents from xfsctl XFS_IOC_FSGETXATTR[A]
+ /* Get number of extents from xfsctl FS_IOC_FSGETXATTR[A]
* syscall.
*/
i = xfsctl(file->name, file->fd, aflag ?
- XFS_IOC_FSGETXATTRA : XFS_IOC_FSGETXATTR, &fsx);
+ XFS_IOC_FSGETXATTRA : FS_IOC_FSGETXATTR, &fsx);
if (i < 0) {
- fprintf(stderr, "%s: xfsctl(XFS_IOC_FSGETXATTR%s) "
+ fprintf(stderr, "%s: xfsctl(FS_IOC_FSGETXATTR%s) "
"[\"%s\"]: %s\n", progname, aflag ? "A" : "",
file->name, strerror(errno));
free(map);
}
if (file->flags & IO_FOREIGN)
return 0;
- if ((xfsctl(file->name, file->fd, XFS_IOC_FSGETXATTR, &fsx)) < 0 ||
+ if ((xfsctl(file->name, file->fd, FS_IOC_FSGETXATTR, &fsx)) < 0 ||
(xfsctl(file->name, file->fd, XFS_IOC_FSGETXATTRA, &fsxa)) < 0) {
- perror("XFS_IOC_FSGETXATTR");
+ perror("FS_IOC_FSGETXATTR");
} else {
printf(_("fsxattr.xflags = 0x%x "), fsx.fsx_xflags);
printxattr(fsx.fsx_xflags, verbose, 0, file->name, 1, 1);
if (!(flags & IO_READONLY) && (flags & IO_REALTIME)) {
struct fsxattr attr;
- if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &attr) < 0) {
- perror("XFS_IOC_FSGETXATTR");
+ if (xfsctl(path, fd, FS_IOC_FSGETXATTR, &attr) < 0) {
+ perror("FS_IOC_FSGETXATTR");
close(fd);
return -1;
}
- if (!(attr.fsx_xflags & XFS_XFLAG_REALTIME)) {
- attr.fsx_xflags |= XFS_XFLAG_REALTIME;
- if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &attr) < 0) {
- perror("XFS_IOC_FSSETXATTR");
+ if (!(attr.fsx_xflags & FS_XFLAG_REALTIME)) {
+ attr.fsx_xflags |= FS_XFLAG_REALTIME;
+ if (xfsctl(path, fd, FS_IOC_FSSETXATTR, &attr) < 0) {
+ perror("FS_IOC_FSSETXATTR");
close(fd);
return -1;
}
{
struct fsxattr fsx;
- if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
- printf("%s: XFS_IOC_FSGETXATTR %s: %s\n",
+ if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
+ printf("%s: FS_IOC_FSGETXATTR %s: %s\n",
progname, path, strerror(errno));
return 0;
}
perror("fstat64");
return 0;
}
- if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
- printf("%s: XFS_IOC_FSGETXATTR %s: %s\n",
+ if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
+ printf("%s: FS_IOC_FSGETXATTR %s: %s\n",
progname, path, strerror(errno));
return 0;
}
if (S_ISREG(stat.st_mode)) {
- fsx.fsx_xflags |= XFS_XFLAG_EXTSIZE;
+ fsx.fsx_xflags |= FS_XFLAG_EXTSIZE;
} else if (S_ISDIR(stat.st_mode)) {
- fsx.fsx_xflags |= XFS_XFLAG_EXTSZINHERIT;
+ fsx.fsx_xflags |= FS_XFLAG_EXTSZINHERIT;
} else {
printf(_("invalid target file type - file %s\n"), path);
return 0;
}
fsx.fsx_extsize = extsz;
- if ((xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx)) < 0) {
- printf("%s: XFS_IOC_FSSETXATTR %s: %s\n",
+ if ((xfsctl(path, fd, FS_IOC_FSSETXATTR, &fsx)) < 0) {
+ printf("%s: FS_IOC_FSSETXATTR %s: %s\n",
progname, path, strerror(errno));
return 0;
}
{
struct fsxattr fsx;
- if (xfsctl(name, fd, XFS_IOC_FSGETXATTR, &fsx)) {
- perror("XFS_IOC_FSGETXATTR");
+ if (xfsctl(name, fd, FS_IOC_FSGETXATTR, &fsx)) {
+ perror("FS_IOC_FSGETXATTR");
return -1;
}
*projid = fsx.fsx_projid;
struct fsxattr fsx;
int error;
- if ((error = xfsctl(name, fd, XFS_IOC_FSGETXATTR, &fsx)) == 0) {
+ if ((error = xfsctl(name, fd, FS_IOC_FSGETXATTR, &fsx)) == 0) {
fsx.fsx_projid = projid;
- error = xfsctl(name, fd, XFS_IOC_FSSETXATTR, &fsx);
+ error = xfsctl(name, fd, FS_IOC_FSSETXATTR, &fsx);
}
return error;
}
/*
* Values for di_flags
- * There should be a one-to-one correspondence between these flags and the
- * XFS_XFLAG_s.
*/
#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */
#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */
#endif
/*
- * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
+ * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
+ * These are for backwards compatibility only. New code should
+ * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
*/
-#ifndef HAVE_FSXATTR
-struct fsxattr {
- __u32 fsx_xflags; /* xflags field value (get/set) */
- __u32 fsx_extsize; /* extsize field value (get/set)*/
- __u32 fsx_nextents; /* nextents field value (get) */
- __u32 fsx_projid; /* project identifier (get/set) */
- unsigned char fsx_pad[12];
-};
-#endif
-
-/*
- * Flags for the bs_xflags/fsx_xflags field
- * There should be a one-to-one correspondence between these flags and the
- * XFS_DIFLAG_s.
- */
-#define XFS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
-#define XFS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
-#define XFS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
-#define XFS_XFLAG_APPEND 0x00000010 /* all writes append */
-#define XFS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
-#define XFS_XFLAG_NOATIME 0x00000040 /* do not update access time */
-#define XFS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
-#define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
-#define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
-#define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
-#define XFS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
-#define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
-#define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
-#define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
-#define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+#define XFS_XFLAG_REALTIME FS_XFLAG_REALTIME
+#define XFS_XFLAG_PREALLOC FS_XFLAG_PREALLOC
+#define XFS_XFLAG_IMMUTABLE FS_XFLAG_IMMUTABLE
+#define XFS_XFLAG_APPEND FS_XFLAG_APPEND
+#define XFS_XFLAG_SYNC FS_XFLAG_SYNC
+#define XFS_XFLAG_NOATIME FS_XFLAG_NOATIME
+#define XFS_XFLAG_NODUMP FS_XFLAG_NODUMP
+#define XFS_XFLAG_RTINHERIT FS_XFLAG_RTINHERIT
+#define XFS_XFLAG_PROJINHERIT FS_XFLAG_PROJINHERIT
+#define XFS_XFLAG_NOSYMLINKS FS_XFLAG_NOSYMLINKS
+#define XFS_XFLAG_EXTSIZE FS_XFLAG_EXTSIZE
+#define XFS_XFLAG_EXTSZINHERIT FS_XFLAG_EXTSZINHERIT
+#define XFS_XFLAG_NODEFRAG FS_XFLAG_NODEFRAG
+#define XFS_XFLAG_FILESTREAM FS_XFLAG_FILESTREAM
+#define XFS_XFLAG_HASATTR FS_XFLAG_HASATTR
+
+#define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR
+#define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR
/*
* Structure for XFS_IOC_GETBMAP.
#define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)
#define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)
#define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr)
-#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
-#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
#define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64)
#define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64)
#define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
return 0;
}
- if ((xfsctl(path->fs_dir, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+ if ((xfsctl(path->fs_dir, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
exitcode = 1;
- perror("XFS_IOC_FSGETXATTR");
+ perror("FS_IOC_FSGETXATTR");
close(fd);
return 0;
}
- if (!(fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT)) {
+ if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT)) {
exitcode = 1;
fprintf(stderr, _("%s: project quota flag not set on %s\n"),
progname, path->fs_dir);
exitcode = 1;
fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
- } else if ((xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+ } else if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
exitcode = 1;
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, path, strerror(errno));
printf(_("%s - project identifier is not set"
" (inode=%u, tree=%u)\n"),
path, fsx.fsx_projid, (unsigned int)prid);
- if (!(fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT))
+ if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT))
printf(_("%s - project inheritance flag is not set\n"),
path);
}
fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
return 0;
- } else if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx) < 0) {
+ } else if (xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx) < 0) {
exitcode = 1;
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, path, strerror(errno));
}
fsx.fsx_projid = 0;
- fsx.fsx_xflags &= ~XFS_XFLAG_PROJINHERIT;
- if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0) {
+ fsx.fsx_xflags &= ~FS_XFLAG_PROJINHERIT;
+ if (xfsctl(path, fd, FS_IOC_FSSETXATTR, &fsx) < 0) {
exitcode = 1;
fprintf(stderr, _("%s: cannot clear project on %s: %s\n"),
progname, path, strerror(errno));
fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
return 0;
- } else if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &fsx) < 0) {
+ } else if (xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx) < 0) {
exitcode = 1;
fprintf(stderr, _("%s: cannot get flags on %s: %s\n"),
progname, path, strerror(errno));
}
fsx.fsx_projid = prid;
- fsx.fsx_xflags |= XFS_XFLAG_PROJINHERIT;
- if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0) {
+ fsx.fsx_xflags |= FS_XFLAG_PROJINHERIT;
+ if (xfsctl(path, fd, FS_IOC_FSSETXATTR, &fsx) < 0) {
exitcode = 1;
fprintf(stderr, _("%s: cannot set project on %s: %s\n"),
progname, path, strerror(errno));
XFS_DIFLAG_NOSYMLINKS);
}
}
- if (flags & (XFS_DIFLAG_REALTIME | XFS_XFLAG_EXTSIZE)) {
+ if (flags & (XFS_DIFLAG_REALTIME | FS_XFLAG_EXTSIZE)) {
/* must be a file */
if (di_mode && !S_ISREG(di_mode)) {
if (!uncertain) {
lino);
}
flags &= ~(XFS_DIFLAG_REALTIME |
- XFS_XFLAG_EXTSIZE);
+ FS_XFLAG_EXTSIZE);
}
}
if (!verify_mode && flags != be16_to_cpu(dino->di_flags)) {
/*
* mark the file as a realtime file
*/
- fsxattr.fsx_xflags = XFS_XFLAG_REALTIME;
+ fsxattr.fsx_xflags = FS_XFLAG_REALTIME;
if (fextsize != -1 )
fsxattr.fsx_extsize = fextsize;
else
fsxattr.fsx_extsize = 0;
- if ( xfsctl(tbuf, tofd, XFS_IOC_FSSETXATTR, &fsxattr) ) {
+ if ( xfsctl(tbuf, tofd, FS_IOC_FSSETXATTR, &fsxattr) ) {
fprintf(stderr,
_("%s: set attributes on %s failed: %s\n"),
progname, tbuf, strerror(errno));
return( -1 );
}
- if ( xfsctl(tbuf, tofd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
+ if ( xfsctl(tbuf, tofd, FS_IOC_FSGETXATTR, &fsxattr) ) {
fprintf(stderr,
_("%s: get attributes of %s failed: %s\n"),
progname, tbuf, strerror(errno));
/*
* check if the existing file is already a realtime file
*/
- if ( !(fsxattr.fsx_xflags & XFS_XFLAG_REALTIME) ) {
+ if ( !(fsxattr.fsx_xflags & FS_XFLAG_REALTIME) ) {
fprintf(stderr, _("%s: %s is not a realtime file.\n"),
progname, tbuf);
close( tofd );
fsxattr.fsx_xflags = 0;
fsxattr.fsx_extsize = 0;
- if ( xfsctl(source, fromfd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
+ if ( xfsctl(source, fromfd, FS_IOC_FSGETXATTR, &fsxattr) ) {
reopen = 1;
} else {
- if (! (fsxattr.fsx_xflags & XFS_XFLAG_REALTIME) ){
+ if (! (fsxattr.fsx_xflags & FS_XFLAG_REALTIME) ){
fprintf(stderr, _("%s: %s is not a realtime file.\n"),
progname, source);
reopen = 1;