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

« back to all changes in this revision

Viewing changes to 1.0.0.rc16/lib/format/ataraid/via.h

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2010-02-04 21:34:22 UTC
  • mfrom: (1.1.4 upstream) (2.4.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100204213422-tdag8lcxpr7ahmg4
Tags: 1.0.0.rc16-3ubuntu1
* Merge from debian testing. (LP: #503136)  Remaining changes:
  - debian/dmraid-activate: Remove the special-casing of the root
    device which breaks in many situations and leaves the raw devices
    exposed. This was introduced in Debian to accommodate some broken
    configurations which wanted to access "partitions" on the raid
    raw devices. In Ubuntu, broken configurations has not been supported.
  - debian/dmraid.postinst: Comment out "udevadm trigger" call in postinst
    for now as it has severeconsequences when mountall is installed
    (clears /tmp).  If dmraid is installed, then presumably the important
    system devices are up and one canbe bothered with a reboot to take 
    the change into account. Let update-initramfs flag the system
    as needing a reboot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2004,2005  Heinz Mauelshagen, Red Hat GmbH.
 
3
 *                          All rights reserved.
 
4
 *
 
5
 * See file DISCLAIMER at the top of this source tree for license information.
 
6
 */
 
7
 
 
8
#ifndef _VIA_H_
 
9
#define _VIA_H_
 
10
 
 
11
#ifdef  FORMAT_HANDLER
 
12
 
 
13
#include <stdint.h>
 
14
 
 
15
/* VIA metadata and data  offsets. */
 
16
#define VIA_CONFIGOFFSET        ((di->sectors - 1) << 9)
 
17
#define VIA_DATAOFFSET          0
 
18
 
 
19
#define VIA_MAX_DISKS           8
 
20
 
 
21
struct disk {
 
22
        uint16_t        bootable:1;             /* BIOS boot */
 
23
        uint16_t        enable_enhanced:1;      /* Unused */
 
24
        uint16_t        in_disk_array:1;        /* Used/Spare */
 
25
        uint16_t        raid_type:4;
 
26
#define VIA_T_RAID0     0
 
27
#define VIA_T_RAID1     1
 
28
#define VIA_T_SPAN      8
 
29
#define VIA_T_RAID01    9
 
30
#define VIA_RAID_TYPE(x)        ((x)->array.disk.raid_type)
 
31
        uint16_t        array_index:3;
 
32
#define VIA_ARRAY_INDEX(x)      ((x)->array.disk.array_index)
 
33
        uint16_t        raid_type_info:5;
 
34
/* SPAN + RAID 0 */
 
35
#define VIA_T_RAID_INDEX(x) ((x)->array.disk.raid_type_info & 0x7)
 
36
 
 
37
/* RAID 1 */
 
38
#define VIA_T_RAID1_SOURCE(x) (((x)->array.disk.raid_type_info & 0x3) == 0)
 
39
#define VIA_T_RAID1_SPARE(x)  (((x)->array.disk.raid_type_info & 0x3) == 1)
 
40
#define VIA_T_RAID1_MIRROR(x) (((x)->array.disk.raid_type_info & 0x3) == 2)
 
41
#define VIA_T_RAID1_DIRTY(x)  (((x)->array.disk.raid_type_info & 0x4) >> 2)
 
42
 
 
43
/* RAID 0+1 */
 
44
// #define      VIA_T_RAID01_INDEX(x)   VIA_T_RAID_INDEX(x)
 
45
#define VIA_T_RAID01_MIRROR(x)  (((x)->array.disk.raid_type_info & 0x8) >> 3)
 
46
#define VIA_T_RAID01_DIRTY(x)   (((x)->array.disk.raid_type_info & 0x10) >> 4)
 
47
 
 
48
/* SPAN */
 
49
#define VIA_T_SPAN_INDEX(x)     ((x)->array.disk.raid_type_info & 0x7)
 
50
        uint16_t        tolerance:1;
 
51
} __attribute__ ((packed));
 
52
 
 
53
struct array {
 
54
        struct disk     disk;
 
55
        uint8_t         disk_array_ex;
 
56
#define VIA_RAID_DISKS(x)       ((x)->array.disk_array_ex & 0x7)
 
57
#define VIA_BROKEN(x)           (((x)->array.disk_array_ex & 0x8) >> 4)
 
58
#define VIA_STRIDE(x)           (8 << (((x)->array.disk_array_ex & 0xF0) >> 4))
 
59
        uint32_t        capacity_low;
 
60
        uint32_t        capacity_high;
 
61
        uint32_t        serial_checksum;
 
62
} __attribute__ ((packed));
 
63
 
 
64
struct via {
 
65
        uint16_t        signature;
 
66
#define VIA_SIGNATURE   0xAA55
 
67
        uint8_t         version_number;
 
68
        struct array    array;
 
69
        uint32_t        serial_checksum[8];
 
70
        uint8_t         checksum;
 
71
} __attribute__ ((packed));
 
72
#endif
 
73
 
 
74
/* Prototype of the register function for this metadata format handler */
 
75
int register_via(struct lib_context *lc);
 
76
 
 
77
#endif