[PATCH V2 04/19] selftests/resctrl: Declare global variables as extern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



resctrl test suite uses global variables (E.g: bm_pid, ppid, llc_occup_path
and is_amd) that are used across .c files. Declare them as 'extern'
variables in resctrl.h file so that they are defined only in one .c file.
Otherwise sparse tool warns it as multiple definitions of the same
variable.

Sparse still complains about "bm_pid" variable name being used globally and
locally to a function in cache.c file. This issue will be addressed in a
later patch series.

Fixes: 591a6e8588fc ("selftests/resctrl: Add basic resctrl file system operations and data")
Reported-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@xxxxxxxxx>
---
 tools/testing/selftests/resctrl/resctrl.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 68522b19b235..814d0dd517a4 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -62,11 +62,11 @@ struct resctrl_val_param {
 	int		(*setup)(int num, ...);
 };
 
-pid_t bm_pid, ppid;
-int tests_run;
+extern pid_t bm_pid, ppid;
+extern int tests_run;
 
-char llc_occup_path[1024];
-bool is_amd;
+extern char llc_occup_path[1024];
+extern bool is_amd;
 
 bool check_resctrlfs_support(void);
 int filter_dmesg(void);
-- 
2.19.1




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux