linux/drivers/usb/usbip/usbip_common.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2003-2008 Takahiro Hirofuchi
 * Copyright (C) 2015-2016 Samsung Electronics
 *               Krzysztof Opasiak <[email protected]>
 */

#include <asm/byteorder.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <net/sock.h>

#include "usbip_common.h"

#define DRIVER_AUTHOR
#define DRIVER_DESC

#ifdef CONFIG_USBIP_DEBUG
unsigned long usbip_debug_flag =;
#else
unsigned long usbip_debug_flag;
#endif
EXPORT_SYMBOL_GPL();
module_param(usbip_debug_flag, ulong, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();

/* FIXME */
struct device_attribute dev_attr_usbip_debug;
EXPORT_SYMBOL_GPL();

static ssize_t usbip_debug_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t usbip_debug_store(struct device *dev,
				 struct device_attribute *attr, const char *buf,
				 size_t count)
{}
DEVICE_ATTR_RW();

static void usbip_dump_buffer(char *buff, int bufflen)
{}

static void usbip_dump_pipe(unsigned int p)
{}

static void usbip_dump_usb_device(struct usb_device *udev)
{}

static void usbip_dump_request_type(__u8 rt)
{}

static void usbip_dump_usb_ctrlrequest(struct usb_ctrlrequest *cmd)
{}

void usbip_dump_urb(struct urb *urb)
{}
EXPORT_SYMBOL_GPL();

void usbip_dump_header(struct usbip_header *pdu)
{}
EXPORT_SYMBOL_GPL();

/* Receive data over TCP/IP. */
int usbip_recv(struct socket *sock, void *buf, int size)
{}
EXPORT_SYMBOL_GPL();

/* there may be more cases to tweak the flags. */
static unsigned int tweak_transfer_flags(unsigned int flags)
{}

/*
 * USBIP driver packs URB transfer flags in PDUs that are exchanged
 * between Server (usbip_host) and Client (vhci_hcd). URB_* flags
 * are internal to kernel and could change. Where as USBIP URB flags
 * exchanged in PDUs are USBIP user API must not change.
 *
 * USBIP_URB* flags are exported as explicit API and client and server
 * do mapping from kernel flags to USBIP_URB*. Details as follows:
 *
 * Client tx path (USBIP_CMD_SUBMIT):
 * - Maps URB_* to USBIP_URB_* when it sends USBIP_CMD_SUBMIT packet.
 *
 * Server rx path (USBIP_CMD_SUBMIT):
 * - Maps USBIP_URB_* to URB_* when it receives USBIP_CMD_SUBMIT packet.
 *
 * Flags aren't included in USBIP_CMD_UNLINK and USBIP_RET_SUBMIT packets
 * and no special handling is needed for them in the following cases:
 * - Server rx path (USBIP_CMD_UNLINK)
 * - Client rx path & Server tx path (USBIP_RET_SUBMIT)
 *
 * Code paths:
 * usbip_pack_pdu() is the common routine that handles packing pdu from
 * urb and unpack pdu to an urb.
 *
 * usbip_pack_cmd_submit() and usbip_pack_ret_submit() handle
 * USBIP_CMD_SUBMIT and USBIP_RET_SUBMIT respectively.
 *
 * usbip_map_urb_to_usbip() and usbip_map_usbip_to_urb() are used
 * by usbip_pack_cmd_submit() and usbip_pack_ret_submit() to map
 * flags.
 */

struct urb_to_usbip_flags {};

#define NUM_USBIP_FLAGS

static const struct urb_to_usbip_flags flag_map[NUM_USBIP_FLAGS] =;

static unsigned int urb_to_usbip(unsigned int flags)
{}

static unsigned int usbip_to_urb(unsigned int flags)
{}

static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb,
				  int pack)
{}

static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb,
				  int pack)
{}

void usbip_pack_pdu(struct usbip_header *pdu, struct urb *urb, int cmd,
		    int pack)
{}
EXPORT_SYMBOL_GPL();

static void correct_endian_basic(struct usbip_header_basic *base, int send)
{}

static void correct_endian_cmd_submit(struct usbip_header_cmd_submit *pdu,
				      int send)
{}

static void correct_endian_ret_submit(struct usbip_header_ret_submit *pdu,
				      int send)
{}

static void correct_endian_cmd_unlink(struct usbip_header_cmd_unlink *pdu,
				      int send)
{}

static void correct_endian_ret_unlink(struct usbip_header_ret_unlink *pdu,
				      int send)
{}

void usbip_header_correct_endian(struct usbip_header *pdu, int send)
{}
EXPORT_SYMBOL_GPL();

static void usbip_iso_packet_correct_endian(
		struct usbip_iso_packet_descriptor *iso, int send)
{}

static void usbip_pack_iso(struct usbip_iso_packet_descriptor *iso,
			   struct usb_iso_packet_descriptor *uiso, int pack)
{}

/* must free buffer */
struct usbip_iso_packet_descriptor*
usbip_alloc_iso_desc_pdu(struct urb *urb, ssize_t *bufflen)
{}
EXPORT_SYMBOL_GPL();

/* some members of urb must be substituted before. */
int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)
{}
EXPORT_SYMBOL_GPL();

/*
 * This functions restores the padding which was removed for optimizing
 * the bandwidth during transfer over tcp/ip
 *
 * buffer and iso packets need to be stored and be in propeper endian in urb
 * before calling this function
 */
void usbip_pad_iso(struct usbip_device *ud, struct urb *urb)
{}
EXPORT_SYMBOL_GPL();

/* some members of urb must be substituted before. */
int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
{}
EXPORT_SYMBOL_GPL();

static int __init usbip_core_init(void)
{}

static void __exit usbip_core_exit(void)
{}

module_init();
module_exit(usbip_core_exit);

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