[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26265 - in gnunet/src: fs include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26265 - in gnunet/src: fs include |
Date: |
Sun, 3 Mar 2013 02:57:23 +0100 |
Author: LRN
Date: 2013-03-03 02:57:23 +0100 (Sun, 03 Mar 2013)
New Revision: 26265
Modified:
gnunet/src/fs/fs_namespace.c
gnunet/src/include/gnunet_fs_service.h
Log:
GNUNET_FS_namespace_rename
Modified: gnunet/src/fs/fs_namespace.c
===================================================================
--- gnunet/src/fs/fs_namespace.c 2013-03-03 01:57:19 UTC (rev 26264)
+++ gnunet/src/fs/fs_namespace.c 2013-03-03 01:57:23 UTC (rev 26265)
@@ -460,6 +460,43 @@
/**
+ * Rename a local namespace.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param old_name old name of the namespace
+ * @param new_name new name of the namespace
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error (see errno for details)
+ */
+int
+GNUNET_FS_namespace_rename (struct GNUNET_FS_Handle *h, char *old_name, char
*new_name)
+{
+ char *dn;
+ char *fn_old;
+ char *fn_new;
+ int result;
+ int save_errno;
+
+ dn = get_namespace_directory (h);
+ if (NULL == dn)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Can't determine where namespace directory is\n"));
+ return GNUNET_SYSERR;
+ }
+ GNUNET_asprintf (&fn_old, "%s%s%s", dn, DIR_SEPARATOR_STR, old_name);
+ GNUNET_asprintf (&fn_new, "%s%s%s", dn, DIR_SEPARATOR_STR, new_name);
+ GNUNET_free (dn);
+ result = RENAME (fn_old, fn_new);
+ save_errno = errno;
+ GNUNET_free (fn_old);
+ GNUNET_free (fn_new);
+ errno = save_errno;
+ if (result == 0)
+ return GNUNET_OK;
+ return GNUNET_SYSERR;
+}
+
+/**
* Duplicate a namespace handle.
*
* @param ns namespace handle
Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h 2013-03-03 01:57:19 UTC (rev
26264)
+++ gnunet/src/include/gnunet_fs_service.h 2013-03-03 01:57:23 UTC (rev
26265)
@@ -2292,6 +2292,18 @@
/**
+ * Rename a local namespace.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param old_name old name of the namespace
+ * @param new_name new name of the namespace
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error (see errno for details)
+ */
+int
+GNUNET_FS_namespace_rename (struct GNUNET_FS_Handle *h, char *old_name, char
*new_name);
+
+
+/**
* Duplicate a namespace handle.
*
* @param ns namespace handle
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26265 - in gnunet/src: fs include,
gnunet <=