|
Packit |
6c4009 |
/* Definitions for locale archive handling.
|
|
Packit |
6c4009 |
Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _LOCARCHIVE_H
|
|
Packit |
6c4009 |
#define _LOCARCHIVE_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <stdint.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define AR_MAGIC 0xde020109
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct locarhead
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
uint32_t magic;
|
|
Packit |
6c4009 |
/* Serial number. */
|
|
Packit |
6c4009 |
uint32_t serial;
|
|
Packit |
6c4009 |
/* Name hash table. */
|
|
Packit |
6c4009 |
uint32_t namehash_offset;
|
|
Packit |
6c4009 |
uint32_t namehash_used;
|
|
Packit |
6c4009 |
uint32_t namehash_size;
|
|
Packit |
6c4009 |
/* String table. */
|
|
Packit |
6c4009 |
uint32_t string_offset;
|
|
Packit |
6c4009 |
uint32_t string_used;
|
|
Packit |
6c4009 |
uint32_t string_size;
|
|
Packit |
6c4009 |
/* Table with locale records. */
|
|
Packit |
6c4009 |
uint32_t locrectab_offset;
|
|
Packit |
6c4009 |
uint32_t locrectab_used;
|
|
Packit |
6c4009 |
uint32_t locrectab_size;
|
|
Packit |
6c4009 |
/* MD5 sum hash table. */
|
|
Packit |
6c4009 |
uint32_t sumhash_offset;
|
|
Packit |
6c4009 |
uint32_t sumhash_used;
|
|
Packit |
6c4009 |
uint32_t sumhash_size;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct namehashent
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* Hash value of the name. */
|
|
Packit |
6c4009 |
uint32_t hashval;
|
|
Packit |
6c4009 |
/* Offset of the name in the string table. */
|
|
Packit |
6c4009 |
uint32_t name_offset;
|
|
Packit |
6c4009 |
/* Offset of the locale record. */
|
|
Packit |
6c4009 |
uint32_t locrec_offset;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct sumhashent
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* MD5 sum. */
|
|
Packit |
6c4009 |
char sum[16];
|
|
Packit |
6c4009 |
/* Offset of the file in the archive. */
|
|
Packit |
6c4009 |
uint32_t file_offset;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct locrecent
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
uint32_t refs; /* # of namehashent records that point here */
|
|
Packit |
6c4009 |
struct
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
uint32_t offset;
|
|
Packit |
6c4009 |
uint32_t len;
|
|
Packit |
6c4009 |
} record[__LC_LAST];
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct locarhandle
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* Full path to the locale archive file. */
|
|
Packit |
6c4009 |
const char *fname;
|
|
Packit |
6c4009 |
int fd;
|
|
Packit |
6c4009 |
void *addr;
|
|
Packit |
6c4009 |
size_t mmaped;
|
|
Packit |
6c4009 |
size_t reserved;
|
|
Packit |
6c4009 |
/* If this mmap required adjustment (such as re-aligning), then this is the
|
|
Packit |
6c4009 |
real address that was returned from mmap and thus should be passed to the
|
|
Packit |
6c4009 |
munmap call. The addr field above is the first usable address. */
|
|
Packit |
6c4009 |
void *mmap_base;
|
|
Packit |
6c4009 |
/* Same as above for mmap_base vs addr, but this is the real length of the
|
|
Packit |
6c4009 |
map rather than the usable (which is what reserved represents). */
|
|
Packit |
6c4009 |
size_t mmap_len;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* In memory data for the locales with their checksums. */
|
|
Packit |
6c4009 |
typedef struct locale_category_data
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
off64_t size;
|
|
Packit |
6c4009 |
void *addr;
|
|
Packit |
6c4009 |
char sum[16];
|
|
Packit |
6c4009 |
} locale_data_t[__LC_LAST];
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* locarchive.h */
|