+xfsprogs (2.1.0-1) unstable; urgency=low
+
+ * New upstream release
+ * Support for the XFS version 2 log format
+
+ -- Nathan Scott <nathans@debian.org> Thu, 20 Jun 2002 14:43:07 +1000
+
xfsprogs (2.0.6-2) unstable; urgency=low
* Fix a problem in xfs_repair's handling of ACLs
- support for xfs version 2 log format.
- Fix for xfs_repair mangling i8count for dir2_sf directories
- Minor mkfs.xfs man page update for blocksize limits on Linux
+ - xfs_cred.h split into xfs_acl.h, xfs_cap.h and xfs_mac.h
xfsprogs-2.0.6 (30 May 2002)
- Fix error returns from log recovery (affects xfs_repair).
HFILES = arch.h handle.h jdm.h libxfs.h libxlog.h xqm.h \
xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \
xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \
- xfs_buf_item.h xfs_cred.h xfs_da_btree.h xfs_dfrag.h xfs_dinode.h \
+ xfs_buf_item.h xfs_da_btree.h xfs_dfrag.h xfs_dinode.h \
xfs_dir.h xfs_dir2.h xfs_dir2_block.h xfs_dir2_data.h xfs_dir2_leaf.h \
xfs_dir2_node.h xfs_dir2_sf.h xfs_dir_leaf.h xfs_dir_sf.h xfs_dqblk.h \
xfs_dquot_item.h xfs_extfree_item.h xfs_fs.h xfs_ialloc.h \
xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_mount.h xfs_quota.h \
xfs_rtalloc.h xfs_sb.h xfs_trans.h xfs_trans_space.h xfs_types.h
-DK_HFILES = mountinfo.h volume.h fstyp.h dvh.h
-LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules $(DK_HFILES)
+LHFILES = xfs_acl.h xfs_cap.h xfs_mac.h
+DKHFILES = mountinfo.h volume.h fstyp.h dvh.h
+LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules \
+ $(LHFILES) $(DKHFILES)
LDIRT = xfs
default install :
$(INSTALL) -m 644 $(HFILES) $(PKG_INC_DIR)
$(INSTALL) -m 644 platform_defs.h $(PKG_INC_DIR)
$(INSTALL) -m 755 -d $(DK_INC_DIR)
- $(INSTALL) -m 644 $(DK_HFILES) $(DK_INC_DIR)
+ $(INSTALL) -m 644 $(DKHFILES) $(DK_INC_DIR)
#include <xfs_inode.h>
#include <xfs_buf_item.h>
#include <xfs_inode_item.h>
-#include <xfs_cred.h>
#include <xfs_bmap.h>
#include <xfs_imap.h>
#include <xfs_log.h>
--- /dev/null
+/*
+ * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_ACL_H__
+#define __XFS_ACL_H__
+
+/*
+ * Access Control Lists
+ */
+typedef __uint16_t xfs_acl_perm_t;
+typedef __int32_t xfs_acl_type_t;
+typedef __int32_t xfs_acl_tag_t;
+typedef __int32_t xfs_acl_id_t;
+
+#define XFS_ACL_MAX_ENTRIES 25
+#define XFS_ACL_NOT_PRESENT (-1)
+
+typedef struct xfs_acl_entry {
+ xfs_acl_tag_t ae_tag;
+ xfs_acl_id_t ae_id;
+ xfs_acl_perm_t ae_perm;
+} xfs_acl_entry_t;
+
+typedef struct xfs_acl {
+ __int32_t acl_cnt;
+ xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES];
+} xfs_acl_t;
+
+/* On-disk XFS extended attribute names */
+#define SGI_ACL_FILE "SGI_ACL_FILE"
+#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT"
+#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
+#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
+
+
+#ifdef __KERNEL__
+
+#ifdef CONFIG_FS_POSIX_ACL
+
+#include <linux/posix_acl.h>
+
+struct vattr;
+struct vnode;
+struct xfs_inode;
+
+extern int xfs_acl_inherit(struct vnode *, struct vattr *, xfs_acl_t *);
+extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
+extern int xfs_acl_get(struct vnode *, xfs_acl_t *, xfs_acl_t *);
+extern int xfs_acl_set(struct vnode *, xfs_acl_t *, xfs_acl_t *);
+extern int xfs_acl_vtoacl(struct vnode *, xfs_acl_t *, xfs_acl_t *);
+extern int xfs_acl_vhasacl_access(struct vnode *);
+extern int xfs_acl_vhasacl_default(struct vnode *);
+extern int xfs_acl_vset(struct vnode *, void *, size_t, int);
+extern int xfs_acl_vget(struct vnode *, void *, size_t, int);
+extern int xfs_acl_vremove(struct vnode *vp, int);
+
+extern struct xfs_zone *xfs_acl_zone;
+
+#define _ACL_DECL(a) xfs_acl_t *(a) = NULL
+#define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP))
+#define _ACL_FREE(a) ((a)? kmem_zone_free(xfs_acl_zone, (a)) : 0)
+#define _ACL_ZONE_INIT(z,name) ((z) = kmem_zone_init(sizeof(xfs_acl_t), name))
+#define _ACL_ZONE_DESTROY(z) (kmem_cache_destroy(z))
+#define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d))
+#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
+#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
+#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
+#define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default
+#define _ACL_XFS_IACCESS(i,m,c) \
+ (XFS_IFORK_Q(i) ? xfs_acl_iaccess(i,m,c) : -1)
+
+#else
+#define xfs_acl_vset(v,p,sz,t) (-ENOTSUP)
+#define xfs_acl_vget(v,p,sz,t) (-ENOTSUP)
+#define xfs_acl_vremove(v,t) (-ENOTSUP)
+#define _ACL_DECL(a) ((void)0)
+#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
+#define _ACL_FREE(a) ((void)0)
+#define _ACL_ZONE_INIT(z,name) ((void)0)
+#define _ACL_ZONE_DESTROY(z) ((void)0)
+#define _ACL_INHERIT(c,v,d) (0)
+#define _ACL_GET_ACCESS(pv,pa) (0)
+#define _ACL_GET_DEFAULT(pv,pd) (0)
+#define _ACL_ACCESS_EXISTS (NULL)
+#define _ACL_DEFAULT_EXISTS (NULL)
+#define _ACL_XFS_IACCESS(i,m,c) (-1)
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __XFS_ACL_H__ */
#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1)
#endif
-/* Get low bit set out of 32-bit argument, -1 if none set */
-extern int xfs_lowbit32(__uint32_t v);
-
/* Get high bit set out of 32-bit argument, -1 if none set */
extern int xfs_highbit32(__uint32_t v);
--- /dev/null
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_CAP_H__
+#define __XFS_CAP_H__
+
+/*
+ * Capabilities
+ */
+typedef __uint64_t xfs_cap_value_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;
+
+/* On-disk XFS extended attribute names */
+#define SGI_CAP_FILE "SGI_CAP_FILE"
+#define SGI_CAP_FILE_SIZE (sizeof(SGI_CAP_FILE)-1)
+
+/* On-disk bitfield values, as defined for us by IRIX */
+#define XFS_CAP_CHOWN (0x01LL << 1)
+#define XFS_CAP_DAC_WRITE (0x01LL << 2)
+#define XFS_CAP_DAC_READ_SEARCH (0x01LL << 3)
+#define XFS_CAP_FOWNER (0x01LL << 4)
+#define XFS_CAP_DAC_OVERRIDE \
+ (XFS_CAP_DAC_WRITE|XFS_CAP_DAC_READ_SEARCH|XFS_CAP_FOWNER)
+#define XFS_CAP_FSETID (0x01LL << 5)
+#define XFS_CAP_KILL (0x01LL << 6)
+#define XFS_CAP_LINK_DIR (0x01LL << 7)
+#define XFS_CAP_SETFPRIV (0x01LL << 8)
+#define XFS_CAP_SETFCAP XFS_CAP_SETFPRIV
+#define XFS_CAP_SETPPRIV (0x01LL << 9)
+#define XFS_CAP_SETPCAP XFS_CAP_SETPPRIV
+#define XFS_CAP_SETGID (0x01LL << 10)
+#define XFS_CAP_SETUID (0x01LL << 11)
+#define XFS_CAP_MAC_DOWNGRADE (0x01LL << 12)
+#define XFS_CAP_MAC_READ (0x01LL << 13)
+#define XFS_CAP_MAC_RELABEL_SUBJ (0x01LL << 14)
+#define XFS_CAP_MAC_WRITE (0x01LL << 15)
+#define XFS_CAP_MAC_UPGRADE (0x01LL << 16)
+#define XFS_CAP_INF_NOFLOAT_OBJ (0x01LL << 17) /* Currently unused */
+#define XFS_CAP_INF_NOFLOAT_SUBJ (0x01LL << 18) /* Currently unused */
+#define XFS_CAP_INF_DOWNGRADE (0x01LL << 19) /* Currently unused */
+#define XFS_CAP_INF_UPGRADE (0x01LL << 20) /* Currently unused */
+#define XFS_CAP_INF_RELABEL_SUBJ (0x01LL << 21) /* Currently unused */
+#define XFS_CAP_AUDIT_CONTROL (0x01LL << 22)
+#define XFS_CAP_AUDIT_WRITE (0x01LL << 23)
+#define XFS_CAP_MAC_MLD (0x01LL << 24)
+#define XFS_CAP_MEMORY_MGT (0x01LL << 25)
+#define XFS_CAP_SWAP_MGT (0x01LL << 26)
+#define XFS_CAP_TIME_MGT (0x01LL << 27)
+#define XFS_CAP_SYSINFO_MGT (0x01LL << 28)
+#define XFS_CAP_NVRAM_MGT XFS_CAP_SYSINFO_MGT
+#define XFS_CAP_MOUNT_MGT (0x01LL << 29)
+#define XFS_CAP_QUOTA_MGT (0x01LL << 30)
+#define XFS_CAP_PRIV_PORT (0x01LL << 31)
+#define XFS_CAP_STREAMS_MGT (0x01LL << 32)
+#define XFS_CAP_SCHED_MGT (0x01LL << 33)
+#define XFS_CAP_PROC_MGT (0x01LL << 34)
+#define XFS_CAP_SVIPC_MGT (0x01LL << 35)
+#define XFS_CAP_NETWORK_MGT (0x01LL << 36)
+#define XFS_CAP_DEVICE_MGT (0x01LL << 37)
+#define XFS_CAP_MKNOD XFS_CAP_DEVICE_MGT
+#define XFS_CAP_ACCT_MGT (0x01LL << 38)
+#define XFS_CAP_SHUTDOWN (0x01LL << 39)
+#define XFS_CAP_CHROOT (0x01LL << 40)
+#define XFS_CAP_DAC_EXECUTE (0x01LL << 41)
+#define XFS_CAP_MAC_RELABEL_OPEN (0x01LL << 42)
+#define XFS_CAP_SIGMASK (0x01LL << 43) /* Not implemented */
+#define XFS_CAP_XTCB (0x01LL << 44) /* X11 Trusted Client */
+
+
+#ifdef __KERNEL__
+
+#ifdef CONFIG_POSIX_CAP
+/* NOT YET IMPLEMENTED */
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __XFS_CAP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_CRED_H__
-#define __XFS_CRED_H__
-
-/*
- * Access Control Lists
- */
-typedef __uint16_t xfs_acl_perm_t;
-typedef __int32_t xfs_acl_type_t;
-typedef __int32_t xfs_acl_tag_t;
-typedef __int32_t xfs_acl_id_t;
-
-#define XFS_ACL_MAX_ENTRIES 25
-#define XFS_ACL_NOT_PRESENT (-1)
-
-typedef struct xfs_acl_entry {
- xfs_acl_tag_t ae_tag;
- xfs_acl_id_t ae_id;
- xfs_acl_perm_t ae_perm;
-} xfs_acl_entry_t;
-
-typedef struct xfs_acl {
- __int32_t acl_cnt;
- xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES];
-} xfs_acl_t;
-
-/*
- * Capabilities
- */
-typedef __uint64_t xfs_cap_value_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;
-
-
-/*
- * Mandatory Access Control
- *
- * Layout of a composite MAC label:
- * ml_list contains the list of categories (MSEN) followed by the list of
- * divisions (MINT). This is actually a header for the data structure which
- * will have an ml_list with more than one element.
- *
- * -------------------------------
- * | ml_msen_type | ml_mint_type |
- * -------------------------------
- * | ml_level | ml_grade |
- * -------------------------------
- * | ml_catcount |
- * -------------------------------
- * | ml_divcount |
- * -------------------------------
- * | category 1 |
- * | . . . |
- * | category N | (where N = ml_catcount)
- * -------------------------------
- * | division 1 |
- * | . . . |
- * | division M | (where M = ml_divcount)
- * -------------------------------
- */
-#define XFS_MAC_MAX_SETS 250
-typedef struct xfs_mac_label {
- __uint8_t ml_msen_type; /* MSEN label type */
- __uint8_t ml_mint_type; /* MINT label type */
- __uint8_t ml_level; /* Hierarchical level */
- __uint8_t ml_grade; /* Hierarchical grade */
- __uint16_t ml_catcount; /* Category count */
- __uint16_t ml_divcount; /* Division count */
- /* Category set, then Division set */
- __uint16_t 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"
-#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT"
-#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
-#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
-
-/* On-disk XFS extended attribute names (mandatory access control) */
-#define SGI_MAC_FILE "SGI_MAC_FILE"
-#define SGI_MAC_FILE_SIZE (sizeof(SGI_MAC_FILE)-1)
-
-/* On-disk XFS extended attribute names (capabilities) */
-#define SGI_CAP_FILE "SGI_CAP_FILE"
-#define SGI_CAP_FILE_SIZE (sizeof(SGI_CAP_FILE)-1)
-
-/* MSEN label type names. Choose an upper case ASCII character. */
-#define MSEN_ADMIN_LABEL 'A' /* Admin: low<admin != tcsec<high */
-#define MSEN_EQUAL_LABEL 'E' /* Wildcard - always equal */
-#define MSEN_HIGH_LABEL 'H' /* System High - always dominates */
-#define MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */
-#define MSEN_LOW_LABEL 'L' /* System Low - always dominated */
-#define MSEN_MLD_LABEL 'M' /* TCSEC label on a multi-level dir */
-#define MSEN_MLD_LOW_LABEL 'N' /* System Low, multi-level dir */
-#define MSEN_TCSEC_LABEL 'T' /* TCSEC label */
-#define MSEN_UNKNOWN_LABEL 'U' /* unknown label */
-
-/* MINT label type names. Choose a lower case ASCII character. */
-#define MINT_BIBA_LABEL 'b' /* Dual of a TCSEC label */
-#define MINT_EQUAL_LABEL 'e' /* Wildcard - always equal */
-#define MINT_HIGH_LABEL 'h' /* High Grade - always dominates */
-#define MINT_LOW_LABEL 'l' /* Low Grade - always dominated */
-
-
-#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; }
-/*
- * XXX: tes
- * This is a hack.
- * It assumes that if cred is not null then it is sys_cred which
- * has all capabilities.
- * One solution may be to implement capable_cred based on linux' capable()
- * and initialize all credentials in our xfs linvfs layer.
- */
-static __inline int capable_cred(cred_t *cr, int cid) { return (cr==NULL) ? capable(cid) : 1; }
-extern struct cred *sys_cred;
-#endif /* __KERNEL__ */
-
-#endif /* __XFS_CRED_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_MAC_H__
+#define __XFS_MAC_H__
+
+/*
+ * Mandatory Access Control
+ *
+ * Layout of a composite MAC label:
+ * ml_list contains the list of categories (MSEN) followed by the list of
+ * divisions (MINT). This is actually a header for the data structure which
+ * will have an ml_list with more than one element.
+ *
+ * -------------------------------
+ * | ml_msen_type | ml_mint_type |
+ * -------------------------------
+ * | ml_level | ml_grade |
+ * -------------------------------
+ * | ml_catcount |
+ * -------------------------------
+ * | ml_divcount |
+ * -------------------------------
+ * | category 1 |
+ * | . . . |
+ * | category N | (where N = ml_catcount)
+ * -------------------------------
+ * | division 1 |
+ * | . . . |
+ * | division M | (where M = ml_divcount)
+ * -------------------------------
+ */
+#define XFS_MAC_MAX_SETS 250
+typedef struct xfs_mac_label {
+ __uint8_t ml_msen_type; /* MSEN label type */
+ __uint8_t ml_mint_type; /* MINT label type */
+ __uint8_t ml_level; /* Hierarchical level */
+ __uint8_t ml_grade; /* Hierarchical grade */
+ __uint16_t ml_catcount; /* Category count */
+ __uint16_t ml_divcount; /* Division count */
+ /* Category set, then Division set */
+ __uint16_t ml_list[XFS_MAC_MAX_SETS];
+} xfs_mac_label_t;
+
+/* MSEN label type names. Choose an upper case ASCII character. */
+#define XFS_MSEN_ADMIN_LABEL 'A' /* Admin: low<admin != tcsec<high */
+#define XFS_MSEN_EQUAL_LABEL 'E' /* Wildcard - always equal */
+#define XFS_MSEN_HIGH_LABEL 'H' /* System High - always dominates */
+#define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */
+#define XFS_MSEN_LOW_LABEL 'L' /* System Low - always dominated */
+#define XFS_MSEN_MLD_LABEL 'M' /* TCSEC label on a multi-level dir */
+#define XFS_MSEN_MLD_LOW_LABEL 'N' /* System Low, multi-level dir */
+#define XFS_MSEN_TCSEC_LABEL 'T' /* TCSEC label */
+#define XFS_MSEN_UNKNOWN_LABEL 'U' /* unknown label */
+
+/* MINT label type names. Choose a lower case ASCII character. */
+#define XFS_MINT_BIBA_LABEL 'b' /* Dual of a TCSEC label */
+#define XFS_MINT_EQUAL_LABEL 'e' /* Wildcard - always equal */
+#define XFS_MINT_HIGH_LABEL 'h' /* High Grade - always dominates */
+#define XFS_MINT_LOW_LABEL 'l' /* Low Grade - always dominated */
+
+/* On-disk XFS extended attribute names */
+#define SGI_MAC_FILE "SGI_MAC_FILE"
+#define SGI_MAC_FILE_SIZE (sizeof(SGI_MAC_FILE)-1)
+
+
+#ifdef __KERNEL__
+
+#ifdef CONFIG_FS_POSIX_MAC
+
+/* NOT YET IMPLEMENTED */
+
+struct xfs_inode;
+extern int xfs_mac_iaccess(struct xfs_inode *, mode_t, cred_t *);
+
+#define _MAC_XFS_IACCESS(i,m,c) (xfs_mac_iaccess(i,m,c))
+#define _MAC_VACCESS(v,c,m) (xfs_mac_vaccess(v,c,m))
+
+#else
+#define _MAC_XFS_IACCESS(i,m,c) (0)
+#define _MAC_VACCESS(v,c,m) (0)
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __XFS_MAC_H__ */
#ifdef __KERNEL__
+
+#ifdef CONFIG_XFS_QUOTA
/*
* External Interface to the XFS disk quota subsystem.
*/
-struct bhv_desc;
-struct vfs;
struct xfs_disk_dquot;
struct xfs_dqhash;
struct xfs_dquot;
extern void xfs_qm_dqdettach_inode(struct xfs_inode *);
extern int xfs_qm_sync(struct xfs_mount *, short);
-
-/*
- * system call interface
- */
-extern int xfs_quotactl(xfs_mount_t *, struct vfs *, int, int,
- int, xfs_caddr_t);
-
/*
- * dquot interface.
+ * Dquot interface.
*/
extern void xfs_dqlock(struct xfs_dquot *);
extern void xfs_dqunlock(struct xfs_dquot *);
struct xfs_dquot **,
struct xfs_dquot **);
-extern int xfs_qm_vop_chown_dqalloc(struct xfs_mount *,
- struct xfs_inode *,
- int, uid_t, gid_t,
- struct xfs_dquot **,
- struct xfs_dquot **);
-
extern int xfs_qm_vop_chown_reserve(struct xfs_trans *,
struct xfs_inode *,
struct xfs_dquot *,
extern void xfs_trans_mod_dquot(struct xfs_trans *,
struct xfs_dquot *,
uint, long);
-extern int xfs_trans_mod_dquot_byino(struct xfs_trans *,
+extern void xfs_trans_mod_dquot_byino(struct xfs_trans *,
struct xfs_inode *,
uint, long);
extern void xfs_trans_apply_dquot_deltas(struct xfs_trans *);
struct xfs_dquot *);
extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint);
+#else
+# define xfs_qm_init() (NULL)
+# define xfs_qm_destroy(xqm) do { } while (0)
+# define xfs_qm_dqflush_all(m,t) (ENOSYS)
+# define xfs_qm_dqattach(i,t) (ENOSYS)
+# define xfs_qm_dqpurge_all(m,t) (ENOSYS)
+# define xfs_qm_mount_quotainit(m,t) do { } while (0)
+# define xfs_qm_unmount_quotadestroy(m) do { } while (0)
+# define xfs_qm_mount_quotas(m) (ENOSYS)
+# define xfs_qm_unmount_quotas(m) (ENOSYS)
+# define xfs_qm_dqdettach_inode(i) do { } while (0)
+# define xfs_qm_sync(m,t) (ENOSYS)
+# define xfs_dqlock(d) do { } while (0)
+# define xfs_dqunlock(d) do { } while (0)
+# define xfs_dqunlock_nonotify(d) do { } while (0)
+# define xfs_dqlock2(d1,d2) do { } while (0)
+# define xfs_qm_dqput(d) do { } while (0)
+# define xfs_qm_dqrele(d) do { } while (0)
+# define xfs_qm_dqid(d) (-1)
+# define xfs_qm_dqget(m,i,di,t,f,d) (ENOSYS)
+# define xfs_qm_dqcheck(dd,di,t,f,s) (ENOSYS)
+# define xfs_trans_alloc_dqinfo(t) do { } while (0)
+# define xfs_trans_free_dqinfo(t) do { } while (0)
+# define xfs_trans_dup_dqinfo(t1,t2) do { } while (0)
+# define xfs_trans_mod_dquot(t,d,f,x) do { } while (0)
+# define xfs_trans_mod_dquot_byino(t,i,f,x) do { } while (0)
+# define xfs_trans_apply_dquot_deltas(t) do { } while (0)
+# define xfs_trans_unreserve_and_mod_dquots(t) do { } while (0)
+# define xfs_trans_reserve_quota_nblks(t,i,nb,ni,f) (ENOSYS)
+# define xfs_trans_reserve_quota_bydquots(t,x,y,b,i,f) (ENOSYS)
+# define xfs_trans_log_dquot(t,d) do { } while (0)
+# define xfs_trans_dqjoin(t,d) do { } while (0)
+# define xfs_qm_dqrele_all_inodes(m,t) do { } while (0)
+# define xfs_qm_vop_chown(t,i,d1,d2) (NULL)
+# define xfs_qm_vop_dqalloc(m,i,u,g,f,d1,d2) (ENOSYS)
+# define xfs_qm_vop_chown_reserve(t,i,d1,d2,f) (ENOSYS)
+# define xfs_qm_vop_rename_dqattach(i) (ENOSYS)
+# define xfs_qm_vop_dqattach_and_dqmod_newinode(t,i,x,y) do { } while (0)
+#endif /* CONFIG_XFS_QUOTA */
+
/*
* Regular disk block quota reservations
*/
XFS_QMOPT_RES_REGBLKS|XFS_QMOPT_FORCE_RES)
#define xfs_trans_unreserve_blkquota(tp, ip, nblks) \
-xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_REGBLKS)
+(void)xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_REGBLKS)
#define xfs_trans_reserve_quota(tp, udq, gdq, nb, ni, f) \
xfs_trans_reserve_quota_bydquots(tp, udq, gdq, nb, ni, f|XFS_QMOPT_RES_REGBLKS)
xfs_trans_reserve_quota_nblks(tp, ip, nblks, 0, XFS_QMOPT_RES_RTBLKS)
#define xfs_trans_unreserve_rtblkquota(tp, ip, nblks) \
-xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_RTBLKS)
+(void)xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_RTBLKS)
#define xfs_trans_reserve_rtquota(mp, tp, uq, pq, blks, f) \
xfs_trans_reserve_quota_bydquots(mp, tp, uq, pq, blks, 0, f|XFS_QMOPT_RES_RTBLKS)
#define xfs_trans_unreserve_rtquota(tp, uq, pq, blks) \
xfs_trans_reserve_quota_bydquots(tp, uq, pq, -(blks), XFS_QMOPT_RES_RTBLKS)
+
#endif /* __KERNEL__ */
#endif /* __XFS_QUOTA_H__ */
#define XFS_RTBLOCKLOG(b) xfs_highbit32(b)
#endif
+
+#ifdef __KERNEL__
+
+#ifdef CONFIG_XFS_RT
/*
* Function prototypes for exported functions.
*/
xfs_extlen_t len, /* allocation length (rtextents) */
xfs_rtblock_t *pick); /* result rt extent */
-#ifdef XFSDEBUG
/*
* Debug code: print out the value of a range in the bitmap.
*/
xfs_rtprint_summary(
struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp); /* transaction pointer */
-#endif /* XFSDEBUG */
+
+/*
+ * Grow the realtime area of the filesystem.
+ */
+int
+xfs_growfs_rt(
+ struct xfs_mount *mp, /* file system mount structure */
+ xfs_growfs_rt_t *in); /* user supplied growfs struct */
+
+#else
+# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS)
+# define xfs_rtfree_extent(t,b,l) (ENOSYS)
+# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
+# define xfs_growfs_rt(mp,in) (ENOSYS)
+# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
+# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
+#endif /* CONFIG_XFS_RT */
+
+#endif /* __KERNEL__ */
#endif /* __XFS_RTALLOC_H__ */
*/
#include <xfs.h>
+extern int xfs_lowbit32(__uint32_t);
/*
* Get a buffer for the bitmap or summary file block specified.
xfs_trans_t *tp, /* transaction pointer */
xfs_rtblock_t block, /* block number in bitmap or summary */
int issum, /* is summary not bitmap */
- xfs_buf_t **bpp) /* output: buffer for the block */
+ xfs_buf_t **bpp) /* output: buffer for the block */
{
- xfs_buf_t *bp; /* block buffer, result */
- xfs_daddr_t d; /* disk addr of block */
+ xfs_buf_t *bp; /* block buffer, result */
+ xfs_daddr_t d; /* disk addr of block */
int error; /* error value */
xfs_fsblock_t fsb; /* fs block number for block */
xfs_inode_t *ip; /* bitmap or summary inode */
xfs_rtword_t *b; /* current word in buffer */
int bit; /* bit number in the word */
xfs_rtblock_t block; /* bitmap block number */
- xfs_buf_t *bp; /* buf for the block */
+ xfs_buf_t *bp; /* buf for the block */
xfs_rtword_t *bufp; /* starting word in buffer */
int error; /* error value */
xfs_rtblock_t firstbit; /* first useful bit in the word */
xfs_rtword_t *b; /* current word in buffer */
int bit; /* bit number in the word */
xfs_rtblock_t block; /* bitmap block number */
- xfs_buf_t *bp; /* buf for the block */
+ xfs_buf_t *bp; /* buf for the block */
xfs_rtword_t *bufp; /* starting word in buffer */
int error; /* error value */
xfs_rtblock_t i; /* current bit number rel. to start */
xfs_trans_t *tp, /* transaction pointer */
xfs_rtblock_t start, /* starting block to free */
xfs_extlen_t len, /* length to free */
- xfs_buf_t **rbpp, /* in/out: summary block buffer */
+ xfs_buf_t **rbpp, /* in/out: summary block buffer */
xfs_fsblock_t *rsb) /* in/out: summary block number */
{
xfs_rtblock_t end; /* end of the freed extent */
int log, /* log2 of extent size */
xfs_rtblock_t bbno, /* bitmap block number */
int delta, /* change to make to summary info */
- xfs_buf_t **rbpp, /* in/out: summary block buffer */
+ xfs_buf_t **rbpp, /* in/out: summary block buffer */
xfs_fsblock_t *rsb) /* in/out: summary block number */
{
- xfs_buf_t *bp; /* buffer for the summary block */
+ xfs_buf_t *bp; /* buffer for the summary block */
int error; /* error value */
xfs_fsblock_t sb; /* summary fsblock */
int so; /* index into the summary file */
xfs_inode_t *ip; /* bitmap file inode */
xfs_mount_t *mp; /* file system mount structure */
xfs_fsblock_t sb; /* summary file block number */
- xfs_buf_t *sumbp; /* summary file block buffer */
+ xfs_buf_t *sumbp; /* summary file block buffer */
mp = tp->t_mountp;
/*
*/
#include <libxfs.h>
+#include <xfs_acl.h>
+#include <xfs_cap.h>
+#include <xfs_mac.h>
#include "globals.h"
#include "err_protos.h"
#include "attr_repair.h"
* appropriate level, category association.
*/
switch (lp->ml_msen_type) {
- case MSEN_ADMIN_LABEL:
- case MSEN_EQUAL_LABEL:
- case MSEN_HIGH_LABEL:
- case MSEN_MLD_HIGH_LABEL:
- case MSEN_LOW_LABEL:
- case MSEN_MLD_LOW_LABEL:
+ case XFS_MSEN_ADMIN_LABEL:
+ case XFS_MSEN_EQUAL_LABEL:
+ case XFS_MSEN_HIGH_LABEL:
+ case XFS_MSEN_MLD_HIGH_LABEL:
+ case XFS_MSEN_LOW_LABEL:
+ case XFS_MSEN_MLD_LOW_LABEL:
if (lp->ml_level != 0 || lp->ml_catcount > 0 )
return (0);
break;
- case MSEN_TCSEC_LABEL:
- case MSEN_MLD_LABEL:
+ case XFS_MSEN_TCSEC_LABEL:
+ case XFS_MSEN_MLD_LABEL:
if (lp->ml_catcount > 0 &&
__check_setvalue(lp->ml_list,
lp->ml_catcount) == -1)
return (0);
break;
- case MSEN_UNKNOWN_LABEL:
+ case XFS_MSEN_UNKNOWN_LABEL:
default:
return (0);
}
* appropriate grade, division association.
*/
switch (lp->ml_mint_type) {
- case MINT_BIBA_LABEL:
+ case XFS_MINT_BIBA_LABEL:
if (lp->ml_divcount > 0 &&
__check_setvalue(lp->ml_list + lp->ml_catcount,
lp->ml_divcount) == -1)
return(0);
break;
- case MINT_EQUAL_LABEL:
- case MINT_HIGH_LABEL:
- case MINT_LOW_LABEL:
+ case XFS_MINT_EQUAL_LABEL:
+ case XFS_MINT_HIGH_LABEL:
+ case XFS_MINT_LOW_LABEL:
if (lp->ml_grade != 0 || lp->ml_divcount > 0 )
return(0);
break;