From 8c4a2bb003892342de819f298c7d3b4e6520dcd9 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Sun, 14 Oct 2001 07:09:57 +0000 Subject: [PATCH] add imap subdir, cleanup debian boorfloppies build process extras. --- Makefile | 4 +- VERSION | 2 +- debian/changelog | 7 +++ debian/rules | 33 +++++------- doc/CHANGES | 4 ++ imap/Makefile | 44 ++++++++++++++++ imap/xfs_imap.c | 96 ++++++++++++++++++++++++++++++++++ include/xfs_cred.h | 55 +++++++++++++++++--- include/xfs_fs.h | 119 +++++++++++++++++++++++-------------------- repair/attr_repair.h | 39 ++------------ 10 files changed, 282 insertions(+), 121 deletions(-) create mode 100644 imap/Makefile create mode 100644 imap/xfs_imap.c diff --git a/Makefile b/Makefile index e00ee9de7..55dde91c5 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,10 @@ CONFIGURE = configure include/builddefs include/platform_defs.h LSRCFILES = configure configure.in Makepkgs install-sh README VERSION LDIRT = config.log config.status config.cache confdefs.h conftest* \ - Logs/* built bfbuilt .census .bfcensus install.* install-dev.* *.gz + Logs/* install.* install-dev.* *.gz SUBDIRS = include libxfs libhandle libdisk \ - bmap db freeze fsck growfs logprint mkfile mkfs repair rtcp \ + bmap db freeze fsck growfs imap logprint mkfile mkfs repair rtcp \ man doc debian build default: $(CONFIGURE) diff --git a/VERSION b/VERSION index f970a4adb..10d9a8279 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=1 PKG_MINOR=3 -PKG_REVISION=9 +PKG_REVISION=10 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 27efcfb88..fe4815efb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +xfsprogs (1.3.10-0) unstable; urgency=low + + * New upstream release + * Fix up some issues building the bootfloppies package + + -- Nathan Scott Fri, 12 Oct 2001 17:43:20 +1000 + xfsprogs (1.3.9-0) unstable; urgency=low * Upstream bug fix release diff --git a/debian/rules b/debian/rules index f081dda0c..acf96678a 100755 --- a/debian/rules +++ b/debian/rules @@ -16,8 +16,8 @@ options = DEBUG=-DNDEBUG; DISTRIBUTION=debian; export DEBUG DISTRIBUTION; bfsopts = $(options) OPTIMIZER=-Os; export OPTIMIZER; checkdir = test -f debian/rules -build: bfbuilt built -built: config +build: built +built: bfbuild config @echo "== dpkg-buildpackage: build" 1>&2 $(MAKE) default touch built @@ -30,28 +30,21 @@ config: .census $(options) ./configure touch .census -bfbuilt: bfconfig - @echo "== dpkg-buildpackage: bootfloppies build" 1>&2 - for dir in libxfs libdisk mkfs; \ - do \ - $(MAKE) -C $$dir; \ - done - mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg) - $(MAKE) distclean - touch bfbuilt - -bfconfig: .bfcensus -.bfcensus: - @echo "== dpkg-buildpackage: bootfloppies configure" 1>&2 +bfbuild: $(checkdir) - autoconf - $(bfsopts) ./configure --enable-shared-uuid=yes - touch .bfcensus + @echo "== dpkg-buildpackage: bootfloppies" 1>&2 + if [ ! -f mkfs/mkfs.xfs-$(bootpkg) ]; then \ + autoconf; \ + $(bfsopts) ./configure --enable-shared-uuid=yes; \ + for dir in libxfs libdisk mkfs; do $(MAKE) -C $$dir; done; \ + mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \ + $(MAKE) distclean; \ + fi clean: @echo "== dpkg-buildpackage: clean" 1>&2 $(checkdir) - -rm -f bfbuilt built .bfcensus .census mkfs/mkfs.xfs-$(bootpkg) + -rm -f built .census mkfs/mkfs.xfs-$(bootpkg) $(MAKE) distclean -rm -rf $(dirtmp) $(dirdev) $(dirbfs) debian/*substvars debian/files* @@ -62,7 +55,7 @@ binary-indep: # Note2: absolute symlinks (required by policy) confuse debstd; # so we'll filter out symlink messages entirely now. # -binary-arch: checkroot bfbuilt built +binary-arch: checkroot built @echo "== dpkg-buildpackage: binary-arch" 1>&2 $(checkdir) -rm -rf $(dirtmp) $(dirdev) $(dirbfs) diff --git a/doc/CHANGES b/doc/CHANGES index 48ac0ab58..157ce5a9e 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,7 @@ +xfsprogs-1.3.10 (12 October 2001) + - sync with XFS kernel header changes for EAs by-handle + - ported xfs_imap command for dumping the inode map + xfsprogs-1.3.9 (03 October 2001) - fix xfs_repair bug in handling a corrupt root directory inode with multiple "lost+found" entries diff --git a/imap/Makefile b/imap/Makefile new file mode 100644 index 000000000..a0ecf4947 --- /dev/null +++ b/imap/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (c) 2000 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/ +# + +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +LTCOMMAND = xfs_imap +CFILES = xfs_imap.c + +default: $(LTCOMMAND) + +include $(BUILDRULES) + +install: +install-dev: diff --git a/imap/xfs_imap.c b/imap/xfs_imap.c new file mode 100644 index 000000000..56146e019 --- /dev/null +++ b/imap/xfs_imap.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2001 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/ + */ + +/* + * Inode map display utility for XFS. + */ + +#include +#include +#include + +int main(int argc, char **argv) +{ + int count; + int nent; + int fd; + int i; + char *name; + char *progname; + __s64 last = 0; + xfs_inogrp_t *t; + xfs_fsop_bulkreq_t bulkreq; + struct statfs buf; + + progname = basename(argv[0]); + + if (argc < 2) + name = "."; + else + name = argv[1]; + fd = open(name, O_RDONLY); + if (fd < 0) { + perror(name); + return 1; + } + fstatfs(fd, &buf); + if (buf.f_type != XFS_SUPER_MAGIC) { + fprintf(stderr, "%s: " + "specified file [\"%s\"] is not on an XFS filesystem\n", + progname, name); + exit(1); + } + + if (argc < 3) + nent = 1; + else + nent = atoi(argv[2]); + + t = malloc(nent * sizeof(*t)); + + bulkreq.lastip = &last; + bulkreq.icount = nent; + bulkreq.ubuffer = t; + bulkreq.ocount = &count; + + while (ioctl(fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) { + if (count == 0) + return 0; + for (i = 0; i < count; i++) { + printf("ino %10lld count %2d mask %016llx\n", + t[i].xi_startino, t[i].xi_alloccount, + t[i].xi_allocmask); + } + } + perror("ioctl(XFS_IOC_FSINUMBERS)"); + return 1; +} diff --git a/include/xfs_cred.h b/include/xfs_cred.h index 4a8d1e96b..6858393a4 100644 --- a/include/xfs_cred.h +++ b/include/xfs_cred.h @@ -39,6 +39,30 @@ #include #endif +/* + * Access Control Lists + */ +typedef ushort acl_perm_t; +typedef int acl_type_t; +typedef int acl_tag_t; + +#define ACL_MAX_ENTRIES 25 +#define ACL_NOT_PRESENT -1 + +typedef struct acl_entry { + acl_tag_t ae_tag; + uid_t ae_id; + acl_perm_t ae_perm; +} acl_entry_s; + +typedef struct acl { + int acl_cnt; + acl_entry_s acl_entry[ACL_MAX_ENTRIES]; +} acl_s; + +typedef struct acl_entry * acl_entry_t; +typedef struct acl * acl_t; + /* * Capabilities */ @@ -123,15 +147,32 @@ 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 01 -#define VWRITE 02 +#define VREAD 00400 +#define VWRITE 00200 +#define VEXEC 00100 +#define MACEXEC 00100 +#define MACWRITE 00200 +#define MACREAD 00400 #endif /* __KERNEL__ */ -#define MACWRITE 00200 -#define SGI_MAC_FILE "/dev/null" -#define SGI_MAC_FILE_SIZE 10 -#define SGI_CAP_FILE "/dev/null" -#define SGI_CAP_FILE_SIZE 10 + +/* 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_BI_FILE "SGI_BI_FILE" +#define SGI_BLS_FILE "SGI_BLS_FILE" +#define SGI_MAC_FILE "SGI_MAC_FILE" +#define SGI_BI_FILE_SIZE (sizeof(SGI_BI_FILE)-1) +#define SGI_BLS_FILE_SIZE (sizeof(SGI_BLS_FILE)-1) +#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 getbmapx - move fields from p1 to p2. */ - #define GETBMAP_CONVERT(p1,p2) { \ p2.bmv_offset = p1.bmv_offset; \ p2.bmv_block = p1.bmv_block; \ @@ -140,12 +140,6 @@ struct getbmapx { p2.bmv_count = p1.bmv_count; \ p2.bmv_entries = p1.bmv_entries; } -#ifdef __KERNEL__ - -/* Kernel only bmv_iflags value. */ -#define BMV_IF_EXTENDED 0x40000000 /* getpmapx if set */ - -#endif /* __KERNEL__ */ /* * Structure for XFS_IOC_FSSETDM. @@ -236,24 +230,18 @@ typedef struct xfs_fsop_resblks { #define XFS_MAX_LOG_BYTES (128 * 1024 * 1024) /* - * XFS_IOC_FSGROWFSDATA + * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT */ typedef struct xfs_growfs_data { __u64 newblocks; /* new data subvol size, fsblocks */ __u32 imaxpct; /* new inode space percentage limit */ } xfs_growfs_data_t; -/* - * XFS_IOC_FSGROWFSLOG - */ typedef struct xfs_growfs_log { __u32 newblocks; /* new log size, fsblocks */ __u32 isint; /* 1 if new log is internal */ } xfs_growfs_log_t; -/* - * XFS_IOC_FSGROWFSRT - */ typedef struct xfs_growfs_rt { __u64 newblocks; /* new realtime size, fsblocks */ __u32 extsize; /* new realtime extent size, fsblocks */ @@ -304,7 +292,7 @@ typedef struct xfs_fsop_bulkreq { /* - * Structures returned from xfs_inumbers syssgi routine. + * Structures returned from xfs_inumbers routine (XFS_IOC_FSINUMBERS). */ typedef struct xfs_inogrp { __u64 xi_startino; /* starting inode number */ @@ -313,6 +301,15 @@ typedef struct xfs_inogrp { } xfs_inogrp_t; +/* + * Error injection. + */ +typedef struct xfs_error_injection { + __s32 fd; + __s32 errtag; +} xfs_error_injection_t; + + /* * The user-level Handle Request interface structure. */ @@ -326,25 +323,47 @@ typedef struct xfs_fsop_handlereq { __u32 *ohandlen; /* user buffer length */ } xfs_fsop_handlereq_t; -/* - * Error injection can be turned on ethier by DEBUG or by INDUCE_IO_ERROR - * below since relying only on DEBUG will undoubtedly be a different - * code path. - */ -/*#define INDUCE_IO_ERROR*/ - -#if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) /* - * Error injection. + * Compound structures for passing args through Handle Request interfaces + * xfs_fssetdm_by_handle, xfs_attrlist_by_handle, xfs_attrmulti_by_handle + * - ioctls: XFS_IOC_FSSETDM_BY_HANDLE, XFS_IOC_ATTRLIST_BY_HANDLE, and + * XFS_IOC_ATTRMULTI_BY_HANDLE */ -typedef struct xfs_error_injection { - __s32 fd; - __s32 errtag; -} xfs_error_injection_t; -#endif /* DEBUG || INDUCE_IO_ERROR */ + +typedef struct xfs_fsop_setdm_handlereq { + struct xfs_fsop_handlereq hreq; /* handle interface structure */ + struct fsdmidata *data; /* DMAPI data to set */ +} xfs_fsop_setdm_handlereq_t; + +typedef struct xfs_attrlist_cursor { + __u32 opaque[4]; +} xfs_attrlist_cursor_t; + +typedef struct xfs_fsop_attrlist_handlereq { + struct xfs_fsop_handlereq hreq; /* handle interface structure */ + struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */ + __u32 flags; /* flags, use ROOT/USER names */ + __u32 buflen; /* length of buffer supplied */ + void *buffer; /* attrlist data to return */ +} xfs_fsop_attrlist_handlereq_t; + +typedef struct xfs_attr_multiop { + __u32 am_opcode; + __s32 am_error; + void *am_attrname; + void *am_attrvalue; + __u32 am_length; + __u32 am_flags; +} xfs_attr_multiop_t; + +typedef struct xfs_fsop_attrmulti_handlereq { + struct xfs_fsop_handlereq hreq; /* handle interface structure */ + __u32 opcount; /* count of following multiop */ + struct xfs_attr_multiop *ops; /* attr_multi data to get/set */ +} xfs_fsop_attrmulti_handlereq_t; /* - * Compound structure for passing args through ioctl to xfs_attrctl_by_handle + * 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 */ @@ -353,15 +372,6 @@ typedef struct xfs_fsop_attr_handlereq { int count; /* number of attribute ops */ } xfs_fsop_attr_handlereq_t; -/* - * Compound structure for passing args through ioctl to xfs_fssetdm_by_handle - */ -typedef struct xfs_fsop_setdm_handlereq { - struct xfs_fsop_handlereq hreq; /* handle request interface */ - /* structure */ - struct fsdmidata *data; /* DMAPI data to set */ -} xfs_fsop_setdm_handlereq_t; - /* * File system identifier. Should be unique (at least per machine). */ @@ -375,7 +385,6 @@ typedef struct { * "file handles". */ #define MAXFIDSZ 46 - typedef struct fid { __u16 fid_len; /* length of data in bytes */ unsigned char fid_data[MAXFIDSZ]; /* data (variable length) */ @@ -402,7 +411,6 @@ typedef struct xfs_handle { } ha_u; xfs_fid_t ha_fid; /* file system specific file ID */ } xfs_handle_t; - #define ha_fsid ha_u._ha_fsid #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \ @@ -457,19 +465,20 @@ typedef struct xfs_handle { #define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts) #define XFS_IOC_SET_RESBLKS _IOR ('X', 114, struct xfs_fsop_resblks) #define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks) -#if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) #define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection) #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection) -#endif /* DEBUG || INDUCE_IO_ERROR */ +/* 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 */ -#define XFS_IOC_GETFSUUID _IOR ('X', 140, unsigned char[16]) +#define XFS_IOC_GETFSUUID _IOR ('X', 140, unsigned char[16]) /* diff --git a/repair/attr_repair.h b/repair/attr_repair.h index 0bce68513..13e77ba1a 100644 --- a/repair/attr_repair.h +++ b/repair/attr_repair.h @@ -29,18 +29,9 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ - #ifndef _XR_ATTRREPAIR_H #define _XR_ATTRREPAIR_H -struct blkmap; - -#define SGI_ACL_FILE "SGI_ACL_FILE" -#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT" -#define SGI_ACL_FILE_SIZE 12 -#define SGI_ACL_DEFAULT_SIZE 15 - -#define ACL_MAX_ENTRIES 25 #define ACL_USER_OBJ 0x01 /* owner */ #define ACL_USER 0x02 /* additional users */ #define ACL_GROUP_OBJ 0x04 /* group */ @@ -48,32 +39,8 @@ struct blkmap; #define ACL_MASK 0x10 /* mask entry */ #define ACL_OTHER_OBJ 0x20 /* other entry */ -typedef ushort acl_perm_t; -typedef int acl_type_t; -typedef int acl_tag_t; - -/* - * On-disk representation of an ACL. - */ -struct acl_entry { - acl_tag_t ae_tag; - uid_t ae_id; - acl_perm_t ae_perm; -}; - -typedef struct acl_entry * acl_entry_t; - -struct acl { - int acl_cnt; /* Number of entries */ - struct acl_entry acl_entry[ACL_MAX_ENTRIES]; -}; - -int -process_attributes( - xfs_mount_t *mp, - xfs_ino_t ino, - xfs_dinode_t *dip, - struct blkmap *blkmap, - int *repair); +struct blkmap; +extern int process_attributes (xfs_mount_t *, xfs_ino_t, xfs_dinode_t *, + struct blkmap *, int *); #endif /* _XR_ATTRREPAIR_H */ -- 2.47.2