linux/net/9p/trans_fd.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Fd transport layer.  Includes deprecated socket layer.
 *
 *  Copyright (C) 2006 by Russ Cox <[email protected]>
 *  Copyright (C) 2004-2005 by Latchesar Ionkov <[email protected]>
 *  Copyright (C) 2004-2008 by Eric Van Hensbergen <[email protected]>
 *  Copyright (C) 1997-2002 by Ron Minnich <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/in.h>
#include <linux/module.h>
#include <linux/net.h>
#include <linux/ipv6.h>
#include <linux/kthread.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/un.h>
#include <linux/uaccess.h>
#include <linux/inet.h>
#include <linux/file.h>
#include <linux/parser.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>

#include <linux/syscalls.h> /* killme */

#define P9_PORT
#define MAX_SOCK_BUF
#define MAXPOLLWADDR

static struct p9_trans_module p9_tcp_trans;
static struct p9_trans_module p9_fd_trans;

/**
 * struct p9_fd_opts - per-transport options
 * @rfd: file descriptor for reading (trans=fd)
 * @wfd: file descriptor for writing (trans=fd)
 * @port: port to connect to (trans=tcp)
 * @privport: port is privileged
 */

struct p9_fd_opts {};

/*
  * Option Parsing (code inspired by NFS code)
  *  - a little lazy - parse all fd-transport options
  */

enum {};

static const match_table_t tokens =;

enum {};

struct p9_poll_wait {};

/**
 * struct p9_conn - fd mux connection state information
 * @mux_list: list link for mux to manage multiple connections (?)
 * @client: reference to client instance for this connection
 * @err: error state
 * @req_lock: lock protecting req_list and requests statuses
 * @req_list: accounting for requests which have been sent
 * @unsent_req_list: accounting for requests that haven't been sent
 * @rreq: read request
 * @wreq: write request
 * @tmp_buf: temporary buffer to read in header
 * @rc: temporary fcall for reading current frame
 * @wpos: write position for current frame
 * @wsize: amount of data to write for current frame
 * @wbuf: current write buffer
 * @poll_pending_link: pending links to be polled per conn
 * @poll_wait: array of wait_q's for various worker threads
 * @pt: poll state
 * @rq: current read work
 * @wq: current write work
 * @wsched: ????
 *
 */

struct p9_conn {};

/**
 * struct p9_trans_fd - transport state
 * @rd: reference to file to read from
 * @wr: reference of file to write to
 * @conn: connection state reference
 *
 */

struct p9_trans_fd {};

static void p9_poll_workfn(struct work_struct *work);

static DEFINE_SPINLOCK(p9_poll_lock);
static LIST_HEAD(p9_poll_pending_list);
static DECLARE_WORK(p9_poll_work, p9_poll_workfn);

static unsigned int p9_ipport_resv_min =;
static unsigned int p9_ipport_resv_max =;

static void p9_mux_poll_stop(struct p9_conn *m)
{}

/**
 * p9_conn_cancel - cancel all pending requests with error
 * @m: mux data
 * @err: error code
 *
 */

static void p9_conn_cancel(struct p9_conn *m, int err)
{}

static __poll_t
p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt, int *err)
{}

/**
 * p9_fd_read- read from a fd
 * @client: client instance
 * @v: buffer to receive data into
 * @len: size of receive buffer
 *
 */

static int p9_fd_read(struct p9_client *client, void *v, int len)
{}

/**
 * p9_read_work - called when there is some data to be read from a transport
 * @work: container of work to be done
 *
 */

static void p9_read_work(struct work_struct *work)
{}

/**
 * p9_fd_write - write to a socket
 * @client: client instance
 * @v: buffer to send data from
 * @len: size of send buffer
 *
 */

static int p9_fd_write(struct p9_client *client, void *v, int len)
{}

/**
 * p9_write_work - called when a transport can send some data
 * @work: container for work to be done
 *
 */

static void p9_write_work(struct work_struct *work)
{}

static int p9_pollwake(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key)
{}

/**
 * p9_pollwait - add poll task to the wait queue
 * @filp: file pointer being polled
 * @wait_address: wait_q to block on
 * @p: poll state
 *
 * called by files poll operation to add v9fs-poll task to files wait queue
 */

static void
p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p)
{}

/**
 * p9_conn_create - initialize the per-session mux data
 * @client: client instance
 *
 * Note: Creates the polling task if this is the first session.
 */

static void p9_conn_create(struct p9_client *client)
{}

/**
 * p9_poll_mux - polls a mux and schedules read or write works if necessary
 * @m: connection to poll
 *
 */

static void p9_poll_mux(struct p9_conn *m)
{}

/**
 * p9_fd_request - send 9P request
 * The function can sleep until the request is scheduled for sending.
 * The function can be interrupted. Return from the function is not
 * a guarantee that the request is sent successfully.
 *
 * @client: client instance
 * @req: request to be sent
 *
 */

static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)
{}

static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
{}

static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
{}

static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt)
{}

/**
 * parse_opts - parse mount options into p9_fd_opts structure
 * @params: options string passed from mount
 * @opts: fd transport-specific structure to parse options into
 *
 * Returns 0 upon success, -ERRNO upon failure
 */

static int parse_opts(char *params, struct p9_fd_opts *opts)
{}

static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
{}

static int p9_socket_open(struct p9_client *client, struct socket *csocket)
{}

/**
 * p9_conn_destroy - cancels all pending requests of mux
 * @m: mux to destroy
 *
 */

static void p9_conn_destroy(struct p9_conn *m)
{}

/**
 * p9_fd_close - shutdown file descriptor transport
 * @client: client instance
 *
 */

static void p9_fd_close(struct p9_client *client)
{}

/*
 * stolen from NFS - maybe should be made a generic function?
 */
static inline int valid_ipaddr4(const char *buf)
{}

static int p9_bind_privport(struct socket *sock)
{}


static int
p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
{}

static int
p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
{}

static int
p9_fd_create(struct p9_client *client, const char *addr, char *args)
{}

static struct p9_trans_module p9_tcp_trans =;
MODULE_ALIAS_9P();

static struct p9_trans_module p9_unix_trans =;
MODULE_ALIAS_9P();

static struct p9_trans_module p9_fd_trans =;
MODULE_ALIAS_9P();

/**
 * p9_poll_workfn - poll worker thread
 * @work: work queue
 *
 * polls all v9fs transports for new events and queues the appropriate
 * work to the work queue
 *
 */

static void p9_poll_workfn(struct work_struct *work)
{}

static int __init p9_trans_fd_init(void)
{}

static void __exit p9_trans_fd_exit(void)
{}

module_init();
module_exit(p9_trans_fd_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();