From patchwork Tue Nov 5 00:53:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1189267 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="LPmryqQD"; 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 476WQF2lbsz9sP6 for ; Tue, 5 Nov 2019 11:54:13 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id F33353C2533 for ; Tue, 5 Nov 2019 01:54:08 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 20AE03C1CA4 for ; Tue, 5 Nov 2019 01:53:58 +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-3.smtp.seeweb.it (Postfix) with ESMTPS id 910551A0100E for ; Tue, 5 Nov 2019 01:53:57 +0100 (CET) Received: by mail-wr1-x442.google.com with SMTP id a15so19262043wrf.9 for ; Mon, 04 Nov 2019 16:53:57 -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=lgaPH/p38PXhg7aPp8RnvQ3dNQTWWWF+byKXYa1Z/Dw=; b=LPmryqQDXvuNcc2EmX6neLVVvwzLYwRkGsNirdEvjhyJmKPGlmm2Ce5TmJsJWnL4Ss HcJeyiiFg01dxDDMbCWZP/VNymMVlCOgWg3s3qPDEHPqCwN0CV3IJ2KdnRuYTQTBy0TL MjTK+SGXv/y1NJ3UyDaJnKByEbeLINbyuXMJ3aKaQ/qXtjPOZvIj1MvCQGNJwilBDfeZ 7/eq/PbY/OcMLdGfKBF3sZ0rDVySEtCzyZuaBNa65GSLXnmSXlut5qftSpXc0CICCV5C FKXEnJeaQXtfhnVp2XW90V8DaBQArDGQNaPu6QfFDCzz/MZSdXhyg4recfBPH/QRByDV fJog== 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=lgaPH/p38PXhg7aPp8RnvQ3dNQTWWWF+byKXYa1Z/Dw=; b=d/Kb1E/67EYjDx17S5xPXDFQndWRJqHc7WN0TUnVh4yXkzJS4mF6hVw6LxjjJeS16J yvF7qp8Ysc63gefPHXljCr/V+TDl7UbwEgtHCd4xkRM1UYjM+WILhqMfAbZ2NeGzUjaL LBH5DHaw6h92f+F1TlqVHt5wrESSHcupgXNZ3eRHS4IYoy1HHBs6AjIHZ+tb0kGZSXRk Ko9cPiJXEK3x0Na0Nn7uAtlQ46cies7KPyO1Xt90B2WyaVDPxWCsPcZESEJg+A7eIL3T t+rrPbMmfxhw3RshFKbGuekEa3HjMZbWaSJNdwQHyShvu7/K97nf88kCFUC38rA0eZOE xQ/w== X-Gm-Message-State: APjAAAV5Q9FQ4nW4VRw1cMDlTcsFPAjAeKwjV5Aun3njFvNMzXIYIac7 G3bZ1gARQ9cEjVosAulJYEVV+5l+xek= X-Google-Smtp-Source: APXvYqxoayCM4zY0VSlDQJiqhelCK+XirgHZsSbsJ6qSg6e7jkd3NApd3A+okYb3OH0G2jByiDKO2w== X-Received: by 2002:adf:c786:: with SMTP id l6mr21288248wrg.45.1572915236853; Mon, 04 Nov 2019 16:53:56 -0800 (PST) Received: from localhost.localdomain ([62.201.25.198]) by smtp.gmail.com with ESMTPSA id g69sm20002476wme.31.2019.11.04.16.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2019 16:53:56 -0800 (PST) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 5 Nov 2019 01:53:41 +0100 Message-Id: <20191105005341.19033-3-petr.vorel@gmail.com> X-Mailer: git-send-email 2.24.0.rc2 In-Reply-To: <20191105005341.19033-1-petr.vorel@gmail.com> References: <20191105005341.19033-1-petr.vorel@gmail.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-3.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-3.smtp.seeweb.it Subject: [LTP] [PATCH 2/2] fanotify: Rename fanotify_event_info_fid struct 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" To fix build on musl, which also defines fanotify_event_info_fid, but uses fsid_t type for fsid instead of __kernel_fsid_t. This fixes errors: 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], musl (unlike glibc and uclibc-ng) defines fanotify_event_info_fid in fanotify.h and uses fsid_t as type for fanotify_event_info_fid.fsid member, which defines __val[2] (unlike val[2] in __kernel_fsid_t). /* musl (include/sys/fanotify.h) */ struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; fsid_t fsid; unsigned char handle[]; }; /* musl (include/sys/statfs.h) */ typedef struct __fsid_t { int __val[2]; } fsid_t; /* kernel (include/uapi/linux/fanotify.h) */ struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; __kernel_fsid_t fsid; /* * Following is an opaque struct file_handle that can be passed as * an argument to open_by_handle_at(2). */ unsigned char handle[0]; }; /* kernel include/uapi/asm-generic/posix_types.h */ typedef struct { int val[2]; } __kernel_fsid_t; Signed-off-by: Petr Vorel --- testcases/kernel/syscalls/fanotify/fanotify.h | 6 ++---- testcases/kernel/syscalls/fanotify/fanotify13.c | 4 ++-- testcases/kernel/syscalls/fanotify/fanotify15.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 563a4eb5b..faac178cf 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -133,17 +133,15 @@ struct fanotify_event_info_header { uint8_t pad; uint16_t len; }; +#endif /* ! FAN_REPORT_FID */ #ifdef HAVE_NAME_TO_HANDLE_AT -struct fanotify_event_info_fid { +struct lapi_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 */ -#ifdef HAVE_NAME_TO_HANDLE_AT /* * Helper function used to obtain fsid and file_handle for a given path. * Used by test files correlated to FAN_REPORT_FID functionality. diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c index 030734285..e0ce887e7 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify13.c +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c @@ -159,7 +159,7 @@ static void do_test(unsigned int number) struct file_handle *event_file_handle; struct fanotify_event_metadata *metadata; - struct fanotify_event_info_fid *event_fid; + struct lapi_fanotify_event_info_fid *event_fid; struct test_case_t *tc = &test_cases[number]; struct fanotify_mark_type *mark = &tc->mark; @@ -207,7 +207,7 @@ static void do_test(unsigned int number) for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf; FAN_EVENT_OK(metadata, len); metadata = FAN_EVENT_NEXT(metadata, len), i++) { - event_fid = (struct fanotify_event_info_fid *) (metadata + 1); + event_fid = (struct lapi_fanotify_event_info_fid *) (metadata + 1); event_file_handle = (struct file_handle *) event_fid->handle; /* File descriptor is redundant with FAN_REPORT_FID */ diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c index e9e926078..e9f1ff70d 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify15.c +++ b/testcases/kernel/syscalls/fanotify/fanotify15.c @@ -53,7 +53,7 @@ static void do_test(void) struct file_handle *event_file_handle; struct fanotify_event_metadata *metadata; - struct fanotify_event_info_fid *event_fid; + struct lapi_fanotify_event_info_fid *event_fid; if (fanotify_mark(fanotify_fd, FAN_MARK_ADD | FAN_MARK_FILESYSTEM, FAN_CREATE | FAN_DELETE | FAN_ATTRIB | @@ -125,7 +125,7 @@ static void do_test(void) for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf; FAN_EVENT_OK(metadata, len); metadata = FAN_EVENT_NEXT(metadata,len), i++) { - event_fid = (struct fanotify_event_info_fid *) (metadata + 1); + event_fid = (struct lapi_fanotify_event_info_fid *) (metadata + 1); event_file_handle = (struct file_handle *) event_fid->handle; if (i >= count) {