Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fdctl: optimize imports #3446

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/fdctl/caps.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef HEADER_fd_src_app_fdctl_caps_h
#define HEADER_fd_src_app_fdctl_caps_h

#include "fdctl.h"
#include "../../util/fd_util_base.h"

/* API for checking capabilities, and accumulating information about
what capabilities or permissions are missing that are required to run
Expand Down Expand Up @@ -67,7 +67,7 @@ void
fd_caps_check_capability( fd_caps_ctx_t * ctx,
char const * name,
uint capability,
char const * reason );
char const * reason );

/* fd_caps_check_resource() checks if the current process is running
with the provided resource, a RLIMIT_* constant, at or above the
Expand Down
7 changes: 2 additions & 5 deletions src/app/fdctl/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
#include "fdctl.h"

#include "run/topos/topos.h"
#include "run/run.h"

#include "../../ballet/toml/fd_toml.h"
#include "../../disco/topo/fd_topob.h"
#include "../../disco/topo/fd_pod_format.h"
#include "../../flamenco/runtime/fd_blockstore.h"
#include "../../flamenco/runtime/fd_txncache.h"
#include "../../funk/fd_funk.h"
#include "../../util/net/fd_eth.h"
#include "../../util/net/fd_ip4.h"
#include "../../util/tile/fd_tile_private.h"

#include <fcntl.h>
#include <pwd.h>
Expand Down Expand Up @@ -463,13 +460,13 @@ fdctl_cfg_from_env( int * pargc,
static uchar pod_mem2[ 1UL<<20 ];
uchar * pod1 = fd_pod_join( fd_pod_new( pod_mem1, sizeof(pod_mem1) ) );
uchar * pod2 = fd_pod_join( fd_pod_new( pod_mem2, sizeof(pod_mem2) ) );

uchar scratch[ 4096 ];
long toml_err = fd_toml_parse( fdctl_default_config, fdctl_default_config_sz, pod1, scratch, sizeof(scratch) );
if( FD_UNLIKELY( toml_err!=FD_TOML_SUCCESS ) ) FD_LOG_ERR(( "Invalid config (%s)", "default.toml" ));
toml_err = fd_toml_parse( fdctl_default_firedancer_config, fdctl_default_firedancer_config_sz, pod2, scratch, sizeof(scratch) );
if( FD_UNLIKELY( toml_err!=FD_TOML_SUCCESS ) ) FD_LOG_ERR(( "Invalid config (%s)", "default-firedancer.toml" ));

if( FD_UNLIKELY( !fdctl_pod_to_cfg( config, pod1 ) ) ) FD_LOG_ERR(( "Invalid config (%s)", "default.toml" ));
if( FD_UNLIKELY( !fdctl_pod_to_cfg( config, pod2 ) ) ) FD_LOG_ERR(( "Invalid config (%s)", "default-firedancer.toml" ));
fd_pod_delete( fd_pod_leave( pod1 ) );
Expand Down
2 changes: 0 additions & 2 deletions src/app/fdctl/configure/configure.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "configure.h"

#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>

void
configure_cmd_args( int * pargc,
Expand Down
1 change: 0 additions & 1 deletion src/app/fdctl/configure/ethtool-channels.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "configure.h"

#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/fdctl/configure/ethtool-gro.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "configure.h"

#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/fdctl/fuzz_fdctl_config.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "config_parse.h"
#include "../../ballet/toml/fd_toml.h"
#include "../../util/fd_util.h"
#include "../../util/sanitize/fd_fuzz.h"

#include <assert.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/fdctl/main1.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#define _GNU_SOURCE
#define FD_UNALIGNED_ACCESS_STYLE 0
#include "../../util/bits/fd_bits.h"

#include "fdctl.h"

Expand Down
2 changes: 0 additions & 2 deletions src/app/fdctl/monitor/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <stdio.h>

#include "../../../disco/fd_disco.h"

#define PRINT( ... ) do { \
int n = snprintf( *buf, *buf_sz, __VA_ARGS__ ); \
if( FD_UNLIKELY( n<0 ) ) FD_LOG_ERR(( "snprintf failed" )); \
Expand Down
7 changes: 2 additions & 5 deletions src/app/fdctl/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

#include "generated/monitor_seccomp.h"
#include "helper.h"
#include "../run/run.h"
#include "../../../disco/tiles.h"
#include "../../../disco/fd_disco.h"

#include <stdio.h>
#include <signal.h>
Expand Down Expand Up @@ -156,7 +153,7 @@ link_snap( link_snap_t * snap_cur,
if( FD_LIKELY( topo->tiles[ tile_idx ].in_link_poll[ in_idx ] ) ) {
in_metrics = (ulong const *)fd_metrics_link_in( topo->tiles[ tile_idx ].metrics, in_idx );
}

fd_topo_link_t * link = &topo->links[ topo->tiles[ tile_idx ].in_link_id[ in_idx ] ];
ulong producer_id = fd_topo_find_link_producer( topo, link );
FD_TEST( producer_id!=ULONG_MAX );
Expand Down Expand Up @@ -345,7 +342,7 @@ run_monitor( config_t * const config,
PRINT( " | " ); printf_err_cnt ( &buf, &buf_sz, cur->nvcsw, prv->nvcsw );
PRINT( " | " ); printf_err_bool( &buf, &buf_sz, cur->in_backp, prv->in_backp );
PRINT( " | " ); printf_err_cnt ( &buf, &buf_sz, cur->backp_cnt, prv->backp_cnt );

ulong cur_hkeep_ticks = cur->regime_ticks[0]+cur->regime_ticks[1]+cur->regime_ticks[2];
ulong prv_hkeep_ticks = prv->regime_ticks[0]+prv->regime_ticks[1]+prv->regime_ticks[2];

Expand Down
1 change: 0 additions & 1 deletion src/app/fdctl/run/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "generated/pidns_seccomp.h"
#endif

#include "../../../disco/tiles.h"
#include "../../../disco/topo/fd_pod_format.h"
#include "../../../waltz/xdp/fd_xdp1.h"
#include "../../../flamenco/runtime/fd_blockstore.h"
Expand Down
2 changes: 0 additions & 2 deletions src/app/fdctl/spy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "fdctl.h"
#include "../../flamenco/gossip/fd_gossip.h"
#include "../../util/fd_util.h"
#include "../../ballet/base58/fd_base58.h"
#include "../../flamenco/types/fd_types_yaml.h"
#include "../../util/net/fd_eth.h"
#include <stdio.h>
Expand Down
2 changes: 2 additions & 0 deletions src/app/fdctl/utility.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#define _GNU_SOURCE
#include "utility.h"
#include "../../util/fd_util.h"

#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/fdctl/utility.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef HEADER_fd_src_app_fdctl_utility_h
#define HEADER_fd_src_app_fdctl_utility_h

#include "fdctl.h"
#include "../../util/fd_util_base.h"

#include <stdlib.h>

Expand Down
3 changes: 0 additions & 3 deletions src/app/fddev/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@

#include "../fdctl/configure/configure.h"
#include "../fdctl/run/run.h"
#include "rpc_client/fd_rpc_client.h"

#include "../../disco/topo/fd_topob.h"
#include "../../disco/keyguard/fd_keyload.h"
#include "../../util/net/fd_ip4.h"
#include "../../util/shmem/fd_shmem_private.h"

#include <unistd.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/fddev/configure/genesis.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define FD_SCRATCH_USE_HANDHOLDING 1
#include "../../fdctl/configure/configure.h"

#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
Expand Down
3 changes: 0 additions & 3 deletions src/app/fddev/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "../fdctl/configure/configure.h"
#include "../fdctl/run/run.h"
#include "../../util/wksp/fd_wksp_private.h"

#include <stdio.h>
#include <unistd.h>
Expand All @@ -14,8 +13,6 @@
#include <pthread.h>
#include <sys/wait.h>

#include "../../util/tile/fd_tile_private.h"

void
dev_cmd_args( int * pargc,
char *** pargv,
Expand Down
1 change: 0 additions & 1 deletion src/app/fddev/flame.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#define _GNU_SOURCE
#include "fddev.h"
#include "../../util/net/fd_pcap.h"

#include <stdio.h>
#include <unistd.h>
Expand Down
2 changes: 0 additions & 2 deletions src/app/fddev/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "../../disco/topo/fd_topob.h"
#include "../../util/net/fd_ip4.h"

#include "../../util/tile/fd_tile_private.h"

void
load_cmd_perm( args_t * args,
fd_caps_ctx_t * caps,
Expand Down
3 changes: 1 addition & 2 deletions src/app/fddev/tiles/fd_benchg.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "../../../disco/tiles.h"

#include "../../../disco/topo/fd_topo.h"
#include "../../../flamenco/types/fd_types_custom.h"
#include "../../../flamenco/runtime/fd_system_ids_pp.h"

Expand Down
7 changes: 3 additions & 4 deletions src/app/fddev/tiles/fd_bencho.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "../../../disco/tiles.h"

#include "../../../disco/topo/fd_topo.h"
#include "../rpc_client/fd_rpc_client.h"
#include "../rpc_client/fd_rpc_client_private.h"

Expand Down Expand Up @@ -93,7 +92,7 @@ service_block_hash( fd_bencho_ctx_t * ctx,
ctx->blockhash_state = FD_BENCHO_STATE_WAIT;
ctx->blockhash_deadline = fd_log_wallclock() + 400L * 1000L * 1000L; /* 400 millis til we fetch new blockhash */
fd_memcpy( fd_chunk_to_laddr( ctx->mem, ctx->out_chunk ), response->result.latest_block_hash.block_hash, 32 );
fd_stem_publish( stem, 0UL, 0UL, ctx->out_chunk, 32UL, 0UL, 0UL, 0UL );
fd_stem_publish( stem, 0UL, 0UL, ctx->out_chunk, 32UL, 0UL, 0UL, 0UL );
ctx->out_chunk = fd_dcache_compact_next( ctx->out_chunk, 32, ctx->out_chunk0, ctx->out_wmark );

