1
0

aufs2.patch 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. diff -Nur linux-3.1.4.orig/include/linux/Kbuild linux-3.1.4/include/linux/Kbuild
  2. --- linux-3.1.4.orig/include/linux/Kbuild 2011-11-28 23:48:14.000000000 +0100
  3. +++ linux-3.1.4/include/linux/Kbuild 2011-12-01 12:44:17.000000000 +0100
  4. @@ -65,6 +65,7 @@
  5. header-y += atmsap.h
  6. header-y += atmsvc.h
  7. header-y += audit.h
  8. +header-y += aufs_type.h
  9. header-y += auto_fs.h
  10. header-y += auto_fs4.h
  11. header-y += auxvec.h
  12. diff -Nur linux-3.1.4.orig/include/linux/aufs_type.h linux-3.1.4/include/linux/aufs_type.h
  13. --- linux-3.1.4.orig/include/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
  14. +++ linux-3.1.4/include/linux/aufs_type.h 2011-12-01 12:44:17.000000000 +0100
  15. @@ -0,0 +1,197 @@
  16. +/*
  17. + * Copyright (C) 2005-2011 Junjiro R. Okajima
  18. + *
  19. + * This program, aufs is free software; you can redistribute it and/or modify
  20. + * it under the terms of the GNU General Public License as published by
  21. + * the Free Software Foundation; either version 2 of the License, or
  22. + * (at your option) any later version.
  23. + *
  24. + * This program is distributed in the hope that it will be useful,
  25. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. + * GNU General Public License for more details.
  28. + *
  29. + * You should have received a copy of the GNU General Public License
  30. + * along with this program; if not, write to the Free Software
  31. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  32. + */
  33. +
  34. +#ifndef __AUFS_TYPE_H__
  35. +#define __AUFS_TYPE_H__
  36. +
  37. +#include <linux/ioctl.h>
  38. +#include <linux/kernel.h>
  39. +#include <linux/limits.h>
  40. +#include <linux/types.h>
  41. +
  42. +#define AUFS_VERSION "2.1-standalone.tree-36-20110110"
  43. +
  44. +/* todo? move this to linux-2.6.19/include/magic.h */
  45. +#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
  46. +
  47. +/* ---------------------------------------------------------------------- */
  48. +
  49. +#ifdef CONFIG_AUFS_BRANCH_MAX_127
  50. +typedef __s8 aufs_bindex_t;
  51. +#define AUFS_BRANCH_MAX 127
  52. +#else
  53. +typedef __s16 aufs_bindex_t;
  54. +#ifdef CONFIG_AUFS_BRANCH_MAX_511
  55. +#define AUFS_BRANCH_MAX 511
  56. +#elif defined(CONFIG_AUFS_BRANCH_MAX_1023)
  57. +#define AUFS_BRANCH_MAX 1023
  58. +#elif defined(CONFIG_AUFS_BRANCH_MAX_32767)
  59. +#define AUFS_BRANCH_MAX 32767
  60. +#endif
  61. +#endif
  62. +
  63. +#ifdef __KERNEL__
  64. +#ifndef AUFS_BRANCH_MAX
  65. +#error unknown CONFIG_AUFS_BRANCH_MAX value
  66. +#endif
  67. +#endif /* __KERNEL__ */
  68. +
  69. +/* ---------------------------------------------------------------------- */
  70. +
  71. +#define AUFS_NAME "aufs"
  72. +#define AUFS_FSTYPE AUFS_NAME
  73. +
  74. +#define AUFS_ROOT_INO 2
  75. +#define AUFS_FIRST_INO 11
  76. +
  77. +#define AUFS_WH_PFX ".wh."
  78. +#define AUFS_WH_PFX_LEN ((int)sizeof(AUFS_WH_PFX) - 1)
  79. +#define AUFS_WH_TMP_LEN 4
  80. +/* a limit for rmdir/rename a dir */
  81. +#define AUFS_MAX_NAMELEN (NAME_MAX \
  82. + - AUFS_WH_PFX_LEN * 2 /* doubly whiteouted */\
  83. + - 1 /* dot */\
  84. + - AUFS_WH_TMP_LEN) /* hex */
  85. +#define AUFS_XINO_FNAME "." AUFS_NAME ".xino"
  86. +#define AUFS_XINO_DEFPATH "/tmp/" AUFS_XINO_FNAME
  87. +#define AUFS_XINO_TRUNC_INIT 64 /* blocks */
  88. +#define AUFS_XINO_TRUNC_STEP 4 /* blocks */
  89. +#define AUFS_DIRWH_DEF 3
  90. +#define AUFS_RDCACHE_DEF 10 /* seconds */
  91. +#define AUFS_RDCACHE_MAX 3600 /* seconds */
  92. +#define AUFS_RDBLK_DEF 512 /* bytes */
  93. +#define AUFS_RDHASH_DEF 32
  94. +#define AUFS_WKQ_NAME AUFS_NAME "d"
  95. +#define AUFS_WKQ_PRE_NAME AUFS_WKQ_NAME "_pre"
  96. +#define AUFS_MFS_DEF_SEC 30 /* seconds */
  97. +#define AUFS_MFS_MAX_SEC 3600 /* seconds */
  98. +#define AUFS_PLINK_WARN 100 /* number of plinks */
  99. +
  100. +/* pseudo-link maintenace under /proc */
  101. +#define AUFS_PLINK_MAINT_NAME "plink_maint"
  102. +#define AUFS_PLINK_MAINT_DIR "fs/" AUFS_NAME
  103. +#define AUFS_PLINK_MAINT_PATH AUFS_PLINK_MAINT_DIR "/" AUFS_PLINK_MAINT_NAME
  104. +
  105. +#define AUFS_DIROPQ_NAME AUFS_WH_PFX ".opq" /* whiteouted doubly */
  106. +#define AUFS_WH_DIROPQ AUFS_WH_PFX AUFS_DIROPQ_NAME
  107. +
  108. +#define AUFS_BASE_NAME AUFS_WH_PFX AUFS_NAME
  109. +#define AUFS_PLINKDIR_NAME AUFS_WH_PFX "plnk"
  110. +#define AUFS_ORPHDIR_NAME AUFS_WH_PFX "orph"
  111. +
  112. +/* doubly whiteouted */
  113. +#define AUFS_WH_BASE AUFS_WH_PFX AUFS_BASE_NAME
  114. +#define AUFS_WH_PLINKDIR AUFS_WH_PFX AUFS_PLINKDIR_NAME
  115. +#define AUFS_WH_ORPHDIR AUFS_WH_PFX AUFS_ORPHDIR_NAME
  116. +
  117. +/* branch permission */
  118. +#define AUFS_BRPERM_RW "rw"
  119. +#define AUFS_BRPERM_RO "ro"
  120. +#define AUFS_BRPERM_RR "rr"
  121. +#define AUFS_BRPERM_WH "wh"
  122. +#define AUFS_BRPERM_NLWH "nolwh"
  123. +#define AUFS_BRPERM_ROWH AUFS_BRPERM_RO "+" AUFS_BRPERM_WH
  124. +#define AUFS_BRPERM_RRWH AUFS_BRPERM_RR "+" AUFS_BRPERM_WH
  125. +#define AUFS_BRPERM_RWNLWH AUFS_BRPERM_RW "+" AUFS_BRPERM_NLWH
  126. +
  127. +/* ---------------------------------------------------------------------- */
  128. +
  129. +/* ioctl */
  130. +enum {
  131. + /* readdir in userspace */
  132. + AuCtl_RDU,
  133. + AuCtl_RDU_INO,
  134. +
  135. + /* pathconf wrapper */
  136. + AuCtl_WBR_FD
  137. +};
  138. +
  139. +/* borrowed from linux/include/linux/kernel.h */
  140. +#ifndef ALIGN
  141. +#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
  142. +#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
  143. +#endif
  144. +
  145. +/* borrowed from linux/include/linux/compiler-gcc3.h */
  146. +#ifndef __aligned
  147. +#define __aligned(x) __attribute__((aligned(x)))
  148. +#define __packed __attribute__((packed))
  149. +#endif
  150. +
  151. +struct au_rdu_cookie {
  152. + __u64 h_pos;
  153. + __s16 bindex;
  154. + __u8 flags;
  155. + __u8 pad;
  156. + __u32 generation;
  157. +} __aligned(8);
  158. +
  159. +struct au_rdu_ent {
  160. + __u64 ino;
  161. + __s16 bindex;
  162. + __u8 type;
  163. + __u8 nlen;
  164. + __u8 wh;
  165. + char name[0];
  166. +} __aligned(8);
  167. +
  168. +static inline int au_rdu_len(int nlen)
  169. +{
  170. + /* include the terminating NULL */
  171. + return ALIGN(sizeof(struct au_rdu_ent) + nlen + 1,
  172. + sizeof(__u64));
  173. +}
  174. +
  175. +union au_rdu_ent_ul {
  176. + struct au_rdu_ent __user *e;
  177. + __u64 ul;
  178. +};
  179. +
  180. +enum {
  181. + AufsCtlRduV_SZ,
  182. + AufsCtlRduV_End
  183. +};
  184. +
  185. +struct aufs_rdu {
  186. + /* input */
  187. + union {
  188. + __u64 sz; /* AuCtl_RDU */
  189. + __u64 nent; /* AuCtl_RDU_INO */
  190. + };
  191. + union au_rdu_ent_ul ent;
  192. + __u16 verify[AufsCtlRduV_End];
  193. +
  194. + /* input/output */
  195. + __u32 blk;
  196. +
  197. + /* output */
  198. + union au_rdu_ent_ul tail;
  199. + /* number of entries which were added in a single call */
  200. + __u64 rent;
  201. + __u8 full;
  202. + __u8 shwh;
  203. +
  204. + struct au_rdu_cookie cookie;
  205. +} __aligned(8);
  206. +
  207. +#define AuCtlType 'A'
  208. +#define AUFS_CTL_RDU _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu)
  209. +#define AUFS_CTL_RDU_INO _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu)
  210. +#define AUFS_CTL_WBR_FD _IO(AuCtlType, AuCtl_WBR_FD)
  211. +
  212. +#endif /* __AUFS_TYPE_H__ */
  213. diff -Nur linux-3.1.4.orig/include/linux/namei.h linux-3.1.4/include/linux/namei.h
  214. --- linux-3.1.4.orig/include/linux/namei.h 2011-11-28 23:48:14.000000000 +0100
  215. +++ linux-3.1.4/include/linux/namei.h 2011-12-01 12:44:17.000000000 +0100
  216. @@ -85,6 +85,9 @@
  217. extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
  218. int (*open)(struct inode *, struct file *));
  219. +extern struct dentry *lookup_hash(struct nameidata *nd);
  220. +extern int __lookup_one_len(const char *name, struct qstr *this,
  221. + struct dentry *base, int len);
  222. extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
  223. extern int follow_down_one(struct path *);
  224. diff -Nur linux-3.1.4.orig/include/linux/splice.h linux-3.1.4/include/linux/splice.h
  225. --- linux-3.1.4.orig/include/linux/splice.h 2011-11-28 23:48:14.000000000 +0100
  226. +++ linux-3.1.4/include/linux/splice.h 2011-12-01 12:45:51.000000000 +0100
  227. @@ -91,4 +91,9 @@
  228. extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
  229. extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
  230. +extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  231. + loff_t *ppos, size_t len, unsigned int flags);
  232. +extern long do_splice_to(struct file *in, loff_t *ppos,
  233. + struct pipe_inode_info *pipe, size_t len,
  234. + unsigned int flags);
  235. #endif