summaryrefslogtreecommitdiffstats
path: root/include/blkdev.h
diff options
context:
space:
mode:
authorKarel Zak2012-06-15 12:44:17 +0200
committerKarel Zak2012-06-15 12:44:17 +0200
commitd5f9b6e5fb352c632655e442773df96129cea02d (patch)
treea260ed26fd77e54280d1370f0b8e7a41aa1fe380 /include/blkdev.h
parentlibmount: make some string operations more robust (diff)
parentlsblk: use blkdev_scsi_type_to_name() (diff)
downloadkernel-qcow2-util-linux-d5f9b6e5fb352c632655e442773df96129cea02d.tar.gz
kernel-qcow2-util-linux-d5f9b6e5fb352c632655e442773df96129cea02d.tar.xz
kernel-qcow2-util-linux-d5f9b6e5fb352c632655e442773df96129cea02d.zip
Merge branch '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit
* '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit: lsblk: use blkdev_scsi_type_to_name() blkdev: add blkdev_scsi_type_to_name() wipefs: use symbolic value for markup mode eject: inform if CD-ROM drive is not ready docs: clean up partx.8 manual include: fix void pointer arithmetics warnings sysfs: fix printf format warnings build: fix unused parameter warnings build: fix redundant redeclaration warnings include: fix spurious list.h warnings uuidd: use output redirection which works [checkbashisms] blkid: fix realloc memory leak [cppcheck] setarch: do not use -1 as array index [cppcheck]
Diffstat (limited to 'include/blkdev.h')
-rw-r--r--include/blkdev.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/blkdev.h b/include/blkdev.h
index 56dbce75c..84c26dd33 100644
--- a/include/blkdev.h
+++ b/include/blkdev.h
@@ -78,6 +78,24 @@
# define CDROM_GET_CAPABILITY 0x5331
#endif
+/* SCSI device types. Copied almost as-is from kernel header.
+ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=include/scsi/scsi.h */
+#define SCSI_TYPE_DISK 0x00
+#define SCSI_TYPE_TAPE 0x01
+#define SCSI_TYPE_PRINTER 0x02
+#define SCSI_TYPE_PROCESSOR 0x03 /* HP scanners use this */
+#define SCSI_TYPE_WORM 0x04 /* Treated as ROM by our system */
+#define SCSI_TYPE_ROM 0x05
+#define SCSI_TYPE_SCANNER 0x06
+#define SCSI_TYPE_MOD 0x07 /* Magneto-optical disk - treated as SCSI_TYPE_DISK */
+#define SCSI_TYPE_MEDIUM_CHANGER 0x08
+#define SCSI_TYPE_COMM 0x09 /* Communications device */
+#define SCSI_TYPE_RAID 0x0c
+#define SCSI_TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
+#define SCSI_TYPE_RBC 0x0e
+#define SCSI_TYPE_OSD 0x11
+#define SCSI_TYPE_NO_LUN 0x7f
+
struct hd_geometry {
unsigned char heads;
unsigned char sectors;
@@ -113,4 +131,7 @@ int blkdev_is_cdrom(int fd);
/* get device's geometry - legacy */
int blkdev_get_geometry(int fd, unsigned int *h, unsigned int *s);
+/* convert scsi type code to name */
+char *blkdev_scsi_type_to_name(int type);
+
#endif /* BLKDEV_H */