#include <linux/module.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/fileattr.h>
#include <linux/splice.h>
#include <linux/xattr.h>
#include <linux/security.h>
#include <linux/uaccess.h>
#include <linux/sched/signal.h>
#include <linux/cred.h>
#include <linux/namei.h>
#include <linux/fdtable.h>
#include <linux/ratelimit.h>
#include <linux/exportfs.h>
#include "overlayfs.h"
#define OVL_COPY_UP_CHUNK_SIZE …
static int ovl_ccup_set(const char *buf, const struct kernel_param *param)
{ … }
static int ovl_ccup_get(char *buf, const struct kernel_param *param)
{ … }
module_param_call(…);
MODULE_PARM_DESC(…) …;
static bool ovl_must_copy_xattr(const char *name)
{ … }
static int ovl_copy_acl(struct ovl_fs *ofs, const struct path *path,
struct dentry *dentry, const char *acl_name)
{ … }
int ovl_copy_xattr(struct super_block *sb, const struct path *oldpath, struct dentry *new)
{ … }
static int ovl_copy_fileattr(struct inode *inode, const struct path *old,
const struct path *new)
{ … }
static int ovl_verify_area(loff_t pos, loff_t pos2, loff_t len, loff_t totlen)
{ … }
static int ovl_copy_up_file(struct ovl_fs *ofs, struct dentry *dentry,
struct file *new_file, loff_t len)
{ … }
static int ovl_set_size(struct ovl_fs *ofs,
struct dentry *upperdentry, struct kstat *stat)
{ … }
static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry,
struct kstat *stat)
{ … }
int ovl_set_attr(struct ovl_fs *ofs, struct dentry *upperdentry,
struct kstat *stat)
{ … }
struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct dentry *real,
bool is_upper)
{ … }
struct ovl_fh *ovl_get_origin_fh(struct ovl_fs *ofs, struct dentry *origin)
{ … }
int ovl_set_origin_fh(struct ovl_fs *ofs, const struct ovl_fh *fh,
struct dentry *upper)
{ … }
static int ovl_set_upper_fh(struct ovl_fs *ofs, struct dentry *upper,
struct dentry *index)
{ … }
static int ovl_create_index(struct dentry *dentry, const struct ovl_fh *fh,
struct dentry *upper)
{ … }
struct ovl_copy_up_ctx { … };
static int ovl_link_up(struct ovl_copy_up_ctx *c)
{ … }
static int ovl_copy_up_data(struct ovl_copy_up_ctx *c, const struct path *temp)
{ … }
static int ovl_copy_up_metadata(struct ovl_copy_up_ctx *c, struct dentry *temp)
{ … }
struct ovl_cu_creds { … };
static int ovl_prep_cu_creds(struct dentry *dentry, struct ovl_cu_creds *cc)
{ … }
static void ovl_revert_cu_creds(struct ovl_cu_creds *cc)
{ … }
static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
{ … }
static int ovl_copy_up_tmpfile(struct ovl_copy_up_ctx *c)
{ … }
static int ovl_do_copy_up(struct ovl_copy_up_ctx *c)
{ … }
static bool ovl_need_meta_copy_up(struct dentry *dentry, umode_t mode,
int flags)
{ … }
static ssize_t ovl_getxattr_value(const struct path *path, char *name, char **value)
{ … }
static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)
{ … }
static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
int flags)
{ … }
static int ovl_copy_up_flags(struct dentry *dentry, int flags)
{ … }
static bool ovl_open_need_copy_up(struct dentry *dentry, int flags)
{ … }
int ovl_maybe_copy_up(struct dentry *dentry, int flags)
{ … }
int ovl_copy_up_with_data(struct dentry *dentry)
{ … }
int ovl_copy_up(struct dentry *dentry)
{ … }