From 32759f7d7af5454c616574190c388e1a59184f92 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 21 Oct 2021 08:34:55 +0100 Subject: cachefiles: Implement a function to get/create a directory in the cache Implement a function to get/create structural directories in the cache. This is used for setting up a cache and creating volume substructures. The directory in memory are marked with the S_KERNEL_FILE inode flag whilst they're in use to tell rmdir to reject attempts to remove them. Changes ======= ver #3: - Return an indication as to whether the directory was freshly created. Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/163819631182.215744.3322471539523262619.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906933130.143852.962088616746509062.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967141952.1823006.7832985646370603833.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021542169.640689.18266858945694357839.stgit@warthog.procyon.org.uk/ # v4 --- fs/cachefiles/internal.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fs/cachefiles/internal.h') diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 3783a3e01027..48768a3ab105 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h @@ -125,6 +125,15 @@ static inline int cachefiles_inject_remove_error(void) return cachefiles_error_injection_state & 2 ? -EIO : 0; } +/* + * namei.c + */ +extern struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, + struct dentry *dir, + const char *name, + bool *_is_new); +extern void cachefiles_put_directory(struct dentry *dir); + /* * security.c */ -- cgit v1.2.3-59-g8ed1b