~psusi/ubuntu/precise/dmraid/fix-gpt

« back to all changes in this revision

Viewing changes to 1.0.0.rc14/lib/format/ddf/ddf1_lib.h

  • Committer: Bazaar Package Importer
  • Author(s): Giuseppe Iuculano, 6af052c
  • Date: 2009-03-25 22:34:59 UTC
  • mfrom: (2.1.9 sid)
  • mto: (2.4.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20090325223459-y54f0rmxem7htn6r
Tags: 1.0.0.rc15-6
[6af052c] Remove 15_isw_incorrect_status_fix.patch, it causes a
segfault. (Closes: #521104)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * SNIA DDF1 v1.0 metadata format handler.
3
 
 *
4
 
 * Copyright (C) 2005-2006 IBM, All rights reserved.
5
 
 * Written by Darrick Wong <djwong@us.ibm.com>
6
 
 *
7
 
 * Copyright (C) 2006 Heinz Mauelshagen, Red Hat GmbH
8
 
 *                    All rights reserved.
9
 
 *
10
 
 * See file LICENSE at the top of this source tree for license information.
11
 
 */
12
 
 
13
 
#ifndef _DDF1_LIB_H
14
 
#define _DDF1_LIB_H
15
 
 
16
 
/* Cpmpare two GUIDs */
17
 
static inline uint8_t _and(uint8_t *p)
18
 
{
19
 
        return p[20] & p[21] & p[22] & p[23];
20
 
}
21
 
 
22
 
static inline int guidcmp(uint8_t *one, uint8_t *two)
23
 
{
24
 
        int x = memcmp(one, two, DDF1_GUID_LENGTH - 4);
25
 
 
26
 
        if (x)
27
 
                return x;
28
 
 
29
 
        return (_and(one) || _and(two)) ? 0 : memcmp(one + 20, two + 20, 4);
30
 
}
31
 
 
32
 
/* Byte offset for sector */
33
 
static inline uint64_t to_bytes(uint64_t sector)
34
 
{
35
 
        return sector * DDF1_BLKSIZE;
36
 
}
37
 
 
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);
41
 
 
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);
47
 
};
48
 
 
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);
52
 
 
53
 
#endif