2
* SNIA DDF1 v1.0 metadata format handler.
4
* Copyright (C) 2005-2006 IBM, All rights reserved.
5
* Written by Darrick Wong <djwong@us.ibm.com>
7
* Copyright (C) 2006 Heinz Mauelshagen, Red Hat GmbH
10
* See file LICENSE at the top of this source tree for license information.
16
/* Cpmpare two GUIDs */
17
static inline uint8_t _and(uint8_t *p)
19
return p[20] & p[21] & p[22] & p[23];
22
static inline int guidcmp(uint8_t *one, uint8_t *two)
24
int x = memcmp(one, two, DDF1_GUID_LENGTH - 4);
29
return (_and(one) || _and(two)) ? 0 : memcmp(one + 20, two + 20, 4);
32
/* Byte offset for sector */
33
static inline uint64_t to_bytes(uint64_t sector)
35
return sector * DDF1_BLKSIZE;
38
uint64_t ddf1_beginning(struct ddf1 *ddf1);
39
uint16_t ddf1_cr_off_maxpds_helper(struct ddf1 *ddf1);
40
int ddf1_endianness(struct lib_context *lc, struct ddf1 *ddf1);
42
struct ddf1_record_handler {
43
int (*vd)(struct lib_context *lc, struct dev_info *di,
44
struct ddf1 *ddf1, int idx);
45
int (*spare)(struct lib_context *lc, struct dev_info *di,
46
struct ddf1 *ddf1, int idx);
49
int ddf1_process_records(struct lib_context *lc, struct dev_info *di,
50
struct ddf1_record_handler *handler,
51
struct ddf1 *ddf1, int in_cpu_format);