From patchwork Wed Nov 13 00:56:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1193924 X-Patchwork-Delegate: petr.vorel@gmail.com 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dGUxN6Iw"; dkim-atps=neutral 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 47CR5b2pfYz9sPk for ; Wed, 13 Nov 2019 11:56:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8E3383C2489 for ; Wed, 13 Nov 2019 01:56:42 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 443043C2451 for ; Wed, 13 Nov 2019 01:56:38 +0100 (CET) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 6BDA560107E for ; Wed, 13 Nov 2019 01:56:38 +0100 (CET) Received: by mail-wr1-x444.google.com with SMTP id l7so334452wrp.6 for ; Tue, 12 Nov 2019 16:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dc/xQOuLU+XjhfcGqQssYC0pfzQMyExxMgegNwxz1/Y=; b=dGUxN6IwzB0/771EAn4yOrTyIj5HoCRcL4+ek3dpqpWQYTZKXtMdYtZ4XlwCdg7hbe 0HV/y2V2WB/IpzH67YGfsF3vxwW2d1yLQwEQ7o59htALXZvFeG/5EjMUH3Kltf0ghgzT 8Hkg3Zh/yiP14SXPX5em+Di25NbYAkmg+Iasl/FryDsw3cG9s4mDtJeVv6igCRGSupCH 6oL6cCj0bydJ8zAUkZ05OtsYQJ3nuZFCch4nhtzlXm5wCq94nhrsXFmuWanuoV56JCWB GaVfSQ/8tzz1tvQI8hsf8ND4DmOUbhF25J/YRrXJvVd+Y9DubUtcRQKUbRlwa2lmHV49 xZuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dc/xQOuLU+XjhfcGqQssYC0pfzQMyExxMgegNwxz1/Y=; b=LuneEKQSc2CnSt6I9Enq5u345HaYhUqfYaznP2VUiAxrk5l5IidAMHqbp7ZU3Jez5k ONVk76k8yxKma3mY7rP9hSuAdiCPMMpfoRA1dSC7BCXxKz1b+nzX3boQIdUfCRZomvQp J6RFiNmF/l7KVjebX347BMMD8RPqv9+h23MMrQrolm5jZtwouSkYDHNil4sNgbk0xLgQ zs3TmVBThBoQvTPwN4AXB14xafcXxBSHUPshVPomUkiO0SKzEj+CfnL44Ka15NWqqwfT kkjjCvbYT5BvmhzdCgBARGONTLjZ5BVIh4IXbL0sc+cDixzHBpqkiFOaMN+xr0usk0fw AHTw== X-Gm-Message-State: APjAAAXVZ2PpSTTnKRaeV5C9IkCVXiAoyjtclhQu85xlxugSRCpi61Cs GG0Gmsxr9WupW/RyZhxmauor+2vJ X-Google-Smtp-Source: APXvYqz5PyHVAwu35aaMVVyZqOKedteh8Q/vCVParo9qcGfOfR+WL23zw+BOKVARWKjzxRdUHVS1NQ== X-Received: by 2002:a5d:6746:: with SMTP id l6mr121287wrw.349.1573606597610; Tue, 12 Nov 2019 16:56:37 -0800 (PST) Received: from x230.suse.cz ([62.201.25.198]) by smtp.gmail.com with ESMTPSA id z4sm431546wmf.36.2019.11.12.16.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 16:56:36 -0800 (PST) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Nov 2019 01:56:24 +0100 Message-Id: <20191113005626.19585-2-petr.vorel@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191113005626.19585-1-petr.vorel@gmail.com> References: <20191113005626.19585-1-petr.vorel@gmail.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 1/3] fanotify: Move __kernel_fsid_t definition to correct place 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This fixes errors: fanotify.h:149:55: error: unknown type name ‘__kernel_fsid_t’ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, ^~~~~~~~~~~~~~~ fanotify13.c:47:2: error: unknown type name ‘__kernel_fsid_t’ __kernel_fsid_t fsid; Remove #ifdef HAVE_NAME_TO_HANDLE_AT wrap of __kernel_fsid_t fallback definition to simplify preprocessor checks. Fixes: b8aebc835 ("fanotify: Fix missing __kernel_fsid_t definition") Signed-off-by: Petr Vorel --- testcases/kernel/syscalls/fanotify/fanotify.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 435f100d8..573ed5f59 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -116,6 +116,13 @@ struct fanotify_mark_type { const char * name; }; +#ifndef __kernel_fsid_t +typedef struct { + int val[2]; +} lapi_fsid_t; +#define __kernel_fsid_t lapi_fsid_t +#endif /* __kernel_fsid_t */ + #ifndef FAN_REPORT_FID #define FAN_REPORT_FID 0x00000200 @@ -126,20 +133,13 @@ struct fanotify_event_info_header { }; #ifdef HAVE_NAME_TO_HANDLE_AT -#ifndef __kernel_fsid_t -typedef struct { - int val[2]; -} lapi_fsid_t; -#define __kernel_fsid_t lapi_fsid_t -#endif - struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; __kernel_fsid_t fsid; unsigned char handle[0]; }; -#endif -#endif +#endif /* HAVE_NAME_TO_HANDLE_AT */ +#endif /* ! FAN_REPORT_FID */ #ifdef HAVE_NAME_TO_HANDLE_AT /* From patchwork Wed Nov 13 00:56:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1193928 X-Patchwork-Delegate: petr.vorel@gmail.com 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=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TjySgiAA"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (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 47CR606jnMz9sPh for ; Wed, 13 Nov 2019 11:57:12 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 57BCF3C251E for ; Wed, 13 Nov 2019 01:57:10 +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 [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id 559453C24F1 for ; Wed, 13 Nov 2019 01:56:47 +0100 (CET) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id A170360256B for ; Wed, 13 Nov 2019 01:56:39 +0100 (CET) Received: by mail-wm1-x344.google.com with SMTP id u18so147063wmc.3 for ; Tue, 12 Nov 2019 16:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ME3cRSKVpEdWYtbmS9f6W9g1QnmuyQA+aOCi4+b+Op8=; b=TjySgiAAWhRvrLy7T+uV4u7dNwsTkLsyrjZSFgwpIwDAHj2PS5kgwtNbC4K0eYlsLE e8Vi1LwKeEfhDbRwXehrU1cxP1QHznoJRunbbmGNjqzDU0VtMIq+pFATblXb1PLc0Sy2 jcgVQjTHgwEvtdfKITdw1h42UlKp4ODpCNeJAHyUSa7hk7meYuvl9YirOj8IIqA1jVfT gMobTdiQeRsBhfobnFgRa5ZzkZCuEBNi2rIzb5/bQNYPot4PfLH0OuWfuaGukx2dNdAT kA6XtkxM5XwRgQfWWxzfr44EvLSE82lV8WcwR42NRi9gtDrytC3f1g9q9zqobddRf1pr Y+YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ME3cRSKVpEdWYtbmS9f6W9g1QnmuyQA+aOCi4+b+Op8=; b=a4nifd3xjmziZ6g39hkiCoM+SUAmshq0g9cQS3q7GkqYppzhGi9BqZXQ3uVeWg9jWP dAFszkPMpkfj4x024+O+eq/mt8RfMIc4z6rFVrmJIs3X8MCkKbzBdQvcSHTJgorGhduH jmNgyQ+iVhqPrsDr0aO9ZlOLli/fk7FpJNd4kCMh7jwc35kTL8At3agAtoyuFvUfQXYY /S//qNArNw7k46KxaO8lKUP6iIspgRiAvlHCwr7UfemF5Y4unSISOluWHQEsoNAvkHzP rbNpzqbdEMG4iKP1Db9NP2RZw9YdVyX20JdzLKxO7aRXsoAyDMwHWEmFXhmPRdAnBinh gFBA== X-Gm-Message-State: APjAAAVULmIk9WLZNwy86i+doz+bB2NPpUJnC7MUw0cFk6u8+p6LaK7b k1goIHAKYMP3W9NLnXJlzs3Zb/65 X-Google-Smtp-Source: APXvYqzkU9ETHVHYRJThEDkaHgKsQHX7R0qOH0yir6QyHGOiCto155TvQVrHmxHPxgoZkFm2Ik7i1w== X-Received: by 2002:a1c:b607:: with SMTP id g7mr287904wmf.94.1573606598748; Tue, 12 Nov 2019 16:56:38 -0800 (PST) Received: from x230.suse.cz ([62.201.25.198]) by smtp.gmail.com with ESMTPSA id z4sm431546wmf.36.2019.11.12.16.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 16:56:38 -0800 (PST) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Nov 2019 01:56:25 +0100 Message-Id: <20191113005626.19585-3-petr.vorel@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191113005626.19585-1-petr.vorel@gmail.com> References: <20191113005626.19585-1-petr.vorel@gmail.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/3] fanotify: Rework checks for fallback definitions 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Add autoconf checks for struct fanotify_event_info_fid and struct fanotify_event_info_header. Instead of detecting via FAN_REPORT_FID or HAVE_NAME_TO_HANDLE_AT. Signed-off-by: Petr Vorel --- Changes v1->v2: New commit. configure.ac | 1 + m4/ltp-fanotify.m4 | 7 +++++++ testcases/kernel/syscalls/fanotify/fanotify.h | 14 ++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 m4/ltp-fanotify.m4 diff --git a/configure.ac b/configure.ac index 62c5a0bb4..71738b72d 100644 --- a/configure.ac +++ b/configure.ac @@ -212,6 +212,7 @@ LTP_CHECK_CAPABILITY_SUPPORT LTP_CHECK_CC_WARN_OLDSTYLE LTP_CHECK_CLONE_SUPPORTS_7_ARGS LTP_CHECK_CRYPTO +LTP_CHECK_FANOTIFY LTP_CHECK_FIDEDUPE LTP_CHECK_FORTIFY_SOURCE LTP_CHECK_FTS_H diff --git a/m4/ltp-fanotify.m4 b/m4/ltp-fanotify.m4 new file mode 100644 index 000000000..e7b77d8a4 --- /dev/null +++ b/m4/ltp-fanotify.m4 @@ -0,0 +1,7 @@ +dnl SPDX-License-Identifier: GPL-2.0-or-later +dnl Copyright (c) 2019 Petr Vorel + +AC_DEFUN([LTP_CHECK_FANOTIFY],[ +AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include ]) +AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include ]) +]) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 573ed5f59..9d2fded13 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -101,6 +101,10 @@ static long fanotify_mark(int fd, unsigned int flags, uint64_t mask, #define FAN_OPEN_EXEC_PERM 0x00040000 #endif +#ifndef FAN_REPORT_FID +#define FAN_REPORT_FID 0x00000200 +#endif + /* * FAN_ALL_PERM_EVENTS has been deprecated, so any new permission events * are not to be added to it. To cover the instance where a new permission @@ -123,23 +127,21 @@ typedef struct { #define __kernel_fsid_t lapi_fsid_t #endif /* __kernel_fsid_t */ -#ifndef FAN_REPORT_FID -#define FAN_REPORT_FID 0x00000200 - +#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER struct fanotify_event_info_header { uint8_t info_type; uint8_t pad; uint16_t len; }; +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */ -#ifdef HAVE_NAME_TO_HANDLE_AT +#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; __kernel_fsid_t fsid; unsigned char handle[0]; }; -#endif /* HAVE_NAME_TO_HANDLE_AT */ -#endif /* ! FAN_REPORT_FID */ +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */ #ifdef HAVE_NAME_TO_HANDLE_AT /* From patchwork Wed Nov 13 00:56:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1193925 X-Patchwork-Delegate: petr.vorel@gmail.com 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nIaWdzVr"; dkim-atps=neutral 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 47CR5r0BZ8z9sPh for ; Wed, 13 Nov 2019 11:57:03 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 73B7D3C2487 for ; Wed, 13 Nov 2019 01:57:01 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 8AEC43C2452 for ; Wed, 13 Nov 2019 01:56:41 +0100 (CET) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 27CF460111F for ; Wed, 13 Nov 2019 01:56:41 +0100 (CET) Received: by mail-wr1-x442.google.com with SMTP id b3so296597wrs.13 for ; Tue, 12 Nov 2019 16:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P+razEwi/kUdkfEWdO/g81lGwxTbIvpUc8+gFiPt36M=; b=nIaWdzVrZRpAw08cBs8tBTbrl05pwoQHv3ny3iTnwvHDzup8tiYm7tPn3rlFVvJc0k NymB645qx8EhHJXhiiQOg8IuRqJ2mk0Dp9lvEa0HBKNqavkPvuuLZbExRbzrLd0NJB/9 iSdXhRUgKWMQ39SzkwMe9sitaMJ/+o6rDzR87wU7qInCpuNVGgjjyCVoDcvbnD165Fa4 a3CoH//itXVbuLUyeWIghhYUCr5iOIzxkqKepbB50sQ+kZ8si/uMiewqz7BDAusk0ZXE lhpTLIMlljgowWUvcjBESZJmfIxICosJbXuEHGN+YDVEolSKpML2eimJW/qjqpQ/I8aZ 26tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P+razEwi/kUdkfEWdO/g81lGwxTbIvpUc8+gFiPt36M=; b=BUmtTnOQaCVwdmQQAUmPDN4k/ZYG/oLhcwiweCxw7qroXj51Eyu9zdZK8yqTfQ+t5u v8BA3OcdZ36LSNcSBwo5r7f+QEgEoUk2L9vSYd4I9fx/S8tSm+uafvdf3V338OJKrE0U AWnKQ1/GB8L8lDngyBNfkwdbaDLGAAbTkcueMmPrJmLYfvo+zR9iLnu9cRjR2Gcu3jIj UG5OT2advMPv0SRueZuHGcNl+RWhKOPQRyqXy/9p6yt9Xw+2PfR/GxRdo1KWIiHypDA4 hfCOiFc+PfIx+HsKaulLDTQnG8rWIWpb3MPO1ywHpGBRx+hrDMHcFaO5X189/xCurjCC 30pg== X-Gm-Message-State: APjAAAWNPzrOOHBkFwa3ve56pVGq008p5sWt2W7UNLGfAsqszA9M7R1D SKUXrF29nnzY7FfUUV/XsGg1a0Nr X-Google-Smtp-Source: APXvYqz2zhZwteeujfKzUkNBpULOxYBscqAZbaIXdeYLMpwM4tLDEmpfa+nQPAQd8VPvAXu4RCBeow== X-Received: by 2002:a05:6000:18c:: with SMTP id p12mr156865wrx.154.1573606600284; Tue, 12 Nov 2019 16:56:40 -0800 (PST) Received: from x230.suse.cz ([62.201.25.198]) by smtp.gmail.com with ESMTPSA id z4sm431546wmf.36.2019.11.12.16.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 16:56:39 -0800 (PST) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 13 Nov 2019 01:56:26 +0100 Message-Id: <20191113005626.19585-4-petr.vorel@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191113005626.19585-1-petr.vorel@gmail.com> References: <20191113005626.19585-1-petr.vorel@gmail.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 3/3] fanotify: Detect val vs. __val fanotify_event_info_fid.fsid member 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" via FSID_VAL_MEMBER() macro and autotools detection. This fixes build on musl, which also defines fanotify_event_info_fid, but uses fsid_t type for fsid instead of __kernel_fsid_t. fsid_t type has __val[2] member (unlike val[2] in __kernel_fsid_t). Fixed error: fanotify13.c: In function ‘do_test’: fanotify13.c:278:20: error: ‘fsid_t’ {aka ‘struct __fsid_t’} has no member named ‘val’; did you mean ‘__val’? event_fid->fsid.val[0], ^~~ ../../../../include/tst_test.h:49:53: note: in definition of macro ‘tst_res’ tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__) ^~~~~~~~~~~ fanotify13.c:279:20: error: ‘fsid_t’ {aka ‘struct __fsid_t’} has no member named ‘val’; did you mean ‘__val’? event_fid->fsid.val[1], Signed-off-by: Petr Vorel --- Changes v1->v2: * access members via macro FSID_VAL_MEMBER() * use autotools detection m4/ltp-fanotify.m4 | 1 + testcases/kernel/syscalls/fanotify/fanotify.h | 6 ++++++ testcases/kernel/syscalls/fanotify/fanotify13.c | 8 ++++---- testcases/kernel/syscalls/fanotify/fanotify15.c | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/m4/ltp-fanotify.m4 b/m4/ltp-fanotify.m4 index e7b77d8a4..f2e31eb68 100644 --- a/m4/ltp-fanotify.m4 +++ b/m4/ltp-fanotify.m4 @@ -4,4 +4,5 @@ dnl Copyright (c) 2019 Petr Vorel AC_DEFUN([LTP_CHECK_FANOTIFY],[ AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include ]) AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include ]) +AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include ]) ]) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 9d2fded13..5370e30bb 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -143,6 +143,12 @@ struct fanotify_event_info_fid { }; #endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */ +#ifdef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL +# define FSID_VAL_MEMBER(fsid, i) (fsid.__val[i]) +#else +# define FSID_VAL_MEMBER(fsid, i) (fsid.val[i]) +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */ + #ifdef HAVE_NAME_TO_HANDLE_AT /* * Helper function used to obtain fsid and file_handle for a given path. diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c index 030734285..b0d9fb5b6 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify13.c +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c @@ -130,8 +130,8 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc) "kernel"); return 1; } else if (errno == ENODEV && - !event_set[i].fsid.val[0] && - !event_set[i].fsid.val[1]) { + !FSID_VAL_MEMBER(event_set[i].fsid, 0) && + !FSID_VAL_MEMBER(event_set[i].fsid, 1)) { tst_res(TCONF, "FAN_REPORT_FID not supported on " "filesystem type %s", @@ -275,8 +275,8 @@ static void do_test(unsigned int number) "and name_to_handle_at(2)", metadata->mask, getpid(), - event_fid->fsid.val[0], - event_fid->fsid.val[1], + FSID_VAL_MEMBER(event_fid->fsid, 0), + FSID_VAL_MEMBER(event_fid->fsid, 1), *(unsigned long *) event_file_handle->f_handle); } out: diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c index e9e926078..48ed368ae 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify15.c +++ b/testcases/kernel/syscalls/fanotify/fanotify15.c @@ -192,8 +192,8 @@ static void do_test(void) "fid=%x.%x.%lx values", metadata->mask, getpid(), - event_fid->fsid.val[0], - event_fid->fsid.val[1], + FSID_VAL_MEMBER(event_fid->fsid, 0), + FSID_VAL_MEMBER(event_fid->fsid, 1), *(unsigned long *) event_file_handle->f_handle); }