52 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright 2023 Red Hat4 */5 6#ifndef VDO_WORK_QUEUE_H7#define VDO_WORK_QUEUE_H8 9#include <linux/sched.h> /* for TASK_COMM_LEN */10 11#include "types.h"12 13enum {14 MAX_VDO_WORK_QUEUE_NAME_LEN = TASK_COMM_LEN,15};16 17struct vdo_work_queue_type {18 void (*start)(void *context);19 void (*finish)(void *context);20 enum vdo_completion_priority max_priority;21 enum vdo_completion_priority default_priority;22};23 24struct vdo_completion;25struct vdo_thread;26struct vdo_work_queue;27 28int vdo_make_work_queue(const char *thread_name_prefix, const char *name,29 struct vdo_thread *owner, const struct vdo_work_queue_type *type,30 unsigned int thread_count, void *thread_privates[],31 struct vdo_work_queue **queue_ptr);32 33void vdo_enqueue_work_queue(struct vdo_work_queue *queue, struct vdo_completion *completion);34 35void vdo_finish_work_queue(struct vdo_work_queue *queue);36 37void vdo_free_work_queue(struct vdo_work_queue *queue);38 39void vdo_dump_work_queue(struct vdo_work_queue *queue);40 41void vdo_dump_completion_to_buffer(struct vdo_completion *completion, char *buffer,42 size_t length);43 44void *vdo_get_work_queue_private_data(void);45struct vdo_work_queue *vdo_get_current_work_queue(void);46struct vdo_thread *vdo_get_work_queue_owner(struct vdo_work_queue *queue);47 48bool __must_check vdo_work_queue_type_is(struct vdo_work_queue *queue,49 const struct vdo_work_queue_type *type);50 51#endif /* VDO_WORK_QUEUE_H */52