From johannes at johannesthoma.com Mon Feb 4 22:00:14 2019 From: johannes at johannesthoma.com (Johannes Thoma) Date: Mon, 4 Feb 2019 22:00:14 +0100 Subject: [Drbd-dev] [PATCH 1/2] WinDRBD compat headers: might also be defined in windrbd_ioctl.h Message-ID: <20190204210015.7457-1-johannes@johannesthoma.com> We made windrbd_ioctl.h usable outside drbd-utils: Hence we define GENL_NAMSIZ where it does not exist. Check in the compat headers if it is defined already. This commit only touches WinDRBD specific headers and hence should not break Linux builds. Signed-off-by: Johannes Thoma --- drbd-headers | 2 +- user/windrbd-compat-headers/linux/netlink.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drbd-headers b/drbd-headers index b5db4408..da78b84c 160000 --- a/drbd-headers +++ b/drbd-headers @@ -1 +1 @@ -Subproject commit b5db4408c02da6ad65e72edd7b254fd6c5ac3dd4 +Subproject commit da78b84ccdd438c21c44c2332040d31f37a77a76 diff --git a/user/windrbd-compat-headers/linux/netlink.h b/user/windrbd-compat-headers/linux/netlink.h index 0ce1d255..98ec271d 100644 --- a/user/windrbd-compat-headers/linux/netlink.h +++ b/user/windrbd-compat-headers/linux/netlink.h @@ -121,7 +121,10 @@ struct nlattr ///////////////////////////////////////////////////////////// // Genetlink.h ///////////////////////////////////////////////////////////// + +#ifndef GENL_NAMSIZ #define GENL_NAMSIZ 16 /* length of family name */ +#endif struct genlmsghdr { -- 2.17.0 From johannes at johannesthoma.com Mon Feb 4 22:00:15 2019 From: johannes at johannesthoma.com (Johannes Thoma) Date: Mon, 4 Feb 2019 22:00:15 +0100 Subject: [Drbd-dev] [PATCH 2/2] windrbd: Include stdbool.h for bool type. In-Reply-To: <20190204210015.7457-1-johannes@johannesthoma.com> References: <20190204210015.7457-1-johannes@johannesthoma.com> Message-ID: <20190204210015.7457-2-johannes@johannesthoma.com> It seems that windrbd tool didn't compile before. Signed-off-by: Johannes Thoma --- user/windrbd/windrbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/user/windrbd/windrbd.c b/user/windrbd/windrbd.c index 28385cf5..2602f599 100644 --- a/user/windrbd/windrbd.c +++ b/user/windrbd/windrbd.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include -- 2.17.0 From johannes at johannesthoma.com Mon Feb 4 21:59:52 2019 From: johannes at johannesthoma.com (Johannes Thoma) Date: Mon, 4 Feb 2019 21:59:52 +0100 Subject: [Drbd-dev] [PATCH] Make windrbd_ioctl.h usable without compat headers. Message-ID: <20190204205952.7412-1-johannes@johannesthoma.com> This includes: *) Not to use Linux kernel specific types (u32). Standard C types (uint32_t) are used instead. *) Define length of netlink message unless defined. Since this file is WinDRBD-only it should not break Linux builds. Signed-off-by: Johannes Thoma --- windrbd/windrbd_ioctl.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/windrbd/windrbd_ioctl.h b/windrbd/windrbd_ioctl.h index 0973a6be..22eb8af9 100644 --- a/windrbd/windrbd_ioctl.h +++ b/windrbd/windrbd_ioctl.h @@ -2,8 +2,16 @@ #define WINDRBD_IOCTL_H #include /* for int64_t */ -#include + +#ifdef __CYGWIN__ + +#ifndef GENL_NAMSIZ +#define GENL_NAMSIZ 16 +#endif + +#else #include +#endif /* For compiling this for drbd-utils when there are no Windows headers * installed, we need this (taken from ReactOS): Hopefully this never @@ -55,11 +63,11 @@ struct windrbd_ioctl_fault_injection { #define IOCTL_WINDRBD_INJECT_FAULTS CTL_CODE(WINDRBD_DEVICE_TYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) struct windrbd_ioctl_genl_portid { - u32 portid; + uint32_t portid; }; struct windrbd_ioctl_genl_portid_and_multicast_group { - u32 portid; + uint32_t portid; char name[GENL_NAMSIZ]; }; -- 2.17.0 From axboe at kernel.dk Tue Feb 12 22:36:20 2019 From: axboe at kernel.dk (Jens Axboe) Date: Tue, 12 Feb 2019 14:36:20 -0700 Subject: [Drbd-dev] [PATCH] drbd_receiver: mark expected switch fall-throughs In-Reply-To: <20190212212820.GA15942@embeddedor> References: <20190212212820.GA15942@embeddedor> Message-ID: <4a4429a8-56d4-b349-444c-282246537121@kernel.dk> On 2/12/19 2:28 PM, Gustavo A. R. Silva wrote: > In preparation to enabling -Wimplicit-fallthrough, mark switch > cases where we are expecting to fall through. > > This patch fixes the following warnings: > > drivers/block/drbd/drbd_receiver.c: In function ?drbd_asb_recover_0p?: > drivers/block/drbd/drbd_receiver.c:3093:6: warning: this statement may fall through [-Wimplicit-fallthrough=] > if (self == 1 && peer == 0) { > ^ > drivers/block/drbd/drbd_receiver.c:3098:2: note: here > case ASB_DISCARD_OLDER_PRI: > ^~~~ > drivers/block/drbd/drbd_receiver.c:3120:6: warning: this statement may fall through [-Wimplicit-fallthrough=] > if (after_sb_0p == ASB_DISCARD_ZERO_CHG) > ^ > drivers/block/drbd/drbd_receiver.c:3123:2: note: here > case ASB_DISCARD_LEAST_CHG: > ^~~~ > > Warning level 3 was used: -Wimplicit-fallthrough=3 > > Notice that in some cases, the code comment is modified in > accordance with what GCC is expecting to find. > > This patch is part of the ongoing efforts to enable > -Wimplicit-fallthrough. > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/block/drbd/drbd_receiver.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c > index c7ad88d91a09..78bb763a367d 100644 > --- a/drivers/block/drbd/drbd_receiver.c > +++ b/drivers/block/drbd/drbd_receiver.c > @@ -3094,7 +3094,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold > rv = 1; > break; > } > - /* Else fall through to one of the other strategies... */ > + /* Else fall through - to one of the other strategies... */ > case ASB_DISCARD_OLDER_PRI: > if (self == 0 && peer == 1) { > rv = 1; > @@ -3119,7 +3119,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold > } > if (after_sb_0p == ASB_DISCARD_ZERO_CHG) > break; > - /* else: fall through */ > + /* Else fall through */ This is getting really silly, as these two hunks both aptly demonstrate. Can we please inject some sanity into this fall through witch hunt? The last hunk is updating ANOTHER patch that also attempted to silence this stuff. -- Jens Axboe