sound/core/oss/pcm_oss.c
Source file repositories/reference/linux-study-clean/sound/core/oss/pcm_oss.c
File Facts
- System
- Linux kernel
- Corpus path
sound/core/oss/pcm_oss.c- Extension
.c- Size
- 88673 bytes
- Lines
- 3254
- Domain
- Driver Families
- Bucket
- sound/core
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/slab.hlinux/sched/signal.hlinux/time.hlinux/vmalloc.hlinux/module.hlinux/math64.hlinux/string.hlinux/compat.hsound/core.hsound/minors.hsound/pcm.hsound/pcm_params.hpcm_plugin.hsound/info.hlinux/soundcard.hsound/initval.hsound/mixer_oss.h
Detected Declarations
function snd_interval_refine_minfunction snd_interval_refine_maxfunction snd_interval_refine_setfunction snd_pcm_hw_param_value_minfunction snd_pcm_hw_param_value_maxfunction _snd_pcm_hw_param_maskfunction snd_pcm_hw_param_maskfunction _snd_pcm_hw_param_minfunction snd_pcm_hw_param_minfunction _snd_pcm_hw_param_maxfunction snd_pcm_hw_param_maxfunction boundary_subfunction boundary_ltfunction boundary_nearerfunction snd_pcm_hw_param_nearfunction _snd_pcm_hw_param_setfunction snd_pcm_hw_param_setfunction _snd_pcm_hw_param_setintegerfunction snd_pcm_oss_plugin_clearfunction snd_pcm_plugin_insertfunction snd_pcm_plugin_appendfunction snd_pcm_oss_bytesfunction snd_pcm_alsa_framesfunction get_hw_ptr_periodfunction snd_pcm_oss_format_fromfunction snd_pcm_oss_format_tofunction snd_pcm_oss_period_sizefunction choose_ratefunction lock_paramsfunction unlock_paramsfunction snd_pcm_oss_release_buffersfunction snd_pcm_oss_change_params_lockedfunction snd_pcm_oss_change_paramsfunction snd_pcm_oss_get_active_substreamfunction snd_pcm_oss_preparefunction snd_pcm_oss_make_readyfunction snd_pcm_oss_make_ready_lockedfunction snd_pcm_oss_capture_position_fixupfunction snd_pcm_oss_write3function snd_pcm_oss_read3function snd_pcm_oss_writev3function snd_pcm_oss_readv3function snd_pcm_oss_write2function snd_pcm_oss_write1function snd_pcm_oss_read2function snd_pcm_oss_read1function snd_pcm_oss_resetfunction snd_pcm_oss_post
Annotated Snippet
static const struct file_operations snd_pcm_oss_f_reg =
{
.owner = THIS_MODULE,
.read = snd_pcm_oss_read,
.write = snd_pcm_oss_write,
.open = snd_pcm_oss_open,
.release = snd_pcm_oss_release,
.poll = snd_pcm_oss_poll,
.unlocked_ioctl = snd_pcm_oss_ioctl,
.compat_ioctl = snd_pcm_oss_ioctl_compat,
.mmap = snd_pcm_oss_mmap,
};
static void register_oss_dsp(struct snd_pcm *pcm, int index)
{
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
pcm->card, index, &snd_pcm_oss_f_reg,
pcm) < 0) {
pcm_err(pcm, "unable to register OSS PCM device %i:%i\n",
pcm->card->number, pcm->device);
}
}
static int snd_pcm_oss_register_minor(struct snd_pcm *pcm)
{
pcm->oss.reg = 0;
if (dsp_map[pcm->card->number] == (int)pcm->device) {
char name[128];
int duplex;
register_oss_dsp(pcm, 0);
duplex = (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count > 0 &&
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count &&
!(pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX));
sprintf(name, "%s%s", pcm->name, duplex ? " (DUPLEX)" : "");
#ifdef SNDRV_OSS_INFO_DEV_AUDIO
snd_oss_info_register(SNDRV_OSS_INFO_DEV_AUDIO,
pcm->card->number,
name);
#endif
pcm->oss.reg++;
pcm->oss.reg_mask |= 1;
}
if (adsp_map[pcm->card->number] == (int)pcm->device) {
register_oss_dsp(pcm, 1);
pcm->oss.reg++;
pcm->oss.reg_mask |= 2;
}
if (pcm->oss.reg)
snd_pcm_oss_proc_init(pcm);
return 0;
}
static int snd_pcm_oss_disconnect_minor(struct snd_pcm *pcm)
{
if (pcm->oss.reg) {
if (pcm->oss.reg_mask & 1) {
pcm->oss.reg_mask &= ~1;
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
pcm->card, 0);
}
if (pcm->oss.reg_mask & 2) {
pcm->oss.reg_mask &= ~2;
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
pcm->card, 1);
}
if (dsp_map[pcm->card->number] == (int)pcm->device) {
#ifdef SNDRV_OSS_INFO_DEV_AUDIO
snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number);
#endif
}
pcm->oss.reg = 0;
}
return 0;
}
static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
{
snd_pcm_oss_disconnect_minor(pcm);
snd_pcm_oss_proc_done(pcm);
return 0;
}
static struct snd_pcm_notify snd_pcm_oss_notify =
{
.n_register = snd_pcm_oss_register_minor,
.n_disconnect = snd_pcm_oss_disconnect_minor,
.n_unregister = snd_pcm_oss_unregister_minor,
};
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/sched/signal.h`, `linux/time.h`, `linux/vmalloc.h`, `linux/module.h`, `linux/math64.h`, `linux/string.h`.
- Detected declarations: `function snd_interval_refine_min`, `function snd_interval_refine_max`, `function snd_interval_refine_set`, `function snd_pcm_hw_param_value_min`, `function snd_pcm_hw_param_value_max`, `function _snd_pcm_hw_param_mask`, `function snd_pcm_hw_param_mask`, `function _snd_pcm_hw_param_min`, `function snd_pcm_hw_param_min`, `function _snd_pcm_hw_param_max`.
- Atlas domain: Driver Families / sound/core.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.