From: Ben Gras Date: Wed, 28 Jun 2006 12:20:30 +0000 (+0000) Subject: Fix another bug related to trying i/o more than once X-Git-Tag: v3.1.3~276 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=bfca7d68ba6a5e934a6ce6c8b71cb065ee76a983;p=minix.git Fix another bug related to trying i/o more than once --- diff --git a/servers/fs/device.c b/servers/fs/device.c index 4c0853055..914fd233b 100644 --- a/servers/fs/device.c +++ b/servers/fs/device.c @@ -177,6 +177,7 @@ off_t *pos; int access = 0, size; int j; iovec_t *v; + static iovec_t new_iovec[NR_IOREQS]; /* Number of grants allocated in vector I/O. */ *vec_grants = 0; @@ -204,9 +205,9 @@ off_t *pos; /* Change to safe op. */ *op = *op == DEV_GATHER ? DEV_GATHER_S : DEV_SCATTER_S; - /* Grant access to i/o vector. */ + /* Grant access to my new i/o vector. */ if((*gid = cpf_grant_direct(driver, (vir_bytes) - buf, bytes * sizeof(iovec_t), + new_iovec, bytes * sizeof(iovec_t), CPF_READ | CPF_WRITE)) < 0) { panic(__FILE__, "cpf_grant_direct of vector failed", NO_NUM); @@ -214,7 +215,7 @@ off_t *pos; v = (iovec_t *) buf; /* Grant access to i/o buffers. */ for(j = 0; j < bytes; j++) { - gids[j] = v[j].iov_addr = + new_iovec[j].iov_addr = gids[j] = cpf_grant_direct(driver, (vir_bytes) v[j].iov_addr, v[j].iov_size, *op == DEV_GATHER_S ? CPF_WRITE : CPF_READ); @@ -222,6 +223,7 @@ off_t *pos; panic(__FILE__, "grant to iovec buf failed", NO_NUM); } + new_iovec[j].iov_size = v[j].iov_size; (*vec_grants)++; } break;