mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-27 05:23:34 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
90 lines
2.7 KiB
C
90 lines
2.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
|
*/
|
|
/*
|
|
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
|
* Use is subject to license terms.
|
|
*/
|
|
|
|
#ifndef _SYS_ZAP_LEAF_H
|
|
#define _SYS_ZAP_LEAF_H
|
|
|
|
#define ZAP_LEAF_MAGIC 0x2AB1EAF
|
|
|
|
/* chunk size = 24 bytes */
|
|
#define ZAP_LEAF_CHUNKSIZE 24
|
|
|
|
/*
|
|
* The amount of space within the chunk available for the array is:
|
|
* chunk size - space for type (1) - space for next pointer (2)
|
|
*/
|
|
#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3)
|
|
|
|
typedef enum zap_chunk_type {
|
|
ZAP_CHUNK_FREE = 253,
|
|
ZAP_CHUNK_ENTRY = 252,
|
|
ZAP_CHUNK_ARRAY = 251,
|
|
ZAP_CHUNK_TYPE_MAX = 250
|
|
} zap_chunk_type_t;
|
|
|
|
/*
|
|
* TAKE NOTE:
|
|
* If zap_leaf_phys_t is modified, zap_leaf_byteswap() must be modified.
|
|
*/
|
|
typedef struct zap_leaf_phys {
|
|
struct zap_leaf_header {
|
|
uint64_t lh_block_type; /* ZBT_LEAF */
|
|
uint64_t lh_pad1;
|
|
uint64_t lh_prefix; /* hash prefix of this leaf */
|
|
uint32_t lh_magic; /* ZAP_LEAF_MAGIC */
|
|
uint16_t lh_nfree; /* number free chunks */
|
|
uint16_t lh_nentries; /* number of entries */
|
|
uint16_t lh_prefix_len; /* num bits used to id this */
|
|
|
|
/* above is accessable to zap, below is zap_leaf private */
|
|
|
|
uint16_t lh_freelist; /* chunk head of free list */
|
|
uint8_t lh_pad2[12];
|
|
} l_hdr; /* 2 24-byte chunks */
|
|
|
|
/*
|
|
* The header is followed by a hash table with
|
|
* ZAP_LEAF_HASH_NUMENTRIES(zap) entries. The hash table is
|
|
* followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
|
|
* zap_leaf_chunk structures. These structures are accessed
|
|
* with the ZAP_LEAF_CHUNK() macro.
|
|
*/
|
|
|
|
uint16_t l_hash[1];
|
|
} zap_leaf_phys_t;
|
|
|
|
typedef union zap_leaf_chunk {
|
|
struct zap_leaf_entry {
|
|
uint8_t le_type; /* always ZAP_CHUNK_ENTRY */
|
|
uint8_t le_int_size; /* size of ints */
|
|
uint16_t le_next; /* next entry in hash chain */
|
|
uint16_t le_name_chunk; /* first chunk of the name */
|
|
uint16_t le_name_length; /* bytes in name, incl null */
|
|
uint16_t le_value_chunk; /* first chunk of the value */
|
|
uint16_t le_value_length; /* value length in ints */
|
|
uint32_t le_cd; /* collision differentiator */
|
|
uint64_t le_hash; /* hash value of the name */
|
|
} l_entry;
|
|
struct zap_leaf_array {
|
|
uint8_t la_type; /* always ZAP_CHUNK_ARRAY */
|
|
union {
|
|
uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
|
|
uint64_t la_array64;
|
|
} __attribute__ ((packed));
|
|
uint16_t la_next; /* next blk or CHAIN_END */
|
|
} l_array;
|
|
struct zap_leaf_free {
|
|
uint8_t lf_type; /* always ZAP_CHUNK_FREE */
|
|
uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
|
|
uint16_t lf_next; /* next in free list, or CHAIN_END */
|
|
} l_free;
|
|
} zap_leaf_chunk_t;
|
|
|
|
#endif /* _SYS_ZAP_LEAF_H */
|