retire PUBLIC, PRIVATE and FORWARD

This commit is contained in:
Ben Gras
2012-03-25 20:25:53 +02:00
parent 6a73e85ad1
commit 7336a67dfe
603 changed files with 5776 additions and 5779 deletions

View File

@@ -26,33 +26,33 @@ typedef struct {
ssize_t value;
} result_t;
PRIVATE char driver_label[32] = ""; /* driver DS label */
PRIVATE dev_t driver_minor = -1; /* driver's partition minor to use */
PRIVATE endpoint_t driver_endpt; /* driver endpoint */
static char driver_label[32] = ""; /* driver DS label */
static dev_t driver_minor = -1; /* driver's partition minor to use */
static endpoint_t driver_endpt; /* driver endpoint */
PRIVATE int may_write = FALSE; /* may we write to the device? */
PRIVATE int sector_size = 512; /* size of a single disk sector */
PRIVATE int min_read = 512; /* minimum total size of read req */
PRIVATE int element_size = 512; /* minimum I/O vector element size */
PRIVATE int max_size = 131072; /* maximum total size of any req */
static int may_write = FALSE; /* may we write to the device? */
static int sector_size = 512; /* size of a single disk sector */
static int min_read = 512; /* minimum total size of read req */
static int element_size = 512; /* minimum I/O vector element size */
static int max_size = 131072; /* maximum total size of any req */
/* Note that we do not test exceeding the max_size limit, so it is safe to set
* it to a value lower than the driver supports.
*/
PRIVATE struct partition part; /* base and size of target partition */
static struct partition part; /* base and size of target partition */
#define NR_OPENED 10 /* maximum number of opened devices */
PRIVATE dev_t opened[NR_OPENED]; /* list of currently opened devices */
PRIVATE int nr_opened = 0; /* current number of opened devices */
static dev_t opened[NR_OPENED]; /* list of currently opened devices */
static int nr_opened = 0; /* current number of opened devices */
PRIVATE int total_tests = 0; /* total number of tests performed */
PRIVATE int failed_tests = 0; /* number of tests that failed */
PRIVATE int failed_groups = 0; /* nr of groups that had failures */
PRIVATE int group_failure; /* has this group had a failure yet? */
PRIVATE int driver_deaths = 0; /* number of restarts that we saw */
static int total_tests = 0; /* total number of tests performed */
static int failed_tests = 0; /* number of tests that failed */
static int failed_groups = 0; /* nr of groups that had failures */
static int group_failure; /* has this group had a failure yet? */
static int driver_deaths = 0; /* number of restarts that we saw */
/* Options supported by this driver. */
PRIVATE struct optset optset_table[] = {
static struct optset optset_table[] = {
{ "label", OPT_STRING, driver_label, sizeof(driver_label) },
{ "minor", OPT_INT, &driver_minor, 10 },
{ "rw", OPT_BOOL, &may_write, TRUE },
@@ -64,7 +64,7 @@ PRIVATE struct optset optset_table[] = {
{ NULL, 0, NULL, 0 }
};
PRIVATE int set_result(result_t *res, int type, ssize_t value)
static int set_result(result_t *res, int type, ssize_t value)
{
/* Set the result to the given result type and with the given optional
* extra value. Return the type.
@@ -75,7 +75,7 @@ PRIVATE int set_result(result_t *res, int type, ssize_t value)
return type;
}
PRIVATE void accept_result(result_t *res, int type, ssize_t value)
static void accept_result(result_t *res, int type, ssize_t value)
{
/* If the result is of the given type and value, reset it to a success
* result. This allows for a logical OR on error codes.
@@ -85,7 +85,7 @@ PRIVATE void accept_result(result_t *res, int type, ssize_t value)
set_result(res, RESULT_OK, 0);
}
PRIVATE void got_result(result_t *res, char *desc)
static void got_result(result_t *res, char *desc)
{
/* Process the result of a test. Keep statistics.
*/
@@ -142,7 +142,7 @@ PRIVATE void got_result(result_t *res, char *desc)
}
}
PRIVATE void test_group(char *name, int exec)
static void test_group(char *name, int exec)
{
/* Start a new group of tests.
*/
@@ -152,7 +152,7 @@ PRIVATE void test_group(char *name, int exec)
group_failure = FALSE;
}
PRIVATE void reopen_device(dev_t minor)
static void reopen_device(dev_t minor)
{
/* Reopen a device after we were notified that the driver has died.
* Explicitly ignore any errors here; this is a feeble attempt to get
@@ -169,7 +169,7 @@ PRIVATE void reopen_device(dev_t minor)
(void) sendrec(driver_endpt, &m);
}
PRIVATE int sendrec_driver(message *m_ptr, ssize_t exp, result_t *res)
static int sendrec_driver(message *m_ptr, ssize_t exp, result_t *res)
{
/* Make a call to the driver, and perform basic checks on the return
* message. Fill in the result structure, wiping out what was in there
@@ -226,7 +226,7 @@ PRIVATE int sendrec_driver(message *m_ptr, ssize_t exp, result_t *res)
return set_result(res, RESULT_OK, 0);
}
PRIVATE int raw_xfer(dev_t minor, u64_t pos, iovec_s_t *iovec, int nr_req,
static int raw_xfer(dev_t minor, u64_t pos, iovec_s_t *iovec, int nr_req,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer with a safecopy iovec already supplied.
@@ -268,7 +268,7 @@ PRIVATE int raw_xfer(dev_t minor, u64_t pos, iovec_s_t *iovec, int nr_req,
return set_result(res, RESULT_TRUNC, exp - m.BDEV_STATUS);
}
PRIVATE int vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
static int vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer, creating and revoking grants for the I/O vector.
@@ -299,7 +299,7 @@ PRIVATE int vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
return r;
}
PRIVATE int simple_xfer(dev_t minor, u64_t pos, u8_t *buf, size_t size,
static int simple_xfer(dev_t minor, u64_t pos, u8_t *buf, size_t size,
int write, ssize_t exp, result_t *res)
{
/* Perform a transfer involving a single buffer.
@@ -312,7 +312,7 @@ PRIVATE int simple_xfer(dev_t minor, u64_t pos, u8_t *buf, size_t size,
return vir_xfer(minor, pos, &iov, 1, write, exp, res);
}
PRIVATE void alloc_buf_and_grant(u8_t **ptr, cp_grant_id_t *grant,
static void alloc_buf_and_grant(u8_t **ptr, cp_grant_id_t *grant,
size_t size, int perms)
{
/* Allocate a buffer suitable for DMA (i.e. contiguous) and create a
@@ -328,7 +328,7 @@ PRIVATE void alloc_buf_and_grant(u8_t **ptr, cp_grant_id_t *grant,
panic("unable to allocate grant");
}
PRIVATE void free_buf_and_grant(u8_t *ptr, cp_grant_id_t grant, size_t size)
static void free_buf_and_grant(u8_t *ptr, cp_grant_id_t grant, size_t size)
{
/* Revoke a grant and free a buffer.
*/
@@ -338,7 +338,7 @@ PRIVATE void free_buf_and_grant(u8_t *ptr, cp_grant_id_t grant, size_t size)
free_contig(ptr, size);
}
PRIVATE void bad_read1(void)
static void bad_read1(void)
{
/* Test various illegal read transfer requests, part 1.
*/
@@ -445,7 +445,7 @@ PRIVATE void bad_read1(void)
cpf_revoke(grant);
}
PRIVATE u32_t get_sum(u8_t *ptr, size_t size)
static u32_t get_sum(u8_t *ptr, size_t size)
{
/* Compute a checksum over the given buffer.
*/
@@ -457,7 +457,7 @@ PRIVATE u32_t get_sum(u8_t *ptr, size_t size)
return sum;
}
PRIVATE u32_t fill_rand(u8_t *ptr, size_t size)
static u32_t fill_rand(u8_t *ptr, size_t size)
{
/* Fill the given buffer with random data. Return a checksum over the
* resulting data.
@@ -470,7 +470,7 @@ PRIVATE u32_t fill_rand(u8_t *ptr, size_t size)
return get_sum(ptr, size);
}
PRIVATE void test_sum(u8_t *ptr, size_t size, u32_t sum, int should_match,
static void test_sum(u8_t *ptr, size_t size, u32_t sum, int should_match,
result_t *res)
{
/* If the test succeeded so far, check whether the given buffer does
@@ -490,7 +490,7 @@ PRIVATE void test_sum(u8_t *ptr, size_t size, u32_t sum, int should_match,
}
}
PRIVATE void bad_read2(void)
static void bad_read2(void)
{
/* Test various illegal read transfer requests, part 2.
*
@@ -733,7 +733,7 @@ PRIVATE void bad_read2(void)
#define SECTOR_UNALIGN 2 /* word-aligned and sector-unaligned */
PRIVATE void bad_write(void)
static void bad_write(void)
{
/* Test various illegal write transfer requests, if writing is allowed.
* If handled correctly, these requests will not actually write data.
@@ -827,7 +827,7 @@ PRIVATE void bad_write(void)
free_buf_and_grant(buf_ptr, buf_grant, buf_size);
}
PRIVATE void vector_and_large_sub(size_t small_size)
static void vector_and_large_sub(size_t small_size)
{
/* Check whether large vectored requests, and large single requests,
* succeed.
@@ -957,7 +957,7 @@ PRIVATE void vector_and_large_sub(size_t small_size)
free_contig(buf_ptr, buf_size);
}
PRIVATE void vector_and_large(void)
static void vector_and_large(void)
{
/* Check whether large vectored requests, and large single requests,
* succeed. These are request patterns commonly used by MFS and the
@@ -987,7 +987,7 @@ PRIVATE void vector_and_large(void)
}
}
PRIVATE void open_device(dev_t minor)
static void open_device(dev_t minor)
{
/* Open a partition or subpartition. Remember that it has been opened,
* so that we can reopen it later in the event of a driver crash.
@@ -1013,7 +1013,7 @@ PRIVATE void open_device(dev_t minor)
"opening a subpartition");
}
PRIVATE void close_device(dev_t minor)
static void close_device(dev_t minor)
{
/* Close a partition or subpartition. Remove it from the list of opened
* devices.
@@ -1041,7 +1041,7 @@ PRIVATE void close_device(dev_t minor)
"closing a subpartition");
}
PRIVATE int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
static int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
result_t *res)
{
/* Perform an I/O control request, using a local buffer.
@@ -1077,7 +1077,7 @@ PRIVATE int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
return r;
}
PRIVATE void misc_ioctl(void)
static void misc_ioctl(void)
{
/* Test some ioctls.
*/
@@ -1137,7 +1137,7 @@ PRIVATE void misc_ioctl(void)
got_result(&res, "decreased open count after closing");
}
PRIVATE void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
{
/* Test reads up to, across, and beyond partition limits.
*/
@@ -1250,7 +1250,7 @@ PRIVATE void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
free_contig(buf_ptr, buf_size);
}
PRIVATE void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
{
/* Test writes up to, across, and beyond partition limits. Use the
* first given subpartition to test, and the second to make sure there
@@ -1392,7 +1392,7 @@ PRIVATE void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size)
free_contig(buf_ptr, buf_size);
}
PRIVATE void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
static void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
{
/* Create virtual, temporary subpartitions through the DIOCSETP ioctl,
* and perform tests on the resulting subpartitions.
@@ -1459,7 +1459,7 @@ PRIVATE void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
close_device(sub0_minor);
}
PRIVATE void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
static void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
{
/* Create our own subpartitions by writing a partition table, and
* perform tests on the resulting real subpartitions.
@@ -1598,7 +1598,7 @@ PRIVATE void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs)
free_contig(buf_ptr, buf_size);
}
PRIVATE void part_limits(void)
static void part_limits(void)
{
/* Test reads and writes up to, across, and beyond partition limits.
* As a side effect, test reading and writing partition sizes and
@@ -1635,7 +1635,7 @@ PRIVATE void part_limits(void)
}
PRIVATE void unaligned_size_io(u64_t base_pos, u8_t *buf_ptr, size_t buf_size,
static void unaligned_size_io(u64_t base_pos, u8_t *buf_ptr, size_t buf_size,
u8_t *sec_ptr[2], int sectors, int pattern, u32_t ssum[5])
{
/* Perform a single small-element I/O read, write, readback test.
@@ -1804,7 +1804,7 @@ PRIVATE void unaligned_size_io(u64_t base_pos, u8_t *buf_ptr, size_t buf_size,
got_result(&res, "readback verification");
}
PRIVATE void unaligned_size(void)
static void unaligned_size(void)
{
/* Test sector-unaligned sizes in I/O vector elements. The total size
* of the request, however, has to add up to the sector size.
@@ -1905,7 +1905,7 @@ PRIVATE void unaligned_size(void)
free_contig(buf_ptr, buf_size);
}
PRIVATE void unaligned_pos1(void)
static void unaligned_pos1(void)
{
/* Test sector-unaligned positions and total sizes for requests. This
* is a read-only test as no driver currently supports sector-unaligned
@@ -2058,7 +2058,7 @@ PRIVATE void unaligned_pos1(void)
free_contig(buf_ptr, buf_size);
}
PRIVATE void unaligned_pos2(void)
static void unaligned_pos2(void)
{
/* Test sector-unaligned positions and total sizes for requests, second
* part. This one tests the use of multiple I/O vector elements, and
@@ -2202,7 +2202,7 @@ PRIVATE void unaligned_pos2(void)
free_contig(buf_ptr, buf_size);
}
PRIVATE void sweep_area(u64_t base_pos)
static void sweep_area(u64_t base_pos)
{
/* Go over an eight-sector area from left (low address) to right (high
* address), reading and optionally writing in three-sector chunks, and
@@ -2294,7 +2294,7 @@ PRIVATE void sweep_area(u64_t base_pos)
free_contig(buf_ptr, buf_size);
}
PRIVATE void sweep_and_check(u64_t pos, int check_integ)
static void sweep_and_check(u64_t pos, int check_integ)
{
/* Perform an area sweep at the given position. If asked for, get an
* integrity checksum over the beginning of the disk (first writing
@@ -2350,7 +2350,7 @@ PRIVATE void sweep_and_check(u64_t pos, int check_integ)
}
}
PRIVATE void basic_sweep(void)
static void basic_sweep(void)
{
/* Perform a basic area sweep.
*/
@@ -2360,7 +2360,7 @@ PRIVATE void basic_sweep(void)
sweep_area(cvu64(sector_size));
}
PRIVATE void high_disk_pos(void)
static void high_disk_pos(void)
{
/* Test 64-bit absolute disk positions. This means that after adding
* partition base to the given position, the driver will be dealing
@@ -2397,7 +2397,7 @@ PRIVATE void high_disk_pos(void)
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
PRIVATE void high_part_pos(void)
static void high_part_pos(void)
{
/* Test 64-bit partition-relative disk positions. In other words, use
* within the current partition a position that exceeds a 32-bit value.
@@ -2430,7 +2430,7 @@ PRIVATE void high_part_pos(void)
sweep_and_check(base_pos, TRUE);
}
PRIVATE void high_lba_pos1(void)
static void high_lba_pos1(void)
{
/* Test 48-bit LBA positions, as opposed to *24-bit*. Drivers that only
* support 48-bit LBA ATA transfers, will treat the lower and upper 24
@@ -2467,7 +2467,7 @@ PRIVATE void high_lba_pos1(void)
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
PRIVATE void high_lba_pos2(void)
static void high_lba_pos2(void)
{
/* Test 48-bit LBA positions, as opposed to *28-bit*. That means sector
* numbers in excess of 28-bit values; the old ATA upper limit. The
@@ -2501,7 +2501,7 @@ PRIVATE void high_lba_pos2(void)
sweep_and_check(base_pos, !cmp64u(part.base, 0));
}
PRIVATE void high_pos(void)
static void high_pos(void)
{
/* Check whether the driver deals well with 64-bit positions and
* 48-bit LBA addresses. We test three cases: disk byte position beyond
@@ -2528,7 +2528,7 @@ PRIVATE void high_pos(void)
high_lba_pos2();
}
PRIVATE void open_primary(void)
static void open_primary(void)
{
/* Open the primary device. This call has its own test group.
*/
@@ -2538,7 +2538,7 @@ PRIVATE void open_primary(void)
open_device(driver_minor);
}
PRIVATE void close_primary(void)
static void close_primary(void)
{
/* Close the primary device. This call has its own test group.
*/
@@ -2550,7 +2550,7 @@ PRIVATE void close_primary(void)
assert(nr_opened == 0);
}
PRIVATE void do_tests(void)
static void do_tests(void)
{
/* Perform all the tests.
*/
@@ -2584,7 +2584,7 @@ PRIVATE void do_tests(void)
close_primary();
}
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize.
*/
@@ -2611,7 +2611,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
return OK;
}
PRIVATE void sef_local_startup(void)
static void sef_local_startup(void)
{
/* Initialize the SEF framework.
*/
@@ -2621,7 +2621,7 @@ PRIVATE void sef_local_startup(void)
sef_startup();
}
PUBLIC int main(int argc, char **argv)
int main(int argc, char **argv)
{
/* Driver task.
*/

View File

@@ -202,7 +202,7 @@ void test_map(void)
}
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -226,7 +226,7 @@ int main(void)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -3,7 +3,7 @@
char *key_u32 = "test_u32";
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -85,7 +85,7 @@ int main(void)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -4,7 +4,7 @@
#include "com.h"
PRIVATE int do_request(message *m)
static int do_request(message *m)
{
struct vumap_vir vvec[MAPVEC_NR + 3];
struct vumap_phys pvec[MAPVEC_NR + 3];
@@ -36,18 +36,18 @@ PRIVATE int do_request(message *m)
return r;
}
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
return OK;
}
PRIVATE void sef_cb_signal_handler(int sig)
static void sef_cb_signal_handler(int sig)
{
if (sig == SIGTERM)
exit(0);
}
PRIVATE void sef_local_startup(void)
static void sef_local_startup(void)
{
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_signal_handler(sef_cb_signal_handler);
@@ -55,7 +55,7 @@ PRIVATE void sef_local_startup(void)
sef_startup();
}
PUBLIC int main(int argc, char **argv)
int main(int argc, char **argv)
{
message m;
int r;

View File

@@ -15,28 +15,28 @@ struct buf {
#define BUF_PREALLOC 0x1 /* if set, immediately allocate the page */
#define BUF_ADJACENT 0x2 /* virtually contiguous with the last buffer */
PRIVATE unsigned int count = 0, failures = 0;
static unsigned int count = 0, failures = 0;
PRIVATE int success;
PRIVATE char *fail_file;
PRIVATE int fail_line;
static int success;
static char *fail_file;
static int fail_line;
PRIVATE int relay;
PRIVATE endpoint_t endpt;
static int relay;
static endpoint_t endpt;
PRIVATE int verbose;
static int verbose;
PRIVATE enum {
static enum {
GE_NONE, /* no exception */
GE_REVOKED, /* revoked grant */
GE_INVALID /* invalid grant */
} grant_exception = GE_NONE;
PRIVATE int grant_access = 0;
static int grant_access = 0;
#define expect(r) expect_f((r), __FILE__, __LINE__)
PRIVATE void alloc_buf(struct buf *buf, phys_bytes next)
static void alloc_buf(struct buf *buf, phys_bytes next)
{
void *tmp = NULL;
vir_bytes addr;
@@ -108,7 +108,7 @@ PRIVATE void alloc_buf(struct buf *buf, phys_bytes next)
panic("unable to allocate noncontiguous range");
}
PRIVATE void alloc_bufs(struct buf *buf, int count)
static void alloc_bufs(struct buf *buf, int count)
{
static vir_bytes base = 0x80000000L;
phys_bytes next;
@@ -141,7 +141,7 @@ PRIVATE void alloc_bufs(struct buf *buf, int count)
#endif
}
PRIVATE void free_bufs(struct buf *buf, int count)
static void free_bufs(struct buf *buf, int count)
{
int i, j, r;
@@ -156,7 +156,7 @@ PRIVATE void free_bufs(struct buf *buf, int count)
}
}
PRIVATE int is_allocated(vir_bytes addr, size_t bytes, phys_bytes *phys)
static int is_allocated(vir_bytes addr, size_t bytes, phys_bytes *phys)
{
int r;
@@ -170,19 +170,19 @@ PRIVATE int is_allocated(vir_bytes addr, size_t bytes, phys_bytes *phys)
return r == OK;
}
PRIVATE int is_buf_allocated(struct buf *buf)
static int is_buf_allocated(struct buf *buf)
{
return is_allocated(buf->addr, buf->pages * PAGE_SIZE, &buf->phys);
}
PRIVATE void test_group(char *name)
static void test_group(char *name)
{
if (verbose)
printf("Test group: %s (%s)\n",
name, relay ? "relay" : "local");
}
PRIVATE void expect_f(int res, char *file, int line)
static void expect_f(int res, char *file, int line)
{
if (!res && success) {
success = FALSE;
@@ -191,7 +191,7 @@ PRIVATE void expect_f(int res, char *file, int line)
}
}
PRIVATE void got_result(char *desc)
static void got_result(char *desc)
{
count++;
@@ -206,7 +206,7 @@ PRIVATE void got_result(char *desc)
}
}
PRIVATE int relay_vumap(struct vumap_vir *vvec, int vcount, size_t offset,
static int relay_vumap(struct vumap_vir *vvec, int vcount, size_t offset,
int access, struct vumap_phys *pvec, int *pcount)
{
struct vumap_vir gvvec[MAPVEC_NR + 3];
@@ -266,7 +266,7 @@ PRIVATE int relay_vumap(struct vumap_vir *vvec, int vcount, size_t offset,
return (r != OK) ? r : m.m_type;
}
PRIVATE int do_vumap(endpoint_t endpt, struct vumap_vir *vvec, int vcount,
static int do_vumap(endpoint_t endpt, struct vumap_vir *vvec, int vcount,
size_t offset, int access, struct vumap_phys *pvec, int *pcount)
{
struct vumap_phys pv_backup[MAPVEC_NR + 3];
@@ -308,7 +308,7 @@ PRIVATE int do_vumap(endpoint_t endpt, struct vumap_vir *vvec, int vcount,
return r;
}
PRIVATE void test_basics(void)
static void test_basics(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[4];
@@ -499,7 +499,7 @@ PRIVATE void test_basics(void)
free_bufs(buf, 4);
}
PRIVATE void test_endpt(void)
static void test_endpt(void)
{
struct vumap_vir vvec[1];
struct vumap_phys pvec[1];
@@ -538,7 +538,7 @@ PRIVATE void test_endpt(void)
free_bufs(buf, 1);
}
PRIVATE void test_vector1(void)
static void test_vector1(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
@@ -599,7 +599,7 @@ PRIVATE void test_vector1(void)
free_bufs(buf, 2);
}
PRIVATE void test_vector2(void)
static void test_vector2(void)
{
struct vumap_vir vvec[2], *vvecp;
struct vumap_phys pvec[3], *pvecp;
@@ -710,7 +710,7 @@ PRIVATE void test_vector2(void)
free_bufs(buf, 2);
}
PRIVATE void test_grant(void)
static void test_grant(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
@@ -805,7 +805,7 @@ PRIVATE void test_grant(void)
free_bufs(buf, 2);
}
PRIVATE void test_offset(void)
static void test_offset(void)
{
struct vumap_vir vvec[2];
struct vumap_phys pvec[3];
@@ -943,7 +943,7 @@ PRIVATE void test_offset(void)
free_bufs(buf, 4);
}
PRIVATE void test_access(void)
static void test_access(void)
{
struct vumap_vir vvec[3];
struct vumap_phys pvec[4], *pvecp;
@@ -1130,7 +1130,7 @@ PRIVATE void test_access(void)
*/
}
PRIVATE void phys_limit(struct vumap_vir *vvec, int vcount,
static void phys_limit(struct vumap_vir *vvec, int vcount,
struct vumap_phys *pvec, int pcount, struct buf *buf, char *desc)
{
int i, r;
@@ -1147,7 +1147,7 @@ PRIVATE void phys_limit(struct vumap_vir *vvec, int vcount,
got_result(desc);
}
PRIVATE void test_limits(void)
static void test_limits(void)
{
struct vumap_vir vvec[MAPVEC_NR + 3];
struct vumap_phys pvec[MAPVEC_NR + 3];
@@ -1345,7 +1345,7 @@ PRIVATE void test_limits(void)
free_bufs(buf, nr_bufs);
}
PRIVATE void do_tests(int use_relay)
static void do_tests(int use_relay)
{
relay = use_relay;
@@ -1366,7 +1366,7 @@ PRIVATE void do_tests(int use_relay)
test_limits();
}
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
int r;
@@ -1392,14 +1392,14 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
return (failures) ? EINVAL : OK;
}
PRIVATE void sef_local_startup(void)
static void sef_local_startup(void)
{
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_startup();
}
PUBLIC int main(int argc, char **argv)
int main(int argc, char **argv)
{
env_setargs(argc, argv);

View File

@@ -3,7 +3,7 @@
char buf_buf[BUF_SIZE + CLICK_SIZE];
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -36,7 +36,7 @@ int test(size_t size)
}
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -5,7 +5,7 @@ char buf_buf[BUF_SIZE + CLICK_SIZE];
int fid_send, fid_get;
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -8,7 +8,7 @@ char *buf;
int fid_send, fid_get;
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -145,7 +145,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -5,7 +5,7 @@ char buf_buf[BUF_SIZE + CLICK_SIZE];
int fid_send, fid_get;
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* main *
@@ -54,7 +54,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -8,7 +8,7 @@ char *buf;
int fid_send, fid_get;
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
static void sef_local_startup(void);
/*===========================================================================*
* read_write_buff *
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();

View File

@@ -17,21 +17,21 @@
#define MAX_ERROR 5
#include "common.c"
PUBLIC int errct;
PRIVATE int count, condition_met;
PRIVATE int th_a, th_b, th_c, th_d, th_e, th_f, th_g, th_h;
PRIVATE int mutex_a_step, mutex_b_step, mutex_c_step;
PRIVATE mutex_t mu[3];
PRIVATE cond_t condition;
PRIVATE mutex_t *count_mutex, *condition_mutex;
PRIVATE once_t once;
PRIVATE key_t key[MTHREAD_KEYS_MAX+1];
PRIVATE int values[4];
PRIVATE int first;
PRIVATE event_t event;
PRIVATE int event_a_step, event_b_step;
PRIVATE rwlock_t rwlock;
PRIVATE int rwlock_a_step, rwlock_b_step;
int errct;
static int count, condition_met;
static int th_a, th_b, th_c, th_d, th_e, th_f, th_g, th_h;
static int mutex_a_step, mutex_b_step, mutex_c_step;
static mutex_t mu[3];
static cond_t condition;
static mutex_t *count_mutex, *condition_mutex;
static once_t once;
static key_t key[MTHREAD_KEYS_MAX+1];
static int values[4];
static int first;
static event_t event;
static int event_a_step, event_b_step;
static rwlock_t rwlock;
static int rwlock_a_step, rwlock_b_step;
#define VERIFY_RWLOCK(a, b, esub, eno) \
GEN_VERIFY(rwlock_a_step, a, rwlock_b_step, b, esub, eno)
@@ -61,27 +61,27 @@ PRIVATE int rwlock_a_step, rwlock_b_step;
#define MEG 1024*1024
#define MAGIC ((signed) 0xb4a3f1c2)
FORWARD void destr_a(void *arg);
FORWARD void destr_b(void *arg);
FORWARD void *thread_a(void *arg);
FORWARD void *thread_b(void *arg);
FORWARD void *thread_c(void *arg);
FORWARD void *thread_d(void *arg);
FORWARD void thread_e(void);
FORWARD void *thread_f(void *arg);
FORWARD void *thread_g(void *arg);
FORWARD void *thread_h(void *arg);
FORWARD void test_scheduling(void);
FORWARD void test_mutex(void);
FORWARD void test_condition(void);
FORWARD void test_attributes(void);
FORWARD void test_keys(void);
FORWARD void err(int subtest, int error);
static void destr_a(void *arg);
static void destr_b(void *arg);
static void *thread_a(void *arg);
static void *thread_b(void *arg);
static void *thread_c(void *arg);
static void *thread_d(void *arg);
static void thread_e(void);
static void *thread_f(void *arg);
static void *thread_g(void *arg);
static void *thread_h(void *arg);
static void test_scheduling(void);
static void test_mutex(void);
static void test_condition(void);
static void test_attributes(void);
static void test_keys(void);
static void err(int subtest, int error);
/*===========================================================================*
* thread_a *
*===========================================================================*/
PRIVATE void *thread_a(void *arg) {
static void *thread_a(void *arg) {
th_a++;
return(NULL);
}
@@ -90,7 +90,7 @@ PRIVATE void *thread_a(void *arg) {
/*===========================================================================*
* thread_b *
*===========================================================================*/
PRIVATE void *thread_b(void *arg) {
static void *thread_b(void *arg) {
th_b++;
if (mthread_once(&once, thread_e) != 0) err(10, 1);
return(NULL);
@@ -100,7 +100,7 @@ PRIVATE void *thread_b(void *arg) {
/*===========================================================================*
* thread_c *
*===========================================================================*/
PRIVATE void *thread_c(void *arg) {
static void *thread_c(void *arg) {
th_c++;
return(NULL);
}
@@ -109,7 +109,7 @@ PRIVATE void *thread_c(void *arg) {
/*===========================================================================*
* thread_d *
*===========================================================================*/
PRIVATE void *thread_d(void *arg) {
static void *thread_d(void *arg) {
th_d++;
mthread_exit(NULL); /* Thread wants to stop running */
return(NULL);
@@ -119,7 +119,7 @@ PRIVATE void *thread_d(void *arg) {
/*===========================================================================*
* thread_e *
*===========================================================================*/
PRIVATE void thread_e(void) {
static void thread_e(void) {
th_e++;
}
@@ -127,7 +127,7 @@ PRIVATE void thread_e(void) {
/*===========================================================================*
* thread_f *
*===========================================================================*/
PRIVATE void *thread_f(void *arg) {
static void *thread_f(void *arg) {
if (mthread_mutex_lock(condition_mutex) != 0) err(12, 1);
th_f++;
if (mthread_cond_signal(&condition) != 0) err(12, 2);
@@ -139,7 +139,7 @@ PRIVATE void *thread_f(void *arg) {
/*===========================================================================*
* thread_g *
*===========================================================================*/
PRIVATE void *thread_g(void *arg) {
static void *thread_g(void *arg) {
char bigarray[MTHREAD_STACK_MIN + 1];
if (mthread_mutex_lock(condition_mutex) != 0) err(13, 1);
memset(bigarray, '\0', MTHREAD_STACK_MIN + 1); /* Actually allocate it */
@@ -153,7 +153,7 @@ PRIVATE void *thread_g(void *arg) {
/*===========================================================================*
* thread_h *
*===========================================================================*/
PRIVATE void *thread_h(void *arg) {
static void *thread_h(void *arg) {
char bigarray[2 * MEG];
int reply;
if (mthread_mutex_lock(condition_mutex) != 0) err(14, 1);
@@ -170,7 +170,7 @@ PRIVATE void *thread_h(void *arg) {
/*===========================================================================*
* err *
*===========================================================================*/
PRIVATE void err(int sub, int error) {
static void err(int sub, int error) {
/* As we're running with multiple threads, they might all clobber the
* subtest variable. This wrapper prevents that from happening. */
@@ -182,7 +182,7 @@ PRIVATE void err(int sub, int error) {
/*===========================================================================*
* test_scheduling *
*===========================================================================*/
PRIVATE void test_scheduling(void)
static void test_scheduling(void)
{
unsigned int i;
thread_t t[7];
@@ -247,7 +247,7 @@ PRIVATE void test_scheduling(void)
/*===========================================================================*
* mutex_a *
*===========================================================================*/
PRIVATE void *mutex_a(void *arg)
static void *mutex_a(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
@@ -303,7 +303,7 @@ PRIVATE void *mutex_a(void *arg)
/*===========================================================================*
* mutex_b *
*===========================================================================*/
PRIVATE void *mutex_b(void *arg)
static void *mutex_b(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
@@ -339,7 +339,7 @@ PRIVATE void *mutex_b(void *arg)
/*===========================================================================*
* mutex_c *
*===========================================================================*/
PRIVATE void *mutex_c(void *arg)
static void *mutex_c(void *arg)
{
mutex_t *mu = (mutex_t *) arg;
@@ -367,7 +367,7 @@ PRIVATE void *mutex_c(void *arg)
/*===========================================================================*
* test_mutex *
*===========================================================================*/
PRIVATE void test_mutex(void)
static void test_mutex(void)
{
unsigned int i;
thread_t t[3];
@@ -413,7 +413,7 @@ PRIVATE void test_mutex(void)
/*===========================================================================*
* cond_a *
*===========================================================================*/
PRIVATE void *cond_a(void *arg)
static void *cond_a(void *arg)
{
cond_t c;
int did_count = 0;
@@ -462,7 +462,7 @@ PRIVATE void *cond_a(void *arg)
/*===========================================================================*
* cond_b *
*===========================================================================*/
PRIVATE void *cond_b(void *arg)
static void *cond_b(void *arg)
{
int did_count = 0;
while(1) {
@@ -489,7 +489,7 @@ PRIVATE void *cond_b(void *arg)
/*===========================================================================*
* cond_broadcast *
*===========================================================================*/
PRIVATE void *cond_broadcast(void *arg)
static void *cond_broadcast(void *arg)
{
if (mthread_mutex_lock(condition_mutex) != 0) err(9, 1);
@@ -507,7 +507,7 @@ PRIVATE void *cond_broadcast(void *arg)
/*===========================================================================*
* test_condition *
*===========================================================================*/
PRIVATE void test_condition(void)
static void test_condition(void)
{
#define NTHREADS 10
int i;
@@ -595,7 +595,7 @@ PRIVATE void test_condition(void)
/*===========================================================================*
* test_attributes *
*===========================================================================*/
PRIVATE void test_attributes(void)
static void test_attributes(void)
{
attr_t tattr;
thread_t tid;
@@ -765,7 +765,7 @@ PRIVATE void test_attributes(void)
/*===========================================================================*
* destr_a *
*===========================================================================*/
PRIVATE void destr_a(void *value)
static void destr_a(void *value)
{
int num;
@@ -782,7 +782,7 @@ PRIVATE void destr_a(void *value)
/*===========================================================================*
* destr_b *
*===========================================================================*/
PRIVATE void destr_b(void *value)
static void destr_b(void *value)
{
/* This destructor must never trigger. */
err(16, 1);
@@ -791,7 +791,7 @@ PRIVATE void destr_b(void *value)
/*===========================================================================*
* key_a *
*===========================================================================*/
PRIVATE void *key_a(void *arg)
static void *key_a(void *arg)
{
int i;
@@ -823,7 +823,7 @@ PRIVATE void *key_a(void *arg)
/*===========================================================================*
* key_b *
*===========================================================================*/
PRIVATE void *key_b(void *arg)
static void *key_b(void *arg)
{
int i;
@@ -849,7 +849,7 @@ PRIVATE void *key_b(void *arg)
/*===========================================================================*
* key_c *
*===========================================================================*/
PRIVATE void *key_c(void *arg)
static void *key_c(void *arg)
{
/* The only thing that this thread should do, is set a value. */
if (mthread_setspecific(key[0], (void *) mthread_self()) != 0) err(19, 1);
@@ -864,7 +864,7 @@ PRIVATE void *key_c(void *arg)
/*===========================================================================*
* test_keys *
*===========================================================================*/
PRIVATE void test_keys(void)
static void test_keys(void)
{
thread_t t[24];
int i, j;
@@ -939,7 +939,7 @@ PRIVATE void test_keys(void)
/*===========================================================================*
* event_a *
*===========================================================================*/
PRIVATE void *event_a(void *arg)
static void *event_a(void *arg)
{
VERIFY_EVENT(0, 0, 21, 1);
@@ -963,7 +963,7 @@ PRIVATE void *event_a(void *arg)
/*===========================================================================*
* event_b *
*===========================================================================*/
PRIVATE void *event_b(void *arg)
static void *event_b(void *arg)
{
VERIFY_EVENT(0, 0, 22, 1);
@@ -983,7 +983,7 @@ PRIVATE void *event_b(void *arg)
/*===========================================================================*
* test_event *
*===========================================================================*/
PRIVATE void test_event(void)
static void test_event(void)
{
thread_t t[2];
int i;
@@ -1022,7 +1022,7 @@ PRIVATE void test_event(void)
/*===========================================================================*
* rwlock_a *
*===========================================================================*/
PRIVATE void *rwlock_a(void *arg)
static void *rwlock_a(void *arg)
{
/* acquire read lock */
VERIFY_RWLOCK(0, 0, 24, 1);
@@ -1052,7 +1052,7 @@ PRIVATE void *rwlock_a(void *arg)
/*===========================================================================*
* rwlock_b *
*===========================================================================*/
PRIVATE void *rwlock_b(void *arg)
static void *rwlock_b(void *arg)
{
/* Step 1: acquire the read lock */
VERIFY_RWLOCK(1, 0, 25, 1);
@@ -1078,7 +1078,7 @@ PRIVATE void *rwlock_b(void *arg)
/*===========================================================================*
* test_rwlock *
*===========================================================================*/
PRIVATE void test_rwlock(void)
static void test_rwlock(void)
{
thread_t t[2];
int i;