PERFORCE change 180232 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Jun 26 06:36:54 UTC 2010


http://p4web.freebsd.org/@@180232?ac=10

Change 180232 by trasz at trasz_victim on 2010/06/26 06:36:08

	s/hrl_container/container/g

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#2 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#75 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_jail.c#21 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#17 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#32 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/container.h#2 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/hrl.h#44 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/jail.h#15 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/loginclass.h#8 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/proc.h#21 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/resourcevar.h#18 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#2 (text+ko) ====

@@ -55,7 +55,7 @@
 extern struct mtx hrl_lock;
 
 static void
-hrl_container_add(struct hrl_container *dest, const struct hrl_container *src)
+container_add(struct container *dest, const struct container *src)
 {
 	int i;
 
@@ -73,7 +73,7 @@
 }
 
 static void
-hrl_container_subtract(struct hrl_container *dest, const struct hrl_container *src)
+container_subtract(struct container *dest, const struct container *src)
 {
 	int i;
 
@@ -93,7 +93,7 @@
 }
 
 void
-hrl_container_join(struct hrl_container *child, struct hrl_container *parent)
+container_join(struct container *child, struct container *parent)
 {
 	int i;
 
@@ -106,7 +106,7 @@
 		    ("container already joined"));
 		if (child->hc_parents[i] == NULL) {
 			child->hc_parents[i] = parent;
-			hrl_container_add(parent, child);
+			container_add(parent, child);
 			return;
 		}
 	}
@@ -114,7 +114,7 @@
 }
 
 void
-hrl_container_leave(struct hrl_container *child, struct hrl_container *parent)
+container_leave(struct container *child, struct container *parent)
 {
 	int i;
 
@@ -124,7 +124,7 @@
 
 	for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) {
 		if (child->hc_parents[i] == parent) {
-			hrl_container_subtract(parent, child);
+			container_subtract(parent, child);
 			child->hc_parents[i] = NULL;
 			return;
 		}
@@ -133,7 +133,7 @@
 }
 
 static void
-hrl_container_leave_parents(struct hrl_container *child)
+container_leave_parents(struct container *child)
 {
 	int i;
 
@@ -143,13 +143,13 @@
 	for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) {
 		if (child->hc_parents[i] == NULL)
 			continue;
-		hrl_container_subtract(child->hc_parents[i], child);
+		container_subtract(child->hc_parents[i], child);
 		child->hc_parents[i] = NULL;
 	}
 }
 
 void
-hrl_container_create(struct hrl_container *container)
+container_create(struct container *container)
 {
 	int i;
 
@@ -162,7 +162,7 @@
 }
 
 void
-hrl_container_destroy(struct hrl_container *container)
+container_destroy(struct container *container)
 {
 	int i;
 
@@ -176,7 +176,7 @@
 		container->hc_resources[i] = 0;
 	}
 
-	hrl_container_leave_parents(container);
+	container_leave_parents(container);
 	mtx_unlock(&hrl_lock);
 }
 
@@ -185,10 +185,10 @@
  * Go through the resource consumption information and make sure it makes sense.
  */
 static void
-hrl_container_assert(const struct hrl_container *container)
+container_assert(const struct container *container)
 {
 	int i, resource;
-	struct hrl_container *parent;
+	struct container *parent;
 
 	mtx_assert(&hrl_lock, MA_OWNED);
 	KASSERT(container != NULL, ("NULL container"));
@@ -202,7 +202,7 @@
 		parent = container->hc_parents[i];
 		if (parent == NULL);
 			continue;
-		hrl_container_assert(parent);
+		container_assert(parent);
 		for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) {
 			KASSERT(parent->hc_resources[resource] >=
 			    container->hc_resources[resource],
@@ -218,7 +218,7 @@
  * may be less than zero.
  */
 static void
-hrl_container_alloc_resource(struct hrl_container *container, int resource,
+container_alloc_resource(struct container *container, int resource,
     uint64_t amount)
 {
 	int i;
@@ -230,10 +230,10 @@
 	for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) {
 		if (container->hc_parents[i] == NULL)
 			continue;
-		hrl_container_alloc_resource(container->hc_parents[i], resource, amount);
+		container_alloc_resource(container->hc_parents[i], resource, amount);
 	}
 #ifdef DIAGNOSTIC
-	hrl_container_assert(container);
+	container_assert(container);
 #endif
 }
 
@@ -259,7 +259,7 @@
 		mtx_unlock(&hrl_lock);
 		return (error);
 	}
-	hrl_container_alloc_resource(&p->p_container, resource, amount);
+	container_alloc_resource(&p->p_container, resource, amount);
 	mtx_unlock(&hrl_lock);
 
 	return (0);
@@ -294,7 +294,7 @@
 			return (error);
 		}
 	}
