]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Merge of xfs-cmds-2.4.18:slinx:111135a by nathans. v2.0.0
authorNathan Scott <nathans@sgi.com>
Mon, 25 Feb 2002 22:06:21 +0000 (22:06 +0000)
committerNathan Scott <nathans@sgi.com>
Mon, 25 Feb 2002 22:06:21 +0000 (22:06 +0000)
  bump to version 2.0.0 for extended attribute and other interface changes.

16 files changed:
VERSION
build/rpm/xfsprogs.spec.in
debian/changelog
debian/control
doc/CHANGES
include/handle.h
include/jdm.h
include/libxfs.h
include/xfs_cred.h
include/xfs_fs.h
libhandle/Makefile
libhandle/handle.c
libhandle/jdm.c
man/man8/xfs_freeze.8
mkfile/xfs_mkfile.c
repair/attr_repair.c

diff --git a/VERSION b/VERSION
index 936d4040cc8b4c0fa835968658c420800f92e893..94674066330d859f202812c044687afc72ffaef1 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 #
 # 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
index 30bbbe1eb2a81d688984282cf5957a0656bcc3c3..e5e3eacbee010ddf33d43d3f792f2b93e4190187 100644 (file)
@@ -8,6 +8,7 @@ BuildRoot: @build_root@
 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.
@@ -31,7 +32,8 @@ with the IRIX version of XFS.
 %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
index 120f61a6beee9dc8a23f86ff11730893915ceca4..dc6bd81aa69c3c757f1cd6baa4dd4f2792d604fb 100644 (file)
@@ -1,3 +1,10 @@
+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
@@ -27,6 +34,13 @@ xfsprogs (1.3.15-1) unstable; urgency=low
 
  -- 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
index c4809aecc63b54918ded89296aa6d263ba2075f1..387bb2a61a7b7053a4f04781f107426241a4fff6 100644 (file)
@@ -8,6 +8,7 @@ Standards-Version: 3.5.5
 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.
@@ -26,7 +27,8 @@ Description: Utilities for managing the XFS filesystem
 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
index 1b98252a502e487284e7af29a5691989212e2b53..2e695fd67f1bed92a078616fcae0f06f19d2e014 100644 (file)
@@ -1,3 +1,12 @@
+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
index 80482b85eef623a7f7871fa17cb5e489a9c04525..7811d032484c35d91460ae3bc63bfac07e981a4e 100644 (file)
@@ -37,6 +37,9 @@
 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);
@@ -47,6 +50,11 @@ extern void free_handle (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);
 
index f49140cc96a4b2e5ab1ba787c0cf30256d35824b..3fc4f70d0514210131dbc4ca865a6fcc2e4e7ddc 100644 (file)
@@ -37,7 +37,7 @@ typedef void  jdm_fshandle_t;         /* filesystem handle */
 typedef void   jdm_filehandle_t;       /* filehandle */
 
 struct xfs_bstat;
-
+struct attrlist_cursor;
 
 extern jdm_fshandle_t *
 jdm_getfshandle( char *mntpnt);
@@ -63,6 +63,17 @@ jdm_readlink( jdm_fshandle_t *fshandlep,
              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 )
 
index 3df81732a5218108ff728db792515cb1e7328dab..c2f59fc6247e78bb0cf804c84acee5be5e3044b2 100644 (file)
@@ -334,6 +334,11 @@ typedef struct xfs_inode {
        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 *);
index ddaf0655da7f5aa5b22913faae7df07dd5c89965..1ed66ca4f6dd0e6658178b0d362b5f32dcc6dffd 100644 (file)
  * 
  * 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)
@@ -64,13 +57,13 @@ typedef struct xfs_acl {
 /*
  * 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;
 
 
 /*
@@ -99,8 +92,8 @@ typedef struct cap_set {
  *      | 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  */
@@ -108,51 +101,8 @@ typedef struct mac_label {
        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"
@@ -191,6 +141,35 @@ extern int mac_xfs_vaccess(vnode_t *, cred_t *, mode_t);
 
 
 #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; }
 /* 
index 8c61ac71643cd3ad993eba2560f166c41fb269bb..d5a7e19c586e953f125803901f1128b532a23070 100644 (file)
@@ -363,16 +363,6 @@ typedef struct xfs_fsop_attrmulti_handlereq {
        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).
  */
@@ -469,18 +459,12 @@ typedef struct xfs_handle {
 #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      */
 
 
 /*
index 3d9fb667b242d934f3eb6f61d4ff6ef964d265fb..d077e6d9921a18394efa30a06651de88fab8fed1 100644 (file)
@@ -34,7 +34,7 @@ TOPDIR = ..
 include $(TOPDIR)/include/builddefs
 
 LTLIBRARY = libhandle.la
-LT_CURRENT = 0
+LT_CURRENT = 1
 LT_REVISION = 0
 LT_AGE = 0
 
index 9b635dcc2c9580a56271b1fbd4e08022bd14d44d..f90fdfd1c13d55acafd12be15608622e6c476b2d 100644 (file)
 #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
@@ -54,7 +58,6 @@ typedef union {
        char    *path;
 } comarg_t;
 
-
 int
 obj_to_handle (
        int             fsfd,
@@ -303,6 +306,69 @@ readlink_by_handle (
        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,
index bac715481653879adb590dd0bf74b9a3c82eb035..958dd3f9d8530dc89b358822202cf4c310e7bc27 100644 (file)
  */
 
 #include <libxfs.h>
+
+/* attributes.h (purposefully) unavailable to xfsprogs, make do */
+struct attrlist_cursor { __u32 opaque[4]; };
+
 #include <handle.h>
 #include <jdm.h>
 
@@ -152,3 +156,37 @@ jdm_readlink( jdm_fshandle_t *fshp,
                                   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;
+}
index c11e74e3023007e7ae14711cbf09892198ec3dda..eb7d75bbca7cb61a5b9b52366bf0da6846d12e35 100644 (file)
@@ -9,38 +9,47 @@ xfs_freeze \- suspend access to an XFS filesystem
 .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).
index 1957b4da7f98c2bc4cad653afbcbea9e28516d34..28df7c9dad670030ef2a7de14894e4304427e7f1 100644 (file)
 #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)
 {
@@ -139,7 +168,11 @@ 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)
@@ -149,14 +182,11 @@ main(int argc, char **argv)
 
                        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) {
@@ -255,10 +285,3 @@ main(int argc, char **argv)
 
        return errs != 0;
 }
-
-static void
-usage(void)
-{
-       fprintf(stderr, "%s: [-npv] <size> <name1> [<name2>] ...\n", progname);
-       exit(2);
-}
index 903b6115b3fdf7cf8886a790e0ece58ea7d63368..d13a483be2b299619f5cf43b9d981283f9e242fb 100644 (file)
@@ -39,7 +39,7 @@
 #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);
 
 
 /*
@@ -98,7 +98,7 @@ int
 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;
@@ -119,13 +119,13 @@ valuecheck(char *namevalue, char *value, int namelen, int valuelen)
                }
        } 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)
@@ -138,7 +138,7 @@ valuecheck(char *namevalue, char *value, int namelen, int valuelen)
                        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");
                }
@@ -1010,10 +1010,10 @@ __check_setvalue(const unsigned short *list, unsigned short count)
 
 /*
  * 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);
@@ -1022,7 +1022,7 @@ xfs_mac_valid(mac_t lp)
         * 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);
 
        /*