lib/fw.c
/**
 * @brief Check if the boot partition is marked as read-only
 * @param[in]  dev	Switchtec device handle
 * @return 1 if the partition is read-only, 0 if it's not or
 * 	a negative value if an error occurred
 */
@brief Check if the boot partition is marked as read-only
@param[in]  dev      Switchtec device handle
@return 1 if the partition is read-only, 0 if it's not or
a negative value if an error occurred
@brief Check if the boot partition is marked as read - only @param [ in ] dev Switchtec device handle @return 1 if the partition is read - only 0 if it ' s not or a negative value if an error occurred
int switchtec_fw_is_boot_ro(struct switchtec_dev *dev)
{
	struct switchtec_boot_ro subcmd = {
		.subcmd = MRPC_FWDNLD_BOOT_RO,
		.set_get = 0,
	};
	struct {
		uint8_t status;
		uint8_t reserved[3];
	} result;
	int ret;
	ret = switchtec_cmd(dev, MRPC_FWDNLD, &subcmd, sizeof(subcmd),
			    &result, sizeof(result));
	if (ret == ERR_SUBCMD_INVALID) {
		errno = 0;
		return 0;
	}
	if (ret)
		return ret;
	return result.status;
}
int switchtec_fw_is_boot_ro ( struct switchtec_dev * dev ) { struct switchtec_boot_ro subcmd = { . subcmd = MRPC_FWDNLD_BOOT_RO , . set_get = 0 , } ; struct { uint8_t status ; uint8_t reserved [ 3 ] ; } result ; int ret ; ret = switchtec_cmd ( dev , MRPC_FWDNLD , & subcmd , sizeof ( subcmd ) , & result , sizeof ( result ) ) ; if ( ret == ERR_SUBCMD_INVALID ) { errno = 0 ; return 0 ; } if ( ret ) return ret ; return result . status ; }
@brief Check if the boot partition is marked as read-only
 @param[in]  dev      Switchtec device handle
 @return 1 if the partition is read-only, 0 if it's not or
      a negative value if an error occurred
@brief Check if the boot partition is marked as read - only @param [ in ] dev Switchtec device handle @return 1 if the partition is read - only 0 if it ' s not or a negative value if an error occurred