Den tors 24 jan. 2019 kl 14:08 skrev Daniel Borkmann <dan...@iogearbox.net>: > [...] > >>> +#ifndef _LINUX_XDP_DIAG_H > >>> +#define _LINUX_XDP_DIAG_H > >>> + > >>> +#include <linux/types.h> > >>> + > >>> +struct xdp_diag_req { > >>> + __u8 sdiag_family; > >>> + __u8 sdiag_protocol; > >>> + __u16 pad; > >> > >> Presumably this one is for future use? Maybe better as '__u16 :16;' to > >> avoid compile errors if someone tries to zero 'pad' member manually? > > > > The "pad" was there simply to have an explicitly named structure hole. > > I'm not following the bitfield argument. Why does that avoid compiler > > errors? > > Mostly in the sense that an application would explicitly set 'pad = 0' > whereas pad could later on potentially be renamed and reused otherwise > (which __u16 :16 would avoid in first place). But looking at other > *_diag_req structs, it's explicitly named as 'pad' elsewhere already, > then nevermind, lets have it rather consistent then and keep as is. >
Ok, thanks for clearing it up. I'll address all your comments, and also adds a "pad" member in msg for consistency. > One small thing I still spotted when looking at it again, in function > xsk_diag_handler_dump() the req is unused. > Ah, thank you. Björn > Thanks, > Daniel