@@ -568,6 +568,24 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp,
568
568
* and it can break the size limit of converted decimal list and hexadecimal
569
569
* bitmask.
570
570
*
571
+ * WARNING!
572
+ *
573
+ * This function is not a replacement for sprintf() or bitmap_print_to_pagebuf().
574
+ * It is intended to workaround sysfs limitations discussed above and should be
575
+ * used carefully in general case for the following reasons:
576
+ * - Time complexity is O(nbits^2/count), comparing to O(nbits) for snprintf().
577
+ * - Memory complexity is O(nbits), comparing to O(1) for snprintf().
578
+ * - @off and @count are NOT offset and number of bits to print.
579
+ * - If printing part of bitmap as list, the resulting string is not a correct
580
+ * list representation of bitmap. Particularly, some bits within or out of
581
+ * related interval may be erroneously set or unset. The format of the string
582
+ * may be broken, so bitmap_parselist-like parser may fail parsing it.
583
+ * - If printing the whole bitmap as list by parts, user must ensure the order
584
+ * of calls of the function such that the offset is incremented linearly.
585
+ * - If printing the whole bitmap as list by parts, user must keep bitmap
586
+ * unchanged between the very first and very last call. Otherwise concatenated
587
+ * result may be incorrect, and format may be broken.
588
+ *
571
589
* Returns the number of characters actually printed to @buf
572
590
*/
573
591
int bitmap_print_bitmask_to_buf (char * buf , const unsigned long * maskp ,
0 commit comments