[LTP] [PATCH v4 12/31] testcases: sysfs: Add sys_ata01

Petr Vorel pvorel@suse.cz
Thu Sep 3 17:59:06 CEST 2026


Hi Cyril,

...
> +++ b/testcases/kernel/sysfs/class/ata_device/sys_ata01.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2026 Cyril Hrubis <chrubis@suse.cz>
> + */
> +
> +/*\
> + * Sanity checks for the ATA device attributes exported under
> + * /sys/class/ata_device/<dev>/.
> + *
> + * For every ATA device the test verifies that:
> + *
> + * - class is one of the known libata device classes (ata, atapi, pmp, semb,
> + *   unknown, zac, none). none is a legitimate value here, not just a range
> + *   extension for safety: ata_tdev_add() in drivers/ata/libata-transport.c
> + *   creates a transport device object for every possible device slot on a
> + *   link (e.g. both the master/slave slots on a PATA link), regardless of
> + *   whether a physical device is actually attached to it, so an empty slot
> + *   reports class = none rather than not existing at all.
> + * - dma_mode, pio_mode and xfer_mode, when non-empty, start with the
> + *   ``XFER_`` prefix used by all libata transfer mode names
> + * - spdn_cnt (speed-down count) is non-negative
> + *
> + * dma_mode is legitimately empty for devices that only support PIO, so it is
> + * only checked when present.
> + *
> + * The test skips with TCONF when no ATA device is present.
> + */
> +
> +#include <string.h>
> +#include <dirent.h>
> +#include "tst_test.h"
> +#include "tst_sysfs_assert.h"
> +#include "tst_path_defs.h"
> +
> +static const char *const class_allowed[] = {
> +	"ata", "atapi", "pmp", "semb", "unknown", "zac", "none", NULL
Lol, I'd expect this would be part of Documentation/ABI/testing/sysfs-ata
but it's only in the sources (drivers/ata/libata-transport.c).

You mentioned that by findings of this patchset kernel doc could be improved :).

Kind regards,
Petr


More information about the ltp mailing list