assert: Decorate error message buffer
[glibc.git] / nss / nss_db / nss_db.h
bloba408b89ef1f2d8648a16991dc28c5cb7f8c60b81
1 /* Common database open/close routines for nss_db.
2 Copyright (C) 1999-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef _NSS_DB_H
20 #define _NSS_DB_H 1
22 #include <nss.h>
23 #include <stdint.h>
24 #include <libc-lock.h>
26 NSS_DECLARE_MODULE_FUNCTIONS (db)
28 /* String table index type. */
29 typedef uint32_t stridx_t;
31 /* Database file header. */
32 struct nss_db_header
34 uint32_t magic;
35 #define NSS_DB_MAGIC 0xdd110601
36 uint32_t ndbs;
37 uint64_t valstroffset;
38 uint64_t valstrlen;
39 uint64_t allocate;
40 struct
42 char id;
43 char pad[sizeof (uint32_t) - 1];
44 uint32_t hashsize;
45 uint64_t hashoffset;
46 uint64_t keyidxoffset;
47 uint64_t keystroffset;
48 } dbs[0];
52 /* Information about mapped database. */
53 struct nss_db_map
55 struct nss_db_header *header;
56 size_t len;
60 /* Open the database stored in FILE. If successful, store the database
61 handle in *MAPPINGP or a file descriptor for the file in *FDP and
62 return NSS_STATUS_SUCCESS. On failure, return the appropriate
63 lookup status. */
64 enum nss_status internal_setent (const char *file,
65 struct nss_db_map *mappingp);
67 /* Close the database FD. */
68 extern void internal_endent (struct nss_db_map *mapping);
70 #endif /* nss_db.h */