[PATCH 30/67] aufs whiteout for logical deletion and opaque directory, header

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-fsdevel@...>, <linux-kernel@...>
Cc: Junjiro Okajima <hooanon05@...>
Date: Friday, May 16, 2008 - 10:32 am

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

	initial commit
	aufs whiteout for logical deletion and opaque directory, header

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/whout.h |  140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 140 insertions(+), 0 deletions(-)

diff --git a/fs/aufs/whout.h b/fs/aufs/whout.h
new file mode 100644
index 0000000..f66239f
--- /dev/null
+++ b/fs/aufs/whout.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * whiteout for logical deletion and opaque directory
+ *
+ * $Id: whout.h,v 1.2 2008/04/21 02:00:37 sfjro Exp $
+ */
+
+#ifndef __AUFS_WHOUT_H__
+#define __AUFS_WHOUT_H__
+
+#ifdef __KERNEL__
+
+#include <linux/fs.h>
+#include <linux/aufs_type.h>
+#include "dir.h"
+#include "opts.h"
+#include "super.h"
+
+int au_wh_name_alloc(const char *name, int len, struct qstr *wh);
+void au_wh_name_free(struct qstr *wh);
+
+struct au_ndx;
+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio,
+	       struct au_ndx *ndx);
+int au_diropq_test(struct dentry *h_dentry, struct au_ndx *ndx);
+
+struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct qstr *prefix,
+			     struct au_ndx *ndx);
+int au_whtmp_ren(struct inode *dir, struct dentry *dentry, aufs_bindex_t bindex,
+		 int noself);
+int au_wh_unlink_dentry(struct inode *h_dir, struct dentry *wh_dentry,
+			struct dentry *dentry, struct inode *dir, int dlgt);
+
+struct au_branch;
+int au_wh_init(struct dentry *h_parent, struct au_branch *br,
+	       struct vfsmount *nfsmnt, struct super_block *sb);
+
+/* diropq flags */
+#define AuDiropq_CREATE	1
+#define AuDiropq_DLGT	(1 << 1)
+#define au_ftest_diropq(flags, name)	((flags) & AuDiropq_##name)
+#define au_fset_diropq(flags, name)	{ (flags) |= AuDiropq_##name; }
+#define au_fclr_diropq(flags, name)	{ (flags) &= ~AuDiropq_##name; }
+#ifndef CONFIG_AUFS_DLGT
+#undef AuDiropq_DLGT
+#define AuDiropq_DLGT	0
+#endif
+
+struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
+			     unsigned int flags);
+
+struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
+			  struct au_ndx *ndx);
+struct dentry *au_wh_create(struct inode *dir, struct dentry *dentry,
+			    aufs_bindex_t bindex, struct dentry *h_parent,
+			    struct au_ndx *ndx);
+
+/* real rmdir the whiteout-ed dir */
+struct au_whtmp_rmdir_args {
+	struct dentry *h_dentry;
+	struct au_nhash whlist;
+	aufs_bindex_t bindex;
+	struct inode *dir, *inode;
+	int noself;
+};
+
+struct au_nhash;
+int au_whtmp_rmdir(struct dentry *h_dentry, struct au_nhash *whlist,
+		   aufs_bindex_t bindex, struct inode *dir, struct inode *inode,
+		   int noself);
+void au_whtmp_kick_rmdir(struct dentry *h_dentry, struct au_nhash *whlist,
+			 aufs_bindex_t bindex, struct inode *dir,
+			 struct inode *inode, int noself,
+			 struct au_whtmp_rmdir_args *args);
+
+/* ---------------------------------------------------------------------- */
+
+static inline
+struct dentry *au_diropq_create(struct dentry *dentry, aufs_bindex_t bindex,
+				int dlgt)
+{
+	unsigned int flags = AuDiropq_CREATE;
+	if (unlikely(dlgt))
+		au_fset_diropq(flags, DLGT);
+	return au_diropq_sio(dentry, bindex, flags);
+}
+
+static inline
+int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex, int dlgt)
+{
+	unsigned int flags = !AuDiropq_CREATE;
+	if (unlikely(dlgt))
+		au_fset_diropq(flags, DLGT);
+	return PTR_ERR(au_diropq_sio(dentry, bindex, flags));
+}
+
+/* ---------------------------------------------------------------------- */
+
+#ifdef CONFIG_AUFS_ROBR
+/* robr.c */
+int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
+		    struct qstr *wh_name, int try_sio, struct au_ndx *ndx);
+int au_test_robr_shwh(struct super_block *sb, const struct qstr *name);
+#else
+static inline
+int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
+		    struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
+{
+	return au_wh_test(h_parent, wh_name, try_sio, ndx);
+}
+
+static inline
+int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
+{
+	if (unlikely(!au_opt_test(au_mntflags(sb), SHWH)
+		     && !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
+		return -EPERM;
+	return 0;
+}
+#endif /* CONFIG_AUFS_ROBR */
+
+#endif /* __KERNEL__ */
+#endif /* __AUFS_WHOUT_H__ */
-- 
1.4.4.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/67] aufs document, , (Fri May 16, 10:32 am)
Re: [PATCH 1/67] aufs document, Dave Quigley, (Fri May 16, 10:59 am)
Re: [PATCH 1/67] aufs document , , (Fri May 16, 11:45 am)
Re: [PATCH 1/67] aufs document, Dave Quigley, (Fri May 16, 12:09 pm)
Re: [PATCH 1/67] aufs document , , (Fri May 16, 10:06 pm)
Re: [PATCH 1/67] aufs document, Jan Engelhardt, (Fri May 16, 11:32 am)
Re: [PATCH 1/67] aufs document , , (Sun May 18, 10:25 pm)
Re: [PATCH 1/67] aufs document, Josef 'Jeff' Sipek, (Fri May 16, 5:07 pm)
[PATCH 2/67] aufs manual, , (Fri May 16, 10:32 am)
[PATCH 3/67] aufs global header file, , (Fri May 16, 10:32 am)
[PATCH 4/67] aufs configuration, , (Fri May 16, 10:32 am)
Re: [PATCH 4/67] aufs configuration, Jan Engelhardt, (Fri May 16, 11:28 am)
Re: [PATCH 4/67] aufs configuration , , (Sun May 18, 10:23 pm)
[PATCH 5/67] aufs Makefile, , (Fri May 16, 10:32 am)
Re: [PATCH 5/67] aufs Makefile, Sam Ravnborg, (Fri May 16, 1:25 pm)
Re: [PATCH 5/67] aufs Makefile , , (Sun May 18, 10:27 pm)
[PATCH 6/67] aufs main header file, , (Fri May 16, 10:32 am)
Re: [PATCH 6/67] aufs main header file, Jan Engelhardt, (Fri May 16, 11:33 am)
Re: [PATCH 8/67] aufs module global variables and operations, Jan Engelhardt, (Fri May 16, 11:36 am)
[PATCH 13/67] aufs branch management, , (Fri May 16, 10:32 am)
[PATCH 24/67] aufs sub-VFS, header, , (Fri May 16, 10:32 am)
[PATCH 25/67] aufs sub-VFS, source, , (Fri May 16, 10:32 am)
[PATCH 26/67] aufs sub-dcache, header, , (Fri May 16, 10:32 am)
[PATCH 27/67] aufs sub-dcache, source, , (Fri May 16, 10:32 am)
[PATCH 30/67] aufs whiteout for logical deletion and opaque ..., , (Fri May 16, 10:32 am)
[PATCH 32/67] aufs pseudo-link, , (Fri May 16, 10:32 am)
[PATCH 36/67] aufs dentry private data, , (Fri May 16, 10:32 am)
[PATCH 37/67] aufs file operations, , (Fri May 16, 10:32 am)
[PATCH 39/67] aufs file private data, , (Fri May 16, 10:32 am)
[PATCH 44/67] aufs inode operations, , (Fri May 16, 10:32 am)
[PATCH 45/67] aufs inode functions, , (Fri May 16, 10:32 am)
[PATCH 46/67] aufs inode private data, , (Fri May 16, 10:33 am)
[PATCH 52/67] aufs inotify handler, , (Fri May 16, 10:33 am)
[PATCH 55/67] aufs export via nfs, , (Fri May 16, 10:33 am)
[PATCH 57/67] aufs sysfs interface, , (Fri May 16, 10:33 am)
[PATCH 62/67] aufs magic sysrq handler, , (Fri May 16, 10:33 am)
[PATCH 63/67] aufs mount helper, , (Fri May 16, 10:33 am)
[PATCH 64/67] aufs pseudo-link helper, , (Fri May 16, 10:33 am)
[PATCH 66/67] aufs umount helper, , (Fri May 16, 10:33 am)
[PATCH 67/67] merge aufs, , (Fri May 16, 10:33 am)