]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - mkfs/xfs_mkfs.h
128068e8bb65bebf167fdfcc914f10d41eb75844
[thirdparty/xfsprogs-dev.git] / mkfs / xfs_mkfs.h
1 /*
2 * Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #ifndef __XFS_MKFS_H__
19 #define __XFS_MKFS_H__
20
21 #define XFS_DFL_SB_VERSION_BITS \
22 (XFS_SB_VERSION_NLINKBIT | \
23 XFS_SB_VERSION_EXTFLGBIT | \
24 XFS_SB_VERSION_DIRV2BIT)
25
26 #define XFS_SB_VERSION_MKFS(crc,ia,dia,log2,attr1,sflag,ci,more) (\
27 ((crc)||(ia)||(dia)||(log2)||(attr1)||(sflag)||(ci)||(more)) ? \
28 (((crc) ? XFS_SB_VERSION_5 : XFS_SB_VERSION_4) | \
29 ((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) | \
30 ((dia) ? XFS_SB_VERSION_DALIGNBIT : 0) | \
31 ((log2) ? XFS_SB_VERSION_LOGV2BIT : 0) | \
32 ((attr1) ? XFS_SB_VERSION_ATTRBIT : 0) | \
33 ((sflag) ? XFS_SB_VERSION_SECTORBIT : 0) | \
34 ((ci) ? XFS_SB_VERSION_BORGBIT : 0) | \
35 ((more) ? XFS_SB_VERSION_MOREBITSBIT : 0) | \
36 XFS_DFL_SB_VERSION_BITS | \
37 0 ) : XFS_SB_VERSION_1 )
38
39 #define XFS_SB_VERSION2_MKFS(crc, lazycount, attr2, projid32bit, parent, \
40 ftype) (\
41 ((lazycount) ? XFS_SB_VERSION2_LAZYSBCOUNTBIT : 0) | \
42 ((attr2) ? XFS_SB_VERSION2_ATTR2BIT : 0) | \
43 ((projid32bit) ? XFS_SB_VERSION2_PROJID32BIT : 0) | \
44 ((parent) ? XFS_SB_VERSION2_PARENTBIT : 0) | \
45 ((crc) ? XFS_SB_VERSION2_CRCBIT : 0) | \
46 ((ftype) ? XFS_SB_VERSION2_FTYPE : 0) | \
47 0 )
48
49 #define XFS_DFL_BLOCKSIZE_LOG 12 /* 4096 byte blocks */
50 #define XFS_DINODE_DFL_LOG 8 /* 256 byte inodes */
51 #define XFS_DINODE_DFL_CRC_LOG 9 /* 512 byte inodes for CRCs */
52 #define XFS_MIN_DATA_BLOCKS 100
53 #define XFS_MIN_INODE_PERBLOCK 2 /* min inodes per block */
54 #define XFS_DFL_IMAXIMUM_PCT 25 /* max % of space for inodes */
55 #define XFS_IFLAG_ALIGN 1 /* -i align defaults on */
56 #define XFS_MIN_REC_DIRSIZE 12 /* 4096 byte dirblocks (V2) */
57 #define XFS_DFL_DIR_VERSION 2 /* default directory version */
58 #define XFS_DFL_LOG_SIZE 1000 /* default log size, blocks */
59 #define XFS_DFL_LOG_FACTOR 5 /* default log size, factor */
60 /* with max trans reservation */
61 #define XFS_MAX_INODE_SIG_BITS 32 /* most significant bits in an
62 * inode number that we'll
63 * accept w/o warnings
64 */
65
66 #define XFS_AG_BYTES(bblog) ((long long)BBSIZE << (bblog))
67 #define XFS_AG_MIN_BYTES ((XFS_AG_BYTES(15))) /* 16 MB */
68 #define XFS_AG_MIN_BLOCKS(blog) ((XFS_AG_BYTES(15)) >> (blog))
69 #define XFS_AG_MAX_BLOCKS(blog) ((XFS_AG_BYTES(31) - 1) >> (blog))
70
71 #define XFS_MAX_AGNUMBER ((xfs_agnumber_t)(NULLAGNUMBER - 1))
72
73
74 /* xfs_mkfs.c */
75 extern int isdigits (char *str);
76 extern long long cvtnum (unsigned int blocksize,
77 unsigned int sectorsize, char *s);
78
79 /* proto.c */
80 extern char *setup_proto (char *fname);
81 extern void parse_proto (xfs_mount_t *mp, struct fsxattr *fsx, char **pp);
82 extern void res_failed (int err);
83
84 /* maxtrres.c */
85 extern int max_trans_res (int crcs_enabled, int dirversion,
86 int sectorlog, int blocklog, int inodelog, int dirblocklog,
87 int logversion, int log_sunit, int finobt);
88
89 #endif /* __XFS_MKFS_H__ */