All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/5] Tools: hv: fix compiler warnings and do minor cleanup
@ 2015-01-10  6:18 K. Y. Srinivasan
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
  0 siblings, 1 reply; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

When someone does 'make' in tools/hv/ issues appear:
- hv_fcopy_daemon is not being built;
- lots of compiler warnings.

This is just a cleanup. Compile-tested by myself on top of linux-next/master.

Piggyback this series and send "[PATCH 5/5] Tools: hv: do not add redundant '/'
in hv_start_fcopy()"

Vitaly Kuznetsov (5):
  Tools: hv: add mising fcopyd to the Makefile
  Tools: hv: remove unused bytes_written from kvp_update_file()
  Tools: hv: address compiler warnings for hv_kvp_daemon.c
  Tools: hv: address compiler warnings for hv_fcopy_daemon.c
  Tools: hv: do not add redundant '/' in hv_start_fcopy()

 tools/hv/Makefile          |    4 ++--
 tools/hv/hv_fcopy_daemon.c |   10 ++--------
 tools/hv/hv_kvp_daemon.c   |   29 +++++++++++++----------------
 3 files changed, 17 insertions(+), 26 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile
  2015-01-10  6:18 [PATCH RESEND 0/5] Tools: hv: fix compiler warnings and do minor cleanup K. Y. Srinivasan
@ 2015-01-10  6:18 ` K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 2/5] Tools: hv: remove unused bytes_written from kvp_update_file() K. Y. Srinivasan
                     ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

fcopyd in missing in the Makefile, add it there.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index bd22f78..99ffe61 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -5,9 +5,9 @@ PTHREAD_LIBS = -lpthread
 WARNINGS = -Wall -Wextra
 CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS)
 
-all: hv_kvp_daemon hv_vss_daemon
+all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $^
 
 clean:
-	$(RM) hv_kvp_daemon hv_vss_daemon
+	$(RM) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 2/5] Tools: hv: remove unused bytes_written from kvp_update_file()
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
@ 2015-01-10  6:18   ` K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 3/5] Tools: hv: address compiler warnings for hv_kvp_daemon.c K. Y. Srinivasan
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

