]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: add a helper function, add_endpoint
authorMasatake YAMATO <yamato@redhat.com>
Sat, 4 Mar 2023 05:16:44 +0000 (14:16 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 18 May 2023 18:27:27 +0000 (03:27 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-fifo.c
misc-utils/lsfd.c
misc-utils/lsfd.h

index 704bc06da4cae969132ec949f6b390d019dd4d2a..02951607349b55960ef75af8033ae4c4d699aa42 100644 (file)
@@ -132,8 +132,7 @@ static void fifo_initialize_content(struct file *file)
        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 = {
index cdfe311b9d2e22b73cf770d26444084f54a9f4a5..a5dcc1884f72ebab217d50151e5d6951f64c93c1 100644 (file)
@@ -1101,6 +1101,12 @@ void add_ipc(struct ipc *ipc, unsigned int hash)
        list_add(&ipc->ipcs, &ipc_table.tables[slot]);
 }
 
+void add_endpoint(struct ipc_endpoint *endpoint, struct ipc *ipc)
+{
+       endpoint->ipc = ipc;
+       list_add(&endpoint->endpoints, &ipc->endpoints);
+}
+
 static void fill_column(struct proc *proc,
                        struct file *file,
                        struct libscols_line *ln,
index 5a1cc9891b5cf96a3cf21968629681dfe75a6d1c..09a29043281de680b7015fe03bfe6269888bbf4b 100644 (file)
@@ -212,6 +212,7 @@ struct ipc_class {
 struct ipc *new_ipc(const struct ipc_class *class);
 struct ipc *get_ipc(struct file *file);
 void add_ipc(struct ipc *ipc, unsigned int hash);
+void add_endpoint(struct ipc_endpoint *endpoint, struct ipc *ipc);
 
 /*
  * Name managing