}
+/**
+ * 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_fi_node (struct GNUNET_BIO_ReadHandle *rh)
+{
+ return NULL;
+}
+
+
/**
* Using the given serialization filename, try to deserialize
* the file-information tree associated with it.
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))
{
*/
char *serialization_name;
+ /**
+ * Name of the file or directory (must be an absolute path).
+ */
+ char *filename;
+
/**
* Data describing either the file or the directory.
*/
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;
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;
*/
struct {
- /**
- * Name of the directory.
- */
- char *dirname;
-
/**
* Linked list of entries in the directory.
*/
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)))
"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;
}
&fi->expirationTime,
&fi->client_info);
GNUNET_free_non_null (fi->data.dir.dir_data);
- GNUNET_free_non_null (fi->data.dir.dirname);
}
else
{
&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);
= 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,
{
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);
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);
{
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);
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))
{
{
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);
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))
{
{
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],
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,
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);