| // SPDX-License-Identifier: GPL-2.0 |
| #include <linux/kernel.h> |
| #include <linux/time64.h> |
| unsigned long parse_tag_value(const char *str, struct parse_tag *tags) |
| struct parse_tag *i = tags; |
| char *s = strchr(str, i->tag); |
| value = strtoul(str, &endptr, 10); |
| if (value > ULONG_MAX / i->mult) |
| return (unsigned long) -1; |
| unsigned long convert_unit(unsigned long value, char *unit) |
| int unit_number__scnprintf(char *buf, size_t size, u64 n) |
| while (((n / 1024) > 1) && (i < 3)) { |
| return scnprintf(buf, size, "%" PRIu64 "%c", n, unit[i]); |