Module Name: src Committed By: riastradh Date: Sun Dec 19 01:04:05 UTC 2021
Modified Files: src/sys/external/bsd/common/include/linux: workqueue.h src/sys/external/bsd/common/linux: linux_work.c Log Message: Add work_pending, delayed_work_pending. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 \ src/sys/external/bsd/common/include/linux/workqueue.h cvs rdiff -u -r1.48 -r1.49 src/sys/external/bsd/common/linux/linux_work.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/common/include/linux/workqueue.h diff -u src/sys/external/bsd/common/include/linux/workqueue.h:1.16 src/sys/external/bsd/common/include/linux/workqueue.h:1.17 --- src/sys/external/bsd/common/include/linux/workqueue.h:1.16 Sun Dec 19 01:03:57 2021 +++ src/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 01:04:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.16 2021/12/19 01:03:57 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.17 2021/12/19 01:04:05 riastradh Exp $ */ /*- * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. @@ -45,6 +45,7 @@ #define cancel_work linux_cancel_work #define cancel_work_sync linux_cancel_work_sync #define current_work linux_current_work +#define delayed_work_pending linux_delayed_work_pending #define destroy_workqueue linux_destroy_workqueue #define flush_delayed_work linux_flush_delayed_work #define flush_scheduled_work linux_flush_scheduled_work @@ -60,6 +61,7 @@ #define system_unbound_wq linux_system_unbound_wq #define system_wq linux_system_wq #define to_delayed_work linux_to_delayed_work +#define work_pending linux_work_pending struct workqueue_struct; @@ -111,6 +113,7 @@ bool queue_work(struct workqueue_struct bool cancel_work(struct work_struct *); bool cancel_work_sync(struct work_struct *); bool flush_work(struct work_struct *); +bool work_pending(struct work_struct *); void INIT_DELAYED_WORK(struct delayed_work *, void (*)(struct work_struct *)); @@ -122,6 +125,7 @@ bool mod_delayed_work(struct workqueue_s bool cancel_delayed_work(struct delayed_work *); bool cancel_delayed_work_sync(struct delayed_work *); bool flush_delayed_work(struct delayed_work *); +bool delayed_work_pending(struct delayed_work *); struct work_struct * current_work(void); Index: src/sys/external/bsd/common/linux/linux_work.c diff -u src/sys/external/bsd/common/linux/linux_work.c:1.48 src/sys/external/bsd/common/linux/linux_work.c:1.49 --- src/sys/external/bsd/common/linux/linux_work.c:1.48 Sun Dec 19 01:03:57 2021 +++ src/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 01:04:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_work.c,v 1.48 2021/12/19 01:03:57 riastradh Exp $ */ +/* $NetBSD: linux_work.c,v 1.49 2021/12/19 01:04:05 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.48 2021/12/19 01:03:57 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.49 2021/12/19 01:04:05 riastradh Exp $"); #include <sys/types.h> #include <sys/atomic.h> @@ -538,6 +538,19 @@ work_claimed(struct work_struct *work, s } /* + * work_pending(work) + * + * True if work is currently claimed by any workqueue, scheduled + * to run on that workqueue. + */ +bool +work_pending(struct work_struct *work) +{ + + return work->work_owner & 1; +} + +/* * work_queue(work) * * Return the last queue that work was queued on, or NULL if it @@ -1526,3 +1539,15 @@ flush_delayed_work(struct delayed_work * return waited; } + +/* + * delayed_work_pending(dw) + * + * True if dw is currently scheduled to execute, false if not. + */ +bool +delayed_work_pending(struct delayed_work *dw) +{ + + return work_pending(&dw->work); +}