linux/sound/core/pcm_compat.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   32bit -> 64bit ioctl wrapper for PCM API
 *   Copyright (c) by Takashi Iwai <[email protected]>
 */

/* This file included from pcm_native.c */

#include <linux/compat.h>
#include <linux/slab.h>

static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream,
				      s32 __user *src)
{}

static int snd_pcm_ioctl_rewind_compat(struct snd_pcm_substream *substream,
				       u32 __user *src)
{}

static int snd_pcm_ioctl_forward_compat(struct snd_pcm_substream *substream,
				       u32 __user *src)
{}

struct snd_pcm_hw_params32 {};

struct snd_pcm_sw_params32 {};

static int snd_pcm_ioctl_sw_params_compat(struct snd_pcm_substream *substream,
					  struct snd_pcm_sw_params32 __user *src)
{}

struct snd_pcm_channel_info32 {};

static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substream,
					     struct snd_pcm_channel_info32 __user *src)
{}

#ifdef CONFIG_X86_X32_ABI
/* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */
static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
				     struct snd_pcm_channel_info __user *src);
#define snd_pcm_ioctl_channel_info_x32(s, p)
#endif /* CONFIG_X86_X32_ABI */

struct compat_snd_pcm_status64 {} __packed;

static int snd_pcm_status_user_compat64(struct snd_pcm_substream *substream,
					struct compat_snd_pcm_status64 __user *src,
					bool ext)
{}

/* both for HW_PARAMS and HW_REFINE */
static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
					  int refine, 
					  struct snd_pcm_hw_params32 __user *data32)
{}


/*
 */
struct snd_xferi32 {};

static int snd_pcm_ioctl_xferi_compat(struct snd_pcm_substream *substream,
				      int dir, struct snd_xferi32 __user *data32)
{}


/* snd_xfern needs remapping of bufs */
struct snd_xfern32 {};

/*
 * xfern ioctl nees to copy (up to) 128 pointers on stack.
 * although we may pass the copied pointers through f_op->ioctl, but the ioctl
 * handler there expands again the same 128 pointers on stack, so it is better
 * to handle the function (calling pcm_readv/writev) directly in this handler.
 */
static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
				      int dir, struct snd_xfern32 __user *data32)
{}

#ifdef CONFIG_X86_X32_ABI
/* X32 ABI has 64bit timespec and 64bit alignment */
struct snd_pcm_mmap_status_x32 {} __packed;

struct snd_pcm_mmap_control_x32 {};

struct snd_pcm_sync_ptr_x32 {} __packed;

static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream,
				      struct snd_pcm_sync_ptr_x32 __user *src)
{}
#endif /* CONFIG_X86_X32_ABI */

#ifdef __BIG_ENDIAN
typedef char __pad_before_u32[4];
typedef char __pad_after_u32[0];
#else
__pad_before_u32;
__pad_after_u32;
#endif

/* PCM 2.0.15 API definition had a bug in mmap control; it puts the avail_min
 * at the wrong offset due to a typo in padding type.
 * The bug hits only 32bit.
 * A workaround for incorrect read/write is needed only in 32bit compat mode.
 */
struct __snd_pcm_mmap_control64_buggy {};

static int snd_pcm_ioctl_sync_ptr_buggy(struct snd_pcm_substream *substream,
					struct snd_pcm_sync_ptr __user *_sync_ptr)
{}

/*
 */
enum {};

static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{}