drop segment from safecopy invocations

. all invocations were S or D, so can safely be dropped
	  to prepare for the segmentless world
	. still assign D to the SCP_SEG field in the message
	  to make previous kernels usable
This commit is contained in:
Ben Gras 2012-06-16 03:46:15 +02:00
parent 85ff5a947e
commit 2bfeeed885
87 changed files with 293 additions and 297 deletions

View file

@ -2563,7 +2563,7 @@ static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
case DIOCOPENCT:
return sys_safecopyto(endpt, grant, 0,
(vir_bytes) &ps->open_count, sizeof(ps->open_count), D);
(vir_bytes) &ps->open_count, sizeof(ps->open_count));
case DIOCFLUSH:
if (ps->state != STATE_GOOD_DEV || (ps->flags & FLAG_BARRIER))
@ -2576,7 +2576,7 @@ static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
return EIO;
if ((r = sys_safecopyfrom(endpt, grant, 0, (vir_bytes) &val,
sizeof(val), D)) != OK)
sizeof(val))) != OK)
return r;
return gen_set_wcache(ps, val);
@ -2589,7 +2589,7 @@ static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
return r;
return sys_safecopyto(endpt, grant, 0, (vir_bytes) &val,
sizeof(val), D);
sizeof(val));
}
return EINVAL;

View file

@ -2213,7 +2213,7 @@ static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
switch (request) {
case DIOCTIMEOUT:
r= sys_safecopyfrom(endpt, grant, 0, (vir_bytes)&timeout,
sizeof(timeout), D);
sizeof(timeout));
if(r != OK)
return r;
@ -2244,7 +2244,7 @@ static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
}
r= sys_safecopyto(endpt, grant, 0, (vir_bytes)&prev,
sizeof(prev), D);
sizeof(prev));
if(r != OK)
return r;
@ -2256,7 +2256,7 @@ static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
if (w_prepare(minor) == NULL) return ENXIO;
count = w_wn->open_ct;
r= sys_safecopyto(endpt, grant, 0, (vir_bytes)&count,
sizeof(count), D);
sizeof(count));
if(r != OK)
return r;

View file

@ -777,7 +777,7 @@ static void atl2_readv(const message *m, int from_int)
batch = MIN(m->DL_COUNT - i, NR_IOREQS);
r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D);
(vir_bytes) iovec, batch * sizeof(iovec[0]));
if (r != OK)
panic("vector copy failed: %d", r);
@ -786,7 +786,7 @@ static void atl2_readv(const message *m, int from_int)
size = MIN(iovp->iov_size, left);
r = sys_safecopyto(m->m_source, iovp->iov_grant, 0,
(vir_bytes) pos, size, D);
(vir_bytes) pos, size);
if (r != OK)
panic("safe copy failed: %d", r);
@ -874,7 +874,7 @@ static void atl2_writev(const message *m, int from_int)
batch = MIN(m->DL_COUNT - i, NR_IOREQS);
r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D);
(vir_bytes) iovec, batch * sizeof(iovec[0]));
if (r != OK)
panic("vector copy failed: %d", r);
@ -890,7 +890,7 @@ static void atl2_writev(const message *m, int from_int)
r = sys_safecopyfrom(m->m_source,
iovp->iov_grant, 0,
(vir_bytes) (state.txd_base + pos),
skip, D);
skip);
if (r != OK)
panic("safe copy failed: %d", r);
pos = 0;
@ -898,7 +898,7 @@ static void atl2_writev(const message *m, int from_int)
r = sys_safecopyfrom(m->m_source, iovp->iov_grant,
skip, (vir_bytes) (state.txd_base + pos),
size - skip, D);
size - skip);
if (r != OK)
panic("safe copy failed: %d", r);
@ -1051,7 +1051,7 @@ static void atl2_getstat(message *m)
int r;
sys_safecopyto(m->m_source, m->DL_GRANT, 0,
(vir_bytes) &state.stat, sizeof(state.stat), D);
(vir_bytes) &state.stat, sizeof(state.stat));
m->m_type = DL_STAT_REPLY;

View file

@ -178,7 +178,7 @@ static void do_get_stat_s(message * mp)
if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0UL,
(vir_bytes)&dep->de_stat,
sizeof(dep->de_stat), 0)) != OK)
sizeof(dep->de_stat))) != OK)
panic(str_CopyErrMsg, rc);
mp->m_type = DL_STAT_REPLY;
@ -511,7 +511,7 @@ static void do_vread_s(const message * mp, int from_int)
bytes = size;
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D);
(vir_bytes)buffer, bytes);
if (r != OK)
panic(str_CopyErrMsg, r);
buffer += bytes;
@ -776,7 +776,7 @@ static void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
vir_bytes len;
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D);
rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len);
if (rc != OK)
panic(str_CopyErrMsg, rc);
return;
@ -840,7 +840,7 @@ static void do_vwrite_s(const message * mp, int from_int){
bytes = size;
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D);
0, (vir_bytes)buffer, bytes);
if (r != OK)
panic(str_CopyErrMsg, r);
buffer += bytes;

View file

@ -1195,7 +1195,7 @@ vir_bytes count;
r= sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D);
vir_hw, bytes);
if (r != OK) {
panic("dp_user2nic_s: sys_safecopyfrom failed: %d", r);
}
@ -1320,7 +1320,7 @@ vir_bytes count;
if (odd_byte)
{
r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D);
(vir_bytes)&two_bytes[1], 1);
if (r != OK) {
panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
}
@ -1348,7 +1348,7 @@ vir_bytes count;
{
assert(bytes == 1);
r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[0], 1, D);
(vir_bytes)&two_bytes[0], 1);
if (r != OK) {
panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
}
@ -1411,7 +1411,7 @@ vir_bytes count;
r= sys_safecopyto(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D);
vir_hw, bytes);
if (r != OK)
panic("dp_nic2user_s: sys_safecopyto failed: %d", r);
@ -1521,7 +1521,7 @@ vir_bytes count;
if (odd_byte)
{
r= sys_safecopyto(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D);
(vir_bytes)&two_bytes[1], 1);
if (r != OK) {
panic("dp_pio16_nic2user: sys_safecopyto failed: %d", r);
}
@ -1550,7 +1550,7 @@ vir_bytes count;
assert(bytes == 1);
*(u16_t *)two_bytes= inw(dep->de_data_port);
r= sys_safecopyto(user_proc, gid, offset,
(vir_bytes)&two_bytes[0], 1, D);
(vir_bytes)&two_bytes[0], 1);
if (r != OK)
{
panic("dp_pio16_nic2user: sys_safecopyto failed: %d",
@ -1774,7 +1774,7 @@ void *loc_addr;
int r;
r= sys_safecopyfrom(user_proc, grant, offset,
(vir_bytes)loc_addr, count, D);
(vir_bytes)loc_addr, count);
if (r != OK)
panic("get_userdata: sys_safecopyfrom failed: %d", r);
}
@ -1791,7 +1791,7 @@ void *loc_addr;
int r;
r= sys_safecopyto(user_proc, grant, 0, (vir_bytes)loc_addr,
count, D);
count);
if (r != OK)
panic("put_userdata: sys_safecopyto failed: %d", r);
}

View file

@ -192,7 +192,7 @@ static void get_userdata_s(int user_proc, cp_grant_id_t grant,
vir_bytes len;
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D)) != OK)
if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len)) != OK)
panic(CopyErrMsg, rc);
return;
}
@ -432,7 +432,7 @@ static void do_getstat_s(const message * mp)
if (dep->de_mode == DEM_ENABLED) (*dep->de_getstatsf) (dep);
if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK)
(vir_bytes) sizeof(dep->de_stat))) != OK)
panic(CopyErrMsg, rc);
reply_mess.m_type = DL_STAT_REPLY;

View file

@ -119,7 +119,7 @@ void mem2user(dpeth_t *dep, buff_t *rxbuff)
/* Reads from Rx buffer to user area */
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D);
(vir_bytes)buffer, bytes);
if (r != OK)
panic("mem2user: sys_safecopyto failed: %d", r);
buffer += bytes;
@ -149,7 +149,7 @@ void user2mem(dpeth_t *dep, buff_t *txbuff)
bytes = iovp->iod_iovec[ix].iov_size; /* Size of buffer */
if (bytes > pktsize) bytes = pktsize;
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D);
0, (vir_bytes)buffer, bytes);
if (r != OK)
panic("user2mem: sys_safecopyfrom failed: %d", r);
buffer += bytes;

View file

@ -615,7 +615,7 @@ int from_int;
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)
sizeof(iovec_s_t))) != OK)
{
panic("sys_safecopyfrom() failed: %d", r);
}
@ -640,7 +640,7 @@ int from_int;
iovec[i].iov_grant, 0,
(vir_bytes) e->tx_buffer +
(tail * E1000_IOBUF_SIZE),
size, D)) != OK)
size)) != OK)
{
panic("sys_safecopyfrom() failed: %d", r);
}
@ -706,7 +706,7 @@ int from_int;
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)
sizeof(iovec_s_t))) != OK)
{
panic("sys_safecopyfrom() failed: %d", r);
}
@ -741,7 +741,7 @@ int from_int;
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)
size)) != OK)
{
panic("sys_safecopyto() failed: %d", r);
}
@ -791,7 +791,7 @@ message *mp;
stats.ets_OWC = 0;
sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D);
sizeof(stats));
mp->m_type = DL_STAT_REPLY;
if((r=send(mp->m_source, mp)) != OK)
panic("e1000_getstat: send() failed: %d", r);

View file

@ -33,8 +33,7 @@ int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
/* Copy in the rule. */
if ((r = sys_safecopyfrom(endpt, grant, 0,
(vir_bytes) &rules[i-1], sizeof(rules[0]),
D)) != OK)
(vir_bytes) &rules[i-1], sizeof(rules[0]))) != OK)
return r;
/* Mark the rule as active, and return its number. */
@ -45,7 +44,7 @@ int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
case FBDCDELRULE:
/* Copy in the given rule number. */
if ((r = sys_safecopyfrom(endpt, grant, 0, (vir_bytes) &i,
sizeof(i), D)) != OK)
sizeof(i))) != OK)
return r;
/* Fail if the given rule number is not valid or in use.
@ -64,7 +63,7 @@ int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
/* Copy in just the rule number from the given structure. */
if ((r = sys_safecopyfrom(endpt, grant,
offsetof(struct fbd_rule, num), (vir_bytes) &i,
sizeof(i), D)) != OK)
sizeof(i))) != OK)
return r;
/* Fail if the given rule number is not valid or in use.
@ -76,7 +75,7 @@ int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
/* Copy out the entire rule as is. */
return sys_safecopyto(endpt, grant, 0, (vir_bytes) &rules[i-1],
sizeof(rules[0]), D);
sizeof(rules[0]));
default:
return EINVAL;

View file

