Kernel-2.6.32-573.12.1.el6_printk-formats

If variable is of Type, use printk format specifier:

    int            %d or %x
    unsigned int        %u or %x
    long            %ld or %lx
    unsigned long        %lu or %lx
    long long        %lld or %llx
    unsigned long long    %llu or %llx
    size_t            %zu or %zx
    ssize_t            %zd or %zx

Raw pointer value SHOULD be printed with %p.

IPv4/IPv6 addresses (generic, with port, flowinfo, scope):

%pIS    1.2.3.4        or 0001:0002:0003:0004:0005:0006:0007:0008
%piS    001.002.003.004    or 00010002000300040005000600070008
%pISc    1.2.3.4        or 1:2:3:4:5:6:7:8
%pISpc    1.2.3.4:12345    or [1:2:3:4:5:6:7:8]:12345
%p[Ii]S[pfschnbl]

For printing an IP address without the need to distinguish whether it's
of type AF_INET or AF_INET6, a pointer to a valid 'struct sockaddr',
specified through 'IS' or 'iS', can be passed to this format specifier.

The additional 'p', 'f', and 's' specifiers are used to specify port
(IPv4, IPv6), flowinfo (IPv6) and scope (IPv6). Ports have a ':' prefix,
flowinfo a '/' and scope a '%', each followed by the actual value.

In case of an IPv6 address the compressed IPv6 address as described by
http://tools.ietf.org/html/rfc5952 is being used if the additional
specifier 'c' is given. The IPv6 address is surrounded by '[', ']' in
case of additional specifiers 'p', 'f' or 's' as suggested by
https://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-07

In case of IPv4 addresses, the additional 'h', 'n', 'b', and 'l'
specifiers can be used as well and are ignored in case of an IPv6
address.

Further examples:

%pISfc        1.2.3.4        or [1:2:3:4:5:6:7:8]/123456789
%pISsc        1.2.3.4        or [1:2:3:4:5:6:7:8]%1234567890
%pISpfc        1.2.3.4:12345    or [1:2:3:4:5:6:7:8]:12345/123456789

Raw buffer as a hex string:
%*ph 00 01 02 … 3f
%*phC 00:01:02: … :3f
%*phD 00-01-02- … -3f
%*phN 000102 … 3f

For printing a small buffers (up to 64 bytes long) as a hex string with
certain separator. For the larger buffers consider to use
print_hex_dump().

u64 SHOULD be printed with %llu/%llx, (unsigned long long):

printk("%llu", (unsigned long long)u64_var);

s64 SHOULD be printed with %lld/%llx, (long long):

printk("%lld", (long long)s64_var);

If is dependent on a config option for its size (e.g., sector_t,
blkcnt_t, phys_addr_t, resource_size_t) or is architecture-dependent
for its size (e.g., tcflag_t), use a format specifier of its largest
possible type and explicitly cast to it. Example:

printk("test: sector number/total blocks: %llu/%llu\n",
    (unsigned long long)sector, (unsigned long long)blockcount);

Reminder: sizeof() result is of type size_t.

Thank you for your cooperation and attention.

By Randy Dunlap rdunlap@xenotime.net