From 17fa5be4f89ede71b6459d2dce2a5379135a9738 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Fri, 21 Nov 2014 00:48:13 +0300
Subject: [PATCH] A few renames.

---
 src/box/CMakeLists.txt             |  2 +-
 src/box/alter.cc                   | 18 +++++++++---------
 src/box/authentication.cc          |  2 +-
 src/box/box.cc                     |  2 +-
 src/box/lua/call.cc                |  2 +-
 src/box/lua/session.cc             |  2 +-
 src/box/session.cc                 |  2 +-
 src/box/space.cc                   |  2 +-
 src/box/{user_cache.cc => user.cc} |  2 +-
 src/box/{user_cache.h => user.h}   |  7 ++++---
 10 files changed, 21 insertions(+), 20 deletions(-)
 rename src/box/{user_cache.cc => user.cc} (99%)
 rename src/box/{user_cache.h => user.h} (95%)

diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index 72ae654e3c..9b2d819a63 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -43,7 +43,7 @@ add_library(box
     txn.cc
     box.cc
     user_def.cc
-    user_cache.cc
+    user.cc
     authentication.cc
     vclock.c
     cluster.cc
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 80eff00981..c7dd490928 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -29,7 +29,7 @@
 #include "alter.h"
 #include "schema.h"
 #include "user_def.h"
-#include "user_cache.h"
+#include "user.h"
 #include "space.h"
 #include "txn.h"
 #include "tuple.h"
@@ -1152,13 +1152,13 @@ user_has_data(uint32_t uid)
 	return false;
 }
 
-/** Supposedly a user may have many authentication mechanisms
+/**
+ * Supposedly a user may have many authentication mechanisms
  * defined, but for now we only support chap-sha1. Get
  * password of chap-sha1 from the _user space.
  */
-
 void
-user_fill_auth_data(struct user_def *user, const char *auth_data)
+user_def_fill_auth_data(struct user_def *user, const char *auth_data)
 {
 	uint8_t type = mp_typeof(*auth_data);
 	if (type == MP_ARRAY || type == MP_NIL) {
@@ -1202,7 +1202,7 @@ user_fill_auth_data(struct user_def *user, const char *auth_data)
 }
 
 void
-user_create_from_tuple(struct user_def *user, struct tuple *tuple)
+user_def_create_from_tuple(struct user_def *user, struct tuple *tuple)
 {
 	/* In case user password is empty, fill it with \0 */
 	memset(user, 0, sizeof(*user));
@@ -1235,7 +1235,7 @@ user_create_from_tuple(struct user_def *user, struct tuple *tuple)
 				  "authentication data can not be set for "
 				  "a role");
 		}
-		user_fill_auth_data(user, auth_data);
+		user_def_fill_auth_data(user, auth_data);
 	}
 }
 
@@ -1256,7 +1256,7 @@ user_cache_alter_user(struct trigger * /* trigger */, void *event)
 	struct txn *txn = (struct txn *) event;
 	struct txn_stmt *stmt = txn_stmt(txn);
 	struct user_def user;
-	user_create_from_tuple(&user, stmt->new_tuple);
+	user_def_create_from_tuple(&user, stmt->new_tuple);
 	user_cache_replace(&user);
 }
 
