Date: Sat, 24 Jun 2006 13:55:13 GMT From: Alex Lyashkov <als@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 99938 for review Message-ID: <200606241355.k5ODtDgn054184@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99938 Change 99938 by als@als_head on 2006/06/24 13:54:35 whitespace cleanup. remove duplicated case. Affected files ... .. //depot/projects/jail2/sys/kern/kern_jail2_resource.c#4 edit Differences ... ==== //depot/projects/jail2/sys/kern/kern_jail2_resource.c#4 (text+ko) ==== @@ -45,38 +45,38 @@ #define jprint(a...) /* printf(a) */ -static int +static int jail_setproclimit(struct prison *_pr, void *_data) { int error; int limit; - + error = copyin(_data, &limit, sizeof(limit)); if (error) return (error); - + sx_xlock(&allproc_lock); _pr->pr_tasks.jt_limit = limit; sx_xunlock(&allproc_lock); - + if (limit != 0) - JAIL_SET_PROCLIM(_pr); + JAIL_SET_PROCLIM(_pr); else - JAIL_CLEAR_PROCLIM(_pr); - + JAIL_CLEAR_PROCLIM(_pr); + return (0); } -static int +static int jail_setresource_int(uint32_t *res, void *_data) { int error; int limit; - + error = copyin(_data, &limit, sizeof(limit)); if (error) return (error); - + atomic_store_rel_int(res, limit); return (0); @@ -87,7 +87,7 @@ { struct prison *pr; int ret = 0; - + mtx_lock(&allprison_mtx); pr = prison_find(_j->ctx_id); mtx_unlock(&allprison_mtx); @@ -99,37 +99,27 @@ } switch(JAIL2_CMD(_j->cmd)) { - case J_SETVROOT: - if (JAIL_VROOT(pr) != NULL) { - if (JAIL_NPROCS(pr) != 0) { - ret = EPERM; + case J_SETPROCLIMIT: + ret = jail_setproclimit(pr, _j->data); break; - } - jail_destroyvroot(pr); - } - ret = jail_setvroot(pr, _td, _j->data); - break; - case J_SETPROCLIMIT: - ret = jail_setproclimit(pr, _j->data); - break; case J_INODEUSAGE: - ret = jail_setresource_int(&pr->pr_disk.pr_inodes, _j->data); - break; + ret = jail_setresource_int(&pr->pr_disk.pr_inodes, _j->data); + break; case J_INODELIMIT: - ret = jail_setresource_int(&pr->pr_disk.pr_l_inodes, _j->data); - break; + ret = jail_setresource_int(&pr->pr_disk.pr_l_inodes, _j->data); + break; case J_MSQLIMIT: - ret = jail_setresource_int(&pr->pr_ipc.msq_limit, _j->data); - break; + ret = jail_setresource_int(&pr->pr_ipc.msq_limit, _j->data); + break; case J_SEMLIMIT: - ret = jail_setresource_int(&pr->pr_ipc.sem_limit, _j->data); - break; + ret = jail_setresource_int(&pr->pr_ipc.sem_limit, _j->data); + break; case J_SHMLIMIT: - ret = jail_setresource_int(&pr->pr_ipc.shm_limit, _j->data); - break; + ret = jail_setresource_int(&pr->pr_ipc.shm_limit, _j->data); + break; case J_SETFILELIMIT: - ret = jail_setresource_int(&pr->pr_limits.fdlimit, _j->data); - break; + ret = jail_setresource_int(&pr->pr_limits.fdlimit, _j->data); + break; case J_SETMEMLIMIT: case J_SETRSSLIMIT: case J_SETTCPSOCKETSLIMIT: @@ -137,12 +127,12 @@ case J_CPUHARDLIMIT: case J_CPUSOFTLIMIT: default: - ret = EOPNOTSUPP; - break; + ret = EOPNOTSUPP; + break; } /* remove refs from find/create */ - prison_free (pr); + prison_free (pr); jprint("jail2_resouce return %d\n", ret); return (ret);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606241355.k5ODtDgn054184>