On Thu, May 28, 2015 at 03:14:44PM +0800, Wangnan (F) wrote:
imo that would be an ugly API. You only want to do that to have
On 2015/5/28 14:09, Alexei Starovoitov wrote:
On Thu, May 28, 2015 at 11:09:50AM +0800, Wangnan (F) wrote:What about appending a flag into bpf_object__load() to let it know
However this breaks a law in current design that opening phase doesn'tI see, so you want 'parse elf' and 'create maps + load programs'
talk to kernel with sys_bpf() at all. All related staff is done in loading
phase. This principle ensures that in every systems, no matter it support
sys_bpf() or not, can read eBPF object without failure.
to be separate phases?
Fair enough. Then please add a call to release the information
collected from elf after program loading is done.
relocations and other things are not needed at that point.
whether to cleanup resource it taken or not? for example:
int bpf_object__load(struct bpf_object *obj, bool clean);
then we can further wrap it by a macro:
#define bpf_object__load_clean(o) bpf_object__load(o, true)
If 'clear' is true, after loading resources will be freed, and the same
object will be unable to reload again after unload. B doing this we can
avoid adding a new function.
one less library API function? I think it's cleaner to let user of
the library call it when necessary.
Or do cleaning unconditionally. I don't see a use case when the
same set of maps and programs would need to be loaded twice into the kernel.