1 | //container_framework.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009 |
---|
5 | * |
---|
6 | * This file is part of roard a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | #include "roard.h" |
---|
26 | |
---|
27 | #define _DECL() struct cont_fw_child_vio_inst * inst |
---|
28 | #define _CHECK() if ( vio == NULL ) \ |
---|
29 | return -1 |
---|
30 | #define _CINST() if ( (inst = vio->inst) == NULL ) \ |
---|
31 | return -1 |
---|
32 | #define _PREP() _CHECK(); \ |
---|
33 | _CINST() |
---|
34 | #define _BASIC() _DECL(); \ |
---|
35 | _PREP() |
---|
36 | |
---|
37 | ssize_t cont_fw_read (struct roar_vio_calls * vio, void *buf, size_t count) { |
---|
38 | _BASIC(); |
---|
39 | |
---|
40 | if ( inst->parent->cb.read != NULL ) |
---|
41 | return inst->parent->cb.read(inst->parent, inst->inst, buf, count); |
---|
42 | |
---|
43 | return -1; |
---|
44 | } |
---|
45 | |
---|
46 | ssize_t cont_fw_write (struct roar_vio_calls * vio, void *buf, size_t count) { |
---|
47 | _BASIC(); |
---|
48 | |
---|
49 | if ( inst->parent->cb.write != NULL ) |
---|
50 | return inst->parent->cb.write(inst->parent, inst->inst, buf, count); |
---|
51 | |
---|
52 | return -1; |
---|
53 | } |
---|
54 | |
---|
55 | off_t cont_fw_lseek (struct roar_vio_calls * vio, off_t offset, int whence); |
---|
56 | int cont_fw_nonblock(struct roar_vio_calls * vio, int state); |
---|
57 | |
---|
58 | int cont_fw_sync (struct roar_vio_calls * vio) { |
---|
59 | _BASIC(); |
---|
60 | |
---|
61 | if ( inst->parent->cb.flush != NULL ) |
---|
62 | return inst->parent->cb.flush(inst->parent, inst->inst); |
---|
63 | |
---|
64 | return 0; |
---|
65 | } |
---|
66 | |
---|
67 | int cont_fw_close (struct roar_vio_calls * vio) { |
---|
68 | _DECL(); |
---|
69 | int r = 0; |
---|
70 | |
---|
71 | _PREP(); |
---|
72 | |
---|
73 | if ( cont_fw_sync(vio) == -1 ) |
---|
74 | r = -1; |
---|
75 | |
---|
76 | return -1; |
---|
77 | return r; |
---|
78 | } |
---|
79 | |
---|
80 | int cont_fw_ctl (struct roar_vio_calls * vio, int cmd, void * data); |
---|
81 | |
---|
82 | //ll |
---|