@@ -1277,7 +1277,7 @@ on_replace_dd_user(struct trigger * /* trigger */, void *event)
 	struct user_def *old_user = user_by_id(uid);
 	if (new_tuple != NULL && old_user == NULL) { /* INSERT */
 		struct user_def user;
-		user_create_from_tuple(&user, new_tuple);
+		user_def_create_from_tuple(&user, new_tuple);
 		(void) user_cache_replace(&user);
 		struct trigger *on_rollback =
 			txn_alter_trigger_new(user_cache_remove_user, NULL);
@@ -1309,7 +1309,7 @@ on_replace_dd_user(struct trigger * /* trigger */, void *event)
 		 * correct.
 		 */
 		struct user_def user;
-		user_create_from_tuple(&user, new_tuple);
+		user_def_create_from_tuple(&user, new_tuple);
 		struct trigger *on_commit =
 			txn_alter_trigger_new(user_cache_alter_user, NULL);
 		trigger_add(&txn->on_commit, on_commit);
diff --git a/src/box/authentication.cc b/src/box/authentication.cc
index 023f09f07f..f4a2d45caa 100644
--- a/src/box/authentication.cc
+++ b/src/box/authentication.cc
@@ -26,7 +26,7 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "user_cache.h"
+#include "user.h"
 #include "user_def.h"
 #include "session.h"
 
diff --git a/src/box/box.cc b/src/box/box.cc
index d6c744896c..e7b2c45aff 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -48,7 +48,7 @@
 #include "request.h"
 #include "txn.h"
 #include "fiber.h"
-#include "user_cache.h"
+#include "user.h"
 #include "cfg.h"
 #include "iobuf.h"
 
diff --git a/src/box/lua/call.cc b/src/box/lua/call.cc
index 9eb6643b79..a8f5eb17e7 100644
--- a/src/box/lua/call.cc
+++ b/src/box/lua/call.cc
@@ -48,7 +48,7 @@
 #include "box/request.h"
 #include "box/txn.h"
 #include "box/user_def.h"
-#include "box/user_cache.h"
+#include "box/user.h"
 #include "box/schema.h"
 #include "box/session.h"
 #include "box/iproto_constants.h"
diff --git a/src/box/lua/session.cc b/src/box/lua/session.cc
index c0ac116d54..a558def7b5 100644
--- a/src/box/lua/session.cc
+++ b/src/box/lua/session.cc
@@ -29,7 +29,7 @@
 #include "session.h"
 #include "lua/utils.h"
 #include "lua/trigger.h"
-#include "box/user_cache.h"
+#include "box/user.h"
 #include "box/user_def.h"
 
 extern "C" {
diff --git a/src/box/session.cc b/src/box/session.cc
index 56f2324f8c..d274c05f9e 100644
--- a/src/box/session.cc
+++ b/src/box/session.cc
@@ -35,7 +35,7 @@
 #include "exception.h"
 #include "random.h"
 #include <sys/socket.h>
-#include "user_cache.h"
+#include "user.h"
 
 static struct mh_i32ptr_t *session_registry;
 
diff --git a/src/box/space.cc b/src/box/space.cc
index 0713814cda..f355f76fea 100644
--- a/src/box/space.cc
+++ b/src/box/space.cc
@@ -34,7 +34,7 @@
 #include "scoped_guard.h"
 #include "trigger.h"
 #include "user_def.h"
-#include "user_cache.h"
+#include "user.h"
 #include "session.h"
 
 void
diff --git a/src/box/user_cache.cc b/src/box/user.cc
similarity index 99%
rename from src/box/user_cache.cc
rename to src/box/user.cc
index d82555cd3b..aab2bac5ce 100644
--- a/src/box/user_cache.cc
+++ b/src/box/user.cc
@@ -26,7 +26,7 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "user_cache.h"
+#include "user.h"
 #include "user_def.h"
 #include "assoc.h"
 #include "schema.h"
diff --git a/src/box/user_cache.h b/src/box/user.h
similarity index 95%
rename from src/box/user_cache.h
rename to src/box/user.h
index ab7757b825..f4ac406bbf 100644
--- a/src/box/user_cache.h
+++ b/src/box/user.h
@@ -1,5 +1,5 @@
-#ifndef INCLUDES_TARANTOOL_BOX_USER_CACHE_H
-#define INCLUDES_TARANTOOL_BOX_USER_CACHE_H
+#ifndef INCLUDES_TARANTOOL_BOX_USER_H
+#define INCLUDES_TARANTOOL_BOX_USER_H
 /*
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -31,6 +31,7 @@
 #include <stdint.h>
 
 struct user_def;
+
 /**
  * For best performance, all users are maintained in this array.
  * Position in the array is store in user->auth_token and also
@@ -87,4 +88,4 @@ user_cache_init();
 void
 user_cache_free();
 
-#endif /* INCLUDES_TARANTOOL_BOX_USER_CACHE_H */
+#endif /* INCLUDES_TARANTOOL_BOX_USER_H */
-- 
GitLab