annotate src/vfstrace/vfstrace.c @ 3196:0f7180e3b163

alsa-ng: Enforce a minimum buffer size of 500ms.
author William Pitcock <nenolod@atheme.org>
date Sun, 12 Jul 2009 08:30:13 -0500
parents 08a91bda0829
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3097
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /* Audacious
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 * Copyright (c) 2009 William Pitcock
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 *
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 * (at your option) any later version.
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 *
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 * GNU General Public License for more details.
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 *
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 */
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18
3156
08a91bda0829 adapt to audlegacy
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 3097
diff changeset
19 #include <audlegacy/plugin.h>
3097
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 VFSFile *(*vfs_fopen_impl)(const gchar *path, const gchar *mode) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 gint (*vfs_fclose_impl)(VFSFile * file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, size_t nmemb, VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, size_t nmemb, VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 gint (*vfs_getc_impl)(VFSFile *stream) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 void (*vfs_rewind_impl)(VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 glong (*vfs_ftell_impl)(VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 gboolean (*vfs_feof_impl)(VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 off_t (*vfs_fsize_impl)(VFSFile *file) = NULL;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 VFSFile *
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 vt_vfs_fopen_impl(const gchar *path, const gchar *mode)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 VFSFile *ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 ret = vfs_fopen_impl(path, mode);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 g_print("fopen : path:%s : mode:%s : ret:%p\n", path, mode, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 gint
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 vt_vfs_fclose_impl(VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 gint ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 ret = vfs_fclose_impl(file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 g_print("fclose : file:%p : ret:%d\n", file, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 size_t
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 vt_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 size_t ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 ret = vfs_fread_impl(ptr, size, nmemb, file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 g_print("fread : size:%lu : nmemb:%lu : ret:%lu\n", size, nmemb, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 size_t
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 vt_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70 size_t ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 ret = vfs_fwrite_impl(ptr, size, nmemb, file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 g_print("fwrite : size:%lu : nmemb:%lu : ret:%lu\n", size, nmemb, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78 gint
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 vt_vfs_getc_impl(VFSFile *stream)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 gint ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 ret = vfs_getc_impl(stream);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 g_print("getc : ret:%d\n", ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 gint
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90 vt_vfs_ungetc_impl(gint c, VFSFile *stream)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92 gint ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 ret = vfs_ungetc_impl(c, stream);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 g_print("ungetc : c:%d : ret:%d\n", c, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 gint
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101 vt_vfs_fseek_impl(VFSFile *file, glong offset, gint whence)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103 gint ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 ret = vfs_fseek_impl(file, offset, whence);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106 g_print("fseek : offset:%ld : whence:%d : ret:%d\n", offset, whence, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
110
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
111 void
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
112 vt_vfs_rewind_impl(VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
113 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
114 g_print("rewind\n");
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
115 vfs_rewind_impl(file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
116 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
117
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
118 glong
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
119 vt_vfs_ftell_impl(VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
120 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
121 glong ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
122
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
123 ret = vfs_ftell_impl(file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
124 g_print("ftell : ret:%ld\n", ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
125
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
126 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
127 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
128
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
129 gboolean
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
130 vt_vfs_feof_impl(VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
131 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
132 gboolean ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
133
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
134 ret = vfs_feof_impl(file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
135 g_print("feof : ret:%d\n", ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
136
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
137 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
138 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
139
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
140 gboolean
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
141 vt_vfs_truncate_impl(VFSFile *file, glong length)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
142 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
143 gboolean ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
144
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
145 ret = vfs_truncate_impl(file, length);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
146 g_print("truncate : length:%ld : ret:%d\n", length, ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
147
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
148 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
149 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
150
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
151 off_t
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
152 vt_vfs_fsize_impl(VFSFile *file)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
153 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
154 off_t ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
155
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
156 ret = vfs_fsize_impl(file);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
157 g_print("fsize : ret:%lu\n", ret);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
158
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
159 return ret;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
160 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
161
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
162 void
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
163 patch_vfs(void)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
164 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
165 vfs_fopen_impl = aud_vfs_fopen;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
166 vfs_fclose_impl = aud_vfs_fclose;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
167 vfs_fread_impl = aud_vfs_fread;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
168 vfs_fwrite_impl = aud_vfs_fwrite;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
169 vfs_getc_impl = aud_vfs_getc;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
170 vfs_ungetc_impl = aud_vfs_ungetc;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
171 vfs_fseek_impl = aud_vfs_fseek;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
172 vfs_rewind_impl = aud_vfs_rewind;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
173 vfs_ftell_impl = aud_vfs_ftell;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
174 vfs_feof_impl = aud_vfs_feof;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
175 vfs_truncate_impl = aud_vfs_truncate;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
176 vfs_fsize_impl = aud_vfs_fsize;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
177
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
178 aud_vfs_fopen = vt_vfs_fopen_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
179 aud_vfs_fclose = vt_vfs_fclose_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
180 aud_vfs_fread = vt_vfs_fread_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
181 aud_vfs_fwrite = vt_vfs_fwrite_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
182 aud_vfs_getc = vt_vfs_getc_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
183 aud_vfs_ungetc = vt_vfs_ungetc_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
184 aud_vfs_fseek = vt_vfs_fseek_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
185 aud_vfs_rewind = vt_vfs_rewind_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
186 aud_vfs_ftell = vt_vfs_ftell_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
187 aud_vfs_feof = vt_vfs_feof_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
188 aud_vfs_truncate = vt_vfs_truncate_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
189 aud_vfs_fsize = vt_vfs_fsize_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
190 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
191
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
192 void
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
193 unpatch_vfs(void)
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
194 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
195 aud_vfs_fopen = vfs_fopen_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
196 aud_vfs_fclose = vfs_fclose_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
197 aud_vfs_fread = vfs_fread_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
198 aud_vfs_fwrite = vfs_fwrite_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
199 aud_vfs_getc = vfs_getc_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
200 aud_vfs_ungetc = vfs_ungetc_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
201 aud_vfs_fseek = vfs_fseek_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
202 aud_vfs_rewind = vfs_rewind_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
203 aud_vfs_ftell = vfs_ftell_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
204 aud_vfs_feof = vfs_feof_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
205 aud_vfs_truncate = vfs_truncate_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
206 aud_vfs_fsize = vfs_fsize_impl;
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
207 }
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
208
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
209 static GeneralPlugin vfstrace_plugin =
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
210 {
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
211 .description = "VFSTrace",
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
212 .init = patch_vfs,
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
213 .cleanup = unpatch_vfs,
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
214 };
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
215
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
216 GeneralPlugin *vfstrace_gplist[] = { &vfstrace_plugin, NULL };
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
217 SIMPLE_GENERAL_PLUGIN(vfstrace, vfstrace_gplist);
1e48d5a52760 vfstrace: merge plugin
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
218