@ -87,10 +87,10 @@ static int carry(size_t size, int flag_rw)
if (flag_rw == FLT_WRITE)
return sys_safecopyfrom(who_e, grant_id, 0,
(vir_bytes) buffer, size, D);
(vir_bytes) buffer, size);
else
return sys_safecopyto(who_e, grant_id, 0,
(vir_bytes) buffer, size, D);
(vir_bytes) buffer, size);
}
/*===========================================================================*
@ -111,11 +111,11 @@ static int vcarry(int grants, iovec_t *iov, int flag_rw, size_t size)
if (flag_rw == FLT_WRITE)
r = sys_safecopyfrom(who_e,
(vir_bytes) iov[i].iov_addr, 0,
(vir_bytes) bufp, bytes, D);
(vir_bytes) bufp, bytes);
else
r = sys_safecopyto(who_e,
(vir_bytes) iov[i].iov_addr, 0,
(vir_bytes) bufp, bytes, D);
(vir_bytes) bufp, bytes);
if(r != OK)
return r;
@ -190,7 +190,7 @@ static int do_vrdwt(int flag_rw)
/* Extract informations. */
grants = m_in.BDEV_COUNT;
if((r = sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) iov_proc,
grants * sizeof(iovec_t), D)) != OK) {
grants * sizeof(iovec_t))) != OK) {
panic("copying in grant vector failed: %d", r);
}
@ -260,7 +260,7 @@ static int do_ioctl(message *m)
if(sys_safecopyto(who_e, (vir_bytes) grant_id, 0,
(vir_bytes) &sizepart,
sizeof(struct partition), D) != OK) {
sizeof(struct partition)) != OK) {
printf("Filter: DIOCGETP safecopyto failed\n");
return EIO;
}

View file

@ -513,7 +513,7 @@ static ssize_t f_transfer(
if(proc_nr != SELF) {
s=sys_safecopyfrom(proc_nr, iov->iov_addr,
SECTOR_SIZE + iov_offset, (vir_bytes) &fmt_param,
(phys_bytes) sizeof(fmt_param), D);
(phys_bytes) sizeof(fmt_param));
if(s != OK)
panic("sys_safecopyfrom failed: %d", s);
} else {
@ -618,7 +618,7 @@ static ssize_t f_transfer(
if(proc_nr != SELF) {
s=sys_safecopyfrom(proc_nr, *ug, *up,
(vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D);
(phys_bytes) SECTOR_SIZE);
if(s != OK)
panic("sys_safecopyfrom failed: %d", s);
} else {
@ -644,7 +644,7 @@ static ssize_t f_transfer(
if(proc_nr != SELF) {
s=sys_safecopyto(proc_nr, *ug, *up,
(vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D);
(phys_bytes) SECTOR_SIZE);
if(s != OK)
panic("sys_safecopyto failed: %d", s);
} else {

View file

@ -1012,7 +1012,7 @@ static void fxp_writev_s(const message *mp, int from_int)
n= count-i;
r= sys_safecopyfrom(iov_endpt, iov_grant, iov_offset,
(vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D);
n * sizeof(fp->fxp_iovec_s[0]));
if (r != OK)
panic("fxp_writev: sys_safecopyfrom failed: %d", r);
@ -1024,7 +1024,7 @@ static void fxp_writev_s(const message *mp, int from_int)
}
r= sys_safecopyfrom(iov_endpt, iovp->iov_grant,
0, (vir_bytes)(txp->tx_buf+o), s, D);
0, (vir_bytes)(txp->tx_buf+o), s);
if (r != OK) {
panic("fxp_writev_s: sys_safecopyfrom failed: %d", r);
}
@ -1147,7 +1147,7 @@ int from_int;
n= count-i;
r= sys_safecopyfrom(iov_endpt, iov_grant, iov_offset,
(vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D);
n * sizeof(fp->fxp_iovec_s[0]));
if (r != OK)
panic("fxp_readv_s: sys_safecopyfrom failed: %d", r);
@ -1161,7 +1161,7 @@ int from_int;
}
r= sys_safecopyto(iov_endpt, iovp->iov_grant,
0, (vir_bytes)(rfdp->rfd_buf+o), s, D);
0, (vir_bytes)(rfdp->rfd_buf+o), s);
if (r != OK)
{
panic("fxp_readv: sys_safecopyto failed: %d", r);
@ -1447,7 +1447,7 @@ static void fxp_getstat_s(message *mp)
stats.ets_OWC= fp->fxp_stat.sc_tx_latecol;
r= sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D);
sizeof(stats));
if (r != OK)
panic("fxp_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -87,7 +87,7 @@ static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
case DEV_GATHER_S:
ret = sys_safecopyto(endpt, (cp_grant_id_t) iov->iov_addr, 0,
(vir_bytes) (HELLO_MESSAGE + ex64lo(position)),
bytes, D);
bytes);
iov->iov_size -= bytes;
break;

View file

@ -1012,7 +1012,7 @@ static void do_vread_s(const message *mp)
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);
sizeof(iovec_s_t));
if (r != OK)
panic("do_vread_s: sys_safecopyfrom failed: %d", r);
ec->read_iovec.iod_iovec_s = count;
@ -1130,7 +1130,7 @@ int from_int;
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);
sizeof(iovec_s_t));
if (r != OK)
panic("do_vwrite_s: sys_safecopyfrom failed: %d", r);
ec->write_iovec.iod_iovec_s = count;
@ -1205,7 +1205,7 @@ vir_bytes count;
if ( (r=sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset,
nic_addr, bytes, D )) != OK )
nic_addr, bytes )) != OK )
panic("ec_user2nic: sys_safecopyfrom failed: %d", r);
count -= bytes;
@ -1245,7 +1245,7 @@ vir_bytes count;
if (bytes > count)
bytes = count;
if ( (r=sys_safecopyto( iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant,
offset, nic_addr, bytes, D )) != OK )
offset, nic_addr, bytes )) != OK )
panic("ec_nic2user: sys_safecopyto failed: %d", r);
count -= bytes;
@ -1295,7 +1295,7 @@ iovec_dat_t *iovp;
(vir_bytes)iovp->iod_iovec,
(iovp->iod_iovec_s > IOVEC_NR ?
IOVEC_NR : iovp->iod_iovec_s) *
sizeof(iovec_s_t), D);
sizeof(iovec_s_t));
if (r != OK)
panic("ec_next_iovec: sys_safecopyfrom failed: %d", r);
}
@ -1313,7 +1313,7 @@ message *mp;
ec= &ec_state;
r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D);
(vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat));
if (r != OK)
panic("do_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -159,7 +159,7 @@ subwrite(struct logdevice *log, int count, endpoint_t endpt,
}
else {
if((r=sys_safecopyfrom(endpt, grant, offset,
(vir_bytes)buf, count, D)) != OK)
(vir_bytes)buf, count)) != OK)
return r;
}
@ -263,7 +263,7 @@ subread(struct logdevice *log, int count, endpoint_t endpt,
buf = log->log_buffer + log->log_read;
if((r=sys_safecopyto(endpt, grant, offset,
(vir_bytes)buf, count, D)) != OK)
(vir_bytes)buf, count)) != OK)
return r;
LOGINC(log->log_read, count);

View file

@ -278,10 +278,10 @@ static int m_transfer(
if (position + count > dv_size) count = dv_size - position;
if (opcode == DEV_GATHER_S) { /* copy actual data */
r=sys_safecopyto(endpt, grant, vir_offset,
dev_vaddr + position, count, D);
dev_vaddr + position, count);
} else {
r=sys_safecopyfrom(endpt, grant, vir_offset,
dev_vaddr + position, count, D);
dev_vaddr + position, count);
}
if(r != OK) {
panic("I/O copy failed: %d", r);
@ -339,10 +339,10 @@ static int m_transfer(
if (opcode == DEV_GATHER_S) { /* copy data */
s=sys_safecopyto(endpt, grant,
vir_offset, (vir_bytes) vaddr+page_off, subcount, D);
vir_offset, (vir_bytes) vaddr+page_off, subcount);
} else {
s=sys_safecopyfrom(endpt, grant,
vir_offset, (vir_bytes) vaddr+page_off, subcount, D);
vir_offset, (vir_bytes) vaddr+page_off, subcount);
}
if(s != OK)
return s;
@ -358,7 +358,7 @@ static int m_transfer(
while (left > 0) {
chunk = (left > ZERO_BUF_SIZE) ? ZERO_BUF_SIZE : left;
s=sys_safecopyto(endpt, grant,
vir_offset+suboffset, (vir_bytes) dev_zero, chunk, D);
vir_offset+suboffset, (vir_bytes) dev_zero, chunk);
if(s != OK)
return s;
left -= chunk;
@ -480,10 +480,10 @@ static int m_block_transfer(
if (position + count > dv_size) count = dv_size - position;
if (!do_write) { /* copy actual data */
r=sys_safecopyto(endpt, grant, vir_offset,
dev_vaddr + position, count, D);
dev_vaddr + position, count);
} else {
r=sys_safecopyfrom(endpt, grant, vir_offset,
dev_vaddr + position, count, D);
dev_vaddr + position, count);
}
if(r != OK) {
panic("I/O copy failed: %d", r);
@ -582,7 +582,7 @@ static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
/* Get request structure */
s= sys_safecopyfrom(endpt, grant, 0, (vir_bytes)&ramdev_size,
sizeof(ramdev_size), D);
sizeof(ramdev_size));
if (s != OK)
return s;
if(m_vaddrs[minor] && !cmp64(dv->dv_size, cvul64(ramdev_size))) {

View file

@ -1210,7 +1210,7 @@ static void or_writev_s (message * mp, int from_int) {
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);
n * sizeof(orp->or_iovec_s[0]));
if (cps != OK)
printf("orinoco: sys_safecopyfrom failed: %d\n", cps);
@ -1221,7 +1221,7 @@ static void or_writev_s (message * mp, int from_int) {
}
cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) databuf + o, s, D);
0, (vir_bytes) databuf + o, s);
if (cps != OK)
printf("orinoco: sys_safecopyfrom failed:%d\n",
cps);
@ -1601,7 +1601,7 @@ static void or_readv_s (message * mp, int from_int)
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);
n * sizeof(orp->or_iovec_s[0]));
if (cps != OK)
panic("orinoco: warning: sys_safecopytp failed: %d", cps);
@ -1612,7 +1612,7 @@ static void or_readv_s (message * mp, int from_int)
s = length - size;
}
cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0,
(vir_bytes) databuf + o, s, D);
(vir_bytes) databuf + o, s);
if (cps != OK)
panic("orinoco: warning: sys_safecopy failed: %d", cps);
@ -1779,7 +1779,7 @@ static void or_getstat_s (message * mp) {
stats = orp->or_stat;
r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
(vir_bytes) &stats, sizeof(stats));
if(r != OK) {
panic("or_getstat_s: sys_safecopyto failed: %d", r);
}

View file

