source: bootcd/isolinux/syslinux-6.03/com32/modules/disk.c

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2009 Pierre-Alexandre Meyer - All Rights Reserved
4 *
5 *   This program is free software; you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 *   Boston MA 02110-1301, USA; either version 2 of the License, or
9 *   (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13#include <stdio.h>
14#include <console.h>
15#include <stdlib.h>
16#include <string.h>
17#include <disk/geom.h>
18#include <disk/util.h>
19#include <disk/errno_disk.h>
20#include <disk/error.h>
21
22int main(int argc, char *argv[])
23{
24        struct driveinfo drive;
25        struct driveinfo *d = &drive;
26
27        (void)argc;
28        (void)argv;
29
30        for (int disk = 0x80; disk < 0xff; disk++) {
31                memset(d, 0, sizeof(struct driveinfo));
32                d->disk = disk;
33                get_drive_parameters(d);
34
35                /* Do not print output when drive does not exists */
36                if (errno_disk == -1 || !d->cbios)
37                        continue;
38
39                if (errno_disk) {
40                        get_error("reading disk");
41                        continue;
42                }
43
44                printf("DISK 0x%X:\n", d->disk);
45                printf("  C/H/S: %d heads, %d cylinders\n",
46                        d->legacy_max_head + 1, d->legacy_max_cylinder + 1);
47                printf("         %d sectors/track, %d drives\n",
48                        d->legacy_sectors_per_track, d->legacy_max_drive);
49                printf("  EDD:   ebios=%d, EDD version: %X\n",
50                        d->ebios, d->edd_version);
51                printf("         %d heads, %d cylinders\n",
52                        (int) d->edd_params.heads, (int) d->edd_params.cylinders);
53                printf("         %d sectors, %d bytes/sector, %d sectors/track\n",
54                        (int) d->edd_params.sectors, (int) d->edd_params.bytes_per_sector,
55                        (int) d->edd_params.sectors_per_track);
56                printf("         Host bus: %s, Interface type: %s\n\n",
57                        d->edd_params.host_bus_type, d->edd_params.interface_type);
58        }
59        return 0;
60}
Note: See TracBrowser for help on using the repository browser.