Delete duplicate macros, move them to one config.h 91/162791/6
authorleejungkyuen <jklolo.lee@samsung.com>
Wed, 26 Jul 2017 06:58:50 +0000 (15:58 +0900)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Fri, 12 Jan 2018 14:02:22 +0000 (15:02 +0100)
Change-Id: Idbebaec899d491786402172e5e9a554a72e8e45c

TEECLib/src/teec_api.c
TEEStub/teestubmain.cpp
include/include/config.h
simulatordaemon/inc/path.h [deleted file]
simulatordaemon/src/SimulatorDaemon.cpp
simulatordaemon/src/TABinaryManager/TABinaryManager.cpp
simulatordaemon/src/TABinaryManager/TestMain.cpp
simulatordaemon/src/TAInstance.cpp
ssflib/dep/swdss/source/secure_file.cpp
ssflib/src/ssf_client.cpp

index 132f4d9..c46c933 100644 (file)
@@ -191,8 +191,7 @@ static void freeSharedMemory(TEEC_SharedMemory *shm)
                return;
        }
 
-       ret = snprintf(shm_name, sizeof(shm_name), SHM_NAME_TEMPLATE,
-                                  sharedMem_imp->shmKey);
+       ret = snprintf(shm_name, sizeof(shm_name), SHM_NAME_TEMPLATE, sharedMem_imp->shmKey);
 
        if (ret == sizeof(shm_name)) {
                LOGE(TEE_STUB, "the shm object name is too long");
index 3b1cd3b..b66cd4e 100644 (file)
@@ -108,7 +108,9 @@ int main(int argc, char* argv[]) {
 
        // Once the server is started, it exits only after the
        // connection is lost or gracefully disconnected.
-       StartServer(string(TEE_TASOCK_ROOT) + string(argv[1]));
+       std::string sock = string(TEE_TASOCK_ROOT) + argv[1];
+       LOGD(TEE_STUB, "StartServer on %s\n", sock.c_str());
+       StartServer(sock);
        LOGD(TEE_STUB, "Exiting TEEStub\n");
        // Deallocate property objects
        if (TEE_SUCCESS == initStatus) DeInitPropertyModule();
index e5cd6c9..19c251c 100644 (file)
 //this is ln -s to /usr/lib/tastore or /usr/lib64/tastore (see spec file)
 #define TEE_TASTORE_ROOT "/opt/tastore/"
 
+#define SIMDAEMON_SOCK_PATH "/tmp/simdaemon"
 //TEEStub must have write access in this directory (creating socket per TA)
 #define TEE_TASOCK_ROOT "/tmp/"
 #define TEE_TALOG_ROOT "/tmp/"
 
 #define SHM_PATH "/tmp/shm"
-#define SIMDAEMON_SOCK_PATH "/tmp/simdaemon"
 
 #define TEE_PROP_PATH "/usr/bin/GPD_TEE_PROP"
 
+#define TEE_SS_ROOT "/tmp/tastore2/"
+
 #endif /* INCLUDE_CONFIG_H_ */
diff --git a/simulatordaemon/inc/path.h b/simulatordaemon/inc/path.h
deleted file mode 100644 (file)
index 37a528f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- * @file
- * @author CHERYL (cb) (cheryl.b@samsung.com)
- * @brief  Path detail
- */
-
-
-#if !defined(_PATH_H)
-#define _PATH_H
-
-/*-----------------------------------------------------------------------------
- *  MACROS
- *-----------------------------------------------------------------------------*/
-
-// shm path to be created for Shared memory functionality support
-#define SHM_PATH "/tmp/shm"
-// socket path for connection with Simulator Daemon
-#define SIMDAEMON_PATH "/tmp/simdaemon"
-
-#endif  //_PATH_H
index f5928f1..70dd279 100644 (file)
 /*-----------------------------------------------------------------------------
  *  Include files
  *-----------------------------------------------------------------------------*/
-#include "path.h"
 #include "SimulatorDaemonServer.h"
-
 #include <systemd/sd-daemon.h>
+#include <config.h>
 
 /*-----------------------------------------------------------------------------
  *  Local functions
@@ -108,7 +107,7 @@ int main() {
        LOGD(SIM_DAEMON, "Entry");
        uint32_t result = 0;
        try {
-               int sockFD = getSystemdSocket(SIMDAEMON_PATH);
+               int sockFD = getSystemdSocket(SIMDAEMON_SOCK_PATH);
 
                //initializeShm();
                if (sockFD > 0) {
@@ -117,7 +116,7 @@ int main() {
                        startServer(ioService::getInstance());
                } else {
                        LOGI(SIM_DAEMON, "No systemd socket available - creating own one");
-                       SimulatorDaemonServer s(ioService::getInstance(), SIMDAEMON_PATH);
+                       SimulatorDaemonServer s(ioService::getInstance(), SIMDAEMON_SOCK_PATH);
                        startServer(ioService::getInstance());
                }
 
index 298a76d..18910d7 100644 (file)
@@ -25,7 +25,6 @@
  *  Include files
  *-----------------------------------------------------------------------------*/
 #include "TABinaryManager.h"
-#include <config.h>
 #include <iostream>
 #include <fstream>
 #include <stdio.h>
@@ -36,6 +35,7 @@
 #include <sys/file.h>
 #include <algorithm>
 #include <boost/filesystem.hpp>
+#include <config.h>
 /*-----------------------------------------------------------------------------
  *  Globals
  *-----------------------------------------------------------------------------*/
@@ -251,7 +251,7 @@ bool TABinaryManager::unpackBinary(const string &uuid, StructBinaryInfo& info) {
        if (0 == unpacker->unpackTA(string(TEE_TASTORE_ROOT), uuid)) {
                LOGD(SIM_DAEMON, "Unpacked, filling info");
                // 1. Set binary info
-               info.path = string(TEE_TASTORE_ROOT)+ uuid;
+               info.path = string(TEE_TASTORE_ROOT) + uuid;
                info.extractpath = string(TEE_TASTORE_ROOT) + uuid + "-ext/";
                info.imagePath = info.extractpath + uuid + ".image";
                info.manifestPath = info.extractpath + uuid + ".manifest";
index f66443d..b0b322a 100644 (file)
@@ -26,7 +26,8 @@
 #include "TABinaryManager.h"
 #include "TAManifest.h"
 #include "TAUnpack.h"
-#include "Config.h"
+#include <config.h>
+
 using namespace std;
 
 int test_main() {
@@ -49,7 +50,7 @@ int test_main() {
                                // Unpack TA
                                case 1: {
                                        TAUnpack *unpacker = TAUnpack::getInstance();
-                                       unpacker->unpackTA(TA_STORE_PATH, "0000-0000-0000-0000000000c7");
+                                       unpacker->unpackTA(TEE_TASTORE_ROOT, "0000-0000-0000-0000000000c7");
                                        break;
                                }
                                        // Manifest test
@@ -57,7 +58,7 @@ int test_main() {
                                        TAManifest manifest;
                                        manifest.processXML(
                                            string(
-                                               TA_STORE_PATH"0000-0000-0000-0000000000c7-ext/0000-0000-0000-0000000000c7.manifest"));
+                                               TEE_TASTORE_ROOT"0000-0000-0000-0000000000c7-ext/0000-0000-0000-0000000000c7.manifest"));
                                        manifest.printProcessedData();
                                        break;
                                }
index afa5ad7..15da04e 100644 (file)
@@ -26,6 +26,7 @@
  *-----------------------------------------------------------------------------*/
 #include "TAInstance.h"
 #include "ResponseCommands/ResMakeCommand.h"
+#include <config.h>
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index 96c89e7..c2de76f 100644 (file)
@@ -1705,7 +1705,7 @@ int secure_file::get_data_name(char* data_name, int maxlen, bool is_dir) {
        char* ptr = data_name;
        int remain = maxlen;
 
-       strncpy(ptr, TEE_TASTORE_ROOT, remain);
+       strncpy(ptr, TEE_SS_ROOT, remain);
        if (ptr[remain - 1] != '\0')
                return -1;
        ptr += strlen(ptr);
index edec1cc..8094a29 100644 (file)
@@ -36,7 +36,6 @@
  *  MACROS
  *-----------------------------------------------------------------------------*/
 
-
 /*-----------------------------------------------------------------------------
  *  local functions
  *-----------------------------------------------------------------------------*/