@ -247,7 +247,7 @@ message *mp;
if (len > name_len)
len= name_len;
r= sys_safecopyto(mp->m_source, name_gid, 0, (vir_bytes)name,
len, D);
len);
}
mp->m_type= r;
@ -283,7 +283,7 @@ message *mp;
if (len > name_len)
len= name_len;
r= sys_safecopyto(mp->m_source, gid, 0,
(vir_bytes)name, len, D);
(vir_bytes)name, len);
}
mp->m_type= r;
@ -322,7 +322,7 @@ message *mp;
gid= mp->m1_i1;
r= sys_safecopyfrom(mp->m_source, gid, 0, (vir_bytes)&pci_acl[i].acl,
sizeof(pci_acl[i].acl), D);
sizeof(pci_acl[i].acl));
if (r != OK)
{
printf("PCI: do_set_acl: safecopyfrom failed\n");

View file

@ -178,7 +178,7 @@ int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
(vir_bytes) rprocpub, sizeof(rprocpub))) != OK) {
panic("sys_safecopyfrom failed: %d", r);
}
for(i=0;i < NR_BOOT_PROCS;i++) {

View file

@ -412,7 +412,7 @@ static void prepare_output()
if ( (chunk = user_left) > sizeof obuf) chunk = sizeof obuf;
s=sys_safecopyfrom(caller, grant_nr, user_vir_d, (vir_bytes) obuf,
chunk, D);
chunk);
if(s != OK) {
done_status = EFAULT;

View file

@ -173,7 +173,7 @@ static int r_transfer(
if (opcode == DEV_GATHER_S) {
random_getbytes(random_buf, chunk);
r= sys_safecopyto(endpt, grant, vir_offset,
(vir_bytes) random_buf, chunk, D);
(vir_bytes) random_buf, chunk);
if (r != OK)
{
printf("random: sys_safecopyto failed for proc %d, "
@ -182,7 +182,7 @@ static int r_transfer(
}
} else if (opcode == DEV_SCATTER_S) {
r= sys_safecopyfrom(endpt, grant, vir_offset,
(vir_bytes) random_buf, chunk, D);
(vir_bytes) random_buf, chunk);
if (r != OK)
{
printf("random: sys_safecopyfrom failed for proc %d, "

View file

@ -869,7 +869,7 @@ static void rl_readv_s(const message *mp, int from_int)
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);
n * sizeof(rep->re_iovec_s[0]));
if (cps != OK) {
panic("rl_readv_s: sys_safecopyfrom failed: %d",
cps);
@ -902,14 +902,14 @@ static void rl_readv_s(const message *mp, int from_int)
cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s1, D);
(vir_bytes) rep->v_re_rx_buf+o, s1);
if (cps != OK) {
panic("rl_readv_s: sys_safecopyto failed: %d",
cps);
}
cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, s1,
(vir_bytes) rep->v_re_rx_buf, s-s1, S);
(vir_bytes) rep->v_re_rx_buf, s-s1);
if (cps != OK) {
panic("rl_readv_s: sys_safecopyto failed: %d", cps);
}
@ -918,7 +918,7 @@ static void rl_readv_s(const message *mp, int from_int)
{
cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s, D);
(vir_bytes) rep->v_re_rx_buf+o, s);
if (cps != OK)
panic("rl_readv_s: sys_safecopyto failed: %d", cps);
}
@ -1033,7 +1033,7 @@ static void rl_writev_s(const message *mp, int from_int)
n= count-i;
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);
n * sizeof(rep->re_iovec_s[0]));
if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
@ -1045,7 +1045,7 @@ static void rl_writev_s(const message *mp, int from_int)
panic("invalid packet size");
}
cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) ret, s, D);
0, (vir_bytes) ret, s);
if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
@ -1529,7 +1529,7 @@ message *mp;
stats= rep->re_stat;
r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
(vir_bytes) &stats, sizeof(stats));
if (r != OK)
panic("rl_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -1221,7 +1221,7 @@ readvs_loop:
n = count-i;
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);
n * sizeof(rep->re_iovec_s[0]));
if (cps != OK) {
panic("rl_readv_s: sys_safecopyfrom failed: %d", cps);
}
@ -1234,7 +1234,7 @@ readvs_loop:
}
cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0,
(vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D);
(vir_bytes) rep->re_rx[index].v_ret_buf + size, s);
if (cps != OK)
panic("rl_readv_s: sys_safecopyto failed: %d", cps);
@ -1357,7 +1357,7 @@ static void rl_writev_s(const message *mp, int from_int)
n = count - i;
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);
n * sizeof(rep->re_iovec_s[0]));
if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
@ -1368,7 +1368,7 @@ static void rl_writev_s(const message *mp, int from_int)
panic("invalid packet size");
cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) ret, s, D);
0, (vir_bytes) ret, s);
if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
}
@ -1519,7 +1519,7 @@ message *mp;
stats = rep->re_stat;
r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D);
(vir_bytes) &stats, sizeof(stats));
if (r != OK)
panic("rl_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -172,7 +172,7 @@ int try;
do {
if (count > sizeof(buf)) count = sizeof(buf);
if ((result = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) buf, count, D)) != OK)
tp->tty_outoffset, (vir_bytes) buf, count)) != OK)
break;
tp->tty_outoffset += count;
tbuf = buf;
@ -813,7 +813,7 @@ void do_video(message *m)
r = sys_safecopyfrom(m->m_source,
(cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &mapreqvm, sizeof(mapreqvm), D);
(vir_bytes) &mapreqvm, sizeof(mapreqvm));
if (r != OK)
{
@ -834,7 +834,7 @@ void do_video(message *m)
if((r = sys_safecopyto(m->m_source,
(cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &mapreqvm,
sizeof(mapreqvm), D)) != OK) {
sizeof(mapreqvm))) != OK) {
printf("tty: sys_safecopyto failed\n");
}
} else {
@ -1204,7 +1204,7 @@ message *m;
result = ga_program(seq1); /* bring font memory into view */
if(sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) font_memory, GA_FONT_SIZE, D) != OK) {
(vir_bytes) font_memory, GA_FONT_SIZE) != OK) {
printf("tty: copying from %d failed\n", m->m_source);
return EFAULT;
}

View file

@ -265,7 +265,7 @@ message *m;
if (n <= 0)
panic("do_kbd(READ): bad n: %d", n);
r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &kbdp->buf[kbdp->offset], n, D);
(vir_bytes) &kbdp->buf[kbdp->offset], n);
if (r == OK)
{
kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
@ -292,7 +292,7 @@ message *m;
for (i= 0; i<m->COUNT; i++)
{
r= sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, i, (vir_bytes) &c, 1, D);
m->IO_GRANT, i, (vir_bytes) &c, 1);
if (r != OK)
break;
kbc_cmd1(KBC_WRITE_AUX, c);
@ -330,7 +330,7 @@ message *m;
r= sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, 0, (vir_bytes) &leds,
sizeof(leds), D);
sizeof(leds));
if (r != OK)
break;
b= 0;
@ -365,7 +365,7 @@ message *m;
r = sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, 0, (vir_bytes) &bell,
sizeof(bell), D);
sizeof(bell));
if (r != OK)
break;
@ -412,7 +412,7 @@ message *m;
panic("kbd_status: bad n: %d", n);
kbdp->req_size= 0;
r= sys_safecopyto(kbdp->incaller, kbdp->req_grant, 0,
(vir_bytes)&kbdp->buf[kbdp->offset], n, D);
(vir_bytes)&kbdp->buf[kbdp->offset], n);
if (r == OK)
{
kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
@ -1060,7 +1060,7 @@ message *m;
{
/* Load a new keymap. */
return sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D);
0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap));
}
/*===========================================================================*

View file

@ -243,7 +243,7 @@ static int pty_write(tty_t *tp, int try)
/* Copy from user space to the PTY output buffer. */
if ((s = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) pp->ohead, count, D))!=OK) {
tp->tty_outoffset, (vir_bytes) pp->ohead, count))!=OK) {
break;
}
@ -320,7 +320,7 @@ static void pty_start(pty_t *pp)
/* Copy from the output buffer to the readers address space. */
if((s = sys_safecopyto(pp->rdcaller, pp->rdgrant,
pp->rdoffset, (vir_bytes) pp->otail, count, D)) != OK) {
pp->rdoffset, (vir_bytes) pp->otail, count)) != OK) {
break;
}
pp->rdoffset += count;
@ -389,7 +389,7 @@ static int pty_read(tty_t *tp, int try)
/* Transfer one character to 'c'. */
if ((s = sys_safecopyfrom(pp->wrcaller, pp->wrgrant, pp->wroffset,
(vir_bytes) &c, 1, D)) != OK) {
(vir_bytes) &c, 1)) != OK) {
printf("pty: safecopy failed (error %d)\n", s);
break;
}

View file

@ -249,7 +249,7 @@ static int rs_write(register tty_t *tp, int try)
/* Copy from user space to the RS232 output buffer. */
sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) rs->ohead, count, D);
tp->tty_outoffset, (vir_bytes) rs->ohead, count);
/* Perform output processing on the output buffer. */
out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);

View file

@ -607,7 +607,7 @@ message *m_ptr; /* pointer to message sent to task */
case TCGETS:
/* Get the termios attributes. */
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);
(vir_bytes) &tp->tty_termios, (vir_bytes) size);
break;
case TCSETSW:
@ -628,14 +628,14 @@ message *m_ptr; /* pointer to message sent to task */
case TCSETS:
/* Set the termios attributes. */
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);
0, (vir_bytes) &tp->tty_termios, (vir_bytes) size);
if (r != OK) break;
setattr(tp);
break;
case TCFLSH:
r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &param.i, (vir_bytes) size, D);
0, (vir_bytes) &param.i, (vir_bytes) size);
if (r != OK) break;
switch (param.i) {
case TCIFLUSH: tty_icancel(tp); break;
@ -647,7 +647,7 @@ message *m_ptr; /* pointer to message sent to task */
case TCFLOW:
r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &param.i, (vir_bytes) size, D);
0, (vir_bytes) &param.i, (vir_bytes) size);
if (r != OK) break;
switch (param.i) {
case TCOOFF:
@ -672,12 +672,12 @@ message *m_ptr; /* pointer to message sent to task */
case TIOCGWINSZ:
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);
(vir_bytes) &tp->tty_winsize, (vir_bytes) size);
break;
case TIOCSWINSZ:
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);
0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size);
sigchar(tp, SIGWINCH, 0);
break;
@ -928,7 +928,7 @@ register tty_t *tp; /* pointer to terminal to read from */
sys_safecopyto(tp->tty_incaller,
tp->tty_ingrant, tp->tty_inoffset,
(vir_bytes) buf,
(vir_bytes) buflen(buf), D);
(vir_bytes) buflen(buf));
tp->tty_inoffset += buflen(buf);
tp->tty_incum += buflen(buf);
bp = buf;
@ -951,7 +951,7 @@ register tty_t *tp; /* pointer to terminal to read from */
count = bp - buf;
sys_safecopyto(tp->tty_incaller,
tp->tty_ingrant, tp->tty_inoffset,
(vir_bytes) buf, (vir_bytes) count, D);
(vir_bytes) buf, (vir_bytes) count);
tp->tty_inoffset += count;
tp->tty_incum += count;
}
@ -1393,7 +1393,7 @@ tty_t *tp;
if (tp->tty_ioreq == TCSETSF) tty_icancel(tp);
result = sys_safecopyfrom(tp->tty_iocaller, tp->tty_iogrant, 0,
(vir_bytes) &tp->tty_termios,
(vir_bytes) sizeof(tp->tty_termios), D);
(vir_bytes) sizeof(tp->tty_termios));
if (result == OK) setattr(tp);
}
tp->tty_ioreq = 0;

