lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070510104216.GK4629@kernel.dk>
Date:	Thu, 10 May 2007 12:42:17 +0200
From:	Jens Axboe <jens.axboe@...cle.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/13] Add sg helpers for iterating over a scatterlist  table

On Thu, May 10 2007, Andrew Morton wrote:
> On Thu, 10 May 2007 12:21:44 +0200 Jens Axboe <jens.axboe@...cle.com> wrote:
> 
> > First step to being able to change the scatterlist setup without
> > having to modify drivers (a lot :-)
> > 
> > Signed-off-by: Jens Axboe <jens.axboe@...cle.com>
> > ---
> >  include/linux/scatterlist.h |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> > index 4efbd9c..c5bffde 100644
> > --- a/include/linux/scatterlist.h
> > +++ b/include/linux/scatterlist.h
> > @@ -20,4 +20,13 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> >  	sg_set_buf(sg, buf, buflen);
> >  }
> >  
> > +#define sg_next(sg)		((sg) + 1)
> > +#define sg_last(sg, nents)	(&(sg[nents - 1]))
> 
> Looks a bit underparenthesised.
> 
> > +/*
> > + * Loop over each sg element, following the pointer to a new list if necessary
> > + */
> > +#define for_each_sg(sglist, sg, nr, __i)	\
> > +	for (__i = 0, sg = (sglist); __i < nr; __i++, sg = sg_next(sg))
> > +
> 
> So does this.

Yeah I know, both of these are fixed up when the chain support is added
(patch 07). So I didn't bother fixing these up, but I will make a note
of it for the first round.

> I don't see how it "follows the pointer to a new list".  All it's doing is
> iterating across an array?

It doesn't, this first patch just allows you to convert drivers to
using for_each_sg() to loop over sg elements. Then you can later
introduce sg chaining behind their back, they don't have to know about
that.

Patch 07 is the one that enables sg chaining for x86 and includes the
generic bits for linux/scatterlist.h.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