code to asynchronously build a 'struct GNUNET_FS_ShareTreeItem' from an on-disk directory for publishing; use the 'gnunet-helper-fs-publish'. More...
#include "platform.h"
#include "gnunet_fs_service.h"
#include "gnunet_scheduler_lib.h"
#include <pthread.h>
Go to the source code of this file.
Data Structures | |
struct | GNUNET_FS_DirScanner |
An opaque structure a pointer to which is returned to the caller to be used to control the scanner. More... | |
Functions | |
void | GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds) |
Abort the scan. More... | |
struct GNUNET_FS_ShareTreeItem * | GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds) |
Obtain the result of the scan after the scan has signalled completion. More... | |
static struct GNUNET_FS_ShareTreeItem * | advance (struct GNUNET_FS_ShareTreeItem *pos) |
Move in the directory from the given position to the next file in DFS traversal. More... | |
static struct GNUNET_FS_ShareTreeItem * | expand_tree (struct GNUNET_FS_ShareTreeItem *parent, const char *filename, int is_directory) |
Add another child node to the tree. More... | |
static void | finish_scan (void *cls) |
Task run last to shut everything down. More... | |
static int | process_helper_msgs (void *cls, const struct GNUNET_MessageHeader *msg) |
Called every time there is data to read from the scanner. More... | |
static void | helper_died_cb (void *cls) |
Function called if our helper process died. More... | |
struct GNUNET_FS_DirScanner * | GNUNET_FS_directory_scan_start (const char *filename, int disable_extractor, const char *ex, GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls) |
Start a directory scanner thread. More... | |
code to asynchronously build a 'struct GNUNET_FS_ShareTreeItem' from an on-disk directory for publishing; use the 'gnunet-helper-fs-publish'.
Definition in file fs_dirmetascan.c.
|
static |
Move in the directory from the given position to the next file in DFS traversal.
pos | current position |
Definition at line 139 of file fs_dirmetascan.c.
References GNUNET_FS_ShareTreeItem::children_head, GNUNET_assert, GNUNET_YES, GNUNET_FS_ShareTreeItem::is_directory, GNUNET_FS_ShareTreeItem::next, and GNUNET_FS_ShareTreeItem::parent.
Referenced by process_helper_msgs().
|
static |
Add another child node to the tree.
parent | parent of the child, NULL for top level |
filename | name of the file or directory |
is_directory | GNUNET_YES for directories |
Definition at line 181 of file fs_dirmetascan.c.
References GNUNET_FS_ShareTreeItem::children_head, GNUNET_FS_ShareTreeItem::children_tail, filename, GNUNET_FS_ShareTreeItem::filename, GNUNET_asprintf(), GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, GNUNET_STRINGS_get_short_name(), GNUNET_YES, GNUNET_FS_ShareTreeItem::is_directory, GNUNET_FS_ShareTreeItem::parent, and GNUNET_FS_ShareTreeItem::short_filename.
Referenced by process_helper_msgs().
|
static |
Task run last to shut everything down.
cls | the 'struct GNUNET_FS_DirScanner' |
Definition at line 215 of file fs_dirmetascan.c.
References ds, GNUNET_FS_DIRSCANNER_FINISHED, GNUNET_HELPER_stop(), GNUNET_NO, GNUNET_SYSERR, GNUNET_FS_DirScanner::helper, GNUNET_FS_DirScanner::progress_callback, GNUNET_FS_DirScanner::progress_callback_cls, and GNUNET_FS_DirScanner::stop_task.
Referenced by process_helper_msgs().
|
static |
Called every time there is data to read from the scanner.
Calls the scanner progress handler.
cls | the closure (directory scanner object) |
msg | message from the helper process |
Definition at line 243 of file fs_dirmetascan.c.
References advance(), ds, end, expand_tree(), EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, filename, GNUNET_FS_ShareTreeItem::filename, finish_scan(), GNUNET_assert, GNUNET_break, GNUNET_FS_DIRSCANNER_ALL_COUNTED, GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED, GNUNET_FS_DIRSCANNER_FILE_IGNORED, GNUNET_FS_DIRSCANNER_FILE_START, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR, GNUNET_FS_meta_data_delete(), GNUNET_FS_meta_data_deserialize(), GNUNET_FS_meta_data_insert(), GNUNET_FS_uri_ksk_create_from_meta_data(), GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE, GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, GNUNET_YES, GNUNET_FS_ShareTreeItem::is_directory, GNUNET_FS_ShareTreeItem::ksk_uri, GNUNET_FS_ShareTreeItem::meta, msg, GNUNET_FS_ShareTreeItem::parent, GNUNET_FS_DirScanner::pos, GNUNET_FS_DirScanner::progress_callback, GNUNET_FS_DirScanner::progress_callback_cls, GNUNET_FS_ShareTreeItem::short_filename, GNUNET_MessageHeader::size, GNUNET_FS_DirScanner::stop_task, GNUNET_FS_DirScanner::toplevel, and GNUNET_MessageHeader::type.
Referenced by GNUNET_FS_directory_scan_start().
|
static |
Function called if our helper process died.
cls | the 'struct GNUNET_FS_DirScanner' callback. |
Definition at line 424 of file fs_dirmetascan.c.
References ds, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR, GNUNET_SYSERR, GNUNET_FS_DirScanner::helper, GNUNET_FS_DirScanner::progress_callback, GNUNET_FS_DirScanner::progress_callback_cls, and GNUNET_FS_DirScanner::stop_task.
Referenced by GNUNET_FS_directory_scan_start().