From cc6df8a8b19af38dcabc8073aa94ef643d29c884 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Wed, 3 Jan 2024 13:16:12 +0000 Subject: [PATCH] wksp: clean up FD_WKSP_NO_LOCK_RECLAIM fd_wksp_admin.c assumes that FD_WKSP_NO_LOCK_RECLAIM is always defined via compile flags. The current Make config defines this macro then project-wide. This commit cleans up the integration by adding a sane default if the flag is not defined. --- config/base.mk | 2 +- src/flamenco/nanopb/README.txt | 13 ++++++++----- src/flamenco/nanopb/pb_firedancer.h | 11 +++++++++++ src/flamenco/types/fd_solana_block.pb.h | 7 ++++--- src/flamenco/types/fd_solana_block.proto | 1 + 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/config/base.mk b/config/base.mk index fa43b5ab19..2def13f80c 100644 --- a/config/base.mk +++ b/config/base.mk @@ -1,7 +1,7 @@ BASEDIR?=build SHELL:=bash -CPPFLAGS:=-isystem ./opt/include -DFD_LOG_UNCLEAN_EXIT=1 -DFD_HAS_BACKTRACE=0 -DPB_SYSTEM_HEADER="\"pb_firedancer.h\"" +CPPFLAGS:=-isystem ./opt/include -DFD_LOG_UNCLEAN_EXIT=1 -DFD_HAS_BACKTRACE=0 CC:=gcc CFLAGS:=-std=c17 CXX:=g++ diff --git a/src/flamenco/nanopb/README.txt b/src/flamenco/nanopb/README.txt index cd56d311b2..48b84fd566 100644 --- a/src/flamenco/nanopb/README.txt +++ b/src/flamenco/nanopb/README.txt @@ -1,10 +1,13 @@ This directory contains a copy of the Nanopb library. This library is copied exactly from commit `839156b`, and there are -no Firedancer specific modifications to the code. `pb_firedancer.h` -has a few Firedancer specific #defines, which are loaded into the -library by #define'ing the `PB_SYSTEM_HEADER` to it as part of our -build. You should not make local modifications to nanopb. instead -prefer to upstream changes, or make a local patch if needed. +no Firedancer specific modifications to the code. You should not make +local modifications to nanopb. Instead prefer to upstream changes, or +make a local patch if needed. For licensing information, refer to NOTICE in the root of this repo. + +nanopb_generator.py can be invoked like so: + + cd src/flamenco/types + nanopb_generator.py -L "" fd_solana_block.proto diff --git a/src/flamenco/nanopb/pb_firedancer.h b/src/flamenco/nanopb/pb_firedancer.h index ae234da654..840bb36e94 100644 --- a/src/flamenco/nanopb/pb_firedancer.h +++ b/src/flamenco/nanopb/pb_firedancer.h @@ -1,3 +1,10 @@ +#ifndef HEADER_fd_src_flamenco_nanopb_pb_firedancer_h +#define HEADER_fd_src_flamenco_nanopb_pb_firedancer_h + +#ifdef PB_H_INCLUDED +#error "Only include pb_firedancer.h" +#endif + #include #include #include @@ -10,3 +17,7 @@ #define PB_BUFFER_ONLY #define PB_FIELD_32BIT 1 #define PB_ENABLE_MALLOC 1 + +#include "pb.h" + +#endif /* HEADER_fd_src_flamenco_nanopb_pb_firedancer_h */ diff --git a/src/flamenco/types/fd_solana_block.pb.h b/src/flamenco/types/fd_solana_block.pb.h index eb9861c854..5efba0f8e5 100644 --- a/src/flamenco/types/fd_solana_block.pb.h +++ b/src/flamenco/types/fd_solana_block.pb.h @@ -1,9 +1,10 @@ /* Automatically generated nanopb header */ /* Generated by nanopb-0.4.8-dev */ -#ifndef PB_SOLANA_STORAGE_CONFIRMEDBLOCK_SRC_FLAMENCO_TYPES_FD_SOLANA_BLOCK_PB_H_INCLUDED -#define PB_SOLANA_STORAGE_CONFIRMEDBLOCK_SRC_FLAMENCO_TYPES_FD_SOLANA_BLOCK_PB_H_INCLUDED -#include "../nanopb/pb.h" +#ifndef PB_SOLANA_STORAGE_CONFIRMEDBLOCK_FD_SOLANA_BLOCK_PB_H_INCLUDED +#define PB_SOLANA_STORAGE_CONFIRMEDBLOCK_FD_SOLANA_BLOCK_PB_H_INCLUDED + +#include "../nanopb/pb_firedancer.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. diff --git a/src/flamenco/types/fd_solana_block.proto b/src/flamenco/types/fd_solana_block.proto index 149287d494..a95e42bd01 100644 --- a/src/flamenco/types/fd_solana_block.proto +++ b/src/flamenco/types/fd_solana_block.proto @@ -50,6 +50,7 @@ package solana.storage.ConfirmedBlock; import "nanopb.proto"; option (nanopb_fileopt).package = "fd_solblock"; +option (nanopb_fileopt).include = "../nanopb/pb_firedancer.h"; // Transaction related