Lines Matching refs:end
456 char *number(char *buf, char *end, unsigned long long num, in number() argument
520 if (buf < end) in number()
527 if (buf < end) in number()
534 if (buf < end) in number()
539 if (buf < end) in number()
549 if (buf < end) in number()
556 if (buf < end) in number()
562 if (buf < end) in number()
568 if (buf < end) in number()
577 char *special_hex_number(char *buf, char *end, unsigned long long num, int size) in special_hex_number() argument
587 return number(buf, end, num, spec); in special_hex_number()
590 static void move_right(char *buf, char *end, unsigned len, unsigned spaces) in move_right() argument
593 if (buf >= end) /* nowhere to put anything */ in move_right()
595 size = end - buf; in move_right()
617 char *widen_string(char *buf, int n, char *end, struct printf_spec spec) in widen_string() argument
626 move_right(buf - n, end, n, spaces); in widen_string()
630 if (buf < end) in widen_string()
638 static char *string_nocheck(char *buf, char *end, const char *s, in string_nocheck() argument
648 if (buf < end) in string_nocheck()
653 return widen_string(buf, len, end, spec); in string_nocheck()
656 static char *err_ptr(char *buf, char *end, void *ptr, in err_ptr() argument
663 return string_nocheck(buf, end, sym, spec); in err_ptr()
672 return number(buf, end, err, spec); in err_ptr()
676 static char *error_string(char *buf, char *end, const char *s, in error_string() argument
687 return string_nocheck(buf, end, s, spec); in error_string()
706 static int check_pointer(char **buf, char *end, const void *ptr, in check_pointer() argument
713 *buf = error_string(*buf, end, err_msg, spec); in check_pointer()
721 char *string(char *buf, char *end, const char *s, in string() argument
724 if (check_pointer(&buf, end, s, spec)) in string()
727 return string_nocheck(buf, end, s, spec); in string()
730 static char *pointer_string(char *buf, char *end, in pointer_string() argument
741 return number(buf, end, (unsigned long int)ptr, spec); in pointer_string()
806 static char *ptr_to_id(char *buf, char *end, const void *ptr, in ptr_to_id() argument
818 return pointer_string(buf, end, ptr, spec); in ptr_to_id()
823 return pointer_string(buf, end, (const void *)hashval, spec); in ptr_to_id()
830 return error_string(buf, end, str, spec); in ptr_to_id()
833 return pointer_string(buf, end, (const void *)hashval, spec); in ptr_to_id()
836 static char *default_pointer(char *buf, char *end, const void *ptr, in default_pointer() argument
844 return pointer_string(buf, end, ptr, spec); in default_pointer()
846 return ptr_to_id(buf, end, ptr, spec); in default_pointer()
852 char *restricted_pointer(char *buf, char *end, const void *ptr, in restricted_pointer() argument
858 return default_pointer(buf, end, ptr, spec); in restricted_pointer()
869 return error_string(buf, end, "pK-error", spec); in restricted_pointer()
895 return pointer_string(buf, end, ptr, spec); in restricted_pointer()
899 char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_spec spec, in dentry_name() argument
917 if (check_pointer(&buf, end, d, spec)) { in dentry_name()
940 if (buf < end) in dentry_name()
944 return widen_string(buf, n, end, spec); in dentry_name()
948 char *file_dentry_name(char *buf, char *end, const struct file *f, in file_dentry_name() argument
951 if (check_pointer(&buf, end, f, spec)) in file_dentry_name()
954 return dentry_name(buf, end, f->f_path.dentry, spec, fmt); in file_dentry_name()
958 char *bdev_name(char *buf, char *end, struct block_device *bdev, in bdev_name() argument
963 if (check_pointer(&buf, end, bdev, spec)) in bdev_name()
967 buf = string(buf, end, hd->disk_name, spec); in bdev_name()
970 if (buf < end) in bdev_name()
974 buf = number(buf, end, bdev->bd_partno, spec); in bdev_name()
981 char *symbol_string(char *buf, char *end, void *ptr, in symbol_string() argument
1005 return string_nocheck(buf, end, sym, spec); in symbol_string()
1007 return special_hex_number(buf, end, value, sizeof(void *)); in symbol_string()
1042 char *resource_string(char *buf, char *end, struct resource *res, in resource_string() argument
1089 if (check_pointer(&buf, end, res, spec)) in resource_string()
1118 if (res->start != res->end) { in resource_string()
1120 p = number(p, pend, res->end, *specp); in resource_string()
1139 return string_nocheck(buf, end, sym, spec); in resource_string()
1143 char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec, in hex_string() argument
1154 if (check_pointer(&buf, end, addr, spec)) in hex_string()
1176 if (buf < end) in hex_string()
1179 if (buf < end) in hex_string()
1184 if (buf < end) in hex_string()
1194 char *bitmap_string(char *buf, char *end, const unsigned long *bitmap, in bitmap_string() argument
1202 if (check_pointer(&buf, end, bitmap, spec)) in bitmap_string()
1223 if (buf < end) in bitmap_string()
1230 buf = number(buf, end, val, spec); in bitmap_string()
1238 char *bitmap_list_string(char *buf, char *end, const unsigned long *bitmap, in bitmap_list_string() argument
1245 if (check_pointer(&buf, end, bitmap, spec)) in bitmap_list_string()
1250 if (buf < end) in bitmap_list_string()
1256 buf = number(buf, end, rbot, default_dec_spec); in bitmap_list_string()
1260 if (buf < end) in bitmap_list_string()
1262 buf = number(++buf, end, rtop - 1, default_dec_spec); in bitmap_list_string()
1268 char *mac_address_string(char *buf, char *end, u8 *addr, in mac_address_string() argument
1277 if (check_pointer(&buf, end, addr, spec)) in mac_address_string()
1305 return string_nocheck(buf, end, mac_addr, spec); in mac_address_string()
1458 char *ip6_addr_string(char *buf, char *end, const u8 *addr, in ip6_addr_string() argument
1468 return string_nocheck(buf, end, ip6_addr, spec); in ip6_addr_string()
1472 char *ip4_addr_string(char *buf, char *end, const u8 *addr, in ip4_addr_string() argument
1479 return string_nocheck(buf, end, ip4_addr, spec); in ip4_addr_string()
1483 char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa, in ip6_addr_string_sa() argument
1541 return string_nocheck(buf, end, ip6_addr, spec); in ip6_addr_string_sa()
1545 char *ip4_addr_string_sa(char *buf, char *end, const struct sockaddr_in *sa, in ip4_addr_string_sa() argument
1576 return string_nocheck(buf, end, ip4_addr, spec); in ip4_addr_string_sa()
1580 char *ip_addr_string(char *buf, char *end, const void *ptr, in ip_addr_string() argument
1585 if (check_pointer(&buf, end, ptr, spec)) in ip_addr_string()
1590 return ip6_addr_string(buf, end, ptr, spec, fmt); in ip_addr_string()
1592 return ip4_addr_string(buf, end, ptr, spec, fmt); in ip_addr_string()
1602 return ip4_addr_string_sa(buf, end, &sa->v4, spec, fmt); in ip_addr_string()
1604 return ip6_addr_string_sa(buf, end, &sa->v6, spec, fmt); in ip_addr_string()
1606 return error_string(buf, end, "(einval)", spec); in ip_addr_string()
1611 return error_string(buf, end, err_fmt_msg, spec); in ip_addr_string()
1615 char *escaped_string(char *buf, char *end, u8 *addr, struct printf_spec spec, in escaped_string() argument
1626 if (check_pointer(&buf, end, addr, spec)) in escaped_string()
1668 buf += string_escape_mem(addr, len, buf, buf < end ? end - buf : 0, flags, NULL); in escaped_string()
1673 static char *va_format(char *buf, char *end, struct va_format *va_fmt, in va_format() argument
1678 if (check_pointer(&buf, end, va_fmt, spec)) in va_format()
1682 buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va); in va_format()
1689 char *uuid_string(char *buf, char *end, const u8 *addr, in uuid_string() argument
1698 if (check_pointer(&buf, end, addr, spec)) in uuid_string()
1730 return string_nocheck(buf, end, uuid, spec); in uuid_string()
1734 char *netdev_bits(char *buf, char *end, const void *addr, in netdev_bits() argument
1740 if (check_pointer(&buf, end, addr, spec)) in netdev_bits()
1749 return error_string(buf, end, "(%pN?)", spec); in netdev_bits()
1752 return special_hex_number(buf, end, num, size); in netdev_bits()
1756 char *fourcc_string(char *buf, char *end, const u32 *fourcc, in fourcc_string() argument
1765 return error_string(buf, end, "(%p4?)", spec); in fourcc_string()
1767 if (check_pointer(&buf, end, fourcc, spec)) in fourcc_string()
1790 return string(buf, end, output, spec); in fourcc_string()
1794 char *address_val(char *buf, char *end, const void *addr, in address_val() argument
1800 if (check_pointer(&buf, end, addr, spec)) in address_val()
1815 return special_hex_number(buf, end, num, size); in address_val()
1819 char *date_str(char *buf, char *end, const struct rtc_time *tm, bool r) in date_str() argument
1824 buf = number(buf, end, year, default_dec04_spec); in date_str()
1825 if (buf < end) in date_str()
1829 buf = number(buf, end, mon, default_dec02_spec); in date_str()
1830 if (buf < end) in date_str()
1834 return number(buf, end, tm->tm_mday, default_dec02_spec); in date_str()
1838 char *time_str(char *buf, char *end, const struct rtc_time *tm, bool r) in time_str() argument
1840 buf = number(buf, end, tm->tm_hour, default_dec02_spec); in time_str()
1841 if (buf < end) in time_str()
1845 buf = number(buf, end, tm->tm_min, default_dec02_spec); in time_str()
1846 if (buf < end) in time_str()
1850 return number(buf, end, tm->tm_sec, default_dec02_spec); in time_str()
1854 char *rtc_str(char *buf, char *end, const struct rtc_time *tm, in rtc_str() argument
1862 if (check_pointer(&buf, end, tm, spec)) in rtc_str()
1891 buf = date_str(buf, end, tm, raw); in rtc_str()
1893 if (buf < end) in rtc_str()
1898 buf = time_str(buf, end, tm, raw); in rtc_str()
1904 char *time64_str(char *buf, char *end, const time64_t time, in time64_str() argument
1923 return rtc_str(buf, end, &rtc_time, spec, fmt); in time64_str()
1927 char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec, in time_and_date() argument
1932 return rtc_str(buf, end, (const struct rtc_time *)ptr, spec, fmt); in time_and_date()
1934 return time64_str(buf, end, *(const time64_t *)ptr, spec, fmt); in time_and_date()
1936 return error_string(buf, end, "(%pt?)", spec); in time_and_date()
1941 char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec, in clock() argument
1945 return error_string(buf, end, "(%pC?)", spec); in clock()
1947 if (check_pointer(&buf, end, clk, spec)) in clock()
1954 return string(buf, end, __clk_get_name(clk), spec); in clock()
1956 return ptr_to_id(buf, end, clk, spec); in clock()
1962 char *format_flags(char *buf, char *end, unsigned long flags, in format_flags() argument
1972 buf = string(buf, end, names->name, default_str_spec); in format_flags()
1976 if (buf < end) in format_flags()
1983 buf = number(buf, end, flags, default_flag_spec); in format_flags()
2010 char *format_page_flags(char *buf, char *end, unsigned long flags) in format_page_flags() argument
2016 buf = number(buf, end, flags, default_flag_spec); in format_page_flags()
2017 if (buf < end) in format_page_flags()
2023 buf = format_flags(buf, end, main_flags, pageflag_names); in format_page_flags()
2035 if (buf < end) in format_page_flags()
2040 buf = string(buf, end, pff[i].name, default_str_spec); in format_page_flags()
2041 if (buf < end) in format_page_flags()
2044 buf = number(buf, end, (flags >> pff[i].shift) & pff[i].mask, in format_page_flags()
2049 if (buf < end) in format_page_flags()
2057 char *format_page_type(char *buf, char *end, unsigned int page_type) in format_page_type() argument
2059 buf = number(buf, end, page_type, default_flag_spec); in format_page_type()
2061 if (buf < end) in format_page_type()
2066 buf = format_flags(buf, end, ~page_type, pagetype_names); in format_page_type()
2068 if (buf < end) in format_page_type()
2076 char *flags_string(char *buf, char *end, void *flags_ptr, in flags_string() argument
2082 if (check_pointer(&buf, end, flags_ptr, spec)) in flags_string()
2087 return format_page_flags(buf, end, *(unsigned long *)flags_ptr); in flags_string()
2089 return format_page_type(buf, end, *(unsigned int *)flags_ptr); in flags_string()
2099 return error_string(buf, end, "(%pG?)", spec); in flags_string()
2102 return format_flags(buf, end, flags, names); in flags_string()
2107 char *end) in fwnode_full_name_string() argument
2120 buf = string(buf, end, fwnode_get_name_prefix(__fwnode), in fwnode_full_name_string()
2122 buf = string(buf, end, fwnode_get_name(__fwnode), in fwnode_full_name_string()
2133 char *device_node_string(char *buf, char *end, struct device_node *dn, in device_node_string() argument
2147 return error_string(buf, end, "(%pO?)", spec); in device_node_string()
2150 return error_string(buf, end, "(%pOF?)", spec); in device_node_string()
2152 if (check_pointer(&buf, end, dn, spec)) in device_node_string()
2163 if (buf < end) in device_node_string()
2171 end); in device_node_string()
2177 buf = string(buf, end, p, str_spec); in device_node_string()
2181 buf = number(buf, end, (unsigned int)dn->phandle, default_dec_spec); in device_node_string()
2187 buf = string(buf, end, p, str_spec); in device_node_string()
2195 buf = string_nocheck(buf, end, tbuf, str_spec); in device_node_string()
2200 buf = string(buf, end, p, str_spec); in device_node_string()
2206 buf = string_nocheck(buf, end, ",", str_spec); in device_node_string()
2207 buf = string_nocheck(buf, end, "\"", str_spec); in device_node_string()
2208 buf = string(buf, end, p, str_spec); in device_node_string()
2209 buf = string_nocheck(buf, end, "\"", str_spec); in device_node_string()
2219 return widen_string(buf, buf - buf_start, end, spec); in device_node_string()
2223 char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode, in fwnode_string() argument
2232 return error_string(buf, end, "(%pf?)", spec); in fwnode_string()
2234 if (check_pointer(&buf, end, fwnode, spec)) in fwnode_string()
2241 buf = string(buf, end, fwnode_get_name(fwnode), str_spec); in fwnode_string()
2245 buf = fwnode_full_name_string(fwnode, buf, end); in fwnode_string()
2249 return widen_string(buf, buf - buf_start, end, spec); in fwnode_string()
2278 char *rust_fmt_argument(char *buf, char *end, void *ptr);
2412 char *pointer(const char *fmt, char *buf, char *end, void *ptr, in pointer() argument
2421 return symbol_string(buf, end, ptr, spec, fmt); in pointer()
2424 return resource_string(buf, end, ptr, spec, fmt); in pointer()
2426 return hex_string(buf, end, ptr, spec, fmt); in pointer()
2430 return bitmap_list_string(buf, end, ptr, spec, fmt); in pointer()
2432 return bitmap_string(buf, end, ptr, spec, fmt); in pointer()
2438 return mac_address_string(buf, end, ptr, spec, fmt); in pointer()
2448 return ip_addr_string(buf, end, ptr, spec, fmt); in pointer()
2450 return escaped_string(buf, end, ptr, spec, fmt); in pointer()
2452 return uuid_string(buf, end, ptr, spec, fmt); in pointer()
2454 return va_format(buf, end, ptr, spec, fmt); in pointer()
2456 return restricted_pointer(buf, end, ptr, spec); in pointer()
2458 return netdev_bits(buf, end, ptr, spec, fmt); in pointer()
2460 return fourcc_string(buf, end, ptr, spec, fmt); in pointer()
2462 return address_val(buf, end, ptr, spec, fmt); in pointer()
2464 return dentry_name(buf, end, ptr, spec, fmt); in pointer()
2466 return time_and_date(buf, end, ptr, spec, fmt); in pointer()
2468 return clock(buf, end, ptr, spec, fmt); in pointer()
2470 return file_dentry_name(buf, end, ptr, spec, fmt); in pointer()
2473 return bdev_name(buf, end, ptr, spec, fmt); in pointer()
2477 return flags_string(buf, end, ptr, spec, fmt); in pointer()
2479 return device_node_string(buf, end, ptr, spec, fmt + 1); in pointer()
2481 return fwnode_string(buf, end, ptr, spec, fmt + 1); in pointer()
2485 return error_string(buf, end, "(%pA?)", spec); in pointer()
2487 return rust_fmt_argument(buf, end, ptr); in pointer()
2489 return pointer_string(buf, end, ptr, spec); in pointer()
2493 return default_pointer(buf, end, ptr, spec); in pointer()
2494 return err_ptr(buf, end, ptr, spec); in pointer()
2499 return string(buf, end, ptr, spec); in pointer()
2501 return error_string(buf, end, "(einval)", spec); in pointer()
2504 return default_pointer(buf, end, ptr, spec); in pointer()
2756 char *str, *end; in vsnprintf() local
2765 end = buf + size; in vsnprintf()
2768 if (end < buf) { in vsnprintf()
2769 end = ((void *)-1); in vsnprintf()
2770 size = end - buf; in vsnprintf()
2782 if (str < end) { in vsnprintf()
2783 if (copy > end - str) in vsnprintf()
2784 copy = end - str; in vsnprintf()
2804 if (str < end) in vsnprintf()
2811 if (str < end) in vsnprintf()
2815 if (str < end) in vsnprintf()
2823 str = string(str, end, va_arg(args, char *), spec); in vsnprintf()
2827 str = pointer(fmt, str, end, va_arg(args, void *), in vsnprintf()
2834 if (str < end) in vsnprintf()
2889 str = number(str, end, num, spec); in vsnprintf()
2895 if (str < end) in vsnprintf()
2898 end[-1] = '\0'; in vsnprintf()
3061 char *str, *end; in vbin_printf() local
3065 end = (char *)(bin_buf + size); in vbin_printf()
3074 if (str + sizeof(type) <= end) { \ in vbin_printf()
3083 if (str + sizeof(type) <= end) \ in vbin_printf()
3125 if (str + len < end) in vbin_printf()
3147 str = pointer(fmt, str, end, va_arg(args, void *), in vbin_printf()
3149 if (str + 1 < end) in vbin_printf()
3152 end[-1] = '\0'; /* Must be nul terminated */ in vbin_printf()
3220 char *str, *end; in bstr_printf() local
3227 end = buf + size; in bstr_printf()
3245 if (end < buf) { in bstr_printf()
3246 end = ((void *)-1); in bstr_printf()
3247 size = end - buf; in bstr_printf()
3259 if (str < end) { in bstr_printf()
3260 if (copy > end - str) in bstr_printf()
3261 copy = end - str; in bstr_printf()
3281 if (str < end) in bstr_printf()
3287 if (str < end) in bstr_printf()
3291 if (str < end) in bstr_printf()
3301 str = string(str, end, (char *)str_arg, spec); in bstr_printf()
3323 if (str < end) { in bstr_printf()
3325 if (copy > end - str) in bstr_printf()
3326 copy = end - str; in bstr_printf()
3333 str = pointer(fmt, str, end, get_arg(void *), spec); in bstr_printf()
3341 if (str < end) in bstr_printf()
3386 str = number(str, end, num, spec); in bstr_printf()
3393 if (str < end) in bstr_printf()
3396 end[-1] = '\0'; in bstr_printf()