proper prototypes for others as required.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
}
/* 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;
" .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
#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
*/
};
-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;
}
/* 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);
/* 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;
/* 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;
/* 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)
{
/* 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;
* 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;
/* 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;
*((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)
{
" .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);
/* 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__ */
* 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)
{
}
-uint16_t TCG_IsShutdownPreBootInterface(void)
+static uint16_t TCG_IsShutdownPreBootInterface(void)
{
return tcpa_acpi.flags & STATUS_FLAG_SHUTDOWN;
}
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;
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;
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;
}
-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;
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;
}
/* 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;
return 0;
}
-int vprintf(const char *fmt, va_list ap)
-{
- _doprint(putchar, fmt, ap);
- return 0;
-}
-
void mssleep(uint32_t waittime)
{
uint32_t i;
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;
}
+#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;
}
* 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;
};
-void check_gotten_sum(void)
+static void check_gotten_sum(void)
{
#if 0
uint64_t sum, ns;
-void dump_stats(void)
+static void dump_stats(void)
{
stat_map_t *smt = stat_map;
time_t end_time, run_time;
check_gotten_sum();
}
-void log_event(int event_id)
+static void log_event(int event_id)
{
stat_map_t *smt = stat_map;
/* Returns the event channel handle. */
/* Stolen from xenstore code */
-int eventchn_init(void)
+static int eventchn_init(void)
{
int rc;
return xce_handle;
}
-void wait_for_event(void)
+static void wait_for_event(void)
{
int ret;
fd_set inset;
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);
*
* 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;
* 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;
* 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;
/**
* 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();
/**
* 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 */
#define xstr(x) str(x)
#define str(x) #x
-void usage(void)
+static void usage(void)
{
#define USAGE_STR \
"Usage: xenbaked [OPTION...]\n" \
}
/* 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;
}
/* 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[] = {
}
#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 *));
return ret;
}
-void qos_init_domain(int domid, int idx)
+static void qos_init_domain(int domid, int idx)
{
int i;
}
}
-void global_init_domain(int domid, int idx)
+static void global_init_domain(int domid, int idx)
{
int cpu;
_new_qos_data *saved_qos;
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);
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);
// 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;
-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;
// 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;
}
-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);
// 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);
}
// 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;
// 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;
// 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;
// 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;
}
-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;
}
-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;
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;
#ifndef _SAMBA_BUILD_
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
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)));
#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;
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)
{
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)
return 0;
}
-void free_symbol(struct symbol *symbol)
+#if 0
+static void free_symbol(struct symbol *symbol)
{
if (symbol == NULL)
return;
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;
prev = symbol;
}
-struct symbol *lookup_symbol(size_t address)
+static struct symbol *lookup_symbol(size_t address)
{
struct symbol *s = symbol_table;
return NULL;
}
-void print_symbol(size_t addr)
+static void print_symbol(size_t addr)
{
struct symbol *s;
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;
{ NULL, "cid" } // 21 Cpuid Identification Flag
};
-void print_flags(uint64_t flags)
+static void print_flags(uint64_t flags)
{
int i;
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;
#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;
}
}
#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;
#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;
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);
}
#endif
-void dump_ctx(int vcpu)
+static void dump_ctx(int vcpu)
{
int ret;
vcpu_guest_context_any_t ctx;
}
}
-void usage(void)
+static void usage(void)
{
printf("usage:\n\n");
static int event_fd = -1;
static int virq_port = -1;
-void close_handler(int signal)
+static void close_handler(int signal)
{
interrupted = 1;
}
* 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;
*
* 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;
* @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;
* 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;
* 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;
/**
* 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;
/**
* event_init - setup to receive the VIRQ_TBUF event
*/
-void event_init(void)
+static void event_init(void)
{
int rc;
* 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,
* 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;
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" \
}
/* 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;
return val;
}
-int parse_evtmask(char *arg)
+static int parse_evtmask(char *arg)
{
/* search filtering class */
if (strcmp(arg, "gen") == 0){
}
/* 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[] = {