annotate src/smb/smb.c @ 1954:6acf1bda788b

Removed some extraneous includes.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2007 02:20:03 +0300
parents 7d0062c2e2a4
children e8ea3a76a84e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
1 /* Audacious
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
2 * Copyright (c) 2007 Daniel Bradshaw
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
3 *
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
7 * (at your option) any later version.
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
8 *
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
12 * GNU General Public License for more details.
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
13 *
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
17 */
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
18
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
19 #include <audacious/plugin.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
20 #include <stdio.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
21
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
22 #include <unistd.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
23 #include <sys/stat.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
24 #include <sys/types.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
25
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
26 #include <libsmbclient.h>
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
27
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
28 static void smb_auth_fn(const char *srv,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
29 const char *shr,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
30 char *wg, int wglen,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
31 char *un, int unlen,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
32 char *pw, int pwlen)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
33 {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
34 /* Does absolutely nothing :P */
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
35 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
36
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
37 typedef struct _SMBFile {
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
38 int fd;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
39 long length;
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
40 } SMBFile;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
41
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
42 /* TODO: make writing work. */
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
43 VFSFile *smb_vfs_fopen_impl(const gchar * path, const gchar * mode)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
44 {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
45 VFSFile *file;
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
46 SMBFile *handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
47 struct stat st;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
48
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
49 if (!path || !mode)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
50 return NULL;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
51
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
52 file = g_new0(VFSFile, 1);
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
53 handle = g_new0(SMBFile, 1);
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
54 handle->fd = smbc_open(path, O_RDONLY, 0);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
55
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
56 if (handle->fd < 0) {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
57 g_free(file);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
58 file = NULL;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
59 } else {
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
60 smbc_stat(path,&st);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
61 handle->length = st.st_size;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
62 file->handle = (void *)handle;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
63 }
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
64
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
65 return file;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
66 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
67
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
68 gint smb_vfs_fclose_impl(VFSFile * file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
69 {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
70 gint ret = 0;
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
71 SMBFile *handle;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
72
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
73 if (file == NULL)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
74 return -1;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
75
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
76 if (file->handle)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
77 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
78 handle = (SMBFile *)file->handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
79 if (smbc_close(handle->fd) != 0)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
80 ret = -1;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
81 g_free(file->handle);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
82 }
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
83
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
84 return ret;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
85 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
86
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
87 size_t smb_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
88 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
89 SMBFile *handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
90 if (file == NULL)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
91 return 0;
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
92 handle = (SMBFile *)file->handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
93 return smbc_read(handle->fd, ptr, size * nmemb);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
94 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
95
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
96 size_t smb_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
97 {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
98 return 0;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
99 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
100
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
101 gint smb_vfs_getc_impl(VFSFile *file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
102 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
103 SMBFile *handle;
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
104 char temp;
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
105 handle = (SMBFile *)file->handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
106 smbc_read(handle->fd, &temp, 1);
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
107 return (gint) temp;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
108 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
109
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
110 gint smb_vfs_fseek_impl(VFSFile * file, glong offset, gint whence)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
111 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
112 SMBFile *handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
113 glong roffset = offset;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
114 gint ret = 0;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
115 if (file == NULL)
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
116 return 0;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
117
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
118 handle = (SMBFile *)file->handle;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
119
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
120 if (whence == SEEK_END)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
121 {
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
122 roffset = handle->length + offset;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
123 if (roffset < 0)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
124 roffset = 0;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
125
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
126 ret = smbc_lseek(handle->fd, roffset, SEEK_SET);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
127 //printf("%ld -> %ld = %d\n",offset, roffset, ret);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
128 }
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
129 else
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
130 {
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
131 if (roffset < 0)
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
132 roffset = 0;
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
133 ret = smbc_lseek(handle->fd, roffset, whence);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
134 //printf("%ld %d = %d\n",roffset, whence, ret);
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
135 }
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
136
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
137 return ret;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
138 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
139
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
140 gint smb_vfs_ungetc_impl(gint c, VFSFile *file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
141 {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
142 smb_vfs_fseek_impl(file, -1, SEEK_CUR);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
143 return c;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
144 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
145
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
146 void smb_vfs_rewind_impl(VFSFile * file)
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
147 {
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
148 smb_vfs_fseek_impl(file, 0, SEEK_SET);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
149 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
150
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
151 glong
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
152 smb_vfs_ftell_impl(VFSFile * file)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
153 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
154 SMBFile *handle;
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
155 handle = (SMBFile *)file->handle;
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
156 return smbc_lseek(handle->fd, 0, SEEK_CUR);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
157 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
158
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
159 gboolean
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
160 smb_vfs_feof_impl(VFSFile * file)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
161 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
162 SMBFile *handle;
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
163 off_t at;
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
164
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
165 at = smb_vfs_ftell_impl(file);
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
166
846
76983ca8178a [svn] - Adjust indenting cause the previous indenting was painful
nazca
parents: 845
diff changeset
167 //printf("%d %d %ld %ld\n",sizeof(int), sizeof(off_t), at, handle->length);
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
168 return (gboolean) (at == handle->length) ? TRUE : FALSE;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
169 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
170
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
171 gint
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
172 smb_vfs_truncate_impl(VFSFile * file, glong size)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
173 {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
174 return -1;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
175 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
176
965
ertzing
parents: 873
diff changeset
177 off_t
ertzing
parents: 873
diff changeset
178 smb_vfs_fsize_impl(VFSFile * file)
ertzing
parents: 873
diff changeset
179 {
971
ertzing
parents: 965
diff changeset
180 SMBFile *handle = (SMBFile *)file->handle;
ertzing
parents: 965
diff changeset
181
ertzing
parents: 965
diff changeset
182 return handle->length;
965
ertzing
parents: 873
diff changeset
183 }
ertzing
parents: 873
diff changeset
184
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
185 VFSConstructor smb_const = {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
186 "smb://",
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
187 smb_vfs_fopen_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
188 smb_vfs_fclose_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
189 smb_vfs_fread_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
190 smb_vfs_fwrite_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
191 smb_vfs_getc_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
192 smb_vfs_ungetc_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
193 smb_vfs_fseek_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
194 smb_vfs_rewind_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
195 smb_vfs_ftell_impl,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
196 smb_vfs_feof_impl,
965
ertzing
parents: 873
diff changeset
197 smb_vfs_truncate_impl,
ertzing
parents: 873
diff changeset
198 smb_vfs_fsize_impl
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
199 };
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
200
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
201 static void init(void)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
202 {
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
203 int err;
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
204
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
205 err = smbc_init(smb_auth_fn, 1);
872
ad00b785dec0 [svn] - Slight tweak ... smbc_init returns 0 on sucess, not fail
nazca
parents: 871
diff changeset
206 if (err < 0)
871
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
207 {
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
208 g_message("[smb] not starting samba support due to error code %d", err);
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
209 return;
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
210 }
f51f658b8e9c [svn] - make this work, i think.
nenolod
parents: 846
diff changeset
211
845
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
212 vfs_register_transport(&smb_const);
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
213 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
214
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
215 static void cleanup(void)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
216 {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
217 #if 0
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
218 vfs_unregister_transport(&smb_const);
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
219 #endif
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
220 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
221
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
222 LowlevelPlugin llp_smb = {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
223 NULL,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
224 NULL,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
225 "smb:// URI Transport",
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
226 init,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
227 cleanup,
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
228 };
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
229
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
230 LowlevelPlugin *get_lplugin_info(void)
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
231 {
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
232 return &llp_smb;
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
233 }
71c6cbf25348 [svn] - Prototype smb:// vfs transport. Needs testing.
nazca
parents:
diff changeset
234