1 |
/* device.c - Some helper functions for OS devices and BIOS drives */ |
/* device.c - Some helper functions for OS devices and BIOS drives */ |
2 |
/* |
/* |
3 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
4 |
* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
42 |
# include <linux/unistd.h> /* _llseek */ |
# include <linux/unistd.h> /* _llseek */ |
43 |
# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ |
# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */ |
44 |
# include <sys/ioctl.h> /* ioctl */ |
# include <sys/ioctl.h> /* ioctl */ |
45 |
# include <linux/hdreg.h> /* HDIO_GETGEO */ |
# ifndef HDIO_GETGEO |
46 |
# include <linux/major.h> /* FLOPPY_MAJOR */ |
# define HDIO_GETGEO 0x0301 /* get device geometry */ |
47 |
# include <linux/kdev_t.h> /* MAJOR */ |
/* If HDIO_GETGEO is not defined, it is unlikely that hd_geometry is |
48 |
|
defined. */ |
49 |
|
struct hd_geometry |
50 |
|
{ |
51 |
|
unsigned char heads; |
52 |
|
unsigned char sectors; |
53 |
|
unsigned short cylinders; |
54 |
|
unsigned long start; |
55 |
|
}; |
56 |
|
# endif /* ! HDIO_GETGEO */ |
57 |
|
# ifndef FLOPPY_MAJOR |
58 |
|
# define FLOPPY_MAJOR 2 /* the major number for floppy */ |
59 |
|
# endif /* ! FLOPPY_MAJOR */ |
60 |
|
# ifndef MAJOR |
61 |
|
# ifndef MINORBITS |
62 |
|
# define MINORBITS 8 |
63 |
|
# endif /* ! MINORBITS */ |
64 |
|
# define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) |
65 |
|
# endif /* ! MAJOR */ |
66 |
# ifndef CDROM_GET_CAPABILITY |
# ifndef CDROM_GET_CAPABILITY |
67 |
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
68 |
# endif /* ! CDROM_GET_CAPABILITY */ |
# endif /* ! CDROM_GET_CAPABILITY */ |