diff options
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/blkpg.h | 28 | ||||
| -rw-r--r-- | include/uapi/linux/can.h | 2 | ||||
| -rw-r--r-- | include/uapi/linux/ethtool.h | 54 | ||||
| -rw-r--r-- | include/uapi/linux/rfkill.h | 80 | 
4 files changed, 104 insertions, 60 deletions
| diff --git a/include/uapi/linux/blkpg.h b/include/uapi/linux/blkpg.h index ac6474e4f29d..d0a64ee97c6d 100644 --- a/include/uapi/linux/blkpg.h +++ b/include/uapi/linux/blkpg.h @@ -2,29 +2,6 @@  #ifndef _UAPI__LINUX_BLKPG_H  #define _UAPI__LINUX_BLKPG_H -/* - * Partition table and disk geometry handling - * - * A single ioctl with lots of subfunctions: - * - * Device number stuff: - *    get_whole_disk()		(given the device number of a partition, - *                               find the device number of the encompassing disk) - *    get_all_partitions()	(given the device number of a disk, return the - *				 device numbers of all its known partitions) - * - * Partition stuff: - *    add_partition() - *    delete_partition() - *    test_partition_in_use()	(also for test_disk_in_use) - * - * Geometry stuff: - *    get_geometry() - *    set_geometry() - *    get_bios_drivedata() - * - * For today, only the partition stuff - aeb, 990515 - */  #include <linux/compiler.h>  #include <linux/ioctl.h> @@ -52,9 +29,8 @@ struct blkpg_partition {  	long long start;		/* starting offset in bytes */  	long long length;		/* length in bytes */  	int pno;			/* partition number */ -	char devname[BLKPG_DEVNAMELTH];	/* partition name, like sda5 or c0d1p2, -					   to be used in kernel messages */ -	char volname[BLKPG_VOLNAMELTH];	/* volume label */ +	char devname[BLKPG_DEVNAMELTH];	/* unused / ignored */ +	char volname[BLKPG_VOLNAMELTH];	/* unused / ignore */  };  #endif /* _UAPI__LINUX_BLKPG_H */ diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h index f75238ac6dce..c7535352fef6 100644 --- a/include/uapi/linux/can.h +++ b/include/uapi/linux/can.h @@ -113,7 +113,7 @@ struct can_frame {  		 */  		__u8 len;  		__u8 can_dlc; /* deprecated */ -	}; +	} __attribute__((packed)); /* disable padding added in some ABIs */  	__u8 __pad; /* padding */  	__u8 __res0; /* reserved / padding */  	__u8 len8_dlc; /* optional DLC for 8 byte payload length (9 .. 15) */ diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index cde753bb2093..5afea692a3f7 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -26,6 +26,14 @@   * have the same layout for 32-bit and 64-bit userland.   */ +/* Note on reserved space. + * Reserved fields must not be accessed directly by user space because + * they may be replaced by a different field in the future. They must + * be initialized to zero before making the request, e.g. via memset + * of the entire structure or implicitly by not being set in a structure + * initializer. + */ +  /**   * struct ethtool_cmd - DEPRECATED, link control and status   * This structure is DEPRECATED, please use struct ethtool_link_settings. @@ -67,6 +75,7 @@   *	and other link features that the link partner advertised   *	through autonegotiation; 0 if unknown or not applicable.   *	Read-only. + * @reserved: Reserved for future use; see the note on reserved space.   *   * The link speed in Mbps is split between @speed and @speed_hi.  Use   * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to @@ -155,6 +164,7 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)   * @bus_info: Device bus address.  This should match the dev_name()   *	string for the underlying bus device, if there is one.  May be   *	an empty string. + * @reserved2: Reserved for future use; see the note on reserved space.   * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and   *	%ETHTOOL_SPFLAGS commands; also the number of strings in the   *	%ETH_SS_PRIV_FLAGS set @@ -356,6 +366,7 @@ struct ethtool_eeprom {   * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting   *	its tx lpi (after reaching 'idle' state). Effective only when eee   *	was negotiated and tx_lpi_enabled was set. + * @reserved: Reserved for future use; see the note on reserved space.   */  struct ethtool_eee {  	__u32	cmd; @@ -374,6 +385,7 @@ struct ethtool_eee {   * @cmd: %ETHTOOL_GMODULEINFO   * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx   * @eeprom_len: Length of the eeprom + * @reserved: Reserved for future use; see the note on reserved space.   *   * This structure is used to return the information to   * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. @@ -579,9 +591,7 @@ struct ethtool_pauseparam {  	__u32	tx_pause;  }; -/** - * enum ethtool_link_ext_state - link extended state - */ +/* Link extended state */  enum ethtool_link_ext_state {  	ETHTOOL_LINK_EXT_STATE_AUTONEG,  	ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, @@ -595,10 +605,7 @@ enum ethtool_link_ext_state {  	ETHTOOL_LINK_EXT_STATE_OVERHEAT,  }; -/** - * enum ethtool_link_ext_substate_autoneg - more information in addition to - * ETHTOOL_LINK_EXT_STATE_AUTONEG. - */ +/* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */  enum ethtool_link_ext_substate_autoneg {  	ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1,  	ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED, @@ -608,9 +615,7 @@ enum ethtool_link_ext_substate_autoneg {  	ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD,  }; -/** - * enum ethtool_link_ext_substate_link_training - more information in addition to - * ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE. +/* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE.   */  enum ethtool_link_ext_substate_link_training {  	ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1, @@ -619,9 +624,7 @@ enum ethtool_link_ext_substate_link_training {  	ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT,  }; -/** - * enum ethtool_link_ext_substate_logical_mismatch - more information in addition - * to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH. +/* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH.   */  enum ethtool_link_ext_substate_link_logical_mismatch {  	ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1, @@ -631,19 +634,14 @@ enum ethtool_link_ext_substate_link_logical_mismatch {  	ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED,  }; -/** - * enum ethtool_link_ext_substate_bad_signal_integrity - more information in - * addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY. +/* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY.   */  enum ethtool_link_ext_substate_bad_signal_integrity {  	ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,  	ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,  }; -/** - * enum ethtool_link_ext_substate_cable_issue - more information in - * addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. - */ +/* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */  enum ethtool_link_ext_substate_cable_issue {  	ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,  	ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, @@ -661,6 +659,7 @@ enum ethtool_link_ext_substate_cable_issue {   *	now deprecated   * @ETH_SS_FEATURES: Device feature names   * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names + * @ETH_SS_TUNABLES: tunable names   * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS   * @ETH_SS_PHY_TUNABLES: PHY tunable names   * @ETH_SS_LINK_MODES: link mode names @@ -670,6 +669,8 @@ enum ethtool_link_ext_substate_cable_issue {   * @ETH_SS_TS_TX_TYPES: timestamping Tx types   * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters   * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types + * + * @ETH_SS_COUNT: number of defined string sets   */  enum ethtool_stringset {  	ETH_SS_TEST		= 0, @@ -715,6 +716,7 @@ struct ethtool_gstrings {  /**   * struct ethtool_sset_info - string set information   * @cmd: Command number = %ETHTOOL_GSSET_INFO + * @reserved: Reserved for future use; see the note on reserved space.   * @sset_mask: On entry, a bitmask of string sets to query, with bits   *	numbered according to &enum ethtool_stringset.  On return, a   *	bitmask of those string sets queried that are supported. @@ -759,6 +761,7 @@ enum ethtool_test_flags {   * @flags: A bitmask of flags from &enum ethtool_test_flags.  Some   *	flags may be set by the user on entry; others may be set by   *	the driver on return. + * @reserved: Reserved for future use; see the note on reserved space.   * @len: On return, the number of test results   * @data: Array of test results   * @@ -959,6 +962,7 @@ union ethtool_flow_union {   * @vlan_etype: VLAN EtherType   * @vlan_tci: VLAN tag control information   * @data: user defined data + * @padding: Reserved for future use; see the note on reserved space.   *   * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT   * is set in &struct ethtool_rx_flow_spec @flow_type. @@ -1134,7 +1138,8 @@ struct ethtool_rxfh_indir {   *	hardware hash key.   * @hfunc: Defines the current RSS hash function used by HW (or to be set to).   *	Valid values are one of the %ETH_RSS_HASH_*. - * @rsvd:	Reserved for future extensions. + * @rsvd8: Reserved for future use; see the note on reserved space. + * @rsvd32: Reserved for future use; see the note on reserved space.   * @rss_config: RX ring/queue index for each hash value i.e., indirection table   *	of @indir_size __u32 elements, followed by hash key of @key_size   *	bytes. @@ -1302,7 +1307,9 @@ struct ethtool_sfeatures {   * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags   * @phc_index: device index of the associated PHC, or -1 if there is none   * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values + * @tx_reserved: Reserved for future use; see the note on reserved space.   * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values + * @rx_reserved: Reserved for future use; see the note on reserved space.   *   * The bits in the 'tx_types' and 'rx_filters' fields correspond to   * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, @@ -1958,6 +1965,11 @@ enum ethtool_reset_flags {   *	autonegotiation; 0 if unknown or not applicable.  Read-only.   * @transceiver: Used to distinguish different possible PHY types,   *	reported consistently by PHYLIB.  Read-only. + * @master_slave_cfg: Master/slave port mode. + * @master_slave_state: Master/slave port state. + * @reserved: Reserved for future use; see the note on reserved space. + * @reserved1: Reserved for future use; see the note on reserved space. + * @link_mode_masks: Variable length bitmaps.   *   * If autonegotiation is disabled, the speed and @duplex represent the   * fixed link mode and are writable if the driver supports multiple diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h index 03e8af87b364..9b77cfc42efa 100644 --- a/include/uapi/linux/rfkill.h +++ b/include/uapi/linux/rfkill.h @@ -86,34 +86,90 @@ enum rfkill_hard_block_reasons {   * @op: operation code   * @hard: hard state (0/1)   * @soft: soft state (0/1) + * + * Structure used for userspace communication on /dev/rfkill, + * used for events from the kernel and control to the kernel. + */ +struct rfkill_event { +	__u32 idx; +	__u8  type; +	__u8  op; +	__u8  soft; +	__u8  hard; +} __attribute__((packed)); + +/** + * struct rfkill_event_ext - events for userspace on /dev/rfkill + * @idx: index of dev rfkill + * @type: type of the rfkill struct + * @op: operation code + * @hard: hard state (0/1) + * @soft: soft state (0/1)   * @hard_block_reasons: valid if hard is set. One or several reasons from   *	&enum rfkill_hard_block_reasons.   *   * Structure used for userspace communication on /dev/rfkill,   * used for events from the kernel and control to the kernel. + * + * See the extensibility docs below.   */ -struct rfkill_event { +struct rfkill_event_ext {  	__u32 idx;  	__u8  type;  	__u8  op;  	__u8  soft;  	__u8  hard; + +	/* +	 * older kernels will accept/send only up to this point, +	 * and if extended further up to any chunk marked below +	 */ +  	__u8  hard_block_reasons;  } __attribute__((packed)); -/* - * We are planning to be backward and forward compatible with changes - * to the event struct, by adding new, optional, members at the end. - * When reading an event (whether the kernel from userspace or vice - * versa) we need to accept anything that's at least as large as the - * version 1 event size, but might be able to accept other sizes in - * the future. +/** + * DOC: Extensibility + * + * Originally, we had planned to allow backward and forward compatible + * changes by just adding fields at the end of the structure that are + * then not reported on older kernels on read(), and not written to by + * older kernels on write(), with the kernel reporting the size it did + * accept as the result. + * + * This would have allowed userspace to detect on read() and write() + * which kernel structure version it was dealing with, and if was just + * recompiled it would have gotten the new fields, but obviously not + * accessed them, but things should've continued to work. + * + * Unfortunately, while actually exercising this mechanism to add the + * hard block reasons field, we found that userspace (notably systemd) + * did all kinds of fun things not in line with this scheme: + * + * 1. treat the (expected) short writes as an error; + * 2. ask to read sizeof(struct rfkill_event) but then compare the + *    actual return value to RFKILL_EVENT_SIZE_V1 and treat any + *    mismatch as an error. + * + * As a consequence, just recompiling with a new struct version caused + * things to no longer work correctly on old and new kernels. + * + * Hence, we've rolled back &struct rfkill_event to the original version + * and added &struct rfkill_event_ext. This effectively reverts to the + * old behaviour for all userspace, unless it explicitly opts in to the + * rules outlined here by using the new &struct rfkill_event_ext. + * + * Userspace using &struct rfkill_event_ext must adhere to the following + * rules   * - * One exception is the kernel -- we already have two event sizes in - * that we've made the 'hard' member optional since our only option - * is to ignore it anyway. + * 1. accept short writes, optionally using them to detect that it's + *    running on an older kernel; + * 2. accept short reads, knowing that this means it's running on an + *    older kernel; + * 3. treat reads that are as long as requested as acceptable, not + *    checking against RFKILL_EVENT_SIZE_V1 or such.   */ -#define RFKILL_EVENT_SIZE_V1	8 +#define RFKILL_EVENT_SIZE_V1	sizeof(struct rfkill_event)  /* ioctl for turning off rfkill-input (if present) */  #define RFKILL_IOC_MAGIC	'R' |