Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2011 18:35:43 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220527 - in head/sys: kern sys
Message-ID:  <201104101835.p3AIZhO8056047@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Apr 10 18:35:43 2011
New Revision: 220527
URL: http://svn.freebsd.org/changeset/base/220527

Log:
  Rename a misnamed structure field (hr_loginclass), and reorder priv(9)
  constants to match the order and naming of syscalls.  No functional changes.

Modified:
  head/sys/kern/kern_rctl.c
  head/sys/sys/priv.h
  head/sys/sys/rctl.h

Modified: head/sys/kern/kern_rctl.c
==============================================================================
--- head/sys/kern/kern_rctl.c	Sun Apr 10 17:07:02 2011	(r220526)
+++ head/sys/kern/kern_rctl.c	Sun Apr 10 18:35:43 2011	(r220527)
@@ -475,9 +475,9 @@ rctl_rule_matches(const struct rctl_rule
 				return (0);
 			break;
 		case RCTL_SUBJECT_TYPE_LOGINCLASS:
-			if (filter->rr_subject.hr_loginclass != NULL &&
-			    rule->rr_subject.hr_loginclass !=
-			    filter->rr_subject.hr_loginclass)
+			if (filter->rr_subject.rs_loginclass != NULL &&
+			    rule->rr_subject.rs_loginclass !=
+			    filter->rr_subject.rs_loginclass)
 				return (0);
 			break;
 		case RCTL_SUBJECT_TYPE_JAIL:
@@ -642,8 +642,8 @@ rctl_rule_acquire_subject(struct rctl_ru
 			uihold(rule->rr_subject.rs_uip);
 		break;
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		if (rule->rr_subject.hr_loginclass != NULL)
-			loginclass_hold(rule->rr_subject.hr_loginclass);
+		if (rule->rr_subject.rs_loginclass != NULL)
+			loginclass_hold(rule->rr_subject.rs_loginclass);
 		break;
 	default:
 		panic("rctl_rule_acquire_subject: unknown subject type %d",
@@ -665,8 +665,8 @@ rctl_rule_release_subject(struct rctl_ru
 			uifree(rule->rr_subject.rs_uip);
 		break;
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		if (rule->rr_subject.hr_loginclass != NULL)
-			loginclass_free(rule->rr_subject.hr_loginclass);
+		if (rule->rr_subject.rs_loginclass != NULL)
+			loginclass_free(rule->rr_subject.rs_loginclass);
 		break;
 	default:
 		panic("rctl_rule_release_subject: unknown subject type %d",
@@ -685,7 +685,7 @@ rctl_rule_alloc(int flags)
 	rule->rr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED;
 	rule->rr_subject.rs_proc = NULL;
 	rule->rr_subject.rs_uip = NULL;
-	rule->rr_subject.hr_loginclass = NULL;
+	rule->rr_subject.rs_loginclass = NULL;
 	rule->rr_subject.rs_prison = NULL;
 	rule->rr_per = RCTL_SUBJECT_TYPE_UNDEFINED;
 	rule->rr_resource = RACCT_UNDEFINED;
@@ -707,7 +707,7 @@ rctl_rule_duplicate(const struct rctl_ru
 	copy->rr_subject_type = rule->rr_subject_type;
 	copy->rr_subject.rs_proc = rule->rr_subject.rs_proc;
 	copy->rr_subject.rs_uip = rule->rr_subject.rs_uip;
-	copy->rr_subject.hr_loginclass = rule->rr_subject.hr_loginclass;
+	copy->rr_subject.rs_loginclass = rule->rr_subject.rs_loginclass;
 	copy->rr_subject.rs_prison = rule->rr_subject.rs_prison;
 	copy->rr_per = rule->rr_per;
 	copy->rr_resource = rule->rr_resource;
@@ -780,7 +780,7 @@ rctl_rule_fully_specified(const struct r
 			return (0);
 		break;
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		if (rule->rr_subject.hr_loginclass == NULL)
+		if (rule->rr_subject.rs_loginclass == NULL)
 			return (0);
 		break;
 	case RCTL_SUBJECT_TYPE_JAIL:
@@ -832,7 +832,7 @@ rctl_string_to_rule(char *rulestr, struc
 	if (subject_idstr == NULL || subject_idstr[0] == '\0') {
 		rule->rr_subject.rs_proc = NULL;
 		rule->rr_subject.rs_uip = NULL;
-		rule->rr_subject.hr_loginclass = NULL;
+		rule->rr_subject.rs_loginclass = NULL;
 		rule->rr_subject.rs_prison = NULL;
 	} else {
 		switch (rule->rr_subject_type) {
@@ -858,9 +858,9 @@ rctl_string_to_rule(char *rulestr, struc
 			rule->rr_subject.rs_uip = uifind(id);
 			break;
 		case RCTL_SUBJECT_TYPE_LOGINCLASS:
-			rule->rr_subject.hr_loginclass =
+			rule->rr_subject.rs_loginclass =
 			    loginclass_find(subject_idstr);
-			if (rule->rr_subject.hr_loginclass == NULL) {
+			if (rule->rr_subject.rs_loginclass == NULL) {
 				error = ENAMETOOLONG;
 				goto out;
 			}
@@ -1002,7 +1002,7 @@ rctl_rule_add(struct rctl_rule *rule)
 		break;
 
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		lc = rule->rr_subject.hr_loginclass;
+		lc = rule->rr_subject.rs_loginclass;
 		KASSERT(lc != NULL, ("rctl_rule_add: NULL loginclass"));
 		rctl_racct_add_rule(lc->lc_racct, rule);
 		break;
@@ -1034,7 +1034,7 @@ rctl_rule_add(struct rctl_rule *rule)
 				break;
 			continue;
 		case RCTL_SUBJECT_TYPE_LOGINCLASS:
-			if (cred->cr_loginclass == rule->rr_subject.hr_loginclass)
+			if (cred->cr_loginclass == rule->rr_subject.rs_loginclass)
 				break;
 			continue;
 		case RCTL_SUBJECT_TYPE_JAIL:
@@ -1137,11 +1137,11 @@ rctl_rule_to_sbuf(struct sbuf *sb, const
 			    rule->rr_subject.rs_uip->ui_uid);
 		break;
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		if (rule->rr_subject.hr_loginclass == NULL)
+		if (rule->rr_subject.rs_loginclass == NULL)
 			sbuf_printf(sb, ":");
 		else
 			sbuf_printf(sb, "%s:",
-			    rule->rr_subject.hr_loginclass->lc_name);
+			    rule->rr_subject.rs_loginclass->lc_name);
 		break;
 	case RCTL_SUBJECT_TYPE_JAIL:
 		if (rule->rr_subject.rs_prison == NULL)
@@ -1247,7 +1247,7 @@ rctl_get_racct(struct thread *td, struct
 	struct loginclass *lc;
 	struct prison *pr;
 
-	error = priv_check(td, PRIV_RCTL_GET_USAGE);
+	error = priv_check(td, PRIV_RCTL_GET_RACCT);
 	if (error != 0)
 		return (error);
 
@@ -1287,7 +1287,7 @@ rctl_get_racct(struct thread *td, struct
 		outputsbuf = rctl_racct_to_sbuf(uip->ui_racct, 1);
 		break;
 	case RCTL_SUBJECT_TYPE_LOGINCLASS:
-		lc = filter->rr_subject.hr_loginclass;
+		lc = filter->rr_subject.rs_loginclass;
 		if (lc == NULL) {
 			error = EINVAL;
 			goto out;

Modified: head/sys/sys/priv.h
==============================================================================
--- head/sys/sys/priv.h	Sun Apr 10 17:07:02 2011	(r220526)
+++ head/sys/sys/priv.h	Sun Apr 10 18:35:43 2011	(r220527)
@@ -486,11 +486,11 @@
 /*
  * Resource Limits privileges.
  */
-#define	PRIV_RCTL_GET_RULES	670
-#define	PRIV_RCTL_ADD_RULE	671
-#define	PRIV_RCTL_REMOVE_RULE	672
-#define	PRIV_RCTL_GET_USAGE	673
-#define	PRIV_RCTL_GET_LIMITS	674
+#define	PRIV_RCTL_GET_RACCT	670
+#define	PRIV_RCTL_GET_RULES	671
+#define	PRIV_RCTL_GET_LIMITS	672
+#define	PRIV_RCTL_ADD_RULE	673
+#define	PRIV_RCTL_REMOVE_RULE	674
 
 /*
  * Track end of privilege list.

Modified: head/sys/sys/rctl.h
==============================================================================
--- head/sys/sys/rctl.h	Sun Apr 10 17:07:02 2011	(r220526)
+++ head/sys/sys/rctl.h	Sun Apr 10 18:35:43 2011	(r220527)
@@ -67,10 +67,10 @@ struct rctl_rule_link;
 struct rctl_rule {
 	int		rr_subject_type;
 	union {
-		struct proc	*rs_proc;
-		struct uidinfo	*rs_uip;
-		struct loginclass *hr_loginclass;
-		struct prison	*rs_prison;
+		struct proc		*rs_proc;
+		struct uidinfo		*rs_uip;
+		struct loginclass	*rs_loginclass;
+		struct prison		*rs_prison;
 	} rr_subject;
 	int		rr_per;
 	int		rr_resource;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104101835.p3AIZhO8056047>