Messages in this thread |  | | Date | Thu, 19 Feb 2009 18:42:51 +0800 | | From | Herbert Xu <> | | Subject | Re: [PATCH] crypto: compress - Add pcomp interface |
| |
On Thu, Feb 19, 2009 at 10:12:18AM +0100, Geert Uytterhoeven wrote: > > IIUC, my setup() routines should decode the parameters using nla_parse()?
Right.
> And the caller of a setup() routine should encode the data. But how? All the > nla_put*() routines seem to be targeted at skb's.
The callers in the kernel should just lay it out on the stack, e.g.,
struct { struct nlattr foo; u32 foo_val; struct nlattr bar; u32 bar_val; ... };
Note that the netlink alignment is 4 so u32 doesn't need any padding though u8/u16 would need padding before the next nlattr. Although for our purposes u32 should be sufficient.
> The only place where nla_parse() is called with a void */length pair is > net/sched/em_meta.c:em_meta_change(). But I can find no place where the actual > TCA_EM_META_* fields are encoded.
For simple things like u32 the format is just header followed by the u32. See nla_get_u32 for details.
Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
|  |