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

@@ -7,7 +7,7 @@
/*===========================================================================*
* get_rand *
*===========================================================================*/
PRIVATE u32_t get_rand(u32_t max)
static u32_t get_rand(u32_t max)
{
/* Las Vegas algorithm for getting a random number in the range from
* 0 to max, inclusive.
@@ -35,7 +35,7 @@ PRIVATE u32_t get_rand(u32_t max)
/*===========================================================================*
* get_range *
*===========================================================================*/
PRIVATE size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
u64_t *skip)
{
/* Compute the range within the given request range that is affected
@@ -82,7 +82,7 @@ PRIVATE size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
/*===========================================================================*
* limit_range *
*===========================================================================*/
PRIVATE void limit_range(iovec_t *iov, unsigned *count, size_t size)
static void limit_range(iovec_t *iov, unsigned *count, size_t size)
{
/* Limit the given vector to the given size.
*/
@@ -104,7 +104,7 @@ PRIVATE void limit_range(iovec_t *iov, unsigned *count, size_t size)
/*===========================================================================*
* action_io_corrupt *
*===========================================================================*/
PRIVATE void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
static void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int UNUSED(flag))
{
u64_t skip;
@@ -151,7 +151,7 @@ PRIVATE void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
/*===========================================================================*
* action_pre_error *
*===========================================================================*/
PRIVATE void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
static void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos)
{
/* Limit the request to the part that precedes the matched range. */
@@ -163,7 +163,7 @@ PRIVATE void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================*
* action_post_error *
*===========================================================================*/
PRIVATE void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
static void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
int *result)
{
/* Upon success of the first part, return the specified error code. */
@@ -174,7 +174,7 @@ PRIVATE void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
/*===========================================================================*
* action_pre_misdir *
*===========================================================================*/
PRIVATE void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
static void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
unsigned *UNUSED(count), size_t *UNUSED(size), u64_t *pos)
{
/* Randomize the request position to fall within the range (and have
@@ -201,7 +201,7 @@ PRIVATE void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
/*===========================================================================*
* action_pre_losttorn *
*===========================================================================*/
PRIVATE void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
static void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *UNUSED(pos))
{
if (*size > rule->params.losttorn.lead)
@@ -213,7 +213,7 @@ PRIVATE void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================*
* action_post_losttorn *
*===========================================================================*/
PRIVATE void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
static void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
int *result)
{
/* On success, pretend full completion. */
@@ -226,7 +226,7 @@ PRIVATE void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
/*===========================================================================*
* action_mask *
*===========================================================================*/
PUBLIC int action_mask(struct fbd_rule *rule)
int action_mask(struct fbd_rule *rule)
{
/* Return the hook mask for the given rule's action type. */
@@ -244,7 +244,7 @@ PUBLIC int action_mask(struct fbd_rule *rule)
/*===========================================================================*
* action_pre_hook *
*===========================================================================*/
PUBLIC void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos)
{
switch (rule->action) {
@@ -268,7 +268,7 @@ PUBLIC void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================*
* action_io_hook *
*===========================================================================*/
PUBLIC void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int flag)
{
switch (rule->action) {
@@ -284,7 +284,7 @@ PUBLIC void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
/*===========================================================================*
* action_post_hook *
*===========================================================================*/
PUBLIC void action_post_hook(struct fbd_rule *rule, size_t osize, int *result)
void action_post_hook(struct fbd_rule *rule, size_t osize, int *result)
{
switch (rule->action) {
case FBD_ACTION_ERROR:

View File

@@ -15,22 +15,22 @@
#define BUF_SIZE (NR_IOREQS * CLICK_SIZE) /* 256k */
/* Function declarations. */
PRIVATE int fbd_open(dev_t minor, int access);
PRIVATE int fbd_close(dev_t minor);
PRIVATE int fbd_transfer(dev_t minor, int do_write, u64_t position,
static int fbd_open(dev_t minor, int access);
static int fbd_close(dev_t minor);
static int fbd_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
PRIVATE int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
static int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant);
/* Variables. */
PRIVATE char *fbd_buf; /* scratch buffer */
static char *fbd_buf; /* scratch buffer */
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 */
/* Entry points to this driver. */
PRIVATE struct blockdriver fbd_dtab = {
static struct blockdriver fbd_dtab = {
BLOCKDRIVER_TYPE_OTHER, /* do not handle partition requests */
fbd_open, /* open or mount request, initialize device */
fbd_close, /* release device */
@@ -46,7 +46,7 @@ PRIVATE struct blockdriver fbd_dtab = {
};
/* 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 },
{ NULL, 0, NULL, 0 }
@@ -55,7 +55,7 @@ PRIVATE struct optset optset_table[] = {
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
clock_t uptime;
int r;
@@ -97,7 +97,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo)
static void sef_cb_signal_handler(int signo)
{
/* Terminate immediately upon receiving a SIGTERM. */
if (signo != SIGTERM) return;
@@ -115,7 +115,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup(void)
static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -132,7 +132,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================*
* main *
*===========================================================================*/
PUBLIC int main(int argc, char **argv)
int main(int argc, char **argv)
{
/* SEF local startup. */
env_setargs(argc, argv);
@@ -147,7 +147,7 @@ PUBLIC int main(int argc, char **argv)
/*===========================================================================*
* fbd_open *
*===========================================================================*/
PRIVATE int fbd_open(dev_t UNUSED(minor), int access)
static int fbd_open(dev_t UNUSED(minor), int access)
{
/* Open a device. */
message m;
@@ -172,7 +172,7 @@ PRIVATE int fbd_open(dev_t UNUSED(minor), int access)
/*===========================================================================*
* fbd_close *
*===========================================================================*/
PRIVATE int fbd_close(dev_t UNUSED(minor))
static int fbd_close(dev_t UNUSED(minor))
{
/* Close a device. */
message m;
@@ -196,7 +196,7 @@ PRIVATE int fbd_close(dev_t UNUSED(minor))
/*===========================================================================*
* fbd_ioctl *
*===========================================================================*/
PRIVATE int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
static int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
endpoint_t endpt, cp_grant_id_t grant)
{
/* Handle an I/O control request. */
@@ -238,7 +238,7 @@ PRIVATE int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
/*===========================================================================*
* fbd_transfer_direct *
*===========================================================================*/
PRIVATE ssize_t fbd_transfer_direct(int do_write, u64_t position,
static ssize_t fbd_transfer_direct(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags)
{
/* Forward the entire transfer request, without any intervention. */
@@ -284,7 +284,7 @@ PRIVATE ssize_t fbd_transfer_direct(int do_write, u64_t position,
/*===========================================================================*
* fbd_transfer_copy *
*===========================================================================*/
PRIVATE ssize_t fbd_transfer_copy(int do_write, u64_t position,
static ssize_t fbd_transfer_copy(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, size_t size,
int flags)
{
@@ -406,7 +406,7 @@ PRIVATE ssize_t fbd_transfer_copy(int do_write, u64_t position,
/*===========================================================================*
* fbd_transfer *
*===========================================================================*/
PRIVATE int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
static int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags)
{
/* Transfer data from or to the device. */

View File

@@ -5,14 +5,14 @@
#include "action.h"
#include "rule.h"
PRIVATE struct fbd_rule rules[MAX_RULES];
PRIVATE struct fbd_rule *matches[MAX_RULES];
PRIVATE int nr_matches;
static struct fbd_rule rules[MAX_RULES];
static struct fbd_rule *matches[MAX_RULES];
static int nr_matches;
/*===========================================================================*
* rule_ctl *
*===========================================================================*/
PUBLIC int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
{
/* Handle an I/O control request regarding rules. */
fbd_rulenum_t i;
@@ -86,7 +86,7 @@ PUBLIC int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
/*===========================================================================*
* rule_match *
*===========================================================================*/
PRIVATE int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
static int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
{
/* Check whether the given rule matches the given parameters. As side
* effect, update counters in the rule as appropriate.
@@ -113,7 +113,7 @@ PRIVATE int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
/*===========================================================================*
* rule_find *
*===========================================================================*/
PUBLIC int rule_find(u64_t pos, size_t size, int flag)
int rule_find(u64_t pos, size_t size, int flag)
{
/* Find all matching rules, and return a hook mask. */
struct fbd_rule *rule;
@@ -150,7 +150,7 @@ PUBLIC int rule_find(u64_t pos, size_t size, int flag)
/*===========================================================================*
* rule_pre_hook *
*===========================================================================*/
PUBLIC void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
u64_t *pos)
{
int i;
@@ -163,7 +163,7 @@ PUBLIC void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
/*===========================================================================*
* rule_io_hook *
*===========================================================================*/
PUBLIC void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
{
int i;
@@ -175,7 +175,7 @@ PUBLIC void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
/*===========================================================================*
* rule_post_hook *
*===========================================================================*/
PUBLIC void rule_post_hook(size_t osize, int *result)
void rule_post_hook(size_t osize, int *result)
{
int i;