-	hrl_container_alloc_resource(&p->p_container, resource, diff);
+	container_alloc_resource(&p->p_container, resource, diff);
 	mtx_unlock(&hrl_lock);
 
 	return (0);
@@ -320,6 +320,6 @@
 	    "%ld for %s (pid %d)", amount, hrl_resource_name(resource),
 	    p->p_container.hc_resources[resource], p->p_comm, p->p_pid));
 
-	hrl_container_alloc_resource(&p->p_container, resource, -amount);
+	container_alloc_resource(&p->p_container, resource, -amount);
 	mtx_unlock(&hrl_lock);
 }

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#75 (text+ko) ====

@@ -511,7 +511,7 @@
  * Connect the rule to the container, increasing refcount for the rule.
  */
 static void
-hrl_container_add_rule(struct hrl_container *container, struct hrl_rule *rule)
+hrl_container_add_rule(struct container *container, struct hrl_rule *rule)
 {
 	struct hrl_rule_link *link;
 
@@ -527,7 +527,7 @@
 }
 
 static int
-hrl_container_add_rule_locked(struct hrl_container *container, struct hrl_rule *rule)
+hrl_container_add_rule_locked(struct container *container, struct hrl_rule *rule)
 {
 	struct hrl_rule_link *link;
 
@@ -550,7 +550,7 @@
  * the number of limit structures removed.
  */
 static int
-hrl_container_remove_rules(struct hrl_container *container,
+hrl_container_remove_rules(struct container *container,
     const struct hrl_rule *filter)
 {
 	int removed = 0;
@@ -972,7 +972,7 @@
 }
 
 static int
-hrl_rule_remove_callback(struct hrl_container *container, const struct hrl_rule *filter, void *arg3)
+hrl_rule_remove_callback(struct container *container, const struct hrl_rule *filter, void *arg3)
 {
 	int *found = (int *)arg3;
 
@@ -1121,7 +1121,7 @@
 }
 
 static struct sbuf *
-hrl_container_to_sbuf(struct hrl_container *container)
+hrl_container_to_sbuf(struct container *container)
 {
 	int i;
 	struct sbuf *sb;
@@ -1216,7 +1216,7 @@
 }
 
 static int
-hrl_get_rules_callback(struct hrl_container *container,
+hrl_get_rules_callback(struct container *container,
     const struct hrl_rule *filter, void *arg3)
 {
 	struct hrl_rule_link *link;
@@ -1457,10 +1457,10 @@
 
 	mtx_lock(&hrl_lock);
 
-	hrl_container_create(&p->p_container);
-	hrl_container_join(&p->p_container, &cred->cr_ruidinfo->ui_container);
-	hrl_container_join(&p->p_container, &cred->cr_loginclass->lc_container);
-	hrl_container_join(&p->p_container, &cred->cr_prison->pr_container);
+	container_create(&p->p_container);
+	container_join(&p->p_container, &cred->cr_ruidinfo->ui_container);
+	container_join(&p->p_container, &cred->cr_loginclass->lc_container);
+	container_join(&p->p_container, &cred->cr_prison->pr_container);
 
 	mtx_unlock(&hrl_lock);
 }
@@ -1527,8 +1527,8 @@
 			KASSERT(error == 0, ("XXX: better error handling needed"));
 		}
 
-		hrl_container_leave(&p->p_container, &olduip->ui_container);
-		hrl_container_join(&p->p_container, &newuip->ui_container);
+		container_leave(&p->p_container, &olduip->ui_container);
+		container_join(&p->p_container, &newuip->ui_container);
 	}
 	if (newlc != oldlc) {
 		LIST_FOREACH(link, &newlc->lc_container.hc_rule_links, hrl_next) {
@@ -1536,8 +1536,8 @@
 			KASSERT(error == 0, ("XXX: better error handling needed"));
 		}
 
-		hrl_container_leave(&p->p_container, &oldlc->lc_container);
-		hrl_container_join(&p->p_container, &newlc->lc_container);
+		container_leave(&p->p_container, &oldlc->lc_container);
+		container_join(&p->p_container, &newlc->lc_container);
 	}
 	if (newpr != oldpr) {
 		LIST_FOREACH(link, &newpr->pr_container.hc_rule_links, hrl_next) {
@@ -1545,8 +1545,8 @@
 			KASSERT(error == 0, ("XXX: better error handling needed"));
 		}
 
-		hrl_container_leave(&p->p_container, &oldpr->pr_container);
-		hrl_container_join(&p->p_container, &newpr->pr_container);
+		container_leave(&p->p_container, &oldpr->pr_container);
+		container_join(&p->p_container, &newpr->pr_container);
 	}
 
 	mtx_unlock(&hrl_lock);
@@ -1563,7 +1563,7 @@
 	int error, i;
 	struct hrl_rule_link *link;
 	struct hrl_rule *rule;
-	struct hrl_container *container;
+	struct container *container;
 
 	PROC_LOCK(parent);
 	PROC_LOCK(child);
@@ -1573,12 +1573,12 @@
 	 * Create container for the child process and inherit containing
 	 * containers from the parent.
 	 */
-	hrl_container_create(&child->p_container);
+	container_create(&child->p_container);
 	for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) {
 		container = parent->p_container.hc_parents[i];
 		if (container == NULL)
 			continue;
-		hrl_container_join(&child->p_container, container);
+		container_join(&child->p_container, container);
 	}
 
 	for (i = 0; i <= HRL_RESOURCE_MAX; i++) {
@@ -1625,7 +1625,7 @@
 	hrl_allocated(p, HRL_RESOURCE_PTY, 0);
 
 	mtx_lock(&hrl_lock);
-	hrl_container_destroy(&p->p_container);
+	container_destroy(&p->p_container);
 	mtx_unlock(&hrl_lock);
 }
 

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_jail.c#21 (text+ko) ====

