New test for ioctl(FS_IOC_GETLBMD_CAP) feature
cover New test for ioctl(FS_IOC_GETLBMD_CAP) feature
---
Andrea Cervesato (2):
Add logical_block_metadata_cap struct fallback Add new test ioctl_getlbmd01
configure.ac | 2 + include/lapi/fs.h | 21 ++++++ runtest/syscalls | 2 + testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_getlbmd01.c | 84 +++++++++++++++++++++++ 5 files changed, 110 insertions(+)
---
base-commit: b874b6a264cf4f343c17d543ebe4ff91fbb89042
change-id: 20260325-ioctl_getlbmd01-62b5ab65d63f
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/2 Add logical_block_metadata_cap struct fallback
From: Andrea Cervesato <[email protected]>
Add UAPI fallback definitions for struct logical_block_metadata_cap, FS_IOC_GETLBMD_CAP ioctl and related LBMD_* constants in lapi/fs.h for systems whose kernel headers predate v6.17.
Also add the corresponding AC_CHECK_TYPES entry in configure.ac.
--- configure.ac | 2 ++ include/lapi/fs.h | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)
configure.ac +2 -0
@@ -274,6 +274,8 @@ AC_CHECK_TYPES([struct file_attr],,,[#include <linux/fs.h>]) AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>]) +AC_CHECK_TYPES([struct logical_block_metadata_cap],,,[#include <linux/fs.h>]) + AC_CHECK_TYPES([struct sockaddr_vm],,,[ #include <sys/socket.h> #include <linux/vm_sockets.h>
include/lapi/fs.h +21 -0
@@ -136,4 +136,25 @@ static inline int file_setattr(int dfd, const char *filename, }#endif +#ifndef HAVE_STRUCT_LOGICAL_BLOCK_METADATA_CAP +struct logical_block_metadata_cap { +uint32_t lbmd_flags; +uint16_t lbmd_interval; +uint8_t lbmd_size; +uint8_t lbmd_opaque_size; +uint8_t lbmd_opaque_offset; +uint8_t lbmd_pi_size; +uint8_t lbmd_pi_offset; +uint8_t lbmd_guard_tag_type; +uint8_t lbmd_app_tag_size; +uint8_t lbmd_ref_tag_size; +uint8_t lbmd_storage_tag_size; +uint8_t pad; +}; +#endif + +#ifndef FS_IOC_GETLBMD_CAP +# define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap) +#endif +#endif /* LAPI_FS_H__ */
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] Add logical_block_metadata_cap struct fallback
Hi Andrea,
obviously correct, thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] Add logical_block_metadata_cap struct fallback
In reply to Andrea CervesatoHi Andrea,
--- [PATCH 1/2] ---
Quoted 4 lines · Andrea Cervesato
Add
logical_block_metadata_capstruct fallbackAdd UAPI fallback definitions for struct
logical_block_metadata_cap,FS_IOC_GETLBMD_CAPioctl and related LBMD_* constants inlapi/fs.h
The commit message claims LBMD_* constants are added, but none appear in the diff. The kernel's uapi/linux/fs.h defines LBMD_PI_CAP_INTEGRITY, LBMD_PI_CAP_REFTAG, LBMD_PI_CSUM_{NONE,IP,CRC16_T10DIF,CRC64_NVME}, and LBMD_SIZE_VER0 — either add them to lapi/fs.h or drop the claim from the commit message.
---
Note:
Our agent completed the review of the patch. The full review can be found at: <not available>
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedRe: [LTP] [PATCH 1/2] Add logical_block_metadata_cap struct fallback
In reply to Andrea CervesatoMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 Add new test ioctl_getlbmd01
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
Verify :manpage:ioctl(2) with FS_IOC_GETLBMD_CAP on block devices.
- fill struct logical_block_metadata_cap with non-zero pattern, call FS_IOC_GETLBMD_CAP on a block device without integrity support and verify the kernel zeroed out all fields
- call FS_IOC_GETLBMD_CAP on a regular file and verify it fails with ENOTTY
--- runtest/syscalls | 2 + testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_getlbmd01.c | 84 +++++++++++++++++++++++ 3 files changed, 87 insertions(+)
runtest/syscalls +2 -0
@@ -624,6 +624,8 @@ ioctl_ficlonerange01 ioctl_ficlonerange01 ioctl_ficlonerange02 ioctl_ficlonerange02 ioctl_fiemap01 ioctl_fiemap01 +ioctl_getlbmd01 ioctl_getlbmd01 + ioctl_pidfd01 ioctl_pidfd01 ioctl_pidfd02 ioctl_pidfd02 ioctl_pidfd03 ioctl_pidfd03
testcases/kernel/syscalls/ioctl/.gitignore +1 -0
@@ -30,6 +30,7 @@ /ioctl_ficlonerange01 /ioctl_ficlonerange02 /ioctl_fiemap01 +/ioctl_getlbmd01 /ioctl_pidfd01 /ioctl_pidfd02 /ioctl_pidfd03
testcases/kernel/syscalls/ioctl/ioctl_getlbmd01.c new file +84 -0
84 lines not on this page · raw message
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] Add new test ioctl_getlbmd01
Hi Andrea,
LGTM, thanks!
testcases/kernel/syscalls/ioctl/ioctl_getlbmd01.c line 74
Quoted 7 lines
testcases/kernel/syscalls/ioctl/ioctl_getlbmd01.c new file +7
-0+static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .needs_device =1 , + .needs_root =1 , + .needs_tmpdir =1 ,
nit: This is not needed due needs_device (see needs_tmpdir()). (can be fixed before merge.
Kind regards,
Petr Vorel
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp