lkml.org 
[lkml]   [2010]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC, 3/7] NUMA hotplug emulator
On Fri, May 14, 2010 at 01:32:02PM +0800, Haicheng Li wrote:
> Wu Fengguang wrote:
> >> Pls. replace it with following code:
> >>
> >> +#ifdef CONFIG_NODE_HOTPLUG_EMU
> >> +static ssize_t store_nodes_probe(struct sysdev_class *class,
> >> + struct sysdev_class_attribute *attr,
> >> + const char *buf, size_t count)
> >> +{
> >> + long nid;
> >> + int ret;
> >> +
> >> + ret = strict_strtol(buf, 0, &nid);
> >> + if (ret == -EINVAL)
> >> + return ret;
> >> +
> >> + ret = hotadd_hidden_nodes(nid);
> >> + if (!ret)
> >> + return count;
> >> + else
> >> + return -EIO;
> >> +}
> >> +#endif
> >
> > How about this?
> >
> > err = strict_strtol(buf, 0, &nid);
> > if (err < 0)
> > return err;
>
> other negative value would be odd here.

Yes, strict_strtoul() will be better.

> > err = hotadd_hidden_nodes(nid);
> > if (err < 0)
> > return err;
>
> hotadd_hidden_nodes could return -EEXIST, which is also odd here, right?

Why not? write(2) says "Other errors may occur, depending on the
object connected to fd."

Thanks,
Fengguang


\
 
 \ /
  Last update: 2010-05-14 07:55    [W:0.107 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site