aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/res_counter.h5
-rw-r--r--kernel/res_counter.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 61363ce896d5..8cb1ecd420a9 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -39,8 +39,9 @@ struct res_counter {
39 spinlock_t lock; 39 spinlock_t lock;
40}; 40};
41 41
42/* 42/**
43 * Helpers to interact with userspace 43 * Helpers to interact with userspace
44 * res_counter_read_u64() - returns the value of the specified member.
44 * res_counter_read/_write - put/get the specified fields from the 45 * res_counter_read/_write - put/get the specified fields from the
45 * res_counter struct to/from the user 46 * res_counter struct to/from the user
46 * 47 *
@@ -51,6 +52,8 @@ struct res_counter {
51 * @pos: and the offset. 52 * @pos: and the offset.
52 */ 53 */
53 54
55u64 res_counter_read_u64(struct res_counter *counter, int member);
56
54ssize_t res_counter_read(struct res_counter *counter, int member, 57ssize_t res_counter_read(struct res_counter *counter, int member,
55 const char __user *buf, size_t nbytes, loff_t *pos, 58 const char __user *buf, size_t nbytes, loff_t *pos,
56 int (*read_strategy)(unsigned long long val, char *s)); 59 int (*read_strategy)(unsigned long long val, char *s));
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index a508c2769463..70587657dda3 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -93,6 +93,11 @@ ssize_t res_counter_read(struct res_counter *counter, int member,
93 pos, buf, s - buf); 93 pos, buf, s - buf);
94} 94}
95 95
96u64 res_counter_read_u64(struct res_counter *counter, int member)
97{
98 return *res_counter_member(counter, member);
99}
100
96ssize_t res_counter_write(struct res_counter *counter, int member, 101ssize_t res_counter_write(struct res_counter *counter, int member,
97 const char __user *userbuf, size_t nbytes, loff_t *pos, 102 const char __user *userbuf, size_t nbytes, loff_t *pos,
98 int (*write_strategy)(char *st_buf, unsigned long long *val)) 103 int (*write_strategy)(char *st_buf, unsigned long long *val))