mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, torvalds@osdl.org, hch@infradead.org,
	viro@ftp.linux.org.uk, linux-fsdevel@vger.kernel.org,
	penberg@cs.helsinki.fi, ezk@cs.sunysb.edu, mhalcrow@us.ibm.com
Subject: [PATCH 1 of 2] Stackfs: Introduce stackfs_copy_{attr,inode}_*
Date: Fri, 13 Oct 2006 07:18:49 -0400	[thread overview]
Message-ID: <ceb6edcac7047367ca16.1160738329@thor.fsl.cs.sunysb.edu> (raw)
In-Reply-To: <patchbomb.1160738328@thor.fsl.cs.sunysb.edu>

From: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu>

The following patch introduces several stackfs_copy_* functions which allow
stackable filesystems (such as eCryptfs and Unionfs) to easily copy over
(currently only) inode attributes. This prevents code duplication and allows
for code reuse.

Signed-off-by: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu>

---

1 file changed, 65 insertions(+)
include/linux/stack_fs.h |   65 ++++++++++++++++++++++++++++++++++++++++++++++

diff --git a/include/linux/stack_fs.h b/include/linux/stack_fs.h
new file mode 100644
--- /dev/null
+++ b/include/linux/stack_fs.h
@@ -0,0 +1,65 @@
+#ifndef _LINUX_STACK_FS_H
+#define _LINUX_STACK_FS_H
+
+/* This file defines generic functions used primarily by stackable
+ * filesystems
+ */
+
+static inline void stackfs_copy_inode_size(struct inode *dst,
+					   const struct inode *src)
+{
+	i_size_write(dst, i_size_read((struct inode *)src));
+	dst->i_blocks = src->i_blocks;
+}
+
+static inline void stackfs_copy_attr_atime(struct inode *dest,
+					   const struct inode *src)
+{
+	dest->i_atime = src->i_atime;
+}
+
+static inline void stackfs_copy_attr_times(struct inode *dest,
+					   const struct inode *src)
+{
+	dest->i_atime = src->i_atime;
+	dest->i_mtime = src->i_mtime;
+	dest->i_ctime = src->i_ctime;
+}
+
+static inline void stackfs_copy_attr_timesizes(struct inode *dest,
+					       const struct inode *src)
+{
+	dest->i_atime = src->i_atime;
+	dest->i_mtime = src->i_mtime;
+	dest->i_ctime = src->i_ctime;
+	stackfs_copy_inode_size(dest, src);
+}
+
+static inline void __stackfs_copy_attr_all(struct inode *dest,
+					   const struct inode *src,
+					   int (*get_nlinks)(struct inode *))
+{
+	if (!get_nlinks)
+		dest->i_nlink = src->i_nlink;
+	else
+		dest->i_nlink = get_nlinks(dest);
+
+	dest->i_mode = src->i_mode;
+	dest->i_uid = src->i_uid;
+	dest->i_gid = src->i_gid;
+	dest->i_rdev = src->i_rdev;
+	dest->i_atime = src->i_atime;
+	dest->i_mtime = src->i_mtime;
+	dest->i_ctime = src->i_ctime;
+	dest->i_blkbits = src->i_blkbits;
+	dest->i_flags = src->i_flags;
+}
+
+static inline void stackfs_copy_attr_all(struct inode *dest,
+					 const struct inode *src)
+{
+	__stackfs_copy_attr_all(dest, src, NULL);
+}
+
+#endif /* _LINUX_STACK_FS_H */
+



  reply	other threads:[~2006-10-13 11:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13 11:18 [PATCH 0 of 2] Stackfs: generic stackable filesystem helper functions Josef Jeff Sipek
2006-10-13 11:18 ` Josef Jeff Sipek [this message]
2006-10-13 19:04   ` [PATCH 1 of 2] Stackfs: Introduce stackfs_copy_{attr,inode}_* Andrew James Wade
2006-10-15 17:38     ` [PATCH] " Jan Engelhardt
2006-10-13 19:27   ` Andrew Morton
2006-10-13 20:07     ` Josef Sipek
2006-10-13 20:16       ` Josef Sipek
2006-10-13 20:37       ` Andrew Morton
2006-10-15 12:36       ` Jan Engelhardt
2006-10-13 11:18 ` [PATCH 2 of 2] eCryptfs: Use stackfs's generic copy inode attr functions Josef Jeff Sipek
2006-10-13 12:02 ` [PATCH 0 of 2] Stackfs: generic stackable filesystem helper functions Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ceb6edcac7047367ca16.1160738329@thor.fsl.cs.sunysb.edu \
    --to=jsipek@cs.sunysb.edu \
    --cc=akpm@osdl.org \
    --cc=ezk@cs.sunysb.edu \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhalcrow@us.ibm.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®