Helper functions for building directories. More...
Go to the source code of this file.
Data Structures | |
struct | GetFullDataClosure |
Closure for 'find_full_data'. More... | |
struct | BuilderEntry |
Entries in the directory (builder). More... | |
struct | GNUNET_FS_DirectoryBuilder |
Internal state of a directory builder. More... | |
Macros | |
#define | GNUNET_DIRECTORY_MAGIC "\211GND\r\n\032\n" |
String that is used to indicate that a file is a GNUnet directory. More... | |
Functions | |
int | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_FS_MetaData *md) |
Does the meta-data claim that this is a directory? Checks if the mime-type is that of a GNUnet directory. More... | |
void | GNUNET_FS_meta_data_make_directory (struct GNUNET_FS_MetaData *md) |
Set the MIMETYPE information for the given metadata to "application/gnunet-directory". More... | |
static int | find_full_data (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_len) |
Type of a function that libextractor calls for each meta data item found. More... | |
int | GNUNET_FS_directory_list_contents (size_t size, const void *data, uint64_t offset, GNUNET_FS_DirectoryEntryProcessor dep, void *dep_cls) |
Iterate over all entries in a directory. More... | |
struct GNUNET_FS_DirectoryBuilder * | GNUNET_FS_directory_builder_create (const struct GNUNET_FS_MetaData *mdir) |
Create a directory builder. More... | |
void | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *md, const void *data) |
Add an entry to a directory. More... | |
static size_t | do_align (size_t start_position, size_t end_position) |
Given the start and end position of a block of data, return the end position of that data after alignment to the DBLOCK_SIZE. More... | |
static void | block_align (size_t start, unsigned int count, const size_t *sizes, unsigned int *perm) |
Compute a permutation of the blocks to minimize the cost of alignment. More... | |
int | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, size_t *rsize, void **rdata) |
Finish building the directory. More... | |
Helper functions for building directories.
TODO:
Definition in file fs_directory.c.
#define GNUNET_DIRECTORY_MAGIC "\211GND\r\n\032\n" |
String that is used to indicate that a file is a GNUnet directory.
Definition at line 44 of file fs_directory.c.
|
static |
Type of a function that libextractor calls for each meta data item found.
cls | closure (user-defined) |
plugin_name | name of the plugin that produced this value; special values can be used (e.g. '<zlib>' for zlib being used in the main libextractor library and yielding meta data). |
type | libextractor-type describing the meta data |
format | basic format information about data |
data_mime_type | mime-type of data (not of the original file); can be NULL (if mime-type is not known) |
data | actual meta-data found |
data_len | number of bytes in data |
Definition at line 136 of file fs_directory.c.
References data, GetFullDataClosure::data, GNUNET_malloc, GNUNET_memcpy, GetFullDataClosure::size, and type.
Referenced by GNUNET_FS_directory_list_contents().
|
static |
Given the start and end position of a block of data, return the end position of that data after alignment to the DBLOCK_SIZE.
Definition at line 488 of file fs_directory.c.
References DBLOCK_SIZE.
Referenced by block_align(), GNUNET_FS_directory_builder_finish(), and GNUNET_MST_from_buffer().
|
static |
Compute a permutation of the blocks to minimize the cost of alignment.
Greedy packer.
start | starting position for the first block |
count | size of the two arrays |
sizes | the sizes of the individual blocks |
perm | the permutation of the blocks (updated) |
Definition at line 509 of file fs_directory.c.
References DBLOCK_SIZE, do_align(), GNUNET_assert, and start.
Referenced by GNUNET_FS_directory_builder_finish().