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 /common/gvfsdaemonprotocol.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 'common/gvfsdaemonprotocol.h')
-rw-r--r-- | common/gvfsdaemonprotocol.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/gvfsdaemonprotocol.h b/common/gvfsdaemonprotocol.h index 440620b4..e74a5d24 100644 --- a/common/gvfsdaemonprotocol.h +++ b/common/gvfsdaemonprotocol.h @@ -19,6 +19,10 @@ G_BEGIN_DECLS /* Normal ops are faster, one minute timeout */ #define G_VFS_DBUS_TIMEOUT_MSECS (1000*60) +/* Flags for the OpenForWriteFlags method */ +#define OPEN_FOR_WRITE_FLAG_CAN_SEEK (1<<0) +#define OPEN_FOR_WRITE_FLAG_CAN_TRUNCATE (1<<1) + typedef struct { guint32 command; guint32 seq_nr; @@ -36,6 +40,7 @@ typedef struct { #define G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_SEEK_SET 4 #define G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_SEEK_END 5 #define G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_QUERY_INFO 6 +#define G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_TRUNCATE 7 /* read, readahead reply: @@ -67,6 +72,7 @@ typedef struct { #define G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_WRITTEN 3 #define G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_CLOSED 4 #define G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_INFO 5 +#define G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_TRUNCATED 6 typedef union { |