aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache/util.h')
-rw-r--r--drivers/md/bcache/util.h54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index 56705fdcc149..577393e38c3a 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -307,42 +307,42 @@ do { \
307#define ANYSINT_MAX(t) \ 307#define ANYSINT_MAX(t) \
308 ((((t) 1 << (sizeof(t) * 8 - 2)) - (t) 1) * (t) 2 + (t) 1) 308 ((((t) 1 << (sizeof(t) * 8 - 2)) - (t) 1) * (t) 2 + (t) 1)
309 309
310int strtoint_h(const char *, int *); 310int bch_strtoint_h(const char *, int *);
311int strtouint_h(const char *, unsigned int *); 311int bch_strtouint_h(const char *, unsigned int *);
312int strtoll_h(const char *, long long *); 312int bch_strtoll_h(const char *, long long *);
313int strtoull_h(const char *, unsigned long long *); 313int bch_strtoull_h(const char *, unsigned long long *);
314 314
315static inline int strtol_h(const char *cp, long *res) 315static inline int bch_strtol_h(const char *cp, long *res)
316{ 316{
317#if BITS_PER_LONG == 32 317#if BITS_PER_LONG == 32
318 return strtoint_h(cp, (int *) res); 318 return bch_strtoint_h(cp, (int *) res);
319#else 319#else
320 return strtoll_h(cp, (long long *) res); 320 return bch_strtoll_h(cp, (long long *) res);
321#endif 321#endif
322} 322}
323 323
324static inline int strtoul_h(const char *cp, long *res) 324static inline int bch_strtoul_h(const char *cp, long *res)
325{ 325{
326#if BITS_PER_LONG == 32 326#if BITS_PER_LONG == 32
327 return strtouint_h(cp, (unsigned int *) res); 327 return bch_strtouint_h(cp, (unsigned int *) res);
328#else 328#else
329 return strtoull_h(cp, (unsigned long long *) res); 329 return bch_strtoull_h(cp, (unsigned long long *) res);
330#endif 330#endif
331} 331}
332 332
333#define strtoi_h(cp, res) \ 333#define strtoi_h(cp, res) \
334 (__builtin_types_compatible_p(typeof(*res), int) \ 334 (__builtin_types_compatible_p(typeof(*res), int) \
335 ? strtoint_h(cp, (void *) res) \ 335 ? bch_strtoint_h(cp, (void *) res) \
336 : __builtin_types_compatible_p(typeof(*res), long) \ 336 : __builtin_types_compatible_p(typeof(*res), long) \
337 ? strtol_h(cp, (void *) res) \ 337 ? bch_strtol_h(cp, (void *) res) \
338 : __builtin_types_compatible_p(typeof(*res), long long) \ 338 : __builtin_types_compatible_p(typeof(*res), long long) \
339 ? strtoll_h(cp, (void *) res) \ 339 ? bch_strtoll_h(cp, (void *) res) \
340 : __builtin_types_compatible_p(typeof(*res), unsigned int) \ 340 : __builtin_types_compatible_p(typeof(*res), unsigned int) \
341 ? strtouint_h(cp, (void *) res) \ 341 ? bch_strtouint_h(cp, (void *) res) \
342 : __builtin_types_compatible_p(typeof(*res), unsigned long) \ 342 : __builtin_types_compatible_p(typeof(*res), unsigned long) \
343 ? strtoul_h(cp, (void *) res) \ 343 ? bch_strtoul_h(cp, (void *) res) \
344 : __builtin_types_compatible_p(typeof(*res), unsigned long long)\ 344 : __builtin_types_compatible_p(typeof(*res), unsigned long long)\
345 ? strtoull_h(cp, (void *) res) : -EINVAL) 345 ? bch_strtoull_h(cp, (void *) res) : -EINVAL)
346 346
347#define strtoul_safe(cp, var) \ 347#define strtoul_safe(cp, var) \
348({ \ 348({ \
@@ -379,15 +379,15 @@ static inline int strtoul_h(const char *cp, long *res)
379 __builtin_types_compatible_p(typeof(var), const char *) \ 379 __builtin_types_compatible_p(typeof(var), const char *) \
380 ? "%s\n" : "%i\n", var) 380 ? "%s\n" : "%i\n", var)
381 381
382ssize_t hprint(char *buf, int64_t v); 382ssize_t bch_hprint(char *buf, int64_t v);
383 383
384bool is_zero(const char *p, size_t n); 384bool bch_is_zero(const char *p, size_t n);
385int parse_uuid(const char *s, char *uuid); 385int bch_parse_uuid(const char *s, char *uuid);
386 386
387ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], 387ssize_t bch_snprint_string_list(char *buf, size_t size, const char * const list[],
388 size_t selected); 388 size_t selected);
389 389
390ssize_t read_string_list(const char *buf, const char * const list[]); 390ssize_t bch_read_string_list(const char *buf, const char * const list[]);
391 391
392struct time_stats { 392struct time_stats {
393 /* 393 /*
@@ -400,7 +400,7 @@ struct time_stats {
400 uint64_t last; 400 uint64_t last;
401}; 401};
402 402
403void time_stats_update(struct time_stats *stats, uint64_t time); 403void bch_time_stats_update(struct time_stats *stats, uint64_t time);
404 404
405#define NSEC_PER_ns 1L 405#define NSEC_PER_ns 1L
406#define NSEC_PER_us NSEC_PER_USEC 406#define NSEC_PER_us NSEC_PER_USEC
@@ -462,7 +462,7 @@ static inline void ratelimit_reset(struct ratelimit *d)
462 d->next = local_clock(); 462 d->next = local_clock();
463} 463}
464 464
465unsigned next_delay(struct ratelimit *d, uint64_t done); 465unsigned bch_next_delay(struct ratelimit *d, uint64_t done);
466 466
467#define __DIV_SAFE(n, d, zero) \ 467#define __DIV_SAFE(n, d, zero) \
468({ \ 468({ \
@@ -568,9 +568,9 @@ static inline unsigned fract_exp_two(unsigned x, unsigned fract_bits)
568 568
569#define bio_end(bio) ((bio)->bi_sector + bio_sectors(bio)) 569#define bio_end(bio) ((bio)->bi_sector + bio_sectors(bio))
570 570
571void bio_map(struct bio *bio, void *base); 571void bch_bio_map(struct bio *bio, void *base);
572 572
573int bio_alloc_pages(struct bio *bio, gfp_t gfp); 573int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp);
574 574
575static inline sector_t bdev_sectors(struct block_device *bdev) 575static inline sector_t bdev_sectors(struct block_device *bdev)
576{ 576{
@@ -583,7 +583,7 @@ do { \
583 bch_generic_make_request(bio, &(dev)->bio_split_hook); \ 583 bch_generic_make_request(bio, &(dev)->bio_split_hook); \
584} while (0) 584} while (0)
585 585
586uint64_t crc64_update(uint64_t, const void *, size_t); 586uint64_t bch_crc64_update(uint64_t, const void *, size_t);
587uint64_t crc64(const void *, size_t); 587uint64_t bch_crc64(const void *, size_t);
588 588
589#endif /* _BCACHE_UTIL_H */ 589#endif /* _BCACHE_UTIL_H */