/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Zoned block devices handling. * * Copyright (C) 2015 Seagate Technology PLC * * Written by: Shaun Tancheff <[email protected]> * * Modified by: Damien Le Moal <[email protected]> * Copyright (C) 2016 Western Digital * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #ifndef _UAPI_BLKZONED_H #define _UAPI_BLKZONED_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum blk_zone_type - Types of zones allowed in a zoned device. * * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen * randomly. Zone reset has no effect on the zone. * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially * * Any other value not defined is reserved and must be considered as invalid. */ enum blk_zone_type { … }; /** * enum blk_zone_cond - Condition [state] of a zone in a zoned device. * * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional. * @BLK_ZONE_COND_EMPTY: The zone is empty. * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened. * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an * OPEN ZONE command. * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing. * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone * FINISH ZONE command. * @BLK_ZONE_COND_READONLY: The zone is read-only. * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written). * * The Zone Condition state machine in the ZBC/ZAC standards maps the above * deinitions as: * - ZC1: Empty | BLK_ZONE_COND_EMPTY * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN * - ZC4: Closed | BLK_ZONE_COND_CLOSED * - ZC5: Full | BLK_ZONE_COND_FULL * - ZC6: Read Only | BLK_ZONE_COND_READONLY * - ZC7: Offline | BLK_ZONE_COND_OFFLINE * * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should * be considered invalid. */ enum blk_zone_cond { … }; /** * enum blk_zone_report_flags - Feature flags of reported zone descriptors. * * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field. */ enum blk_zone_report_flags { … }; /** * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl. * * @start: Zone start in 512 B sector units * @len: Zone length in 512 B sector units * @wp: Zone write pointer location in 512 B sector units * @type: see enum blk_zone_type for possible values * @cond: see enum blk_zone_cond for possible values * @non_seq: Flag indicating that the zone is using non-sequential resources * (for host-aware zoned block devices only). * @reset: Flag indicating that a zone reset is recommended. * @resv: Padding for 8B alignment. * @capacity: Zone usable capacity in 512 B sector units * @reserved: Padding to 64 B to match the ZBC, ZAC and ZNS defined zone * descriptor size. * * start, len, capacity and wp use the regular 512 B sector unit, regardless * of the device logical block size. The overall structure size is 64 B to * match the ZBC, ZAC and ZNS defined zone descriptor and allow support for * future additional zone information. */ struct blk_zone { … }; /** * struct blk_zone_report - BLKREPORTZONE ioctl request/reply * * @sector: starting sector of report * @nr_zones: IN maximum / OUT actual * @flags: one or more flags as defined by enum blk_zone_report_flags. * @zones: Space to hold @nr_zones @zones entries on reply. * * The array of at most @nr_zones must follow this structure in memory. */ struct blk_zone_report { … }; /** * struct blk_zone_range - BLKRESETZONE/BLKOPENZONE/ * BLKCLOSEZONE/BLKFINISHZONE ioctl * requests * @sector: Starting sector of the first zone to operate on. * @nr_sectors: Total number of sectors of all zones to operate on. */ struct blk_zone_range { … }; /** * Zoned block device ioctl's: * * @BLKREPORTZONE: Get zone information. Takes a zone report as argument. * The zone report will start from the zone containing the * sector specified in the report request structure. * @BLKRESETZONE: Reset the write pointer of the zones in the specified * sector range. The sector range must be zone aligned. * @BLKGETZONESZ: Get the device zone size in number of 512 B sectors. * @BLKGETNRZONES: Get the total number of zones of the device. * @BLKOPENZONE: Open the zones in the specified sector range. * The 512 B sector range must be zone aligned. * @BLKCLOSEZONE: Close the zones in the specified sector range. * The 512 B sector range must be zone aligned. * @BLKFINISHZONE: Mark the zones as full in the specified sector range. * The 512 B sector range must be zone aligned. */ #define BLKREPORTZONE … #define BLKRESETZONE … #define BLKGETZONESZ … #define BLKGETNRZONES … #define BLKOPENZONE … #define BLKCLOSEZONE … #define BLKFINISHZONE … #endif /* _UAPI_BLKZONED_H */