From c61e14d3a8412cd50d98aab604e607692c844c8a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:30 +0200 Subject: Adding upstream version 2.40. Signed-off-by: Daniel Baumann --- misc-utils/lsfd-fifo.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'misc-utils/lsfd-fifo.c') diff --git a/misc-utils/lsfd-fifo.c b/misc-utils/lsfd-fifo.c index f736192..b78e6d4 100644 --- a/misc-utils/lsfd-fifo.c +++ b/misc-utils/lsfd-fifo.c @@ -19,10 +19,6 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "xalloc.h" -#include "nls.h" -#include "libsmartcols.h" - #include "lsfd.h" struct fifo { @@ -68,8 +64,8 @@ static bool fifo_fill_column(struct proc *proc __attribute__((__unused__)), case COL_ENDPOINTS: { struct fifo *this = (struct fifo *)file; struct list_head *e; - char *estr; - list_for_each_backwardly(e, &this->endpoint.ipc->endpoints) { + foreach_endpoint(e, this->endpoint) { + char *estr; struct fifo *other = list_entry(e, struct fifo, endpoint.endpoints); if (this == other) continue; @@ -107,6 +103,7 @@ static bool fifo_is_suitable_ipc(struct ipc *ipc, struct file *file) static const struct ipc_class *fifo_get_ipc_class(struct file *file __attribute__((__unused__))) { static const struct ipc_class fifo_ipc_class = { + .size = sizeof(struct fifo_ipc), .get_hash = fifo_get_hash, .is_suitable_ipc = fifo_is_suitable_ipc, .free = NULL, @@ -120,22 +117,18 @@ static void fifo_initialize_content(struct file *file) struct ipc *ipc; unsigned int hash; - INIT_LIST_HEAD(&fifo->endpoint.endpoints); + init_endpoint(&fifo->endpoint); ipc = get_ipc(file); if (ipc) goto link; - ipc = xmalloc(sizeof(struct fifo_ipc)); - ipc->class = fifo_get_ipc_class(file); - INIT_LIST_HEAD(&ipc->endpoints); - INIT_LIST_HEAD(&ipc->ipcs); + ipc = new_ipc(fifo_get_ipc_class(file)); ((struct fifo_ipc *)ipc)->ino = file->stat.st_ino; hash = fifo_get_hash(file); add_ipc(ipc, hash); link: - fifo->endpoint.ipc = ipc; - list_add(&fifo->endpoint.endpoints, &ipc->endpoints); + add_endpoint(&fifo->endpoint, ipc); } const struct file_class fifo_class = { -- cgit v1.2.3