Add a meta-parameter IP__NULL to enum intparam, instead of mixing

enum values and zeroes.  This keeps clang happy (and is just good form).

Submitted by:	dim
This commit is contained in:
Jamie Gritton 2012-05-03 21:39:23 +00:00
parent 35840dd335
commit 6fcbac3cd5
4 changed files with 11 additions and 10 deletions

View file

@ -100,7 +100,7 @@ next_command(struct cfjail *j)
if (j->comstring == NULL) {
j->comparam += create_failed ? -1 : 1;
switch ((comparam = *j->comparam)) {
case 0:
case IP__NULL:
return 0;
case IP_MOUNT_DEVFS:
if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))

View file

@ -328,7 +328,7 @@ add_param(struct cfjail *j, const struct cfparam *p, enum intparam ipnum,
}
} else {
flags = PF_APPEND;
if (ipnum != 0) {
if (ipnum != IP__NULL) {
name = intparams[ipnum].name;
flags |= intparams[ipnum].flags;
} else if ((cs = strchr(value, '='))) {
@ -350,7 +350,7 @@ add_param(struct cfjail *j, const struct cfparam *p, enum intparam ipnum,
}
/* See if this parameter has already been added. */
if (ipnum != 0)
if (ipnum != IP__NULL)
dp = j->intparams[ipnum];
else
TAILQ_FOREACH(dp, &j->params, tq)
@ -375,10 +375,10 @@ add_param(struct cfjail *j, const struct cfparam *p, enum intparam ipnum,
np->flags = flags;
np->gen = 0;
TAILQ_INSERT_TAIL(&j->params, np, tq);
if (ipnum != 0)
if (ipnum != IP__NULL)
j->intparams[ipnum] = np;
else
for (ipnum = 1; ipnum < IP_NPARAM; ipnum++)
for (ipnum = IP__NULL + 1; ipnum < IP_NPARAM; ipnum++)
if (!(intparams[ipnum].flags & PF_CONV) &&
equalopts(name, intparams[ipnum].name)) {
j->intparams[ipnum] = np;

View file

@ -81,7 +81,7 @@ static struct permspec perm_sysctl[] = {
};
static const enum intparam startcommands[] = {
0,
IP__NULL,
#ifdef INET
IP__IP4_IFADDR,
#endif
@ -97,11 +97,11 @@ static const enum intparam startcommands[] = {
IP_EXEC_START,
IP_COMMAND,
IP_EXEC_POSTSTART,
0
IP__NULL
};
static const enum intparam stopcommands[] = {
0,
IP__NULL,
IP_EXEC_PRESTOP,
IP_EXEC_STOP,
IP_STOP_TIMEOUT,
@ -116,7 +116,7 @@ static const enum intparam stopcommands[] = {
#ifdef INET
IP__IP4_IFADDR,
#endif
0
IP__NULL
};
int

View file

@ -71,7 +71,8 @@
#define JF_DO_STOP(js) (((js) & (JF_SET | JF_STOP)) == JF_STOP)
enum intparam {
IP_ALLOW_DYING = 1, /* Allow making changes to a dying jail */
IP__NULL = 0, /* Null command */
IP_ALLOW_DYING, /* Allow making changes to a dying jail */
IP_COMMAND, /* Command run inside jail at creation */
IP_DEPEND, /* Jail starts after (stops before) another */
IP_EXEC_CLEAN, /* Run commands in a clean environment */