aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gplinclude/disk
Commit message (Collapse)AuthorAgeFilesLines
* disk/bootloaders.c: fix bogus const in get_bootloader_string()H. Peter Anvin2010-01-101-1/+1
| | | | | | | 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>
* gpllibs: Running NindentErwan Velu2009-11-2411-213/+213
| | | | | | Impact: visual Running Nindent on gpllib / gplinclude
* Merge branch 'bootloader-detection' into hdt-nextPierre-Alexandre Meyer2009-09-072-0/+36
|\ | | | | | | | | | | | | | | | | 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>
| * gpllib: add bootloader detectionPierre-Alexandre Meyer2009-08-261-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * gpllib: rename __BOOTLOADERS_H_ to __MBRS_H_ in mbrs.hPierre-Alexandre Meyer2009-08-261-3/+3
| | | | | | | | | | | | We had forgotten to update the #define when renaming the file. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
| * gpllib: rename bootloader detection to MBR detectionPierre-Alexandre Meyer2009-08-261-2/+2
| | | | | | | | | | | | | | 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>
| * gpllib: use four bytes to discover the MBRPierre-Alexandre Meyer2009-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | 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>
| * gpllib: fix compilation warning (disk/bootloaders.h)Pierre-Alexandre Meyer2009-08-231-0/+1
| | | | | | | | | | | | struct driveinfo is defined in disk/geom.h. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
| * gpllib: bootloader id should be uint16_tPierre-Alexandre Meyer2009-08-231-2/+5
| | | | | | | | | | | | The id is of the form 0xABCD: use uint16_t instead of int. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
| * gpllib: add bootloader detectionPierre-Alexandre Meyer2009-08-231-0/+14
| | | | | | | | | | | | | | | | | | | | | | 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>
* | gpllib: remove get_error declaration from disk/util.hPierre-Alexandre Meyer2009-09-012-3/+2
| | | | | | | | | | | | | | In d1890409251949b80c2026557b9b12ca00d55144, it seems we have forgotten to update util.h. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
* | gpllib: share PAGE_SIZE definition with cpuid.hPierre-Alexandre Meyer2009-09-011-3/+3
|/ | | | | | | | | | | | | 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>
* hdt: make get_error behaves like perrorPierre-Alexandre Meyer2009-08-221-3/+0
| | | | | | | | This simplifies buffer handling. Misc.: clean some old error code handling. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
* gpllib: Introduce typedefs for callbacksPierre-Alexandre Meyer2009-08-051-1/+3
| | | | | | | | | | | | | | | 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>
* hdt: Make the menu and cli use the new disk interfacesPierre-Alexandre Meyer2009-08-051-1/+1
| | | | | | | | | 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>
* gpllib: More errno fixesPierre-Alexandre Meyer2009-08-053-34/+38
| | | | | | | | * 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>
* disklib: Change read/write interfacePierre-Alexandre Meyer2009-08-053-7/+55
| | | | | | | 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>
* gpllib: Add copyright/license information (disklib)Pierre-Alexandre Meyer2009-04-308-0/+102
| | | | | | | | | | | 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>
* gpllib: Add parse_partition_table() to iterate through all partitions on a diskPierre-Alexandre Meyer2009-04-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* gpllib: Add swsusp_check to check for swsusp signaturePierre-Alexandre Meyer2009-04-211-0/+19
| | | | | | | | | | 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>
* gpllib: Propagate error codes in disk libraryPierre-Alexandre Meyer2009-04-212-11/+17
| | | | | | | | | 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>
* gpllib: Move partition declarations to disk/partition.hPierre-Alexandre Meyer2009-04-212-17/+23
| | | | | | Add a new file for partition related structures. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
* gpllib: Move get_error from disk/util.c to disk/error.cPierre-Alexandre Meyer2009-04-211-0/+4
| | | | | | | 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>
* gpllib: Add disk/common.h for shared definitionsPierre-Alexandre Meyer2009-04-212-10/+19
| | | | | | | 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>
* gpllib: Add partition table structure (disk)Pierre-Alexandre Meyer2009-04-191-0/+16
| | | | | | | | | | | 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>
* gpllib: Add read_mbr helper (disk)Pierre-Alexandre Meyer2009-04-191-0/+1
| | | | | | | | | 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>
* gpllib: Don't clobber legacy C/H/S parameters with EDD onesPierre-Alexandre Meyer2009-04-191-23/+30
| | | | | | | | | | | | | | 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>
* hdt: Fix typo in device_parameter structPierre-Alexandre Meyer2009-04-191-1/+1
| | | | | | cheksum should read checksum. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
* gpllib: Add disk libraryPierre-Alexandre Meyer2009-04-194-0/+335
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>