View file

@ -288,7 +288,7 @@ static int finish_req(int conn, int req, int *code)
hgcm_conn[conn].req[req].grant, 0,
(vir_bytes)
hgcm_conn[conn].req[req].param,
count * sizeof(vbox_param_t), D);
count * sizeof(vbox_param_t));
}
}
@ -372,7 +372,7 @@ static int do_open(message *m_ptr, int ipc_status, int *code)
connreq = (struct VMMDevHGCMConnect *) hgcm_conn[conn].req[0].ptr;
connreq->type = VMMDEV_HGCM_SVCLOC_LOCALHOST_EXISTING;
if ((r = sys_safecopyfrom(m_ptr->m_source, m_ptr->VBOX_GRANT, 0,
(vir_bytes) connreq->name, m_ptr->VBOX_COUNT, D)) !=
(vir_bytes) connreq->name, m_ptr->VBOX_COUNT)) !=
OK) {
free_conn(conn);
@ -576,7 +576,7 @@ static int do_call(message *m_ptr, int ipc_status, int *code)
if (count > 0) {
if ((r = sys_safecopyfrom(m_ptr->m_source, m_ptr->VBOX_GRANT,
0, (vir_bytes) hgcm_conn[conn].req[req].param,
count * sizeof(vbox_param_t), D)) != OK)
count * sizeof(vbox_param_t))) != OK)
return r;
}

View file

@ -559,7 +559,7 @@
/* Field names for SYS_SAFECOPY* */
#define SCP_FROM_TO m2_i1 /* from/to whom? */
#define SCP_SEG m2_i2 /* my own segment */
#define SCP_SEG_OBSOLETE m2_i2 /* my own segment */
#define SCP_GID m2_i3 /* grant id */
#define SCP_OFFSET m2_l1 /* offset within grant */
#define SCP_ADDRESS m2_p1 /* my own address */

View file

@ -148,9 +148,9 @@ int sys_physcopy(endpoint_t src_proc, int src_seg, vir_bytes src_vir,
/* Grant-based copy functions. */
int sys_safecopyfrom(endpoint_t source, cp_grant_id_t grant, vir_bytes
grant_offset, vir_bytes my_address, size_t bytes, int my_seg);
grant_offset, vir_bytes my_address, size_t bytes);
int sys_safecopyto(endpoint_t dest, cp_grant_id_t grant, vir_bytes
grant_offset, vir_bytes my_address, size_t bytes, int my_seg);
grant_offset, vir_bytes my_address, size_t bytes);
int sys_vsafecopy(struct vscp_vec *copyvec, int elements);
int sys_memset(endpoint_t who, unsigned long pattern,

View file

@ -3,7 +3,6 @@
*
* The parameters for this kernel call are:
* SCP_FROM_TO other endpoint
* SCP_SEG segment in own address space
* SCP_GID grant id
* SCP_OFFSET offset within granted space
* SCP_ADDRESS address in own address space
@ -24,7 +23,7 @@
#define MEM_TOP 0xFFFFFFFFUL
static int safecopy(struct proc *, endpoint_t, endpoint_t,
cp_grant_id_t, int, int, size_t, vir_bytes, vir_bytes, int);
cp_grant_id_t, size_t, vir_bytes, vir_bytes, int);
#define HASGRANTTABLE(gr) \
(priv(gr) && priv(gr)->s_grant_table)
@ -226,12 +225,11 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/*===========================================================================*
* safecopy *
*===========================================================================*/
static int safecopy(caller, granter, grantee, grantid, src_seg, dst_seg, bytes,
static int safecopy(caller, granter, grantee, grantid, bytes,
g_offset, addr, access)
struct proc * caller;
endpoint_t granter, grantee;
cp_grant_id_t grantid;
int src_seg, dst_seg;
size_t bytes;
vir_bytes g_offset, addr;
int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE
@ -279,8 +277,8 @@ int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE
granter = new_granter;
/* Now it's a regular copy. */
v_src.segment = src_seg;
v_dst.segment = dst_seg;
v_src.segment = D;
v_dst.segment = D;
v_src.proc_nr_e = *src;
v_dst.proc_nr_e = *dst;
@ -347,7 +345,7 @@ int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE
int do_safecopy_to(struct proc * caller, message * m_ptr)
{
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
(cp_grant_id_t) m_ptr->SCP_GID, m_ptr->SCP_SEG, D,
(cp_grant_id_t) m_ptr->SCP_GID,
m_ptr->SCP_BYTES, m_ptr->SCP_OFFSET,
(vir_bytes) m_ptr->SCP_ADDRESS, CPF_WRITE);
}
@ -358,7 +356,7 @@ int do_safecopy_to(struct proc * caller, message * m_ptr)
int do_safecopy_from(struct proc * caller, message * m_ptr)
{
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
(cp_grant_id_t) m_ptr->SCP_GID, D, m_ptr->SCP_SEG,
(cp_grant_id_t) m_ptr->SCP_GID,
m_ptr->SCP_BYTES, m_ptr->SCP_OFFSET,
(vir_bytes) m_ptr->SCP_ADDRESS, CPF_READ);
}
@ -406,7 +404,7 @@ int do_vsafecopy(struct proc * caller, message * m_ptr)
/* Do safecopy for this element. */
if((r=safecopy(caller, granter, caller->p_endpoint,
vec[i].v_gid, D, D,
vec[i].v_gid,
vec[i].v_bytes, vec[i].v_offset,
vec[i].v_addr, access)) != OK) {
return r;

View file

@ -475,7 +475,7 @@ static int msg_ioctl(const message *m_ptr)
if(sys_safecopyfrom(m_ptr->m_source,
(vir_bytes)m_ptr->ADDRESS, 0,
(vir_bytes)io_ctl_buf, len, D) != OK) {
(vir_bytes)io_ctl_buf, len) != OK) {
printf("%s:%d: safecopyfrom failed\n", __FILE__, __LINE__);
}
}
@ -488,7 +488,7 @@ static int msg_ioctl(const message *m_ptr)
/* copy result back to user */
if(sys_safecopyto(m_ptr->m_source, (vir_bytes)m_ptr->ADDRESS, 0,
(vir_bytes)io_ctl_buf, len, D) != OK) {
(vir_bytes)io_ctl_buf, len) != OK) {
printf("%s:%d: safecopyto failed\n", __FILE__, __LINE__);
}
@ -794,7 +794,7 @@ static void data_from_user(sub_dev_t *subdev)
(vir_bytes)subdev->ReviveGrant, 0,
(vir_bytes)subdev->DmaPtr +
subdev->DmaFillNext * subdev->FragSize,
(phys_bytes)subdev->FragSize, D);
(phys_bytes)subdev->FragSize);
subdev->DmaLength += 1;
@ -807,7 +807,7 @@ static void data_from_user(sub_dev_t *subdev)
(vir_bytes)subdev->ReviveGrant, 0,
(vir_bytes)subdev->ExtraBuf +
subdev->BufFillNext * subdev->FragSize,
(phys_bytes)subdev->FragSize, D);
(phys_bytes)subdev->FragSize);
subdev->BufLength += 1;
@ -861,7 +861,7 @@ static void data_to_user(sub_dev_t *sub_dev_ptr)
(vir_bytes)sub_dev_ptr->ReviveGrant,
0, (vir_bytes)sub_dev_ptr->ExtraBuf +
sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize,
(phys_bytes)sub_dev_ptr->FragSize, D);
(phys_bytes)sub_dev_ptr->FragSize);
/* adjust the buffer status variables */
sub_dev_ptr->BufReadNext =
@ -874,7 +874,7 @@ static void data_to_user(sub_dev_t *sub_dev_ptr)
(vir_bytes)sub_dev_ptr->ReviveGrant, 0,
(vir_bytes)sub_dev_ptr->DmaPtr +
sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize,
(phys_bytes)sub_dev_ptr->FragSize, D);
(phys_bytes)sub_dev_ptr->FragSize);
/* adjust the buffer status variables */
sub_dev_ptr->DmaReadNext =

View file

@ -230,7 +230,7 @@ static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
if (nr_req > NR_IOREQS) nr_req = NR_IOREQS;
if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->BDEV_GRANT,
0, (vir_bytes) iovec, nr_req * sizeof(iovec[0]), D)) {
0, (vir_bytes) iovec, nr_req * sizeof(iovec[0]))) {
printf("blockdriver: bad I/O vector by: %d\n", mp->m_source);
return EINVAL;
}
@ -269,7 +269,7 @@ static int do_dioctl(struct blockdriver *bdp, dev_t minor,
case DIOCSETP:
/* Copy just this one partition table entry. */
r = sys_safecopyfrom(endpt, grant, 0, (vir_bytes) &entry,
sizeof(entry), D);
sizeof(entry));
if (r != OK)
return r;
@ -295,8 +295,7 @@ static int do_dioctl(struct blockdriver *bdp, dev_t minor,
entry.sectors = 32;
}
r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &entry, sizeof(entry),
D);
r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &entry, sizeof(entry));
break;
}

View file

@ -63,7 +63,7 @@ int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
/* Copy in the requested size. */
if ((r = sys_safecopyfrom(endpt, grant, 0, (vir_bytes) &size,
sizeof(size), D)) != OK)
sizeof(size))) != OK)
return r;
if (size >= INT_MAX / sizeof(btrace_entry)) return EINVAL;
@ -103,7 +103,7 @@ int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
/* Copy in the request code. */
if ((r = sys_safecopyfrom(endpt, grant, 0, (vir_bytes) &ctl,
sizeof(ctl), D)) != OK)
sizeof(ctl))) != OK)
return r;
/* Start or stop tracing. */
@ -150,7 +150,7 @@ int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt,
if ((r = sys_safecopyto(endpt, grant, 0,
(vir_bytes) &trace_buf[trace_next],
entries * sizeof(btrace_entry), D)) != OK)
entries * sizeof(btrace_entry))) != OK)
return r;
trace_next += entries;

View file

@ -280,7 +280,7 @@ static int do_vrdwt(struct chardriver *cdp, message *mp)
iovec_size = (phys_bytes) (nr_req * sizeof(iovec[0]));
if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) {
0, (vir_bytes) iovec, iovec_size)) {
printf("bad I/O vector by: %d\n", mp->m_source);
return(EINVAL);
}
@ -296,7 +296,7 @@ static int do_vrdwt(struct chardriver *cdp, message *mp)
/* Copy the I/O vector back to the caller. */
if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) {
0, (vir_bytes) iovec, iovec_size)) {
printf("couldn't return I/O vector: %d\n", mp->m_source);
return(EINVAL);
}

View file

