fast timeout on disconnect
[oweals/gnunet.git] / src / include / gnunet_disk_lib.h
index 38b5df9c60ed13d7a7de99b5ec430973166ccfa6..340c35a4e5cb8019cc0639b098f3042f230f2f4d 100644 (file)
@@ -288,12 +288,15 @@ int GNUNET_DISK_file_size (const char *filename,
  * @return GNUNET_OK on success
  */
 int GNUNET_DISK_file_get_identifiers (const char *filename,
-                                     uint32_t *dev,
+                                     uint64_t *dev,
                                      uint64_t *ino);
  
 
 /**
- * Create an (empty) temporary file on disk.
+ * 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/".
@@ -312,7 +315,7 @@ GNUNET_DISK_mktemp (const char *t);
  * @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_USER_NONE if a file could not be created by this
+ *             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
  */
@@ -327,6 +330,7 @@ struct GNUNET_DISK_FileHandle *GNUNET_DISK_file_open (const char *fn,
  */
 struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking);
 
+
 /**
  * Closes an interprocess channel
  * @param p pipe
@@ -334,6 +338,17 @@ struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking);
  */
 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);
+
 /**
  * Close an open file.
  *
@@ -342,8 +357,10 @@ int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
  */
 int GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h);
 
+
 /**
  * Get the handle to a particular pipe end
+ *
  * @param p pipe
  * @param n end to access
  * @return handle for the respective end
@@ -384,7 +401,7 @@ ssize_t GNUNET_DISK_fn_read (const char *fn,
  * @param h handle to open file
  * @param buffer the data to write
  * @param n number of bytes to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return number of bytes written on success, GNUNET_SYSERR on error
  */
 ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, 
                                const void *buffer,
@@ -441,7 +458,8 @@ struct GNUNET_DISK_DirectoryIterator;
  *
  * @param cls closure
  * @param di argument to pass to "GNUNET_DISK_directory_iterator_next" to
- *           get called on the next entry (or finish cleanly)
+ *           get called on the next entry (or finish cleanly);
+ *           NULL on error (will be the last call in that case)
  * @param filename complete filename (absolute path)
  * @param dirname directory name (absolute path)
  */
@@ -548,8 +566,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart,
 /**
  * Unlock a part of a file
  * @param fh file handle
- * @param lockStart absolute position from where to unlock
- * @param lockEnd absolute position until where to unlock
+ * @param unlockStart absolute position from where to unlock
+ * @param unlockEnd absolute position until where to unlock
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
@@ -582,7 +600,7 @@ int GNUNET_DISK_file_change_owner (const char *filename, const char *user);
  *
  * @param cfg configuration to use
  * @param serviceName name of the service asking
- * @param varargs is NULL-terminated list of
+ * @param ... is NULL-terminated list of
  *                path components to append to the
  *                private directory name.
  * @return the constructed filename