hyperv/hn: Move %b format string for capabilities near their definition.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8341
This commit is contained in:
Sepherosa Ziehau 2016-10-27 04:42:39 +00:00
parent 90321eb752
commit 5341cc1c91
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307986
2 changed files with 6 additions and 12 deletions

View File

@ -275,6 +275,11 @@ struct hn_softc {
#define HN_CAP_TSO6 0x0100
#define HN_CAP_HASHVAL 0x0200
/* Capability description for use with printf(9) %b identifier. */
#define HN_CAP_BITS \
"\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \
"\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL"
#define HN_LINK_FLAG_LINKUP 0x0001
#define HN_LINK_FLAG_NETCHG 0x0002

View File

@ -2379,18 +2379,7 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS)
HN_LOCK(sc);
caps = sc->hn_caps;
HN_UNLOCK(sc);
snprintf(caps_str, sizeof(caps_str), "%b", caps,
"\020"
"\001VLAN"
"\002MTU"
"\003IPCS"
"\004TCP4CS"
"\005TCP6CS"
"\006UDP4CS"
"\007UDP6CS"
"\010TSO4"
"\011TSO6"
"\012HASHVAL");
snprintf(caps_str, sizeof(caps_str), "%b", caps, HN_CAP_BITS);
return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req);
}