aufs_type.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: 
011: 
012: 
013: 
014: 
015: 
016: 
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: 
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: 
062: #define AUFS_MAX_NAMELEN        (NAME_MAX \
063:                                 - AUFS_WH_PFX_LEN * 2   \
064:                                 - 1                     \
065:                                 - AUFS_WH_TMP_LEN)      
066: #define AUFS_XINO_FNAME         "." AUFS_NAME ".xino"
067: #define AUFS_XINO_DEFPATH       "/tmp/" AUFS_XINO_FNAME
068: #define AUFS_XINO_TRUNC_INIT    64 
069: #define AUFS_XINO_TRUNC_STEP    4  
070: #define AUFS_DIRWH_DEF          3
071: #define AUFS_RDCACHE_DEF        10 
072: #define AUFS_RDCACHE_MAX        3600 
073: #define AUFS_RDBLK_DEF          512 
074: #define AUFS_RDHASH_DEF         32
075: #define AUFS_WKQ_NAME           AUFS_NAME "d"
076: #define AUFS_MFS_DEF_SEC        30 
077: #define AUFS_MFS_MAX_SEC        3600 
078: #define AUFS_PLINK_WARN         100 
079: 
080: 
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" 
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: 
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: 
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: 
107: enum {
108:         
109:         AuCtl_RDU,
110:         AuCtl_RDU_INO,
111: 
112:         
113:         AuCtl_WBR_FD,
114: 
115:         
116:         AuCtl_IBUSY
117: };
118: 
119: 
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: 
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:         
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:         
167:         union {
168:                 uint64_t        sz;     
169:                 uint64_t        nent;   
170:         };
171:         union au_rdu_ent_ul     ent;
172:         uint16_t                verify[AufsCtlRduV_End];
173: 
174:         
175:         uint32_t                blk;
176: 
177:         
178:         union au_rdu_ent_ul     tail;
179:         
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 
211: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved