Move cp_grant_id_t to a more central header file, and uses it more

extensively.
Fix casts that cast the grand id field of some messages to the wrong
type.
This commit is contained in:
Kees van Reeuwijk 2010-03-04 16:15:26 +00:00
parent adf0b6fb26
commit 851dc95566
7 changed files with 18 additions and 15 deletions

View file

@ -2334,7 +2334,7 @@ message *m;
return EINVAL;
if (m->REQUEST == DIOCTIMEOUT) {
r= sys_safecopyfrom(m->IO_ENDPT, (vir_bytes) m->IO_GRANT,
r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&timeout, sizeof(timeout), D);
if(r != OK)
@ -2363,7 +2363,8 @@ message *m;
timeout_ticks = timeout;
}
r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->IO_GRANT,
r= sys_safecopyto(m->IO_ENDPT,
(cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&prev, sizeof(prev), D);
if(r != OK)
@ -2375,7 +2376,7 @@ message *m;
int count;
if (w_prepare(m->DEVICE) == NIL_DEV) return ENXIO;
count = w_wn->open_ct;
r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->IO_GRANT,
r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&count, sizeof(count), D);
if(r != OK)

View file

@ -525,7 +525,7 @@ PRIVATE int w_other(struct driver *dr, message *m)
int count;
if (w_prepare(m->DEVICE) == NIL_DEV) return ENXIO;
count = w_wn->open_ct;
r=sys_safecopyto(m->IO_ENDPT, (vir_bytes)m->IO_GRANT,
r=sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t)m->IO_GRANT,
0, (vir_bytes)&count, sizeof(count), D);
if(r != OK)

View file

@ -481,10 +481,10 @@ PRIVATE void do_vread_s(message * mp, int from_int)
client layer
*/
dep->de_read_iovec.iod_proc_nr = mp->DL_PROC;
de_get_userdata_s(mp->DL_PROC, (vir_bytes) mp->DL_GRANT, 0,
de_get_userdata_s(mp->DL_PROC, (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 = (vir_bytes) mp->DL_GRANT;
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
dep->de_read_iovec.iod_iovec_offset = 0;
size = de_calc_iov_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE)
@ -841,7 +841,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
de_get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0,
mp->DL_COUNT, iovp->iod_iovec);
iovp->iod_iovec_s = mp->DL_COUNT;
iovp->iod_grant = (vir_bytes) mp->DL_GRANT;
iovp->iod_grant = (cp_grant_id_t) mp->DL_GRANT;
iovp->iod_iovec_offset = 0;
totalsize = size = de_calc_iov_size(iovp);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)

View file

@ -416,7 +416,7 @@ static void do_vwrite_s(message * mp)
get_userdata_s(mp->DL_PROC, 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 = (vir_bytes) mp->DL_GRANT;
dep->de_write_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
dep->de_write_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_write_iovec);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
@ -454,10 +454,10 @@ static void do_vread_s(message * mp)
panic(dep->de_name, "read already in progress", NO_NUM);
dep->de_read_iovec.iod_proc_nr = mp->DL_PROC;
get_userdata_s(mp->DL_PROC, (vir_bytes) mp->DL_GRANT, 0,
get_userdata_s(mp->DL_PROC, (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 = (vir_bytes) mp->DL_GRANT;
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
dep->de_read_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE) panic(dep->de_name, SizeErrMsg, size);

View file

@ -1092,7 +1092,7 @@ static void do_vread_s(message *mp)
"do_vread_s: sys_safecopyfrom failed: %d\n", r);
ec->read_iovec.iod_iovec_s = count;
ec->read_iovec.iod_proc_nr = mp->DL_PROC;
ec->read_iovec.iod_grant = (vir_bytes) mp->DL_GRANT;
ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
ec->read_iovec.iod_iovec_offset = 0;
ec->tmp_iovec = ec->read_iovec;

View file

@ -6,8 +6,6 @@
#include <minix/types.h>
#include <stdint.h>
typedef int32_t cp_grant_id_t;
typedef struct {
int cp_flags; /* CPF_* below */
union {

View file

@ -9,12 +9,16 @@
#include <minix/types.h>
#endif
#include <stdint.h>
/* Type definitions. */
typedef unsigned int vir_clicks; /* virtual addr/length in clicks */
typedef unsigned long phys_bytes; /* physical addr/length in bytes */
typedef unsigned int phys_clicks; /* physical addr/length in clicks */
typedef int endpoint_t; /* process identifier */
typedef int32_t cp_grant_id_t; /* A grant ID. */
#if (_MINIX_CHIP == _CHIP_INTEL)
typedef long unsigned int vir_bytes; /* virtual addresses/lengths in bytes */
#endif
@ -43,7 +47,7 @@ struct far_mem {
/* Structure for virtual copying by means of a vector with requests. */
struct vir_addr {
int proc_nr_e;
endpoint_t proc_nr_e;
int segment;
vir_bytes offset;
};
@ -61,7 +65,7 @@ typedef struct {
} iovec_t;
typedef struct {
int iov_grant; /* grant ID of an I/O buffer */
cp_grant_id_t iov_grant; /* grant ID of an I/O buffer */
vir_bytes iov_size; /* sizeof an I/O buffer */
} iovec_s_t;