]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Cleanup: Rename "name" to "username" in struct cgroup_rule.
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Wed, 3 Jun 2009 06:03:24 +0000 (15:03 +0900)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Mon, 8 Jun 2009 07:57:24 +0000 (13:27 +0530)
Hi,

CHANGELOG of v2:
================
* No change.

To add the member "procname" to struct cgroup_rule by later patch, this
patch renames the member "name" to "username" for the clarification.

Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Reviewed-By: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
src/api.c
src/libcgroup-internal.h

index 3af9de04ed2d89dfed60240e5523e9f0fa1affc5..9a379d6186a46dcb3d941d60102a262023c7a03b 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -475,7 +475,7 @@ static int cgroup_parse_rules(bool cache, uid_t muid, gid_t mgid)
 
                newrule->uid = uid;
                newrule->gid = gid;
-               strncpy(newrule->name, user, sizeof(newrule->name) - 1);
+               strncpy(newrule->username, user, sizeof(newrule->username) - 1);
                strncpy(newrule->destination, destination,
                        sizeof(newrule->destination) - 1);
                newrule->next = NULL;
@@ -516,7 +516,7 @@ static int cgroup_parse_rules(bool cache, uid_t muid, gid_t mgid)
                }
 
                cgroup_dbg("Added rule %s (UID: %d, GID: %d) -> %s for"
-                       " controllers:", lst->tail->name, lst->tail->uid,
+                       " controllers:", lst->tail->username, lst->tail->uid,
                        lst->tail->gid, lst->tail->destination);
                 for (i = 0; lst->tail->controllers[i]; i++) {
                        cgroup_dbg(" %s", lst->tail->controllers[i]);
@@ -1808,9 +1808,9 @@ static struct cgroup_rule *cgroup_find_matching_rule_uid_gid(const uid_t uid,
                }
 
                /* If this is a group rule, the UID might be a member. */
-               if (ret->name[0] == '@') {
+               if (ret->username[0] == '@') {
                        /* Get the group data. */
-                       sp = &(ret->name[1]);
+                       sp = &(ret->username[1]);
                        grp = getgrnam(sp);
                        if (!grp) {
                                continue;
@@ -1910,11 +1910,12 @@ int cgroup_change_cgroup_uid_gid_flags(const uid_t uid, const gid_t gid,
                }
        }
        cgroup_dbg("Found matching rule %s for PID: %d, UID: %d, GID: %d\n",
-                       tmp->name, pid, uid, gid);
+                       tmp->username, pid, uid, gid);
 
        /* If we are here, then we found a matching rule, so execute it. */
        do {
-               cgroup_dbg("Executing rule %s for PID %d... ", tmp->name, pid);
+               cgroup_dbg("Executing rule %s for PID %d... ", tmp->username,
+                                                               pid);
                ret = cgroup_change_cgroup_path(tmp->destination,
                                pid, tmp->controllers);
                if (ret) {
@@ -1928,7 +1929,7 @@ int cgroup_change_cgroup_uid_gid_flags(const uid_t uid, const gid_t gid,
                 * we just executed.
                 */
                tmp = tmp->next;
-       } while (tmp && (tmp->name[0] == '%'));
+       } while (tmp && (tmp->username[0] == '%'));
 
 finished:
        return ret;
@@ -2003,7 +2004,7 @@ void cgroup_print_rules_config(FILE *fp)
 
        itr = rl.head;
        while (itr) {
-               fprintf(fp, "Rule: %s\n", itr->name);
+               fprintf(fp, "Rule: %s\n", itr->username);
 
                if (itr->uid == CGRULE_WILD)
                        fprintf(fp, "  UID: any\n");
index 001da1a65c9509cdb3aa7735db9064cbd802004f..9e69f10e4de59793f0d98572ed82c6ef6e12f230 100644 (file)
@@ -74,7 +74,7 @@ struct cgroup_rules_data {
 struct cgroup_rule {
        uid_t uid;
        gid_t gid;
-       char name[LOGIN_NAME_MAX];
+       char username[LOGIN_NAME_MAX];
        char destination[FILENAME_MAX];
        char *controllers[MAX_MNT_ELEMENTS];
        struct cgroup_rule *next;