#include <sound/core.h>
#include <linux/major.h>
#include <linux/init.h>
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/wait.h>
#include <linux/mutex.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/nospec.h>
#include <sound/rawmidi.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/minors.h>
#include <sound/initval.h>
#include <sound/ump.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#ifdef CONFIG_SND_OSSEMUL
static int midi_map[SNDRV_CARDS];
static int amidi_map[SNDRV_CARDS] = …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
#endif
static int snd_rawmidi_dev_free(struct snd_device *device);
static int snd_rawmidi_dev_register(struct snd_device *device);
static int snd_rawmidi_dev_disconnect(struct snd_device *device);
static LIST_HEAD(snd_rawmidi_devices);
static DEFINE_MUTEX(register_mutex);
#define rmidi_err(rmidi, fmt, args...) …
#define rmidi_warn(rmidi, fmt, args...) …
#define rmidi_dbg(rmidi, fmt, args...) …
struct snd_rawmidi_status32 { … };
#define SNDRV_RAWMIDI_IOCTL_STATUS32 …
struct snd_rawmidi_status64 { … };
#define SNDRV_RAWMIDI_IOCTL_STATUS64 …
#define rawmidi_is_ump(rmidi) …
static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device)
{ … }
static inline unsigned short snd_rawmidi_file_flags(struct file *file)
{ … }
static inline bool __snd_rawmidi_ready(struct snd_rawmidi_runtime *runtime)
{ … }
static bool snd_rawmidi_ready(struct snd_rawmidi_substream *substream)
{ … }
static inline int snd_rawmidi_ready_append(struct snd_rawmidi_substream *substream,
size_t count)
{ … }
static void snd_rawmidi_input_event_work(struct work_struct *work)
{ … }
static inline void snd_rawmidi_buffer_ref(struct snd_rawmidi_runtime *runtime)
{ … }
static inline void snd_rawmidi_buffer_unref(struct snd_rawmidi_runtime *runtime)
{ … }
static void snd_rawmidi_buffer_ref_sync(struct snd_rawmidi_substream *substream)
{ … }
static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
{ … }
static inline int get_align(struct snd_rawmidi_runtime *runtime)
{ … }
#define get_aligned_size(runtime, size) …
static int snd_rawmidi_runtime_free(struct snd_rawmidi_substream *substream)
{ … }
static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
{ … }
static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
{ … }
static void __reset_runtime_ptrs(struct snd_rawmidi_runtime *runtime,
bool is_input)
{ … }
static void reset_runtime_ptrs(struct snd_rawmidi_substream *substream,
bool is_input)
{ … }
int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream)
{ … }
EXPORT_SYMBOL(…);
int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
{ … }
EXPORT_SYMBOL(…);
int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
{ … }
EXPORT_SYMBOL(…);
static int assign_substream(struct snd_rawmidi *rmidi, int subdevice,
int stream, int mode,
struct snd_rawmidi_substream **sub_ret)
{ … }
static int open_substream(struct snd_rawmidi *rmidi,
struct snd_rawmidi_substream *substream,
int mode)
{ … }
static void close_substream(struct snd_rawmidi *rmidi,
struct snd_rawmidi_substream *substream,
int cleanup);
static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
struct snd_rawmidi_file *rfile)
{ … }
int snd_rawmidi_kernel_open(struct snd_rawmidi *rmidi, int subdevice,
int mode, struct snd_rawmidi_file *rfile)
{ … }
EXPORT_SYMBOL(…);
static int snd_rawmidi_open(struct inode *inode, struct file *file)
{ … }
static void close_substream(struct snd_rawmidi *rmidi,
struct snd_rawmidi_substream *substream,
int cleanup)
{ … }
static void rawmidi_release_priv(struct snd_rawmidi_file *rfile)
{ … }
int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile)
{ … }
EXPORT_SYMBOL(…);
static int snd_rawmidi_release(struct inode *inode, struct file *file)
{ … }
static int snd_rawmidi_info(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_info *info)
{ … }
static int snd_rawmidi_info_user(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_info __user *_info)
{ … }
static int __snd_rawmidi_info_select(struct snd_card *card,
struct snd_rawmidi_info *info)
{ … }
int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
{ … }
EXPORT_SYMBOL(…);
static int snd_rawmidi_info_select_user(struct snd_card *card,
struct snd_rawmidi_info __user *_info)
{ … }
static int resize_runtime_buffer(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_params *params,
bool is_input)
{ … }
int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_params *params)
{ … }
EXPORT_SYMBOL(…);
int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_params *params)
{ … }
EXPORT_SYMBOL(…);
static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_status64 *status)
{ … }
static int snd_rawmidi_input_status(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_status64 *status)
{ … }
static int snd_rawmidi_ioctl_status32(struct snd_rawmidi_file *rfile,
struct snd_rawmidi_status32 __user *argp)
{ … }
static int snd_rawmidi_ioctl_status64(struct snd_rawmidi_file *rfile,
struct snd_rawmidi_status64 __user *argp)
{ … }
static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static int snd_rawmidi_next_device(struct snd_card *card, int __user *argp,
bool find_ump)
{ … }
#if IS_ENABLED(CONFIG_SND_UMP)
static int snd_rawmidi_call_ump_ioctl(struct snd_card *card, int cmd,
void __user *argp)
{ … }
#endif
static int snd_rawmidi_control_ioctl(struct snd_card *card,
struct snd_ctl_file *control,
unsigned int cmd,
unsigned long arg)
{ … }
static int receive_with_tstamp_framing(struct snd_rawmidi_substream *substream,
const unsigned char *buffer, int src_count, const struct timespec64 *tstamp)
{ … }
static struct timespec64 get_framing_tstamp(struct snd_rawmidi_substream *substream)
{ … }
int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
const unsigned char *buffer, int count)
{ … }
EXPORT_SYMBOL(…);
static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
unsigned char __user *userbuf,
unsigned char *kernelbuf, long count)
{ … }
long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
unsigned char *buf, long count)
{ … }
EXPORT_SYMBOL(…);
static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count,
loff_t *offset)
{ … }
int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
{ … }
EXPORT_SYMBOL(…);
static int __snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count)
{ … }
int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count)
{ … }
EXPORT_SYMBOL(…);
static int __snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream,
int count)
{ … }
int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
{ … }
EXPORT_SYMBOL(…);
int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count)
{ … }
EXPORT_SYMBOL(…);
int snd_rawmidi_proceed(struct snd_rawmidi_substream *substream)
{ … }
EXPORT_SYMBOL(…);
static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
const unsigned char __user *userbuf,
const unsigned char *kernelbuf,
long count)
{ … }
long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
const unsigned char *buf, long count)
{ … }
EXPORT_SYMBOL(…);
static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
size_t count, loff_t *offset)
{ … }
static __poll_t snd_rawmidi_poll(struct file *file, poll_table *wait)
{ … }
#ifdef CONFIG_COMPAT
#include "rawmidi_compat.c"
#else
#define snd_rawmidi_ioctl_compat …
#endif
static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static const struct file_operations snd_rawmidi_f_ops = …;
static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
struct snd_rawmidi_str *stream,
int direction,
int count)
{ … }
int snd_rawmidi_init(struct snd_rawmidi *rmidi,
struct snd_card *card, char *id, int device,
int output_count, int input_count,
unsigned int info_flags)
{ … }
EXPORT_SYMBOL_GPL(…);
int snd_rawmidi_new(struct snd_card *card, char *id, int device,
int output_count, int input_count,
struct snd_rawmidi **rrawmidi)
{ … }
EXPORT_SYMBOL(…);
static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
{ … }
int snd_rawmidi_free(struct snd_rawmidi *rmidi)
{ … }
EXPORT_SYMBOL_GPL(…);
static int snd_rawmidi_dev_free(struct snd_device *device)
{ … }
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device)
{ … }
#endif
static int snd_rawmidi_dev_register(struct snd_device *device)
{ … }
static int snd_rawmidi_dev_disconnect(struct snd_device *device)
{ … }
void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
const struct snd_rawmidi_ops *ops)
{ … }
EXPORT_SYMBOL(…);
static int __init alsa_rawmidi_init(void)
{ … }
static void __exit alsa_rawmidi_exit(void)
{ … }
module_init(…) …
module_exit(…)