~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to debian/grub-extras/zfs/include/grub/zfs/spa.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  GRUB  --  GRand Unified Bootloader
3
3
 *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
4
 
 *  Copyright 2007 Sun Microsystems, Inc.
 
4
 *  Copyright 2010 Sun Microsystems, Inc.
5
5
 *  Copyright (C) 2009  Vladimir Serbinenko <phcoder@gmail.com>
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
83
83
#define SPA_BLOCKSIZES          (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
84
84
 
85
85
/*
 
86
 * Size of block to hold the configuration data (a packed nvlist)
 
87
 */
 
88
#define SPA_CONFIG_BLOCKSIZE    (1 << 14)
 
89
 
 
90
/*
86
91
 * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
87
92
 * The ASIZE encoding should be at least 64 times larger (6 more bits)
88
93
 * to support up to 4-way RAID-Z mirror mode with worst-case gang block
126
131
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
127
132
 * 5    |G|                      offset3                                |
128
133
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
129
 
 * 6    |E| lvl | type  | cksum | comp  |     PSIZE     |     LSIZE     |
 
134
 * 6    |BDX|lvl| type  | cksum | comp  |     PSIZE     |     LSIZE     |
130
135
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
131
136
 * 7    |                       padding                                 |
132
137
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
133
138
 * 8    |                       padding                                 |
134
139
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
135
 
 * 9    |                       padding                                 |
 
140
 * 9    |                       physical birth txg                      |
136
141
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
137
 
 * a    |                       birth txg                               |
 
142
 * a    |                       logical birth txg                       |
138
143
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
139
144
 * b    |                       fill count                              |
140
145
 *      +-------+-------+-------+-------+-------+-------+-------+-------+
158
163
 * cksum        checksum function
159
164
 * comp         compression function
160
165
 * G            gang block indicator
161
 
 * E            endianness
 
166
 * B            byteorder (endianness)
 
167
 * D            dedup
 
168
 * X            unused
 
169
 * lvl          level of indirection
162
170
 * type         DMU object type
163
 
 * lvl          level of indirection
164
 
 * birth txg    transaction group in which the block was born
 
171
 * phys birth   txg of block allocation; zero if same as logical birth txg
 
172
 * log. birth   transaction group in which the block was logically born
165
173
 * fill count   number of non-zero blocks under this bp
166
174
 * checksum[4]  256-bit checksum of the data this bp describes
167
175
 */
 
176
#define SPA_BLKPTRSHIFT 7               /* blkptr_t is 128 bytes        */
 
177
#define SPA_DVAS_PER_BP 3               /* Number of DVAs in a bp       */
 
178
 
168
179
typedef struct blkptr {
169
 
        dva_t           blk_dva[3];     /* 128-bit Data Virtual Address */
170
 
        grub_uint64_t   blk_prop;       /* size, compression, type, etc */
171
 
        grub_uint64_t   blk_pad[3];     /* Extra space for the future   */
172
 
        grub_uint64_t   blk_birth;      /* transaction group at birth   */
173
 
        grub_uint64_t   blk_fill;       /* fill count                   */
174
 
        zio_cksum_t     blk_cksum;      /* 256-bit checksum             */
 
180
        dva_t           blk_dva[SPA_DVAS_PER_BP]; /* Data Virtual Addresses */
 
181
        grub_uint64_t   blk_prop;       /* size, compression, type, etc     */
 
182
        grub_uint64_t   blk_pad[2];     /* Extra space for the future       */
 
183
        grub_uint64_t   blk_phys_birth; /* txg when block was allocated     */
 
184
        grub_uint64_t   blk_birth;      /* transaction group at birth       */
 
185
        grub_uint64_t   blk_fill;       /* fill count                       */
 
186
        zio_cksum_t     blk_cksum;      /* 256-bit checksum                 */
175
187
} blkptr_t;
176
188
 
177
 
#define SPA_BLKPTRSHIFT 7               /* blkptr_t is 128 bytes        */
178
 
#define SPA_DVAS_PER_BP 3               /* Number of DVAs in a bp       */
179
 
 
180
189
/*
181
190
 * Macros to get and set fields in a bp or DVA.
182
191
 */
195
204
#define DVA_SET_GANG(dva, x)    BF64_SET((dva)->dva_word[1], 63, 1, x)
196
205
 
197
206
#define BP_GET_LSIZE(bp)        \
198
 
        (BP_IS_HOLE(bp) ? 0 : \
199
 
        BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
 
207
        BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)
200
208
#define BP_SET_LSIZE(bp, x)     \
201
209
        BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
202
210
 
203
 
#define BP_GET_COMPRESS(bp)     BF64_GET((bp)->blk_prop, 32, 8)
204
 
#define BP_SET_COMPRESS(bp, x)  BF64_SET((bp)->blk_prop, 32, 8, x)
205
 
 
206
 
#define BP_GET_CHECKSUM(bp)     BF64_GET((bp)->blk_prop, 40, 8)
207
 
