[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19949 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19949 - gnunet/src/fs |
Date: |
Wed, 22 Feb 2012 19:34:29 +0100 |
Author: grothoff
Date: 2012-02-22 19:34:29 +0100 (Wed, 22 Feb 2012)
New Revision: 19949
Modified:
gnunet/src/fs/fs_api.c
gnunet/src/fs/fs_dirmetascan.c
gnunet/src/fs/fs_file_information.c
gnunet/src/fs/fs_publish.c
gnunet/src/fs/fs_sharetree.c
gnunet/src/fs/gnunet-helper-fs-publish.c
gnunet/src/fs/gnunet-publish.c
Log:
LRN: two directory patches change the way "is_directory" is evaluated.
Now it must be GNUNET_YES for the execution flow to switch to a branch
where something is considered to be a directory.
The reason for that is that some functions might return GNUNET_SYSERR
when asked whether something is a directory or not. Checking this
value as "!= GNUNET_NO" will produce positive result, even though it's
not a directory.
Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/fs_api.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -1210,7 +1210,7 @@
{
if (0 == strcmp (srch, pos->serialization))
return pos;
- if (pos->is_directory)
+ if (pos->is_directory == GNUNET_YES)
{
r = find_file_position (pos->data.dir.entries, srch);
if (r != NULL)
Modified: gnunet/src/fs/fs_dirmetascan.c
===================================================================
--- gnunet/src/fs/fs_dirmetascan.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/fs_dirmetascan.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -152,7 +152,7 @@
GNUNET_assert (NULL != pos);
moved = 0; /* must not terminate, even on file, otherwise "normal" */
- while ( (pos->is_directory) ||
+ while ( (pos->is_directory == GNUNET_YES) ||
(0 == moved) )
{
if ( (moved != -1) &&
@@ -203,7 +203,7 @@
GNUNET_asprintf (&chld->short_filename,
"%s%s",
GNUNET_STRINGS_get_short_name (filename),
- is_directory ? "/" : "");
+ is_directory == GNUNET_YES ? "/" : "");
/* make sure we do not end with '//' */
slen = strlen (chld->short_filename);
if ( (slen >= 2) &&
@@ -325,7 +325,7 @@
NULL, GNUNET_SYSERR,
GNUNET_FS_DIRSCANNER_ALL_COUNTED);
ds->pos = ds->toplevel;
- if (ds->pos->is_directory)
+ if (ds->pos->is_directory == GNUNET_YES)
ds->pos = advance (ds->pos);
return;
case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA:
Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/fs_file_information.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -324,7 +324,7 @@
GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir,
struct GNUNET_FS_FileInformation *ent)
{
- if ((ent->dir != NULL) || (ent->next != NULL) || (!dir->is_directory))
+ if ((ent->dir != NULL) || (ent->next != NULL) || (dir->is_directory !=
GNUNET_YES))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -362,12 +362,12 @@
no = GNUNET_NO;
if (GNUNET_OK !=
proc (proc_cls, dir,
- (dir->is_directory) ? dir->data.dir.dir_size : dir->data.
+ (dir->is_directory == GNUNET_YES) ? dir->data.dir.dir_size :
dir->data.
file.file_size, dir->meta, &dir->keywords, &dir->bo,
- (dir->is_directory) ? &no : &dir->data.file.do_index,
+ (dir->is_directory == GNUNET_YES) ? &no : &dir->data.file.do_index,
&dir->client_info))
return;
- if (!dir->is_directory)
+ if (dir->is_directory != GNUNET_YES)
return;
pos = dir->data.dir.entries;
while (pos != NULL)
@@ -375,9 +375,9 @@
no = GNUNET_NO;
if (GNUNET_OK !=
proc (proc_cls, pos,
- (pos->is_directory) ? pos->data.dir.dir_size : pos->data.
+ (pos->is_directory == GNUNET_YES) ? pos->data.dir.dir_size :
pos->data.
file.file_size, pos->meta, &pos->keywords, &pos->bo,
- (pos->is_directory) ? &no : &pos->data.file.do_index,
+ (pos->is_directory == GNUNET_YES) ? &no :
&pos->data.file.do_index,
&pos->client_info))
break;
pos = pos->next;
@@ -404,7 +404,7 @@
int no;
no = GNUNET_NO;
- if (fi->is_directory)
+ if (fi->is_directory == GNUNET_YES)
{
/* clean up directory */
while (NULL != (pos = fi->data.dir.entries))
Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/fs_publish.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -57,7 +57,7 @@
pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info;
pi->value.publish.filename = p->filename;
pi->value.publish.size =
- (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size;
+ (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size :
p->data.file.file_size;
pi->value.publish.eta =
GNUNET_TIME_calculate_eta (p->start_time, offset,
pi->value.publish.size);
pi->value.publish.completed = offset;
@@ -132,7 +132,7 @@
pi.value.publish.specifics.error.message = pc->fi_pos->emsg;
pc->fi_pos->client_info =
GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0);
- if ((pc->fi_pos->is_directory == GNUNET_NO) &&
+ if ((pc->fi_pos->is_directory != GNUNET_YES) &&
(pc->fi_pos->filename != NULL) &&
(pc->fi_pos->data.file.do_index == GNUNET_YES))
{
@@ -191,7 +191,7 @@
pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
pi.value.publish.specifics.error.message = emsg;
p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, 0);
- if ((p->is_directory == GNUNET_NO) && (p->filename != NULL) &&
+ if ((p->is_directory != GNUNET_YES) && (p->filename != NULL) &&
(p->data.file.do_index == GNUNET_YES))
{
/* run unindex to clean up */
@@ -347,7 +347,7 @@
const char *dd;
p = pc->fi_pos;
- if (p->is_directory)
+ if (p->is_directory == GNUNET_YES)
{
pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset);
dd = p->data.dir.dir_data;
@@ -451,7 +451,7 @@
return;
}
- if ((!p->is_directory) && (GNUNET_YES == p->data.file.do_index) &&
+ if ((p->is_directory != GNUNET_YES) && (GNUNET_YES == p->data.file.do_index)
&&
(type == GNUNET_BLOCK_TYPE_FS_DBLOCK))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -462,7 +462,7 @@
odb.file_id = p->data.file.file_id;
GNUNET_assert (pc->qre == NULL);
pc->qre =
- GNUNET_DATASTORE_put (pc->dsh, (p->is_directory) ? 0 : pc->rid,
+ GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 :
pc->rid,
&chk->query, sizeof (struct OnDemandBlock), &odb,
GNUNET_BLOCK_TYPE_FS_ONDEMAND,
p->bo.content_priority, p->bo.anonymity_level,
@@ -477,7 +477,7 @@
(unsigned int) block_size);
GNUNET_assert (pc->qre == NULL);
pc->qre =
- GNUNET_DATASTORE_put (pc->dsh, (p->is_directory) ? 0 : pc->rid,
+ GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 :
pc->rid,
&chk->query, block_size, block, type,
p->bo.content_priority, p->bo.anonymity_level,
p->bo.replication_level, p->bo.expiration_time, -2,
@@ -535,14 +535,14 @@
GNUNET_assert (p != NULL);
if (NULL == p->te)
{
- if (p->is_directory)
+ if (p->is_directory == GNUNET_YES)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating directory\n");
db = GNUNET_FS_directory_builder_create (p->meta);
dirpos = p->data.dir.entries;
while (NULL != dirpos)
{
- if (dirpos->is_directory)
+ if (dirpos->is_directory == GNUNET_YES)
{
raw_data = dirpos->data.dir.dir_data;
dirpos->data.dir.dir_data = NULL;
@@ -578,7 +578,7 @@
&p->data.dir.dir_data);
GNUNET_FS_file_information_sync_ (p);
}
- size = (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size;
+ size = (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size :
p->data.file.file_size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating tree encoder\n");
p->te =
GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader,
@@ -783,7 +783,7 @@
return;
}
/* find starting position */
- while ((p->is_directory) && (NULL != p->data.dir.entries) && (NULL ==
p->emsg)
+ while ((p->is_directory == GNUNET_YES) && (NULL != p->data.dir.entries) &&
(NULL == p->emsg)
&& (NULL == p->data.dir.entries->chk_uri))
{
p = p->data.dir.entries;
@@ -847,7 +847,7 @@
}
return;
}
- if ((!p->is_directory) && (p->data.file.do_index))
+ if ((p->is_directory != GNUNET_YES) && (p->data.file.do_index))
{
if (NULL == p->filename)
{
Modified: gnunet/src/fs/fs_sharetree.c
===================================================================
--- gnunet/src/fs/fs_sharetree.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/fs_sharetree.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -347,7 +347,7 @@
}
/* consider adding filename to directory meta data */
- if (tree->is_directory)
+ if (tree->is_directory == GNUNET_YES)
{
const char *user = getenv ("USER");
if ( (user == NULL) ||
Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c 2012-02-22 18:05:18 UTC (rev
19948)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c 2012-02-22 18:34:29 UTC (rev
19949)
@@ -298,7 +298,7 @@
item->filename = GNUNET_strdup (filename);
item->is_directory = (S_ISDIR (sbuf.st_mode)) ? GNUNET_YES : GNUNET_NO;
item->file_size = (uint64_t) sbuf.st_size;
- if (item->is_directory)
+ if (item->is_directory == GNUNET_YES)
{
struct RecursionContext rc;
@@ -334,7 +334,7 @@
ssize_t size;
size_t slen;
- if (item->is_directory)
+ if (item->is_directory == GNUNET_YES)
{
/* for directories, we simply only descent, no extraction, no
progress reporting */
Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c 2012-02-22 18:05:18 UTC (rev 19948)
+++ gnunet/src/fs/gnunet-publish.c 2012-02-22 18:34:29 UTC (rev 19949)
@@ -378,7 +378,7 @@
struct GNUNET_FS_FileInformation *fic;
struct GNUNET_FS_ShareTreeItem *child;
- if (item->is_directory)
+ if (item->is_directory == GNUNET_YES)
{
GNUNET_CONTAINER_meta_data_delete (item->meta,
EXTRACTOR_METATYPE_MIMETYPE, NULL, 0);
@@ -481,7 +481,7 @@
case GNUNET_FS_DIRSCANNER_FILE_START:
if (verbose > 1)
{
- if (is_directory)
+ if (is_directory == GNUNET_YES)
FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename);
else
FPRINTF (stdout, _("Scanning file `%s'.\n"), filename);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19949 - gnunet/src/fs,
gnunet <=