~ubuntu-branches/ubuntu/quantal/util-linux/quantal

« back to all changes in this revision

Viewing changes to include/blkdev.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-06-20 22:31:50 UTC
  • mfrom: (1.6.3 upstream) (4.5.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110620223150-lz8wrv0946ihcz3z
Tags: 2.19.1-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - Build for multiarch.
  - Add pre-depends on multiarch-support.
  - configure.ac: don't try to be clever about extracting a path name from
    $libdir to append to /usr in a way that's not overridable; instead,
    reuse the built-in configurable libexecdir.
  - Fix up the .pc.in files to know about libexecdir, so our substitutions
    don't leave us with unusable pkg-config files.
  - Install custom blkid.conf to use /dev/.blkid.tab since we don't
    expect device names to survive a reboot
  - Mention mountall(8) in fstab(5) manpages, along with its special
    options.
  - Since upstart is required in Ubuntu, the hwclock.sh init script is not
    called on startup and the hwclockfirst.sh init script is removed.
  - Drop depends on initscripts for the above.
  - Replace hwclock udev rule with an Upstart job.
  - For the case where mount is called with a directory to mount, look
    that directory up in mountall's /lib/init/fstab if we couldn't find
    it mentioned anywhere else.  This means "mount /proc", "mount /sys",
    etc. work.
  - mount.8 points to the cifs-utils package, not the obsolete smbfs one. 
* Dropped changes:
  - mount.preinst: lsb_release has been fixed in lucid and above to be
    usable without configuration, so we don't have to diverge from Debian
    here anymore.
* Changes merged upstream:
  - sfdisk support for '+' with '-N'
  - mount/umount.c: fix a segfault on umount with empty mtab entry
  - Fix arbitrary unmount with fuse security issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#include <sys/types.h>
5
5
#include <sys/ioctl.h>
 
6
#ifdef HAVE_SYS_IOCCOM_H
 
7
# include <sys/ioccom.h> /* for _IO macro on e.g. Solaris */
 
8
#endif
6
9
#include <fcntl.h>
7
10
#include <unistd.h>
8
11
 
 
12
#if HAVE_SYS_MKDEV_H
 
13
# include <sys/mkdev.h>         /* major and minor on Solaris */
 
14
#endif
 
15
 
9
16
#define DEFAULT_SECTOR_SIZE       512
10
17
 
11
 
/* open() retries when errno is ENOMEDIUM */
12
 
#define CRDOM_NOMEDIUM_RETRIES    5
13
 
 
14
 
#if !defined(BLKROSET) && defined(__linux__)
15
 
 
16
 
#define BLKROSET   _IO(0x12,93) /* set device read-only (0 = read-write) */
17
 
#define BLKROGET   _IO(0x12,94) /* get read-only status (0 = read_write) */
18
 
#define BLKRRPART  _IO(0x12,95) /* re-read partition table */
19
 
#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
20
 
#define BLKFLSBUF  _IO(0x12,97) /* flush buffer cache */
21
 
#define BLKRASET   _IO(0x12,98) /* set read ahead for block device */
22
 
#define BLKRAGET   _IO(0x12,99) /* get current read ahead setting */
23
 
#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
24
 
#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
25
 
#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
26
 
#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
27
 
#define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
 
18
#ifdef __linux__
 
19
/* very basic ioclts, should be available everywhere */
 
20
# ifndef BLKROSET
 
21
#  define BLKROSET   _IO(0x12,93)       /* set device read-only (0 = read-write) */
 
22
#  define BLKROGET   _IO(0x12,94)       /* get read-only status (0 = read_write) */
 
23
#  define BLKRRPART  _IO(0x12,95)       /* re-read partition table */
 
24
#  define BLKGETSIZE _IO(0x12,96)       /* return device size /512 (long *arg) */
 
25
#  define BLKFLSBUF  _IO(0x12,97)       /* flush buffer cache */
 
26
#  define BLKRASET   _IO(0x12,98)       /* set read ahead for block device */
 
27
#  define BLKRAGET   _IO(0x12,99)       /* get current read ahead setting */
 
28
#  define BLKFRASET  _IO(0x12,100)      /* set filesystem (mm/filemap.c) read-ahead */
 
29
#  define BLKFRAGET  _IO(0x12,101)      /* get filesystem (mm/filemap.c) read-ahead */
 
30
#  define BLKSECTSET _IO(0x12,102)      /* set max sectors per request (ll_rw_blk.c) */
 
31
#  define BLKSECTGET _IO(0x12,103)      /* get max sectors per request (ll_rw_blk.c) */
 
32
#  define BLKSSZGET  _IO(0x12,104)      /* get block device sector size */
28
33
 
29
34
/* ioctls introduced in 2.2.16, removed in 2.5.58 */
30
 
#define BLKELVGET  _IOR(0x12,106,size_t) /* elevator get */
31
 
#define BLKELVSET  _IOW(0x12,107,size_t) /* elevator set */
32
 
 
33
 
#define BLKBSZGET  _IOR(0x12,112,size_t)
34
 
#define BLKBSZSET  _IOW(0x12,113,size_t)
35
 
#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
36
 
 
37
 
#endif /* BLKROSET */
38
 
 
39
 
/* block device topology ioctls, introduced in 2.6.32 */
40
 
#ifndef BLKIOMIN
41
 
#define BLKIOMIN   _IO(0x12,120)
42
 
#define BLKIOOPT   _IO(0x12,121)
43
 
#define BLKALIGNOFF _IO(0x12,122)
44
 
#define BLKPBSZGET _IO(0x12,123)
 
35
#  define BLKELVGET  _IOR(0x12,106,size_t) /* elevator get */
 
36
#  define BLKELVSET  _IOW(0x12,107,size_t) /* elevator set */
 
37
 
 
38
#  define BLKBSZGET  _IOR(0x12,112,size_t)
 
39
#  define BLKBSZSET  _IOW(0x12,113,size_t)
 
40
# endif /* !BLKROSET */
 
41
 
 
42
# ifndef BLKGETSIZE64
 
43
#  define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
 
44
# endif
 
45
 
 
46
/* block device topology ioctls, introduced in 2.6.32 (commit ac481c20) */
 
47
# ifndef BLKIOMIN
 
48
#  define BLKIOMIN   _IO(0x12,120)
 
49
#  define BLKIOOPT   _IO(0x12,121)
 
50
#  define BLKALIGNOFF _IO(0x12,122)
 
51
#  define BLKPBSZGET _IO(0x12,123)
 
52
# endif
 
53
 
 
54
/* discard zeroes support, introduced in 2.6.33 (commit 98262f27) */
 
55
# ifndef BLKDISCARDZEROES
 
56
#  define BLKDISCARDZEROES _IO(0x12,124)
 
57
# endif
 
58
 
 
59
/* filesystem freeze, introduced in 2.6.29 (commit fcccf502) */
 
60
# ifndef FIFREEZE
 
61
#  define FIFREEZE   _IOWR('X', 119, int)    /* Freeze */
 
62
#  define FITHAW     _IOWR('X', 120, int)    /* Thaw */
 
63
# endif
 
64
 
 
65
#endif /* __linux */
 
66
 
 
67
#ifdef APPLE_DARWIN
 
68
# define BLKGETSIZE DKIOCGETBLOCKCOUNT32
45
69
#endif
46
70
 
47
71
#ifndef HDIO_GETGEO