1 // Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
6 #define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
7 #include <stdint.h>
8 
9 #include "gpt.h"
10 
11 enum {
12   CGPT_OK = 0,
13   CGPT_FAILED,
14 };
15 
16 typedef struct CgptCreateParams {
17   char *drive_name;
18   uint64_t drive_size;
19   int zap;
20   uint64_t padding;
21 } CgptCreateParams;
22 
23 typedef struct CgptAddParams {
24   char *drive_name;
25   uint64_t drive_size;
26   uint32_t partition;
27   uint64_t begin;
28   uint64_t size;
29   Guid type_guid;
30   Guid unique_guid;
31   char *label;
32   int successful;
33   int tries;
34   int priority;
35   uint32_t raw_value;
36   int set_begin;
37   int set_size;
38   int set_type;
39   int set_unique;
40   int set_successful;
41   int set_tries;
42   int set_priority;
43   int set_raw;
44 } CgptAddParams;
45 
46 typedef struct CgptShowParams {
47   char *drive_name;
48   uint64_t drive_size;
49   int numeric;
50   int verbose;
51   int quick;
52   uint32_t partition;
53   int single_item;
54   int debug;
55   int num_partitions;
56 } CgptShowParams;
57 
58 typedef struct CgptRepairParams {
59   char *drive_name;
60   uint64_t drive_size;
61   int verbose;
62 } CgptRepairParams;
63 
64 typedef struct CgptBootParams {
65   char *drive_name;
66   uint64_t drive_size;
67   uint32_t partition;
68   char *bootfile;
69   int create_pmbr;
70 } CgptBootParams;
71 
72 typedef struct CgptPrioritizeParams {
73   char *drive_name;
74   uint64_t drive_size;
75   uint32_t set_partition;
76   int set_friends;
77   int max_priority;
78   int orig_priority;
79 } CgptPrioritizeParams;
80 
81 struct CgptFindParams;
82 typedef void (*CgptFindShowFn)(struct CgptFindParams *params, char *filename,
83                                int partnum, GptEntry *entry);
84 typedef struct CgptFindParams {
85   char *drive_name;
86   uint64_t drive_size;
87   int verbose;
88   int set_unique;
89   int set_type;
90   int set_label;
91   int oneonly;
92   int numeric;
93   uint8_t *matchbuf;
94   uint64_t matchlen;
95   uint64_t matchoffset;
96   uint8_t *comparebuf;
97   Guid unique_guid;
98   Guid type_guid;
99   char *label;
100   int hits;
101   int match_partnum;           /* 1-based; 0 means no match */
102   /* when working with MTD, we actually work on a temp file, but we still need
103    * to print the device name. so this parameter is here to properly show the
104    * correct device name in that special case. */
105   CgptFindShowFn show_fn;
106 } CgptFindParams;
107 
108 typedef struct CgptLegacyParams {
109   char *drive_name;
110   uint64_t drive_size;
111   int efipart;
112 } CgptLegacyParams;
113 
114 #endif  // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
115