Patch submitted by hoefnix. Ref.
https://groups.google.com/d/msg/minix-dev/sHQDVJRyx1c/eJjrYOqk5bgJ
Change-Id: I2fcdf4cf119ef252ccc7df06849baf37ffd08440
static int get_started(sub_dev_t *sub_dev_ptr);
static int io_ctl_length(int io_request);
static special_file_t* get_special_file(int minor_dev_nr);
-static void tell_dev(vir_bytes buf, size_t size, int pci_bus, int
- pci_dev, int pci_func);
+static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
+ int pci_dev, int pci_func);
static char io_ctl_buf[IOCPARM_MASK];
static int irq_hook_id = 0; /* id of irq hook at the kernel */
/*===========================================================================*
* 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);
return NULL;
}
-static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
-vir_bytes buf;
-size_t size;
-int pci_bus;
-int pci_dev;
-int pci_func;
+static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
+ int pci_dev, int pci_func)
{
int r;
endpoint_t dev_e;
/* Extended partition? */
#define ext_part(s) ((s) == 0x05 || (s) == 0x0F)
-static void parse_part_table(struct blockdriver *bdp, int device, int
- style, int atapi, u8_t *tmp_buf);
-static void extpartition(struct blockdriver *bdp, int extdev, unsigned
- long extbase, u8_t *tmp_buf);
-static int get_part_table(struct blockdriver *bdp, int device, unsigned
- long offset, struct part_entry *table, u8_t *tmp_buf);
+static void parse_part_table(struct blockdriver *bdp, int device,
+ int style, int atapi, u8_t *tmp_buf);
+
+static void extpartition(struct blockdriver *bdp, int extdev,
+ unsigned long extbase, u8_t *tmp_buf);
+
+static int get_part_table(struct blockdriver *bdp, int device,
+ unsigned long offset, struct part_entry *table, u8_t *tmp_buf);
+
static void sort(struct part_entry *table);
/*============================================================================*
* partition *
*============================================================================*/
-void partition(bdp, device, style, atapi)
-struct blockdriver *bdp; /* device dependent entry points */
-int device; /* device to partition */
-int style; /* partitioning style: floppy, primary, sub. */
-int atapi; /* atapi device */
+void partition(
+ struct blockdriver *bdp, /* device dependent entry points */
+ int device, /* device to partition */
+ int style, /* partitioning style: floppy, primary, sub. */
+ int atapi /* atapi device */
+)
{
/* This routine is called on first open to initialize the partition tables
* of a device.
/*============================================================================*
* parse_part_table *
*============================================================================*/
-static void parse_part_table(bdp, device, style, atapi, tmp_buf)
-struct blockdriver *bdp; /* device dependent entry points */
-int device; /* device to partition */
-int style; /* partitioning style: floppy, primary, sub. */
-int atapi; /* atapi device */
-u8_t *tmp_buf; /* temporary buffer */
+static void parse_part_table(
+ struct blockdriver *bdp, /* device dependent entry points */
+ int device, /* device to partition */
+ int style, /* partitioning style: floppy, primary, sub. */
+ int atapi, /* atapi device */
+ u8_t *tmp_buf /* temporary buffer */
+)
{
/* This routine reads and parses a partition table. It may be called
* recursively. It makes sure that each partition falls safely within the
/*============================================================================*
* extpartition *
*============================================================================*/
-static void extpartition(bdp, extdev, extbase, tmp_buf)
-struct blockdriver *bdp; /* device dependent entry points */
-int extdev; /* extended partition to scan */
-unsigned long extbase; /* sector offset of the base ext. partition */
-u8_t *tmp_buf; /* temporary buffer */
+static void extpartition(
+ struct blockdriver *bdp, /* device dependent entry points */
+ int extdev, /* extended partition to scan */
+ unsigned long extbase, /* sector offset of the base ext. partition */
+ u8_t *tmp_buf /* temporary buffer */
+)
{
/* Extended partitions cannot be ignored alas, because people like to move
* files to and from DOS partitions. Avoid reading this code, it's no fun.
/*============================================================================*
* get_part_table *
*============================================================================*/
-static int get_part_table(bdp, device, offset, table, tmp_buf)
-struct blockdriver *bdp;
-int device;
-unsigned long offset; /* sector offset to the table */
-struct part_entry *table; /* four entries */
-u8_t *tmp_buf; /* temporary buffer */
+static int get_part_table(
+ struct blockdriver *bdp,
+ int device,
+ unsigned long offset, /* sector offset to the table */
+ struct part_entry *table, /* four entries */
+ u8_t *tmp_buf) /* temporary buffer */
{
/* Read the partition table for the device, return true iff there were no
* errors.
/*===========================================================================*
* sort *
*===========================================================================*/
-static void sort(table)
-struct part_entry *table;
+static void sort(struct part_entry *table)
{
/* Sort a partition table. */
struct part_entry *pe, tmp;
}
char *find_rslabel(char *args_line);
-int mount(special, name, mountflags, srvflags, type, args)
-char *name, *special, *type, *args;
-int mountflags, srvflags;
+
+int mount(char *special, char *name, int mountflags, int srvflags,
+ char *type, char *args)
{
int r;
message m;
return r;
}
-int umount(name, srvflags)
-const char *name;
-int srvflags;
+int umount(const char *name, int srvflags)
{
char label[MNT_LABEL_LEN];
message m;
static char mtab_in[BUF_SIZE+1]; /* holds /etc/mtab when it is read in */
static char *iptr = mtab_in; /* pointer to next line to feed out. */
-int load_mtab(char *prog_name );
+int load_mtab(char *prog_name);
int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
-static void err(char *prog_name, char *str );
+static void err(char *prog_name, const char *str);
-int load_mtab(prog_name)
-char *prog_name;
+int load_mtab(char *prog_name)
{
/* Read in /etc/mtab and store it in /etc/mtab. */
}
-static void
-err(prog_name, str)
-char *prog_name, *str;
+static void err(char *prog_name, const char *str)
{
std_err(prog_name);
std_err(str);
/****************************************************************************
* devman_get_ep *
***************************************************************************/
-endpoint_t devman_get_ep()
+endpoint_t devman_get_ep(void)
{
return devman_ep;
}
/****************************************************************************
* devman_init *
***************************************************************************/
-int devman_init()
+int devman_init(void)
{
int res;
/*===========================================================================*
* attr_get *
*===========================================================================*/
-void attr_get(attr)
-struct sffs_attr *attr;
+void attr_get(struct sffs_attr *attr)
{
/* Get attribute information from the RPC buffer, storing the requested parts
* in the given attr structure.
/*===========================================================================*
* hgfs_getattr *
*===========================================================================*/
-int hgfs_getattr(path, attr)
-char *path;
-struct sffs_attr *attr;
+int hgfs_getattr(char *path, struct sffs_attr *attr)
{
/* Get selected attributes of a file by path name.
*/
/*===========================================================================*
* hgfs_setattr *
*===========================================================================*/
-int hgfs_setattr(path, attr)
-char *path;
-struct sffs_attr *attr;
+int hgfs_setattr(char *path, struct sffs_attr *attr)
{
/* Set selected attributes of a file by path name.
*/
/*===========================================================================*
* channel_open *
*===========================================================================*/
-int channel_open(ch, type)
-struct channel *ch; /* struct describing the new channel */
-u32_t type; /* channel type: CH_IN or CH_OUT */
+int channel_open(
+ struct channel *ch, /* struct describing the new channel */
+ u32_t type /* channel type: CH_IN or CH_OUT */
+)
{
/* Open a new backdoor channel. Upon success, the given channel structure will
* be filled with information and can be used in subsequent channel calls.
/*===========================================================================*
* channel_close *
*===========================================================================*/
-void channel_close(ch)
-struct channel *ch; /* backdoor channel to close */
+void channel_close(
+ struct channel *ch /* backdoor channel to close */
+)
{
/* Close a previously opened backdoor channel.
*/
/*===========================================================================*
* channel_send *
*===========================================================================*/
-int channel_send(ch, buf, len)
-struct channel *ch; /* backdoor channel to send to */
-char *buf; /* buffer to send data from */
-int len; /* size of the data to send */
+int channel_send(
+ struct channel *ch, /* backdoor channel to send to */
+ char *buf, /* buffer to send data from */
+ int len /* size of the data to send */
+)
{
/* Receive data over a backdoor channel. Return OK on success, or a negative
* error code on error.
/*===========================================================================*
* channel_recv *
*===========================================================================*/
-int channel_recv(ch, buf, max)
-struct channel *ch; /* backdoor channel to receive from */
-char *buf; /* buffer to receive data into */
-int max; /* size of the buffer */
+int channel_recv(
+ struct channel *ch, /* backdoor channel to receive from */
+ char *buf, /* buffer to receive data into */
+ int max /* size of the buffer */
+)
{
/* Receive data on a backdoor channel. Return the number of bytes received, or
* a negative error code on error.
/*===========================================================================*
* hgfs_opendir *
*===========================================================================*/
-int hgfs_opendir(path, handle)
-char *path;
-sffs_dir_t *handle;
+int hgfs_opendir(char *path, sffs_dir_t *handle)
{
/* Open a directory. Store a directory handle upon success.
*/
/*===========================================================================*
* hgfs_readdir *
*===========================================================================*/
-int hgfs_readdir(handle, index, buf, size, attr)
-sffs_dir_t handle;
-unsigned int index;
-char *buf;
-size_t size;
-struct sffs_attr *attr;
+int hgfs_readdir(sffs_dir_t handle, unsigned int index, char *buf,
+ size_t size, struct sffs_attr *attr)
{
/* Read a directory entry from an open directory, using a zero-based index
* number. Upon success, the resulting path name is stored in the given buffer
/*===========================================================================*
* hgfs_closedir *
*===========================================================================*/
-int hgfs_closedir(handle)
-sffs_dir_t handle;
+int hgfs_closedir(sffs_dir_t handle)
{
/* Close an open directory.
*/
/*===========================================================================*
* error_convert *
*===========================================================================*/
-int error_convert(err)
-int err;
+int error_convert(int err)
{
/* Convert a HGFS error into an errno error code.
*/
/*===========================================================================*
* hgfs_open *
*===========================================================================*/
-int hgfs_open(path, flags, mode, handle)
-char *path; /* path name to open */
-int flags; /* open flags to use */
-int mode; /* mode to create (user bits only) */
-sffs_file_t *handle; /* place to store resulting handle */
+int hgfs_open(
+ char *path, /* path name to open */
+ int flags, /* open flags to use */
+ int mode, /* mode to create (user bits only) */
+ sffs_file_t *handle /* place to store resulting handle */
+)
{
/* Open a file. Store a file handle upon success.
*/
/*===========================================================================*
* hgfs_read *
*===========================================================================*/
-ssize_t hgfs_read(handle, buf, size, off)
-sffs_file_t handle; /* handle to open file */
-char *buf; /* data buffer or NULL */
-size_t size; /* maximum number of bytes to read */
-u64_t off; /* file offset */
+ssize_t hgfs_read(
+ sffs_file_t handle, /* handle to open file */
+ char *buf, /* data buffer or NULL */
+ size_t size, /* maximum number of bytes to read */
+ u64_t off /* file offset */
+)
{
/* Read from an open file. Upon success, return the number of bytes read.
*/
/*===========================================================================*
* hgfs_write *
*===========================================================================*/
-ssize_t hgfs_write(handle, buf, len, off)
-sffs_file_t handle; /* handle to open file */
-char *buf; /* data buffer or NULL */
-size_t len; /* number of bytes to write */
-u64_t off; /* file offset */
+ssize_t hgfs_write(
+ sffs_file_t handle, /* handle to open file */
+ char *buf, /* data buffer or NULL */
+ size_t len, /* number of bytes to write */
+ u64_t off /* file offset */
+)
{
/* Write to an open file. Upon success, return the number of bytes written.
*/
/*===========================================================================*
* hgfs_close *
*===========================================================================*/
-int hgfs_close(handle)
-sffs_file_t handle; /* handle to open file */
+int hgfs_close(
+ sffs_file_t handle /* handle to open file */
+)
{
/* Close an open file.
*/
/*===========================================================================*
* hgfs_readbuf *
*===========================================================================*/
-size_t hgfs_readbuf(ptr)
-char **ptr;
+size_t hgfs_readbuf(char **ptr)
{
/* Return information about the read buffer, for zero-copy purposes. Store a
* pointer to the first byte of the read buffer, and return the maximum data
/*===========================================================================*
* hgfs_writebuf *
*===========================================================================*/
-size_t hgfs_writebuf(ptr)
-char **ptr;
+size_t hgfs_writebuf(char **ptr)
{
/* Return information about the write buffer, for zero-copy purposes. Store a
* pointer to the first byte of the write buffer, and return the maximum data
/*===========================================================================*
* hgfs_queryvol *
*===========================================================================*/
-int hgfs_queryvol(path, free, total)
-char *path;
-u64_t *free;
-u64_t *total;
+int hgfs_queryvol(char *path, u64_t *free, u64_t *total)
{
/* Retrieve information about available and total volume space associated with
* a given path.
/*===========================================================================*
* hgfs_mkdir *
*===========================================================================*/
-int hgfs_mkdir(path, mode)
-char *path;
-int mode;
+int hgfs_mkdir(char *path, int mode)
{
/* Create a new directory.
*/
/*===========================================================================*
* hgfs_unlink *
*===========================================================================*/
-int hgfs_unlink(path)
-char *path;
+int hgfs_unlink(char *path)
{
/* Delete a file.
*/
/*===========================================================================*
* hgfs_rmdir *
*===========================================================================*/
-int hgfs_rmdir(path)
-char *path;
+int hgfs_rmdir(char *path)
{
/* Remove an empty directory.
*/
/*===========================================================================*
* hgfs_rename *
*===========================================================================*/
-int hgfs_rename(opath, npath)
-char *opath;
-char *npath;
+int hgfs_rename(char *opath, char *npath)
{
/* Rename a file or directory.
*/
/*===========================================================================*
* path_put *
*===========================================================================*/
-void path_put(path)
-char *path;
+void path_put(char *path)
{
/* Append the given path name in HGFS format to the RPC buffer. Truncate it
* if it is longer than PATH_MAX bytes.
/*===========================================================================*
* path_get *
*===========================================================================*/
-int path_get(path, max)
-char *path;
-int max;
+int path_get(char *path, int max)
{
/* Retrieve a HGFS formatted path name from the RPC buffer. Returns EINVAL if
* the path name is invalid. Returns ENAMETOOLONG if the path name is too
/*===========================================================================*
* rpc_open *
*===========================================================================*/
-int rpc_open()
+int rpc_open(void)
{
/* Open a HGFS RPC backdoor channel to the VMware host, and make sure that it
* is working. Return OK upon success, or a negative error code otherwise; in
/*===========================================================================*
* rpc_query *
*===========================================================================*/
-int rpc_query()
+int rpc_query(void)
{
/* Send a HGFS RPC query over the backdoor channel. Return OK upon success, or
* a negative error code otherwise; EAGAIN is returned if shared folders are
/*===========================================================================*
* rpc_test *
*===========================================================================*/
-int rpc_test()
+int rpc_test(void)
{
/* Test whether HGFS communication is working. Return OK on success, EAGAIN if
* shared folders are disabled, or another negative error code upon error.
/*===========================================================================*
* rpc_close *
*===========================================================================*/
-void rpc_close()
+void rpc_close(void)
{
/* Close the HGFS RPC backdoor channel.
*/
* Initialize the resolver: set up the UDP pcb and configure the default server
* (DNS_SERVER_ADDRESS).
*/
-void
-dns_init()
+void dns_init(void)
{
ip_addr_t dnsserver;
static int quiet = 0;
-void
-lmfs_setquiet(int q) { quiet = q; }
+void lmfs_setquiet(int q) { quiet = q; }
static u32_t fs_bufs_heuristic(int minbufs, u32_t btotal, u64_t bfree,
int blocksize, dev_t majordev)
}
}
-void
-lmfs_markdirty(struct buf *bp)
+void lmfs_markdirty(struct buf *bp)
{
bp->lmfs_flags |= VMMC_DIRTY;
}
-void
-lmfs_markclean(struct buf *bp)
+void lmfs_markclean(struct buf *bp)
{
bp->lmfs_flags &= ~VMMC_DIRTY;
}
-int
-lmfs_isclean(struct buf *bp)
+int lmfs_isclean(struct buf *bp)
{
return !(bp->lmfs_flags & VMMC_DIRTY);
}
-dev_t
-lmfs_dev(struct buf *bp)
+dev_t lmfs_dev(struct buf *bp)
{
return bp->lmfs_dev;
}
return bp->lmfs_bytes;
}
-static void
-free_unused_blocks(void)
+static void free_unused_blocks(void)
{
struct buf *bp;
printf("libminixfs: freeing; %d blocks, %d bytes\n", freed, bytes);
}
-static void
-lmfs_alloc_block(struct buf *bp)
+static void lmfs_alloc_block(struct buf *bp)
{
int len;
ASSERT(!bp->data);
/*===========================================================================*
* lmfs_put_block *
*===========================================================================*/
-void lmfs_put_block(bp, block_type)
-register struct buf *bp; /* pointer to the buffer to be released */
-int block_type; /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
+void lmfs_put_block(
+ struct buf *bp, /* pointer to the buffer to be released */
+ int block_type /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
+)
{
/* Return a block to the list of available blocks. Depending on 'block_type'
* it may be put on the front or rear of the LRU chain. Blocks that are
/*===========================================================================*
* read_block *
*===========================================================================*/
-static void read_block(bp)
-register struct buf *bp; /* buffer pointer */
+static void read_block(
+ struct buf *bp /* buffer pointer */
+)
{
/* Read or write a disk block. This is the only routine in which actual disk
* I/O is invoked. If an error occurs, a message is printed here, but the error
/*===========================================================================*
* rm_lru *
*===========================================================================*/
-static void rm_lru(bp)
-struct buf *bp;
+static void rm_lru(struct buf *bp)
{
/* Remove a block from its LRU chain. */
struct buf *next_ptr, *prev_ptr;
char *itoa(int n);
-char *itoa(n)
-int n;
+char *itoa(int n)
{
register int r, k;
int flag = 0;
/*===========================================================================*
* fs_link *
*===========================================================================*/
-int fs_link()
+int fs_link(void)
{
/* Perform the link(name1, name2) system call. */
/*===========================================================================*
* fs_rdlink *
*===========================================================================*/
-int fs_rdlink()
+int fs_rdlink(void)
{
register int r; /* return value */
size_t copylen;
/*===========================================================================*
* fs_rename *
*===========================================================================*/
-int fs_rename()
+int fs_rename(void)
{
/* Perform the rename(name1, name2) system call. */
struct puffs_node *old_dirp, *old_ip; /* ptrs to old dir, file pnodes */
/*===========================================================================*
* fs_unlink *
*===========================================================================*/
-int fs_unlink()
+int fs_unlink(void)
{
/* 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()
/*===========================================================================*
* remove_dir *
*===========================================================================*/
-static int remove_dir(pn_dir, pn, pcn)
-struct puffs_node *pn_dir; /* parent directory */
-struct puffs_node *pn; /* directory to be removed */
-struct puffs_cn *pcn; /* Name, creads of directory */
+static int remove_dir(
+ struct puffs_node *pn_dir, /* parent directory */
+ struct puffs_node *pn, /* directory to be removed */
+ struct puffs_cn *pcn /* Name, creads of directory */
+)
{
/* A directory file has to be removed. Five conditions have to met:
* - The file must be a directory
/*===========================================================================*
* unlink_file *
*===========================================================================*/
-static int unlink_file(dirp, pn, pcn)
-struct puffs_node *dirp; /* parent directory of file */
-struct puffs_node *pn; /* pnode of file, may be NULL too. */
-struct puffs_cn *pcn; /* Name, creads of file */
+static int unlink_file(
+ struct puffs_node *dirp, /* parent directory of file */
+ struct puffs_node *pn, /* pnode of file, may be NULL too. */
+ struct puffs_cn *pcn /* Name, creads of file */
+)
{
/* Unlink 'file_name'; pn must be the pnode of 'file_name' */
int r;
/*===========================================================================*
* fs_sync *
*===========================================================================*/
-int fs_sync()
+int fs_sync(void)
{
/* Perform the sync() system call. Flush all the tables.
* The order in which the various tables are flushed is critical.
/*===========================================================================*
* fs_flush *
*===========================================================================*/
-int fs_flush()
+int fs_flush(void)
{
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
-int fs_readsuper()
+int fs_readsuper(void)
{
struct vattr *root_va;
/*===========================================================================*
* fs_mountpoint *
*===========================================================================*/
-int fs_mountpoint()
+int fs_mountpoint(void)
{
/* This function looks up the mount point, it checks the condition whether
* the partition can be mounted on the pnode or not.
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
-int fs_unmount()
+int fs_unmount(void)
{
int error;
/*===========================================================================*
* fs_create *
*===========================================================================*/
-int fs_create()
+int fs_create(void)
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_mknod *
*===========================================================================*/
-int fs_mknod()
+int fs_mknod(void)
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_mkdir *
*===========================================================================*/
-int fs_mkdir()
+int fs_mkdir(void)
{
int r;
struct puffs_node *pn_dir;
/*===========================================================================*
* fs_slink *
*===========================================================================*/
-int fs_slink()
+int fs_slink(void)
{
int r;
struct pnode *pn; /* pnode containing symbolic link */
/*===========================================================================*
* fs_inhibread *
*===========================================================================*/
-int fs_inhibread()
+int fs_inhibread(void)
{
return(OK);
}
/*===========================================================================*
* fs_lookup *
*===========================================================================*/
-int fs_lookup()
+int fs_lookup(void)
{
cp_grant_id_t grant;
int r, r1, flags, symlinks;
* parse_path *
*===========================================================================*/
static int parse_path(
-pino_t dir_ino,
-pino_t root_ino,
-int flags,
-struct puffs_node **res_inop,
-size_t *offsetp,
-int *symlinkp
-) {
+ pino_t dir_ino,
+ pino_t root_ino,
+ int flags,
+ struct puffs_node **res_inop,
+ size_t *offsetp,
+ int *symlinkp
+)
+{
/* Parse the path in user_path, starting at dir_ino. If the path is the empty
* string, just return dir_ino. It is upto the caller to treat an empty
* path in a special way. Otherwise, if the path consists of just one or
/*===========================================================================*
* ltraverse *
*===========================================================================*/
-static int ltraverse(pn, suffix)
-register struct puffs_node *pn;/* symbolic link */
-char *suffix; /* current remaining path. Has to point in the
+static int ltraverse(
+ struct puffs_node *pn, /* symbolic link */
+ char *suffix /* current remaining path. Has to point in the
* user_path buffer
*/
+)
{
/* Traverse a symbolic link. Copy the link text from the pnode and insert
* the text into the path. Return error code or report success. Base
*/
int r;
char sp[PATH_MAX];
- size_t llen = PATH_MAX;/* length of link */
- size_t slen; /* length of suffix */
+ size_t llen = PATH_MAX; /* length of link */
+ size_t slen; /* length of suffix */
PUFFS_MAKECRED(pcr, &global_kcred);
/*===========================================================================*
* advance *
*===========================================================================*/
-struct puffs_node *advance(pn_dir, string, chk_perm)
-struct puffs_node *pn_dir; /* pnode 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*/
+struct puffs_node *advance(
+ struct puffs_node *pn_dir, /* pnode 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*/
+)
{
/* Given a directory and a component of a path, look up the component in
* the directory, find the pnode, open it, and return a pointer to its pnode
/*===========================================================================*
* get_name *
*===========================================================================*/
-static char *get_name(path_name, string)
-char *path_name; /* path name to parse */
-char string[NAME_MAX+1]; /* component extracted from 'old_name' */
+static char *get_name(
+ char *path_name, /* path name to parse */
+ char string[NAME_MAX+1] /* component extracted from 'old_name' */
+)
{
/* Given a pointer to a path name in fs space, 'path_name', copy the first
* component to 'string' (truncated if necessary, always nul terminated).
/*===========================================================================*
* fs_chmod *
*===========================================================================*/
-int fs_chmod()
+int fs_chmod(void)
{
/* Perform the chmod(name, mode) system call. */
struct puffs_node *pn;
/*===========================================================================*
* fs_chown *
*===========================================================================*/
-int fs_chown()
+int fs_chown(void)
{
struct puffs_node *pn;
struct vattr va;
/*===========================================================================*
* 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);
/*===========================================================================*
* get_work *
*===========================================================================*/
-static void get_work(m_in)
-message *m_in; /* pointer to message */
+static void get_work(
+ message *m_in /* pointer to message */
+)
{
int r, srcok = 0;
endpoint_t src;
/*===========================================================================*
* fs_stat *
*===========================================================================*/
-int fs_stat()
+int fs_stat(void)
{
register int r; /* return value */
register struct puffs_node *pn; /* target pnode */
/*===========================================================================*
* fs_statvfs *
*===========================================================================*/
-int fs_statvfs()
+int fs_statvfs(void)
{
int r;
struct statvfs st;
/*===========================================================================*
* fs_utime *
*===========================================================================*/
-int fs_utime()
+int fs_utime(void)
{
struct puffs_node *pn;
struct vattr va;
/*===========================================================================*
* no_sys *
*===========================================================================*/
-int no_sys()
+int no_sys(void)
{
/* Somebody has used an illegal system call number */
lpuffs_debug("no_sys: invalid call %d\n", req_nr);
/*===========================================================================*
* clock_timespec *
*===========================================================================*/
-struct timespec clock_timespec()
+struct timespec clock_timespec(void)
{
/* 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
/*===========================================================================*
* init_dentry *
*===========================================================================*/
-void init_dentry()
+void init_dentry(void)
{
/* Initialize the names hashtable.
*/
/*===========================================================================*
* lookup_dentry *
*===========================================================================*/
-struct inode *lookup_dentry(parent, name)
-struct inode *parent;
-char *name;
+struct inode *lookup_dentry(struct inode *parent, char *name)
{
/* Given a directory inode and a component name, look up the inode associated
* with that directory entry. Return the inode (with increased reference
/*===========================================================================*
* add_dentry *
*===========================================================================*/
-void add_dentry(parent, name, ino)
-struct inode *parent;
-char *name;
-struct inode *ino;
+void add_dentry(struct inode *parent, char *name, struct inode *ino)
{
/* Add an entry to a parent inode, in the form of a new inode, with the given
* name. An entry with this name must not already exist.
/*===========================================================================*
* del_one_dentry *
*===========================================================================*/
-static void del_one_dentry(ino)
-struct inode *ino;
+static void del_one_dentry(struct inode *ino)
{
/* This inode has become inaccessible by name. Disassociate it from its parent
* and remove it from the names hash table.
/*===========================================================================*
* del_dentry *
*===========================================================================*/
-void del_dentry(ino)
-struct inode *ino;
+void del_dentry(struct inode *ino)
{
/* Disassociate an inode from its parent, effectively deleting it. Recursively
* delete all its children as well, fragmenting the deleted branch into single
/*===========================================================================*
* hash_dentry *
*===========================================================================*/
-static unsigned int hash_dentry(parent, name)
-struct inode *parent;
-char *name;
+static unsigned int hash_dentry(struct inode *parent, char *name)
{
/* Generate a hash value for a given name. Normalize the name first, so that
* different variations of the name will result in the same hash value.
/*===========================================================================*
* get_handle *
*===========================================================================*/
-int get_handle(ino)
-struct inode *ino;
+int get_handle(struct inode *ino)
{
/* Get an open file or directory handle for an inode.
*/
/*===========================================================================*
* put_handle *
*===========================================================================*/
-void put_handle(ino)
-struct inode *ino;
+void put_handle(struct inode *ino)
{
/* Close an open file or directory handle associated with an inode.
*/
/*===========================================================================*
* init_inode *
*===========================================================================*/
-struct inode *init_inode()
+struct inode *init_inode(void)
{
/* Initialize inode table. Return the root inode.
*/
/*===========================================================================*
* get_inode *
*===========================================================================*/
-void get_inode(ino)
-struct inode *ino;
+void get_inode(struct inode *ino)
{
/* Increase the given inode's reference count. If both reference and link
* count were zero before, remove the inode from the free list.
/*===========================================================================*
* put_inode *
*===========================================================================*/
-void put_inode(ino)
-struct inode *ino;
+void put_inode(struct inode *ino)
{
/* Decrease an inode's reference count. If this count has reached zero, close
* the inode's file handle, if any. If both reference and link count have
/*===========================================================================*
* link_inode *
*===========================================================================*/
-void link_inode(parent, ino)
-struct inode *parent;
-struct inode *ino;
+void link_inode(struct inode *parent, struct inode *ino)
{
/* Link an inode to a parent. If both reference and link count were zero
* before, remove the inode from the free list. This function should only be
/*===========================================================================*
* unlink_inode *
*===========================================================================*/
-void unlink_inode(ino)
-struct inode *ino;
+void unlink_inode(struct inode *ino)
{
/* Unlink an inode from its parent. If both reference and link count have
* reached zero, mark the inode as cached or free. This function should only
/*===========================================================================*
* get_free_inode *
*===========================================================================*/
-struct inode *get_free_inode()
+struct inode *get_free_inode(void)
{
/* Return a free inode object (with reference count 1), if available.
*/
/*===========================================================================*
* have_free_inode *
*===========================================================================*/
-int have_free_inode()
+int have_free_inode(void)
{
/* Check whether there are any free inodes at the moment. Kind of lame, but
* this allows for easier error recovery in some places.
/*===========================================================================*
* have_used_inode *
*===========================================================================*/
-int have_used_inode()
+int have_used_inode(void)
{
/* Check whether any inodes are still in use, that is, any of the inodes have
* a reference count larger than zero.
/*===========================================================================*
* do_putnode *
*===========================================================================*/
-int do_putnode()
+int do_putnode(void)
{
/* Decrease an inode's reference count.
*/
/*===========================================================================*
* do_create *
*===========================================================================*/
-int do_create()
+int do_create(void)
{
/* Create a new file.
*/
/*===========================================================================*
* do_mkdir *
*===========================================================================*/
-int do_mkdir()
+int do_mkdir(void)
{
/* Make a new directory.
*/
/*===========================================================================*
* force_remove *
*===========================================================================*/
-static int force_remove(path, dir)
-char *path; /* path to file or directory */
-int dir; /* TRUE iff directory */
+static int force_remove(
+ char *path, /* path to file or directory */
+ int dir /* TRUE iff directory */
+)
{
/* Remove a file or directory. Wrapper around unlink and rmdir that makes the
* target temporarily writable if the operation fails with an access denied
/*===========================================================================*
* do_unlink *
*===========================================================================*/
-int do_unlink()
+int do_unlink(void)
{
/* Delete a file.
*/
/*===========================================================================*
* do_rmdir *
*===========================================================================*/
-int do_rmdir()
+int do_rmdir(void)
{
/* Remove an empty directory.
*/
/*===========================================================================*
* do_rename *
*===========================================================================*/
-int do_rename()
+int do_rename(void)
{
/* Rename a file or directory.
*/
#include "inc.h"
static int get_mask(vfs_ucred_t *ucred);
-static int access_as_dir(struct inode *ino, struct sffs_attr *attr, int
- uid, int mask);
+
+static int access_as_dir(struct inode *ino, struct sffs_attr *attr,
+ int uid, int mask);
+
static int next_name(char **ptr, char **start, char name[NAME_MAX+1]);
-static int go_up(char path[PATH_MAX], struct inode *ino, struct inode
- **res_ino, struct sffs_attr *attr);
+
+static int go_up(char path[PATH_MAX], struct inode *ino,
+ struct inode **res_ino, struct sffs_attr *attr);
+
static int go_down(char path[PATH_MAX], struct inode *ino, char *name,
struct inode **res_ino, struct sffs_attr *attr);
/*===========================================================================*
* get_mask *
*===========================================================================*/
-static int get_mask(ucred)
-vfs_ucred_t *ucred; /* credentials of the caller */
+static int get_mask(
+ vfs_ucred_t *ucred /* credentials of the caller */
+)
{
/* Given the caller's credentials, precompute a search access mask to test
* against directory modes.
/*===========================================================================*
* access_as_dir *
*===========================================================================*/
-static int access_as_dir(ino, attr, uid, mask)
-struct inode *ino; /* the inode to test */
-struct sffs_attr *attr; /* attributes of the inode */
-int uid; /* UID of the caller */
-int mask; /* search access mask of the caller */
+static int access_as_dir(
+ struct inode *ino, /* the inode to test */
+ struct sffs_attr *attr, /* attributes of the inode */
+ int uid, /* UID of the caller */
+ int mask /* search access mask of the caller */
+)
{
/* Check whether the given inode may be accessed as directory.
* Return OK or an appropriate error code.
/*===========================================================================*
* next_name *
*===========================================================================*/
-static int next_name(ptr, start, name)
-char **ptr; /* cursor pointer into path (in, out) */
-char **start; /* place to store start of name */
-char name[NAME_MAX+1]; /* place to store name */
+static int next_name(
+ char **ptr, /* cursor pointer into path (in, out) */
+ char **start, /* place to store start of name */
+ char name[NAME_MAX+1] /* place to store name */
+)
{
/* Get the next path component from a path.
*/
/*===========================================================================*
* go_up *
*===========================================================================*/
-static int go_up(path, ino, res_ino, attr)
-char path[PATH_MAX]; /* path to take the last part from */
-struct inode *ino; /* inode of the current directory */
-struct inode **res_ino; /* place to store resulting inode */
-struct sffs_attr *attr; /* place to store inode attributes */
+static int go_up(
+ char path[PATH_MAX], /* path to take the last part from */
+ struct inode *ino, /* inode of the current directory */
+ struct inode **res_ino, /* place to store resulting inode */
+ struct sffs_attr *attr /* place to store inode attributes */
+)
{
/* Given an inode, progress into the parent directory.
*/
/*===========================================================================*
* go_down *
*===========================================================================*/
-static int go_down(path, parent, name, res_ino, attr)
-char path[PATH_MAX]; /* path to add the name to */
-struct inode *parent; /* inode of the current directory */
-char *name; /* name of the directory entry */
-struct inode **res_ino; /* place to store resulting inode */
-struct sffs_attr *attr; /* place to store inode attributes */
+static int go_down(
+ char path[PATH_MAX], /* path to add the name to */
+ struct inode *parent, /* inode of the current directory */
+ char *name, /* name of the directory entry */
+ struct inode **res_ino, /* place to store resulting inode */
+ struct sffs_attr *attr /* place to store inode attributes */
+)
{
/* Given a directory inode and a name, progress into a directory entry.
*/
/*===========================================================================*
* do_lookup *
*===========================================================================*/
-int do_lookup()
+int do_lookup(void)
{
/* Resolve a path string to an inode.
*/
/*===========================================================================*
* get_work *
*===========================================================================*/
-static int get_work(who_e)
-endpoint_t *who_e;
+static int get_work(endpoint_t *who_e)
{
/* Receive a request message from VFS. Return TRUE if a new message is ready
* to be processed, or FALSE if sef_stop() was called from the signal handler.
/*===========================================================================*
* send_reply *
*===========================================================================*/
-static void send_reply(err, transid)
-int err; /* resulting error code */
-int transid;
+static void send_reply(
+ int err, /* resulting error code */
+ int transid
+)
{
/* Send a reply message to the requesting party, with the given error code.
*/
/*===========================================================================*
* do_statvfs *
*===========================================================================*/
-int do_statvfs()
+int do_statvfs(void)
{
/* Retrieve file system statistics.
*/
/*===========================================================================*
* do_readsuper *
*===========================================================================*/
-int do_readsuper()
+int do_readsuper(void)
{
/* Mount the file system.
*/
/*===========================================================================*
* do_unmount *
*===========================================================================*/
-int do_unmount()
+int do_unmount(void)
{
/* Unmount the file system.
*/
/*===========================================================================*
* normalize_name *
*===========================================================================*/
-void normalize_name(dst, src)
-char dst[NAME_MAX+1];
-char *src;
+void normalize_name(char dst[NAME_MAX+1], char *src)
{
/* Normalize the given path component name, storing the result in the given
* buffer.
/*===========================================================================*
* compare_name *
*===========================================================================*/
-int compare_name(name1, name2)
-char *name1;
-char *name2;
+int compare_name(char *name1, char *name2)
{
/* Return TRUE if the given path component names are equivalent, FALSE
* otherwise.
/*===========================================================================*
* make_path *
*===========================================================================*/
-int make_path(path, ino)
-char path[PATH_MAX];
-struct inode *ino;
+int make_path(char path[PATH_MAX], struct inode *ino)
{
/* Given an inode, construct the path identifying that inode.
*/
/*===========================================================================*
* push_path *
*===========================================================================*/
-int push_path(path, name)
-char path[PATH_MAX];
-char *name;
+int push_path(char path[PATH_MAX], char *name)
{
/* Add a component to the end of a path.
*/
/*===========================================================================*
* pop_path *
*===========================================================================*/
-void pop_path(path)
-char path[PATH_MAX];
+void pop_path(char path[PATH_MAX])
{
/* Remove the last component from a path.
*/
/*===========================================================================*
* do_read *
*===========================================================================*/
-int do_read()
+int do_read(void)
{
/* Read data from a file.
*/
/*===========================================================================*
* do_getdents *
*===========================================================================*/
-int do_getdents()
+int do_getdents(void)
{
/* Retrieve directory entries.
*/
/*===========================================================================*
* get_mode *
*===========================================================================*/
-pmode_t get_mode(ino, mode)
-struct inode *ino;
-int mode;
+pmode_t get_mode(struct inode *ino, int mode)
{
/* Return the mode for an inode, given the inode and the retrieved mode.
*/
/*===========================================================================*
* do_stat *
*===========================================================================*/
-int do_stat()
+int do_stat(void)
{
/* Retrieve inode status.
*/
/*===========================================================================*
* do_chmod *
*===========================================================================*/
-int do_chmod()
+int do_chmod(void)
{
/* Change file mode.
*/
/*===========================================================================*
* do_utime *
*===========================================================================*/
-int do_utime()
+int do_utime(void)
{
/* Set file times.
*/
/*===========================================================================*
* get_name *
*===========================================================================*/
-int get_name(grant, len, name)
-cp_grant_id_t grant; /* memory grant for the path component */
-size_t len; /* length of the name, including '\0' */
-char name[NAME_MAX+1]; /* buffer in which store the result */
+int get_name(
+ cp_grant_id_t grant, /* memory grant for the path component */
+ size_t len, /* length of the name, including '\0' */
+ char name[NAME_MAX+1] /* buffer in which store the result */
+)
{
/* Retrieve a path component from the caller, using a given grant.
*/
/*===========================================================================*
* do_noop *
*===========================================================================*/
-int do_noop()
+int do_noop(void)
{
/* Generic handler for no-op system calls.
*/
/*===========================================================================*
* no_sys *
*===========================================================================*/
-int no_sys()
+int no_sys(void)
{
/* Generic handler for unimplemented system calls.
*/
/*===========================================================================*
* verify_path *
*===========================================================================*/
-int verify_path(path, ino, attr, stale)
-char path[PATH_MAX];
-struct inode *ino;
-struct sffs_attr *attr;
-int *stale;
+int verify_path(char path[PATH_MAX], struct inode *ino,
+ struct sffs_attr *attr, int *stale)
{
/* Given a path, and the inode associated with that path, verify if the inode
* still matches the real world. Obtain the attributes of the file identified
/*===========================================================================*
* verify_inode *
*===========================================================================*/
-int verify_inode(ino, path, attr)
-struct inode *ino; /* inode to verify */
-char path[PATH_MAX]; /* buffer in which to store the path */
-struct sffs_attr *attr; /* buffer for attributes, or NULL */
+int verify_inode(
+ struct inode *ino, /* inode to verify */
+ char path[PATH_MAX], /* buffer in which to store the path */
+ struct sffs_attr *attr /* buffer for attributes, or NULL */
+)
{
/* Given an inode, construct a path identifying the inode, and check whether
* that path is still valid for that inode (as far as we can tell). As a side
/*===========================================================================*
* verify_dentry *
*===========================================================================*/
-int verify_dentry(parent, name, path, res_ino)
-struct inode *parent; /* parent inode: the inode to verify */
-char name[NAME_MAX+1]; /* the given directory entry path component */
-char path[PATH_MAX]; /* buffer to store the resulting path in */
-struct inode **res_ino; /* pointer for addressed inode (or NULL) */
+int verify_dentry(
+ struct inode *parent, /* parent inode: the inode to verify */
+ char name[NAME_MAX+1], /* the given directory entry path component */
+ char path[PATH_MAX], /* buffer to store the resulting path in */
+ struct inode **res_ino /* pointer for addressed inode (or NULL) */
+)
{
/* Given a directory inode and a name, construct a path identifying that
* directory entry, check whether the path to the parent is still valid, and
/*===========================================================================*
* write_file *
*===========================================================================*/
-static int write_file(ino, posp, countp, grantp)
-struct inode *ino;
-u64_t *posp;
-size_t *countp;
-cp_grant_id_t *grantp;
+static int write_file(struct inode *ino, u64_t *posp, size_t *countp,
+ cp_grant_id_t *grantp)
{
/* Write data or zeroes to a file, depending on whether a valid pointer to
* a data grant was provided.
/*===========================================================================*
* do_write *
*===========================================================================*/
-int do_write()
+int do_write(void)
{
/* Write data to a file.
*/
/*===========================================================================*
* do_ftrunc *
*===========================================================================*/
-int do_ftrunc()
+int do_ftrunc(void)
{
/* Change file size or create file holes.
*/
static void clear_tbl(void);
-void procentry (char *name)
+void procentry(char *name)
{
static int init = 0;
unsigned hash = 0, x = 0;
}
-void procexit (char *UNUSED(name))
+void procexit(char *UNUSED(name))
{
u64_t stop, spent;
u32_t tsc_lo, tsc_hi;
}
-static void cprof_init()
+static void cprof_init(void)
{
int i;
}
-static void reset()
+static void reset(void)
{
clear_tbl();
control.reset = 0;
}
-static void clear_tbl()
+static void clear_tbl(void)
{
int i;
/*===========================================================================*
* env_setargs *
*===========================================================================*/
-void env_setargs(arg_c, arg_v)
-int arg_c;
-char *arg_v[];
+void env_setargs(int arg_c, char *arg_v[])
{
env_argc= arg_c;
env_argv= arg_v;
/*==========================================================================*
* find_key *
*==========================================================================*/
-static char *find_key(params,name)
-const char *params;
-const char *name;
+static char *find_key(const char *params, const char *name)
{
- register const char *namep;
- register char *envp;
+ const char *namep;
+ char *envp;
for (envp = (char *) params; *envp != 0;) {
for (namep = name; *namep != 0 && *namep == *envp; namep++, envp++)
#include <minix/const.h>
#include <minix/optset.h>
-static void optset_parse_entry(struct optset *entry, char *ptr, int
- len);
+static void optset_parse_entry(struct optset *entry, char *ptr, int len);
/*===========================================================================*
* optset_parse_entry *
*===========================================================================*/
-static void optset_parse_entry(entry, ptr, len)
-struct optset *entry;
-char *ptr;
-int len;
+static void optset_parse_entry(struct optset *entry, char *ptr, int len)
{
/* Parse and store the value of a single option.
*/
/*===========================================================================*
* optset_parse *
*===========================================================================*/
-void optset_parse(table, string)
-struct optset *table;
-char *string;
+void optset_parse(struct optset *table, char *string)
{
/* Parse a string of options, using the provided table of optset entries.
*/
/*===========================================================================*
* do_sef_lu_before_receive *
*===========================================================================*/
-void do_sef_lu_before_receive()
+void do_sef_lu_before_receive(void)
{
/* Handle SEF Live update before receive events. */
int r;
*---------------------------------------------------------------------
*/
-static void
-sig_segv(int sig_no)
+static void sig_segv(int sig_no)
{
/* jumping to error handling in VAssert_IsInVM. */
siglongjmp(segv_jmp, 1);
*---------------------------------------------------------------------
*/
-static Bool
-VAssert_IsInVM(void)
+static Bool VAssert_IsInVM(void)
{
uint32 eax, ebx, ecx, edx;
static Bool inVM = FALSE;
*---------------------------------------------------------------------
*/
-char
-VAssert_Init(void)
+char VAssert_Init(void)
{
uint32 eax, ebx, ecx, edx;
VA page_address = (VA) &vassert_state.inReplay;
*---------------------------------------------------------------------
*/
-char
-VAssert_Uninit(void)
+char VAssert_Uninit(void)
{
unsigned int eax, ebx, ecx, edx;
if (!VAssert_IsInVM()) {
*---------------------------------------------------------------------
*/
-void
-VAssert_LogMain(const char *format, ...)
+void VAssert_LogMain(const char *format, ...)
{
unsigned int eax, ebx, ecx, edx;
char buf[LOG_MAX];
*---------------------------------------------------------------------
*/
-void
-VAssert_GoLiveMain()
+void VAssert_GoLiveMain(void)
{
unsigned int eax, ebx, ecx, edx;
vassert_state.inReplay = 0;
*---------------------------------------------------------------------
*/
-void
-VAssert_ReturnToReplayMain()
+void VAssert_ReturnToReplayMain(void)
{
unsigned int eax, ebx, ecx, edx;
libvassert_process_backdoor(CMD_RETURN_REPLAY, 0, MAGIC_PORT, &eax, &ebx, &ecx, &edx);
*---------------------------------------------------------------------
*/
-char
-VAssert_SetRecordingMain(char start)
+char VAssert_SetRecordingMain(char start)
{
uint32 eax, ebx, ecx, edx;
if (!VAssert_IsInVM()) {