diff --git a/HISTORY b/HISTORY index 3c30daa4..9a5f2c00 100644 --- a/HISTORY +++ b/HISTORY @@ -1,8 +1,9 @@ SnapRAID HISTORY ================ -11.4 2020/05 (WorkInProgress) +11.4 2020/05 ============================= + * Fix build errors due new gcc 10 default for -fno-common. * In fixing, if a parity is filtered out, don't attempt to recover its size, and proceed without it if missing. * Avoid unnecessary parity read when fixing the parity itself. diff --git a/cmdline/io.c b/cmdline/io.c index c71ba411..156d512f 100644 --- a/cmdline/io.c +++ b/cmdline/io.c @@ -19,6 +19,19 @@ #include "io.h" +void (*io_start)(struct snapraid_io* io, + block_off_t blockstart, block_off_t blockmax, + int (*block_is_enabled)(void* arg, block_off_t), void* blockarg) = 0; +void (*io_stop)(struct snapraid_io* io) = 0; +block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer) = 0; +struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac) = 0; +struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac) = 0; +void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac) = 0; +void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip) = 0; +void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error) = 0; +void (*io_refresh)(struct snapraid_io* io) = 0; + + /** * Get the next block position to process. */ diff --git a/cmdline/io.h b/cmdline/io.h index 82ec7448..ea6644bb 100644 --- a/cmdline/io.h +++ b/cmdline/io.h @@ -313,14 +313,14 @@ void io_done(struct snapraid_io* io); /** * Start all the worker threads. */ -void (*io_start)(struct snapraid_io* io, +extern void (*io_start)(struct snapraid_io* io, block_off_t blockstart, block_off_t blockmax, int (*block_is_enabled)(void* arg, block_off_t), void* blockarg); /** * Stop all the worker threads. */ -void (*io_stop)(struct snapraid_io* io); +extern void (*io_stop)(struct snapraid_io* io); /** * Next read position. @@ -332,7 +332,7 @@ void (*io_stop)(struct snapraid_io* io); * \param buffer The data buffers to use for this position. * \return The parity position. */ -block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer); +extern block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer); /** * Read a data block. @@ -343,7 +343,7 @@ block_off_t (*io_read_next)(struct snapraid_io* io, void*** buffer); * \param diskcur The position of the data block in the ::handle_map vector. * \return The completed task. */ -struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac); +extern struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, unsigned* waiting_map, unsigned* waiting_mac); /** * Read a parity block. @@ -354,7 +354,7 @@ struct snapraid_task* (*io_data_read)(struct snapraid_io* io, unsigned* diskcur, * \param levcur The position of the parity block in the ::parity_handle_map vector. * \return The completed task. */ -struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); +extern struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); /** * Write of a parity block. @@ -364,7 +364,7 @@ struct snapraid_task* (*io_parity_read)(struct snapraid_io* io, unsigned* levcur * \param io InputOutput context. * \param levcur The position of the parity block in the ::parity_handle_map vector. */ -void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); +extern void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* waiting_map, unsigned* waiting_mac); /** * Preset the write position. @@ -376,7 +376,7 @@ void (*io_parity_write)(struct snapraid_io* io, unsigned* levcur, unsigned* wait * \param blockcur The parity position to write. * \param skip Skip the writes, in case parity doesn't need to be updated. */ -void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip); +extern void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip); /** * Next write position. @@ -389,12 +389,12 @@ void (*io_write_preset)(struct snapraid_io* io, block_off_t blockcur, int skip); * \param skip Skip the writes, in case parity doesn't need to be updated. * \param writer_error Return the number of errors. Vector of IO_WRITER_ERROR_MAX elements. */ -void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error); +extern void (*io_write_next)(struct snapraid_io* io, block_off_t blockcur, int skip, int* writer_error); /** * Refresh the number of cached blocks for all data and parity disks. */ -void (*io_refresh)(struct snapraid_io* io); +extern void (*io_refresh)(struct snapraid_io* io); #endif diff --git a/cmdline/portable.h b/cmdline/portable.h index 19e6fe1d..a665a550 100644 --- a/cmdline/portable.h +++ b/cmdline/portable.h @@ -389,14 +389,14 @@ void os_clear(void); * * If no log file is selected, it's 0. */ -FILE* stdlog; +extern FILE* stdlog; /** * Exit codes for testing. */ -int exit_success; -int exit_failure; -int exit_sync_needed; +extern int exit_success; +extern int exit_failure; +extern int exit_sync_needed; #undef EXIT_SUCCESS #undef EXIT_FAILURE #define EXIT_SUCCESS exit_success diff --git a/cmdline/stream.h b/cmdline/stream.h index 35b941f6..6ec33912 100644 --- a/cmdline/stream.h +++ b/cmdline/stream.h @@ -28,7 +28,7 @@ * * It's not a constant for testing purpose. */ -unsigned STREAM_SIZE; +extern unsigned STREAM_SIZE; #define STREAM_STATE_READ 0 /**< The stream is in a normal state of read. */ #define STREAM_STATE_WRITE 1 /**< The stream is in a normal state of write. */ diff --git a/cmdline/support.c b/cmdline/support.c index 80dfa5c2..0bda1284 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -79,6 +79,7 @@ void lock_done(void) /* print */ int msg_level = 0; +FILE* stdlog = 0; /* * Note that in the following functions we always flush both diff --git a/cmdline/support.h b/cmdline/support.h index 5bde967a..e7e76b5f 100644 --- a/cmdline/support.h +++ b/cmdline/support.h @@ -415,7 +415,7 @@ int smartctl_flush(FILE* f, const char* file, const char* name); * * Ensure to change that before starting any thread. */ -int thread_cond_signal_outside; +extern int thread_cond_signal_outside; /** * Thread wrappers to handle error conditions. diff --git a/cmdline/util.h b/cmdline/util.h index 3d7e3941..8717a14c 100644 --- a/cmdline/util.h +++ b/cmdline/util.h @@ -161,7 +161,7 @@ static inline uint32_t crc32c_plain(uint32_t crc, const unsigned char* ptr, unsi /** * Compute the CRC-32 (Castagnoli) */ -uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size); +extern uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size); /** * Internal entry points for testing. diff --git a/configure.ac b/configure.ac index 267bebb7..f82b6c52 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,8 @@ AC_CHECK_CC_OPT([-fno-omit-frame-pointer], CFLAGS="$CFLAGS -fno-omit-frame-point AC_CHECK_CC_OPT([-fno-inline-functions-called-once], CFLAGS="$CFLAGS -fno-inline-functions-called-once", []) AC_CHECK_CC_OPT([-fno-inline-small-functions], CFLAGS="$CFLAGS -fno-inline-small-functions", []) AC_CHECK_CC_OPT([-rdynamic], CFLAGS="$CFLAGS -rdynamic", []) +# This the new default for gcc 10 +AC_CHECK_CC_OPT([-fno-common], CFLAGS="$CFLAGS -fno-common", []) dnl Options to improve the performance AC_CHECK_CC_OPT([-march=native], CFLAGS="$CFLAGS -march=native", [])