summaryrefslogtreecommitdiff
path: root/src/common/storagedir.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-03-29 12:55:09 +0200
committerNick Mathewson <nickm@torproject.org>2017-04-06 11:48:40 -0400
commit37bb3b31fab58fc0f4f503bed6de322b0a808e70 (patch)
tree3d51680910dcf3ee7ec987541f19c5635b3f1fdc /src/common/storagedir.h
parentb6f22524ee69e5cc458673f59cfb66054f7d0c82 (diff)
downloadtor-37bb3b31fab58fc0f4f503bed6de322b0a808e70.tar.gz
tor-37bb3b31fab58fc0f4f503bed6de322b0a808e70.zip
Add some "labeled storagedir" abstractions.
These add a tiny bit of structure on top of the regular storagedir abstractions in order to store key-value lists at the head of each document.
Diffstat (limited to 'src/common/storagedir.h')
-rw-r--r--src/common/storagedir.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/common/storagedir.h b/src/common/storagedir.h
index 29be941b14..781194407f 100644
--- a/src/common/storagedir.h
+++ b/src/common/storagedir.h
@@ -5,7 +5,7 @@
#define TOR_STORAGEDIR_H
typedef struct storage_dir_t storage_dir_t;
-
+struct config_line_t;
struct sandbox_cfg_elem;
storage_dir_t * storage_dir_new(const char *dirname, int n_files);
@@ -26,6 +26,19 @@ int storage_dir_save_string_to_file(storage_dir_t *d,
const char *data,
int binary,
char **fname_out);
+int storage_dir_save_labeled_to_file(storage_dir_t *d,
+ const struct config_line_t *labels,
+ const uint8_t *data,
+ size_t length,
+ char **fname_out);
+tor_mmap_t *storage_dir_map_labeled(storage_dir_t *dir,
+ const char *fname,
+ struct config_line_t **labels_out,
+ const uint8_t **data_out,
+ size_t *size_out);
+uint8_t *storage_dir_read_labeled(storage_dir_t *d, const char *fname,
+ struct config_line_t **labels_out,
+ size_t *sz_out);
void storage_dir_remove_file(storage_dir_t *d,
const char *fname);
int storage_dir_shrink(storage_dir_t *d,