// SPDX-License-Identifier: GPL-2.0-or-later /* * eCryptfs: Linux filesystem encryption layer * * Copyright (C) 1997-2003 Erez Zadok * Copyright (C) 2001-2003 Stony Brook University * Copyright (C) 2004-2006 International Business Machines Corp. * Author(s): Michael A. Halcrow <[email protected]> * Michael C. Thompson <[email protected]> */ #include <linux/fs.h> #include <linux/mount.h> #include <linux/key.h> #include <linux/slab.h> #include <linux/seq_file.h> #include <linux/file.h> #include <linux/statfs.h> #include <linux/magic.h> #include "ecryptfs_kernel.h" struct kmem_cache *ecryptfs_inode_info_cache; /** * ecryptfs_alloc_inode - allocate an ecryptfs inode * @sb: Pointer to the ecryptfs super block * * Called to bring an inode into existence. * * Only handle allocation, setting up structures should be done in * ecryptfs_read_inode. This is because the kernel, between now and * then, will 0 out the private data pointer. * * Returns a pointer to a newly allocated inode, NULL otherwise */ static struct inode *ecryptfs_alloc_inode(struct super_block *sb) { … } static void ecryptfs_free_inode(struct inode *inode) { … } /** * ecryptfs_destroy_inode * @inode: The ecryptfs inode * * This is used during the final destruction of the inode. All * allocation of memory related to the inode, including allocated * memory in the crypt_stat struct, will be released here. * There should be no chance that this deallocation will be missed. */ static void ecryptfs_destroy_inode(struct inode *inode) { … } /** * ecryptfs_statfs * @dentry: The ecryptfs dentry * @buf: The struct kstatfs to fill in with stats * * Get the filesystem statistics. Currently, we let this pass right through * to the lower filesystem and take no action ourselves. */ static int ecryptfs_statfs(struct dentry *dentry, struct kstatfs *buf) { … } /** * ecryptfs_evict_inode * @inode: The ecryptfs inode * * Called by iput() when the inode reference count reached zero * and the inode is not hashed anywhere. Used to clear anything * that needs to be, before the inode is completely destroyed and put * on the inode free list. We use this to drop out reference to the * lower inode. */ static void ecryptfs_evict_inode(struct inode *inode) { … } /* * ecryptfs_show_options * * Prints the mount options for a given superblock. * Returns zero; does not fail. */ static int ecryptfs_show_options(struct seq_file *m, struct dentry *root) { … } const struct super_operations ecryptfs_sops = …;