Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


aufs_type.h
001: /*
002:  * Copyright (C) 2005-2012 Junjiro R. Okajima
003:  *
004:  * This program, aufs is free software; you can redistribute it and/or modify
005:  * it under the terms of the GNU General Public License as published by
006:  * the Free Software Foundation; either version 2 of the License, or
007:  * (at your option) any later version.
008:  *
009:  * This program is distributed in the hope that it will be useful,
010:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:  * GNU General Public License for more details.
013:  *
014:  * You should have received a copy of the GNU General Public License
015:  * along with this program; if not, write to the Free Software
016:  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
017:  */
018: 
019: #ifndef __AUFS_TYPE_H__
020: #define __AUFS_TYPE_H__
021: 
022: #define AUFS_NAME       "aufs"
023: 
024: #include <stdint.h>
025: #include <sys/types.h>
026: 
027: #include <linux/limits.h>
028: 
029: #define AUFS_VERSION    "3.2-20120109"
030: 
031: /* todo? move this to linux-2.6.19/include/magic.h */
032: #define AUFS_SUPER_MAGIC        ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
033: 
034: /* ---------------------------------------------------------------------- */
035: 
036: #ifdef CONFIG_AUFS_BRANCH_MAX_127
037: typedef int8_t aufs_bindex_t;
038: #define AUFS_BRANCH_MAX 127
039: #else
040: typedef int16_t aufs_bindex_t;
041: #ifdef CONFIG_AUFS_BRANCH_MAX_511
042: #define AUFS_BRANCH_MAX 511
043: #elif defined(CONFIG_AUFS_BRANCH_MAX_1023)
044: #define AUFS_BRANCH_MAX 1023
045: #elif defined(CONFIG_AUFS_BRANCH_MAX_32767)
046: #define AUFS_BRANCH_MAX 32767
047: #endif
048: #endif
049: 
050: 
051: /* ---------------------------------------------------------------------- */
052: 
053: #define AUFS_FSTYPE             AUFS_NAME
054: 
055: #define AUFS_ROOT_INO           2
056: #define AUFS_FIRST_INO          11
057: 
058: #define AUFS_WH_PFX             ".wh."
059: #define AUFS_WH_PFX_LEN         ((int)sizeof(AUFS_WH_PFX) - 1)
060: #define AUFS_WH_TMP_LEN         4
061: /* a limit for rmdir/rename a dir */
062: #define AUFS_MAX_NAMELEN        (NAME_MAX \
063:                                 - AUFS_WH_PFX_LEN * 2   /* doubly whiteouted */\
064:                                 - 1                     /* dot */\
065:                                 - AUFS_WH_TMP_LEN)      /* hex */
066: #define AUFS_XINO_FNAME         "." AUFS_NAME ".xino"
067: #define AUFS_XINO_DEFPATH       "/tmp/" AUFS_XINO_FNAME
068: #define AUFS_XINO_TRUNC_INIT    64 /* blocks */
069: #define AUFS_XINO_TRUNC_STEP    4  /* blocks */
070: #define AUFS_DIRWH_DEF          3
071: #define AUFS_RDCACHE_DEF        10 /* seconds */
072: #define AUFS_RDCACHE_MAX        3600 /* seconds */
073: #define AUFS_RDBLK_DEF          512 /* bytes */
074: #define AUFS_RDHASH_DEF         32
075: #define AUFS_WKQ_NAME           AUFS_NAME "d"
076: #define AUFS_MFS_DEF_SEC        30 /* seconds */
077: #define AUFS_MFS_MAX_SEC        3600 /* seconds */
078: #define AUFS_PLINK_WARN         100 /* number of plinks */
079: 
080: /* pseudo-link maintenace under /proc */
081: #define AUFS_PLINK_MAINT_NAME   "plink_maint"
082: #define AUFS_PLINK_MAINT_DIR    "fs/" AUFS_NAME
083: #define AUFS_PLINK_MAINT_PATH   AUFS_PLINK_MAINT_DIR "/" AUFS_PLINK_MAINT_NAME
084: 
085: #define AUFS_DIROPQ_NAME        AUFS_WH_PFX ".opq" /* whiteouted doubly */
086: #define AUFS_WH_DIROPQ          AUFS_WH_PFX AUFS_DIROPQ_NAME
087: 
088: #define AUFS_BASE_NAME          AUFS_WH_PFX AUFS_NAME
089: #define AUFS_PLINKDIR_NAME      AUFS_WH_PFX "plnk"
090: #define AUFS_ORPHDIR_NAME       AUFS_WH_PFX "orph"
091: 
092: /* doubly whiteouted */
093: #define AUFS_WH_BASE            AUFS_WH_PFX AUFS_BASE_NAME
094: #define AUFS_WH_PLINKDIR        AUFS_WH_PFX AUFS_PLINKDIR_NAME
095: #define AUFS_WH_ORPHDIR         AUFS_WH_PFX AUFS_ORPHDIR_NAME
096: 
097: /* branch permissions and attributes */
098: #define AUFS_BRPERM_RW          "rw"
099: #define AUFS_BRPERM_RO          "ro"
100: #define AUFS_BRPERM_RR          "rr"
101: #define AUFS_BRRATTR_WH         "wh"
102: #define AUFS_BRWATTR_NLWH       "nolwh"
103: 
104: /* ---------------------------------------------------------------------- */
105: 
106: /* ioctl */
107: enum {
108:         /* readdir in userspace */
109:         AuCtl_RDU,
110:         AuCtl_RDU_INO,
111: 
112:         /* pathconf wrapper */
113:         AuCtl_WBR_FD,
114: 
115:         /* busy inode */
116:         AuCtl_IBUSY
117: };
118: 
119: /* borrowed from linux/include/linux/kernel.h */
120: #ifndef ALIGN
121: #define ALIGN(x, a)             __ALIGN_MASK(x, (typeof(x))(a)-1)
122: #define __ALIGN_MASK(x, mask)   (((x)+(mask))&~(mask))
123: #endif
124: 
125: /* borrowed from linux/include/linux/compiler-gcc3.h */
126: #ifndef __aligned
127: #define __aligned(x)                    __attribute__((aligned(x)))
128: #endif
129: 
130: 
131: struct au_rdu_cookie {
132:         uint64_t        h_pos;
133:         int16_t         bindex;
134:         uint8_t         flags;
135:         uint8_t         pad;
136:         uint32_t        generation;
137: } __aligned(8);
138: 
139: struct au_rdu_ent {
140:         uint64_t        ino;
141:         int16_t         bindex;
142:         uint8_t         type;
143:         uint8_t         nlen;
144:         uint8_t         wh;
145:         char            name[0];
146: } __aligned(8);
147: 
148: static __inline__ int au_rdu_len(int nlen)
149: {
150:         /* include the terminating NULL */
151:         return ALIGN(sizeof(struct au_rdu_ent) + nlen + 1,
152:                      sizeof(uint64_t));
153: }
154: 
155: union au_rdu_ent_ul {
156:         struct au_rdu_ent *e;
157:         uint64_t                        ul;
158: };
159: 
160: enum {
161:         AufsCtlRduV_SZ,
162:         AufsCtlRduV_End
163: };
164: 
165: struct aufs_rdu {
166:         /* input */
167:         union {
168:                 uint64_t        sz;     /* AuCtl_RDU */
169:                 uint64_t        nent;   /* AuCtl_RDU_INO */
170:         };
171:         union au_rdu_ent_ul     ent;
172:         uint16_t                verify[AufsCtlRduV_End];
173: 
174:         /* input/output */
175:         uint32_t                blk;
176: 
177:         /* output */
178:         union au_rdu_ent_ul     tail;
179:         /* number of entries which were added in a single call */
180:         uint64_t                rent;
181:         uint8_t                 full;
182:         uint8_t                 shwh;
183: 
184:         struct au_rdu_cookie    cookie;
185: } __aligned(8);
186: 
187: /* ---------------------------------------------------------------------- */
188: 
189: struct aufs_wbr_fd {
190:         uint32_t        oflags;
191:         int16_t         brid;
192: } __aligned(8);
193: 
194: /* ---------------------------------------------------------------------- */
195: 
196: struct aufs_ibusy {
197:         uint64_t        ino, h_ino;
198:         int16_t         bindex;
199: } __aligned(8);
200: 
201: /* ---------------------------------------------------------------------- */
202: 
203: #define AuCtlType               'A'
204: #define AUFS_CTL_RDU            _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu)
205: #define AUFS_CTL_RDU_INO        _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu)
206: #define AUFS_CTL_WBR_FD         _IOW(AuCtlType, AuCtl_WBR_FD, \
207:                                      struct aufs_wbr_fd)
208: #define AUFS_CTL_IBUSY          _IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy)
209: 
210: #endif /* __AUFS_TYPE_H__ */
211: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/