diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-10-17 07:26:05 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-12-05 23:51:30 +0000 |
commit | c3b6615e95bd213beab32d90a8bf38f1b221a8b4 (patch) | |
tree | b18ec470be6377b527e603d58ca274bb5c48074d /daemon/gvfsjobopenforwrite.h | |
parent | 444a63d09fdaf4db8124801ec6f4ff26ca3c7c0e (diff) | |
download | gvfs-c3b6615e95bd213beab32d90a8bf38f1b221a8b4.tar.gz |
Implement truncate support for output streams
Backends receive a TRUNCATE message which contains a size parameter.
Truncation is signaled with a TRUNCATED message (which contains no other
useful information).
In more detail:
Add a new dbus method, OpenForWriteFlags, which has a flags parameter to
implement can_seek and can_truncate. These flags are used in
GDaemonFileOutputStream. Compatability with old clients is maintained.
Implement the can_truncate and truncate_fn GDaemonFileOutputStream
methods.
Add two new message types to the daemon socket protocol:
G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_TRUNCATE
G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_TRUNCATED
Add a new job type, GVfsJobTruncate.
Add two new methods to GVfsBackend which backend classes can implement:
truncate and try_truncate
https://bugzilla.gnome.org/show_bug.cgi?id=573837
Diffstat (limited to 'daemon/gvfsjobopenforwrite.h')
-rw-r--r-- | daemon/gvfsjobopenforwrite.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/daemon/gvfsjobopenforwrite.h b/daemon/gvfsjobopenforwrite.h index 79854d23..141189f3 100644 --- a/daemon/gvfsjobopenforwrite.h +++ b/daemon/gvfsjobopenforwrite.h @@ -44,6 +44,11 @@ typedef enum { OPEN_FOR_WRITE_REPLACE = 2 } GVfsJobOpenForWriteMode; +typedef enum { + OPEN_FOR_WRITE_VERSION_ORIGINAL, + OPEN_FOR_WRITE_VERSION_WITH_FLAGS, +} GVfsJobOpenForWriteVersion; + struct _GVfsJobOpenForWrite { GVfsJobDBus parent_instance; @@ -57,11 +62,14 @@ struct _GVfsJobOpenForWrite GVfsBackend *backend; GVfsBackendHandle backend_handle; - gboolean can_seek; + guint can_seek : 1; + guint can_truncate : 1; goffset initial_offset; GVfsWriteChannel *write_channel; GPid pid; + + GVfsJobOpenForWriteVersion version; }; struct _GVfsJobOpenForWriteClass @@ -81,10 +89,22 @@ gboolean g_vfs_job_open_for_write_new_handle (GVfsDBusMount *obj guint arg_flags, guint arg_pid, GVfsBackend *backend); +gboolean g_vfs_job_open_for_write_new_handle_with_flags (GVfsDBusMount *object, + GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, + const gchar *arg_path_data, + guint16 arg_mode, + const gchar *arg_etag, + gboolean arg_make_backup, + guint arg_flags, + guint arg_pid, + GVfsBackend *backend); void g_vfs_job_open_for_write_set_handle (GVfsJobOpenForWrite *job, GVfsBackendHandle handle); void g_vfs_job_open_for_write_set_can_seek (GVfsJobOpenForWrite *job, gboolean can_seek); +void g_vfs_job_open_for_write_set_can_truncate (GVfsJobOpenForWrite *job, + gboolean can_truncate); void g_vfs_job_open_for_write_set_initial_offset (GVfsJobOpenForWrite *job, goffset initial_offset); GPid g_vfs_job_open_for_write_get_pid (GVfsJobOpenForWrite *job); |