All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: rbm@suse.com
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v5 1/3] syscalls/modify_ldt: Add lapi/ldt.h
Date: Tue, 1 Apr 2025 12:29:09 +0200	[thread overview]
Message-ID: <20250401102909.GB345164@pevik> (raw)
In-Reply-To: <20250331-conversions-modify_ldt-v5-1-fd6ea1491956@suse.com>

Hi Ricardo, Andrea,

> +++ b/include/lapi/ldt.h
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2025 SUSE LLC Ricardo B. Marlière <rbm@suse.com>
> + */
> +
> +#ifndef LAPI_LDT_H__
> +#define LAPI_LDT_H__
> +
> +#include "config.h"
> +#include "lapi/syscalls.h"
> +#include <asm/ldt.h>
> +
> +static int modify_ldt(int func, void *ptr, unsigned long bytecount)
FYI if this in a header it should be 'static inline'. That would be worth to fix.

We have a lot of 'static inline' in lapi headers. IMHO this is a good approach
for these feature specific syscalls, although Martin Doucha tried to get rid of
some static inline (moving them to C files in lib/) to avoid compilation problems.

But again, this is worth for some generic files long enough e.g.
lib/tst_netlink.c or lib/tst_netdevice.c.

Also static inline makes code to grow, but adding new C source to LTP libs makes
IMHO bigger code size increase (besides we don't care about LTP size anyway,
otherwise we would change linking similar to busybox - single binary providing
many functions).

> +{
> +	return tst_syscall(__NR_modify_ldt, func, ptr, bytecount);
> +}
> +
> +static int safe_modify_ldt(const char *file, const int lineno, int func,
> +			   void *ptr, unsigned long bytecount)
> +{
And here as well.

Kind regards,
Petr

> +	int rval;
> +
> +	rval = modify_ldt(func, ptr, bytecount);
> +	if (rval == -1)
> +		tst_brk_(file, lineno, TBROK | TERRNO,
> +			 "modify_ldt(%d, %p, %lu)", func, ptr, bytecount);
> +
> +	return rval;
> +}
> +
> +#define SAFE_MODIFY_LDT(func, ptr, bytecount) \
> +	safe_modify_ldt(__FILE__, __LINE__, (func), (ptr), (bytecount))
> +
> +#endif /* LAPI_LDT_H__ */

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2025-04-01 10:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 17:43 [LTP] [PATCH v5 0/3] syscalls/modify_ldt: Refactor into new API Ricardo B. Marliere via ltp
2025-03-31 17:43 ` [LTP] [PATCH v5 1/3] syscalls/modify_ldt: Add lapi/ldt.h Ricardo B. Marliere via ltp
2025-04-01  8:48   ` Petr Vorel
2025-04-01  8:56     ` Andrea Cervesato via ltp
2025-04-01 10:21       ` Petr Vorel
2025-04-01 13:55     ` Ricardo B. Marli��re via ltp
2025-04-01 10:29   ` Petr Vorel [this message]
2025-04-01 10:45     ` Ricardo B. Marli��re via ltp
2025-03-31 17:43 ` [LTP] [PATCH v5 2/3] syscalls/modify_ldt02: Refactor into new API Ricardo B. Marliere via ltp
2025-03-31 17:43 ` [LTP] [PATCH v5 3/3] syscalls/modify_ldt01: " Ricardo B. Marliere via ltp
2025-03-31 17:55   ` Ricardo B. Marli��re via ltp
2025-03-31 17:58     ` Ricardo B. Marli��re via ltp

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=20250401102909.GB345164@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rbm@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.