Skip to content

Commit e55fe92

Browse files
fanquakevijaydasmp
authored andcommitted
Merge bitcoin#27254: refactor: Extract util/fs from util/system
00e9b97 refactor: Move fs.* to util/fs.* (TheCharlatan) 106b46d Add missing fs.h includes (TheCharlatan) b202b3d Add missing cstddef include in assumptions.h (TheCharlatan) 18fb363 refactor: Extract util/fs_helpers from util/system (Ben Woosley) Pull request description: This pull request is part of the `libbitcoinkernel` project bitcoin#24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". This commit was originally authored by empact and is taken from its parent PR bitcoin#25152. #### Context There is an ongoing effort to decouple the `ArgsManager` used for command line parsing user-provided arguments from the libbitcoinkernel library (bitcoin#25290, bitcoin#25487, bitcoin#25527, bitcoin#25862, bitcoin#26177, and bitcoin#27125). The `ArgsManager` is defined in `system.h`. A similar pull request extracting functionality from `system.h` has been merged in bitcoin#27238. #### Changes Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on `system.h` (and thus the `ArgsManager` definition) by moving filesystem related functions out of the `system.*` files. There is already a pair of `fs.h` / `fs.cpp` in the top-level `src/` directory. They were not combined with the files introduced here, to keep the patch cleaner and more importantly because they are often included without the utility functions. The new files are therefore named `fs_helpers` and the existing `fs` files are moved into the util directory. Further commits splitting more functionality out of `system.h` are still in bitcoin#25152 and will be submitted in separate PRs once this PR has been processed. ACKs for top commit: hebasto: ACK 00e9b97 Tree-SHA512: 31422f148d14ba3c843b99b1550a6fd77c77f350905ca324f93d4f97b652246bc58fa9696c64d1201979cf88733e40be02d262739bb7d417cf22bf506fdb7666
1 parent 7c43465 commit e55fe92

88 files changed

Lines changed: 466 additions & 370 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ BITCOIN_CORE_H = \
244244
gsl/pointers.h \
245245
flat-database.h \
246246
flatfile.h \
247-
fs.h \
248247
httprpc.h \
249248
httpserver.h \
250249
i2p.h \
@@ -398,6 +397,8 @@ BITCOIN_CORE_H = \
398397
util/error.h \
399398
util/fastrange.h \
400399
util/fees.h \
400+
util/fs.h \
401+
util/fs_helpers.h \
401402
util/golombrice.h \
402403
util/hasher.h \
403404
util/hash_type.h \
@@ -978,7 +979,6 @@ libbitcoin_util_a_SOURCES = \
978979
support/lockedpool.cpp \
979980
chainparamsbase.cpp \
980981
clientversion.cpp \
981-
fs.cpp \
982982
interfaces/echo.cpp \
983983
interfaces/handler.cpp \
984984
interfaces/init.cpp \
@@ -996,6 +996,8 @@ libbitcoin_util_a_SOURCES = \
996996
util/edge.cpp \
997997
util/error.cpp \
998998
util/fees.cpp \
999+
util/fs.cpp \
1000+
util/fs_helpers.cpp \
9991001
util/hasher.cpp \
10001002
util/getuniquepath.cpp \
10011003
util/sock.cpp \

src/addrdb.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
#include <addrman.h>
99
#include <chainparams.h>
1010
#include <clientversion.h>
11-
#include <fs.h>
11+
#include <util/fs.h>
12+
#include <util/fs_helpers.h>
1213
#include <hash.h>
1314
#include <logging/timer.h>
1415
#include <netbase.h>

src/addrdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#ifndef BITCOIN_ADDRDB_H
77
#define BITCOIN_ADDRDB_H
88

9-
#include <fs.h>
109
#include <net_types.h> // For banmap_t
1110
#include <univalue.h>
11+
#include <util/fs.h>
1212

1313
#include <memory>
1414
#include <optional>

src/banman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#include <addrdb.h>
99
#include <common/bloom.h>
10-
#include <fs.h>
1110
#include <net_types.h> // For banmap_t
1211
#include <sync.h>
12+
#include <util/fs.h>
1313

1414
#include <chrono>
1515
#include <cstdint>

src/bench/bench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#include <bench/bench.h>
66

7-
#include <fs.h>
87
#include <test/util/setup_common.h>
8+
#include <util/fs.h>
99
#include <util/string.h>
1010

1111
#include <algorithm>

src/bench/bench.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef BITCOIN_BENCH_BENCH_H
66
#define BITCOIN_BENCH_BENCH_H
77

8-
#include <fs.h>
8+
#include <util/fs.h>
99
#include <util/macros.h>
1010

1111
#include <chrono>

src/bench/bench_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <clientversion.h>
99
#include <crypto/sha256.h>
1010
#include <crypto/x11/dispatch.h>
11-
#include <fs.h>
11+
#include <util/fs.h>
1212
#include <util/strencodings.h>
1313
#include <util/system.h>
1414

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <consensus/consensus.h>
1414
#include <core_io.h>
1515
#include <key_io.h>
16-
#include <fs.h>
16+
#include <util/fs.h>
1717
#include <policy/policy.h>
1818
#include <primitives/transaction.h>
1919
#include <script/script.h>

src/coinjoin/client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <netmessagemaker.h>
2020
#include <shutdown.h>
2121
#include <util/check.h>
22+
#include <util/fs_helpers.h>
2223
#include <util/moneystr.h>
2324
#include <util/system.h>
2425
#include <util/translation.h>
@@ -1783,4 +1784,3 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const
17831784
}
17841785
obj.pushKV("sessions", arrSessions);
17851786
}
1786-

src/dbwrapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
#include <dbwrapper.h>
66

7-
#include <fs.h>
7+
#include <util/fs.h>
8+
#include <util/fs_helpers.h>
89
#include <logging.h>
910
#include <random.h>
1011
#include <util/strencodings.h>

0 commit comments

Comments
 (0)