aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/util.c
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-03-28 14:50:55 -0400
committerJens Axboe <axboe@kernel.dk>2013-03-28 14:50:55 -0400
commit169ef1cf6171d35550fef85645b83b960e241cff (patch)
tree61451e5477e992d5bdee0fc906f9db018afc1239 /drivers/md/bcache/util.c
parent0b6ef4164f50698eee536903d69d086add1a7889 (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.c38
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) \
22int name ## _h(const char *cp, type *res) \ 22int 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} \
70EXPORT_SYMBOL_GPL(name ## _h);
71 70
72STRTO_H(strtoint, int) 71STRTO_H(strtoint, int)
73STRTO_H(strtouint, unsigned int) 72STRTO_H(strtouint, unsigned int)
74STRTO_H(strtoll, long long) 73STRTO_H(strtoll, long long)
75STRTO_H(strtoull, unsigned long long) 74STRTO_H(strtoull, unsigned long long)
76 75
77ssize_t hprint(char *buf, int64_t v) 76ssize_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}
96EXPORT_SYMBOL_GPL(hprint);
97 95
98ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], 96ssize_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}
111EXPORT_SYMBOL_GPL(snprint_string_list);
112 109
113ssize_t read_string_list(const char *buf, const char * const list[]) 110ssize_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}
133EXPORT_SYMBOL_GPL(read_string_list);
134 130
135bool is_zero(const char *p, size_t n) 131bool 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}
144EXPORT_SYMBOL_GPL(is_zero);
145 140
146int parse_uuid(const char *s, char *uuid) 141int 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}
173EXPORT_SYMBOL_GPL(parse_uuid);
174 168
175void time_stats_update(struct time_stats *stats, uint64_t start_time) 169void 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}
198EXPORT_SYMBOL_GPL(time_stats_update);
199 192
200unsigned next_delay(struct ratelimit *d, uint64_t done) 193unsigned 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}
210EXPORT_SYMBOL_GPL(next_delay);
211 203
212void bio_map(struct bio *bio, void *base) 204void 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}
238EXPORT_SYMBOL_GPL(bio_map);
239 230
240int bio_alloc_pages(struct bio *bio, gfp_t gfp) 231int 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}
256EXPORT_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
368uint64_t crc64_update(uint64_t crc, const void *_data, size_t len) 358uint64_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}
379EXPORT_SYMBOL(crc64_update);
380 369
381uint64_t crc64(const void *data, size_t len) 370uint64_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}
389EXPORT_SYMBOL(crc64);