From: David van Moolenbroek Date: Mon, 11 Apr 2011 17:35:05 +0000 (+0000) Subject: Server/driver protocols: no longer allow third-party copies. X-Git-Tag: v3.2.0~581 X-Git-Url: http://zhaoyanbai.com/repos/%7B%24global.css%7D?a=commitdiff_plain;h=c51cd5fe915e68ab6d7ecb149508921b2fb6a3f5;p=minix.git Server/driver protocols: no longer allow third-party copies. Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed to know which actual process to copy data from/to, as that process may not always be the caller. Now that we have full safecopy support, these fields have become useless for that purpose: the owner of the grant is *always* the caller. Allowing the caller to supply another endpoint is in fact dangerous, because the callee may then end up using a grant from a third party. One could call this a variant of the confused deputy problem. From now on, safecopy calls should always use the caller's endpoint as grant owner. This fully obsoletes the DL_ENDPT field in the inet/ethernet protocol. IO_ENDPT has other uses besides identifying the grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only because that is a more fitting name (it should never be used for I/O after all), but also in order to intentionally break any old system source code outside the base system. If this patch breaks your code, fixing it is fairly simple: - DL_ENDPT should be replaced with m_source; - IO_ENDPT should be replaced with m_source when used for safecopies; - IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g. when setting REP_ENDPT, matching requests in CANCEL calls, getting DEV_SELECT flags, and retrieving of the real user process's endpoint in DEV_OPEN. The changes in this patch are binary backward compatible. --- diff --git a/common/include/minix/audio_fw.h b/common/include/minix/audio_fw.h index e3095cdfe..f0c040739 100644 --- a/common/include/minix/audio_fw.h +++ b/common/include/minix/audio_fw.h @@ -55,11 +55,11 @@ typedef struct { int BufLength; int RevivePending; /* process waiting for this dev? */ int ReviveStatus; /* return val when proc unblocked */ - int ReviveProcNr; /* the process to unblock */ + endpoint_t ReviveProcNr; /* the process to unblock */ cp_grant_id_t ReviveGrant; /* grant id associated with io */ void *UserBuf; /* address of user's data buffer */ int ReadyToRevive; /* are we ready to revive process?*/ - int NotifyProcNr; /* process to send notify to (FS) */ + endpoint_t SourceProcNr; /* process to send notify to (FS) */ u32_t FragSize; /* dma fragment size */ char *DmaBuf; /* the dma buffer; extra space for page alignment */ diff --git a/common/include/minix/com.h b/common/include/minix/com.h index b5557835c..db3c5c8f9 100644 --- a/common/include/minix/com.h +++ b/common/include/minix/com.h @@ -222,7 +222,7 @@ /* Field names for messages to block and character device drivers. */ #define DEVICE m2_i1 /* major-minor device */ -#define IO_ENDPT m2_i2 /* which (proc/endpoint) wants I/O? */ +#define USER_ENDPT m2_i2 /* which endpoint initiated this call? */ #define COUNT m2_i3 /* how many bytes to transfer */ #define REQUEST m2_i3 /* ioctl request code */ #define POSITION m2_l1 /* file offset (low 4 bytes) */ @@ -286,7 +286,7 @@ #define DL_TASK_REPLY (DL_RS_BASE + 2) /* Field names for data link layer messages. */ -#define DL_ENDPT m2_i2 +#define DL_ENDPT_LEGACY m2_i2 /* obsolete; will be removed */ #define DL_COUNT m2_i3 #define DL_MODE m2_l1 #define DL_FLAGS m2_l1 @@ -454,6 +454,9 @@ #define ABRT_MON_LEN m1_i3 /* length of monitor params */ #define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */ +/* Field names for SYS_IOPENABLE. */ +#define IOP_ENDPT m2_l1 /* target endpoint */ + /* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */ #define CP_SRC_SPACE m5_s1 /* T or D space (stack is also D) */ #define CP_SRC_ENDPT m5_i1 /* process to copy from */ diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index 08e6c5ab5..e36763f57 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -2404,7 +2404,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m) return atapi_load_eject(current_port, 0, FALSE /*load*/); case DIOCOPENCT: - return sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, + return sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) ¤t_port->open_count, sizeof(current_port->open_count), D); @@ -2418,7 +2418,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m) if (current_port->state != STATE_GOOD_DEV) return EIO; - if ((r = sys_safecopyfrom(m->IO_ENDPT, + if ((r = sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &val, sizeof(val), D)) != OK) return r; @@ -2432,7 +2432,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m) if ((r = gen_get_wcache(current_port, 0, &val)) != OK) return r; - return sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, + return sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &val, sizeof(val), D); } diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 052030745..21c5fe1a1 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -2303,7 +2303,7 @@ message *m; return EINVAL; if (m->REQUEST == DIOCTIMEOUT) { - r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, + r= sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes)&timeout, sizeof(timeout), D); if(r != OK) @@ -2334,7 +2334,7 @@ message *m; timeout_usecs = timeout; } - r= sys_safecopyto(m->IO_ENDPT, + r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes)&prev, sizeof(prev), D); @@ -2347,7 +2347,7 @@ message *m; int count; if (w_prepare(m->DEVICE) == NULL) return ENXIO; count = w_wn->open_ct; - r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, + r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes)&count, sizeof(count), D); if(r != OK) diff --git a/drivers/atl2/atl2.c b/drivers/atl2/atl2.c index 381eb56b9..30af19469 100644 --- a/drivers/atl2/atl2.c +++ b/drivers/atl2/atl2.c @@ -791,7 +791,7 @@ PRIVATE void atl2_readv(const message *m, int from_int) /* Copy in the next batch. */ batch = MIN(m->DL_COUNT - i, NR_IOREQS); - r = sys_safecopyfrom(m->DL_ENDPT, m->DL_GRANT, off, + r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off, (vir_bytes) iovec, batch * sizeof(iovec[0]), D); if (r != OK) panic("vector copy failed: %d", r); @@ -800,7 +800,7 @@ PRIVATE void atl2_readv(const message *m, int from_int) for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) { size = MIN(iovp->iov_size, left); - r = sys_safecopyto(m->DL_ENDPT, iovp->iov_grant, 0, + r = sys_safecopyto(m->m_source, iovp->iov_grant, 0, (vir_bytes) pos, size, D); if (r != OK) panic("safe copy failed: %d", r); @@ -888,7 +888,7 @@ PRIVATE void atl2_writev(const message *m, int from_int) /* Copy in the next batch. */ batch = MIN(m->DL_COUNT - i, NR_IOREQS); - r = sys_safecopyfrom(m->DL_ENDPT, m->DL_GRANT, off, + r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off, (vir_bytes) iovec, batch * sizeof(iovec[0]), D); if (r != OK) panic("vector copy failed: %d", r); @@ -902,7 +902,7 @@ PRIVATE void atl2_writev(const message *m, int from_int) skip = 0; if (size > ATL2_TXD_BUFSIZE - pos) { skip = ATL2_TXD_BUFSIZE - pos; - r = sys_safecopyfrom(m->DL_ENDPT, + r = sys_safecopyfrom(m->m_source, iovp->iov_grant, 0, (vir_bytes) (state.txd_base + pos), skip, D); @@ -911,7 +911,7 @@ PRIVATE void atl2_writev(const message *m, int from_int) pos = 0; } - r = sys_safecopyfrom(m->DL_ENDPT, iovp->iov_grant, + r = sys_safecopyfrom(m->m_source, iovp->iov_grant, skip, (vir_bytes) (state.txd_base + pos), size - skip, D); if (r != OK) @@ -1062,7 +1062,7 @@ PRIVATE void atl2_getstat(message *m) */ int r; - sys_safecopyto(m->DL_ENDPT, m->DL_GRANT, 0, + sys_safecopyto(m->m_source, m->DL_GRANT, 0, (vir_bytes) &state.stat, sizeof(state.stat), D); m->m_type = DL_STAT_REPLY; diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index 965ae879f..570b79dea 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -528,7 +528,7 @@ PRIVATE int w_other(struct driver *UNUSED(dr), message *m) int count; if (w_prepare(m->DEVICE) == NULL) return ENXIO; count = w_wn->open_ct; - r=sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t)m->IO_GRANT, + r=sys_safecopyto(m->m_source, (cp_grant_id_t)m->IO_GRANT, 0, (vir_bytes)&count, sizeof(count), D); if(r != OK) diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index af008f14a..4273b2ba7 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -176,7 +176,7 @@ PRIVATE void do_get_stat_s(message * mp) dep = &de_state; - if ((rc = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0UL, + if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0UL, (vir_bytes)&dep->de_stat, sizeof(dep->de_stat), 0)) != OK) panic(str_CopyErrMsg, rc); @@ -474,8 +474,8 @@ PRIVATE void do_vread_s(const message * mp, int from_int) /* Setup the iovec entry to allow copying into client layer */ - dep->de_read_iovec.iod_proc_nr = mp->DL_ENDPT; - de_get_userdata_s(mp->DL_ENDPT, (cp_grant_id_t) mp->DL_GRANT, 0, + dep->de_read_iovec.iod_proc_nr = mp->m_source; + de_get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0, mp->DL_COUNT, dep->de_read_iovec.iod_iovec); dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; @@ -827,8 +827,8 @@ PRIVATE void do_vwrite_s(const message * mp, int from_int){ buffer = descr->buf1; iovp = &dep->de_write_iovec; - iovp->iod_proc_nr = mp->DL_ENDPT; - de_get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, + iovp->iod_proc_nr = mp->m_source; + de_get_userdata_s(mp->m_source, mp->DL_GRANT, 0, mp->DL_COUNT, iovp->iod_iovec); iovp->iod_iovec_s = mp->DL_COUNT; iovp->iod_grant = (cp_grant_id_t) mp->DL_GRANT; diff --git a/drivers/dec21140A/dec21140A.h b/drivers/dec21140A/dec21140A.h index 9b6778132..9eb97466a 100644 --- a/drivers/dec21140A/dec21140A.h +++ b/drivers/dec21140A/dec21140A.h @@ -39,7 +39,7 @@ Created: 09/01/2009 Nicolas Tittley (first.last @ gmail DOT com) typedef struct iovec_dat_s { iovec_s_t iod_iovec[IOVEC_NR]; int iod_iovec_s; - int iod_proc_nr; + endpoint_t iod_proc_nr; cp_grant_id_t iod_grant; vir_bytes iod_iovec_offset; } iovec_dat_s_t; diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index e78de5489..bb1c51c51 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -408,12 +408,12 @@ int from_int; } assert(!(dep->de_flags & DEF_PACK_SEND)); - get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, + get_userdata_s(mp->m_source, mp->DL_GRANT, 0, (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(dep->de_write_iovec_s.iod_iovec[0]), dep->de_write_iovec_s.iod_iovec); dep->de_write_iovec_s.iod_iovec_s = count; - dep->de_write_iovec_s.iod_proc_nr = mp->DL_ENDPT; + dep->de_write_iovec_s.iod_proc_nr = mp->m_source; dep->de_write_iovec_s.iod_grant = mp->DL_GRANT; dep->de_write_iovec_s.iod_iovec_offset = 0; @@ -481,12 +481,12 @@ message *mp; if(dep->de_flags & DEF_READING) panic("dp8390: read already in progress"); - get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, + get_userdata_s(mp->m_source, mp->DL_GRANT, 0, (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(dep->de_read_iovec_s.iod_iovec[0]), dep->de_read_iovec_s.iod_iovec); dep->de_read_iovec_s.iod_iovec_s = count; - dep->de_read_iovec_s.iod_proc_nr = mp->DL_ENDPT; + dep->de_read_iovec_s.iod_proc_nr = mp->m_source; dep->de_read_iovec_s.iod_grant = mp->DL_GRANT; dep->de_read_iovec_s.iod_iovec_offset = 0; @@ -595,7 +595,7 @@ message *mp; if (dep->de_mode == DEM_SINK) { - put_userdata_s(mp->DL_ENDPT, (vir_bytes) mp->DL_GRANT, + put_userdata_s(mp->m_source, (vir_bytes) mp->DL_GRANT, (vir_bytes) sizeof(dep->de_stat), &dep->de_stat); mp->m_type= DL_STAT_REPLY; @@ -611,7 +611,7 @@ message *mp; dep->de_stat.ets_frameAll += inb_reg0(dep, DP_CNTR1); dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2); - put_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, + put_userdata_s(mp->m_source, mp->DL_GRANT, sizeof(dep->de_stat), &dep->de_stat); mp->m_type= DL_STAT_REPLY; diff --git a/drivers/dp8390/dp8390.h b/drivers/dp8390/dp8390.h index 102f32041..77ac014b3 100644 --- a/drivers/dp8390/dp8390.h +++ b/drivers/dp8390/dp8390.h @@ -203,7 +203,7 @@ typedef struct iovec_dat { iovec_t iod_iovec[IOVEC_NR]; int iod_iovec_s; - int iod_proc_nr; + endpoint_t iod_proc_nr; vir_bytes iod_iovec_addr; } iovec_dat_t; diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index e790aab83..34ba6fda7 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -361,8 +361,8 @@ static void do_vwrite_s(const message * mp) if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */ panic("send already in progress "); - dep->de_write_iovec.iod_proc_nr = mp->DL_ENDPT; - get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, + dep->de_write_iovec.iod_proc_nr = mp->m_source; + get_userdata_s(mp->m_source, mp->DL_GRANT, 0, mp->DL_COUNT, dep->de_write_iovec.iod_iovec); dep->de_write_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_write_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; @@ -399,8 +399,8 @@ static void do_vread_s(const message * mp) if (dep->de_flags & DEF_READING) /* Reading in progress */ panic("read already in progress"); - dep->de_read_iovec.iod_proc_nr = mp->DL_ENDPT; - get_userdata_s(mp->DL_ENDPT, (cp_grant_id_t) mp->DL_GRANT, 0, + dep->de_read_iovec.iod_proc_nr = mp->m_source; + get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0, mp->DL_COUNT, dep->de_read_iovec.iod_iovec); dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; @@ -434,7 +434,7 @@ static void do_getstat_s(const message * mp) dep = &de_state; if (dep->de_mode == DEM_ENABLED) (*dep->de_getstatsf) (dep); - if ((rc = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, + if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&dep->de_stat, (vir_bytes) sizeof(dep->de_stat), 0)) != OK) panic(CopyErrMsg, rc); diff --git a/drivers/dpeth/dp.h b/drivers/dpeth/dp.h index 41c1cf074..06e0174aa 100644 --- a/drivers/dpeth/dp.h +++ b/drivers/dpeth/dp.h @@ -86,7 +86,7 @@ typedef void (*dp_getblock_t) (struct dpeth *, u16_t, int, void *); typedef struct iovec_dat_s { iovec_s_t iod_iovec[IOVEC_NR]; int iod_iovec_s; - int iod_proc_nr; + endpoint_t iod_proc_nr; cp_grant_id_t iod_grant; vir_bytes iod_iovec_offset; } iovec_dat_s_t; diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index b7cb86b42..b4c297738 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -624,7 +624,7 @@ int from_int; /* * Copy the I/O vector table. */ - if ((r = sys_safecopyfrom(e->tx_message.DL_ENDPT, + if ((r = sys_safecopyfrom(e->tx_message.m_source, e->tx_message.DL_GRANT, 0, (vir_bytes) iovec, e->tx_message.DL_COUNT * sizeof(iovec_s_t), D)) != OK) @@ -648,7 +648,7 @@ int from_int; E1000_DEBUG(4, ("iovec[%d] = %d\n", i, size)); /* Copy bytes to TX queue buffers. */ - if ((r = sys_safecopyfrom(e->tx_message.DL_ENDPT, + if ((r = sys_safecopyfrom(e->tx_message.m_source, iovec[i].iov_grant, 0, (vir_bytes) e->tx_buffer + (tail * E1000_IOBUF_SIZE), @@ -715,7 +715,7 @@ int from_int; /* * Copy the I/O vector table first. */ - if ((r = sys_safecopyfrom(e->rx_message.DL_ENDPT, + if ((r = sys_safecopyfrom(e->rx_message.m_source, e->rx_message.DL_GRANT, 0, (vir_bytes) iovec, e->rx_message.DL_COUNT * sizeof(iovec_s_t), D)) != OK) @@ -750,7 +750,7 @@ int from_int; E1000_DEBUG(4, ("iovec[%d] = %lu[%d]\n", i, iovec[i].iov_size, size)); - if ((r = sys_safecopyto(e->rx_message.DL_ENDPT, iovec[i].iov_grant, + if ((r = sys_safecopyto(e->rx_message.m_source, iovec[i].iov_grant, 0, (vir_bytes) e->rx_buffer + bytes + (cur * E1000_IOBUF_SIZE), size, D)) != OK) @@ -802,7 +802,7 @@ message *mp; stats.ets_CDheartbeat = 0; stats.ets_OWC = 0; - sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, (vir_bytes)&stats, + sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats, sizeof(stats), D); mp->m_type = DL_STAT_REPLY; if((r=send(mp->m_source, mp)) != OK) diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index 77582b3c3..f99c17e7b 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -31,7 +31,7 @@ static int driver_open(int which) msg.m_type = DEV_OPEN; msg.DEVICE = driver[which].minor; - msg.IO_ENDPT = self_ep; + msg.USER_ENDPT = self_ep; r = sendrec(driver[which].endpt, &msg); if (r != OK) { @@ -57,7 +57,7 @@ static int driver_open(int which) msg.m_type = DEV_IOCTL_S; msg.REQUEST = DIOCGETP; msg.DEVICE = driver[which].minor; - msg.IO_ENDPT = self_ep; + msg.USER_ENDPT = self_ep; msg.IO_GRANT = (char *) gid; r = sendrec(driver[which].endpt, &msg); @@ -107,7 +107,7 @@ static int driver_close(int which) msg.m_type = DEV_CLOSE; msg.DEVICE = driver[which].minor; - msg.IO_ENDPT = self_ep; + msg.USER_ENDPT = self_ep; r = sendrec(driver[which].endpt, &msg); if (r != OK) { @@ -521,7 +521,7 @@ static int flt_senda(message *mess, int which) /* Fill in the last bits of the message. */ mess->DEVICE = driver[which].minor; - mess->IO_ENDPT = self_ep; + mess->USER_ENDPT = self_ep; /* Send the message asynchronously. */ amp = &amsgtable[which]; diff --git a/drivers/filter/main.c b/drivers/filter/main.c index c808325cf..6a77bbddc 100644 --- a/drivers/filter/main.c +++ b/drivers/filter/main.c @@ -67,7 +67,7 @@ PRIVATE struct optset optset_table[] = { /* Request message. */ static message m_in; static endpoint_t who_e; /* m_source */ -static endpoint_t proc_e; /* IO_ENDPT */ +static endpoint_t proc_e; /* USER_ENDPT */ static cp_grant_id_t grant_id; /* IO_GRANT */ /* Data buffers. */ @@ -87,10 +87,10 @@ static int carry(size_t size, int flag_rw) */ if (flag_rw == FLT_WRITE) - return sys_safecopyfrom(proc_e, grant_id, 0, + return sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) buffer, size, D); else - return sys_safecopyto(proc_e, grant_id, 0, + return sys_safecopyto(who_e, grant_id, 0, (vir_bytes) buffer, size, D); } @@ -110,11 +110,11 @@ static int vcarry(int grants, iovec_t *iov, int flag_rw, size_t size) bytes = MIN(size, iov[i].iov_size); if (flag_rw == FLT_WRITE) - r = sys_safecopyfrom(proc_e, + r = sys_safecopyfrom(who_e, (vir_bytes) iov[i].iov_addr, 0, (vir_bytes) bufp, bytes, D); else - r = sys_safecopyto(proc_e, + r = sys_safecopyto(who_e, (vir_bytes) iov[i].iov_addr, 0, (vir_bytes) bufp, bytes, D); @@ -268,7 +268,7 @@ static int do_ioctl(message *m) */ sizepart.size = convert(get_raw_size()); - if(sys_safecopyto(proc_e, (vir_bytes) grant_id, 0, + if(sys_safecopyto(who_e, (vir_bytes) grant_id, 0, (vir_bytes) &sizepart, sizeof(struct partition), D) != OK) { printf("Filter: DIOCGETP safecopyto failed\n"); @@ -397,7 +397,7 @@ int main(int argc, char *argv[]) } who_e = m_in.m_source; - proc_e = m_in.IO_ENDPT; + proc_e = m_in.USER_ENDPT; grant_id = (cp_grant_id_t) m_in.IO_GRANT; /* Forword the request message to the drivers. */ diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 02a3bc2ea..dfbbbb85f 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -1093,7 +1093,7 @@ static void fxp_writev_s(const message *mp, int from_int) assert(!(fp->fxp_flags & FF_SEND_AVAIL)); assert(!(fp->fxp_flags & FF_PACK_SENT)); - iov_endpt= mp->DL_ENDPT; + iov_endpt= mp->m_source; iov_grant= mp->DL_GRANT; size= 0; @@ -1228,7 +1228,7 @@ int from_int; packlen= rfd_res & RFDSZ_SIZE; - iov_endpt = mp->DL_ENDPT; + iov_endpt = mp->m_source; iov_grant = mp->DL_GRANT; size= 0; @@ -1541,7 +1541,7 @@ static void fxp_getstat_s(message *mp) stats.ets_CDheartbeat= 0; stats.ets_OWC= fp->fxp_stat.sc_tx_latecol; - r= sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, (vir_bytes)&stats, + r= sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats, sizeof(stats), D); if (r != OK) panic("fxp_getstat_s: sys_safecopyto failed: %d", r); diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 82ae70866..528a40bb9 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -6,18 +6,18 @@ * * The valid messages and their parameters are: * - * m_type DL_ENDPT DL_COUNT DL_MODE DL_GRANT - * |--------------+---------+----------+---------+---------| - * | DL_WRITEV_S | endpt | count | | grant | - * |--------------|---------|----------|---------|---------| - * | DL_READV_S | endpt | count | | grant | - * |--------------|---------|----------|---------|---------| - * | DL_CONF | | | mode | | - * |--------------|---------|----------|---------|---------| - * | DL_GETSTAT_S | endpt | | | grant | - * |--------------|---------|----------|---------|---------| - * | hardware int | | | | | - * |--------------|---------|----------|---------|---------| + * m_type DL_COUNT DL_MODE DL_GRANT + * |--------------+----------+---------+---------| + * | DL_WRITEV_S | count | | grant | + * |--------------|----------|---------|---------| + * | DL_READV_S | count | | grant | + * |--------------|----------|---------|---------| + * | DL_CONF | | mode | | + * |--------------|----------|---------|---------| + * | DL_GETSTAT_S | | | grant | + * |--------------|----------|---------|---------| + * | hardware int | | | | + * |--------------|----------|---------|---------| * * The messages sent are: * @@ -1023,14 +1023,14 @@ static void do_vread_s(const message *mp) ec->client= mp->m_source; count = mp->DL_COUNT; - r = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)ec->read_iovec.iod_iovec, (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_s_t), D); if (r != OK) panic("do_vread_s: sys_safecopyfrom failed: %d", r); ec->read_iovec.iod_iovec_s = count; - ec->read_iovec.iod_proc_nr = mp->DL_ENDPT; + ec->read_iovec.iod_proc_nr = mp->m_source; ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; ec->read_iovec.iod_iovec_offset = 0; @@ -1141,14 +1141,14 @@ int from_int; } /* convert the message to write_iovec */ - r = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)ec->write_iovec.iod_iovec, (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_s_t), D); if (r != OK) panic("do_vwrite_s: sys_safecopyfrom failed: %d", r); ec->write_iovec.iod_iovec_s = count; - ec->write_iovec.iod_proc_nr = mp->DL_ENDPT; + ec->write_iovec.iod_proc_nr = mp->m_source; ec->write_iovec.iod_grant = mp->DL_GRANT; ec->write_iovec.iod_iovec_offset = 0; @@ -1326,7 +1326,7 @@ message *mp; ec= &ec_state; - r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D); if (r != OK) diff --git a/drivers/lance/lance.h b/drivers/lance/lance.h index dc2996112..be8aa33b2 100644 --- a/drivers/lance/lance.h +++ b/drivers/lance/lance.h @@ -51,7 +51,7 @@ typedef struct iovec_dat { iovec_s_t iod_iovec[IOVEC_NR]; int iod_iovec_s; - int iod_proc_nr; + endpoint_t iod_proc_nr; cp_grant_id_t iod_grant; vir_bytes iod_iovec_offset; } iovec_dat_t; diff --git a/drivers/log/liveupdate.c b/drivers/log/liveupdate.c index 474c36655..7ba768623 100644 --- a/drivers/log/liveupdate.c +++ b/drivers/log/liveupdate.c @@ -18,7 +18,7 @@ PRIVATE void load_state_info(void) found_pending = FALSE; for (i = 0; i < NR_DEVS && !found_pending; i++) { log = &logdevices[i]; - if(log->log_proc_nr) { + if(log->log_source != NONE) { is_read_pending = TRUE; } if(log->log_selected) { diff --git a/drivers/log/log.c b/drivers/log/log.c index 727e04b59..2882c9ee7 100644 --- a/drivers/log/log.c +++ b/drivers/log/log.c @@ -50,7 +50,7 @@ PRIVATE struct driver log_dtab = { NULL /* HW int */ }; -extern int device_caller; +extern int device_endpt; /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); @@ -113,7 +113,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) logdevices[i].log_select_alerted = logdevices[i].log_selected = logdevices[i].log_select_ready_ops = 0; - logdevices[i].log_proc_nr = 0; + logdevices[i].log_source = NONE; logdevices[i].log_revive_alerted = 0; } @@ -189,12 +189,13 @@ subwrite(struct logdevice *log, int count, int proc_nr, LOGINC(log->log_read, overflow); } - if(log->log_size > 0 && log->log_proc_nr && !log->log_revive_alerted) { + if(log->log_size > 0 && log->log_source != NONE && + !log->log_revive_alerted) { /* Someone who was suspended on read can now * be revived. */ log->log_status = subread(log, log->log_iosize, - log->log_proc_nr, log->log_user_grant, + log->log_source, log->log_user_grant, log->log_user_offset); m.m_type = DEV_REVIVE; @@ -207,7 +208,7 @@ subwrite(struct logdevice *log, int count, int proc_nr, printf("log`subwrite: send to %d failed: %d\n", log->log_source, r); } - log->log_proc_nr = 0; + log->log_source = NONE; } if(log->log_size > 0) @@ -319,7 +320,7 @@ unsigned nr_req; /* length of request vector */ case MINOR_KLOG: if (opcode == DEV_GATHER_S) { - if (log->log_proc_nr || count < 1) { + if (log->log_source != NONE || count < 1) { /* There's already someone hanging to read, or * no real I/O requested. */ @@ -330,14 +331,14 @@ unsigned nr_req; /* length of request vector */ if(accumulated_read) return OK; /* No data available; let caller block. */ - log->log_proc_nr = proc_nr; + log->log_source = proc_nr; log->log_iosize = count; log->log_user_grant = grant; log->log_user_offset = 0; log->log_revive_alerted = 0; - /* Device_caller is a global in drivers library. */ - log->log_source = device_caller; + /* device_endpt is a global in drivers library. */ + log->log_proc_nr = device_endpt; #if LOG_DEBUG printf("blocked %d (%d)\n", log->log_source, log->log_proc_nr); @@ -402,7 +403,7 @@ message *m_ptr; d = m_ptr->TTY_LINE; if(d < 0 || d >= NR_DEVS) return EINVAL; - logdevices[d].log_proc_nr = 0; + logdevices[d].log_proc_nr = NONE; logdevices[d].log_revive_alerted = 0; return(OK); } @@ -452,10 +453,10 @@ message *m_ptr; return EINVAL; } - ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); + ops = m_ptr->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); /* Read blocks when there is no log. */ - if((m_ptr->IO_ENDPT & SEL_RD) && logdevices[d].log_size > 0) { + if((m_ptr->USER_ENDPT & SEL_RD) && logdevices[d].log_size > 0) { #if LOG_DEBUG printf("log can read; size %d\n", logdevices[d].log_size); #endif @@ -463,13 +464,13 @@ message *m_ptr; } /* Write never blocks. */ - if(m_ptr->IO_ENDPT & SEL_WR) ready_ops |= SEL_WR; + if(m_ptr->USER_ENDPT & SEL_WR) ready_ops |= SEL_WR; /* Enable select calback if no operations were * ready to go, but operations were requested, * and notify was enabled. */ - if((m_ptr->IO_ENDPT & SEL_NOTIFY) && ops && !ready_ops) { + if((m_ptr->USER_ENDPT & SEL_NOTIFY) && ops && !ready_ops) { logdevices[d].log_selected |= ops; logdevices[d].log_select_proc = m_ptr->m_source; #if LOG_DEBUG diff --git a/drivers/log/log.h b/drivers/log/log.h index f4f20105a..11187fc56 100644 --- a/drivers/log/log.h +++ b/drivers/log/log.h @@ -18,11 +18,11 @@ struct logdevice { log_read, /* read mark */ log_write; /* write mark */ #if SUSPENDABLE - int log_proc_nr, - log_source, - log_iosize, + endpoint_t log_proc_nr, + log_source; + int log_iosize, log_revive_alerted, - log_status; /* proc that is blocking on read */ + log_status; cp_grant_id_t log_user_grant; vir_bytes log_user_offset; #endif diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 4ad14e8e3..ff2f58c70 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -356,11 +356,11 @@ message *m_ptr; if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); if (m_device == MEM_DEV) { - r = sys_enable_iop(m_ptr->IO_ENDPT); + r = sys_enable_iop(m_ptr->USER_ENDPT); if (r != OK) { printf("m_do_open: sys_enable_iop failed for %d: %d\n", - m_ptr->IO_ENDPT, r); + m_ptr->USER_ENDPT, r); return r; } } @@ -449,7 +449,7 @@ message *m_ptr; /* pointer to control message */ if ((dv = m_prepare(dev)) == NULL) return(ENXIO); /* Get request structure */ - s= sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->IO_GRANT, + s= sys_safecopyfrom(m_ptr->m_source, (vir_bytes)m_ptr->IO_GRANT, 0, (vir_bytes)&ramdev_size, sizeof(ramdev_size), D); if (s != OK) return s; diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index aca1a5a7a..013a580e7 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -1292,7 +1292,7 @@ static void or_writev_s (message * mp, int from_int) { if (i + n > count) n = count - i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes) orp->or_iovec_s, n * sizeof(orp->or_iovec_s[0]), D); if (cps != OK) @@ -1304,7 +1304,7 @@ static void or_writev_s (message * mp, int from_int) { printf("Orinoco: invalid pkt size\n"); } - cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, + cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant, 0, (vir_bytes) databuf + o, s, D); if (cps != OK) printf("orinoco: sys_safecopyfrom failed:%d\n", @@ -1683,7 +1683,7 @@ static void or_readv_s (message * mp, int from_int) if (i + n > count) n = count - i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes)orp->or_iovec_s, n * sizeof(orp->or_iovec_s[0]), D); if (cps != OK) @@ -1695,7 +1695,7 @@ static void or_readv_s (message * mp, int from_int) assert (length > size); s = length - size; } - cps = sys_safecopyto(mp->DL_ENDPT, iovp->iov_grant, 0, + cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0, (vir_bytes) databuf + o, s, D); if (cps != OK) panic("orinoco: warning: sys_safecopy failed: %d", cps); @@ -1862,7 +1862,7 @@ static void or_getstat_s (message * mp) { stats = orp->or_stat; - r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if(r != OK) { panic("or_getstat_s: sys_safecopyto failed: %d", r); diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index c2213d171..1fb3ab2f1 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -14,7 +14,7 @@ * DEV_WRITE: a process wants to write on a terminal * CANCEL: terminate a previous incomplete system call immediately * - * m_type TTY_LINE IO_ENDPT COUNT ADDRESS + * m_type TTY_LINE USER_ENDPT COUNT ADDRESS * |-------------+---------+---------+---------+---------| * | DEV_OPEN | | | | | * |-------------+---------+---------+---------+---------| @@ -86,7 +86,7 @@ * with the sys_outb() messages exchanged. */ -PRIVATE int caller; /* process to tell when printing done (FS) */ +PRIVATE endpoint_t caller; /* process to tell when printing done (FS) */ PRIVATE int revive_pending; /* set to true if revive is pending */ PRIVATE int revive_status; /* revive status */ PRIVATE int done_status; /* status of last output completion */ @@ -95,7 +95,7 @@ PRIVATE unsigned char obuf[128]; /* output buffer */ PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */ PRIVATE int orig_count; /* original byte count */ PRIVATE int port_base; /* I/O port for printer */ -PRIVATE int proc_nr; /* user requesting the printing */ +PRIVATE endpoint_t proc_nr; /* user requesting the printing */ PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */ PRIVATE int user_left; /* bytes of output left in user buf */ PRIVATE vir_bytes user_vir_d; /* offset in user buf */ @@ -143,7 +143,7 @@ PUBLIC int main(int argc, char *argv[]) break; default: reply(TASK_REPLY, pr_mess.m_source, - pr_mess.IO_ENDPT, EINVAL); + pr_mess.USER_ENDPT, EINVAL); } continue; } @@ -153,13 +153,14 @@ PUBLIC int main(int argc, char *argv[]) do_initialize(); /* initialize */ /* fall through */ case DEV_CLOSE: - reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, OK); + reply(TASK_REPLY, pr_mess.m_source, pr_mess.USER_ENDPT, OK); break; case DEV_WRITE_S: do_write(&pr_mess); break; case DEV_STATUS: do_status(&pr_mess); break; case CANCEL: do_cancel(&pr_mess); break; default: - reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, EINVAL); + reply(TASK_REPLY, pr_mess.m_source, pr_mess.USER_ENDPT, + EINVAL); } } } @@ -217,14 +218,14 @@ register message *m_ptr; /* pointer to the newly arrived message */ else if (m_ptr->COUNT <= 0) r = EINVAL; /* Reply to FS, no matter what happened, possible SUSPEND caller. */ - reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); /* If no errors occurred, continue printing with SUSPENDED caller. * First wait until the printer is online to prevent stupid errors. */ if (SUSPEND == r) { caller = m_ptr->m_source; - proc_nr = m_ptr->IO_ENDPT; + proc_nr = m_ptr->USER_ENDPT; user_left = m_ptr->COUNT; orig_count = m_ptr->COUNT; user_vir_d = 0; /* Offset. */ @@ -324,12 +325,12 @@ register message *m_ptr; /* pointer to the newly arrived message */ * but rely on FS to handle the EINTR reply and de-suspension properly. */ - if (writing && m_ptr->IO_ENDPT == proc_nr) { + if (writing && m_ptr->USER_ENDPT == proc_nr) { oleft = 0; /* cancel output by interrupt handler */ writing = FALSE; revive_pending = FALSE; } - reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, EINTR); + reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, EINTR); } /*===========================================================================* @@ -393,7 +394,7 @@ PRIVATE void prepare_output() if ( (chunk = user_left) > sizeof obuf) chunk = sizeof obuf; - s=sys_safecopyfrom(proc_nr, grant_nr, user_vir_d, (vir_bytes) obuf, + s=sys_safecopyfrom(caller, grant_nr, user_vir_d, (vir_bytes) obuf, chunk, D); if(s != OK) { diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index ceac7aed8..74a85479e 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -963,7 +963,7 @@ static void rl_readv_s(const message *mp, int from_int) if (i+n > count) n= count-i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { @@ -981,7 +981,7 @@ static void rl_readv_s(const message *mp, int from_int) } #if 0 - if (sys_umap(mp->DL_ENDPT, D, iovp->iov_addr, s, &dst_phys) != OK) + if (sys_umap(mp->m_source, D, iovp->iov_addr, s, &dst_phys) != OK) panic("umap_local failed"); #endif @@ -996,14 +996,14 @@ static void rl_readv_s(const message *mp, int from_int) assert(oDL_ENDPT, + cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0, (vir_bytes) rep->v_re_rx_buf+o, s1, D); if (cps != OK) { panic("rl_readv_s: sys_safecopyto failed: %d", cps); } - cps = sys_safecopyto(mp->DL_ENDPT, + cps = sys_safecopyto(mp->m_source, iovp->iov_grant, s1, (vir_bytes) rep->v_re_rx_buf, s-s1, S); if (cps != OK) { @@ -1012,7 +1012,7 @@ static void rl_readv_s(const message *mp, int from_int) } else { - cps = sys_safecopyto(mp->DL_ENDPT, + cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0, (vir_bytes) rep->v_re_rx_buf+o, s, D); if (cps != OK) @@ -1127,7 +1127,7 @@ static void rl_writev_s(const message *mp, int from_int) n= IOVEC_NR; if (i+n > count) n= count-i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { @@ -1140,7 +1140,7 @@ static void rl_writev_s(const message *mp, int from_int) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { panic("invalid packet size"); } - cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, + cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant, 0, (vir_bytes) ret, s, D); if (cps != OK) { panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); @@ -1624,7 +1624,7 @@ message *mp; stats= rep->re_stat; - r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if (r != OK) panic("rl_getstat_s: sys_safecopyto failed: %d", r); diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 036352f89..cfb0e3c9a 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -1305,7 +1305,7 @@ readvs_loop: n = IOVEC_NR; if (i + n > count) n = count-i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { @@ -1319,7 +1319,7 @@ readvs_loop: s = packlen-size; } - cps = sys_safecopyto(mp->DL_ENDPT, iovp->iov_grant, 0, + cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0, (vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D); if (cps != OK) panic("rl_readv_s: sys_safecopyto failed: %d", cps); @@ -1441,7 +1441,7 @@ static void rl_writev_s(const message *mp, int from_int) n = IOVEC_NR; if (i + n > count) n = count - i; - cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, + cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { @@ -1453,7 +1453,7 @@ static void rl_writev_s(const message *mp, int from_int) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) panic("invalid packet size"); - cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, + cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant, 0, (vir_bytes) ret, s, D); if (cps != OK) { panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); @@ -1604,7 +1604,7 @@ message *mp; stats = rep->re_stat; - r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, + r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if (r != OK) panic("rl_getstat_s: sys_safecopyto failed: %d", r); diff --git a/drivers/tty/console.c b/drivers/tty/console.c index b02476210..230f26fac 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -171,7 +171,7 @@ int try; */ do { if (count > sizeof(buf)) count = sizeof(buf); - if ((result = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, + if ((result = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant, tp->tty_outoffset, (vir_bytes) buf, count, D)) != OK) break; tp->tty_outoffset += count; @@ -807,27 +807,27 @@ PUBLIC void do_video(message *m) do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */ - r = sys_safecopyfrom(m->IO_ENDPT, + r = sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &mapreqvm, sizeof(mapreqvm), D); if (r != OK) { printf("tty: sys_safecopyfrom failed\n"); - tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, - r); + tty_reply(TASK_REPLY, m->m_source, + m->USER_ENDPT, r); return; } /* In safe ioctl mode, the POSITION field contains * the endpt number of the original requestor. - * IO_ENDPT is always FS. + * USER_ENDPT is always FS. */ if(do_map) { mapreqvm.vaddr_ret = vm_map_phys(m->POSITION, (void *) mapreqvm.phys_offset, mapreqvm.size); - if((r = sys_safecopyto(m->IO_ENDPT, + if((r = sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &mapreqvm, sizeof(mapreqvm), D)) != OK) { @@ -837,7 +837,7 @@ PUBLIC void do_video(message *m) r = vm_unmap_phys(m->POSITION, mapreqvm.vaddr, mapreqvm.size); } - tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); + tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r); return; } } @@ -850,7 +850,7 @@ PUBLIC void do_video(message *m) m->m_type, m->m_source); r= EINVAL; } - tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); + tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r); } @@ -1201,9 +1201,9 @@ message *m; if (!machine.vdu_ega) return(ENOTTY); result = ga_program(seq1); /* bring font memory into view */ - if(sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, 0, + if(sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) font_memory, GA_FONT_SIZE, D) != OK) { - printf("tty: copying from %d failed\n", m->IO_ENDPT); + printf("tty: copying from %d failed\n", m->m_source); return EFAULT; } diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index 8766e1d2a..e6dbbc7c1 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -248,7 +248,7 @@ message *m; { /* Should record proc */ kbdp->req_size= m->COUNT; - kbdp->req_proc= m->IO_ENDPT; + kbdp->req_proc= m->USER_ENDPT; kbdp->req_grant= (cp_grant_id_t) m->IO_GRANT; kbdp->req_addr_offset= 0; kbdp->incaller= m->m_source; @@ -264,7 +264,7 @@ message *m; n= KBD_BUFSZ-kbdp->offset; if (n <= 0) panic("do_kbd(READ): bad n: %d", n); - r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, 0, + r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &kbdp->buf[kbdp->offset], n, D); if (r == OK) { @@ -291,7 +291,7 @@ message *m; */ for (i= 0; iCOUNT; i++) { - r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) + r= sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, i, (vir_bytes) &c, 1, D); if (r != OK) break; @@ -305,8 +305,8 @@ message *m; r= OK; break; case DEV_SELECT: - ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); - watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; + ops = m->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); + watch = (m->USER_ENDPT & SEL_NOTIFY) ? 1 : 0; r= 0; if (kbdp->avail && (ops & SEL_RD)) @@ -328,7 +328,7 @@ message *m; unsigned char b; - r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) + r= sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &leds, sizeof(leds), D); if (r != OK) @@ -363,7 +363,7 @@ message *m; kio_bell_t bell; clock_t ticks; - r = sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) + r = sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &bell, sizeof(bell), D); if (r != OK) @@ -386,7 +386,7 @@ message *m; m->m_type, m->m_source); r= EINVAL; } - tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); + tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r); } @@ -410,7 +410,7 @@ message *m; if (n <= 0) panic("kbd_status: bad n: %d", n); kbdp->req_size= 0; - r= sys_safecopyto(kbdp->req_proc, kbdp->req_grant, 0, + r= sys_safecopyto(kbdp->incaller, kbdp->req_grant, 0, (vir_bytes)&kbdp->buf[kbdp->offset], n, D); if (r == OK) { @@ -1060,7 +1060,7 @@ PUBLIC int kbd_loadmap(m) message *m; { /* Load a new keymap. */ - return sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, + return sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D); } diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 72a1c3b96..916b7b963 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -103,7 +103,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr) } pp->rdsendreply = TRUE; pp->rdcaller = m_ptr->m_source; - pp->rdproc = m_ptr->IO_ENDPT; + pp->rdproc = m_ptr->USER_ENDPT; pp->rdgrant = (cp_grant_id_t) m_ptr->IO_GRANT; pp->rdoffset = 0; pp->rdleft = m_ptr->COUNT; @@ -135,7 +135,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr) } pp->wrsendreply = TRUE; pp->wrcaller = m_ptr->m_source; - pp->wrproc = m_ptr->IO_ENDPT; + pp->wrproc = m_ptr->USER_ENDPT; pp->wrgrant = (cp_grant_id_t) m_ptr->IO_GRANT; pp->wroffset = 0; pp->wrleft = m_ptr->COUNT; @@ -173,12 +173,12 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr) case CANCEL: r = EINTR; - if (m_ptr->IO_ENDPT == pp->rdproc) { + if (m_ptr->USER_ENDPT == pp->rdproc) { /* Cancel a read from a PTY. */ r = pp->rdcum > 0 ? pp->rdcum : EAGAIN; pp->rdleft = pp->rdcum = 0; } - if (m_ptr->IO_ENDPT == pp->wrproc) { + if (m_ptr->USER_ENDPT == pp->wrproc) { /* Cancel a write to a PTY. */ r = pp->wrcum > 0 ? pp->wrcum : EAGAIN; pp->wrleft = pp->wrcum = 0; @@ -188,7 +188,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr) default: r = EINVAL; } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); } /*===========================================================================* @@ -230,7 +230,7 @@ PRIVATE int pty_write(tty_t *tp, int try) break; /* Copy from user space to the PTY output buffer. */ - if ((s = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, + if ((s = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant, tp->tty_outoffset, (vir_bytes) pp->ohead, count, D))!=OK) { break; } @@ -307,7 +307,7 @@ PRIVATE void pty_start(pty_t *pp) if (count == 0) break; /* Copy from the output buffer to the readers address space. */ - if((s = sys_safecopyto(pp->rdproc, pp->rdgrant, + if((s = sys_safecopyto(pp->rdcaller, pp->rdgrant, pp->rdoffset, (vir_bytes) pp->otail, count, D)) != OK) { break; } @@ -376,7 +376,7 @@ PRIVATE int pty_read(tty_t *tp, int try) int s; /* Transfer one character to 'c'. */ - if ((s = sys_safecopyfrom(pp->wrproc, pp->wrgrant, pp->wroffset, + if ((s = sys_safecopyfrom(pp->wrcaller, pp->wrgrant, pp->wroffset, (vir_bytes) &c, 1, D)) != OK) { printf("pty: safecopy failed (error %d)\n", s); break; @@ -587,8 +587,8 @@ PRIVATE int pty_select(tty_t *tp, message *m) pty_t *pp = tp->tty_priv; int ops, ready_ops = 0, watch; - ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); - watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; + ops = m->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); + watch = (m->USER_ENDPT & SEL_NOTIFY) ? 1 : 0; ready_ops = select_try_pty(tp, ops); diff --git a/drivers/tty/rs232.c b/drivers/tty/rs232.c index 5bf8bec8a..f3311e3c0 100644 --- a/drivers/tty/rs232.c +++ b/drivers/tty/rs232.c @@ -248,7 +248,7 @@ PRIVATE int rs_write(register tty_t *tp, int try) if (try) return 1; /* Copy from user space to the RS232 output buffer. */ - sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, + sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant, tp->tty_outoffset, (vir_bytes) rs->ohead, count, D); /* Perform output processing on the output buffer. */ diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index bdb269ea7..39f4ee54a 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -30,7 +30,7 @@ * DEV_STATUS: FS wants to know status for SELECT or REVIVE * CANCEL: terminate a previous incomplete system call immediately * - * m_type TTY_LINE IO_ENDPT COUNT TTY_SPEKS IO_GRANT + * m_type TTY_LINE USER_ENDPT COUNT TTY_SPEKS IO_GRANT * ----------------------------------------------------------------- * | HARD_INT | | | | | | * |-------------+---------+---------+---------+---------+---------| @@ -263,7 +263,7 @@ PUBLIC int main(void) if (tty_mess.m_source != LOG_PROC_NR) { tty_reply(TASK_REPLY, tty_mess.m_source, - tty_mess.IO_ENDPT, ENXIO); + tty_mess.USER_ENDPT, ENXIO); } continue; } @@ -281,7 +281,7 @@ PUBLIC int main(void) printf("Warning, TTY got unexpected request %d from %d\n", tty_mess.m_type, tty_mess.m_source); tty_reply(TASK_REPLY, tty_mess.m_source, - tty_mess.IO_ENDPT, EINVAL); + tty_mess.USER_ENDPT, EINVAL); } } @@ -455,7 +455,7 @@ register message *m_ptr; /* pointer to message sent to the task */ /* Copy information from the message to the tty struct. */ tp->tty_inrepcode = TASK_REPLY; tp->tty_incaller = m_ptr->m_source; - tp->tty_inproc = m_ptr->IO_ENDPT; + tp->tty_inproc = m_ptr->USER_ENDPT; tp->tty_ingrant = (cp_grant_id_t) m_ptr->IO_GRANT; tp->tty_inoffset = 0; tp->tty_inleft = m_ptr->COUNT; @@ -495,7 +495,7 @@ register message *m_ptr; /* pointer to message sent to the task */ r = SUSPEND; /* suspend the caller */ tp->tty_inrepcode = TTY_REVIVE; } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); if (tp->tty_select_ops) select_retry(tp); } @@ -522,7 +522,7 @@ register message *m_ptr; /* pointer to message sent to the task */ /* Copy message parameters to the tty structure. */ tp->tty_outrepcode = TASK_REPLY; tp->tty_outcaller = m_ptr->m_source; - tp->tty_outproc = m_ptr->IO_ENDPT; + tp->tty_outproc = m_ptr->USER_ENDPT; tp->tty_outgrant = (cp_grant_id_t) m_ptr->IO_GRANT; tp->tty_outoffset = 0; tp->tty_outleft = m_ptr->COUNT; @@ -538,7 +538,7 @@ register message *m_ptr; /* pointer to message sent to the task */ r = SUSPEND; /* suspend the caller */ tp->tty_outrepcode = TTY_REVIVE; } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); } /*===========================================================================* @@ -598,7 +598,7 @@ message *m_ptr; /* pointer to message sent to task */ switch (m_ptr->TTY_REQUEST) { case TCGETS: /* Get the termios attributes. */ - r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0, + r = sys_safecopyto(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) &tp->tty_termios, (vir_bytes) size, D); break; @@ -608,7 +608,7 @@ message *m_ptr; /* pointer to message sent to task */ if (tp->tty_outleft > 0) { /* Wait for all ongoing output processing to finish. */ tp->tty_iocaller = m_ptr->m_source; - tp->tty_ioproc = m_ptr->IO_ENDPT; + tp->tty_ioproc = m_ptr->USER_ENDPT; tp->tty_ioreq = m_ptr->REQUEST; tp->tty_iogrant = (cp_grant_id_t) m_ptr->IO_GRANT; r = SUSPEND; @@ -619,14 +619,14 @@ message *m_ptr; /* pointer to message sent to task */ /*FALL THROUGH*/ case TCSETS: /* Set the termios attributes. */ - r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, + r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) &tp->tty_termios, (vir_bytes) size, D); if (r != OK) break; setattr(tp); break; case TCFLSH: - r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, + r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) ¶m.i, (vir_bytes) size, D); if (r != OK) break; switch (param.i) { @@ -638,7 +638,7 @@ message *m_ptr; /* pointer to message sent to task */ break; case TCFLOW: - r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, + r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) ¶m.i, (vir_bytes) size, D); if (r != OK) break; switch (param.i) { @@ -663,12 +663,12 @@ message *m_ptr; /* pointer to message sent to task */ break; case TIOCGWINSZ: - r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0, + r = sys_safecopyto(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D); break; case TIOCSWINSZ: - r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, + r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D); sigchar(tp, SIGWINCH, 0); break; @@ -698,7 +698,7 @@ message *m_ptr; /* pointer to message sent to task */ } /* Send the reply. */ - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); } /*===========================================================================* @@ -719,12 +719,12 @@ message *m_ptr; /* pointer to message sent to task */ if (m_ptr->COUNT & R_BIT) r = EACCES; } else { if (!(m_ptr->COUNT & O_NOCTTY)) { - tp->tty_pgrp = m_ptr->IO_ENDPT; + tp->tty_pgrp = m_ptr->USER_ENDPT; r = 1; } tp->tty_openct++; } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r); } /*===========================================================================* @@ -745,7 +745,7 @@ message *m_ptr; /* pointer to message sent to task */ tp->tty_winsize = winsize_defaults; setattr(tp); } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, OK); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, OK); } /*===========================================================================* @@ -764,7 +764,7 @@ message *m_ptr; /* pointer to message sent to task */ int r = EINTR; /* Check the parameters carefully, to avoid cancelling twice. */ - proc_nr = m_ptr->IO_ENDPT; + proc_nr = m_ptr->USER_ENDPT; mode = m_ptr->COUNT; if ((mode & R_BIT) && tp->tty_inleft != 0 && proc_nr == tp->tty_inproc && tp->tty_ingrant == (cp_grant_id_t) m_ptr->IO_GRANT) { @@ -913,7 +913,7 @@ register tty_t *tp; /* pointer to terminal to read from */ tp->tty_inleft--; if (++bp == bufend(buf)) { /* Temp buffer full, copy to user space. */ - sys_safecopyto(tp->tty_inproc, + sys_safecopyto(tp->tty_incaller, tp->tty_ingrant, tp->tty_inoffset, (vir_bytes) buf, (vir_bytes) buflen(buf), D); @@ -937,7 +937,7 @@ register tty_t *tp; /* pointer to terminal to read from */ if (bp > buf) { /* Leftover characters in the buffer. */ count = bp - buf; - sys_safecopyto(tp->tty_inproc, + sys_safecopyto(tp->tty_incaller, tp->tty_ingrant, tp->tty_inoffset, (vir_bytes) buf, (vir_bytes) count, D); tp->tty_inoffset += count; @@ -1377,7 +1377,7 @@ tty_t *tp; if (tp->tty_ioreq != TCDRAIN) { if (tp->tty_ioreq == TCSETSF) tty_icancel(tp); - result = sys_safecopyfrom(tp->tty_ioproc, tp->tty_iogrant, 0, + result = sys_safecopyfrom(tp->tty_iocaller, tp->tty_iogrant, 0, (vir_bytes) &tp->tty_termios, (vir_bytes) sizeof(tp->tty_termios), D); if (result == OK) setattr(tp); @@ -1614,8 +1614,8 @@ register message *m_ptr; /* pointer to message sent to the task */ { int ops, ready_ops = 0, watch; - ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); - watch = (m_ptr->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; + ops = m_ptr->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); + watch = (m_ptr->USER_ENDPT & SEL_NOTIFY) ? 1 : 0; ready_ops = select_try(tp, ops); @@ -1624,7 +1624,7 @@ register message *m_ptr; /* pointer to message sent to the task */ tp->tty_select_proc = m_ptr->m_source; } - tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, ready_ops); + tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, ready_ops); return; } diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index 2f82e7be4..b83334e7b 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -58,36 +58,36 @@ typedef struct tty { char tty_reprint; /* 1 when echoed input messed up, else 0 */ char tty_escaped; /* 1 when LNEXT (^V) just seen, else 0 */ char tty_inhibited; /* 1 when STOP (^S) just seen (stops output) */ - int tty_pgrp; /* slot number of controlling process */ + endpoint_t tty_pgrp; /* endpoint of controlling process */ char tty_openct; /* count of number of opens of this tty */ /* Information about incomplete I/O requests is stored here. */ int tty_inrepcode; /* reply code, TASK_REPLY or REVIVE */ char tty_inrevived; /* set to 1 if revive callback is pending */ - int tty_incaller; /* process that made the call (usually FS) */ - int tty_inproc; /* process that wants to read from tty */ + endpoint_t tty_incaller; /* process that made the call (usually VFS) */ + endpoint_t tty_inproc; /* process that wants to read from tty */ cp_grant_id_t tty_ingrant; /* grant where data is to go */ vir_bytes tty_inoffset; /* offset into grant */ int tty_inleft; /* how many chars are still needed */ int tty_incum; /* # chars input so far */ int tty_outrepcode; /* reply code, TASK_REPLY or REVIVE */ int tty_outrevived; /* set to 1 if revive callback is pending */ - int tty_outcaller; /* process that made the call (usually FS) */ - int tty_outproc; /* process that wants to write to tty */ + endpoint_t tty_outcaller; /* process that made the call (usually VFS) */ + endpoint_t tty_outproc; /* process that wants to write to tty */ cp_grant_id_t tty_outgrant; /* grant where data comes from */ vir_bytes tty_outoffset; /* offset into grant */ int tty_outleft; /* # chars yet to be output */ int tty_outcum; /* # chars output so far */ - int tty_iocaller; /* process that made the call (usually FS) */ + endpoint_t tty_iocaller; /* process that made the call (usually VFS) */ int tty_iorevived; /* set to 1 if revive callback is pending */ - int tty_ioproc; /* process that wants to do an ioctl */ + endpoint_t tty_ioproc; /* process that wants to do an ioctl */ int tty_iostatus; /* result */ int tty_ioreq; /* ioctl request code */ cp_grant_id_t tty_iogrant; /* virtual address of ioctl buffer or grant */ /* select() data */ int tty_select_ops; /* which operations are interesting */ - int tty_select_proc; /* which process wants notification */ + endpoint_t tty_select_proc; /* which process wants notification */ /* Miscellaneous. */ devfun_t tty_ioctl; /* set line speed, etc. at the device level */ diff --git a/kernel/arch/i386/do_iopenable.c b/kernel/arch/i386/do_iopenable.c index 083198702..ea4a17150 100644 --- a/kernel/arch/i386/do_iopenable.c +++ b/kernel/arch/i386/do_iopenable.c @@ -2,7 +2,7 @@ * m_type: SYS_IOPENABLE * * The parameters for this system call are: - * m2_i2: IO_ENDPT (process to give I/O Protection Level bits) + * m2_i2: IOP_ENDPT (process to give I/O Protection Level bits) * * Author: * Jorrit N. Herder @@ -22,9 +22,9 @@ PUBLIC int do_iopenable(struct proc * caller, message * m_ptr) int proc_nr; #if 1 /* ENABLE_USERPRIV && ENABLE_USERIOPL */ - if (m_ptr->IO_ENDPT == SELF) { + if (m_ptr->IOP_ENDPT == SELF) { proc_nr = _ENDPOINT_P(caller->p_endpoint); - } else if(!isokendpt(m_ptr->IO_ENDPT, &proc_nr)) + } else if(!isokendpt(m_ptr->IOP_ENDPT, &proc_nr)) return(EINVAL); enable_iop(proc_addr(proc_nr)); return(OK); diff --git a/lib/libaudiodriver/audio_fw.c b/lib/libaudiodriver/audio_fw.c index 6514088f5..fa388340d 100644 --- a/lib/libaudiodriver/audio_fw.c +++ b/lib/libaudiodriver/audio_fw.c @@ -8,7 +8,7 @@ * * The driver supports the following operations: * - * m_type DEVICE IO_ENDPT COUNT POSITION ADRRESS + * m_type DEVICE USER_ENDPT COUNT POSITION ADRRESS * ----------------------------------------------------------------- * | DEV_OPEN | device | proc nr | | | | * |-------------+---------+---------+---------+---------+---------| @@ -122,7 +122,7 @@ PUBLIC int main(int argc, char *argv[]) /* open the special file ( = parameter) */ r = msg_open(mess.DEVICE); repl_mess.m_type = DEV_REVIVE; - repl_mess.REP_ENDPT = mess.IO_ENDPT; + repl_mess.REP_ENDPT = mess.USER_ENDPT; repl_mess.REP_STATUS = r; send(caller, &repl_mess); @@ -132,7 +132,7 @@ PUBLIC int main(int argc, char *argv[]) /* close the special file ( = parameter) */ r = msg_close(mess.DEVICE); repl_mess.m_type = DEV_CLOSE_REPL; - repl_mess.REP_ENDPT = mess.IO_ENDPT; + repl_mess.REP_ENDPT = mess.USER_ENDPT; repl_mess.REP_STATUS = r; send(caller, &repl_mess); @@ -144,7 +144,7 @@ PUBLIC int main(int argc, char *argv[]) if (r != SUSPEND) { repl_mess.m_type = DEV_REVIVE; - repl_mess.REP_ENDPT = mess.IO_ENDPT; + repl_mess.REP_ENDPT = mess.USER_ENDPT; repl_mess.REP_IO_GRANT = (unsigned)mess.IO_GRANT; repl_mess.REP_STATUS = r; @@ -162,7 +162,7 @@ PUBLIC int main(int argc, char *argv[]) /* reopen the special file ( = parameter) */ r = msg_open(mess.DEVICE); repl_mess.m_type = DEV_REOPEN_REPL; - repl_mess.REP_ENDPT = mess.IO_ENDPT; + repl_mess.REP_ENDPT = mess.USER_ENDPT; repl_mess.REP_STATUS = r; send(caller, &repl_mess); continue; @@ -479,7 +479,7 @@ PRIVATE int msg_ioctl(const message *m_ptr) if (m_ptr->REQUEST & _IOC_IN) { /* if there is data for us, copy it */ len = io_ctl_length(m_ptr->REQUEST); - if(sys_safecopyfrom(m_ptr->IO_ENDPT, + if(sys_safecopyfrom(m_ptr->m_source, (vir_bytes)m_ptr->ADDRESS, 0, (vir_bytes)io_ctl_buf, len, D) != OK) { printf("%s:%d: safecopyfrom failed\n", __FILE__, __LINE__); @@ -493,7 +493,7 @@ PRIVATE int msg_ioctl(const message *m_ptr) if (status == OK && m_ptr->REQUEST & _IOC_OUT) { /* copy result back to user */ - if(sys_safecopyto(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, 0, + if(sys_safecopyto(m_ptr->m_source, (vir_bytes)m_ptr->ADDRESS, 0, (vir_bytes)io_ctl_buf, len, D) != OK) { printf("%s:%d: safecopyto failed\n", __FILE__, __LINE__); } @@ -515,7 +515,7 @@ PRIVATE void msg_write(const message *m_ptr) if (chan == NO_CHANNEL) { error("%s: No write channel specified!\n", drv.DriverName); - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO); return; } /* get pointer to sub device data */ @@ -529,20 +529,20 @@ PRIVATE void msg_write(const message *m_ptr) } if(m_ptr->COUNT != sub_dev_ptr->FragSize) { error("Fragment size does not match user's buffer length\n"); - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EINVAL); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL); return; } /* if we are busy with something else than writing, return EBUSY */ if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_WRITE_S) { error("Already busy with something else then writing\n"); - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EBUSY); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EBUSY); return; } sub_dev_ptr->RevivePending = TRUE; - sub_dev_ptr->ReviveProcNr = m_ptr->IO_ENDPT; + sub_dev_ptr->ReviveProcNr = m_ptr->USER_ENDPT; sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS; - sub_dev_ptr->NotifyProcNr = m_ptr->m_source; + sub_dev_ptr->SourceProcNr = m_ptr->m_source; data_from_user(sub_dev_ptr); @@ -566,7 +566,7 @@ PRIVATE void msg_read(message *m_ptr) if (chan == NO_CHANNEL) { error("%s: No read channel specified!\n", drv.DriverName); - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO); return; } /* get pointer to sub device data */ @@ -575,25 +575,26 @@ PRIVATE void msg_read(message *m_ptr) if (!sub_dev_ptr->DmaBusy) { /* get fragment size on first read */ if (drv_get_frag_size(&(sub_dev_ptr->FragSize), sub_dev_ptr->Nr) != OK){ error("%s: Could not retrieve fragment size!\n", drv.DriverName); - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, + EIO); return; } } if(m_ptr->COUNT != sub_dev_ptr->FragSize) { - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EINVAL); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL); error("fragment size does not match message size\n"); return; } /* if we are busy with something else than reading, reply EBUSY */ if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_READ_S) { - reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EBUSY); + reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EBUSY); return; } sub_dev_ptr->RevivePending = TRUE; - sub_dev_ptr->ReviveProcNr = m_ptr->IO_ENDPT; + sub_dev_ptr->ReviveProcNr = m_ptr->USER_ENDPT; sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS; - sub_dev_ptr->NotifyProcNr = m_ptr->m_source; + sub_dev_ptr->SourceProcNr = m_ptr->m_source; if(!sub_dev_ptr->DmaBusy) { /* Dma tranfer not yet started */ get_started(sub_dev_ptr); @@ -814,7 +815,7 @@ PRIVATE void data_from_user(sub_dev_t *subdev) if (subdev->DmaLength < subdev->NrOfDmaFragments) { /* room in dma buf */ - sys_safecopyfrom(subdev->ReviveProcNr, + sys_safecopyfrom(subdev->SourceProcNr, (vir_bytes)subdev->ReviveGrant, 0, (vir_bytes)subdev->DmaPtr + subdev->DmaFillNext * subdev->FragSize, @@ -828,7 +829,7 @@ PRIVATE void data_from_user(sub_dev_t *subdev) } else { /* room in extra buf */ - sys_safecopyfrom(subdev->ReviveProcNr, + sys_safecopyfrom(subdev->SourceProcNr, (vir_bytes)subdev->ReviveGrant, 0, (vir_bytes)subdev->ExtraBuf + subdev->BufFillNext * subdev->FragSize, @@ -858,11 +859,11 @@ PRIVATE void data_from_user(sub_dev_t *subdev) m.REP_ENDPT = subdev->ReviveProcNr; m.REP_IO_GRANT = subdev->ReviveGrant; m.REP_STATUS = subdev->ReviveStatus; - r= send(subdev->NotifyProcNr, &m); /* send the message */ + r= send(subdev->SourceProcNr, &m); /* send the message */ if (r != OK) { printf("audio_fw: send to %d failed: %d\n", - subdev->NotifyProcNr, r); + subdev->SourceProcNr, r); } /* reset variables */ @@ -883,7 +884,7 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr) if(sub_dev_ptr->BufLength != 0) { /* data in extra buffer available */ - sys_safecopyto(sub_dev_ptr->ReviveProcNr, + sys_safecopyto(sub_dev_ptr->SourceProcNr, (vir_bytes)sub_dev_ptr->ReviveGrant, 0, (vir_bytes)sub_dev_ptr->ExtraBuf + sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize, @@ -898,7 +899,7 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr) } else { /* extra buf empty, but data in dma buf*/ sys_safecopyto( - sub_dev_ptr->ReviveProcNr, + sub_dev_ptr->SourceProcNr, (vir_bytes)sub_dev_ptr->ReviveGrant, 0, (vir_bytes)sub_dev_ptr->DmaPtr + sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize, @@ -920,11 +921,11 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr) m.REP_ENDPT = sub_dev_ptr->ReviveProcNr; m.REP_IO_GRANT = sub_dev_ptr->ReviveGrant; m.REP_STATUS = sub_dev_ptr->ReviveStatus; - r= send(sub_dev_ptr->NotifyProcNr, &m); /* send the message */ + r= send(sub_dev_ptr->SourceProcNr, &m); /* send the message */ if (r != OK) { printf("audio_fw: send to %d failed: %d\n", - sub_dev_ptr->NotifyProcNr, r); + sub_dev_ptr->SourceProcNr, r); } /* reset variables */ diff --git a/lib/libdriver/driver.c b/lib/libdriver/driver.c index 0d3b4fbe4..e90054ce6 100644 --- a/lib/libdriver/driver.c +++ b/lib/libdriver/driver.c @@ -9,7 +9,7 @@ * * The drivers support the following operations (using message format m2): * - * m_type DEVICE IO_ENDPT COUNT POSITION HIGHPOS IO_GRANT + * m_type DEVICE USER_ENDPT COUNT POSITION HIGHPOS IO_GRANT * ---------------------------------------------------------------------------- * | DEV_OPEN | device | proc nr | | | | | * |---------------+--------+---------+---------+--------+--------+-----------| @@ -53,7 +53,7 @@ FORWARD _PROTOTYPE( void clear_open_devs, (void) ); FORWARD _PROTOTYPE( int is_open_dev, (int device) ); FORWARD _PROTOTYPE( void set_open_dev, (int device) ); -FORWARD _PROTOTYPE( void asyn_reply, (message *mess, int proc_nr, int r) ); +FORWARD _PROTOTYPE( void asyn_reply, (message *mess, int r) ); FORWARD _PROTOTYPE( int driver_reply, (endpoint_t caller_e, int caller_status, message *m_ptr) ); FORWARD _PROTOTYPE( int driver_spurious_reply, (endpoint_t caller_e, @@ -61,7 +61,8 @@ FORWARD _PROTOTYPE( int driver_spurious_reply, (endpoint_t caller_e, FORWARD _PROTOTYPE( int do_rdwt, (struct driver *dr, message *mp) ); FORWARD _PROTOTYPE( int do_vrdwt, (struct driver *dr, message *mp) ); -int device_caller; +PRIVATE endpoint_t device_caller; +PUBLIC endpoint_t device_endpt; /* used externally by log driver */ PRIVATE mq_t *queue_head = NULL; PRIVATE int open_devs[MAX_NR_OPEN_DEVICES]; PRIVATE int next_open_devs_slot = 0; @@ -108,9 +109,8 @@ PRIVATE void set_open_dev(int device) /*===========================================================================* * asyn_reply * *===========================================================================*/ -PRIVATE void asyn_reply(mess, proc_nr, r) +PRIVATE void asyn_reply(mess, r) message *mess; -int proc_nr; int r; { /* Send a reply using the new asynchronous character device protocol. @@ -120,13 +120,13 @@ int r; switch (mess->m_type) { case DEV_OPEN: reply_mess.m_type = DEV_REVIVE; - reply_mess.REP_ENDPT = proc_nr; + reply_mess.REP_ENDPT = device_endpt; reply_mess.REP_STATUS = r; break; case DEV_CLOSE: reply_mess.m_type = DEV_CLOSE_REPL; - reply_mess.REP_ENDPT = proc_nr; + reply_mess.REP_ENDPT = device_endpt; reply_mess.REP_STATUS = r; break; @@ -134,10 +134,11 @@ int r; case DEV_WRITE_S: case DEV_IOCTL_S: if (r == SUSPEND) - printf("driver_task: reviving %d with SUSPEND\n", proc_nr); + printf("driver_task: reviving %d (%d) with SUSPEND\n", + device_caller, device_endpt); reply_mess.m_type = DEV_REVIVE; - reply_mess.REP_ENDPT = proc_nr; + reply_mess.REP_ENDPT = device_endpt; reply_mess.REP_IO_GRANT = (cp_grant_id_t) mess->IO_GRANT; reply_mess.REP_STATUS = r; break; @@ -154,7 +155,7 @@ int r; default: reply_mess.m_type = TASK_REPLY; - reply_mess.REP_ENDPT = proc_nr; + reply_mess.REP_ENDPT = device_endpt; /* Status is # of bytes transferred or error code. */ reply_mess.REP_STATUS = r; break; @@ -202,7 +203,7 @@ message *m_ptr; int r; m_ptr->m_type = TASK_REPLY; - m_ptr->REP_ENDPT = m_ptr->IO_ENDPT; + m_ptr->REP_ENDPT = m_ptr->USER_ENDPT; m_ptr->REP_STATUS = ERESTART; r = driver_reply(caller_e, caller_status, m_ptr); @@ -346,7 +347,7 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */ { /* Main program of any device driver task. */ - int r, proc_nr, ipc_status; + int r, ipc_status; message mess; driver_running = TRUE; @@ -371,10 +372,10 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */ message *m_ptr; /* Pointer to message to handle */ int ipc_status; { - int r, proc_nr; + int r; device_caller = m_ptr->m_source; - proc_nr = m_ptr->IO_ENDPT; + device_endpt = m_ptr->USER_ENDPT; if (is_ipc_notify(ipc_status)) { switch (_ENDPOINT_P(m_ptr->m_source)) { case HARDWARE: @@ -425,7 +426,7 @@ send_reply: switch (type) { case DRIVER_STD: m_ptr->m_type = TASK_REPLY; - m_ptr->REP_ENDPT = proc_nr; + m_ptr->REP_ENDPT = device_endpt; /* Status is # of bytes transferred or error code. */ m_ptr->REP_STATUS = r; @@ -439,7 +440,7 @@ send_reply: break; case DRIVER_ASYN: - asyn_reply(m_ptr, proc_nr, r); + asyn_reply(m_ptr, r); break; @@ -495,7 +496,7 @@ message *mp; /* pointer to read or write message */ /* Transfer bytes from/to the device. */ position= make64(mp->POSITION, mp->HIGHPOS); - r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, position, &iovec1, 1); + r = (*dp->dr_transfer)(mp->m_source, opcode, position, &iovec1, 1); /* Return the number of bytes transferred or an error code. */ return(r == OK ? (mp->COUNT - iovec1.iov_size) : r); @@ -536,7 +537,7 @@ message *mp; /* pointer to read or write message */ /* Transfer bytes from/to the device. */ opcode = mp->m_type; position= make64(mp->POSITION, mp->HIGHPOS); - r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, position, iovec, nr_req); + r = (*dp->dr_transfer)(mp->m_source, opcode, position, iovec, nr_req); /* Copy the I/O vector back to the caller. */ if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT, @@ -659,7 +660,7 @@ message *mp; /* pointer to ioctl request */ if (mp->REQUEST == DIOCSETP) { /* Copy just this one partition table entry. */ - s=sys_safecopyfrom(mp->IO_ENDPT, (vir_bytes) mp->IO_GRANT, + s=sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT, 0, (vir_bytes) &entry, sizeof(entry), D); if(s != OK) return s; @@ -670,7 +671,7 @@ message *mp; /* pointer to ioctl request */ entry.base = dv->dv_base; entry.size = dv->dv_size; (*dp->dr_geometry)(&entry); - s=sys_safecopyto(mp->IO_ENDPT, (vir_bytes) mp->IO_GRANT, + s=sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT, 0, (vir_bytes) &entry, sizeof(entry), D); if (OK != s) return s; diff --git a/lib/libsys/sys_eniop.c b/lib/libsys/sys_eniop.c index 91b1e3d9b..0dd7b1fa2 100644 --- a/lib/libsys/sys_eniop.c +++ b/lib/libsys/sys_eniop.c @@ -7,7 +7,7 @@ PUBLIC int sys_enable_iop(proc_ep) endpoint_t proc_ep; /* number of process to allow I/O */ { message m_iop; - m_iop.IO_ENDPT = proc_ep; + m_iop.IOP_ENDPT = proc_ep; return _kernel_call(SYS_IOPENABLE, &m_iop); } diff --git a/servers/ext2/device.c b/servers/ext2/device.c index 9bb601941..d29d39331 100644 --- a/servers/ext2/device.c +++ b/servers/ext2/device.c @@ -185,13 +185,13 @@ PUBLIC int block_dev_io( } /* By default, these are right. */ - m.IO_ENDPT = proc_e; + m.USER_ENDPT = proc_e; m.ADDRESS = buffer; buf_used = buffer; /* Convert parameters to 'safe mode'. */ op_used = op; - safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.IO_ENDPT, + safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.USER_ENDPT, &buf_used, &vec_grants, bytes); /* Set up rest of the message. */ @@ -303,7 +303,7 @@ PRIVATE int gen_opcl( dev_mess.m_type = op; dev_mess.DEVICE = minor(dev); - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.COUNT = flags; /* Call the task. */ @@ -327,7 +327,7 @@ PRIVATE int gen_io( int r, proc_e; - proc_e = mess_ptr->IO_ENDPT; + proc_e = mess_ptr->USER_ENDPT; r = sendrec(task_nr, mess_ptr); if(r == OK && mess_ptr->REP_STATUS == ERESTART) diff --git a/servers/inet/mnx_eth.c b/servers/inet/mnx_eth.c index 18bf6b152..5c04a6588 100644 --- a/servers/inet/mnx_eth.c +++ b/servers/inet/mnx_eth.c @@ -543,7 +543,7 @@ eth_port_t *eth_port; errno)); } m.m_type= DL_WRITEV_S; - m.DL_ENDPT= this_proc; + m.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */ m.DL_COUNT= i; m.DL_GRANT= eth_port->etp_osdep.etp_wr_vec_grant; @@ -710,7 +710,7 @@ eth_port_t *eth_port; } mess.m_type= DL_READV_S; - mess.DL_ENDPT= this_proc; + mess.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */ mess.DL_COUNT= i; mess.DL_GRANT= eth_port->etp_osdep.etp_rd_vec_grant; @@ -822,7 +822,7 @@ eth_port_t *eth_port; message mess; mess.m_type= DL_GETSTAT_S; - mess.DL_ENDPT= this_proc; + mess.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */ mess.DL_GRANT= eth_port->etp_osdep.etp_stat_gid; assert(eth_port->etp_osdep.etp_state == OEPS_IDLE); diff --git a/servers/inet/sr.c b/servers/inet/sr.c index f6d147f25..7f1962983 100644 --- a/servers/inet/sr.c +++ b/servers/inet/sr.c @@ -7,14 +7,14 @@ * * Requests: * - * m_type DEVICE IO_ENDPT COUNT + * m_type DEVICE USER_ENDPT COUNT * -------------------------------------------------- * | DEV_OPEN | minor dev | proc nr | mode | * |-------------+-----------+-----------+----------+ * | DEV_CLOSE | minor dev | proc nr | | * |-------------+-----------+-----------+----------+ * - * m_type DEVICE IO_ENDPT COUNT IO_GRANT + * m_type DEVICE USER_ENDPT COUNT IO_GRANT * --------------------------------------------------------------- * | DEV_READ_S | minor dev | proc nr | count | grant ID | * |-------------+-----------+-----------+-----------+-----------| @@ -30,7 +30,7 @@ * | DEV_STATUS | * |-------------| * - * m_type DEVICE IO_ENDPT COUNT + * m_type DEVICE USER_ENDPT COUNT * --------------------------------------------------| * | CANCEL | minor dev | proc nr | mode | * |-------------+-----------+-----------+-----------| @@ -124,7 +124,7 @@ mq_t *m; { if (m->mq_mess.m_type == CANCEL) { - result= sr_repl_queue(m->mq_mess.IO_ENDPT, + result= sr_repl_queue(m->mq_mess.USER_ENDPT, (int)m->mq_mess.IO_GRANT, 0); if (result) @@ -461,7 +461,7 @@ message *m; int proc_nr, ref; result=EINTR; - proc_nr= m->IO_ENDPT; + proc_nr= m->USER_ENDPT; ref= (int)m->IO_GRANT; sr_fd= sr_getchannel(m->DEVICE); assert (sr_fd); @@ -487,7 +487,7 @@ message *m; ip_panic(( "request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d", m->m_source, m->m_type, m->DEVICE, - m->IO_ENDPT, (int) m->IO_GRANT)); + m->USER_ENDPT, (int) m->IO_GRANT)); return result; } @@ -504,7 +504,7 @@ message *m; sr_fd->srf_select_proc= m->m_source; - m_ops= m->IO_ENDPT; + m_ops= m->USER_ENDPT; i_ops= 0; if (m_ops & SEL_RD) i_ops |= SR_SELECT_READ; if (m_ops & SEL_WR) i_ops |= SR_SELECT_WRITE; @@ -597,7 +597,7 @@ int first_flag; for(q_ptr_prv= NULL, q_ptr= *q_head_ptr; q_ptr; q_ptr_prv= q_ptr, q_ptr= q_ptr->mq_next) { - if (q_ptr->mq_mess.IO_ENDPT != proc_nr) + if (q_ptr->mq_mess.USER_ENDPT != proc_nr) continue; if ((int)q_ptr->mq_mess.IO_GRANT != ref) continue; @@ -650,7 +650,7 @@ int is_revive; int result, proc, ref; message reply, *mp; - proc= mq->mq_mess.IO_ENDPT; + proc= mq->mq_mess.USER_ENDPT; ref= (int)mq->mq_mess.IO_GRANT; if (is_revive) @@ -744,7 +744,7 @@ int for_ioctl; return NULL; } - result= cp_u2b ((*head_ptr)->mq_mess.IO_ENDPT, + result= cp_u2b ((*head_ptr)->mq_mess.m_source, (int)(*head_ptr)->mq_mess.IO_GRANT, offset, &acc, count); return result<0 ? NULL : acc; @@ -805,7 +805,7 @@ int for_ioctl; return OK; } - return cp_b2u (data, (*head_ptr)->mq_mess.IO_ENDPT, + return cp_b2u (data, (*head_ptr)->mq_mess.m_source, (int)(*head_ptr)->mq_mess.IO_GRANT, offset); } diff --git a/servers/iso9660fs/device.c b/servers/iso9660fs/device.c index c35fc6e42..c09e624e6 100644 --- a/servers/iso9660fs/device.c +++ b/servers/iso9660fs/device.c @@ -193,14 +193,14 @@ PUBLIC int block_dev_io( } /* By default, these are right. */ - m.IO_ENDPT = proc_e; + m.USER_ENDPT = proc_e; m.ADDRESS = buf; buf_used = buf; /* Convert parameters to 'safe mode'. */ op_used = op; safe = safe_io_conversion(driver_e, &gid, - &op_used, gids, NR_IOREQS, &m.IO_ENDPT, &buf_used, + &op_used, gids, NR_IOREQS, &m.USER_ENDPT, &buf_used, &vec_grants, bytes); /* Set up rest of the message. */ @@ -273,7 +273,7 @@ PRIVATE int gen_opcl( dev_mess.m_type = op; dev_mess.DEVICE = (dev >> MINOR) & BYTE; - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.COUNT = flags; /* Call the task. */ @@ -296,7 +296,7 @@ message *mess_ptr; /* pointer to message for task */ int r, proc_e; - proc_e = mess_ptr->IO_ENDPT; + proc_e = mess_ptr->USER_ENDPT; r = sendrec(task_nr, mess_ptr); if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADEPT; diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index fb3657d1c..0fd000026 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -147,7 +147,7 @@ static void driver_setup_read(struct nic * nic) nic->rx_iovec[0].iov_size = nic->rx_pbuf->len; m.m_type = DL_READV_S; - m.DL_ENDPT = lwip_ep; + m.DL_ENDPT_LEGACY = lwip_ep; /* FIXME: legacy support */ m.DL_COUNT = 1; m.DL_GRANT = nic->rx_iogrant; @@ -209,7 +209,7 @@ int driver_tx(struct nic * nic) panic("Failed to set grant"); m.m_type = DL_WRITEV_S; - m.DL_ENDPT = lwip_ep; + m.DL_ENDPT_LEGACY = lwip_ep; /* FIXME: legacy support */ m.DL_COUNT = 1; m.DL_GRANT = nic->tx_iogrant; @@ -274,7 +274,7 @@ static int raw_receive(message * m, size_t cp_len; cp_len = (rem_len < p->len) ? rem_len : p->len; - err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, + err = copy_to_user(m->m_source, p->payload, cp_len, (cp_grant_id_t) m->IO_GRANT, written); @@ -468,7 +468,7 @@ static void nic_ioctl_set_conf(__unused struct socket * sock, nwio_ipconf_t ipconf; int err; - err = copy_from_user(m->IO_ENDPT, &ipconf, sizeof(ipconf), + err = copy_from_user(m->m_source, &ipconf, sizeof(ipconf), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) send_reply(m, err); @@ -498,7 +498,7 @@ static void nic_ioctl_get_conf(__unused struct socket * sock, ipconf.nwic_netmask = nic->netif.netmask.addr; ipconf.nwic_mtu = nic->netif.mtu; - err = copy_to_user(m->IO_ENDPT, &ipconf, sizeof(ipconf), + err = copy_to_user(m->m_source, &ipconf, sizeof(ipconf), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) send_reply(m, err); @@ -513,7 +513,7 @@ static void nic_ioctl_set_gateway(__unused struct socket * sock, nwio_route_t route; int err; - err = copy_from_user(m->IO_ENDPT, &route, sizeof(route), + err = copy_from_user(m->m_source, &route, sizeof(route), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) send_reply(m, err); @@ -546,7 +546,7 @@ static void nic_ioctl_get_ethstat(__unused struct socket * sock, memset(ðstat, 0, sizeof(ethstat)); memcpy(ðstat.nwes_addr, nic->netif.hwaddr, 6); - err = copy_to_user(m->IO_ENDPT, ðstat, sizeof(ethstat), + err = copy_to_user(m->m_source, ðstat, sizeof(ethstat), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) send_reply(m, err); @@ -580,7 +580,7 @@ static void nic_ioctl_set_ethopt(struct socket * sock, return; } - err = copy_from_user(m->IO_ENDPT, ðopt, sizeof(ethopt), + err = copy_from_user(m->m_source, ðopt, sizeof(ethopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) send_reply(m, err); @@ -697,7 +697,7 @@ static void nic_op_write(struct socket * sock, message * m) goto write_err; } - if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, + if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT, (cp_grant_id_t) m->IO_GRANT, 0)) != OK) { pbuf_free(pbuf); goto write_err; diff --git a/servers/lwip/raw_ip.c b/servers/lwip/raw_ip.c index 16c7c7f28..36efdcf4c 100644 --- a/servers/lwip/raw_ip.c +++ b/servers/lwip/raw_ip.c @@ -79,7 +79,7 @@ static int raw_ip_do_receive(message * m, size_t cp_len; cp_len = (rem_len < p->len) ? rem_len : p->len; - err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, + err = copy_to_user(m->m_source, p->payload, cp_len, (cp_grant_id_t) m->IO_GRANT, hdr_sz + written); @@ -231,7 +231,7 @@ static void raw_ip_op_write(struct socket * sock, message * m) goto write_err; } - if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, + if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT, (cp_grant_id_t) m->IO_GRANT, 0)) != OK) { pbuf_free(pbuf); goto write_err; @@ -264,7 +264,7 @@ static void raw_ip_set_opt(struct socket * sock, message * m) nwio_ipopt_t ipopt; struct raw_pcb * pcb; - err = copy_from_user(m->IO_ENDPT, &ipopt, sizeof(ipopt), + err = copy_from_user(m->m_source, &ipopt, sizeof(ipopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -323,7 +323,7 @@ static void raw_ip_get_opt(struct socket * sock, message * m) return; } - err = copy_to_user(m->IO_ENDPT, &ipopt, sizeof(ipopt), + err = copy_to_user(m->m_source, &ipopt, sizeof(ipopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) diff --git a/servers/lwip/socket.c b/servers/lwip/socket.c index de673999b..373a88b57 100644 --- a/servers/lwip/socket.c +++ b/servers/lwip/socket.c @@ -114,7 +114,7 @@ static int mq_cancel(message * m) for (mq = mq_tail; mq; mq = mq->prev) { if (m->DEVICE == mq->m.DEVICE && - m->IO_ENDPT == mq->m.IO_ENDPT && + m->USER_ENDPT == mq->m.USER_ENDPT && m->IO_GRANT == mq->m.IO_GRANT) { debug_sock_print("socket %d\n", mq->m.DEVICE); break; @@ -181,7 +181,7 @@ static void set_reply_msg(message * m, int status) { int proc, ref; - proc= m->IO_ENDPT; + proc= m->USER_ENDPT; ref= (int)m->IO_GRANT; m->REP_ENDPT= proc; @@ -591,9 +591,9 @@ void generic_op_select(struct socket * sock, message * m) { int retsel = 0, sel; - debug_print("socket num %ld 0x%x", get_sock_num(sock), m->IO_ENDPT); + debug_print("socket num %ld 0x%x", get_sock_num(sock), m->USER_ENDPT); - sel = m->IO_ENDPT; + sel = m->USER_ENDPT; /* in this case any operation would block, no error */ if (sock->flags & SOCK_FLG_OP_PENDING) { diff --git a/servers/lwip/tcp.c b/servers/lwip/tcp.c index 5cc7a8b25..78e3c4225 100644 --- a/servers/lwip/tcp.c +++ b/servers/lwip/tcp.c @@ -218,7 +218,7 @@ static int read_from_tcp(struct socket * sock, message * m) #if 0 print_tcp_payload(p->payload, p->len); #endif - err = copy_to_user(m->IO_ENDPT, p->payload, p->len, + err = copy_to_user(m->m_source, p->payload, p->len, (cp_grant_id_t) m->IO_GRANT, written); if (err != OK) goto cp_error; @@ -259,7 +259,7 @@ static int read_from_tcp(struct socket * sock, message * m) #if 0 print_tcp_payload(p->payload, rem_buf); #endif - err = copy_to_user(m->IO_ENDPT, p->payload, rem_buf, + err = copy_to_user(m->m_source, p->payload, rem_buf, (cp_grant_id_t) m->IO_GRANT, written); if (err != OK) goto cp_error; @@ -308,7 +308,7 @@ static void tcp_op_read(struct socket * sock, message * m) } else { if (sock->flags & SOCK_FLG_CLOSED) { printf("socket %ld already closed!!! call from %d\n", - get_sock_num(sock), m->IO_ENDPT); + get_sock_num(sock), m->USER_ENDPT); do_tcp_debug = 1; sock_reply(sock, 0); return; @@ -423,7 +423,7 @@ static void tcp_op_write(struct socket * sock, message * m) sock_reply(sock, ENOMEM); } - if ((ret = copy_from_user(m->IO_ENDPT, wbuf->data, usr_buf_len, + if ((ret = copy_from_user(m->m_source, wbuf->data, usr_buf_len, (cp_grant_id_t) m->IO_GRANT, 0)) != OK) { sock_reply(sock, ret); return; @@ -508,7 +508,7 @@ static void tcp_set_conf(struct socket * sock, message * m) assert(pcb); - err = copy_from_user(m->IO_ENDPT, &tconf, sizeof(tconf), + err = copy_from_user(m->m_source, &tconf, sizeof(tconf), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -569,7 +569,7 @@ static void tcp_get_conf(struct socket * sock, message * m) return; } - err = copy_to_user(m->IO_ENDPT, &tconf, sizeof(tconf), + err = copy_to_user(m->m_source, &tconf, sizeof(tconf), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -835,7 +835,7 @@ static int tcp_do_accept(struct socket * listen_sock, debug_tcp_print("socket num %ld", get_sock_num(listen_sock)); - if ((ret = copy_from_user(m->IO_ENDPT, &sock_num, sizeof(sock_num), + if ((ret = copy_from_user(m->m_source, &sock_num, sizeof(sock_num), (cp_grant_id_t) m->IO_GRANT, 0)) != OK) return EFAULT; if (!is_valid_sock_num(sock_num)) @@ -903,7 +903,7 @@ static void tcp_op_listen(struct socket * sock, message * m) debug_tcp_print("socket num %ld", get_sock_num(sock)); - err = copy_from_user(m->IO_ENDPT, &backlog, sizeof(backlog), + err = copy_from_user(m->m_source, &backlog, sizeof(backlog), (cp_grant_id_t) m->IO_GRANT, 0); new_pcb = tcp_listen_with_backlog((struct tcp_pcb *) sock->pcb, @@ -985,7 +985,7 @@ static void tcp_op_get_cookie(struct socket * sock, message * m) sock_num = get_sock_num(sock); memcpy(&cookie, &sock_num, sizeof(sock_num)); - if (copy_to_user(m->IO_ENDPT, &cookie, sizeof(sock), + if (copy_to_user(m->m_source, &cookie, sizeof(sock), (cp_grant_id_t) m->IO_GRANT, 0) == OK) sock_reply(sock, OK); else @@ -1010,7 +1010,7 @@ static void tcp_get_opt(struct socket * sock, message * m) /* FIXME : not used by the userspace library */ tcpopt.nwto_flags = 0; - err = copy_to_user(m->IO_ENDPT, &tcpopt, sizeof(tcpopt), + err = copy_to_user(m->m_source, &tcpopt, sizeof(tcpopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -1029,7 +1029,7 @@ static void tcp_set_opt(struct socket * sock, message * m) assert(pcb); - err = copy_from_user(m->IO_ENDPT, &tcpopt, sizeof(tcpopt), + err = copy_from_user(m->m_source, &tcpopt, sizeof(tcpopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -1091,7 +1091,7 @@ static void tcp_op_select(struct socket * sock, __unused message * m) { int retsel = 0, sel; - sel = m->IO_ENDPT; + sel = m->USER_ENDPT; debug_tcp_print("socket num %ld 0x%x", get_sock_num(sock), sel); /* in this case any operation would block, no error */ diff --git a/servers/lwip/udp.c b/servers/lwip/udp.c index 912e368d1..606e62a2f 100644 --- a/servers/lwip/udp.c +++ b/servers/lwip/udp.c @@ -101,7 +101,7 @@ static int udp_do_receive(struct socket * sock, hdr.uih_data_len = 0; hdr.uih_ip_opt_len = 0; - err = copy_to_user(m->IO_ENDPT, + err = copy_to_user(m->m_source, &hdr, sizeof(hdr), (cp_grant_id_t) m->IO_GRANT, 0); @@ -116,7 +116,7 @@ static int udp_do_receive(struct socket * sock, size_t cp_len; cp_len = (rem_len < p->len) ? rem_len : p->len; - err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, + err = copy_to_user(m->m_source, p->payload, cp_len, (cp_grant_id_t) m->IO_GRANT, hdr_sz + written); @@ -276,7 +276,7 @@ static void udp_op_write(struct socket * sock, message * m) goto write_err; } - if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, + if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT, (cp_grant_id_t) m->IO_GRANT, 0)) != OK) { pbuf_free(pbuf); goto write_err; @@ -304,7 +304,7 @@ static void udp_set_opt(struct socket * sock, message * m) assert(pcb); - err = copy_from_user(m->IO_ENDPT, &udpopt, sizeof(udpopt), + err = copy_from_user(m->m_source, &udpopt, sizeof(udpopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) @@ -376,7 +376,7 @@ static void udp_get_opt(struct socket * sock, message * m) return; } - err = copy_to_user(m->IO_ENDPT, &udpopt, sizeof(udpopt), + err = copy_to_user(m->m_source, &udpopt, sizeof(udpopt), (cp_grant_id_t) m->IO_GRANT, 0); if (err != OK) diff --git a/servers/mfs/device.c b/servers/mfs/device.c index 5c38db7b0..cf56c10b0 100644 --- a/servers/mfs/device.c +++ b/servers/mfs/device.c @@ -185,13 +185,13 @@ PUBLIC int block_dev_io( } /* By default, these are right. */ - m.IO_ENDPT = proc_e; + m.USER_ENDPT = proc_e; m.ADDRESS = buffer; buf_used = buffer; /* Convert parameters to 'safe mode'. */ op_used = op; - safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.IO_ENDPT, + safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.USER_ENDPT, &buf_used, &vec_grants, bytes); /* Set up rest of the message. */ @@ -303,7 +303,7 @@ PRIVATE int gen_opcl( dev_mess.m_type = op; dev_mess.DEVICE = minor(dev); - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.COUNT = flags; /* Call the task. */ @@ -327,7 +327,7 @@ PRIVATE int gen_io( int r, proc_e; - proc_e = mess_ptr->IO_ENDPT; + proc_e = mess_ptr->USER_ENDPT; r = sendrec(task_nr, mess_ptr); if(r == OK && mess_ptr->REP_STATUS == ERESTART) diff --git a/servers/pfs/dev_uds.c b/servers/pfs/dev_uds.c index fb00ff3c0..3d6e73241 100644 --- a/servers/pfs/dev_uds.c +++ b/servers/pfs/dev_uds.c @@ -48,7 +48,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_open() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); + printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT); #endif /* @@ -71,7 +71,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) if (minor == -1) { /* descriptor table full */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, ENFILE); return ENFILE; } @@ -91,8 +91,8 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) uds_fd_table[minor].syscall_done = 0; /* set the socket owner */ - uds_fd_table[minor].owner = dev_m_in->IO_ENDPT; - uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; + uds_fd_table[minor].owner = dev_m_in->USER_ENDPT; + uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT; /* setup select(2) framework */ uds_fd_table[minor].selecting = 0; @@ -168,7 +168,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t)); /* likely error: invalid endpoint / proc doesn't exist */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, errno); return errno; } @@ -189,7 +189,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t)); /* likely error: get_block() failed */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, rc); return rc; } @@ -201,7 +201,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out) /* prepare the reply */ uds_fd_table[minor].syscall_done = 1; - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, minor); return minor; } @@ -216,7 +216,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_close() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); + printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT); #endif minor = uds_minor(dev_m_in); @@ -225,7 +225,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; } @@ -276,7 +276,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out) return rc; } - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, OK); return OK; } @@ -290,7 +290,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_select() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); + printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT); #endif minor = uds_minor(dev_m_in); @@ -300,7 +300,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; @@ -317,7 +317,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out) /* Can't update the process endpoint here, no info. */ - uds_fd_table[minor].sel_ops_in = dev_m_in->IO_ENDPT; + uds_fd_table[minor].sel_ops_in = dev_m_in->USER_ENDPT; uds_fd_table[minor].sel_ops_out = 0; /* check if there is data available to read */ @@ -346,7 +346,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out) uds_fd_table[minor].syscall_done = 1; - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, uds_fd_table[minor].sel_ops_out); @@ -663,7 +663,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_read() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, + printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT, dev_m_in->POSITION); #endif @@ -674,7 +674,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; @@ -686,7 +686,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out) uds_fd_table[minor].syscall_done = 0; /* Update the process endpoint. */ - uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; + uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT; /* setup select(2) framework */ uds_fd_table[minor].selecting = 0; @@ -715,7 +715,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_write() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, + printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT, dev_m_in->POSITION); #endif @@ -726,7 +726,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; @@ -738,7 +738,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out) uds_fd_table[minor].syscall_done = 0; /* Update the process endpoint. */ - uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; + uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT; /* setup select(2) framework */ uds_fd_table[minor].selecting = 0; @@ -766,7 +766,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_ioctl() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, + printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT, dev_m_in->POSITION); #endif @@ -777,7 +777,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; @@ -950,7 +950,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out) if (rc != SUSPEND) uds_fd_table[minor].syscall_done = 1; - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, rc); return rc; @@ -964,7 +964,7 @@ PUBLIC int uds_status(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_status() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, dev_m_in->POSITION); + printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT, dev_m_in->POSITION); #endif for (i = 0; i < NR_FDS; i++) { @@ -1085,7 +1085,7 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out) static int call_count = 0; printf("(uds) [%d] uds_cancel() call_count=%d\n", uds_minor(dev_m_in), ++call_count); - printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); + printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT); #endif minor = uds_minor(dev_m_in); @@ -1095,14 +1095,14 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out) /* attempted to close a socket that hasn't been opened -- * something is very wrong :( */ - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); return EINVAL; } /* Update the process endpoint. */ - uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; + uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT; /* setup select(2) framework */ uds_fd_table[minor].selecting = 0; @@ -1202,7 +1202,7 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out) } - uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, + uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT, (cp_grant_id_t) dev_m_in->IO_GRANT, EINTR); return EINTR; diff --git a/servers/pfs/uds.c b/servers/pfs/uds.c index a0b23e906..a5fb519fd 100644 --- a/servers/pfs/uds.c +++ b/servers/pfs/uds.c @@ -67,7 +67,7 @@ PRIVATE int check_perms(int minor, struct sockaddr_un *addr) memset(&vfs_m, '\0', sizeof(message)); vfs_m.m_type = PFS_REQ_CHECK_PERMS; - vfs_m.IO_ENDPT = uds_fd_table[minor].owner; + vfs_m.USER_ENDPT = uds_fd_table[minor].owner; vfs_m.IO_GRANT = (char *) grant_id; vfs_m.COUNT = UNIX_PATH_MAX; @@ -102,7 +102,7 @@ PRIVATE filp_id_t verify_fd(endpoint_t ep, int fd) memset(&vfs_m, '\0', sizeof(message)); vfs_m.m_type = PFS_REQ_VERIFY_FD; - vfs_m.IO_ENDPT = ep; + vfs_m.USER_ENDPT = ep; vfs_m.COUNT = fd; rc = sendrec(VFS_PROC_NR, &vfs_m); @@ -161,7 +161,7 @@ PRIVATE int copy_filp(endpoint_t to_ep, filp_id_t cfilp) memset(&vfs_m, '\0', sizeof(message)); vfs_m.m_type = PFS_REQ_COPY_FILP; - vfs_m.IO_ENDPT = to_ep; + vfs_m.USER_ENDPT = to_ep; vfs_m.ADDRESS = cfilp; rc = sendrec(VFS_PROC_NR, &vfs_m); @@ -218,7 +218,7 @@ PRIVATE int cancel_fd(endpoint_t ep, int fd) memset(&vfs_m, '\0', sizeof(message)); vfs_m.m_type = PFS_REQ_CANCEL_FD; - vfs_m.IO_ENDPT = ep; + vfs_m.USER_ENDPT = ep; vfs_m.COUNT = fd; rc = sendrec(VFS_PROC_NR, &vfs_m); diff --git a/servers/vfs/device.c b/servers/vfs/device.c index 3ca5d3c19..3bd48eacd 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -377,13 +377,13 @@ PUBLIC int dev_io( } /* By default, these are right. */ - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.ADDRESS = buf; /* Convert DEV_* to DEV_*_S variants. */ buf_used = buf; safe = safe_io_conversion(dp->dmap_driver, &gid, &op, gids, NR_IOREQS, - (endpoint_t*) &dev_mess.IO_ENDPT, &buf_used, + (endpoint_t*) &dev_mess.USER_ENDPT, &buf_used, &vec_grants, bytes, &pos_lo); if(buf != buf_used) @@ -402,7 +402,7 @@ PUBLIC int dev_io( dev_mess.HIGHPOS = pos_high; /* This will be used if the i/o is suspended. */ - ioproc = dev_mess.IO_ENDPT; + ioproc = dev_mess.USER_ENDPT; /* Call the task. */ (*dp->dmap_io)(dp->dmap_driver, &dev_mess); @@ -424,7 +424,7 @@ PUBLIC int dev_io( if ((flags & O_NONBLOCK) && !(dp->dmap_style == STYLE_DEVA)) { /* Not supposed to block. */ dev_mess.m_type = CANCEL; - dev_mess.IO_ENDPT = ioproc; + dev_mess.USER_ENDPT = ioproc; dev_mess.IO_GRANT = (char *) gid; /* This R_BIT/W_BIT check taken from suspend()/unpause() @@ -449,7 +449,7 @@ PUBLIC int dev_io( if (flags & O_NONBLOCK) { /* Not supposed to block, send cancel message */ dev_mess.m_type = CANCEL; - dev_mess.IO_ENDPT = ioproc; + dev_mess.USER_ENDPT = ioproc; dev_mess.IO_GRANT = (char *) gid; /* This R_BIT/W_BIT check taken from suspend()/unpause() @@ -493,7 +493,7 @@ PUBLIC int gen_opcl( dev_mess.m_type = op; dev_mess.DEVICE = (dev >> MINOR) & BYTE; - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.COUNT = flags; if (dp->dmap_driver == NONE) { @@ -626,7 +626,7 @@ message *mess_ptr; /* pointer to message for task */ printf("VFS: sending %d to SYSTEM\n", mess_ptr->m_type); } - proc_e = mess_ptr->IO_ENDPT; + proc_e = mess_ptr->USER_ENDPT; for (;;) { @@ -780,7 +780,7 @@ PUBLIC int clone_opcl( dev_mess.m_type = op; dev_mess.DEVICE = minor; - dev_mess.IO_ENDPT = proc_e; + dev_mess.USER_ENDPT = proc_e; dev_mess.COUNT = flags; diff --git a/servers/vfs/filedes.c b/servers/vfs/filedes.c index 40ffb8593..dbae45682 100644 --- a/servers/vfs/filedes.c +++ b/servers/vfs/filedes.c @@ -174,7 +174,7 @@ int fd; *===========================================================================*/ PUBLIC int do_verify_fd(void) { - m_out.ADDRESS = (void *) verify_fd(m_in.IO_ENDPT, m_in.COUNT); + m_out.ADDRESS = (void *) verify_fd(m_in.USER_ENDPT, m_in.COUNT); return (m_out.ADDRESS != NULL) ? OK : EINVAL; } @@ -236,7 +236,7 @@ filp_id_t cfilp; *===========================================================================*/ PUBLIC int do_copy_filp(void) { - return copy_filp(m_in.IO_ENDPT, (filp_id_t) m_in.ADDRESS); + return copy_filp(m_in.USER_ENDPT, (filp_id_t) m_in.ADDRESS); } /*===========================================================================* @@ -294,7 +294,7 @@ int fd; *===========================================================================*/ PUBLIC int do_cancel_fd(void) { - return cancel_fd(m_in.IO_ENDPT, m_in.COUNT); + return cancel_fd(m_in.USER_ENDPT, m_in.COUNT); } /*===========================================================================* diff --git a/servers/vfs/path.c b/servers/vfs/path.c index 3e8fc47db..c0ddceb44 100644 --- a/servers/vfs/path.c +++ b/servers/vfs/path.c @@ -533,5 +533,6 @@ int pathlen; *===========================================================================*/ PUBLIC int do_check_perms(void) { - return check_perms(m_in.IO_ENDPT, (cp_grant_id_t) m_in.IO_GRANT, m_in.COUNT); + return check_perms(m_in.USER_ENDPT, (cp_grant_id_t) m_in.IO_GRANT, + m_in.COUNT); } diff --git a/servers/vfs/pipe.c b/servers/vfs/pipe.c index a46f7b3f6..1491342a4 100644 --- a/servers/vfs/pipe.c +++ b/servers/vfs/pipe.c @@ -538,7 +538,7 @@ int proc_nr_e; f = rfp->fp_filp[fild]; dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */ mess.TTY_LINE = (dev >> MINOR) & BYTE; - mess.IO_ENDPT = rfp->fp_ioproc; + mess.USER_ENDPT = rfp->fp_ioproc; mess.IO_GRANT = (char *) rfp->fp_grant; /* Tell kernel R or W. Mode is from current call, not open. */