@ -317,7 +317,7 @@ static void submit_urb(message *msg)
/* copy in URB */
res = sys_safecopyfrom(ep, msg->USB_GRANT_ID, 0,
(vir_bytes) &mx_urb->dev_id, msg->USB_GRANT_SIZE, D);
(vir_bytes) &mx_urb->dev_id, msg->USB_GRANT_SIZE);
if (res != 0) {
DEBUG_MSG("sys_safecopyfrom failed ");
@ -474,7 +474,7 @@ static void completion_callback(void *priv)
/* copy out URB */
res = sys_safecopyto(drv->ep, ctx->gid, 0,
(vir_bytes) ((char*)mx_urb) + sizeof(void*),
mx_urb->urb_size - sizeof(void*), D);
mx_urb->urb_size - sizeof(void*));
if (res != 0) {
DEBUG_MSG("Copy out failed: %d", res);

View file

@ -17,7 +17,7 @@ int fs_lookup_credentials(vfs_ucred_t *credentials,
if(cred_size == sizeof(*credentials)) {
r = sys_safecopyfrom(VFS_PROC_NR, grant2, (vir_bytes) 0,
(vir_bytes) credentials, cred_size, D);
(vir_bytes) credentials, cred_size);
if (r != OK) {
printf("FS: cred copy (regular) failed.\n");
return(r);
@ -25,7 +25,7 @@ int fs_lookup_credentials(vfs_ucred_t *credentials,
} else if(cred_size == sizeof(old_cred)) {
int g;
r = sys_safecopyfrom(VFS_PROC_NR, grant2, (vir_bytes) 0,
(vir_bytes) &old_cred, sizeof(old_cred), D);
(vir_bytes) &old_cred, sizeof(old_cred));
if (r != OK) {
printf("FS: cred copy (fallback) failed.\n");
return(r);

View file

@ -90,7 +90,7 @@ int fs_link()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0,
(vir_bytes) string, (size_t) len, D);
(vir_bytes) string, (size_t) len);
if (r != OK) return(r);
NUL(string, len, sizeof(string));
@ -182,7 +182,7 @@ int fs_rdlink()
}
r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) path, (size_t) copylen, D);
(vir_bytes) 0, (vir_bytes) path, (size_t) copylen);
if (r == OK)
fs_m_out.RES_NBYTES = copylen;
@ -219,7 +219,7 @@ int fs_rename()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_OLD,
(vir_bytes) 0, (vir_bytes) pcn_src.pcn_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) pcn_src.pcn_name, (size_t) len);
if (r != OK) return(r);
NUL(pcn_src.pcn_name, len, sizeof(pcn_src.pcn_name));
pcn_src.pcn_namelen = len - 1;
@ -230,7 +230,7 @@ int fs_rename()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_NEW,
(vir_bytes) 0, (vir_bytes) pcn_targ.pcn_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) pcn_targ.pcn_name, (size_t) len);
if (r != OK) return(r);
NUL(pcn_targ.pcn_name, len, sizeof(pcn_targ.pcn_name));
pcn_targ.pcn_namelen = len - 1;
@ -415,7 +415,7 @@ int fs_unlink()
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) pcn.pcn_name,
(size_t) len, D);
(size_t) len);
if (r != OK) return (r);
NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name));

View file

@ -48,7 +48,7 @@ int fs_create()
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) pcn.pcn_name,
(size_t) len, D);
(size_t) len);
if (err_code != OK) return(err_code);
NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name));
@ -140,7 +140,7 @@ int fs_mknod()
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) pcn.pcn_name,
(size_t) len, D);
(size_t) len);
if (err_code != OK) return(err_code);
NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name));
@ -223,7 +223,7 @@ int fs_mkdir()
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) pcn.pcn_name,
(phys_bytes) len, D);
(phys_bytes) len);
if (err_code != OK) return(err_code);
NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name));
@ -307,14 +307,14 @@ int fs_slink()
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) pcn.pcn_name,
(size_t) len, D);
(size_t) len);
if (r != OK) return(r);
NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name));
/* Copy the target path (note that it's not null terminated) */
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT3,
(vir_bytes) 0, (vir_bytes) target,
(size_t) fs_m_in.REQ_MEM_SIZE, D);
(size_t) fs_m_in.REQ_MEM_SIZE);
if (r != OK) return(r);
target[fs_m_in.REQ_MEM_SIZE] = '\0';

View file

@ -57,7 +57,7 @@ int fs_lookup()
/* Copy the pathname and set up caller's user and group id */
r = sys_safecopyfrom(VFS_PROC_NR, grant, /*offset*/ 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if (r != OK) return(r);
/* Verify this is a null-terminated path. */
@ -85,7 +85,7 @@ int fs_lookup()
if (len > path_size) return(ENAMETOOLONG);
r1 = sys_safecopyto(VFS_PROC_NR, grant, (vir_bytes) 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if (r1 != OK) return(r1);
}

View file

@ -67,7 +67,7 @@ int fs_readwrite(void)
bytes_done = nrbytes - bytes_left;
if (bytes_done) {
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) 0,
(vir_bytes) rw_buf, bytes_done, D);
(vir_bytes) rw_buf, bytes_done);
update_times(pn, ATIME, 0);
}
} else if (rw_flag == WRITING) {
@ -85,7 +85,7 @@ int fs_readwrite(void)
if (r) return(EINVAL);
r = sys_safecopyfrom(VFS_PROC_NR, gid, (vir_bytes) 0,
(vir_bytes) rw_buf, nrbytes, D);
(vir_bytes) rw_buf, nrbytes);
if (r != OK) return(EINVAL);
if (global_pu->pu_ops.puffs_node_write == NULL)
@ -165,7 +165,7 @@ int fs_getdents(void)
if (written) {
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) 0,
(vir_bytes) getdents_buf, written, D);
(vir_bytes) getdents_buf, written);
if (r != OK) return(r);
}

View file

@ -30,7 +30,7 @@ int fs_fstatfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st), D);
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st));
return(r);
}
@ -88,7 +88,7 @@ int fs_stat()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) &statbuf,
(size_t) sizeof(statbuf), D);
(size_t) sizeof(statbuf));
return(r);
}
@ -115,7 +115,7 @@ int fs_statvfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, (vir_bytes) &st,
(phys_bytes) sizeof(st), D);
(phys_bytes) sizeof(st));
return(r);
}

View file

@ -215,7 +215,7 @@ int do_lookup()
return EINVAL;
r = sys_safecopyfrom(m_in.m_source, m_in.REQ_GRANT, 0,
(vir_bytes) buf, len, D);
(vir_bytes) buf, len);
if (r != OK)
return r;
@ -237,7 +237,7 @@ int do_lookup()
}
r = sys_safecopyfrom(m_in.m_source, m_in.REQ_GRANT2, 0,
(vir_bytes) &ucred, m_in.REQ_UCRED_SIZE, D);
(vir_bytes) &ucred, m_in.REQ_UCRED_SIZE);
if (r != OK)
return r;

View file

@ -25,7 +25,7 @@ int do_fstatfs()
statfs.f_bsize = BLOCK_SIZE; /* arbitrary block size constant */
return sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, 0,
(vir_bytes) &statfs, sizeof(statfs), D);
(vir_bytes) &statfs, sizeof(statfs));
}
/*===========================================================================*
@ -74,5 +74,5 @@ int do_statvfs()
statvfs.f_namemax = NAME_MAX;
return sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, 0,
(vir_bytes) &statvfs, sizeof(statvfs), D);
(vir_bytes) &statvfs, sizeof(statvfs));
}

View file

@ -54,7 +54,7 @@ int do_read()
chunk = r;
r = sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, off,
(vir_bytes) ptr, chunk, D);
(vir_bytes) ptr, chunk);
if (r != OK)
break;
@ -190,7 +190,7 @@ int do_getdents()
/* If our own buffer cannot contain the new record, copy out first. */
if (off + len > sizeof(buf)) {
r = sys_safecopyto(m_in.m_source, m_in.REQ_GRANT,
user_off, (vir_bytes) buf, off, D);
user_off, (vir_bytes) buf, off);
if (r != OK) {
put_inode(child);
@ -218,7 +218,7 @@ int do_getdents()
/* If there is anything left in our own buffer, copy that out now. */
if (off > 0) {
r = sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, user_off,
(vir_bytes) buf, off, D);
(vir_bytes) buf, off);
if (r != OK)
return r;

View file

@ -97,7 +97,7 @@ int do_stat()
}
return sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, 0,
(vir_bytes) &stat, sizeof(stat), D);
(vir_bytes) &stat, sizeof(stat));
}
/*===========================================================================*

View file

@ -27,7 +27,7 @@ char name[NAME_MAX+1]; /* buffer in which store the result */
if (len <= 1) return EINVAL;
if (len > NAME_MAX+1) return ENAMETOOLONG;
r = sys_safecopyfrom(m_in.m_source, grant, 0, (vir_bytes) name, len, D);
r = sys_safecopyfrom(m_in.m_source, grant, 0, (vir_bytes) name, len);
if (r != OK) return r;

View file

@ -50,7 +50,7 @@ cp_grant_id_t *grantp;
if (grantp != NULL) {
r = sys_safecopyfrom(m_in.m_source, *grantp,
off, (vir_bytes) ptr, chunk, D);
off, (vir_bytes) ptr, chunk);
if (r != OK)
break;

View file

@ -31,7 +31,7 @@ static void add_buff(void *ptr, int size)
size = pos - gcov_buff_sz;
}
r = sys_safecopyto(VFS_PROC_NR, grant, pos, (vir_bytes)ptr, size, D);
r = sys_safecopyto(VFS_PROC_NR, grant, pos, (vir_bytes)ptr, size);
if(r) {
printf("libsys: gcov: safecopy failed (%d)\n", r);

View file

@ -5,8 +5,7 @@
int sys_safecopyfrom(endpoint_t src_e,
cp_grant_id_t gr_id, vir_bytes offset,
vir_bytes address, size_t bytes,
int my_seg)
vir_bytes address, size_t bytes)
{
/* Transfer a block of data for which the other process has previously
* given permission.
@ -15,20 +14,23 @@ int sys_safecopyfrom(endpoint_t src_e,
message copy_mess;
copy_mess.SCP_FROM_TO = src_e;
copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;
copy_mess.SCP_BYTES = (long) bytes;
/* for older kernels that still need the 'seg' field
* provide the right value.
*/
copy_mess.SCP_SEG_OBSOLETE = D;
return(_kernel_call(SYS_SAFECOPYFROM, &copy_mess));
}
int sys_safecopyto(endpoint_t dst_e,
cp_grant_id_t gr_id, vir_bytes offset,
vir_bytes address, size_t bytes,
int my_seg)
vir_bytes address, size_t bytes)
{
/* Transfer a block of data for which the other process has previously
* given permission.
@ -37,12 +39,16 @@ int sys_safecopyto(endpoint_t dst_e,
message copy_mess;
copy_mess.SCP_FROM_TO = dst_e;
copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;
copy_mess.SCP_BYTES = (long) bytes;
/* for older kernels that still need the 'seg' field
* provide the right value.
*/
copy_mess.SCP_SEG_OBSOLETE = D;
return(_kernel_call(SYS_SAFECOPYTO, &copy_mess));
}

