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/gvfsbackend.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/gvfsbackend.h')
-rw-r--r-- | daemon/gvfsbackend.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/daemon/gvfsbackend.h b/daemon/gvfsbackend.h index 45ec4fb7..8e7ba551 100644 --- a/daemon/gvfsbackend.h +++ b/daemon/gvfsbackend.h @@ -55,6 +55,7 @@ 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; @@ -236,6 +237,14 @@ struct _GVfsBackendClass 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, |