lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQzoJNQ21o3pmozo5c0rLq-ETaAqxSgbiU_gJu7U_mu8g@mail.gmail.com>
Date: Mon, 7 Oct 2024 02:36:19 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Sami Tolvanen <samitolvanen@...gle.com>
Cc: Luis Chamberlain <mcgrof@...nel.org>, Miguel Ojeda <ojeda@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Matthew Maurer <mmaurer@...gle.com>, 
	Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Gary Guo <gary@...yguo.net>, 
	Petr Pavlu <petr.pavlu@...e.com>, Neal Gompa <neal@...pa.dev>, Hector Martin <marcan@...can.st>, 
	Janne Grunau <j@...nau.net>, Miroslav Benes <mbenes@...e.cz>, Asahi Linux <asahi@...ts.linux.dev>, 
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-modules@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v3 01/20] scripts: import more list macros

On Tue, Sep 24, 2024 at 3:19 AM Sami Tolvanen <samitolvanen@...gle.com> wrote:
>
> Import list_is_first, list_is_last, list_replace, and list_replace_init.
>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>


This one was applied to linux-kbuild.
Thanks.


> ---
>  scripts/include/list.h | 50 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>
> diff --git a/scripts/include/list.h b/scripts/include/list.h
> index fea1e2b79063..8bdcaadca709 100644
> --- a/scripts/include/list.h
> +++ b/scripts/include/list.h
> @@ -127,6 +127,36 @@ static inline void list_del(struct list_head *entry)
>         entry->prev = LIST_POISON2;
>  }
>
> +/**
> + * list_replace - replace old entry by new one
> + * @old : the element to be replaced
> + * @new : the new element to insert
> + *
> + * If @old was empty, it will be overwritten.
> + */
> +static inline void list_replace(struct list_head *old,
> +                               struct list_head *new)
> +{
> +       new->next = old->next;
> +       new->next->prev = new;
> +       new->prev = old->prev;
> +       new->prev->next = new;
> +}
> +
> +/**
> + * list_replace_init - replace old entry by new one and initialize the old one
> + * @old : the element to be replaced
> + * @new : the new element to insert
> + *
> + * If @old was empty, it will be overwritten.
> + */
> +static inline void list_replace_init(struct list_head *old,
> +                                    struct list_head *new)
> +{
> +       list_replace(old, new);
> +       INIT_LIST_HEAD(old);
> +}
> +
>  /**
>   * list_move - delete from one list and add as another's head
>   * @list: the entry to move
> @@ -150,6 +180,26 @@ static inline void list_move_tail(struct list_head *list,
>         list_add_tail(list, head);
>  }
>
> +/**
> + * list_is_first -- tests whether @list is the first entry in list @head
> + * @list: the entry to test
> + * @head: the head of the list
> + */
> +static inline int list_is_first(const struct list_head *list, const struct list_head *head)
> +{
> +       return list->prev == head;
> +}
> +
> +/**
> + * list_is_last - tests whether @list is the last entry in list @head
> + * @list: the entry to test
> + * @head: the head of the list
> + */
> +static inline int list_is_last(const struct list_head *list, const struct list_head *head)
> +{
> +       return list->next == head;
> +}
> +
>  /**
>   * list_is_head - tests whether @list is the list @head
>   * @list: the entry to test
> --
> 2.46.0.792.g87dc391469-goog
>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