[PATCH] [6/15] Clean up libnuma namespace

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

 



- Make all non exported functions static
- Add copy_bitmask_to_bitmask to numa.h
- Remove duplicated/unnecessary prototypes
- Always use full C prototype (void) instead of ()

---
 libnuma.c |   42 +++++++++++++++++++-----------------------
 numa.h    |    1 +
 2 files changed, 20 insertions(+), 23 deletions(-)

Index: numactl-2.0.0/libnuma.c
===================================================================
--- numactl-2.0.0.orig/libnuma.c
+++ numactl-2.0.0/libnuma.c
@@ -68,11 +68,7 @@ static int nodemask_sz = 0;
 static int cpumask_sz = 0;
 
 int numa_exit_on_error = 0;
-struct bitmask *numa_allocate_nodemask(void);
-void set_sizes(void);
-void copy_nodemask_to_bitmask(nodemask_t *, struct bitmask *);
-void copy_bitmask_to_nodemask(struct bitmask *, nodemask_t *);
-void copy_bitmask_to_bitmask(struct bitmask *, struct bitmask *);
+static void set_sizes(void);
 
 static inline void
 nodemask_set_v1(nodemask_t *mask, int node)
@@ -99,7 +95,7 @@ nodemask_isset_v1(const nodemask_t *mask
  * The v1 library depends upon nodemask_t's of all nodes and no nodes.
  */
 void
-numa_init()
+numa_init(void)
 {
 	int max,i;
 
@@ -292,7 +288,7 @@ make_internal_alias(numa_pagesize);
 /*
  * Find the highest numbered existing memory node: maxconfigurednode.
  */
-void
+static void
 set_configured_nodes(void)
 {
 	DIR *d;
@@ -355,7 +351,7 @@ static const char *nodemask_prefix = "Me
  * (this could also be used to find the cpumask size)
  */
 static void
-set_nodemask_size()
+set_nodemask_size(void)
 {
 	FILE *fp = NULL;
 	char *buf = NULL;
@@ -391,7 +387,7 @@ done:
  * commas. Order them correctly and return the number of the last bit
  * set.
  */
-int
+static int
 read_mask(char *s, struct bitmask *bmp)
 {
 	char *end = s;
@@ -449,7 +445,7 @@ read_mask(char *s, struct bitmask *bmp)
  * Read a processes constraints in terms of nodes and cpus from
  * /proc/self/status.
  */
-void
+static void
 set_thread_constraints(void)
 {
 	int max_cpus = numa_num_possible_cpus();
@@ -518,7 +514,7 @@ set_thread_constraints(void)
  * Find the highest cpu number possible (in other words the size
  * of a kernel cpumask_t (in bits) - 1)
  */
-void
+static void
 set_numa_max_cpu(void)
 {
 	int len = 2048;
@@ -546,8 +542,8 @@ set_numa_max_cpu(void)
 /*
  * get the total (configured) number of cpus - both online and offline
  */
-void
-set_configured_cpus()
+static void
+set_configured_cpus(void)
 {
 	int		filecount=0;
 	char		*dirnamep = "/sys/devices/system/cpu";
@@ -575,8 +571,8 @@ set_configured_cpus()
 /*
  * Initialize all the sizes.
  */
-void
-set_sizes()
+static void
+set_sizes(void)
 {
 	sizes_set++;
 	set_configured_nodes();	/* configured nodes listed in /sys */
@@ -587,7 +583,7 @@ set_sizes()
 }
 
 int
-numa_num_configured_nodes()
+numa_num_configured_nodes(void)
 {
 	return maxconfigurednode+1;
 }
@@ -600,25 +596,25 @@ numa_num_configured_cpus(void)
 }
 
 int
-numa_num_possible_nodes()
+numa_num_possible_nodes(void)
 {
 	return nodemask_sz;
 }
 
 int
-numa_num_possible_cpus()
+numa_num_possible_cpus(void)
 {
 	return cpumask_sz;
 }
 
 int
-numa_num_thread_nodes()
+numa_num_thread_nodes(void)
 {
 	return maxprocnode+1;
 }
 
 int
-numa_num_thread_cpus()
+numa_num_thread_cpus(void)
 {
 	return maxproccpu+1;
 }
@@ -672,7 +668,7 @@ numa_allocate_cpumask()
  * Allocate a bitmask the size of a libnuma nodemask_t
  */
 static struct bitmask *
-allocate_nodemask_v1()
+allocate_nodemask_v1(void)
 {
 	int nnodes = numa_max_possible_node_v1_int()+1;
 
@@ -684,7 +680,7 @@ allocate_nodemask_v1()
  * match the kernel's nodemask_t.
  */
 struct bitmask *
-numa_allocate_nodemask()
+numa_allocate_nodemask(void)
 {
 	struct bitmask *bmp;
 	int nnodes = numa_max_possible_node_v2_int() + 1;
@@ -1176,7 +1172,7 @@ numa_parse_bitmap_v2(char *line, struct 
 __asm__(".symver numa_parse_bitmap_v2,numa_parse_bitmap@@libnuma_1.2");
 
 void
-init_node_cpu_mask_v2()
+init_node_cpu_mask_v2(void)
 {
 	int nnodes = numa_max_possible_node_v2_int() + 1;
 	node_cpu_mask_v2 = calloc (nnodes, sizeof(struct bitmask *));
Index: numactl-2.0.0/numa.h
===================================================================
--- numactl-2.0.0.orig/numa.h
+++ numactl-2.0.0/numa.h
@@ -60,6 +60,7 @@ void numa_bitmask_free(struct bitmask *)
 int numa_bitmask_equal(const struct bitmask *, const struct bitmask *);
 void copy_nodemask_to_bitmask(nodemask_t *, struct bitmask *);
 void copy_bitmask_to_nodemask(struct bitmask *, nodemask_t *);
+void copy_bitmask_to_bitmask(struct bitmask *, struct bitmask *);
 
 /* compatibility for codes that used them: */
 static inline void nodemask_zero(struct bitmask *mask)
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux