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

@@ -48,13 +48,13 @@
#include "trace.h"
/* Management data for opened devices. */
PRIVATE int open_devs[MAX_NR_OPEN_DEVICES];
PRIVATE int next_open_devs_slot = 0;
static int open_devs[MAX_NR_OPEN_DEVICES];
static int next_open_devs_slot = 0;
/*===========================================================================*
* clear_open_devs *
*===========================================================================*/
PRIVATE void clear_open_devs(void)
static void clear_open_devs(void)
{
/* Reset the set of previously opened minor devices. */
next_open_devs_slot = 0;
@@ -63,7 +63,7 @@ PRIVATE void clear_open_devs(void)
/*===========================================================================*
* is_open_dev *
*===========================================================================*/
PRIVATE int is_open_dev(int device)
static int is_open_dev(int device)
{
/* Check whether the given minor device has previously been opened. */
int i;
@@ -78,7 +78,7 @@ PRIVATE int is_open_dev(int device)
/*===========================================================================*
* set_open_dev *
*===========================================================================*/
PRIVATE void set_open_dev(int device)
static void set_open_dev(int device)
{
/* Mark the given minor device as having been opened. */
@@ -92,7 +92,7 @@ PRIVATE void set_open_dev(int device)
/*===========================================================================*
* blockdriver_announce *
*===========================================================================*/
PUBLIC void blockdriver_announce(int type)
void blockdriver_announce(int type)
{
/* Announce we are up after a fresh start or a restart. */
int r;
@@ -130,7 +130,7 @@ PUBLIC void blockdriver_announce(int type)
/*===========================================================================*
* blockdriver_reply *
*===========================================================================*/
PUBLIC void blockdriver_reply(message *m_ptr, int ipc_status, int reply)
void blockdriver_reply(message *m_ptr, int ipc_status, int reply)
{
/* Reply to a block request sent to the driver. */
endpoint_t caller_e;
@@ -167,7 +167,7 @@ PUBLIC void blockdriver_reply(message *m_ptr, int ipc_status, int reply)
/*===========================================================================*
* do_open *
*===========================================================================*/
PRIVATE int do_open(struct blockdriver *bdp, message *mp)
static int do_open(struct blockdriver *bdp, message *mp)
{
/* Open a minor device. */
@@ -177,7 +177,7 @@ PRIVATE int do_open(struct blockdriver *bdp, message *mp)
/*===========================================================================*
* do_close *
*===========================================================================*/
PRIVATE int do_close(struct blockdriver *bdp, message *mp)
static int do_close(struct blockdriver *bdp, message *mp)
{
/* Close a minor device. */
@@ -187,7 +187,7 @@ PRIVATE int do_close(struct blockdriver *bdp, message *mp)
/*===========================================================================*
* do_rdwt *
*===========================================================================*/
PRIVATE int do_rdwt(struct blockdriver *bdp, message *mp)
static int do_rdwt(struct blockdriver *bdp, message *mp)
{
/* Carry out a single read or write request. */
iovec_t iovec1;
@@ -216,7 +216,7 @@ PRIVATE int do_rdwt(struct blockdriver *bdp, message *mp)
/*===========================================================================*
* do_vrdwt *
*===========================================================================*/
PRIVATE int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
{
/* Carry out an device read or write to/from a vector of buffers. */
iovec_t iovec[NR_IOREQS];
@@ -257,7 +257,7 @@ PRIVATE int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
/*===========================================================================*
* do_dioctl *
*===========================================================================*/
PRIVATE int do_dioctl(struct blockdriver *bdp, dev_t minor,
static int do_dioctl(struct blockdriver *bdp, dev_t minor,
unsigned int request, endpoint_t endpt, cp_grant_id_t grant)
{
/* Carry out a disk-specific I/O control request. */
@@ -307,7 +307,7 @@ PRIVATE int do_dioctl(struct blockdriver *bdp, dev_t minor,
/*===========================================================================*
* do_ioctl *
*===========================================================================*/
PRIVATE int do_ioctl(struct blockdriver *bdp, message *mp)
static int do_ioctl(struct blockdriver *bdp, message *mp)
{
/* Carry out an I/O control request. We forward block trace control requests
* to the tracing module, and handle setting/getting partitions when the driver
@@ -355,7 +355,7 @@ PRIVATE int do_ioctl(struct blockdriver *bdp, message *mp)
/*===========================================================================*
* blockdriver_handle_notify *
*===========================================================================*/
PUBLIC void blockdriver_handle_notify(struct blockdriver *bdp, message *m_ptr)
void blockdriver_handle_notify(struct blockdriver *bdp, message *m_ptr)
{
/* Take care of the notifications (interrupt and clock messages) by calling
* the appropiate callback functions. Never send a reply.
@@ -382,7 +382,7 @@ PUBLIC void blockdriver_handle_notify(struct blockdriver *bdp, message *m_ptr)
/*===========================================================================*
* blockdriver_handle_request *
*===========================================================================*/
PUBLIC int blockdriver_handle_request(struct blockdriver *bdp, message *m_ptr,
int blockdriver_handle_request(struct blockdriver *bdp, message *m_ptr,
thread_id_t id)
{
/* Call the appropiate driver function, based on the type of request. Return

View File

@@ -53,20 +53,20 @@ typedef struct {
mthread_rwlock_t barrier;
} device_t;
PRIVATE struct blockdriver *bdtab;
PRIVATE int running = FALSE;
static struct blockdriver *bdtab;
static int running = FALSE;
PRIVATE mthread_key_t worker_key;
static mthread_key_t worker_key;
PRIVATE device_t device[MAX_DEVICES];
static device_t device[MAX_DEVICES];
PRIVATE worker_t *exited[MAX_THREADS];
PRIVATE int num_exited = 0;
static worker_t *exited[MAX_THREADS];
static int num_exited = 0;
/*===========================================================================*
* enqueue *
*===========================================================================*/
PRIVATE void enqueue(device_t *dp, const message *m_src, int ipc_status)
static void enqueue(device_t *dp, const message *m_src, int ipc_status)
{
/* Enqueue a message into the device's queue, and signal the event.
* Must be called from the master thread.
@@ -81,7 +81,7 @@ PRIVATE void enqueue(device_t *dp, const message *m_src, int ipc_status)
/*===========================================================================*
* try_dequeue *
*===========================================================================*/
PRIVATE int try_dequeue(device_t *dp, message *m_dst, int *ipc_status)
static int try_dequeue(device_t *dp, message *m_dst, int *ipc_status)
{
/* See if a message can be dequeued from the current worker thread's device
* queue. If so, dequeue the message and return TRUE. If not, return FALSE.
@@ -94,7 +94,7 @@ PRIVATE int try_dequeue(device_t *dp, message *m_dst, int *ipc_status)
/*===========================================================================*
* dequeue *
*===========================================================================*/
PRIVATE int dequeue(device_t *dp, worker_t *wp, message *m_dst,
static int dequeue(device_t *dp, worker_t *wp, message *m_dst,
int *ipc_status)
{
/* Dequeue a message from the current worker thread's device queue. Block the
@@ -119,7 +119,7 @@ PRIVATE int dequeue(device_t *dp, worker_t *wp, message *m_dst,
/*===========================================================================*
* is_transfer_req *
*===========================================================================*/
PRIVATE int is_transfer_req(int type)
static int is_transfer_req(int type)
{
/* Return whether the given block device request is a transfer request.
*/
@@ -139,7 +139,7 @@ PRIVATE int is_transfer_req(int type)
/*===========================================================================*
* worker_thread *
*===========================================================================*/
PRIVATE void *worker_thread(void *param)
static void *worker_thread(void *param)
{
/* The worker thread loop. Set up the thread-specific reference to itself and
* start looping. The loop consists of blocking dequeing and handling messages.
@@ -207,7 +207,7 @@ PRIVATE void *worker_thread(void *param)
/*===========================================================================*
* master_create_worker *
*===========================================================================*/
PRIVATE void master_create_worker(worker_t *wp, worker_id_t worker_id,
static void master_create_worker(worker_t *wp, worker_id_t worker_id,
device_id_t device_id)
{
/* Start a new worker thread.
@@ -240,7 +240,7 @@ PRIVATE void master_create_worker(worker_t *wp, worker_id_t worker_id,
/*===========================================================================*
* master_destroy_worker *
*===========================================================================*/
PRIVATE void master_destroy_worker(worker_t *wp)
static void master_destroy_worker(worker_t *wp)
{
/* Clean up resources used by an exited worker thread.
*/
@@ -261,7 +261,7 @@ PRIVATE void master_destroy_worker(worker_t *wp)
/*===========================================================================*
* master_handle_exits *
*===========================================================================*/
PRIVATE void master_handle_exits(void)
static void master_handle_exits(void)
{
/* Destroy the remains of all exited threads.
*/
@@ -276,7 +276,7 @@ PRIVATE void master_handle_exits(void)
/*===========================================================================*
* master_handle_request *
*===========================================================================*/
PRIVATE void master_handle_request(message *m_ptr, int ipc_status)
static void master_handle_request(message *m_ptr, int ipc_status)
{
/* For real request messages, query the device ID, start a thread if none is
* free and the maximum number of threads for that device has not yet been
@@ -337,7 +337,7 @@ PRIVATE void master_handle_request(message *m_ptr, int ipc_status)
/*===========================================================================*
* master_init *
*===========================================================================*/
PRIVATE void master_init(struct blockdriver *bdp)
static void master_init(struct blockdriver *bdp)
{
/* Initialize the state of the master thread.
*/
@@ -371,7 +371,7 @@ PRIVATE void master_init(struct blockdriver *bdp)
/*===========================================================================*
* blockdriver_mt_get_tid *
*===========================================================================*/
PUBLIC thread_id_t blockdriver_mt_get_tid(void)
thread_id_t blockdriver_mt_get_tid(void)
{
/* Return back the ID of this thread.
*/
@@ -388,7 +388,7 @@ PUBLIC thread_id_t blockdriver_mt_get_tid(void)
/*===========================================================================*
* blockdriver_mt_receive *
*===========================================================================*/
PRIVATE void blockdriver_mt_receive(message *m_ptr, int *ipc_status)
static void blockdriver_mt_receive(message *m_ptr, int *ipc_status)
{
/* Receive a message.
*/
@@ -403,7 +403,7 @@ PRIVATE void blockdriver_mt_receive(message *m_ptr, int *ipc_status)
/*===========================================================================*
* blockdriver_mt_task *
*===========================================================================*/
PUBLIC void blockdriver_mt_task(struct blockdriver *driver_tab)
void blockdriver_mt_task(struct blockdriver *driver_tab)
{
/* The multithreaded driver task.
*/
@@ -444,7 +444,7 @@ PUBLIC void blockdriver_mt_task(struct blockdriver *driver_tab)
/*===========================================================================*
* blockdriver_mt_terminate *
*===========================================================================*/
PUBLIC void blockdriver_mt_terminate(void)
void blockdriver_mt_terminate(void)
{
/* Instruct libblockdriver to shut down.
*/
@@ -455,7 +455,7 @@ PUBLIC void blockdriver_mt_terminate(void)
/*===========================================================================*
* blockdriver_mt_sleep *
*===========================================================================*/
PUBLIC void blockdriver_mt_sleep(void)
void blockdriver_mt_sleep(void)
{
/* Let the current thread sleep until it gets woken up by the master thread.
*/
@@ -472,7 +472,7 @@ PUBLIC void blockdriver_mt_sleep(void)
/*===========================================================================*
* blockdriver_mt_wakeup *
*===========================================================================*/
PUBLIC void blockdriver_mt_wakeup(thread_id_t id)
void blockdriver_mt_wakeup(thread_id_t id)
{
/* Wake up a sleeping worker thread from the master thread.
*/
@@ -496,7 +496,7 @@ PUBLIC void blockdriver_mt_wakeup(thread_id_t id)
/*===========================================================================*
* blockdriver_mt_set_workers *
*===========================================================================*/
PUBLIC void blockdriver_mt_set_workers(device_id_t id, int workers)
void blockdriver_mt_set_workers(device_id_t id, int workers)
{
/* Set the number of worker threads for the given device.
*/

View File

@@ -18,12 +18,12 @@
#include "driver.h"
#include "mq.h"
PRIVATE int running;
static int running;
/*===========================================================================*
* blockdriver_receive_mq *
*===========================================================================*/
PUBLIC int blockdriver_receive_mq(message *m_ptr, int *status_ptr)
int blockdriver_receive_mq(message *m_ptr, int *status_ptr)
{
/* receive() interface for drivers with message queueing. */
@@ -38,7 +38,7 @@ PUBLIC int blockdriver_receive_mq(message *m_ptr, int *status_ptr)
/*===========================================================================*
* blockdriver_terminate *
*===========================================================================*/
PUBLIC void blockdriver_terminate(void)
void blockdriver_terminate(void)
{
/* Break out of the main driver loop after finishing the current request. */
@@ -48,7 +48,7 @@ PUBLIC void blockdriver_terminate(void)
/*===========================================================================*
* blockdriver_task *
*===========================================================================*/
PUBLIC void blockdriver_task(struct blockdriver *bdp)
void blockdriver_task(struct blockdriver *bdp)
{
/* Main program of any block device driver task. */
int r, ipc_status;
@@ -70,7 +70,7 @@ PUBLIC void blockdriver_task(struct blockdriver *bdp)
/*===========================================================================*
* blockdriver_process *
*===========================================================================*/
PUBLIC void blockdriver_process(struct blockdriver *bdp, message *m_ptr,
void blockdriver_process(struct blockdriver *bdp, message *m_ptr,
int ipc_status)
{
/* Handle the given received message. */
@@ -91,7 +91,7 @@ PUBLIC void blockdriver_process(struct blockdriver *bdp, message *m_ptr,
/*===========================================================================*
* blockdriver_mq_queue *
*===========================================================================*/
PUBLIC int blockdriver_mq_queue(message *m, int status)
int blockdriver_mq_queue(message *m, int status)
{
/* Queue a message for later processing. */

View File

@@ -11,18 +11,18 @@
/* Extended partition? */
#define ext_part(s) ((s) == 0x05 || (s) == 0x0F)
FORWARD void parse_part_table(struct blockdriver *bdp, int device, int
static void parse_part_table(struct blockdriver *bdp, int device, int
style, int atapi, u8_t *tmp_buf);
FORWARD void extpartition(struct blockdriver *bdp, int extdev, unsigned
static void extpartition(struct blockdriver *bdp, int extdev, unsigned
long extbase, u8_t *tmp_buf);
FORWARD int get_part_table(struct blockdriver *bdp, int device, unsigned
static int get_part_table(struct blockdriver *bdp, int device, unsigned
long offset, struct part_entry *table, u8_t *tmp_buf);
FORWARD void sort(struct part_entry *table);
static void sort(struct part_entry *table);
/*============================================================================*
* partition *
*============================================================================*/
PUBLIC void partition(bdp, device, style, atapi)
void partition(bdp, device, style, atapi)
struct blockdriver *bdp; /* device dependent entry points */
int device; /* device to partition */
int style; /* partitioning style: floppy, primary, sub. */
@@ -51,7 +51,7 @@ int atapi; /* atapi device */
/*============================================================================*
* parse_part_table *
*============================================================================*/
PRIVATE void parse_part_table(bdp, device, style, atapi, tmp_buf)
static void parse_part_table(bdp, device, style, atapi, tmp_buf)
struct blockdriver *bdp; /* device dependent entry points */
int device; /* device to partition */
int style; /* partitioning style: floppy, primary, sub. */
@@ -128,7 +128,7 @@ u8_t *tmp_buf; /* temporary buffer */
/*============================================================================*
* extpartition *
*============================================================================*/
PRIVATE void extpartition(bdp, extdev, extbase, tmp_buf)
static void extpartition(bdp, extdev, extbase, tmp_buf)
struct blockdriver *bdp; /* device dependent entry points */
int extdev; /* extended partition to scan */
unsigned long extbase; /* sector offset of the base ext. partition */
@@ -177,7 +177,7 @@ u8_t *tmp_buf; /* temporary buffer */
/*============================================================================*
* get_part_table *
*============================================================================*/
PRIVATE int get_part_table(bdp, device, offset, table, tmp_buf)
static int get_part_table(bdp, device, offset, table, tmp_buf)
struct blockdriver *bdp;
int device;
unsigned long offset; /* sector offset to the table */
@@ -210,7 +210,7 @@ u8_t *tmp_buf; /* temporary buffer */
/*===========================================================================*
* sort *
*===========================================================================*/
PRIVATE void sort(table)
static void sort(table)
struct part_entry *table;
{
/* Sort a partition table. */

View File

@@ -21,14 +21,14 @@ struct mq_cell {
STAILQ_ENTRY(mq_cell) next;
};
PRIVATE struct mq_cell pool[MQ_SIZE];
PRIVATE STAILQ_HEAD(queue, mq_cell) queue[MAX_DEVICES];
PRIVATE STAILQ_HEAD(free_list, mq_cell) free_list;
static struct mq_cell pool[MQ_SIZE];
static STAILQ_HEAD(queue, mq_cell) queue[MAX_DEVICES];
static STAILQ_HEAD(free_list, mq_cell) free_list;
/*===========================================================================*
* mq_init *
*===========================================================================*/
PUBLIC void mq_init(void)
void mq_init(void)
{
/* Initialize the message queues and message cells.
*/
@@ -46,7 +46,7 @@ PUBLIC void mq_init(void)
/*===========================================================================*
* mq_enqueue *
*===========================================================================*/
PUBLIC int mq_enqueue(device_id_t device_id, const message *mess,
int mq_enqueue(device_id_t device_id, const message *mess,
int ipc_status)
{
/* Add a message, including its IPC status, to the message queue of a device.
@@ -73,7 +73,7 @@ PUBLIC int mq_enqueue(device_id_t device_id, const message *mess,
/*===========================================================================*
* mq_dequeue *
*===========================================================================*/
PUBLIC int mq_dequeue(device_id_t device_id, message *mess, int *ipc_status)
int mq_dequeue(device_id_t device_id, message *mess, int *ipc_status)
{
/* Return and remove a message, including its IPC status, from the message
* queue of a thread. Return TRUE iff a message was available.

View File

@@ -13,24 +13,24 @@
#define NO_TRACEDEV ((dev_t) -1)
#define NO_TIME ((u32_t) -1)
PRIVATE int trace_enabled = FALSE;
PRIVATE dev_t trace_dev = NO_TRACEDEV;
PRIVATE btrace_entry *trace_buf = NULL;
PRIVATE size_t trace_size = 0;
PRIVATE size_t trace_pos;
PRIVATE size_t trace_next;
PRIVATE u64_t trace_tsc;
static int trace_enabled = FALSE;
static dev_t trace_dev = NO_TRACEDEV;
static btrace_entry *trace_buf = NULL;
static size_t trace_size = 0;
static size_t trace_pos;
static size_t trace_next;
static u64_t trace_tsc;
/* Pointers to in-progress trace entries for each thread (all worker threads,
* plus one for the main thread). Each pointer is set to NULL whenever no
* operation is currently being traced for that thread, for whatever reason.
*/
PRIVATE btrace_entry *trace_ptr[MAX_THREADS + 1] = { NULL };
static btrace_entry *trace_ptr[MAX_THREADS + 1] = { NULL };
/*===========================================================================*
* trace_gettime *
*===========================================================================*/
PRIVATE u32_t trace_gettime(void)
static u32_t trace_gettime(void)
{
/* Return the current time, in microseconds since the start of the trace.
*/
@@ -48,7 +48,7 @@ PRIVATE u32_t trace_gettime(void)
/*===========================================================================*
* trace_ctl *
*===========================================================================*/
PUBLIC int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant)
{
/* Process a block trace control request.
@@ -164,7 +164,7 @@ PUBLIC int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
/*===========================================================================*
* trace_start *
*===========================================================================*/
PUBLIC void trace_start(thread_id_t id, message *m_ptr)
void trace_start(thread_id_t id, message *m_ptr)
{
/* Start creating a trace entry.
*/
@@ -247,7 +247,7 @@ PUBLIC void trace_start(thread_id_t id, message *m_ptr)
/*===========================================================================*
* trace_setsize *
*===========================================================================*/
PUBLIC void trace_setsize(thread_id_t id, size_t size)
void trace_setsize(thread_id_t id, size_t size)
{
/* Set the current trace entry's actual (byte) size, for vector requests.
*/
@@ -265,7 +265,7 @@ PUBLIC void trace_setsize(thread_id_t id, size_t size)
/*===========================================================================*
* trace_finish *
*===========================================================================*/
PUBLIC void trace_finish(thread_id_t id, int result)
void trace_finish(thread_id_t id, int result)
{
/* Finish a trace entry.
*/