Lines Matching refs:buf
185 char *put_dec_trunc8(char *buf, unsigned r) in put_dec_trunc8() argument
195 *((u16 *)buf) = decpair[r - 100*q]; in put_dec_trunc8()
196 buf += 2; in put_dec_trunc8()
204 *((u16 *)buf) = decpair[q - 100*r]; in put_dec_trunc8()
205 buf += 2; in put_dec_trunc8()
213 *((u16 *)buf) = decpair[r - 100*q]; in put_dec_trunc8()
214 buf += 2; in put_dec_trunc8()
220 *((u16 *)buf) = decpair[r]; in put_dec_trunc8()
221 buf += r < 10 ? 1 : 2; in put_dec_trunc8()
222 return buf; in put_dec_trunc8()
227 char *put_dec_full8(char *buf, unsigned r) in put_dec_full8() argument
233 *((u16 *)buf) = decpair[r - 100*q]; in put_dec_full8()
234 buf += 2; in put_dec_full8()
238 *((u16 *)buf) = decpair[q - 100*r]; in put_dec_full8()
239 buf += 2; in put_dec_full8()
243 *((u16 *)buf) = decpair[r - 100*q]; in put_dec_full8()
244 buf += 2; in put_dec_full8()
247 *((u16 *)buf) = decpair[q]; in put_dec_full8()
248 buf += 2; in put_dec_full8()
249 return buf; in put_dec_full8()
253 char *put_dec(char *buf, unsigned long long n) in put_dec() argument
256 buf = put_dec_full8(buf, do_div(n, 100*1000*1000)); in put_dec()
259 buf = put_dec_full8(buf, do_div(n, 100*1000*1000)); in put_dec()
261 return put_dec_trunc8(buf, n); in put_dec()
267 put_dec_full4(char *buf, unsigned r) in put_dec_full4() argument
273 *((u16 *)buf) = decpair[r - 100*q]; in put_dec_full4()
274 buf += 2; in put_dec_full4()
276 *((u16 *)buf) = decpair[q]; in put_dec_full4()
287 unsigned put_dec_helper4(char *buf, unsigned x) in put_dec_helper4() argument
291 put_dec_full4(buf, x - q * 10000); in put_dec_helper4()
301 char *put_dec(char *buf, unsigned long long n) in put_dec() argument
306 return put_dec_trunc8(buf, n); in put_dec()
316 q = put_dec_helper4(buf, q); in put_dec()
319 q = put_dec_helper4(buf+4, q); in put_dec()
322 q = put_dec_helper4(buf+8, q); in put_dec()
325 buf += 12; in put_dec()
327 buf = put_dec_trunc8(buf, q); in put_dec()
328 else while (buf[-1] == '0') in put_dec()
329 --buf; in put_dec()
331 return buf; in put_dec()
342 int num_to_str(char *buf, int size, unsigned long long num, unsigned int width) in num_to_str() argument
362 buf[idx] = ' '; in num_to_str()
368 buf[idx + width] = tmp[len - idx - 1]; in num_to_str()
416 char *number(char *buf, char *end, unsigned long long num, in number() argument
480 if (buf < end) in number()
481 *buf = ' '; in number()
482 ++buf; in number()
487 if (buf < end) in number()
488 *buf = sign; in number()
489 ++buf; in number()
494 if (buf < end) in number()
495 *buf = '0'; in number()
496 ++buf; in number()
499 if (buf < end) in number()
500 *buf = ('X' | locase); in number()
501 ++buf; in number()
509 if (buf < end) in number()
510 *buf = c; in number()
511 ++buf; in number()
516 if (buf < end) in number()
517 *buf = '0'; in number()
518 ++buf; in number()
522 if (buf < end) in number()
523 *buf = tmp[i]; in number()
524 ++buf; in number()
528 if (buf < end) in number()
529 *buf = ' '; in number()
530 ++buf; in number()
533 return buf; in number()
537 char *special_hex_number(char *buf, char *end, unsigned long long num, int size) in special_hex_number() argument
547 return number(buf, end, num, spec); in special_hex_number()
550 static void move_right(char *buf, char *end, unsigned len, unsigned spaces) in move_right() argument
553 if (buf >= end) /* nowhere to put anything */ in move_right()
555 size = end - buf; in move_right()
557 memset(buf, ' ', size); in move_right()
563 memmove(buf + spaces, buf, len); in move_right()
565 memset(buf, ' ', spaces); in move_right()
577 char *widen_string(char *buf, int n, char *end, struct printf_spec spec) in widen_string() argument
582 return buf; in widen_string()
586 move_right(buf - n, end, n, spaces); in widen_string()
587 return buf + spaces; in widen_string()
590 if (buf < end) in widen_string()
591 *buf = ' '; in widen_string()
592 ++buf; in widen_string()
594 return buf; in widen_string()
598 static char *string_nocheck(char *buf, char *end, const char *s, in string_nocheck() argument
608 if (buf < end) in string_nocheck()
609 *buf = c; in string_nocheck()
610 ++buf; in string_nocheck()
613 return widen_string(buf, len, end, spec); in string_nocheck()
617 static char *error_string(char *buf, char *end, const char *s, in error_string() argument
628 return string_nocheck(buf, end, s, spec); in error_string()
647 static int check_pointer(char **buf, char *end, const void *ptr, in check_pointer() argument
654 *buf = error_string(*buf, end, err_msg, spec); in check_pointer()
662 char *string(char *buf, char *end, const char *s, in string() argument
665 if (check_pointer(&buf, end, s, spec)) in string()
666 return buf; in string()
668 return string_nocheck(buf, end, s, spec); in string()
671 static char *pointer_string(char *buf, char *end, in pointer_string() argument
682 return number(buf, end, (unsigned long int)ptr, spec); in pointer_string()
769 static char *ptr_to_id(char *buf, char *end, const void *ptr, in ptr_to_id() argument
779 return pointer_string(buf, end, (const void *)hashval, spec); in ptr_to_id()
786 return error_string(buf, end, str, spec); in ptr_to_id()
789 return pointer_string(buf, end, (const void *)hashval, spec); in ptr_to_id()
795 char *restricted_pointer(char *buf, char *end, const void *ptr, in restricted_pointer() argument
801 return ptr_to_id(buf, end, ptr, spec); in restricted_pointer()
812 return error_string(buf, end, "pK-error", spec); in restricted_pointer()
838 return pointer_string(buf, end, ptr, spec); in restricted_pointer()
842 char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_spec spec, in dentry_name() argument
860 if (check_pointer(&buf, end, d, spec)) { in dentry_name()
862 return buf; in dentry_name()
875 for (n = 0; n != spec.precision; n++, buf++) { in dentry_name()
883 if (buf < end) in dentry_name()
884 *buf = c; in dentry_name()
887 return widen_string(buf, n, end, spec); in dentry_name()
891 char *file_dentry_name(char *buf, char *end, const struct file *f, in file_dentry_name() argument
894 if (check_pointer(&buf, end, f, spec)) in file_dentry_name()
895 return buf; in file_dentry_name()
897 return dentry_name(buf, end, f->f_path.dentry, spec, fmt); in file_dentry_name()
901 char *bdev_name(char *buf, char *end, struct block_device *bdev, in bdev_name() argument
906 if (check_pointer(&buf, end, bdev, spec)) in bdev_name()
907 return buf; in bdev_name()
910 buf = string(buf, end, hd->disk_name, spec); in bdev_name()
913 if (buf < end) in bdev_name()
914 *buf = 'p'; in bdev_name()
915 buf++; in bdev_name()
917 buf = number(buf, end, bdev->bd_part->partno, spec); in bdev_name()
919 return buf; in bdev_name()
924 char *symbol_string(char *buf, char *end, void *ptr, in symbol_string() argument
944 return string_nocheck(buf, end, sym, spec); in symbol_string()
946 return special_hex_number(buf, end, value, sizeof(void *)); in symbol_string()
981 char *resource_string(char *buf, char *end, struct resource *res, in resource_string() argument
1028 if (check_pointer(&buf, end, res, spec)) in resource_string()
1029 return buf; in resource_string()
1078 return string_nocheck(buf, end, sym, spec); in resource_string()
1082 char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec, in hex_string() argument
1091 return buf; in hex_string()
1093 if (check_pointer(&buf, end, addr, spec)) in hex_string()
1094 return buf; in hex_string()
1115 if (buf < end) in hex_string()
1116 *buf = hex_asc_hi(addr[i]); in hex_string()
1117 ++buf; in hex_string()
1118 if (buf < end) in hex_string()
1119 *buf = hex_asc_lo(addr[i]); in hex_string()
1120 ++buf; in hex_string()
1123 if (buf < end) in hex_string()
1124 *buf = separator; in hex_string()
1125 ++buf; in hex_string()
1129 return buf; in hex_string()
1133 char *bitmap_string(char *buf, char *end, unsigned long *bitmap, in bitmap_string() argument
1141 if (check_pointer(&buf, end, bitmap, spec)) in bitmap_string()
1142 return buf; in bitmap_string()
1162 if (buf < end) in bitmap_string()
1163 *buf = ','; in bitmap_string()
1164 buf++; in bitmap_string()
1169 buf = number(buf, end, val, spec); in bitmap_string()
1173 return buf; in bitmap_string()
1177 char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, in bitmap_list_string() argument
1185 if (check_pointer(&buf, end, bitmap, spec)) in bitmap_list_string()
1186 return buf; in bitmap_list_string()
1196 if (buf < end) in bitmap_list_string()
1197 *buf = ','; in bitmap_list_string()
1198 buf++; in bitmap_list_string()
1202 buf = number(buf, end, rbot, default_dec_spec); in bitmap_list_string()
1204 if (buf < end) in bitmap_list_string()
1205 *buf = '-'; in bitmap_list_string()
1206 buf++; in bitmap_list_string()
1208 buf = number(buf, end, rtop, default_dec_spec); in bitmap_list_string()
1213 return buf; in bitmap_list_string()
1217 char *mac_address_string(char *buf, char *end, u8 *addr, in mac_address_string() argument
1226 if (check_pointer(&buf, end, addr, spec)) in mac_address_string()
1227 return buf; in mac_address_string()
1254 return string_nocheck(buf, end, mac_addr, spec); in mac_address_string()
1407 char *ip6_addr_string(char *buf, char *end, const u8 *addr, in ip6_addr_string() argument
1417 return string_nocheck(buf, end, ip6_addr, spec); in ip6_addr_string()
1421 char *ip4_addr_string(char *buf, char *end, const u8 *addr, in ip4_addr_string() argument
1428 return string_nocheck(buf, end, ip4_addr, spec); in ip4_addr_string()
1432 char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa, in ip6_addr_string_sa() argument
1490 return string_nocheck(buf, end, ip6_addr, spec); in ip6_addr_string_sa()
1494 char *ip4_addr_string_sa(char *buf, char *end, const struct sockaddr_in *sa, in ip4_addr_string_sa() argument
1525 return string_nocheck(buf, end, ip4_addr, spec); in ip4_addr_string_sa()
1529 char *ip_addr_string(char *buf, char *end, const void *ptr, in ip_addr_string() argument
1534 if (check_pointer(&buf, end, ptr, spec)) in ip_addr_string()
1535 return buf; in ip_addr_string()
1539 return ip6_addr_string(buf, end, ptr, spec, fmt); in ip_addr_string()
1541 return ip4_addr_string(buf, end, ptr, spec, fmt); in ip_addr_string()
1551 return ip4_addr_string_sa(buf, end, &sa->v4, spec, fmt); in ip_addr_string()
1553 return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt); in ip_addr_string()
1555 return error_string(buf, end, "(einval)", spec); in ip_addr_string()
1560 return error_string(buf, end, err_fmt_msg, spec); in ip_addr_string()
1564 char *escaped_string(char *buf, char *end, u8 *addr, struct printf_spec spec, in escaped_string() argument
1573 return buf; /* nothing to print */ in escaped_string()
1575 if (check_pointer(&buf, end, addr, spec)) in escaped_string()
1576 return buf; in escaped_string()
1617 buf += string_escape_mem(addr, len, buf, buf < end ? end - buf : 0, flags, NULL); in escaped_string()
1619 return buf; in escaped_string()
1622 static char *va_format(char *buf, char *end, struct va_format *va_fmt, in va_format() argument
1627 if (check_pointer(&buf, end, va_fmt, spec)) in va_format()
1628 return buf; in va_format()
1631 buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va); in va_format()
1634 return buf; in va_format()
1638 char *uuid_string(char *buf, char *end, const u8 *addr, in uuid_string() argument
1647 if (check_pointer(&buf, end, addr, spec)) in uuid_string()
1648 return buf; in uuid_string()
1678 return string_nocheck(buf, end, uuid, spec); in uuid_string()
1682 char *netdev_bits(char *buf, char *end, const void *addr, in netdev_bits() argument
1688 if (check_pointer(&buf, end, addr, spec)) in netdev_bits()
1689 return buf; in netdev_bits()
1697 return error_string(buf, end, "(%pN?)", spec); in netdev_bits()
1700 return special_hex_number(buf, end, num, size); in netdev_bits()
1704 char *address_val(char *buf, char *end, const void *addr, in address_val() argument
1710 if (check_pointer(&buf, end, addr, spec)) in address_val()
1711 return buf; in address_val()
1725 return special_hex_number(buf, end, num, size); in address_val()
1729 char *date_str(char *buf, char *end, const struct rtc_time *tm, bool r) in date_str() argument
1734 buf = number(buf, end, year, default_dec04_spec); in date_str()
1735 if (buf < end) in date_str()
1736 *buf = '-'; in date_str()
1737 buf++; in date_str()
1739 buf = number(buf, end, mon, default_dec02_spec); in date_str()
1740 if (buf < end) in date_str()
1741 *buf = '-'; in date_str()
1742 buf++; in date_str()
1744 return number(buf, end, tm->tm_mday, default_dec02_spec); in date_str()
1748 char *time_str(char *buf, char *end, const struct rtc_time *tm, bool r) in time_str() argument
1750 buf = number(buf, end, tm->tm_hour, default_dec02_spec); in time_str()
1751 if (buf < end) in time_str()
1752 *buf = ':'; in time_str()
1753 buf++; in time_str()
1755 buf = number(buf, end, tm->tm_min, default_dec02_spec); in time_str()
1756 if (buf < end) in time_str()
1757 *buf = ':'; in time_str()
1758 buf++; in time_str()
1760 return number(buf, end, tm->tm_sec, default_dec02_spec); in time_str()
1764 char *rtc_str(char *buf, char *end, const struct rtc_time *tm, in rtc_str() argument
1771 if (check_pointer(&buf, end, tm, spec)) in rtc_str()
1772 return buf; in rtc_str()
1788 buf = date_str(buf, end, tm, raw); in rtc_str()
1791 if (buf < end) in rtc_str()
1792 *buf = 'T'; in rtc_str()
1793 buf++; in rtc_str()
1796 buf = time_str(buf, end, tm, raw); in rtc_str()
1798 return buf; in rtc_str()
1802 char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec, in time_and_date() argument
1807 return rtc_str(buf, end, (const struct rtc_time *)ptr, spec, fmt); in time_and_date()
1809 return error_string(buf, end, "(%ptR?)", spec); in time_and_date()
1814 char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec, in clock() argument
1818 return error_string(buf, end, "(%pC?)", spec); in clock()
1820 if (check_pointer(&buf, end, clk, spec)) in clock()
1821 return buf; in clock()
1827 return string(buf, end, __clk_get_name(clk), spec); in clock()
1829 return ptr_to_id(buf, end, clk, spec); in clock()
1835 char *format_flags(char *buf, char *end, unsigned long flags, in format_flags() argument
1845 buf = string(buf, end, names->name, default_str_spec); in format_flags()
1849 if (buf < end) in format_flags()
1850 *buf = '|'; in format_flags()
1851 buf++; in format_flags()
1856 buf = number(buf, end, flags, default_flag_spec); in format_flags()
1858 return buf; in format_flags()
1862 char *flags_string(char *buf, char *end, void *flags_ptr, in flags_string() argument
1868 if (check_pointer(&buf, end, flags_ptr, spec)) in flags_string()
1869 return buf; in flags_string()
1887 return error_string(buf, end, "(%pG?)", spec); in flags_string()
1890 return format_flags(buf, end, flags, names); in flags_string()
1902 char *device_node_gen_full_name(const struct device_node *np, char *buf, char *end) in device_node_gen_full_name() argument
1909 return string_nocheck(buf, end, "/", default_str_spec); in device_node_gen_full_name()
1915 buf = string_nocheck(buf, end, "/", default_str_spec); in device_node_gen_full_name()
1916 buf = string(buf, end, device_node_name_for_depth(np, depth), in device_node_gen_full_name()
1919 return buf; in device_node_gen_full_name()
1923 char *device_node_string(char *buf, char *end, struct device_node *dn, in device_node_string() argument
1929 char *buf_start = buf; in device_node_string()
1943 return error_string(buf, end, "(%pOF?)", spec); in device_node_string()
1945 if (check_pointer(&buf, end, dn, spec)) in device_node_string()
1946 return buf; in device_node_string()
1956 if (buf < end) in device_node_string()
1957 *buf = ':'; in device_node_string()
1958 buf++; in device_node_string()
1963 buf = device_node_gen_full_name(dn, buf, end); in device_node_string()
1969 buf = string(buf, end, p, str_spec); in device_node_string()
1973 buf = number(buf, end, (unsigned int)dn->phandle, num_spec); in device_node_string()
1979 buf = string(buf, end, p, str_spec); in device_node_string()
1987 buf = string_nocheck(buf, end, tbuf, str_spec); in device_node_string()
1992 buf = string(buf, end, p, str_spec); in device_node_string()
1998 buf = string_nocheck(buf, end, ",", str_spec); in device_node_string()
1999 buf = string_nocheck(buf, end, "\"", str_spec); in device_node_string()
2000 buf = string(buf, end, p, str_spec); in device_node_string()
2001 buf = string_nocheck(buf, end, "\"", str_spec); in device_node_string()
2011 return widen_string(buf, buf - buf_start, end, spec); in device_node_string()
2014 static char *kobject_string(char *buf, char *end, void *ptr, in kobject_string() argument
2019 return device_node_string(buf, end, ptr, spec, fmt + 1); in kobject_string()
2022 return error_string(buf, end, "(%pO?)", spec); in kobject_string()
2138 char *pointer(const char *fmt, char *buf, char *end, void *ptr, in pointer() argument
2149 return symbol_string(buf, end, ptr, spec, fmt); in pointer()
2152 return resource_string(buf, end, ptr, spec, fmt); in pointer()
2154 return hex_string(buf, end, ptr, spec, fmt); in pointer()
2158 return bitmap_list_string(buf, end, ptr, spec, fmt); in pointer()
2160 return bitmap_string(buf, end, ptr, spec, fmt); in pointer()
2166 return mac_address_string(buf, end, ptr, spec, fmt); in pointer()
2176 return ip_addr_string(buf, end, ptr, spec, fmt); in pointer()
2178 return escaped_string(buf, end, ptr, spec, fmt); in pointer()
2180 return uuid_string(buf, end, ptr, spec, fmt); in pointer()
2182 return va_format(buf, end, ptr, spec, fmt); in pointer()
2184 return restricted_pointer(buf, end, ptr, spec); in pointer()
2186 return netdev_bits(buf, end, ptr, spec, fmt); in pointer()
2188 return address_val(buf, end, ptr, spec, fmt); in pointer()
2190 return dentry_name(buf, end, ptr, spec, fmt); in pointer()
2192 return time_and_date(buf, end, ptr, spec, fmt); in pointer()
2194 return clock(buf, end, ptr, spec, fmt); in pointer()
2196 return file_dentry_name(buf, end, ptr, spec, fmt); in pointer()
2199 return bdev_name(buf, end, ptr, spec, fmt); in pointer()
2203 return flags_string(buf, end, ptr, spec, fmt); in pointer()
2205 return kobject_string(buf, end, ptr, spec, fmt); in pointer()
2207 return pointer_string(buf, end, ptr, spec); in pointer()
2211 return ptr_to_id(buf, end, ptr, spec); in pointer()
2458 int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) in vsnprintf() argument
2469 str = buf; in vsnprintf()
2470 end = buf + size; in vsnprintf()
2473 if (end < buf) { in vsnprintf()
2475 size = end - buf; in vsnprintf()
2607 return str-buf; in vsnprintf()
2627 int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) in vscnprintf() argument
2631 i = vsnprintf(buf, size, fmt, args); in vscnprintf()
2655 int snprintf(char *buf, size_t size, const char *fmt, ...) in snprintf() argument
2661 i = vsnprintf(buf, size, fmt, args); in snprintf()
2679 int scnprintf(char *buf, size_t size, const char *fmt, ...) in scnprintf() argument
2685 i = vscnprintf(buf, size, fmt, args); in scnprintf()
2706 int vsprintf(char *buf, const char *fmt, va_list args) in vsprintf() argument
2708 return vsnprintf(buf, INT_MAX, fmt, args); in vsprintf()
2724 int sprintf(char *buf, const char *fmt, ...) in sprintf() argument
2730 i = vsnprintf(buf, INT_MAX, fmt, args); in sprintf()
2921 int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) in bstr_printf() argument
2930 str = buf; in bstr_printf()
2931 end = buf + size; in bstr_printf()
2949 if (end < buf) { in bstr_printf()
2951 size = end - buf; in bstr_printf()
3107 return str - buf; in bstr_printf()
3142 int vsscanf(const char *buf, const char *fmt, va_list args) in vsscanf() argument
3144 const char *str = buf; in vsscanf()
3224 *va_arg(args, int *) = str - buf; in vsscanf()
3429 int sscanf(const char *buf, const char *fmt, ...) in sscanf() argument
3435 i = vsscanf(buf, fmt, args); in sscanf()