View file

@ -33,7 +33,7 @@ int fs_rdlink(void)
/* Copy out the result. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) path, len, D);
(vir_bytes) path, len);
if (r != OK) return r;
fs_m_out.RES_NBYTES = len;

View file

@ -166,7 +166,7 @@ int fs_lookup(void)
return EINVAL;
r = sys_safecopyfrom(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) path, (phys_bytes) len, D);
(vir_bytes) path, (phys_bytes) len);
if (r != OK) return r;
if (path[len-1] != 0) return EINVAL;
@ -176,7 +176,7 @@ int fs_lookup(void)
assert(fs_m_in.REQ_UCRED_SIZE == sizeof(ucred));
r = sys_safecopyfrom(fs_m_in.m_source, fs_m_in.REQ_GRANT2, 0,
(vir_bytes) &ucred, fs_m_in.REQ_UCRED_SIZE, D);
(vir_bytes) &ucred, fs_m_in.REQ_UCRED_SIZE);
if (r != OK)
return r;
@ -286,7 +286,7 @@ int fs_lookup(void)
if (symloop > 0 && (r == ELEAVEMOUNT || r == ESYMLINK)) {
r2 = sys_safecopyto(fs_m_in.m_source,
fs_m_in.REQ_GRANT, 0, (vir_bytes) path,
strlen(path) + 1, D);
strlen(path) + 1);
if (r2 != OK)
r = r2;

View file

@ -50,7 +50,7 @@ int fs_read(void)
/* Copy the resulting data to user space. */
if (r == OK && len > 0) {
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT,
0, (vir_bytes) ptr, len, D);
0, (vir_bytes) ptr, len);
}
} else {
/* Feign an empty file. */
@ -179,7 +179,7 @@ int fs_getdents(void)
*/
if (off + len > sizeof(buf)) {
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT,
user_off, (vir_bytes) buf, off, D);
user_off, (vir_bytes) buf, off);
if (r != OK) return r;
user_off += off;
@ -200,7 +200,7 @@ int fs_getdents(void)
/* If there is anything left in our own buffer, copy that out now. */
if (off > 0) {
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT,
user_off, (vir_bytes) buf, off, D);
user_off, (vir_bytes) buf, off);
if (r != OK)
return r;

View file

@ -52,7 +52,7 @@ int fs_stat(void)
/* Copy the struct to user space. */
return sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) &statbuf, (phys_bytes) sizeof(statbuf), D);
(vir_bytes) &statbuf, (phys_bytes) sizeof(statbuf));
}
/*===========================================================================*
@ -68,7 +68,7 @@ int fs_fstatfs(void)
/* Copy the struct to user space. */
return sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) &statfs, (phys_bytes) sizeof(statfs), D);
(vir_bytes) &statfs, (phys_bytes) sizeof(statfs));
}
/*===========================================================================*
@ -87,5 +87,5 @@ int fs_statvfs(void)
statvfs.f_namemax = PNAME_MAX;
return sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) &statvfs, sizeof(statvfs), D);
(vir_bytes) &statvfs, sizeof(statvfs));
}

View file

@ -244,7 +244,7 @@ int do_add_device(message *msg)
}
res = sys_safecopyfrom(ep, msg->DEVMAN_GRANT_ID,
0, (vir_bytes) devinf, msg->DEVMAN_GRANT_SIZE, D);
0, (vir_bytes) devinf, msg->DEVMAN_GRANT_SIZE);
if (res != OK) {
res = EINVAL;

View file

@ -155,7 +155,7 @@ static int get_key_name(const message *m_ptr, char *key_name)
/* Copy name from caller. */
r = sys_safecopyfrom(m_ptr->m_source,
(cp_grant_id_t) m_ptr->DS_KEY_GRANT, 0,
(vir_bytes) key_name, m_ptr->DS_KEY_LEN, D);
(vir_bytes) key_name, m_ptr->DS_KEY_LEN);
if(r != OK) {
printf("DS: publish: copy failed from %d: %d\n", m_ptr->m_source, r);
return r;
@ -268,7 +268,7 @@ int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
/* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
(vir_bytes) rprocpub, sizeof(rprocpub))) != OK) {
panic("sys_safecopyfrom failed: %d", r);
}
for(i=0;i < NR_BOOT_PROCS;i++) {
@ -353,7 +353,7 @@ int do_publish(message *m_ptr)
/* Copy the memory range. */
r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->DS_VAL,
0, (vir_bytes) dsp->u.mem.data, length, D);
0, (vir_bytes) dsp->u.mem.data, length);
if(r != OK) {
printf("DS: publish: memory map/copy failed from %d: %d\n",
m_ptr->m_source, r);
@ -432,7 +432,7 @@ int do_retrieve(message *m_ptr)
case DSF_TYPE_MEM:
length = MIN(m_ptr->DS_VAL_LEN, dsp->u.mem.length);
r = sys_safecopyto(m_ptr->m_source, (cp_grant_id_t) m_ptr->DS_VAL, 0,
(vir_bytes) dsp->u.mem.data, length, D);
(vir_bytes) dsp->u.mem.data, length);
if(r != OK) {
printf("DS: retrieve: copy failed to %d: %d\n",
m_ptr->m_source, r);
@ -471,7 +471,7 @@ int do_retrieve(message *m_ptr)
length = MIN(m_ptr->DS_VAL_LEN, dsp->u.map.length);
r = sys_safecopyto(m_ptr->m_source,
(cp_grant_id_t) m_ptr->DS_VAL, (vir_bytes) 0,
(vir_bytes) data, length, D);
(vir_bytes) data, length);
if(r != OK) {
printf("DS: retrieve: copy failed to %d: %d\n",
m_ptr->m_source, r);
@ -505,7 +505,7 @@ int do_retrieve_label(const message *m_ptr)
/* Copy the key name. */
r = sys_safecopyto(m_ptr->m_source,
(cp_grant_id_t) m_ptr->DS_KEY_GRANT, (vir_bytes) 0,
(vir_bytes) dsp->key, strlen(dsp->key) + 1, D);
(vir_bytes) dsp->key, strlen(dsp->key) + 1);
if(r != OK) {
printf("DS: copy failed from %d: %d\n", m_ptr->m_source, r);
return r;
@ -620,7 +620,7 @@ int do_check(message *m_ptr)
/* Copy the key name. */
r = sys_safecopyto(m_ptr->m_source,
(cp_grant_id_t) m_ptr->DS_KEY_GRANT, (vir_bytes) 0,
(vir_bytes) ds_store[i].key, strlen(ds_store[i].key) + 1, D);
(vir_bytes) ds_store[i].key, strlen(ds_store[i].key) + 1);
if(r != OK) {
printf("DS: check: copy failed from %d: %d\n", m_ptr->m_source, r);
return r;

View file

@ -46,7 +46,7 @@ int fs_link()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0,
(vir_bytes) string, (size_t) len, D);
(vir_bytes) string, (size_t) len);
if (r != OK) return r;
NUL(string, len, sizeof(string));
@ -134,7 +134,7 @@ int fs_unlink()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) string, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
if (r != OK) return r;
NUL(string, len, sizeof(string));
@ -218,7 +218,7 @@ int fs_rdlink()
copylen = min( copylen, (unsigned) rip->i_size);
r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) link_text,
(size_t) copylen, D);
(size_t) copylen);
put_block(bp, DIRECTORY_BLOCK);
if (r == OK)
fs_m_out.RES_NBYTES = copylen;
@ -323,7 +323,7 @@ int fs_rename()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_OLD,
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len);
if (r != OK) return r;
NUL(old_name, len, sizeof(old_name));
@ -333,7 +333,7 @@ int fs_rename()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_NEW,
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len);
if (r != OK) return r;
NUL(new_name, len, sizeof(new_name));

View file

@ -84,7 +84,7 @@ int fs_new_driver(void)
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, (vir_bytes) 0,
(vir_bytes) label, label_len, D);
(vir_bytes) label, label_len);
if (r != OK) {
printf("ext2: fs_new_driver safecopyfrom failed (%d)\n", r);

View file

@ -43,7 +43,7 @@ int fs_readsuper()
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, 0,
(vir_bytes)fs_dev_label, label_len, D);
(vir_bytes)fs_dev_label, label_len);
if (r != OK) {
printf("%s:%d fs_readsuper: safecopyfrom failed: %d\n",
__FILE__, __LINE__, r);

View file

@ -40,7 +40,7 @@ int fs_create()
return(ENAMETOOLONG);
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len);
if (err_code != OK) return err_code;
NUL(lastc, len, sizeof(lastc));
@ -90,7 +90,7 @@ int fs_mknod()
return(ENAMETOOLONG);
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len);
if (err_code != OK) return err_code;
NUL(lastc, len, sizeof(lastc));
@ -128,7 +128,7 @@ int fs_mkdir()
return(ENAMETOOLONG);
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, (phys_bytes) len, D);
(vir_bytes) 0, (vir_bytes) lastc, (phys_bytes) len);
if(err_code != OK) return(err_code);
NUL(lastc, len, sizeof(lastc));
@ -203,7 +203,7 @@ int fs_slink()
return(ENAMETOOLONG);
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) string, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
if (r != OK) return(r);
NUL(string, len, sizeof(string));
@ -225,7 +225,7 @@ int fs_slink()
r = sys_safecopyfrom(VFS_PROC_NR,
(cp_grant_id_t) fs_m_in.REQ_GRANT3,
(vir_bytes) 0, (vir_bytes) sip->i_block,
(vir_bytes) fs_m_in.REQ_MEM_SIZE, D);
(vir_bytes) fs_m_in.REQ_MEM_SIZE);
sip->i_dirt = DIRTY;
link_target_buf = (char*) sip->i_block;
} else {
@ -233,7 +233,7 @@ int fs_slink()
sys_safecopyfrom(VFS_PROC_NR,
(cp_grant_id_t) fs_m_in.REQ_GRANT3,
(vir_bytes) 0, (vir_bytes) bp->b_data,
(vir_bytes) fs_m_in.REQ_MEM_SIZE, D);
(vir_bytes) fs_m_in.REQ_MEM_SIZE);
bp->b_dirt = DIRTY;
link_target_buf = bp->b_data;
} else {

View file

@ -56,7 +56,7 @@ int fs_lookup()
/* Copy the pathname and set up caller's user and group id */
r = sys_safecopyfrom(VFS_PROC_NR, grant, /*offset*/ 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if(r != OK) return(r);
/* Verify this is a null-terminated path. */
@ -83,7 +83,7 @@ int fs_lookup()
if(len > path_size) return(ENAMETOOLONG);
r1 = sys_safecopyto(VFS_PROC_NR, grant, (vir_bytes) 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if (r1 != OK) return(r1);
}

View file

@ -272,11 +272,11 @@ int *completed; /* number of bytes copied */
if (rw_flag == READING) {
/* Copy a chunk from the block buffer to user space. */
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) buf_off,
(vir_bytes) (bp->b_data+off), (size_t) chunk, D);
(vir_bytes) (bp->b_data+off), (size_t) chunk);
} else {
/* Copy a chunk from user space to the block buffer. */
r = sys_safecopyfrom(VFS_PROC_NR, gid, (vir_bytes) buf_off,
(vir_bytes) (bp->b_data+off), (size_t) chunk, D);
(vir_bytes) (bp->b_data+off), (size_t) chunk);
bp->b_dirt = DIRTY;
}
@ -624,7 +624,7 @@ int fs_getdents(void)
r = sys_safecopyto(VFS_PROC_NR, gid,
(vir_bytes) userbuf_off,
(vir_bytes) getdents_buf,
(size_t) tmpbuf_off, D);
(size_t) tmpbuf_off);
if (r != OK) {
put_inode(rip);
return(r);
@ -661,7 +661,7 @@ int fs_getdents(void)
if (tmpbuf_off != 0) {
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) userbuf_off,
(vir_bytes) getdents_buf, (size_t) tmpbuf_off, D);
(vir_bytes) getdents_buf, (size_t) tmpbuf_off);
if (r != OK) {
put_inode(rip);
return(r);

View file

@ -54,7 +54,7 @@ static int stat_inode(
/* Copy the struct to user space. */
r = sys_safecopyto(who_e, gid, (vir_bytes) 0, (vir_bytes) &statbuf,
(size_t) sizeof(statbuf), D);
(size_t) sizeof(statbuf));
return(r);
}
@ -76,7 +76,7 @@ int fs_fstatfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st), D);
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st));
return(r);
}
@ -124,7 +124,7 @@ int fs_statvfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, (vir_bytes) &st,
(phys_bytes) sizeof(st), D);
(phys_bytes) sizeof(st));
return(r);
}

