drr_begin: can't forward declare untagged struct

When compiling with Clang++ it does not allow for untagged structs, so
struct ddr_begin needs to be declared before the struct that uses it.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #10453
This commit is contained in:
Jorgen Lundman 2020-06-17 03:57:04 +09:00 committed by GitHub
parent 86a0f49483
commit cd07d7c83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,15 +224,8 @@ typedef enum dmu_send_resume_token_version {
/* /*
* zfs ioctl command structure * zfs ioctl command structure
*/ */
typedef struct dmu_replay_record {
enum { /* Header is used in C++ so can't forward declare untagged struct */
DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_OBJECT_RANGE, DRR_REDACT,
DRR_NUMTYPES
} drr_type;
uint32_t drr_payloadlen;
union {
struct drr_begin { struct drr_begin {
uint64_t drr_magic; uint64_t drr_magic;
uint64_t drr_versioninfo; /* was drr_version */ uint64_t drr_versioninfo; /* was drr_version */
@ -242,7 +235,18 @@ typedef struct dmu_replay_record {
uint64_t drr_toguid; uint64_t drr_toguid;
uint64_t drr_fromguid; uint64_t drr_fromguid;
char drr_toname[MAXNAMELEN]; char drr_toname[MAXNAMELEN];
} drr_begin; };
typedef struct dmu_replay_record {
enum {
DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_OBJECT_RANGE, DRR_REDACT,
DRR_NUMTYPES
} drr_type;
uint32_t drr_payloadlen;
union {
struct drr_begin drr_begin;
struct drr_end { struct drr_end {
zio_cksum_t drr_checksum; zio_cksum_t drr_checksum;
uint64_t drr_toguid; uint64_t drr_toguid;