comparison src/smb/smb.c @ 1978:fa9f85cebade

s/vfs_/aud_vfs_/g
author William Pitcock <nenolod@atheme.org>
date Sun, 07 Oct 2007 00:25:33 -0500
parents e8ea3a76a84e
children 3134a0987162
comparison
equal deleted inserted replaced
1977:5a6b60ceaa0f 1978:fa9f85cebade
39 int fd; 39 int fd;
40 long length; 40 long length;
41 } SMBFile; 41 } SMBFile;
42 42
43 /* TODO: make writing work. */ 43 /* TODO: make writing work. */
44 VFSFile *smb_vfs_fopen_impl(const gchar * path, const gchar * mode) 44 VFSFile *smb_aud_vfs_fopen_impl(const gchar * path, const gchar * mode)
45 { 45 {
46 VFSFile *file; 46 VFSFile *file;
47 SMBFile *handle; 47 SMBFile *handle;
48 struct stat st; 48 struct stat st;
49 49
64 } 64 }
65 65
66 return file; 66 return file;
67 } 67 }
68 68
69 gint smb_vfs_fclose_impl(VFSFile * file) 69 gint smb_aud_vfs_fclose_impl(VFSFile * file)
70 { 70 {
71 gint ret = 0; 71 gint ret = 0;
72 SMBFile *handle; 72 SMBFile *handle;
73 73
74 if (file == NULL) 74 if (file == NULL)
83 } 83 }
84 84
85 return ret; 85 return ret;
86 } 86 }
87 87
88 size_t smb_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file) 88 size_t smb_aud_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file)
89 { 89 {
90 SMBFile *handle; 90 SMBFile *handle;
91 if (file == NULL) 91 if (file == NULL)
92 return 0; 92 return 0;
93 handle = (SMBFile *)file->handle; 93 handle = (SMBFile *)file->handle;
94 return smbc_read(handle->fd, ptr, size * nmemb); 94 return smbc_read(handle->fd, ptr, size * nmemb);
95 } 95 }
96 96
97 size_t smb_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file) 97 size_t smb_aud_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file)
98 { 98 {
99 return 0; 99 return 0;
100 } 100 }
101 101
102 gint smb_vfs_getc_impl(VFSFile *file) 102 gint smb_aud_vfs_getc_impl(VFSFile *file)
103 { 103 {
104 SMBFile *handle; 104 SMBFile *handle;
105 char temp; 105 char temp;
106 handle = (SMBFile *)file->handle; 106 handle = (SMBFile *)file->handle;
107 smbc_read(handle->fd, &temp, 1); 107 smbc_read(handle->fd, &temp, 1);
108 return (gint) temp; 108 return (gint) temp;
109 } 109 }
110 110
111 gint smb_vfs_fseek_impl(VFSFile * file, glong offset, gint whence) 111 gint smb_aud_vfs_fseek_impl(VFSFile * file, glong offset, gint whence)
112 { 112 {
113 SMBFile *handle; 113 SMBFile *handle;
114 glong roffset = offset; 114 glong roffset = offset;
115 gint ret = 0; 115 gint ret = 0;
116 if (file == NULL) 116 if (file == NULL)
136 } 136 }
137 137
138 return ret; 138 return ret;
139 } 139 }
140 140
141 gint smb_vfs_ungetc_impl(gint c, VFSFile *file) 141 gint smb_aud_vfs_ungetc_impl(gint c, VFSFile *file)
142 { 142 {
143 smb_vfs_fseek_impl(file, -1, SEEK_CUR); 143 smb_aud_vfs_fseek_impl(file, -1, SEEK_CUR);
144 return c; 144 return c;
145 } 145 }
146 146
147 void smb_vfs_rewind_impl(VFSFile * file) 147 void smb_aud_vfs_rewind_impl(VFSFile * file)
148 { 148 {
149 smb_vfs_fseek_impl(file, 0, SEEK_SET); 149 smb_aud_vfs_fseek_impl(file, 0, SEEK_SET);
150 } 150 }
151 151
152 glong 152 glong
153 smb_vfs_ftell_impl(VFSFile * file) 153 smb_aud_vfs_ftell_impl(VFSFile * file)
154 { 154 {
155 SMBFile *handle; 155 SMBFile *handle;
156 handle = (SMBFile *)file->handle; 156 handle = (SMBFile *)file->handle;
157 return smbc_lseek(handle->fd, 0, SEEK_CUR); 157 return smbc_lseek(handle->fd, 0, SEEK_CUR);
158 } 158 }
159 159
160 gboolean 160 gboolean
161 smb_vfs_feof_impl(VFSFile * file) 161 smb_aud_vfs_feof_impl(VFSFile * file)
162 { 162 {
163 SMBFile *handle; 163 SMBFile *handle;
164 off_t at; 164 off_t at;
165 165
166 at = smb_vfs_ftell_impl(file); 166 at = smb_aud_vfs_ftell_impl(file);
167 167
168 //printf("%d %d %ld %ld\n",sizeof(int), sizeof(off_t), at, handle->length); 168 //printf("%d %d %ld %ld\n",sizeof(int), sizeof(off_t), at, handle->length);
169 return (gboolean) (at == handle->length) ? TRUE : FALSE; 169 return (gboolean) (at == handle->length) ? TRUE : FALSE;
170 } 170 }
171 171
172 gint 172 gint
173 smb_vfs_truncate_impl(VFSFile * file, glong size) 173 smb_aud_vfs_truncate_impl(VFSFile * file, glong size)
174 { 174 {
175 return -1; 175 return -1;
176 } 176 }
177 177
178 off_t 178 off_t
179 smb_vfs_fsize_impl(VFSFile * file) 179 smb_aud_vfs_fsize_impl(VFSFile * file)
180 { 180 {
181 SMBFile *handle = (SMBFile *)file->handle; 181 SMBFile *handle = (SMBFile *)file->handle;
182 182
183 return handle->length; 183 return handle->length;
184 } 184 }
185 185
186 VFSConstructor smb_const = { 186 VFSConstructor smb_const = {
187 "smb://", 187 "smb://",
188 smb_vfs_fopen_impl, 188 smb_aud_vfs_fopen_impl,
189 smb_vfs_fclose_impl, 189 smb_aud_vfs_fclose_impl,
190 smb_vfs_fread_impl, 190 smb_aud_vfs_fread_impl,
191 smb_vfs_fwrite_impl, 191 smb_aud_vfs_fwrite_impl,
192 smb_vfs_getc_impl, 192 smb_aud_vfs_getc_impl,
193 smb_vfs_ungetc_impl, 193 smb_aud_vfs_ungetc_impl,
194 smb_vfs_fseek_impl, 194 smb_aud_vfs_fseek_impl,
195 smb_vfs_rewind_impl, 195 smb_aud_vfs_rewind_impl,
196 smb_vfs_ftell_impl, 196 smb_aud_vfs_ftell_impl,
197 smb_vfs_feof_impl, 197 smb_aud_vfs_feof_impl,
198 smb_vfs_truncate_impl, 198 smb_aud_vfs_truncate_impl,
199 smb_vfs_fsize_impl 199 smb_aud_vfs_fsize_impl
200 }; 200 };
201 201
202 static void init(void) 202 static void init(void)
203 { 203 {
204 int err; 204 int err;
208 { 208 {
209 g_message("[smb] not starting samba support due to error code %d", err); 209 g_message("[smb] not starting samba support due to error code %d", err);
210 return; 210 return;
211 } 211 }
212 212
213 vfs_register_transport(&smb_const); 213 aud_vfs_register_transport(&smb_const);
214 } 214 }
215 215
216 static void cleanup(void) 216 static void cleanup(void)
217 { 217 {
218 #if 0 218 #if 0
219 vfs_unregister_transport(&smb_const); 219 aud_vfs_unregister_transport(&smb_const);
220 #endif 220 #endif
221 } 221 }
222 222
223 LowlevelPlugin llp_smb = { 223 LowlevelPlugin llp_smb = {
224 NULL, 224 NULL,