View file

@ -897,7 +897,7 @@ int size;
{
r= sys_safecopyfrom(s_cp_req[0].v_from,
s_cp_req[0].v_gid, s_cp_req[0].v_offset,
s_cp_req[0].v_addr, s_cp_req[0].v_bytes, D);
s_cp_req[0].v_addr, s_cp_req[0].v_bytes);
if (r <0)
{
printf("sys_safecopyfrom failed: %d\n", r);
@ -961,7 +961,7 @@ vir_bytes offset;
{
r= sys_safecopyto(s_cp_req[0].v_to,
s_cp_req[0].v_gid, s_cp_req[0].v_offset,
s_cp_req[0].v_addr, s_cp_req[0].v_bytes, D);
s_cp_req[0].v_addr, s_cp_req[0].v_bytes);
if (r <0)
{
printf("sys_safecopyto failed: %d\n", r);

View file

@ -34,7 +34,7 @@ int fs_new_driver(void)
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, (vir_bytes) 0,
(vir_bytes) label, label_len, D);
(vir_bytes) label, label_len);
if (r != OK) {
printf("ISOFS: fs_new_driver safecopyfrom failed (%d)\n", r);

View file

@ -24,7 +24,7 @@ int fs_readsuper() {
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, 0, (vir_bytes)fs_dev_label,
label_len, D);
label_len);
if (r != OK) {
printf("ISOFS %s:%d safecopyfrom failed: %d\n", __FILE__, __LINE__, r);
return(EINVAL);

View file

@ -34,7 +34,7 @@ int fs_lookup() {
/* Copy the pathname and set up caller's user and group id */
r = sys_safecopyfrom(VFS_PROC_NR, grant, 0, (vir_bytes) user_path,
(phys_bytes) len, D);
(phys_bytes) len);
if (r != OK) {
printf("ISOFS %s:%d sys_safecopyfrom failed: %d\n",
__FILE__, __LINE__, r);

View file

@ -228,7 +228,7 @@ int fs_getdents(void) {
* and start from the beginning. */
if (tmpbuf_offset + reclen > GETDENTS_BUFSIZ) {
r = sys_safecopyto(VFS_PROC_NR, gid, userbuf_off,
(vir_bytes)getdents_buf, tmpbuf_offset, D);
(vir_bytes)getdents_buf, tmpbuf_offset);
if (r != OK)
panic("fs_getdents: sys_safecopyto failed: %d", r);
@ -262,7 +262,7 @@ int fs_getdents(void) {
if (tmpbuf_offset != 0) {
r = sys_safecopyto(VFS_PROC_NR, gid, userbuf_off,
(vir_bytes) getdents_buf, tmpbuf_offset, D);
(vir_bytes) getdents_buf, tmpbuf_offset);
if (r != OK)
panic("fs_getdents: sys_safecopyto failed: %d", r);
@ -326,7 +326,7 @@ int *completed; /* number of bytes copied */
}
r = sys_safecopyto(VFS_PROC_NR, gid, buf_off,
(vir_bytes) (bp->b_data+off), (phys_bytes) chunk, D);
(vir_bytes) (bp->b_data+off), (phys_bytes) chunk);
put_block(bp);

View file

@ -69,7 +69,7 @@ static int stat_dir_record(
/* Copy the struct to user space. */
r = sys_safecopyto(who_e, gid, 0, (vir_bytes) &statbuf,
(phys_bytes) sizeof(statbuf), D);
(phys_bytes) sizeof(statbuf));
return(r);
}
@ -105,7 +105,7 @@ int fs_fstatfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
(vir_bytes) &st, (phys_bytes) sizeof(st), D);
(vir_bytes) &st, (phys_bytes) sizeof(st));
return(r);
}
@ -134,7 +134,7 @@ int fs_statvfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, (vir_bytes) &st,
(phys_bytes) sizeof(st), D);
(phys_bytes) sizeof(st));
return(r);
}

View file

@ -41,7 +41,7 @@ int fs_link()
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(string));
/* Copy the link name's last component */
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) string, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
if (r != OK) return r;
NUL(string, len, sizeof(string));
@ -123,7 +123,7 @@ int fs_unlink()
/* Copy the last component */
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(string));
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) string, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
if (r != OK) return r;
NUL(string, len, sizeof(string));
@ -196,7 +196,7 @@ int fs_rdlink()
bp = get_block(rip->i_dev, b, NORMAL);
r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) bp->b_data,
(size_t) copylen, D);
(size_t) copylen);
put_block(bp, DIRECTORY_BLOCK);
if (r == OK)
fs_m_out.RES_NBYTES = copylen;
@ -298,14 +298,14 @@ int fs_rename()
/* Copy the last component of the old name */
len = min( (unsigned) fs_m_in.REQ_REN_LEN_OLD, sizeof(old_name));
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_OLD,
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len);
if (r != OK) return r;
NUL(old_name, len, sizeof(old_name));
/* Copy the last component of the new name */
len = min( (unsigned) fs_m_in.REQ_REN_LEN_NEW, sizeof(new_name));
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_NEW,
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len);
if (r != OK) return r;
NUL(new_name, len, sizeof(new_name));

View file

@ -72,7 +72,7 @@ int fs_new_driver(void)
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, (vir_bytes) 0,
(vir_bytes) label, label_len, D);
(vir_bytes) label, label_len);
if (r != OK) {
printf("MFS: fs_new_driver safecopyfrom failed (%d)\n", r);

View file

@ -34,7 +34,7 @@ int fs_readsuper()
return(EINVAL);
r = sys_safecopyfrom(fs_m_in.m_source, label_gid, (vir_bytes) 0,
(vir_bytes) fs_dev_label, label_len, D);
(vir_bytes) fs_dev_label, label_len);
if (r != OK) {
printf("MFS %s:%d safecopyfrom failed: %d\n", __FILE__, __LINE__, r);
return(EINVAL);

View file

@ -32,7 +32,7 @@ int fs_create()
/* Copy the last component (i.e., file name) */
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(lastc));
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, len, D);
(vir_bytes) 0, (vir_bytes) lastc, len);
if (err_code != OK) return err_code;
NUL(lastc, len, sizeof(lastc));
@ -79,7 +79,7 @@ int fs_mknod()
/* Copy the last component and set up caller's user and group id */
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(lastc));
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len);
if (err_code != OK) return err_code;
NUL(lastc, len, sizeof(lastc));
@ -114,7 +114,7 @@ int fs_mkdir()
/* Copy the last component and set up caller's user and group id */
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(lastc));
err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) lastc, (size_t) len);
if(err_code != OK) return(err_code);
NUL(lastc, len, sizeof(lastc));
@ -184,7 +184,7 @@ int fs_slink()
/* Copy the link name's last component */
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(string));
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) string, (size_t) len, D);
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
if (r != OK) return(r);
NUL(string, len, sizeof(string));
@ -206,7 +206,7 @@ int fs_slink()
r = sys_safecopyfrom(VFS_PROC_NR,
(cp_grant_id_t) fs_m_in.REQ_GRANT3,
(vir_bytes) 0, (vir_bytes) bp->b_data,
(size_t) fs_m_in.REQ_MEM_SIZE, D);
(size_t) fs_m_in.REQ_MEM_SIZE);
if(bp != NULL && r == OK) {
bp->b_data[_MIN_BLOCK_SIZE-1] = '\0';

View file

@ -56,7 +56,7 @@ int fs_lookup()
/* Copy the pathname and set up caller's user and group id */
r = sys_safecopyfrom(VFS_PROC_NR, grant, /*offset*/ (vir_bytes) 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if(r != OK) return(r);
/* Verify this is a null-terminated path. */
@ -83,7 +83,7 @@ int fs_lookup()
if(len > path_size) return(ENAMETOOLONG);
r1 = sys_safecopyto(VFS_PROC_NR, grant, (vir_bytes) 0,
(vir_bytes) user_path, (size_t) len, D);
(vir_bytes) user_path, (size_t) len);
if(r1 != OK) return(r1);
}

View file

@ -280,7 +280,7 @@ int *completed; /* number of bytes copied */
if (rw_flag == READING) {
/* Copy a chunk from the block buffer to user space. */
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) buf_off,
(vir_bytes) (bp->b_data+off), (size_t) chunk, D);
(vir_bytes) (bp->b_data+off), (size_t) chunk);
} else if(!block_write_ok(bp)) {
/* Let cache layer veto writing to this block */
printf("MFS: block write not allowed\n");
@ -288,7 +288,7 @@ int *completed; /* number of bytes copied */
} else {
/* Copy a chunk from user space to the block buffer. */
r = sys_safecopyfrom(VFS_PROC_NR, gid, (vir_bytes) buf_off,
(vir_bytes) (bp->b_data+off), (size_t) chunk, D);
(vir_bytes) (bp->b_data+off), (size_t) chunk);
MARKDIRTY(bp);
}
@ -613,7 +613,7 @@ int fs_getdents(void)
r = sys_safecopyto(VFS_PROC_NR, gid,
(vir_bytes) userbuf_off,
(vir_bytes) getdents_buf,
(size_t) tmpbuf_off, D);
(size_t) tmpbuf_off);
if (r != OK) {
put_inode(rip);
return(r);
@ -651,7 +651,7 @@ int fs_getdents(void)
if(tmpbuf_off != 0) {
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) userbuf_off,
(vir_bytes) getdents_buf, (size_t) tmpbuf_off, D);
(vir_bytes) getdents_buf, (size_t) tmpbuf_off);
if (r != OK) {
put_inode(rip);
return(r);

View file

@ -80,7 +80,7 @@ static int stat_inode(
/* Copy the struct to user space. */
r = sys_safecopyto(who_e, gid, (vir_bytes) 0, (vir_bytes) &statbuf,
(size_t) sizeof(statbuf), D);
(size_t) sizeof(statbuf));
return(r);
}
@ -101,7 +101,7 @@ int fs_fstatfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT,
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st), D);
(vir_bytes) 0, (vir_bytes) &st, (size_t) sizeof(st));
return(r);
}
@ -135,7 +135,7 @@ int fs_statvfs()
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, (vir_bytes) &st,
(phys_bytes) sizeof(st), D);
(phys_bytes) sizeof(st));
return(r);
}

