Skip to content

Commit 6845645

Browse files
soleenakpm00
authored andcommitted
liveupdate: luo_file: Use private list
Switch LUO to use the private list iterators. Link: https://lkml.kernel.org/r/20251218155752.3045808-4-pasha.tatashin@soleen.com Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: Alexander Graf <graf@amazon.com> Cc: David Gow <davidgow@google.com> Cc: David Matlack <dmatlack@google.com> Cc: David Rientjes <rientjes@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kees Cook <kees@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Petr Mladek <pmladek@suse.com> Cc: Pratyush Yadav <pratyush@kernel.org> Cc: Samiullah Khawaja <skhawaja@google.com> Cc: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 66bd850 commit 6845645

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

kernel/liveupdate/luo_file.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
#include <linux/io.h>
105105
#include <linux/kexec_handover.h>
106106
#include <linux/kho/abi/luo.h>
107+
#include <linux/list_private.h>
107108
#include <linux/liveupdate.h>
108109
#include <linux/module.h>
109110
#include <linux/sizes.h>
@@ -273,7 +274,7 @@ int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd)
273274
goto err_fput;
274275

275276
err = -ENOENT;
276-
luo_list_for_each_private(fh, &luo_file_handler_list, list) {
277+
list_private_for_each_entry(fh, &luo_file_handler_list, list) {
277278
if (fh->ops->can_preserve(fh, file)) {
278279
err = 0;
279280
break;
@@ -760,7 +761,7 @@ int luo_file_deserialize(struct luo_file_set *file_set,
760761
bool handler_found = false;
761762
struct luo_file *luo_file;
762763

763-
luo_list_for_each_private(fh, &luo_file_handler_list, list) {
764+
list_private_for_each_entry(fh, &luo_file_handler_list, list) {
764765
if (!strcmp(fh->compatible, file_ser[i].compatible)) {
765766
handler_found = true;
766767
break;
@@ -835,7 +836,7 @@ int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
835836
return -EBUSY;
836837

837838
/* Check for duplicate compatible strings */
838-
luo_list_for_each_private(fh_iter, &luo_file_handler_list, list) {
839+
list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) {
839840
if (!strcmp(fh_iter->compatible, fh->compatible)) {
840841
pr_err("File handler registration failed: Compatible string '%s' already registered.\n",
841842
fh->compatible);

kernel/liveupdate/luo_internal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ static inline int luo_ucmd_respond(struct luo_ucmd *ucmd,
4040
*/
4141
#define luo_restore_fail(__fmt, ...) panic(__fmt, ##__VA_ARGS__)
4242

43-
/* Mimics list_for_each_entry() but for private list head entries */
44-
#define luo_list_for_each_private(pos, head, member) \
45-
for (struct list_head *__iter = (head)->next; \
46-
__iter != (head) && \
47-
({ pos = container_of(__iter, typeof(*(pos)), member); 1; }); \
48-
__iter = __iter->next)
49-
5043
/**
5144
* struct luo_file_set - A set of files that belong to the same sessions.
5245
* @files_list: An ordered list of files associated with this session, it is

0 commit comments

Comments
 (0)