summaryrefslogtreecommitdiffstats
path: root/lib/blkdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/blkdev.c')
-rw-r--r--lib/blkdev.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/blkdev.c b/lib/blkdev.c
index 3f652bb60..9138b0d85 100644
--- a/lib/blkdev.c
+++ b/lib/blkdev.c
@@ -243,6 +243,19 @@ int blkdev_is_misaligned(int fd)
#endif
}
+int blkdev_is_cdrom(int fd)
+{
+#ifdef CDROM_GET_CAPABILITY
+ int ret;
+
+ if ((ret = ioctl(fd, CDROM_GET_CAPABILITY, NULL)) < 0)
+ return 0;
+ else
+ return ret;
+#else
+ return 0;
+#endif
+}
#ifdef TEST_PROGRAM
#include <stdio.h>