fwrite() does not actually return the number of bytes written and
this value is being ignored anyway and ferror() is being called to
check for an error. As we assign to this variable and never use it
we get the following compile-time warning:
hv_kvp_daemon.c:149:9: warning: variable .bytes_written. set but not used [-Wunused-but-set-variable]
Remove bytes_written completely.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_kvp_daemon.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 6a6432a..5a274ca 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -147,7 +147,6 @@ static void kvp_release_lock(int pool)
 static void kvp_update_file(int pool)
 {
 	FILE *filep;
-	size_t bytes_written;
 
 	/*
 	 * We are going to write our in-memory registry out to
@@ -163,8 +162,7 @@ static void kvp_update_file(int pool)
 		exit(EXIT_FAILURE);
 	}
 
-	bytes_written = fwrite(kvp_file_info[pool].records,
-				sizeof(struct kvp_record),
+	fwrite(kvp_file_info[pool].records, sizeof(struct kvp_record),
 				kvp_file_info[pool].num_records, filep);
 
 	if (ferror(filep) || fclose(filep)) {
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 3/5] Tools: hv: address compiler warnings for hv_kvp_daemon.c
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 2/5] Tools: hv: remove unused bytes_written from kvp_update_file() K. Y. Srinivasan
@ 2015-01-10  6:18   ` K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 4/5] Tools: hv: address compiler warnings for hv_fcopy_daemon.c K. Y. Srinivasan
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

This patch addresses two types of compiler warnings:
... warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
and
... warning: pointer targets in passing argument N of .kvp_.... differ in signedness [-Wpointer-sign]

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_kvp_daemon.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 5a274ca..48a95f9 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -308,7 +308,7 @@ static int kvp_file_init(void)
 	return 0;
 }
 
-static int kvp_key_delete(int pool, const char *key, int key_size)
+static int kvp_key_delete(int pool, const __u8 *key, int key_size)
 {
 	int i;
 	int j, k;
@@ -351,8 +351,8 @@ static int kvp_key_delete(int pool, const char *key, int key_size)
 	return 1;
 }
 
-static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value,
-			int value_size)
+static int kvp_key_add_or_modify(int pool, const __u8 *key, int key_size,
+				 const __u8 *value, int value_size)
 {
 	int i;
 	int num_records;
@@ -405,7 +405,7 @@ static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const
 	return 0;
 }
 
-static int kvp_get_value(int pool, const char *key, int key_size, char *value,
+static int kvp_get_value(int pool, const __u8 *key, int key_size, __u8 *value,
 			int value_size)
 {
 	int i;
@@ -437,8 +437,8 @@ static int kvp_get_value(int pool, const char *key, int key_size, char *value,
 	return 1;
 }
 
-static int kvp_pool_enumerate(int pool, int index, char *key, int key_size,
-				char *value, int value_size)
+static int kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size,
+				__u8 *value, int value_size)
 {
 	struct kvp_record *record;
 
@@ -659,7 +659,7 @@ static char *kvp_if_name_to_mac(char *if_name)
 	char    *p, *x;
 	char    buf[256];
 	char addr_file[256];
-	int i;
+	unsigned int i;
 	char *mac_addr = NULL;
 
 	snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/",
@@ -698,7 +698,7 @@ static char *kvp_mac_to_if_name(char *mac)
 	char    buf[256];
 	char *kvp_net_dir = "/sys/class/net/";
 	char dev_id[256];
-	int i;
+	unsigned int i;
 
 	dir = opendir(kvp_net_dir);
 	if (dir == NULL)
@@ -748,7 +748,7 @@ static char *kvp_mac_to_if_name(char *mac)
 
 
 static void kvp_process_ipconfig_file(char *cmd,
-					char *config_buf, int len,
+					char *config_buf, unsigned int len,
 					int element_size, int offset)
 {
 	char buf[256];
@@ -766,7 +766,7 @@ static void kvp_process_ipconfig_file(char *cmd,
 	if (offset == 0)
 		memset(config_buf, 0, len);
 	while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
-		if ((len - strlen(config_buf)) < (element_size + 1))
+		if (len < strlen(config_buf) + element_size + 1)
 			break;
 
 		x = strchr(p, '\n');
@@ -914,7 +914,7 @@ static int kvp_process_ip_address(void *addrp,
 
 static int
 kvp_get_ip_info(int family, char *if_name, int op,
-		 void  *out_buffer, int length)
+		 void  *out_buffer, unsigned int length)
 {
 	struct ifaddrs *ifap;
 	struct ifaddrs *curp;
@@ -1017,8 +1017,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
 					weight += hweight32(&w[i]);
 
 				sprintf(cidr_mask, "/%d", weight);
-				if ((length - sn_offset) <
-					(strlen(cidr_mask) + 1))
+				if (length < sn_offset + strlen(cidr_mask) + 1)
 					goto gather_ipaddr;
 
 				if (sn_offset == 0)
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 4/5] Tools: hv: address compiler warnings for hv_fcopy_daemon.c
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 2/5] Tools: hv: remove unused bytes_written from kvp_update_file() K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 3/5] Tools: hv: address compiler warnings for hv_kvp_daemon.c K. Y. Srinivasan
@ 2015-01-10  6:18   ` K. Y. Srinivasan
  2015-01-10  6:18   ` [PATCH RESEND 5/5] Tools: hv: do not add redundant '/' in hv_start_fcopy() K. Y. Srinivasan
  2015-01-25 13:34   ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile Greg KH
  4 siblings, 0 replies; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

This patch addresses two types of compiler warnings:
... warning: unused variable .fd. [-Wunused-variable]
and
... warning: format .%s. expects argument of type .char *., but argument 5 has type .__u16 *. [-Wformat=]

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_fcopy_daemon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index f437d73..1a23872 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -51,7 +51,7 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
 
 	p = (char *)smsg->path_name;
 	snprintf(target_fname, sizeof(target_fname), "%s/%s",
-		(char *)smsg->path_name, smsg->file_name);
+		 (char *)smsg->path_name, (char *)smsg->file_name);
 
 	syslog(LOG_INFO, "Target file name: %s", target_fname);
 	/*
@@ -137,7 +137,7 @@ void print_usage(char *argv[])
 
 int main(int argc, char *argv[])
 {
-	int fd, fcopy_fd, len;
+	int fcopy_fd, len;
 	int error;
 	int daemonize = 1, long_index = 0, opt;
 	int version = FCOPY_CURRENT_VERSION;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 5/5] Tools: hv: do not add redundant '/' in hv_start_fcopy()
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
                     ` (2 preceding siblings ...)
  2015-01-10  6:18   ` [PATCH RESEND 4/5] Tools: hv: address compiler warnings for hv_fcopy_daemon.c K. Y. Srinivasan
@ 2015-01-10  6:18   ` K. Y. Srinivasan
  2015-01-25 13:34   ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile Greg KH
  4 siblings, 0 replies; 8+ messages in thread
From: K. Y. Srinivasan @ 2015-01-10  6:18 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets; +Cc: K. Y. Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

We don't need to add additional '/' to smsg->path_name as snprintf("%s/%s")
does the right thing. Without the patch we get doubled '//' in the log message.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_fcopy_daemon.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index 1a23872..9445d8f 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -43,12 +43,6 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
 	int error = HV_E_FAIL;
 	char *q, *p;
 
-	/*
-	 * If possile append a path seperator to the path.
-	 */
-	if (strlen((char *)smsg->path_name) < (W_MAX_PATH - 2))
-		strcat((char *)smsg->path_name, "/");
-
 	p = (char *)smsg->path_name;
 	snprintf(target_fname, sizeof(target_fname), "%s/%s",
 		 (char *)smsg->path_name, (char *)smsg->file_name);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile
  2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
                     ` (3 preceding siblings ...)
  2015-01-10  6:18   ` [PATCH RESEND 5/5] Tools: hv: do not add redundant '/' in hv_start_fcopy() K. Y. Srinivasan
@ 2015-01-25 13:34   ` Greg KH
  2015-01-26 10:07     ` Vitaly Kuznetsov
  4 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2015-01-25 13:34 UTC (permalink / raw)
  To: K. Y. Srinivasan; +Cc: linux-kernel, devel, olaf, apw, vkuznets

On Fri, Jan 09, 2015 at 10:18:51PM -0800, K. Y. Srinivasan wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> fcopyd in missing in the Makefile, add it there.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  tools/hv/Makefile |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

This patch fails to apply :(

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile
  2015-01-25 13:34   ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile Greg KH
@ 2015-01-26 10:07     ` Vitaly Kuznetsov
  0 siblings, 0 replies; 8+ messages in thread
From: Vitaly Kuznetsov @ 2015-01-26 10:07 UTC (permalink / raw)
  To: Greg KH; +Cc: K. Y. Srinivasan, linux-kernel, devel, olaf, apw

Greg KH <gregkh@linuxfoundation.org> writes:

> On Fri, Jan 09, 2015 at 10:18:51PM -0800, K. Y. Srinivasan wrote:
>> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>> 
>> fcopyd in missing in the Makefile, add it there.
>> 
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
>> ---
>>  tools/hv/Makefile |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> This patch fails to apply :(

The was a mid-air collision with Matej's 'tools: hv: Makefile: Add
hv_fcopy_daemon to Makefile' patch, feel free to drop this one.

Sorry for the inconvenience,

-- 
  Vitaly

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-26 10:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-10  6:18 [PATCH RESEND 0/5] Tools: hv: fix compiler warnings and do minor cleanup K. Y. Srinivasan
2015-01-10  6:18 ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile K. Y. Srinivasan
2015-01-10  6:18   ` [PATCH RESEND 2/5] Tools: hv: remove unused bytes_written from kvp_update_file() K. Y. Srinivasan
2015-01-10  6:18   ` [PATCH RESEND 3/5] Tools: hv: address compiler warnings for hv_kvp_daemon.c K. Y. Srinivasan
2015-01-10  6:18   ` [PATCH RESEND 4/5] Tools: hv: address compiler warnings for hv_fcopy_daemon.c K. Y. Srinivasan
2015-01-10  6:18   ` [PATCH RESEND 5/5] Tools: hv: do not add redundant '/' in hv_start_fcopy() K. Y. Srinivasan
2015-01-25 13:34   ` [PATCH RESEND 1/5] Tools: hv: add mising fcopyd to the Makefile Greg KH
2015-01-26 10:07     ` Vitaly Kuznetsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.