1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef __G_VFS_BACKEND_H__
#define __G_VFS_BACKEND_H__
#include <gio/gio.h>
#include <gvfsdaemon.h>
#include <gvfsjob.h>
#include <gmountspec.h>
G_BEGIN_DECLS
#define G_VFS_TYPE_BACKEND (g_vfs_backend_get_type ())
#define G_VFS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_BACKEND, GVfsBackend))
#define G_VFS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_BACKEND, GVfsBackendClass))
#define G_VFS_IS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_BACKEND))
#define G_VFS_IS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_BACKEND))
#define G_VFS_BACKEND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_BACKEND, GVfsBackendClass))
typedef struct _GVfsBackendPrivate GVfsBackendPrivate;
typedef struct _GVfsBackendClass GVfsBackendClass;
typedef struct _GVfsJobMount GVfsJobMount;
typedef struct _GVfsJobUnmount GVfsJobUnmount;
typedef struct _GVfsJobMountMountable GVfsJobMountMountable;
typedef struct _GVfsJobUnmountMountable GVfsJobUnmountMountable;
typedef struct _GVfsJobStartMountable GVfsJobStartMountable;
typedef struct _GVfsJobStopMountable GVfsJobStopMountable;
typedef struct _GVfsJobPollMountable GVfsJobPollMountable;
typedef struct _GVfsJobOpenForRead GVfsJobOpenForRead;
typedef struct _GVfsJobOpenIconForRead GVfsJobOpenIconForRead;
typedef struct _GVfsJobSeekRead GVfsJobSeekRead;
typedef struct _GVfsJobCloseRead GVfsJobCloseRead;
typedef struct _GVfsJobRead GVfsJobRead;
typedef struct _GVfsJobOpenForWrite GVfsJobOpenForWrite;
typedef struct _GVfsJobWrite GVfsJobWrite;
typedef struct _GVfsJobSeekWrite GVfsJobSeekWrite;
typedef struct _GVfsJobTruncate GVfsJobTruncate;
typedef struct _GVfsJobCloseWrite GVfsJobCloseWrite;
typedef struct _GVfsJobQueryInfo GVfsJobQueryInfo;
typedef struct _GVfsJobQueryInfoRead GVfsJobQueryInfoRead;
typedef struct _GVfsJobQueryInfoWrite GVfsJobQueryInfoWrite;
typedef struct _GVfsJobQueryFsInfo GVfsJobQueryFsInfo;
typedef struct _GVfsJobEnumerate GVfsJobEnumerate;
typedef struct _GVfsJobSetDisplayName GVfsJobSetDisplayName;
typedef struct _GVfsJobTrash GVfsJobTrash;
typedef struct _GVfsJobDelete GVfsJobDelete;
typedef struct _GVfsJobMakeDirectory GVfsJobMakeDirectory;
typedef struct _GVfsJobMakeSymlink GVfsJobMakeSymlink;
typedef struct _GVfsJobCopy GVfsJobCopy;
typedef struct _GVfsJobMove GVfsJobMove;
typedef struct _GVfsJobPush GVfsJobPush;
typedef struct _GVfsJobPull GVfsJobPull;
typedef struct _GVfsJobSetAttribute GVfsJobSetAttribute;
typedef struct _GVfsJobQueryAttributes GVfsJobQueryAttributes;
typedef struct _GVfsJobCreateMonitor GVfsJobCreateMonitor;
typedef struct _GVfsJobError GVfsJobError;
typedef gpointer GVfsBackendHandle;
struct _GVfsBackend
{
GObject parent_instance;
GVfsBackendPrivate *priv;
};
struct _GVfsBackendClass
{
GObjectClass parent_class;
/* vtable */
/* These try_ calls should be fast and non-blocking, scheduling the i/o
* operations async (or on a thread) or reading from cache.
* Returning FALSE means "Can't do this now or async", which
* means the non-try_ version will be scheduled in a worker
* thread.
* A NULL here means operation not supported
*/
void (*unmount) (GVfsBackend *backend,
GVfsJobUnmount *job,
GMountUnmountFlags flags,
GMountSource *mount_source);
gboolean (*try_unmount) (GVfsBackend *backend,
GVfsJobUnmount *job,
GMountUnmountFlags flags,
GMountSource *mount_source);
void (*mount) (GVfsBackend *backend,
GVfsJobMount *job,
GMountSpec *mount_spec,
GMountSource *mount_source,
gboolean is_automount);
gboolean (*try_mount) (GVfsBackend *backend,
GVfsJobMount *job,
GMountSpec *mount_spec,
GMountSource *mount_source,
gboolean is_automount);
void (*mount_mountable) (GVfsBackend *backend,
GVfsJobMountMountable *job,
const char *filename,
GMountSource *mount_source);
gboolean (*try_mount_mountable)(GVfsBackend *backend,
GVfsJobMountMountable *job,
const char *filename,
GMountSource *mount_source);
void (*unmount_mountable) (GVfsBackend *backend,
GVfsJobUnmountMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
gboolean (*try_unmount_mountable)(GVfsBackend *backend,
GVfsJobUnmountMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
void (*eject_mountable) (GVfsBackend *backend,
GVfsJobUnmountMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
gboolean (*try_eject_mountable)(GVfsBackend *backend,
GVfsJobUnmountMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
void (*open_for_read) (GVfsBackend *backend,
GVfsJobOpenForRead *job,
const char *filename);
gboolean (*try_open_for_read) (GVfsBackend *backend,
GVfsJobOpenForRead *job,
const char *filename);
void (*open_icon_for_read) (GVfsBackend *backend,
GVfsJobOpenIconForRead *job,
const char *icon_id);
gboolean (*try_open_icon_for_read) (GVfsBackend *backend,
GVfsJobOpenIconForRead *job,
const char *icon_id);
void (*close_read) (GVfsBackend *backend,
GVfsJobCloseRead *job,
GVfsBackendHandle handle);
gboolean (*try_close_read) (GVfsBackend *backend,
GVfsJobCloseRead *job,
GVfsBackendHandle handle);
void (*read) (GVfsBackend *backend,
GVfsJobRead *job,
GVfsBackendHandle handle,
char *buffer,
gsize bytes_requested);
gboolean (*try_read) (GVfsBackend *backend,
GVfsJobRead *job,
GVfsBackendHandle handle,
char *buffer,
gsize bytes_requested);
void (*seek_on_read) (GVfsBackend *backend,
GVfsJobSeekRead *job,
GVfsBackendHandle handle,
goffset offset,
GSeekType type);
gboolean (*try_seek_on_read) (GVfsBackend *backend,
GVfsJobSeekRead *job,
GVfsBackendHandle handle,
goffset offset,
GSeekType type);
gboolean (*try_create) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
GFileCreateFlags flags);
void (*create) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
GFileCreateFlags flags);
gboolean (*try_append_to) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
GFileCreateFlags flags);
void (*append_to) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
GFileCreateFlags flags);
gboolean (*try_replace) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
const char *etag,
gboolean make_backup,
GFileCreateFlags flags);
void (*replace) (GVfsBackend *backend,
GVfsJobOpenForWrite *job,
const char *filename,
const char *etag,
gboolean make_backup,
GFileCreateFlags flags);
void (*close_write) (GVfsBackend *backend,
GVfsJobCloseWrite *job,
GVfsBackendHandle handle);
gboolean (*try_close_write) (GVfsBackend *backend,
GVfsJobCloseWrite *job,
GVfsBackendHandle handle);
void (*write) (GVfsBackend *backend,
GVfsJobWrite *job,
GVfsBackendHandle handle,
char *buffer,
gsize buffer_size);
gboolean (*try_write) (GVfsBackend *backend,
GVfsJobWrite *job,
GVfsBackendHandle handle,
char *buffer,
gsize buffer_size);
void (*seek_on_write) (GVfsBackend *backend,
GVfsJobSeekWrite *job,
GVfsBackendHandle handle,
goffset offset,
GSeekType type);
gboolean (*try_seek_on_write) (GVfsBackend *backend,
GVfsJobSeekWrite *job,
GVfsBackendHandle handle,
goffset offset,
GSeekType type);
void (*truncate) (GVfsBackend *backend,
GVfsJobTruncate *job,
GVfsBackendHandle handle,
goffset size);
gboolean (*try_truncate) (GVfsBackend *backend,
GVfsJobTruncate *job,
GVfsBackendHandle handle,
goffset size);
void (*query_info) (GVfsBackend *backend,
GVfsJobQueryInfo *job,
const char *filename,
GFileQueryInfoFlags flags,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
gboolean (*try_query_info) (GVfsBackend *backend,
GVfsJobQueryInfo *job,
const char *filename,
GFileQueryInfoFlags flags,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
void (*query_info_on_read)(GVfsBackend *backend,
GVfsJobQueryInfoRead *job,
GVfsBackendHandle handle,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
gboolean (*try_query_info_on_read)(GVfsBackend *backend,
GVfsJobQueryInfoRead *job,
GVfsBackendHandle handle,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
void (*query_info_on_write)(GVfsBackend *backend,
GVfsJobQueryInfoWrite *job,
GVfsBackendHandle handle,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
gboolean (*try_query_info_on_write)(GVfsBackend *backend,
GVfsJobQueryInfoWrite *job,
GVfsBackendHandle handle,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
void (*query_fs_info) (GVfsBackend *backend,
GVfsJobQueryFsInfo *job,
const char *filename,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
gboolean (*try_query_fs_info) (GVfsBackend *backend,
GVfsJobQueryFsInfo *job,
const char *filename,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher);
void (*enumerate) (GVfsBackend *backend,
GVfsJobEnumerate *job,
const char *filename,
GFileAttributeMatcher *attribute_matcher,
GFileQueryInfoFlags flags);
gboolean (*try_enumerate) (GVfsBackend *backend,
GVfsJobEnumerate *job,
const char *filename,
GFileAttributeMatcher *attribute_matcher,
GFileQueryInfoFlags flags);
void (*set_display_name) (GVfsBackend *backend,
GVfsJobSetDisplayName *job,
const char *filename,
const char *display_name);
gboolean (*try_set_display_name) (GVfsBackend *backend,
GVfsJobSetDisplayName *job,
const char *filename,
const char *display_name);
void (*delete) (GVfsBackend *backend,
GVfsJobDelete *job,
const char *filename);
gboolean (*try_delete) (GVfsBackend *backend,
GVfsJobDelete *job,
const char *filename);
void (*trash) (GVfsBackend *backend,
GVfsJobTrash *job,
const char *filename);
gboolean (*try_trash) (GVfsBackend *backend,
GVfsJobTrash *job,
const char *filename);
void (*make_directory) (GVfsBackend *backend,
GVfsJobMakeDirectory *job,
const char *filename);
gboolean (*try_make_directory)(GVfsBackend *backend,
GVfsJobMakeDirectory *job,
const char *filename);
void (*make_symlink) (GVfsBackend *backend,
GVfsJobMakeSymlink *make_symlink,
const char *filename,
const char *symlink_value);
gboolean (*try_make_symlink) (GVfsBackend *backend,
GVfsJobMakeSymlink *make_symlink,
const char *filename,
const char *symlink_value);
void (*copy) (GVfsBackend *backend,
GVfsJobCopy *job,
const char *source,
const char *destination,
GFileCopyFlags flags,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
gboolean (*try_copy) (GVfsBackend *backend,
GVfsJobCopy *job,
const char *source,
const char *destination,
GFileCopyFlags flags,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
void (*move) (GVfsBackend *backend,
GVfsJobMove *job,
const char *source,
const char *destination,
GFileCopyFlags flags,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
gboolean (*try_move) (GVfsBackend *backend,
GVfsJobMove *job,
const char *source,
const char *destination,
GFileCopyFlags flags,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
void (*push) (GVfsBackend *backend,
GVfsJobPush *job,
const char *destination,
const char *local_path,
GFileCopyFlags flags,
gboolean remove_source,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
gboolean (*try_push) (GVfsBackend *backend,
GVfsJobPush *job,
const char *destination,
const char *local_path,
GFileCopyFlags flags,
gboolean remove_source,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
void (*pull) (GVfsBackend *backend,
GVfsJobPull *job,
const char *source,
const char *local_path,
GFileCopyFlags flags,
gboolean remove_source,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
gboolean (*try_pull) (GVfsBackend *backend,
GVfsJobPull *job,
const char *source,
const char *local_path,
GFileCopyFlags flags,
gboolean remove_source,
GFileProgressCallback progress_callback,
gpointer progress_callback_data);
void (*set_attribute) (GVfsBackend *backend,
GVfsJobSetAttribute *set_attribute,
const char *filename,
const char *attribute,
GFileAttributeType type,
gpointer value_p,
GFileQueryInfoFlags flags);
gboolean (*try_set_attribute) (GVfsBackend *backend,
GVfsJobSetAttribute *set_attribute,
const char *filename,
const char *attribute,
GFileAttributeType type,
gpointer value_p,
GFileQueryInfoFlags flags);
void (*create_dir_monitor)(GVfsBackend *backend,
GVfsJobCreateMonitor *job,
const char *filename,
GFileMonitorFlags flags);
gboolean (*try_create_dir_monitor) (GVfsBackend *backend,
GVfsJobCreateMonitor *job,
const char *filename,
GFileMonitorFlags flags);
void (*create_file_monitor)(GVfsBackend *backend,
GVfsJobCreateMonitor *job,
const char *filename,
GFileMonitorFlags flags);
gboolean (*try_create_file_monitor) (GVfsBackend *backend,
GVfsJobCreateMonitor *job,
const char *filename,
GFileMonitorFlags flags);
void (*query_settable_attributes) (GVfsBackend *backend,
GVfsJobQueryAttributes *job,
const char *filename);
gboolean (*try_query_settable_attributes) (GVfsBackend *backend,
GVfsJobQueryAttributes *job,
const char *filename);
void (*query_writable_namespaces) (GVfsBackend *backend,
GVfsJobQueryAttributes *job,
const char *filename);
gboolean (*try_query_writable_namespaces) (GVfsBackend *backend,
GVfsJobQueryAttributes *job,
const char *filename);
void (*start_mountable) (GVfsBackend *backend,
GVfsJobStartMountable *job,
const char *filename,
GMountSource *mount_source);
gboolean (*try_start_mountable) (GVfsBackend *backend,
GVfsJobStartMountable *job,
const char *filename,
GMountSource *mount_source);
void (*stop_mountable) (GVfsBackend *backend,
GVfsJobStopMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
gboolean (*try_stop_mountable) (GVfsBackend *backend,
GVfsJobStopMountable *job,
const char *filename,
GMountUnmountFlags flags,
GMountSource *mount_source);
void (*poll_mountable) (GVfsBackend *backend,
GVfsJobPollMountable *job,
const char *filename);
gboolean (*try_poll_mountable) (GVfsBackend *backend,
GVfsJobPollMountable *job,
const char *filename);
};
GType g_vfs_backend_get_type (void) G_GNUC_CONST;
void g_vfs_register_backend (GType backend_type,
const char *type);
GType g_vfs_lookup_backend (const char *type);
void g_vfs_backend_set_display_name (GVfsBackend *backend,
const char *display_name);
void g_vfs_backend_set_stable_name (GVfsBackend *backend,
const char *stable_name);
void g_vfs_backend_set_x_content_types (GVfsBackend *backend,
char **x_content_types);
void g_vfs_backend_set_icon_name (GVfsBackend *backend,
const char *icon_name);
void g_vfs_backend_set_icon (GVfsBackend *backend,
GIcon *icon);
void g_vfs_backend_set_symbolic_icon_name (GVfsBackend *backend,
const char *icon_name);
void g_vfs_backend_set_symbolic_icon (GVfsBackend *backend,
GIcon *icon);
void g_vfs_backend_set_prefered_filename_encoding (GVfsBackend *backend,
const char *prefered_filename_encoding);
void g_vfs_backend_set_user_visible (GVfsBackend *backend,
gboolean user_visible);
void g_vfs_backend_set_default_location (GVfsBackend *backend,
const char *location);
void g_vfs_backend_set_mount_spec (GVfsBackend *backend,
GMountSpec *mount_spec);
void g_vfs_backend_register_mount (GVfsBackend *backend,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_vfs_backend_register_mount_finish (GVfsBackend *backend,
GAsyncResult *res,
GError **error);
void g_vfs_backend_unregister_mount (GVfsBackend *backend,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_vfs_backend_unregister_mount_finish (GVfsBackend *backend,
GAsyncResult *res,
GError **error);
const char *g_vfs_backend_get_backend_type (GVfsBackend *backend);
const char *g_vfs_backend_get_display_name (GVfsBackend *backend);
const char *g_vfs_backend_get_stable_name (GVfsBackend *backend);
char **g_vfs_backend_get_x_content_types (GVfsBackend *backend);
GIcon *g_vfs_backend_get_icon (GVfsBackend *backend);
GIcon *g_vfs_backend_get_symbolic_icon (GVfsBackend *backend);
const char *g_vfs_backend_get_default_location (GVfsBackend *backend);
GMountSpec *g_vfs_backend_get_mount_spec (GVfsBackend *backend);
GVfsDaemon *g_vfs_backend_get_daemon (GVfsBackend *backend);
gboolean g_vfs_backend_is_mounted (GVfsBackend *backend);
void g_vfs_backend_force_unmount (GVfsBackend *backend);
void g_vfs_backend_add_auto_info (GVfsBackend *backend,
GFileAttributeMatcher *matcher,
GFileInfo *info,
const char *uri);
void g_vfs_backend_add_auto_fs_info (GVfsBackend *backend,
GFileAttributeMatcher *matcher,
GFileInfo *info);
void g_vfs_backend_set_block_requests (GVfsBackend *backend,
gboolean value);
gboolean g_vfs_backend_get_block_requests (GVfsBackend *backend);
gboolean g_vfs_backend_unmount_with_operation_finish (GVfsBackend *backend,
GAsyncResult *res,
GError **error);
void g_vfs_backend_unmount_with_operation (GVfsBackend *backend,
GMountSource *mount_source,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_vfs_backend_invocation_first_handler (GVfsDBusMount *object,
GDBusMethodInvocation *invocation,
GVfsBackend *backend);
void g_vfs_backend_handle_readonly_lockdown (GVfsBackend *backend);
gboolean g_vfs_backend_get_readonly_lockdown (GVfsBackend *backend);
G_END_DECLS
#endif /* __G_VFS_BACKEND_H__ */
|