mkfs code, leftover from IRIX libdisk.
rationalise headers - we'd already included this header.
*/
#include <libxfs.h>
-#include <getopt.h>
#include "command.h"
#include "data.h"
#include "type.h"
#include <libxfs.h>
#include <math.h>
-#include <getopt.h>
#include <sys/time.h>
#include "bmap.h"
#include "check.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include "addr.h"
#include "agf.h"
#include "agfl.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include "bit.h"
#include "bmap.h"
#include "command.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include <ctype.h>
#include <time.h>
#include "type.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include <sys/time.h>
#include "bmap.h"
#include "command.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include "command.h"
#include "data.h"
#include "freesp.h"
*/
#include <libxfs.h>
-#include <getopt.h>
#include <signal.h>
#include "command.h"
#include "data.h"
user accounting with limit enforcement disabled. quotaon(8)
contains some examples of frequently used procedures.
- o Turning on quotas on the root filesystem is slightly different from
- the above. quotaon(8) must be used on the root XFS filesystem
- first; quotas will be turned on the next time the system is
- rebooted. It is useful to use repquota(8) with the -v option to
- monitor the effect of quotaon/off at various stages.
+ o Turning on quotas on the root filesystem is slightly different
+ from the above. In more recent versions of XFS, the quota mount
+ flags must be passed in with the "rootflags=" boot parameter.
+ In older versions of XFS and (quota-tools) quotaon(8) must be
+ used on the root XFS filesystem first; and quotas will be turned
+ on the next time the system is rebooted.
+
+ o It is useful to use repquota(8) with the -v option to monitor
+ the XFS quota state at various stages.
o quotacheck(8) has no effect on XFS filesystems. The first time
quota accounting is turned on, XFS does an automatic quotacheck
EXAMPLES
->>> Enabling quota enforcement on a non-root XFS filesystem
+>>> Enabling quota enforcement on an XFS filesystem
[root@troppo]# echo /dev/hdb10 /mnt/xqm xfs rw,usrquota 0 0 >>/etc/fstab
[root@troppo]# mount /mnt/xqm
A filesystem that has used user quota on IRIX, however, can be migrated
to Linux, and vice-versa, as the ondisk format is shared between both
versions of XFS (and Linux/XFS is "endian clean"). Group quota support
-is planned for a future release of IRIX, and the same level of ondisk
-compatibility will be available as for user quota, once this work has
-been completed.
+has been implemented only in more recent versions of IRIX 6.5f, and the
+same level of ondisk compatibility is now available as for user quota.
Have fun,
xfs_rtalloc.h xfs_sb.h xfs_trans.h xfs_trans_space.h xfs_types.h
LHFILES = xfs_acl.h xfs_cap.h xfs_mac.h
-DKHFILES = mountinfo.h volume.h fstyp.h dvh.h
+DKHFILES = volume.h fstyp.h dvh.h
LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules \
$(LHFILES) $(DKHFILES)
LDIRT = xfs
+++ /dev/null
-/*
- * Copyright (c) 2000-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/
- */
-#ifndef __MOUNTINFO_H__
-#define __MOUNTINFO_H__
-
-/*
- * mountinfo.h
- * Header for disk volume/partition check routines
- */
-
-#define MNT_CAUSE_NONE 0x00
-#define MNT_CAUSE_MOUNTED 0x01 /* partition already mounted */
-#define MNT_CAUSE_OVERLAP 0x02 /* partitions overlap */
-#define MNT_CAUSE_NODEV 0x04 /* no /dev/rdsk /dev/dsk entry */
-#define MNT_CAUSE_UNUSED 0x08 /* unallocated partition */
-#define MNT_CAUSE_MULTIMOUNT 0x10 /* multiple owners */
-#define MNT_CAUSE_LVOL_OWNED 0x20 /* owned by logical vol */
-#define MNT_CAUSE_XVM_MNT 0x40 /* mounted xvm subvolume */
-#define MNT_CAUSE_XVM_PART 0x80 /* xvm-owned partition */
-#define MNT_CAUSE__END 0x100 /* last entry */
-
-typedef struct mnt_check_state_s {
- /* currently unused, remains from IRIX */
-} mnt_check_state_t;
-
-/* prototypes */
-extern int mnt_check_init (mnt_check_state_t **);
-extern int mnt_find_mount_conflicts (mnt_check_state_t *, char *);
-extern int mnt_find_mounted_partitions (mnt_check_state_t *, char *);
-extern int mnt_causes_test (mnt_check_state_t *, int);
-extern void mnt_causes_show (mnt_check_state_t *, FILE *, char *);
-extern void mnt_plist_show (mnt_check_state_t *, FILE *, char *);
-extern int mnt_check_end (mnt_check_state_t *);
-
-#endif /* __MOUNTINFO_H__ */
LT_REVISION = 0
LT_AGE = 0
-CFILES = fstype.c pttype.c md.c xvm.c evms.c lvm.c drivers.c mountinfo.c
-HFILES = fstype.h pttype.h md.h xvm.h evms.h
+CFILES = drivers.c fstype.c pttype.c md.c xvm.c evms.c lvm.c
+HFILES = drivers.h fstype.h pttype.h md.h xvm.h evms.h
default: $(LTLIBRARY)
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <volume.h>
-
-extern int md_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
-extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
-extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
-extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+#include "drivers.h"
void
get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
char buf[64], puf[64];
int major = -1;
-#define PROC_DEVICES "/proc/devices"
- if ((f = fopen(PROC_DEVICES, "r")) == NULL)
+ if ((f = fopen("/proc/devices", "r")) == NULL)
return major;
while (fgets(buf, sizeof(buf), f)) /* skip to block dev section */
if (strncmp("Block devices:\n", buf, sizeof(buf)) == 0)
--- /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/
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <volume.h>
+
+/*
+ * This stuff is all very platform specific.
+ */
+
+#ifdef __linux__
+extern int md_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
+#else
+#define stat64 stat
+#define md_get_subvol_stripe(dev, type, a, b, stat) (-1)
+#define lvm_get_subvol_stripe(dev, type, a, b, stat) (-1)
+#define xvm_get_subvol_stripe(dev, type, a, b, stat) (-1)
+#define evms_get_subvol_stripe(dev, type, a, b, stat) (-1)
+#endif
+++ /dev/null
-/*
- * Copyright (c) 2000-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/
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <mntent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include "mountinfo.h"
-
-int
-mnt_check_init(mnt_check_state_t **check_state)
-{
- return(0);
-}
-
-int
-mnt_find_mount_conflicts(mnt_check_state_t *check_state, char *devname)
-{
-#define PROC_MOUNTED "/proc/mounts"
- int sts = 0;
- FILE *f;
- struct mntent *mnt;
- struct stat64 ns, ms;
- char mounts[MAXPATHLEN];
-
- if (stat64(devname, &ns) < 0)
- return sts;
-
- strcpy(mounts, access(PROC_MOUNTED, R_OK)? PROC_MOUNTED : MOUNTED);
- if ((f = setmntent(mounts, "r")) == NULL)
- return sts;
- while ((mnt = getmntent(f)) != NULL) {
- if (stat64(mnt->mnt_fsname, &ms) < 0)
- continue;
- if (S_ISBLK(ms.st_mode) && ns.st_rdev == ms.st_rdev)
- break;
- if (!S_ISBLK(ms.st_mode) && !strcmp(devname, mnt->mnt_fsname))
- break;
- }
- endmntent(f);
- if (mnt)
- sts = 1;
- return sts;
-}
-
-int
-mnt_find_mounted_partitions(mnt_check_state_t *check_state, char *devname)
-{
- return 0;
-}
-
-int
-mnt_causes_test(mnt_check_state_t *check_state, int cause)
-{
- switch(cause) {
- case MNT_CAUSE_MOUNTED:
- return(1);
-
- default:
- fprintf(stderr, "mnt_causes_test: unknown cause %d\n", cause);
- exit(99);
- }
-}
-
-void
-mnt_causes_show(mnt_check_state_t *check_state, FILE *fp, char *prefix)
-{
- fprintf(fp, "mnt_causes_show: not implemented. Called with %s\n",
- prefix);
- exit(98);
-}
-
-void
-mnt_plist_show(mnt_check_state_t *check_state, FILE *fp, char *prefix)
-{
- /*
- * Need to do some work for volume mgmt.
- */
-}
-
-int
-mnt_check_end(mnt_check_state_t *check_state)
-{
- return(0);
-}
#define blksize 512
-static __uint32_t
-twos_complement_32bit_sum(__uint32_t *base, int size)
+static u_int32_t
+twos_complement_32bit_sum(u_int32_t *base, int size)
{
int i;
- __uint32_t sum = 0;
+ u_int32_t sum = 0;
- size = size / sizeof(__uint32_t);
+ size = size / sizeof(u_int32_t);
for (i = 0; i < size; i++)
sum = sum - ntohl(base[i]);
return sum;
static int
sgi_parttable(char *base)
{
- __uint32_t csum;
+ u_int32_t csum;
struct volume_header *vh = (struct volume_header *)base;
if (ntohl(vh->vh_magic) != VHMAGIC)
return 0;
- csum = twos_complement_32bit_sum((__uint32_t *)vh,
+ csum = twos_complement_32bit_sum((u_int32_t *)vh,
sizeof(struct volume_header));
return !csum;
}
unsigned short nsect; /* Sectors per track */
unsigned char spare3[4]; /* Even more magic... */
struct sun_partition {
- __uint32_t start_cylinder;
- __uint32_t num_sectors;
+ u_int32_t start_cylinder;
+ u_int32_t num_sectors;
} partitions[8];
unsigned short magic; /* Magic number */
unsigned short csum; /* Label xor'd checksum */
\f3mkfs.xfs\f1 [ \f3\-b\f1 subopt=value ] [ \f3\-d\f1 subopt[=value] ]
[ \f3\-i\f1 subopt=value ] [ \f3\-l\f1 subopt[=value] ]
[ \f3\-n\f1 subopt[=value] ] [ \f3\-p\f1 protofile ] [ \f3\-q\f1 ]
- [ \f3\-r\f1 subopt[=value] ] [ \f3\-C\f1 ] [ \f3\-L\f1 label ] device
+ [ \f3\-r\f1 subopt[=value] ] [ \f3\-N\f1 ] [ \f3\-L\f1 label ] device
.fi
.SH DESCRIPTION
.I mkfs.xfs
.BR log= ,
or in bytes with
.BR size= .
-The default value is 4096 bytes (4 KB) on systems with a 4KB pagesize.
-The minimum value for block size is 512; the maximum is 65536 (64 KB).
+The default value is 4096 bytes (4 KB), the minimum is 512, and the
+maximum is 65536 (64 KB).
XFS on Linux currently only supports pagesize or smaller blocks.
.TP
.B \-d
filesystem should occupy
less space than the size of the partition or logical volume containing the section.
.TP
-.B \-C
-Disable overlapping partition/volume checks.
-.IP
-By default \f2mkfs.xfs\f1 checks to see if the destination partition or logical
-volume overlaps any mounted or reserved partitions in the system. If an
-overlap or mount conflict is found, the user will be notified and prevented
-from potentially corrupting the existing data. For systems with
-a large number of disks, this additional checking may add noticable overhead
-to the command's execution time. For situations where command performance is
-necessary, this switch may be used to disable the safeguards. Due to the
-potential for user-error causing corrupted filesystems or other on-disk
-data corruption, we strongly discourage use of this switch in normal operation.
-.TP
\f3\-L\f1 \f2label\f1
Set the filesystem label.
XFS filesystem labels can be at most 12 characters long; if
and
.IR xfs_admin (8)
manual entries for additional information.
+.TP
+.B \-N
+Causes the file system parameters to be printed out without really
+creating the file system.
.SH SEE ALSO
mkfs(8),
mount(8),
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include <libxfs.h>
#include <fstyp.h>
/*
*/
#include <libxfs.h>
+#include <sys/stat.h>
#include "proto.h"
/*
#include <fstyp.h>
#include <stdio.h>
#include <volume.h>
-#include <mountinfo.h>
#include <libxfs.h>
#include <ctype.h>
int dirblocklog;
int dirblocksize;
int dirversion;
- int do_overlap_checks;
char *dsize;
int dsu;
int dsw;
int lsu;
int lsunit;
int min_logblocks;
- mnt_check_state_t *mnt_check_state;
- int mnt_partition_count;
xfs_mount_t *mp;
xfs_mount_t mbuf;
xfs_extlen_t nbmblocks;
xfs_alloc_rec_t *nrec;
int nsflag;
int nvflag;
+ int Nflag;
char *p;
char *protofile;
char *protostring;
loginternal = 1;
logversion = 1;
logagno = logblocks = rtblocks = 0;
- nlflag = nsflag = nvflag = 0;
+ Nflag = nlflag = nsflag = nvflag = 0;
dirblocklog = dirblocksize = dirversion = 0;
qflag = 0;
imaxpct = inodelog = inopblock = isize = 0;
dsize = logsize = rtsize = rtextsize = protofile = NULL;
opterr = 0;
dsu = dsw = dsunit = dswidth = nodsflag = lalign = lsu = lsunit = 0;
- do_overlap_checks = 1;
extent_flagging = 0;
force_overwrite = 0;
worst_freelist = 0;
- while ((c = getopt(argc, argv, "b:d:i:l:L:n:p:qr:CfV")) != EOF) {
+ while ((c = getopt(argc, argv, "b:d:i:l:L:n:Np:qr:CfV")) != EOF) {
switch (c) {
case 'C':
- do_overlap_checks = 0;
- break;
case 'f':
force_overwrite = 1;
break;
reqval('d', dopts, D_AGCOUNT);
if (daflag)
respec('d', dopts, D_AGCOUNT);
- agcount = (__uint64_t)atoll(value);
+ agcount = (__uint64_t)
+ strtoul(value, NULL, 10);
if ((__int64_t)agcount <= 0)
illegal(value, "d agcount");
daflag = 1;
}
}
break;
+ case 'N':
+ Nflag = 1;
+ break;
case 'p':
if (protofile)
respec('p', 0, 0);
}
}
- if (!xi.disfile && do_overlap_checks) {
- /*
- * do partition overlap check
- * If this is a straight file we assume that it's been created
- * before the call to mnt_check_init()
- */
-
- if (mnt_check_init(&mnt_check_state) == -1) {
- fprintf(stderr,
- "unable to initialize mount checking "
- "routines, bypassing protection checks.\n");
- } else {
- mnt_partition_count = mnt_find_mount_conflicts(
- mnt_check_state, dfile);
-
- /*
- * ignore -1 return codes, since 3rd party devices
- * may not be part of hinv.
- */
- if (mnt_partition_count > 0) {
- if (mnt_causes_test(mnt_check_state, MNT_CAUSE_MOUNTED)) {
- fprintf(stderr, "%s: "
- "%s is already in use.\n",
- progname, dfile);
- } else if (mnt_causes_test(mnt_check_state, MNT_CAUSE_OVERLAP)) {
- fprintf(stderr, "%s: "
- "%s overlaps partition(s) "
- "already in use.\n",
- progname, dfile);
- } else {
- mnt_causes_show(mnt_check_state, stderr, progname);
- }
- fprintf(stderr, "\n");
- fflush(stderr);
- mnt_plist_show(mnt_check_state, stderr, progname);
- fprintf(stderr, "\n");
- }
- mnt_check_end(mnt_check_state);
- if (mnt_partition_count > 0) {
- usage();
- }
- }
- }
-
if (!liflag && !ldflag)
loginternal = xi.logdev == 0;
if (xi.logname)
XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, extent_flagging,
dirversion == 2, logversion == 2);
+ if (!qflag || Nflag) {
+ printf(
+ "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
+ "data =%-22s bsize=%-6d blocks=%lld, imaxpct=%d\n"
+ " =%-22s sunit=%-6d swidth=%d blks, unwritten=%d\n"
+ "naming =version %-14d bsize=%-6d\n"
+ "log =%-22s bsize=%-6d blocks=%lld, version=%d\n"
+ " =%-22s sunit=%d blks\n"
+ "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n",
+ dfile, isize, (long long)agcount, (long long)agsize,
+ "", blocksize, (long long)dblocks, sbp->sb_imax_pct,
+ "", dsunit, dswidth, extent_flagging,
+ dirversion, dirversion == 1 ? blocksize : dirblocksize,
+ logfile, 1 << blocklog, (long long)logblocks,
+ logversion, "", lsunit,
+ rtfile, rtextblocks << blocklog,
+ (long long)rtblocks, (long long)rtextents);
+ if (Nflag)
+ exit(0);
+ }
+
/*
* Zero out the first 68k in on the device, to obliterate any old
* filesystem signatures out there. This should take care of
XFS_SB_ALL_BITS);
libxfs_writebuf(buf, 1);
- if (!qflag)
- printf(
- "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
- "data =%-22s bsize=%-6d blocks=%lld, imaxpct=%d\n"
- " =%-22s sunit=%-6d swidth=%d blks, unwritten=%d\n"
- "naming =version %-14d bsize=%-6d\n"
- "log =%-22s bsize=%-6d blocks=%lld, version=%d\n"
- " =%-22s sunit=%d blks\n"
- "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n",
- dfile, isize, (long long)agcount, (long long)agsize,
- "", blocksize, (long long)dblocks, sbp->sb_imax_pct,
- "", dsunit, dswidth, extent_flagging,
- dirversion, dirversion == 1 ? blocksize : dirblocksize,
- logfile, 1 << blocklog, (long long)logblocks,
- logversion, "", lsunit,
- rtfile, rtextblocks << blocklog,
- (long long)rtblocks, (long long)rtextents);
/*
* If the data area is a file, then grow it out to its final size
* so that the reads for the end of the device in the mount code