dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From fca34746951f740c544e62a5b60929c41a198fd1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Thu, 16 Jul 2015 16:54:00 +0200
Subject: [PATCH 38/47] mmap_cache: Rename variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Michal Židek <mzidek@redhat.com>
(cherry picked from commit 39b31427e2d11ca318df11fd48db33a7cc610aa7)
---
 src/responder/nss/nsssrv_mmap_cache.c | 16 ++++++++--------
 src/responder/nss/nsssrv_mmap_cache.h |  4 ++--
 src/sss_client/nss_mc_initgr.c        | 10 +++++-----
 src/util/mmap_cache.h                 |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index ebda8ac6fab3dd87f5a1d8e43717bf7a5b5a9878..16bc926f3ba4f5ab096bd0fb43895edef2b57c50 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -959,8 +959,8 @@ done:
 
 errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
                                     struct sized_string *name,
-                                    uint32_t memnum,
-                                    uint8_t *membuf)
+                                    uint32_t num_groups,
+                                    uint8_t *gids_buf)
 {
     struct sss_mc_ctx *mcc = *_mcc;
     struct sss_mc_rec *rec;
@@ -974,8 +974,8 @@ errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
         return EINVAL;
     }
 
-    /* memnum + reserved + array of members + name*/
-    data_len = (2 + memnum) * sizeof(uint32_t) + name->len;
+    /* num_groups + reserved + array of gids + name*/
+    data_len = (2 + num_groups) * sizeof(uint32_t) + name->len;
     rec_len = sizeof(struct sss_mc_rec) + sizeof(struct sss_mc_initgr_data)
               + data_len;
     if (rec_len > mcc->dt_size) {
@@ -998,10 +998,10 @@ errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
                             name->str, name->len, name->str, name->len);
 
     /* initgroups struct */
-    data->members = memnum;
-    memcpy(data->gids, membuf, memnum * sizeof(uint32_t));
-    memcpy(&data->gids[memnum], name->str, name->len);
-    data->name = MC_PTR_DIFF(&data->gids[memnum], data);
+    data->num_groups = num_groups;
+    memcpy(data->gids, gids_buf, num_groups * sizeof(uint32_t));
+    memcpy(&data->gids[num_groups], name->str, name->len);
+    data->name = MC_PTR_DIFF(&data->gids[num_groups], data);
 
     MC_LOWER_BARRIER(rec);
 
diff --git a/src/responder/nss/nsssrv_mmap_cache.h b/src/responder/nss/nsssrv_mmap_cache.h
index 3a6764dd36bf3346d789bb287b3a94df120f36ee..b09e4a6f8efa364ae7a6407bab9d8a2a2143c812 100644
--- a/src/responder/nss/nsssrv_mmap_cache.h
+++ b/src/responder/nss/nsssrv_mmap_cache.h
@@ -53,8 +53,8 @@ errno_t sss_mmap_cache_gr_store(struct sss_mc_ctx **_mcc,
 
 errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
                                     struct sized_string *name,
-                                    uint32_t memnum,
-                                    uint8_t *membuf);
+                                    uint32_t num_groups,
+                                    uint8_t *gids_buf);
 
 errno_t sss_mmap_cache_pw_invalidate(struct sss_mc_ctx *mcc,
                                      struct sized_string *name);
diff --git a/src/sss_client/nss_mc_initgr.c b/src/sss_client/nss_mc_initgr.c
index bfb09d6550c310fbab254dc9b3ab7b306b7d3f06..e21b9f40aba00f9cc2385a561fc2bcc163c5791a 100644
--- a/src/sss_client/nss_mc_initgr.c
+++ b/src/sss_client/nss_mc_initgr.c
@@ -42,7 +42,7 @@ static errno_t sss_nss_mc_parse_result(struct sss_mc_rec *rec,
     struct sss_mc_initgr_data *data;
     time_t expire;
     long int i;
-    uint32_t gid_count;
+    uint32_t num_groups;
     long int max_ret;
 
     /* additional checks before filling result*/
@@ -53,15 +53,15 @@ static errno_t sss_nss_mc_parse_result(struct sss_mc_rec *rec,
     }
 
     data = (struct sss_mc_initgr_data *)rec->data;
-    gid_count = data->members;
-    max_ret = gid_count;
+    num_groups = data->num_groups;
+    max_ret = num_groups;
 
     /* check we have enough space in the buffer */
-    if ((*size - *start) < gid_count) {
+    if ((*size - *start) < num_groups) {
         long int newsize;
         gid_t *newgroups;
 
-        newsize = *size + gid_count;
+        newsize = *size + num_groups;
         if ((limit > 0) && (newsize > limit)) {
             newsize = limit;
             max_ret = newsize - *start;
diff --git a/src/util/mmap_cache.h b/src/util/mmap_cache.h
index 438e28a3d217041278fc1bb60aa553d098516035..a8703d5da4022e11c4bc2f3e2f8710e7f9d982bf 100644
--- a/src/util/mmap_cache.h
+++ b/src/util/mmap_cache.h
@@ -139,7 +139,7 @@ struct sss_mc_grp_data {
 
 struct sss_mc_initgr_data {
     rel_ptr_t name;         /* ptr to name string, rel. to struct base addr */
-    uint32_t members;       /* number of members in groups */
+    uint32_t num_groups;    /* number of groups */
     uint32_t gids[0];       /* array of all groups
                              * string with name is stored after gids */
 };
-- 
2.4.3