~ubuntu-branches/ubuntu/raring/efibootmgr/raring-proposed

« back to all changes in this revision

Viewing changes to .pc/efibootmgr-0.5.4-support-4k-sectors.patch/src/include/disk.h

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2013-02-01 15:54:24 UTC
  • mfrom: (15.1.3 efibootmgr)
  • Revision ID: package-import@ubuntu.com-20130201155424-cxpynj5jqjvv1b84
Tags: 0.5.4-4ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Fix implementation of -w option to match documentation by leaving an
    existing unique MBR signature intact.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  disk.[ch]
 
3
 
 
4
  Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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
 
19
 */
 
20
 
 
21
#ifndef _DISK_H
 
22
#define _DISK_H
 
23
 
 
24
#include <sys/ioctl.h>
 
25
 
 
26
/* Snagged from linux/include/asm-ia64/ioctl.h */
 
27
#define _IOC_NRBITS     8
 
28
#define _IOC_TYPEBITS   8
 
29
#define _IOC_SIZEBITS   14
 
30
#define _IOC_DIRBITS    2
 
31
 
 
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)
 
36
 
 
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)
 
41
 
 
42
/*
 
43
 * Direction bits.
 
44
 */
 
45
#define _IOC_NONE       0U
 
46
#define _IOC_WRITE      1U
 
47
#define _IOC_READ       2U
 
48
 
 
49
#define _IOC(dir,type,nr,size) \
 
50
        (((dir)  << _IOC_DIRSHIFT) | \
 
51
         ((type) << _IOC_TYPESHIFT) | \
 
52
         ((nr)   << _IOC_NRSHIFT) | \
 
53
         ((size) << _IOC_SIZESHIFT))
 
54
 
 
55
/* used to create numbers */
 
56
#define _IO(type,nr)            _IOC(_IOC_NONE,(type),(nr),0)
 
57
 
 
58
 
 
59
/* Snagged from linux/include/linux/fs.h */
 
60
#define BLKGETSIZE _IO(0x12,96)      /* return device size */
 
61
 
 
62
 
 
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};
 
67
 
 
68
int disk_get_pci(int fd,
 
69
                 unsigned char *bus,
 
70
                 unsigned char *device,
 
71
                 unsigned char *function);
 
72
 
 
73
int disk_info_from_fd(int fd, 
 
74
                      int *interface_type,
 
75
                      unsigned int *controllernum, 
 
76
                      unsigned int *disknum,
 
77
                      unsigned char *part);
 
78
 
 
79
int disk_get_partition_info (int fd, 
 
80
                             uint32_t num,
 
81
                             uint64_t *start, uint64_t *size,
 
82
                             char *signature,
 
83
                             uint8_t *mbr_type, uint8_t *signature_type);
 
84
 
 
85
 
 
86
int disk_get_size(int fd, long *size);
 
87
int get_sector_size(int fd);
 
88
 
 
89
 
 
90
#endif