diff options
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r-- | lib/bitmap.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 0b66f0e5eb6b..08c6ef3a2b6f 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -502,11 +502,11 @@ EXPORT_SYMBOL(bitmap_print_to_pagebuf); | |||
502 | * Syntax: range:used_size/group_size | 502 | * Syntax: range:used_size/group_size |
503 | * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769 | 503 | * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769 |
504 | * | 504 | * |
505 | * Returns 0 on success, -errno on invalid input strings. | 505 | * Returns: 0 on success, -errno on invalid input strings. Error values: |
506 | * Error values: | 506 | * |
507 | * %-EINVAL: second number in range smaller than first | 507 | * - ``-EINVAL``: second number in range smaller than first |
508 | * %-EINVAL: invalid character in string | 508 | * - ``-EINVAL``: invalid character in string |
509 | * %-ERANGE: bit number specified too large for mask | 509 | * - ``-ERANGE``: bit number specified too large for mask |
510 | */ | 510 | */ |
511 | static int __bitmap_parselist(const char *buf, unsigned int buflen, | 511 | static int __bitmap_parselist(const char *buf, unsigned int buflen, |
512 | int is_user, unsigned long *maskp, | 512 | int is_user, unsigned long *maskp, |
@@ -864,14 +864,16 @@ EXPORT_SYMBOL(bitmap_bitremap); | |||
864 | * 11 was set in @orig had no affect on @dst. | 864 | * 11 was set in @orig had no affect on @dst. |
865 | * | 865 | * |
866 | * Example [2] for bitmap_fold() + bitmap_onto(): | 866 | * Example [2] for bitmap_fold() + bitmap_onto(): |
867 | * Let's say @relmap has these ten bits set: | 867 | * Let's say @relmap has these ten bits set:: |
868 | * | ||
868 | * 40 41 42 43 45 48 53 61 74 95 | 869 | * 40 41 42 43 45 48 53 61 74 95 |
870 | * | ||
869 | * (for the curious, that's 40 plus the first ten terms of the | 871 | * (for the curious, that's 40 plus the first ten terms of the |
870 | * Fibonacci sequence.) | 872 | * Fibonacci sequence.) |
871 | * | 873 | * |
872 | * Further lets say we use the following code, invoking | 874 | * Further lets say we use the following code, invoking |
873 | * bitmap_fold() then bitmap_onto, as suggested above to | 875 | * bitmap_fold() then bitmap_onto, as suggested above to |
874 | * avoid the possibility of an empty @dst result: | 876 | * avoid the possibility of an empty @dst result:: |
875 | * | 877 | * |
876 | * unsigned long *tmp; // a temporary bitmap's bits | 878 | * unsigned long *tmp; // a temporary bitmap's bits |
877 | * | 879 | * |
@@ -882,22 +884,26 @@ EXPORT_SYMBOL(bitmap_bitremap); | |||
882 | * various @orig's. I list the zero-based positions of each set bit. | 884 | * various @orig's. I list the zero-based positions of each set bit. |
883 | * The tmp column shows the intermediate result, as computed by | 885 | * The tmp column shows the intermediate result, as computed by |
884 | * using bitmap_fold() to fold the @orig bitmap modulo ten | 886 | * using bitmap_fold() to fold the @orig bitmap modulo ten |
885 | * (the weight of @relmap). | 887 | * (the weight of @relmap): |
886 | * | 888 | * |
889 | * =============== ============== ================= | ||
887 | * @orig tmp @dst | 890 | * @orig tmp @dst |
888 | * 0 0 40 | 891 | * 0 0 40 |
889 | * 1 1 41 | 892 | * 1 1 41 |
890 | * 9 9 95 | 893 | * 9 9 95 |
891 | * 10 0 40 (*) | 894 | * 10 0 40 [#f1]_ |
892 | * 1 3 5 7 1 3 5 7 41 43 48 61 | 895 | * 1 3 5 7 1 3 5 7 41 43 48 61 |
893 | * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45 | 896 | * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45 |
894 | * 0 9 18 27 0 9 8 7 40 61 74 95 | 897 | * 0 9 18 27 0 9 8 7 40 61 74 95 |
895 | * 0 10 20 30 0 40 | 898 | * 0 10 20 30 0 40 |
896 | * 0 11 22 33 0 1 2 3 40 41 42 43 | 899 | * 0 11 22 33 0 1 2 3 40 41 42 43 |
897 | * 0 12 24 36 0 2 4 6 40 42 45 53 | 900 | * 0 12 24 36 0 2 4 6 40 42 45 53 |
898 | * 78 102 211 1 2 8 41 42 74 (*) | 901 | * 78 102 211 1 2 8 41 42 74 [#f1]_ |
902 | * =============== ============== ================= | ||
903 | * | ||
904 | * .. [#f1] | ||
899 | * | 905 | * |
900 | * (*) For these marked lines, if we hadn't first done bitmap_fold() | 906 | * For these marked lines, if we hadn't first done bitmap_fold() |
901 | * into tmp, then the @dst result would have been empty. | 907 | * into tmp, then the @dst result would have been empty. |
902 | * | 908 | * |
903 | * If either of @orig or @relmap is empty (no set bits), then @dst | 909 | * If either of @orig or @relmap is empty (no set bits), then @dst |