Re: [PATCH bpf-next 6/6] selftest/bpf/benchs: Add benchmark for hashmap lookups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/01/30 04:16, Andrii Nakryiko wrote:
> On Fri, Jan 27, 2023 at 10:14 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> wrote:
> >
> [...]
> > +
> > +       switch (key) {
> > +       case ARG_KEY_SIZE:
> > +               ret = strtol(arg, NULL, 10);
> > +               if (ret < 1 || ret > MAX_KEY_SIZE) {
> > +                       fprintf(stderr, "invalid key_size");
> > +                       argp_usage(state);
> > +               }
> > +               args.key_size = ret;
> > +               break;
> > +       case ARG_MAP_FLAGS:
> > +               if (!strncasecmp(arg, "0x", 2))
> > +                       ret = strtol(arg, NULL, 0x10);
> > +               else
> > +                       ret = strtol(arg, NULL, 10);
> 
> if you pass base as zero, strtol() will do this for you

Thanks, I didn't remeber this!

> > +               if (ret < 0 || ret > UINT_MAX) {
> > +                       fprintf(stderr, "invalid map_flags");
> > +                       argp_usage(state);
> > +               }
> > +               args.map_flags = ret;
> > +               break;
> 
> [...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux