From patchwork Wed Jan 13 07:51:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1425675 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DG05J3Y3Hz9sVS for ; Wed, 13 Jan 2021 18:51:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 07C203C319F for ; Wed, 13 Jan 2021 08:51:44 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id EFB713C6AA3 for ; Wed, 13 Jan 2021 08:51:29 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id EC886100035D for ; Wed, 13 Jan 2021 08:51:21 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 53371AED7; Wed, 13 Jan 2021 07:51:21 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Jan 2021 08:51:08 +0100 Message-Id: <20210113075110.31628-2-pvorel@suse.cz> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113075110.31628-1-pvorel@suse.cz> References: <20210113075110.31628-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 1/3] lapi: Move struct file_handle into lapi/fcntl.h X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" that way it can be used in fanotify tests (some of use the struct, but not name_to_handle_at() syscall) and the struct is defined in anyway. Although detection with HAVE_NAME_TO_HANDLE_AT works (at least on glibc, musl and uclibc-ng) add proper autotools check for the struct presence. Signed-off-by: Petr Vorel Acked-by: Yang Xu --- configure.ac | 6 ++++++ include/lapi/fcntl.h | 10 ++++++++++ include/lapi/name_to_handle_at.h | 9 +-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 06be1c094..e44e25cc6 100644 --- a/configure.ac +++ b/configure.ac @@ -148,6 +148,12 @@ AC_CHECK_TYPES([struct acct_v3],,,[#include ]) AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include ]) AC_CHECK_TYPES([struct fanotify_event_info_fid, struct fanotify_event_info_header],,,[#include ]) AC_CHECK_TYPES([struct file_dedupe_range],,,[#include ]) + +AC_CHECK_TYPES([struct file_handle],,,[ +#define _GNU_SOURCE +#include +]) + AC_CHECK_TYPES([struct fs_quota_statv],,,[#include ]) AC_CHECK_TYPES([struct if_nextdqblk],,,[#include ]) AC_CHECK_TYPES([struct iovec],,,[#include ]) diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h index d6665915f..e08970c4f 100644 --- a/include/lapi/fcntl.h +++ b/include/lapi/fcntl.h @@ -6,6 +6,7 @@ #ifndef __LAPI_FCNTL_H__ #define __LAPI_FCNTL_H__ +#include "config.h" #include #include @@ -140,4 +141,13 @@ # define MAX_HANDLE_SZ 128 #endif +#ifndef HAVE_STRUCT_FILE_HANDLE +struct file_handle { + unsigned int handle_bytes; + int handle_type; + /* File identifier. */ + unsigned char f_handle[0]; +}; +#endif /* HAVE_STRUCT_FILE_HANDLE */ + #endif /* __LAPI_FCNTL_H__ */ diff --git a/include/lapi/name_to_handle_at.h b/include/lapi/name_to_handle_at.h index 3484133d1..275db4ae0 100644 --- a/include/lapi/name_to_handle_at.h +++ b/include/lapi/name_to_handle_at.h @@ -15,13 +15,6 @@ #include "tst_test.h" #ifndef HAVE_NAME_TO_HANDLE_AT -struct file_handle { - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - static inline int name_to_handle_at(int dfd, const char *pathname, struct file_handle *handle, int *mount_id, int flags) @@ -35,7 +28,7 @@ static inline int open_by_handle_at(int mount_fd, struct file_handle *handle, { return tst_syscall(__NR_open_by_handle_at, mount_fd, handle, flags); } -#endif +#endif /* HAVE_NAME_TO_HANDLE_AT */ /* Returns a valid pointer on success, NULL on errors */ static inline struct file_handle * From patchwork Wed Jan 13 07:51:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1425673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DG04y3KSyz9sVS for ; Wed, 13 Jan 2021 18:51:28 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D43653C320C for ; Wed, 13 Jan 2021 08:51:24 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 562553C266D for ; Wed, 13 Jan 2021 08:51:22 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 05F36601417 for ; Wed, 13 Jan 2021 08:51:21 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 85833AE40; Wed, 13 Jan 2021 07:51:21 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Jan 2021 08:51:09 +0100 Message-Id: <20210113075110.31628-3-pvorel@suse.cz> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113075110.31628-1-pvorel@suse.cz> References: <20210113075110.31628-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/3] fanotify: Fix build on undefined struct file_handle X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This fixes error: fanotify09.c:201:32: error: dereferencing pointer to incomplete type ‘struct file_handle’ 201 | filename = (char *)file_handle->f_handle + file_handle->handle_bytes; Signed-off-by: Petr Vorel --- testcases/kernel/syscalls/fanotify/fanotify.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 8907db052..039379961 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include "lapi/fcntl.h" int safe_fanotify_init(const char *file, const int lineno, unsigned int flags, unsigned int event_f_flags) From patchwork Wed Jan 13 07:51:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1425674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DG0551cwdz9sVS for ; Wed, 13 Jan 2021 18:51:37 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8A97D3C5DC0 for ; Wed, 13 Jan 2021 08:51:34 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id 6618E3C2698 for ; Wed, 13 Jan 2021 08:51:22 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 1C18A10006C6 for ; Wed, 13 Jan 2021 08:51:22 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7A10AF4E; Wed, 13 Jan 2021 07:51:21 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Jan 2021 08:51:10 +0100 Message-Id: <20210113075110.31628-4-pvorel@suse.cz> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113075110.31628-1-pvorel@suse.cz> References: <20210113075110.31628-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 3/3] syscalls: Remove unused include X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Tests should always use lapi/fcntl.h instead of to fix possible missing definitions. But in this case removing include, because fanotify tests include in lapi/fcntl.h (via fanotify.h) and {name_to,open_by}_handle_at tests include lapi/fcntl.h in lapi/name_to_handle_at.h. Signed-off-by: Petr Vorel Reviewed-by: Xiao Yang --- testcases/kernel/syscalls/fanotify/fanotify09.c | 1 - testcases/kernel/syscalls/fanotify/fanotify13.c | 1 - testcases/kernel/syscalls/fanotify/fanotify15.c | 1 - testcases/kernel/syscalls/fanotify/fanotify16.c | 1 - .../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 1 - .../kernel/syscalls/name_to_handle_at/name_to_handle_at02.c | 1 - .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 1 - .../kernel/syscalls/open_by_handle_at/open_by_handle_at02.c | 1 - 8 files changed, 8 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c index 30e212f44..918e40274 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify09.c +++ b/testcases/kernel/syscalls/fanotify/fanotify09.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c index c9cf10555..6d812cdd1 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify13.c +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include "tst_test.h" diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c index ba8259c7c..fe143823e 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify15.c +++ b/testcases/kernel/syscalls/fanotify/fanotify15.c @@ -19,7 +19,6 @@ #include #include -#include #include #include #include "tst_test.h" diff --git a/testcases/kernel/syscalls/fanotify/fanotify16.c b/testcases/kernel/syscalls/fanotify/fanotify16.c index 5ffaec92f..c4b8a5abc 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify16.c +++ b/testcases/kernel/syscalls/fanotify/fanotify16.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 84ac32eab..1ac9d8214 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -15,7 +15,6 @@ \*/ #define _GNU_SOURCE -#include #include #include "lapi/name_to_handle_at.h" diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c index 7c0d57485..020b25531 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c @@ -10,7 +10,6 @@ \*/ #define _GNU_SOURCE -#include #include "lapi/name_to_handle_at.h" #define TEST_FILE "test_file" diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index c1b08f1b8..0d09e1ed8 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -15,7 +15,6 @@ \*/ #define _GNU_SOURCE -#include #include #include "lapi/name_to_handle_at.h" diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c index 3c8f06d85..0f60752c4 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c @@ -10,7 +10,6 @@ \*/ #define _GNU_SOURCE #include -#include #include "tst_capability.h" #include "lapi/name_to_handle_at.h"