[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11120 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11120 - gnunet/src/fs |
Date: |
Thu, 29 Apr 2010 23:52:48 +0200 |
Author: grothoff
Date: 2010-04-29 23:52:48 +0200 (Thu, 29 Apr 2010)
New Revision: 11120
Modified:
gnunet/src/fs/fs.c
gnunet/src/fs/fs.h
gnunet/src/fs/fs_file_information.c
gnunet/src/fs/fs_publish.c
Log:
cleaning up FileInformation struct
Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c 2010-04-29 20:05:06 UTC (rev 11119)
+++ gnunet/src/fs/fs.c 2010-04-29 21:52:48 UTC (rev 11120)
@@ -284,6 +284,22 @@
* @return NULL on error
*/
static struct GNUNET_FS_FileInformation *
+deserialize_fi_node (struct GNUNET_BIO_ReadHandle *rh)
+{
+ return NULL;
+}
+
+
+/**
+ * Using the given serialization filename, try to deserialize
+ * the file-information tree associated with it.
+ *
+ * @param h master context
+ * @param filename name of the file (without directory) with
+ * the infromation
+ * @return NULL on error
+ */
+static struct GNUNET_FS_FileInformation *
deserialize_file_information (struct GNUNET_FS_Handle *h,
const char *filename)
{
@@ -294,10 +310,7 @@
rh = get_read_handle (h, "publish-fi", filename);
if (rh == NULL)
return NULL;
-
- ret = NULL;
- /* FIXME: not implemented! */
-
+ ret = deserialize_fi_node (rh);
if (GNUNET_OK !=
GNUNET_BIO_read_close (rh, &emsg))
{
Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h 2010-04-29 20:05:06 UTC (rev 11119)
+++ gnunet/src/fs/fs.h 2010-04-29 21:52:48 UTC (rev 11120)
@@ -349,6 +349,11 @@
char *serialization_name;
/**
+ * Name of the file or directory (must be an absolute path).
+ */
+ char *filename;
+
+ /**
* Data describing either the file or the directory.
*/
union
@@ -370,16 +375,8 @@
void *reader_cls;
/**
- * Name of the file (must be an absolute path).
- * Only required for indexing. FIXME: not yet
- * initialized!
- */
- char *filename;
-
- /**
- * If this file is being indexed, this value
- * is set to the hash over the entire file
- * (when the indexing process is started).
+ * If this file is being indexed, this value is set to the hash
+ * over the entire file (when the indexing process is started).
* Otherwise this field is not used.
*/
GNUNET_HashCode file_id;
@@ -395,8 +392,8 @@
int do_index;
/**
- * Is "file_id" already valid? Set to GNUNET_YES
- * once the hash has been calculated.
+ * Is "file_id" already valid? Set to GNUNET_YES once the hash
+ * has been calculated.
*/
int have_hash;
@@ -414,11 +411,6 @@
struct {
/**
- * Name of the directory.
- */
- char *dirname;
-
- /**
* Linked list of entries in the directory.
*/
struct GNUNET_FS_FileInformation *entries;
Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2010-04-29 20:05:06 UTC (rev 11119)
+++ gnunet/src/fs/fs_file_information.c 2010-04-29 21:52:48 UTC (rev 11120)
@@ -231,7 +231,7 @@
anonymity,
priority,
expirationTime);
- ret->data.file.filename = GNUNET_strdup (filename);
+ ret->filename = GNUNET_strdup (filename);
fn = filename;
while (NULL != (ss = strstr (fn,
DIR_SEPARATOR_STR)))
@@ -677,7 +677,7 @@
"text/plain",
fn,
strlen (fn) + 1);
- ret->data.dir.dirname = GNUNET_strdup (filename);
+ ret->filename = GNUNET_strdup (filename);
GNUNET_FS_file_information_sync (ret);
return ret;
}
@@ -845,7 +845,6 @@
&fi->expirationTime,
&fi->client_info);
GNUNET_free_non_null (fi->data.dir.dir_data);
- GNUNET_free_non_null (fi->data.dir.dirname);
}
else
{
@@ -863,6 +862,7 @@
&fi->expirationTime,
&fi->client_info);
}
+ GNUNET_free_non_null (fi->filename);
GNUNET_free_non_null (fi->serialization);
GNUNET_free_non_null (fi->emsg);
GNUNET_free_non_null (fi->chk_uri);
Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c 2010-04-29 20:05:06 UTC (rev 11119)
+++ gnunet/src/fs/fs_publish.c 2010-04-29 21:52:48 UTC (rev 11120)
@@ -92,9 +92,8 @@
= p->client_info;
pi->value.publish.pctx
= (NULL == p->dir) ? NULL : p->dir->client_info;
- pi->value.publish.filename
- = (p->is_directory) ? p->data.dir.dirname : p->data.file.filename;
- pi->value.publish.size
+ pi->value.publish.filename = p->filename;
+ pi->value.publish.size
= (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size;
pi->value.publish.eta
= GNUNET_TIME_calculate_eta (p->start_time,
@@ -642,7 +641,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Can not index file `%s': %s. Will try to insert
instead.\n"),
- p->data.file.filename,
+ p->filename,
_("timeout on index-start request to `fs' service"));
p->data.file.do_index = GNUNET_NO;
publish_content (sc);
@@ -657,7 +656,7 @@
emsg = gettext_noop ("unknown error");
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Can not index file `%s': %s. Will try to insert
instead.\n"),
- p->data.file.filename,
+ p->filename,
gettext (emsg));
p->data.file.do_index = GNUNET_NO;
publish_content (sc);
@@ -695,7 +694,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Can not index file `%s': %s. Will try to insert
instead.\n"),
- p->data.file.filename,
+ p->filename,
_("failed to compute hash"));
p->data.file.do_index = GNUNET_NO;
publish_content (sc);
@@ -706,7 +705,7 @@
publish_content (sc);
return;
}
- fn = GNUNET_STRINGS_filename_expand (p->data.file.filename);
+ fn = GNUNET_STRINGS_filename_expand (p->filename);
slen = strlen (fn) + 1;
if (slen > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage))
{
@@ -732,7 +731,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Can not index file `%s': %s. Will try to insert
instead.\n"),
- p->data.file.filename,
+ p->filename,
_("could not connect to `fs' service"));
p->data.file.do_index = GNUNET_NO;
publish_content (sc);
@@ -747,7 +746,7 @@
slen);
ism->header.type = htons(GNUNET_MESSAGE_TYPE_FS_INDEX_START);
if (GNUNET_OK ==
- GNUNET_DISK_file_get_identifiers (p->data.file.filename,
+ GNUNET_DISK_file_get_identifiers (p->filename,
&dev,
&ino))
{
@@ -758,7 +757,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Failed to get file identifiers for `%s'\n"),
- p->data.file.filename);
+ p->filename);
}
ism->file_id = *res;
memcpy (&ism[1],
@@ -871,7 +870,7 @@
if ( (!p->is_directory) &&
(p->data.file.do_index) )
{
- if (NULL == p->data.file.filename)
+ if (NULL == p->filename)
{
p->data.file.do_index = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -889,7 +888,7 @@
p->start_time = GNUNET_TIME_absolute_get ();
GNUNET_CRYPTO_hash_file (sc->h->sched,
GNUNET_SCHEDULER_PRIORITY_IDLE,
- p->data.file.filename,
+ p->filename,
HASHING_BLOCKSIZE,
&hash_for_index_cb,
sc);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11120 - gnunet/src/fs,
gnunet <=