linux/include/linux/sunrpc/sched.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * linux/include/linux/sunrpc/sched.h
 *
 * Scheduling primitives for kernel Sun RPC.
 *
 * Copyright (C) 1996, Olaf Kirch <[email protected]>
 */

#ifndef _LINUX_SUNRPC_SCHED_H_
#define _LINUX_SUNRPC_SCHED_H_

#include <linux/timer.h>
#include <linux/ktime.h>
#include <linux/sunrpc/types.h>
#include <linux/spinlock.h>
#include <linux/wait_bit.h>
#include <linux/workqueue.h>
#include <linux/sunrpc/xdr.h>

/*
 * This is the actual RPC procedure call info.
 */
struct rpc_procinfo;
struct rpc_message {};

struct rpc_call_ops;
struct rpc_wait_queue;
struct rpc_wait {};

/*
 * This describes a timeout strategy
 */
struct rpc_timeout {};

/*
 * This is the RPC task struct
 */
struct rpc_task {};

rpc_action;

struct rpc_call_ops {};

struct rpc_task_setup {};

/*
 * RPC task flags
 */
#define RPC_TASK_ASYNC
#define RPC_TASK_SWAPPER
#define RPC_TASK_MOVEABLE
#define RPC_TASK_NULLCREDS
#define RPC_CALL_MAJORSEEN
#define RPC_TASK_DYNAMIC
#define RPC_TASK_NO_ROUND_ROBIN
#define RPC_TASK_SOFT
#define RPC_TASK_SOFTCONN
#define RPC_TASK_SENT
#define RPC_TASK_TIMEOUT
#define RPC_TASK_NOCONNECT
#define RPC_TASK_NO_RETRANS_TIMEOUT
#define RPC_TASK_CRED_NOREF

#define RPC_IS_ASYNC(t)
#define RPC_IS_SWAPPER(t)
#define RPC_IS_SOFT(t)
#define RPC_IS_SOFTCONN(t)
#define RPC_WAS_SENT(t)
#define RPC_IS_MOVEABLE(t)

enum {};

#define rpc_test_and_set_running(t)
#define rpc_clear_running(t)

#define RPC_IS_QUEUED(t)
#define rpc_set_queued(t)
#define rpc_clear_queued(t)

#define RPC_IS_ACTIVATED(t)

#define RPC_SIGNALLED(t)

/*
 * Task priorities.
 * Note: if you change these, you must also change
 * the task initialization definitions below.
 */
#define RPC_PRIORITY_LOW
#define RPC_PRIORITY_NORMAL
#define RPC_PRIORITY_HIGH
#define RPC_PRIORITY_PRIVILEGED
#define RPC_NR_PRIORITY

struct rpc_timer {};

/*
 * RPC synchronization objects
 */
struct rpc_wait_queue {};

/*
 * This is the # requests to send consecutively
 * from a single cookie.  The aim is to improve
 * performance of NFS operations such as read/write.
 */
#define RPC_IS_PRIORITY(q)

/*
 * Function prototypes
 */
struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
		struct rpc_timeout *timeout);
void		rpc_put_task(struct rpc_task *);
void		rpc_put_task_async(struct rpc_task *);
bool		rpc_task_set_rpc_status(struct rpc_task *task, int rpc_status);
void		rpc_task_try_cancel(struct rpc_task *task, int error);
void		rpc_signal_task(struct rpc_task *);
void		rpc_exit_task(struct rpc_task *);
void		rpc_exit(struct rpc_task *, int);
void		rpc_release_calldata(const struct rpc_call_ops *, void *);
void		rpc_killall_tasks(struct rpc_clnt *);
unsigned long	rpc_cancel_tasks(struct rpc_clnt *clnt, int error,
				 bool (*fnmatch)(const struct rpc_task *,
						 const void *),
				 const void *data);
void		rpc_execute(struct rpc_task *);
void		rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
void		rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
void		rpc_destroy_wait_queue(struct rpc_wait_queue *);
unsigned long	rpc_task_timeout(const struct rpc_task *task);
void		rpc_sleep_on_timeout(struct rpc_wait_queue *queue,
					struct rpc_task *task,
					rpc_action action,
					unsigned long timeout);
void		rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
					rpc_action action);
void		rpc_sleep_on_priority_timeout(struct rpc_wait_queue *queue,
					struct rpc_task *task,
					unsigned long timeout,
					int priority);
void		rpc_sleep_on_priority(struct rpc_wait_queue *,
					struct rpc_task *,
					int priority);
void		rpc_wake_up_queued_task(struct rpc_wait_queue *,
					struct rpc_task *);
void		rpc_wake_up_queued_task_set_status(struct rpc_wait_queue *,
						   struct rpc_task *,
						   int);
void		rpc_wake_up(struct rpc_wait_queue *);
struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
struct rpc_task *rpc_wake_up_first_on_wq(struct workqueue_struct *wq,
					struct rpc_wait_queue *,
					bool (*)(struct rpc_task *, void *),
					void *);
struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
					bool (*)(struct rpc_task *, void *),
					void *);
void		rpc_wake_up_status(struct rpc_wait_queue *, int);
void		rpc_delay(struct rpc_task *, unsigned long);
int		rpc_malloc(struct rpc_task *);
void		rpc_free(struct rpc_task *);
int		rpciod_up(void);
void		rpciod_down(void);
int		rpc_wait_for_completion_task(struct rpc_task *task);
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
struct net;
void		rpc_show_tasks(struct net *);
#endif
int		rpc_init_mempool(void);
void		rpc_destroy_mempool(void);
extern struct workqueue_struct *rpciod_workqueue;
extern struct workqueue_struct *xprtiod_workqueue;
void		rpc_prepare_task(struct rpc_task *task);
gfp_t		rpc_task_gfp_mask(void);

#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
static inline const char * rpc_qname(const struct rpc_wait_queue *q)
{}

static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
		const char *name)
{}
#else
static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
		const char *name)
{
}
#endif

#if IS_ENABLED(CONFIG_SUNRPC_SWAP)
int rpc_clnt_swap_activate(struct rpc_clnt *clnt);
void rpc_clnt_swap_deactivate(struct rpc_clnt *clnt);
#else
static inline int
rpc_clnt_swap_activate(struct rpc_clnt *clnt)
{
	return -EINVAL;
}

static inline void
rpc_clnt_swap_deactivate(struct rpc_clnt *clnt)
{
}
#endif /* CONFIG_SUNRPC_SWAP */

#endif /* _LINUX_SUNRPC_SCHED_H_ */