Re: [PATCH] fix build when USE_BPF is not defined

Dave Jones <[email protected]> Tue, 8 Nov 2016 10:00:30 -0500
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
On Tue, Nov 08, 2016 at 11:46:01AM +0100, Jan Stancek wrote:
 > On 11/07/2016 03:34 PM, Dave Jones wrote:
 > > I think it might be better if we wrap all of net/bpf.c in this ifdef,
 > > and then add additional ones wherever we call bpf_gen_filter.
 > > (Right now only two places iirc)
 > 
 > Attached is v2, that follows your suggestion.
 
 Close..
 
 > diff --git a/syscalls/bpf.c b/syscalls/bpf.c
 > index 476a2778d8a0..372ab6dc5376 100644
 > --- a/syscalls/bpf.c
 > +++ b/syscalls/bpf.c
 > @@ -29,9 +29,11 @@ static void bpf_prog_load(struct syscallrecord *rec)
 >  	attr->prog_type = RAND_ARRAY(bpf_prog_types);
 >  
 >  	switch (attr->prog_type) {
 > +#ifdef USE_BPF
 >  	case BPF_PROG_TYPE_SOCKET_FILTER:
 >  		bpf_gen_filter(&insns, &len);
 >  		break;
 > +#endif
 >  	default:
 >  		// this will go away when all the other cases are enumerated
 >  		insns = zmalloc(page_size);

This chunk isn't needed because the whole file is already wrapped.

	Dave