View file

@ -52,11 +52,11 @@ int fs_readwrite(message *fs_m_in, message *fs_m_out)
if (rw_flag == READING) {
/* Copy a chunk from the block buffer to user space. */
r = sys_safecopyto(VFS_PROC_NR, gid, (vir_bytes) 0,
(vir_bytes) (bp->b_data+position), (size_t) nrbytes, D);
(vir_bytes) (bp->b_data+position), (size_t) nrbytes);
} else {
/* Copy a chunk from user space to the block buffer. */
r = sys_safecopyfrom(VFS_PROC_NR, gid, (vir_bytes) 0,
(vir_bytes) (bp->b_data+position), (size_t) nrbytes, D);
(vir_bytes) (bp->b_data+position), (size_t) nrbytes);
}
if (r == OK) {

View file

@ -48,7 +48,7 @@ static int stat_inode(
/* Copy the struct to user space. */
r = sys_safecopyto(who_e, gid, (vir_bytes) 0, (vir_bytes) &statbuf,
(size_t) sizeof(statbuf), D);
(size_t) sizeof(statbuf));
return(r);
}

View file

@ -303,8 +303,7 @@ int do_accept(message *dev_m_in, message *dev_m_out)
/* Get the server's address */
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un),
D);
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un));
if (rc != OK) {
return EIO;
@ -424,7 +423,7 @@ int do_connect(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &addr,
sizeof(struct sockaddr_un), D);
sizeof(struct sockaddr_un));
if (rc != OK) {
return EIO;
@ -594,7 +593,7 @@ int do_listen(message *dev_m_in, message *dev_m_out)
* don't allow the backlog to shrink
*/
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &backlog_size, sizeof(int), D);
(vir_bytes) 0, (vir_bytes) &backlog_size, sizeof(int));
if (rc != OK) {
return EIO;
@ -658,7 +657,7 @@ int do_socket(message *dev_m_in, message *dev_m_out)
/* get the requested type */
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(uds_fd_table[minor].type),
sizeof(int), D);
sizeof(int));
if (rc != OK) {
@ -713,8 +712,7 @@ int do_bind(message *dev_m_in, message *dev_m_out)
}
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un),
D);
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un));
if (rc != OK) {
return EIO;
@ -777,7 +775,7 @@ int do_getsockname(message *dev_m_in, message *dev_m_out)
*/
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(uds_fd_table[minor].addr),
sizeof(struct sockaddr_un), D);
sizeof(struct sockaddr_un));
return rc ? EIO : OK;
}
@ -805,7 +803,7 @@ int do_getpeername(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyto(VFS_PROC_NR,
(cp_grant_id_t) dev_m_in->IO_GRANT, (vir_bytes) 0,
(vir_bytes) &(uds_fd_table[peer_minor].addr),
sizeof(struct sockaddr_un), D);
sizeof(struct sockaddr_un));
return rc ? EIO : OK;
} else {
@ -850,7 +848,7 @@ int do_shutdown(message *dev_m_in, message *dev_m_out)
/* get the 'how' parameter from the process */
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &how, sizeof(int), D);
(vir_bytes) 0, (vir_bytes) &how, sizeof(int));
if (rc != OK) {
return EIO;
@ -900,7 +898,7 @@ int do_socketpair_old(message *dev_m_in, message *dev_m_out)
/* third ioctl param is the minor number of the second socket */
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &minorin, sizeof(short), D);
(vir_bytes) 0, (vir_bytes) &minorin, sizeof(short));
if (rc != OK) {
return EIO;
@ -947,7 +945,7 @@ int do_socketpair(message *dev_m_in, message *dev_m_out)
/* third ioctl param is the minor number of the second socket */
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &minorin, sizeof(dev_t), D);
(vir_bytes) 0, (vir_bytes) &minorin, sizeof(dev_t));
if (rc != OK) {
return EIO;
@ -999,7 +997,7 @@ int do_getsockopt_sotype(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(uds_fd_table[minor].type),
sizeof(int), D);
sizeof(int));
return rc ? EIO : OK;
}
@ -1040,7 +1038,7 @@ int do_getsockopt_peercred(message *dev_m_in, message *dev_m_out)
}
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &cred, sizeof(struct ucred), D);
(vir_bytes) 0, (vir_bytes) &cred, sizeof(struct ucred));
return rc ? EIO : OK;
}
@ -1087,8 +1085,7 @@ int do_getsockopt_peercred_old(message *dev_m_in, message *dev_m_out)
cred_old.gid = (char) cred.gid;
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &cred_old, sizeof(struct ucred_old),
D);
(vir_bytes) 0, (vir_bytes) &cred_old, sizeof(struct ucred_old));
return rc ? EIO : OK;
}
@ -1108,8 +1105,7 @@ int do_getsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
minor = uds_minor(dev_m_in);
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(sndbuf),
sizeof(size_t), D);
(vir_bytes) 0, (vir_bytes) &(sndbuf), sizeof(size_t));
return rc ? EIO : OK;
}
@ -1131,7 +1127,7 @@ int do_setsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &sndbuf,
sizeof(size_t), D);
sizeof(size_t));
if (rc != OK) {
return EIO;
@ -1163,8 +1159,7 @@ int do_getsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
minor = uds_minor(dev_m_in);
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(rcvbuf),
sizeof(size_t), D);
(vir_bytes) 0, (vir_bytes) &(rcvbuf), sizeof(size_t));
return rc ? EIO : OK;
}
@ -1186,7 +1181,7 @@ int do_setsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &rcvbuf,
sizeof(size_t), D);
sizeof(size_t));
if (rc != OK) {
return EIO;
@ -1224,8 +1219,7 @@ int do_sendto(message *dev_m_in, message *dev_m_out)
}
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un),
D);
(vir_bytes) 0, (vir_bytes) &addr, sizeof(struct sockaddr_un));
if (rc != OK) {
return EIO;
@ -1263,7 +1257,7 @@ int do_recvfrom(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(uds_fd_table[minor].source),
sizeof(struct sockaddr_un), D);
sizeof(struct sockaddr_un));
return rc ? EIO : OK;
}
@ -1491,7 +1485,7 @@ int do_sendmsg(message *dev_m_in, message *dev_m_out)
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &msg_ctrl,
sizeof(struct msg_control), D);
sizeof(struct msg_control));
if (rc != OK) {
return EIO;
@ -1580,7 +1574,7 @@ int do_recvmsg(message *dev_m_in, message *dev_m_out)
*/
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &msg_ctrl,
sizeof(struct msg_control), D);
sizeof(struct msg_control));
if (rc != OK) {
return EIO;
@ -1617,7 +1611,7 @@ int do_recvmsg(message *dev_m_in, message *dev_m_out)
/* send the user the control data */
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &msg_ctrl,
sizeof(struct msg_control), D);
sizeof(struct msg_control));
return rc ? EIO : OK;
}

View file

@ -539,7 +539,7 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *info)
/* Map all the services in the boot image. */
if ((s = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK){
(vir_bytes) rprocpub, sizeof(rprocpub))) != OK){
panic("sys_safecopyfrom failed: %d", s);
}
for (i = 0; i < NR_BOOT_PROCS; i++) {

View file

@ -748,7 +748,7 @@ size_t pathlen;
rfp = &(fproc[slot]);
r = sys_safecopyfrom(PFS_PROC_NR, io_gr, (vir_bytes) 0,
(vir_bytes) canon_path, pathlen, D);
(vir_bytes) canon_path, pathlen);
if (r != OK) return(r);
canon_path[pathlen] = '\0';
@ -760,7 +760,7 @@ size_t pathlen;
/* copy canon_path back to PFS */
r = sys_safecopyto(PFS_PROC_NR, (cp_grant_id_t) io_gr, (vir_bytes) 0,
(vir_bytes) canon_path, pathlen, D);
(vir_bytes) canon_path, pathlen);
if (r != OK) return(r);
/* Now do permissions checking */

View file

@ -381,7 +381,7 @@ static int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Map all the services in the boot image. */
if((s = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
(vir_bytes) rprocpub, sizeof(rprocpub))) != OK) {
panic("sys_safecopyfrom failed: %d", s);
}
for(i=0;i < NR_BOOT_PROCS;i++) {

View file

@ -19,7 +19,7 @@ static int do_request(message *m)
access = m->VTR_ACCESS;
r2 = sys_safecopyfrom(m->m_source, m->VTR_VGRANT, 0, (vir_bytes) vvec,
sizeof(vvec[0]) * vcount, D);
sizeof(vvec[0]) * vcount);
assert(r2 == OK);
r = sys_vumap(m->m_source, vvec, vcount, offset, access, pvec,
@ -27,7 +27,7 @@ static int do_request(message *m)
if (pcount >= 1 && pcount <= MAPVEC_NR + 3) {
r2 = sys_safecopyto(m->m_source, m->VTR_PGRANT, 0,
(vir_bytes) pvec, sizeof(pvec[0]) * pcount, D);
(vir_bytes) pvec, sizeof(pvec[0]) * pcount);
assert(r2 == OK);
}

View file

@ -17,7 +17,7 @@ int test(size_t size)
/* Timing. */
read_tsc(&high1, &low1);
r = sys_safecopyfrom(ep_granter, gid, 0, (long)buf, size, D);
r = sys_safecopyfrom(ep_granter, gid, 0, (long)buf, size);
read_tsc(&high2, &low2);
if(r != OK) {
printf("REQUESTOR: error in safecopy: %d\n", r);

View file

@ -126,7 +126,7 @@ int main(int argc, char **argv)
/* Test COW_SMAP2 (with COW safecopy). */
FIFO_WAIT(fid_get);
buf[0] = BUF_START_REQUESTOR;
r = sys_safecopyto(ep_granter, gid, 0, (long)buf, size, D);
r = sys_safecopyto(ep_granter, gid, 0, (long)buf, size);
if(r != OK) {
printf("REQUESTOR: error in sys_safecopyto: %d\n", r);
return 1;

View file

@ -136,7 +136,7 @@ int main(int argc, char **argv)
for(i=0;i<NR_TEST_ITERATIONS;i++) {
read_tsc_64(&start);
r = sys_safecopyfrom(ep_granter, gid, 0, (long)buf,
nr_pages*CLICK_SIZE, D);
nr_pages*CLICK_SIZE);
if(r != OK) {
printf("REQUESTOR: safecopy error: %d\n", r);
return 1;