4 Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
6 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
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <sys/ioctl.h>
26 /* Snagged from linux/include/asm-ia64/ioctl.h */
28 #define _IOC_TYPEBITS 8
29 #define _IOC_SIZEBITS 14
30 #define _IOC_DIRBITS 2
32 #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
33 #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
34 #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
35 #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
37 #define _IOC_NRSHIFT 0
38 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
39 #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
40 #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
49 #define _IOC(dir,type,nr,size) \
50 (((dir) << _IOC_DIRSHIFT) | \
51 ((type) << _IOC_TYPESHIFT) | \
52 ((nr) << _IOC_NRSHIFT) | \
53 ((size) << _IOC_SIZESHIFT))
55 /* used to create numbers */
56 #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
59 /* Snagged from linux/include/linux/fs.h */
60 #define BLKGETSIZE _IO(0x12,96) /* return device size */
63 enum _bus_type {bus_type_unknown, isa, pci};
64 enum _interface_type {interface_type_unknown,
65 ata, atapi, scsi, usb,
66 i1394, fibre, i2o, md};
68 int disk_get_pci(int fd,
70 unsigned char *device,
71 unsigned char *function);
73 int disk_info_from_fd(int fd,
75 unsigned int *controllernum,
76 unsigned int *disknum,
79 int disk_get_partition_info (int fd,
81 uint64_t *start, uint64_t *size,
83 uint8_t *mbr_type, uint8_t *signature_type);
86 int disk_get_size(int fd, long *size);
87 int get_sector_size(int fd);