ALSA: seq: Introduce SNDRV_SEQ_IOCTL_USER_PVERSION ioctl
authorTakashi Iwai <tiwai@suse.de>
Tue, 23 May 2023 07:53:45 +0000 (09:53 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 May 2023 10:11:19 +0000 (12:11 +0200)
For the future extension of ALSA sequencer ABI, introduce a new ioctl
SNDRV_SEQ_IOCTL_USER_PVERSION.  This is similar like the ioctls used
in PCM and other interfaces, for an application to specify its
supporting ABI version.

The use of this ioctl will be mandatory for the upcoming UMP support.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/uapi/sound/asequencer.h
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_clientmgr.h
sound/core/seq/seq_compat.c

index 00d2703e8fca5e78e3f6f584d0f33be90ca998c1..4a3c5a718baeb47403c94e379bf833e8b2e8b443 100644 (file)
@@ -561,6 +561,7 @@ struct snd_seq_query_subs {
 #define SNDRV_SEQ_IOCTL_CLIENT_ID      _IOR ('S', 0x01, int)
 #define SNDRV_SEQ_IOCTL_SYSTEM_INFO    _IOWR('S', 0x02, struct snd_seq_system_info)
 #define SNDRV_SEQ_IOCTL_RUNNING_MODE   _IOWR('S', 0x03, struct snd_seq_running_info)
+#define SNDRV_SEQ_IOCTL_USER_PVERSION  _IOW('S', 0x04, int)
 
 #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO        _IOWR('S', 0x10, struct snd_seq_client_info)
 #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO        _IOW ('S', 0x11, struct snd_seq_client_info)
index 0f26f20596d7a6cba1dcb61c76a0f22d5683146c..89a8d14df83b270b6996dbdaaff50c13df015fe2 100644 (file)
@@ -1056,6 +1056,12 @@ static int snd_seq_ioctl_pversion(struct snd_seq_client *client, void *arg)
        return 0;
 }
 
+static int snd_seq_ioctl_user_pversion(struct snd_seq_client *client, void *arg)
+{
+       client->user_pversion = *(unsigned int *)arg;
+       return 0;
+}
+
 static int snd_seq_ioctl_client_id(struct snd_seq_client *client, void *arg)
 {
        int *client_id = arg;
@@ -1985,6 +1991,7 @@ static const struct ioctl_handler {
        int (*func)(struct snd_seq_client *client, void *arg);
 } ioctl_handlers[] = {
        { SNDRV_SEQ_IOCTL_PVERSION, snd_seq_ioctl_pversion },
+       { SNDRV_SEQ_IOCTL_USER_PVERSION, snd_seq_ioctl_user_pversion },
        { SNDRV_SEQ_IOCTL_CLIENT_ID, snd_seq_ioctl_client_id },
        { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info },
        { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode },
@@ -2125,6 +2132,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
        client->accept_input = 1;
        client->accept_output = 1;
        client->data.kernel.card = card;
+       client->user_pversion = SNDRV_SEQ_VERSION;
                
        va_start(args, name_fmt);
        vsnprintf(client->name, sizeof(client->name), name_fmt, args);
index f05704e45ab43891156f85b4367db2a1b6271992..abe0ceadf3dae95e02ee0a965fe7ee5029bb491b 100644 (file)
@@ -35,6 +35,7 @@ struct snd_seq_client {
        snd_seq_client_type_t type;
        unsigned int accept_input: 1,
                accept_output: 1;
+       unsigned int user_pversion;
        char name[64];          /* client name */
        int number;             /* client number */
        unsigned int filter;    /* filter flags */
index 54723566ce2428d3e1af28ddf064f06953503c67..c0ce6236dc7f1d6dfea06f1f7aa1f305dadaad19 100644 (file)
@@ -81,6 +81,7 @@ static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
 
        switch (cmd) {
        case SNDRV_SEQ_IOCTL_PVERSION:
+       case SNDRV_SEQ_IOCTL_USER_PVERSION:
        case SNDRV_SEQ_IOCTL_CLIENT_ID:
        case SNDRV_SEQ_IOCTL_SYSTEM_INFO:
        case SNDRV_SEQ_IOCTL_GET_CLIENT_INFO: