| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
get_bootloader_string() takes a mutable first argument; the call chain
does have call paths on which this argument will be modified.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
| |
Impact: visual
Running Nindent on gpllib / gplinclude
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
com32/hdt/hdt-cli-disk.c
com32/hdt/hdt-common.h
com32/hdt/hdt-menu-disk.c
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Given an (active) partition, look for a bootloader ID.
Syslinux prints a string (SYSLINUX or EXTLINUX) between bytes
3 and 10.
After some random tests, it seems that Windows™98/98SE and Windows™ME
put MSWIN4.1 at the same place. Internet seems to confirm it:
http://www.geocities.com/thestarman3/asm/mbr/MSWin41BRinHexEd.htm
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| | |
We had forgotten to update the #define when renaming the file.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| |
| | |
bootloaders.c really inspects the MBR, not the bootloader itself.
Let's not confuse the two of them.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Syslinux and Master Boot LoaDeR share the first 2 bytes. Use one more
to distinguish between the two of them.
To keep standards types, uint16_t is being replaced by uint32_t.
The extra byte is not used yet.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| | |
struct driveinfo is defined in disk/geom.h.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| | |
The id is of the form 0xABCD: use uint16_t instead of int.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The first two bytes of the hard drive can help identifying the boot code
installed in the MBR.
Values from the boot_info_script:
http://sourceforge.net/projects/bootinfoscript/
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
| |
| |
| |
| |
| |
| |
| | |
In d1890409251949b80c2026557b9b12ca00d55144, it seems we
have forgotten to update util.h.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
swsusp detection needs PAGE_SIZE. cpuid.h is actually already defining it.
Since both swsusp and cpuid are taken from the Linux kernel, it is a good idea to
share it (they really need to be equal).
We are going to rely on cpuid.h. Creating a page.h for this single definition seems
overkilling and the MMU is part of the CPU on x86 anyways.
Impact: fix compiler warning (redefinition).
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
| |
This simplifies buffer handling.
Misc.: clean some old error code handling.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
typedefs are evil but useful for function pointers as it makes them more
readable and maintainable.
This fixes a bug by the way: we had
void *callback(struct driveinfo *, struct part_entry *, int, int)
where we should have had
void (*callback)(struct driveinfo *, struct part_entry *, int, int)
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
| |
The disklib interfaces have changed (errno_disk introduced). Update
these changes in hdt (nobody else use them).
Misc: fix get_error declaration.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
| |
* Fix header files due to previous commit
* Prefix disk errnos with ED to avoid conflicts with classic errno
* Fix swsusp code to use errno_disk
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
| |
Get rid of the error pointer and use a errno-like error reporting mechanism.
Intent is to make these more like the standard read/write system calls.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The disklib is distributed under GPLv2.
Add copyright holders for borrowed code:
* H. Peter Anvin/Intel Corporation (read/write BIOS calls)
* Matt Domsch <Matt_Domsch@dell.com> (edd structures)
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Impact: expand gpllib disk API
parse_partition_table() can be used to execute a callback on each partition.
The signature of the callback is:
void callback(struct driveinfo *drive_info,
struct part_entry *ptab,
struct part_entry *ptab_root,
int offset_root,
int local_partition_number,
int ebr_seen)
* drive_info represents the disk.
* ptab is the current partition entry processed.
* ptab_root is the partition entry linking to the current one processed (extended only).
* offset_root is the offset of the ebr when iterating through extended partitions
(0 otherwise).
* local_partition_number is the number of the partition processed (0->3).
* ebr_seen counts the total number of ebr processed.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
| |
swsusp is a Linux mechanism to put a computer to sleep. In case of hibernation,
an image is written to the disk, on a swap partition.
swsusp_check can be used to check if a device contains the magic swsusp signature,
meaning that an image is present.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
| |
It is worth propagating read/write error codes back to the caller. He can
pass NULL to ignore them, or an int* that will be populated.
To decode it, one can use the get_error function (see disk/error.c).
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
| |
Add a new file for partition related structures.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
| |
The get_error function is fairly big. It is worth creating
a new file for it.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
| |
A couple of structures/definitions are shared between several files
in the disk library. Add them in disk/common.h
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Impact: disk API extension
Add part_entry structure to describe DOS partition tables.
The new get_label call translates a label id to a meaningful string
describing the partition.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
| |
Impact: disk API extension
read_mbr takes a drive number and returns a pointer to a malloced buffer
containing its mbr.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Impact: driveinfo structure change, new disk.c32 module
Adapt driveinfo structure to store both legacy and EDD parameters. Change utility
functions to use EDD when available (C/H/S being a fallback).
Add a new disk.c32 module to test the disk library. It will print information
(geometry) about every detected drive.
Misc.: refactoring, set ES:DI to 0:0 when querying legacy C/H/S
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
|
|
|
|
| |
cheksum should read checksum.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|
|
This library features read and write operations, as well as geometry detection.
It will prevent duplicating code between several modules (e.g. hdt and chain.c32).
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
|