Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1503546 > unrolled thread
| Started by | Weibing Zhang <atheism.zhang@gmail.com> |
|---|---|
| First post | 2016-10-19 05:50 +0200 |
| Last post | 2016-10-19 17:10 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] tools: hv: clean up code, remove unnecessary header files and link flags Weibing Zhang <atheism.zhang@gmail.com> - 2016-10-19 05:50 +0200
RE: [PATCH] tools: hv: clean up code, remove unnecessary header files and link flags KY Srinivasan <kys@microsoft.com> - 2016-10-19 16:50 +0200
Re: [PATCH] tools: hv: clean up code, remove unnecessary header files and link flags Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-19 17:10 +0200
| From | Weibing Zhang <atheism.zhang@gmail.com> |
|---|---|
| Date | 2016-10-19 05:50 +0200 |
| Subject | [PATCH] tools: hv: clean up code, remove unnecessary header files and link flags |
| Message-ID | <stQ37-3Dd-1@gated-at.bofh.it> |
Remove unnecessary header files and netlink related code as the daemons
do not use netlink to communicate with the kernel now.
Fix a compile warning in snprintf.
Pthread is also not needed.
Signed-off-by: Weibing Zhang <atheism.zhang@gmail.com>
---
tools/hv/Makefile | 3 +--
tools/hv/hv_fcopy_daemon.c | 7 -------
tools/hv/hv_kvp_daemon.c | 9 +--------
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index a8c4644..0d1e61b 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -1,9 +1,8 @@
# Makefile for Hyper-V tools
CC = $(CROSS_COMPILE)gcc
-PTHREAD_LIBS = -lpthread
WARNINGS = -Wall -Wextra
-CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
+CFLAGS = $(WARNINGS) -g $(shell getconf LFS_CFLAGS)
CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index fdc9ca4..26ae609 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -18,21 +18,14 @@
#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <linux/types.h>
-#include <linux/kdev_t.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
#include <errno.h>
#include <linux/hyperv.h>
#include <syslog.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <dirent.h>
#include <getopt.h>
static int target_fd;
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index bc7adb8..d791dbf 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -22,8 +22,6 @@
*/
-#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/poll.h>
#include <sys/utsname.h>
#include <stdio.h>
@@ -34,7 +32,6 @@
#include <errno.h>
#include <arpa/inet.h>
#include <linux/hyperv.h>
-#include <linux/netlink.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <syslog.h>
@@ -99,10 +96,6 @@ static struct utsname uts_buf;
#define MAX_FILE_NAME 100
#define ENTRIES_PER_BLOCK 50
-#ifndef SOL_NETLINK
-#define SOL_NETLINK 270
-#endif
-
struct kvp_record {
char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
@@ -702,7 +695,7 @@ static char *kvp_mac_to_if_name(char *mac)
if (dir == NULL)
return NULL;
- snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
+ snprintf(dev_id, sizeof(dev_id), "%s", kvp_net_dir);
q = dev_id + strlen(kvp_net_dir);
while ((entry = readdir(dir)) != NULL) {
--
2.7.4
[toc] | [next] | [standalone]
| From | KY Srinivasan <kys@microsoft.com> |
|---|---|
| Date | 2016-10-19 16:50 +0200 |
| Subject | RE: [PATCH] tools: hv: clean up code, remove unnecessary header files and link flags |
| Message-ID | <su0lQ-2yX-51@gated-at.bofh.it> |
| In reply to | #1503546 |
> -----Original Message-----
> From: Weibing Zhang [mailto:atheism.zhang@gmail.com]
> Sent: Tuesday, October 18, 2016 8:43 PM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>
> Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; Weibing
> Zhang <atheism.zhang@gmail.com>
> Subject: [PATCH] tools: hv: clean up code, remove unnecessary header files
> and link flags
>
> Remove unnecessary header files and netlink related code as the daemons
> do not use netlink to communicate with the kernel now.
> Fix a compile warning in snprintf.
> Pthread is also not needed.
Breakup this patch into one that does header cleanup and the other that fixes the
compilation warning.
K. Y
>
> Signed-off-by: Weibing Zhang <atheism.zhang@gmail.com>
> ---
> tools/hv/Makefile | 3 +--
> tools/hv/hv_fcopy_daemon.c | 7 -------
> tools/hv/hv_kvp_daemon.c | 9 +--------
> 3 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index a8c4644..0d1e61b 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -1,9 +1,8 @@
> # Makefile for Hyper-V tools
>
> CC = $(CROSS_COMPILE)gcc
> -PTHREAD_LIBS = -lpthread
> WARNINGS = -Wall -Wextra
> -CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
> +CFLAGS = $(WARNINGS) -g $(shell getconf LFS_CFLAGS)
>
> CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
>
> diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
> index fdc9ca4..26ae609 100644
> --- a/tools/hv/hv_fcopy_daemon.c
> +++ b/tools/hv/hv_fcopy_daemon.c
> @@ -18,21 +18,14 @@
>
>
> #include <sys/types.h>
> -#include <sys/socket.h>
> -#include <sys/poll.h>
> -#include <linux/types.h>
> -#include <linux/kdev_t.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> -#include <string.h>
> -#include <ctype.h>
> #include <errno.h>
> #include <linux/hyperv.h>
> #include <syslog.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> -#include <dirent.h>
> #include <getopt.h>
>
> static int target_fd;
> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> index bc7adb8..d791dbf 100644
> --- a/tools/hv/hv_kvp_daemon.c
> +++ b/tools/hv/hv_kvp_daemon.c
> @@ -22,8 +22,6 @@
> */
>
>
> -#include <sys/types.h>
> -#include <sys/socket.h>
> #include <sys/poll.h>
> #include <sys/utsname.h>
> #include <stdio.h>
> @@ -34,7 +32,6 @@
> #include <errno.h>
> #include <arpa/inet.h>
> #include <linux/hyperv.h>
> -#include <linux/netlink.h>
> #include <ifaddrs.h>
> #include <netdb.h>
> #include <syslog.h>
> @@ -99,10 +96,6 @@ static struct utsname uts_buf;
> #define MAX_FILE_NAME 100
> #define ENTRIES_PER_BLOCK 50
>
> -#ifndef SOL_NETLINK
> -#define SOL_NETLINK 270
> -#endif
> -
> struct kvp_record {
> char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
> char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
> @@ -702,7 +695,7 @@ static char *kvp_mac_to_if_name(char *mac)
> if (dir == NULL)
> return NULL;
>
> - snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
> + snprintf(dev_id, sizeof(dev_id), "%s", kvp_net_dir);
> q = dev_id + strlen(kvp_net_dir);
>
> while ((entry = readdir(dir)) != NULL) {
> --
> 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-10-19 17:10 +0200 |
| Subject | Re: [PATCH] tools: hv: clean up code, remove unnecessary header files and link flags |
| Message-ID | <su0Fd-2Wq-83@gated-at.bofh.it> |
| In reply to | #1503546 |
On Wed, Oct 19, 2016 at 11:43:28AM +0800, Weibing Zhang wrote: > Remove unnecessary header files and netlink related code as the daemons > do not use netlink to communicate with the kernel now. > Fix a compile warning in snprintf. > Pthread is also not needed. > > Signed-off-by: Weibing Zhang <atheism.zhang@gmail.com> Break this up into multiple patches. 1) cleanup makefile 2) remove unneeded header stuff 3) fix a compile warning regards, dan carpenter
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web