Static code analysis findings; mutex rework
[profile/ivi/persistence-client-library.git] / src / persistence_client_library_data_organization.c
1 /******************************************************************************
2  * Project         Persistency
3  * (c) copyright   2012
4  * Company         XS Embedded GmbH
5  *****************************************************************************/
6 /******************************************************************************
7  * This Source Code Form is subject to the terms of the
8  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed
9  * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 ******************************************************************************/
11  /**
12  * @file           persistence_client_library_data_organization.c
13  * @ingroup        Persistence client library
14  * @author         Ingo Huerner
15  * @brief          Implementation of persistence database low level access
16  * @see            
17  */
18
19 #include "../include_protected/persistence_client_library_data_organization.h"
20
21 #include <string.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 // rrsource configuration database name
26 const char* gResTableCfg = "/resource-table-cfg.itz";
27
28 /// configurable default database name
29 const char* gConfigDefault = "/configurable-default-data.itz";
30
31 /// default database name
32 const char* gDefault = "/default-data.itz";
33
34 /// write through database name
35 const char* gWt             = "/wt.itz";
36 /// cached database name
37 const char* gCached        = "/cached.itz";
38
39
40 /// directory structure node name defintion
41 const char* gNode = "/node";
42 /// directory structure user name defintion
43 const char* gUser = "/user/";
44 /// directory structure seat name defintion
45 const char* gSeat = "/seat/";
46
47
48 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
49 const char* gLocalCachePath        = "/Data/mnt-c/%s";
50 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
51 const char* gLocalWtPath           = "/Data/mnt-wt/%s";
52 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
53 const char* gSharedCachePath       = "/Data/mnt-c/%s/Shared_Group_%x";
54 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
55 const char* gSharedWtPath          = "/Data/mnt-wt/%s/Shared_Group_%x";
56 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
57 const char* gSharedPublicCachePath = "/Data/mnt-c/%s/Shared_Public";
58 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
59 const char* gSharedPublicWtPath    = "/Data/mnt-wt/%s/Shared_Public";
60
61 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
62 const char* gLocalCachePathKey        = "/Data/mnt-c/%s%s";
63 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
64 const char* gLocalWtPathKey           = "/Data/mnt-wt/%s%s";
65 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
66 const char* gSharedCachePathKey       = "/Data/mnt-c/%s/Shared_Group_%x%s";
67 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
68 const char* gSharedWtPathKey          = "/Data/mnt-wt/%s/Shared_Group_%x%s";
69 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
70 const char* gSharedPublicCachePathKey = "/Data/mnt-c/%s/Shared_Public%s";
71 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
72 const char* gSharedPublicWtPathKey    = "/Data/mnt-wt/%s/Shared_Public%s";
73
74 /// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/<seat>/<resource>
75 const char* gLocalCacheFilePath        = "/Data/mnt-c/%s/user/%d/seat/%d/%s";
76
77
78 const char* gChangeSignal = "PersistenceResChange";
79 const char* gDeleteSignal = "PersistenceResDelete";
80 const char* gCreateSignal = "PersistenceResCreate";
81
82
83 char gNotifykey[DbKeyMaxLen] = {0};
84 unsigned int gNotifyLdbid  = 0;
85 unsigned int gNotifyUserNo = 0;
86 unsigned int gNotifySeatNo = 0;
87 pclNotifyStatus_e       gNotifyReason = 0;
88 PersNotifyRegPolicy_e   gNotifyPolicy = 0;
89
90
91 int gTimeoutMs = 5000;
92
93 int gDbusPendingRvalue = 0;
94
95
96 /// application id
97 char gAppId[MaxAppNameLen] = {0};
98
99
100 /// max key value data size [default 16kB]
101 int gMaxKeyValDataSize = defaultMaxKeyValDataSize;
102
103
104 unsigned int gPclInitialized = PCLnotInitialized;
105
106
107 DltContext gDLTContext;
108
109 int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct);
110
111