mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Move conffile and storagedir to lib/fs
This commit is contained in:
parent
38fd3e0df0
commit
a1f3ece16d
@ -28,10 +28,8 @@ LIBOR_A_SRC = \
|
||||
src/common/buffers.c \
|
||||
src/common/compat.c \
|
||||
src/common/compat_time.c \
|
||||
src/common/conffile.c \
|
||||
src/common/util.c \
|
||||
src/common/util_process.c \
|
||||
src/common/storagedir.c \
|
||||
src/common/token_bucket.c \
|
||||
src/common/workqueue.c \
|
||||
$(libor_extra_source) \
|
||||
@ -68,10 +66,8 @@ COMMONHEADERS = \
|
||||
src/common/compat.h \
|
||||
src/common/compat_libevent.h \
|
||||
src/common/compat_time.h \
|
||||
src/common/conffile.h \
|
||||
src/common/handles.h \
|
||||
src/common/procmon.h \
|
||||
src/common/storagedir.h \
|
||||
src/common/timers.h \
|
||||
src/common/token_bucket.h \
|
||||
src/common/util.h \
|
||||
|
@ -1,11 +1,13 @@
|
||||
orconfig.h
|
||||
lib/cc/*.h
|
||||
lib/container/*.h
|
||||
lib/encoding/*.h
|
||||
lib/err/*.h
|
||||
lib/fdio/*.h
|
||||
lib/malloc/*.h
|
||||
lib/fs/*.h
|
||||
lib/log/*.h
|
||||
lib/malloc/*.h
|
||||
lib/memarea/*.h
|
||||
lib/sandbox/*.h
|
||||
lib/string/*.h
|
||||
lib/testsupport/testsupport.h
|
||||
lib/log/*.h
|
||||
|
@ -4,12 +4,16 @@
|
||||
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#include "common/compat.h"
|
||||
#include "lib/encoding/confline.h"
|
||||
#include "common/conffile.h"
|
||||
#include "lib/log/torlog.h"
|
||||
#include "common/util.h"
|
||||
#include "lib/fs/conffile.h"
|
||||
|
||||
#include "lib/container/smartlist.h"
|
||||
#include "lib/encoding/confline.h"
|
||||
#include "lib/fs/dir.h"
|
||||
#include "lib/fs/files.h"
|
||||
#include "lib/fs/path.h"
|
||||
#include "lib/log/torlog.h"
|
||||
#include "lib/malloc/util_malloc.h"
|
||||
#include "lib/string/printf.h"
|
||||
|
||||
static smartlist_t *config_get_file_list(const char *path,
|
||||
smartlist_t *opened_files);
|
@ -6,10 +6,12 @@ noinst_LIBRARIES += src/lib/libtor-fs-testing.a
|
||||
endif
|
||||
|
||||
src_lib_libtor_fs_a_SOURCES = \
|
||||
src/lib/fs/conffile.c \
|
||||
src/lib/fs/dir.c \
|
||||
src/lib/fs/files.c \
|
||||
src/lib/fs/mmap.c \
|
||||
src/lib/fs/path.c \
|
||||
src/lib/fs/storagedir.c \
|
||||
src/lib/fs/userdb.c
|
||||
|
||||
src_lib_libtor_fs_testing_a_SOURCES = \
|
||||
@ -18,8 +20,10 @@ src_lib_libtor_fs_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
||||
src_lib_libtor_fs_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
noinst_HEADERS += \
|
||||
src/lib/fs/conffile.h \
|
||||
src/lib/fs/dir.h \
|
||||
src/lib/fs/files.h \
|
||||
src/lib/fs/mmap.h \
|
||||
src/lib/fs/path.h \
|
||||
src/lib/fs/storagedir.h \
|
||||
src/lib/fs/userdb.h
|
||||
|
@ -1,14 +1,21 @@
|
||||
/* Copyright (c) 2017-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#include "lib/fs/storagedir.h"
|
||||
|
||||
#include "lib/container/smartlist.h"
|
||||
#include "common/compat.h"
|
||||
#include "lib/encoding/confline.h"
|
||||
#include "lib/fs/dir.h"
|
||||
#include "lib/fs/files.h"
|
||||
#include "lib/fs/mmap.h"
|
||||
#include "lib/log/escape.h"
|
||||
#include "lib/log/torlog.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
#include "lib/malloc/util_malloc.h"
|
||||
#include "lib/memarea/memarea.h"
|
||||
#include "lib/sandbox/sandbox.h"
|
||||
#include "common/storagedir.h"
|
||||
#include "lib/log/torlog.h"
|
||||
#include "common/util.h"
|
||||
#include "lib/string/printf.h"
|
||||
#include "lib/string/util_string.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@ -19,6 +26,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FNAME_MIN_NUM 1000
|
||||
|
@ -4,9 +4,14 @@
|
||||
#ifndef TOR_STORAGEDIR_H
|
||||
#define TOR_STORAGEDIR_H
|
||||
|
||||
#include "lib/cc/torint.h"
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct storage_dir_t storage_dir_t;
|
||||
struct config_line_t;
|
||||
struct sandbox_cfg_elem;
|
||||
struct tor_mmap_t;
|
||||
struct smartlist_t;
|
||||
|
||||
storage_dir_t * storage_dir_new(const char *dirname, int n_files);
|
||||
void storage_dir_free_(storage_dir_t *d);
|
||||
@ -15,9 +20,9 @@ void storage_dir_free_(storage_dir_t *d);
|
||||
|
||||
int storage_dir_register_with_sandbox(storage_dir_t *d,
|
||||
struct sandbox_cfg_elem **cfg);
|
||||
const smartlist_t *storage_dir_list(storage_dir_t *d);
|
||||
const struct smartlist_t *storage_dir_list(storage_dir_t *d);
|
||||
uint64_t storage_dir_get_usage(storage_dir_t *d);
|
||||
tor_mmap_t *storage_dir_map(storage_dir_t *d, const char *fname);
|
||||
struct tor_mmap_t *storage_dir_map(storage_dir_t *d, const char *fname);
|
||||
uint8_t *storage_dir_read(storage_dir_t *d, const char *fname, int bin,
|
||||
size_t *sz_out);
|
||||
int storage_dir_save_bytes_to_file(storage_dir_t *d,
|
||||
@ -34,7 +39,7 @@ int storage_dir_save_labeled_to_file(storage_dir_t *d,
|
||||
const uint8_t *data,
|
||||
size_t length,
|
||||
char **fname_out);
|
||||
tor_mmap_t *storage_dir_map_labeled(storage_dir_t *dir,
|
||||
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,
|
||||
@ -51,4 +56,3 @@ int storage_dir_remove_all(storage_dir_t *d);
|
||||
int storage_dir_get_max_files(storage_dir_t *d);
|
||||
|
||||
#endif /* !defined(TOR_STORAGEDIR_H) */
|
||||
|
Loading…
Reference in New Issue
Block a user