@@ -1185,7 +1185,7 @@
 			root = mypr->pr_root;
 			vref(root);
 		}
-		hrl_container_create(&pr->pr_container);
+		container_create(&pr->pr_container);
 		strlcpy(pr->pr_hostuuid, DEFAULT_HOSTUUID, HOSTUUIDLEN);
 		pr->pr_flags |= PR_HOST;
 #if defined(INET) || defined(INET6)
@@ -2518,7 +2518,7 @@
 		if (pr->pr_cpuset != NULL)
 			cpuset_rel(pr->pr_cpuset);
 		osd_jail_exit(pr);
-		hrl_container_destroy(&pr->pr_container);
+		container_destroy(&pr->pr_container);
 		free(pr, M_PRISON);
 
 		/* Removing a prison frees a reference on its parent. */

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#17 (text+ko) ====

@@ -86,7 +86,7 @@
 
 	mtx_lock(&loginclasses_lock);
 	if (refcount_release(&lc->lc_refcount)) {
-		hrl_container_destroy(&lc->lc_container);
+		container_destroy(&lc->lc_container);
 		LIST_REMOVE(lc, lc_next);
 		mtx_unlock(&loginclasses_lock);
 		free(lc, M_LOGINCLASS);
@@ -126,7 +126,7 @@
 	}
 
 	/* Add new loginclass. */
