linux/net/9p/trans_usbg.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * trans_usbg.c - USB peripheral usb9pfs configuration driver and transport.
 *
 * Copyright (C) 2024 Michael Grzeschik <[email protected]>
 */

/* Gadget usb9pfs only needs two bulk endpoints, and will use the usb9pfs
 * transport to mount host exported filesystem via usb gadget.
 */

/*     +--------------------------+    |    +--------------------------+
 *     |  9PFS mounting client    |    |    |  9PFS exporting server   |
 *  SW |                          |    |    |                          |
 *     |   (this:trans_usbg)      |    |    |(e.g. diod or nfs-ganesha)|
 *     +-------------^------------+    |    +-------------^------------+
 *                   |                 |                  |
 * ------------------|------------------------------------|-------------
 *                   |                 |                  |
 *     +-------------v------------+    |    +-------------v------------+
 *     |                          |    |    |                          |
 *  HW |   USB Device Controller  <--------->   USB Host Controller    |
 *     |                          |    |    |                          |
 *     +--------------------------+    |    +--------------------------+
 */

#include <linux/cleanup.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb/composite.h>
#include <linux/usb/func_utils.h>

#include <net/9p/9p.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>

#define DEFAULT_BUFLEN

struct f_usb9pfs {};

static inline struct f_usb9pfs *func_to_usb9pfs(struct usb_function *f)
{}

struct f_usb9pfs_opts {};

struct f_usb9pfs_dev {};

static DEFINE_MUTEX(usb9pfs_lock);
static struct list_head usbg_instance_list;

static int usb9pfs_queue_tx(struct f_usb9pfs *usb9pfs, struct p9_req_t *p9_tx_req,
			    gfp_t gfp_flags)
{}

static int usb9pfs_queue_rx(struct f_usb9pfs *usb9pfs, struct usb_request *req,
			    gfp_t gfp_flags)
{}

static int usb9pfs_transmit(struct f_usb9pfs *usb9pfs, struct p9_req_t *p9_req)
{}

static void usb9pfs_tx_complete(struct usb_ep *ep, struct usb_request *req)
{}

static struct p9_req_t *usb9pfs_rx_header(struct f_usb9pfs *usb9pfs, void *buf)
{}

static void usb9pfs_rx_complete(struct usb_ep *ep, struct usb_request *req)
{}

static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep)
{}

static void disable_usb9pfs(struct f_usb9pfs *usb9pfs)
{}

static int alloc_requests(struct usb_composite_dev *cdev,
			  struct f_usb9pfs *usb9pfs)
{}

static int enable_endpoint(struct usb_composite_dev *cdev,
			   struct f_usb9pfs *usb9pfs, struct usb_ep *ep)
{}

static int
enable_usb9pfs(struct usb_composite_dev *cdev, struct f_usb9pfs *usb9pfs)
{}

static int p9_usbg_create(struct p9_client *client, const char *devname, char *args)
{}

static void usb9pfs_clear_tx(struct f_usb9pfs *usb9pfs)
{}

static void p9_usbg_close(struct p9_client *client)
{}

static int p9_usbg_request(struct p9_client *client, struct p9_req_t *p9_req)
{}

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

static struct p9_trans_module p9_usbg_trans =;

/*-------------------------------------------------------------------------*/

#define USB_PROTOCOL_9PFS

static struct usb_interface_descriptor usb9pfs_intf =;

/* full speed support: */

static struct usb_endpoint_descriptor fs_usb9pfs_source_desc =;

static struct usb_endpoint_descriptor fs_usb9pfs_sink_desc =;

static struct usb_descriptor_header *fs_usb9pfs_descs[] =;

/* high speed support: */

static struct usb_endpoint_descriptor hs_usb9pfs_source_desc =;

static struct usb_endpoint_descriptor hs_usb9pfs_sink_desc =;

static struct usb_descriptor_header *hs_usb9pfs_descs[] =;

/* super speed support: */

static struct usb_endpoint_descriptor ss_usb9pfs_source_desc =;

static struct usb_ss_ep_comp_descriptor ss_usb9pfs_source_comp_desc =;

static struct usb_endpoint_descriptor ss_usb9pfs_sink_desc =;

static struct usb_ss_ep_comp_descriptor ss_usb9pfs_sink_comp_desc =;

static struct usb_descriptor_header *ss_usb9pfs_descs[] =;

/* function-specific strings: */
static struct usb_string strings_usb9pfs[] =;

static struct usb_gadget_strings stringtab_usb9pfs =;

static struct usb_gadget_strings *usb9pfs_strings[] =;

/*-------------------------------------------------------------------------*/

static int usb9pfs_func_bind(struct usb_configuration *c,
			     struct usb_function *f)
{}

static void usb9pfs_func_unbind(struct usb_configuration *c,
				struct usb_function *f)
{}

static void usb9pfs_free_func(struct usb_function *f)
{}

static int usb9pfs_set_alt(struct usb_function *f,
			   unsigned int intf, unsigned int alt)
{}

static void usb9pfs_disable(struct usb_function *f)
{}

static struct usb_function *usb9pfs_alloc(struct usb_function_instance *fi)
{}

static inline struct f_usb9pfs_opts *to_f_usb9pfs_opts(struct config_item *item)
{}

static inline struct f_usb9pfs_opts *fi_to_f_usb9pfs_opts(struct usb_function_instance *fi)
{}

static void usb9pfs_attr_release(struct config_item *item)
{}

static struct configfs_item_operations usb9pfs_item_ops =;

static ssize_t f_usb9pfs_opts_buflen_show(struct config_item *item, char *page)
{}

static ssize_t f_usb9pfs_opts_buflen_store(struct config_item *item,
					   const char *page, size_t len)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *usb9pfs_attrs[] =;

static const struct config_item_type usb9pfs_func_type =;

static struct f_usb9pfs_dev *_usb9pfs_do_find_dev(const char *tag)
{}

static int usb9pfs_tag_instance(struct f_usb9pfs_dev *dev, const char *tag)
{}

static int usb9pfs_set_inst_tag(struct usb_function_instance *fi, const char *tag)
{}

static void usb9pfs_free_instance(struct usb_function_instance *fi)
{}

static struct usb_function_instance *usb9pfs_alloc_instance(void)
{}
DECLARE_USB_FUNCTION(usb9pfs, usb9pfs_alloc_instance, usb9pfs_alloc);

static int __init usb9pfs_modinit(void)
{}

static void __exit usb9pfs_modexit(void)
{}

module_init();
module_exit(usb9pfs_modexit);

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