The Data Integrity Group contain the API to check the state of internal structures, or to control general data access.
More...
The Data Integrity Group contain the API to check the state of internal structures, or to control general data access.
#define MDBM_CHECK_HEADER 0 |
Check MDBM header for integrity.
#define MDBM_CHECK_CHUNKS 1 |
Check MDBM header and chunks (page structure)
#define MDBM_CHECK_DIRECTORY 2 |
Check MDBM header, chunks, and directory.
Check MDBM header, chunks, directory, and data.
#define MDBM_PROT_WRITE 2 |
#define MDBM_PROT_ACCESS 4 |
int mdbm_check |
( |
MDBM * |
db, |
|
|
int |
level, |
|
|
int |
verbose |
|
) |
| |
Checks an MDBM's integrity, and displays information on standard output.
- Parameters
-
[in,out] | db | Database handle |
[in] | level | Depth of checks |
[in] | verbose | Whether to display verbose information while checking |
- Returns
- Check status
- Return values
-
void mdbm_chk_error |
( |
MDBM * |
db, |
|
|
int |
pagenum, |
|
|
int |
mapped_pagenum, |
|
|
int |
index |
|
) |
| |
Checks integrity of an entry on a page.
NOTE: This has not been implemented.
- Parameters
-
[in,out] | db | Database handle |
[in] | pagenum | Page number |
[in] | mapped_pagenum | Mapped page number |
[in] | index | Entry number on a page |
int mdbm_chk_page |
( |
MDBM * |
db, |
|
|
int |
pagenum |
|
) |
| |
Checks the specified page for errors.
It will print errors found on the page, including bad key size, bad val size, and bad offsets of various fields.
V2: Prints found errors to stdout. If no errors, then no printing performed. When it detects errors, it returns -1 and mdbm_get_errno returns EFAULT.
V3: Prints found errors via mdbm_log targeting LOG_CRITICAL. If no errors, then no logging performed. When it detects errors, it returns -1 and errno is set to EFAULT.
- Parameters
-
[in,out] | db | Database handle |
[in] | pagenum | Page to check for errors |
- Returns
- Check page status
- Return values
-
-1 | Errors detected, and errno is set. This could be due to a locking error. For v2, the caller must call mdbm_get_errno and check against EFAULT. For v3, the caller must check errno against EFAULT. |
0 | Success |
int mdbm_chk_all_page |
( |
MDBM * |
db | ) |
|
Checks the database for errors.
It will report same as mdbm_chk_page for all pages in the database. See v2 and v3 in mdbm_chk_page to determine if errors detected in the database.
- Parameters
-
[in,out] | db | Database handle |
- Returns
- Check all pages status
- Return values
-
-1 | Errors detected, and errno is set. This could be due to a locking error. For v2, the caller must call mdbm_get_errno and check against EFAULT. For v3, the caller must check errno against EFAULT. |
0 | success |
int mdbm_protect |
( |
MDBM * |
db, |
|
|
int |
protect |
|
) |
| |
Sets all database pages to protect permission.
This function is for advanced users only. Users that want to use the built-in protect feature should specify MDBM_PROTECT in their mdbm_open flags.
- Parameters
-
[in,out] | db | Database handle |
[in] | protect | Permission mask |
- Returns
- Protect status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
Values for protect mask:
- MDBM_PROT_NONE - no access
- MDBM_PROT_READ - read access
- MDBM_PROT_WRITE - write access
- MDBM_PROT_ACCESS - all access
- MDBM_PROT_NOACCESS - no access (same as MDBM_PROT_NONE)
NOTE: RHEL is unable to set MDBM_PROT_WRITE without MDBM_PROT_READ, so specifying MDBM_PROT_WRITE does not protect against reads.