fd_rpc_client_close( ctx->rpc, ctx->blockhash_request );
Expand Down Expand Up @@ -138,7 +137,7 @@ service_txn_count( fd_bencho_ctx_t * ctx ) {

if( FD_UNLIKELY( response->status!=FD_RPC_CLIENT_SUCCESS ) )
FD_LOG_ERR(( "RPC server returned error %ld", response->status ));

ulong txns = response->result.transaction_count.transaction_count;
if( FD_LIKELY( ctx->txncount_measured1 ) )
FD_LOG_NOTICE(( "%lu txn/s", (ulong)((double)(txns - ctx->txncount_prev)/1.2 )));
Expand Down
3 changes: 1 addition & 2 deletions src/app/fddev/tiles/fd_benchs.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* _GNU_SOURCE for recvmmsg and sendmmsg */
#define _GNU_SOURCE

#include "../../../disco/tiles.h"
#include "../../../waltz/xdp/fd_xsk_aio.h"
#include "../../../disco/topo/fd_topo.h"
#include "../../../waltz/quic/fd_quic.h"
#include "../../../waltz/tls/test_tls_helper.h"

Expand Down
1 change: 0 additions & 1 deletion src/disco/topo/fd_topo.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "fd_topo.h"

#include "../fd_disco_base.h"
#include "../metrics/fd_metrics.h"
#include "../quic/fd_tpu.h"
#include "../../util/wksp/fd_wksp_private.h"
Expand Down
3 changes: 1 addition & 2 deletions src/disco/topo/fd_topo_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "../metrics/fd_metrics.h"
#include "../../waltz/xdp/fd_xdp1.h"
#include "../../util/tile/fd_tile_private.h"
#include "../../util/shmem/fd_shmem_private.h"

#include <unistd.h>
#include <signal.h>
Expand Down Expand Up @@ -197,7 +196,7 @@ fd_topo_install_xdp( fd_topo_t * topo ) {
FD_TEST( net0_tile_idx!=ULONG_MAX );
fd_topo_tile_t const * net0_tile = &topo->tiles[ net0_tile_idx ];

ushort udp_port_candidates[] = {
ushort udp_port_candidates[] = {
(ushort)net0_tile->net.legacy_transaction_listen_port,
(ushort)net0_tile->net.quic_transaction_listen_port,
(ushort)net0_tile->net.shred_listen_port,
Expand Down
Loading