1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* !! 2 /* -*- mode: c; c-basic-offset: 8; -*- >> 3 * vim: noexpandtab sw=8 ts=8 sts=0: >> 4 * 3 * ocfs2_ioctl.h 5 * ocfs2_ioctl.h 4 * 6 * 5 * Defines OCFS2 ioctls. 7 * Defines OCFS2 ioctls. 6 * 8 * 7 * Copyright (C) 2010 Oracle. All rights rese 9 * Copyright (C) 2010 Oracle. All rights reserved. 8 */ 10 */ 9 11 10 #ifndef OCFS2_IOCTL_H 12 #ifndef OCFS2_IOCTL_H 11 #define OCFS2_IOCTL_H 13 #define OCFS2_IOCTL_H >> 14 >> 15 /* >> 16 * ioctl commands >> 17 */ >> 18 #define OCFS2_IOC_GETFLAGS FS_IOC_GETFLAGS >> 19 #define OCFS2_IOC_SETFLAGS FS_IOC_SETFLAGS >> 20 #define OCFS2_IOC32_GETFLAGS FS_IOC32_GETFLAGS >> 21 #define OCFS2_IOC32_SETFLAGS FS_IOC32_SETFLAGS 12 22 13 /* 23 /* 14 * Space reservation / allocation / free ioctl 24 * Space reservation / allocation / free ioctls and argument structure 15 * are designed to be compatible with XFS. 25 * are designed to be compatible with XFS. 16 * 26 * 17 * ALLOCSP* and FREESP* are not and will never 27 * ALLOCSP* and FREESP* are not and will never be supported, but are 18 * included here for completeness. 28 * included here for completeness. 19 */ 29 */ 20 struct ocfs2_space_resv { 30 struct ocfs2_space_resv { 21 __s16 l_type; 31 __s16 l_type; 22 __s16 l_whence; 32 __s16 l_whence; 23 __s64 l_start; 33 __s64 l_start; 24 __s64 l_len; /* len 34 __s64 l_len; /* len == 0 means until end of file */ 25 __s32 l_sysid; 35 __s32 l_sysid; 26 __u32 l_pid; 36 __u32 l_pid; 27 __s32 l_pad[4]; /* res 37 __s32 l_pad[4]; /* reserve area */ 28 }; 38 }; 29 39 30 #define OCFS2_IOC_ALLOCSP _IOW ( 40 #define OCFS2_IOC_ALLOCSP _IOW ('X', 10, struct ocfs2_space_resv) 31 #define OCFS2_IOC_FREESP _IOW ( 41 #define OCFS2_IOC_FREESP _IOW ('X', 11, struct ocfs2_space_resv) 32 #define OCFS2_IOC_RESVSP _IOW ( 42 #define OCFS2_IOC_RESVSP _IOW ('X', 40, struct ocfs2_space_resv) 33 #define OCFS2_IOC_UNRESVSP _IOW ('X', 41, 43 #define OCFS2_IOC_UNRESVSP _IOW ('X', 41, struct ocfs2_space_resv) 34 #define OCFS2_IOC_ALLOCSP64 _IOW ('X', 36, 44 #define OCFS2_IOC_ALLOCSP64 _IOW ('X', 36, struct ocfs2_space_resv) 35 #define OCFS2_IOC_FREESP64 _IOW ('X', 37, 45 #define OCFS2_IOC_FREESP64 _IOW ('X', 37, struct ocfs2_space_resv) 36 #define OCFS2_IOC_RESVSP64 _IOW ('X', 42, 46 #define OCFS2_IOC_RESVSP64 _IOW ('X', 42, struct ocfs2_space_resv) 37 #define OCFS2_IOC_UNRESVSP64 _IOW ('X', 43, 47 #define OCFS2_IOC_UNRESVSP64 _IOW ('X', 43, struct ocfs2_space_resv) 38 48 39 /* Used to pass group descriptor data when onl 49 /* Used to pass group descriptor data when online resize is done */ 40 struct ocfs2_new_group_input { 50 struct ocfs2_new_group_input { 41 __u64 group; /* Group descr 51 __u64 group; /* Group descriptor's blkno. */ 42 __u32 clusters; /* Total numbe 52 __u32 clusters; /* Total number of clusters in this group */ 43 __u32 frees; /* Total free 53 __u32 frees; /* Total free clusters in this group */ 44 __u16 chain; /* Chain for t 54 __u16 chain; /* Chain for this group */ 45 __u16 reserved1; 55 __u16 reserved1; 46 __u32 reserved2; 56 __u32 reserved2; 47 }; 57 }; 48 58 49 #define OCFS2_IOC_GROUP_EXTEND _IOW('o', 1, i 59 #define OCFS2_IOC_GROUP_EXTEND _IOW('o', 1, int) 50 #define OCFS2_IOC_GROUP_ADD _IOW('o', 2,st 60 #define OCFS2_IOC_GROUP_ADD _IOW('o', 2,struct ocfs2_new_group_input) 51 #define OCFS2_IOC_GROUP_ADD64 _IOW('o', 3,st 61 #define OCFS2_IOC_GROUP_ADD64 _IOW('o', 3,struct ocfs2_new_group_input) 52 62 53 /* Used to pass 2 file names to reflink. */ 63 /* Used to pass 2 file names to reflink. */ 54 struct reflink_arguments { 64 struct reflink_arguments { 55 __u64 old_path; 65 __u64 old_path; 56 __u64 new_path; 66 __u64 new_path; 57 __u64 preserve; 67 __u64 preserve; 58 }; 68 }; 59 #define OCFS2_IOC_REFLINK _IOW('o', 4, s 69 #define OCFS2_IOC_REFLINK _IOW('o', 4, struct reflink_arguments) 60 70 61 /* Following definitions dedicated for ocfs2_i 71 /* Following definitions dedicated for ocfs2_info_request ioctls. */ 62 #define OCFS2_INFO_MAX_REQUEST (50) 72 #define OCFS2_INFO_MAX_REQUEST (50) 63 #define OCFS2_TEXT_UUID_LEN (OCFS2 73 #define OCFS2_TEXT_UUID_LEN (OCFS2_VOL_UUID_LEN * 2) 64 74 65 /* Magic number of all requests */ 75 /* Magic number of all requests */ 66 #define OCFS2_INFO_MAGIC (0x4F3 76 #define OCFS2_INFO_MAGIC (0x4F32494E) 67 77 68 /* 78 /* 69 * Always try to separate info request into sm 79 * Always try to separate info request into small pieces to 70 * guarantee the backward&forward compatibilit 80 * guarantee the backward&forward compatibility. 71 */ 81 */ 72 struct ocfs2_info { 82 struct ocfs2_info { 73 __u64 oi_requests; /* Array of __ 83 __u64 oi_requests; /* Array of __u64 pointers to requests */ 74 __u32 oi_count; /* Number of r 84 __u32 oi_count; /* Number of requests in info_requests */ 75 __u32 oi_pad; 85 __u32 oi_pad; 76 }; 86 }; 77 87 78 struct ocfs2_info_request { 88 struct ocfs2_info_request { 79 /*00*/ __u32 ir_magic; /* Magic number */ 89 /*00*/ __u32 ir_magic; /* Magic number */ 80 __u32 ir_code; /* Info request code * 90 __u32 ir_code; /* Info request code */ 81 __u32 ir_size; /* Size of request */ 91 __u32 ir_size; /* Size of request */ 82 __u32 ir_flags; /* Request flags */ 92 __u32 ir_flags; /* Request flags */ 83 /*10*/ /* Request specific fi 93 /*10*/ /* Request specific fields */ 84 }; 94 }; 85 95 86 struct ocfs2_info_clustersize { 96 struct ocfs2_info_clustersize { 87 struct ocfs2_info_request ic_req; 97 struct ocfs2_info_request ic_req; 88 __u32 ic_clustersize; 98 __u32 ic_clustersize; 89 __u32 ic_pad; 99 __u32 ic_pad; 90 }; 100 }; 91 101 92 struct ocfs2_info_blocksize { 102 struct ocfs2_info_blocksize { 93 struct ocfs2_info_request ib_req; 103 struct ocfs2_info_request ib_req; 94 __u32 ib_blocksize; 104 __u32 ib_blocksize; 95 __u32 ib_pad; 105 __u32 ib_pad; 96 }; 106 }; 97 107 98 struct ocfs2_info_maxslots { 108 struct ocfs2_info_maxslots { 99 struct ocfs2_info_request im_req; 109 struct ocfs2_info_request im_req; 100 __u32 im_max_slots; 110 __u32 im_max_slots; 101 __u32 im_pad; 111 __u32 im_pad; 102 }; 112 }; 103 113 104 struct ocfs2_info_label { 114 struct ocfs2_info_label { 105 struct ocfs2_info_request il_req; 115 struct ocfs2_info_request il_req; 106 __u8 il_label[OCFS2_MAX_VOL_LABEL_L 116 __u8 il_label[OCFS2_MAX_VOL_LABEL_LEN]; 107 } __attribute__ ((packed)); 117 } __attribute__ ((packed)); 108 118 109 struct ocfs2_info_uuid { 119 struct ocfs2_info_uuid { 110 struct ocfs2_info_request iu_req; 120 struct ocfs2_info_request iu_req; 111 __u8 iu_uuid_str[OCFS2_TEXT_UUID_LE 121 __u8 iu_uuid_str[OCFS2_TEXT_UUID_LEN + 1]; 112 } __attribute__ ((packed)); 122 } __attribute__ ((packed)); 113 123 114 struct ocfs2_info_fs_features { 124 struct ocfs2_info_fs_features { 115 struct ocfs2_info_request if_req; 125 struct ocfs2_info_request if_req; 116 __u32 if_compat_features; 126 __u32 if_compat_features; 117 __u32 if_incompat_features; 127 __u32 if_incompat_features; 118 __u32 if_ro_compat_features; 128 __u32 if_ro_compat_features; 119 __u32 if_pad; 129 __u32 if_pad; 120 }; 130 }; 121 131 122 struct ocfs2_info_journal_size { 132 struct ocfs2_info_journal_size { 123 struct ocfs2_info_request ij_req; 133 struct ocfs2_info_request ij_req; 124 __u64 ij_journal_size; 134 __u64 ij_journal_size; 125 }; 135 }; 126 136 127 struct ocfs2_info_freeinode { 137 struct ocfs2_info_freeinode { 128 struct ocfs2_info_request ifi_req; 138 struct ocfs2_info_request ifi_req; 129 struct ocfs2_info_local_freeinode { 139 struct ocfs2_info_local_freeinode { 130 __u64 lfi_total; 140 __u64 lfi_total; 131 __u64 lfi_free; 141 __u64 lfi_free; 132 } ifi_stat[OCFS2_MAX_SLOTS]; 142 } ifi_stat[OCFS2_MAX_SLOTS]; 133 __u32 ifi_slotnum; /* out */ 143 __u32 ifi_slotnum; /* out */ 134 __u32 ifi_pad; 144 __u32 ifi_pad; 135 }; 145 }; 136 146 137 #define OCFS2_INFO_MAX_HIST (32) 147 #define OCFS2_INFO_MAX_HIST (32) 138 148 139 struct ocfs2_info_freefrag { 149 struct ocfs2_info_freefrag { 140 struct ocfs2_info_request iff_req; 150 struct ocfs2_info_request iff_req; 141 struct ocfs2_info_freefrag_stats { /* 151 struct ocfs2_info_freefrag_stats { /* (out) */ 142 struct ocfs2_info_free_chunk_l 152 struct ocfs2_info_free_chunk_list { 143 __u32 fc_chunks[OCFS2_ 153 __u32 fc_chunks[OCFS2_INFO_MAX_HIST]; 144 __u32 fc_clusters[OCFS 154 __u32 fc_clusters[OCFS2_INFO_MAX_HIST]; 145 } ffs_fc_hist; 155 } ffs_fc_hist; 146 __u32 ffs_clusters; 156 __u32 ffs_clusters; 147 __u32 ffs_free_clusters; 157 __u32 ffs_free_clusters; 148 __u32 ffs_free_chunks; 158 __u32 ffs_free_chunks; 149 __u32 ffs_free_chunks_real; 159 __u32 ffs_free_chunks_real; 150 __u32 ffs_min; /* Minimum free 160 __u32 ffs_min; /* Minimum free chunksize in clusters */ 151 __u32 ffs_max; 161 __u32 ffs_max; 152 __u32 ffs_avg; 162 __u32 ffs_avg; 153 __u32 ffs_pad; 163 __u32 ffs_pad; 154 } iff_ffs; 164 } iff_ffs; 155 __u32 iff_chunksize; /* chunksize in c 165 __u32 iff_chunksize; /* chunksize in clusters(in) */ 156 __u32 iff_pad; 166 __u32 iff_pad; 157 }; 167 }; 158 168 159 /* Codes for ocfs2_info_request */ 169 /* Codes for ocfs2_info_request */ 160 enum ocfs2_info_type { 170 enum ocfs2_info_type { 161 OCFS2_INFO_CLUSTERSIZE = 1, 171 OCFS2_INFO_CLUSTERSIZE = 1, 162 OCFS2_INFO_BLOCKSIZE, 172 OCFS2_INFO_BLOCKSIZE, 163 OCFS2_INFO_MAXSLOTS, 173 OCFS2_INFO_MAXSLOTS, 164 OCFS2_INFO_LABEL, 174 OCFS2_INFO_LABEL, 165 OCFS2_INFO_UUID, 175 OCFS2_INFO_UUID, 166 OCFS2_INFO_FS_FEATURES, 176 OCFS2_INFO_FS_FEATURES, 167 OCFS2_INFO_JOURNAL_SIZE, 177 OCFS2_INFO_JOURNAL_SIZE, 168 OCFS2_INFO_FREEINODE, 178 OCFS2_INFO_FREEINODE, 169 OCFS2_INFO_FREEFRAG, 179 OCFS2_INFO_FREEFRAG, 170 OCFS2_INFO_NUM_TYPES 180 OCFS2_INFO_NUM_TYPES 171 }; 181 }; 172 182 173 /* Flags for struct ocfs2_info_request */ 183 /* Flags for struct ocfs2_info_request */ 174 /* Filled by the caller */ 184 /* Filled by the caller */ 175 #define OCFS2_INFO_FL_NON_COHERENT (0x000 185 #define OCFS2_INFO_FL_NON_COHERENT (0x00000001) /* Cluster coherency not 176 186 required. This is a hint. 177 187 It is up to ocfs2 whether 178 188 the request can be fulfilled 179 189 without locking. */ 180 /* Filled by ocfs2 */ 190 /* Filled by ocfs2 */ 181 #define OCFS2_INFO_FL_FILLED (0x400 191 #define OCFS2_INFO_FL_FILLED (0x40000000) /* Filesystem understood 182 192 this request and 183 193 filled in the answer */ 184 194 185 #define OCFS2_INFO_FL_ERROR (0x800 195 #define OCFS2_INFO_FL_ERROR (0x80000000) /* Error happened during 186 196 request handling. */ 187 197 188 #define OCFS2_IOC_INFO _IOR('o', 5, s 198 #define OCFS2_IOC_INFO _IOR('o', 5, struct ocfs2_info) 189 199 190 struct ocfs2_move_extents { 200 struct ocfs2_move_extents { 191 /* All values are in bytes */ 201 /* All values are in bytes */ 192 /* in */ 202 /* in */ 193 __u64 me_start; /* Virtual sta 203 __u64 me_start; /* Virtual start in the file to move */ 194 __u64 me_len; /* Length of t 204 __u64 me_len; /* Length of the extents to be moved */ 195 __u64 me_goal; /* Physical of 205 __u64 me_goal; /* Physical offset of the goal, 196 it's in blo 206 it's in block unit */ 197 __u64 me_threshold; /* Maximum dis 207 __u64 me_threshold; /* Maximum distance from goal or threshold 198 for auto de 208 for auto defragmentation */ 199 __u64 me_flags; /* Flags for t 209 __u64 me_flags; /* Flags for the operation: 200 * - auto defr 210 * - auto defragmentation. 201 * - refcount, 211 * - refcount,xattr cases. 202 */ 212 */ 203 /* out */ 213 /* out */ 204 __u64 me_moved_len; /* Moved/defra 214 __u64 me_moved_len; /* Moved/defraged length */ 205 __u64 me_new_offset; /* Resulting p 215 __u64 me_new_offset; /* Resulting physical location */ 206 __u32 me_reserved[2]; /* Reserved fo 216 __u32 me_reserved[2]; /* Reserved for futhure */ 207 }; 217 }; 208 218 209 #define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG (0x000 219 #define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG (0x00000001) /* Kernel manages to 210 220 claim new clusters 211 221 as the goal place 212 222 for extents moving */ 213 #define OCFS2_MOVE_EXT_FL_PART_DEFRAG (0x000 223 #define OCFS2_MOVE_EXT_FL_PART_DEFRAG (0x00000002) /* Allow partial extent 214 224 moving, is to make 215 225 movement less likely 216 226 to fail, may make fs 217 227 even more fragmented */ 218 #define OCFS2_MOVE_EXT_FL_COMPLETE (0x000 228 #define OCFS2_MOVE_EXT_FL_COMPLETE (0x00000004) /* Move or defragmenation 219 229 completely gets done. 220 230 */ 221 231 222 #define OCFS2_IOC_MOVE_EXT _IOW('o', 6, s 232 #define OCFS2_IOC_MOVE_EXT _IOW('o', 6, struct ocfs2_move_extents) 223 233 224 #endif /* OCFS2_IOCTL_H */ 234 #endif /* OCFS2_IOCTL_H */ 225 235
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.