-	hrl_container_create(&newlc->lc_container);
+	container_create(&newlc->lc_container);
 	strcpy(newlc->lc_name, name);
 	refcount_init(&newlc->lc_refcount, 1);
 	LIST_INSERT_HEAD(&loginclasses, newlc, lc_next);
@@ -208,7 +208,7 @@
 }
 
 int
-loginclass_container_foreach(int (*callback)(struct hrl_container *container,
+loginclass_container_foreach(int (*callback)(struct container *container,
     const struct hrl_rule *filter, void *arg3),
     const struct hrl_rule *filter, void *arg3)
 {

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#32 (text+ko) ====

@@ -1338,7 +1338,7 @@
 			mtx_init(&uip->ui_vmsize_mtx, "ui_vmsize", NULL,
 			    MTX_DEF);
 			LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash);
-			hrl_container_create(&uip->ui_container);
+			container_create(&uip->ui_container);
 		}
 	}
 	uihold(uip);
@@ -1386,7 +1386,7 @@
 	/* Prepare for suboptimal case. */
 	rw_wlock(&uihashtbl_lock);
 	if (refcount_release(&uip->ui_ref)) {
-		hrl_container_destroy(&uip->ui_container);
+		container_destroy(&uip->ui_container);
 		LIST_REMOVE(uip, ui_hash);
 		rw_wunlock(&uihashtbl_lock);
 		if (uip->ui_sbsize != 0)
@@ -1410,7 +1410,7 @@
 }
 
 int
