On Tue, 16 Sep 2008, Paul Moore wrote: > +/* Base length of the local tag (non-standard tag). > + * Tag definition (may change between kernel versions) > + * > + * 0 8 16 24 32 > + * +----------+----------+----------+----------+ > + * | 10000000 | 00001000 | unused (zero fill) | > + * +----------+----------+----------+----------+ > + * | 32-bit secid value (host byte order) | > + * +----------+----------+----------+----------+ > + * > + */ > +#define CIPSO_V4_TAG_LOC_BLEN 8 > + > +static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def, > + const struct netlbl_lsm_secattr *secattr, > + unsigned char *buffer, > + u32 buffer_len) > +{ > + if (!(secattr->flags & NETLBL_SECATTR_SECID)) > + return -EPERM; > + > + buffer[0] = 0x80; > + buffer[1] = 0x08; > + *(u32 *)&buffer[4] = secattr->attr.secid; > + > + return 8; > +} Macros would be nice for these, and why specify zero filling? (Setting and testing that would be wasted cycles, if you enforced it). - James -- James Morris <jmorris@xxxxxxxxx> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.