Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1 */
0002 /*
0003  * Copyright (c) 1995-2005 Silicon Graphics, Inc.
0004  * All Rights Reserved.
0005  */
0006 #ifndef __XFS_FS_H__
0007 #define __XFS_FS_H__
0008 
0009 /*
0010  * SGI's XFS filesystem's major stuff (constants, structures)
0011  */
0012 
0013 /*
0014  * Direct I/O attribute record used with XFS_IOC_DIOINFO
0015  * d_miniosz is the min xfer size, xfer size multiple and file seek offset
0016  * alignment.
0017  */
0018 #ifndef HAVE_DIOATTR
0019 struct dioattr {
0020     __u32       d_mem;      /* data buffer memory alignment */
0021     __u32       d_miniosz;  /* min xfer size        */
0022     __u32       d_maxiosz;  /* max xfer size        */
0023 };
0024 #endif
0025 
0026 /*
0027  * Structure for XFS_IOC_GETBMAP.
0028  * On input, fill in bmv_offset and bmv_length of the first structure
0029  * to indicate the area of interest in the file, and bmv_entries with
0030  * the number of array elements given back.  The first structure is
0031  * updated on return to give the offset and length for the next call.
0032  */
0033 #ifndef HAVE_GETBMAP
0034 struct getbmap {
0035     __s64       bmv_offset; /* file offset of segment in blocks */
0036     __s64       bmv_block;  /* starting block (64-bit daddr_t)  */
0037     __s64       bmv_length; /* length of segment, blocks        */
0038     __s32       bmv_count;  /* # of entries in array incl. 1st  */
0039     __s32       bmv_entries;    /* # of entries filled in (output)  */
0040 };
0041 #endif
0042 
0043 /*
0044  *  Structure for XFS_IOC_GETBMAPX.  Fields bmv_offset through bmv_entries
0045  *  are used exactly as in the getbmap structure.  The getbmapx structure
0046  *  has additional bmv_iflags and bmv_oflags fields. The bmv_iflags field
0047  *  is only used for the first structure.  It contains input flags
0048  *  specifying XFS_IOC_GETBMAPX actions.  The bmv_oflags field is filled
0049  *  in by the XFS_IOC_GETBMAPX command for each returned structure after
0050  *  the first.
0051  */
0052 #ifndef HAVE_GETBMAPX
0053 struct getbmapx {
0054     __s64       bmv_offset; /* file offset of segment in blocks */
0055     __s64       bmv_block;  /* starting block (64-bit daddr_t)  */
0056     __s64       bmv_length; /* length of segment, blocks        */
0057     __s32       bmv_count;  /* # of entries in array incl. 1st  */
0058     __s32       bmv_entries;    /* # of entries filled in (output). */
0059     __s32       bmv_iflags; /* input flags (1st structure)      */
0060     __s32       bmv_oflags; /* output flags (after 1st structure)*/
0061     __s32       bmv_unused1;    /* future use               */
0062     __s32       bmv_unused2;    /* future use               */
0063 };
0064 #endif
0065 
0066 /*  bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */
0067 #define BMV_IF_ATTRFORK     0x1 /* return attr fork rather than data */
0068 #define BMV_IF_NO_DMAPI_READ    0x2 /* Deprecated */
0069 #define BMV_IF_PREALLOC     0x4 /* rtn status BMV_OF_PREALLOC if req */
0070 #define BMV_IF_DELALLOC     0x8 /* rtn status BMV_OF_DELALLOC if req */
0071 #define BMV_IF_NO_HOLES     0x10    /* Do not return holes */
0072 #define BMV_IF_COWFORK      0x20    /* return CoW fork rather than data */
0073 #define BMV_IF_VALID    \
0074     (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC|  \
0075      BMV_IF_DELALLOC|BMV_IF_NO_HOLES|BMV_IF_COWFORK)
0076 
0077 /*  bmv_oflags values - returned for each non-header segment */
0078 #define BMV_OF_PREALLOC     0x1 /* segment = unwritten pre-allocation */
0079 #define BMV_OF_DELALLOC     0x2 /* segment = delayed allocation */
0080 #define BMV_OF_LAST     0x4 /* segment is the last in the file */
0081 #define BMV_OF_SHARED       0x8 /* segment shared with another file */
0082 
0083 /*  fmr_owner special values for FS_IOC_GETFSMAP */
0084 #define XFS_FMR_OWN_FREE    FMR_OWN_FREE      /* free space */
0085 #define XFS_FMR_OWN_UNKNOWN FMR_OWN_UNKNOWN   /* unknown owner */
0086 #define XFS_FMR_OWN_FS      FMR_OWNER('X', 1) /* static fs metadata */
0087 #define XFS_FMR_OWN_LOG     FMR_OWNER('X', 2) /* journalling log */
0088 #define XFS_FMR_OWN_AG      FMR_OWNER('X', 3) /* per-AG metadata */
0089 #define XFS_FMR_OWN_INOBT   FMR_OWNER('X', 4) /* inode btree blocks */
0090 #define XFS_FMR_OWN_INODES  FMR_OWNER('X', 5) /* inodes */
0091 #define XFS_FMR_OWN_REFC    FMR_OWNER('X', 6) /* refcount tree */
0092 #define XFS_FMR_OWN_COW     FMR_OWNER('X', 7) /* cow staging */
0093 #define XFS_FMR_OWN_DEFECTIVE   FMR_OWNER('X', 8) /* bad blocks */
0094 
0095 /*
0096  * File segment locking set data type for 64 bit access.
0097  * Also used for all the RESV/FREE interfaces.
0098  */
0099 typedef struct xfs_flock64 {
0100     __s16       l_type;
0101     __s16       l_whence;
0102     __s64       l_start;
0103     __s64       l_len;      /* len == 0 means until end of file */
0104     __s32       l_sysid;
0105     __u32       l_pid;
0106     __s32       l_pad[4];   /* reserve area             */
0107 } xfs_flock64_t;
0108 
0109 /*
0110  * Output for XFS_IOC_FSGEOMETRY_V1
0111  */
0112 struct xfs_fsop_geom_v1 {
0113     __u32       blocksize;  /* filesystem (data) block size */
0114     __u32       rtextsize;  /* realtime extent size     */
0115     __u32       agblocks;   /* fsblocks in an AG        */
0116     __u32       agcount;    /* number of allocation groups  */
0117     __u32       logblocks;  /* fsblocks in the log      */
0118     __u32       sectsize;   /* (data) sector size, bytes    */
0119     __u32       inodesize;  /* inode size in bytes      */
0120     __u32       imaxpct;    /* max allowed inode space(%)   */
0121     __u64       datablocks; /* fsblocks in data subvolume   */
0122     __u64       rtblocks;   /* fsblocks in realtime subvol  */
0123     __u64       rtextents;  /* rt extents in realtime subvol*/
0124     __u64       logstart;   /* starting fsblock of the log  */
0125     unsigned char   uuid[16];   /* unique id of the filesystem  */
0126     __u32       sunit;      /* stripe unit, fsblocks    */
0127     __u32       swidth;     /* stripe width, fsblocks   */
0128     __s32       version;    /* structure version        */
0129     __u32       flags;      /* superblock version flags */
0130     __u32       logsectsize;    /* log sector size, bytes   */
0131     __u32       rtsectsize; /* realtime sector size, bytes  */
0132     __u32       dirblocksize;   /* directory block size, bytes  */
0133 };
0134 
0135 /*
0136  * Output for XFS_IOC_FSGEOMETRY_V4
0137  */
0138 struct xfs_fsop_geom_v4 {
0139     __u32       blocksize;  /* filesystem (data) block size */
0140     __u32       rtextsize;  /* realtime extent size     */
0141     __u32       agblocks;   /* fsblocks in an AG        */
0142     __u32       agcount;    /* number of allocation groups  */
0143     __u32       logblocks;  /* fsblocks in the log      */
0144     __u32       sectsize;   /* (data) sector size, bytes    */
0145     __u32       inodesize;  /* inode size in bytes      */
0146     __u32       imaxpct;    /* max allowed inode space(%)   */
0147     __u64       datablocks; /* fsblocks in data subvolume   */
0148     __u64       rtblocks;   /* fsblocks in realtime subvol  */
0149     __u64       rtextents;  /* rt extents in realtime subvol*/
0150     __u64       logstart;   /* starting fsblock of the log  */
0151     unsigned char   uuid[16];   /* unique id of the filesystem  */
0152     __u32       sunit;      /* stripe unit, fsblocks    */
0153     __u32       swidth;     /* stripe width, fsblocks   */
0154     __s32       version;    /* structure version        */
0155     __u32       flags;      /* superblock version flags */
0156     __u32       logsectsize;    /* log sector size, bytes   */
0157     __u32       rtsectsize; /* realtime sector size, bytes  */
0158     __u32       dirblocksize;   /* directory block size, bytes  */
0159     __u32       logsunit;   /* log stripe unit, bytes   */
0160 };
0161 
0162 /*
0163  * Output for XFS_IOC_FSGEOMETRY
0164  */
0165 struct xfs_fsop_geom {
0166     __u32       blocksize;  /* filesystem (data) block size */
0167     __u32       rtextsize;  /* realtime extent size     */
0168     __u32       agblocks;   /* fsblocks in an AG        */
0169     __u32       agcount;    /* number of allocation groups  */
0170     __u32       logblocks;  /* fsblocks in the log      */
0171     __u32       sectsize;   /* (data) sector size, bytes    */
0172     __u32       inodesize;  /* inode size in bytes      */
0173     __u32       imaxpct;    /* max allowed inode space(%)   */
0174     __u64       datablocks; /* fsblocks in data subvolume   */
0175     __u64       rtblocks;   /* fsblocks in realtime subvol  */
0176     __u64       rtextents;  /* rt extents in realtime subvol*/
0177     __u64       logstart;   /* starting fsblock of the log  */
0178     unsigned char   uuid[16];   /* unique id of the filesystem  */
0179     __u32       sunit;      /* stripe unit, fsblocks    */
0180     __u32       swidth;     /* stripe width, fsblocks   */
0181     __s32       version;    /* structure version        */
0182     __u32       flags;      /* superblock version flags */
0183     __u32       logsectsize;    /* log sector size, bytes   */
0184     __u32       rtsectsize; /* realtime sector size, bytes  */
0185     __u32       dirblocksize;   /* directory block size, bytes  */
0186     __u32       logsunit;   /* log stripe unit, bytes   */
0187     uint32_t    sick;       /* o: unhealthy fs & rt metadata */
0188     uint32_t    checked;    /* o: checked fs & rt metadata  */
0189     __u64       reserved[17];   /* reserved space       */
0190 };
0191 
0192 #define XFS_FSOP_GEOM_SICK_COUNTERS (1 << 0)  /* summary counters */
0193 #define XFS_FSOP_GEOM_SICK_UQUOTA   (1 << 1)  /* user quota */
0194 #define XFS_FSOP_GEOM_SICK_GQUOTA   (1 << 2)  /* group quota */
0195 #define XFS_FSOP_GEOM_SICK_PQUOTA   (1 << 3)  /* project quota */
0196 #define XFS_FSOP_GEOM_SICK_RT_BITMAP    (1 << 4)  /* realtime bitmap */
0197 #define XFS_FSOP_GEOM_SICK_RT_SUMMARY   (1 << 5)  /* realtime summary */
0198 
0199 /* Output for XFS_FS_COUNTS */
0200 typedef struct xfs_fsop_counts {
0201     __u64   freedata;   /* free data section blocks */
0202     __u64   freertx;    /* free rt extents */
0203     __u64   freeino;    /* free inodes */
0204     __u64   allocino;   /* total allocated inodes */
0205 } xfs_fsop_counts_t;
0206 
0207 /* Input/Output for XFS_GET_RESBLKS and XFS_SET_RESBLKS */
0208 typedef struct xfs_fsop_resblks {
0209     __u64  resblks;
0210     __u64  resblks_avail;
0211 } xfs_fsop_resblks_t;
0212 
0213 #define XFS_FSOP_GEOM_VERSION       0
0214 #define XFS_FSOP_GEOM_VERSION_V5    5
0215 
0216 #define XFS_FSOP_GEOM_FLAGS_ATTR    (1 << 0)  /* attributes in use     */
0217 #define XFS_FSOP_GEOM_FLAGS_NLINK   (1 << 1)  /* 32-bit nlink values   */
0218 #define XFS_FSOP_GEOM_FLAGS_QUOTA   (1 << 2)  /* quotas enabled    */
0219 #define XFS_FSOP_GEOM_FLAGS_IALIGN  (1 << 3)  /* inode alignment       */
0220 #define XFS_FSOP_GEOM_FLAGS_DALIGN  (1 << 4)  /* large data alignment  */
0221 #define XFS_FSOP_GEOM_FLAGS_SHARED  (1 << 5)  /* read-only shared      */
0222 #define XFS_FSOP_GEOM_FLAGS_EXTFLG  (1 << 6)  /* special extent flag   */
0223 #define XFS_FSOP_GEOM_FLAGS_DIRV2   (1 << 7)  /* directory version 2   */
0224 #define XFS_FSOP_GEOM_FLAGS_LOGV2   (1 << 8)  /* log format version 2  */
0225 #define XFS_FSOP_GEOM_FLAGS_SECTOR  (1 << 9)  /* sector sizes >1BB     */
0226 #define XFS_FSOP_GEOM_FLAGS_ATTR2   (1 << 10) /* inline attributes rework */
0227 #define XFS_FSOP_GEOM_FLAGS_PROJID32    (1 << 11) /* 32-bit project IDs    */
0228 #define XFS_FSOP_GEOM_FLAGS_DIRV2CI (1 << 12) /* ASCII only CI names   */
0229     /*  -- Do not use --        (1 << 13)    SGI parent pointers   */
0230 #define XFS_FSOP_GEOM_FLAGS_LAZYSB  (1 << 14) /* lazy superblock counters */
0231 #define XFS_FSOP_GEOM_FLAGS_V5SB    (1 << 15) /* version 5 superblock  */
0232 #define XFS_FSOP_GEOM_FLAGS_FTYPE   (1 << 16) /* inode directory types */
0233 #define XFS_FSOP_GEOM_FLAGS_FINOBT  (1 << 17) /* free inode btree      */
0234 #define XFS_FSOP_GEOM_FLAGS_SPINODES    (1 << 18) /* sparse inode chunks   */
0235 #define XFS_FSOP_GEOM_FLAGS_RMAPBT  (1 << 19) /* reverse mapping btree */
0236 #define XFS_FSOP_GEOM_FLAGS_REFLINK (1 << 20) /* files can share blocks */
0237 #define XFS_FSOP_GEOM_FLAGS_BIGTIME (1 << 21) /* 64-bit nsec timestamps */
0238 #define XFS_FSOP_GEOM_FLAGS_INOBTCNT    (1 << 22) /* inobt btree counter */
0239 #define XFS_FSOP_GEOM_FLAGS_NREXT64 (1 << 23) /* large extent counters */
0240 
0241 /*
0242  * Minimum and maximum sizes need for growth checks.
0243  *
0244  * Block counts are in units of filesystem blocks, not basic blocks.
0245  */
0246 #define XFS_MIN_AG_BLOCKS   64
0247 #define XFS_MIN_LOG_BLOCKS  512ULL
0248 #define XFS_MAX_LOG_BLOCKS  (1024 * 1024ULL)
0249 #define XFS_MIN_LOG_BYTES   (10 * 1024 * 1024ULL)
0250 
0251 /*
0252  * Limits on sb_agblocks/sb_agblklog -- mkfs won't format AGs smaller than
0253  * 16MB or larger than 1TB.
0254  */
0255 #define XFS_MIN_AG_BYTES    (1ULL << 24)    /* 16 MB */
0256 #define XFS_MAX_AG_BYTES    (1ULL << 40)    /* 1 TB */
0257 #define XFS_MAX_AG_BLOCKS   (XFS_MAX_AG_BYTES / XFS_MIN_BLOCKSIZE)
0258 #define XFS_MAX_CRC_AG_BLOCKS   (XFS_MAX_AG_BYTES / XFS_MIN_CRC_BLOCKSIZE)
0259 
0260 /* keep the maximum size under 2^31 by a small amount */
0261 #define XFS_MAX_LOG_BYTES \
0262     ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES)
0263 
0264 /* Used for sanity checks on superblock */
0265 #define XFS_MAX_DBLOCKS(s) ((xfs_rfsblock_t)(s)->sb_agcount * (s)->sb_agblocks)
0266 #define XFS_MIN_DBLOCKS(s) ((xfs_rfsblock_t)((s)->sb_agcount - 1) * \
0267              (s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
0268 
0269 /*
0270  * Output for XFS_IOC_AG_GEOMETRY
0271  */
0272 struct xfs_ag_geometry {
0273     uint32_t    ag_number;  /* i/o: AG number */
0274     uint32_t    ag_length;  /* o: length in blocks */
0275     uint32_t    ag_freeblks;    /* o: free space */
0276     uint32_t    ag_icount;  /* o: inodes allocated */
0277     uint32_t    ag_ifree;   /* o: inodes free */
0278     uint32_t    ag_sick;    /* o: sick things in ag */
0279     uint32_t    ag_checked; /* o: checked metadata in ag */
0280     uint32_t    ag_flags;   /* i/o: flags for this ag */
0281     uint64_t    ag_reserved[12];/* o: zero */
0282 };
0283 #define XFS_AG_GEOM_SICK_SB (1 << 0)  /* superblock */
0284 #define XFS_AG_GEOM_SICK_AGF    (1 << 1)  /* AGF header */
0285 #define XFS_AG_GEOM_SICK_AGFL   (1 << 2)  /* AGFL header */
0286 #define XFS_AG_GEOM_SICK_AGI    (1 << 3)  /* AGI header */
0287 #define XFS_AG_GEOM_SICK_BNOBT  (1 << 4)  /* free space by block */
0288 #define XFS_AG_GEOM_SICK_CNTBT  (1 << 5)  /* free space by length */
0289 #define XFS_AG_GEOM_SICK_INOBT  (1 << 6)  /* inode index */
0290 #define XFS_AG_GEOM_SICK_FINOBT (1 << 7)  /* free inode index */
0291 #define XFS_AG_GEOM_SICK_RMAPBT (1 << 8)  /* reverse mappings */
0292 #define XFS_AG_GEOM_SICK_REFCNTBT (1 << 9)  /* reference counts */
0293 
0294 /*
0295  * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT
0296  */
0297 typedef struct xfs_growfs_data {
0298     __u64       newblocks;  /* new data subvol size, fsblocks */
0299     __u32       imaxpct;    /* new inode space percentage limit */
0300 } xfs_growfs_data_t;
0301 
0302 typedef struct xfs_growfs_log {
0303     __u32       newblocks;  /* new log size, fsblocks */
0304     __u32       isint;      /* 1 if new log is internal */
0305 } xfs_growfs_log_t;
0306 
0307 typedef struct xfs_growfs_rt {
0308     __u64       newblocks;  /* new realtime size, fsblocks */
0309     __u32       extsize;    /* new realtime extent size, fsblocks */
0310 } xfs_growfs_rt_t;
0311 
0312 
0313 /*
0314  * Structures returned from ioctl XFS_IOC_FSBULKSTAT & XFS_IOC_FSBULKSTAT_SINGLE
0315  */
0316 typedef struct xfs_bstime {
0317     __kernel_long_t tv_sec;     /* seconds      */
0318     __s32       tv_nsec;    /* and nanoseconds  */
0319 } xfs_bstime_t;
0320 
0321 struct xfs_bstat {
0322     __u64       bs_ino;     /* inode number         */
0323     __u16       bs_mode;    /* type and mode        */
0324     __u16       bs_nlink;   /* number of links      */
0325     __u32       bs_uid;     /* user id          */
0326     __u32       bs_gid;     /* group id         */
0327     __u32       bs_rdev;    /* device value         */
0328     __s32       bs_blksize; /* block size           */
0329     __s64       bs_size;    /* file size            */
0330     xfs_bstime_t    bs_atime;   /* access time          */
0331     xfs_bstime_t    bs_mtime;   /* modify time          */
0332     xfs_bstime_t    bs_ctime;   /* inode change time        */
0333     int64_t     bs_blocks;  /* number of blocks     */
0334     __u32       bs_xflags;  /* extended flags       */
0335     __s32       bs_extsize; /* extent size          */
0336     __s32       bs_extents; /* number of extents        */
0337     __u32       bs_gen;     /* generation count     */
0338     __u16       bs_projid_lo;   /* lower part of project id */
0339 #define bs_projid   bs_projid_lo    /* (previously just bs_projid)  */
0340     __u16       bs_forkoff; /* inode fork offset in bytes   */
0341     __u16       bs_projid_hi;   /* higher part of project id    */
0342     uint16_t    bs_sick;    /* sick inode metadata      */
0343     uint16_t    bs_checked; /* checked inode metadata   */
0344     unsigned char   bs_pad[2];  /* pad space, unused        */
0345     __u32       bs_cowextsize;  /* cow extent size      */
0346     __u32       bs_dmevmask;    /* DMIG event mask      */
0347     __u16       bs_dmstate; /* DMIG state info      */
0348     __u16       bs_aextents;    /* attribute number of extents  */
0349 };
0350 
0351 /* New bulkstat structure that reports v5 features and fixes padding issues */
0352 struct xfs_bulkstat {
0353     uint64_t    bs_ino;     /* inode number         */
0354     uint64_t    bs_size;    /* file size            */
0355 
0356     uint64_t    bs_blocks;  /* number of blocks     */
0357     uint64_t    bs_xflags;  /* extended flags       */
0358 
0359     int64_t     bs_atime;   /* access time, seconds     */
0360     int64_t     bs_mtime;   /* modify time, seconds     */
0361 
0362     int64_t     bs_ctime;   /* inode change time, seconds   */
0363     int64_t     bs_btime;   /* creation time, seconds   */
0364 
0365     uint32_t    bs_gen;     /* generation count     */
0366     uint32_t    bs_uid;     /* user id          */
0367     uint32_t    bs_gid;     /* group id         */
0368     uint32_t    bs_projectid;   /* project id           */
0369 
0370     uint32_t    bs_atime_nsec;  /* access time, nanoseconds */
0371     uint32_t    bs_mtime_nsec;  /* modify time, nanoseconds */
0372     uint32_t    bs_ctime_nsec;  /* inode change time, nanoseconds */
0373     uint32_t    bs_btime_nsec;  /* creation time, nanoseconds   */
0374 
0375     uint32_t    bs_blksize; /* block size           */
0376     uint32_t    bs_rdev;    /* device value         */
0377     uint32_t    bs_cowextsize_blks; /* cow extent size hint, blocks */
0378     uint32_t    bs_extsize_blks; /* extent size hint, blocks    */
0379 
0380     uint32_t    bs_nlink;   /* number of links      */
0381     uint32_t    bs_extents; /* 32-bit data fork extent counter */
0382     uint32_t    bs_aextents;    /* attribute number of extents  */
0383     uint16_t    bs_version; /* structure version        */
0384     uint16_t    bs_forkoff; /* inode fork offset in bytes   */
0385 
0386     uint16_t    bs_sick;    /* sick inode metadata      */
0387     uint16_t    bs_checked; /* checked inode metadata   */
0388     uint16_t    bs_mode;    /* type and mode        */
0389     uint16_t    bs_pad2;    /* zeroed           */
0390     uint64_t    bs_extents64;   /* 64-bit data fork extent counter */
0391 
0392     uint64_t    bs_pad[6];  /* zeroed           */
0393 };
0394 
0395 #define XFS_BULKSTAT_VERSION_V1 (1)
0396 #define XFS_BULKSTAT_VERSION_V5 (5)
0397 
0398 /* bs_sick flags */
0399 #define XFS_BS_SICK_INODE   (1 << 0)  /* inode core */
0400 #define XFS_BS_SICK_BMBTD   (1 << 1)  /* data fork */
0401 #define XFS_BS_SICK_BMBTA   (1 << 2)  /* attr fork */
0402 #define XFS_BS_SICK_BMBTC   (1 << 3)  /* cow fork */
0403 #define XFS_BS_SICK_DIR     (1 << 4)  /* directory */
0404 #define XFS_BS_SICK_XATTR   (1 << 5)  /* extended attributes */
0405 #define XFS_BS_SICK_SYMLINK (1 << 6)  /* symbolic link remote target */
0406 #define XFS_BS_SICK_PARENT  (1 << 7)  /* parent pointers */
0407 
0408 /*
0409  * Project quota id helpers (previously projid was 16bit only
0410  * and using two 16bit values to hold new 32bit projid was chosen
0411  * to retain compatibility with "old" filesystems).
0412  */
0413 static inline uint32_t
0414 bstat_get_projid(const struct xfs_bstat *bs)
0415 {
0416     return (uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
0417 }
0418 
0419 /*
0420  * The user-level BulkStat Request interface structure.
0421  */
0422 struct xfs_fsop_bulkreq {
0423     __u64       __user *lastip; /* last inode # pointer     */
0424     __s32       icount;     /* count of entries in buffer   */
0425     void        __user *ubuffer;/* user buffer for inode desc.  */
0426     __s32       __user *ocount; /* output count pointer     */
0427 };
0428 
0429 /*
0430  * Structures returned from xfs_inumbers routine (XFS_IOC_FSINUMBERS).
0431  */
0432 struct xfs_inogrp {
0433     __u64       xi_startino;    /* starting inode number    */
0434     __s32       xi_alloccount;  /* # bits set in allocmask  */
0435     __u64       xi_allocmask;   /* mask of allocated inodes */
0436 };
0437 
0438 /* New inumbers structure that reports v5 features and fixes padding issues */
0439 struct xfs_inumbers {
0440     uint64_t    xi_startino;    /* starting inode number    */
0441     uint64_t    xi_allocmask;   /* mask of allocated inodes */
0442     uint8_t     xi_alloccount;  /* # bits set in allocmask  */
0443     uint8_t     xi_version; /* version          */
0444     uint8_t     xi_padding[6];  /* zero             */
0445 };
0446 
0447 #define XFS_INUMBERS_VERSION_V1 (1)
0448 #define XFS_INUMBERS_VERSION_V5 (5)
0449 
0450 /* Header for bulk inode requests. */
0451 struct xfs_bulk_ireq {
0452     uint64_t    ino;        /* I/O: start with this inode   */
0453     uint32_t    flags;      /* I/O: operation flags     */
0454     uint32_t    icount;     /* I: count of entries in buffer */
0455     uint32_t    ocount;     /* O: count of entries filled out */
0456     uint32_t    agno;       /* I: see comment for IREQ_AGNO */
0457     uint64_t    reserved[5];    /* must be zero         */
0458 };
0459 
0460 /*
0461  * Only return results from the specified @agno.  If @ino is zero, start
0462  * with the first inode of @agno.
0463  */
0464 #define XFS_BULK_IREQ_AGNO  (1U << 0)
0465 
0466 /*
0467  * Return bulkstat information for a single inode, where @ino value is a
0468  * special value, not a literal inode number.  See the XFS_BULK_IREQ_SPECIAL_*
0469  * values below.  Not compatible with XFS_BULK_IREQ_AGNO.
0470  */
0471 #define XFS_BULK_IREQ_SPECIAL   (1U << 1)
0472 
0473 /*
0474  * Return data fork extent count via xfs_bulkstat->bs_extents64 field and assign
0475  * 0 to xfs_bulkstat->bs_extents when the flag is set.  Otherwise, use
0476  * xfs_bulkstat->bs_extents for returning data fork extent count and set
0477  * xfs_bulkstat->bs_extents64 to 0. In the second case, return -EOVERFLOW and
0478  * assign 0 to xfs_bulkstat->bs_extents if data fork extent count is larger than
0479  * XFS_MAX_EXTCNT_DATA_FORK_OLD.
0480  */
0481 #define XFS_BULK_IREQ_NREXT64   (1U << 2)
0482 
0483 #define XFS_BULK_IREQ_FLAGS_ALL (XFS_BULK_IREQ_AGNO |    \
0484                  XFS_BULK_IREQ_SPECIAL | \
0485                  XFS_BULK_IREQ_NREXT64)
0486 
0487 /* Operate on the root directory inode. */
0488 #define XFS_BULK_IREQ_SPECIAL_ROOT  (1)
0489 
0490 /*
0491  * ioctl structures for v5 bulkstat and inumbers requests
0492  */
0493 struct xfs_bulkstat_req {
0494     struct xfs_bulk_ireq    hdr;
0495     struct xfs_bulkstat bulkstat[];
0496 };
0497 #define XFS_BULKSTAT_REQ_SIZE(nr)   (sizeof(struct xfs_bulkstat_req) + \
0498                      (nr) * sizeof(struct xfs_bulkstat))
0499 
0500 struct xfs_inumbers_req {
0501     struct xfs_bulk_ireq    hdr;
0502     struct xfs_inumbers inumbers[];
0503 };
0504 #define XFS_INUMBERS_REQ_SIZE(nr)   (sizeof(struct xfs_inumbers_req) + \
0505                      (nr) * sizeof(struct xfs_inumbers))
0506 
0507 /*
0508  * Error injection.
0509  */
0510 typedef struct xfs_error_injection {
0511     __s32       fd;
0512     __s32       errtag;
0513 } xfs_error_injection_t;
0514 
0515 
0516 /*
0517  * Speculative preallocation trimming.
0518  */
0519 #define XFS_EOFBLOCKS_VERSION       1
0520 struct xfs_fs_eofblocks {
0521     __u32       eof_version;
0522     __u32       eof_flags;
0523     uid_t       eof_uid;
0524     gid_t       eof_gid;
0525     prid_t      eof_prid;
0526     __u32       pad32;
0527     __u64       eof_min_file_size;
0528     __u64       pad64[12];
0529 };
0530 
0531 /* eof_flags values */
0532 #define XFS_EOF_FLAGS_SYNC      (1 << 0) /* sync/wait mode scan */
0533 #define XFS_EOF_FLAGS_UID       (1 << 1) /* filter by uid */
0534 #define XFS_EOF_FLAGS_GID       (1 << 2) /* filter by gid */
0535 #define XFS_EOF_FLAGS_PRID      (1 << 3) /* filter by project id */
0536 #define XFS_EOF_FLAGS_MINFILESIZE   (1 << 4) /* filter by min file size */
0537 #define XFS_EOF_FLAGS_UNION     (1 << 5) /* union filter algorithm;
0538                           * kernel only, not included in
0539                           * valid mask */
0540 #define XFS_EOF_FLAGS_VALID \
0541     (XFS_EOF_FLAGS_SYNC |   \
0542      XFS_EOF_FLAGS_UID |    \
0543      XFS_EOF_FLAGS_GID |    \
0544      XFS_EOF_FLAGS_PRID |   \
0545      XFS_EOF_FLAGS_MINFILESIZE)
0546 
0547 
0548 /*
0549  * The user-level Handle Request interface structure.
0550  */
0551 typedef struct xfs_fsop_handlereq {
0552     __u32       fd;     /* fd for FD_TO_HANDLE      */
0553     void        __user *path;   /* user pathname        */
0554     __u32       oflags;     /* open flags           */
0555     void        __user *ihandle;/* user supplied handle     */
0556     __u32       ihandlen;   /* user supplied length     */
0557     void        __user *ohandle;/* user buffer for handle   */
0558     __u32       __user *ohandlen;/* user buffer length      */
0559 } xfs_fsop_handlereq_t;
0560 
0561 /*
0562  * Compound structures for passing args through Handle Request interfaces
0563  * xfs_attrlist_by_handle, xfs_attrmulti_by_handle
0564  * - ioctls: XFS_IOC_ATTRLIST_BY_HANDLE, and XFS_IOC_ATTRMULTI_BY_HANDLE
0565  */
0566 
0567 /*
0568  * Flags passed in xfs_attr_multiop.am_flags for the attr ioctl interface.
0569  *
0570  * NOTE: Must match the values declared in libattr without the XFS_IOC_ prefix.
0571  */
0572 #define XFS_IOC_ATTR_ROOT   0x0002  /* use attrs in root namespace */
0573 #define XFS_IOC_ATTR_SECURE 0x0008  /* use attrs in security namespace */
0574 #define XFS_IOC_ATTR_CREATE 0x0010  /* fail if attr already exists */
0575 #define XFS_IOC_ATTR_REPLACE    0x0020  /* fail if attr does not exist */
0576 
0577 typedef struct xfs_attrlist_cursor {
0578     __u32       opaque[4];
0579 } xfs_attrlist_cursor_t;
0580 
0581 /*
0582  * Define how lists of attribute names are returned to userspace from the
0583  * XFS_IOC_ATTRLIST_BY_HANDLE ioctl.  struct xfs_attrlist is the header at the
0584  * beginning of the returned buffer, and a each entry in al_offset contains the
0585  * relative offset of an xfs_attrlist_ent containing the actual entry.
0586  *
0587  * NOTE: struct xfs_attrlist must match struct attrlist defined in libattr, and
0588  * struct xfs_attrlist_ent must match struct attrlist_ent defined in libattr.
0589  */
0590 struct xfs_attrlist {
0591     __s32   al_count;   /* number of entries in attrlist */
0592     __s32   al_more;    /* T/F: more attrs (do call again) */
0593     __s32   al_offset[1];   /* byte offsets of attrs [var-sized] */
0594 };
0595 
0596 struct xfs_attrlist_ent {   /* data from attr_list() */
0597     __u32   a_valuelen; /* number bytes in value of attr */
0598     char    a_name[1];  /* attr name (NULL terminated) */
0599 };
0600 
0601 typedef struct xfs_fsop_attrlist_handlereq {
0602     struct xfs_fsop_handlereq   hreq; /* handle interface structure */
0603     struct xfs_attrlist_cursor  pos; /* opaque cookie, list offset */
0604     __u32               flags;  /* which namespace to use */
0605     __u32               buflen; /* length of buffer supplied */
0606     void                __user *buffer; /* returned names */
0607 } xfs_fsop_attrlist_handlereq_t;
0608 
0609 typedef struct xfs_attr_multiop {
0610     __u32       am_opcode;
0611 #define ATTR_OP_GET 1   /* return the indicated attr's value */
0612 #define ATTR_OP_SET 2   /* set/create the indicated attr/value pair */
0613 #define ATTR_OP_REMOVE  3   /* remove the indicated attr */
0614     __s32       am_error;
0615     void        __user *am_attrname;
0616     void        __user *am_attrvalue;
0617     __u32       am_length;
0618     __u32       am_flags; /* XFS_IOC_ATTR_* */
0619 } xfs_attr_multiop_t;
0620 
0621 typedef struct xfs_fsop_attrmulti_handlereq {
0622     struct xfs_fsop_handlereq   hreq; /* handle interface structure */
0623     __u32               opcount;/* count of following multiop */
0624     struct xfs_attr_multiop     __user *ops; /* attr_multi data */
0625 } xfs_fsop_attrmulti_handlereq_t;
0626 
0627 /*
0628  * per machine unique filesystem identifier types.
0629  */
0630 typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */
0631 
0632 typedef struct xfs_fid {
0633     __u16   fid_len;        /* length of remainder  */
0634     __u16   fid_pad;
0635     __u32   fid_gen;        /* generation number    */
0636     __u64   fid_ino;        /* 64 bits inode number */
0637 } xfs_fid_t;
0638 
0639 typedef struct xfs_handle {
0640     union {
0641         __s64       align;  /* force alignment of ha_fid     */
0642         xfs_fsid_t  _ha_fsid;   /* unique file system identifier */
0643     } ha_u;
0644     xfs_fid_t   ha_fid;     /* file system specific file ID  */
0645 } xfs_handle_t;
0646 #define ha_fsid ha_u._ha_fsid
0647 
0648 /*
0649  * Structure passed to XFS_IOC_SWAPEXT
0650  */
0651 typedef struct xfs_swapext
0652 {
0653     int64_t     sx_version; /* version */
0654 #define XFS_SX_VERSION      0
0655     int64_t     sx_fdtarget;    /* fd of target file */
0656     int64_t     sx_fdtmp;   /* fd of tmp file */
0657     xfs_off_t   sx_offset;  /* offset into file */
0658     xfs_off_t   sx_length;  /* leng from offset */
0659     char        sx_pad[16]; /* pad space, unused */
0660     struct xfs_bstat sx_stat;   /* stat of target b4 copy */
0661 } xfs_swapext_t;
0662 
0663 /*
0664  * Flags for going down operation
0665  */
0666 #define XFS_FSOP_GOING_FLAGS_DEFAULT        0x0 /* going down */
0667 #define XFS_FSOP_GOING_FLAGS_LOGFLUSH       0x1 /* flush log but not data */
0668 #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH     0x2 /* don't flush log nor data */
0669 
0670 /* metadata scrubbing */
0671 struct xfs_scrub_metadata {
0672     __u32 sm_type;      /* What to check? */
0673     __u32 sm_flags;     /* flags; see below. */
0674     __u64 sm_ino;       /* inode number. */
0675     __u32 sm_gen;       /* inode generation. */
0676     __u32 sm_agno;      /* ag number. */
0677     __u64 sm_reserved[5];   /* pad to 64 bytes */
0678 };
0679 
0680 /*
0681  * Metadata types and flags for scrub operation.
0682  */
0683 
0684 /* Scrub subcommands. */
0685 #define XFS_SCRUB_TYPE_PROBE    0   /* presence test ioctl */
0686 #define XFS_SCRUB_TYPE_SB   1   /* superblock */
0687 #define XFS_SCRUB_TYPE_AGF  2   /* AG free header */
0688 #define XFS_SCRUB_TYPE_AGFL 3   /* AG free list */
0689 #define XFS_SCRUB_TYPE_AGI  4   /* AG inode header */
0690 #define XFS_SCRUB_TYPE_BNOBT    5   /* freesp by block btree */
0691 #define XFS_SCRUB_TYPE_CNTBT    6   /* freesp by length btree */
0692 #define XFS_SCRUB_TYPE_INOBT    7   /* inode btree */
0693 #define XFS_SCRUB_TYPE_FINOBT   8   /* free inode btree */
0694 #define XFS_SCRUB_TYPE_RMAPBT   9   /* reverse mapping btree */
0695 #define XFS_SCRUB_TYPE_REFCNTBT 10  /* reference count btree */
0696 #define XFS_SCRUB_TYPE_INODE    11  /* inode record */
0697 #define XFS_SCRUB_TYPE_BMBTD    12  /* data fork block mapping */
0698 #define XFS_SCRUB_TYPE_BMBTA    13  /* attr fork block mapping */
0699 #define XFS_SCRUB_TYPE_BMBTC    14  /* CoW fork block mapping */
0700 #define XFS_SCRUB_TYPE_DIR  15  /* directory */
0701 #define XFS_SCRUB_TYPE_XATTR    16  /* extended attribute */
0702 #define XFS_SCRUB_TYPE_SYMLINK  17  /* symbolic link */
0703 #define XFS_SCRUB_TYPE_PARENT   18  /* parent pointers */
0704 #define XFS_SCRUB_TYPE_RTBITMAP 19  /* realtime bitmap */
0705 #define XFS_SCRUB_TYPE_RTSUM    20  /* realtime summary */
0706 #define XFS_SCRUB_TYPE_UQUOTA   21  /* user quotas */
0707 #define XFS_SCRUB_TYPE_GQUOTA   22  /* group quotas */
0708 #define XFS_SCRUB_TYPE_PQUOTA   23  /* project quotas */
0709 #define XFS_SCRUB_TYPE_FSCOUNTERS 24    /* fs summary counters */
0710 
0711 /* Number of scrub subcommands. */
0712 #define XFS_SCRUB_TYPE_NR   25
0713 
0714 /* i: Repair this metadata. */
0715 #define XFS_SCRUB_IFLAG_REPAIR      (1u << 0)
0716 
0717 /* o: Metadata object needs repair. */
0718 #define XFS_SCRUB_OFLAG_CORRUPT     (1u << 1)
0719 
0720 /*
0721  * o: Metadata object could be optimized.  It's not corrupt, but
0722  *    we could improve on it somehow.
0723  */
0724 #define XFS_SCRUB_OFLAG_PREEN       (1u << 2)
0725 
0726 /* o: Cross-referencing failed. */
0727 #define XFS_SCRUB_OFLAG_XFAIL       (1u << 3)
0728 
0729 /* o: Metadata object disagrees with cross-referenced metadata. */
0730 #define XFS_SCRUB_OFLAG_XCORRUPT    (1u << 4)
0731 
0732 /* o: Scan was not complete. */
0733 #define XFS_SCRUB_OFLAG_INCOMPLETE  (1u << 5)
0734 
0735 /* o: Metadata object looked funny but isn't corrupt. */
0736 #define XFS_SCRUB_OFLAG_WARNING     (1u << 6)
0737 
0738 /*
0739  * o: IFLAG_REPAIR was set but metadata object did not need fixing or
0740  *    optimization and has therefore not been altered.
0741  */
0742 #define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1u << 7)
0743 
0744 #define XFS_SCRUB_FLAGS_IN  (XFS_SCRUB_IFLAG_REPAIR)
0745 #define XFS_SCRUB_FLAGS_OUT (XFS_SCRUB_OFLAG_CORRUPT | \
0746                  XFS_SCRUB_OFLAG_PREEN | \
0747                  XFS_SCRUB_OFLAG_XFAIL | \
0748                  XFS_SCRUB_OFLAG_XCORRUPT | \
0749                  XFS_SCRUB_OFLAG_INCOMPLETE | \
0750                  XFS_SCRUB_OFLAG_WARNING | \
0751                  XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED)
0752 #define XFS_SCRUB_FLAGS_ALL (XFS_SCRUB_FLAGS_IN | XFS_SCRUB_FLAGS_OUT)
0753 
0754 /*
0755  * ioctl limits
0756  */
0757 #ifdef XATTR_LIST_MAX
0758 #  define XFS_XATTR_LIST_MAX XATTR_LIST_MAX
0759 #else
0760 #  define XFS_XATTR_LIST_MAX 65536
0761 #endif
0762 
0763 
0764 /*
0765  * ioctl commands that are used by Linux filesystems
0766  */
0767 #define XFS_IOC_GETXFLAGS   FS_IOC_GETFLAGS
0768 #define XFS_IOC_SETXFLAGS   FS_IOC_SETFLAGS
0769 #define XFS_IOC_GETVERSION  FS_IOC_GETVERSION
0770 
0771 /*
0772  * ioctl commands that replace IRIX fcntl()'s
0773  * For 'documentation' purposed more than anything else,
0774  * the "cmd #" field reflects the IRIX fcntl number.
0775  */
0776 /*  XFS_IOC_ALLOCSP ------- deprecated 10    */
0777 /*  XFS_IOC_FREESP -------- deprecated 11    */
0778 #define XFS_IOC_DIOINFO     _IOR ('X', 30, struct dioattr)
0779 #define XFS_IOC_FSGETXATTR  FS_IOC_FSGETXATTR
0780 #define XFS_IOC_FSSETXATTR  FS_IOC_FSSETXATTR
0781 /*  XFS_IOC_ALLOCSP64 ----- deprecated 36    */
0782 /*  XFS_IOC_FREESP64 ------ deprecated 37    */
0783 #define XFS_IOC_GETBMAP     _IOWR('X', 38, struct getbmap)
0784 /*      XFS_IOC_FSSETDM ------- deprecated 39    */
0785 #define XFS_IOC_RESVSP      _IOW ('X', 40, struct xfs_flock64)
0786 #define XFS_IOC_UNRESVSP    _IOW ('X', 41, struct xfs_flock64)
0787 #define XFS_IOC_RESVSP64    _IOW ('X', 42, struct xfs_flock64)
0788 #define XFS_IOC_UNRESVSP64  _IOW ('X', 43, struct xfs_flock64)
0789 #define XFS_IOC_GETBMAPA    _IOWR('X', 44, struct getbmap)
0790 #define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr)
0791 /*  XFS_IOC_SETBIOSIZE ---- deprecated 46      */
0792 /*  XFS_IOC_GETBIOSIZE ---- deprecated 47      */
0793 #define XFS_IOC_GETBMAPX    _IOWR('X', 56, struct getbmap)
0794 #define XFS_IOC_ZERO_RANGE  _IOW ('X', 57, struct xfs_flock64)
0795 #define XFS_IOC_FREE_EOFBLOCKS  _IOR ('X', 58, struct xfs_fs_eofblocks)
0796 /*  XFS_IOC_GETFSMAP ------ hoisted 59         */
0797 #define XFS_IOC_SCRUB_METADATA  _IOWR('X', 60, struct xfs_scrub_metadata)
0798 #define XFS_IOC_AG_GEOMETRY _IOWR('X', 61, struct xfs_ag_geometry)
0799 
0800 /*
0801  * ioctl commands that replace IRIX syssgi()'s
0802  */
0803 #define XFS_IOC_FSGEOMETRY_V1        _IOR ('X', 100, struct xfs_fsop_geom_v1)
0804 #define XFS_IOC_FSBULKSTAT       _IOWR('X', 101, struct xfs_fsop_bulkreq)
0805 #define XFS_IOC_FSBULKSTAT_SINGLE    _IOWR('X', 102, struct xfs_fsop_bulkreq)
0806 #define XFS_IOC_FSINUMBERS       _IOWR('X', 103, struct xfs_fsop_bulkreq)
0807 #define XFS_IOC_PATH_TO_FSHANDLE     _IOWR('X', 104, struct xfs_fsop_handlereq)
0808 #define XFS_IOC_PATH_TO_HANDLE       _IOWR('X', 105, struct xfs_fsop_handlereq)
0809 #define XFS_IOC_FD_TO_HANDLE         _IOWR('X', 106, struct xfs_fsop_handlereq)
0810 #define XFS_IOC_OPEN_BY_HANDLE       _IOWR('X', 107, struct xfs_fsop_handlereq)
0811 #define XFS_IOC_READLINK_BY_HANDLE   _IOWR('X', 108, struct xfs_fsop_handlereq)
0812 #define XFS_IOC_SWAPEXT          _IOWR('X', 109, struct xfs_swapext)
0813 #define XFS_IOC_FSGROWFSDATA         _IOW ('X', 110, struct xfs_growfs_data)
0814 #define XFS_IOC_FSGROWFSLOG      _IOW ('X', 111, struct xfs_growfs_log)
0815 #define XFS_IOC_FSGROWFSRT       _IOW ('X', 112, struct xfs_growfs_rt)
0816 #define XFS_IOC_FSCOUNTS         _IOR ('X', 113, struct xfs_fsop_counts)
0817 #define XFS_IOC_SET_RESBLKS      _IOWR('X', 114, struct xfs_fsop_resblks)
0818 #define XFS_IOC_GET_RESBLKS      _IOR ('X', 115, struct xfs_fsop_resblks)
0819 #define XFS_IOC_ERROR_INJECTION      _IOW ('X', 116, struct xfs_error_injection)
0820 #define XFS_IOC_ERROR_CLEARALL       _IOW ('X', 117, struct xfs_error_injection)
0821 /*  XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118  */
0822 
0823 #define XFS_IOC_FREEZE           _IOWR('X', 119, int)   /* aka FIFREEZE */
0824 #define XFS_IOC_THAW             _IOWR('X', 120, int)   /* aka FITHAW */
0825 
0826 /*      XFS_IOC_FSSETDM_BY_HANDLE -- deprecated 121      */
0827 #define XFS_IOC_ATTRLIST_BY_HANDLE   _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
0828 #define XFS_IOC_ATTRMULTI_BY_HANDLE  _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
0829 #define XFS_IOC_FSGEOMETRY_V4        _IOR ('X', 124, struct xfs_fsop_geom_v4)
0830 #define XFS_IOC_GOINGDOWN        _IOR ('X', 125, uint32_t)
0831 #define XFS_IOC_FSGEOMETRY       _IOR ('X', 126, struct xfs_fsop_geom)
0832 #define XFS_IOC_BULKSTAT         _IOR ('X', 127, struct xfs_bulkstat_req)
0833 #define XFS_IOC_INUMBERS         _IOR ('X', 128, struct xfs_inumbers_req)
0834 /*  XFS_IOC_GETFSUUID ---------- deprecated 140  */
0835 
0836 
0837 #ifndef HAVE_BBMACROS
0838 /*
0839  * Block I/O parameterization.  A basic block (BB) is the lowest size of
0840  * filesystem allocation, and must equal 512.  Length units given to bio
0841  * routines are in BB's.
0842  */
0843 #define BBSHIFT     9
0844 #define BBSIZE      (1<<BBSHIFT)
0845 #define BBMASK      (BBSIZE-1)
0846 #define BTOBB(bytes)    (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
0847 #define BTOBBT(bytes)   ((__u64)(bytes) >> BBSHIFT)
0848 #define BBTOB(bbs)  ((bbs) << BBSHIFT)
0849 #endif
0850 
0851 #endif  /* __XFS_FS_H__ */