Next Previous Contents

3. File operations

File operations related structures and functions are in include/driver.h header file. Basic structure for registering file operations for minor number is snd_minor_t. Minor constants are in include/minors.h header file.

3.1 Variables and functions

Functions list:

Note: Devices (minor numbers) are registered only if device is present in the system. It isn't preffered do some pre-registration from some middle-level code for each possible devices per interface.

3.2 Examples


static snd_minor_t snd_pcm_reg = {
  "digital audio",

  NULL,                         /* unregister */

  NULL,                         /* lseek */
  snd_pcm_read,                 /* read */
  snd_pcm_write,                /* write */
  snd_pcm_open,                 /* open */
  snd_pcm_release,              /* release */
#ifdef SND_POLL
  snd_pcm_poll,                 /* poll */
#else
  snd_pcm_select,               /* select */
#endif
  snd_pcm_ioctl,                /* ioctl */
  NULL,                         /* mmap */
};

...
  if ( (err = snd_register_minor( SND_MINOR_PCM + device, &snd_pcm_reg )) < 0 )
    return err;
...
  snd_unregister_minor( SND_MINOR_PCM + device );


Next Previous Contents