aufs4-base.patch 9.82 KB
Newer Older
Philip Müller's avatar
Philip Müller committed
1
aufs4.9.94+ base patch
Philip Müller's avatar
Philip Müller committed
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

diff --git a/MAINTAINERS b/MAINTAINERS
index 63cefa6..d78b954 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2293,6 +2293,19 @@ F:	include/linux/audit.h
 F:	include/uapi/linux/audit.h
 F:	kernel/audit*
 
+AUFS (advanced multi layered unification filesystem) FILESYSTEM
+M:	"J. R. Okajima" <hooanon05g@gmail.com>
+L:	linux-unionfs@vger.kernel.org
+L:	aufs-users@lists.sourceforge.net (members only)
+W:	http://aufs.sourceforge.net
+T:	git://github.com/sfjro/aufs4-linux.git
+S:	Supported
+F:	Documentation/filesystems/aufs/
+F:	Documentation/ABI/testing/debugfs-aufs
+F:	Documentation/ABI/testing/sysfs-aufs
+F:	fs/aufs/
+F:	include/uapi/linux/aufs_type.h
+
 AUXILIARY DISPLAY DRIVERS
 M:	Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
 W:	http://miguelojeda.es/auxdisplay.htm
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
Philip Müller's avatar
Philip Müller committed
28
index dc318b9..6fdd95e 100644
Philip Müller's avatar
Philip Müller committed
29 30
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
Philip Müller's avatar
Philip Müller committed
31
@@ -704,6 +704,24 @@ static inline int is_loop_device(struct file *file)
Philip Müller's avatar
Philip Müller committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
 	return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
 }
 
