]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - fs/aufs/whout.h
tracing/histogram: Fix sorting on old "cpu" value
[mirror_ubuntu-jammy-kernel.git] / fs / aufs / whout.h
CommitLineData
7fea21ae
AR
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2005-2021 Junjiro R. Okajima
4 *
5 * This program, aufs is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*
20 * whiteout for logical deletion and opaque directory
21 */
22
23#ifndef __AUFS_WHOUT_H__
24#define __AUFS_WHOUT_H__
25
26#ifdef __KERNEL__
27
28#include "dir.h"
29
30/* whout.c */
31int au_wh_name_alloc(struct qstr *wh, const struct qstr *name);
32int au_wh_test(struct user_namespace *h_userns, struct path *h_ppath,
33 struct qstr *wh_name, int try_sio);
34int au_diropq_test(struct user_namespace *h_userns, struct path *h_path);
35struct au_branch;
36struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br,
37 struct qstr *prefix);
38int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br);
39int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path,
40 struct dentry *dentry);
41int au_wh_init(struct au_branch *br, struct super_block *sb);
42
43/* diropq flags */
44#define AuDiropq_CREATE 1
45#define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name)
46#define au_fset_diropq(flags, name) \
47 do { (flags) |= AuDiropq_##name; } while (0)
48#define au_fclr_diropq(flags, name) \
49 do { (flags) &= ~AuDiropq_##name; } while (0)
50
51struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
52 unsigned int flags);
53struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
54 struct au_branch *br);
55struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex,
56 struct dentry *h_parent);
57
58/* real rmdir for the whiteout-ed dir */
59struct au_whtmp_rmdir {
60 struct inode *dir;
61 struct au_branch *br;
62 struct dentry *wh_dentry;
63 struct au_nhash whlist;
64};
65
66struct au_whtmp_rmdir *au_whtmp_rmdir_alloc(struct super_block *sb, gfp_t gfp);
67void au_whtmp_rmdir_free(struct au_whtmp_rmdir *whtmp);
68int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex,
69 struct dentry *wh_dentry, struct au_nhash *whlist);
70void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex,
71 struct dentry *wh_dentry, struct au_whtmp_rmdir *args);
72
73/* ---------------------------------------------------------------------- */
74
75static inline struct dentry *au_diropq_create(struct dentry *dentry,
76 aufs_bindex_t bindex)
77{
78 return au_diropq_sio(dentry, bindex, AuDiropq_CREATE);
79}
80
81static inline int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex)
82{
83 return PTR_ERR(au_diropq_sio(dentry, bindex, !AuDiropq_CREATE));
84}
85
86#endif /* __KERNEL__ */
87#endif /* __AUFS_WHOUT_H__ */