1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
/******************************************************************************
*
* Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
* All rights reserved.
*
* File: DataPrv.h
*
* Description:
* Private Header for the Data Manager
*
* History:
* 08/10/95 RM Created by Ron Marianetti
* 10/26/99 kwk Backed out overlay cache modifications, and added
* constants for RAM vs. ROM store ids.
*
*****************************************************************************/
#ifdef NON_PORTABLE
#ifndef __DATAPRV_H__
#define __DATAPRV_H__
// DOLATER kwk - find out if the decision was made to use nested includes,
// or do I need to go through and hit all of the source files that include
// DataPrv.h to also include OverlayMgr.h (or add OverlayMgr.h to SysAll.h)
#include <OverlayMgr.h>
/************************************************************
* Ways that a database can be open.
*************************************************************/
#define openTypeRegular 0 // Nothing special.
#define openTypeBase (openTypeRegular+1) // Rsc db opened as base.
#define openTypeOverlay (openTypeRegular+2) // Rsc db opened as overlay.
/************************************************************
* Structure of a Record entry
*************************************************************/
typedef struct {
LocalID localChunkID; // local chunkID of a record
UInt8 attributes; // record attributes;
UInt8 uniqueID[3]; // unique ID of record; should
// not be 0 for a legal record.
} RecordEntryType;
typedef RecordEntryType* RecordEntryPtr;
/************************************************************
* Structure of a Resource entry
*************************************************************/
typedef struct {
UInt32 type; // resource type
UInt16 id; // resource id
LocalID localChunkID; // resource data chunk ID
} RsrcEntryType;
typedef RsrcEntryType* RsrcEntryPtr;
// Attributes field
#define dmRsrcAttrUnused 0x0000 // to be defined...
/************************************************************
* Structure of a record list extension. This is used if all
* the database record/resource entries of a database can't fit into
* the database header.
*************************************************************/
typedef struct {
LocalID nextRecordListID; // local chunkID of next list
UInt16 numRecords; // number of records in this list
UInt16 firstEntry; // array of Record/Rsrc entries
// starts here
} RecordListType;
typedef RecordListType* RecordListPtr;
/************************************************************
* Structure of a Database Header
*************************************************************/
typedef struct {
UInt8 name[dmDBNameLength]; // name of database
UInt16 attributes; // database attributes
UInt16 version; // version of database
UInt32 creationDate; // creation date of database
UInt32 modificationDate; // latest modification date
UInt32 lastBackupDate; // latest backup date
UInt32 modificationNumber; // modification number of database
LocalID appInfoID; // application specific info
LocalID sortInfoID; // app specific sorting info
UInt32 type; // database type
UInt32 creator; // database creator
UInt32 uniqueIDSeed; // used to generate unique IDs.
// Note that only the low order
// 3 bytes of this is used (in
// RecordEntryType.uniqueID).
// We are keeping 4 bytes for
// alignment purposes.
RecordListType recordList; // first record list
} DatabaseHdrType;
typedef DatabaseHdrType* DatabaseHdrPtr;
/************************************************************
* Directory of all available databases - maintained by the
* Database Manager. This directory also includes resource
* databases. There is one of these directories for each store
* (either RAM or ROM store) in a memory card. The ROM store
* list gets copied into the RAM store list at DmInit time.
*************************************************************/
typedef struct {
LocalID baseID;
} DatabaseDirEntryType;
typedef struct {
LocalID nextDatabaseListID; // continuation list, if any
UInt16 numDatabases; // # of database ID's in this list
DatabaseDirEntryType databaseID[1]; // one entry per database
} DatabaseDirType;
typedef DatabaseDirType* DatabaseDirPtr;
/************************************************************
* This structure is used to hold information on an open database
* It gets allocated as a non-movable chunk in the dynamic heap
* when a database is opened and caches database information that
* helps speed up performance.
*************************************************************/
typedef struct {
void * next; // MemPtr to next access structure
UInt16 openCount; // incremented every time it's opened
UInt32 ownerTaskID; // taskID of owner
UInt16 exclusive : 1; // true if opened with exclusive access
UInt16 writeAccess : 1; // true if opened with write access
UInt16 resDB : 1; // true if resource database
LocalID hdrID; // local ID of database header
MemHandle hdrH; // Database header handle
DatabaseHdrPtr hdrP; // Database header MemPtr for faster access
UInt16 cardNo; // card number of database
UInt16 numRecords; // cached here for better performance
MemPtr hdrMasterP; // master MemPtr to header if ROM based
MemPtr* handleTableP; // pointer to block of ROM handles
} DmOpenInfoType;
typedef DmOpenInfoType* DmOpenInfoPtr;
/************************************************************
* This structure is used to hold client specific information for
* an open database. There is one of these allocated every time
* a database is opened, even if it's already open. This structure
* holds the open mode of the client and a pointer to the DmOpenInfoType
* of the database which contains the common database info for all
* clients. The SysAppInfoPtr, referenced off of the current A5,
* has a pointer to the first DmAccessType in the linked list.
*************************************************************/
typedef struct DmAccessType {
struct DmAccessType* next; // MemPtr to next access structure
UInt16 mode; // mode it was opened in
DmOpenInfoPtr openP; // MemPtr to DmOpenInfoType for database
// NEW FOR PalmOS v3.0
UInt32 savedModNum; // saved modification number of database
// at the time of opening
// NEW FOR PalmOS 3.5
UInt8 openType; // Regular, base, or overlay
UInt8 reserved;
} DmAccessType;
typedef DmAccessType* DmAccessPtr;
/************************************************************
* This structure is used to hold the results of a search
* in DmGetNextDatabaseByTypeCreator. It is the "real" structure
* of the generic type DmSearchStateType used by applications.
*************************************************************/
#if EMULATION_LEVEL == EMULATION_NONE
#define MAX_CARDS 1
#else
#define MAX_CARDS 2
#endif
#define MAX_STORES_PER_CARD 2
#define MAX_STORES (MAX_CARDS * MAX_STORES_PER_CARD)
typedef struct {
UInt16 indexes[MAX_STORES];
UInt16 cardNos[MAX_STORES]; // cardNo for each store
UInt32 latestVersionCandidateType; // saved type of latest version candidate
UInt32 latestVersionCandidateCreator; // saved creator of latest version candidate
Int16 latestVersionCandidateStore; // saved store for latest versions
} DmPrvSearchStateType;
typedef DmPrvSearchStateType* DmPrvSearchStatePtr;
/************************************************************
* This structure is used to keep track of protected databases. These
* are databases which have been protected through the DmDatabaseProtect()
* call. A handle to an array of these structures is stored in the
* low memory global GDmProtectListH. The number of entries in the array
* must be calculated by taking the size of the handle and dividing
* by sizeof (DmProtectEntryType)
*************************************************************/
typedef struct {
UInt8 protectCount;
UInt8 cardNo;
LocalID dbID;
} DmProtectEntryType, *DmProtectEntryPtr;
/************************************************************
* This structure is used to cache data about applications and
* launchable data databases in the system Launch Database.
* This is the record structure for the database.
*************************************************************/
#define dmMaxVersionStrLength 16
typedef struct {
// Cached database info:
UInt32 type; // type of database
UInt32 creator; // creator of database
LocalID dbID; // LocalID of database
UInt16 cardNo; // card number of database
UInt16 dbAttrs; // database attributes
UInt16 version; // version of database
UInt8 dbName[dmDBNameLength]; // database name
// Launcher info:
UInt16 lgIconOffset; // offset in bytes from beginning of record to bitmap for large icon
UInt16 smIconOffset; // offset in bytes from beginning of record to bitmap for small icon
UInt8 iconName[dmDBNameLength]; // application icon name (from tain resource)
Char versionStr[dmMaxVersionStrLength]; // version string to display in Launcher
UInt8 flags; // launch flags, defined below
UInt8 reserved;
// Small & Large bitmaps for the database are stored
// at the end of the record, and are 4-byte aligned.
} DmLaunchDBRecordType, *DmLaunchDBRecordPtr;
// Constants for the 'flags' field in DmLaunchDBRecordType
#define dmLaunchFlagDirty 0x01 // Used to tell the launcher to update
// the category & launcher info,
#define dmLaunchFlagOrphaned 0x02 // Used during boot in PrvSyncLaunchDatabase()
// to remove superfluous entries.
#define dmLaunchFlagLaunchable 0x04 // Used during boot in PrvSyncLaunchDatabase()
// to remove superfluous entries.
#define dmLaunchFlagResetCategory 0x08 // Used to force the launcher to move the
// entity into its default category.
// Type & creator for the launch database:
#define dmLaunchDatabaseType 'lnch'
#define dmLaunchDatabaseCreator sysFileCSystem
#define dmLaunchDatabaseVersion 1
#define dmLaunchDatabaseName "psysLaunchDB"
// For private database searching routine
typedef Int16 (*DmSearchFuncPtr) (void const * searchData, void const * dbData, Int32 other);
/************************************************************
* The owner ID of chunks allocated by the Database Manager
*************************************************************/
#define dmDynOwnerID 0x00 // Dynamic heap chunks
#define dmMgrOwnerID 0x01 // Management chunks
#define dmRecOwnerID 0x02 // Record chunks
#define dmOrphanOwnerID 0x03 // Orphaned record chunks
/************************************************************
* Private Data Manager procedures
*************************************************************/
#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif
Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP)
SYS_TRAP(sysTrapDmMoveOpenDBContext);
DmOpenRef DmOpenDBWithLocale(UInt16 cardNo, LocalID dbID, UInt16 mode, const OmLocaleType* localeP)
SYS_TRAP(sysTrapDmOpenDBWithLocale);
#ifdef __cplusplus
}
#endif
#endif
#endif // __DATAPRV_H__
#endif //NON_PORTABLE
|