aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 13:48:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 13:48:44 -0500
commit4ba63072b998cc31515cc6305c25f3b808b50c01 (patch)
tree779863511765c70bfd232f676b885f940ba88722 /tools
parente29876723f7cb7728f0d6a674d23f92673e9f112 (diff)
parent5fb31cd839c21130c0b2524ceb9244e98dfe10e3 (diff)
Merge tag 'char-misc-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc patches from Greg KH: "Here's the big char/misc driver update for 3.20-rc1. Lots of little things in here, all described in the changelog. Nothing major or unusual, except maybe the binder selinux stuff, which was all acked by the proper selinux people and they thought it best to come through this tree. All of this has been in linux-next with no reported issues for a while" * tag 'char-misc-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (90 commits) coresight: fix function etm_writel_cp14() parameter order coresight-etm: remove check for unknown Kconfig macro coresight: fixing CPU hwid lookup in device tree coresight: remove the unnecessary function coresight_is_bit_set() coresight: fix the debug AMBA bus name coresight: remove the extra spaces coresight: fix the link between orphan connection and newly added device coresight: remove the unnecessary replicator property coresight: fix the replicator subtype value pdfdocs: Fix 'make pdfdocs' failure for 'uio-howto.tmpl' mcb: Fix error path of mcb_pci_probe virtio/console: verify device has config space ti-st: clean up data types (fix harmless memory corruption) mei: me: release hw from reset only during the reset flow mei: mask interrupt set bit on clean reset bit extcon: max77693: Constify struct regmap_config extcon: adc-jack: Release IIO channel on driver remove extcon: Remove duplicated include from extcon-class.c Drivers: hv: vmbus: hv_process_timer_expiration() can be static Drivers: hv: vmbus: serialize Offer and Rescind offer ...
Diffstat (limited to 'tools')
-rw-r--r--tools/hv/Makefile4
-rw-r--r--tools/hv/hv_fcopy_daemon.c10
-rw-r--r--tools/hv/hv_kvp_daemon.c41
3 files changed, 23 insertions, 32 deletions
diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index bd22f786a60c..99ffe61051a7 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -5,9 +5,9 @@ PTHREAD_LIBS = -lpthread
5WARNINGS = -Wall -Wextra 5WARNINGS = -Wall -Wextra
6CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) 6CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS)
7 7
8all: hv_kvp_daemon hv_vss_daemon 8all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
9%: %.c 9%: %.c
10 $(CC) $(CFLAGS) -o $@ $^ 10 $(CC) $(CFLAGS) -o $@ $^
11 11
12clean: 12clean:
13 $(RM) hv_kvp_daemon hv_vss_daemon 13 $(RM) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index f437d739f37d..9445d8f264a4 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -43,15 +43,9 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
43 int error = HV_E_FAIL; 43 int error = HV_E_FAIL;
44 char *q, *p; 44 char *q, *p;
45 45
46 /*
47 * If possile append a path seperator to the path.
48 */
49 if (strlen((char *)smsg->path_name) < (W_MAX_PATH - 2))
50 strcat((char *)smsg->path_name, "/");
51
52 p = (char *)smsg->path_name; 46 p = (char *)smsg->path_name;
53 snprintf(target_fname, sizeof(target_fname), "%s/%s", 47 snprintf(target_fname, sizeof(target_fname), "%s/%s",
54 (char *)smsg->path_name, smsg->file_name); 48 (char *)smsg->path_name, (char *)smsg->file_name);
55 49
56 syslog(LOG_INFO, "Target file name: %s", target_fname); 50 syslog(LOG_INFO, "Target file name: %s", target_fname);
57 /* 51 /*
@@ -137,7 +131,7 @@ void print_usage(char *argv[])
137 131
138int main(int argc, char *argv[]) 132int main(int argc, char *argv[])
139{ 133{
140 int fd, fcopy_fd, len; 134 int fcopy_fd, len;
141 int error; 135 int error;
142 int daemonize = 1, long_index = 0, opt; 136 int daemonize = 1, long_index = 0, opt;
143 int version = FCOPY_CURRENT_VERSION; 137 int version = FCOPY_CURRENT_VERSION;
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 6a6432a20a1d..408bb076a234 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)
147static void kvp_update_file(int pool) 147static void kvp_update_file(int pool)
148{ 148{
149 FILE *filep; 149 FILE *filep;
150 size_t bytes_written;
151 150
152 /* 151 /*
153 * We are going to write our in-memory registry out to 152 * We are going to write our in-memory registry out to
@@ -163,8 +162,7 @@ static void kvp_update_file(int pool)
163 exit(EXIT_FAILURE); 162 exit(EXIT_FAILURE);
164 } 163 }
165 164
166 bytes_written = fwrite(kvp_file_info[pool].records, 165 fwrite(kvp_file_info[pool].records, sizeof(struct kvp_record),
167 sizeof(struct kvp_record),
168 kvp_file_info[pool].num_records, filep); 166 kvp_file_info[pool].num_records, filep);
169 167
170 if (ferror(filep) || fclose(filep)) { 168 if (ferror(filep) || fclose(filep)) {
@@ -310,7 +308,7 @@ static int kvp_file_init(void)
310 return 0; 308 return 0;
311} 309}
312 310
313static int kvp_key_delete(int pool, const char *key, int key_size) 311static int kvp_key_delete(int pool, const __u8 *key, int key_size)
314{ 312{
315 int i; 313 int i;
316 int j, k; 314 int j, k;
@@ -353,8 +351,8 @@ static int kvp_key_delete(int pool, const char *key, int key_size)
353 return 1; 351 return 1;
354} 352}
355 353
356static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value, 354static int kvp_key_add_or_modify(int pool, const __u8 *key, int key_size,
357 int value_size) 355 const __u8 *value, int value_size)
358{ 356{
359 int i; 357 int i;
360 int num_records; 358 int num_records;
@@ -407,7 +405,7 @@ static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const
407 return 0; 405 return 0;
408} 406}
409 407
410static int kvp_get_value(int pool, const char *key, int key_size, char *value, 408static int kvp_get_value(int pool, const __u8 *key, int key_size, __u8 *value,
411 int value_size) 409 int value_size)
412{ 410{
413 int i; 411 int i;
@@ -439,8 +437,8 @@ static int kvp_get_value(int pool, const char *key, int key_size, char *value,
439 return 1; 437 return 1;
440} 438}
441 439
442static int kvp_pool_enumerate(int pool, int index, char *key, int key_size, 440static int kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size,
443 char *value, int value_size) 441 __u8 *value, int value_size)
444{ 442{
445 struct kvp_record *record; 443 struct kvp_record *record;
446 444
@@ -661,7 +659,7 @@ static char *kvp_if_name_to_mac(char *if_name)
661 char *p, *x; 659 char *p, *x;
662 char buf[256]; 660 char buf[256];
663 char addr_file[256]; 661 char addr_file[256];
664 int i; 662 unsigned int i;
665 char *mac_addr = NULL; 663 char *mac_addr = NULL;
666 664
667 snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/", 665 snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/",
@@ -700,7 +698,7 @@ static char *kvp_mac_to_if_name(char *mac)
700 char buf[256]; 698 char buf[256];
701 char *kvp_net_dir = "/sys/class/net/"; 699 char *kvp_net_dir = "/sys/class/net/";
702 char dev_id[256]; 700 char dev_id[256];
703 int i; 701 unsigned int i;
704 702
705 dir = opendir(kvp_net_dir); 703 dir = opendir(kvp_net_dir);
706 if (dir == NULL) 704 if (dir == NULL)
@@ -750,7 +748,7 @@ static char *kvp_mac_to_if_name(char *mac)
750 748
751 749
752static void kvp_process_ipconfig_file(char *cmd, 750static void kvp_process_ipconfig_file(char *cmd,
753 char *config_buf, int len, 751 char *config_buf, unsigned int len,
754 int element_size, int offset) 752 int element_size, int offset)
755{ 753{
756 char buf[256]; 754 char buf[256];
@@ -768,7 +766,7 @@ static void kvp_process_ipconfig_file(char *cmd,
768 if (offset == 0) 766 if (offset == 0)
769 memset(config_buf, 0, len); 767 memset(config_buf, 0, len);
770 while ((p = fgets(buf, sizeof(buf), file)) != NULL) { 768 while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
771 if ((len - strlen(config_buf)) < (element_size + 1)) 769 if (len < strlen(config_buf) + element_size + 1)
772 break; 770 break;
773 771
774 x = strchr(p, '\n'); 772 x = strchr(p, '\n');
@@ -916,7 +914,7 @@ static int kvp_process_ip_address(void *addrp,
916 914
917static int 915static int
918kvp_get_ip_info(int family, char *if_name, int op, 916kvp_get_ip_info(int family, char *if_name, int op,
919 void *out_buffer, int length) 917 void *out_buffer, unsigned int length)
920{ 918{
921 struct ifaddrs *ifap; 919 struct ifaddrs *ifap;
922 struct ifaddrs *curp; 920 struct ifaddrs *curp;
@@ -1019,8 +1017,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
1019 weight += hweight32(&w[i]); 1017 weight += hweight32(&w[i]);
1020 1018
1021 sprintf(cidr_mask, "/%d", weight); 1019 sprintf(cidr_mask, "/%d", weight);
1022 if ((length - sn_offset) < 1020 if (length < sn_offset + strlen(cidr_mask) + 1)
1023 (strlen(cidr_mask) + 1))
1024 goto gather_ipaddr; 1021 goto gather_ipaddr;
1025 1022
1026 if (sn_offset == 0) 1023 if (sn_offset == 0)
@@ -1308,16 +1305,17 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
1308 if (error) 1305 if (error)
1309 goto setval_error; 1306 goto setval_error;
1310 1307
1308 /*
1309 * The dhcp_enabled flag is only for IPv4. In the case the host only
1310 * injects an IPv6 address, the flag is true, but we still need to
1311 * proceed to parse and pass the IPv6 information to the
1312 * disto-specific script hv_set_ifconfig.
1313 */
1311 if (new_val->dhcp_enabled) { 1314 if (new_val->dhcp_enabled) {
1312 error = kvp_write_file(file, "BOOTPROTO", "", "dhcp"); 1315 error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
1313 if (error) 1316 if (error)
1314 goto setval_error; 1317 goto setval_error;
1315 1318
1316 /*
1317 * We are done!.
1318 */
1319 goto setval_done;
1320
1321 } else { 1319 } else {
1322 error = kvp_write_file(file, "BOOTPROTO", "", "none"); 1320 error = kvp_write_file(file, "BOOTPROTO", "", "none");
1323 if (error) 1321 if (error)
@@ -1345,7 +1343,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
1345 if (error) 1343 if (error)
1346 goto setval_error; 1344 goto setval_error;
1347 1345
1348setval_done:
1349 fclose(file); 1346 fclose(file);
1350 1347
1351 /* 1348 /*