[PATCH 08/12] libfrog: move workqueue.h to libfrog/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Move this header to libfrog since the code is there already.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 include/workqueue.h |   41 -----------------------------------------
 libfrog/Makefile    |    3 ++-
 libfrog/workqueue.h |   41 +++++++++++++++++++++++++++++++++++++++++
 repair/threads.h    |    2 +-
 scrub/fscounters.c  |    2 +-
 scrub/inodes.c      |    2 +-
 scrub/phase1.c      |    2 +-
 scrub/phase2.c      |    2 +-
 scrub/phase3.c      |    2 +-
 scrub/phase4.c      |    2 +-
 scrub/phase5.c      |    2 +-
 scrub/phase6.c      |    2 +-
 scrub/read_verify.c |    2 +-
 scrub/spacemap.c    |    2 +-
 scrub/vfs.c         |    2 +-
 15 files changed, 55 insertions(+), 54 deletions(-)
 delete mode 100644 include/workqueue.h
 create mode 100644 libfrog/workqueue.h


diff --git a/include/workqueue.h b/include/workqueue.h
deleted file mode 100644
index c45dc4fb..00000000
--- a/include/workqueue.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2017 Oracle.  All Rights Reserved.
- * Author: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
- */
-#ifndef	_WORKQUEUE_H_
-#define	_WORKQUEUE_H_
-
-#include <pthread.h>
-
-struct workqueue;
-
-typedef void workqueue_func_t(struct workqueue *wq, uint32_t index, void *arg);
-
-struct workqueue_item {
-	struct workqueue	*queue;
-	struct workqueue_item	*next;
-	workqueue_func_t	*function;
-	void			*arg;
-	uint32_t		index;
-};
-
-struct workqueue {
-	void			*wq_ctx;
-	pthread_t		*threads;
-	struct workqueue_item	*next_item;
-	struct workqueue_item	*last_item;
-	pthread_mutex_t		lock;
-	pthread_cond_t		wakeup;
-	unsigned int		item_count;
-	unsigned int		thread_count;
-	bool			terminate;
-};
-
-int workqueue_create(struct workqueue *wq, void *wq_ctx,
-		unsigned int nr_workers);
-int workqueue_add(struct workqueue *wq, workqueue_func_t fn,
-		uint32_t index, void *arg);
-void workqueue_destroy(struct workqueue *wq);
-
-#endif	/* _WORKQUEUE_H_ */
diff --git a/libfrog/Makefile b/libfrog/Makefile
index 482893ef..5506c96f 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile
@@ -37,7 +37,8 @@ crc32table.h \
 fsgeom.h \
 ptvar.h \
 radix-tree.h \
-topology.h
+topology.h \
+workqueue.h
 
 LSRCFILES += gen_crc32table.c
 
diff --git a/libfrog/workqueue.h b/libfrog/workqueue.h
new file mode 100644
index 00000000..a1f3a57c
--- /dev/null
+++ b/libfrog/workqueue.h
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 Oracle.  All Rights Reserved.
+ * Author: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
+ */
+#ifndef	__LIBFROG_WORKQUEUE_H__
+#define	__LIBFROG_WORKQUEUE_H__
+
+#include <pthread.h>
+
+struct workqueue;
+
+typedef void workqueue_func_t(struct workqueue *wq, uint32_t index, void *arg);
+
+struct workqueue_item {
+	struct workqueue	*queue;
+	struct workqueue_item	*next;
+	workqueue_func_t	*function;
+	void			*arg;
+	uint32_t		index;
+};
+
+struct workqueue {
+	void			*wq_ctx;
+	pthread_t		*threads;
+	struct workqueue_item	*next_item;
+	struct workqueue_item	*last_item;
+	pthread_mutex_t		lock;
+	pthread_cond_t		wakeup;
+	unsigned int		item_count;
+	unsigned int		thread_count;
+	bool			terminate;
+};
+
+int workqueue_create(struct workqueue *wq, void *wq_ctx,
+		unsigned int nr_workers);
+int workqueue_add(struct workqueue *wq, workqueue_func_t fn,
+		uint32_t index, void *arg);
+void workqueue_destroy(struct workqueue *wq);
+
+#endif	/* __LIBFROG_WORKQUEUE_H__ */
diff --git a/repair/threads.h b/repair/threads.h
index 22f74d1f..55c7c632 100644
--- a/repair/threads.h
+++ b/repair/threads.h
@@ -3,7 +3,7 @@
 #ifndef	_XFS_REPAIR_THREADS_H_
 #define	_XFS_REPAIR_THREADS_H_
 
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 
 void	thread_init(void);
 
