]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - fs/aufs/hbl.h
x86/speculation/mds: Add sysfs reporting for MDS
[mirror_ubuntu-bionic-kernel.git] / fs / aufs / hbl.h
1 /*
2 * Copyright (C) 2017 Junjiro R. Okajima
3 *
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /*
19 * helpers for hlist_bl.h
20 */
21
22 #ifndef __AUFS_HBL_H__
23 #define __AUFS_HBL_H__
24
25 #ifdef __KERNEL__
26
27 #include <linux/list_bl.h>
28
29 static inline void au_hbl_add(struct hlist_bl_node *node,
30 struct hlist_bl_head *hbl)
31 {
32 hlist_bl_lock(hbl);
33 hlist_bl_add_head(node, hbl);
34 hlist_bl_unlock(hbl);
35 }
36
37 static inline void au_hbl_del(struct hlist_bl_node *node,
38 struct hlist_bl_head *hbl)
39 {
40 hlist_bl_lock(hbl);
41 hlist_bl_del(node);
42 hlist_bl_unlock(hbl);
43 }
44
45 #define au_hbl_for_each(pos, head) \
46 for (pos = hlist_bl_first(head); \
47 pos; \
48 pos = pos->next)
49
50 static inline unsigned long au_hbl_count(struct hlist_bl_head *hbl)
51 {
52 unsigned long cnt;
53 struct hlist_bl_node *pos;
54
55 cnt = 0;
56 hlist_bl_lock(hbl);
57 au_hbl_for_each(pos, hbl)
58 cnt++;
59 hlist_bl_unlock(hbl);
60 return cnt;
61 }
62
63 #endif /* __KERNEL__ */
64 #endif /* __AUFS_HBL_H__ */