2
* Copyright (C) 2005-2011 Junjiro R. Okajima
4
* This program, aufs is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
#ifndef __AUFS_TYPE_H__
20
#define __AUFS_TYPE_H__
22
#include <linux/ioctl.h>
23
#include <linux/kernel.h>
24
#include <linux/limits.h>
26
#include <linux/types.h>
29
#include <sys/types.h>
32
#define AUFS_VERSION "3.x-rcN-20111205"
34
/* todo? move this to linux-2.6.19/include/magic.h */
35
#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
37
/* ---------------------------------------------------------------------- */
39
#ifdef CONFIG_AUFS_BRANCH_MAX_127
40
typedef int8_t aufs_bindex_t;
41
#define AUFS_BRANCH_MAX 127
43
typedef int16_t aufs_bindex_t;
44
#ifdef CONFIG_AUFS_BRANCH_MAX_511
45
#define AUFS_BRANCH_MAX 511
46
#elif defined(CONFIG_AUFS_BRANCH_MAX_1023)
47
#define AUFS_BRANCH_MAX 1023
48
#elif defined(CONFIG_AUFS_BRANCH_MAX_32767)
49
#define AUFS_BRANCH_MAX 32767
54
#ifndef AUFS_BRANCH_MAX
55
#error unknown CONFIG_AUFS_BRANCH_MAX value
57
#endif /* __KERNEL__ */
59
/* ---------------------------------------------------------------------- */
61
#define AUFS_NAME "aufs"
62
#define AUFS_FSTYPE AUFS_NAME
64
#define AUFS_ROOT_INO 2
65
#define AUFS_FIRST_INO 11
67
#define AUFS_WH_PFX ".wh."
68
#define AUFS_WH_PFX_LEN ((int)sizeof(AUFS_WH_PFX) - 1)
69
#define AUFS_WH_TMP_LEN 4
70
/* a limit for rmdir/rename a dir */
71
#define AUFS_MAX_NAMELEN (NAME_MAX \
72
- AUFS_WH_PFX_LEN * 2 /* doubly whiteouted */\
74
- AUFS_WH_TMP_LEN) /* hex */
75
#define AUFS_XINO_FNAME "." AUFS_NAME ".xino"
76
#define AUFS_XINO_DEFPATH "/tmp/" AUFS_XINO_FNAME
77
#define AUFS_XINO_TRUNC_INIT 64 /* blocks */
78
#define AUFS_XINO_TRUNC_STEP 4 /* blocks */
79
#define AUFS_DIRWH_DEF 3
80
#define AUFS_RDCACHE_DEF 10 /* seconds */
81
#define AUFS_RDCACHE_MAX 3600 /* seconds */
82
#define AUFS_RDBLK_DEF 512 /* bytes */
83
#define AUFS_RDHASH_DEF 32
84
#define AUFS_WKQ_NAME AUFS_NAME "d"
85
#define AUFS_MFS_DEF_SEC 30 /* seconds */
86
#define AUFS_MFS_MAX_SEC 3600 /* seconds */
87
#define AUFS_PLINK_WARN 100 /* number of plinks */
89
/* pseudo-link maintenace under /proc */
90
#define AUFS_PLINK_MAINT_NAME "plink_maint"
91
#define AUFS_PLINK_MAINT_DIR "fs/" AUFS_NAME
92
#define AUFS_PLINK_MAINT_PATH AUFS_PLINK_MAINT_DIR "/" AUFS_PLINK_MAINT_NAME
94
#define AUFS_DIROPQ_NAME AUFS_WH_PFX ".opq" /* whiteouted doubly */
95
#define AUFS_WH_DIROPQ AUFS_WH_PFX AUFS_DIROPQ_NAME
97
#define AUFS_BASE_NAME AUFS_WH_PFX AUFS_NAME
98
#define AUFS_PLINKDIR_NAME AUFS_WH_PFX "plnk"
99
#define AUFS_ORPHDIR_NAME AUFS_WH_PFX "orph"
101
/* doubly whiteouted */
102
#define AUFS_WH_BASE AUFS_WH_PFX AUFS_BASE_NAME
103
#define AUFS_WH_PLINKDIR AUFS_WH_PFX AUFS_PLINKDIR_NAME
104
#define AUFS_WH_ORPHDIR AUFS_WH_PFX AUFS_ORPHDIR_NAME
106
/* branch permissions and attributes */
107
#define AUFS_BRPERM_RW "rw"
108
#define AUFS_BRPERM_RO "ro"
109
#define AUFS_BRPERM_RR "rr"
110
#define AUFS_BRRATTR_WH "wh"
111
#define AUFS_BRWATTR_NLWH "nolwh"
113
/* ---------------------------------------------------------------------- */
117
/* readdir in userspace */
121
/* pathconf wrapper */
128
/* borrowed from linux/include/linux/kernel.h */
130
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
131
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
134
/* borrowed from linux/include/linux/compiler-gcc3.h */
136
#define __aligned(x) __attribute__((aligned(x)))
141
#define __packed __attribute__((packed))
145
struct au_rdu_cookie {
162
static inline int au_rdu_len(int nlen)
164
/* include the terminating NULL */
165
return ALIGN(sizeof(struct au_rdu_ent) + nlen + 1,
169
union au_rdu_ent_ul {
170
struct au_rdu_ent __user *e;
182
uint64_t sz; /* AuCtl_RDU */
183
uint64_t nent; /* AuCtl_RDU_INO */
185
union au_rdu_ent_ul ent;
186
uint16_t verify[AufsCtlRduV_End];
192
union au_rdu_ent_ul tail;
193
/* number of entries which were added in a single call */
198
struct au_rdu_cookie cookie;
201
/* ---------------------------------------------------------------------- */
208
/* ---------------------------------------------------------------------- */
215
/* ---------------------------------------------------------------------- */
217
#define AuCtlType 'A'
218
#define AUFS_CTL_RDU _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu)
219
#define AUFS_CTL_RDU_INO _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu)
220
#define AUFS_CTL_WBR_FD _IOW(AuCtlType, AuCtl_WBR_FD, \
222
#define AUFS_CTL_IBUSY _IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy)
224
#endif /* __AUFS_TYPE_H__ */