bump to version 2.0.0 for extended attribute and other interface changes.
#
# This file is used by configure to get version information
#
-PKG_MAJOR=1
-PKG_MINOR=3
-PKG_REVISION=19
+PKG_MAJOR=2
+PKG_MINOR=0
+PKG_REVISION=0
PKG_BUILD=0
Provides: xfs-cmds
Obsoletes: xfs-cmds
Prereq: /sbin/ldconfig
+Conflicts: xfsdump < 2.0.0
Source: @pkg_name@-@pkg_version@.src.tar.gz
Copyright: Copyright (C) 2000 Silicon Graphics, Inc.
Vendor: Silicon Graphics, Inc.
%package devel
Summary: XFS filesystem-specific static libraries and headers.
Group: Development/Libraries
-Requires: @pkg_name@
+Requires: @pkg_name@ >= 2.0.0
+Conflicts: @pkg_name@ < 2.0.0
%description devel
xfsprogs-devel contains the libraries and header files needed to
+xfsprogs (2.0.0-1) unstable; urgency=low
+
+ * New upstream release with support for new libhandle interfaces
+ * Major release for switch to official extended attributes syscalls
+
+ -- Nathan Scott <nathans@debian.org> Thu, 7 Feb 2002 13:25:26 +1100
+
xfsprogs (1.3.18-1) unstable; urgency=low
* New upstream bugfix (minor) release
-- Nathan Scott <nathans@debian.org> Wed, 12 Dec 2001 09:25:42 +1100
+xfsprogs (1.3.14-1) unstable; urgency=low
+
+ * Fix minor package version numbering issue (closes: #117545)
+ * Fix bug in mkfs.xfs device size cross-check for realtime device
+
+ -- Nathan Scott <nathans@debian.org> Wed, 5 Dec 2001 17:13:06 +1100
+
xfsprogs (1.3.13-0) unstable; urgency=low
* New upstream release
Package: xfsprogs
Depends: ${shlibs:Depends}
Suggests: xfsdump, attr, dvhtool
+Conflicts: xfsdump (<< 2.0.0)
Architecture: any
Description: Utilities for managing the XFS filesystem
A set of commands to use the XFS filesystem, including mkfs.xfs.
Package: xfslibs-dev
Section: devel
Priority: extra
-Depends: libc6-dev, xfsprogs
+Depends: libc6-dev, xfsprogs (>= 2.0.0)
+Conflicts: xfsprogs (<< 2.0.0)
Architecture: any
Description: XFS filesystem-specific static libraries and headers.
xfslibs-dev contains the libraries and header files needed to
+xfsprogs-2.0.0 (26 February 2002)
+ - Major release to coincide with switch to new extended
+ attributes system call interfaces
+ - bumped version of libhandle, added new symbols to use
+ the reworked extended attributes handle ioctl interface
+ - xfs_repair in no-modify mode opens the filesystem device
+ read-only now (fix from Chris Pascoe)
+ - sync up with recent changes to kernel headers
+
xfsprogs-1.3.19 (15 February 2002)
- fix xfs_repair option parsing for external logs
- add xfs_repair option parsing for realtime device
extern "C" {
#endif
+struct fsdmidata;
+struct attrlist_cursor;
+
extern int path_to_handle (char *__path, void **__hanp, size_t *__hlen);
extern int path_to_fshandle (char *__path, void **__hanp, size_t *__hlen);
extern int fd_to_handle (int __fd, void **__hanp, size_t *__hlen);
extern int open_by_handle (void *__hanp, size_t __hlen, int __rw);
extern int readlink_by_handle (void *__hanp, size_t __hlen, void *__buf,
size_t __bs);
+extern int attr_multi_by_handle (void *__hanp, size_t __hlen, void *__buf,
+ int __rtrvcnt, int __flags);
+extern int attr_list_by_handle (void *__hanp, size_t __hlen, void *__buf,
+ size_t __bufsize, int __flags,
+ struct attrlist_cursor *__cursor);
extern int fssetdm_by_handle (void *__hanp, size_t __hlen,
struct fsdmidata *__fsdmi);
typedef void jdm_filehandle_t; /* filehandle */
struct xfs_bstat;
-
+struct attrlist_cursor;
extern jdm_fshandle_t *
jdm_getfshandle( char *mntpnt);
char *bufp,
size_t bufsz);
+extern intgen_t
+jdm_attr_multi( jdm_fshandle_t *fshp,
+ xfs_bstat_t *statp,
+ char *bufp, int rtrvcnt, int flags);
+
+extern intgen_t
+jdm_attr_list( jdm_fshandle_t *fshp,
+ xfs_bstat_t *statp,
+ char *bufp, size_t bufsz, int flags,
+ struct attrlist_cursor *cursor);
+
/* macro for determining the size of a structure member */
#define sizeofmember( t, m ) sizeof( ( ( t * )0 )->m )
xfs_dinode_core_t i_d; /* most of ondisk inode */
} xfs_inode_t;
+typedef struct {
+ uid_t cr_uid;
+ gid_t cr_gid;
+} cred_t;
+
extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t,
ushort, dev_t, cred_t *, xfs_inode_t **);
extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *);
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-
#ifndef __XFS_CRED_H__
#define __XFS_CRED_H__
-#include <asm/param.h> /* For NGROUPS */
-#ifdef __KERNEL__
-#include <linux/capability.h>
-#include <linux/sched.h>
-#endif
-
/*
* Access Control Lists
*/
typedef ushort xfs_acl_perm_t;
typedef int xfs_acl_type_t;
typedef int xfs_acl_tag_t;
-typedef uid_t xfs_acl_id_t;
+typedef int xfs_acl_id_t;
#define XFS_ACL_MAX_ENTRIES 25
#define XFS_ACL_NOT_PRESENT (-1)
/*
* Capabilities
*/
-typedef __uint64_t cap_value_t;
+typedef __uint64_t xfs_cap_value_t;
-typedef struct cap_set {
- cap_value_t cap_effective; /* use in capability checks */
- cap_value_t cap_permitted; /* combined with file attrs */
- cap_value_t cap_inheritable;/* pass through exec */
-} cap_set_t;
+typedef struct xfs_cap_set {
+ xfs_cap_value_t cap_effective; /* use in capability checks */
+ xfs_cap_value_t cap_permitted; /* combined with file attrs */
+ xfs_cap_value_t cap_inheritable;/* pass through exec */
+} xfs_cap_set_t;
/*
* | division M | (where M = ml_divcount)
* -------------------------------
*/
-#define MAC_MAX_SETS 250
-typedef struct mac_label {
+#define XFS_MAC_MAX_SETS 250
+typedef struct xfs_mac_label {
unsigned char ml_msen_type; /* MSEN label type */
unsigned char ml_mint_type; /* MINT label type */
unsigned char ml_level; /* Hierarchical level */
unsigned short ml_catcount; /* Category count */
unsigned short ml_divcount; /* Division count */
/* Category set, then Division set */
- unsigned short ml_list[MAC_MAX_SETS];
-} mac_label;
-
-/* Data types required by POSIX P1003.1eD15 */
-typedef struct mac_label * mac_t;
-
-
-/*
- * Credentials
- */
-typedef struct cred {
- int cr_ref; /* reference count */
- ushort cr_ngroups; /* number of groups in cr_groups */
- uid_t cr_uid; /* effective user id */
- gid_t cr_gid; /* effective group id */
- uid_t cr_ruid; /* real user id */
- gid_t cr_rgid; /* real group id */
- uid_t cr_suid; /* "saved" user id (from exec) */
- gid_t cr_sgid; /* "saved" group id (from exec) */
- struct mac_label *cr_mac; /* MAC label for B1 and beyond */
- cap_set_t cr_cap; /* capability (privilege) sets */
- gid_t cr_groups[NGROUPS]; /* supplementary group list */
-} cred_t;
-
-
-#ifdef __KERNEL__
-extern int mac_enabled;
-extern mac_label *mac_high_low_lp;
-static __inline void mac_never(void) {}
-struct xfs_inode;
-extern int mac_xfs_iaccess(struct xfs_inode *, mode_t, cred_t *);
-#define _MAC_XFS_IACCESS(i,m,c) \
- (mac_enabled? (mac_never(), mac_xfs_iaccess(i,m,c)): 0)
-extern int mac_xfs_vaccess(vnode_t *, cred_t *, mode_t);
-#define _MAC_VACCESS(v,c,m) \
- (mac_enabled? (mac_never(), mac_xfs_vaccess(v,c,m)): 0)
-
-#define VREAD 00400
-#define VWRITE 00200
-#define VEXEC 00100
-#define MACEXEC 00100
-#define MACWRITE 00200
-#define MACREAD 00400
-#endif /* __KERNEL__ */
-
+ unsigned short ml_list[XFS_MAC_MAX_SETS];
+} xfs_mac_label_t;
/* On-disk XFS extended attribute names (access control lists) */
#define SGI_ACL_FILE "SGI_ACL_FILE"
#ifdef __KERNEL__
+
+#include <asm/param.h> /* For NGROUPS */
+#include <linux/capability.h>
+#include <linux/sched.h>
+
+/*
+ * Credentials
+ */
+typedef struct cred {
+ int cr_ref; /* reference count */
+ ushort cr_ngroups; /* number of groups in cr_groups */
+ uid_t cr_uid; /* effective user id */
+ gid_t cr_gid; /* effective group id */
+ uid_t cr_ruid; /* real user id */
+ gid_t cr_rgid; /* real group id */
+ uid_t cr_suid; /* "saved" user id (from exec) */
+ gid_t cr_sgid; /* "saved" group id (from exec) */
+ xfs_mac_label_t *cr_mac; /* MAC label for B1 and beyond */
+ xfs_cap_set_t cr_cap; /* capability (privilege) sets */
+ gid_t cr_groups[NGROUPS]; /* supplementary group list */
+} cred_t;
+
+#define VREAD 00400
+#define VWRITE 00200
+#define VEXEC 00100
+#define MACEXEC 00100
+#define MACWRITE 00200
+#define MACREAD 00400
+
extern void cred_init(void);
static __inline cred_t *get_current_cred(void) { return NULL; }
/*
struct xfs_attr_multiop *ops; /* attr_multi data to get/set */
} xfs_fsop_attrmulti_handlereq_t;
-/*
- * Structure for XFS_IOC_ATTRCTL_BY_HANDLE ioctl, will be removed later.
- */
-typedef struct xfs_fsop_attr_handlereq {
- struct xfs_fsop_handlereq *hreq;/* handle request interface */
- /* structure */
- struct attr_op *ops; /* array of attribute ops */
- int count; /* number of attribute ops */
-} xfs_fsop_attr_handlereq_t;
-
/*
* File system identifier. Should be unique (at least per machine).
*/
#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)
#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)
/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */
-#define XFS_IOC_ATTRCTL_BY_HANDLE _IOWR('X', 118, struct xfs_fsop_attr_handlereq)
#define XFS_IOC_FREEZE _IOWR('X', 119, int)
#define XFS_IOC_THAW _IOWR('X', 120, int)
#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
-/*
- * ioctl command to export information not in standard interfaces
- * 140: IRIX statvfs.f_fstr field - UUID from the superblock
- */
-/* XFS_IOC_GETFSUUID --[TODO]-- deprecated 140 */
-#define XFS_IOC_GETFSUUID _IOR ('X', 140, unsigned char[16])
+/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
/*
include $(TOPDIR)/include/builddefs
LTLIBRARY = libhandle.la
-LT_CURRENT = 0
+LT_CURRENT = 1
LT_REVISION = 0
LT_AGE = 0
#include <libxfs.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include "handle.h"
+
+/* attributes.h (purposefully) unavailable to xfsprogs, make do */
+struct attrlist_cursor { __u32 opaque[4]; };
+
+#include <handle.h>
/* just pick a value we know is more than big enough */
#define MAXHANSIZ 64
char *path;
} comarg_t;
-
int
obj_to_handle (
int fsfd,
return (int) ioctl(fd, XFS_IOC_READLINK_BY_HANDLE, &hreq);
}
+int
+attr_multi_by_handle(
+ void *hanp,
+ size_t hlen,
+ void *buf,
+ int rtrvcnt,
+ int flags)
+{
+ int fd;
+ xfs_fsop_attrmulti_handlereq_t amhreq;
+
+ if ((fd = handle_to_fsfd(hanp)) < 0) {
+ errno = EBADF;
+ return -1;
+ }
+
+ amhreq.hreq.fd = 0;
+ amhreq.hreq.path = NULL;
+ amhreq.hreq.oflags = 0;
+ amhreq.hreq.ihandle = hanp;
+ amhreq.hreq.ihandlen = hlen;
+ amhreq.hreq.ohandle = NULL;
+ amhreq.hreq.ohandlen = NULL;
+
+ amhreq.opcount = rtrvcnt;
+ amhreq.ops = buf;
+
+ return (int) ioctl(fd, XFS_IOC_ATTRMULTI_BY_HANDLE, &amhreq);
+}
+
+int
+attr_list_by_handle(
+ void *hanp,
+ size_t hlen,
+ void *buf,
+ size_t bufsize,
+ int flags,
+ struct attrlist_cursor *cursor)
+{
+ int fd;
+ xfs_fsop_attrlist_handlereq_t alhreq;
+
+ if ((fd = handle_to_fsfd(hanp)) < 0) {
+ errno = EBADF;
+ return -1;
+ }
+
+ alhreq.hreq.fd = 0;
+ alhreq.hreq.path = NULL;
+ alhreq.hreq.oflags = 0;
+ alhreq.hreq.ihandle = hanp;
+ alhreq.hreq.ihandlen = hlen;
+ alhreq.hreq.ohandle = NULL;
+ alhreq.hreq.ohandlen = NULL;
+
+ memcpy(&alhreq.pos, cursor, sizeof(alhreq.pos));
+ alhreq.flags = flags;
+ alhreq.buflen = bufsize;
+ alhreq.buffer = buf;
+
+ return (int) ioctl(fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);
+}
+
int
fssetdm_by_handle (
void *hanp,
*/
#include <libxfs.h>
+
+/* attributes.h (purposefully) unavailable to xfsprogs, make do */
+struct attrlist_cursor { __u32 opaque[4]; };
+
#include <handle.h>
#include <jdm.h>
bufsz );
return rval;
}
+
+int
+jdm_attr_multi( jdm_fshandle_t *fshp,
+ xfs_bstat_t *statp,
+ char *bufp, int rtrvcnt, int flags)
+{
+ register fshandle_t *fshandlep = ( fshandle_t * )fshp;
+ filehandle_t filehandle;
+ int rval;
+
+ jdm_fill_filehandle( &filehandle, fshandlep, statp );
+ rval = attr_multi_by_handle ( ( void * )&filehandle,
+ sizeof( filehandle ),
+ (void *) bufp,
+ rtrvcnt, flags);
+ return rval;
+}
+
+int
+jdm_attr_list( jdm_fshandle_t *fshp,
+ xfs_bstat_t *statp,
+ char *bufp, size_t bufsz, int flags,
+ struct attrlist_cursor *cursor)
+{
+ register fshandle_t *fshandlep = ( fshandle_t * )fshp;
+ filehandle_t filehandle;
+ int rval;
+
+ jdm_fill_filehandle( &filehandle, fshandlep, statp );
+ rval = attr_list_by_handle (( void * )&filehandle,
+ sizeof( filehandle ),
+ bufp, bufsz, flags, cursor);
+ return rval;
+}
.I xfs_freeze
suspends and resumes access to an XFS filesystem (see
.IR xfs (5)).
+.PP
+.I xfs_freeze
+halts new access to the filesystem and creates a stable image on disk.
+.I xfs_freeze
+is intended to be used with volume managers and hardware RAID devices
+that support the creation of snapshots.
+.PP
The
.I mount-point
argument is the pathname of the directory where the filesystem
is mounted.
The filesystem must be mounted to be frozen (see
.IR mount (8)).
-.I xfs_freeze
-is intended to be used with volume managers and hardware raid devices
-which support the creation of snapshots,
-.I xfs_freeze
-will halt new access to the filesystem and create a stable image on disk
-suitable for using as a snapshot.
.PP
-Using the \f3\-f\f1 option, the filesystem is locked out from new
-modifications, write system calls are halted on entry, other calls
-which modify the filesystem are halted at the start of a transaction,
-all ongoing transactions in the filesystem are allowed to complete.
+The \f3\-f\f1 flag requests the specified XFS filesystem to be
+frozen from new modifications.
+When this is selected, all ongoing transactions in the filesystem
+are allowed to complete, new write system calls are halted, other
+calls which modify the filesystem are halted, and all dirty data,
+metadata, and log information are written to disk.
+Any process attempting to write to the frozen filesystem will block
+waiting for the filesystem to be unfrozen.
.PP
-All dirty data is written out to disk, the log is flushed to disk and
-all dirty metadata is written out. The \f3\-u\f1 option is then used
-to unfreeze the filesystem and allow operations to continue.
+Note that even after freezing, the on-disk filesystem can contain
+information on files that are still in the process of unlinking.
+These files will not be unlinked until the filesystem is unfrozen
+or a clean mount of the snapshot is complete.
.PP
-The options to
-.I xfs_freeze
-are:
-.TP
-\f3\-f\f1
-Specifies that the filesystem should be frozen.
-.TP
-.B \-u
-Specifies that the filesystem should be unfrozen and new modifications
-allowed.
+The \f3\-u\f1 option is used to un-freeze the filesystem and allow
+operations to continue.
+Any filesystem modifications that were blocked by the freeze are
+unblocked and allowed to complete.
+.PP
+One of \f3\-f\f1 or \f3\-u\f1 must be supplied to
+.IR xfs_freeze .
+.SH NOTES
+A copy of a frozen XFS filesystem will usually have the same universally
+unique identifier (UUID) as the original, and thus may be prevented from
+being mounted.
+The XFS \f3nouuid\f1 mount option can be used to circumvent this issue.
.SH SEE ALSO
+xfs(5),
lvm(8),
mount(8).
#include <malloc.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/vfs.h>
#include <ctype.h>
#define MAXBUFFERSIZE (256 * 1024)
-static void usage(void);
static char *progname;
+static void
+usage(void)
+{
+ fprintf(stderr, "%s: [-npv] <size> <name1> [<name2>] ...\n", progname);
+ exit(2);
+}
+
+static int
+openfd(char *name, int oflags)
+{
+ struct statfs buf;
+ int fd;
+
+ fd = open(name, oflags, 0600);
+ if (fd < 0) {
+ perror(name);
+ return -1;
+ }
+
+ fstatfs(fd, &buf);
+ if (buf.f_type != XFS_SUPER_MAGIC) {
+ fprintf(stderr, "%s: "
+ "file [\"%s\"] is not on an XFS filesystem\n",
+ progname, name);
+ return -1;
+ }
+ return fd;
+}
+
int
main(int argc, char **argv)
{
oflags = O_CREAT|O_TRUNC|O_WRONLY|(nobytes ? 0 : O_DIRECT);
- fd = open(argv[optind], oflags, 0600);
+ if ((fd = openfd(argv[optind], oflags)) == -1) {
+ optind++;
+ errs++;
+ continue;
+ }
if ( (oflags & O_DIRECT)
&& ( (fd < 0 && errno == EINVAL)
oflags &= ~O_DIRECT;
- fd = open(argv[optind], oflags, 0600);
- }
-
- if (fd < 0) {
- perror(argv[optind]);
- optind++;
- errs++;
- continue;
+ if ((fd = openfd(argv[optind], oflags)) == -1) {
+ optind++;
+ errs++;
+ continue;
+ }
}
if (size == 0) {
return errs != 0;
}
-
-static void
-usage(void)
-{
- fprintf(stderr, "%s: [-npv] <size> <name1> [<name2>] ...\n", progname);
- exit(2);
-}
#include "bmap.h"
static int xfs_acl_valid(xfs_acl_t *aclp);
-static int xfs_mac_valid(mac_t lp);
+static int xfs_mac_valid(xfs_mac_label_t *lp);
/*
valuecheck(char *namevalue, char *value, int namelen, int valuelen)
{
/* for proper alignment issues, get the structs and bcopy the values */
- mac_label macl;
+ xfs_mac_label_t macl;
xfs_acl_t thisacl;
void *valuep;
int clearit = 0;
}
} else if (strncmp(namevalue, SGI_MAC_FILE, SGI_MAC_FILE_SIZE) == 0) {
if (value == NULL) {
- bzero(&macl, sizeof(mac_label));
+ bzero(&macl, sizeof(xfs_mac_label_t));
bcopy(namevalue+namelen, &macl, valuelen);
valuep = &macl;
} else
valuep = value;
- if (xfs_mac_valid((mac_label *) valuep) != 1) { /* 1 is valid */
+ if (xfs_mac_valid((xfs_mac_label_t *)valuep) != 1) { /* 1 is valid */
/*
*if sysconf says MAC enabled,
* temp = mac_from_text("msenhigh/mintlow", NULL)
do_warn("entry contains illegal value in attribute named SGI_MAC_LABEL\n");
}
} else if (strncmp(namevalue, SGI_CAP_FILE, SGI_CAP_FILE_SIZE) == 0) {
- if ( valuelen != sizeof(cap_set_t)) {
+ if ( valuelen != sizeof(xfs_cap_set_t)) {
clearit = 1;
do_warn("entry contains illegal value in attribute named SGI_CAP_FILE\n");
}
/*
* xfs_mac_valid(lp)
- * check the validity of a mac label
+ * Check the validity of a MAC label.
*/
static int
-xfs_mac_valid(mac_t lp)
+xfs_mac_valid(xfs_mac_label_t *lp)
{
if (lp == NULL)
return (0);
* if the total category set and division set is greater than 250
* report error
*/
- if ((lp->ml_catcount + lp->ml_divcount) > MAC_MAX_SETS)
+ if ((lp->ml_catcount + lp->ml_divcount) > XFS_MAC_MAX_SETS)
return(0);
/*