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

@@ -20,13 +20,13 @@
#include "const.h"
FORWARD block_t alloc_block_bit(struct super_block *sp, block_t origin,
static block_t alloc_block_bit(struct super_block *sp, block_t origin,
struct inode *rip);
/*===========================================================================*
* discard_preallocated_blocks *
*===========================================================================*/
PUBLIC void discard_preallocated_blocks(struct inode *rip)
void discard_preallocated_blocks(struct inode *rip)
{
/* When called for rip, discard (free) blocks preallocated for rip,
* otherwise discard all preallocated blocks.
@@ -68,7 +68,7 @@ PUBLIC void discard_preallocated_blocks(struct inode *rip)
/*===========================================================================*
* alloc_block *
*===========================================================================*/
PUBLIC block_t alloc_block(struct inode *rip, block_t block)
block_t alloc_block(struct inode *rip, block_t block)
{
/* Allocate a block for inode. If block is provided, then use it as a goal:
* try to allocate this block or his neghbors.
@@ -141,13 +141,13 @@ PUBLIC block_t alloc_block(struct inode *rip, block_t block)
}
FORWARD void check_block_number(block_t block, struct super_block *sp,
static void check_block_number(block_t block, struct super_block *sp,
struct group_desc *gd);
/*===========================================================================*
* alloc_block_bit *
*===========================================================================*/
PRIVATE block_t alloc_block_bit(sp, goal, rip)
static block_t alloc_block_bit(sp, goal, rip)
struct super_block *sp; /* the filesystem to allocate from */
block_t goal; /* try to allocate near this block */
struct inode *rip; /* used for preallocation */
@@ -273,7 +273,7 @@ struct inode *rip; /* used for preallocation */
/*===========================================================================*
* free_block *
*===========================================================================*/
PUBLIC void free_block(struct super_block *sp, bit_t bit_returned)
void free_block(struct super_block *sp, bit_t bit_returned)
{
/* Return a block by turning off its bitmap bit. */
int group; /* group number of bit_returned */
@@ -329,7 +329,7 @@ PUBLIC void free_block(struct super_block *sp, bit_t bit_returned)
}
PRIVATE void check_block_number(block_t block, struct super_block *sp,
static void check_block_number(block_t block, struct super_block *sp,
struct group_desc *gd)
{

View File

@@ -25,15 +25,15 @@
#include "super.h"
#include "inode.h"
FORWARD void rm_lru(struct buf *bp);
FORWARD void rw_block(struct buf *, int);
static void rm_lru(struct buf *bp);
static void rw_block(struct buf *, int);
PRIVATE int vmcache_avail = -1; /* 0 if not available, >0 if available. */
static int vmcache_avail = -1; /* 0 if not available, >0 if available. */
/*===========================================================================*
* get_block *
*===========================================================================*/
PUBLIC struct buf *get_block(
struct buf *get_block(
register dev_t dev, /* on which device is the block? */
register block_t block, /* which block is wanted? */
int only_search /* if NO_READ, don't read, else act normal */
@@ -218,7 +218,7 @@ PUBLIC struct buf *get_block(
/*===========================================================================*
* put_block *
*===========================================================================*/
PUBLIC void put_block(
void put_block(
register struct buf *bp, /* pointer to the buffer to be released */
int block_type /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
)
@@ -281,7 +281,7 @@ PUBLIC void put_block(
/*===========================================================================*
* rw_block *
*===========================================================================*/
PRIVATE void rw_block(
static void rw_block(
register struct buf *bp, /* buffer pointer */
int rw_flag /* READING or WRITING */
)
@@ -327,7 +327,7 @@ PRIVATE void rw_block(
/*===========================================================================*
* invalidate *
*===========================================================================*/
PUBLIC void invalidate(
void invalidate(
dev_t device /* device whose blocks are to be purged */
)
{
@@ -344,7 +344,7 @@ PUBLIC void invalidate(
/*===========================================================================*
* flushall *
*===========================================================================*/
PUBLIC void flushall(
void flushall(
dev_t dev /* device to flush */
)
{
@@ -373,7 +373,7 @@ PUBLIC void flushall(
/*===========================================================================*
* rw_scattered *
*===========================================================================*/
PUBLIC void rw_scattered(
void rw_scattered(
dev_t dev, /* major-minor device number */
struct buf **bufq, /* pointer to array of buffers */
int bufqsize, /* number of buffers */
@@ -476,7 +476,7 @@ PUBLIC void rw_scattered(
/*===========================================================================*
* rm_lru *
*===========================================================================*/
PRIVATE void rm_lru(
static void rm_lru(
struct buf *bp
)
{
@@ -500,7 +500,7 @@ PRIVATE void rm_lru(
/*===========================================================================*
* set_blocksize *
*===========================================================================*/
PUBLIC void set_blocksize(unsigned int blocksize, u32_t blocks,
void set_blocksize(unsigned int blocksize, u32_t blocks,
u32_t freeblocks, dev_t majordev)
{
struct buf *bp;
@@ -524,7 +524,7 @@ PUBLIC void set_blocksize(unsigned int blocksize, u32_t blocks,
/*===========================================================================*
* buf_pool *
*===========================================================================*/
PUBLIC void buf_pool(int new_nr_bufs)
void buf_pool(int new_nr_bufs)
{
/* Initialize the buffer pool. */
register struct buf *bp;

View File

@@ -19,17 +19,17 @@
#include "const.h"
FORWARD bit_t alloc_inode_bit(struct super_block *sp, struct inode
static bit_t alloc_inode_bit(struct super_block *sp, struct inode
*parent, int is_dir);
FORWARD void free_inode_bit(struct super_block *sp, bit_t bit_returned,
static void free_inode_bit(struct super_block *sp, bit_t bit_returned,
int is_dir);
FORWARD void wipe_inode(struct inode *rip);
static void wipe_inode(struct inode *rip);
/*===========================================================================*
* alloc_inode *
*===========================================================================*/
PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
struct inode *alloc_inode(struct inode *parent, mode_t bits)
{
/* Allocate a free inode on parent's dev, and return a pointer to it. */
@@ -87,7 +87,7 @@ PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
/*===========================================================================*
* free_inode *
*===========================================================================*/
PUBLIC void free_inode(
void free_inode(
register struct inode *rip /* inode to free */
)
{
@@ -108,20 +108,20 @@ PUBLIC void free_inode(
}
FORWARD int find_group_dir(struct super_block *sp, struct inode
static int find_group_dir(struct super_block *sp, struct inode
*parent);
FORWARD int find_group_hashalloc(struct super_block *sp, struct inode
static int find_group_hashalloc(struct super_block *sp, struct inode
*parent);
FORWARD int find_group_any(struct super_block *sp, struct inode
static int find_group_any(struct super_block *sp, struct inode
*parent);
FORWARD int find_group_orlov(struct super_block *sp, struct inode
static int find_group_orlov(struct super_block *sp, struct inode
*parent);
/*===========================================================================*
* alloc_inode_bit *
*===========================================================================*/
PRIVATE bit_t alloc_inode_bit(sp, parent, is_dir)
static bit_t alloc_inode_bit(sp, parent, is_dir)
struct super_block *sp; /* the filesystem to allocate from */
struct inode *parent; /* parent of newly allocated inode */
int is_dir; /* inode will be a directory if it is TRUE */
@@ -202,7 +202,7 @@ int is_dir; /* inode will be a directory if it is TRUE */
/*===========================================================================*
* free_inode_bit *
*===========================================================================*/
PRIVATE void free_inode_bit(struct super_block *sp, bit_t bit_returned,
static void free_inode_bit(struct super_block *sp, bit_t bit_returned,
int is_dir)
{
/* Return an inode by turning off its bitmap bit. */
@@ -252,7 +252,7 @@ PRIVATE void free_inode_bit(struct super_block *sp, bit_t bit_returned,
/* it's implemented very close to the linux' find_group_dir() */
PRIVATE int find_group_dir(struct super_block *sp, struct inode *parent)
static int find_group_dir(struct super_block *sp, struct inode *parent)
{
int avefreei = sp->s_free_inodes_count / sp->s_groups_count;
struct group_desc *gd, *best_gd = NULL;
@@ -282,7 +282,7 @@ PRIVATE int find_group_dir(struct super_block *sp, struct inode *parent)
* 2) Quadradically rehash on the group number.
* 3) Make a linear search for free inode.
*/
PRIVATE int find_group_hashalloc(struct super_block *sp, struct inode *parent)
static int find_group_hashalloc(struct super_block *sp, struct inode *parent)
{
int ngroups = sp->s_groups_count;
struct group_desc *gd;
@@ -339,7 +339,7 @@ PRIVATE int find_group_hashalloc(struct super_block *sp, struct inode *parent)
/* Find first group which has free inode slot.
* This is similar to what MFS does.
*/
PRIVATE int find_group_any(struct super_block *sp, struct inode *parent)
static int find_group_any(struct super_block *sp, struct inode *parent)
{
int ngroups = sp->s_groups_count;
struct group_desc *gd;
@@ -371,7 +371,7 @@ PRIVATE int find_group_any(struct super_block *sp, struct inode *parent)
* min_inodes).
*
*/
PRIVATE int find_group_orlov(struct super_block *sp, struct inode *parent)
static int find_group_orlov(struct super_block *sp, struct inode *parent)
{
int avefreei = sp->s_free_inodes_count / sp->s_groups_count;
int avefreeb = sp->s_free_blocks_count / sp->s_groups_count;
@@ -449,7 +449,7 @@ PRIVATE int find_group_orlov(struct super_block *sp, struct inode *parent)
/*===========================================================================*
* wipe_inode *
*===========================================================================*/
PRIVATE void wipe_inode(
static void wipe_inode(
register struct inode *rip /* the inode to be erased */
)
{

View File

@@ -22,16 +22,16 @@
#include "super.h"
#include <minix/vfsif.h>
FORWARD void icopy(struct inode *rip, d_inode *dip, int direction, int
static void icopy(struct inode *rip, d_inode *dip, int direction, int
norm);
FORWARD void addhash_inode(struct inode *node);
FORWARD void unhash_inode(struct inode *node);
static void addhash_inode(struct inode *node);
static void unhash_inode(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 counter.*/
@@ -70,7 +70,7 @@ PUBLIC int fs_putnode(void)
/*===========================================================================*
* init_inode_cache *
*===========================================================================*/
PUBLIC void init_inode_cache()
void init_inode_cache()
{
struct inode *rip;
struct inodelist *rlp;
@@ -96,7 +96,7 @@ PUBLIC void init_inode_cache()
/*===========================================================================*
* addhash_inode *
*===========================================================================*/
PRIVATE void addhash_inode(struct inode *node)
static void addhash_inode(struct inode *node)
{
int hashi = node->i_num & INODE_HASH_MASK;
@@ -108,7 +108,7 @@ PRIVATE void addhash_inode(struct inode *node)
/*===========================================================================*
* unhash_inode *
*===========================================================================*/
PRIVATE void unhash_inode(struct inode *node)
static void unhash_inode(struct inode *node)
{
/* remove from hash table */
LIST_REMOVE(node, i_hash);
@@ -118,7 +118,7 @@ PRIVATE void unhash_inode(struct inode *node)
/*===========================================================================*
* get_inode *
*===========================================================================*/
PUBLIC struct inode *get_inode(
struct inode *get_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number (ANSI: may not be unshort) */
)
@@ -196,7 +196,7 @@ PUBLIC struct inode *get_inode(
/*===========================================================================*
* find_inode *
*===========================================================================*/
PUBLIC struct inode *find_inode(
struct inode *find_inode(
dev_t dev, /* device on which inode resides */
ino_t numb /* inode number (ANSI: may not be unshort) */
)
@@ -221,7 +221,7 @@ PUBLIC struct inode *find_inode(
/*===========================================================================*
* put_inode *
*===========================================================================*/
PUBLIC void put_inode(
void put_inode(
register struct inode *rip /* pointer to inode to be released */
)
{
@@ -271,7 +271,7 @@ PUBLIC void put_inode(
/*===========================================================================*
* update_times *
*===========================================================================*/
PUBLIC void update_times(
void update_times(
register struct inode *rip /* pointer to inode to be read/written */
)
{
@@ -302,7 +302,7 @@ PUBLIC void update_times(
/*===========================================================================*
* rw_inode *
*===========================================================================*/
PUBLIC void rw_inode(
void rw_inode(
register struct inode *rip, /* pointer to inode to be read/written */
int rw_flag /* READING or WRITING */
)
@@ -355,7 +355,7 @@ PUBLIC void rw_inode(
/*===========================================================================*
* icopy *
*===========================================================================*/
PRIVATE void icopy(
static void icopy(
register struct inode *rip, /* pointer to the in-core inode struct */
register d_inode *dip, /* pointer to the on-disk struct */
int direction, /* READING (from disk) or WRITING (to disk) */
@@ -415,7 +415,7 @@ PRIVATE void icopy(
/*===========================================================================*
* dup_inode *
*===========================================================================*/
PUBLIC void dup_inode(
void dup_inode(
struct inode *ip /* The inode to be duplicated. */
)
{

View File

@@ -13,14 +13,14 @@
#define SAME 1000
FORWARD int freesp_inode(struct inode *rip, off_t st, off_t end);
FORWARD int remove_dir(struct inode *rldirp, struct inode *rip, char
static int freesp_inode(struct inode *rip, off_t st, off_t end);
static int remove_dir(struct inode *rldirp, struct inode *rip, char
dir_name[NAME_MAX + 1]);
FORWARD int unlink_file(struct inode *dirp, struct inode *rip, char
static int unlink_file(struct inode *dirp, struct inode *rip, char
file_name[NAME_MAX + 1]);
FORWARD off_t nextblock(off_t pos, int blocksize);
FORWARD void zeroblock_half(struct inode *i, off_t p, int l);
FORWARD void zeroblock_range(struct inode *i, off_t p, off_t h);
static off_t nextblock(off_t pos, int blocksize);
static void zeroblock_half(struct inode *i, off_t p, int l);
static void zeroblock_range(struct inode *i, off_t p, off_t h);
/* Args to zeroblock_half() */
#define FIRST_HALF 0
@@ -30,7 +30,7 @@ FORWARD void zeroblock_range(struct inode *i, off_t p, off_t h);
/*===========================================================================*
* fs_link *
*===========================================================================*/
PUBLIC int fs_link()
int fs_link()
{
/* Perform the link(name1, name2) system call. */
@@ -116,7 +116,7 @@ PUBLIC int fs_link()
/*===========================================================================*
* fs_unlink *
*===========================================================================*/
PUBLIC int fs_unlink()
int fs_unlink()
{
/* Perform the unlink(name) or rmdir(name) system call. The code for these two
* is almost the same. They differ only in some condition testing. Unlink()
@@ -179,7 +179,7 @@ PUBLIC int fs_unlink()
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
PUBLIC int fs_rdlink()
int fs_rdlink()
{
block_t b; /* block containing link text */
struct buf *bp = NULL; /* buffer containing link text */
@@ -232,7 +232,7 @@ PUBLIC int fs_rdlink()
/*===========================================================================*
* remove_dir *
*===========================================================================*/
PRIVATE int remove_dir(rldirp, rip, dir_name)
static int remove_dir(rldirp, rip, dir_name)
struct inode *rldirp; /* parent directory */
struct inode *rip; /* directory to be removed */
char dir_name[NAME_MAX + 1]; /* name of directory to be removed */
@@ -268,7 +268,7 @@ char dir_name[NAME_MAX + 1]; /* name of directory to be removed */
/*===========================================================================*
* unlink_file *
*===========================================================================*/
PRIVATE int unlink_file(dirp, rip, file_name)
static int unlink_file(dirp, rip, file_name)
struct inode *dirp; /* parent directory of file */
struct inode *rip; /* inode of file, may be NULL too. */
char file_name[NAME_MAX + 1]; /* name of file to be removed */
@@ -304,7 +304,7 @@ char file_name[NAME_MAX + 1]; /* name of file to be removed */
/*===========================================================================*
* fs_rename *
*===========================================================================*/
PUBLIC int fs_rename()
int fs_rename()
{
/* Perform the rename(name1, name2) system call. */
struct inode *old_dirp, *old_ip; /* ptrs to old dir, file inodes */
@@ -517,7 +517,7 @@ PUBLIC int fs_rename()
/*===========================================================================*
* fs_ftrunc *
*===========================================================================*/
PUBLIC int fs_ftrunc(void)
int fs_ftrunc(void)
{
struct inode *rip;
off_t start, end;
@@ -541,7 +541,7 @@ PUBLIC int fs_ftrunc(void)
/*===========================================================================*
* truncate_inode *
*===========================================================================*/
PUBLIC int truncate_inode(rip, newsize)
int truncate_inode(rip, newsize)
register struct inode *rip; /* pointer to inode to be truncated */
off_t newsize; /* inode must become this size */
{
@@ -587,7 +587,7 @@ off_t newsize; /* inode must become this size */
/*===========================================================================*
* freesp_inode *
*===========================================================================*/
PRIVATE int freesp_inode(rip, start, end)
static int freesp_inode(rip, start, end)
register struct inode *rip; /* pointer to inode to be partly freed */
off_t start, end; /* range of bytes to free (end uninclusive) */
{
@@ -660,7 +660,7 @@ off_t start, end; /* range of bytes to free (end uninclusive) */
/*===========================================================================*
* nextblock *
*===========================================================================*/
PRIVATE off_t nextblock(pos, block_size)
static off_t nextblock(pos, block_size)
off_t pos;
unsigned short block_size;
{
@@ -678,7 +678,7 @@ unsigned short block_size;
/*===========================================================================*
* zeroblock_half *
*===========================================================================*/
PRIVATE void zeroblock_half(rip, pos, half)
static void zeroblock_half(rip, pos, half)
struct inode *rip;
off_t pos;
int half;
@@ -708,7 +708,7 @@ int half;
/*===========================================================================*
* zeroblock_range *
*===========================================================================*/
PRIVATE void zeroblock_range(rip, pos, len)
static void zeroblock_range(rip, pos, len)
struct inode *rip;
off_t pos;
off_t len;

View File

@@ -13,18 +13,18 @@
#include "inode.h"
/* Declare some local functions. */
FORWARD void get_work(message *m_in);
FORWARD void reply(endpoint_t who, message *m_out);
static void get_work(message *m_in);
static void reply(endpoint_t who, message *m_out);
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo);
static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
static void sef_cb_signal_handler(int signo);
EXTERN int env_argc;
EXTERN char **env_argv;
PRIVATE struct optset optset_table[] = {
static struct optset optset_table[] = {
{ "sb", OPT_INT, &opt.block_with_super, 0 },
{ "orlov", OPT_BOOL, &opt.use_orlov, TRUE },
{ "oldalloc", OPT_BOOL, &opt.use_orlov, FALSE },
@@ -38,7 +38,7 @@ PRIVATE struct optset optset_table[] = {
/*===========================================================================*
* main *
*===========================================================================*/
PUBLIC int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/* This is the main routine of this service. The main loop consists of
* three major activities: getting new work, processing the work, and
@@ -107,7 +107,7 @@ PUBLIC int main(int argc, char *argv[])
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -125,7 +125,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the Minix file server. */
int i;
@@ -164,7 +164,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo)
static void sef_cb_signal_handler(int signo)
{
/* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return;
@@ -181,7 +181,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================*
* get_work *
*===========================================================================*/
PRIVATE void get_work(m_in)
static void get_work(m_in)
message *m_in; /* pointer to message */
{
int r, srcok = 0;
@@ -209,7 +209,7 @@ message *m_in; /* pointer to message */
/*===========================================================================*
* reply *
*===========================================================================*/
PRIVATE void reply(
static void reply(
endpoint_t who,
message *m_out /* report result */
)

View File

@@ -12,7 +12,7 @@
/*===========================================================================*
* fs_sync *
*===========================================================================*/
PUBLIC int fs_sync()
int fs_sync()
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical. The
@@ -49,7 +49,7 @@ PUBLIC int fs_sync()
/*===========================================================================*
* fs_flush *
*===========================================================================*/
PUBLIC int fs_flush()
int fs_flush()
{
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
@@ -67,7 +67,7 @@ PUBLIC int fs_flush()
/*===========================================================================*
* fs_new_driver *
*===========================================================================*/
PUBLIC int fs_new_driver(void)
int fs_new_driver(void)
{
/* Set a new driver endpoint for this device. */
dev_t dev;

View File

@@ -17,7 +17,7 @@
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
PUBLIC int fs_readsuper()
int fs_readsuper()
{
/* This function reads the superblock of the partition, gets the root inode
* and sends back the details of them. Note, that the FS process does not
@@ -170,7 +170,7 @@ PUBLIC int fs_readsuper()
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
PUBLIC int fs_mountpoint()
int fs_mountpoint()
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the inode or not.
@@ -201,7 +201,7 @@ PUBLIC int fs_mountpoint()
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
PUBLIC int fs_unmount()
int fs_unmount()
{
/* Unmount a file system by device number. */
int count;

View File

@@ -11,14 +11,14 @@
#include "super.h"
#include <minix/vfsif.h>
FORWARD struct inode *new_node(struct inode *ldirp, char *string, mode_t
static struct inode *new_node(struct inode *ldirp, char *string, mode_t
bits, block_t z0);
/*===========================================================================*
* fs_create *
*===========================================================================*/
PUBLIC int fs_create()
int fs_create()
{
phys_bytes len;
int r;
@@ -78,7 +78,7 @@ PUBLIC int fs_create()
/*===========================================================================*
* fs_mknod *
*===========================================================================*/
PUBLIC int fs_mknod()
int fs_mknod()
{
struct inode *ip, *ldirp;
char lastc[NAME_MAX + 1];
@@ -114,7 +114,7 @@ PUBLIC int fs_mknod()
/*===========================================================================*
* fs_mkdir *
*===========================================================================*/
PUBLIC int fs_mkdir()
int fs_mkdir()
{
int r1, r2; /* status codes */
ino_t dot, dotdot; /* inode numbers for . and .. */
@@ -184,7 +184,7 @@ PUBLIC int fs_mkdir()
/*===========================================================================*
* fs_slink *
*===========================================================================*/
PUBLIC int fs_slink()
int fs_slink()
{
phys_bytes len;
struct inode *sip; /* inode containing symbolic link */
@@ -275,7 +275,7 @@ PUBLIC int fs_slink()
/*===========================================================================*
* new_node *
*===========================================================================*/
PRIVATE struct inode *new_node(struct inode *ldirp,
static struct inode *new_node(struct inode *ldirp,
char *string, mode_t bits, block_t b0)
{
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
@@ -349,7 +349,7 @@ PRIVATE struct inode *new_node(struct inode *ldirp,
/*===========================================================================*
* fs_inhibread *
*===========================================================================*/
PUBLIC int fs_inhibread()
int fs_inhibread()
{
struct inode *rip;

View File

@@ -23,18 +23,18 @@
#include <minix/vfsif.h>
#include <minix/libminixfs.h>
PUBLIC char dot1[2] = "."; /* used for search_dir to bypass the access */
PUBLIC char dot2[3] = ".."; /* permissions for . and .. */
char dot1[2] = "."; /* used for search_dir to bypass the access */
char dot2[3] = ".."; /* permissions for . and .. */
FORWARD char *get_name(char *name, char string[NAME_MAX+1]);
FORWARD int ltraverse(struct inode *rip, char *suffix);
FORWARD int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
static char *get_name(char *name, char string[NAME_MAX+1]);
static int ltraverse(struct inode *rip, char *suffix);
static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
inode **res_inop, size_t *offsetp, int *symlinkp);
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
PUBLIC int fs_lookup()
int fs_lookup()
{
cp_grant_id_t grant;
int r, r1, flags, symlinks;
@@ -120,7 +120,7 @@ PUBLIC int fs_lookup()
/*===========================================================================*
* parse_path *
*===========================================================================*/
PRIVATE int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
ino_t dir_ino;
ino_t root_ino;
int flags;
@@ -280,7 +280,7 @@ int *symlinkp;
/*===========================================================================*
* ltraverse *
*===========================================================================*/
PRIVATE int ltraverse(rip, suffix)
static int ltraverse(rip, suffix)
register struct inode *rip; /* symbolic link */
char *suffix; /* current remaining path. Has to point in the
* user_path buffer
@@ -363,7 +363,7 @@ char *suffix; /* current remaining path. Has to point in the
/*===========================================================================*
* advance *
*===========================================================================*/
PUBLIC struct inode *advance(dirp, string, chk_perm)
struct inode *advance(dirp, string, chk_perm)
struct inode *dirp; /* inode for directory to be searched */
char string[NAME_MAX + 1]; /* component name to look for */
int chk_perm; /* check permissions when string is looked up*/
@@ -432,7 +432,7 @@ int chk_perm; /* check permissions when string is looked up*/
/*===========================================================================*
* get_name *
*===========================================================================*/
PRIVATE char *get_name(path_name, string)
static char *get_name(path_name, string)
char *path_name; /* path name to parse */
char string[NAME_MAX+1]; /* component extracted from 'old_name' */
{
@@ -482,7 +482,7 @@ char string[NAME_MAX+1]; /* component extracted from 'old_name' */
/*===========================================================================*
* search_dir *
*===========================================================================*/
PUBLIC int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
char string[NAME_MAX + 1]; /* component to search for */
ino_t *numb; /* pointer to inode number */

View File

@@ -7,13 +7,13 @@
#include "super.h"
#include <minix/vfsif.h>
FORWARD int in_group(gid_t grp);
static int in_group(gid_t grp);
/*===========================================================================*
* fs_chmod *
*===========================================================================*/
PUBLIC int fs_chmod()
int fs_chmod()
{
/* Perform the chmod(name, mode) system call. */
@@ -42,7 +42,7 @@ PUBLIC int fs_chmod()
/*===========================================================================*
* fs_chown *
*===========================================================================*/
PUBLIC int fs_chown()
int fs_chown()
{
register struct inode *rip;
register int r;
@@ -72,7 +72,7 @@ PUBLIC int fs_chown()
/*===========================================================================*
* forbidden *
*===========================================================================*/
PUBLIC int forbidden(register struct inode *rip, mode_t access_desired)
int forbidden(register struct inode *rip, mode_t access_desired)
{
/* Given a pointer to an inode, 'rip', and the access desired, determine
* if the access is allowed, and if not why not. The routine looks up the
@@ -126,7 +126,7 @@ PUBLIC int forbidden(register struct inode *rip, mode_t access_desired)
/*===========================================================================*
* in_group *
*===========================================================================*/
PRIVATE int in_group(gid_t grp)
static int in_group(gid_t grp)
{
int i;
@@ -144,7 +144,7 @@ PRIVATE int in_group(gid_t grp)
/*===========================================================================*
* read_only *
*===========================================================================*/
PUBLIC int read_only(ip)
int read_only(ip)
struct inode *ip; /* ptr to inode whose file sys is to be cked */
{
/* Check to see if the file system on which the inode 'ip' resides is mounted

View File

@@ -16,21 +16,21 @@
#include <sys/param.h>
FORWARD struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
static struct buf *rahead(struct inode *rip, block_t baseblock, u64_t
position, unsigned bytes_ahead);
FORWARD int rw_chunk(struct inode *rip, u64_t position, unsigned off,
static int rw_chunk(struct inode *rip, u64_t position, unsigned off,
size_t chunk, unsigned left, int rw_flag, cp_grant_id_t gid, unsigned
buf_off, unsigned int block_size, int *completed);
PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
static char getdents_buf[GETDENTS_BUFSIZ];
PRIVATE off_t rdahedpos; /* position to read ahead */
PRIVATE struct inode *rdahed_inode; /* pointer to inode to read ahead */
static off_t rdahedpos; /* position to read ahead */
static struct inode *rdahed_inode; /* pointer to inode to read ahead */
/*===========================================================================*
* fs_readwrite *
*===========================================================================*/
PUBLIC int fs_readwrite(void)
int fs_readwrite(void)
{
int r, rw_flag, block_spec;
int regular;
@@ -139,7 +139,7 @@ PUBLIC int fs_readwrite(void)
/*===========================================================================*
* fs_breadwrite *
*===========================================================================*/
PUBLIC int fs_breadwrite(void)
int fs_breadwrite(void)
{
int r, rw_flag, completed;
cp_grant_id_t gid;
@@ -201,7 +201,7 @@ PUBLIC int fs_breadwrite(void)
/*===========================================================================*
* rw_chunk *
*===========================================================================*/
PRIVATE int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
static int rw_chunk(rip, position, off, chunk, left, rw_flag, gid,
buf_off, block_size, completed)
register struct inode *rip; /* pointer to inode for file to be rd/wr */
u64_t position; /* position within file to read or write */
@@ -290,7 +290,7 @@ int *completed; /* number of bytes copied */
/*===========================================================================*
* read_map *
*===========================================================================*/
PUBLIC block_t read_map(rip, position)
block_t read_map(rip, position)
register struct inode *rip; /* ptr to inode to map from */
off_t position; /* position in file whose blk wanted */
{
@@ -371,7 +371,7 @@ off_t position; /* position in file whose blk wanted */
/*===========================================================================*
* rd_indir *
*===========================================================================*/
PUBLIC block_t rd_indir(bp, index)
block_t rd_indir(bp, index)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
{
@@ -385,7 +385,7 @@ int index; /* index into *bp */
/*===========================================================================*
* read_ahead *
*===========================================================================*/
PUBLIC void read_ahead()
void read_ahead()
{
/* Read a block into the cache before it is needed. */
unsigned int block_size;
@@ -411,7 +411,7 @@ PUBLIC void read_ahead()
/*===========================================================================*
* rahead *
*===========================================================================*/
PRIVATE struct buf *rahead(rip, baseblock, position, bytes_ahead)
static struct buf *rahead(rip, baseblock, position, bytes_ahead)
register struct inode *rip; /* pointer to inode for file to be read */
block_t baseblock; /* block at current position */
u64_t position; /* position within file */
@@ -538,7 +538,7 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
/*===========================================================================*
* fs_getdents *
*===========================================================================*/
PUBLIC int fs_getdents(void)
int fs_getdents(void)
{
register struct inode *rip;
int o, r, done;

View File

@@ -15,7 +15,7 @@
/*===========================================================================*
* stat_inode *
*===========================================================================*/
PRIVATE int stat_inode(
static int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
@@ -63,7 +63,7 @@ PRIVATE int stat_inode(
/*===========================================================================*
* fs_fstatfs *
*===========================================================================*/
PUBLIC int fs_fstatfs()
int fs_fstatfs()
{
struct statfs st;
struct inode *rip;
@@ -85,7 +85,7 @@ PUBLIC int fs_fstatfs()
/*===========================================================================*
* fs_stat *
*===========================================================================*/
PUBLIC int fs_stat()
int fs_stat()
{
register int r; /* return value */
register struct inode *rip; /* target inode */
@@ -101,7 +101,7 @@ PUBLIC int fs_stat()
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
PUBLIC int fs_statvfs()
int fs_statvfs()
{
struct statvfs st;
struct super_block *sp;

View File

@@ -20,22 +20,22 @@
#include "super.h"
#include "const.h"
FORWARD off_t ext2_max_size(int block_size);
FORWARD u32_t ext2_count_dirs(struct super_block *sp);
static off_t ext2_max_size(int block_size);
static u32_t ext2_count_dirs(struct super_block *sp);
FORWARD void super_copy(register struct super_block *dest, register
static void super_copy(register struct super_block *dest, register
struct super_block *source);
FORWARD void copy_group_descriptors(register struct group_desc
static void copy_group_descriptors(register struct group_desc
*dest_array, register struct group_desc *source_array, unsigned int
ngroups);
PRIVATE off_t super_block_offset;
static off_t super_block_offset;
/*===========================================================================*
* get_super *
*===========================================================================*/
PUBLIC struct super_block *get_super(
struct super_block *get_super(
dev_t dev /* device number whose super_block is sought */
)
{
@@ -51,19 +51,19 @@ PUBLIC struct super_block *get_super(
/*===========================================================================*
* get_block_size *
*===========================================================================*/
PUBLIC unsigned int get_block_size(dev_t dev)
unsigned int get_block_size(dev_t dev)
{
if (dev == NO_DEV)
panic("request for block size of NO_DEV");
return(fs_block_size);
}
PRIVATE struct group_desc *ondisk_group_descs;
static struct group_desc *ondisk_group_descs;
/*===========================================================================*
* read_super *
*===========================================================================*/
PUBLIC int read_super(sp)
int read_super(sp)
register struct super_block *sp; /* pointer to a superblock */
{
/* Read a superblock. */
@@ -214,7 +214,7 @@ register struct super_block *sp; /* pointer to a superblock */
/*===========================================================================*
* write_super *
*===========================================================================*/
PUBLIC void write_super(sp)
void write_super(sp)
struct super_block *sp; /* pointer to a superblock */
{
/* Write a superblock and gdt. */
@@ -271,7 +271,7 @@ struct group_desc* get_group_desc(unsigned int bnum)
}
PRIVATE u32_t ext2_count_dirs(struct super_block *sp)
static u32_t ext2_count_dirs(struct super_block *sp)
{
u32_t count = 0;
unsigned int i;
@@ -302,7 +302,7 @@ PRIVATE u32_t ext2_count_dirs(struct super_block *sp)
* Anyway this function is safe for any change.
* Note: there is also limitation from VFS (to LONG_MAX, i.e. 2GB).
*/
PRIVATE off_t ext2_max_size(int block_size)
static off_t ext2_max_size(int block_size)
{
/* 12 is EXT2_NDIR_BLOCKS used in calculations. */
if (EXT2_NDIR_BLOCKS != 12)
@@ -352,7 +352,7 @@ PRIVATE off_t ext2_max_size(int block_size)
/*===========================================================================*
* super_copy *
*===========================================================================*/
PRIVATE void super_copy(
static void super_copy(
register struct super_block *dest,
register struct super_block *source
)
@@ -411,7 +411,7 @@ PRIVATE void super_copy(
/*===========================================================================*
* gd_copy *
*===========================================================================*/
PRIVATE void gd_copy(
static void gd_copy(
register struct group_desc *dest,
register struct group_desc *source
)
@@ -434,7 +434,7 @@ PRIVATE void gd_copy(
/*===========================================================================*
* copy_group_descriptors *
*===========================================================================*/
PRIVATE void copy_group_descriptors(
static void copy_group_descriptors(
register struct group_desc *dest_array,
register struct group_desc *source_array,
unsigned int ngroups

View File

@@ -12,7 +12,7 @@
#include "buf.h"
#include "super.h"
PUBLIC int (*fs_call_vec[])(void) = {
int (*fs_call_vec[])(void) = {
no_sys, /* 0 not used */
no_sys, /* 1 */ /* Was: fs_getnode */
fs_putnode, /* 2 */

View File

@@ -12,7 +12,7 @@
/*===========================================================================*
* fs_utime *
*===========================================================================*/
PUBLIC int fs_utime()
int fs_utime()
{
register struct inode *rip;
register int r;

View File

@@ -11,7 +11,7 @@
/*===========================================================================*
* no_sys *
*===========================================================================*/
PUBLIC int no_sys()
int no_sys()
{
/* Somebody has used an illegal system call number */
printf("no_sys: invalid call %d\n", req_nr);
@@ -22,7 +22,7 @@ PUBLIC int no_sys()
/*===========================================================================*
* conv2 *
*===========================================================================*/
PUBLIC unsigned conv2(norm, w)
unsigned conv2(norm, w)
int norm; /* TRUE if no swap, FALSE for byte swap */
int w; /* promotion of 16-bit word to be swapped */
{
@@ -35,7 +35,7 @@ int w; /* promotion of 16-bit word to be swapped */
/*===========================================================================*
* conv4 *
*===========================================================================*/
PUBLIC long conv4(norm, x)
long conv4(norm, x)
int norm; /* TRUE if no swap, FALSE for byte swap */
long x; /* 32-bit long to be byte swapped */
{
@@ -54,7 +54,7 @@ long x; /* 32-bit long to be byte swapped */
/*===========================================================================*
* clock_time *
*===========================================================================*/
PUBLIC time_t clock_time()
time_t clock_time()
{
/* This routine returns the time in seconds since 1.1.1970. MINIX is an
* astrophysically naive system that assumes the earth rotates at a constant
@@ -75,7 +75,7 @@ PUBLIC time_t clock_time()
/*===========================================================================*
* mfs_min *
*===========================================================================*/
PUBLIC int min(unsigned int l, unsigned int r)
int min(unsigned int l, unsigned int r)
{
if(r >= l) return(l);
@@ -86,7 +86,7 @@ PUBLIC int min(unsigned int l, unsigned int r)
/*===========================================================================*
* mfs_nul *
*===========================================================================*/
PUBLIC void mfs_nul_f(char *file, int line, char *str, unsigned int len,
void mfs_nul_f(char *file, int line, char *str, unsigned int len,
unsigned int maxlen)
{
if(len < maxlen && str[len-1] != '\0') {
@@ -102,7 +102,7 @@ PUBLIC void mfs_nul_f(char *file, int line, char *str, unsigned int len,
/*===========================================================================*
* sanity_check *
*===========================================================================*/
PUBLIC void sanitycheck(char *file, int line)
void sanitycheck(char *file, int line)
{
MYASSERT(SELF_E > 0);
if(superblock->s_dev != NO_DEV) {
@@ -116,7 +116,7 @@ PUBLIC void sanitycheck(char *file, int line)
/*===========================================================================*
* ansi_strcmp *
*===========================================================================*/
PUBLIC int ansi_strcmp(register const char* ansi_s, register const char *s2,
int ansi_strcmp(register const char* ansi_s, register const char *s2,
register size_t ansi_s_length)
{
/* Compare non null-terminated string ansi_s (length=ansi_s_length)
@@ -143,7 +143,7 @@ PUBLIC int ansi_strcmp(register const char* ansi_s, register const char *s2,
/*===========================================================================*
* setbit *
*===========================================================================*/
PUBLIC bit_t setbit(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
bit_t setbit(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
{
/* Find free bit in bitmap and set. Return number of the bit,
* if failed return -1.
@@ -192,7 +192,7 @@ PUBLIC bit_t setbit(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
/*===========================================================================*
* setbyte *
*===========================================================================*/
PUBLIC bit_t setbyte(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
bit_t setbyte(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
{
/* Find free byte in bitmap and set it. Return number of the starting bit,
* if failed return -1.
@@ -233,7 +233,7 @@ PUBLIC bit_t setbyte(bitchunk_t *bitmap, bit_t max_bits, unsigned int word)
/*===========================================================================*
* unsetbit *
*===========================================================================*/
PUBLIC int unsetbit(bitchunk_t *bitmap, bit_t bit)
int unsetbit(bitchunk_t *bitmap, bit_t bit)
{
/* Unset specified bit. If requested bit is already free return -1,
* otherwise return 0.

View File

@@ -16,13 +16,13 @@
#include "inode.h"
#include "super.h"
FORWARD void wr_indir(struct buf *bp, int index, block_t block);
FORWARD int empty_indir(struct buf *, struct super_block *);
static void wr_indir(struct buf *bp, int index, block_t block);
static int empty_indir(struct buf *, struct super_block *);
/*===========================================================================*
* write_map *
*===========================================================================*/
PUBLIC int write_map(rip, position, new_block, op)
int write_map(rip, position, new_block, op)
struct inode *rip; /* pointer to inode to be changed */
off_t position; /* file address to be mapped */
block_t new_block; /* block # to be inserted */
@@ -267,7 +267,7 @@ int op; /* special actions */
/*===========================================================================*
* wr_indir *
*===========================================================================*/
PRIVATE void wr_indir(bp, index, block)
static void wr_indir(bp, index, block)
struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */
block_t block; /* block to write */
@@ -285,7 +285,7 @@ block_t block; /* block to write */
/*===========================================================================*
* empty_indir *
*===========================================================================*/
PRIVATE int empty_indir(bp, sb)
static int empty_indir(bp, sb)
struct buf *bp; /* pointer to indirect block */
struct super_block *sb; /* superblock of device block resides on */
{
@@ -303,7 +303,7 @@ struct super_block *sb; /* superblock of device block resides on */
/*===========================================================================*
* new_block *
*===========================================================================*/
PUBLIC struct buf *new_block(rip, position)
struct buf *new_block(rip, position)
register struct inode *rip; /* pointer to inode */
off_t position; /* file pointer */
{
@@ -364,7 +364,7 @@ off_t position; /* file pointer */
/*===========================================================================*
* zero_block *
*===========================================================================*/
PUBLIC void zero_block(bp)
void zero_block(bp)
register struct buf *bp; /* pointer to buffer to zero */
{
/* Zero a block. */