mb/google/poppy/variants/nocturne: Add DMIC properties to ACPI DSD
[coreboot.git] / util / archive / archive.h
blob67c42e2bbb4db4653b786d160c3ef070ed44476b
1 /*
2 * Copyright (C) 2015 The ChromiumOS Authors. All rights reserved.
3 * written by Daisuke Nojiri <dnojiri@chromium.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef __ARCHIVE_H
16 #define __ARCHIVE_H
18 #include <stdint.h>
21 * Archive file layout:
23 * +----------------------------------+
24 * | root header |
25 * +----------------------------------+
26 * | file_header[0] |
27 * +----------------------------------+
28 * | file_header[1] |
29 * +----------------------------------+
30 * | ... |
31 * +----------------------------------+
32 * | file_header[count-1] |
33 * +----------------------------------+
34 * | file(0) content |
35 * +----------------------------------+
36 * | file(1) content |
37 * +----------------------------------+
38 * | ... |
39 * +----------------------------------+
40 * | file(count-1) content |
41 * +----------------------------------+
44 #define VERSION 0
45 #define CBAR_MAGIC "CBAR"
46 #define NAME_LENGTH 32
48 /* Root header */
49 struct directory {
50 char magic[4];
51 uint32_t version; /* version of the header. little endian */
52 uint32_t size; /* total size of archive. little endian */
53 uint32_t count; /* number of files. little endian */
56 /* File header */
57 struct dentry {
58 /* file name. null-terminated if shorter than NAME_LENGTH */
59 char name[NAME_LENGTH];
60 /* file offset from the root header. little endian */
61 uint32_t offset;
62 /* file size. little endian */
63 uint32_t size;
66 static inline struct dentry *get_first_dentry(const struct directory *dir)
68 return (struct dentry *)(dir + 1);
71 static inline uint32_t get_first_offset(const struct directory *dir)
73 return sizeof(struct directory) + sizeof(struct dentry) * dir->count;
76 #endif