remove persistent to actually get rid of the contexts
[util-vserver.git] / src / dlimit.h
1 #ifndef _VX_DLIMIT_H
2 #define _VX_DLIMIT_H
3
4 #include "virtual.h"
5 // #include "switch.h"
6
7 /*  inode vserver commands */
8
9 #define VCMD_add_dlimit         VC_CMD(DLIMIT, 1, 0)
10 #define VCMD_rem_dlimit         VC_CMD(DLIMIT, 2, 0)
11
12 #define VCMD_set_dlimit         VC_CMD(DLIMIT, 5, 0)
13 #define VCMD_get_dlimit         VC_CMD(DLIMIT, 6, 0)
14
15
16 struct  vcmd_ctx_dlimit_base_v0 {
17         char *name;
18         uint32_t flags;
19 };
20
21 struct  vcmd_ctx_dlimit_v0 {
22         char *name;
23         uint32_t space_used;                    /* used space in kbytes */
24         uint32_t space_total;                   /* maximum space in kbytes */
25         uint32_t inodes_used;                   /* used inodes */
26         uint32_t inodes_total;                  /* maximum inodes */
27         uint32_t reserved;                      /* reserved for root in % */
28         uint32_t flags;
29 };
30
31 #define CDLIM_UNSET             (0ULL)
32 #define CDLIM_INFINITY          (~0ULL)
33 #define CDLIM_KEEP              (~1ULL)
34
35
36 #ifdef  __KERNEL__
37
38 struct super_block;
39
40 struct dl_info {
41         struct hlist_node dl_hlist;             /* linked list of contexts */
42         struct rcu_head dl_rcu;                 /* the rcu head */
43         xid_t dl_xid;                           /* context id */
44         atomic_t dl_usecnt;                     /* usage count */
45         atomic_t dl_refcnt;                     /* reference count */
46
47         struct super_block *dl_sb;              /* associated superblock */
48
49         struct rw_semaphore dl_sem;             /* protect the values */
50
51         uint64_t dl_space_used;                 /* used space in bytes */
52         uint64_t dl_space_total;                /* maximum space in bytes */
53         uint32_t dl_inodes_used;                /* used inodes */
54         uint32_t dl_inodes_total;               /* maximum inodes */
55
56         unsigned int dl_nrlmult;                /* non root limit mult */
57 };
58
59 extern void rcu_free_dl_info(void *);
60 extern void unhash_dl_info(struct dl_info *);
61
62 struct kstatfs;
63
64 extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
65
66
67 extern int vc_add_dlimit(uint32_t, void __user *);
68 extern int vc_rem_dlimit(uint32_t, void __user *);
69
70 extern int vc_set_dlimit(uint32_t, void __user *);
71 extern int vc_get_dlimit(uint32_t, void __user *);
72
73
74 #endif  /* __KERNEL__ */
75
76 #endif  /* _VX_DLIMIT_H */