+ * @param single_file_mode #GNUNET_YES to only get size of one file
+ * and return #GNUNET_SYSERR for directories.
+ * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
+ */
+int
+GNUNET_DISK_file_size (const char *filename, uint64_t *size,
+ int include_symbolic_links,
+ int single_file_mode);
+
+
+/**
+ * Obtain some unique identifiers for the given file
+ * that can be used to identify it in the local system.
+ * This function is used between GNUnet processes to
+ * quickly check if two files with the same absolute path
+ * are actually identical. The two processes represent
+ * the same peer but may communicate over the network
+ * (and the file may be on an NFS volume). This function
+ * may not be supported on all operating systems.
+ *
+ * @param filename name of the file
+ * @param dev set to the device ID
+ * @param ino set to the inode ID
+ * @return #GNUNET_OK on success
+ */
+int
+GNUNET_DISK_file_get_identifiers (const char *filename,
+ uint64_t *dev,
+ uint64_t *ino);
+
+
+/**
+ * Create an (empty) temporary file on disk. If the given name is not
+ * an absolute path, the current 'TMPDIR' will be prepended. In any case,
+ * 6 random characters will be appended to the name to create a unique
+ * filename.
+ *
+ * @param t component to use for the name;
+ * does NOT contain "XXXXXX" or "/tmp/".
+ * @return NULL on error, otherwise name of fresh
+ * file on disk in directory for temporary files
+ */
+char *
+GNUNET_DISK_mktemp (const char *t);
+
+
+/**
+ * Create an (empty) temporary directory on disk. If the given name is not an
+ * absolute path, the current 'TMPDIR' will be prepended. In any case, 6
+ * random characters will be appended to the name to create a unique name.
+ *
+ * @param t component to use for the name;
+ * does NOT contain "XXXXXX" or "/tmp/".
+ * @return NULL on error, otherwise name of freshly created directory
+ */
+char *
+GNUNET_DISK_mkdtemp (const char *t);
+
+
+/**
+ * Open a file. Note that the access permissions will only be
+ * used if a new file is created and if the underlying operating
+ * system supports the given permissions.
+ *
+ * @param fn file name to be opened
+ * @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit flags
+ * @param perm permissions for the newly created file, use
+ * #GNUNET_DISK_PERM_NONE if a file could not be created by this
+ * call (because of flags)
+ * @return IO handle on success, NULL on error
+ */
+struct GNUNET_DISK_FileHandle *
+GNUNET_DISK_file_open (const char *fn,
+ enum GNUNET_DISK_OpenFlags flags,
+ enum GNUNET_DISK_AccessPermissions perm);
+
+
+/**
+ * Get the size of an open file.
+ *
+ * @param fh open file handle
+ * @param size where to write size of the file
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+int
+GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
+ off_t *size);
+
+
+/**
+ * Creates an interprocess channel
+ *
+ * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO
+ * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO
+ * @param inherit_read 1 to make read handle inheritable, 0 otherwise (NT only)
+ * @param inherit_write 1 to make write handle inheritable, 0 otherwise (NT only)
+ * @return handle to the new pipe, NULL on error
+ */
+struct GNUNET_DISK_PipeHandle *
+GNUNET_DISK_pipe (int blocking_read,
+ int blocking_write,
+ int inherit_read,
+ int inherit_write);
+
+
+/**
+ * Creates a pipe object from a couple of file descriptors.
+ * Useful for wrapping existing pipe FDs.
+ *
+ * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO
+ * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO
+ * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes
+ *
+ * @return handle to the new pipe, NULL on error
+ */
+struct GNUNET_DISK_PipeHandle *
+GNUNET_DISK_pipe_from_fd (int blocking_read,
+ int blocking_write,
+ int fd[2]);
+
+
+/**
+ * Closes an interprocess channel
+ * @param p pipe
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
+
+
+/**
+ * Closes one half of an interprocess channel
+ *
+ * @param p pipe to close end of
+ * @param end which end of the pipe to close
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
+ enum GNUNET_DISK_PipeEnd end);
+
+
+/**
+ * Detaches one of the ends from the pipe.
+ * Detached end is a fully-functional FileHandle, it will
+ * not be affected by anything you do with the pipe afterwards.
+ * Each end of a pipe can only be detched from it once (i.e.
+ * it is not duplicated).
+ *
+ * @param p pipe to detach an end from
+ * @param end which end of the pipe to detach
+ * @return Detached end on success, NULL on failure
+ * (or if that end is not present or is closed).
+ */
+struct GNUNET_DISK_FileHandle *
+GNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p,
+ enum GNUNET_DISK_PipeEnd end);
+
+/**
+ * Close an open file.