Skip to content
This repository was archived by the owner on Oct 26, 2021. It is now read-only.

Commit 3ec72d7

Browse files
author
ihuerner
committed
New release 0.3.1, for chnages see ChangeLog
1 parent 7f213d4 commit 3ec72d7

13 files changed

+340
-264
lines changed

COPYING

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
This Source Code Form is subject to the terms of the
22
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
3-
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
4-
3+
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Revision 0.3.1
2+
- Fixed a problem when accessing prct and key-value database
3+
- reverted chnage of datastructure mad in revision 0.2.4
4+
15
Revision 0.3.0
26
- Switched to the MPL v2 license
37
- Fixed dbus signal issues

src/persistence_client_library.c

+13-8
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
#include <string.h>
3131
#include <errno.h>
3232
#include <stdlib.h>
33-
#include <dbus/dbus.h>
34-
3533
#include <dlt/dlt.h>
3634
#include <dlt/dlt_common.h>
3735

36+
#include <dbus/dbus.h>
37+
38+
39+
40+
#define ENABLE_DBUS_INTERFACE 1
41+
3842
extern char* __progname;
3943

4044
/// debug log and trace (DLT) setup
@@ -87,7 +91,7 @@ const char* gSharedPublicWtPath = "/Data/mnt-wt/shared/public%s";
8791

8892

8993
/// application id
90-
char gAppId[maxAppNameLen];
94+
char gAppId[MaxAppNameLen];
9195

9296
/// max key value data size [default 16kB]
9397
int gMaxKeyValDataSize = defaultMaxKeyValDataSize;
@@ -122,15 +126,16 @@ void pers_library_init(void)
122126
gMaxKeyValDataSize = atoi(pDataSize);
123127
}
124128

129+
#if ENABLE_DBUS_INTERFACE == 1
125130
setup_dbus_mainloop();
126131

127-
128132
// register for lifecycle and persistence admin service dbus messages
129133
register_lifecycle();
130134
register_pers_admin_service();
135+
#endif
131136

132137
// clear the open file descriptor array
133-
memset(gOpenFdArray, maxPersHandle, sizeof(int));
138+
memset(gOpenFdArray, MaxPersHandle, sizeof(int));
134139

135140
/// get custom library names to load
136141
status = get_custom_libraries();
@@ -178,7 +183,7 @@ void pers_library_init(void)
178183
}
179184

180185
//printf("A p p l i c a t i o n n a m e => %s \n", __progname /*program_invocation_short_name*/); // TODO: only temp solution for application name
181-
strncpy(gAppId, __progname, maxAppNameLen);
186+
strncpy(gAppId, __progname, MaxAppNameLen);
182187
// destory mutex
183188
pthread_mutex_destroy(&gDbusInitializedMtx);
184189
pthread_cond_destroy(&gDbusInitializedCond);
@@ -189,11 +194,11 @@ void pers_library_init(void)
189194
void pers_library_destroy(void)
190195
{
191196

192-
197+
#if ENABLE_DBUS_INTERFACE == 1
193198
// unregister for lifecycle and persistence admin service dbus messages
194199
unregister_lifecycle();
195200
unregister_pers_admin_service();
196-
201+
#endif
197202

198203
DLT_UNREGISTER_CONTEXT(persClientLibCtx);
199204
DLT_UNREGISTER_APP();

src/persistence_client_library.h

+17-9
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
/// constant definitions
3232
enum _PersistenceConstantDef
3333
{
34-
resIsNoFile = 0, /// flag to identify that resource a not file
35-
resIsFile = 1, /// flag to identify that resource a file
36-
accessNoLock = 1, /// flag to indicate that access is not locked
34+
ResIsNoFile = 0, /// flag to identify that resource a not file
35+
ResIsFile = 1, /// flag to identify that resource a file
36+
AccessNoLock = 1, /// flag to indicate that access is not locked
3737

3838
FileClosed = 0,
3939
FileOpen = 1,
@@ -44,9 +44,11 @@ enum _PersistenceConstantDef
4444

4545
PrctKeySize = 64, /// persistence resource config table max key size
4646
PrctValueSize = 256, /// persistence resource config table max value size
47+
PrctDbTableSize = 1024, /// number of persistence resource config tables to store
4748

4849
DbKeySize = 64, /// database max key size
4950
DbValueSize = 16384, /// database max value size
51+
DbTableSize = 1024, /// database table size
5052

5153
PasMsg_Block = 1, /// persistence administration service block access
5254
PasMsg_WriteBack = 2, /// persistence administration service write_back
@@ -56,10 +58,10 @@ enum _PersistenceConstantDef
5658
PasErrorStatus_FAIL = -1, /// persistence administration service msg return status
5759

5860
CustLibMaxLen = 128, /// max length of the custom library name and path
59-
dbKeyMaxLen = 128, /// max database key length
60-
dbPathMaxLen = 128, /// max database path length
61-
maxAppNameLen = 128, /// max application name
62-
maxPersHandle = 256, /// max number of parallel open persistence handles
61+
DbKeyMaxLen = 128, /// max database key length
62+
DbPathMaxLen = 128, /// max database path length
63+
MaxAppNameLen = 128, /// max application name
64+
MaxPersHandle = 256, /// max number of parallel open persistence handles
6365

6466
defaultMaxKeyValDataSize = 16384 /// default limit the key-value data size to 16kB
6567
};
@@ -104,17 +106,23 @@ typedef struct _PersistenceConfigurationKey_s
104106
{
105107
PersistencePolicy_e policy; /**< policy */
106108
PersistenceStorage_e storage; /**< definition of storage to use */
107-
PersistenceDbContext_s context; /**< database context*/
108109
unsigned int permission; /**< access right, corresponds to UNIX */
109110
unsigned int max_size; /**< max size expected for the key */
110111
char * reponsible; /**< name of responsible application */
111112
char * custom_name; /**< name of the customer plugin */
112113
} PersistenceConfigurationKey_s;
113114

114115

116+
/// persistence information
117+
typedef struct _PersistenceInfo_s
118+
{
119+
PersistenceDbContext_s context; /**< database context*/
120+
PersistenceConfigurationKey_s configKey; /**< prct configuration key*/
115121

122+
} PersistenceInfo_s;
116123

117124

125+
/// persistence resource config table type definition
118126
typedef enum _PersistenceRCT_e
119127
{
120128
PersistenceRCT_local = 0,
@@ -171,7 +179,7 @@ extern const char* gSharedPublicWtPath;
171179

172180

173181
/// application id
174-
extern char gAppId[maxAppNameLen];
182+
extern char gAppId[MaxAppNameLen];
175183

176184
/// max key value data size
177185
extern int gMaxKeyValDataSize;

0 commit comments

Comments
 (0)