-ui_container_foreach(int (*callback)(struct hrl_container *container,
+ui_container_foreach(int (*callback)(struct container *container,
     const struct hrl_rule *filter, void *arg3),
     const struct hrl_rule *filter, void *arg3)
 {
@@ -1544,7 +1544,7 @@
 	/* Prepare for suboptimal case. */
 	rw_wlock(&gihashtbl_lock);
 	if (refcount_release(&gip->gi_ref)) {
-		hrl_container_destroy(&gip->gi_container);
+		container_destroy(&gip->gi_container);
 		LIST_REMOVE(gip, gi_hash);
 		rw_wunlock(&gihashtbl_lock);
 		free(gip, M_GIDINFO);
@@ -1558,7 +1558,7 @@
 }
 
 int
-gi_container_foreach(int (*callback)(struct hrl_container *container,
+gi_container_foreach(int (*callback)(struct container *container,
     const struct hrl_rule *filter, void *arg3),
     const struct hrl_rule *filter, void *arg3)
 {

==== //depot/projects/soc2009/trasz_limits/sys/sys/container.h#2 (text+ko) ====

@@ -66,7 +66,7 @@
 
 
 /*
- * 'hrl_container' defines resource consumption for a particular
+ * 'container' defines resource consumption for a particular
  * subject, such as process or jail. Containers form a graph - each
  * container has zero or more subcontainers and zero or more
  * "containing" containers (parents).  For example, container for
@@ -84,9 +84,9 @@
  *
  * This structure must be filled with zeroes initially.
  */
-struct hrl_container {
+struct container {
 	int64_t				hc_resources[HRL_RESOURCE_MAX + 1];
-	struct hrl_container		*hc_parents[HRL_HC_PARENTS_MAX + 1];
+	struct container		*hc_parents[HRL_HC_PARENTS_MAX + 1];
 	LIST_HEAD(, hrl_rule_link)	hc_rule_links;
 };
 
@@ -96,11 +96,11 @@
 int	hrl_allocated(struct proc *p, int object, uint64_t amount);
 void	hrl_free(struct proc *p, int object, uint64_t amount);
 
-void	hrl_container_create(struct hrl_container *container);
-void	hrl_container_destroy(struct hrl_container *container);
+void	container_create(struct container *container);
+void	container_destroy(struct container *container);
 
-void	hrl_container_join(struct hrl_container *child, struct hrl_container *parent);
-void	hrl_container_leave(struct hrl_container *child, struct hrl_container *parent);
+void	container_join(struct container *child, struct container *parent);
+void	container_leave(struct container *child, struct container *parent);
 
 #endif /* _KERNEL */
 

==== //depot/projects/soc2009/trasz_limits/sys/sys/hrl.h#44 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/sys/jail.h#15 (text+ko) ====

@@ -181,7 +181,7 @@
 	char		 pr_hostname[MAXHOSTNAMELEN];	/* (p) jail hostname */
 	char		 pr_domainname[MAXHOSTNAMELEN];	/* (p) jail domainname */
 	char		 pr_hostuuid[HOSTUUIDLEN];	/* (p) jail hostuuid */
-	struct hrl_container pr_container;		/* (*) HRL resource accounting */
+	struct container pr_container;			/* (*) resource accounting */
 };
 #endif /* _KERNEL || _WANT_PRISON */
 

==== //depot/projects/soc2009/trasz_limits/sys/sys/loginclass.h#8 (text+ko) ====

@@ -36,13 +36,13 @@
 	LIST_ENTRY(loginclass)	lc_next;
 	char			lc_name[MAXLOGNAME];
 	u_int			lc_refcount;
-	struct hrl_container	lc_container;
+	struct container	lc_container;
 };
 
 void	loginclass_acquire(struct loginclass *lc);
 void	loginclass_release(struct loginclass *lc);
 struct loginclass	*loginclass_find(const char *name);
-int	loginclass_container_foreach(int (*callback)(struct hrl_container *container,
+int	loginclass_container_foreach(int (*callback)(struct container *container,
 	    const struct hrl_rule *filter, void *arg3),
 	    const struct hrl_rule *filter, void *arg3);
 

==== //depot/projects/soc2009/trasz_limits/sys/sys/proc.h#21 (text+ko) ====

@@ -523,7 +523,7 @@
 	int		p_boundary_count;/* (c) Num threads at user boundary */
 	int		p_pendingcnt;	/* how many signals are pending */
 	struct itimers	*p_itimers;	/* (c) POSIX interval timers. */
-	struct hrl_container p_container;	/* (*) HRL resource accounting */
+	struct container p_container;	/* (*) resource usage accounting */
 /* End area that is zeroed on creation. */
 #define	p_endzero	p_magic
 

==== //depot/projects/soc2009/trasz_limits/sys/sys/resourcevar.h#18 (text+ko) ====

@@ -99,7 +99,7 @@
 	long	ui_ptscnt;		/* (b) number of pseudo-terminals */
 	uid_t	ui_uid;			/* (a) uid */
 	u_int	ui_ref;			/* (b) reference count */
-	struct hrl_container ui_container;	/* (*) HRL resource accounting */
+	struct container ui_container;	/* (*) resource usage accounting */
 };
 
 #define	UIDINFO_VMSIZE_LOCK(ui)		mtx_lock(&((ui)->ui_vmsize_mtx))
@@ -117,7 +117,7 @@
 	LIST_ENTRY(gidinfo) gi_hash;	/* (c) hash chain of gidinfos */
 	gid_t	gi_gid;			/* (a) gid */
 	u_int	gi_ref;			/* (b) reference count */
-	struct hrl_container gi_container;	/* (*) HRL resource accounting */
+	struct container gi_container;	/* (*) resource usage accounting */
 };
 
 struct proc;
@@ -156,7 +156,7 @@
 void	 uifree(struct uidinfo *uip);
 void	 uihashinit(void);
 void	 uihold(struct uidinfo *uip);
-int	 ui_container_foreach(int (*callback)(struct hrl_container *container,
+int	 ui_container_foreach(int (*callback)(struct container *container,
 	    const struct hrl_rule *filter, void *arg3),
 	    const struct hrl_rule *filter, void *arg3);
 struct gidinfo
@@ -164,7 +164,7 @@
 void	 gifree(struct gidinfo *gip);
 void	 gihashinit(void);
 void	 gihold(struct gidinfo *gip);
-int	 gi_container_foreach(int (*callback)(struct hrl_container *container,
+int	 gi_container_foreach(int (*callback)(struct container *container,
 	    const struct hrl_rule *filter, void *arg3),
 	    const struct hrl_rule *filter, void *arg3);
 


More information about the p4-projects mailing list