提交 f4685fa6 编写于 作者: T Tomas Hozza 提交者: Greg Kroah-Hartman

tools: hv: daemon setsockopt should use options macros

HyperV daemon should use macros for option values when calling setsockopt.
Using specific numeric values instead of macros is confusing.
Signed-off-by: NTomas Hozza <thozza@redhat.com>
Acked-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 77d6a528
...@@ -102,6 +102,10 @@ static struct utsname uts_buf; ...@@ -102,6 +102,10 @@ static struct utsname uts_buf;
#define MAX_FILE_NAME 100 #define MAX_FILE_NAME 100
#define ENTRIES_PER_BLOCK 50 #define ENTRIES_PER_BLOCK 50
#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif
struct kvp_record { struct kvp_record {
char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
...@@ -1407,7 +1411,7 @@ netlink_send(int fd, struct cn_msg *msg) ...@@ -1407,7 +1411,7 @@ netlink_send(int fd, struct cn_msg *msg)
int main(void) int main(void)
{ {
int fd, len, sock_opt; int fd, len, nl_group;
int error; int error;
struct cn_msg *message; struct cn_msg *message;
struct pollfd pfd; struct pollfd pfd;
...@@ -1452,8 +1456,8 @@ int main(void) ...@@ -1452,8 +1456,8 @@ int main(void)
close(fd); close(fd);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
sock_opt = CN_KVP_IDX; nl_group = CN_KVP_IDX;
setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt)); setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group));
/* /*
* Register ourselves with the kernel. * Register ourselves with the kernel.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册