1 #ifndef __RES_COUNTER_H__
2 #define __RES_COUNTER_H__
56 #define RESOURCE_MAX (unsigned long long)LLONG_MAX
75 int (*read_strategy)(
unsigned long long val,
char *
s));
80 unsigned long long *
res);
148 static inline unsigned long long res_counter_margin(
struct res_counter *
cnt)
150 unsigned long long margin;
158 spin_unlock_irqrestore(&cnt->
lock, flags);
169 static inline unsigned long long
170 res_counter_soft_limit_excess(
struct res_counter *cnt)
172 unsigned long long excess;
180 spin_unlock_irqrestore(&cnt->
lock, flags);
184 static inline void res_counter_reset_max(
struct res_counter *cnt)
190 spin_unlock_irqrestore(&cnt->
lock, flags);
193 static inline void res_counter_reset_failcnt(
struct res_counter *cnt)
199 spin_unlock_irqrestore(&cnt->
lock, flags);
202 static inline int res_counter_set_limit(
struct res_counter *cnt,
203 unsigned long long limit)
209 if (cnt->
usage <= limit) {
213 spin_unlock_irqrestore(&cnt->
lock, flags);
218 res_counter_set_soft_limit(
struct res_counter *cnt,
225 spin_unlock_irqrestore(&cnt->
lock, flags);