tools: Declare functions static where they should be, and provide
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Jul 2008 12:19:26 +0000 (13:19 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Jul 2008 12:19:26 +0000 (13:19 +0100)
proper prototypes for others as required.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 files changed:
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

index 1a3f243a36d544e05b225616f9bb5c001429eee8..16a0b6c27eada1178b341f08e8d4226685f94e24 100644 (file)
@@ -471,7 +471,7 @@ out:
 }
  
 /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
-int xs_gather(struct xs_handle *xs, const char *dir, ...)
+static int xs_gather(struct xs_handle *xs, const char *dir, ...)
 {
        va_list ap;
        const char *name;
index 82e34b0e3ad0fb6114e3be70ee240c7bdbbea5f3..5f1f22e6dd0d8ef180fcb0b5960585a6c3fce3b7 100644 (file)
@@ -99,10 +99,6 @@ asm (
     "    .text                       \n"
     );
 
-void smp_initialise(void);
-void create_mp_tables(void);
-int hvm_write_smbios_tables(void);
-
 static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
 
 static void
index bbf9a38f515a2f68751dffe5b9e033f64d5a129d..2c42f6e4b469d4793d11c06188174396be87c272 100644 (file)
@@ -69,8 +69,6 @@
 
 #include "util.h"
 
-extern int get_vcpu_nr(void);  /* for the guest's VCPU count */
-
 /*
  * The following structures are defined in the MuliProcessor Specifiation v1.4
  */
@@ -152,7 +150,7 @@ struct mp_local_intr_entry {
 };
 
 
-void fill_mp_config_table(struct mp_config_table *mpct, int length)
+static void fill_mp_config_table(struct mp_config_table *mpct, int length)
 {
     int vcpu_nr, i;
     uint8_t checksum;
@@ -199,7 +197,7 @@ void fill_mp_config_table(struct mp_config_table *mpct, int length)
 }
 
 /* fills in an MP processor entry for VCPU 'vcpu_id' */
-void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
+static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
     mppe->lapic_id = LAPIC_ID(vcpu_id);
@@ -213,7 +211,7 @@ void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 
 
 /* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
-void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
+static void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
 {
     int i;
 
@@ -225,7 +223,7 @@ void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
 
 
 /* fills in an MP IOAPIC entry for IOAPIC 'ioapic_id' */
-void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
+static void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
 {
     mpie->type = ENTRY_TYPE_IOAPIC;
     mpie->ioapic_id = IOAPIC_ID;
@@ -236,7 +234,7 @@ void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie)
 
 
 /* fills in an IO interrupt entry for IOAPIC 'ioapic_id' */
-void fill_mp_io_intr_entry(
+static void fill_mp_io_intr_entry(
     struct mp_io_intr_entry *mpiie,
     int src_bus_id, int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
 {
@@ -251,7 +249,7 @@ void fill_mp_io_intr_entry(
 
 
 /* fill in the mp floating processor structure */
-void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
+static void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
 {
     int i;
     uint8_t checksum;
@@ -283,7 +281,7 @@ void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
  * The '___HVMMP' signature is created by the ROMBIOS and designates a chunk
  * of space inside the ROMBIOS that is safe for us to write our MP table info
  */
-void* get_mp_table_start(void)
+static void *get_mp_table_start(void)
 {
     char *bios_mem;
 
@@ -300,7 +298,7 @@ void* get_mp_table_start(void)
 
 
 /* recalculate the new ROMBIOS checksum after adding MP tables */
-void reset_bios_checksum(void)
+static void reset_bios_checksum(void)
 {
     uint32_t i;
     uint8_t checksum;
@@ -312,7 +310,6 @@ void reset_bios_checksum(void)
     *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
 }
 
-
 /* create_mp_tables - creates MP tables for the guest based upon config data */
 void create_mp_tables(void)
 {
index 4d88b5b7602fc4d5c1895ba61cd31ed724b9aa11..f64f73e3f0d6515711404c34fc2dfebba6c420fb 100644 (file)
@@ -69,8 +69,7 @@ asm (
     "    .text                       \n"
     );
 
-extern void cacheattr_init(void);
-
+void ap_start(void); /* non-static avoids unused-function compiler warning */
 /*static*/ void ap_start(void)
 {
     printf(" - CPU%d ... ", ap_cpuid);
index 1d310c64e49246ce75b04c1c3a9aa94b3d78a217..455b2f66e644f96ef8299f5545f6bfda2d669f3f 100644 (file)
@@ -137,6 +137,12 @@ uint32_t e820_malloc(uint32_t size);
 /* Prepare the 32bit BIOS */
 void highbios_setup(void);
 
+/* Miscellaneous. */
+void cacheattr_init(void);
+void create_mp_tables(void);
+int hvm_write_smbios_tables(void);
+void smp_initialise(void);
+
 #define isdigit(c) ((c) >= '0' && (c) <= '9')
 
 #endif /* __HVMLOADER_UTIL_H__ */
index e36ca378455c9401ca83619e9a872e658f8191f2..263607471bdf49a256375239efd05ce8b5529a01 100644 (file)
@@ -581,7 +581,7 @@ static char wake_event_1[]    = "Wake Event 1";
  * data       : additional parameter; used as parameter for 10.4.3
  *              'action index'
  */
-void tcpa_add_measurement(uint32_t pcrIndex,
+static void tcpa_add_measurement(uint32_t pcrIndex,
                           uint16_t event_type,
                           uint32_t data)
 {
@@ -863,7 +863,7 @@ uint32_t tcpa_initialize_tpm(uint32_t physpres)
 }
 
 
-uint16_t TCG_IsShutdownPreBootInterface(void)
+static uint16_t TCG_IsShutdownPreBootInterface(void)
 {
        return tcpa_acpi.flags & STATUS_FLAG_SHUTDOWN;
 }
index 5a49b0038c6fcbc1b8ef4059aee2b49754ae8969..d45f9b0c30b6915cbda3ce53791498361da2d0b5 100644 (file)
@@ -75,7 +75,7 @@ static uint32_t tis_activate(uint32_t baseaddr)
        return rc;
 }
 
-uint32_t tis_ready(uint32_t baseaddr)
+static uint32_t tis_ready(uint32_t baseaddr)
 {
        uint32_t rc = 0;
        uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -86,7 +86,7 @@ uint32_t tis_ready(uint32_t baseaddr)
        return rc;
 }
 
-uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
+static uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
 {
        uint32_t rc = 0;
        uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -127,7 +127,7 @@ uint32_t tis_senddata(uint32_t baseaddr, unsigned char *data, uint32_t len)
        return rc;
 }
 
-uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
+static uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
 {
        uint32_t rc = 0;
        uint32_t offset = 0;
@@ -147,7 +147,7 @@ uint32_t tis_readresp(uint32_t baseaddr, unsigned char *buffer, uint32_t len)
 }
 
 
-uint32_t tis_waitdatavalid(uint32_t baseaddr)
+static uint32_t tis_waitdatavalid(uint32_t baseaddr)
 {
        uint8_t *tis_addr = (uint8_t*)baseaddr;
        uint32_t rc = 0;
@@ -157,7 +157,7 @@ uint32_t tis_waitdatavalid(uint32_t baseaddr)
        return rc;
 }
 
-uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
+static uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
 {
        uint32_t rc = 0;
        uint8_t *tis_addr = (uint8_t*)baseaddr;
@@ -170,7 +170,7 @@ uint32_t tis_waitrespready(uint32_t baseaddr, uint32_t timeout)
 }
 
 /* if device is not there, return '0', '1' otherwise */
-uint32_t tis_probe(uint32_t baseaddr)
+static uint32_t tis_probe(uint32_t baseaddr)
 {
        uint32_t rc = 0;
        uint8_t *tis_addr = (uint8_t*)baseaddr;
index 25a450f8c994aa4926ad3e7dbd6140b20c0efc6e..ad60b9eedbb8a4a6464cc8481deb7817312ce199 100644 (file)
@@ -388,12 +388,6 @@ int printf(const char *fmt, ...)
     return 0;
 }
 
-int vprintf(const char *fmt, va_list ap)
-{
-    _doprint(putchar, fmt, ap);
-    return 0;
-}
-
 void mssleep(uint32_t waittime)
 {
     uint32_t i;
index 4adc69ebc422d66c242b40aab7c3ba7b24890077..f05d86d909b3501feb125816a64e478e554aadf0 100644 (file)
@@ -104,14 +104,20 @@ int *running = NULL;
 int NCPU = 0;
 
 
-void init_current(int ncpu)
+static void advance_next_datapoint(uint64_t);
+static void alloc_qos_data(int ncpu);
+static int process_record(int, struct t_rec *);
+static void qos_kill_thread(int domid);
+
+
+static void init_current(int ncpu)
 {
     running = calloc(ncpu, sizeof(int));
     NCPU = ncpu;
     printf("Initialized with %d %s\n", ncpu, (ncpu == 1) ? "cpu" : "cpu's");
 }
 
-int is_current(int domain, int cpu)
+static int is_current(int domain, int cpu)
 {
     //  int i;
   
@@ -122,20 +128,22 @@ int is_current(int domain, int cpu)
 }
 
 
+#if 0 /* unused */
 // return the domain that's currently running on the given cpu
-int current(int cpu)
+static int current(int cpu)
 {
     return running[cpu];
 }
+#endif
 
-void set_current(int cpu, int domain)
+static void set_current(int cpu, int domain)
 {
     running[cpu] = domain;
 }
 
 
 
-void close_handler(int signal)
+static void close_handler(int signal)
 {
     interrupted = 1;
 }
@@ -152,7 +160,7 @@ void dump_record(int cpu, struct t_rec *x)
  * millis_to_timespec - convert a time in milliseconds to a struct timespec
  * @millis:             time interval in milliseconds
  */
-struct timespec millis_to_timespec(unsigned long millis)
+static struct timespec millis_to_timespec(unsigned long millis)
 {
     struct timespec spec;
 
@@ -188,7 +196,7 @@ stat_map_t stat_map[] = {
 };
 
 
-void check_gotten_sum(void)
+static void check_gotten_sum(void)
 {
 #if 0
     uint64_t sum, ns;
@@ -212,7 +220,7 @@ void check_gotten_sum(void)
 
 
 
-void dump_stats(void) 
+static void dump_stats(void) 
 {
     stat_map_t *smt = stat_map;
     time_t end_time, run_time;
@@ -236,7 +244,7 @@ void dump_stats(void)
     check_gotten_sum();
 }
 
-void log_event(int event_id) 
+static void log_event(int event_id) 
 {
     stat_map_t *smt = stat_map;
 
@@ -258,7 +266,7 @@ int xce_handle = -1;
 
 /* Returns the event channel handle. */
 /* Stolen from xenstore code */
-int eventchn_init(void)
+static int eventchn_init(void)
 {
     int rc;
   
@@ -278,7 +286,7 @@ int eventchn_init(void)
     return xce_handle;
 }
 
-void wait_for_event(void)
+static void wait_for_event(void)
 {
     int ret;
     fd_set inset;
@@ -333,7 +341,7 @@ static void get_tbufs(unsigned long *mfn, unsigned long *size)
     xc_interface_close(xc_handle);
 }
 
-void disable_tracing(void)
+static void disable_tracing(void)
 {
     int xc_handle = xc_interface_open();
     xc_tbuf_disable(xc_handle);  
@@ -348,7 +356,7 @@ void disable_tracing(void)
  *
  * Maps the Xen trace buffers them into process address space.
  */
-struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
+static struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
                         unsigned long size)
 {
     int xc_handle;
@@ -385,7 +393,7 @@ struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
  * Initialises an array of pointers to individual trace buffers within the
  * mapped region containing all trace buffers.
  */
-struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
+static struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
                               unsigned long size)
 {
     int i;
@@ -418,7 +426,7 @@ struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
  * mapped in user space.  Note that the trace buffer metadata contains machine
  * pointers - the array returned allows more convenient access to them.
  */
-struct t_rec **init_rec_ptrs(struct t_buf **meta, unsigned int num)
+static struct t_rec **init_rec_ptrs(struct t_buf **meta, unsigned int num)
 {
     int i;
     struct t_rec **data;
@@ -441,7 +449,7 @@ struct t_rec **init_rec_ptrs(struct t_buf **meta, unsigned int num)
 /**
  * get_num_cpus - get the number of logical CPUs
  */
-unsigned int get_num_cpus(void)
+static unsigned int get_num_cpus(void)
 {
     xc_physinfo_t physinfo = { 0 };
     int xc_handle = xc_interface_open();
@@ -465,11 +473,9 @@ unsigned int get_num_cpus(void)
 /**
  * monitor_tbufs - monitor the contents of tbufs
  */
-int monitor_tbufs(void)
+static int monitor_tbufs(void)
 {
     int i;
-    extern int process_record(int, struct t_rec *);
-    extern void alloc_qos_data(int ncpu);
 
     void *tbufs_mapped;          /* pointer to where the tbufs are mapped    */
     struct t_buf **meta;         /* pointers to the trace buffer metadata    */
@@ -564,7 +570,7 @@ const char *program_bug_address = "<rob.gardner@hp.com>";
 #define xstr(x) str(x)
 #define str(x) #x
 
-void usage(void)
+static void usage(void)
 {
 #define USAGE_STR \
 "Usage: xenbaked [OPTION...]\n" \
@@ -591,7 +597,7 @@ void usage(void)
 }
 
 /* convert the argument string pointed to by arg to a long int representation */
-long argtol(const char *restrict arg, int base)
+static long argtol(const char *restrict arg, int base)
 {
     char *endp; 
     long val;
@@ -612,7 +618,7 @@ long argtol(const char *restrict arg, int base)
 }
 
 /* parse command line arguments */
-void parse_args(int argc, char **argv)
+static void parse_args(int argc, char **argv)
 {
     int option;
     static struct option long_options[] = {
@@ -658,12 +664,11 @@ void parse_args(int argc, char **argv)
 }
 
 #define SHARED_MEM_FILE "/var/run/xenq-shm"
-void alloc_qos_data(int ncpu)
+static void alloc_qos_data(int ncpu)
 {
     int i, n, pgsize, off=0;
     char *dummy;
     int qos_fd;
-    void advance_next_datapoint(uint64_t);
 
     cpu_qos_data = (_new_qos_data **) calloc(ncpu, sizeof(_new_qos_data *));
 
@@ -737,7 +742,7 @@ int main(int argc, char **argv)
     return ret;
 }
 
-void qos_init_domain(int domid, int idx)
+static void qos_init_domain(int domid, int idx)
 {
     int i;
 
@@ -767,7 +772,7 @@ void qos_init_domain(int domid, int idx)
     }
 }
 
-void global_init_domain(int domid, int idx) 
+static void global_init_domain(int domid, int idx) 
 {
     int cpu;
     _new_qos_data *saved_qos;
@@ -781,14 +786,12 @@ void global_init_domain(int domid, int idx)
     new_qos = saved_qos;
 }
 
-
 // give index of this domain in the qos data array
-int indexof(int domid)
+static int indexof(int domid)
 {
     int idx;
     xc_dominfo_t dominfo[NDOMAINS];
     int xc_handle, ndomains;
-    extern void qos_kill_thread(int domid);
   
     if (domid < 0) {   // shouldn't happen
         printf("bad domain id: %d\r\n", domid);
@@ -840,13 +843,13 @@ int indexof(int domid)
     exit(2);
 }
 
-int domain_runnable(int domid)
+static int domain_runnable(int domid)
 {
     return new_qos->domain_info[indexof(domid)].runnable;
 }
 
 
-void update_blocked_time(int domid, uint64_t now)
+static void update_blocked_time(int domid, uint64_t now)
 {
     uint64_t t_blocked;
     int id = indexof(domid);
@@ -867,7 +870,7 @@ void update_blocked_time(int domid, uint64_t now)
 
 
 // advance to next datapoint for all domains
-void advance_next_datapoint(uint64_t now)
+static void advance_next_datapoint(uint64_t now)
 {
     int new, old, didx;
 
@@ -892,7 +895,7 @@ void advance_next_datapoint(uint64_t now)
 
 
 
-void qos_update_thread(int cpu, int domid, uint64_t now)
+static void qos_update_thread(int cpu, int domid, uint64_t now)
 {
     int n, id;
     uint64_t last_update_time, start;
@@ -970,7 +973,7 @@ void qos_update_thread(int cpu, int domid, uint64_t now)
 
 
 // called by dump routines to update all structures
-void qos_update_all(uint64_t now, int cpu)
+static void qos_update_all(uint64_t now, int cpu)
 {
     int i;
 
@@ -980,7 +983,7 @@ void qos_update_all(uint64_t now, int cpu)
 }
 
 
-void qos_update_thread_stats(int cpu, int domid, uint64_t now)
+static void qos_update_thread_stats(int cpu, int domid, uint64_t now)
 {
     if (new_qos->qdata[new_qos->next_datapoint].ns_passed > (million*opts.ms_per_sample)) {
         qos_update_all(now, cpu);
@@ -993,7 +996,7 @@ void qos_update_thread_stats(int cpu, int domid, uint64_t now)
 
 
 // called when a new thread gets the cpu
-void qos_switch_in(int cpu, int domid, uint64_t now, unsigned long ns_alloc, unsigned long ns_waited)
+static void qos_switch_in(int cpu, int domid, uint64_t now, unsigned long ns_alloc, unsigned long ns_waited)
 {
     int idx = indexof(domid);
 
@@ -1016,7 +1019,7 @@ void qos_switch_in(int cpu, int domid, uint64_t now, unsigned long ns_alloc, uns
 }
 
 // called when the current thread is taken off the cpu
-void qos_switch_out(int cpu, int domid, uint64_t now, unsigned long gotten)
+static void qos_switch_out(int cpu, int domid, uint64_t now, unsigned long gotten)
 {
     int idx = indexof(domid);
     int n;
@@ -1054,7 +1057,7 @@ void qos_switch_out(int cpu, int domid, uint64_t now, unsigned long gotten)
 
 // called when domain is put to sleep, may also be called
 // when thread is already asleep
-void qos_state_sleeping(int cpu, int domid, uint64_t now) 
+static void qos_state_sleeping(int cpu, int domid, uint64_t now) 
 {
     int idx;
 
@@ -1072,7 +1075,7 @@ void qos_state_sleeping(int cpu, int domid, uint64_t now)
 
 
 // domain died, presume it's dead on all cpu's, not just mostly dead
-void qos_kill_thread(int domid)
+static void qos_kill_thread(int domid)
 {
     int cpu;
   
@@ -1085,7 +1088,7 @@ void qos_kill_thread(int domid)
 
 // called when thread becomes runnable, may also be called
 // when thread is already runnable
-void qos_state_runnable(int cpu, int domid, uint64_t now)
+static void qos_state_runnable(int cpu, int domid, uint64_t now)
 {
     int idx;
   
@@ -1105,7 +1108,7 @@ void qos_state_runnable(int cpu, int domid, uint64_t now)
 }
 
 
-void qos_count_packets(domid_t domid, uint64_t now)
+static void qos_count_packets(domid_t domid, uint64_t now)
 {
     int i, idx = indexof(domid);
     _new_qos_data *cpu_data;
@@ -1122,7 +1125,7 @@ void qos_count_packets(domid_t domid, uint64_t now)
 }
 
 
-int process_record(int cpu, struct t_rec *r)
+static int process_record(int cpu, struct t_rec *r)
 {
     uint64_t now = 0;
     uint32_t *extra_u32 = r->u.nocycles.extra_u32;
index 8bff92b3bc0bd8d4dbb0166815a659715fe5bfbd..a3d85e34e796e02f430fb3bef19c13f3974af1a9 100644 (file)
@@ -500,7 +500,7 @@ void *talloc_init(const char *fmt, ...)
   should probably not be used in new code. It's in here to keep the talloc
   code consistent across Samba 3 and 4.
 */
-void talloc_free_children(void *ptr)
+static void talloc_free_children(void *ptr)
 {
        struct talloc_chunk *tc;
 
index 7ebf37a94109dcfb47f668a0b0b8a49a038788ae..e04c9aec216fa7a9d935a52d65c6c53bab0f90d8 100644 (file)
@@ -28,7 +28,7 @@
 
 
 #ifndef _SAMBA_BUILD_
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
@@ -731,7 +731,7 @@ update:
 static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition)
 {
        char buf[1024];
-#if HAVE_FTRUNCATE_EXTEND
+#ifdef HAVE_FTRUNCATE_EXTEND
        if (ftruncate(tdb->fd, size+addition) != 0) {
                TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", 
                           size+addition, strerror(errno)));
index aca23ed4c4bee86a473c5016f2145a4a8420f902..9d00c18259bc6096768a7a094dacf564a0f3e8b8 100644 (file)
@@ -121,7 +121,7 @@ static int show_whole_path = 0;
 
 #define MIN(a, b) (((a) < (b))? (a) : (b))
 
-void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms)
+static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms)
 {
     static struct expanding_buffer ebuf;
     char **e;
index b391319a15f6a8b6a4072a930f4eb179a80173bb..90bfd05b917b2f11ede7bb9fccad98aa74018921 100644 (file)
@@ -349,23 +349,6 @@ static int destroy_fd(void *_fd)
        return 0;
 }
 
-/* Return a pointer to an fd, self-closing and attached to this pathname. */
-int *talloc_open(const char *pathname, int flags, int mode)
-{
-       int *fd;
-
-       fd = talloc(pathname, int);
-       *fd = open(pathname, flags, mode);
-       if (*fd < 0) {
-               int saved_errno = errno;
-               talloc_free(fd);
-               errno = saved_errno;
-               return NULL;
-       }
-       talloc_set_destructor(fd, destroy_fd);
-       return fd;
-}
-
 /* Is child a subnode of parent, or equal? */
 bool is_child(const char *child, const char *parent)
 {
index a6f80a4ba46cf2a3ef8b4ef2a82a08bd46224eda..66e48c6d1f39f5c92abe254baea19d0fbfcde261 100644 (file)
@@ -71,7 +71,7 @@ struct symbol {
 
 size_t kernel_stext, kernel_etext, kernel_sinittext, kernel_einittext, kernel_hypercallpage;
 
-int is_kernel_text(size_t addr)
+static int is_kernel_text(size_t addr)
 {
 #if defined (__i386__)
     if (symbol_table == NULL)
@@ -96,7 +96,8 @@ int is_kernel_text(size_t addr)
     return 0;
 }
 
-void free_symbol(struct symbol *symbol)
+#if 0
+static void free_symbol(struct symbol *symbol)
 {
     if (symbol == NULL)
         return;
@@ -104,8 +105,9 @@ void free_symbol(struct symbol *symbol)
         free(symbol->name);
     free(symbol);
 }
+#endif
 
-void insert_symbol(struct symbol *symbol)
+static void insert_symbol(struct symbol *symbol)
 {
     static struct symbol *prev = NULL;
     struct symbol *s = symbol_table;
@@ -132,7 +134,7 @@ void insert_symbol(struct symbol *symbol)
     prev = symbol;
 }
 
-struct symbol *lookup_symbol(size_t address)
+static struct symbol *lookup_symbol(size_t address)
 {
     struct symbol *s = symbol_table;
 
@@ -145,7 +147,7 @@ struct symbol *lookup_symbol(size_t address)
     return NULL;
 }
 
-void print_symbol(size_t addr)
+static void print_symbol(size_t addr)
 {
     struct symbol *s;
 
@@ -163,7 +165,7 @@ void print_symbol(size_t addr)
         printf("%s+%#x ", s->name, (unsigned int)(addr - s->address));
 }
 
-void read_symbol_table(const char *symtab)
+static void read_symbol_table(const char *symtab)
 {
     char line[256];
     char *p;
@@ -240,7 +242,7 @@ char *flag_values[22][2] =
     { NULL,     "cid"  }  // 21       Cpuid Identification Flag
 };
 
-void print_flags(uint64_t flags)
+static void print_flags(uint64_t flags)
 {
     int i;
 
@@ -253,7 +255,7 @@ void print_flags(uint64_t flags)
     printf("\n");
 }
 
-void print_special(unsigned long *regs, const char *name, unsigned int mask)
+static void print_special(unsigned long *regs, const char *name, unsigned int mask)
 {
     unsigned int i;
 
@@ -265,7 +267,7 @@ void print_special(unsigned long *regs, const char *name, unsigned int mask)
 #endif
 
 #ifdef __i386__
-void print_ctx(vcpu_guest_context_t *ctx1)
+static void print_ctx(vcpu_guest_context_t *ctx1)
 {
     struct cpu_user_regs *regs = &ctx1->user_regs;
 
@@ -294,7 +296,7 @@ void print_ctx(vcpu_guest_context_t *ctx1)
     }
 }
 #elif defined(__x86_64__)
-void print_ctx(vcpu_guest_context_t *ctx1)
+static void print_ctx(vcpu_guest_context_t *ctx1)
 {
     struct cpu_user_regs *regs = &ctx1->user_regs;
 
@@ -582,7 +584,7 @@ void print_ctx(vcpu_guest_context_t *ctx)
 #endif
 
 #ifndef NO_TRANSLATION
-void *map_page(vcpu_guest_context_t *ctx, int vcpu, size_t virt)
+static void *map_page(vcpu_guest_context_t *ctx, int vcpu, size_t virt)
 {
     static unsigned long previous_mfn = 0;
     static void *mapped = NULL;
@@ -609,7 +611,7 @@ void *map_page(vcpu_guest_context_t *ctx, int vcpu, size_t virt)
     return (void *)(mapped + offset);
 }
 
-void print_stack(vcpu_guest_context_t *ctx, int vcpu)
+static void print_stack(vcpu_guest_context_t *ctx, int vcpu)
 {
     struct cpu_user_regs *regs = &ctx->user_regs;
     size_t stack = STACK_POINTER(regs);
@@ -699,7 +701,7 @@ void print_stack(vcpu_guest_context_t *ctx, int vcpu)
 }
 #endif
 
-void dump_ctx(int vcpu)
+static void dump_ctx(int vcpu)
 {
     int ret;
     vcpu_guest_context_any_t ctx;
@@ -748,7 +750,7 @@ void dump_ctx(int vcpu)
     }
 }
 
-void usage(void)
+static void usage(void)
 {
     printf("usage:\n\n");
 
index aaef3f09fb763eaeef93852e878cb3f2493465fb..29e664ca62cac0ecf6752d171aa6bdbf20a0f026 100644 (file)
@@ -68,7 +68,7 @@ static int xc_handle = -1;
 static int event_fd = -1;
 static int virq_port = -1;
 
-void close_handler(int signal)
+static void close_handler(int signal)
 {
     interrupted = 1;
 }
@@ -84,7 +84,7 @@ void close_handler(int signal)
  * Outputs the trace buffer to a filestream, prepending the CPU and size
  * of the buffer write.
  */
-void write_buffer(unsigned int cpu, unsigned char *start, int size,
+static void write_buffer(unsigned int cpu, unsigned char *start, int size,
                int total_size, int outfd)
 {
     struct statvfs stat;
@@ -206,7 +206,7 @@ static void get_tbufs(unsigned long *mfn, unsigned long *size)
  *
  * Maps the Xen trace buffers them into process address space.
  */
-struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
+static struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
                         unsigned long size)
 {
     struct t_buf *tbufs_mapped;
@@ -230,7 +230,7 @@ struct t_buf *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
  * @type:           the new mask type,0-event mask, 1-cpu mask
  *
  */
-void set_mask(uint32_t mask, int type)
+static void set_mask(uint32_t mask, int type)
 {
     int ret = 0;
 
@@ -258,7 +258,7 @@ void set_mask(uint32_t mask, int type)
  * Initialises an array of pointers to individual trace buffers within the
  * mapped region containing all trace buffers.
  */
-struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
+static struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
                               unsigned long size)
 {
     int i;
@@ -291,7 +291,7 @@ struct t_buf **init_bufs_ptrs(void *bufs_mapped, unsigned int num,
  * mapped in user space.  Note that the trace buffer metadata contains machine
  * pointers - the array returned allows more convenient access to them.
  */
-unsigned char **init_rec_ptrs(struct t_buf **meta, unsigned int num)
+static unsigned char **init_rec_ptrs(struct t_buf **meta, unsigned int num)
 {
     int i;
     unsigned char **data;
@@ -312,7 +312,7 @@ unsigned char **init_rec_ptrs(struct t_buf **meta, unsigned int num)
 /**
  * get_num_cpus - get the number of logical CPUs
  */
-unsigned int get_num_cpus(void)
+static unsigned int get_num_cpus(void)
 {
     xc_physinfo_t physinfo = { 0 };
     int ret;
@@ -331,7 +331,7 @@ unsigned int get_num_cpus(void)
 /**
  * event_init - setup to receive the VIRQ_TBUF event
  */
-void event_init(void)
+static void event_init(void)
 {
     int rc;
 
@@ -354,7 +354,7 @@ void event_init(void)
  * wait_for_event_or_timeout - sleep for the specified number of milliseconds,
  *                             or until an VIRQ_TBUF event occurs
  */
-void wait_for_event_or_timeout(unsigned long milliseconds)
+static void wait_for_event_or_timeout(unsigned long milliseconds)
 {
     int rc;
     struct pollfd fd = { .fd = event_fd,
@@ -394,7 +394,7 @@ void wait_for_event_or_timeout(unsigned long milliseconds)
  * monitor_tbufs - monitor the contents of tbufs and output to a file
  * @logfile:       the FILE * representing the file to log to
  */
-int monitor_tbufs(int outfd)
+static int monitor_tbufs(int outfd)
 {
     int i;
 
@@ -512,7 +512,7 @@ int monitor_tbufs(int outfd)
 const char *program_version     = "xentrace v1.2";
 const char *program_bug_address = "<mark.a.williamson@intel.com>";
 
-void usage(void)
+static void usage(void)
 {
 #define USAGE_STR \
 "Usage: xentrace [OPTION...] [output file]\n" \
@@ -554,7 +554,7 @@ void usage(void)
 }
 
 /* convert the argument string pointed to by arg to a long int representation */
-long argtol(const char *restrict arg, int base)
+static long argtol(const char *restrict arg, int base)
 {
     char *endp;
     long val;
@@ -574,7 +574,7 @@ long argtol(const char *restrict arg, int base)
     return val;
 }
 
-int parse_evtmask(char *arg)
+static int parse_evtmask(char *arg)
 {
     /* search filtering class */
     if (strcmp(arg, "gen") == 0){ 
@@ -595,7 +595,7 @@ int parse_evtmask(char *arg)
 }
 
 /* parse command line arguments */
-void parse_args(int argc, char **argv)
+static void parse_args(int argc, char **argv)
 {
     int option;
     static struct option long_options[] = {