diff options
Diffstat (limited to 'sound/core/seq/seq_clientmgr.c')
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 460 |
1 files changed, 256 insertions, 204 deletions
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index a886db94b1f..5eab4201c64 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -58,14 +58,18 @@ static DECLARE_MUTEX(register_mutex); * client table */ static char clienttablock[SNDRV_SEQ_MAX_CLIENTS]; -static client_t *clienttab[SNDRV_SEQ_MAX_CLIENTS]; -static usage_t client_usage; +static struct snd_seq_client *clienttab[SNDRV_SEQ_MAX_CLIENTS]; +static struct snd_seq_usage client_usage; /* * prototypes */ -static int bounce_error_event(client_t *client, snd_seq_event_t *event, int err, int atomic, int hop); -static int snd_seq_deliver_single_event(client_t *client, snd_seq_event_t *event, int filter, int atomic, int hop); +static int bounce_error_event(struct snd_seq_client *client, + struct snd_seq_event *event, + int err, int atomic, int hop); +static int snd_seq_deliver_single_event(struct snd_seq_client *client, + struct snd_seq_event *event, + int filter, int atomic, int hop); /* */ @@ -96,16 +100,17 @@ static inline unsigned short snd_seq_file_flags(struct file *file) } } -static inline int snd_seq_write_pool_allocated(client_t *client) +static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client) { return snd_seq_total_cells(client->pool) > 0; } /* return pointer to client structure for specified id */ -static client_t *clientptr(int clientid) +static struct snd_seq_client *clientptr(int clientid) { if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { - snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); + snd_printd("Seq: oops. Trying to get pointer to client %d\n", + clientid); return NULL; } return clienttab[clientid]; @@ -113,13 +118,14 @@ static client_t *clientptr(int clientid) extern int seq_client_load[]; -client_t *snd_seq_client_use_ptr(int clientid) +struct snd_seq_client *snd_seq_client_use_ptr(int clientid) { unsigned long flags; - client_t *client; + struct snd_seq_client *client; if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { - snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); + snd_printd("Seq: oops. Trying to get pointer to client %d\n", + clientid); return NULL; } spin_lock_irqsave(&clients_lock, flags); @@ -144,7 +150,8 @@ client_t *snd_seq_client_use_ptr(int clientid) if (seq_client_load[idx] < 0) break; if (seq_client_load[idx] == clientid) { - request_module("snd-seq-client-%i", clientid); + request_module("snd-seq-client-%i", + clientid); break; } } @@ -174,14 +181,14 @@ client_t *snd_seq_client_use_ptr(int clientid) return client; } -static void usage_alloc(usage_t * res, int num) +static void usage_alloc(struct snd_seq_usage *res, int num) { res->cur += num; if (res->cur > res->peak) res->peak = res->cur; } -static void usage_free(usage_t * res, int num) +static void usage_free(struct snd_seq_usage *res, int num) { res->cur -= num; } @@ -196,11 +203,11 @@ int __init client_init_data(void) } -static client_t *seq_create_client1(int client_index, int poolsize) +static struct snd_seq_client *seq_create_client1(int client_index, int poolsize) { unsigned long flags; int c; - client_t *client; + struct snd_seq_client *client; /* init client data */ client = kzalloc(sizeof(*client), GFP_KERNEL); @@ -241,7 +248,7 @@ static client_t *seq_create_client1(int client_index, int poolsize) } -static int seq_free_client1(client_t *client) +static int seq_free_client1(struct snd_seq_client *client) { unsigned long flags; @@ -263,12 +270,13 @@ static int seq_free_client1(client_t *client) } -static void seq_free_client(client_t * client) +static void seq_free_client(struct snd_seq_client * client) { down(®ister_mutex); switch (client->type) { case NO_CLIENT: - snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", client->number); + snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", + client->number); break; case USER_CLIENT: case KERNEL_CLIENT: @@ -277,7 +285,8 @@ static void seq_free_client(client_t * client) break; default: - snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); + snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", + client->number, client->type); } up(®ister_mutex); @@ -292,8 +301,8 @@ static void seq_free_client(client_t * client) static int snd_seq_open(struct inode *inode, struct file *file) { int c, mode; /* client id */ - client_t *client; - user_client_t *user; + struct snd_seq_client *client; + struct snd_seq_user_client *user; if (down_interruptible(®ister_mutex)) return -ERESTARTSYS; @@ -344,7 +353,7 @@ static int snd_seq_open(struct inode *inode, struct file *file) /* delete a user client */ static int snd_seq_release(struct inode *inode, struct file *file) { - client_t *client = (client_t *) file->private_data; + struct snd_seq_client *client = file->private_data; if (client) { seq_free_client(client); @@ -364,13 +373,14 @@ static int snd_seq_release(struct inode *inode, struct file *file) * -EINVAL no enough user-space buffer to write the whole event * -EFAULT seg. fault during copy to user space */ -static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, loff_t *offset) +static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, + loff_t *offset) { - client_t *client = (client_t *) file->private_data; - fifo_t *fifo; + struct snd_seq_client *client = file->private_data; + struct snd_seq_fifo *fifo; int err; long result = 0; - snd_seq_event_cell_t *cell; + struct snd_seq_event_cell *cell; if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT)) return -ENXIO; @@ -396,7 +406,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l snd_seq_fifo_lock(fifo); /* while data available in queue */ - while (count >= sizeof(snd_seq_event_t)) { + while (count >= sizeof(struct snd_seq_event)) { int nonblock; nonblock = (file->f_flags & O_NONBLOCK) || result > 0; @@ -404,34 +414,34 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l break; } if (snd_seq_ev_is_variable(&cell->event)) { - snd_seq_event_t tmpev; + struct snd_seq_event tmpev; tmpev = cell->event; tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK; - if (copy_to_user(buf, &tmpev, sizeof(snd_seq_event_t))) { + if (copy_to_user(buf, &tmpev, sizeof(struct snd_seq_event))) { err = -EFAULT; break; } - count -= sizeof(snd_seq_event_t); - buf += sizeof(snd_seq_event_t); + count -= sizeof(struct snd_seq_event); + buf += sizeof(struct snd_seq_event); err = snd_seq_expand_var_event(&cell->event, count, (char __force *)buf, 0, - sizeof(snd_seq_event_t)); + sizeof(struct snd_seq_event)); if (err < 0) break; result += err; count -= err; buf += err; } else { - if (copy_to_user(buf, &cell->event, sizeof(snd_seq_event_t))) { + if (copy_to_user(buf, &cell->event, sizeof(struct snd_seq_event))) { err = -EFAULT; break; } - count -= sizeof(snd_seq_event_t); - buf += sizeof(snd_seq_event_t); + count -= sizeof(struct snd_seq_event); + buf += sizeof(struct snd_seq_event); } snd_seq_cell_free(cell); cell = NULL; /* to be sure */ - result += sizeof(snd_seq_event_t); + result += sizeof(struct snd_seq_event); } if (err < 0) { @@ -449,7 +459,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l /* * check access permission to the port */ -static int check_port_perm(client_port_t *port, unsigned int flags) +static int check_port_perm(struct snd_seq_client_port *port, unsigned int flags) { if ((port->capability & flags) != flags) return 0; @@ -460,9 +470,10 @@ static int check_port_perm(client_port_t *port, unsigned int flags) * check if the destination client is available, and return the pointer * if filter is non-zero, client filter bitmap is tested. */ -static client_t *get_event_dest_client(snd_seq_event_t *event, int filter) +static struct snd_seq_client *get_event_dest_client(struct snd_seq_event *event, + int filter) { - client_t *dest; + struct snd_seq_client *dest; dest = snd_seq_client_use_ptr(event->dest.client); if (dest == NULL) @@ -493,10 +504,11 @@ __not_avail: * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra * kmalloc. */ -static int bounce_error_event(client_t *client, snd_seq_event_t *event, +static int bounce_error_event(struct snd_seq_client *client, + struct snd_seq_event *event, int err, int atomic, int hop) { - snd_seq_event_t bounce_ev; + struct snd_seq_event bounce_ev; int result; if (client == NULL || @@ -531,9 +543,10 @@ static int bounce_error_event(client_t *client, snd_seq_event_t *event, * of the given queue. * return non-zero if updated. */ -static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real_time) +static int update_timestamp_of_queue(struct snd_seq_event *event, + int queue, int real_time) { - queue_t *q; + struct snd_seq_queue *q; q = queueptr(queue); if (! q) @@ -559,12 +572,12 @@ static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real * RETURN VALUE: 0 : if succeeded * <0 : error */ -static int snd_seq_deliver_single_event(client_t *client, - snd_seq_event_t *event, +static int snd_seq_deliver_single_event(struct snd_seq_client *client, + struct snd_seq_event *event, int filter, int atomic, int hop) { - client_t *dest = NULL; - client_port_t *dest_port = NULL; + struct snd_seq_client *dest = NULL; + struct snd_seq_client_port *dest_port = NULL; int result = -ENOENT; int direct; @@ -596,7 +609,9 @@ static int snd_seq_deliver_single_event(client_t *client, case KERNEL_CLIENT: if (dest_port->event_input == NULL) break; - result = dest_port->event_input(event, direct, dest_port->private_data, atomic, hop); + result = dest_port->event_input(event, direct, + dest_port->private_data, + atomic, hop); break; default: break; @@ -618,16 +633,16 @@ static int snd_seq_deliver_single_event(client_t *client, /* * send the event to all subscribers: */ -static int deliver_to_subscribers(client_t *client, - snd_seq_event_t *event, +static int deliver_to_subscribers(struct snd_seq_client *client, + struct snd_seq_event *event, int atomic, int hop) { - subscribers_t *subs; + struct snd_seq_subscribers *subs; int err = 0, num_ev = 0; - snd_seq_event_t event_saved; - client_port_t *src_port; + struct snd_seq_event event_saved; + struct snd_seq_client_port *src_port; struct list_head *p; - port_subs_info_t *grp; + struct snd_seq_port_subs_info *grp; src_port = snd_seq_port_use_ptr(client, event->source.port); if (src_port == NULL) @@ -642,7 +657,7 @@ static int deliver_to_subscribers(client_t *client, else down_read(&grp->list_mutex); list_for_each(p, &grp->list_head) { - subs = list_entry(p, subscribers_t, src_list); + subs = list_entry(p, struct snd_seq_subscribers, src_list); event->dest = subs->info.dest; if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) /* convert time according to flag with subscription */ @@ -670,12 +685,12 @@ static int deliver_to_subscribers(client_t *client, /* * broadcast to all ports: */ -static int port_broadcast_event(client_t *client, - snd_seq_event_t *event, +static int port_broadcast_event(struct snd_seq_client *client, + struct snd_seq_event *event, int atomic, int hop) { int num_ev = 0, err = 0; - client_t *dest_client; + struct snd_seq_client *dest_client; struct list_head *p; dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST); @@ -684,7 +699,7 @@ static int port_broadcast_event(client_t *client, read_lock(&dest_client->ports_lock); list_for_each(p, &dest_client->ports_list_head) { - client_port_t *port = list_entry(p, client_port_t, list); + struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list); event->dest.port = port->addr.port; /* pass NULL as source client to avoid error bounce */ err = snd_seq_deliver_single_event(NULL, event, @@ -704,12 +719,12 @@ static int port_broadcast_event(client_t *client, * send the event to all clients: * if destination port is also ADDRESS_BROADCAST, deliver to all ports. */ -static int broadcast_event(client_t *client, - snd_seq_event_t *event, int atomic, int hop) +static int broadcast_event(struct snd_seq_client *client, + struct snd_seq_event *event, int atomic, int hop) { int err = 0, num_ev = 0; int dest; - snd_seq_addr_t addr; + struct snd_seq_addr addr; addr = event->dest; /* save */ @@ -736,7 +751,7 @@ static int broadcast_event(client_t *client, /* multicast - not supported yet */ -static int multicast_event(client_t *client, snd_seq_event_t *event, +static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event, int atomic, int hop) { snd_printd("seq: multicast not supported yet.\n"); @@ -753,7 +768,7 @@ static int multicast_event(client_t *client, snd_seq_event_t *event, * n == 0 : the event was not passed to any client. * n < 0 : error - event was not processed. */ -static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, +static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event, int atomic, int hop) { int result; @@ -794,9 +809,9 @@ static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, * n == 0 : the event was not passed to any client. * n < 0 : error - event was not processed. */ -int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) +int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop) { - client_t *client; + struct snd_seq_client *client; int result; snd_assert(cell != NULL, return -EINVAL); @@ -812,7 +827,7 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) * the event cell is re-used as a NOTE-OFF event and * enqueued again. */ - snd_seq_event_t tmpev, *ev; + struct snd_seq_event tmpev, *ev; /* reserve this event to enqueue note-off later */ tmpev = cell->event; @@ -865,12 +880,12 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) * if pool is empty and blocking is TRUE, sleep until a new cell is * available. */ -static int snd_seq_client_enqueue_event(client_t *client, - snd_seq_event_t *event, +static int snd_seq_client_enqueue_event(struct snd_seq_client *client, + struct snd_seq_event *event, struct file *file, int blocking, int atomic, int hop) { - snd_seq_event_cell_t *cell; + struct snd_seq_event_cell *cell; int err; /* special queue values - force direct passing */ @@ -886,7 +901,7 @@ static int snd_seq_client_enqueue_event(client_t *client, #endif if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { /* check presence of source port */ - client_port_t *src_port = snd_seq_port_use_ptr(client, event->source.port); + struct snd_seq_client_port *src_port = snd_seq_port_use_ptr(client, event->source.port); if (src_port == NULL) return -EINVAL; snd_seq_port_unlock(src_port); @@ -924,7 +939,7 @@ static int snd_seq_client_enqueue_event(client_t *client, * check validity of event type and data length. * return non-zero if invalid. */ -static int check_event_type_and_length(snd_seq_event_t *ev) +static int check_event_type_and_length(struct snd_seq_event *ev) { switch (snd_seq_ev_length_type(ev)) { case SNDRV_SEQ_EVENT_LENGTH_FIXED: @@ -957,12 +972,13 @@ static int check_event_type_and_length(snd_seq_event_t *ev) * -EMLINK too many hops * others depends on return value from driver callback */ -static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) +static ssize_t snd_seq_write(struct file *file, const char __user *buf, + size_t count, loff_t *offset) { - client_t *client = (client_t *) file->private_data; + struct snd_seq_client *client = file->private_data; int written = 0, len; int err = -EINVAL; - snd_seq_event_t event; + struct snd_seq_event event; if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) return -ENXIO; @@ -980,7 +996,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c } /* only process whole events */ - while (count >= sizeof(snd_seq_event_t)) { + while (count >= sizeof(struct snd_seq_event)) { /* Read in the event header from the user */ len = sizeof(event); if (copy_from_user(&event, buf, len)) { @@ -1012,7 +1028,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c /* set user space pointer */ event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; event.data.ext.ptr = (char __force *)buf - + sizeof(snd_seq_event_t); + + sizeof(struct snd_seq_event); len += extlen; /* increment data length */ } else { #ifdef CONFIG_COMPAT @@ -1046,7 +1062,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c */ static unsigned int snd_seq_poll(struct file *file, poll_table * wait) { - client_t *client = (client_t *) file->private_data; + struct snd_seq_client *client = file->private_data; unsigned int mask = 0; /* check client structures are in place */ @@ -1076,9 +1092,9 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait) /* SYSTEM_INFO ioctl() */ -static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) +static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg) { - snd_seq_system_info_t info; + struct snd_seq_system_info info; memset(&info, 0, sizeof(info)); /* fill the info fields */ @@ -1096,10 +1112,10 @@ static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) /* RUNNING_MODE ioctl() */ -static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg) +static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void __user *arg) { - struct sndrv_seq_running_info info; - client_t *cptr; + struct snd_seq_running_info info; + struct snd_seq_client *cptr; int err = 0; if (copy_from_user(&info, arg, sizeof(info))) @@ -1133,7 +1149,8 @@ static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg) } /* CLIENT_INFO ioctl() */ -static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) +static void get_client_info(struct snd_seq_client *cptr, + struct snd_seq_client_info *info) { info->client = cptr->number; @@ -1147,10 +1164,11 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) memset(info->reserved, 0, sizeof(info->reserved)); } -static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client, + void __user *arg) { - client_t *cptr; - snd_seq_client_info_t client_info; + struct snd_seq_client *cptr; + struct snd_seq_client_info client_info; if (copy_from_user(&client_info, arg, sizeof(client_info))) return -EFAULT; @@ -1170,9 +1188,10 @@ static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) /* CLIENT_INFO ioctl() */ -static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client, + void __user *arg) { - snd_seq_client_info_t client_info; + struct snd_seq_client_info client_info; if (copy_from_user(&client_info, arg, sizeof(client_info))) return -EFAULT; @@ -1199,11 +1218,12 @@ static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) /* * CREATE PORT ioctl() */ -static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) +static int snd_seq_ioctl_create_port(struct snd_seq_client *client, + void __user *arg) { - client_port_t *port; - snd_seq_port_info_t info; - snd_seq_port_callback_t *callback; + struct snd_seq_client_port *port; + struct snd_seq_port_info info; + struct snd_seq_port_callback *callback; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1249,9 +1269,10 @@ static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) /* * DELETE PORT ioctl() */ -static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) +static int snd_seq_ioctl_delete_port(struct snd_seq_client *client, + void __user *arg) { - snd_seq_port_info_t info; + struct snd_seq_port_info info; int err; /* set passed parameters */ @@ -1272,11 +1293,12 @@ static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) /* * GET_PORT_INFO ioctl() (on any client) */ -static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) +static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client, + void __user *arg) { - client_t *cptr; - client_port_t *port; - snd_seq_port_info_t info; + struct snd_seq_client *cptr; + struct snd_seq_client_port *port; + struct snd_seq_port_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1304,10 +1326,11 @@ static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) /* * SET_PORT_INFO ioctl() (only ports on this/own client) */ -static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client, + void __user *arg) { - client_port_t *port; - snd_seq_port_info_t info; + struct snd_seq_client_port *port; + struct snd_seq_port_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1329,9 +1352,10 @@ static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) #define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ) #define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE) -static int check_subscription_permission(client_t *client, client_port_t *sport, - client_port_t *dport, - snd_seq_port_subscribe_t *subs) +static int check_subscription_permission(struct snd_seq_client *client, + struct snd_seq_client_port *sport, + struct snd_seq_client_port *dport, + struct snd_seq_port_subscribe *subs) { if (client->number != subs->sender.client && client->number != subs->dest.client) { @@ -1363,9 +1387,10 @@ static int check_subscription_permission(client_t *client, client_port_t *sport, * client must be user client. */ int snd_seq_client_notify_subscription(int client, int port, - snd_seq_port_subscribe_t *info, int evtype) + struct snd_seq_port_subscribe *info, + int evtype) { - snd_seq_event_t event; + struct snd_seq_event event; memset(&event, 0, sizeof(event)); event.type = evtype; @@ -1379,12 +1404,13 @@ int snd_seq_client_notify_subscription(int client, int port, /* * add to port's subscription list IOCTL interface */ -static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) +static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client, + void __user *arg) { int result = -EINVAL; - client_t *receiver = NULL, *sender = NULL; - client_port_t *sport = NULL, *dport = NULL; - snd_seq_port_subscribe_t subs; + struct snd_seq_client *receiver = NULL, *sender = NULL; + struct snd_seq_client_port *sport = NULL, *dport = NULL; + struct snd_seq_port_subscribe subs; if (copy_from_user(&subs, arg, sizeof(subs))) return -EFAULT; @@ -1423,12 +1449,13 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) /* * remove from port's subscription list */ -static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) +static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, + void __user *arg) { int result = -ENXIO; - client_t *receiver = NULL, *sender = NULL; - client_port_t *sport = NULL, *dport = NULL; - snd_seq_port_subscribe_t subs; + struct snd_seq_client *receiver = NULL, *sender = NULL; + struct snd_seq_client_port *sport = NULL, *dport = NULL; + struct snd_seq_port_subscribe subs; if (copy_from_user(&subs, arg, sizeof(subs))) return -EFAULT; @@ -1464,11 +1491,12 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) /* CREATE_QUEUE ioctl() */ -static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) +static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_info_t info; + struct snd_seq_queue_info info; int result; - queue_t *q; + struct snd_seq_queue *q; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1498,9 +1526,10 @@ static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) } /* DELETE_QUEUE ioctl() */ -static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) +static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_info_t info; + struct snd_seq_queue_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1509,10 +1538,11 @@ static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) } /* GET_QUEUE_INFO ioctl() */ -static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) +static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_info_t info; - queue_t *q; + struct snd_seq_queue_info info; + struct snd_seq_queue *q; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1535,10 +1565,11 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) } /* SET_QUEUE_INFO ioctl() */ -static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) +static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_info_t info; - queue_t *q; + struct snd_seq_queue_info info; + struct snd_seq_queue *q; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1570,10 +1601,10 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) } /* GET_NAMED_QUEUE ioctl() */ -static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) +static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, void __user *arg) { - snd_seq_queue_info_t info; - queue_t *q; + struct snd_seq_queue_info info; + struct snd_seq_queue *q; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1593,11 +1624,12 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) } /* GET_QUEUE_STATUS ioctl() */ -static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_status_t status; - queue_t *queue; - seq_timer_t *tmr; + struct snd_seq_queue_status status; + struct snd_seq_queue *queue; + struct snd_seq_timer *tmr; if (copy_from_user(&status, arg, sizeof(status))) return -EFAULT; @@ -1626,11 +1658,12 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) /* GET_QUEUE_TEMPO ioctl() */ -static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_tempo_t tempo; - queue_t *queue; - seq_timer_t *tmr; + struct snd_seq_queue_tempo tempo; + struct snd_seq_queue *queue; + struct snd_seq_timer *tmr; if (copy_from_user(&tempo, arg, sizeof(tempo))) return -EFAULT; @@ -1656,17 +1689,18 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) /* SET_QUEUE_TEMPO ioctl() */ -int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo) +int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo) { if (!snd_seq_queue_check_access(tempo->queue, client)) return -EPERM; return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); } -static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client, + void __user *arg) { int result; - snd_seq_queue_tempo_t tempo; + struct snd_seq_queue_tempo tempo; if (copy_from_user(&tempo, arg, sizeof(tempo))) return -EFAULT; @@ -1677,11 +1711,12 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) /* GET_QUEUE_TIMER ioctl() */ -static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_timer_t timer; - queue_t *queue; - seq_timer_t *tmr; + struct snd_seq_queue_timer timer; + struct snd_seq_queue *queue; + struct snd_seq_timer *tmr; if (copy_from_user(&timer, arg, sizeof(timer))) return -EFAULT; @@ -1713,10 +1748,11 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) /* SET_QUEUE_TIMER ioctl() */ -static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client, + void __user *arg) { int result = 0; - snd_seq_queue_timer_t timer; + struct snd_seq_queue_timer timer; if (copy_from_user(&timer, arg, sizeof(timer))) return -EFAULT; @@ -1725,8 +1761,8 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) return -EINVAL; if (snd_seq_queue_check_access(timer.queue, client->number)) { - queue_t *q; - seq_timer_t *tmr; + struct snd_seq_queue *q; + struct snd_seq_timer *tmr; q = queueptr(timer.queue); if (q == NULL) @@ -1754,9 +1790,10 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) /* GET_QUEUE_CLIENT ioctl() */ -static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client, + void __user *arg) { - snd_seq_queue_client_t info; + struct snd_seq_queue_client info; int used; if (copy_from_user(&info, arg, sizeof(info))) @@ -1775,10 +1812,11 @@ static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg) /* SET_QUEUE_CLIENT ioctl() */ -static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client, + void __user *arg) { int err; - snd_seq_queue_client_t info; + struct snd_seq_queue_client info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1794,10 +1832,11 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) /* GET_CLIENT_POOL ioctl() */ -static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) +static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client, + void __user *arg) { - snd_seq_client_pool_t info; - client_t *cptr; + struct snd_seq_client_pool info; + struct snd_seq_client *cptr; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1828,9 +1867,10 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) } /* SET_CLIENT_POOL ioctl() */ -static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg) +static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client, + void __user *arg) { - snd_seq_client_pool_t info; + struct snd_seq_client_pool info; int rc; if (copy_from_user(&info, arg, sizeof(info))) @@ -1872,9 +1912,10 @@ static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg) /* REMOVE_EVENTS ioctl() */ -static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) +static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, + void __user *arg) { - snd_seq_remove_events_t info; + struct snd_seq_remove_events info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -1901,13 +1942,14 @@ static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) /* * get subscription info */ -static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) +static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, + void __user *arg) { int result; - client_t *sender = NULL; - client_port_t *sport = NULL; - snd_seq_port_subscribe_t subs; - subscribers_t *p; + struct snd_seq_client *sender = NULL; + struct snd_seq_client_port *sport = NULL; + struct snd_seq_port_subscribe subs; + struct snd_seq_subscribers *p; if (copy_from_user(&subs, arg, sizeof(subs))) return -EFAULT; @@ -1940,13 +1982,14 @@ static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) /* * get subscription info - check only its presence */ -static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) +static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, + void __user *arg) { int result = -ENXIO; - client_t *cptr = NULL; - client_port_t *port = NULL; - snd_seq_query_subs_t subs; - port_subs_info_t *group; + struct snd_seq_client *cptr = NULL; + struct snd_seq_client_port *port = NULL; + struct snd_seq_query_subs subs; + struct snd_seq_port_subs_info *group; struct list_head *p; int i; @@ -1977,12 +2020,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) list_for_each(p, &group->list_head) { if (i++ == subs.index) { /* found! */ - subscribers_t *s; + struct snd_seq_subscribers *s; if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) { - s = list_entry(p, subscribers_t, src_list); + s = list_entry(p, struct snd_seq_subscribers, src_list); subs.addr = s->info.dest; } else { - s = list_entry(p, subscribers_t, dest_list); + s = list_entry(p, struct snd_seq_subscribers, dest_list); subs.addr = s->info.sender; } subs.flags = s->info.flags; @@ -2009,10 +2052,11 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) /* * query next client */ -static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) +static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client, + void __user *arg) { - client_t *cptr = NULL; - snd_seq_client_info_t info; + struct snd_seq_client *cptr = NULL; + struct snd_seq_client_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -2040,11 +2084,12 @@ static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) /* * query next port */ -static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) +static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client, + void __user *arg) { - client_t *cptr; - client_port_t *port = NULL; - snd_seq_port_info_t info; + struct snd_seq_client *cptr; + struct snd_seq_client_port *port = NULL; + struct snd_seq_port_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -2075,7 +2120,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) static struct seq_ioctl_table { unsigned int cmd; - int (*func)(client_t *client, void __user * arg); + int (*func)(struct snd_seq_client *client, void __user * arg); } ioctl_tables[] = { { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info }, { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode }, @@ -2109,7 +2154,8 @@ static struct seq_ioctl_table { { 0, NULL }, }; -static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg) +static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd, + void __user *arg) { struct seq_ioctl_table *p; @@ -2136,7 +2182,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - client_t *client = (client_t *) file->private_data; + struct snd_seq_client *client = file->private_data; snd_assert(client != NULL, return -ENXIO); @@ -2153,9 +2199,10 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg /* exported to kernel modules */ -int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t * callback) +int snd_seq_create_kernel_client(struct snd_card *card, int client_index, + struct snd_seq_client_callback *callback) { - client_t *client; + struct snd_seq_client *client; snd_assert(! in_interrupt(), return -EBUSY); @@ -2199,7 +2246,7 @@ int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_cli /* exported to kernel modules */ int snd_seq_delete_kernel_client(int client) { - client_t *ptr; + struct snd_seq_client *ptr; snd_assert(! in_interrupt(), return -EBUSY); @@ -2216,11 +2263,11 @@ int snd_seq_delete_kernel_client(int client) /* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue * and snd_seq_kernel_client_enqueue_blocking */ -static int kernel_client_enqueue(int client, snd_seq_event_t *ev, +static int kernel_client_enqueue(int client, struct snd_seq_event *ev, struct file *file, int blocking, int atomic, int hop) { - client_t *cptr; + struct snd_seq_client *cptr; int result; snd_assert(ev != NULL, return -EINVAL); @@ -2254,7 +2301,7 @@ static int kernel_client_enqueue(int client, snd_seq_event_t *ev, * * RETURN VALUE: zero if succeed, negative if error */ -int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev, +int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev, int atomic, int hop) { return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop); @@ -2265,7 +2312,7 @@ int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev, * * RETURN VALUE: zero if succeed, negative if error */ -int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, +int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev, struct file *file, int atomic, int hop) { @@ -2280,10 +2327,10 @@ int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, * RETURN VALUE: negative = delivery failed, * zero, or positive: the number of delivered events */ -int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, +int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev, int atomic, int hop) { - client_t *cptr; + struct snd_seq_client *cptr; int result; snd_assert(ev != NULL, return -EINVAL); @@ -2315,7 +2362,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, */ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) { - client_t *client; + struct snd_seq_client *client; mm_segment_t fs; int result; @@ -2332,7 +2379,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) /* exported (for OSS emulator) */ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait) { - client_t *client; + struct snd_seq_client *client; client = clientptr(clientid); if (client == NULL) @@ -2350,10 +2397,12 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table /* * /proc interface */ -static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_info_t *group, int is_src, char *msg) +static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer, + struct snd_seq_port_subs_info *group, + int is_src, char *msg) { struct list_head *p; - subscribers_t *s; + struct snd_seq_subscribers *s; int count = 0; down_read(&group->list_mutex); @@ -2364,9 +2413,9 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i snd_iprintf(buffer, msg); list_for_each(p, &group->list_head) { if (is_src) - s = list_entry(p, subscribers_t, src_list); + s = list_entry(p, struct snd_seq_subscribers, src_list); else - s = list_entry(p, subscribers_t, dest_list); + s = list_entry(p, struct snd_seq_subscribers, dest_list); if (count++) snd_iprintf(buffer, ", "); snd_iprintf(buffer, "%d:%d", @@ -2387,13 +2436,14 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i #define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-') -static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client) +static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer, + struct snd_seq_client *client) { struct list_head *l; down(&client->ports_mutex); list_for_each(l, &client->ports_list_head) { - client_port_t *p = list_entry(l, client_port_t, list); + struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", p->addr.port, p->name, FLAG_PERM_RD(p->capability), @@ -2407,13 +2457,15 @@ static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client) } +void snd_seq_info_pool(struct snd_info_buffer *buffer, + struct snd_seq_pool *pool, char *space); + /* exported to seq_info.c */ -void snd_seq_info_clients_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +void snd_seq_info_clients_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - extern void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t * pool, char *space); int c; - client_t *client; + struct snd_seq_client *client; snd_iprintf(buffer, "Client info\n"); snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur); @@ -2468,7 +2520,7 @@ static struct file_operations snd_seq_f_ops = .compat_ioctl = snd_seq_ioctl_compat, }; -static snd_minor_t snd_seq_reg = +static struct snd_minor snd_seq_reg = { .comment = "sequencer", .f_ops = &snd_seq_f_ops, |