lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 16 Sep 2010 15:12:05 -0700 From: Valerie Aurora <vaurora@...hat.com> To: Alexander Viro <viro@...iv.linux.org.uk> Cc: Miklos Szeredi <miklos@...redi.hu>, Christoph Hellwig <hch@...radead.org>, Andreas Gruenbacher <agruen@...e.de>, Nick Piggin <npiggin@...nel.dk>, linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, Valerie Aurora <vaurora@...hat.com> Subject: [PATCH 14/34] union-mount: Create union_add_dir() union_add_dir() fills out the union stack for the topmost dentry with the path of the directory in this layer of the union. Signed-off-by: Valerie Aurora <vaurora@...hat.com> --- fs/union.c | 28 ++++++++++++++++++++++++++++ fs/union.h | 2 ++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/fs/union.c b/fs/union.c index a191bef..45552f8 100644 --- a/fs/union.c +++ b/fs/union.c @@ -65,3 +65,31 @@ void d_free_unions(struct dentry *topmost) kfree(topmost->d_union_stack); topmost->d_union_stack = NULL; } + +/** + * union_add_dir - Add another layer to a unioned directory + * + * @topmost - topmost directory + * @lower - directory in the current layer + * @layer - index of layer to add this at + * + * @layer counts starting at 0 for the dir below the topmost dir. + * Must take a reference to @lower (call path_get()) before calling + * this function. + */ + +int union_add_dir(struct path *topmost, struct path *lower, + unsigned int layer) +{ + struct path *path; + struct dentry *dentry = topmost->dentry; + BUG_ON(layer >= dentry->d_sb->s_union_count); + + if (!dentry->d_union_stack) + dentry->d_union_stack = union_alloc(topmost); + if (!dentry->d_union_stack) + return -ENOMEM; + path = union_find_dir(dentry, layer); + *path = *lower; + return 0; +} diff --git a/fs/union.h b/fs/union.h index 353f78d..bd03d67 100644 --- a/fs/union.h +++ b/fs/union.h @@ -52,6 +52,7 @@ struct union_stack { #define IS_DIR_UNIONED(dentry) ((dentry)->d_union_stack) extern void d_free_unions(struct dentry *); +extern int union_add_dir(struct path *, struct path *, unsigned int); static inline struct path *union_find_dir(struct dentry *dentry, unsigned int layer) { @@ -64,6 +65,7 @@ static inline struct path *union_find_dir(struct dentry *dentry, #define IS_DIR_UNIONED(x) (0) #define d_free_unions(x) do { } while (0) +#define union_add_dir(x, y, z) ({ BUG(); (0); }) #define union_find_dir(x, y) ({ BUG(); (NULL); }) #endif /* CONFIG_UNION_MOUNT */ -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists