tor  0.4.2.1-alpha-dev
storagedir.h
Go to the documentation of this file.
1 /* Copyright (c) 2017-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
10 #ifndef TOR_STORAGEDIR_H
11 #define TOR_STORAGEDIR_H
12 
13 #include "lib/cc/torint.h"
14 #include <stddef.h>
15 
16 typedef struct storage_dir_t storage_dir_t;
17 struct config_line_t;
18 struct sandbox_cfg_elem;
19 struct tor_mmap_t;
20 struct smartlist_t;
21 
22 storage_dir_t * storage_dir_new(const char *dirname, int n_files);
24 #define storage_dir_free(d) \
25  FREE_AND_NULL(storage_dir_t, storage_dir_free_, (d))
26 
28  struct sandbox_cfg_elem **cfg);
31 struct tor_mmap_t *storage_dir_map(storage_dir_t *d, const char *fname);
32 uint8_t *storage_dir_read(storage_dir_t *d, const char *fname, int bin,
33  size_t *sz_out);
35  const uint8_t *data,
36  size_t length,
37  int binary,
38  char **fname_out);
40  const char *data,
41  int binary,
42  char **fname_out);
44  const struct config_line_t *labels,
45  const uint8_t *data,
46  size_t length,
47  char **fname_out);
49  const char *fname,
50  struct config_line_t **labels_out,
51  const uint8_t **data_out,
52  size_t *size_out);
53 uint8_t *storage_dir_read_labeled(storage_dir_t *d, const char *fname,
54  struct config_line_t **labels_out,
55  size_t *sz_out);
57  const char *fname);
59  uint64_t target_size,
60  int min_to_remove);
63 
64 #endif /* !defined(TOR_STORAGEDIR_H) */
uint8_t * storage_dir_read(storage_dir_t *d, const char *fname, int bin, size_t *sz_out)
Definition: storagedir.c:230
uint64_t storage_dir_get_usage(storage_dir_t *d)
Definition: storagedir.c:190
int storage_dir_shrink(storage_dir_t *d, uint64_t target_size, int min_to_remove)
Definition: storagedir.c:540
int storage_dir_save_bytes_to_file(storage_dir_t *d, const uint8_t *data, size_t length, int binary, char **fname_out)
Definition: storagedir.c:311
const struct smartlist_t * storage_dir_list(storage_dir_t *d)
Definition: storagedir.c:179
Integer definitions used throughout Tor.
int storage_dir_remove_all(storage_dir_t *d)
Definition: storagedir.c:593
int storage_dir_get_max_files(storage_dir_t *d)
Definition: storagedir.c:603
const char * data
Definition: mmap.h:25
void storage_dir_remove_file(storage_dir_t *d, const char *fname)
Definition: storagedir.c:480
int storage_dir_register_with_sandbox(storage_dir_t *d, sandbox_cfg_t **cfg)
Definition: storagedir.c:104
struct 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)
Definition: storagedir.c:399
struct tor_mmap_t * storage_dir_map(storage_dir_t *d, const char *fname)
Definition: storagedir.c:215
int storage_dir_save_labeled_to_file(storage_dir_t *d, const config_line_t *labels, const uint8_t *data, size_t length, char **fname_out)
Definition: storagedir.c:345
int storage_dir_save_string_to_file(storage_dir_t *d, const char *data, int binary, char **fname_out)
Definition: storagedir.c:330
uint8_t * storage_dir_read_labeled(storage_dir_t *d, const char *fname, struct config_line_t **labels_out, size_t *sz_out)
Definition: storagedir.c:435
void storage_dir_free_(storage_dir_t *d)
Definition: storagedir.c:83
storage_dir_t * storage_dir_new(const char *dirname, int n_files)
Definition: storagedir.c:68