[PATCH RESEND 4/4] device_cgroup: rename whitelist to exception list

2012-08-09 Thread aris
This patch replaces the "whitelist" usage in the code and comments and replace
them by exception list related information.

Signed-off-by: Aristeu Rozanski 

---
 security/device_cgroup.c |  198 +++
 1 file changed, 99 insertions(+), 99 deletions(-)

Index: github/security/device_cgroup.c
===
--- github.orig/security/device_cgroup.c2012-07-24 17:50:14.0 
-0400
+++ github/security/device_cgroup.c 2012-07-24 17:50:48.343663036 -0400
@@ -26,12 +26,12 @@
 static DEFINE_MUTEX(devcgroup_mutex);
 
 /*
- * whitelist locking rules:
+ * exception list locking rules:
  * hold devcgroup_mutex for update/read.
  * hold rcu_read_lock() for read.
  */
 
-struct dev_whitelist_item {
+struct dev_exception_item {
u32 major, minor;
short type;
short access;
@@ -41,7 +41,7 @@
 
 struct dev_cgroup {
struct cgroup_subsys_state css;
-   struct list_head whitelist;
+   struct list_head exceptions;
bool deny_all;
 };
 
@@ -75,12 +75,12 @@
 /*
  * called under devcgroup_mutex
  */
-static int dev_whitelist_copy(struct list_head *dest, struct list_head *orig)
+static int dev_exceptions_copy(struct list_head *dest, struct list_head *orig)
 {
-   struct dev_whitelist_item *wh, *tmp, *new;
+   struct dev_exception_item *ex, *tmp, *new;
 
-   list_for_each_entry(wh, orig, list) {
-   new = kmemdup(wh, sizeof(*wh), GFP_KERNEL);
+   list_for_each_entry(ex, orig, list) {
+   new = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
if (!new)
goto free_and_exit;
list_add_tail(>list, dest);
@@ -89,9 +89,9 @@
return 0;
 
 free_and_exit:
-   list_for_each_entry_safe(wh, tmp, dest, list) {
-   list_del(>list);
-   kfree(wh);
+   list_for_each_entry_safe(ex, tmp, dest, list) {
+   list_del(>list);
+   kfree(ex);
}
return -ENOMEM;
 }
@@ -99,50 +99,50 @@
 /*
  * called under devcgroup_mutex
  */
-static int dev_whitelist_add(struct dev_cgroup *dev_cgroup,
-   struct dev_whitelist_item *wh)
+static int dev_exception_add(struct dev_cgroup *dev_cgroup,
+struct dev_exception_item *ex)
 {
-   struct dev_whitelist_item *whcopy, *walk;
+   struct dev_exception_item *excopy, *walk;
 
-   whcopy = kmemdup(wh, sizeof(*wh), GFP_KERNEL);
-   if (!whcopy)
+   excopy = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
+   if (!excopy)
return -ENOMEM;
 
-   list_for_each_entry(walk, _cgroup->whitelist, list) {
-   if (walk->type != wh->type)
+   list_for_each_entry(walk, _cgroup->exceptions, list) {
+   if (walk->type != ex->type)
continue;
-   if (walk->major != wh->major)
+   if (walk->major != ex->major)
continue;
-   if (walk->minor != wh->minor)
+   if (walk->minor != ex->minor)
continue;
 
-   walk->access |= wh->access;
-   kfree(whcopy);
-   whcopy = NULL;
+   walk->access |= ex->access;
+   kfree(excopy);
+   excopy = NULL;
}
 
-   if (whcopy != NULL)
-   list_add_tail_rcu(>list, _cgroup->whitelist);
+   if (excopy != NULL)
+   list_add_tail_rcu(>list, _cgroup->exceptions);
return 0;
 }
 
 /*
  * called under devcgroup_mutex
  */
-static void dev_whitelist_rm(struct dev_cgroup *dev_cgroup,
-   struct dev_whitelist_item *wh)
+static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
+struct dev_exception_item *ex)
 {
-   struct dev_whitelist_item *walk, *tmp;
+   struct dev_exception_item *walk, *tmp;
 
-   list_for_each_entry_safe(walk, tmp, _cgroup->whitelist, list) {
-   if (walk->type != wh->type)
+   list_for_each_entry_safe(walk, tmp, _cgroup->exceptions, list) {
+   if (walk->type != ex->type)
continue;
-   if (walk->major != wh->major)
+   if (walk->major != ex->major)
continue;
-   if (walk->minor != wh->minor)
+   if (walk->minor != ex->minor)
continue;
 
-   walk->access &= ~wh->access;
+   walk->access &= ~ex->access;
if (!walk->access) {
list_del_rcu(>list);
kfree_rcu(walk, rcu);
@@ -151,18 +151,18 @@
 }
 
 /**
- * dev_whitelist_clean - frees all entries of the whitelist
- * @dev_cgroup: dev_cgroup with the whitelist to be cleaned
+ * dev_exception_clean - frees all entries of the exception list
+ * @dev_cgroup: dev_cgroup with the exception list to be cleaned
  *
  * called 

[PATCH RESEND 4/4] device_cgroup: rename whitelist to exception list

2012-08-09 Thread aris
This patch replaces the whitelist usage in the code and comments and replace
them by exception list related information.

Signed-off-by: Aristeu Rozanski a...@redhat.com

---
 security/device_cgroup.c |  198 +++
 1 file changed, 99 insertions(+), 99 deletions(-)

Index: github/security/device_cgroup.c
===
--- github.orig/security/device_cgroup.c2012-07-24 17:50:14.0 
-0400
+++ github/security/device_cgroup.c 2012-07-24 17:50:48.343663036 -0400
@@ -26,12 +26,12 @@
 static DEFINE_MUTEX(devcgroup_mutex);
 
 /*
- * whitelist locking rules:
+ * exception list locking rules:
  * hold devcgroup_mutex for update/read.
  * hold rcu_read_lock() for read.
  */
 
-struct dev_whitelist_item {
+struct dev_exception_item {
u32 major, minor;
short type;
short access;
@@ -41,7 +41,7 @@
 
 struct dev_cgroup {
struct cgroup_subsys_state css;
-   struct list_head whitelist;
+   struct list_head exceptions;
bool deny_all;
 };
 
@@ -75,12 +75,12 @@
 /*
  * called under devcgroup_mutex
  */
-static int dev_whitelist_copy(struct list_head *dest, struct list_head *orig)
+static int dev_exceptions_copy(struct list_head *dest, struct list_head *orig)
 {
-   struct dev_whitelist_item *wh, *tmp, *new;
+   struct dev_exception_item *ex, *tmp, *new;
 
-   list_for_each_entry(wh, orig, list) {
-   new = kmemdup(wh, sizeof(*wh), GFP_KERNEL);
+   list_for_each_entry(ex, orig, list) {
+   new = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
if (!new)
goto free_and_exit;
list_add_tail(new-list, dest);
@@ -89,9 +89,9 @@
return 0;
 
 free_and_exit:
-   list_for_each_entry_safe(wh, tmp, dest, list) {
-   list_del(wh-list);
-   kfree(wh);
+   list_for_each_entry_safe(ex, tmp, dest, list) {
+   list_del(ex-list);
+   kfree(ex);
}
return -ENOMEM;
 }
@@ -99,50 +99,50 @@
 /*
  * called under devcgroup_mutex
  */
-static int dev_whitelist_add(struct dev_cgroup *dev_cgroup,
-   struct dev_whitelist_item *wh)
+static int dev_exception_add(struct dev_cgroup *dev_cgroup,
+struct dev_exception_item *ex)
 {
-   struct dev_whitelist_item *whcopy, *walk;
+   struct dev_exception_item *excopy, *walk;
 
-   whcopy = kmemdup(wh, sizeof(*wh), GFP_KERNEL);
-   if (!whcopy)
+   excopy = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
+   if (!excopy)
return -ENOMEM;
 
-   list_for_each_entry(walk, dev_cgroup-whitelist, list) {
-   if (walk-type != wh-type)
+   list_for_each_entry(walk, dev_cgroup-exceptions, list) {
+   if (walk-type != ex-type)
continue;
-   if (walk-major != wh-major)
+   if (walk-major != ex-major)
continue;
-   if (walk-minor != wh-minor)
+   if (walk-minor != ex-minor)
continue;
 
-   walk-access |= wh-access;
-   kfree(whcopy);
-   whcopy = NULL;
+   walk-access |= ex-access;
+   kfree(excopy);
+   excopy = NULL;
}
 
-   if (whcopy != NULL)
-   list_add_tail_rcu(whcopy-list, dev_cgroup-whitelist);
+   if (excopy != NULL)
+   list_add_tail_rcu(excopy-list, dev_cgroup-exceptions);
return 0;
 }
 
 /*
  * called under devcgroup_mutex
  */
-static void dev_whitelist_rm(struct dev_cgroup *dev_cgroup,
-   struct dev_whitelist_item *wh)
+static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
+struct dev_exception_item *ex)
 {
-   struct dev_whitelist_item *walk, *tmp;
+   struct dev_exception_item *walk, *tmp;
 
-   list_for_each_entry_safe(walk, tmp, dev_cgroup-whitelist, list) {
-   if (walk-type != wh-type)
+   list_for_each_entry_safe(walk, tmp, dev_cgroup-exceptions, list) {
+   if (walk-type != ex-type)
continue;
-   if (walk-major != wh-major)
+   if (walk-major != ex-major)
continue;
-   if (walk-minor != wh-minor)
+   if (walk-minor != ex-minor)
continue;
 
-   walk-access = ~wh-access;
+   walk-access = ~ex-access;
if (!walk-access) {
list_del_rcu(walk-list);
kfree_rcu(walk, rcu);
@@ -151,18 +151,18 @@
 }
 
 /**
- * dev_whitelist_clean - frees all entries of the whitelist
- * @dev_cgroup: dev_cgroup with the whitelist to be cleaned
+ * dev_exception_clean - frees all entries of the exception list
+ * @dev_cgroup: dev_cgroup with the exception list to be cleaned