Re: [PATCH v2] cmdfilter: clean up sysfs interface

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

 



On Fri, 8 Aug 2008 09:47:44 +0200
"Adel Gadllah" <adel.gadllah@xxxxxxxxx> wrote:

> >> +     while ((p = strsep((char **)&page, " ")) != NULL) {
> >> +             set = 1;
> >> +
> >> +             if (p[0] == '-') {
> >> +                     set = 0;
> >> +                     p++;
> >> +             }
> >>
> >> -     for (len = strlen(page); len > 0; len -= 3) {
> >> -             if (len < 2)
> >> -                     break;
> >> -             ss.from = (char *) page + ret;
> >> -             ss.to = (char *) page + ret + 2;
> >> -             ret += 3;
> >> +             if (p[0] == '+')
> >> +                     p++;
> >> +             ss.from = (char *) p;
> >> +             ss.to = (char *) p + 4;
> >>               status = match_hex(&ss, &cmd);
> >
> > how about using simple_strtol here? It can handle an value too.
> 
> by value you mean a non hex input?

Oops, "it can handle a sign" But I found that simple_strtol can't
handle '+' though glibc strtol can. Please ignore this comment.

After looking at the string helper functions, here are some new
comments:

o match_hex just uses simple_strtol internally. So I don't think that
we need it here. we can simply use simple_strtol.

o simple_strtol can handle '-' sign. So we don't need:


> >> +             if (p[0] == '-') {
> >> +                     set = 0;
> >> +                     p++;
> >> +             }
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux