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
|
#pragma once
#include <gio/gio.h>
#include <gio/gunixinputstream.h>
#include <gio/gunixoutputstream.h>
#include <glib.h>
/* These functions can be used by slot and artifact update handlers. */
/**
* Opens a device for writing and returns a GUnixOutputStream for it.
* Optionally, the FD is returned as well.
*
* @param filename the device to be opened
* @param fd the associated file descriptor, for use with ioctls
* @param error return location for a GError, or NULL
*
* @return the new GUnixOutputStream if successful, NULL otherwise
*/
GUnixOutputStream* r_unix_output_stream_open_device(const gchar *filename, int *fd, GError **error)
G_GNUC_WARN_UNUSED_RESULT;
/**
* Creates a file for writing and returns a GUnixOutputStream for it.
* Optionally, the FD is returned as well.
*
* This method ensures that the file is newly created by us.
*
* @param filename the file to be opened
* @param mode the access mode for the new file
* @param fd the associated file descriptor, for use with ioctls
* @param error return location for a GError, or NULL
*
* @return the new GUnixOutputStream if successful, NULL otherwise
*/
GUnixOutputStream* r_unix_output_stream_create_file(const gchar *filename, int *fd, GError **error)
G_GNUC_WARN_UNUSED_RESULT;
/**
* Opens a file for reading and returns a GUnixInputStream for it.
* Optionally, the FD is returned as well.
*
* @param filename the file to be opened
* @param fd the associated file descriptor, for use with ioctls
* @param error return location for a GError, or NULL
*
* @return the new GUnixInputStream if successful, NULL otherwise
*/
GUnixInputStream* r_open_unix_input_stream(const gchar *filename, int *fd, GError **error)
G_GNUC_WARN_UNUSED_RESULT;
/**
* Copies data from an input stream to an output stream, while generating
* progress updates.
*
* @param in_stream input stream
* @param out_stream output stream
* @param size expected size of the data to copy
* @param error return location for a GError, or NULL
*
* @return TRUE if copying was successful, FALSE otherwise
*/
gboolean r_copy_stream_with_progress(GInputStream *in_stream, GOutputStream *out_stream,
goffset size, GError **error)
G_GNUC_WARN_UNUSED_RESULT;
|