summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-25 19:53:34 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-25 19:53:34 +0000
commit205ec3279d32a152f6046ecc6ad66c39f097fa4d (patch)
treefa8bb607ebae23a0b43428ea6850797af83b57a0 /firmware
parent2a2b8d8a8234633779dca0fff5e7ce23ad4c48ed (diff)
downloadrockbox-205ec3279d32a152f6046ecc6ad66c39f097fa4d.tar.gz
rockbox-205ec3279d32a152f6046ecc6ad66c39f097fa4d.zip
Make recording complain about every little file I/O problem (error on close() failure and fsync() failure). Why? I guess we will find out the disk is full about 1/2 sector sooner on average when the file APIs actually detect this correctly. :/
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13262 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/pcm_record.h10
-rw-r--r--firmware/pcm_record.c14
2 files changed, 14 insertions, 10 deletions
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h
index 865a37fc70..8075b00ffc 100644
--- a/firmware/export/pcm_record.h
+++ b/firmware/export/pcm_record.h
@@ -45,15 +45,17 @@
#define PCMREC_E_ENCODER 0x80002000
/* filename queue has desynced from stream markers */
#define PCMREC_E_FNQ_DESYNC 0x80004000
+/* I/O error has occurred */
+#define PCMREC_E_IO 0x80008000
#ifdef PCMREC_PARANOID
/* encoder has written past end of allotted space */
-#define PCMREC_E_CHUNK_OVF 0x80008000
+#define PCMREC_E_CHUNK_OVF 0x80010000
/* chunk header incorrect */
-#define PCMREC_E_BAD_CHUNK 0x80010000
+#define PCMREC_E_BAD_CHUNK 0x80020000
/* encoder read position changed outside of recording control */
-#define PCMREC_E_ENC_RD_INDEX_TRASHED 0x80020000
+#define PCMREC_E_ENC_RD_INDEX_TRASHED 0x80040000
/* encoder write position changed outside of recording control */
-#define PCMREC_E_ENC_WR_INDEX_TRASHED 0x80040000
+#define PCMREC_E_ENC_WR_INDEX_TRASHED 0x80080000
#endif /* PCMREC_PARANOID */
/**
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index e0bb664af1..c27f80400d 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -653,7 +653,9 @@ static void pcmrec_close_file(int *fd_p)
if (*fd_p < 0)
return; /* preserve error */
- close(*fd_p);
+ if (close(*fd_p) != 0)
+ errors |= PCMREC_E_IO;
+
*fd_p = -1;
} /* pcmrec_close_file */
@@ -1042,8 +1044,8 @@ static void pcmrec_flush(unsigned flush_num)
} /* end while */
/* sync file */
- if (rec_fdata.rec_file >= 0)
- fsync(rec_fdata.rec_file);
+ if (rec_fdata.rec_file >= 0 && fsync(rec_fdata.rec_file) != 0)
+ errors |= PCMREC_E_IO;
cpu_boost(false);
@@ -1239,13 +1241,13 @@ static void pcmrec_init(void)
{
unsigned char *buffer;
- pcmrec_close_file(&rec_fdata.rec_file);
- rec_fdata.rec_file = -1;
-
/* warings and errors */
warnings =
errors = 0;
+ pcmrec_close_file(&rec_fdata.rec_file);
+ rec_fdata.rec_file = -1;
+
/* pcm FIFO */
dma_lock = true;
SET_PCM_POS(pcm_rd_pos, 0);