diff options
author | Kent Overstreet <koverstreet@google.com> | 2013-03-28 14:50:55 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-03-28 14:50:55 -0400 |
commit | 169ef1cf6171d35550fef85645b83b960e241cff (patch) | |
tree | 61451e5477e992d5bdee0fc906f9db018afc1239 /drivers/md/bcache/util.c | |
parent | 0b6ef4164f50698eee536903d69d086add1a7889 (diff) |
bcache: Don't export utility code, prefix with bch_
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: linux-bcache@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/bcache/util.c')
-rw-r--r-- | drivers/md/bcache/util.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index dcec2e4f84ad..22324d8b2840 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #define simple_strtouint(c, end, base) simple_strtoul(c, end, base) | 19 | #define simple_strtouint(c, end, base) simple_strtoul(c, end, base) |
20 | 20 | ||
21 | #define STRTO_H(name, type) \ | 21 | #define STRTO_H(name, type) \ |
22 | int name ## _h(const char *cp, type *res) \ | 22 | int bch_ ## name ## _h(const char *cp, type *res) \ |
23 | { \ | 23 | { \ |
24 | int u = 0; \ | 24 | int u = 0; \ |
25 | char *e; \ | 25 | char *e; \ |
@@ -67,14 +67,13 @@ int name ## _h(const char *cp, type *res) \ | |||
67 | *res = i; \ | 67 | *res = i; \ |
68 | return 0; \ | 68 | return 0; \ |
69 | } \ | 69 | } \ |
70 | EXPORT_SYMBOL_GPL(name ## _h); | ||
71 | 70 | ||
72 | STRTO_H(strtoint, int) | 71 | STRTO_H(strtoint, int) |
73 | STRTO_H(strtouint, unsigned int) | 72 | STRTO_H(strtouint, unsigned int) |
74 | STRTO_H(strtoll, long long) | 73 | STRTO_H(strtoll, long long) |
75 | STRTO_H(strtoull, unsigned long long) | 74 | STRTO_H(strtoull, unsigned long long) |
76 | 75 | ||
77 | ssize_t hprint(char *buf, int64_t v) | 76 | ssize_t bch_hprint(char *buf, int64_t v) |
78 | { | 77 | { |
79 | static const char units[] = "?kMGTPEZY"; | 78 | static const char units[] = "?kMGTPEZY"; |
80 | char dec[3] = ""; | 79 | char dec[3] = ""; |
@@ -93,9 +92,8 @@ ssize_t hprint(char *buf, int64_t v) | |||
93 | 92 | ||
94 | return sprintf(buf, "%lli%s%c", v, dec, units[u]); | 93 | return sprintf(buf, "%lli%s%c", v, dec, units[u]); |
95 | } | 94 | } |
96 | EXPORT_SYMBOL_GPL(hprint); | ||
97 | 95 | ||
98 | ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], | 96 | ssize_t bch_snprint_string_list(char *buf, size_t size, const char * const list[], |
99 | size_t selected) | 97 | size_t selected) |
100 | { | 98 | { |
101 | char *out = buf; | 99 | char *out = buf; |
@@ -108,9 +106,8 @@ ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], | |||
108 | out[-1] = '\n'; | 106 | out[-1] = '\n'; |
109 | return out - buf; | 107 | return out - buf; |
110 | } | 108 | } |
111 | EXPORT_SYMBOL_GPL(snprint_string_list); | ||
112 | 109 | ||
113 | ssize_t read_string_list(const char *buf, const char * const list[]) | 110 | ssize_t bch_read_string_list(const char *buf, const char * const list[]) |
114 | { | 111 | { |
115 | size_t i; | 112 | size_t i; |
116 | char *s, *d = kstrndup(buf, PAGE_SIZE - 1, GFP_KERNEL); | 113 | char *s, *d = kstrndup(buf, PAGE_SIZE - 1, GFP_KERNEL); |
@@ -130,9 +127,8 @@ ssize_t read_string_list(const char *buf, const char * const list[]) | |||
130 | 127 | ||
131 | return i; | 128 | return i; |
132 | } | 129 | } |
133 | EXPORT_SYMBOL_GPL(read_string_list); | ||
134 | 130 | ||
135 | bool is_zero(const char *p, size_t n) | 131 | bool bch_is_zero(const char *p, size_t n) |
136 | { | 132 | { |
137 | size_t i; | 133 | size_t i; |
138 | 134 | ||
@@ -141,9 +137,8 @@ bool is_zero(const char *p, size_t n) | |||
141 | return false; | 137 | return false; |
142 | return true; | 138 | return true; |
143 | } | 139 | } |
144 | EXPORT_SYMBOL_GPL(is_zero); | ||
145 | 140 | ||
146 | int parse_uuid(const char *s, char *uuid) | 141 | int bch_parse_uuid(const char *s, char *uuid) |
147 | { | 142 | { |
148 | size_t i, j, x; | 143 | size_t i, j, x; |
149 | memset(uuid, 0, 16); | 144 | memset(uuid, 0, 16); |
@@ -170,9 +165,8 @@ int parse_uuid(const char *s, char *uuid) | |||
170 | } | 165 | } |
171 | return i; | 166 | return i; |
172 | } | 167 | } |
173 | EXPORT_SYMBOL_GPL(parse_uuid); | ||
174 | 168 | ||
175 | void time_stats_update(struct time_stats *stats, uint64_t start_time) | 169 | void bch_time_stats_update(struct time_stats *stats, uint64_t start_time) |
176 | { | 170 | { |
177 | uint64_t now = local_clock(); | 171 | uint64_t now = local_clock(); |
178 | uint64_t duration = time_after64(now, start_time) | 172 | uint64_t duration = time_after64(now, start_time) |
@@ -195,9 +189,8 @@ void time_stats_update(struct time_stats *stats, uint64_t start_time) | |||
195 | 189 | ||
196 | stats->last = now ?: 1; | 190 | stats->last = now ?: 1; |
197 | } | 191 | } |
198 | EXPORT_SYMBOL_GPL(time_stats_update); | ||
199 | 192 | ||
200 | unsigned next_delay(struct ratelimit *d, uint64_t done) | 193 | unsigned bch_next_delay(struct ratelimit *d, uint64_t done) |
201 | { | 194 | { |
202 | uint64_t now = local_clock(); | 195 | uint64_t now = local_clock(); |
203 | 196 | ||
@@ -207,9 +200,8 @@ unsigned next_delay(struct ratelimit *d, uint64_t done) | |||
207 | ? div_u64(d->next - now, NSEC_PER_SEC / HZ) | 200 | ? div_u64(d->next - now, NSEC_PER_SEC / HZ) |
208 | : 0; | 201 | : 0; |
209 | } | 202 | } |
210 | EXPORT_SYMBOL_GPL(next_delay); | ||
211 | 203 | ||
212 | void bio_map(struct bio *bio, void *base) | 204 | void bch_bio_map(struct bio *bio, void *base) |
213 | { | 205 | { |
214 | size_t size = bio->bi_size; | 206 | size_t size = bio->bi_size; |
215 | struct bio_vec *bv = bio->bi_io_vec; | 207 | struct bio_vec *bv = bio->bi_io_vec; |
@@ -235,9 +227,8 @@ start: bv->bv_len = min_t(size_t, PAGE_SIZE - bv->bv_offset, | |||
235 | size -= bv->bv_len; | 227 | size -= bv->bv_len; |
236 | } | 228 | } |
237 | } | 229 | } |
238 | EXPORT_SYMBOL_GPL(bio_map); | ||
239 | 230 | ||
240 | int bio_alloc_pages(struct bio *bio, gfp_t gfp) | 231 | int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp) |
241 | { | 232 | { |
242 | int i; | 233 | int i; |
243 | struct bio_vec *bv; | 234 | struct bio_vec *bv; |
@@ -253,7 +244,6 @@ int bio_alloc_pages(struct bio *bio, gfp_t gfp) | |||
253 | 244 | ||
254 | return 0; | 245 | return 0; |
255 | } | 246 | } |
256 | EXPORT_SYMBOL_GPL(bio_alloc_pages); | ||
257 | 247 | ||
258 | /* | 248 | /* |
259 | * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group (Any | 249 | * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group (Any |
@@ -365,7 +355,7 @@ static const uint64_t crc_table[256] = { | |||
365 | 0x9AFCE626CE85B507 | 355 | 0x9AFCE626CE85B507 |
366 | }; | 356 | }; |
367 | 357 | ||
368 | uint64_t crc64_update(uint64_t crc, const void *_data, size_t len) | 358 | uint64_t bch_crc64_update(uint64_t crc, const void *_data, size_t len) |
369 | { | 359 | { |
370 | const unsigned char *data = _data; | 360 | const unsigned char *data = _data; |
371 | 361 | ||
@@ -376,14 +366,12 @@ uint64_t crc64_update(uint64_t crc, const void *_data, size_t len) | |||
376 | 366 | ||
377 | return crc; | 367 | return crc; |
378 | } | 368 | } |
379 | EXPORT_SYMBOL(crc64_update); | ||
380 | 369 | ||
381 | uint64_t crc64(const void *data, size_t len) | 370 | uint64_t bch_crc64(const void *data, size_t len) |
382 | { | 371 | { |
383 | uint64_t crc = 0xffffffffffffffff; | 372 | uint64_t crc = 0xffffffffffffffff; |
384 | 373 | ||
385 | crc = crc64_update(crc, data, len); | 374 | crc = bch_crc64_update(crc, data, len); |
386 | 375 | ||
387 | return crc ^ 0xffffffffffffffff; | 376 | return crc ^ 0xffffffffffffffff; |
388 | } | 377 | } |
389 | EXPORT_SYMBOL(crc64); | ||