merge mainline into gdb
This commit is contained in:
commit
515e8007fc
465 changed files with 26882 additions and 11400 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,20 +36,48 @@
|
|||
#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))
|
||||
#define GRUB_UTF16_LOWER_SURROGATE(code) \
|
||||
(0xDC00 + (((code) - GRUB_UCS2_LIMIT) & 0xfff))
|
||||
|
||||
grub_ssize_t
|
||||
grub_size_t
|
||||
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;
|
||||
|
|
|
@ -198,8 +198,40 @@ 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,
|
||||
|
@ -283,7 +315,7 @@ int
|
|||
grub_password_get (char buf[], unsigned buf_size);
|
||||
|
||||
/* For indistinguishibility. */
|
||||
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
|
||||
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, N_("access denied"))
|
||||
|
||||
extern void (*grub_crypto_autoload_hook) (const char *name);
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
#define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a
|
||||
#define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b
|
||||
#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE 0x3f000000000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL
|
||||
|
|
|
@ -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 = 2 * 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 - 1972) / 4;
|
||||
if (datetime->year < 1972)
|
||||
y4 = (datetime->year - 1973) / 4;
|
||||
if (datetime->year < 1973)
|
||||
y4--;
|
||||
ay = datetime->year - 1972 - 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);
|
||||
|
@ -183,15 +194,17 @@ EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long
|
|||
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
|
||||
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
||||
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
|
||||
#if defined (GRUB_UTIL)
|
||||
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 */
|
||||
|
|
196
include/grub/diskfilter.h
Normal file
196
include/grub/diskfilter.h
Normal file
|
@ -0,0 +1,196 @@
|
|||
/* 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;
|
||||
#ifdef GRUB_UTIL
|
||||
char **partmaps;
|
||||
#endif
|
||||
};
|
||||
|
||||
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);
|
||||
void
|
||||
grub_diskfilter_print_partmap (grub_disk_t disk);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RAID_H */
|
|
@ -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,
|
||||
|
|
|
@ -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 *) \
|
||||
|
@ -152,9 +152,12 @@ struct grub_efiemu_elf_sym
|
|||
|
||||
int grub_efiemu_check_header32 (void *ehdr, grub_size_t size);
|
||||
int grub_efiemu_check_header64 (void *ehdr, grub_size_t size);
|
||||
grub_err_t grub_efiemu_loadcore_init32 (void *core, grub_size_t core_size,
|
||||
grub_err_t grub_efiemu_loadcore_init32 (void *core,
|
||||
const char *filename,
|
||||
grub_size_t core_size,
|
||||
grub_efiemu_segment_t *segments);
|
||||
grub_err_t grub_efiemu_loadcore_init64 (void *core, grub_size_t core_size,
|
||||
grub_err_t grub_efiemu_loadcore_init64 (void *core, const char *filename,
|
||||
grub_size_t core_size,
|
||||
grub_efiemu_segment_t *segments);
|
||||
grub_err_t grub_efiemu_loadcore_load32 (void *core,
|
||||
grub_size_t core_size,
|
||||
|
@ -165,7 +168,8 @@ grub_err_t grub_efiemu_loadcore_load64 (void *core,
|
|||
grub_err_t grub_efiemu_loadcore_unload32 (void);
|
||||
grub_err_t grub_efiemu_loadcore_unload64 (void);
|
||||
grub_err_t grub_efiemu_loadcore_unload(void);
|
||||
grub_err_t grub_efiemu_loadcore_init (grub_file_t file);
|
||||
grub_err_t grub_efiemu_loadcore_init (grub_file_t file,
|
||||
const char *filename);
|
||||
grub_err_t grub_efiemu_loadcore_load (void);
|
||||
|
||||
/* Configuration tables manipulation. Definitions and functions */
|
||||
|
@ -200,15 +204,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 +269,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);
|
||||
|
|
|
@ -42,24 +42,32 @@ typedef grub_err_t (*grub_elf64_load_hook_t)
|
|||
(Elf64_Phdr *phdr, grub_addr_t *addr, int *load);
|
||||
|
||||
grub_elf_t grub_elf_open (const char *);
|
||||
grub_elf_t grub_elf_file (grub_file_t);
|
||||
grub_elf_t grub_elf_file (grub_file_t file, const char *filename);
|
||||
grub_err_t grub_elf_close (grub_elf_t);
|
||||
|
||||
int grub_elf_is_elf32 (grub_elf_t);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *, grub_uint32_t *);
|
||||
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
|
||||
grub_size_t grub_elf32_size (grub_elf_t,
|
||||
const char *filename,
|
||||
Elf32_Addr *, grub_uint32_t *);
|
||||
grub_err_t grub_elf32_load (grub_elf_t, const char *filename,
|
||||
grub_elf32_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
|
||||
int grub_elf_is_elf64 (grub_elf_t);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *, grub_uint64_t *);
|
||||
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
|
||||
grub_size_t grub_elf64_size (grub_elf_t,
|
||||
const char *filename,
|
||||
Elf64_Addr *, grub_uint64_t *);
|
||||
grub_err_t grub_elf64_load (grub_elf_t, const char *filename,
|
||||
grub_elf64_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
grub_err_t
|
||||
grub_elf32_phdr_iterate (grub_elf_t elf,
|
||||
const char *filename,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf32_Phdr *, void *),
|
||||
void *hook_arg);
|
||||
grub_err_t
|
||||
grub_elf64_phdr_iterate (grub_elf_t elf,
|
||||
const char *filename,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf64_Phdr *, void *),
|
||||
void *hook_arg);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ enum grub_dev_abstraction_types {
|
|||
};
|
||||
|
||||
char *grub_find_device (const char *dir, dev_t dev);
|
||||
char *grub_guess_root_device (const char *dir);
|
||||
char **grub_guess_root_devices (const char *dir);
|
||||
int grub_util_get_dev_abstraction (const char *os_dev);
|
||||
char *grub_util_get_grub_dev (const char *os_dev);
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
|
|
|
@ -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,17 +30,38 @@ 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);
|
||||
grub_util_get_fd_sectors (int fd, const char *name, unsigned *log_secsize);
|
||||
#endif
|
||||
|
||||
char *
|
||||
grub_util_get_os_disk (const char *os_dev);
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
||||
|
|
|
@ -60,11 +60,11 @@ 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, ...);
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn));
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
|
||||
|
@ -80,9 +80,4 @@ extern char * canonicalize_file_name (const char *path);
|
|||
int grub_device_mapper_supported (void);
|
||||
#endif
|
||||
|
||||
char *grub_find_root_device_from_mountinfo (const char *dir, char **relroot);
|
||||
|
||||
void EXPORT_FUNC(grub_reboot) (void);
|
||||
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_MAX_ERRMSG 256
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_ERR_NONE = 0,
|
||||
|
@ -59,13 +61,25 @@ 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;
|
||||
|
||||
struct grub_error_saved
|
||||
{
|
||||
grub_err_t grub_errno;
|
||||
char errmsg[GRUB_MAX_ERRMSG];
|
||||
};
|
||||
|
||||
extern grub_err_t EXPORT_VAR(grub_errno);
|
||||
extern char EXPORT_VAR(grub_errmsg)[];
|
||||
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -46,6 +46,7 @@ struct grub_fs
|
|||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
struct grub_fs **prev;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
@ -111,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 */
|
||||
|
|
|
@ -81,21 +81,25 @@ grub_err_t grub_freebsd_load_elfmodule_obj64 (struct grub_relocator *relocator,
|
|||
grub_addr_t *kern_end);
|
||||
grub_err_t grub_freebsd_load_elf_meta32 (struct grub_relocator *relocator,
|
||||
grub_file_t file,
|
||||
const char *filename,
|
||||
grub_addr_t *kern_end);
|
||||
grub_err_t grub_freebsd_load_elf_meta64 (struct grub_relocator *relocator,
|
||||
grub_file_t file,
|
||||
const char *filename,
|
||||
grub_addr_t *kern_end);
|
||||
|
||||
grub_err_t grub_netbsd_load_elf_meta32 (struct grub_relocator *relocator,
|
||||
grub_file_t file,
|
||||
const char *filename,
|
||||
grub_addr_t *kern_end);
|
||||
grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
|
||||
grub_file_t file,
|
||||
const char *filename,
|
||||
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);
|
||||
|
||||
|
@ -107,10 +111,12 @@ struct grub_openbsd_ramdisk_descriptor
|
|||
};
|
||||
|
||||
grub_err_t grub_openbsd_find_ramdisk32 (grub_file_t file,
|
||||
const char *filename,
|
||||
grub_addr_t kern_start,
|
||||
void *kern_chunk_src,
|
||||
struct grub_openbsd_ramdisk_descriptor *desc);
|
||||
grub_err_t grub_openbsd_find_ramdisk64 (grub_file_t file,
|
||||
const char *filename,
|
||||
grub_addr_t kern_start,
|
||||
void *kern_chunk_src,
|
||||
struct grub_openbsd_ramdisk_descriptor *desc);
|
||||
|
|
|
@ -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
|
||||
|
@ -287,6 +284,9 @@ int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entr
|
|||
|
||||
extern struct grub_pxe_bangpxe *grub_pxe_pxenv;
|
||||
|
||||
void *
|
||||
grub_pxe_get_cached (grub_uint16_t type);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_CPU_PXE_H */
|
||||
|
|
|
@ -221,8 +221,6 @@ grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
|
|||
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
|
||||
|
||||
grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
|
||||
grub_err_t grub_vbe_set_video_mode (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
|
||||
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
|
|
|
@ -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
include/grub/i386/relocator_private.h
Normal file
1
include/grub/i386/relocator_private.h
Normal file
|
@ -0,0 +1 @@
|
|||
#define GRUB_RELOCATOR16_STACK_SIZE 4096
|
|
@ -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,
|
||||
|
@ -184,11 +184,9 @@ 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);
|
||||
grub_err_t EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||
|
||||
int
|
||||
EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
|
||||
|
|
|
@ -77,12 +77,12 @@ extern grub_addr_t EXPORT_VAR (grub_modbase);
|
|||
var && (grub_addr_t) var \
|
||||
< (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \
|
||||
var = (struct grub_module_header *) \
|
||||
((char *) var + ((struct grub_module_header *) var)->size))
|
||||
((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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
grub_disk_addr_t 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
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ struct grub_macho_file
|
|||
typedef struct grub_macho_file *grub_macho_t;
|
||||
|
||||
grub_macho_t grub_macho_open (const char *);
|
||||
grub_macho_t grub_macho_file (grub_file_t);
|
||||
grub_macho_t grub_macho_file (grub_file_t file, const char *filename);
|
||||
grub_err_t grub_macho_close (grub_macho_t);
|
||||
|
||||
int grub_macho_contains_macho32 (grub_macho_t);
|
||||
|
@ -57,17 +57,21 @@ grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho);
|
|||
|
||||
/* Ignore BSS segments when loading. */
|
||||
#define GRUB_MACHO_NOBSS 0x1
|
||||
grub_err_t grub_macho_load32 (grub_macho_t macho, char *offset, int flags);
|
||||
grub_err_t grub_macho_load64 (grub_macho_t macho, char *offset, int flags);
|
||||
grub_err_t grub_macho_load32 (grub_macho_t macho, const char *filename,
|
||||
char *offset, int flags);
|
||||
grub_err_t grub_macho_load64 (grub_macho_t macho, const char *filename,
|
||||
char *offset, int flags);
|
||||
|
||||
/* Like filesize and file_read but take only 32-bit part
|
||||
for current architecture. */
|
||||
grub_size_t grub_macho_filesize32 (grub_macho_t macho);
|
||||
grub_err_t grub_macho_readfile32 (grub_macho_t macho, void *dest);
|
||||
grub_err_t grub_macho_readfile32 (grub_macho_t macho, const char *filename,
|
||||
void *dest);
|
||||
grub_size_t grub_macho_filesize64 (grub_macho_t macho);
|
||||
grub_err_t grub_macho_readfile64 (grub_macho_t macho, void *dest);
|
||||
grub_err_t grub_macho_readfile64 (grub_macho_t macho, const char *filename,
|
||||
void *dest);
|
||||
|
||||
void grub_macho_parse32 (grub_macho_t macho);
|
||||
void grub_macho_parse64 (grub_macho_t macho);
|
||||
void grub_macho_parse32 (grub_macho_t macho, const char *filename);
|
||||
void grub_macho_parse64 (grub_macho_t macho, const char *filename);
|
||||
|
||||
#endif /* ! GRUB_MACHOLOAD_HEADER */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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,7 +23,6 @@
|
|||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
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
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* GCC version checking borrowed from glibc. */
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
|
@ -175,6 +176,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)
|
||||
{
|
||||
|
@ -250,27 +263,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);
|
||||
|
||||
|
@ -294,7 +286,7 @@ grub_strtol (const char *str, char **end, int base)
|
|||
{
|
||||
if (magnitude > (unsigned long) GRUB_LONG_MAX + 1)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, "negative overflow");
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
return GRUB_LONG_MIN;
|
||||
}
|
||||
return -((long) magnitude);
|
||||
|
@ -303,7 +295,7 @@ grub_strtol (const char *str, char **end, int base)
|
|||
{
|
||||
if (magnitude > GRUB_LONG_MAX)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, "positive overflow");
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
return GRUB_LONG_MAX;
|
||||
}
|
||||
return (long) magnitude;
|
||||
|
@ -317,6 +309,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
|
||||
|
@ -348,17 +360,31 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
|||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
|
||||
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
|
||||
#if !defined(GRUB_UTIL) && NEED_ENABLE_EXECUTE_STACK
|
||||
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
|
||||
#endif
|
||||
|
||||
#if NEED_REGISTER_FRAME_INFO && !defined(GRUB_UTIL)
|
||||
#if !defined(GRUB_UTIL) && NEED_REGISTER_FRAME_INFO
|
||||
void EXPORT_FUNC (__register_frame_info) (void);
|
||||
void EXPORT_FUNC (__deregister_frame_info) (void);
|
||||
#endif
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
@ -368,24 +394,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)
|
||||
|
@ -394,12 +402,18 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
|||
}
|
||||
|
||||
/* Reboot the machine. */
|
||||
#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
|
||||
|
@ -411,4 +425,19 @@ extern int EXPORT_VAR(grub_no_autoload);
|
|||
#define grub_no_autoload 0
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_error_save (struct grub_error_saved *save)
|
||||
{
|
||||
grub_memcpy (save->errmsg, grub_errmsg, sizeof (save->errmsg));
|
||||
save->grub_errno = grub_errno;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_error_load (const struct grub_error_saved *save)
|
||||
{
|
||||
grub_memcpy (grub_errmsg, save->errmsg, sizeof (grub_errmsg));
|
||||
grub_errno = save->grub_errno;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_MISC_HEADER */
|
||||
|
|
|
@ -80,10 +80,11 @@ grub_multiboot_set_console (int console_type, int accepted_consoles,
|
|||
int width, int height, int depth,
|
||||
int console_required);
|
||||
grub_err_t
|
||||
grub_multiboot_load (grub_file_t file);
|
||||
grub_multiboot_load (grub_file_t file, const char *filename);
|
||||
/* Load ELF32 or ELF64. */
|
||||
grub_err_t
|
||||
grub_multiboot_load_elf (grub_file_t file, void *buffer);
|
||||
grub_multiboot_load_elf (grub_file_t file, const char *filename,
|
||||
void *buffer);
|
||||
extern grub_size_t grub_multiboot_pure_size;
|
||||
extern grub_size_t grub_multiboot_alloc_mbi;
|
||||
extern grub_uint32_t grub_multiboot_payload_eip;
|
||||
|
|
|
@ -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,14 @@ 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)
|
||||
#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))
|
||||
|
||||
|
||||
extern grub_net_app_level_t grub_net_app_level_list;
|
||||
|
||||
|
@ -317,8 +323,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 +342,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 +401,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 +428,30 @@ 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);
|
||||
|
||||
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)
|
||||
void
|
||||
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str);
|
||||
|
||||
void
|
||||
grub_net_poll_cards (unsigned time);
|
||||
|
@ -434,6 +459,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 +473,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
|
||||
|
||||
|
@ -135,4 +132,7 @@ void grub_normal_free_menu (grub_menu_t menu);
|
|||
void grub_normal_auth_init (void);
|
||||
void grub_normal_auth_fini (void);
|
||||
|
||||
grub_command_t
|
||||
grub_dyncmd_get_cmd (grub_command_t cmd);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
|
@ -81,7 +81,7 @@ enum
|
|||
|
||||
#define GRUB_NTFS_BLK_SHR GRUB_DISK_SECTOR_BITS
|
||||
|
||||
#define GRUB_NTFS_MAX_MFT (1024 >> GRUB_NTFS_BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_MFT (4096 >> GRUB_NTFS_BLK_SHR)
|
||||
#define GRUB_NTFS_MAX_IDX (16384 >> GRUB_NTFS_BLK_SHR)
|
||||
|
||||
#define GRUB_NTFS_COM_LEN 4096
|
||||
|
@ -157,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;
|
||||
};
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
/* Offset of reed_solomon_redundancy. */
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x10
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6e0
|
||||
/* Offset of field holding no reed solomon length. */
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH 0x14
|
||||
|
||||
#define GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE 0x18
|
||||
|
||||
#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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -132,6 +132,21 @@ void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch);
|
|||
volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch);
|
||||
grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch);
|
||||
|
||||
static inline void *
|
||||
grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk)
|
||||
{
|
||||
return ((grub_uint8_t *) grub_dma_get_virt (chunk)
|
||||
+ (phys - grub_dma_get_phys (chunk)));
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk)
|
||||
{
|
||||
return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk))
|
||||
+ grub_dma_get_phys (chunk));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_PCI_H */
|
||||
|
|
|
@ -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 */
|
36
include/grub/priority_queue.h
Normal file
36
include/grub/priority_queue.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* 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
|
||||
* 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_PRIORITY_QUEUE_HEADER
|
||||
#define GRUB_PRIORITY_QUEUE_HEADER 1
|
||||
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
@ -143,7 +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 (char *name);
|
||||
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);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define LOCAL(sym) L_ ## sym
|
||||
|
||||
/* Add an underscore to a C symbol in assembler code if needed. */
|
||||
#ifndef GRUB_UTIL
|
||||
#if HAVE_ASM_USCORE
|
||||
# define EXT_C(sym) _ ## sym
|
||||
#else
|
||||
|
@ -42,6 +43,7 @@
|
|||
#define FUNCTION(x) .globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 32; .endef; EXT_C(x):
|
||||
#define VARIABLE(x) .globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 0; .endef; EXT_C(x):
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Mark an exported symbol. */
|
||||
#ifndef GRUB_SYMBOL_GENERATOR
|
||||
|
|
|
@ -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))
|
||||
|
@ -320,7 +320,7 @@ grub_term_unregister_output (grub_term_output_t term)
|
|||
|
||||
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
|
||||
int EXPORT_FUNC(grub_getkey) (void);
|
||||
int EXPORT_FUNC(grub_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_getkey_noblock) (void);
|
||||
void grub_cls (void);
|
||||
void EXPORT_FUNC(grub_refresh) (void);
|
||||
void grub_puts_terminal (const char *str, struct grub_term_output *term);
|
||||
|
|
|
@ -29,6 +29,7 @@ struct grub_test
|
|||
{
|
||||
/* The next test. */
|
||||
struct grub_test *next;
|
||||
struct grub_test **prev;
|
||||
|
||||
/* The test name. */
|
||||
char *name;
|
||||
|
@ -58,6 +59,9 @@ void grub_test_nonzero (int cond, const char *file,
|
|||
## __VA_ARGS__, \
|
||||
"assert failed: %s", #cond)
|
||||
|
||||
void grub_unit_test_init (void);
|
||||
void grub_unit_test_fini (void);
|
||||
|
||||
/* Macro to define a unit test. */
|
||||
#define GRUB_UNIT_TEST(name, funp) \
|
||||
void grub_unit_test_init (void) \
|
||||
|
|
|
@ -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,11 +116,14 @@ 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
|
||||
|
@ -130,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;
|
||||
|
@ -155,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)
|
||||
|
@ -203,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 */
|
||||
|
@ -218,35 +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(void *ptr)
|
||||
static inline grub_uint16_t grub_get_unaligned16 (const void *ptr)
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint16_t d;
|
||||
} __attribute__((packed)) *dd = ptr;
|
||||
return dd->d;
|
||||
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 grub_uint32_t grub_get_unaligned32(void *ptr)
|
||||
static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val)
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint32_t d;
|
||||
} __attribute__((packed)) *dd = ptr;
|
||||
return dd->d;
|
||||
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_uint64_t grub_get_unaligned64(void *ptr)
|
||||
static inline grub_uint32_t grub_get_unaligned32 (const void *ptr)
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint64_t d;
|
||||
} __attribute__((packed)) *dd = ptr;
|
||||
return dd->d;
|
||||
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[];
|
||||
|
|
|
@ -198,6 +198,11 @@ struct grub_usb_device
|
|||
grub_uint32_t statuschange;
|
||||
|
||||
struct grub_usb_desc_endp *hub_endpoint;
|
||||
|
||||
/* EHCI Split Transfer information */
|
||||
int port;
|
||||
|
||||
int hubaddr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -246,7 +251,10 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_USBMS_PROTOCOL_BULK = 0x50
|
||||
GRUB_USBMS_PROTOCOL_BULK = 0x50,
|
||||
/* Experimental support for Control/Bulk/Interrupt (CBI) devices */
|
||||
GRUB_USBMS_PROTOCOL_CBI = 0x00, /* CBI with interrupt */
|
||||
GRUB_USBMS_PROTOCOL_CB = 0x01 /* CBI wthout interrupt */
|
||||
} grub_usbms_protocol_t;
|
||||
|
||||
static inline struct grub_usb_desc_if *
|
||||
|
@ -264,6 +272,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,11 +0,0 @@
|
|||
#ifndef GRUB_DEVICEITER_MACHINE_UTIL_HEADER
|
||||
#define GRUB_DEVICEITER_MACHINE_UTIL_HEADER 1
|
||||
|
||||
#include <config.h>
|
||||
|
||||
void grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
|
||||
int floppy_disks);
|
||||
void grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy,
|
||||
int *num_fd, int *num_hd);
|
||||
|
||||
#endif /* ! GRUB_DEVICEITER_MACHINE_UTIL_HEADER */
|
|
@ -31,14 +31,13 @@
|
|||
#include <grub/emu/misc.h>
|
||||
|
||||
char *grub_util_get_path (const char *dir, const char *file);
|
||||
size_t grub_util_get_fp_size (FILE *fp);
|
||||
size_t grub_util_get_image_size (const char *path);
|
||||
void grub_util_read_at (void *img, size_t len, off_t offset, FILE *fp);
|
||||
char *grub_util_read_image (const char *path);
|
||||
void grub_util_load_image (const char *path, char *buf);
|
||||
void grub_util_write_image (const char *img, size_t size, FILE *out);
|
||||
void grub_util_write_image (const char *img, size_t size, FILE *out,
|
||||
const char *name);
|
||||
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
||||
FILE *out);
|
||||
FILE *out, const char *name);
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -66,17 +66,8 @@
|
|||
#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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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