The C and C++ Include Header Files
/usr/include/linux/aufs_type.h
$ cat -n /usr/include/linux/aufs_type.h 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * Copyright (C) 2005-2021 Junjiro R. Okajima 4 * 5 * This program, aufs is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see
. 17 */ 18 19 #ifndef __AUFS_TYPE_H__ 20 #define __AUFS_TYPE_H__ 21 22 #define AUFS_NAME "aufs" 23 24 #include
25 #include
26 #include
27 28 #define AUFS_VERSION "5.15.5-20211129" 29 30 /* todo? move this to linux-2.6.19/include/magic.h */ 31 #define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's') 32 33 /* ---------------------------------------------------------------------- */ 34 35 36 /* ---------------------------------------------------------------------- */ 37 38 #define AUFS_FSTYPE AUFS_NAME 39 40 #define AUFS_ROOT_INO 2 41 #define AUFS_FIRST_INO 11 42 43 #define AUFS_WH_PFX ".wh." 44 #define AUFS_WH_PFX_LEN ((int)sizeof(AUFS_WH_PFX) - 1) 45 #define AUFS_WH_TMP_LEN 4 46 /* a limit for rmdir/rename a dir and copyup */ 47 #define AUFS_MAX_NAMELEN (NAME_MAX \ 48 - AUFS_WH_PFX_LEN * 2 /* doubly whiteouted */\ 49 - 1 /* dot */\ 50 - AUFS_WH_TMP_LEN) /* hex */ 51 #define AUFS_XINO_FNAME "." AUFS_NAME ".xino" 52 #define AUFS_XINO_DEFPATH "/tmp/" AUFS_XINO_FNAME 53 #define AUFS_XINO_DEF_SEC 30 /* seconds */ 54 #define AUFS_XINO_DEF_TRUNC 45 /* percentage */ 55 #define AUFS_DIRWH_DEF 3 56 #define AUFS_RDCACHE_DEF 10 /* seconds */ 57 #define AUFS_RDCACHE_MAX 3600 /* seconds */ 58 #define AUFS_RDBLK_DEF 512 /* bytes */ 59 #define AUFS_RDHASH_DEF 32 60 #define AUFS_WKQ_NAME AUFS_NAME "d" 61 #define AUFS_MFS_DEF_SEC 30 /* seconds */ 62 #define AUFS_MFS_MAX_SEC 3600 /* seconds */ 63 #define AUFS_FHSM_CACHE_DEF_SEC 30 /* seconds */ 64 #define AUFS_PLINK_WARN 50 /* number of plinks in a single bucket */ 65 66 /* pseudo-link maintenace under /proc */ 67 #define AUFS_PLINK_MAINT_NAME "plink_maint" 68 #define AUFS_PLINK_MAINT_DIR "fs/" AUFS_NAME 69 #define AUFS_PLINK_MAINT_PATH AUFS_PLINK_MAINT_DIR "/" AUFS_PLINK_MAINT_NAME 70 71 /* dirren, renamed dir */ 72 #define AUFS_DR_INFO_PFX AUFS_WH_PFX ".dr." 73 #define AUFS_DR_BRHINO_NAME AUFS_WH_PFX "hino" 74 /* whiteouted doubly */ 75 #define AUFS_WH_DR_INFO_PFX AUFS_WH_PFX AUFS_DR_INFO_PFX 76 #define AUFS_WH_DR_BRHINO AUFS_WH_PFX AUFS_DR_BRHINO_NAME 77 78 #define AUFS_DIROPQ_NAME AUFS_WH_PFX ".opq" /* whiteouted doubly */ 79 #define AUFS_WH_DIROPQ AUFS_WH_PFX AUFS_DIROPQ_NAME 80 81 #define AUFS_BASE_NAME AUFS_WH_PFX AUFS_NAME 82 #define AUFS_PLINKDIR_NAME AUFS_WH_PFX "plnk" 83 #define AUFS_ORPHDIR_NAME AUFS_WH_PFX "orph" 84 85 /* doubly whiteouted */ 86 #define AUFS_WH_BASE AUFS_WH_PFX AUFS_BASE_NAME 87 #define AUFS_WH_PLINKDIR AUFS_WH_PFX AUFS_PLINKDIR_NAME 88 #define AUFS_WH_ORPHDIR AUFS_WH_PFX AUFS_ORPHDIR_NAME 89 90 /* branch permissions and attributes */ 91 #define AUFS_BRPERM_RW "rw" 92 #define AUFS_BRPERM_RO "ro" 93 #define AUFS_BRPERM_RR "rr" 94 #define AUFS_BRATTR_COO_REG "coo_reg" 95 #define AUFS_BRATTR_COO_ALL "coo_all" 96 #define AUFS_BRATTR_FHSM "fhsm" 97 #define AUFS_BRATTR_UNPIN "unpin" 98 #define AUFS_BRATTR_ICEX "icex" 99 #define AUFS_BRATTR_ICEX_SEC "icexsec" 100 #define AUFS_BRATTR_ICEX_SYS "icexsys" 101 #define AUFS_BRATTR_ICEX_TR "icextr" 102 #define AUFS_BRATTR_ICEX_USR "icexusr" 103 #define AUFS_BRATTR_ICEX_OTH "icexoth" 104 #define AUFS_BRRATTR_WH "wh" 105 #define AUFS_BRWATTR_NLWH "nolwh" 106 #define AUFS_BRWATTR_MOO "moo" 107 108 #define AuBrPerm_RW 1 /* writable, hardlinkable wh */ 109 #define AuBrPerm_RO (1 << 1) /* readonly */ 110 #define AuBrPerm_RR (1 << 2) /* natively readonly */ 111 #define AuBrPerm_Mask (AuBrPerm_RW | AuBrPerm_RO | AuBrPerm_RR) 112 113 #define AuBrAttr_COO_REG (1 << 3) /* copy-up on open */ 114 #define AuBrAttr_COO_ALL (1 << 4) 115 #define AuBrAttr_COO_Mask (AuBrAttr_COO_REG | AuBrAttr_COO_ALL) 116 117 #define AuBrAttr_FHSM (1 << 5) /* file-based hsm */ 118 #define AuBrAttr_UNPIN (1 << 6) /* rename-able top dir of 119 branch. meaningless since 120 linux-3.18-rc1 */ 121 122 /* ignore error in copying XATTR */ 123 #define AuBrAttr_ICEX_SEC (1 << 7) 124 #define AuBrAttr_ICEX_SYS (1 << 8) 125 #define AuBrAttr_ICEX_TR (1 << 9) 126 #define AuBrAttr_ICEX_USR (1 << 10) 127 #define AuBrAttr_ICEX_OTH (1 << 11) 128 #define AuBrAttr_ICEX (AuBrAttr_ICEX_SEC \ 129 | AuBrAttr_ICEX_SYS \ 130 | AuBrAttr_ICEX_TR \ 131 | AuBrAttr_ICEX_USR \ 132 | AuBrAttr_ICEX_OTH) 133 134 #define AuBrRAttr_WH (1 << 12) /* whiteout-able */ 135 #define AuBrRAttr_Mask AuBrRAttr_WH 136 137 #define AuBrWAttr_NoLinkWH (1 << 13) /* un-hardlinkable whiteouts */ 138 #define AuBrWAttr_MOO (1 << 14) /* move-up on open */ 139 #define AuBrWAttr_Mask (AuBrWAttr_NoLinkWH | AuBrWAttr_MOO) 140 141 #define AuBrAttr_CMOO_Mask (AuBrAttr_COO_Mask | AuBrWAttr_MOO) 142 143 /* #warning test userspace */ 144 145 /* the longest combination */ 146 /* AUFS_BRATTR_ICEX and AUFS_BRATTR_ICEX_TR don't affect here */ 147 #define AuBrPermStrSz sizeof(AUFS_BRPERM_RW \ 148 "+" AUFS_BRATTR_COO_REG \ 149 "+" AUFS_BRATTR_FHSM \ 150 "+" AUFS_BRATTR_UNPIN \ 151 "+" AUFS_BRATTR_ICEX_SEC \ 152 "+" AUFS_BRATTR_ICEX_SYS \ 153 "+" AUFS_BRATTR_ICEX_USR \ 154 "+" AUFS_BRATTR_ICEX_OTH \ 155 "+" AUFS_BRWATTR_NLWH) 156 157 typedef struct { 158 char a[AuBrPermStrSz]; 159 } au_br_perm_str_t; 160 161 static __inline__ int au_br_writable(int brperm) 162 { 163 return brperm & AuBrPerm_RW; 164 } 165 166 static __inline__ int au_br_whable(int brperm) 167 { 168 return brperm & (AuBrPerm_RW | AuBrRAttr_WH); 169 } 170 171 static __inline__ int au_br_wh_linkable(int brperm) 172 { 173 return !(brperm & AuBrWAttr_NoLinkWH); 174 } 175 176 static __inline__ int au_br_cmoo(int brperm) 177 { 178 return brperm & AuBrAttr_CMOO_Mask; 179 } 180 181 static __inline__ int au_br_fhsm(int brperm) 182 { 183 return brperm & AuBrAttr_FHSM; 184 } 185 186 /* ---------------------------------------------------------------------- */ 187 188 /* ioctl */ 189 enum { 190 /* readdir in userspace */ 191 AuCtl_RDU, 192 AuCtl_RDU_INO, 193 194 AuCtl_WBR_FD, /* pathconf wrapper */ 195 AuCtl_IBUSY, /* busy inode */ 196 AuCtl_MVDOWN, /* move-down */ 197 AuCtl_BR, /* info about branches */ 198 AuCtl_FHSM_FD /* connection for fhsm */ 199 }; 200 201 /* borrowed from linux/include/linux/kernel.h */ 202 #ifndef ALIGN 203 #ifdef _GNU_SOURCE 204 #define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) 205 #else 206 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) 207 #endif 208 #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) 209 #endif 210 211 /* borrowed from linux/include/linux/compiler-gcc3.h */ 212 #ifndef __aligned 213 #define __aligned(x) __attribute__((aligned(x))) 214 #endif 215 216 217 struct au_rdu_cookie { 218 uint64_t h_pos; 219 int16_t bindex; 220 uint8_t flags; 221 uint8_t pad; 222 uint32_t generation; 223 } __aligned(8); 224 225 struct au_rdu_ent { 226 uint64_t ino; 227 int16_t bindex; 228 uint8_t type; 229 uint8_t nlen; 230 uint8_t wh; 231 char name[]; 232 } __aligned(8); 233 234 static __inline__ int au_rdu_len(int nlen) 235 { 236 /* include the terminating NULL */ 237 return ALIGN(sizeof(struct au_rdu_ent) + nlen + 1, 238 sizeof(uint64_t)); 239 } 240 241 union au_rdu_ent_ul { 242 struct au_rdu_ent *e; 243 uint64_t ul; 244 }; 245 246 enum { 247 AufsCtlRduV_SZ, 248 AufsCtlRduV_End 249 }; 250 251 struct aufs_rdu { 252 /* input */ 253 union { 254 uint64_t sz; /* AuCtl_RDU */ 255 uint64_t nent; /* AuCtl_RDU_INO */ 256 }; 257 union au_rdu_ent_ul ent; 258 uint16_t verify[AufsCtlRduV_End]; 259 260 /* input/output */ 261 uint32_t blk; 262 263 /* output */ 264 union au_rdu_ent_ul tail; 265 /* number of entries which were added in a single call */ 266 uint64_t rent; 267 uint8_t full; 268 uint8_t shwh; 269 270 struct au_rdu_cookie cookie; 271 } __aligned(8); 272 273 /* ---------------------------------------------------------------------- */ 274 275 /* dirren. the branch is identified by the filename who contains this */ 276 struct au_drinfo { 277 uint64_t ino; 278 union { 279 uint8_t oldnamelen; 280 uint64_t _padding; 281 }; 282 uint8_t oldname[]; 283 } __aligned(8); 284 285 struct au_drinfo_fdata { 286 uint32_t magic; 287 struct au_drinfo drinfo; 288 } __aligned(8); 289 290 #define AUFS_DRINFO_MAGIC_V1 ('a' << 24 | 'd' << 16 | 'r' << 8 | 0x01) 291 /* future */ 292 #define AUFS_DRINFO_MAGIC_V2 ('a' << 24 | 'd' << 16 | 'r' << 8 | 0x02) 293 294 /* ---------------------------------------------------------------------- */ 295 296 struct aufs_wbr_fd { 297 uint32_t oflags; 298 int16_t brid; 299 } __aligned(8); 300 301 /* ---------------------------------------------------------------------- */ 302 303 struct aufs_ibusy { 304 uint64_t ino, h_ino; 305 int16_t bindex; 306 } __aligned(8); 307 308 /* ---------------------------------------------------------------------- */ 309 310 /* error code for move-down */ 311 /* the actual message strings are implemented in aufs-util.git */ 312 enum { 313 EAU_MVDOWN_OPAQUE = 1, 314 EAU_MVDOWN_WHITEOUT, 315 EAU_MVDOWN_UPPER, 316 EAU_MVDOWN_BOTTOM, 317 EAU_MVDOWN_NOUPPER, 318 EAU_MVDOWN_NOLOWERBR, 319 EAU_Last 320 }; 321 322 /* flags for move-down */ 323 #define AUFS_MVDOWN_DMSG 1 324 #define AUFS_MVDOWN_OWLOWER (1 << 1) /* overwrite lower */ 325 #define AUFS_MVDOWN_KUPPER (1 << 2) /* keep upper */ 326 #define AUFS_MVDOWN_ROLOWER (1 << 3) /* do even if lower is RO */ 327 #define AUFS_MVDOWN_ROLOWER_R (1 << 4) /* did on lower RO */ 328 #define AUFS_MVDOWN_ROUPPER (1 << 5) /* do even if upper is RO */ 329 #define AUFS_MVDOWN_ROUPPER_R (1 << 6) /* did on upper RO */ 330 #define AUFS_MVDOWN_BRID_UPPER (1 << 7) /* upper brid */ 331 #define AUFS_MVDOWN_BRID_LOWER (1 << 8) /* lower brid */ 332 #define AUFS_MVDOWN_FHSM_LOWER (1 << 9) /* find fhsm attr for lower */ 333 #define AUFS_MVDOWN_STFS (1 << 10) /* req. stfs */ 334 #define AUFS_MVDOWN_STFS_FAILED (1 << 11) /* output: stfs is unusable */ 335 #define AUFS_MVDOWN_BOTTOM (1 << 12) /* output: no more lowers */ 336 337 /* index for move-down */ 338 enum { 339 AUFS_MVDOWN_UPPER, 340 AUFS_MVDOWN_LOWER, 341 AUFS_MVDOWN_NARRAY 342 }; 343 344 /* 345 * additional info of move-down 346 * number of free blocks and inodes. 347 * subset of struct kstatfs, but smaller and always 64bit. 348 */ 349 struct aufs_stfs { 350 uint64_t f_blocks; 351 uint64_t f_bavail; 352 uint64_t f_files; 353 uint64_t f_ffree; 354 }; 355 356 struct aufs_stbr { 357 int16_t brid; /* optional input */ 358 int16_t bindex; /* output */ 359 struct aufs_stfs stfs; /* output when AUFS_MVDOWN_STFS set */ 360 } __aligned(8); 361 362 struct aufs_mvdown { 363 uint32_t flags; /* input/output */ 364 struct aufs_stbr stbr[AUFS_MVDOWN_NARRAY]; /* input/output */ 365 int8_t au_errno; /* output */ 366 } __aligned(8); 367 368 /* ---------------------------------------------------------------------- */ 369 370 union aufs_brinfo { 371 /* PATH_MAX may differ between kernel-space and user-space */ 372 char _spacer[4096]; 373 struct { 374 int16_t id; 375 int perm; 376 char path[]; 377 }; 378 } __aligned(8); 379 380 /* ---------------------------------------------------------------------- */ 381 382 #define AuCtlType 'A' 383 #define AUFS_CTL_RDU _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu) 384 #define AUFS_CTL_RDU_INO _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu) 385 #define AUFS_CTL_WBR_FD _IOW(AuCtlType, AuCtl_WBR_FD, \ 386 struct aufs_wbr_fd) 387 #define AUFS_CTL_IBUSY _IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy) 388 #define AUFS_CTL_MVDOWN _IOWR(AuCtlType, AuCtl_MVDOWN, \ 389 struct aufs_mvdown) 390 #define AUFS_CTL_BRINFO _IOW(AuCtlType, AuCtl_BR, union aufs_brinfo) 391 #define AUFS_CTL_FHSM_FD _IOW(AuCtlType, AuCtl_FHSM_FD, int) 392 393 #endif /* __AUFS_TYPE_H__ */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2024 MyWebUniversity.com ™