#define BP_SET_CHECKSUM(bp, x)  BF64_SET((bp)->blk_prop, 40, 8, x)
208
 
 
209
 
#define BP_GET_TYPE(bp)         BF64_GET((bp)->blk_prop, 48, 8)
210
 
#define BP_SET_TYPE(bp, x)      BF64_SET((bp)->blk_prop, 48, 8, x)
211
 
 
212
 
#define BP_GET_LEVEL(bp)        BF64_GET((bp)->blk_prop, 56, 5)
213
 
#define BP_SET_LEVEL(bp, x)     BF64_SET((bp)->blk_prop, 56, 5, x)
214
 
 
215
 
#define BP_GET_BYTEORDER(bp)    (0 - BF64_GET((bp)->blk_prop, 63, 1))
216
 
#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
 
211
#define BP_GET_COMPRESS(bp)             BF64_GET((bp)->blk_prop, 32, 8)
 
212
#define BP_SET_COMPRESS(bp, x)          BF64_SET((bp)->blk_prop, 32, 8, x)
 
213
 
 
214
#define BP_GET_CHECKSUM(bp)             BF64_GET((bp)->blk_prop, 40, 8)
 
215
#define BP_SET_CHECKSUM(bp, x)          BF64_SET((bp)->blk_prop, 40, 8, x)
 
216
 
 
217
#define BP_GET_TYPE(bp)                 BF64_GET((bp)->blk_prop, 48, 8)
 
218
#define BP_SET_TYPE(bp, x)              BF64_SET((bp)->blk_prop, 48, 8, x)
 
219
 
 
220
#define BP_GET_LEVEL(bp)                BF64_GET((bp)->blk_prop, 56, 5)
 
221
#define BP_SET_LEVEL(bp, x)             BF64_SET((bp)->blk_prop, 56, 5, x)
 
222
 
 
223
#define BP_GET_PROP_BIT_61(bp)          BF64_GET((bp)->blk_prop, 61, 1)
 
224
#define BP_SET_PROP_BIT_61(bp, x)       BF64_SET((bp)->blk_prop, 61, 1, x)
 
225
 
 
226
#define BP_GET_DEDUP(bp)                BF64_GET((bp)->blk_prop, 62, 1)
 
227
#define BP_SET_DEDUP(bp, x)             BF64_SET((bp)->blk_prop, 62, 1, x)
 
228
 
 
229
#define BP_GET_BYTEORDER(bp)            (0 - BF64_GET((bp)->blk_prop, 63, 1))
 
230
#define BP_SET_BYTEORDER(bp, x)         BF64_SET((bp)->blk_prop, 63, 1, x)
 
231
 
 
232
#define BP_PHYSICAL_BIRTH(bp)           \
 
233
        ((bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
 
234
 
 
235
#define BP_SET_BIRTH(bp, logical, physical)     \
 
236
{                                               \
 
237
        (bp)->blk_birth = (logical);            \
 
238
        (bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
 
239
}
217
240
 
218
241
#define BP_GET_ASIZE(bp)        \
219
242
        (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
237
260
        ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
238
261
        (dva1)->dva_word[0] == (dva2)->dva_word[0])
239
262
 
 
263
#define BP_EQUAL(bp1, bp2)      \
 
264
        (BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) &&    \
 
265
        DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) &&    \
 
266
        DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) &&    \
 
267
        DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
 
268
 
240
269
#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
241
270
        (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
242
271
        ((zc1).zc_word[1] - (zc2).zc_word[1]) | \
243
272
        ((zc1).zc_word[2] - (zc2).zc_word[2]) | \
244
273
        ((zc1).zc_word[3] - (zc2).zc_word[3])))
245
274
 
246
 
 
247
275
#define DVA_IS_VALID(dva)       (DVA_GET_ASIZE(dva) != 0)
248
276
 
249
277
#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3)   \
257
285
#define BP_IDENTITY(bp)         (&(bp)->blk_dva[0])
258
286
#define BP_IS_GANG(bp)          DVA_GET_GANG(BP_IDENTITY(bp))
259
287
#define BP_IS_HOLE(bp)          ((bp)->blk_birth == 0)
260
 
#define BP_IS_OLDER(bp, txg)    (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg))
 
288
 
 
289
/* BP_IS_RAIDZ(bp) assumes no block compression */
 
290
#define BP_IS_RAIDZ(bp)         (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
 
291
                                BP_GET_PSIZE(bp))
261
292
 
262
293
#define BP_ZERO(bp)                             \
263
294
{                                               \
270
301
        (bp)->blk_prop = 0;                     \
271
302
        (bp)->blk_pad[0] = 0;                   \
272
303
        (bp)->blk_pad[1] = 0;                   \
273
 
        (bp)->blk_pad[2] = 0;                   \
 
304
        (bp)->blk_phys_birth = 0;               \
274
305
        (bp)->blk_birth = 0;                    \
275
306
        (bp)->blk_fill = 0;                     \
276
307
        ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \