ia64/xen-unstable

changeset 18056:750eee596adf

tools: Declare functions static where they should be, and provide
proper prototypes for others as required.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 15 13:19:26 2008 +0100 (2008-07-15)
parents 63317b6c3eab
children 1c22d42043bb
files tools/console/daemon/io.c tools/firmware/hvmloader/hvmloader.c tools/firmware/hvmloader/mp_tables.c tools/firmware/hvmloader/smp.c tools/firmware/hvmloader/util.h tools/firmware/rombios/32bit/tcgbios/tcgbios.c tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c tools/firmware/rombios/32bit/util.c tools/xenmon/xenbaked.c tools/xenstore/talloc.c tools/xenstore/tdb.c tools/xenstore/xenstore_client.c tools/xenstore/xenstored_core.c tools/xentrace/xenctx.c tools/xentrace/xentrace.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Mon Jul 14 15:21:03 2008 +0100
     1.2 +++ b/tools/console/daemon/io.c	Tue Jul 15 13:19:26 2008 +0100
     1.3 @@ -471,7 +471,7 @@ out:
     1.4  }
     1.5   
     1.6  /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
     1.7 -int xs_gather(struct xs_handle *xs, const char *dir, ...)
     1.8 +static int xs_gather(struct xs_handle *xs, const char *dir, ...)
     1.9  {
    1.10  	va_list ap;
    1.11  	const char *name;
     2.1 --- a/tools/firmware/hvmloader/hvmloader.c	Mon Jul 14 15:21:03 2008 +0100
     2.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Tue Jul 15 13:19:26 2008 +0100
     2.3 @@ -99,10 +99,6 @@ asm (
     2.4      "    .text                       \n"
     2.5      );
     2.6  
     2.7 -void smp_initialise(void);
     2.8 -void create_mp_tables(void);
     2.9 -int hvm_write_smbios_tables(void);
    2.10 -
    2.11  static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
    2.12  
    2.13  static void
     3.1 --- a/tools/firmware/hvmloader/mp_tables.c	Mon Jul 14 15:21:03 2008 +0100
     3.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Tue Jul 15 13:19:26 2008 +0100
     3.3 @@ -69,8 +69,6 @@
     3.4  
     3.5  #include "util.h"
     3.6  
     3.7 -extern int get_vcpu_nr(void);  /* for the guest's VCPU count */
     3.8 -
     3.9  /*
    3.10   * The following structures are defined in the MuliProcessor Specifiation v1.4
    3.11   */
    3.12 @@ -152,7 +150,7 @@ struct mp_local_intr_entry {
    3.13  };
    3.14  
    3.15  
    3.16 -void fill_mp_config_table(struct mp_config_table *mpct, int length)
    3.17 +static void fill_mp_config_table(struct mp_config_table *mpct, int length)
    3.18  {
    3.19      int vcpu_nr, i;
    3.20      uint8_t checksum;
    3.21 @@ -199,7 +197,7 @@ void fill_mp_config_table(struct mp_conf
    3.22  }
    3.23  
    3.24  /* fills in an MP processor entry for VCPU 'vcpu_id' */
    3.25 -void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
    3.26 +static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
    3.27  {
    3.28      mppe->type = ENTRY_TYPE_PROCESSOR;
    3.29      mppe->lapic_id = LAPIC_ID(vcpu_id);
    3.30 @@ -213,7 +211,7 @@ void fill_mp_proc_entry(struct mp_proc_e
    3.31  
    3.32  
    3.33  /* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
    3.34 -void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
    3.35 +static void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
    3.36  {
    3.37      int i;
    3.38  
    3.39 @@ -225,7 +223,7 @@ void fill_mp_bus_entry(struct mp_bus_ent
    3.40  
    3.41  
    3.42  /* fills in an MP IOAPIC entry for IOAPIC 'ioapic_id' */
    3.43 -void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
    3.44 +static void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
    3.45  {
    3.46      mpie->type = ENTRY_TYPE_IOAPIC;
    3.47      mpie->ioapic_id = IOAPIC_ID;
    3.48 @@ -236,7 +234,7 @@ void fill_mp_ioapic_entry(struct mp_ioap
    3.49  
    3.50  
    3.51  /* fills in an IO interrupt entry for IOAPIC 'ioapic_id' */
    3.52 -void fill_mp_io_intr_entry(
    3.53 +static void fill_mp_io_intr_entry(
    3.54      struct mp_io_intr_entry *mpiie,
    3.55      int src_bus_id, int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
    3.56  {
    3.57 @@ -251,7 +249,7 @@ void fill_mp_io_intr_entry(
    3.58  
    3.59  
    3.60  /* fill in the mp floating processor structure */
    3.61 -void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
    3.62 +static void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
    3.63  {
    3.64      int i;
    3.65      uint8_t checksum;
    3.66 @@ -283,7 +281,7 @@ void fill_mpfps(struct mp_floating_point
    3.67   * The '___HVMMP' signature is created by the ROMBIOS and designates a chunk
    3.68   * of space inside the ROMBIOS that is safe for us to write our MP table info
    3.69   */
    3.70 -void* get_mp_table_start(void)
    3.71 +static void *get_mp_table_start(void)
    3.72  {
    3.73      char *bios_mem;
    3.74  
    3.75 @@ -300,7 +298,7 @@ void* get_mp_table_start(void)
    3.76  
    3.77  
    3.78  /* recalculate the new ROMBIOS checksum after adding MP tables */
    3.79 -void reset_bios_checksum(void)
    3.80 +static void reset_bios_checksum(void)
    3.81  {
    3.82      uint32_t i;
    3.83      uint8_t checksum;
    3.84 @@ -312,7 +310,6 @@ void reset_bios_checksum(void)
    3.85      *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
    3.86  }
    3.87  
    3.88 -
    3.89  /* create_mp_tables - creates MP tables for the guest based upon config data */
    3.90  void create_mp_tables(void)
    3.91  {
     4.1 --- a/tools/firmware/hvmloader/smp.c	Mon Jul 14 15:21:03 2008 +0100
     4.2 +++ b/tools/firmware/hvmloader/smp.c	Tue Jul 15 13:19:26 2008 +0100
     4.3 @@ -69,8 +69,7 @@ asm (
     4.4      "    .text                       \n"
     4.5      );
     4.6  
     4.7 -extern void cacheattr_init(void);
     4.8 -
     4.9 +void ap_start(void); /* non-static avoids unused-function compiler warning */
    4.10  /*static*/ void ap_start(void)
    4.11  {
    4.12      printf(" - CPU%d ... ", ap_cpuid);
     5.1 --- a/tools/firmware/hvmloader/util.h	Mon Jul 14 15:21:03 2008 +0100
     5.2 +++ b/tools/firmware/hvmloader/util.h	Tue Jul 15 13:19:26 2008 +0100
     5.3 @@ -137,6 +137,12 @@ uint32_t e820_malloc(uint32_t size);
     5.4  /* Prepare the 32bit BIOS */
     5.5  void highbios_setup(void);
     5.6  
     5.7 +/* Miscellaneous. */
     5.8 +void cacheattr_init(void);
     5.9 +void create_mp_tables(void);
    5.10 +int hvm_write_smbios_tables(void);
    5.11 +void smp_initialise(void);
    5.12 +
    5.13  #define isdigit(c) ((c) >= '0' && (c) <= '9')
    5.14  
    5.15  #endif /* __HVMLOADER_UTIL_H__ */
     6.1 --- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c	Mon Jul 14 15:21:03 2008 +0100
     6.2 +++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c	Tue Jul 15 13:19:26 2008 +0100
     6.3 @@ -581,7 +581,7 @@ static char wake_event_1[]    = "Wake Ev
     6.4   * data       : additional parameter; used as parameter for 10.4.3
     6.5   *              'action index'
     6.6   */
     6.7 -void tcpa_add_measurement(uint32_t pcrIndex,
     6.8 +static void tcpa_add_measurement(uint32_t pcrIndex,
     6.9                            uint16_t event_type,
    6.10                            uint32_t data)
    6.11  {
    6.12 @@ -863,7 +863,7 @@ uint32_t tcpa_initialize_tpm(uint32_t ph
    6.13  }
    6.14  
    6.15  
    6.16 -uint16_t TCG_IsShutdownPreBootInterface(void)
    6.17 +static uint16_t TCG_IsShutdownPreBootInterface(void)
    6.18  {
    6.19  	return tcpa_acpi.flags & STATUS_FLAG_SHUTDOWN;
    6.20  }
     7.1 --- a/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c	Mon Jul 14 15:21:03 2008 +0100
     7.2 +++ b/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c	Tue Jul 15 13:19:26 2008 +0100
     7.3 @@ -75,7 +75,7 @@ static uint32_t tis_activate(uint32_t ba
     7.4  	return rc;
     7.5  }
     7.6  
     7.7 -uint32_t tis_ready(uint32_t baseaddr)
     7.8 +static uint32_t tis_ready(uint32_t baseaddr)
     7.9  {
    7.10  	uint32_t rc = 0;
    7.11  	uint8_t *tis_addr = (uint8_t*)baseaddr;
    7.12 @@ -86,7 +86,7 @@ uint32_t tis_ready(uint32_t baseaddr)
    7.13  	return rc;
    7.14  }
    7.15  
    7.16 -uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
    7.17 +static uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
    7.18  {
    7.19  	uint32_t rc = 0;
    7.20  	uint8_t *tis_addr = (uint8_t*)baseaddr;
    7.21 @@ -127,7 +127,7 @@ uint32_t tis_senddata(uint32_t baseaddr,
    7.22  	return rc;
    7.23  }
    7.24  
    7.25 -uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
    7.26 +static uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
    7.27  {
    7.28  	uint32_t rc = 0;
    7.29  	uint32_t offset = 0;
    7.30 @@ -147,7 +147,7 @@ uint32_t tis_readresp(uint32_t baseaddr,
    7.31  }
    7.32  
    7.33  
    7.34 -uint32_t tis_waitdatavalid(uint32_t baseaddr)
    7.35 +static uint32_t tis_waitdatavalid(uint32_t baseaddr)
    7.36  {
    7.37  	uint8_t *tis_addr = (uint8_t*)baseaddr;
    7.38  	uint32_t rc = 0;
    7.39 @@ -157,7 +157,7 @@ uint32_t tis_waitdatavalid(uint32_t base
    7.40  	return rc;
    7.41  }
    7.42  
    7.43 -uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
    7.44 +static uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
    7.45  {
    7.46  	uint32_t rc = 0;
    7.47  	uint8_t *tis_addr = (uint8_t*)baseaddr;
    7.48 @@ -170,7 +170,7 @@ uint32_t tis_waitrespready(uint32_t base
    7.49  }
    7.50  
    7.51  /* if device is not there, return '0', '1' otherwise */
    7.52 -uint32_t tis_probe(uint32_t baseaddr)
    7.53 +static uint32_t tis_probe(uint32_t baseaddr)
    7.54  {
    7.55  	uint32_t rc = 0;
    7.56  	uint8_t *tis_addr = (uint8_t*)baseaddr;
     8.1 --- a/tools/firmware/rombios/32bit/util.c	Mon Jul 14 15:21:03 2008 +0100
     8.2 +++ b/tools/firmware/rombios/32bit/util.c	Tue Jul 15 13:19:26 2008 +0100
     8.3 @@ -388,12 +388,6 @@ int printf(const char *fmt, ...)
     8.4      return 0;
     8.5  }
     8.6  
     8.7 -int vprintf(const char *fmt, va_list ap)
     8.8 -{
     8.9 -    _doprint(putchar, fmt, ap);
    8.10 -    return 0;
    8.11 -}
    8.12 -
    8.13  void mssleep(uint32_t waittime)
    8.14  {
    8.15      uint32_t i;
     9.1 --- a/tools/xenmon/xenbaked.c	Mon Jul 14 15:21:03 2008 +0100
     9.2 +++ b/tools/xenmon/xenbaked.c	Tue Jul 15 13:19:26 2008 +0100
     9.3 @@ -104,14 +104,20 @@ int *running = NULL;
     9.4  int NCPU = 0;
     9.5  
     9.6  
     9.7 -void init_current(int ncpu)
     9.8 +static void advance_next_datapoint(uint64_t);
     9.9 +static void alloc_qos_data(int ncpu);
    9.10 +static int process_record(int, struct t_rec *);
    9.11 +static void qos_kill_thread(int domid);
    9.12 +
    9.13 +
    9.14 +static void init_current(int ncpu)
    9.15  {
    9.16      running = calloc(ncpu, sizeof(int));
    9.17      NCPU = ncpu;
    9.18      printf("Initialized with %d %s\n", ncpu, (ncpu == 1) ? "cpu" : "cpu's");
    9.19  }
    9.20  
    9.21 -int is_current(int domain, int cpu)
    9.22 +static int is_current(int domain, int cpu)
    9.23  {
    9.24      //  int i;
    9.25    
    9.26 @@ -122,20 +128,22 @@ int is_current(int domain, int cpu)
    9.27  }
    9.28  
    9.29  
    9.30 +#if 0 /* unused */
    9.31  // return the domain that's currently running on the given cpu
    9.32 -int current(int cpu)
    9.33 +static int current(int cpu)
    9.34  {
    9.35      return running[cpu];
    9.36  }
    9.37 +#endif
    9.38  
    9.39 -void set_current(int cpu, int domain)
    9.40 +static void set_current(int cpu, int domain)
    9.41  {
    9.42      running[cpu] = domain;
    9.43  }
    9.44  
    9.45  
    9.46  
    9.47 -void close_handler(int signal)
    9.48 +static void close_handler(int signal)
    9.49  {
    9.50      interrupted = 1;
    9.51  }
    9.52 @@ -152,7 +160,7 @@ void dump_record(int cpu, struct t_rec *
    9.53   * millis_to_timespec - convert a time in milliseconds to a struct timespec
    9.54   * @millis:             time interval in milliseconds
    9.55   */
    9.56 -struct timespec millis_to_timespec(unsigned long millis)
    9.57 +static struct timespec millis_to_timespec(unsigned long millis)
    9.58  {
    9.59      struct timespec spec;
    9.60  
    9.61 @@ -188,7 +196,7 @@ stat_map_t stat_map[] = {
    9.62  };
    9.63  
    9.64  
    9.65 -void check_gotten_sum(void)
    9.66 +static void check_gotten_sum(void)
    9.67  {
    9.68  #if 0
    9.69      uint64_t sum, ns;
    9.70 @@ -212,7 +220,7 @@ void check_gotten_sum(void)
    9.71  
    9.72  
    9.73  
    9.74 -void dump_stats(void) 
    9.75 +static void dump_stats(void) 
    9.76  {
    9.77      stat_map_t *smt = stat_map;
    9.78      time_t end_time, run_time;
    9.79 @@ -236,7 +244,7 @@ void dump_stats(void)
    9.80      check_gotten_sum();
    9.81  }
    9.82  
    9.83 -void log_event(int event_id) 
    9.84 +static void log_event(int event_id) 
    9.85  {
    9.86      stat_map_t *smt = stat_map;
    9.87  
    9.88 @@ -258,7 +266,7 @@ int xce_handle = -1;
    9.89  
    9.90  /* Returns the event channel handle. */
    9.91  /* Stolen from xenstore code */
    9.92 -int eventchn_init(void)
    9.93 +static int eventchn_init(void)
    9.94  {
    9.95      int rc;
    9.96    
    9.97 @@ -278,7 +286,7 @@ int eventchn_init(void)
    9.98      return xce_handle;
    9.99  }
   9.100  
   9.101 -void wait_for_event(void)
   9.102 +static void wait_for_event(void)
   9.103  {
   9.104      int ret;
   9.105      fd_set inset;
   9.106 @@ -333,7 +341,7 @@ static void get_tbufs(unsigned long *mfn
   9.107      xc_interface_close(xc_handle);
   9.108  }
   9.109  
   9.110 -void disable_tracing(void)
   9.111 +static void disable_tracing(void)
   9.112  {
   9.113      int xc_handle = xc_interface_open();
   9.114      xc_tbuf_disable(xc_handle);  
   9.115 @@ -348,7 +356,7 @@ void disable_tracing(void)
   9.116   *
   9.117   * Maps the Xen trace buffers them into process address space.
   9.118   */
   9.119 -struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
   9.120 +static struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
   9.121                          unsigned long size)
   9.122  {
   9.123      int xc_handle;
   9.124 @@ -385,7 +393,7 @@ struct t_buf *map_tbufs(unsigned long tb
   9.125   * Initialises an array of pointers to individual trace buffers within the
   9.126   * mapped region containing all trace buffers.
   9.127   */
   9.128 -struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
   9.129 +static struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
   9.130                                unsigned long size)
   9.131  {
   9.132      int i;
   9.133 @@ -418,7 +426,7 @@ struct t_buf **init_bufs_ptrs(void *bufs
   9.134   * mapped in user space.  Note that the trace buffer metadata contains machine
   9.135   * pointers - the array returned allows more convenient access to them.
   9.136   */
   9.137 -struct t_rec **init_rec_ptrs(struct t_buf **meta, unsigned int num)
   9.138 +static struct t_rec **init_rec_ptrs(struct t_buf **meta, unsigned int num)
   9.139  {
   9.140      int i;
   9.141      struct t_rec **data;
   9.142 @@ -441,7 +449,7 @@ struct t_rec **init_rec_ptrs(struct t_bu
   9.143  /**
   9.144   * get_num_cpus - get the number of logical CPUs
   9.145   */
   9.146 -unsigned int get_num_cpus(void)
   9.147 +static unsigned int get_num_cpus(void)
   9.148  {
   9.149      xc_physinfo_t physinfo = { 0 };
   9.150      int xc_handle = xc_interface_open();
   9.151 @@ -465,11 +473,9 @@ unsigned int get_num_cpus(void)
   9.152  /**
   9.153   * monitor_tbufs - monitor the contents of tbufs
   9.154   */
   9.155 -int monitor_tbufs(void)
   9.156 +static int monitor_tbufs(void)
   9.157  {
   9.158      int i;
   9.159 -    extern int process_record(int, struct t_rec *);
   9.160 -    extern void alloc_qos_data(int ncpu);
   9.161  
   9.162      void *tbufs_mapped;          /* pointer to where the tbufs are mapped    */
   9.163      struct t_buf **meta;         /* pointers to the trace buffer metadata    */
   9.164 @@ -564,7 +570,7 @@ const char *program_bug_address = "<rob.
   9.165  #define xstr(x) str(x)
   9.166  #define str(x) #x
   9.167  
   9.168 -void usage(void)
   9.169 +static void usage(void)
   9.170  {
   9.171  #define USAGE_STR \
   9.172  "Usage: xenbaked [OPTION...]\n" \
   9.173 @@ -591,7 +597,7 @@ void usage(void)
   9.174  }
   9.175  
   9.176  /* convert the argument string pointed to by arg to a long int representation */
   9.177 -long argtol(const char *restrict arg, int base)
   9.178 +static long argtol(const char *restrict arg, int base)
   9.179  {
   9.180      char *endp; 
   9.181      long val;
   9.182 @@ -612,7 +618,7 @@ long argtol(const char *restrict arg, in
   9.183  }
   9.184  
   9.185  /* parse command line arguments */
   9.186 -void parse_args(int argc, char **argv)
   9.187 +static void parse_args(int argc, char **argv)
   9.188  {
   9.189      int option;
   9.190      static struct option long_options[] = {
   9.191 @@ -658,12 +664,11 @@ void parse_args(int argc, char **argv)
   9.192  }
   9.193  
   9.194  #define SHARED_MEM_FILE "/var/run/xenq-shm"
   9.195 -void alloc_qos_data(int ncpu)
   9.196 +static void alloc_qos_data(int ncpu)
   9.197  {
   9.198      int i, n, pgsize, off=0;
   9.199      char *dummy;
   9.200      int qos_fd;
   9.201 -    void advance_next_datapoint(uint64_t);
   9.202  
   9.203      cpu_qos_data = (_new_qos_data **) calloc(ncpu, sizeof(_new_qos_data *));
   9.204  
   9.205 @@ -737,7 +742,7 @@ int main(int argc, char **argv)
   9.206      return ret;
   9.207  }
   9.208  
   9.209 -void qos_init_domain(int domid, int idx)
   9.210 +static void qos_init_domain(int domid, int idx)
   9.211  {
   9.212      int i;
   9.213  
   9.214 @@ -767,7 +772,7 @@ void qos_init_domain(int domid, int idx)
   9.215      }
   9.216  }
   9.217  
   9.218 -void global_init_domain(int domid, int idx) 
   9.219 +static void global_init_domain(int domid, int idx) 
   9.220  {
   9.221      int cpu;
   9.222      _new_qos_data *saved_qos;
   9.223 @@ -781,14 +786,12 @@ void global_init_domain(int domid, int i
   9.224      new_qos = saved_qos;
   9.225  }
   9.226  
   9.227 -
   9.228  // give index of this domain in the qos data array
   9.229 -int indexof(int domid)
   9.230 +static int indexof(int domid)
   9.231  {
   9.232      int idx;
   9.233      xc_dominfo_t dominfo[NDOMAINS];
   9.234      int xc_handle, ndomains;
   9.235 -    extern void qos_kill_thread(int domid);
   9.236    
   9.237      if (domid < 0) {	// shouldn't happen
   9.238          printf("bad domain id: %d\r\n", domid);
   9.239 @@ -840,13 +843,13 @@ int indexof(int domid)
   9.240      exit(2);
   9.241  }
   9.242  
   9.243 -int domain_runnable(int domid)
   9.244 +static int domain_runnable(int domid)
   9.245  {
   9.246      return new_qos->domain_info[indexof(domid)].runnable;
   9.247  }
   9.248  
   9.249  
   9.250 -void update_blocked_time(int domid, uint64_t now)
   9.251 +static void update_blocked_time(int domid, uint64_t now)
   9.252  {
   9.253      uint64_t t_blocked;
   9.254      int id = indexof(domid);
   9.255 @@ -867,7 +870,7 @@ void update_blocked_time(int domid, uint
   9.256  
   9.257  
   9.258  // advance to next datapoint for all domains
   9.259 -void advance_next_datapoint(uint64_t now)
   9.260 +static void advance_next_datapoint(uint64_t now)
   9.261  {
   9.262      int new, old, didx;
   9.263  
   9.264 @@ -892,7 +895,7 @@ void advance_next_datapoint(uint64_t now
   9.265  
   9.266  
   9.267  
   9.268 -void qos_update_thread(int cpu, int domid, uint64_t now)
   9.269 +static void qos_update_thread(int cpu, int domid, uint64_t now)
   9.270  {
   9.271      int n, id;
   9.272      uint64_t last_update_time, start;
   9.273 @@ -970,7 +973,7 @@ void qos_update_thread(int cpu, int domi
   9.274  
   9.275  
   9.276  // called by dump routines to update all structures
   9.277 -void qos_update_all(uint64_t now, int cpu)
   9.278 +static void qos_update_all(uint64_t now, int cpu)
   9.279  {
   9.280      int i;
   9.281  
   9.282 @@ -980,7 +983,7 @@ void qos_update_all(uint64_t now, int cp
   9.283  }
   9.284  
   9.285  
   9.286 -void qos_update_thread_stats(int cpu, int domid, uint64_t now)
   9.287 +static void qos_update_thread_stats(int cpu, int domid, uint64_t now)
   9.288  {
   9.289      if (new_qos->qdata[new_qos->next_datapoint].ns_passed > (million*opts.ms_per_sample)) {
   9.290          qos_update_all(now, cpu);
   9.291 @@ -993,7 +996,7 @@ void qos_update_thread_stats(int cpu, in
   9.292  
   9.293  
   9.294  // called when a new thread gets the cpu
   9.295 -void qos_switch_in(int cpu, int domid, uint64_t now, unsigned long ns_alloc, unsigned long ns_waited)
   9.296 +static void qos_switch_in(int cpu, int domid, uint64_t now, unsigned long ns_alloc, unsigned long ns_waited)
   9.297  {
   9.298      int idx = indexof(domid);
   9.299  
   9.300 @@ -1016,7 +1019,7 @@ void qos_switch_in(int cpu, int domid, u
   9.301  }
   9.302  
   9.303  // called when the current thread is taken off the cpu
   9.304 -void qos_switch_out(int cpu, int domid, uint64_t now, unsigned long gotten)
   9.305 +static void qos_switch_out(int cpu, int domid, uint64_t now, unsigned long gotten)
   9.306  {
   9.307      int idx = indexof(domid);
   9.308      int n;
   9.309 @@ -1054,7 +1057,7 @@ void qos_switch_out(int cpu, int domid, 
   9.310  
   9.311  // called when domain is put to sleep, may also be called
   9.312  // when thread is already asleep
   9.313 -void qos_state_sleeping(int cpu, int domid, uint64_t now) 
   9.314 +static void qos_state_sleeping(int cpu, int domid, uint64_t now) 
   9.315  {
   9.316      int idx;
   9.317  
   9.318 @@ -1072,7 +1075,7 @@ void qos_state_sleeping(int cpu, int dom
   9.319  
   9.320  
   9.321  // domain died, presume it's dead on all cpu's, not just mostly dead
   9.322 -void qos_kill_thread(int domid)
   9.323 +static void qos_kill_thread(int domid)
   9.324  {
   9.325      int cpu;
   9.326    
   9.327 @@ -1085,7 +1088,7 @@ void qos_kill_thread(int domid)
   9.328  
   9.329  // called when thread becomes runnable, may also be called
   9.330  // when thread is already runnable
   9.331 -void qos_state_runnable(int cpu, int domid, uint64_t now)
   9.332 +static void qos_state_runnable(int cpu, int domid, uint64_t now)
   9.333  {
   9.334      int idx;
   9.335    
   9.336 @@ -1105,7 +1108,7 @@ void qos_state_runnable(int cpu, int dom
   9.337  }
   9.338  
   9.339  
   9.340 -void qos_count_packets(domid_t domid, uint64_t now)
   9.341 +static void qos_count_packets(domid_t domid, uint64_t now)
   9.342  {
   9.343      int i, idx = indexof(domid);
   9.344      _new_qos_data *cpu_data;
   9.345 @@ -1122,7 +1125,7 @@ void qos_count_packets(domid_t domid, ui
   9.346  }
   9.347  
   9.348  
   9.349 -int process_record(int cpu, struct t_rec *r)
   9.350 +static int process_record(int cpu, struct t_rec *r)
   9.351  {
   9.352      uint64_t now = 0;
   9.353      uint32_t *extra_u32 = r->u.nocycles.extra_u32;
    10.1 --- a/tools/xenstore/talloc.c	Mon Jul 14 15:21:03 2008 +0100
    10.2 +++ b/tools/xenstore/talloc.c	Tue Jul 15 13:19:26 2008 +0100
    10.3 @@ -500,7 +500,7 @@ void *talloc_init(const char *fmt, ...)
    10.4    should probably not be used in new code. It's in here to keep the talloc
    10.5    code consistent across Samba 3 and 4.
    10.6  */
    10.7 -void talloc_free_children(void *ptr)
    10.8 +static void talloc_free_children(void *ptr)
    10.9  {
   10.10  	struct talloc_chunk *tc;
   10.11  
    11.1 --- a/tools/xenstore/tdb.c	Mon Jul 14 15:21:03 2008 +0100
    11.2 +++ b/tools/xenstore/tdb.c	Tue Jul 15 13:19:26 2008 +0100
    11.3 @@ -28,7 +28,7 @@
    11.4  
    11.5  
    11.6  #ifndef _SAMBA_BUILD_
    11.7 -#if HAVE_CONFIG_H
    11.8 +#ifdef HAVE_CONFIG_H
    11.9  #include <config.h>
   11.10  #endif
   11.11  
   11.12 @@ -731,7 +731,7 @@ update:
   11.13  static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition)
   11.14  {
   11.15  	char buf[1024];
   11.16 -#if HAVE_FTRUNCATE_EXTEND
   11.17 +#ifdef HAVE_FTRUNCATE_EXTEND
   11.18  	if (ftruncate(tdb->fd, size+addition) != 0) {
   11.19  		TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", 
   11.20  			   size+addition, strerror(errno)));
    12.1 --- a/tools/xenstore/xenstore_client.c	Mon Jul 14 15:21:03 2008 +0100
    12.2 +++ b/tools/xenstore/xenstore_client.c	Tue Jul 15 13:19:26 2008 +0100
    12.3 @@ -121,7 +121,7 @@ static int show_whole_path = 0;
    12.4  
    12.5  #define MIN(a, b) (((a) < (b))? (a) : (b))
    12.6  
    12.7 -void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms)
    12.8 +static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms)
    12.9  {
   12.10      static struct expanding_buffer ebuf;
   12.11      char **e;
    13.1 --- a/tools/xenstore/xenstored_core.c	Mon Jul 14 15:21:03 2008 +0100
    13.2 +++ b/tools/xenstore/xenstored_core.c	Tue Jul 15 13:19:26 2008 +0100
    13.3 @@ -349,23 +349,6 @@ static int destroy_fd(void *_fd)
    13.4  	return 0;
    13.5  }
    13.6  
    13.7 -/* Return a pointer to an fd, self-closing and attached to this pathname. */
    13.8 -int *talloc_open(const char *pathname, int flags, int mode)
    13.9 -{
   13.10 -	int *fd;
   13.11 -
   13.12 -	fd = talloc(pathname, int);
   13.13 -	*fd = open(pathname, flags, mode);
   13.14 -	if (*fd < 0) {
   13.15 -		int saved_errno = errno;
   13.16 -		talloc_free(fd);
   13.17 -		errno = saved_errno;
   13.18 -		return NULL;
   13.19 -	}
   13.20 -	talloc_set_destructor(fd, destroy_fd);
   13.21 -	return fd;
   13.22 -}
   13.23 -
   13.24  /* Is child a subnode of parent, or equal? */
   13.25  bool is_child(const char *child, const char *parent)
   13.26  {
    14.1 --- a/tools/xentrace/xenctx.c	Mon Jul 14 15:21:03 2008 +0100
    14.2 +++ b/tools/xentrace/xenctx.c	Tue Jul 15 13:19:26 2008 +0100
    14.3 @@ -71,7 +71,7 @@ struct symbol {
    14.4  
    14.5  size_t kernel_stext, kernel_etext, kernel_sinittext, kernel_einittext, kernel_hypercallpage;
    14.6  
    14.7 -int is_kernel_text(size_t addr)
    14.8 +static int is_kernel_text(size_t addr)
    14.9  {
   14.10  #if defined (__i386__)
   14.11      if (symbol_table == NULL)
   14.12 @@ -96,7 +96,8 @@ int is_kernel_text(size_t addr)
   14.13      return 0;
   14.14  }
   14.15  
   14.16 -void free_symbol(struct symbol *symbol)
   14.17 +#if 0
   14.18 +static void free_symbol(struct symbol *symbol)
   14.19  {
   14.20      if (symbol == NULL)
   14.21          return;
   14.22 @@ -104,8 +105,9 @@ void free_symbol(struct symbol *symbol)
   14.23          free(symbol->name);
   14.24      free(symbol);
   14.25  }
   14.26 +#endif
   14.27  
   14.28 -void insert_symbol(struct symbol *symbol)
   14.29 +static void insert_symbol(struct symbol *symbol)
   14.30  {
   14.31      static struct symbol *prev = NULL;
   14.32      struct symbol *s = symbol_table;
   14.33 @@ -132,7 +134,7 @@ void insert_symbol(struct symbol *symbol
   14.34      prev = symbol;
   14.35  }
   14.36  
   14.37 -struct symbol *lookup_symbol(size_t address)
   14.38 +static struct symbol *lookup_symbol(size_t address)
   14.39  {
   14.40      struct symbol *s = symbol_table;
   14.41  
   14.42 @@ -145,7 +147,7 @@ struct symbol *lookup_symbol(size_t addr
   14.43      return NULL;
   14.44  }
   14.45  
   14.46 -void print_symbol(size_t addr)
   14.47 +static void print_symbol(size_t addr)
   14.48  {
   14.49      struct symbol *s;
   14.50  
   14.51 @@ -163,7 +165,7 @@ void print_symbol(size_t addr)
   14.52          printf("%s+%#x ", s->name, (unsigned int)(addr - s->address));
   14.53  }
   14.54  
   14.55 -void read_symbol_table(const char *symtab)
   14.56 +static void read_symbol_table(const char *symtab)
   14.57  {
   14.58      char line[256];
   14.59      char *p;
   14.60 @@ -240,7 +242,7 @@ char *flag_values[22][2] =
   14.61      { NULL,     "cid"  }  // 21       Cpuid Identification Flag
   14.62  };
   14.63  
   14.64 -void print_flags(uint64_t flags)
   14.65 +static void print_flags(uint64_t flags)
   14.66  {
   14.67      int i;
   14.68  
   14.69 @@ -253,7 +255,7 @@ void print_flags(uint64_t flags)
   14.70      printf("\n");
   14.71  }
   14.72  
   14.73 -void print_special(unsigned long *regs, const char *name, unsigned int mask)
   14.74 +static void print_special(unsigned long *regs, const char *name, unsigned int mask)
   14.75  {
   14.76      unsigned int i;
   14.77  
   14.78 @@ -265,7 +267,7 @@ void print_special(unsigned long *regs, 
   14.79  #endif
   14.80  
   14.81  #ifdef __i386__
   14.82 -void print_ctx(vcpu_guest_context_t *ctx1)
   14.83 +static void print_ctx(vcpu_guest_context_t *ctx1)
   14.84  {
   14.85      struct cpu_user_regs *regs = &ctx1->user_regs;
   14.86  
   14.87 @@ -294,7 +296,7 @@ void print_ctx(vcpu_guest_context_t *ctx
   14.88      }
   14.89  }
   14.90  #elif defined(__x86_64__)
   14.91 -void print_ctx(vcpu_guest_context_t *ctx1)
   14.92 +static void print_ctx(vcpu_guest_context_t *ctx1)
   14.93  {
   14.94      struct cpu_user_regs *regs = &ctx1->user_regs;
   14.95  
   14.96 @@ -582,7 +584,7 @@ void print_ctx(vcpu_guest_context_t *ctx
   14.97  #endif
   14.98  
   14.99  #ifndef NO_TRANSLATION
  14.100 -void *map_page(vcpu_guest_context_t *ctx, int vcpu, size_t virt)
  14.101 +static void *map_page(vcpu_guest_context_t *ctx, int vcpu, size_t virt)
  14.102  {
  14.103      static unsigned long previous_mfn = 0;
  14.104      static void *mapped = NULL;
  14.105 @@ -609,7 +611,7 @@ void *map_page(vcpu_guest_context_t *ctx
  14.106      return (void *)(mapped + offset);
  14.107  }
  14.108  
  14.109 -void print_stack(vcpu_guest_context_t *ctx, int vcpu)
  14.110 +static void print_stack(vcpu_guest_context_t *ctx, int vcpu)
  14.111  {
  14.112      struct cpu_user_regs *regs = &ctx->user_regs;
  14.113      size_t stack = STACK_POINTER(regs);
  14.114 @@ -699,7 +701,7 @@ void print_stack(vcpu_guest_context_t *c
  14.115  }
  14.116  #endif
  14.117  
  14.118 -void dump_ctx(int vcpu)
  14.119 +static void dump_ctx(int vcpu)
  14.120  {
  14.121      int ret;
  14.122      vcpu_guest_context_any_t ctx;
  14.123 @@ -748,7 +750,7 @@ void dump_ctx(int vcpu)
  14.124      }
  14.125  }
  14.126  
  14.127 -void usage(void)
  14.128 +static void usage(void)
  14.129  {
  14.130      printf("usage:\n\n");
  14.131  
    15.1 --- a/tools/xentrace/xentrace.c	Mon Jul 14 15:21:03 2008 +0100
    15.2 +++ b/tools/xentrace/xentrace.c	Tue Jul 15 13:19:26 2008 +0100
    15.3 @@ -68,7 +68,7 @@ static int xc_handle = -1;
    15.4  static int event_fd = -1;
    15.5  static int virq_port = -1;
    15.6  
    15.7 -void close_handler(int signal)
    15.8 +static void close_handler(int signal)
    15.9  {
   15.10      interrupted = 1;
   15.11  }
   15.12 @@ -84,7 +84,7 @@ void close_handler(int signal)
   15.13   * Outputs the trace buffer to a filestream, prepending the CPU and size
   15.14   * of the buffer write.
   15.15   */
   15.16 -void write_buffer(unsigned int cpu, unsigned char *start, int size,
   15.17 +static void write_buffer(unsigned int cpu, unsigned char *start, int size,
   15.18                 int total_size, int outfd)
   15.19  {
   15.20      struct statvfs stat;
   15.21 @@ -206,7 +206,7 @@ static void get_tbufs(unsigned long *mfn
   15.22   *
   15.23   * Maps the Xen trace buffers them into process address space.
   15.24   */
   15.25 -struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
   15.26 +static struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
   15.27                          unsigned long size)
   15.28  {
   15.29      struct t_buf *tbufs_mapped;
   15.30 @@ -230,7 +230,7 @@ struct t_buf *map_tbufs(unsigned long tb
   15.31   * @type:           the new mask type,0-event mask, 1-cpu mask
   15.32   *
   15.33   */
   15.34 -void set_mask(uint32_t mask, int type)
   15.35 +static void set_mask(uint32_t mask, int type)
   15.36  {
   15.37      int ret = 0;
   15.38  
   15.39 @@ -258,7 +258,7 @@ void set_mask(uint32_t mask, int type)
   15.40   * Initialises an array of pointers to individual trace buffers within the
   15.41   * mapped region containing all trace buffers.
   15.42   */
   15.43 -struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
   15.44 +static struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
   15.45                                unsigned long size)
   15.46  {
   15.47      int i;
   15.48 @@ -291,7 +291,7 @@ struct t_buf **init_bufs_ptrs(void *bufs
   15.49   * mapped in user space.  Note that the trace buffer metadata contains machine
   15.50   * pointers - the array returned allows more convenient access to them.
   15.51   */
   15.52 -unsigned char **init_rec_ptrs(struct t_buf **meta, unsigned int num)
   15.53 +static unsigned char **init_rec_ptrs(struct t_buf **meta, unsigned int num)
   15.54  {
   15.55      int i;
   15.56      unsigned char **data;
   15.57 @@ -312,7 +312,7 @@ unsigned char **init_rec_ptrs(struct t_b
   15.58  /**
   15.59   * get_num_cpus - get the number of logical CPUs
   15.60   */
   15.61 -unsigned int get_num_cpus(void)
   15.62 +static unsigned int get_num_cpus(void)
   15.63  {
   15.64      xc_physinfo_t physinfo = { 0 };
   15.65      int ret;
   15.66 @@ -331,7 +331,7 @@ unsigned int get_num_cpus(void)
   15.67  /**
   15.68   * event_init - setup to receive the VIRQ_TBUF event
   15.69   */
   15.70 -void event_init(void)
   15.71 +static void event_init(void)
   15.72  {
   15.73      int rc;
   15.74  
   15.75 @@ -354,7 +354,7 @@ void event_init(void)
   15.76   * wait_for_event_or_timeout - sleep for the specified number of milliseconds,
   15.77   *                             or until an VIRQ_TBUF event occurs
   15.78   */
   15.79 -void wait_for_event_or_timeout(unsigned long milliseconds)
   15.80 +static void wait_for_event_or_timeout(unsigned long milliseconds)
   15.81  {
   15.82      int rc;
   15.83      struct pollfd fd = { .fd = event_fd,
   15.84 @@ -394,7 +394,7 @@ void wait_for_event_or_timeout(unsigned 
   15.85   * monitor_tbufs - monitor the contents of tbufs and output to a file
   15.86   * @logfile:       the FILE * representing the file to log to
   15.87   */
   15.88 -int monitor_tbufs(int outfd)
   15.89 +static int monitor_tbufs(int outfd)
   15.90  {
   15.91      int i;
   15.92  
   15.93 @@ -512,7 +512,7 @@ int monitor_tbufs(int outfd)
   15.94  const char *program_version     = "xentrace v1.2";
   15.95  const char *program_bug_address = "<mark.a.williamson@intel.com>";
   15.96  
   15.97 -void usage(void)
   15.98 +static void usage(void)
   15.99  {
  15.100  #define USAGE_STR \
  15.101  "Usage: xentrace [OPTION...] [output file]\n" \
  15.102 @@ -554,7 +554,7 @@ void usage(void)
  15.103  }
  15.104  
  15.105  /* convert the argument string pointed to by arg to a long int representation */
  15.106 -long argtol(const char *restrict arg, int base)
  15.107 +static long argtol(const char *restrict arg, int base)
  15.108  {
  15.109      char *endp;
  15.110      long val;
  15.111 @@ -574,7 +574,7 @@ long argtol(const char *restrict arg, in
  15.112      return val;
  15.113  }
  15.114  
  15.115 -int parse_evtmask(char *arg)
  15.116 +static int parse_evtmask(char *arg)
  15.117  {
  15.118      /* search filtering class */
  15.119      if (strcmp(arg, "gen") == 0){ 
  15.120 @@ -595,7 +595,7 @@ int parse_evtmask(char *arg)
  15.121  }
  15.122  
  15.123  /* parse command line arguments */
  15.124 -void parse_args(int argc, char **argv)
  15.125 +static void parse_args(int argc, char **argv)
  15.126  {
  15.127      int option;
  15.128      static struct option long_options[] = {