=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/Attic/safile.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- src/usr.bin/aucat/Attic/safile.c 2009/11/05 08:36:48 1.19 +++ src/usr.bin/aucat/Attic/safile.c 2010/01/10 21:47:41 1.20 @@ -1,4 +1,4 @@ -/* $OpenBSD: safile.c,v 1.19 2009/11/05 08:36:48 ratchov Exp $ */ +/* $OpenBSD: safile.c,v 1.20 2010/01/10 21:47:41 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -30,6 +30,9 @@ #include "dev.h" #include "file.h" #include "safile.h" +#ifdef DEBUG +#include "dbg.h" +#endif struct safile { struct file file; @@ -163,10 +166,20 @@ struct safile *f = (struct safile *)file; if (!sio_start(f->hdl)) { +#ifdef DEBUG + dbg_puts(f->file.name); + dbg_puts(": failed to start device\n"); +#endif file_close(file); return; } f->started = 1; +#ifdef DEBUG + if (debug_level >= 3) { + file_dbg(&f->file); + dbg_puts(": started\n"); + } +#endif } void @@ -176,9 +189,19 @@ f->started = 0; if (!sio_eof(f->hdl) && !sio_stop(f->hdl)) { +#ifdef DEBUG + dbg_puts(f->file.name); + dbg_puts(": failed to stop device\n"); +#endif file_close(file); return; } +#ifdef DEBUG + if (debug_level >= 3) { + file_dbg(&f->file); + dbg_puts(": stopped\n"); + } +#endif } unsigned @@ -191,8 +214,18 @@ if (n == 0) { f->file.state &= ~FILE_ROK; if (sio_eof(f->hdl)) { +#ifdef DEBUG + dbg_puts(f->file.name); + dbg_puts(": failed to read from device\n"); +#endif file_eof(&f->file); } else { +#ifdef DEBUG + if (debug_level >= 4) { + file_dbg(&f->file); + dbg_puts(": reading blocked\n"); + } +#endif } return 0; } @@ -210,8 +243,18 @@ if (n == 0) { f->file.state &= ~FILE_WOK; if (sio_eof(f->hdl)) { +#ifdef DEBUG + dbg_puts(f->file.name); + dbg_puts(": failed to write on device\n"); +#endif file_hup(&f->file); } else { +#ifdef DEBUG + if (debug_level >= 4) { + file_dbg(&f->file); + dbg_puts(": writing blocked\n"); + } +#endif } return 0; }