1 #ifndef _VX_LIMIT_INT_H
2 #define _VX_LIMIT_INT_H
7 #define VXD_RCRES(r) VXD_CBIT(cres, (r))
8 #define VXD_RLIMIT(r) VXD_CBIT(limit, (r))
10 extern const char *vlimit_name[NUM_LIMITS];
12 static inline void __vx_acc_cres(struct vx_info *vxi,
13 int res, int dir, void *_data, char *_file, int _line)
16 vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5d%s (%p)",
17 (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
18 (vxi ? atomic_read(&vxi->limit.rcur[res]) : 0),
19 (dir > 0) ? "++" : "--", _data, _file, _line);
24 atomic_inc(&vxi->limit.rcur[res]);
26 atomic_dec(&vxi->limit.rcur[res]);
29 static inline void __vx_add_cres(struct vx_info *vxi,
30 int res, int amount, void *_data, char *_file, int _line)
33 vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5d += %5d (%p)",
34 (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
35 (vxi ? atomic_read(&vxi->limit.rcur[res]) : 0),
36 amount, _data, _file, _line);
41 atomic_add(amount, &vxi->limit.rcur[res]);
44 static inline int __vx_cres_avail(struct vx_info *vxi,
45 int res, int num, char *_file, int _line)
50 vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d",
51 (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
52 (vxi ? vxi->limit.rlim[res] : 1),
53 (vxi ? atomic_read(&vxi->limit.rcur[res]) : 0),
60 value = atomic_read(&vxi->limit.rcur[res]);
62 if (value > vxi->limit.rmax[res])
63 vxi->limit.rmax[res] = value;
65 if (vxi->limit.rlim[res] == RLIM_INFINITY)
68 if (value + num <= vxi->limit.rlim[res])
71 atomic_inc(&vxi->limit.lhit[res]);
75 #endif /* __KERNEL__ */
76 #endif /* _VX_LIMIT_H */