From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>, Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5 3/5] Add fchmodat2 fallback definition
Date: Fri, 2 Aug 2024 12:38:09 +0200 [thread overview]
Message-ID: <25cf4465-ce2b-4783-86be-b012e4d155d4@suse.com> (raw)
In-Reply-To: <20240802095503.GC1613449@pevik>
Hi,
On 8/2/24 11:55, Petr Vorel wrote:
> Hi Andrea,
>
>
>> include/lapi/stat.h | 16 ++++++++++++++++
> What is the reason this to be added to include/lapi/stat.h?
>
> It's not a general function? (otherwise tst_safe_macros.c would be more
> appropriate).
>
> And because one day it will be defined in <sys/stat.h>?
>
> Probably ok due both reasons, but I'm just curious, also because static inline
> brought various problems in the past.
>
I was asked by Cyril to use proper headers instead of safe macros
headers, which contain anything.
>> 1 file changed, 16 insertions(+)
>> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
>> index 3606c9eb0..8e38ecfef 100644
>> --- a/include/lapi/stat.h
>> +++ b/include/lapi/stat.h
>> @@ -229,4 +229,20 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
>> # define STATX_ATTR_VERITY 0x00100000
>> #endif
>> +#define SAFE_FCHMODAT2(dfd, filename, mode, flags) \
>> + safe_fchmodat2(__FILE__, __LINE__, (dfd), (filename), (mode), (flags))
>> +
>> +static inline int safe_fchmodat2(const char *file, const int lineno,
>> + int dfd, const char *filename, mode_t mode, int flags)
>> +{
>> + int ret;
>> +
>> + ret = tst_syscall(__NR_fchmodat2, dfd, filename, mode, flags);
>> + if (ret == -1)
>> + tst_brk_(file, lineno, TBROK | TERRNO, "%s(%d,%s,%d,%d) error",
>> + __func__, dfd, filename, mode, flags);
>> +
>> + return ret;
> The code itself is obviously correct.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr
>
>> +}
>> +
>> #endif /* LAPI_STAT_H__ */
Andrea
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-08-02 10:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 8:23 [LTP] [PATCH v5 0/5] Add fchmodat2 testing suite Andrea Cervesato
2024-08-02 8:23 ` [LTP] [PATCH v5 1/5] Add SAFE_SYMLINKAT macro Andrea Cervesato
2024-08-02 9:47 ` Petr Vorel
2024-08-02 9:48 ` Cyril Hrubis
2024-08-02 10:02 ` Petr Vorel
2024-08-02 10:39 ` Andrea Cervesato via ltp
2024-08-02 8:23 ` [LTP] [PATCH v5 2/5] Add fchmodat2 syscalls definitions Andrea Cervesato
2024-08-02 9:49 ` Petr Vorel
2024-08-02 8:23 ` [LTP] [PATCH v5 3/5] Add fchmodat2 fallback definition Andrea Cervesato
2024-08-02 9:55 ` Petr Vorel
2024-08-02 10:38 ` Andrea Cervesato via ltp [this message]
2024-08-02 10:57 ` Petr Vorel
2024-08-02 8:23 ` [LTP] [PATCH v5 4/5] Add fchmodat2_01 test Andrea Cervesato
2024-08-02 8:47 ` Petr Vorel
2024-08-02 8:23 ` [LTP] [PATCH v5 5/5] Add fchmodat2_02 test Andrea Cervesato
2024-08-02 10:33 ` Petr Vorel
2024-08-02 9:58 ` [LTP] [PATCH v5 0/5] Add fchmodat2 testing suite Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25cf4465-ce2b-4783-86be-b012e4d155d4@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=andrea.cervesato@suse.de \
--cc=pvorel@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox