aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-15 13:19:26 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-15 13:19:26 +0100
commit7eb8d34c180bf88522822ebd487747ad7353335a (patch)
treea1fa4d5eab79c5882ff6e57cb4f37a9a15ce54e0
parent533a2a2773f04d175bda34ea2f0202616b68be2b (diff)
downloadxen-7eb8d34c180bf88522822ebd487747ad7353335a.tar.gz
xen-7eb8d34c180bf88522822ebd487747ad7353335a.tar.bz2
xen-7eb8d34c180bf88522822ebd487747ad7353335a.zip
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>
-rw-r--r--tools/console/daemon/io.c2
-rw-r--r--tools/firmware/hvmloader/hvmloader.c4
-rw-r--r--tools/firmware/hvmloader/mp_tables.c19
-rw-r--r--tools/firmware/hvmloader/smp.c3
-rw-r--r--tools/firmware/hvmloader/util.h6
-rw-r--r--tools/firmware/rombios/32bit/tcgbios/tcgbios.c4
-rw-r--r--tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c12
-rw-r--r--tools/firmware/rombios/32bit/util.c6
-rw-r--r--tools/xenmon/xenbaked.c87
-rw-r--r--tools/xenstore/talloc.c2
-rw-r--r--tools/xenstore/tdb.c4
-rw-r--r--tools/xenstore/xenstore_client.c2
-rw-r--r--tools/xenstore/xenstored_core.c17
-rw-r--r--tools/xentrace/xenctx.c30
-rw-r--r--tools/xentrace/xentrace.c28
15 files changed, 103 insertions, 123 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 1a3f243a36..16a0b6c27e 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -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;
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index 82e34b0e3a..5f1f22e6dd 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -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
diff --git a/tools/firmware/hvmloader/mp_tables.c b/tools/firmware/hvmloader/mp_tables.c
index bbf9a38f51..2c42f6e4b4 100644
--- a/tools/firmware/hvmloader/mp_tables.c
+++ b/tools/firmware/hvmloader/mp_tables.c
@@ -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)
{
diff --git a/tools/firmware/hvmloader/smp.c b/tools/firmware/hvmloader/smp.c
index 4d88b5b760..f64f73e3f0 100644
--- a/tools/firmware/hvmloader/smp.c
+++ b/tools/firmware/hvmloader/smp.c
@@ -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);
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 1d310c64e4..455b2f66e6 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -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__ */
diff --git a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
index e36ca37845..263607471b 100644
--- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
+++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
@@ -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;
}
diff --git a/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c b/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c
index 5a49b0038c..d45f9b0c30 100644
--- a/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c
+++ b/tools/firmware/rombios/32bit/tcgbios/tpm_drivers.c
@@ -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;
diff --git a/tools/firmware/rombios/32bit/util.c b/tools/firmware/rombios/32bit/util.c
index 25a450f8c9..ad60b9eedb 100644
--- a/tools/firmware/rombios/32bit/util.c
+++ b/tools/firmware/rombios/32bit/util.c
@@ -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;
diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 4adc69ebc4..f05d86d909 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -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;
diff --git a/tools/xenstore/talloc.c b/tools/xenstore/talloc.c
index 8bff92b3bc..a3d85e34e7 100644
--- a/tools/xenstore/talloc.c
+++ b/tools/xenstore/talloc.c
@@ -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;
diff --git a/tools/xenstore/tdb.c b/tools/xenstore/tdb.c
index 7ebf37a941..e04c9aec21 100644
--- a/tools/xenstore/tdb.c
+++ b/tools/xenstore/tdb.c
@@ -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)));
diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index aca23ed4c4..9d00c18259 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -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;
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index b391319a15..90bfd05b91 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -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)
{
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index a6f80a4ba4..66e48c6d1f 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -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");
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index aaef3f09fb..29e664ca62 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -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[] = {