version 1.9, 2008/12/29 17:59:08 |
version 1.10, 2009/01/23 17:38:15 |
|
|
struct safile { |
struct safile { |
struct file file; |
struct file file; |
struct sio_hdl *hdl; |
struct sio_hdl *hdl; |
#ifdef DEBUG |
#ifdef DEBUG |
struct timeval itv, otv; |
struct timeval itv, otv; |
#endif |
#endif |
}; |
}; |
|
|
|
|
void |
void |
safile_start(struct file *file) |
safile_start(struct file *file) |
{ |
{ |
struct safile *f = (struct safile *)file; |
struct safile *f = (struct safile *)file; |
|
|
if (!sio_start(f->hdl)) { |
if (!sio_start(f->hdl)) { |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
gettimeofday(&tv1, NULL); |
gettimeofday(&tv1, NULL); |
timersub(&tv1, &tv0, &dtv); |
timersub(&tv1, &tv0, &dtv); |
us = dtv.tv_sec * 1000000 + dtv.tv_usec; |
us = dtv.tv_sec * 1000000 + dtv.tv_usec; |
DPRINTFN(us < 5000 ? 4 : 1, |
DPRINTFN(us < 5000 ? 4 : 1, |
"safile_read: %s: got %d bytes in %uus\n", |
"safile_read: %s: got %d bytes in %uus\n", |
f->file.name, n, us); |
f->file.name, n, us); |
#endif |
#endif |
return n; |
return n; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
struct timeval tv0, tv1, dtv; |
struct timeval tv0, tv1, dtv; |
unsigned us; |
unsigned us; |
|
|
if (!(f->file.state & FILE_WOK)) { |
if (!(f->file.state & FILE_WOK)) { |
DPRINTF("safile_write: %s: bad state\n", f->file.name); |
DPRINTF("safile_write: %s: bad state\n", f->file.name); |
abort(); |
abort(); |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
gettimeofday(&tv1, NULL); |
gettimeofday(&tv1, NULL); |
timersub(&tv1, &tv0, &dtv); |
timersub(&tv1, &tv0, &dtv); |
us = dtv.tv_sec * 1000000 + dtv.tv_usec; |
us = dtv.tv_sec * 1000000 + dtv.tv_usec; |
DPRINTFN(us < 5000 ? 4 : 1, |
DPRINTFN(us < 5000 ? 4 : 1, |
"safile_write: %s: wrote %d bytes in %uus\n", |
"safile_write: %s: wrote %d bytes in %uus\n", |
f->file.name, n, us); |
f->file.name, n, us); |