VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / linux / vserver / dlimit.h
1 #ifndef _VX_DLIMIT_H
2 #define _VX_DLIMIT_H
3
4 #include "switch.h"
5 #include <linux/spinlock.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         const char __user *name;
18         uint32_t flags;
19 };
20
21 struct  vcmd_ctx_dlimit_v0 {
22         const char __user *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         spinlock_t dl_lock;                     /* protect the values */
51
52         uint64_t dl_space_used;                 /* used space in bytes */
53         uint64_t dl_space_total;                /* maximum space in bytes */
54         uint32_t dl_inodes_used;                /* used inodes */
55         uint32_t dl_inodes_total;               /* maximum inodes */
56
57         unsigned int dl_nrlmult;                /* non root limit mult */
58 };
59
60 struct rcu_head;
61
62 extern void rcu_free_dl_info(struct rcu_head *);
63 extern void unhash_dl_info(struct dl_info *);
64
65 extern struct dl_info *locate_dl_info(struct super_block *, xid_t);
66
67
68 struct kstatfs;
69
70 extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
71
72
73 extern int vc_add_dlimit(uint32_t, void __user *);
74 extern int vc_rem_dlimit(uint32_t, void __user *);
75
76 extern int vc_set_dlimit(uint32_t, void __user *);
77 extern int vc_get_dlimit(uint32_t, void __user *);
78
79
80 typedef uint64_t dlsize_t;
81
82
83 #endif  /* __KERNEL__ */
84
85 #endif  /* _VX_DLIMIT_H */