Linux: Add support for the zoned block device ioctls

Shingled magnetic recording drives support a command set called ZBC
(Zoned Block Commands). Two new ioctls have been added to the Linux
kernel to support such drives, namely VKI_BLKREPORTZONE and
VKI_BLKRESETZONE. Add support to Valgrind for these ioctls.
This commit is contained in:
Bart Van Assche 2018-03-08 12:57:41 -08:00
parent ccd1e177ee
commit a05d86e562
3 changed files with 47 additions and 0 deletions

1
NEWS
View File

@ -97,6 +97,7 @@ where XXXXXX is the bug number as listed below.
n-i-bz Fix missing workq_ops operations (macOS)
n-i-bz fix bug in strspn replacement
n-i-bz Add support for the Linux BLKFLSBUF ioctl
n-i-bz Add support for the Linux BLKREPORTZONE and BLKRESETZONE ioctls
Release 3.13.0 (15 June 2017)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -6919,6 +6919,14 @@ PRE(sys_ioctl)
case VKI_BLKDISCARDZEROES:
PRE_MEM_WRITE( "ioctl(BLKDISCARDZEROES)", ARG3, sizeof(vki_uint));
break;
case VKI_BLKREPORTZONE:
PRE_MEM_READ("ioctl(BLKREPORTZONE)", ARG3,
sizeof(struct vki_blk_zone_report));
break;
case VKI_BLKRESETZONE:
PRE_MEM_READ("ioctl(BLKRESETZONE)", ARG3,
sizeof(struct vki_blk_zone_range));
break;
/* Hard disks */
case VKI_HDIO_GETGEO: /* 0x0301 */
@ -9672,6 +9680,14 @@ POST(sys_ioctl)
case VKI_BLKDISCARDZEROES:
POST_MEM_WRITE(ARG3, sizeof(vki_uint));
break;
case VKI_BLKREPORTZONE: {
const struct vki_blk_zone_report *zr = (void *)ARG3;
POST_MEM_WRITE(ARG3, sizeof(*zr) + zr->nr_zones * sizeof(zr->zones[0]));
break;
}
case VKI_BLKRESETZONE:
break;
/* Hard disks */
case VKI_HDIO_GETGEO: /* 0x0301 */

View File

@ -4760,6 +4760,36 @@ struct vki_serial_struct {
#endif // __VKI_LINUX_H
//----------------------------------------------------------------------
// From linux-4.10/include/uapi/linux/blkzoned.h
//----------------------------------------------------------------------
struct vki_blk_zone {
__vki_u64 start;
__vki_u64 len;
__vki_u64 wp;
__vki_u8 type;
__vki_u8 cond;
__vki_u8 non_seq;
__vki_u8 reset;
__vki_u8 reserved[36];
};
struct vki_blk_zone_report {
__vki_u64 sector;
__vki_u32 nr_zones;
__vki_u8 reserved[4];
struct vki_blk_zone zones[0];
};
struct vki_blk_zone_range {
__vki_u64 sector;
__vki_u64 nr_sectors;
};
#define VKI_BLKREPORTZONE _VKI_IOWR(0x12, 130, struct vki_blk_zone_report)
#define VKI_BLKRESETZONE _VKI_IOW(0x12, 131, struct vki_blk_zone_range)
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/