aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gpllib
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-26 00:31:43 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-26 00:31:43 -0700
commita4af14c5e65f78d77e3b8b2b6673fc1b62e39f4e (patch)
tree72a241d6811573022c6ee7119d206690aaa7b9d4 /com32/gpllib
parent039f904f20fa6d3cbdef637c9704188e0c6b08a5 (diff)
downloadsyslinux-a4af14c5e65f78d77e3b8b2b6673fc1b62e39f4e.tar.gz
syslinux-a4af14c5e65f78d77e3b8b2b6673fc1b62e39f4e.tar.xz
syslinux-a4af14c5e65f78d77e3b8b2b6673fc1b62e39f4e.zip
gpllib: rename bootloader detection to MBR detection
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>
Diffstat (limited to 'com32/gpllib')
-rw-r--r--com32/gpllib/disk/mbrs.c (renamed from com32/gpllib/disk/bootloaders.c)24
1 files changed, 12 insertions, 12 deletions
diff --git a/com32/gpllib/disk/bootloaders.c b/com32/gpllib/disk/mbrs.c
index 2017625d..b5e271b7 100644
--- a/com32/gpllib/disk/bootloaders.c
+++ b/com32/gpllib/disk/mbrs.c
@@ -15,12 +15,12 @@
#include <stdio.h>
/**
- * get_bootloader_string - return a string describing the boot code
+ * get_mbr_string - return a string describing the boot code
* @label: first four bytes of the MBR
* @buffer: pre-allocated buffer
* @buffer_size: @buffer size
**/
-void get_bootloader_string(const uint32_t label, char* buffer, const int buffer_size)
+void get_mbr_string(const uint32_t label, char* buffer, const int buffer_size)
{
/* 2 bytes are usually enough to identify the MBR */
uint16_t s_label = label >> 16;
@@ -48,35 +48,35 @@ void get_bootloader_string(const uint32_t label, char* buffer, const int buffer_
else if ((label >> 8) & 0xff == 0xc0)
strncpy(buffer, "Syslinux", buffer_size - 1);
else
- strncpy(buffer, "Unknown bootloader", buffer_size - 1); break;
+ strncpy(buffer, "Unknown mbr", buffer_size - 1); break;
break;
case 0xfaeb: strncpy(buffer, "Lilo", buffer_size - 1); break;
case 0xfc31: strncpy(buffer, "Testdisk", buffer_size - 1); break;
case 0xfc33: strncpy(buffer, "Gag", buffer_size - 1); break;
case 0xfceb: strncpy(buffer, "BootIT NG", buffer_size - 1); break;
- default: strncpy(buffer, "Unknown bootloader", buffer_size - 1); break;
+ default: strncpy(buffer, "Unknown mbr", buffer_size - 1); break;
}
buffer[buffer_size - 1] = '\0';
}
/**
- * get_bootloader_id - return the first four bytes of the MBR
+ * get_mbr_id - return the first four bytes of the MBR
* @d: driveinfo struct describing the drive
**/
-uint32_t get_bootloader_id(const struct driveinfo *d)
+uint32_t get_mbr_id(const struct driveinfo *d)
{
char mbr[SECTOR * sizeof(char)];
if (read_mbr(d->disk, &mbr) == -1)
return -1;
else {
- uint32_t bootloader_id;
+ uint32_t mbr_id;
/* Reverse the opcodes */
- bootloader_id = (*(uint8_t *) (mbr + 3));
- bootloader_id += (*(uint8_t *) (mbr + 2) << 8);
- bootloader_id += (*(uint8_t *) (mbr + 1) << 16);
- bootloader_id += (*(uint8_t *) mbr) << 24;
- return bootloader_id;
+ mbr_id = (*(uint8_t *) (mbr + 3));
+ mbr_id += (*(uint8_t *) (mbr + 2) << 8);
+ mbr_id += (*(uint8_t *) (mbr + 1) << 16);
+ mbr_id += (*(uint8_t *) mbr) << 24;
+ return mbr_id;
}
}