Skip to content

Commit

Permalink
Fix build errors due new gcc 10 default for -fno-common
Browse files Browse the repository at this point in the history
  • Loading branch information
amadvance committed May 18, 2020
1 parent 2f9e0e6 commit 5bac3d6
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 17 deletions.
3 changes: 2 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 13 additions & 0 deletions cmdline/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
18 changes: 9 additions & 9 deletions cmdline/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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

8 changes: 4 additions & 4 deletions cmdline/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmdline/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
1 change: 1 addition & 0 deletions cmdline/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmdline/support.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmdline/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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", [])
Expand Down

0 comments on commit 5bac3d6

Please sign in to comment.