[LTP] [PATCH v4 1/5] Add landlock03 test

Petr Vorel pvorel@suse.cz
Fri Jul 26 13:01:39 CEST 2024


Hi Andrea,

...
> +static struct tst_cap dropadmin = {
> +	.action = TST_CAP_DROP,
> +	.id = CAP_SYS_ADMIN,
> +	.name = "CAP_SYS_ADMIN",
> +};
> +
> +static struct tst_cap needadmin = {
> +	.action = TST_CAP_REQ,
> +	.id = CAP_SYS_ADMIN,
> +	.name = "CAP_SYS_ADMIN",
> +};

I dared to merge this with very minor change:

+++ testcases/kernel/syscalls/landlock/landlock03.c
@@ -26,16 +26,15 @@ static int ruleset_fd = -1;
 static int ruleset_invalid = -1;
 static int file_fd = -1;
 
+#define ID_NAME(x) .id = x, .name = #x
 static struct tst_cap dropadmin = {
 	.action = TST_CAP_DROP,
-	.id = CAP_SYS_ADMIN,
-	.name = "CAP_SYS_ADMIN",
+	ID_NAME(CAP_SYS_ADMIN),
 };
 
 static struct tst_cap needadmin = {
 	.action = TST_CAP_REQ,
-	.id = CAP_SYS_ADMIN,
-	.name = "CAP_SYS_ADMIN",
+	ID_NAME(CAP_SYS_ADMIN),
 };
 
 static struct tcase {


More information about the ltp mailing list