More use of endpoint_t. Other code cleanup.

This commit is contained in:
Kees van Reeuwijk
2010-03-30 14:07:15 +00:00
parent 2ff73172b4
commit 4865e3f4f9
34 changed files with 120 additions and 133 deletions

View File

@@ -17,7 +17,7 @@ PRIVATE int callnr; /* system call number */
/* Declare some local functions. */
FORWARD _PROTOTYPE(void get_work, (message *m_ptr) );
FORWARD _PROTOTYPE(void reply, (int whom, message *m_ptr) );
FORWARD _PROTOTYPE(void reply, (endpoint_t whom, message *m_ptr) );
/* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
@@ -108,11 +108,11 @@ PRIVATE void sef_local_startup()
/*===========================================================================*
* get_work *
*===========================================================================*/
PRIVATE void get_work(m_ptr)
message *m_ptr; /* message buffer */
PRIVATE void get_work(
message *m_ptr /* message buffer */
)
{
int status = 0;
status = sef_receive(ANY, m_ptr); /* this blocks until message arrives */
int status = sef_receive(ANY, m_ptr); /* blocks until message arrives */
if (OK != status)
panic("failed to receive message!: %d", status);
who_e = m_ptr->m_source; /* message arrived! set sender */
@@ -122,12 +122,12 @@ message *m_ptr; /* message buffer */
/*===========================================================================*
* reply *
*===========================================================================*/
PRIVATE void reply(who_e, m_ptr)
int who_e; /* destination */
message *m_ptr; /* message buffer */
PRIVATE void reply(
endpoint_t who_e, /* destination */
message *m_ptr /* message buffer */
)
{
int s;
s = send(who_e, m_ptr); /* send the message */
int s = send(who_e, m_ptr); /* send the message */
if (OK != s)
printf("DS: unable to send reply to %d: %d\n", who_e, s);
}

View File

@@ -113,14 +113,14 @@ PRIVATE char *ds_getprocname(endpoint_t e)
/*===========================================================================*
* ds_getprocep *
*===========================================================================*/
PRIVATE endpoint_t ds_getprocep(char *s)
PRIVATE endpoint_t ds_getprocep(const char *s)
{
/* Get a process endpoint given its name. */
struct data_store *dsp;
if((dsp = lookup_entry(s, DSF_TYPE_LABEL)) != NULL)
return dsp->u.u32;
return -1;
return (endpoint_t) -1;
}
/*===========================================================================*

View File

@@ -74,7 +74,7 @@ THIS_FILE
#define RANDOM_DEV_NAME "/dev/random"
int this_proc; /* Process number of this server. */
endpoint_t this_proc; /* Process number of this server. */
/* Killing Solaris */
int killer_inet= 0;
@@ -100,7 +100,8 @@ PUBLIC void main()
{
mq_t *mq;
int r;
int source, m_type;
endpoint_t source;
int m_type;
/* SEF local startup. */
sef_local_startup();

View File

@@ -31,13 +31,13 @@ FORWARD _PROTOTYPE( void write_int, (eth_port_t *eth_port) );
FORWARD _PROTOTYPE( void eth_recvev, (event_t *ev, ev_arg_t ev_arg) );
FORWARD _PROTOTYPE( void eth_sendev, (event_t *ev, ev_arg_t ev_arg) );
FORWARD _PROTOTYPE( eth_port_t *find_port, (message *m) );
FORWARD _PROTOTYPE( void eth_restart, (eth_port_t *eth_port, int tasknr) );
FORWARD _PROTOTYPE( void eth_restart, (eth_port_t *eth_port, endpoint_t tasknr) );
FORWARD _PROTOTYPE( void send_getstat, (eth_port_t *eth_port) );
PUBLIC void osdep_eth_init()
{
int i, j, r, rport;
u32_t tasknr;
endpoint_t tasknr;
struct eth_conf *ecp;
eth_port_t *eth_port, *rep;
message mess;
@@ -475,9 +475,8 @@ PUBLIC void eth_rec(message *m)
PUBLIC void eth_check_drivers(message *m)
{
int r, tasknr;
tasknr= m->m_source;
int r;
endpoint_t tasknr= m->m_source;
#if 0
if (notification_count < 100)
{
@@ -674,8 +673,7 @@ eth_port_t *eth_port;
eth_port->etp_osdep.etp_state= OEPS_SEND_SENT;
}
PRIVATE void write_int(eth_port)
eth_port_t *eth_port;
PRIVATE void write_int(eth_port_t *eth_port)
{
acc_t *pack;
int multicast;
@@ -886,9 +884,7 @@ message *m;
return loc_port;
}
static void eth_restart(eth_port, tasknr)
eth_port_t *eth_port;
int tasknr;
static void eth_restart(eth_port_t *eth_port, endpoint_t tasknr)
{
int r;
unsigned flags, dl_flags;

View File

@@ -18,7 +18,7 @@ typedef struct osdep_eth_port
{
int etp_state;
int etp_flags;
int etp_task;
endpoint_t etp_task;
int etp_port;
int etp_recvconf;
int etp_send_ev;

View File

@@ -97,10 +97,10 @@ FORWARD _PROTOTYPE ( int walk_queue, (sr_fd_t *sr_fd, mq_t **q_head_ptr,
FORWARD _PROTOTYPE ( void process_req_q, (mq_t *mq, mq_t *tail,
mq_t **tail_ptr) );
FORWARD _PROTOTYPE ( void sr_event, (event_t *evp, ev_arg_t arg) );
FORWARD _PROTOTYPE ( int cp_u2b, (int proc, int gid, vir_bytes offset,
acc_t **var_acc_ptr, int size) );
FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, int gid,
vir_bytes offset) );
FORWARD _PROTOTYPE ( int cp_u2b, (endpoint_t proc, cp_grant_id_t gid,
vir_bytes offset, acc_t **var_acc_ptr, int size) );
FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, endpoint_t proc,
cp_grant_id_t gid, vir_bytes offset) );
PUBLIC void sr_init()
{
@@ -809,9 +809,7 @@ int for_ioctl;
(int)(*head_ptr)->mq_mess.IO_GRANT, offset);
}
PRIVATE void sr_select_res(fd, ops)
int fd;
unsigned ops;
PRIVATE void sr_select_res(int fd, unsigned ops)
{
sr_fd_t *sr_fd;
@@ -891,8 +889,8 @@ ev_arg_t arg;
}
PRIVATE int cp_u2b(proc, gid, offset, var_acc_ptr, size)
int proc;
int gid;
endpoint_t proc;
cp_grant_id_t gid;
vir_bytes offset;
acc_t **var_acc_ptr;
int size;
@@ -955,8 +953,8 @@ int size;
PRIVATE int cp_b2u(acc_ptr, proc, gid, offset)
acc_t *acc_ptr;
int proc;
int gid;
endpoint_t proc;
cp_grant_id_t gid;
vir_bytes offset;
{
acc_t *acc;

View File

@@ -13,7 +13,7 @@ typedef struct sr_fd
int srf_flags;
int srf_fd;
int srf_port;
int srf_select_proc;
endpoint_t srf_select_proc;
sr_open_t srf_open;
sr_close_t srf_close;
sr_write_t srf_write;

View File

@@ -117,7 +117,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the ipc server. */

View File

@@ -11,10 +11,10 @@
#include <minix/endpoint.h>
/* Allocate space for the global variables. */
message m_in; /* the input message itself */
message m_out; /* the output message used for reply */
int who_e; /* caller's proc number */
int callnr; /* system call number */
PRIVATE message m_in; /* the input message itself */
PRIVATE message m_out; /* the output message used for reply */
PRIVATE endpoint_t who_e; /* caller's proc number */
PRIVATE int callnr; /* system call number */
extern int errno; /* error number set by system library */

View File

@@ -286,7 +286,7 @@ int flags; /* mode bits and flags */
* gen_io *
*===========================================================================*/
PRIVATE int gen_io(task_nr, mess_ptr)
int task_nr; /* which task to call */
endpoint_t task_nr; /* which task to call */
message *mess_ptr; /* pointer to message for task */
{
/* All file system I/O ultimately comes down to I/O on major/minor device
@@ -330,9 +330,7 @@ message *mess_ptr; /* pointer to message for task */
/*===========================================================================*
* dev_close *
*===========================================================================*/
PUBLIC void dev_close(driver_e, dev)
endpoint_t driver_e;
dev_t dev; /* device to close */
PUBLIC void dev_close(endpoint_t driver_e, dev_t dev)
{
(void) gen_opcl(driver_e, DEV_CLOSE, dev, 0, 0);
}

View File

@@ -19,7 +19,7 @@ FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
* main *
*===========================================================================*/
PUBLIC int main(void) {
int who_e, ind, error;
endpoint_t who_e, ind, error;
message m;
/* SEF local startup. */

View File

@@ -18,7 +18,7 @@ _PROTOTYPE( int block_dev_io, (int op, Dev_t dev, int proc, void *buf,
u64_t pos, int bytes, int flags) );
_PROTOTYPE( int dev_open, (endpoint_t driver_e, Dev_t dev, int proc,
int flags) );
_PROTOTYPE( void dev_close, (endpoint_t driver_e, Dev_t dev) );
_PROTOTYPE( void dev_close, (endpoint_t driver_e, dev_t dev) );
_PROTOTYPE( int fs_new_driver, (void) );
/* inode.c */

View File

@@ -8,18 +8,15 @@
#include <minix/vfsif.h>
FORWARD _PROTOTYPE(int stat_dir_record, (struct dir_record *dir, int pipe_pos,
int who_e, cp_grant_id_t gid) );
/*===========================================================================*
* stat_dir_record *
*===========================================================================*/
PRIVATE int stat_dir_record(dir, pipe_pos, who_e, gid)
register struct dir_record *dir; /* pointer to dir record to stat */
int pipe_pos; /* position in a pipe, supplied by fstat() */
int who_e; /* Caller endpoint */
cp_grant_id_t gid; /* grant for the stat buf */
PRIVATE int stat_dir_record(
register struct dir_record *dir, /* pointer to dir record to stat */
int pipe_pos, /* position in a pipe, supplied by fstat() */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
)
{
/* This function returns all the info about a particular inode. It's missing
* the recording date because of a bug in the standard functions stdtime.

View File

@@ -24,7 +24,7 @@ FORWARD _PROTOTYPE( void safe_io_cleanup, (cp_grant_id_t, cp_grant_id_t *,
int));
FORWARD _PROTOTYPE( int gen_opcl, (endpoint_t driver_e, int op,
Dev_t dev, int proc_e, int flags) );
FORWARD _PROTOTYPE( int gen_io, (int task_nr, message *mess_ptr) );
FORWARD _PROTOTYPE( int gen_io, (endpoint_t task_nr, message *mess_ptr) );
/*===========================================================================*
@@ -314,9 +314,10 @@ int flags; /* mode bits and flags */
/*===========================================================================*
* gen_io *
*===========================================================================*/
PRIVATE int gen_io(task_nr, mess_ptr)
int task_nr; /* which task to call */
message *mess_ptr; /* pointer to message for task */
PRIVATE int gen_io(
endpoint_t task_nr, /* which task to call */
message *mess_ptr /* pointer to message for task */
)
{
/* All file system I/O ultimately comes down to I/O on major/minor device
* pairs. These lead to calls on the following routines via the dmap table.

View File

@@ -167,9 +167,10 @@ message *m_in; /* pointer to message */
/*===========================================================================*
* reply *
*===========================================================================*/
PUBLIC void reply(who, m_out)
int who;
message *m_out; /* report result */
PUBLIC void reply(
endpoint_t who,
message *m_out /* report result */
)
{
if (OK != send(who, m_out)) /* send the message */
printf("MFS(%d) was unable to send reply\n", SELF_E);

View File

@@ -52,7 +52,7 @@ _PROTOTYPE( int fs_unlink, (void) );
_PROTOTYPE( int truncate_inode, (struct inode *rip, off_t len) );
/* main.c */
_PROTOTYPE( void reply, (int who, message *m_out) );
_PROTOTYPE( void reply, (endpoint_t who, message *m_out) );
/* misc.c */
_PROTOTYPE( int fs_flush, (void) );

View File

@@ -8,17 +8,15 @@
#include "super.h"
#include <minix/vfsif.h>
FORWARD _PROTOTYPE( int stat_inode, (struct inode *rip, int who_e,
cp_grant_id_t gid) );
/*===========================================================================*
* stat_inode *
*===========================================================================*/
PRIVATE int stat_inode(rip, who_e, gid)
register struct inode *rip; /* pointer to inode to stat */
int who_e; /* Caller endpoint */
cp_grant_id_t gid; /* grant for the stat buf */
PRIVATE int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
)
{
/* Common code for stat and fstat system calls. */

View File

@@ -2,17 +2,15 @@
#include "inode.h"
#include <sys/stat.h>
FORWARD _PROTOTYPE( int stat_inode, (struct inode *rip, int who_e,
cp_grant_id_t gid) );
/*===========================================================================*
* stat_inode *
*===========================================================================*/
PRIVATE int stat_inode(rip, who_e, gid)
register struct inode *rip; /* pointer to inode to stat */
int who_e; /* Caller endpoint */
cp_grant_id_t gid; /* grant for the stat buf */
PRIVATE int stat_inode(
register struct inode *rip, /* pointer to inode to stat */
endpoint_t who_e, /* Caller endpoint */
cp_grant_id_t gid /* grant for the stat buf */
)
{
/* Common code for stat and fstat system calls. */