+/*
+ * for AUFS
+ * no get/put for file.
+ */
+struct file *loop_backing_file(struct super_block *sb)
+{
+	struct file *ret;
+	struct loop_device *l;
+
+	ret = NULL;
+	if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
+		l = sb->s_bdev->bd_disk->private_data;
+		ret = l->lo_backing_file;
+	}
+	return ret;
+}
+EXPORT_SYMBOL_GPL(loop_backing_file);
+
 /* loop sysfs attributes */
 
 static ssize_t loop_attr_show(struct device *dev, char *page,
diff --git a/fs/dcache.c b/fs/dcache.c
Philip Müller's avatar
Philip Müller committed
57
index 2225b98..079e84b 100644
Philip Müller's avatar
Philip Müller committed
58 59
--- a/fs/dcache.c
+++ b/fs/dcache.c
Philip Müller's avatar
Philip Müller committed
60
@@ -1204,7 +1204,7 @@ enum d_walk_ret {
Philip Müller's avatar
Philip Müller committed
61 62 63 64 65 66 67 68 69
  *
  * The @enter() and @finish() callbacks are called with d_lock held.
  */
-static void d_walk(struct dentry *parent, void *data,
+void d_walk(struct dentry *parent, void *data,
 		   enum d_walk_ret (*enter)(void *, struct dentry *),
 		   void (*finish)(void *))
 {
diff --git a/fs/fcntl.c b/fs/fcntl.c
Philip Müller's avatar
Philip Müller committed
70
index ec03cf6..f3bbbdf 100644
Philip Müller's avatar
Philip Müller committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -29,7 +29,7 @@
 
 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
 
-static int setfl(int fd, struct file * filp, unsigned long arg)
+int setfl(int fd, struct file * filp, unsigned long arg)
 {
 	struct inode * inode = file_inode(filp);
 	int error = 0;
@@ -60,6 +60,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 
 	if (filp->f_op->check_flags)
 		error = filp->f_op->check_flags(arg);
+	if (!error && filp->f_op->setfl)
+		error = filp->f_op->setfl(filp, arg);
 	if (error)
 		return error;
 
diff --git a/fs/inode.c b/fs/inode.c
Philip Müller's avatar
Philip Müller committed
92
index 920aa0b..816ee9b 100644
Philip Müller's avatar
Philip Müller committed
93 94
--- a/fs/inode.c
+++ b/fs/inode.c
Philip Müller's avatar
Philip Müller committed
95
@@ -1643,7 +1643,7 @@ EXPORT_SYMBOL(generic_update_time);
Philip Müller's avatar
Philip Müller committed
96 97 98 99 100 101 102 103 104
  * This does the actual work of updating an inodes time or version.  Must have
  * had called mnt_want_write() before calling this.
  */
-static int update_time(struct inode *inode, struct timespec *time, int flags)
+int update_time(struct inode *inode, struct timespec *time, int flags)
 {
 	int (*update_time)(struct inode *, struct timespec *, int);
 
diff --git a/fs/namespace.c b/fs/namespace.c
Philip Müller's avatar
Philip Müller committed
105
index d7360f9..a774274 100644
Philip Müller's avatar
Philip Müller committed
106 107
--- a/fs/namespace.c
+++ b/fs/namespace.c
Philip Müller's avatar
Philip Müller committed
108
@@ -790,6 +790,12 @@ static inline int check_mnt(struct mount *mnt)
Philip Müller's avatar
Philip Müller committed
109 110 111 112 113 114 115 116 117 118 119 120 121
 	return mnt->mnt_ns == current->nsproxy->mnt_ns;
 }
 
+/* for aufs, CONFIG_AUFS_BR_FUSE */
+int is_current_mnt_ns(struct vfsmount *mnt)
+{
+	return check_mnt(real_mount(mnt));
+}
+
 /*
  * vfsmount lock must be held for write
  */
diff --git a/fs/read_write.c b/fs/read_write.c
Philip Müller's avatar
Philip Müller committed
122
index ba28059..ae2e2cd 100644
Philip Müller's avatar
Philip Müller committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -515,6 +515,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
 }
 EXPORT_SYMBOL(__vfs_write);
 
+vfs_readf_t vfs_readf(struct file *file)
+{
+	const struct file_operations *fop = file->f_op;
+
+	if (fop->read)
+		return fop->read;
+	if (fop->read_iter)
+		return new_sync_read;
+	return ERR_PTR(-ENOSYS);
+}
+
+vfs_writef_t vfs_writef(struct file *file)
+{
+	const struct file_operations *fop = file->f_op;
+
+	if (fop->write)
+		return fop->write;
+	if (fop->write_iter)
+		return new_sync_write;
+	return ERR_PTR(-ENOSYS);
+}
+
 ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
 {
 	mm_segment_t old_fs;
diff --git a/fs/splice.c b/fs/splice.c
Philip Müller's avatar
Philip Müller committed
155
index 8dd79ec..8bca247 100644
Philip Müller's avatar
Philip Müller committed
156 157
--- a/fs/splice.c
+++ b/fs/splice.c
Philip Müller's avatar
Philip Müller committed
158
@@ -856,8 +856,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
Philip Müller's avatar
Philip Müller committed
159 160 161 162 163 164 165 166 167 168
 /*
  * Attempt to initiate a splice from pipe to file.
  */
-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-			   loff_t *ppos, size_t len, unsigned int flags)
+long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+		    loff_t *ppos, size_t len, unsigned int flags)
 {
 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
 				loff_t *, size_t, unsigned int);
Philip Müller's avatar
Philip Müller committed
169
@@ -873,9 +873,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
Philip Müller's avatar
Philip Müller committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
 /*
  * Attempt to initiate a splice from a file to a pipe.
  */
-static long do_splice_to(struct file *in, loff_t *ppos,
-			 struct pipe_inode_info *pipe, size_t len,
-			 unsigned int flags)
+long do_splice_to(struct file *in, loff_t *ppos,
+		  struct pipe_inode_info *pipe, size_t len,
+		  unsigned int flags)
 {
 	ssize_t (*splice_read)(struct file *, loff_t *,
 			       struct pipe_inode_info *, size_t, unsigned int);
diff --git a/fs/sync.c b/fs/sync.c
index 2a54c1f..7a5fa3f 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -27,7 +27,7 @@
  * wait == 1 case since in that case write_inode() functions do
  * sync_dirty_buffer() and thus effectively write one block at a time.
  */
-static int __sync_filesystem(struct super_block *sb, int wait)
+int __sync_filesystem(struct super_block *sb, int wait)
 {
 	if (wait)
 		sync_inodes_sb(sb);
diff --git a/include/linux/file.h b/include/linux/file.h
index 7444f5f..bdac0be 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -19,6 +19,7 @@ struct dentry;
 struct path;
 extern struct file *alloc_file(struct path *, fmode_t mode,
 	const struct file_operations *fop);
+extern struct file *get_empty_filp(void);
 
 static inline void fput_light(struct file *file, int fput_needed)
 {
diff --git a/include/linux/fs.h b/include/linux/fs.h
Philip Müller's avatar
Philip Müller committed
208
index e9867af..5f771e0 100644
Philip Müller's avatar
Philip Müller committed
209 210
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
Philip Müller's avatar
Philip Müller committed
211
@@ -1297,6 +1297,7 @@ extern void fasync_free(struct fasync_struct *);
Philip Müller's avatar
Philip Müller committed
212 213 214 215 216 217 218
 /* can be called from interrupts */
 extern void kill_fasync(struct fasync_struct **, int, int);
 
+extern int setfl(int fd, struct file * filp, unsigned long arg);
 extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
 extern void f_setown(struct file *filp, unsigned long arg, int force);
 extern void f_delown(struct file *filp);
Philip Müller's avatar
Philip Müller committed
219
@@ -1722,6 +1723,7 @@ struct file_operations {
Philip Müller's avatar
Philip Müller committed
220 221 222 223 224 225 226
 	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
 	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
 	int (*check_flags)(int);
+	int (*setfl)(struct file *, unsigned long);
 	int (*flock) (struct file *, int, struct file_lock *);
 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
 	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
Philip Müller's avatar
Philip Müller committed
227
@@ -1775,6 +1777,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
Philip Müller's avatar
Philip Müller committed
228 229 230 231 232 233 234 235 236 237 238 239
 			      struct iovec *fast_pointer,
 			      struct iovec **ret_pointer);
 
+typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
+typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
+				loff_t *);
+vfs_readf_t vfs_readf(struct file *file);
+vfs_writef_t vfs_writef(struct file *file);
+
 extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
 extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
 extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
Philip Müller's avatar
Philip Müller committed
240
@@ -2147,6 +2155,7 @@ extern int current_umask(void);
Philip Müller's avatar
Philip Müller committed
241 242 243 244 245 246 247
 extern void ihold(struct inode * inode);
 extern void iput(struct inode *);
 extern int generic_update_time(struct inode *, struct timespec *, int);
+extern int update_time(struct inode *, struct timespec *, int);
 
 /* /sys/fs */
 extern struct kobject *fs_kobj;
Philip Müller's avatar
Philip Müller committed
248
@@ -2426,6 +2435,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
Philip Müller's avatar
Philip Müller committed
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
 	return false;
 }
 #endif
+extern int __sync_filesystem(struct super_block *, int);
 extern int sync_filesystem(struct super_block *);
 extern const struct file_operations def_blk_fops;
 extern const struct file_operations def_chr_fops;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 12b2ab5..8b810d1 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -5,11 +5,14 @@
 struct mnt_namespace;
 struct fs_struct;
 struct user_namespace;
+struct vfsmount;
 
 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
 		struct user_namespace *, struct fs_struct *);
 extern void put_mnt_ns(struct mnt_namespace *ns);
 
+extern int is_current_mnt_ns(struct vfsmount *mnt);
+
 extern const struct file_operations proc_mounts_operations;
 extern const struct file_operations proc_mountinfo_operations;
 extern const struct file_operations proc_mountstats_operations;
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 00a2116..1f0a4a2 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -86,4 +86,10 @@ extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
 
 extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
 extern const struct pipe_buf_operations default_pipe_buf_ops;
+
+extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+			   loff_t *ppos, size_t len, unsigned int flags);
+extern long do_splice_to(struct file *in, loff_t *ppos,
+			 struct pipe_inode_info *pipe, size_t len,
+			 unsigned int flags);
 #endif