diff --git a/scrub/fscounters.c b/scrub/fscounters.c
index f8cc1e94..9635c44f 100644
--- a/scrub/fscounters.c
+++ b/scrub/fscounters.c
@@ -11,7 +11,7 @@
 #include "xfs_arch.h"
 #include "xfs_format.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "fscounters.h"
diff --git a/scrub/inodes.c b/scrub/inodes.c
index faffef54..19923de5 100644
--- a/scrub/inodes.c
+++ b/scrub/inodes.c
@@ -13,7 +13,7 @@
 #include "xfs_format.h"
 #include "handle.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "inodes.h"
diff --git a/scrub/phase1.c b/scrub/phase1.c
index 23df9a15..d0e77cab 100644
--- a/scrub/phase1.c
+++ b/scrub/phase1.c
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <pthread.h>
 #include "libfrog.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "input.h"
 #include "path.h"
 #include "handle.h"
diff --git a/scrub/phase2.c b/scrub/phase2.c
index a80da7fd..baec11dd 100644
--- a/scrub/phase2.c
+++ b/scrub/phase2.c
@@ -9,7 +9,7 @@
 #include <sys/statvfs.h>
 #include "list.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "scrub.h"
diff --git a/scrub/phase3.c b/scrub/phase3.c
index 8c02f1cb..64a499c3 100644
--- a/scrub/phase3.c
+++ b/scrub/phase3.c
@@ -9,7 +9,7 @@
 #include <sys/statvfs.h>
 #include "list.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "counter.h"
diff --git a/scrub/phase4.c b/scrub/phase4.c
index 49f00723..14074835 100644
--- a/scrub/phase4.c
+++ b/scrub/phase4.c
@@ -10,7 +10,7 @@
 #include <sys/statvfs.h>
 #include "list.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "progress.h"
diff --git a/scrub/phase5.c b/scrub/phase5.c
index f3ee22e6..ab015821 100644
--- a/scrub/phase5.c
+++ b/scrub/phase5.c
@@ -15,7 +15,7 @@
 #include "handle.h"
 #include "list.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "inodes.h"
diff --git a/scrub/phase6.c b/scrub/phase6.c
index 9b0d228a..d0e62cea 100644
--- a/scrub/phase6.c
+++ b/scrub/phase6.c
@@ -9,7 +9,7 @@
 #include <sys/statvfs.h>
 #include "handle.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "libfrog/bitmap.h"
diff --git a/scrub/read_verify.c b/scrub/read_verify.c
index d56f4893..828f6be6 100644
--- a/scrub/read_verify.c
+++ b/scrub/read_verify.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <sys/statvfs.h>
 #include "libfrog/ptvar.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "path.h"
 #include "xfs_scrub.h"
 #include "common.h"
diff --git a/scrub/spacemap.c b/scrub/spacemap.c
index c3621a3a..774efbaa 100644
--- a/scrub/spacemap.c
+++ b/scrub/spacemap.c
@@ -8,7 +8,7 @@
 #include <string.h>
 #include <pthread.h>
 #include <sys/statvfs.h>
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "path.h"
 #include "xfs_scrub.h"
 #include "common.h"
diff --git a/scrub/vfs.c b/scrub/vfs.c
index 7b0b5bcd..7d79e7f7 100644
--- a/scrub/vfs.c
+++ b/scrub/vfs.c
@@ -10,7 +10,7 @@
 #include <sys/statvfs.h>
 #include "handle.h"
 #include "path.h"
-#include "workqueue.h"
+#include "libfrog/workqueue.h"
 #include "xfs_scrub.h"
 #include "common.h"
 #include "vfs.h"




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux