Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * FS_IOC_FIEMAP ioctl infrastructure.
0004  *
0005  * Some portions copyright (C) 2007 Cluster File Systems, Inc
0006  *
0007  * Authors: Mark Fasheh <mfasheh@suse.com>
0008  *          Kalpak Shah <kalpak.shah@sun.com>
0009  *          Andreas Dilger <adilger@sun.com>
0010  */
0011 
0012 #ifndef _UAPI_LINUX_FIEMAP_H
0013 #define _UAPI_LINUX_FIEMAP_H
0014 
0015 #include <linux/types.h>
0016 
0017 struct fiemap_extent {
0018     __u64 fe_logical;  /* logical offset in bytes for the start of
0019                 * the extent from the beginning of the file */
0020     __u64 fe_physical; /* physical offset in bytes for the start
0021                 * of the extent from the beginning of the disk */
0022     __u64 fe_length;   /* length in bytes for this extent */
0023     __u64 fe_reserved64[2];
0024     __u32 fe_flags;    /* FIEMAP_EXTENT_* flags for this extent */
0025     __u32 fe_reserved[3];
0026 };
0027 
0028 struct fiemap {
0029     __u64 fm_start;     /* logical offset (inclusive) at
0030                  * which to start mapping (in) */
0031     __u64 fm_length;    /* logical length of mapping which
0032                  * userspace wants (in) */
0033     __u32 fm_flags;     /* FIEMAP_FLAG_* flags for request (in/out) */
0034     __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
0035     __u32 fm_extent_count;  /* size of fm_extents array (in) */
0036     __u32 fm_reserved;
0037     struct fiemap_extent fm_extents[]; /* array of mapped extents (out) */
0038 };
0039 
0040 #define FIEMAP_MAX_OFFSET   (~0ULL)
0041 
0042 #define FIEMAP_FLAG_SYNC    0x00000001 /* sync file data before map */
0043 #define FIEMAP_FLAG_XATTR   0x00000002 /* map extended attribute tree */
0044 #define FIEMAP_FLAG_CACHE   0x00000004 /* request caching of the extents */
0045 
0046 #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
0047 
0048 #define FIEMAP_EXTENT_LAST      0x00000001 /* Last extent in file. */
0049 #define FIEMAP_EXTENT_UNKNOWN       0x00000002 /* Data location unknown. */
0050 #define FIEMAP_EXTENT_DELALLOC      0x00000004 /* Location still pending.
0051                             * Sets EXTENT_UNKNOWN. */
0052 #define FIEMAP_EXTENT_ENCODED       0x00000008 /* Data can not be read
0053                             * while fs is unmounted */
0054 #define FIEMAP_EXTENT_DATA_ENCRYPTED    0x00000080 /* Data is encrypted by fs.
0055                             * Sets EXTENT_NO_BYPASS. */
0056 #define FIEMAP_EXTENT_NOT_ALIGNED   0x00000100 /* Extent offsets may not be
0057                             * block aligned. */
0058 #define FIEMAP_EXTENT_DATA_INLINE   0x00000200 /* Data mixed with metadata.
0059                             * Sets EXTENT_NOT_ALIGNED.*/
0060 #define FIEMAP_EXTENT_DATA_TAIL     0x00000400 /* Multiple files in block.
0061                             * Sets EXTENT_NOT_ALIGNED.*/
0062 #define FIEMAP_EXTENT_UNWRITTEN     0x00000800 /* Space allocated, but
0063                             * no data (i.e. zero). */
0064 #define FIEMAP_EXTENT_MERGED        0x00001000 /* File does not natively
0065                             * support extents. Result
0066                             * merged for efficiency. */
0067 #define FIEMAP_EXTENT_SHARED        0x00002000 /* Space shared with other
0068                             * files. */
0069 
0070 #endif /* _UAPI_LINUX_FIEMAP_H */