summaryrefslogtreecommitdiffstats
path: root/include/blkdev.h
diff options
context:
space:
mode:
authorSamuel Thibault2008-07-24 00:30:21 +0200
committerKarel Zak2008-07-24 00:52:52 +0200
commit268cefe6cb34fb8799b34187677154071ad45eb7 (patch)
tree7a98c7f45eae4ec54f6a150b0eaf3eb6d5c3abea /include/blkdev.h
parentmount: s/MOUNTED/_PATH_MOUNTED/ (diff)
downloadkernel-qcow2-util-linux-268cefe6cb34fb8799b34187677154071ad45eb7.tar.gz
kernel-qcow2-util-linux-268cefe6cb34fb8799b34187677154071ad45eb7.tar.xz
kernel-qcow2-util-linux-268cefe6cb34fb8799b34187677154071ad45eb7.zip
lib: blkdev.c clean up, non-linux support
[kzak@redhat.com: split the original patch to small patches] Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/blkdev.h')
-rw-r--r--include/blkdev.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/blkdev.h b/include/blkdev.h
index 1f0fe674e..1b10569b9 100644
--- a/include/blkdev.h
+++ b/include/blkdev.h
@@ -6,7 +6,7 @@
#define DEFAULT_SECTOR_SIZE 512
-#ifndef BLKROSET
+#if !defined(BLKROSET) && defined(__linux__)
#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
@@ -34,7 +34,9 @@
#endif /* BLKROSET */
#ifndef HDIO_GETGEO
-#define HDIO_GETGEO 0x0301
+# ifdef __linux__
+# define HDIO_GETGEO 0x0301
+# endif
struct hd_geometry {
unsigned char heads;
unsigned char sectors;
@@ -43,6 +45,9 @@ struct hd_geometry {
};
#endif
+/* Determine size in bytes */
+off_t blkdev_find_size (int fd);
+
/* get size in bytes */
int blkdev_get_size(int fd, unsigned long long *bytes);
@@ -52,5 +57,4 @@ int blkdev_get_sectors(int fd, unsigned long long *sectors);
/* get hardware sector size */
int blkdev_get_sector_size(int fd, int *sector_size);
-
#endif /* BLKDEV_H */