1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Nicolas Pennequin
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
23 #include <sys/types.h>
42 struct memory_handle
{
45 enum data_state state
;
48 size_t offset
; /* Offset at which we start reading the file */
49 size_t filerem
; /* Remaining bytes of file NOT in buffer */
50 size_t filesize
; /* File total length */
51 size_t available
; /* Available bytes to read from buffer */
52 size_t start_pos
; /* Position to first bytes of file in buffer */
53 size_t buf_idx
; /* Current pointer to the data buffer */
54 struct memory_handle
*next
;
57 void buffer_init(void);
58 int bufopen(char *file
, size_t offset
);
59 int bufclose(int handle_id
);