merge mainline into ehci
This commit is contained in:
commit
cefa01261b
443 changed files with 38931 additions and 11122 deletions
|
@ -139,6 +139,13 @@ enum
|
|||
GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT,
|
||||
};
|
||||
|
||||
enum grub_arc_file_access
|
||||
{
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_RO,
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_WO,
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_RW,
|
||||
};
|
||||
|
||||
struct grub_arc_fileinfo
|
||||
{
|
||||
grub_arc_ularge_t start;
|
||||
|
@ -195,7 +202,7 @@ struct grub_arc_firmware_vector
|
|||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
grub_arc_err_t (*get_read_status) (grub_arc_fileno_t fileno);
|
||||
grub_arc_err_t (*write) (grub_arc_fileno_t fileno, void *buf,
|
||||
grub_arc_err_t (*write) (grub_arc_fileno_t fileno, const void *buf,
|
||||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
|
||||
|
|
|
@ -182,6 +182,8 @@ struct grub_ata
|
|||
|
||||
int dma;
|
||||
|
||||
grub_size_t maxbuffer;
|
||||
|
||||
int *present;
|
||||
|
||||
void *data;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
|
||||
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_UTF16 4
|
||||
|
||||
#define GRUB_UCS2_LIMIT 0x10000
|
||||
#define GRUB_UTF16_UPPER_SURROGATE(code) \
|
||||
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
|
||||
|
@ -47,9 +49,35 @@ grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
|
|||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
|
||||
/* Determine the last position where the UTF-8 string [beg, end) can
|
||||
be safely cut. */
|
||||
static inline grub_size_t
|
||||
grub_getend (const char *beg, const char *end)
|
||||
{
|
||||
const char *ptr;
|
||||
for (ptr = end - 1; ptr >= beg; ptr--)
|
||||
if ((*ptr & GRUB_UINT8_2_LEADINGBITS) != GRUB_UINT8_1_LEADINGBIT)
|
||||
break;
|
||||
if (ptr < beg)
|
||||
return 0;
|
||||
if ((*ptr & GRUB_UINT8_1_LEADINGBIT) == 0)
|
||||
return ptr + 1 - beg;
|
||||
if ((*ptr & GRUB_UINT8_3_LEADINGBITS) == GRUB_UINT8_2_LEADINGBITS
|
||||
&& ptr + 2 <= end)
|
||||
return ptr + 2 - beg;
|
||||
if ((*ptr & GRUB_UINT8_4_LEADINGBITS) == GRUB_UINT8_3_LEADINGBITS
|
||||
&& ptr + 3 <= end)
|
||||
return ptr + 3 - beg;
|
||||
if ((*ptr & GRUB_UINT8_5_LEADINGBITS) == GRUB_UINT8_4_LEADINGBITS
|
||||
&& ptr + 4 <= end)
|
||||
return ptr + 4 - beg;
|
||||
/* Invalid character or incomplete. Cut before it. */
|
||||
return ptr - beg;
|
||||
}
|
||||
|
||||
/* Convert UTF-16 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, const grub_uint16_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
grub_uint32_t code_high = 0;
|
||||
|
@ -74,6 +102,8 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
{
|
||||
/* Error... */
|
||||
*dest++ = '?';
|
||||
/* *src may be valid. Don't eat it. */
|
||||
src--;
|
||||
}
|
||||
|
||||
code_high = 0;
|
||||
|
@ -116,19 +146,52 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
return dest;
|
||||
}
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_LATIN1 2
|
||||
|
||||
/* Convert Latin1 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_latin1_to_utf8 (grub_uint8_t *dest, const grub_uint8_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
if (!(*src & 0x80))
|
||||
*dest++ = *src;
|
||||
else
|
||||
{
|
||||
*dest++ = (*src >> 6) | 0xC0;
|
||||
*dest++ = (*src & 0x3F) | 0x80;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Convert UCS-4 to UTF-8. */
|
||||
char *grub_ucs4_to_utf8_alloc (grub_uint32_t *src, grub_size_t size);
|
||||
char *grub_ucs4_to_utf8_alloc (const grub_uint32_t *src, grub_size_t size);
|
||||
|
||||
int
|
||||
grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
|
||||
|
||||
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||
grub_uint32_t **last_position);
|
||||
|
||||
/* Process one character from UTF8 sequence.
|
||||
At beginning set *code = 0, *count = 0. Returns 0 on failure and
|
||||
1 on success. *count holds the number of trailing bytes. */
|
||||
int
|
||||
grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count);
|
||||
|
||||
void
|
||||
grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size,
|
||||
grub_ucs4_to_utf8 (const grub_uint32_t *src, grub_size_t size,
|
||||
grub_uint8_t *dest, grub_size_t destsize);
|
||||
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
/* Returns -2 if not enough space, -1 on invalid character. */
|
||||
grub_ssize_t
|
||||
grub_encode_utf8_character (grub_uint8_t *dest, grub_uint8_t *destend,
|
||||
grub_uint32_t code);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,7 @@ struct grub_command
|
|||
{
|
||||
/* The next element. */
|
||||
struct grub_command *next;
|
||||
struct grub_command **prev;
|
||||
|
||||
/* The name. */
|
||||
const char *name;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -191,11 +192,46 @@ grub_crypto_cipher_set_key (grub_crypto_cipher_handle_t cipher,
|
|||
const unsigned char *key,
|
||||
unsigned keylen);
|
||||
|
||||
void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher);
|
||||
static inline void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher)
|
||||
{
|
||||
grub_free (cipher);
|
||||
}
|
||||
|
||||
void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size);
|
||||
static inline void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size)
|
||||
{
|
||||
const grub_uint8_t *in1ptr = in1, *in2ptr = in2;
|
||||
grub_uint8_t *outptr = out;
|
||||
while (size && (((grub_addr_t) in1ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) in2ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) outptr & (sizeof (grub_uint64_t) - 1))))
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
while (size >= sizeof (grub_uint64_t))
|
||||
{
|
||||
*(grub_uint64_t *) (void *) outptr
|
||||
= (*(grub_uint64_t *) (void *) in1ptr
|
||||
^ *(grub_uint64_t *) (void *) in2ptr);
|
||||
in1ptr += sizeof (grub_uint64_t);
|
||||
in2ptr += sizeof (grub_uint64_t);
|
||||
outptr += sizeof (grub_uint64_t);
|
||||
size -= sizeof (grub_uint64_t);
|
||||
}
|
||||
while (size)
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
|
||||
|
@ -203,7 +239,7 @@ grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
|
|||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size);
|
||||
void *out, const void *in, grub_size_t size);
|
||||
gcry_err_code_t
|
||||
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size,
|
||||
|
@ -251,11 +287,13 @@ extern gcry_md_spec_t _gcry_digest_spec_sha1;
|
|||
extern gcry_md_spec_t _gcry_digest_spec_sha256;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha512;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_crc32;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_aes;
|
||||
#define GRUB_MD_MD5 ((const gcry_md_spec_t *) &_gcry_digest_spec_md5)
|
||||
#define GRUB_MD_SHA1 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha1)
|
||||
#define GRUB_MD_SHA256 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha256)
|
||||
#define GRUB_MD_SHA512 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha512)
|
||||
#define GRUB_MD_CRC32 ((const gcry_md_spec_t *) &_gcry_digest_spec_crc32)
|
||||
#define GRUB_CIPHER_AES ((const gcry_cipher_spec_t *) &_gcry_cipher_spec_aes)
|
||||
|
||||
/* Implement PKCS#5 PBKDF2 as per RFC 2898. The PRF to use is HMAC variant
|
||||
of digest supplied by MD. Inputs are the password P of length PLEN,
|
||||
|
|
|
@ -59,6 +59,7 @@ typedef gcry_err_code_t
|
|||
struct grub_cryptodisk
|
||||
{
|
||||
struct grub_cryptodisk *next;
|
||||
struct grub_cryptodisk **prev;
|
||||
|
||||
char *source;
|
||||
grub_disk_addr_t offset;
|
||||
|
@ -96,6 +97,7 @@ typedef struct grub_cryptodisk *grub_cryptodisk_t;
|
|||
struct grub_cryptodisk_dev
|
||||
{
|
||||
struct grub_cryptodisk_dev *next;
|
||||
struct grub_cryptodisk_dev **prev;
|
||||
|
||||
grub_cryptodisk_t (*scan) (grub_disk_t disk, const char *check_uuid,
|
||||
int boot_only);
|
||||
|
@ -116,7 +118,7 @@ grub_cryptodisk_dev_register (grub_cryptodisk_dev_t cr)
|
|||
static inline void
|
||||
grub_cryptodisk_dev_unregister (grub_cryptodisk_dev_t cr)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_cryptodisk_list), GRUB_AS_LIST (cr));
|
||||
grub_list_remove (GRUB_AS_LIST (cr));
|
||||
}
|
||||
|
||||
#define FOR_CRYPTODISK_DEVS(var) FOR_LIST_ELEMENTS((var), (grub_cryptodisk_list))
|
||||
|
|
|
@ -46,7 +46,7 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
|||
#endif
|
||||
|
||||
int grub_get_weekday (struct grub_datetime *datetime);
|
||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
const char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
|
||||
void grub_unixtime2datetime (grub_int32_t nix,
|
||||
struct grub_datetime *datetime);
|
||||
|
@ -85,14 +85,14 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
|||
/* In the period of validity of unixtime all years divisible by 4
|
||||
are bissextile*/
|
||||
/* Convenience: let's have 3 consecutive non-bissextile years
|
||||
at the beginning of the epoch. So count from 1971 instead of 1970 */
|
||||
ret = SECPERYEAR + SECPERDAY;
|
||||
at the beginning of the epoch. So count from 1973 instead of 1970 */
|
||||
ret = 3 * SECPERYEAR + SECPERDAY;
|
||||
|
||||
/* Transform C divisions and modulos to mathematical ones */
|
||||
y4 = (datetime->year - 1971) / 4;
|
||||
if (datetime->year < 1971)
|
||||
y4 = (datetime->year - 1973) / 4;
|
||||
if (datetime->year < 1973)
|
||||
y4--;
|
||||
ay = datetime->year - 1971 - 4 * y4;
|
||||
ay = datetime->year - 1973 - 4 * y4;
|
||||
ret += y4 * SECPER4YEARS;
|
||||
ret += ay * SECPERYEAR;
|
||||
|
||||
|
@ -125,7 +125,7 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if defined (__powerpc__) || defined (__sparc__)
|
||||
#if (defined (__powerpc__) || defined (__sparc__)) && !defined (GRUB_UTIL)
|
||||
grub_err_t
|
||||
grub_get_datetime_cmos (struct grub_datetime *datetime);
|
||||
grub_err_t
|
||||
|
|
|
@ -23,8 +23,4 @@ grub_ssize_t
|
|||
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
|
||||
char *outbuf, grub_size_t outsize);
|
||||
|
||||
grub_err_t
|
||||
grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
grub_off_t off, char *outbuf, grub_size_t outsize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,18 +32,15 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_OFDISK_ID,
|
||||
GRUB_DISK_DEVICE_LOOPBACK_ID,
|
||||
GRUB_DISK_DEVICE_EFIDISK_ID,
|
||||
GRUB_DISK_DEVICE_RAID_ID,
|
||||
GRUB_DISK_DEVICE_LVM_ID,
|
||||
GRUB_DISK_DEVICE_DISKFILTER_ID,
|
||||
GRUB_DISK_DEVICE_HOST_ID,
|
||||
GRUB_DISK_DEVICE_ATA_ID,
|
||||
GRUB_DISK_DEVICE_MEMDISK_ID,
|
||||
GRUB_DISK_DEVICE_NAND_ID,
|
||||
GRUB_DISK_DEVICE_UUID_ID,
|
||||
GRUB_DISK_DEVICE_PXE_ID,
|
||||
GRUB_DISK_DEVICE_SCSI_ID,
|
||||
GRUB_DISK_DEVICE_FILE_ID,
|
||||
GRUB_DISK_DEVICE_CRYPTODISK_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
@ -96,6 +93,8 @@ struct grub_disk_dev
|
|||
};
|
||||
typedef struct grub_disk_dev *grub_disk_dev_t;
|
||||
|
||||
extern grub_disk_dev_t EXPORT_VAR (grub_disk_dev_list);
|
||||
|
||||
struct grub_partition;
|
||||
|
||||
/* Disk. */
|
||||
|
@ -158,7 +157,19 @@ void grub_disk_cache_invalidate_all (void);
|
|||
|
||||
void EXPORT_FUNC(grub_disk_dev_register) (grub_disk_dev_t dev);
|
||||
void EXPORT_FUNC(grub_disk_dev_unregister) (grub_disk_dev_t dev);
|
||||
int EXPORT_FUNC(grub_disk_dev_iterate) (int (*hook) (const char *name));
|
||||
static inline int
|
||||
grub_disk_dev_iterate (int (*hook) (const char *name))
|
||||
{
|
||||
grub_disk_dev_t p;
|
||||
grub_disk_pull_t pull;
|
||||
|
||||
for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++)
|
||||
for (p = grub_disk_dev_list; p; p = p->next)
|
||||
if (p->iterate && (p->iterate) (hook, pull))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_disk_t EXPORT_FUNC(grub_disk_open) (const char *name);
|
||||
void EXPORT_FUNC(grub_disk_close) (grub_disk_t disk);
|
||||
|
@ -185,13 +196,15 @@ extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
|||
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
|
||||
void grub_lvm_init (void);
|
||||
void grub_ldm_init (void);
|
||||
void grub_mdraid09_init (void);
|
||||
void grub_mdraid1x_init (void);
|
||||
void grub_raid_init (void);
|
||||
void grub_diskfilter_init (void);
|
||||
void grub_lvm_fini (void);
|
||||
void grub_ldm_fini (void);
|
||||
void grub_mdraid09_fini (void);
|
||||
void grub_mdraid1x_fini (void);
|
||||
void grub_raid_fini (void);
|
||||
void grub_diskfilter_fini (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DISK_HEADER */
|
||||
|
|
191
include/grub/diskfilter.h
Normal file
191
include/grub/diskfilter.h
Normal file
|
@ -0,0 +1,191 @@
|
|||
/* diskfilter.h - On disk structures for RAID. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007,2008,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_DISKFILTER_H
|
||||
#define GRUB_DISKFILTER_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_RAID_LAYOUT_RIGHT_MASK = 1,
|
||||
GRUB_RAID_LAYOUT_SYMMETRIC_MASK = 2,
|
||||
GRUB_RAID_LAYOUT_MUL_FROM_POS = 4,
|
||||
|
||||
GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC = 0,
|
||||
GRUB_RAID_LAYOUT_RIGHT_ASYMMETRIC = GRUB_RAID_LAYOUT_RIGHT_MASK,
|
||||
GRUB_RAID_LAYOUT_LEFT_SYMMETRIC = GRUB_RAID_LAYOUT_SYMMETRIC_MASK,
|
||||
GRUB_RAID_LAYOUT_RIGHT_SYMMETRIC = (GRUB_RAID_LAYOUT_RIGHT_MASK
|
||||
| GRUB_RAID_LAYOUT_SYMMETRIC_MASK)
|
||||
};
|
||||
|
||||
|
||||
struct grub_diskfilter_vg {
|
||||
char *uuid;
|
||||
grub_size_t uuid_len;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
int extent_size;
|
||||
struct grub_diskfilter_pv *pvs;
|
||||
struct grub_diskfilter_lv *lvs;
|
||||
struct grub_diskfilter_vg *next;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_diskfilter *driver;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_diskfilter_pv_id {
|
||||
union
|
||||
{
|
||||
char *uuid;
|
||||
int id;
|
||||
};
|
||||
grub_size_t uuidlen;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_pv {
|
||||
struct grub_diskfilter_pv_id id;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t part_start;
|
||||
grub_disk_addr_t part_size;
|
||||
grub_disk_addr_t start_sector; /* Sector number where the data area starts. */
|
||||
struct grub_diskfilter_pv *next;
|
||||
/* Optional. */
|
||||
grub_uint8_t *internal_id;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_lv {
|
||||
/* Name used for disk. */
|
||||
char *fullname;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
int number;
|
||||
unsigned int segment_count;
|
||||
grub_size_t segment_alloc;
|
||||
grub_uint64_t size;
|
||||
int became_readable_at;
|
||||
|
||||
int visible;
|
||||
|
||||
/* Pointer to segment_count segments. */
|
||||
struct grub_diskfilter_segment *segments;
|
||||
struct grub_diskfilter_vg *vg;
|
||||
struct grub_diskfilter_lv *next;
|
||||
|
||||
/* Optional. */
|
||||
char *internal_id;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_segment {
|
||||
unsigned int start_extent;
|
||||
unsigned int extent_count;
|
||||
enum
|
||||
{
|
||||
GRUB_DISKFILTER_STRIPED = 0,
|
||||
GRUB_DISKFILTER_MIRROR = 1,
|
||||
GRUB_DISKFILTER_RAID4 = 4,
|
||||
GRUB_DISKFILTER_RAID5 = 5,
|
||||
GRUB_DISKFILTER_RAID6 = 6,
|
||||
GRUB_DISKFILTER_RAID10 = 10,
|
||||
} type;
|
||||
int layout;
|
||||
/* valid only for raid10. */
|
||||
grub_uint64_t raid_member_size;
|
||||
|
||||
unsigned int node_count;
|
||||
unsigned int node_alloc;
|
||||
struct grub_diskfilter_node *nodes;
|
||||
|
||||
unsigned int stripe_size;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_node {
|
||||
grub_disk_addr_t start;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
struct grub_diskfilter_pv *pv;
|
||||
struct grub_diskfilter_lv *lv;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_vg *
|
||||
grub_diskfilter_get_vg_by_uuid (grub_size_t uuidlen, char *uuid);
|
||||
|
||||
struct grub_diskfilter
|
||||
{
|
||||
struct grub_diskfilter *next;
|
||||
struct grub_diskfilter **prev;
|
||||
|
||||
const char *name;
|
||||
|
||||
struct grub_diskfilter_vg * (*detect) (grub_disk_t disk,
|
||||
struct grub_diskfilter_pv_id *id,
|
||||
grub_disk_addr_t *start_sector);
|
||||
};
|
||||
typedef struct grub_diskfilter *grub_diskfilter_t;
|
||||
|
||||
extern grub_diskfilter_t grub_diskfilter_list;
|
||||
static inline void
|
||||
grub_diskfilter_register (grub_diskfilter_t diskfilter)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_diskfilter_list),
|
||||
GRUB_AS_LIST (diskfilter));
|
||||
}
|
||||
static inline void
|
||||
grub_diskfilter_unregister (grub_diskfilter_t diskfilter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST (diskfilter));
|
||||
}
|
||||
|
||||
struct grub_diskfilter_vg *
|
||||
grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||
char *name, grub_uint64_t disk_size,
|
||||
grub_uint64_t stripe_size,
|
||||
int layout, int level);
|
||||
|
||||
typedef grub_err_t (*grub_raid5_recover_func_t) (struct grub_diskfilter_segment *array,
|
||||
int disknr, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
typedef grub_err_t (*grub_raid6_recover_func_t) (struct grub_diskfilter_segment *array,
|
||||
int disknr, int p, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
extern grub_raid5_recover_func_t grub_raid5_recover_func;
|
||||
extern grub_raid6_recover_func_t grub_raid6_recover_func;
|
||||
|
||||
grub_err_t grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg);
|
||||
|
||||
grub_err_t
|
||||
grub_diskfilter_read_node (const struct grub_diskfilter_node *node,
|
||||
grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_diskfilter_pv *
|
||||
grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
|
||||
struct grub_diskfilter_vg **vg);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RAID_H */
|
|
@ -136,11 +136,12 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
#ifdef __ia64__
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
void *got;
|
||||
void *tramp;
|
||||
#endif
|
||||
void *base;
|
||||
grub_size_t sz;
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
@ -176,10 +177,21 @@ void
|
|||
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got);
|
||||
|
||||
#ifdef __ia64__
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 16
|
||||
#if defined (__ia64__)
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE GRUB_IA64_DL_TRAMP_SIZE
|
||||
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
|
||||
#else
|
||||
void
|
||||
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got);
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE 16
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -371,7 +371,7 @@ struct grub_efi_memory_descriptor
|
|||
grub_efi_virtual_address_t virtual_start;
|
||||
grub_efi_uint64_t num_pages;
|
||||
grub_efi_uint64_t attribute;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t;
|
||||
|
||||
/* Device Path definitions. */
|
||||
|
@ -416,7 +416,7 @@ struct grub_efi_pci_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
grub_efi_uint8_t device;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -425,7 +425,7 @@ struct grub_efi_pccard_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -433,10 +433,10 @@ typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
|||
struct grub_efi_memory_mapped_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_memory_type_t memory_type;
|
||||
grub_efi_uint32_t memory_type;
|
||||
grub_efi_physical_address_t start_address;
|
||||
grub_efi_physical_address_t end_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -446,7 +446,7 @@ struct grub_efi_vendor_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -455,7 +455,7 @@ struct grub_efi_controller_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t controller_number;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t;
|
||||
|
||||
/* ACPI Device Path. */
|
||||
|
@ -468,7 +468,7 @@ struct grub_efi_acpi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -479,8 +479,8 @@ struct grub_efi_expanded_acpi_device_path
|
|||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
grub_efi_uint32_t cid;
|
||||
char hidstr[1];
|
||||
};
|
||||
char hidstr[0];
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
|
||||
|
@ -503,7 +503,7 @@ struct grub_efi_atapi_device_path
|
|||
grub_efi_uint8_t primary_secondary;
|
||||
grub_efi_uint8_t slave_master;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -513,7 +513,7 @@ struct grub_efi_scsi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint16_t pun;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -524,7 +524,7 @@ struct grub_efi_fibre_channel_device_path
|
|||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t wwn;
|
||||
grub_efi_uint64_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t;
|
||||
|
||||
#define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -534,7 +534,7 @@ struct grub_efi_1394_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -544,7 +544,7 @@ struct grub_efi_usb_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t parent_port_number;
|
||||
grub_efi_uint8_t interface;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
|
||||
|
@ -557,7 +557,7 @@ struct grub_efi_usb_class_device_path
|
|||
grub_efi_uint8_t device_class;
|
||||
grub_efi_uint8_t device_subclass;
|
||||
grub_efi_uint8_t device_protocol;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t;
|
||||
|
||||
#define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -566,7 +566,7 @@ struct grub_efi_i2o_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t tid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
|
||||
|
@ -576,7 +576,7 @@ struct grub_efi_mac_address_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_mac_address_t mac_address;
|
||||
grub_efi_uint8_t if_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
|
||||
|
@ -590,7 +590,7 @@ struct grub_efi_ipv4_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
|
||||
|
@ -604,7 +604,7 @@ struct grub_efi_ipv6_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
|
||||
|
||||
#define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
|
||||
|
@ -617,7 +617,7 @@ struct grub_efi_infiniband_device_path
|
|||
grub_efi_uint64_t remote_id;
|
||||
grub_efi_uint64_t target_port_id;
|
||||
grub_efi_uint64_t device_id;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t;
|
||||
|
||||
#define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
|
||||
|
@ -630,7 +630,7 @@ struct grub_efi_uart_device_path
|
|||
grub_efi_uint8_t data_bits;
|
||||
grub_efi_uint8_t parity;
|
||||
grub_efi_uint8_t stop_bits;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
||||
|
@ -640,7 +640,7 @@ struct grub_efi_vendor_messaging_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
|
||||
|
||||
/* Media Device Path. */
|
||||
|
@ -657,7 +657,7 @@ struct grub_efi_hard_drive_device_path
|
|||
grub_efi_uint8_t partition_signature[8];
|
||||
grub_efi_uint8_t mbr_type;
|
||||
grub_efi_uint8_t signature_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -668,7 +668,7 @@ struct grub_efi_cdrom_device_path
|
|||
grub_efi_uint32_t boot_entry;
|
||||
grub_efi_lba_t partition_start;
|
||||
grub_efi_lba_t partition_size;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -678,7 +678,7 @@ struct grub_efi_vendor_media_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -687,7 +687,7 @@ struct grub_efi_file_path_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_char16_t path_name[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -696,7 +696,7 @@ struct grub_efi_protocol_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -705,7 +705,7 @@ struct grub_efi_piwg_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid __attribute__ ((packed));
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
|
||||
|
||||
|
||||
|
@ -720,7 +720,7 @@ struct grub_efi_bios_device_path
|
|||
grub_efi_uint16_t device_type;
|
||||
grub_efi_uint16_t status_flags;
|
||||
char description[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
|
||||
|
||||
struct grub_efi_open_protocol_information_entry
|
||||
|
@ -1301,7 +1301,9 @@ struct grub_efi_simple_network
|
|||
void (*statistics) (void);
|
||||
void (*mcastiptomac) (void);
|
||||
void (*nvdata) (void);
|
||||
void (*getstatus) (void);
|
||||
grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this,
|
||||
grub_uint32_t *int_status,
|
||||
void **txbuf);
|
||||
grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t header_size,
|
||||
grub_efi_uintn_t buffer_size,
|
||||
|
|
|
@ -70,6 +70,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
|
|||
char **device,
|
||||
char **path);
|
||||
|
||||
grub_addr_t grub_efi_modules_addr (void);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
void grub_efi_init (void);
|
||||
|
|
|
@ -24,15 +24,8 @@
|
|||
|
||||
#define GRUB_MMAP_REGISTER_BY_FIRMWARE 1
|
||||
|
||||
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
|
||||
int type, int handle);
|
||||
grub_err_t grub_machine_mmap_unregister (int handle);
|
||||
|
||||
grub_uint64_t grub_mmap_get_post64 (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
|
||||
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -114,9 +114,9 @@ extern grub_efi_system_table64_t *grub_efiemu_system_table64;
|
|||
: (grub_efiemu_system_table32->x \
|
||||
= (y)))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_PTR(x) ((grub_efiemu_sizeof_uintn_t () == 8)\
|
||||
? UINT_TO_PTR \
|
||||
? (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table64->x) \
|
||||
: UINT_TO_PTR \
|
||||
: (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table32->x))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_VAR(x) ((grub_efiemu_sizeof_uintn_t () == 8) \
|
||||
? (void *) \
|
||||
|
@ -200,15 +200,9 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
|
|||
int grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
|
||||
grub_efi_memory_type_t type);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_memory_descriptor_t *memory_map,
|
||||
grub_efi_uintn_t *map_key,
|
||||
grub_efi_uintn_t *descriptor_size,
|
||||
grub_efi_uint32_t *descriptor_version);
|
||||
grub_err_t grub_efiemu_mm_unload (void);
|
||||
grub_err_t grub_efiemu_mm_do_alloc (void);
|
||||
grub_err_t grub_efiemu_mm_init (void);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
void grub_efiemu_mm_return_request (int handle);
|
||||
grub_efi_memory_type_t grub_efiemu_mm_get_type (int handle);
|
||||
|
||||
|
@ -271,8 +265,7 @@ grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
|||
int minus_handle, int ptv_needed, int size);
|
||||
grub_err_t grub_efiemu_write_sym_markers (void);
|
||||
grub_err_t grub_efiemu_pnvram (void);
|
||||
grub_err_t grub_efiemu_prepare (void);
|
||||
char *grub_efiemu_get_default_core_name (void);
|
||||
const char *grub_efiemu_get_default_core_name (void);
|
||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||
grub_err_t grub_efiemu_autocore (void);
|
||||
grub_err_t grub_efiemu_crc32 (void);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void grub_util_biosdisk_init (const char *dev_map);
|
||||
|
@ -29,14 +30,32 @@ char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
|||
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
||||
int grub_util_biosdisk_is_present (const char *name);
|
||||
int grub_util_biosdisk_is_floppy (grub_disk_t disk);
|
||||
const char *
|
||||
grub_util_biosdisk_get_compatibility_hint (grub_disk_t disk);
|
||||
grub_err_t grub_util_biosdisk_flush (struct grub_disk *disk);
|
||||
void grub_util_pull_device (const char *osname);
|
||||
grub_err_t
|
||||
grub_util_fd_seek (int fd, const char *name, grub_uint64_t sector);
|
||||
ssize_t grub_util_fd_read (int fd, char *buf, size_t len);
|
||||
ssize_t grub_util_fd_write (int fd, const char *buf, size_t len);
|
||||
grub_err_t
|
||||
grub_cryptodisk_cheat_mount (const char *sourcedev, const char *cheat);
|
||||
void grub_util_cryptodisk_print_uuid (grub_disk_t disk);
|
||||
char *
|
||||
grub_util_get_ldm (grub_disk_t disk, grub_disk_addr_t start);
|
||||
int
|
||||
grub_util_is_ldm (grub_disk_t disk);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_err_t
|
||||
grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
#endif
|
||||
grub_disk_addr_t
|
||||
grub_hostdisk_find_partition_start (const char *dev);
|
||||
const char *
|
||||
grub_hostdisk_os_dev_to_grub_drive (const char *os_dev, int add);
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
grub_uint64_t
|
||||
grub_util_get_fd_sectors (int fd, unsigned *log_secsize);
|
||||
|
|
|
@ -60,7 +60,7 @@ grub_util_device_is_mapped (const char *dev);
|
|||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct grub_env_var;
|
||||
|
||||
typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct grub_env_var
|
|||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
const char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
|
||||
|
|
|
@ -59,8 +59,14 @@ typedef enum
|
|||
GRUB_ERR_NET_BAD_ADDRESS,
|
||||
GRUB_ERR_NET_ROUTE_LOOP,
|
||||
GRUB_ERR_NET_NO_ROUTE,
|
||||
GRUB_ERR_NET_NO_ANSWER,
|
||||
GRUB_ERR_WAIT,
|
||||
GRUB_ERR_BUG
|
||||
GRUB_ERR_BUG,
|
||||
GRUB_ERR_NET_PORT_CLOSED,
|
||||
GRUB_ERR_NET_INVALID_RESPONSE,
|
||||
GRUB_ERR_NET_UNKNOWN_ERROR,
|
||||
GRUB_ERR_NET_PACKET_TOO_BIG,
|
||||
GRUB_ERR_NET_NO_DOMAIN
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
|
|
@ -31,8 +31,17 @@ struct grub_video_fbblit_info
|
|||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
void *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
/* Advance pointer by VAL bytes. If there is no unaligned access available,
|
||||
VAL has to be divisible by size of pointed type.
|
||||
*/
|
||||
#ifdef GRUB_HAVE_UNALIGNED_ACCESS
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) = (typeof (ptr)) ((char *) ptr + val))
|
||||
#else
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) += (val) / sizeof (*(ptr)))
|
||||
#endif
|
||||
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
|
|
@ -56,9 +56,10 @@ typedef enum grub_file_filter_id
|
|||
{
|
||||
GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_LZOPIO,
|
||||
GRUB_FILE_FILTER_MAX,
|
||||
GRUB_FILE_FILTER_COMPRESSION_FIRST = GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_LZOPIO,
|
||||
} grub_file_filter_id_t;
|
||||
|
||||
typedef grub_file_t (*grub_file_filter_t) (grub_file_t in);
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
/* For embedding types. */
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/partition.h>
|
||||
#endif
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
@ -42,6 +46,7 @@ struct grub_fs
|
|||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
struct grub_fs **prev;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
@ -74,6 +79,11 @@ struct grub_fs
|
|||
grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (grub_device_t device, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
|
||||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
@ -102,7 +112,7 @@ grub_fs_register (grub_fs_t fs)
|
|||
static inline void
|
||||
grub_fs_unregister (grub_fs_t fs)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
grub_list_remove (GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define GRUB_GPT_PARTITION_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
struct grub_gpt_part_type
|
||||
{
|
||||
|
@ -36,10 +37,19 @@ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
|
|||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
|
||||
{ grub_cpu_to_le32_compile_time (0x21686148), grub_cpu_to_le16_compile_time (0x6449), grub_cpu_to_le16_compile_time (0x6e6f), \
|
||||
{ grub_cpu_to_le32_compile_time (0x21686148), \
|
||||
grub_cpu_to_le16_compile_time (0x6449), \
|
||||
grub_cpu_to_le16_compile_time (0x6e6f), \
|
||||
{ 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
|
||||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_LDM \
|
||||
{ grub_cpu_to_le32_compile_time (0x5808C8AAU),\
|
||||
grub_cpu_to_le16_compile_time (0x7E8F), \
|
||||
grub_cpu_to_le16_compile_time (0x42E0), \
|
||||
{ 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \
|
||||
}
|
||||
|
||||
struct grub_gpt_header
|
||||
{
|
||||
grub_uint8_t magic[8];
|
||||
|
@ -68,4 +78,10 @@ struct grub_gpt_partentry
|
|||
char name[72];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
grub_err_t
|
||||
grub_gpt_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition));
|
||||
|
||||
|
||||
#endif /* ! GRUB_GPT_PARTITION_HEADER */
|
||||
|
|
|
@ -94,8 +94,8 @@ grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
|
|||
grub_addr_t *kern_end);
|
||||
|
||||
grub_err_t grub_bsd_add_meta (grub_uint32_t type,
|
||||
void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (char *filename, char *type,
|
||||
const void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (const char *filename, const char *type,
|
||||
int argc, char **argv,
|
||||
grub_addr_t addr, grub_uint32_t size);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ struct grub_netbsd_btinfo_bootwedge {
|
|||
grub_disk_addr_t matchblk;
|
||||
grub_uint64_t matchnblks;
|
||||
grub_uint8_t matchhash[16]; /* MD5 hash */
|
||||
} __packed;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_netbsd_btinfo_symtab
|
||||
{
|
||||
|
|
|
@ -26,16 +26,6 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/i386/vga_common.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
int grub_console_getkey (struct grub_term_input *term);
|
||||
grub_uint16_t grub_console_getxy (struct grub_term_output *term);
|
||||
void grub_console_gotoxy (struct grub_term_output *term,
|
||||
grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_console_cls (struct grub_term_output *term);
|
||||
void grub_console_setcursor (struct grub_term_output *term, int on);
|
||||
void grub_console_putchar (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
|
|
|
@ -29,20 +29,10 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The DOS partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_dos_part;
|
||||
|
||||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
extern grub_uint32_t EXPORT_VAR(grub_boot_device);
|
||||
|
||||
extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* This is an asm part of the chainloader. */
|
||||
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
|
@ -157,9 +157,6 @@
|
|||
#define GRUB_PXE_BOOTP_SIZE (312 + 236) /* DHCP standard vendor field size. */
|
||||
#endif
|
||||
|
||||
#define GRUB_PXE_MIN_BLKSIZE 512
|
||||
#define GRUB_PXE_MAX_BLKSIZE 1432
|
||||
|
||||
#define GRUB_PXE_TFTP_PORT 69
|
||||
|
||||
#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
|
||||
|
|
|
@ -28,12 +28,6 @@
|
|||
|
||||
extern grub_addr_t grub_core_entry_addr;
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
|
|
@ -33,10 +33,4 @@
|
|||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void grub_machine_mmap_init (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! _GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,12 +16,13 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BOOT_HEADER
|
||||
#define GRUB_BOOT_HEADER 1
|
||||
#ifndef GRUB_REBOOT_H
|
||||
#define GRUB_REBOOT_H 1
|
||||
|
||||
#define GRUB_BOOT_VERSION_MAJOR 4
|
||||
#define GRUB_BOOT_VERSION_MINOR 0
|
||||
#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \
|
||||
| GRUB_BOOT_VERSION_MAJOR)
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#endif /* ! GRUB_BOOT_HEADER */
|
||||
extern grub_uint8_t grub_reboot_end[], grub_reboot_start[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -48,6 +48,8 @@ struct grub_relocator16_state
|
|||
grub_uint16_t ip;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t edx;
|
||||
grub_uint32_t esi;
|
||||
int a20;
|
||||
};
|
||||
|
||||
struct grub_relocator64_state
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
/* i386 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
|
|
|
@ -125,7 +125,7 @@ extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag);
|
|||
|
||||
|
||||
void EXPORT_FUNC(grub_ieee1275_init) (void);
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (const char *name,
|
||||
grub_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *property, void *buf,
|
||||
|
@ -148,7 +148,7 @@ int EXPORT_FUNC(grub_ieee1275_instance_to_path)
|
|||
(grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, grub_size_t len,
|
||||
const void *buffer, grub_size_t len,
|
||||
grub_ssize_t *actualp);
|
||||
int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, grub_size_t len,
|
||||
|
@ -173,7 +173,8 @@ int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size,
|
|||
unsigned int align, grub_addr_t *result);
|
||||
int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
const char *propname,
|
||||
const void *buf,
|
||||
grub_size_t size,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
|
||||
|
@ -183,10 +184,8 @@ int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs);
|
|||
|
||||
int EXPORT_FUNC(grub_devalias_iterate)
|
||||
(int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
int EXPORT_FUNC(grub_children_iterate) (char *devpath,
|
||||
int EXPORT_FUNC(grub_children_iterate) (const char *devpath,
|
||||
int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||
|
||||
int
|
||||
|
|
|
@ -26,14 +26,15 @@ enum
|
|||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
OBJ_TYPE_CONFIG,
|
||||
OBJ_TYPE_PREFIX
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
struct grub_module_header
|
||||
{
|
||||
/* The type of object. */
|
||||
grub_uint8_t type;
|
||||
grub_uint32_t type;
|
||||
/* The size of object (including this header). */
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
@ -68,14 +69,20 @@ struct grub_module_info64
|
|||
#define grub_module_info grub_module_info32
|
||||
#endif
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
extern grub_addr_t EXPORT_VAR (grub_modbase);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
#define FOR_MODULES(var) for (\
|
||||
var = grub_modbase ? (struct grub_module_header *) \
|
||||
(grub_modbase + (((struct grub_module_info *) grub_modbase)->offset)) : 0;\
|
||||
var && (grub_addr_t) var \
|
||||
< (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \
|
||||
var = (struct grub_module_header *) \
|
||||
((grub_uint32_t *) var + ((struct grub_module_header *) var)->size / 4))
|
||||
|
||||
grub_addr_t grub_modules_get_end (void);
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
void grub_main (void) __attribute__ ((noreturn));
|
||||
|
||||
/* The machine-specific initialization. This must initialize memory. */
|
||||
void grub_machine_init (void);
|
||||
|
@ -92,9 +99,4 @@ void grub_register_exported_symbols (void);
|
|||
|
||||
extern void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
|
||||
|
||||
|
||||
#if ! defined (ASM_FILE)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -53,8 +53,8 @@ struct grub_arg_option
|
|||
const char *longarg;
|
||||
int shortarg;
|
||||
int flags;
|
||||
char *doc;
|
||||
char *arg;
|
||||
const char *doc;
|
||||
const char *arg;
|
||||
grub_arg_type_t type;
|
||||
};
|
||||
|
||||
|
|
|
@ -63,6 +63,12 @@ void EXPORT_FUNC (__divsi3) (void);
|
|||
# ifdef HAVE___MODSI3
|
||||
void EXPORT_FUNC (__modsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZDI2
|
||||
void EXPORT_FUNC (__ctzdi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZSI2
|
||||
void EXPORT_FUNC (__ctzsi2) (void);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef HAVE___IA64_TRAMPOLINE
|
||||
|
|
|
@ -27,11 +27,30 @@
|
|||
struct grub_list
|
||||
{
|
||||
struct grub_list *next;
|
||||
struct grub_list **prev;
|
||||
};
|
||||
typedef struct grub_list *grub_list_t;
|
||||
|
||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||
static inline void
|
||||
grub_list_push (grub_list_t *head, grub_list_t item)
|
||||
{
|
||||
item->prev = head;
|
||||
if (*head)
|
||||
(*head)->prev = &item->next;
|
||||
item->next = *head;
|
||||
*head = item;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_list_remove (grub_list_t item)
|
||||
{
|
||||
if (item->prev)
|
||||
*item->prev = item->next;
|
||||
if (item->next)
|
||||
item->next->prev = item->prev;
|
||||
item->next = 0;
|
||||
item->prev = 0;
|
||||
}
|
||||
|
||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||
|
||||
|
@ -53,16 +72,17 @@ grub_bad_type_cast_real (int line, const char *file)
|
|||
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
|
||||
|
||||
#define GRUB_AS_LIST(ptr) \
|
||||
(GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
|
||||
(grub_list_t) ptr : grub_bad_type_cast ())
|
||||
(GRUB_FIELD_MATCH (ptr, grub_list_t, next) && GRUB_FIELD_MATCH (ptr, grub_list_t, prev) ? \
|
||||
(grub_list_t) ptr : (grub_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_LIST_P(pptr) \
|
||||
(GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
|
||||
(grub_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
(GRUB_FIELD_MATCH (*pptr, grub_list_t, next) && GRUB_FIELD_MATCH (*pptr, grub_list_t, prev) ? \
|
||||
(grub_list_t *) (void *) pptr : (grub_list_t *) grub_bad_type_cast ())
|
||||
|
||||
struct grub_named_list
|
||||
{
|
||||
struct grub_named_list *next;
|
||||
struct grub_named_list **prev;
|
||||
char *name;
|
||||
};
|
||||
typedef struct grub_named_list *grub_named_list_t;
|
||||
|
@ -71,14 +91,16 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
|
|||
const char *name);
|
||||
|
||||
#define GRUB_AS_NAMED_LIST(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t) ptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_named_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t) ptr : (grub_named_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_NAMED_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_named_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t *) (void *) pptr : (grub_named_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_PRIO_LIST_PRIO_MASK 0xff
|
||||
#define GRUB_PRIO_LIST_FLAG_ACTIVE 0x100
|
||||
|
@ -86,6 +108,7 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
|
|||
struct grub_prio_list
|
||||
{
|
||||
struct grub_prio_list *next;
|
||||
struct grub_prio_list **prev;
|
||||
char *name;
|
||||
int prio;
|
||||
};
|
||||
|
@ -95,23 +118,27 @@ void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head,
|
|||
grub_prio_list_t item);
|
||||
|
||||
static inline void
|
||||
grub_prio_list_remove (grub_prio_list_t *head, grub_prio_list_t item)
|
||||
grub_prio_list_remove (grub_prio_list_t item)
|
||||
{
|
||||
if ((item->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && (item->next))
|
||||
item->next->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||
grub_list_remove (GRUB_AS_LIST_P (head), GRUB_AS_LIST (item));
|
||||
grub_list_remove (GRUB_AS_LIST (item));
|
||||
}
|
||||
|
||||
#define GRUB_AS_PRIO_LIST(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t) ptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t) ptr \
|
||||
: (grub_prio_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_PRIO_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio)) ? \
|
||||
(grub_prio_list_t *) (void *) pptr \
|
||||
: (grub_prio_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_LIST_HEADER */
|
||||
|
|
|
@ -56,11 +56,13 @@ typedef enum {
|
|||
} grub_loader_preboot_hook_prio_t;
|
||||
|
||||
/* Register a preboot hook. */
|
||||
void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
struct grub_preboot;
|
||||
|
||||
struct grub_preboot *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
|
||||
/* Unregister given preboot hook. */
|
||||
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (void *hnd);
|
||||
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (struct grub_preboot *hnd);
|
||||
|
||||
#endif /* ! GRUB_LOADER_HEADER */
|
||||
|
|
|
@ -21,60 +21,11 @@
|
|||
#define GRUB_LVM_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/diskfilter.h>
|
||||
|
||||
/* Length of ID string, excluding terminating zero. */
|
||||
#define GRUB_LVM_ID_STRLEN 38
|
||||
|
||||
struct grub_lvm_vg {
|
||||
char id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *name;
|
||||
int extent_size;
|
||||
struct grub_lvm_pv *pvs;
|
||||
struct grub_lvm_lv *lvs;
|
||||
struct grub_lvm_vg *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_pv {
|
||||
char id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *name;
|
||||
grub_disk_t disk;
|
||||
int start; /* Sector number where the data area starts. */
|
||||
struct grub_lvm_pv *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_lv {
|
||||
char *name;
|
||||
char *fullname;
|
||||
char *compatname;
|
||||
unsigned int number;
|
||||
unsigned int segment_count;
|
||||
grub_uint64_t size;
|
||||
|
||||
int visible;
|
||||
|
||||
struct grub_lvm_segment *segments; /* Pointer to segment_count segments. */
|
||||
struct grub_lvm_vg *vg;
|
||||
struct grub_lvm_lv *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_segment {
|
||||
unsigned int start_extent;
|
||||
unsigned int extent_count;
|
||||
enum { GRUB_LVM_STRIPED, GRUB_LVM_MIRROR } type;
|
||||
|
||||
unsigned int node_count;
|
||||
struct grub_lvm_node *nodes;
|
||||
|
||||
unsigned int stripe_size;
|
||||
};
|
||||
|
||||
struct grub_lvm_node {
|
||||
grub_disk_addr_t start;
|
||||
char *name;
|
||||
struct grub_lvm_pv *pv;
|
||||
struct grub_lvm_lv *lv;
|
||||
};
|
||||
|
||||
#define GRUB_LVM_LABEL_SIZE GRUB_DISK_SECTOR_SIZE
|
||||
#define GRUB_LVM_LABEL_SCAN_SECTORS 4L
|
||||
|
||||
|
|
|
@ -21,10 +21,4 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
#ifndef GRUB_EC_MACHINE_HEADER
|
||||
#define GRUB_EC_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/pci.h>
|
||||
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
|
||||
#define GRUB_MACHINE_EC_DATA_PORT 0x383
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine) __attribute__ ((section(".text")));
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize) __attribute__ ((section(".text")));
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize) __attribute__ ((section(".text")));
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/time.h>
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock) __attribute__ ((section(".text")));
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_TIME_HEADER */
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
extern grub_uint32_t grub_arch_memsize;
|
||||
extern grub_uint32_t grub_arch_memsize __attribute__ ((section(".text")));
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock) __attribute__ ((section(".text")));
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -49,14 +49,19 @@
|
|||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||
|
||||
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
|
||||
|
||||
void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
|
||||
char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
|
||||
char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
|
||||
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
static inline void *
|
||||
grub_memcpy (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
return grub_memmove (dest, src, n);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
|
@ -82,7 +87,7 @@ grub_strncat (char *dest, const char *src, int c)
|
|||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
while (c-- && (*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
|
@ -108,7 +113,53 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
|
|||
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
|
||||
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
|
||||
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
|
||||
char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
static inline char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
|
||||
|
@ -124,6 +175,18 @@ grub_isalpha (int c)
|
|||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_islower (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isupper (int c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
|
@ -136,6 +199,12 @@ grub_isdigit (int c)
|
|||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isxdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isalnum (int c)
|
||||
{
|
||||
|
@ -193,27 +262,6 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
grub_size_t grub_strlen (const char *s);
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
|
||||
|
@ -260,6 +308,26 @@ grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused
|
|||
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
|
||||
|
||||
static inline int
|
||||
|
@ -302,6 +370,20 @@ void EXPORT_FUNC (__deregister_frame_info) (void);
|
|||
|
||||
/* Inline functions. */
|
||||
|
||||
static inline char *
|
||||
grub_memchr (const void *p, int c, grub_size_t len)
|
||||
{
|
||||
const char *s = p;
|
||||
const char *e = s + len;
|
||||
|
||||
for (; s < e; s++)
|
||||
if (*s == c)
|
||||
return (char *) s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline unsigned int
|
||||
grub_abs (int x)
|
||||
{
|
||||
|
@ -311,24 +393,6 @@ grub_abs (int x)
|
|||
return (unsigned int) x;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_min (long x, long y)
|
||||
{
|
||||
if (x < y)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_max (long x, long y)
|
||||
{
|
||||
if (x > y)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
/* Rounded-up division */
|
||||
static inline unsigned int
|
||||
grub_div_roundup (unsigned int x, unsigned int y)
|
||||
|
@ -337,12 +401,18 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
|||
}
|
||||
|
||||
/* Reboot the machine. */
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS)
|
||||
void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_reboot (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||
* use APM even if it is available. */
|
||||
void grub_halt (int no_apm) __attribute__ ((noreturn));
|
||||
#elif defined (__mips__)
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_halt (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
|
|
@ -72,4 +72,21 @@ void *EXPORT_FUNC(grub_debug_memalign) (const char *file, int line,
|
|||
grub_size_t align, grub_size_t size);
|
||||
#endif /* MM_DEBUG && ! GRUB_UTIL */
|
||||
|
||||
#include <grub/err.h>
|
||||
|
||||
static inline grub_err_t
|
||||
grub_extend_alloc (grub_size_t sz, grub_size_t *allocated, void **ptr)
|
||||
{
|
||||
void *n;
|
||||
if (sz < *allocated)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
*allocated = 2 * sz;
|
||||
n = grub_realloc (*ptr, *allocated);
|
||||
if (!n)
|
||||
return grub_errno;
|
||||
*ptr = n;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_MM_H */
|
||||
|
|
|
@ -42,9 +42,11 @@
|
|||
#define GRUB_PC_PARTITION_TYPE_FAT32_LBA 0xc
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
||||
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||
#define GRUB_PC_PARTITION_TYPE_PLAN9 0x39
|
||||
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
||||
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_SWAP 0x82
|
||||
#define GRUB_PC_PARTITION_TYPE_EXT2FS 0x83
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED 0x85
|
||||
#define GRUB_PC_PARTITION_TYPE_VSTAFS 0x9e
|
||||
|
|
|
@ -27,6 +27,19 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/net/netbuff.h>
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_NET_MAX_LINK_HEADER_SIZE = 64,
|
||||
GRUB_NET_UDP_HEADER_SIZE = 8,
|
||||
GRUB_NET_TCP_HEADER_SIZE = 20,
|
||||
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
|
||||
GRUB_NET_OUR_IPV6_HEADER_SIZE = 40,
|
||||
GRUB_NET_OUR_MAX_IP_HEADER_SIZE = 40,
|
||||
GRUB_NET_TCP_RESERVE_SIZE = GRUB_NET_TCP_HEADER_SIZE
|
||||
+ GRUB_NET_OUR_IPV4_HEADER_SIZE
|
||||
+ GRUB_NET_MAX_LINK_HEADER_SIZE
|
||||
};
|
||||
|
||||
typedef enum grub_link_level_protocol_id
|
||||
{
|
||||
GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
||||
|
@ -59,13 +72,13 @@ struct grub_net_card;
|
|||
struct grub_net_card_driver
|
||||
{
|
||||
struct grub_net_card_driver *next;
|
||||
char *name;
|
||||
struct grub_net_card_driver **prev;
|
||||
const char *name;
|
||||
grub_err_t (*open) (const struct grub_net_card *dev);
|
||||
void (*close) (const struct grub_net_card *dev);
|
||||
grub_err_t (*send) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
grub_ssize_t (*recv) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
struct grub_net_buff * (*recv) (const struct grub_net_card *dev);
|
||||
};
|
||||
|
||||
typedef struct grub_net_packet
|
||||
|
@ -86,10 +99,22 @@ typedef struct grub_net_packets
|
|||
#include <grub/efi/api.h>
|
||||
#endif
|
||||
|
||||
struct grub_net_slaac_mac_list
|
||||
{
|
||||
struct grub_net_slaac_mac_list *next;
|
||||
struct grub_net_slaac_mac_list **prev;
|
||||
grub_net_link_level_address_t address;
|
||||
int slaac_counter;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct grub_net_link_layer_entry;
|
||||
|
||||
struct grub_net_card
|
||||
{
|
||||
struct grub_net_card *next;
|
||||
char *name;
|
||||
struct grub_net_card **prev;
|
||||
const char *name;
|
||||
struct grub_net_card_driver *driver;
|
||||
grub_net_link_level_address_t default_address;
|
||||
grub_net_card_flags_t flags;
|
||||
|
@ -97,6 +122,10 @@ struct grub_net_card
|
|||
int opened;
|
||||
unsigned idle_poll_delay_ms;
|
||||
grub_uint64_t last_poll;
|
||||
grub_size_t mtu;
|
||||
struct grub_net_slaac_mac_list *slaac_list;
|
||||
grub_ssize_t new_ll_entry;
|
||||
struct grub_net_link_layer_entry *link_layer_table;
|
||||
union
|
||||
{
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
|
@ -116,7 +145,8 @@ struct grub_net_network_level_interface;
|
|||
typedef enum grub_network_level_protocol_id
|
||||
{
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6
|
||||
} grub_network_level_protocol_id_t;
|
||||
|
||||
typedef struct grub_net_network_level_address
|
||||
|
@ -125,6 +155,7 @@ typedef struct grub_net_network_level_address
|
|||
union
|
||||
{
|
||||
grub_uint32_t ipv4;
|
||||
grub_uint64_t ipv6[2];
|
||||
};
|
||||
} grub_net_network_level_address_t;
|
||||
|
||||
|
@ -137,6 +168,10 @@ typedef struct grub_net_network_level_netaddress
|
|||
grub_uint32_t base;
|
||||
int masksize;
|
||||
} ipv4;
|
||||
struct {
|
||||
grub_uint64_t base[2];
|
||||
int masksize;
|
||||
} ipv6;
|
||||
};
|
||||
} grub_net_network_level_netaddress_t;
|
||||
|
||||
|
@ -188,48 +223,16 @@ typedef struct grub_net_socket *grub_net_socket_t;
|
|||
struct grub_net_app_protocol
|
||||
{
|
||||
struct grub_net_app_protocol *next;
|
||||
char *name;
|
||||
struct grub_net_app_protocol **prev;
|
||||
const char *name;
|
||||
grub_err_t (*dir) (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
const struct grub_dirhook_info *info));
|
||||
grub_err_t (*open) (struct grub_file *file, const char *filename);
|
||||
grub_err_t (*seek) (struct grub_file *file, grub_off_t off);
|
||||
grub_err_t (*close) (struct grub_file *file);
|
||||
};
|
||||
|
||||
struct grub_net_socket
|
||||
{
|
||||
struct grub_net_socket *next;
|
||||
|
||||
enum { GRUB_NET_SOCKET_START,
|
||||
GRUB_NET_SOCKET_ESTABLISHED,
|
||||
GRUB_NET_SOCKET_CLOSED } x_status;
|
||||
int x_in_port;
|
||||
int x_out_port;
|
||||
grub_err_t (*recv_hook) (grub_net_socket_t sock, struct grub_net_buff *nb,
|
||||
void *recv);
|
||||
void *recv_hook_data;
|
||||
grub_net_network_level_address_t x_out_nla;
|
||||
struct grub_net_network_level_interface *x_inf;
|
||||
};
|
||||
|
||||
extern struct grub_net_socket *grub_net_sockets;
|
||||
|
||||
static inline void
|
||||
grub_net_socket_register (grub_net_socket_t sock)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_net_sockets),
|
||||
GRUB_AS_LIST (sock));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_net_socket_unregister (grub_net_socket_t sock)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_net_sockets),
|
||||
GRUB_AS_LIST (sock));
|
||||
}
|
||||
|
||||
#define FOR_NET_SOCKETS(var) for (var = grub_net_sockets; var; var = var->next)
|
||||
|
||||
typedef struct grub_net
|
||||
{
|
||||
char *server;
|
||||
|
@ -297,11 +300,12 @@ grub_net_session_recv (struct grub_net_session *session, void *buf,
|
|||
struct grub_net_network_level_interface *
|
||||
grub_net_add_addr (const char *name,
|
||||
struct grub_net_card *card,
|
||||
grub_net_network_level_address_t addr,
|
||||
grub_net_link_level_address_t hwaddress,
|
||||
const grub_net_network_level_address_t *addr,
|
||||
const grub_net_link_level_address_t *hwaddress,
|
||||
grub_net_interface_flags_t flags);
|
||||
|
||||
extern struct grub_net_network_level_interface *grub_net_network_level_interfaces;
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
|
||||
|
||||
extern grub_net_app_level_t grub_net_app_level_list;
|
||||
|
||||
|
@ -317,8 +321,7 @@ grub_net_app_level_register (grub_net_app_level_t proto)
|
|||
static inline void
|
||||
grub_net_app_level_unregister (grub_net_app_level_t proto)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_net_app_level_list),
|
||||
GRUB_AS_LIST (proto));
|
||||
grub_list_remove (GRUB_AS_LIST (proto));
|
||||
}
|
||||
|
||||
#define FOR_NET_APP_LEVEL(var) FOR_LIST_ELEMENTS((var), \
|
||||
|
@ -337,7 +340,7 @@ void
|
|||
grub_net_card_unregister (struct grub_net_card *card);
|
||||
|
||||
#define FOR_NET_CARDS(var) for (var = grub_net_cards; var; var = var->next)
|
||||
#define FOR_NET_CARDS_SAFE(var, next) for (var = grub_net_cards, next = var->next; var; var = next, next = var->next)
|
||||
#define FOR_NET_CARDS_SAFE(var, next) for (var = grub_net_cards, next = (var ? var->next : 0); var; var = next, next = (var ? var->next : 0))
|
||||
|
||||
|
||||
struct grub_net_session *
|
||||
|
@ -396,6 +399,18 @@ struct grub_net_bootp_packet
|
|||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
|
||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_3 0x63
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_NET_BOOTP_PAD = 0x00,
|
||||
GRUB_NET_BOOTP_ROUTER = 0x03,
|
||||
GRUB_NET_BOOTP_DNS = 0x06,
|
||||
GRUB_NET_BOOTP_HOSTNAME = 0x0c,
|
||||
GRUB_NET_BOOTP_DOMAIN = 0x0f,
|
||||
GRUB_NET_BOOTP_ROOT_PATH = 0x11,
|
||||
GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
|
||||
GRUB_NET_BOOTP_END = 0xff
|
||||
};
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_configure_by_dhcp_ack (const char *name,
|
||||
struct grub_net_card *card,
|
||||
|
@ -411,22 +426,35 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
|
|||
int
|
||||
grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||
const grub_net_link_level_address_t *b);
|
||||
int
|
||||
grub_net_addr_cmp (const grub_net_network_level_address_t *a,
|
||||
const grub_net_network_level_address_t *b);
|
||||
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
Currently supported adresses:
|
||||
IPv4: XXX.XXX.XXX.XXX
|
||||
IPv6: XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
|
||||
*/
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXX.XXX.XXX.XXX")
|
||||
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
ethernet: XX:XX:XX:XX:XX:XX
|
||||
*/
|
||||
|
||||
#define GRUB_NET_MAX_STR_HWADDR_LEN (sizeof ("XX:XX:XX:XX:XX:XX"))
|
||||
|
||||
void
|
||||
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
|
||||
char *buf);
|
||||
void
|
||||
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str);
|
||||
|
||||
extern struct grub_net_network_level_interface *grub_net_network_level_interfaces;
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES(var) for (var = grub_net_network_level_interfaces; var; var = var->next)
|
||||
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE(var,next) for (var = grub_net_network_level_interfaces, next = var->next; var; var = next, next = var->next)
|
||||
#define FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE(var,next) for (var = grub_net_network_level_interfaces, next = (var ? var->next : 0); var; var = next, next = (var ? var->next : 0))
|
||||
|
||||
void
|
||||
grub_net_poll_cards (unsigned time);
|
||||
|
@ -434,6 +462,9 @@ grub_net_poll_cards (unsigned time);
|
|||
void grub_bootp_init (void);
|
||||
void grub_bootp_fini (void);
|
||||
|
||||
void grub_dns_init (void);
|
||||
void grub_dns_fini (void);
|
||||
|
||||
static inline void
|
||||
grub_net_network_level_interface_unregister (struct grub_net_network_level_interface *inter)
|
||||
{
|
||||
|
@ -445,6 +476,37 @@ grub_net_network_level_interface_unregister (struct grub_net_network_level_inter
|
|||
inter->prev = 0;
|
||||
}
|
||||
|
||||
void
|
||||
grub_net_tcp_retransmit (void);
|
||||
|
||||
void
|
||||
grub_net_link_layer_add_address (struct grub_net_card *card,
|
||||
const grub_net_network_level_address_t *nl,
|
||||
const grub_net_link_level_address_t *ll,
|
||||
int override);
|
||||
int
|
||||
grub_net_link_layer_resolve_check (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
grub_err_t
|
||||
grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr,
|
||||
grub_net_link_level_address_t *hw_addr);
|
||||
grub_err_t
|
||||
grub_net_dns_lookup (const char *name,
|
||||
const struct grub_net_network_level_address *servers,
|
||||
grub_size_t n_servers,
|
||||
grub_size_t *naddresses,
|
||||
struct grub_net_network_level_address **addresses,
|
||||
int cache);
|
||||
grub_err_t
|
||||
grub_net_add_dns_server (const struct grub_net_network_level_address *s);
|
||||
void
|
||||
grub_net_remove_dns_server (const struct grub_net_network_level_address *s);
|
||||
|
||||
|
||||
extern char *grub_net_default_server;
|
||||
|
||||
#define GRUB_NET_TRIES 40
|
||||
#define GRUB_NET_INTERVAL 400
|
||||
|
||||
#endif /* ! GRUB_NET_HEADER */
|
||||
|
|
|
@ -1,36 +1,31 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_NET_ARP_HEADER
|
||||
#define GRUB_NET_ARP_HEADER 1
|
||||
#include <grub/misc.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
enum
|
||||
{
|
||||
/* IANA ARP constant to define hardware type as ethernet. */
|
||||
GRUB_NET_ARPHRD_ETHERNET = 1
|
||||
};
|
||||
extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card);
|
||||
|
||||
/* ARP header operation codes */
|
||||
#define ARP_REQUEST 1
|
||||
#define ARP_REPLY 2
|
||||
|
||||
struct arp_entry {
|
||||
int avail;
|
||||
grub_net_network_level_address_t nl_address;
|
||||
grub_net_link_level_address_t ll_address;
|
||||
};
|
||||
|
||||
struct arphdr {
|
||||
grub_uint16_t hrd;
|
||||
grub_uint16_t pro;
|
||||
grub_uint8_t hln;
|
||||
grub_uint8_t pln;
|
||||
grub_uint16_t op;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
extern grub_err_t grub_net_arp_receive(struct grub_net_buff *nb);
|
||||
|
||||
extern grub_err_t grub_net_arp_resolve(struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *addr,
|
||||
grub_net_link_level_address_t *hw_addr);
|
||||
grub_err_t
|
||||
grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,19 +22,20 @@
|
|||
#include <grub/net.h>
|
||||
|
||||
/* IANA Ethertype */
|
||||
enum
|
||||
{
|
||||
GRUB_NET_ETHERTYPE_IP = 0x0800,
|
||||
GRUB_NET_ETHERTYPE_ARP = 0x0806
|
||||
};
|
||||
typedef enum
|
||||
{
|
||||
GRUB_NET_ETHERTYPE_IP = 0x0800,
|
||||
GRUB_NET_ETHERTYPE_ARP = 0x0806,
|
||||
GRUB_NET_ETHERTYPE_IP6 = 0x86DD,
|
||||
} grub_net_ethertype_t;
|
||||
|
||||
grub_err_t
|
||||
send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
struct grub_net_buff *nb,
|
||||
grub_net_link_level_address_t target_addr,
|
||||
grub_uint16_t ethertype);
|
||||
grub_net_ethertype_t ethertype);
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card);
|
||||
struct grub_net_card *card);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,22 +21,75 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
enum
|
||||
typedef enum grub_net_ip_protocol
|
||||
{
|
||||
IP_UDP = 0x11 /* UDP protocol */
|
||||
};
|
||||
#define IP_BROADCAST 0xFFFFFFFF
|
||||
GRUB_NET_IP_ICMP = 1,
|
||||
GRUB_NET_IP_TCP = 6,
|
||||
GRUB_NET_IP_UDP = 17,
|
||||
GRUB_NET_IP_ICMPV6 = 58
|
||||
} grub_net_ip_protocol_t;
|
||||
#define GRUB_NET_IP_BROADCAST 0xFFFFFFFF
|
||||
|
||||
grub_uint16_t grub_net_ip_chksum(void *ipv, int len);
|
||||
static inline grub_uint64_t
|
||||
grub_net_ipv6_get_id (const grub_net_link_level_address_t *addr)
|
||||
{
|
||||
return grub_cpu_to_be64 (((grub_uint64_t) (addr->mac[0] ^ 2) << 56)
|
||||
| ((grub_uint64_t) addr->mac[1] << 48)
|
||||
| ((grub_uint64_t) addr->mac[2] << 40)
|
||||
| 0xfffe000000ULL
|
||||
| ((grub_uint64_t) addr->mac[3] << 16)
|
||||
| ((grub_uint64_t) addr->mac[4] << 8)
|
||||
| ((grub_uint64_t) addr->mac[5]));
|
||||
}
|
||||
|
||||
grub_uint16_t grub_net_ip_chksum(void *ipv, grub_size_t len);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip_packets (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress);
|
||||
struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress,
|
||||
const grub_net_link_level_address_t *src_hwaddress);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *target,
|
||||
struct grub_net_buff *nb);
|
||||
const grub_net_link_level_address_t *ll_target_addr,
|
||||
struct grub_net_buff *nb,
|
||||
grub_net_ip_protocol_t proto);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_icmp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_link_level_address_t *ll_src,
|
||||
const grub_net_network_level_address_t *src);
|
||||
grub_err_t
|
||||
grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_link_level_address_t *ll_src,
|
||||
const grub_net_network_level_address_t *source,
|
||||
const grub_net_network_level_address_t *dest,
|
||||
grub_uint8_t ttl);
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *src);
|
||||
grub_err_t
|
||||
grub_net_recv_tcp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *source);
|
||||
|
||||
grub_uint16_t
|
||||
grub_net_ip_transport_checksum (struct grub_net_buff *nb,
|
||||
grub_uint16_t proto,
|
||||
const grub_net_network_level_address_t *src,
|
||||
const grub_net_network_level_address_t *dst);
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_ipv6_get_link_local (struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddr);
|
||||
grub_err_t
|
||||
grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *proto_addr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,23 +8,23 @@
|
|||
|
||||
struct grub_net_buff
|
||||
{
|
||||
/*Pointer to the start of the buffer*/
|
||||
char *head;
|
||||
/*Pointer to the data */
|
||||
char *data;
|
||||
/*Pointer to the tail */
|
||||
char *tail;
|
||||
/*Pointer to the end of the buffer*/
|
||||
char *end;
|
||||
/* Pointer to the start of the buffer. */
|
||||
grub_uint8_t *head;
|
||||
/* Pointer to the data. */
|
||||
grub_uint8_t *data;
|
||||
/* Pointer to the tail. */
|
||||
grub_uint8_t *tail;
|
||||
/* Pointer to the end of the buffer. */
|
||||
grub_uint8_t *end;
|
||||
};
|
||||
|
||||
grub_err_t grub_netbuff_put (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_unput (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_push (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff ,grub_size_t len);
|
||||
grub_err_t grub_netbuff_put (struct grub_net_buff *net_buff, grub_size_t len);
|
||||
grub_err_t grub_netbuff_unput (struct grub_net_buff *net_buff, grub_size_t len);
|
||||
grub_err_t grub_netbuff_push (struct grub_net_buff *net_buff, grub_size_t len);
|
||||
grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff, grub_size_t len);
|
||||
grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff, grub_size_t len);
|
||||
grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff);
|
||||
struct grub_net_buff * grub_netbuff_alloc ( grub_size_t len );
|
||||
struct grub_net_buff * grub_netbuff_alloc (grub_size_t len);
|
||||
grub_err_t grub_netbuff_free (struct grub_net_buff *net_buff);
|
||||
|
||||
#endif
|
||||
|
|
79
include/grub/net/tcp.h
Normal file
79
include/grub/net/tcp.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_NET_TCP_HEADER
|
||||
#define GRUB_NET_TCP_HEADER 1
|
||||
#include <grub/types.h>
|
||||
#include <grub/net.h>
|
||||
|
||||
struct grub_net_tcp_socket;
|
||||
typedef struct grub_net_tcp_socket *grub_net_tcp_socket_t;
|
||||
|
||||
struct grub_net_tcp_listen;
|
||||
typedef struct grub_net_tcp_listen *grub_net_tcp_listen_t;
|
||||
|
||||
grub_net_tcp_socket_t
|
||||
grub_net_tcp_open (char *server,
|
||||
grub_uint16_t out_port,
|
||||
grub_err_t (*recv_hook) (grub_net_tcp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void (*error_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void (*fin_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
grub_net_tcp_listen_t
|
||||
grub_net_tcp_listen (grub_uint16_t port,
|
||||
const struct grub_net_network_level_interface *inf,
|
||||
grub_err_t (*listen_hook) (grub_net_tcp_listen_t listen,
|
||||
grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
void
|
||||
grub_net_tcp_stop_listen (grub_net_tcp_listen_t listen);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_tcp_packet (const grub_net_tcp_socket_t socket,
|
||||
struct grub_net_buff *nb,
|
||||
int push);
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_NET_TCP_CONTINUE_RECEIVING,
|
||||
GRUB_NET_TCP_DISCARD,
|
||||
GRUB_NET_TCP_ABORT
|
||||
};
|
||||
|
||||
void
|
||||
grub_net_tcp_close (grub_net_tcp_socket_t sock, int discard_received);
|
||||
|
||||
grub_err_t
|
||||
grub_net_tcp_accept (grub_net_tcp_socket_t sock,
|
||||
grub_err_t (*recv_hook) (grub_net_tcp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void (*error_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void (*fin_hook) (grub_net_tcp_socket_t sock,
|
||||
void *data),
|
||||
void *hook_data);
|
||||
|
||||
#endif
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_NET_UDP_HEADER
|
||||
#define GRUB_NET_UDP_HEADER 1
|
||||
#include <grub/types.h>
|
||||
|
@ -11,28 +29,23 @@ struct udphdr
|
|||
grub_uint16_t chksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_net_udp_socket;
|
||||
typedef struct grub_net_udp_socket *grub_net_udp_socket_t;
|
||||
|
||||
grub_net_socket_t
|
||||
grub_net_udp_open (char *server,
|
||||
grub_net_udp_socket_t
|
||||
grub_net_udp_open (grub_net_network_level_address_t addr,
|
||||
grub_uint16_t out_port,
|
||||
grub_err_t (*recv_hook) (grub_net_socket_t sock,
|
||||
grub_err_t (*recv_hook) (grub_net_udp_socket_t sock,
|
||||
struct grub_net_buff *nb,
|
||||
void *data),
|
||||
void *recv_hook_data);
|
||||
|
||||
static inline void
|
||||
grub_net_udp_close (grub_net_socket_t sock)
|
||||
{
|
||||
grub_net_socket_unregister (sock);
|
||||
grub_free (sock);
|
||||
}
|
||||
void
|
||||
grub_net_udp_close (grub_net_udp_socket_t sock);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_udp_packet (const grub_net_socket_t socket, struct grub_net_buff *nb);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf);
|
||||
grub_net_send_udp_packet (const grub_net_udp_socket_t socket,
|
||||
struct grub_net_buff *nb);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/file.h>
|
||||
|
||||
/* The maximum size of a command-line. */
|
||||
#define GRUB_MAX_CMDLINE 1600
|
||||
|
||||
/* The standard left and right margin for some messages. */
|
||||
#define STANDARD_MARGIN 6
|
||||
|
||||
|
|
|
@ -20,79 +20,87 @@
|
|||
#ifndef GRUB_NTFS_H
|
||||
#define GRUB_NTFS_H 1
|
||||
|
||||
#define FILE_MFT 0
|
||||
#define FILE_MFTMIRR 1
|
||||
#define FILE_LOGFILE 2
|
||||
#define FILE_VOLUME 3
|
||||
#define FILE_ATTRDEF 4
|
||||
#define FILE_ROOT 5
|
||||
#define FILE_BITMAP 6
|
||||
#define FILE_BOOT 7
|
||||
#define FILE_BADCLUS 8
|
||||
#define FILE_QUOTA 9
|
||||
#define FILE_UPCASE 10
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_FILE_MFT = 0,
|
||||
GRUB_NTFS_FILE_MFTMIRR = 1,
|
||||
GRUB_NTFS_FILE_LOGFILE = 2,
|
||||
GRUB_NTFS_FILE_VOLUME = 3,
|
||||
GRUB_NTFS_FILE_ATTRDEF = 4,
|
||||
GRUB_NTFS_FILE_ROOT = 5,
|
||||
GRUB_NTFS_FILE_BITMAP = 6,
|
||||
GRUB_NTFS_FILE_BOOT = 7,
|
||||
GRUB_NTFS_FILE_BADCLUS = 8,
|
||||
GRUB_NTFS_FILE_QUOTA = 9,
|
||||
GRUB_NTFS_FILE_UPCASE = 10,
|
||||
};
|
||||
|
||||
#define AT_STANDARD_INFORMATION 0x10
|
||||
#define AT_ATTRIBUTE_LIST 0x20
|
||||
#define AT_FILENAME 0x30
|
||||
#define AT_OBJECT_ID 0x40
|
||||
#define AT_SECURITY_DESCRIPTOR 0x50
|
||||
#define AT_VOLUME_NAME 0x60
|
||||
#define AT_VOLUME_INFORMATION 0x70
|
||||
#define AT_DATA 0x80
|
||||
#define AT_INDEX_ROOT 0x90
|
||||
#define AT_INDEX_ALLOCATION 0xA0
|
||||
#define AT_BITMAP 0xB0
|
||||
#define AT_SYMLINK 0xC0
|
||||
#define AT_EA_INFORMATION 0xD0
|
||||
#define AT_EA 0xE0
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_AT_STANDARD_INFORMATION = 0x10,
|
||||
GRUB_NTFS_AT_ATTRIBUTE_LIST = 0x20,
|
||||
GRUB_NTFS_AT_FILENAME = 0x30,
|
||||
GRUB_NTFS_AT_OBJECT_ID = 0x40,
|
||||
GRUB_NTFS_AT_SECURITY_DESCRIPTOR = 0x50,
|
||||
GRUB_NTFS_AT_VOLUME_NAME = 0x60,
|
||||
GRUB_NTFS_AT_VOLUME_INFORMATION = 0x70,
|
||||
GRUB_NTFS_AT_DATA = 0x80,
|
||||
GRUB_NTFS_AT_INDEX_ROOT = 0x90,
|
||||
GRUB_NTFS_AT_INDEX_ALLOCATION = 0xA0,
|
||||
GRUB_NTFS_AT_BITMAP = 0xB0,
|
||||
GRUB_NTFS_AT_SYMLINK = 0xC0,
|
||||
GRUB_NTFS_AT_EA_INFORMATION = 0xD0,
|
||||
GRUB_NTFS_AT_EA = 0xE0,
|
||||
};
|
||||
|
||||
#define ATTR_READ_ONLY 0x1
|
||||
#define ATTR_HIDDEN 0x2
|
||||
#define ATTR_SYSTEM 0x4
|
||||
#define ATTR_ARCHIVE 0x20
|
||||
#define ATTR_DEVICE 0x40
|
||||
#define ATTR_NORMAL 0x80
|
||||
#define ATTR_TEMPORARY 0x100
|
||||
#define ATTR_SPARSE 0x200
|
||||
#define ATTR_REPARSE 0x400
|
||||
#define ATTR_COMPRESSED 0x800
|
||||
#define ATTR_OFFLINE 0x1000
|
||||
#define ATTR_NOT_INDEXED 0x2000
|
||||
#define ATTR_ENCRYPTED 0x4000
|
||||
#define ATTR_DIRECTORY 0x10000000
|
||||
#define ATTR_INDEX_VIEW 0x20000000
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_ATTR_READ_ONLY = 0x1,
|
||||
GRUB_NTFS_ATTR_HIDDEN = 0x2,
|
||||
GRUB_NTFS_ATTR_SYSTEM = 0x4,
|
||||
GRUB_NTFS_ATTR_ARCHIVE = 0x20,
|
||||
GRUB_NTFS_ATTR_DEVICE = 0x40,
|
||||
GRUB_NTFS_ATTR_NORMAL = 0x80,
|
||||
GRUB_NTFS_ATTR_TEMPORARY = 0x100,
|
||||
GRUB_NTFS_ATTR_SPARSE = 0x200,
|
||||
GRUB_NTFS_ATTR_REPARSE = 0x400,
|
||||
GRUB_NTFS_ATTR_COMPRESSED = 0x800,
|
||||
GRUB_NTFS_ATTR_OFFLINE = 0x1000,
|
||||
GRUB_NTFS_ATTR_NOT_INDEXED = 0x2000,
|
||||
GRUB_NTFS_ATTR_ENCRYPTED = 0x4000,
|
||||
GRUB_NTFS_ATTR_DIRECTORY = 0x10000000,
|
||||
GRUB_NTFS_ATTR_INDEX_VIEW = 0x20000000
|
||||
};
|
||||
|
||||
#define FLAG_COMPRESSED 1
|
||||
#define FLAG_ENCRYPTED 0x4000
|
||||
#define FLAG_SPARSE 0x8000
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_FLAG_COMPRESSED = 1,
|
||||
GRUB_NTFS_FLAG_ENCRYPTED = 0x4000,
|
||||
GRUB_NTFS_FLAG_SPARSE = 0x8000
|
||||
};
|
||||
|
||||
#define BLK_SHR GRUB_DISK_SECTOR_BITS
|
||||
#define GRUB_NTFS_BLK_SHR GRUB_DISK_SECTOR_BITS
|
||||
|
||||
#define MAX_MFT (1024 >> BLK_SHR)
|
||||
#define MAX_IDX (16384 >> BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_MFT (4096 >> GRUB_NTFS_BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_IDX (16384 >> GRUB_NTFS_BLK_SHR)
|
||||
|
||||
#define COM_LEN 4096
|
||||
#define COM_LOG_LEN 12
|
||||
#define COM_SEC (COM_LEN >> BLK_SHR)
|
||||
#define GRUB_NTFS_COM_LEN 4096
|
||||
#define GRUB_NTFS_COM_LOG_LEN 12
|
||||
#define GRUB_NTFS_COM_SEC (GRUB_NTFS_COM_LEN >> GRUB_NTFS_BLK_SHR)
|
||||
|
||||
#define AF_ALST 1
|
||||
#define AF_MMFT 2
|
||||
#define AF_GPOS 4
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_AF_ALST = 1,
|
||||
GRUB_NTFS_AF_MMFT = 2,
|
||||
GRUB_NTFS_AF_GPOS = 4,
|
||||
};
|
||||
|
||||
#define RF_COMP 1
|
||||
#define RF_CBLK 2
|
||||
#define RF_BLNK 4
|
||||
|
||||
#define valueat(buf,ofs,type) *((type*)(((char*)buf)+ofs))
|
||||
|
||||
#define u16at(buf,ofs) grub_le_to_cpu16(valueat(buf,ofs,grub_uint16_t))
|
||||
#define u32at(buf,ofs) grub_le_to_cpu32(valueat(buf,ofs,grub_uint32_t))
|
||||
#define u64at(buf,ofs) grub_le_to_cpu64(valueat(buf,ofs,grub_uint64_t))
|
||||
|
||||
#define v16at(buf,ofs) valueat(buf,ofs,grub_uint16_t)
|
||||
#define v32at(buf,ofs) valueat(buf,ofs,grub_uint32_t)
|
||||
#define v64at(buf,ofs) valueat(buf,ofs,grub_uint64_t)
|
||||
enum
|
||||
{
|
||||
GRUB_NTFS_RF_COMP = 1,
|
||||
GRUB_NTFS_RF_CBLK = 2,
|
||||
GRUB_NTFS_RF_BLNK = 4
|
||||
};
|
||||
|
||||
struct grub_ntfs_bpb
|
||||
{
|
||||
|
@ -120,8 +128,6 @@ struct grub_ntfs_bpb
|
|||
grub_uint32_t checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define grub_ntfs_file grub_fshelp_node
|
||||
|
||||
struct grub_ntfs_attr
|
||||
{
|
||||
int flags;
|
||||
|
@ -132,7 +138,7 @@ struct grub_ntfs_attr
|
|||
struct grub_ntfs_file *mft;
|
||||
};
|
||||
|
||||
struct grub_fshelp_node
|
||||
struct grub_ntfs_file
|
||||
{
|
||||
struct grub_ntfs_data *data;
|
||||
char *buf;
|
||||
|
@ -151,7 +157,6 @@ struct grub_ntfs_data
|
|||
grub_uint32_t mft_size;
|
||||
grub_uint32_t idx_size;
|
||||
grub_uint32_t spc;
|
||||
grub_uint32_t blocksize;
|
||||
grub_uint32_t mft_start;
|
||||
grub_uint64_t uuid;
|
||||
};
|
||||
|
@ -174,13 +179,15 @@ struct grub_ntfs_rlst
|
|||
struct grub_ntfs_comp comp;
|
||||
};
|
||||
|
||||
typedef grub_err_t (*ntfscomp_func_t) (struct grub_ntfs_attr * at, char *dest,
|
||||
grub_uint32_t ofs, grub_uint32_t len,
|
||||
struct grub_ntfs_rlst * ctx,
|
||||
grub_uint32_t vcn);
|
||||
typedef grub_err_t (*grub_ntfscomp_func_t) (struct grub_ntfs_attr * at,
|
||||
char *dest,
|
||||
grub_uint32_t ofs,
|
||||
grub_uint32_t len,
|
||||
struct grub_ntfs_rlst * ctx,
|
||||
grub_uint32_t vcn);
|
||||
|
||||
extern ntfscomp_func_t EXPORT_VAR (grub_ntfscomp_func);
|
||||
extern grub_ntfscomp_func_t grub_ntfscomp_func;
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_ntfs_read_run_list) (struct grub_ntfs_rlst *ctx);
|
||||
grub_err_t grub_ntfs_read_run_list (struct grub_ntfs_rlst *ctx);
|
||||
|
||||
#endif /* ! GRUB_NTFS_H */
|
||||
|
|
|
@ -19,39 +19,26 @@
|
|||
#ifndef OFFSETS_HEADER
|
||||
#define OFFSETS_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE 0x08
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
|
||||
|
||||
/* Offset of reed_solomon_redundancy. */
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x10
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xcd0
|
||||
/* Offset of field holding no reed solomon length. */
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH 0x14
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE 0x18
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX_END (GRUB_KERNEL_I386_PC_PREFIX + 0x40)
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
|
||||
|
@ -63,40 +50,16 @@
|
|||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END 0x114
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END 0x44
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
|
@ -104,62 +67,31 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX_END 0x50
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX 0x50
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_IA64_EFI_PREFIX_END 0xa0
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
|
||||
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END GRUB_KERNEL_I386_COREBOOT_PREFIX_END
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX_END 0x42
|
||||
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
@ -189,19 +121,14 @@
|
|||
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
|
||||
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
|
||||
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
|
||||
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
|
||||
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
|
|
@ -38,6 +38,7 @@ struct grub_partition_map
|
|||
{
|
||||
/* The next partition map type. */
|
||||
struct grub_partition_map *next;
|
||||
struct grub_partition_map **prev;
|
||||
|
||||
/* The name of the partition map type. */
|
||||
const char *name;
|
||||
|
@ -106,8 +107,7 @@ grub_partition_map_register (grub_partition_map_t partmap)
|
|||
static inline void
|
||||
grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_partition_map_list),
|
||||
GRUB_AS_LIST (partmap));
|
||||
grub_list_remove (GRUB_AS_LIST (partmap));
|
||||
}
|
||||
|
||||
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
struct grub_parttool_argdesc
|
||||
{
|
||||
char *name;
|
||||
char *desc;
|
||||
const char *name;
|
||||
const char *desc;
|
||||
enum {GRUB_PARTTOOL_ARG_END, GRUB_PARTTOOL_ARG_BOOL, GRUB_PARTTOOL_ARG_VAL}
|
||||
type;
|
||||
};
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BIOSDISK_MACHINE_HEADER
|
||||
#define GRUB_BIOSDISK_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_BIOSDISK_FLAG_LBA 1
|
||||
|
||||
struct grub_biosdisk_data
|
||||
{
|
||||
int drive;
|
||||
unsigned long cylinders;
|
||||
unsigned long heads;
|
||||
unsigned long sectors;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
|
||||
int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
|
||||
int soff, int nsec, int segment);
|
||||
int grub_biosdisk_check_int13_extensions (int drive);
|
||||
int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
|
||||
int grub_biosdisk_get_diskinfo_standard (int drive,
|
||||
unsigned long *cylinders,
|
||||
unsigned long *heads,
|
||||
unsigned long *sectors);
|
||||
int grub_biosdisk_get_num_floppies (void);
|
||||
|
||||
void grub_biosdisk_init (void);
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */
|
|
@ -1,27 +0,0 @@
|
|||
/* biosdisk.h - emulate biosdisk */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
|
||||
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
void grub_util_biosdisk_init (const char *dev_map);
|
||||
void grub_util_biosdisk_fini (void);
|
||||
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007,2008,2010 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,19 +16,21 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
#ifndef GRUB_PRIORITY_QUEUE_HEADER
|
||||
#define GRUB_PRIORITY_QUEUE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
struct grub_priority_queue;
|
||||
typedef struct grub_priority_queue *grub_priority_queue_t;
|
||||
typedef int (*grub_comparator_t) (const void *a, const void *b);
|
||||
|
||||
grub_priority_queue_t grub_priority_queue_new (grub_size_t elsize,
|
||||
grub_comparator_t cmp);
|
||||
void grub_priority_queue_destroy (grub_priority_queue_t pq);
|
||||
void *grub_priority_queue_top (grub_priority_queue_t pq);
|
||||
void grub_priority_queue_pop (grub_priority_queue_t pq);
|
||||
grub_err_t grub_priority_queue_push (grub_priority_queue_t pq, const void *el);
|
||||
|
||||
#ifndef ASM_FILE
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
|
@ -1,97 +0,0 @@
|
|||
/* raid.h - On disk structures for RAID. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007,2008,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_RAID_H
|
||||
#define GRUB_RAID_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC 0
|
||||
#define GRUB_RAID_LAYOUT_RIGHT_ASYMMETRIC 1
|
||||
#define GRUB_RAID_LAYOUT_LEFT_SYMMETRIC 2
|
||||
#define GRUB_RAID_LAYOUT_RIGHT_SYMMETRIC 3
|
||||
|
||||
#define GRUB_RAID_LAYOUT_RIGHT_MASK 1
|
||||
#define GRUB_RAID_LAYOUT_SYMMETRIC_MASK 2
|
||||
|
||||
struct grub_raid_member
|
||||
{
|
||||
grub_disk_t device; /* Array of total_devs devices. */
|
||||
grub_disk_addr_t start_sector;
|
||||
/* Start of each device, in 512 byte sectors. */
|
||||
};
|
||||
|
||||
struct grub_raid_array
|
||||
{
|
||||
int number; /* The device number, taken from md_minor so we
|
||||
are consistent with the device name in
|
||||
Linux. */
|
||||
int became_readable_at;
|
||||
int level; /* RAID levels, only 0, 1 or 5 at the moment. */
|
||||
int layout; /* Layout for RAID 5/6. */
|
||||
unsigned int total_devs; /* Total number of devices in the array. */
|
||||
grub_size_t chunk_size; /* The size of a chunk, in 512 byte sectors. */
|
||||
grub_uint64_t disk_size; /* Size of an individual disk, in 512 byte
|
||||
sectors. */
|
||||
unsigned int index; /* Index of current device. */
|
||||
int uuid_len; /* The length of uuid. */
|
||||
char *uuid; /* The UUID of the device. */
|
||||
|
||||
/* The following field is setup by the caller. */
|
||||
char *name; /* That will be "md<number>". */
|
||||
unsigned int nr_devs; /* The number of devices we've found so far. */
|
||||
unsigned int allocated_devs;
|
||||
struct grub_raid_member *members;
|
||||
struct grub_raid_array *next;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_raid *driver;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_raid
|
||||
{
|
||||
const char *name;
|
||||
|
||||
grub_err_t (*detect) (grub_disk_t disk, struct grub_raid_array *array,
|
||||
grub_disk_addr_t *start_sector);
|
||||
|
||||
struct grub_raid *next;
|
||||
};
|
||||
typedef struct grub_raid *grub_raid_t;
|
||||
|
||||
void grub_raid_register (grub_raid_t raid);
|
||||
void grub_raid_unregister (grub_raid_t raid);
|
||||
|
||||
void grub_raid_block_xor (char *buf1, const char *buf2, int size);
|
||||
|
||||
typedef grub_err_t (*grub_raid5_recover_func_t) (struct grub_raid_array *array,
|
||||
int disknr, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
typedef grub_err_t (*grub_raid6_recover_func_t) (struct grub_raid_array *array,
|
||||
int disknr, int p, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
extern grub_raid5_recover_func_t grub_raid5_recover_func;
|
||||
extern grub_raid6_recover_func_t grub_raid6_recover_func;
|
||||
|
||||
#endif /* ! GRUB_RAID_H */
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
typedef grub_err_t (*grub_reader_getline_t) (char **, int);
|
||||
|
||||
void grub_rescue_run (void);
|
||||
void grub_rescue_run (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_READER_HEADER */
|
||||
|
|
|
@ -245,8 +245,9 @@ void grub_script_mem_free (struct grub_script_mem *mem);
|
|||
void grub_script_argv_free (struct grub_script_argv *argv);
|
||||
int grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args);
|
||||
int grub_script_argv_next (struct grub_script_argv *argv);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s,
|
||||
grub_size_t slen);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, const char *s);
|
||||
|
||||
struct grub_script_arglist *
|
||||
grub_script_create_arglist (struct grub_parser_param *state);
|
||||
|
|
|
@ -69,7 +69,7 @@ struct grub_scsi_dev
|
|||
/* Write SIZE bytes from BUF to the device SCSI after sending the
|
||||
command CMD of size CMDSIZE. */
|
||||
grub_err_t (*write) (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||
grub_size_t size, char *buf);
|
||||
grub_size_t size, const char *buf);
|
||||
|
||||
/* The next scsi device. */
|
||||
struct grub_scsi_dev *next;
|
||||
|
@ -94,11 +94,11 @@ struct grub_scsi
|
|||
/* Set to 0 when not removable, 1 when removable. */
|
||||
int removable;
|
||||
|
||||
/* Size of the device in blocks. */
|
||||
int size;
|
||||
/* Size of the device in blocks - 1. */
|
||||
grub_uint64_t last_block;
|
||||
|
||||
/* Size of one block. */
|
||||
int blocksize;
|
||||
grub_uint32_t blocksize;
|
||||
|
||||
/* Device-specific data. */
|
||||
void *data;
|
||||
|
|
|
@ -85,7 +85,7 @@ struct grub_scsi_request_sense_data
|
|||
/* there can be additional sense field */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity
|
||||
struct grub_scsi_read_capacity10
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 reserved */
|
||||
|
@ -97,12 +97,29 @@ struct grub_scsi_read_capacity
|
|||
grub_uint16_t pad; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity_data
|
||||
struct grub_scsi_read_capacity10_data
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t last_block;
|
||||
grub_uint32_t blocksize;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity16
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 0x10 */
|
||||
grub_uint64_t logical_block_addr; /* only if PMI=1 */
|
||||
grub_uint32_t alloc_len;
|
||||
grub_uint8_t PMI;
|
||||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity16_data
|
||||
{
|
||||
grub_uint64_t last_block;
|
||||
grub_uint32_t blocksize;
|
||||
grub_uint8_t pad[20];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read10
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
|
@ -124,6 +141,16 @@ struct grub_scsi_read12
|
|||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read16
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint64_t lba;
|
||||
grub_uint32_t size;
|
||||
grub_uint8_t reserved;
|
||||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_write10
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
|
@ -145,14 +172,27 @@ struct grub_scsi_write12
|
|||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_write16
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint64_t lba;
|
||||
grub_uint32_t size;
|
||||
grub_uint8_t reserved;
|
||||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef enum
|
||||
{
|
||||
grub_scsi_cmd_test_unit_ready = 0x00,
|
||||
grub_scsi_cmd_request_sense = 0x03,
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_read_capacity = 0x25,
|
||||
grub_scsi_cmd_read_capacity10 = 0x25,
|
||||
grub_scsi_cmd_read10 = 0x28,
|
||||
grub_scsi_cmd_write10 = 0x2a,
|
||||
grub_scsi_cmd_read16 = 0x88,
|
||||
grub_scsi_cmd_write16 = 0x8a,
|
||||
grub_scsi_cmd_read_capacity16 = 0x9e,
|
||||
grub_scsi_cmd_read12 = 0xa8,
|
||||
grub_scsi_cmd_write12 = 0xaa,
|
||||
} grub_scsi_cmd_t;
|
||||
|
|
|
@ -63,6 +63,7 @@ struct grub_serial_config
|
|||
struct grub_serial_port
|
||||
{
|
||||
struct grub_serial_port *next;
|
||||
struct grub_serial_port **prev;
|
||||
char *name;
|
||||
struct grub_serial_driver *driver;
|
||||
struct grub_serial_config config;
|
||||
|
@ -96,6 +97,32 @@ grub_err_t EXPORT_FUNC(grub_serial_register) (struct grub_serial_port *port);
|
|||
|
||||
void EXPORT_FUNC(grub_serial_unregister) (struct grub_serial_port *port);
|
||||
|
||||
/* Convenience functions to perform primitive operations on a port. */
|
||||
static inline grub_err_t
|
||||
grub_serial_port_configure (struct grub_serial_port *port,
|
||||
struct grub_serial_config *config)
|
||||
{
|
||||
return port->driver->configure (port, config);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_serial_port_fetch (struct grub_serial_port *port)
|
||||
{
|
||||
return port->driver->fetch (port);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_serial_port_put (struct grub_serial_port *port, const int c)
|
||||
{
|
||||
port->driver->put (port, c);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_serial_port_fini (struct grub_serial_port *port)
|
||||
{
|
||||
port->driver->fini (port);
|
||||
}
|
||||
|
||||
/* Set default settings. */
|
||||
static inline grub_err_t
|
||||
grub_serial_config_defaults (struct grub_serial_port *port)
|
||||
|
@ -117,6 +144,7 @@ grub_serial_config_defaults (struct grub_serial_port *port)
|
|||
|
||||
void grub_ns8250_init (void);
|
||||
char *grub_serial_ns8250_add_port (grub_port_t port);
|
||||
struct grub_serial_port *grub_serial_find (const char *name);
|
||||
extern struct grub_serial_driver grub_ns8250_driver;
|
||||
void EXPORT_FUNC(grub_serial_unregister_driver) (struct grub_serial_driver *driver);
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_SIGNATURE 0xbb44aa55
|
||||
|
||||
#define GRUB_BOOT_MACHINE_VER_MAJ 0x08
|
||||
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH 0x0a
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH 0x08
|
||||
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH_END 0x80
|
||||
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -147,6 +147,7 @@ struct grub_term_input
|
|||
{
|
||||
/* The next terminal. */
|
||||
struct grub_term_input *next;
|
||||
struct grub_term_input **prev;
|
||||
|
||||
/* The terminal name. */
|
||||
const char *name;
|
||||
|
@ -171,6 +172,7 @@ struct grub_term_output
|
|||
{
|
||||
/* The next terminal. */
|
||||
struct grub_term_output *next;
|
||||
struct grub_term_output **prev;
|
||||
|
||||
/* The terminal name. */
|
||||
const char *name;
|
||||
|
@ -300,17 +302,15 @@ grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
|||
static inline void
|
||||
grub_term_unregister_input (grub_term_input_t term)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_unregister_output (grub_term_output_t term)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_term_outputs), GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
grub_list_remove (GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||
|
|
|
@ -29,6 +29,7 @@ struct grub_test
|
|||
{
|
||||
/* The next test. */
|
||||
struct grub_test *next;
|
||||
struct grub_test **prev;
|
||||
|
||||
/* The test name. */
|
||||
char *name;
|
||||
|
|
|
@ -21,6 +21,6 @@
|
|||
#define GRUB_TPARM_HEADER 1
|
||||
|
||||
/* Function prototypes. */
|
||||
char *grub_terminfo_tparm (const char *string, ...);
|
||||
const char *grub_terminfo_tparm (const char *string, ...);
|
||||
|
||||
#endif /* ! GRUB_TPARM_HEADER */
|
||||
|
|
|
@ -98,13 +98,15 @@ typedef grub_uint64_t grub_size_t;
|
|||
typedef grub_int64_t grub_ssize_t;
|
||||
|
||||
# if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# define PRIxGRUB_ADDR "lx"
|
||||
# define PRIuGRUB_SIZE "lu"
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# define PRIxGRUB_ADDR "lx"
|
||||
# define PRIuGRUB_SIZE "lu"
|
||||
# define PRIdGRUB_SSIZE "ld"
|
||||
# else
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# define PRIdGRUB_SSIZE "lld"
|
||||
# endif
|
||||
#else
|
||||
typedef grub_uint32_t grub_addr_t;
|
||||
|
@ -114,8 +116,15 @@ typedef grub_int32_t grub_ssize_t;
|
|||
# define PRIxGRUB_SIZE "x"
|
||||
# define PRIxGRUB_ADDR "x"
|
||||
# define PRIuGRUB_SIZE "u"
|
||||
# define PRIdGRUB_SSIZE "d"
|
||||
#endif
|
||||
|
||||
#define GRUB_UCHAR_MAX 0xFF
|
||||
#define GRUB_USHRT_MAX 65535
|
||||
#define GRUB_SHRT_MAX 0x7fff
|
||||
#define GRUB_UINT_MAX 4294967295U
|
||||
#define GRUB_INT_MAX 0x7fffffff
|
||||
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define GRUB_ULONG_MAX 18446744073709551615UL
|
||||
# define GRUB_LONG_MAX 9223372036854775807L
|
||||
|
@ -126,15 +135,9 @@ typedef grub_int32_t grub_ssize_t;
|
|||
# define GRUB_LONG_MIN (-2147483647L - 1)
|
||||
#endif
|
||||
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 4
|
||||
#define UINT_TO_PTR(x) ((void*)(grub_uint32_t)(x))
|
||||
#define PTR_TO_UINT64(x) ((grub_uint64_t)(grub_uint32_t)(x))
|
||||
#define PTR_TO_UINT32(x) ((grub_uint32_t)(x))
|
||||
#else
|
||||
#define UINT_TO_PTR(x) ((void*)(grub_uint64_t)(x))
|
||||
#define PTR_TO_UINT64(x) ((grub_uint64_t)(x))
|
||||
#define PTR_TO_UINT32(x) ((grub_uint32_t)(grub_uint64_t)(x))
|
||||
#endif
|
||||
typedef grub_uint64_t grub_properly_aligned_t;
|
||||
|
||||
#define GRUB_PROPERLY_ALIGNED_ARRAY(name, size) grub_properly_aligned_t name[((size) + sizeof (grub_properly_aligned_t) - 1) / sizeof (grub_properly_aligned_t)]
|
||||
|
||||
/* The type for representing a file offset. */
|
||||
typedef grub_uint64_t grub_off_t;
|
||||
|
@ -151,6 +154,18 @@ typedef grub_uint64_t grub_disk_addr_t;
|
|||
|
||||
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
|
||||
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
|
||||
#define grub_swap_bytes64_compile_time(x) \
|
||||
({ \
|
||||
grub_uint64_t _x = (x); \
|
||||
(grub_uint64_t) ((_x << 56) \
|
||||
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \
|
||||
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \
|
||||
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \
|
||||
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \
|
||||
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \
|
||||
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
|
||||
| (_x >> 56)); \
|
||||
})
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
|
||||
static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x)
|
||||
|
@ -199,6 +214,10 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
|
||||
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
|
||||
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
|
||||
# define grub_cpu_to_be16_compile_time(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_be32_compile_time(x) ((grub_uint32_t) (x))
|
||||
# define grub_cpu_to_be64_compile_time(x) ((grub_uint64_t) (x))
|
||||
# define grub_be_to_cpu64_compile_time(x) ((grub_uint64_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) grub_swap_bytes32_compile_time(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) grub_swap_bytes16_compile_time(x)
|
||||
#else /* ! WORDS_BIGENDIAN */
|
||||
|
@ -214,8 +233,66 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
|
||||
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
|
||||
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
|
||||
# define grub_cpu_to_be16_compile_time(x) grub_swap_bytes16_compile_time(x)
|
||||
# define grub_cpu_to_be32_compile_time(x) grub_swap_bytes32_compile_time(x)
|
||||
# define grub_cpu_to_be64_compile_time(x) grub_swap_bytes64_compile_time(x)
|
||||
# define grub_be_to_cpu64_compile_time(x) grub_swap_bytes64_compile_time(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x))
|
||||
|
||||
#endif /* ! WORDS_BIGENDIAN */
|
||||
|
||||
static inline grub_uint16_t grub_get_unaligned16 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint16_t
|
||||
{
|
||||
grub_uint16_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint16_t *dd
|
||||
= (const struct grub_unaligned_uint16_t *) ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val)
|
||||
{
|
||||
struct grub_unaligned_uint16_t
|
||||
{
|
||||
grub_uint16_t d;
|
||||
} __attribute__ ((packed));
|
||||
struct grub_unaligned_uint16_t *dd = (struct grub_unaligned_uint16_t *) ptr;
|
||||
dd->d = val;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t grub_get_unaligned32 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint32_t
|
||||
{
|
||||
grub_uint32_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint32_t *dd
|
||||
= (const struct grub_unaligned_uint32_t *) ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
static inline void grub_set_unaligned32 (void *ptr, grub_uint32_t val)
|
||||
{
|
||||
struct grub_unaligned_uint32_t
|
||||
{
|
||||
grub_uint32_t d;
|
||||
} __attribute__ ((packed));
|
||||
struct grub_unaligned_uint32_t *dd = (struct grub_unaligned_uint32_t *) ptr;
|
||||
dd->d = val;
|
||||
}
|
||||
|
||||
static inline grub_uint64_t grub_get_unaligned64 (const void *ptr)
|
||||
{
|
||||
struct grub_unaligned_uint64_t
|
||||
{
|
||||
grub_uint64_t d;
|
||||
} __attribute__ ((packed));
|
||||
const struct grub_unaligned_uint64_t *dd
|
||||
= (const struct grub_unaligned_uint64_t *)ptr;
|
||||
return dd->d;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
|
|
|
@ -31,12 +31,12 @@ struct grub_unicode_bidi_pair
|
|||
|
||||
struct grub_unicode_compact_range
|
||||
{
|
||||
grub_uint32_t start:21;
|
||||
grub_uint32_t end:21;
|
||||
grub_uint8_t bidi_type:5;
|
||||
grub_uint8_t comb_type;
|
||||
grub_uint8_t bidi_mirror:1;
|
||||
grub_uint8_t join_type:3;
|
||||
unsigned start:21;
|
||||
unsigned len:9;
|
||||
unsigned bidi_type:5;
|
||||
unsigned comb_type:8;
|
||||
unsigned bidi_mirror:1;
|
||||
unsigned join_type:3;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Old-style Arabic shaping. Used for "visual UTF-8" and
|
||||
|
@ -206,8 +206,11 @@ enum
|
|||
GRUB_UNICODE_BLACK_LEFT_TRIANGLE = 0x25c4,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_1 = 0xfe00,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_16 = 0xfe0f,
|
||||
GRUB_UNICODE_TAG_START = 0xe0000,
|
||||
GRUB_UNICODE_TAG_END = 0xe007f,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_17 = 0xe0100,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_256 = 0xe01ef
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_256 = 0xe01ef,
|
||||
GRUB_UNICODE_LAST_VALID = 0x10ffff
|
||||
};
|
||||
|
||||
extern struct grub_unicode_compact_range grub_unicode_compact[];
|
||||
|
|
|
@ -269,6 +269,7 @@ typedef int (*grub_usb_attach_hook_class) (grub_usb_device_t usbdev,
|
|||
struct grub_usb_attach_desc
|
||||
{
|
||||
struct grub_usb_attach_desc *next;
|
||||
struct grub_usb_attach_desc **prev;
|
||||
int class;
|
||||
grub_usb_attach_hook_class hook;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* lvm.h - LVM support for GRUB utils. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2006,2007,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +20,14 @@
|
|||
#ifndef GRUB_LVM_UTIL_HEADER
|
||||
#define GRUB_LVM_UTIL_HEADER 1
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#ifdef __linux__
|
||||
#define LVM_DEV_MAPPER_STRING "/dev/mapper/"
|
||||
#else
|
||||
#define LVM_DEV_MAPPER_STRING "/dev/linux_lvm/"
|
||||
#endif
|
||||
|
||||
int grub_util_lvm_isvolume (char *name);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ struct grub_video_adapter
|
|||
{
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
struct grub_video_adapter **prev;
|
||||
|
||||
/* The video adapter name. */
|
||||
const char *name;
|
||||
|
@ -398,8 +399,7 @@ grub_video_register (grub_video_adapter_t adapter)
|
|||
static inline void
|
||||
grub_video_unregister (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||
GRUB_AS_LIST (adapter));
|
||||
grub_list_remove (GRUB_AS_LIST (adapter));
|
||||
}
|
||||
|
||||
#define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
/* x86_64 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
|
|
|
@ -81,7 +81,7 @@ struct grub_xnu_extheader
|
|||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xnu_devtree_key *grub_xnu_create_key (struct grub_xnu_devtree_key **parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
extern struct grub_xnu_devtree_key *grub_xnu_devtree_root;
|
||||
|
||||
|
@ -89,18 +89,20 @@ void grub_xnu_free_devtree (struct grub_xnu_devtree_key *cur);
|
|||
|
||||
grub_err_t grub_xnu_writetree_toheap (grub_addr_t *target, grub_size_t *size);
|
||||
struct grub_xnu_devtree_key *grub_xnu_create_value (struct grub_xnu_devtree_key **parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
void grub_xnu_lock (void);
|
||||
void grub_xnu_unlock (void);
|
||||
grub_err_t grub_xnu_resume (char *imagename);
|
||||
grub_err_t grub_xnu_boot_resume (void);
|
||||
struct grub_xnu_devtree_key *grub_xnu_find_key (struct grub_xnu_devtree_key *parent,
|
||||
char *name);
|
||||
const char *name);
|
||||
grub_err_t grub_xnu_align_heap (int align);
|
||||
grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,
|
||||
grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname,
|
||||
const char *osbundlerequired,
|
||||
int maxrecursion);
|
||||
grub_err_t grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
|
||||
grub_err_t grub_xnu_load_kext_from_dir (char *dirname,
|
||||
const char *osbundlerequired,
|
||||
int maxrecursion);
|
||||
grub_err_t grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target);
|
||||
grub_err_t grub_xnu_fill_devicetree (void);
|
||||
|
|
|
@ -88,6 +88,7 @@ typedef enum dmu_object_type {
|
|||
DMU_OT_SA_MASTER_NODE, /* ZAP */
|
||||
DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
|
||||
DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
|
||||
DMU_OT_DSL_KEYCHAIN = 54,
|
||||
DMU_OT_NUMTYPES
|
||||
} dmu_object_type_t;
|
||||
|
||||
|
|
|
@ -29,12 +29,8 @@
|
|||
* Fixed constants.
|
||||
*/
|
||||
#define DNODE_SHIFT 9 /* 512 bytes */
|
||||
#define DN_MIN_INDBLKSHIFT 10 /* 1k */
|
||||
#define DN_MAX_INDBLKSHIFT 14 /* 16k */
|
||||
#define DNODE_BLOCK_SHIFT 14 /* 16k */
|
||||
#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
|
||||
#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */
|
||||
#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */
|
||||
|
||||
/*
|
||||
* Derived constants.
|
||||
|
@ -42,11 +38,9 @@
|
|||
#define DNODE_SIZE (1 << DNODE_SHIFT)
|
||||
#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT)
|
||||
#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT))
|
||||
#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT)
|
||||
|
||||
#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
|
||||
#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT)
|
||||
#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
|
||||
|
||||
#define DNODE_FLAG_SPILL_BLKPTR (1<<2)
|
||||
|
||||
|
|
|
@ -42,7 +42,9 @@ typedef struct dsl_dir_phys {
|
|||
grub_uint64_t dd_reserved;
|
||||
grub_uint64_t dd_props_zapobj;
|
||||
grub_uint64_t dd_deleg_zapobj; /* dataset permissions */
|
||||
grub_uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */
|
||||
grub_uint64_t unused[7];
|
||||
grub_uint64_t keychain;
|
||||
grub_uint64_t unused2[12];
|
||||
} dsl_dir_phys_t;
|
||||
|
||||
#endif /* _SYS_DSL_DIR_H */
|
||||
|
|
|
@ -29,6 +29,9 @@ typedef struct sa_hdr_phys {
|
|||
} sa_hdr_phys_t;
|
||||
|
||||
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
|
||||
#define SA_TYPE_OFFSET 0x0
|
||||
#define SA_SIZE_OFFSET 0x8
|
||||
#define SA_MTIME_OFFSET 0x38
|
||||
#define SA_SYMLINK_OFFSET 0xa0
|
||||
|
||||
#endif /* _SYS_SA_IMPL_H */
|
||||
|
|
|
@ -20,26 +20,24 @@
|
|||
#ifndef GRUB_ZFS_SPA_HEADER
|
||||
#define GRUB_ZFS_SPA_HEADER 1
|
||||
|
||||
typedef enum grub_zfs_endian
|
||||
{
|
||||
UNKNOWN_ENDIAN = -2,
|
||||
LITTLE_ENDIAN = -1,
|
||||
BIG_ENDIAN = 0
|
||||
} grub_zfs_endian_t;
|
||||
|
||||
#define grub_zfs_to_cpu16(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu16(x) \
|
||||
#define grub_zfs_to_cpu16(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_be_to_cpu16(x) \
|
||||
: grub_le_to_cpu16(x))
|
||||
#define grub_cpu_to_zfs16(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be16(x) \
|
||||
#define grub_cpu_to_zfs16(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_cpu_to_be16(x) \
|
||||
: grub_cpu_to_le16(x))
|
||||
|
||||
#define grub_zfs_to_cpu32(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu32(x) \
|
||||
#define grub_zfs_to_cpu32(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_be_to_cpu32(x) \
|
||||
: grub_le_to_cpu32(x))
|
||||
#define grub_cpu_to_zfs32(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be32(x) \
|
||||
#define grub_cpu_to_zfs32(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? \
|
||||
grub_cpu_to_be32(x) \
|
||||
: grub_cpu_to_le32(x))
|
||||
|
||||
#define grub_zfs_to_cpu64(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu64(x) \
|
||||
#define grub_zfs_to_cpu64(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) \
|
||||
? grub_be_to_cpu64(x) \
|
||||
: grub_le_to_cpu64(x))
|
||||
#define grub_cpu_to_zfs64(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be64(x) \
|
||||
#define grub_cpu_to_zfs64(x,a) (((a) == GRUB_ZFS_BIG_ENDIAN) ? grub_cpu_to_be64(x) \
|
||||
: grub_cpu_to_le64(x))
|
||||
|
||||
/*
|
||||
|
@ -68,17 +66,8 @@ typedef enum grub_zfs_endian
|
|||
#define BF64_SET_SB(x, low, len, shift, bias, val) \
|
||||
BF64_SET(x, low, len, ((val) >> (shift)) - (bias))
|
||||
|
||||
/*
|
||||
* We currently support nine block sizes, from 512 bytes to 128K.
|
||||
* We could go higher, but the benefits are near-zero and the cost
|
||||
* of COWing a giant block to modify one byte would become excessive.
|
||||
*/
|
||||
#define SPA_MINBLOCKSHIFT 9
|
||||
#define SPA_MAXBLOCKSHIFT 17
|
||||
#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
|
||||
#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
|
||||
|
||||
#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
|
||||
|
||||
/*
|
||||
* Size of block to hold the configuration data (a packed nvlist)
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#define ZAP_HASHBITS 28
|
||||
#define MZAP_ENT_LEN 64
|
||||
#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2)
|
||||
#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT
|
||||
#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT)
|
||||
|
||||
typedef struct mzap_ent_phys {
|
||||
grub_uint64_t mze_value;
|
||||
|
|
|
@ -69,7 +69,8 @@ typedef struct zap_leaf_phys {
|
|||
* with the ZAP_LEAF_CHUNK() macro.
|
||||
*/
|
||||
|
||||
grub_uint16_t l_hash[1];
|
||||
grub_uint16_t l_hash[0];
|
||||
grub_properly_aligned_t l_entries[0];
|
||||
} zap_leaf_phys_t;
|
||||
|
||||
typedef union zap_leaf_chunk {
|
||||
|
|
|
@ -24,11 +24,19 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
typedef enum grub_zfs_endian
|
||||
{
|
||||
GRUB_ZFS_UNKNOWN_ENDIAN = -2,
|
||||
GRUB_ZFS_LITTLE_ENDIAN = -1,
|
||||
GRUB_ZFS_BIG_ENDIAN = 0
|
||||
} grub_zfs_endian_t;
|
||||
|
||||
/*
|
||||
* On-disk version number.
|
||||
*/
|
||||
#define SPA_VERSION 28ULL
|
||||
#define SPA_VERSION 33ULL
|
||||
|
||||
/*
|
||||
* The following are configuration names used in the nvlist describing a pool's
|
||||
|
@ -112,12 +120,34 @@ grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
|
|||
grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
|
||||
grub_uint64_t *mdnobj);
|
||||
|
||||
char *grub_zfs_nvlist_lookup_string (char *nvlist, char *name);
|
||||
char *grub_zfs_nvlist_lookup_nvlist (char *nvlist, char *name);
|
||||
int grub_zfs_nvlist_lookup_uint64 (char *nvlist, char *name,
|
||||
char *grub_zfs_nvlist_lookup_string (const char *nvlist, const char *name);
|
||||
char *grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name);
|
||||
int grub_zfs_nvlist_lookup_uint64 (const char *nvlist, const char *name,
|
||||
grub_uint64_t *out);
|
||||
char *grub_zfs_nvlist_lookup_nvlist_array (char *nvlist, char *name,
|
||||
char *grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist,
|
||||
const char *name,
|
||||
grub_size_t index);
|
||||
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (char *nvlist, char *name);
|
||||
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (const char *nvlist,
|
||||
const char *name);
|
||||
grub_err_t
|
||||
grub_zfs_add_key (grub_uint8_t *key_in,
|
||||
grub_size_t keylen,
|
||||
int passphrase);
|
||||
|
||||
extern grub_err_t (*grub_zfs_decrypt) (grub_crypto_cipher_handle_t cipher,
|
||||
grub_uint64_t algo,
|
||||
void *nonce,
|
||||
char *buf, grub_size_t size,
|
||||
const grub_uint32_t *expected_mac,
|
||||
grub_zfs_endian_t endian);
|
||||
|
||||
struct grub_zfs_key;
|
||||
|
||||
extern grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key,
|
||||
grub_size_t keysize,
|
||||
grub_uint64_t salt,
|
||||
grub_uint64_t algo);
|
||||
|
||||
|
||||
|
||||
#endif /* ! GRUB_ZFS_HEADER */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
typedef struct zio_eck {
|
||||
grub_uint64_t zec_magic; /* for validation, endianness */
|
||||
zio_cksum_t zec_cksum; /* 256-bit checksum */
|
||||
} zio_eck_t;
|
||||
} __attribute__ ((packed)) zio_eck_t;
|
||||
|
||||
/*
|
||||
* Gang block headers are self-checksumming and contain an array
|
||||
|
@ -65,6 +65,7 @@ enum zio_checksum {
|
|||
ZIO_CHECKSUM_FLETCHER_4,
|
||||
ZIO_CHECKSUM_SHA256,
|
||||
ZIO_CHECKSUM_ZILOG2,
|
||||
ZIO_CHECKSUM_SHA256_MAC,
|
||||
ZIO_CHECKSUM_FUNCTIONS
|
||||
};
|
||||
|
||||
|
@ -86,6 +87,7 @@ enum zio_compress {
|
|||
ZIO_COMPRESS_GZIP7,
|
||||
ZIO_COMPRESS_GZIP8,
|
||||
ZIO_COMPRESS_GZIP9,
|
||||
ZIO_COMPRESS_ZLE,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
|
|
|
@ -23,22 +23,6 @@
|
|||
#ifndef _SYS_ZIO_CHECKSUM_H
|
||||
#define _SYS_ZIO_CHECKSUM_H
|
||||
|
||||
/*
|
||||
* Signature for checksum functions.
|
||||
*/
|
||||
typedef void zio_checksum_t(const void *data, grub_uint64_t size,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *zcp);
|
||||
|
||||
/*
|
||||
* Information about each checksum function.
|
||||
*/
|
||||
typedef struct zio_checksum_info {
|
||||
zio_checksum_t *ci_func; /* checksum function for each byteorder */
|
||||
int ci_correctable; /* number of correctable bits */
|
||||
int ci_eck; /* uses zio embedded checksum? */
|
||||
char *ci_name; /* descriptive name */
|
||||
} zio_checksum_info_t;
|
||||
|
||||
extern void zio_checksum_SHA256 (const void *, grub_uint64_t,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *);
|
||||
extern void fletcher_2 (const void *, grub_uint64_t, grub_zfs_endian_t endian,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue