Cleanup: convert K&R-style definitions to ANSI-style in minix/fs
This task is listed in minix wishlist. No functional chamges are intended.
This commit is contained in:
parent
4db99f4012
commit
40fa176362
|
|
@ -146,11 +146,12 @@ static void check_block_number(block_t block, struct super_block *sp,
|
|||
|
||||
/*===========================================================================*
|
||||
* alloc_block_bit *
|
||||
* sp: the file system to allocate from
|
||||
* goal: try to allocate near this block
|
||||
* rip: used for preallocation
|
||||
*===========================================================================*/
|
||||
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 */
|
||||
static block_t alloc_block_bit(struct super_block *sp, block_t goal,
|
||||
struct inode *rip)
|
||||
{
|
||||
block_t block = NO_BLOCK; /* allocated block */
|
||||
int word; /* word in block bitmap */
|
||||
|
|
|
|||
|
|
@ -119,11 +119,13 @@ static int find_group_orlov(struct super_block *sp, struct inode
|
|||
|
||||
/*===========================================================================*
|
||||
* alloc_inode_bit *
|
||||
* sp: the filesystem to allocate from *
|
||||
* parent: parent of newly allocated inode *
|
||||
* is_dir: inode will be a directory if it is *
|
||||
* TRUE *
|
||||
*===========================================================================*/
|
||||
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 */
|
||||
static bit_t alloc_inode_bit(struct super_block *sp, struct inode *parent,
|
||||
int is_dir)
|
||||
{
|
||||
int group;
|
||||
ino_t inumber = NO_BIT;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ int fs_putnode(ino_t ino_nr, unsigned int count)
|
|||
/*===========================================================================*
|
||||
* init_inode_cache *
|
||||
*===========================================================================*/
|
||||
void init_inode_cache()
|
||||
void init_inode_cache(void)
|
||||
{
|
||||
struct inode *rip;
|
||||
struct inodelist *rlp;
|
||||
|
|
|
|||
|
|
@ -192,12 +192,13 @@ ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* remove_dir *
|
||||
* remove_dir *
|
||||
* rldirp: parent directory *
|
||||
* rip: directory to be removed *
|
||||
* dir_name: name of directory to be removed *
|
||||
*===========================================================================*/
|
||||
static int remove_dir(rldirp, rip, dir_name)
|
||||
struct inode *rldirp; /* parent directory */
|
||||
struct inode *rip; /* directory to be removed */
|
||||
const char *dir_name; /* name of directory to be removed */
|
||||
static int remove_dir(struct inode *rldirp, struct inode *rip,
|
||||
const char *dir_name)
|
||||
{
|
||||
/* A directory file has to be removed. Five conditions have to met:
|
||||
* - The file must be a directory
|
||||
|
|
@ -227,12 +228,13 @@ const char *dir_name; /* name of directory to be removed */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* unlink_file *
|
||||
* unlink_file *
|
||||
* dirp: parent directory of file *
|
||||
* rip: inode of file, may be NULL too *
|
||||
* file_name: name of file to be removed *
|
||||
*===========================================================================*/
|
||||
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. */
|
||||
const char *file_name; /* name of file to be removed */
|
||||
static int unlink_file(struct inode *dirp, struct inode *rip,
|
||||
const char *file_name)
|
||||
{
|
||||
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
||||
|
||||
|
|
@ -466,11 +468,11 @@ int fs_trunc(ino_t ino_nr, off_t start, off_t end)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* truncate_inode *
|
||||
* truncate_inode *
|
||||
* rip: pointer to inode to be truncated *
|
||||
* newsize: inode must become this size *
|
||||
*===========================================================================*/
|
||||
int truncate_inode(rip, newsize)
|
||||
register struct inode *rip; /* pointer to inode to be truncated */
|
||||
off_t newsize; /* inode must become this size */
|
||||
int truncate_inode(register struct inode *rip, off_t newsize)
|
||||
{
|
||||
/* Set inode to a certain size, freeing any blocks no longer referenced
|
||||
* and updating the size in the inode. If the inode is extended, the
|
||||
|
|
@ -510,11 +512,11 @@ off_t newsize; /* inode must become this size */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* freesp_inode *
|
||||
* freesp_inode *
|
||||
* rip: pointer to inode to be partly freed *
|
||||
* start, end: range of bytes to free (end uninclusive) *
|
||||
*===========================================================================*/
|
||||
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) */
|
||||
static int freesp_inode(register struct inode *rip, off_t start, off_t end)
|
||||
{
|
||||
/* Cut an arbitrary hole in an inode. The caller is responsible for checking
|
||||
* the reasonableness of the inode type of rip. The reason is this is that
|
||||
|
|
@ -585,9 +587,7 @@ off_t start, end; /* range of bytes to free (end uninclusive) */
|
|||
/*===========================================================================*
|
||||
* nextblock *
|
||||
*===========================================================================*/
|
||||
static off_t nextblock(pos, block_size)
|
||||
off_t pos;
|
||||
unsigned short block_size;
|
||||
static off_t nextblock(off_t pos, int block_size)
|
||||
{
|
||||
/* Return the first position in the next block after position 'pos'
|
||||
* (unless this is the first position in the current block).
|
||||
|
|
@ -603,10 +603,7 @@ unsigned short block_size;
|
|||
/*===========================================================================*
|
||||
* zeroblock_half *
|
||||
*===========================================================================*/
|
||||
static void zeroblock_half(rip, pos, half)
|
||||
struct inode *rip;
|
||||
off_t pos;
|
||||
int half;
|
||||
static void zeroblock_half(struct inode *rip, off_t pos, int half)
|
||||
{
|
||||
/* Zero the upper or lower 'half' of a block that holds position 'pos'.
|
||||
* half can be FIRST_HALF or LAST_HALF.
|
||||
|
|
@ -633,10 +630,7 @@ int half;
|
|||
/*===========================================================================*
|
||||
* zeroblock_range *
|
||||
*===========================================================================*/
|
||||
static void zeroblock_range(rip, pos, len)
|
||||
struct inode *rip;
|
||||
off_t pos;
|
||||
off_t len;
|
||||
static void zeroblock_range(struct inode *rip, off_t pos, off_t len)
|
||||
{
|
||||
/* Zero a range in a block.
|
||||
* This function is used to zero a segment of a block.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int main(int argc, char *argv[])
|
|||
/*===========================================================================*
|
||||
* sef_local_startup *
|
||||
*===========================================================================*/
|
||||
static void sef_local_startup()
|
||||
static void sef_local_startup(void)
|
||||
{
|
||||
/* Register init callbacks. */
|
||||
sef_setcb_init_fresh(sef_cb_init_fresh);
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ int fs_lookup(ino_t dir_nr, char *name, struct fsdriver_node *node,
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* advance *
|
||||
* advance *
|
||||
* dirp: inode for directory to be searched *
|
||||
* string: component name to look for *
|
||||
*===========================================================================*/
|
||||
struct inode *advance(dirp, string)
|
||||
struct inode *dirp; /* inode for directory to be searched */
|
||||
const char *string; /* component name to look for */
|
||||
struct inode *advance(struct inode *dirp, const char *string)
|
||||
{
|
||||
/* Given a directory and a component of a path, look up the component in
|
||||
* the directory, find the inode, open it, and return a pointer to its inode
|
||||
|
|
@ -91,13 +91,14 @@ const char *string; /* component name to look for */
|
|||
|
||||
/*===========================================================================*
|
||||
* search_dir *
|
||||
* ldir_ptr: ptr to inode for dir to search
|
||||
* string: component to search for
|
||||
* numb: pointer to inode number
|
||||
* flag: LOOK_UP, ENTER, DELETE or IS_EMPTY
|
||||
* ftype: used when ENTER and INCOMPAT_FILETYPE
|
||||
*===========================================================================*/
|
||||
int search_dir(ldir_ptr, string, numb, flag, ftype)
|
||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||
const char *string; /* component to search for */
|
||||
ino_t *numb; /* pointer to inode number */
|
||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||
int ftype; /* used when ENTER and INCOMPAT_FILETYPE */
|
||||
int search_dir(register struct inode *ldir_ptr, const char *string,
|
||||
ino_t *numb, int flag, int ftype)
|
||||
{
|
||||
/* This function searches the directory whose inode is pointed to by 'ldip':
|
||||
* if (flag == ENTER) enter 'string' in the directory with inode # '*numb';
|
||||
|
|
|
|||
|
|
@ -101,20 +101,22 @@ ssize_t fs_readwrite(ino_t ino_nr, struct fsdriver_data *data, size_t nrbytes,
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* rw_chunk *
|
||||
* rw_chunk *
|
||||
* rip: pointer to inode for file to be rd/wr *
|
||||
* position: position within file to read or write *
|
||||
* off: off within the current block *
|
||||
* chunk: number of bytes to read or write *
|
||||
* left: max number of bytes wanted after position *
|
||||
* call: FSC_READ, FSC_WRITE, or FSC_PEEK *
|
||||
* data: structure for (remote) user buffer *
|
||||
* buf_off: offset in user buffer *
|
||||
* block_size: block size of FS operating on *
|
||||
* completed: number of bytes copied *
|
||||
*===========================================================================*/
|
||||
static int rw_chunk(rip, position, off, chunk, left, call, data, 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 */
|
||||
unsigned off; /* off within the current block */
|
||||
size_t chunk; /* number of bytes to read or write */
|
||||
unsigned left; /* max number of bytes wanted after position */
|
||||
int call; /* FSC_READ, FSC_WRITE, or FSC_PEEK */
|
||||
struct fsdriver_data *data; /* structure for (remote) user buffer */
|
||||
unsigned buf_off; /* offset in user buffer */
|
||||
unsigned int block_size; /* block size of FS operating on */
|
||||
int *completed; /* number of bytes copied */
|
||||
static int rw_chunk(register struct inode *rip, u64_t position, unsigned off,
|
||||
size_t chunk, unsigned left, int call,
|
||||
struct fsdriver_data *data, unsigned buf_off,
|
||||
unsigned int block_size, int *completed)
|
||||
{
|
||||
/* Read or write (part of) a block. */
|
||||
|
||||
|
|
@ -196,12 +198,11 @@ int *completed; /* number of bytes copied */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* read_map *
|
||||
* read_map *
|
||||
* rip: prt to inode to map from *
|
||||
* position: position in file whose blk wanted *
|
||||
*===========================================================================*/
|
||||
block_t read_map(rip, position, opportunistic)
|
||||
register struct inode *rip; /* ptr to inode to map from */
|
||||
off_t position; /* position in file whose blk wanted */
|
||||
int opportunistic;
|
||||
block_t read_map(register struct inode *rip, off_t position, int opportunistic)
|
||||
{
|
||||
/* Given an inode and a position within the corresponding file, locate the
|
||||
* block number in which that position is to be found and return it.
|
||||
|
|
@ -296,11 +297,11 @@ struct buf *get_block_map(register struct inode *rip, u64_t position)
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* rd_indir *
|
||||
* rd_indir *
|
||||
* bp: pointer to indirect block *
|
||||
* mindex: index into *bp *
|
||||
*===========================================================================*/
|
||||
block_t rd_indir(bp, mindex)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
int mindex; /* index into *bp */
|
||||
block_t rd_indir(struct buf *bp, int mindex)
|
||||
{
|
||||
if (bp == NULL)
|
||||
panic("rd_indir() on NULL");
|
||||
|
|
@ -310,13 +311,14 @@ int mindex; /* index into *bp */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* rahead *
|
||||
* rahead *
|
||||
* rip : pointer to inode for file to be read *
|
||||
* baselock: block at current position *
|
||||
* position: position within file *
|
||||
* bytes ahead: bytes beyond position for immediate use *
|
||||
*===========================================================================*/
|
||||
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 */
|
||||
unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
||||
static struct buf *rahead(register struct inode *rip, block_t baseblock,
|
||||
u64_t position, unsigned bytes_ahead)
|
||||
{
|
||||
/* Fetch a block from the cache or the device. If a physical read is
|
||||
* required, prefetch as many more blocks as convenient into the cache.
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ static struct group_desc *ondisk_group_descs;
|
|||
|
||||
/*===========================================================================*
|
||||
* read_super *
|
||||
* sp: pointer to superblock *
|
||||
*===========================================================================*/
|
||||
int read_super(sp)
|
||||
register struct super_block *sp; /* pointer to a superblock */
|
||||
int read_super(register struct super_block *sp)
|
||||
{
|
||||
/* Read a superblock. */
|
||||
dev_t dev;
|
||||
|
|
@ -216,10 +216,10 @@ register struct super_block *sp; /* pointer to a superblock */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* write_super *
|
||||
* write_super *
|
||||
* super_block: pointer to a superblock *
|
||||
*===========================================================================*/
|
||||
void write_super(sp)
|
||||
struct super_block *sp; /* pointer to a superblock */
|
||||
void write_super(struct super_block *sp)
|
||||
{
|
||||
/* Write a superblock and gdt. */
|
||||
int r;
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ struct buf *get_block(dev_t dev, block_t block, int how)
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* conv2 *
|
||||
* conv2 *
|
||||
* norm: TRUE if no swap, FALSE for byte swap *
|
||||
* w: promotion of 16-bit word to be swapped *
|
||||
*===========================================================================*/
|
||||
unsigned conv2(norm, w)
|
||||
int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
int w; /* promotion of 16-bit word to be swapped */
|
||||
unsigned conv2(int norm, int w)
|
||||
{
|
||||
/* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
|
||||
if (norm) return( (unsigned) w & 0xFFFF);
|
||||
|
|
@ -44,11 +44,11 @@ int w; /* promotion of 16-bit word to be swapped */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* conv4 *
|
||||
* conv4 *
|
||||
* norm: TRUE if no swap, FALSE for byte swap *
|
||||
* x: 32-bit long to be byte swapped *
|
||||
*===========================================================================*/
|
||||
long conv4(norm, x)
|
||||
int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
long x; /* 32-bit long to be byte swapped */
|
||||
long conv4(int norm, long x)
|
||||
{
|
||||
/* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
|
||||
unsigned lo, hi;
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ static void wr_indir(struct buf *bp, int index, block_t block);
|
|||
static int empty_indir(struct buf *, struct super_block *);
|
||||
|
||||
/*===========================================================================*
|
||||
* write_map *
|
||||
* write_map *
|
||||
* rip: pointer to inode to be changed *
|
||||
* position: file address to be mapped *
|
||||
* new_wblock: block # to be inserted *
|
||||
* op: special actions *
|
||||
*===========================================================================*/
|
||||
int write_map(rip, position, new_wblock, op)
|
||||
struct inode *rip; /* pointer to inode to be changed */
|
||||
off_t position; /* file address to be mapped */
|
||||
block_t new_wblock; /* block # to be inserted */
|
||||
int op; /* special actions */
|
||||
int write_map(struct inode *rip, off_t position, block_t new_wblock, int op)
|
||||
{
|
||||
/* Write a new block into an inode.
|
||||
*
|
||||
|
|
@ -264,12 +264,12 @@ int op; /* special actions */
|
|||
|
||||
|
||||
/*===========================================================================*
|
||||
* wr_indir *
|
||||
* wr_indir *
|
||||
* bp: pointer to indirect block *
|
||||
* wrindex: index into *bp *
|
||||
* block: block to write *
|
||||
*===========================================================================*/
|
||||
static void wr_indir(bp, wrindex, block)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
int wrindex; /* index into *bp */
|
||||
block_t block; /* block to write */
|
||||
static void wr_indir(struct buf *bp, int wrindex, block_t block)
|
||||
{
|
||||
/* Given a pointer to an indirect block, write one entry. */
|
||||
|
||||
|
|
@ -283,10 +283,10 @@ block_t block; /* block to write */
|
|||
|
||||
/*===========================================================================*
|
||||
* empty_indir *
|
||||
* bp: pointer to indirect block
|
||||
* sb: superblock of device block resides on
|
||||
*===========================================================================*/
|
||||
static int empty_indir(bp, sb)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
struct super_block *sb; /* superblock of device block resides on */
|
||||
static int empty_indir(struct buf *bp, struct super_block *sb)
|
||||
{
|
||||
/* Return nonzero if the indirect block pointed to by bp contains
|
||||
* only NO_BLOCK entries.
|
||||
|
|
@ -300,11 +300,11 @@ struct super_block *sb; /* superblock of device block resides on */
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* new_block *
|
||||
* new_block *
|
||||
* rip: pointer to inode *
|
||||
* position: file pointer *
|
||||
*===========================================================================*/
|
||||
struct buf *new_block(rip, position)
|
||||
register struct inode *rip; /* pointer to inode */
|
||||
off_t position; /* file pointer */
|
||||
struct buf *new_block(register struct inode *rip, off_t position)
|
||||
{
|
||||
/* Acquire a new block and return a pointer to it. */
|
||||
struct buf *bp;
|
||||
|
|
@ -364,10 +364,10 @@ off_t position; /* file pointer */
|
|||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* zero_block *
|
||||
* zero_block *
|
||||
* pointer to buffer to zero *
|
||||
*===========================================================================*/
|
||||
void zero_block(bp)
|
||||
register struct buf *bp; /* pointer to buffer to zero */
|
||||
void zero_block(register struct buf *bp)
|
||||
{
|
||||
/* Zero a block. */
|
||||
ASSERT(bp->data);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int fs_putnode(ino_t ino_nr, unsigned int count)
|
|||
/*===========================================================================*
|
||||
* init_inode_cache *
|
||||
*===========================================================================*/
|
||||
void init_inode_cache()
|
||||
void init_inode_cache(void)
|
||||
{
|
||||
struct inode *rip;
|
||||
struct inodelist *rlp;
|
||||
|
|
@ -203,8 +203,9 @@ struct inode *find_inode(
|
|||
/*===========================================================================*
|
||||
* put_inode *
|
||||
*===========================================================================*/
|
||||
void put_inode(rip)
|
||||
register struct inode *rip; /* pointer to inode to be released */
|
||||
void put_inode(
|
||||
register struct inode *rip /* pointer to inode to be released */
|
||||
)
|
||||
{
|
||||
/* The caller is no longer using this inode. If no one else is using it either
|
||||
* write it back to the disk immediately. If it has no links, truncate it and
|
||||
|
|
@ -306,8 +307,9 @@ struct inode *alloc_inode(dev_t dev, mode_t bits, uid_t uid, gid_t gid)
|
|||
/*===========================================================================*
|
||||
* wipe_inode *
|
||||
*===========================================================================*/
|
||||
static void wipe_inode(rip)
|
||||
register struct inode *rip; /* the inode to be erased */
|
||||
static void wipe_inode(
|
||||
register struct inode *rip /* the inode to be erased */
|
||||
)
|
||||
{
|
||||
/* Erase some fields in the inode. This function is called from alloc_inode()
|
||||
* when a new inode is to be allocated, and from truncate(), when an existing
|
||||
|
|
@ -346,8 +348,9 @@ static void free_inode(
|
|||
/*===========================================================================*
|
||||
* update_times *
|
||||
*===========================================================================*/
|
||||
void update_times(rip)
|
||||
register struct inode *rip; /* pointer to inode to be read/written */
|
||||
void update_times(
|
||||
register struct inode *rip /* pointer to inode to be read/written */
|
||||
)
|
||||
{
|
||||
/* Various system calls are required by the standard to update atime, ctime,
|
||||
* or mtime. Since updating a time requires sending a message to the clock
|
||||
|
|
@ -372,9 +375,10 @@ register struct inode *rip; /* pointer to inode to be read/written */
|
|||
/*===========================================================================*
|
||||
* rw_inode *
|
||||
*===========================================================================*/
|
||||
void rw_inode(rip, rw_flag)
|
||||
register struct inode *rip; /* pointer to inode to be read/written */
|
||||
int rw_flag; /* READING or WRITING */
|
||||
void rw_inode(
|
||||
register struct inode *rip, /* pointer to inode to be read/written */
|
||||
int rw_flag /* READING or WRITING */
|
||||
)
|
||||
{
|
||||
/* An entry in the inode table is to be copied to or from the disk. */
|
||||
|
||||
|
|
@ -411,11 +415,12 @@ int rw_flag; /* READING or WRITING */
|
|||
/*===========================================================================*
|
||||
* new_icopy *
|
||||
*===========================================================================*/
|
||||
static void new_icopy(rip, dip, direction, norm)
|
||||
register struct inode *rip; /* pointer to the in-core inode struct */
|
||||
register d2_inode *dip; /* pointer to the d2_inode struct */
|
||||
int direction; /* READING (from disk) or WRITING (to disk) */
|
||||
int norm; /* TRUE = do not swap bytes; FALSE = swap */
|
||||
static void new_icopy(
|
||||
register struct inode *rip, /* pointer to the in-core inode struct */
|
||||
register d2_inode *dip, /* pointer to the d2_inode struct */
|
||||
int direction, /* READING (from disk) or WRITING (to disk) */
|
||||
int norm /* TRUE = do not swap bytes; FALSE = swap */
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -452,8 +457,9 @@ int norm; /* TRUE = do not swap bytes; FALSE = swap */
|
|||
/*===========================================================================*
|
||||
* dup_inode *
|
||||
*===========================================================================*/
|
||||
void dup_inode(ip)
|
||||
struct inode *ip; /* The inode to be duplicated. */
|
||||
void dup_inode(
|
||||
struct inode *ip /* The inode to be duplicated. */
|
||||
)
|
||||
{
|
||||
/* This routine is a simplified form of get_inode() for the case where
|
||||
* the inode pointer is already known.
|
||||
|
|
|
|||
|
|
@ -181,10 +181,11 @@ ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes)
|
|||
/*===========================================================================*
|
||||
* remove_dir *
|
||||
*===========================================================================*/
|
||||
static int remove_dir(rldirp, rip, dir_name)
|
||||
struct inode *rldirp; /* parent directory */
|
||||
struct inode *rip; /* directory to be removed */
|
||||
char dir_name[MFS_NAME_MAX]; /* name of directory to be removed */
|
||||
static int remove_dir(
|
||||
struct inode *rldirp, /* parent directory */
|
||||
struct inode *rip, /* directory to be removed */
|
||||
char dir_name[MFS_NAME_MAX] /* name of directory to be removed */
|
||||
)
|
||||
{
|
||||
/* A directory file has to be removed. Five conditions have to met:
|
||||
* - The file must be a directory
|
||||
|
|
@ -216,10 +217,11 @@ char dir_name[MFS_NAME_MAX]; /* name of directory to be removed */
|
|||
/*===========================================================================*
|
||||
* unlink_file *
|
||||
*===========================================================================*/
|
||||
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[MFS_NAME_MAX]; /* name of file to be removed */
|
||||
static int unlink_file(
|
||||
struct inode *dirp, /* parent directory of file */
|
||||
struct inode *rip, /* inode of file, may be NULL too. */
|
||||
char file_name[MFS_NAME_MAX] /* name of file to be removed */
|
||||
)
|
||||
{
|
||||
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
||||
|
||||
|
|
@ -449,9 +451,10 @@ int fs_trunc(ino_t ino_nr, off_t start, off_t end)
|
|||
/*===========================================================================*
|
||||
* truncate_inode *
|
||||
*===========================================================================*/
|
||||
int truncate_inode(rip, newsize)
|
||||
register struct inode *rip; /* pointer to inode to be truncated */
|
||||
off_t newsize; /* inode must become this size */
|
||||
int truncate_inode(
|
||||
register struct inode *rip, /* pointer to inode to be truncated */
|
||||
off_t newsize /* inode must become this size */
|
||||
)
|
||||
{
|
||||
/* Set inode to a certain size, freeing any zones no longer referenced
|
||||
* and updating the size in the inode. If the inode is extended, the
|
||||
|
|
@ -491,9 +494,11 @@ off_t newsize; /* inode must become this size */
|
|||
/*===========================================================================*
|
||||
* freesp_inode *
|
||||
*===========================================================================*/
|
||||
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) */
|
||||
static int freesp_inode(
|
||||
register struct inode *rip, /* pointer to inode to be partly freed */
|
||||
off_t start,
|
||||
off_t end /* range of bytes to free (end uninclusive) */
|
||||
)
|
||||
{
|
||||
/* Cut an arbitrary hole in an inode. The caller is responsible for checking
|
||||
* the reasonableness of the inode type of rip. The reason is this is that
|
||||
|
|
@ -555,9 +560,7 @@ off_t start, end; /* range of bytes to free (end uninclusive) */
|
|||
/*===========================================================================*
|
||||
* nextblock *
|
||||
*===========================================================================*/
|
||||
static off_t nextblock(pos, zone_size)
|
||||
off_t pos;
|
||||
int zone_size;
|
||||
static off_t nextblock(off_t pos, int zone_size)
|
||||
{
|
||||
/* Return the first position in the next block after position 'pos'
|
||||
* (unless this is the first position in the current block).
|
||||
|
|
@ -573,11 +576,8 @@ int zone_size;
|
|||
/*===========================================================================*
|
||||
* zerozone_half *
|
||||
*===========================================================================*/
|
||||
static void zerozone_half(rip, pos, half, zone_size)
|
||||
struct inode *rip;
|
||||
off_t pos;
|
||||
int half;
|
||||
int zone_size;
|
||||
static void zerozone_half(struct inode *rip, off_t pos, int half,
|
||||
int zone_size)
|
||||
{
|
||||
/* Zero the upper or lower 'half' of a zone that holds position 'pos'.
|
||||
* half can be FIRST_HALF or LAST_HALF.
|
||||
|
|
@ -604,10 +604,7 @@ int zone_size;
|
|||
/*===========================================================================*
|
||||
* zerozone_range *
|
||||
*===========================================================================*/
|
||||
static void zerozone_range(rip, pos, len)
|
||||
struct inode *rip;
|
||||
off_t pos;
|
||||
off_t len;
|
||||
static void zerozone_range(struct inode *rip, off_t pos, off_t len)
|
||||
{
|
||||
/* Zero an arbitrary byte range in a zone, possibly spanning multiple blocks.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ int main(int argc, char *argv[])
|
|||
/*===========================================================================*
|
||||
* sef_local_startup *
|
||||
*===========================================================================*/
|
||||
static void sef_local_startup()
|
||||
static void sef_local_startup(void)
|
||||
{
|
||||
/* Register init callbacks. */
|
||||
sef_setcb_init_fresh(sef_cb_init_fresh);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,10 @@ int fs_lookup(ino_t dir_nr, char *name, struct fsdriver_node *node,
|
|||
/*===========================================================================*
|
||||
* advance *
|
||||
*===========================================================================*/
|
||||
struct inode *advance(dirp, string)
|
||||
struct inode *dirp; /* inode for directory to be searched */
|
||||
const char *string; /* component name to look for */
|
||||
struct inode *advance(
|
||||
struct inode *dirp, /* inode for directory to be searched */
|
||||
const char *string /* component name to look for */
|
||||
)
|
||||
{
|
||||
/* Given a directory and a component of a path, look up the component in
|
||||
* the directory, find the inode, open it, and return a pointer to its inode
|
||||
|
|
@ -89,11 +90,12 @@ const char *string; /* component name to look for */
|
|||
/*===========================================================================*
|
||||
* search_dir *
|
||||
*===========================================================================*/
|
||||
int search_dir(ldir_ptr, string, numb, flag)
|
||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||
const char *string; /* component to search for */
|
||||
ino_t *numb; /* pointer to inode number */
|
||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||
int search_dir(
|
||||
register struct inode *ldir_ptr, /* ptr to inode for dir to search */
|
||||
const char *string, /* component to search for */
|
||||
ino_t *numb, /* pointer to inode number */
|
||||
int flag /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||
)
|
||||
{
|
||||
/* This function searches the directory whose inode is pointed to by 'ldip':
|
||||
* if (flag == ENTER) enter 'string' in the directory with inode # '*numb';
|
||||
|
|
|
|||
|
|
@ -114,18 +114,18 @@ ssize_t fs_readwrite(ino_t ino_nr, struct fsdriver_data *data, size_t nrbytes,
|
|||
/*===========================================================================*
|
||||
* rw_chunk *
|
||||
*===========================================================================*/
|
||||
static int rw_chunk(rip, position, off, chunk, left, call, data, 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 */
|
||||
unsigned off; /* off within the current block */
|
||||
size_t chunk; /* number of bytes to read or write */
|
||||
unsigned left; /* max number of bytes wanted after position */
|
||||
int call; /* FSC_READ, FSC_WRITE, or FSC_PEEK */
|
||||
struct fsdriver_data *data; /* structure for (remote) user buffer */
|
||||
unsigned buf_off; /* offset in user buffer */
|
||||
unsigned int block_size; /* block size of FS operating on */
|
||||
int *completed; /* number of bytes copied */
|
||||
static int rw_chunk(
|
||||
register struct inode *rip, /* pointer to inode for file to be rd/wr */
|
||||
u64_t position, /* position within file to read or write */
|
||||
unsigned off, /* off within the current block */
|
||||
size_t chunk, /* number of bytes to read or write */
|
||||
unsigned left, /* max number of bytes wanted after position */
|
||||
int call, /* FSC_READ, FSC_WRITE, or FSC_PEEK */
|
||||
struct fsdriver_data *data, /* structure for (remote) user buffer */
|
||||
unsigned buf_off, /* offset in user buffer */
|
||||
unsigned int block_size, /* block size of FS operating on */
|
||||
int *completed /* number of bytes copied */
|
||||
)
|
||||
{
|
||||
/* Read or write (part of) a block. */
|
||||
struct buf *bp = NULL;
|
||||
|
|
@ -207,10 +207,11 @@ int *completed; /* number of bytes copied */
|
|||
/*===========================================================================*
|
||||
* read_map *
|
||||
*===========================================================================*/
|
||||
block_t read_map(rip, position, opportunistic)
|
||||
register struct inode *rip; /* ptr to inode to map from */
|
||||
off_t position; /* position in file whose blk wanted */
|
||||
int opportunistic; /* if nonzero, only use cache for metadata */
|
||||
block_t read_map(
|
||||
register struct inode *rip, /* ptr to inode to map from */
|
||||
off_t position, /* position in file whose blk wanted */
|
||||
int opportunistic /* if nonzero, only use cache for metadata */
|
||||
)
|
||||
{
|
||||
/* Given an inode and a position within the corresponding file, locate the
|
||||
* block (not zone) number in which that position is to be found and return it.
|
||||
|
|
@ -298,9 +299,10 @@ struct buf *get_block_map(register struct inode *rip, u64_t position)
|
|||
/*===========================================================================*
|
||||
* rd_indir *
|
||||
*===========================================================================*/
|
||||
zone_t rd_indir(bp, index)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
int index; /* index into *bp */
|
||||
zone_t rd_indir(
|
||||
struct buf *bp, /* pointer to indirect block */
|
||||
int index /* index into *bp */
|
||||
)
|
||||
{
|
||||
struct super_block *sp;
|
||||
zone_t zone;
|
||||
|
|
@ -327,11 +329,12 @@ int index; /* index into *bp */
|
|||
/*===========================================================================*
|
||||
* rahead *
|
||||
*===========================================================================*/
|
||||
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 */
|
||||
unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
||||
static struct buf *rahead(
|
||||
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 */
|
||||
unsigned bytes_ahead /* bytes beyond position for immediate use */
|
||||
)
|
||||
{
|
||||
/* Fetch a block from the cache or the device. If a physical read is
|
||||
* required, prefetch as many more blocks as convenient into the cache.
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@
|
|||
/*===========================================================================*
|
||||
* count_free_bits *
|
||||
*===========================================================================*/
|
||||
bit_t count_free_bits(sp, map)
|
||||
struct super_block *sp; /* the filesystem to allocate from */
|
||||
int map; /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t count_free_bits(
|
||||
struct super_block *sp, /* the filesystem to allocate from */
|
||||
int map /* IMAP (inode map) or ZMAP (zone map) */
|
||||
)
|
||||
{
|
||||
/* Allocate a bit from a bit map and return its bit number. */
|
||||
block_t start_block; /* first bit block */
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@
|
|||
/*===========================================================================*
|
||||
* alloc_bit *
|
||||
*===========================================================================*/
|
||||
bit_t alloc_bit(sp, map, origin)
|
||||
struct super_block *sp; /* the filesystem to allocate from */
|
||||
int map; /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t origin; /* number of bit to start searching at */
|
||||
bit_t alloc_bit(
|
||||
struct super_block *sp, /* the filesystem to allocate from */
|
||||
int map, /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t origin /* number of bit to start searching at */
|
||||
)
|
||||
{
|
||||
/* Allocate a bit from a bit map and return its bit number. */
|
||||
|
||||
|
|
@ -108,10 +109,11 @@ bit_t origin; /* number of bit to start searching at */
|
|||
/*===========================================================================*
|
||||
* free_bit *
|
||||
*===========================================================================*/
|
||||
void free_bit(sp, map, bit_returned)
|
||||
struct super_block *sp; /* the filesystem to operate on */
|
||||
int map; /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t bit_returned; /* number of bit to insert into the map */
|
||||
void free_bit(
|
||||
struct super_block *sp, /* the filesystem to operate on */
|
||||
int map, /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t bit_returned /* number of bit to insert into the map */
|
||||
)
|
||||
{
|
||||
/* Return a zone or inode by turning off its bitmap bit. */
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@
|
|||
/*===========================================================================*
|
||||
* conv2 *
|
||||
*===========================================================================*/
|
||||
unsigned conv2(norm, w)
|
||||
int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
int w; /* promotion of 16-bit word to be swapped */
|
||||
unsigned conv2(
|
||||
int norm, /* TRUE if no swap, FALSE for byte swap */
|
||||
int w /* promotion of 16-bit word to be swapped */
|
||||
)
|
||||
{
|
||||
/* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
|
||||
if (norm) return( (unsigned) w & 0xFFFF);
|
||||
|
|
@ -20,9 +21,10 @@ int w; /* promotion of 16-bit word to be swapped */
|
|||
/*===========================================================================*
|
||||
* conv4 *
|
||||
*===========================================================================*/
|
||||
long conv4(norm, x)
|
||||
int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
long x; /* 32-bit long to be byte swapped */
|
||||
long conv4(
|
||||
int norm, /* TRUE if no swap, FALSE for byte swap */
|
||||
long x /* 32-bit long to be byte swapped */
|
||||
)
|
||||
{
|
||||
/* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
|
||||
unsigned lo, hi;
|
||||
|
|
|
|||
|
|
@ -25,11 +25,12 @@ static int empty_indir(struct buf *, struct super_block *);
|
|||
/*===========================================================================*
|
||||
* write_map *
|
||||
*===========================================================================*/
|
||||
int write_map(rip, position, new_zone, op)
|
||||
struct inode *rip; /* pointer to inode to be changed */
|
||||
off_t position; /* file address to be mapped */
|
||||
zone_t new_zone; /* zone # to be inserted */
|
||||
int op; /* special actions */
|
||||
int write_map(
|
||||
struct inode *rip, /* pointer to inode to be changed */
|
||||
off_t position, /* file address to be mapped */
|
||||
zone_t new_zone, /* zone # to be inserted */
|
||||
int op /* special actions */
|
||||
)
|
||||
{
|
||||
/* Write a new zone into an inode.
|
||||
*
|
||||
|
|
@ -188,10 +189,11 @@ int op; /* special actions */
|
|||
/*===========================================================================*
|
||||
* wr_indir *
|
||||
*===========================================================================*/
|
||||
static void wr_indir(bp, index, zone)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
int index; /* index into *bp */
|
||||
zone_t zone; /* zone to write */
|
||||
static void wr_indir(
|
||||
struct buf *bp, /* pointer to indirect block */
|
||||
int index, /* index into *bp */
|
||||
zone_t zone /* zone to write */
|
||||
)
|
||||
{
|
||||
/* Given a pointer to an indirect block, write one entry. */
|
||||
|
||||
|
|
@ -211,9 +213,10 @@ zone_t zone; /* zone to write */
|
|||
/*===========================================================================*
|
||||
* empty_indir *
|
||||
*===========================================================================*/
|
||||
static int empty_indir(bp, sb)
|
||||
struct buf *bp; /* pointer to indirect block */
|
||||
struct super_block *sb; /* superblock of device block resides on */
|
||||
static int empty_indir(
|
||||
struct buf *bp, /* pointer to indirect block */
|
||||
struct super_block *sb /* superblock of device block resides on */
|
||||
)
|
||||
{
|
||||
/* Return nonzero if the indirect block pointed to by bp contains
|
||||
* only NO_ZONE entries.
|
||||
|
|
@ -230,10 +233,11 @@ struct super_block *sb; /* superblock of device block resides on */
|
|||
/*===========================================================================*
|
||||
* clear_zone *
|
||||
*===========================================================================*/
|
||||
void clear_zone(rip, pos, flag)
|
||||
register struct inode *rip; /* inode to clear */
|
||||
off_t __unused pos; /* points to block to clear */
|
||||
int __unused flag; /* 1 if called by new_block, 0 otherwise */
|
||||
void clear_zone(
|
||||
register struct inode *rip, /* inode to clear */
|
||||
off_t __unused pos, /* points to block to clear */
|
||||
int __unused flag /* 1 if called by new_block, 0 otherwise */
|
||||
)
|
||||
{
|
||||
/* Zero a zone, possibly starting in the middle. The parameter 'pos' gives
|
||||
* a byte in the first block to be zeroed. Clearzone() is called from
|
||||
|
|
@ -251,9 +255,10 @@ int __unused flag; /* 1 if called by new_block, 0 otherwise */
|
|||
/*===========================================================================*
|
||||
* new_block *
|
||||
*===========================================================================*/
|
||||
struct buf *new_block(rip, position)
|
||||
register struct inode *rip; /* pointer to inode */
|
||||
off_t position; /* file pointer */
|
||||
struct buf *new_block(
|
||||
register struct inode *rip, /* pointer to inode */
|
||||
off_t position /* file pointer */
|
||||
)
|
||||
{
|
||||
/* Acquire a new block and return a pointer to it. Doing so may require
|
||||
* allocating a complete zone, and then returning the initial block.
|
||||
|
|
@ -308,8 +313,9 @@ off_t position; /* file pointer */
|
|||
/*===========================================================================*
|
||||
* zero_block *
|
||||
*===========================================================================*/
|
||||
void zero_block(bp)
|
||||
register struct buf *bp; /* pointer to buffer to zero */
|
||||
void zero_block(
|
||||
register struct buf *bp /* pointer to buffer to zero */
|
||||
)
|
||||
{
|
||||
/* Zero a block. */
|
||||
ASSERT(bp->data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user