[systemd-devel] [PATCH 2/3] journal: use audit event names instead of numbers

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Apr 23 20:57:50 PDT 2015


On Mon, Apr 20, 2015 at 05:06:33PM +0200, Lennart Poettering wrote:
> On Mon, 20.04.15 14:58, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > On Mon, Apr 20, 2015 at 04:43:20PM +0200, Lennart Poettering wrote:
> > > On Tue, 14.04.15 21:58, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> > > 
> > > > +const char *audit_type_name(int type,
> > > > +                            char buf[AUDIT_NAME_BUF_SIZE]) {
> > > > +        const char *s;
> > > > +
> > > > +        s = audit_type_to_string(type);
> > > > +        if (s)
> > > > +                return s;
> > > > +
> > > > +        /* This is inspired by DNS TYPEnnn formatting */
> > > > +        snprintf(buf, AUDIT_NAME_BUF_SIZE, "AUDIT%04i", type);
> > > > +        return buf;
> > > 
> > > Shouldn't we stick to <audit-xyz> at least, to stay congruent to what
> > > we so far did, at least for the unknown ones?
> > I thought the visual difference between the capitalized names and what we
> > used so far is too big: e.g. ADD_USER and <audit-1114>, and it is better
> > to have something visually similar at least.
> 
> Hmm, I see. You do have a point, hence go ahead.
> 
> > > Also, may turn this into a macro expression using ({}) that returns
> > > this as alloca() allocated string? 
> >
> > You mean the whole function? I'll try that. The only downside is it
> > cannot be called directly in the args to another function.
> 
> Yeah, the whole function.
> 
> Make sure to name this in a way that it is clear that this is an
> alloca()-based macro, by including an _alloca() suffix or so?
> 
> Also see procfs_file_alloca() or inspiration.

I now pushed something along those lines. Seems simple enough
not to warrant another posting to the mailing list.

Zbyszek


More information about the systemd-devel mailing list