10 #include <linux/types.h>
51 *limit_fail_at =
NULL;
56 spin_unlock(&c->
lock);
65 if (ret < 0 && !force) {
66 for (u = counter; u !=
c; u = u->
parent) {
69 spin_unlock(&u->
lock);
80 return __res_counter_charge(counter, val, limit_fail_at,
false);
86 return __res_counter_charge(counter, val, limit_fail_at,
true);
105 for (c = counter; c !=
top; c = c->
parent) {
108 spin_unlock(&c->
lock);
118 static inline unsigned long long *
119 res_counter_member(
struct res_counter *counter,
int member)
123 return &counter->
usage;
127 return &counter->
limit;
139 const char __user *userbuf,
size_t nbytes, loff_t *
pos,
140 int (*read_strategy)(
unsigned long long val,
char *st_buf))
142 unsigned long long *
val;
146 val = res_counter_member(counter, member);
148 s += read_strategy(*val, s);
150 s +=
sprintf(s,
"%llu\n", *val);
155 #if BITS_PER_LONG == 32
162 ret = *res_counter_member(counter, member);
163 spin_unlock_irqrestore(&counter->
lock, flags);
170 return *res_counter_member(counter, member);
175 unsigned long long *
res)
182 if (*res != 1 || *end !=
'\0')
201 unsigned long long tmp, *
val;
203 if (write_strategy) {
204 if (write_strategy(buf, &tmp))
212 val = res_counter_member(counter, member);
214 spin_unlock_irqrestore(&counter->
lock, flags);