linux/drivers/md/dm-vdo/wait-queue.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2023 Red Hat
 */

#include "wait-queue.h"

#include <linux/device-mapper.h>

#include "permassert.h"

#include "status-codes.h"

/**
 * vdo_waitq_enqueue_waiter() - Add a waiter to the tail end of a waitq.
 * @waitq: The vdo_wait_queue to which to add the waiter.
 * @waiter: The waiter to add to the waitq.
 *
 * The waiter must not already be waiting in a waitq.
 */
void vdo_waitq_enqueue_waiter(struct vdo_wait_queue *waitq, struct vdo_waiter *waiter)
{}

/**
 * vdo_waitq_transfer_all_waiters() - Transfer all waiters from one waitq to
 *                                    a second waitq, emptying the first waitq.
 * @from_waitq: The waitq containing the waiters to move.
 * @to_waitq: The waitq that will receive the waiters from the first waitq.
 */
void vdo_waitq_transfer_all_waiters(struct vdo_wait_queue *from_waitq,
				    struct vdo_wait_queue *to_waitq)
{}

/**
 * vdo_waitq_notify_all_waiters() - Notify all the entries waiting in a waitq.
 * @waitq: The vdo_wait_queue containing the waiters to notify.
 * @callback: The function to call to notify each waiter, or NULL to invoke the callback field
 *            registered in each waiter.
 * @context: The context to pass to the callback function.
 *
 * Notifies all the entries waiting in a waitq to continue execution by invoking a callback
 * function on each of them in turn. The waitq is copied and emptied before invoking any callbacks,
 * and only the waiters that were in the waitq at the start of the call will be notified.
 */
void vdo_waitq_notify_all_waiters(struct vdo_wait_queue *waitq,
				  vdo_waiter_callback_fn callback, void *context)
{}

/**
 * vdo_waitq_get_first_waiter() - Return the waiter that is at the head end of a waitq.
 * @waitq: The vdo_wait_queue from which to get the first waiter.
 *
 * Return: The first (oldest) waiter in the waitq, or NULL if the waitq is empty.
 */
struct vdo_waiter *vdo_waitq_get_first_waiter(const struct vdo_wait_queue *waitq)
{}

/**
 * vdo_waitq_dequeue_matching_waiters() - Remove all waiters that match based on the specified
 *                                        matching method and append them to a vdo_wait_queue.
 * @waitq: The vdo_wait_queue to process.
 * @waiter_match: The method to determine matching.
 * @match_context: Contextual info for the match method.
 * @matched_waitq: A wait_waitq to store matches.
 */
void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,
					vdo_waiter_match_fn waiter_match,
					void *match_context,
					struct vdo_wait_queue *matched_waitq)
{}

/**
 * vdo_waitq_dequeue_waiter() - Remove the first (oldest) waiter from a waitq.
 * @waitq: The vdo_wait_queue from which to remove the first entry.
 *
 * The caller will be responsible for waking the waiter by continuing its
 * execution appropriately.
 *
 * Return: The first (oldest) waiter in the waitq, or NULL if the waitq is empty.
 */
struct vdo_waiter *vdo_waitq_dequeue_waiter(struct vdo_wait_queue *waitq)
{}

/**
 * vdo_waitq_notify_next_waiter() - Notify the next entry waiting in a waitq.
 * @waitq: The vdo_wait_queue containing the waiter to notify.
 * @callback: The function to call to notify the waiter, or NULL to invoke the callback field
 *            registered in the waiter.
 * @context: The context to pass to the callback function.
 *
 * Notifies the next entry waiting in a waitq to continue execution by invoking a callback function
 * on it after removing it from the waitq.
 *
 * Return: true if there was a waiter in the waitq.
 */
bool vdo_waitq_notify_next_waiter(struct vdo_wait_queue *waitq,
				  vdo_waiter_callback_fn callback, void *context)
{}