summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/include.am4
-rw-r--r--src/lib/fs/.may_include6
-rw-r--r--src/lib/fs/conffile.c (renamed from src/common/conffile.c)12
-rw-r--r--src/lib/fs/conffile.h (renamed from src/common/conffile.h)0
-rw-r--r--src/lib/fs/include.am4
-rw-r--r--src/lib/fs/storagedir.c (renamed from src/common/storagedir.c)18
-rw-r--r--src/lib/fs/storagedir.h (renamed from src/common/storagedir.h)12
7 files changed, 38 insertions, 18 deletions
diff --git a/src/common/include.am b/src/common/include.am
index a2d29be5b5..ee35b9d56a 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -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 \
diff --git a/src/lib/fs/.may_include b/src/lib/fs/.may_include
index 2321edbbeb..6c9ce6ca04 100644
--- a/src/lib/fs/.may_include
+++ b/src/lib/fs/.may_include
@@ -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
diff --git a/src/common/conffile.c b/src/lib/fs/conffile.c
index d3215a22ed..37bd9f0368 100644
--- a/src/common/conffile.c
+++ b/src/lib/fs/conffile.c
@@ -4,12 +4,16 @@
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "common/compat.h"
+#include "lib/fs/conffile.h"
+
+#include "lib/container/smartlist.h"
#include "lib/encoding/confline.h"
-#include "common/conffile.h"
+#include "lib/fs/dir.h"
+#include "lib/fs/files.h"
+#include "lib/fs/path.h"
#include "lib/log/torlog.h"
-#include "common/util.h"
-#include "lib/container/smartlist.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);
diff --git a/src/common/conffile.h b/src/lib/fs/conffile.h
index bd8250b002..bd8250b002 100644
--- a/src/common/conffile.h
+++ b/src/lib/fs/conffile.h
diff --git a/src/lib/fs/include.am b/src/lib/fs/include.am
index 35dba60684..dcfd0b201f 100644
--- a/src/lib/fs/include.am
+++ b/src/lib/fs/include.am
@@ -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
diff --git a/src/common/storagedir.c b/src/lib/fs/storagedir.c
index 7642fbbb8e..d013e4550d 100644
--- a/src/common/storagedir.c
+++ b/src/lib/fs/storagedir.c
@@ -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
diff --git a/src/common/storagedir.h b/src/lib/fs/storagedir.h
index 3b46c20b5d..1ecb1c0a11 100644
--- a/src/common/storagedir.h
+++ b/src/lib/fs/storagedir.h
@@ -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) */
-