aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d4996cf46eb6..dc48d2b32ebd 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -25,6 +25,7 @@
25#include <linux/kallsyms.h> 25#include <linux/kallsyms.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <linux/bitrev.h>
28#include <net/addrconf.h> 29#include <net/addrconf.h>
29 30
30#include <asm/page.h> /* for PAGE_SIZE */ 31#include <asm/page.h> /* for PAGE_SIZE */
@@ -681,11 +682,21 @@ static char *mac_address_string(char *buf, char *end, u8 *addr,
681 char mac_addr[sizeof("xx:xx:xx:xx:xx:xx")]; 682 char mac_addr[sizeof("xx:xx:xx:xx:xx:xx")];
682 char *p = mac_addr; 683 char *p = mac_addr;
683 int i; 684 int i;
685 bool bitrev;
686 char separator;
687
688 if (fmt[1] == 'F') { /* FDDI canonical format */
689 bitrev = true;
690 separator = '-';
691 } else {
692 bitrev = false;
693 separator = ':';
694 }
684 695
685 for (i = 0; i < 6; i++) { 696 for (i = 0; i < 6; i++) {
686 p = pack_hex_byte(p, addr[i]); 697 p = pack_hex_byte(p, bitrev ? bitrev8(addr[i]) : addr[i]);
687 if (fmt[0] == 'M' && i != 5) 698 if (fmt[0] == 'M' && i != 5)
688 *p++ = ':'; 699 *p++ = separator;
689 } 700 }
690 *p = '\0'; 701 *p = '\0';
691 702
@@ -896,6 +907,10 @@ static char *uuid_string(char *buf, char *end, const u8 *addr,
896 * - 'M' For a 6-byte MAC address, it prints the address in the 907 * - 'M' For a 6-byte MAC address, it prints the address in the
897 * usual colon-separated hex notation 908 * usual colon-separated hex notation
898 * - 'm' For a 6-byte MAC address, it prints the hex address without colons 909 * - 'm' For a 6-byte MAC address, it prints the hex address without colons
910 * - 'MF' For a 6-byte MAC FDDI address, it prints the address
911 * with a dash-separated hex notation with bit reversed bytes
912 * - 'mF' For a 6-byte MAC FDDI address, it prints the address
913 * in hex notation without separators with bit reversed bytes
899 * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way 914 * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way
900 * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4) 915 * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4)
901 * IPv6 uses colon separated network-order 16 bit hex with leading 0's 916 * IPv6 uses colon separated network-order 16 bit hex with leading 0's
@@ -939,6 +954,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
939 return resource_string(buf, end, ptr, spec, fmt); 954 return resource_string(buf, end, ptr, spec, fmt);
940 case 'M': /* Colon separated: 00:01:02:03:04:05 */ 955 case 'M': /* Colon separated: 00:01:02:03:04:05 */
941 case 'm': /* Contiguous: 000102030405 */ 956 case 'm': /* Contiguous: 000102030405 */
957 /* [mM]F (FDDI, bit reversed) */
942 return mac_address_string(buf, end, ptr, spec, fmt); 958 return mac_address_string(buf, end, ptr, spec, fmt);
943 case 'I': /* Formatted IP supported 959 case 'I': /* Formatted IP supported
944 * 4: 1.2.3.4 960 * 4: 1.2.3.4