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

@@ -3,17 +3,17 @@
#include "inc.h"
/* The number of inodes and hash table slots. */
PRIVATE unsigned int nr_inodes;
static unsigned int nr_inodes;
/* The table of all the inodes. */
PRIVATE struct inode *inode;
static struct inode *inode;
/* The list of unused inodes. */
PRIVATE TAILQ_HEAD(unused_head, inode) unused_inodes;
static TAILQ_HEAD(unused_head, inode) unused_inodes;
/* The hash tables for lookup of <parent,name> and <parent,index> to inode. */
PRIVATE LIST_HEAD(name_head, inode) *parent_name_head;
PRIVATE LIST_HEAD(index_head, inode) *parent_index_head;
static LIST_HEAD(name_head, inode) *parent_name_head;
static LIST_HEAD(index_head, inode) *parent_index_head;
/* Internal integrity check. */
#define CHECK_INODE(node) \
@@ -27,7 +27,7 @@ PRIVATE LIST_HEAD(index_head, inode) *parent_index_head;
/*===========================================================================*
* init_inodes *
*===========================================================================*/
PUBLIC void init_inodes(unsigned int inodes, struct inode_stat *stat,
void init_inodes(unsigned int inodes, struct inode_stat *stat,
index_t nr_indexed_entries)
{
/* Initialize the inode-related state.
@@ -90,7 +90,7 @@ PUBLIC void init_inodes(unsigned int inodes, struct inode_stat *stat,
/*===========================================================================*
* cleanup_inodes *
*===========================================================================*/
PUBLIC void cleanup_inodes(void)
void cleanup_inodes(void)
{
/* Clean up the inode-related state.
*/
@@ -104,7 +104,7 @@ PUBLIC void cleanup_inodes(void)
/*===========================================================================*
* parent_name_hash *
*===========================================================================*/
PRIVATE int parent_name_hash(struct inode *parent, char *name)
static int parent_name_hash(struct inode *parent, char *name)
{
/* Return the hash value of <parent,name> tuple.
*/
@@ -123,7 +123,7 @@ PRIVATE int parent_name_hash(struct inode *parent, char *name)
/*===========================================================================*
* parent_index_hash *
*===========================================================================*/
PRIVATE int parent_index_hash(struct inode *parent, index_t index)
static int parent_index_hash(struct inode *parent, index_t index)
{
/* Return the hash value of a <parent,index> tuple.
*/
@@ -134,7 +134,7 @@ PRIVATE int parent_index_hash(struct inode *parent, index_t index)
/*===========================================================================*
* purge_inode *
*===========================================================================*/
PUBLIC void purge_inode(struct inode *parent)
void purge_inode(struct inode *parent)
{
/* Delete a deletable inode to make room for a new inode.
*/
@@ -175,7 +175,7 @@ PUBLIC void purge_inode(struct inode *parent)
/*===========================================================================*
* add_inode *
*===========================================================================*/
PUBLIC struct inode *add_inode(struct inode *parent, char *name,
struct inode *add_inode(struct inode *parent, char *name,
index_t index, struct inode_stat *stat, index_t nr_indexed_entries,
cbdata_t cbdata)
{
@@ -232,7 +232,7 @@ PUBLIC struct inode *add_inode(struct inode *parent, char *name,
/*===========================================================================*
* get_root_inode *
*===========================================================================*/
PUBLIC struct inode *get_root_inode(void)
struct inode *get_root_inode(void)
{
/* Return the file system's root inode.
*/
@@ -244,7 +244,7 @@ PUBLIC struct inode *get_root_inode(void)
/*===========================================================================*
* get_inode_name *
*===========================================================================*/
PUBLIC char const *get_inode_name(struct inode *node)
char const *get_inode_name(struct inode *node)
{
/* Return the name that an inode has in its parent directory.
*/
@@ -257,7 +257,7 @@ PUBLIC char const *get_inode_name(struct inode *node)
/*===========================================================================*
* get_inode_index *
*===========================================================================*/
PUBLIC index_t get_inode_index(struct inode *node)
index_t get_inode_index(struct inode *node)
{
/* Return the index that an inode has in its parent directory.
*/
@@ -270,7 +270,7 @@ PUBLIC index_t get_inode_index(struct inode *node)
/*===========================================================================*
* get_inode_cbdata *
*===========================================================================*/
PUBLIC cbdata_t get_inode_cbdata(struct inode *node)
cbdata_t get_inode_cbdata(struct inode *node)
{
/* Return the callback data associated with the given inode.
*/
@@ -283,7 +283,7 @@ PUBLIC cbdata_t get_inode_cbdata(struct inode *node)
/*===========================================================================*
* get_parent_inode *
*===========================================================================*/
PUBLIC struct inode *get_parent_inode(struct inode *node)
struct inode *get_parent_inode(struct inode *node)
{
/* Return an inode's parent inode.
*/
@@ -300,7 +300,7 @@ PUBLIC struct inode *get_parent_inode(struct inode *node)
/*===========================================================================*
* get_first_inode *
*===========================================================================*/
PUBLIC struct inode *get_first_inode(struct inode *parent)
struct inode *get_first_inode(struct inode *parent)
{
/* Return a directory's first (non-deleted) child inode.
*/
@@ -320,7 +320,7 @@ PUBLIC struct inode *get_first_inode(struct inode *parent)
/*===========================================================================*
* get_next_inode *
*===========================================================================*/
PUBLIC struct inode *get_next_inode(struct inode *previous)
struct inode *get_next_inode(struct inode *previous)
{
/* Return a directory's next (non-deleted) child inode.
*/
@@ -339,7 +339,7 @@ PUBLIC struct inode *get_next_inode(struct inode *previous)
/*===========================================================================*
* get_inode_number *
*===========================================================================*/
PUBLIC int get_inode_number(struct inode *node)
int get_inode_number(struct inode *node)
{
/* Return the inode number of the given inode.
*/
@@ -352,7 +352,7 @@ PUBLIC int get_inode_number(struct inode *node)
/*===========================================================================*
* get_inode_stat *
*===========================================================================*/
PUBLIC void get_inode_stat(struct inode *node, struct inode_stat *stat)
void get_inode_stat(struct inode *node, struct inode_stat *stat)
{
/* Retrieve an inode's status.
*/
@@ -365,7 +365,7 @@ PUBLIC void get_inode_stat(struct inode *node, struct inode_stat *stat)
/*===========================================================================*
* set_inode_stat *
*===========================================================================*/
PUBLIC void set_inode_stat(struct inode *node, struct inode_stat *stat)
void set_inode_stat(struct inode *node, struct inode_stat *stat)
{
/* Set an inode's status.
*/
@@ -378,7 +378,7 @@ PUBLIC void set_inode_stat(struct inode *node, struct inode_stat *stat)
/*===========================================================================*
* get_inode_by_name *
*===========================================================================*/
PUBLIC struct inode *get_inode_by_name(struct inode *parent, char *name)
struct inode *get_inode_by_name(struct inode *parent, char *name)
{
/* Look up an inode using a <parent,name> tuple.
*/
@@ -402,7 +402,7 @@ PUBLIC struct inode *get_inode_by_name(struct inode *parent, char *name)
/*===========================================================================*
* get_inode_by_index *
*===========================================================================*/
PUBLIC struct inode *get_inode_by_index(struct inode *parent, index_t index)
struct inode *get_inode_by_index(struct inode *parent, index_t index)
{
/* Look up an inode using a <parent,index> tuple.
*/
@@ -426,7 +426,7 @@ PUBLIC struct inode *get_inode_by_index(struct inode *parent, index_t index)
/*===========================================================================*
* find_inode *
*===========================================================================*/
PUBLIC struct inode *find_inode(ino_t num)
struct inode *find_inode(ino_t num)
{
/* Retrieve an inode by inode number.
*/
@@ -442,7 +442,7 @@ PUBLIC struct inode *find_inode(ino_t num)
/*===========================================================================*
* get_inode *
*===========================================================================*/
PUBLIC struct inode *get_inode(ino_t num)
struct inode *get_inode(ino_t num)
{
/* Retrieve an inode by inode number, and increase its reference count.
*/
@@ -458,7 +458,7 @@ PUBLIC struct inode *get_inode(ino_t num)
/*===========================================================================*
* put_inode *
*===========================================================================*/
PUBLIC void put_inode(struct inode *node)
void put_inode(struct inode *node)
{
/* Decrease an inode's reference count.
*/
@@ -478,7 +478,7 @@ PUBLIC void put_inode(struct inode *node)
/*===========================================================================*
* ref_inode *
*===========================================================================*/
PUBLIC void ref_inode(struct inode *node)
void ref_inode(struct inode *node)
{
/* Increase an inode's reference count.
*/
@@ -492,7 +492,7 @@ PUBLIC void ref_inode(struct inode *node)
/*===========================================================================*
* unlink_inode *
*===========================================================================*/
PRIVATE void unlink_inode(struct inode *node)
static void unlink_inode(struct inode *node)
{
/* Unlink the given node from its parent, if it is still linked in.
*/
@@ -517,7 +517,7 @@ PRIVATE void unlink_inode(struct inode *node)
/*===========================================================================*
* delete_inode *
*===========================================================================*/
PUBLIC void delete_inode(struct inode *node)
void delete_inode(struct inode *node)
{
/* Delete the given inode. If its reference count is nonzero, or it
* still has children that cannot be deleted for the same reason, keep
@@ -570,7 +570,7 @@ PUBLIC void delete_inode(struct inode *node)
/*===========================================================================*
* is_inode_deleted *
*===========================================================================*/
PUBLIC int is_inode_deleted(struct inode *node)
int is_inode_deleted(struct inode *node)
{
/* Return whether the given inode has been deleted.
*/
@@ -581,7 +581,7 @@ PUBLIC int is_inode_deleted(struct inode *node)
/*===========================================================================*
* fs_putnode *
*===========================================================================*/
PUBLIC int fs_putnode(void)
int fs_putnode(void)
{
/* Find the inode specified by the request message, and decrease its
* reference count.

View File

@@ -5,7 +5,7 @@
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
PUBLIC int fs_rdlink(void)
int fs_rdlink(void)
{
/* Retrieve symbolic link target.
*/

View File

@@ -5,7 +5,7 @@
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
PUBLIC int fs_readsuper(void)
int fs_readsuper(void)
{
/* This function gets the root inode and sends back its details.
*/
@@ -45,7 +45,7 @@ PUBLIC int fs_readsuper(void)
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
PUBLIC int fs_unmount(void)
int fs_unmount(void)
{
/* Unmount the file system.
*/

View File

@@ -5,7 +5,7 @@
/*===========================================================================*
* access_as_dir *
*===========================================================================*/
PRIVATE int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
static int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
{
/* Check whether the given inode may be accessed as directory.
* Return OK or an appropriate error code.
@@ -41,7 +41,7 @@ PRIVATE int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
/*===========================================================================*
* next_name *
*===========================================================================*/
PRIVATE int next_name(char **ptr, char **start, char name[PNAME_MAX+1])
static int next_name(char **ptr, char **start, char name[PNAME_MAX+1])
{
/* Get the next path component from a path.
*/
@@ -71,7 +71,7 @@ PRIVATE int next_name(char **ptr, char **start, char name[PNAME_MAX+1])
/*===========================================================================*
* go_up *
*===========================================================================*/
PRIVATE int go_up(struct inode *node, struct inode **parent)
static int go_up(struct inode *node, struct inode **parent)
{
/* Given a directory inode, progress into the parent directory.
*/
@@ -90,7 +90,7 @@ PRIVATE int go_up(struct inode *node, struct inode **parent)
/*===========================================================================*
* go_down *
*===========================================================================*/
PRIVATE int go_down(struct inode *parent, char *name, struct inode **child)
static int go_down(struct inode *parent, char *name, struct inode **child)
{
/* Given a directory inode and a name, progress into a directory entry.
*/
@@ -114,7 +114,7 @@ PRIVATE int go_down(struct inode *parent, char *name, struct inode **child)
/*===========================================================================*
* resolve_link *
*===========================================================================*/
PRIVATE int resolve_link(struct inode *node, char *pptr, char *tail)
static int resolve_link(struct inode *node, char *pptr, char *tail)
{
/* Given a symbolic link, resolve and return the contents of the link.
*/
@@ -145,7 +145,7 @@ PRIVATE int resolve_link(struct inode *node, char *pptr, char *tail)
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
PUBLIC int fs_lookup(void)
int fs_lookup(void)
{
/* Resolve a path string to an inode.
*/

View File

@@ -9,7 +9,7 @@
/*===========================================================================*
* fs_read *
*===========================================================================*/
PUBLIC int fs_read(void)
int fs_read(void)
{
/* Read from a file.
*/
@@ -70,7 +70,7 @@ PUBLIC int fs_read(void)
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
PUBLIC int fs_getdents(void)
int fs_getdents(void)
{
/* Retrieve directory entries.
*/

View File

@@ -17,7 +17,7 @@
* use: 65599 nice.
* 65587 even better.
*/
PUBLIC long sdbm_hash(char *str, int len)
long sdbm_hash(char *str, int len)
{
unsigned long n = 0;

View File

@@ -10,7 +10,7 @@
/*===========================================================================*
* fs_stat *
*===========================================================================*/
PUBLIC int fs_stat(void)
int fs_stat(void)
{
/* Retrieve file status.
*/
@@ -58,7 +58,7 @@ PUBLIC int fs_stat(void)
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
PUBLIC int fs_fstatfs(void)
int fs_fstatfs(void)
{
/* Retrieve file system statistics.
*/
@@ -74,7 +74,7 @@ PUBLIC int fs_fstatfs(void)
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
PUBLIC int fs_statvfs(void)
int fs_statvfs(void)
{
/* Retrieve file system statistics.
*/

View File

@@ -3,7 +3,7 @@
#define _TABLE
#include "inc.h"
PUBLIC int (*fs_call_vec[])(void) = {
int (*fs_call_vec[])(void) = {
no_sys, /* 0 */
no_sys, /* 1 getnode */
fs_putnode, /* 2 putnode */

View File

@@ -5,7 +5,7 @@
/*===========================================================================*
* no_sys *
*===========================================================================*/
PUBLIC int no_sys(void)
int no_sys(void)
{
/* This call is not recognized by VTreeFS. If a message hook is
* defined, let it handle the call; otherwise return ENOSYS.
@@ -20,7 +20,7 @@ PUBLIC int no_sys(void)
/*===========================================================================*
* do_noop *
*===========================================================================*/
PUBLIC int do_noop(void)
int do_noop(void)
{
/* This call has no effect.
*/

View File

@@ -2,18 +2,18 @@
#include "inc.h"
FORWARD int get_work(void);
FORWARD void send_reply(int err, int transid);
FORWARD void got_signal(int signal);
static int get_work(void);
static void send_reply(int err, int transid);
static void got_signal(int signal);
PRIVATE unsigned int inodes;
PRIVATE struct inode_stat *root_stat;
PRIVATE index_t root_entries;
static unsigned int inodes;
static struct inode_stat *root_stat;
static index_t root_entries;
/*===========================================================================*
* init_server *
*===========================================================================*/
PRIVATE int init_server(int UNUSED(type), sef_init_info_t *UNUSED(info))
static int init_server(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize internal state, and register with VFS.
*/
@@ -30,7 +30,7 @@ PRIVATE int init_server(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup(void)
static void sef_local_startup(void)
{
sef_setcb_init_fresh(init_server);
sef_setcb_init_restart(init_server);
@@ -45,7 +45,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================*
* start_vtreefs *
*===========================================================================*/
PUBLIC void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
struct inode_stat *stat, index_t nr_indexed_entries)
{
/* This is the main routine of this service. The main loop consists of
@@ -108,7 +108,7 @@ PUBLIC void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
/*===========================================================================*
* get_work *
*===========================================================================*/
PRIVATE int get_work(void)
static int get_work(void)
{
/* Retrieve work. Return the call number.
*/
@@ -123,7 +123,7 @@ PRIVATE int get_work(void)
/*===========================================================================*
* send_reply *
*===========================================================================*/
PRIVATE void send_reply(int err, int transid)
static void send_reply(int err, int transid)
{
/* Send a reply to the caller.
*/
@@ -141,7 +141,7 @@ PRIVATE void send_reply(int err, int transid)
/*===========================================================================*
* got_signal *
*===========================================================================*/
PRIVATE void got_signal(int signal)
static void got_signal(int signal)
{
/* We received a signal. If it is a termination signal, and the file
* system has already been unmounted, clean up and exit.