Re: [Patch 1/8] Setup

Balbir Singh
2006-05-09T03:52:22Z

On Mon, May 08, 2006 at 02:17:13PM -0700, Andrew Morton wrote:
> Balbir Singh <balbir@in.ibm.com> wrote:
> >
> > /*
> > + * sub = end - start, in normalized form
> > + */
> > +static inline void timespec_sub(struct timespec *start, struct timespec *end,
> > + struct timespec *sub)
> > +{
> > + set_normalized_timespec(sub, end->tv_sec - start->tv_sec,
> > + end->tv_nsec - start->tv_nsec);
> > +}
>
> The interface might not be right here.
>
> - I think "lhs" and "rhs" would be better names than "start" and "end".
> After all, we don't _know_ that the caller is using the two times as a
> start and an end. The caller might be taking the difference between two
> differences, for example.
>
> - The existing timespec and timeval funtions tend to do return-by-value.
> So this would become
>
> static inline struct timespec timespec_sub(struct timespec lhs,
> struct timespec rhs)
>
> (and given that it's inlined, the added overhead of passing the
> arguments by value will be zero)

Agreed, I will make these changes.

>
> - If we don't want to do that then at least let's get the arguments in a
> sane order:
>
> static inline void timespec_sub(struct timespec *result,
> struct timespec lhs, struct timespec rhs)
>

--

Balbir Singh,
Linux Technology Center,
IBM Software Labs