dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0038-mmap_cache-Rename-variables.patch

6cf099
From fca34746951f740c544e62a5b60929c41a198fd1 Mon Sep 17 00:00:00 2001
6cf099
From: Lukas Slebodnik <lslebodn@redhat.com>
6cf099
Date: Thu, 16 Jul 2015 16:54:00 +0200
6cf099
Subject: [PATCH 38/47] mmap_cache: Rename variables
6cf099
MIME-Version: 1.0
6cf099
Content-Type: text/plain; charset=UTF-8
6cf099
Content-Transfer-Encoding: 8bit
6cf099
6cf099
Reviewed-by: Michal Židek <mzidek@redhat.com>
6cf099
(cherry picked from commit 39b31427e2d11ca318df11fd48db33a7cc610aa7)
6cf099
---
6cf099
 src/responder/nss/nsssrv_mmap_cache.c | 16 ++++++++--------
6cf099
 src/responder/nss/nsssrv_mmap_cache.h |  4 ++--
6cf099
 src/sss_client/nss_mc_initgr.c        | 10 +++++-----
6cf099
 src/util/mmap_cache.h                 |  2 +-
6cf099
 4 files changed, 16 insertions(+), 16 deletions(-)
6cf099
6cf099
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
6cf099
index ebda8ac6fab3dd87f5a1d8e43717bf7a5b5a9878..16bc926f3ba4f5ab096bd0fb43895edef2b57c50 100644
6cf099
--- a/src/responder/nss/nsssrv_mmap_cache.c
6cf099
+++ b/src/responder/nss/nsssrv_mmap_cache.c
6cf099
@@ -959,8 +959,8 @@ done:
6cf099
 
6cf099
 errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
6cf099
                                     struct sized_string *name,
6cf099
-                                    uint32_t memnum,
6cf099
-                                    uint8_t *membuf)
6cf099
+                                    uint32_t num_groups,
6cf099
+                                    uint8_t *gids_buf)
6cf099
 {
6cf099
     struct sss_mc_ctx *mcc = *_mcc;
6cf099
     struct sss_mc_rec *rec;
6cf099
@@ -974,8 +974,8 @@ errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
6cf099
         return EINVAL;
6cf099
     }
6cf099
 
6cf099
-    /* memnum + reserved + array of members + name*/
6cf099
-    data_len = (2 + memnum) * sizeof(uint32_t) + name->len;
6cf099
+    /* num_groups + reserved + array of gids + name*/
6cf099
+    data_len = (2 + num_groups) * sizeof(uint32_t) + name->len;
6cf099
     rec_len = sizeof(struct sss_mc_rec) + sizeof(struct sss_mc_initgr_data)
6cf099
               + data_len;
6cf099
     if (rec_len > mcc->dt_size) {
6cf099
@@ -998,10 +998,10 @@ errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
6cf099
                             name->str, name->len, name->str, name->len);
6cf099
 
6cf099
     /* initgroups struct */
6cf099
-    data->members = memnum;
6cf099
-    memcpy(data->gids, membuf, memnum * sizeof(uint32_t));
6cf099
-    memcpy(&data->gids[memnum], name->str, name->len);
6cf099
-    data->name = MC_PTR_DIFF(&data->gids[memnum], data);
6cf099
+    data->num_groups = num_groups;
6cf099
+    memcpy(data->gids, gids_buf, num_groups * sizeof(uint32_t));
6cf099
+    memcpy(&data->gids[num_groups], name->str, name->len);
6cf099
+    data->name = MC_PTR_DIFF(&data->gids[num_groups], data);
6cf099
 
6cf099
     MC_LOWER_BARRIER(rec);
6cf099
 
6cf099
diff --git a/src/responder/nss/nsssrv_mmap_cache.h b/src/responder/nss/nsssrv_mmap_cache.h
6cf099
index 3a6764dd36bf3346d789bb287b3a94df120f36ee..b09e4a6f8efa364ae7a6407bab9d8a2a2143c812 100644
6cf099
--- a/src/responder/nss/nsssrv_mmap_cache.h
6cf099
+++ b/src/responder/nss/nsssrv_mmap_cache.h
6cf099
@@ -53,8 +53,8 @@ errno_t sss_mmap_cache_gr_store(struct sss_mc_ctx **_mcc,
6cf099
 
6cf099
 errno_t sss_mmap_cache_initgr_store(struct sss_mc_ctx **_mcc,
6cf099
                                     struct sized_string *name,
6cf099
-                                    uint32_t memnum,
6cf099
-                                    uint8_t *membuf);
6cf099
+                                    uint32_t num_groups,
6cf099
+                                    uint8_t *gids_buf);
6cf099
 
6cf099
 errno_t sss_mmap_cache_pw_invalidate(struct sss_mc_ctx *mcc,
6cf099
                                      struct sized_string *name);
6cf099
diff --git a/src/sss_client/nss_mc_initgr.c b/src/sss_client/nss_mc_initgr.c
6cf099
index bfb09d6550c310fbab254dc9b3ab7b306b7d3f06..e21b9f40aba00f9cc2385a561fc2bcc163c5791a 100644
6cf099
--- a/src/sss_client/nss_mc_initgr.c
6cf099
+++ b/src/sss_client/nss_mc_initgr.c
6cf099
@@ -42,7 +42,7 @@ static errno_t sss_nss_mc_parse_result(struct sss_mc_rec *rec,
6cf099
     struct sss_mc_initgr_data *data;
6cf099
     time_t expire;
6cf099
     long int i;
6cf099
-    uint32_t gid_count;
6cf099
+    uint32_t num_groups;
6cf099
     long int max_ret;
6cf099
 
6cf099
     /* additional checks before filling result*/
6cf099
@@ -53,15 +53,15 @@ static errno_t sss_nss_mc_parse_result(struct sss_mc_rec *rec,
6cf099
     }
6cf099
 
6cf099
     data = (struct sss_mc_initgr_data *)rec->data;
6cf099
-    gid_count = data->members;
6cf099
-    max_ret = gid_count;
6cf099
+    num_groups = data->num_groups;
6cf099
+    max_ret = num_groups;
6cf099
 
6cf099
     /* check we have enough space in the buffer */
6cf099
-    if ((*size - *start) < gid_count) {
6cf099
+    if ((*size - *start) < num_groups) {
6cf099
         long int newsize;
6cf099
         gid_t *newgroups;
6cf099
 
6cf099
-        newsize = *size + gid_count;
6cf099
+        newsize = *size + num_groups;
6cf099
         if ((limit > 0) && (newsize > limit)) {
6cf099
             newsize = limit;
6cf099
             max_ret = newsize - *start;
6cf099
diff --git a/src/util/mmap_cache.h b/src/util/mmap_cache.h
6cf099
index 438e28a3d217041278fc1bb60aa553d098516035..a8703d5da4022e11c4bc2f3e2f8710e7f9d982bf 100644
6cf099
--- a/src/util/mmap_cache.h
6cf099
+++ b/src/util/mmap_cache.h
6cf099
@@ -139,7 +139,7 @@ struct sss_mc_grp_data {
6cf099
 
6cf099
 struct sss_mc_initgr_data {
6cf099
     rel_ptr_t name;         /* ptr to name string, rel. to struct base addr */
6cf099
-    uint32_t members;       /* number of members in groups */
6cf099
+    uint32_t num_groups;    /* number of groups */
6cf099
     uint32_t gids[0];       /* array of all groups
6cf099
                              * string with name is stored after gids */
6cf099
 };
6cf099
-- 
6cf099
2.4.3
6cf099