aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_clientmgr.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:04:02 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:52 -0500
commitc7e0b5bf9fff1b726495081447c107a2333fb82c (patch)
treef4d9ec9a6446f8e2afde4c94e10a39f2b86a0bc9 /sound/core/seq/seq_clientmgr.c
parent6ac77bc180fbd985988015020c2e2347e802959d (diff)
[ALSA] Remove xxx_t typedefs: Sequencer
Modules: ALSA sequencer Remove xxx_t typedefs from the core sequencer codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_clientmgr.c')
-rw-r--r--sound/core/seq/seq_clientmgr.c460
1 files changed, 256 insertions, 204 deletions
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index a886db94b1fa..5eab4201c640 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -58,14 +58,18 @@ static DECLARE_MUTEX(register_mutex);
58 * client table 58 * client table
59 */ 59 */
60static char clienttablock[SNDRV_SEQ_MAX_CLIENTS]; 60static char clienttablock[SNDRV_SEQ_MAX_CLIENTS];
61static client_t *clienttab[SNDRV_SEQ_MAX_CLIENTS]; 61static struct snd_seq_client *clienttab[SNDRV_SEQ_MAX_CLIENTS];
62static usage_t client_usage; 62static struct snd_seq_usage client_usage;
63 63
64/* 64/*
65 * prototypes 65 * prototypes
66 */ 66 */
67static int bounce_error_event(client_t *client, snd_seq_event_t *event, int err, int atomic, int hop); 67static int bounce_error_event(struct snd_seq_client *client,
68static int snd_seq_deliver_single_event(client_t *client, snd_seq_event_t *event, int filter, int atomic, int hop); 68 struct snd_seq_event *event,
69 int err, int atomic, int hop);
70static int snd_seq_deliver_single_event(struct snd_seq_client *client,
71 struct snd_seq_event *event,
72 int filter, int atomic, int hop);
69 73
70/* 74/*
71 */ 75 */
@@ -96,16 +100,17 @@ static inline unsigned short snd_seq_file_flags(struct file *file)
96 } 100 }
97} 101}
98 102
99static inline int snd_seq_write_pool_allocated(client_t *client) 103static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client)
100{ 104{
101 return snd_seq_total_cells(client->pool) > 0; 105 return snd_seq_total_cells(client->pool) > 0;
102} 106}
103 107
104/* return pointer to client structure for specified id */ 108/* return pointer to client structure for specified id */
105static client_t *clientptr(int clientid) 109static struct snd_seq_client *clientptr(int clientid)
106{ 110{
107 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { 111 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
108 snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); 112 snd_printd("Seq: oops. Trying to get pointer to client %d\n",
113 clientid);
109 return NULL; 114 return NULL;
110 } 115 }
111 return clienttab[clientid]; 116 return clienttab[clientid];
@@ -113,13 +118,14 @@ static client_t *clientptr(int clientid)
113 118
114extern int seq_client_load[]; 119extern int seq_client_load[];
115 120
116client_t *snd_seq_client_use_ptr(int clientid) 121struct snd_seq_client *snd_seq_client_use_ptr(int clientid)
117{ 122{
118 unsigned long flags; 123 unsigned long flags;
119 client_t *client; 124 struct snd_seq_client *client;
120 125
121 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { 126 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
122 snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); 127 snd_printd("Seq: oops. Trying to get pointer to client %d\n",
128 clientid);
123 return NULL; 129 return NULL;
124 } 130 }
125 spin_lock_irqsave(&clients_lock, flags); 131 spin_lock_irqsave(&clients_lock, flags);
@@ -144,7 +150,8 @@ client_t *snd_seq_client_use_ptr(int clientid)
144 if (seq_client_load[idx] < 0) 150 if (seq_client_load[idx] < 0)
145 break; 151 break;
146 if (seq_client_load[idx] == clientid) { 152 if (seq_client_load[idx] == clientid) {
147 request_module("snd-seq-client-%i", clientid); 153 request_module("snd-seq-client-%i",
154 clientid);
148 break; 155 break;
149 } 156 }
150 } 157 }
@@ -174,14 +181,14 @@ client_t *snd_seq_client_use_ptr(int clientid)
174 return client; 181 return client;
175} 182}
176 183
177static void usage_alloc(usage_t * res, int num) 184static void usage_alloc(struct snd_seq_usage *res, int num)
178{ 185{
179 res->cur += num; 186 res->cur += num;
180 if (res->cur > res->peak) 187 if (res->cur > res->peak)
181 res->peak = res->cur; 188 res->peak = res->cur;
182} 189}
183 190
184static void usage_free(usage_t * res, int num) 191static void usage_free(struct snd_seq_usage *res, int num)
185{ 192{
186 res->cur -= num; 193 res->cur -= num;
187} 194}
@@ -196,11 +203,11 @@ int __init client_init_data(void)
196} 203}
197 204
198 205
199static client_t *seq_create_client1(int client_index, int poolsize) 206static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
200{ 207{
201 unsigned long flags; 208 unsigned long flags;
202 int c; 209 int c;
203 client_t *client; 210 struct snd_seq_client *client;
204 211
205 /* init client data */ 212 /* init client data */
206 client = kzalloc(sizeof(*client), GFP_KERNEL); 213 client = kzalloc(sizeof(*client), GFP_KERNEL);
@@ -241,7 +248,7 @@ static client_t *seq_create_client1(int client_index, int poolsize)
241} 248}
242 249
243 250
244static int seq_free_client1(client_t *client) 251static int seq_free_client1(struct snd_seq_client *client)
245{ 252{
246 unsigned long flags; 253 unsigned long flags;
247 254
@@ -263,12 +270,13 @@ static int seq_free_client1(client_t *client)
263} 270}
264 271
265 272
266static void seq_free_client(client_t * client) 273static void seq_free_client(struct snd_seq_client * client)
267{ 274{
268 down(&register_mutex); 275 down(&register_mutex);
269 switch (client->type) { 276 switch (client->type) {
270 case NO_CLIENT: 277 case NO_CLIENT:
271 snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", client->number); 278 snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n",
279 client->number);
272 break; 280 break;
273 case USER_CLIENT: 281 case USER_CLIENT:
274 case KERNEL_CLIENT: 282 case KERNEL_CLIENT:
@@ -277,7 +285,8 @@ static void seq_free_client(client_t * client)
277 break; 285 break;
278 286
279 default: 287 default:
280 snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); 288 snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n",
289 client->number, client->type);
281 } 290 }
282 up(&register_mutex); 291 up(&register_mutex);
283 292
@@ -292,8 +301,8 @@ static void seq_free_client(client_t * client)
292static int snd_seq_open(struct inode *inode, struct file *file) 301static int snd_seq_open(struct inode *inode, struct file *file)
293{ 302{
294 int c, mode; /* client id */ 303 int c, mode; /* client id */
295 client_t *client; 304 struct snd_seq_client *client;
296 user_client_t *user; 305 struct snd_seq_user_client *user;
297 306
298 if (down_interruptible(&register_mutex)) 307 if (down_interruptible(&register_mutex))
299 return -ERESTARTSYS; 308 return -ERESTARTSYS;
@@ -344,7 +353,7 @@ static int snd_seq_open(struct inode *inode, struct file *file)
344/* delete a user client */ 353/* delete a user client */
345static int snd_seq_release(struct inode *inode, struct file *file) 354static int snd_seq_release(struct inode *inode, struct file *file)
346{ 355{
347 client_t *client = (client_t *) file->private_data; 356 struct snd_seq_client *client = file->private_data;
348 357
349 if (client) { 358 if (client) {
350 seq_free_client(client); 359 seq_free_client(client);
@@ -364,13 +373,14 @@ static int snd_seq_release(struct inode *inode, struct file *file)
364 * -EINVAL no enough user-space buffer to write the whole event 373 * -EINVAL no enough user-space buffer to write the whole event
365 * -EFAULT seg. fault during copy to user space 374 * -EFAULT seg. fault during copy to user space
366 */ 375 */
367static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, loff_t *offset) 376static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,
377 loff_t *offset)
368{ 378{
369 client_t *client = (client_t *) file->private_data; 379 struct snd_seq_client *client = file->private_data;
370 fifo_t *fifo; 380 struct snd_seq_fifo *fifo;
371 int err; 381 int err;
372 long result = 0; 382 long result = 0;
373 snd_seq_event_cell_t *cell; 383 struct snd_seq_event_cell *cell;
374 384
375 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT)) 385 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT))
376 return -ENXIO; 386 return -ENXIO;
@@ -396,7 +406,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
396 snd_seq_fifo_lock(fifo); 406 snd_seq_fifo_lock(fifo);
397 407
398 /* while data available in queue */ 408 /* while data available in queue */
399 while (count >= sizeof(snd_seq_event_t)) { 409 while (count >= sizeof(struct snd_seq_event)) {
400 int nonblock; 410 int nonblock;
401 411
402 nonblock = (file->f_flags & O_NONBLOCK) || result > 0; 412 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
404 break; 414 break;
405 } 415 }
406 if (snd_seq_ev_is_variable(&cell->event)) { 416 if (snd_seq_ev_is_variable(&cell->event)) {
407 snd_seq_event_t tmpev; 417 struct snd_seq_event tmpev;
408 tmpev = cell->event; 418 tmpev = cell->event;
409 tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK; 419 tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK;
410 if (copy_to_user(buf, &tmpev, sizeof(snd_seq_event_t))) { 420 if (copy_to_user(buf, &tmpev, sizeof(struct snd_seq_event))) {
411 err = -EFAULT; 421 err = -EFAULT;
412 break; 422 break;
413 } 423 }
414 count -= sizeof(snd_seq_event_t); 424 count -= sizeof(struct snd_seq_event);
415 buf += sizeof(snd_seq_event_t); 425 buf += sizeof(struct snd_seq_event);
416 err = snd_seq_expand_var_event(&cell->event, count, 426 err = snd_seq_expand_var_event(&cell->event, count,
417 (char __force *)buf, 0, 427 (char __force *)buf, 0,
418 sizeof(snd_seq_event_t)); 428 sizeof(struct snd_seq_event));
419 if (err < 0) 429 if (err < 0)
420 break; 430 break;
421 result += err; 431 result += err;
422 count -= err; 432 count -= err;
423 buf += err; 433 buf += err;
424 } else { 434 } else {
425 if (copy_to_user(buf, &cell->event, sizeof(snd_seq_event_t))) { 435 if (copy_to_user(buf, &cell->event, sizeof(struct snd_seq_event))) {
426 err = -EFAULT; 436 err = -EFAULT;
427 break; 437 break;
428 } 438 }
429 count -= sizeof(snd_seq_event_t); 439 count -= sizeof(struct snd_seq_event);
430 buf += sizeof(snd_seq_event_t); 440 buf += sizeof(struct snd_seq_event);
431 } 441 }
432 snd_seq_cell_free(cell); 442 snd_seq_cell_free(cell);
433 cell = NULL; /* to be sure */ 443 cell = NULL; /* to be sure */
434 result += sizeof(snd_seq_event_t); 444 result += sizeof(struct snd_seq_event);
435 } 445 }
436 446
437 if (err < 0) { 447 if (err < 0) {
@@ -449,7 +459,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
449/* 459/*
450 * check access permission to the port 460 * check access permission to the port
451 */ 461 */
452static int check_port_perm(client_port_t *port, unsigned int flags) 462static int check_port_perm(struct snd_seq_client_port *port, unsigned int flags)
453{ 463{
454 if ((port->capability & flags) != flags) 464 if ((port->capability & flags) != flags)
455 return 0; 465 return 0;
@@ -460,9 +470,10 @@ static int check_port_perm(client_port_t *port, unsigned int flags)
460 * check if the destination client is available, and return the pointer 470 * check if the destination client is available, and return the pointer
461 * if filter is non-zero, client filter bitmap is tested. 471 * if filter is non-zero, client filter bitmap is tested.
462 */ 472 */
463static client_t *get_event_dest_client(snd_seq_event_t *event, int filter) 473static struct snd_seq_client *get_event_dest_client(struct snd_seq_event *event,
474 int filter)
464{ 475{
465 client_t *dest; 476 struct snd_seq_client *dest;
466 477
467 dest = snd_seq_client_use_ptr(event->dest.client); 478 dest = snd_seq_client_use_ptr(event->dest.client);
468 if (dest == NULL) 479 if (dest == NULL)
@@ -493,10 +504,11 @@ __not_avail:
493 * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra 504 * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra
494 * kmalloc. 505 * kmalloc.
495 */ 506 */
496static int bounce_error_event(client_t *client, snd_seq_event_t *event, 507static int bounce_error_event(struct snd_seq_client *client,
508 struct snd_seq_event *event,
497 int err, int atomic, int hop) 509 int err, int atomic, int hop)
498{ 510{
499 snd_seq_event_t bounce_ev; 511 struct snd_seq_event bounce_ev;
500 int result; 512 int result;
501 513
502 if (client == NULL || 514 if (client == NULL ||
@@ -531,9 +543,10 @@ static int bounce_error_event(client_t *client, snd_seq_event_t *event,
531 * of the given queue. 543 * of the given queue.
532 * return non-zero if updated. 544 * return non-zero if updated.
533 */ 545 */
534static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real_time) 546static int update_timestamp_of_queue(struct snd_seq_event *event,
547 int queue, int real_time)
535{ 548{
536 queue_t *q; 549 struct snd_seq_queue *q;
537 550
538 q = queueptr(queue); 551 q = queueptr(queue);
539 if (! q) 552 if (! q)
@@ -559,12 +572,12 @@ static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real
559 * RETURN VALUE: 0 : if succeeded 572 * RETURN VALUE: 0 : if succeeded
560 * <0 : error 573 * <0 : error
561 */ 574 */
562static int snd_seq_deliver_single_event(client_t *client, 575static int snd_seq_deliver_single_event(struct snd_seq_client *client,
563 snd_seq_event_t *event, 576 struct snd_seq_event *event,
564 int filter, int atomic, int hop) 577 int filter, int atomic, int hop)
565{ 578{
566 client_t *dest = NULL; 579 struct snd_seq_client *dest = NULL;
567 client_port_t *dest_port = NULL; 580 struct snd_seq_client_port *dest_port = NULL;
568 int result = -ENOENT; 581 int result = -ENOENT;
569 int direct; 582 int direct;
570 583
@@ -596,7 +609,9 @@ static int snd_seq_deliver_single_event(client_t *client,
596 case KERNEL_CLIENT: 609 case KERNEL_CLIENT:
597 if (dest_port->event_input == NULL) 610 if (dest_port->event_input == NULL)
598 break; 611 break;
599 result = dest_port->event_input(event, direct, dest_port->private_data, atomic, hop); 612 result = dest_port->event_input(event, direct,
613 dest_port->private_data,
614 atomic, hop);
600 break; 615 break;
601 default: 616 default:
602 break; 617 break;
@@ -618,16 +633,16 @@ static int snd_seq_deliver_single_event(client_t *client,
618/* 633/*
619 * send the event to all subscribers: 634 * send the event to all subscribers:
620 */ 635 */
621static int deliver_to_subscribers(client_t *client, 636static int deliver_to_subscribers(struct snd_seq_client *client,
622 snd_seq_event_t *event, 637 struct snd_seq_event *event,
623 int atomic, int hop) 638 int atomic, int hop)
624{ 639{
625 subscribers_t *subs; 640 struct snd_seq_subscribers *subs;
626 int err = 0, num_ev = 0; 641 int err = 0, num_ev = 0;
627 snd_seq_event_t event_saved; 642 struct snd_seq_event event_saved;
628 client_port_t *src_port; 643 struct snd_seq_client_port *src_port;
629 struct list_head *p; 644 struct list_head *p;
630 port_subs_info_t *grp; 645 struct snd_seq_port_subs_info *grp;
631 646
632 src_port = snd_seq_port_use_ptr(client, event->source.port); 647 src_port = snd_seq_port_use_ptr(client, event->source.port);
633 if (src_port == NULL) 648 if (src_port == NULL)
@@ -642,7 +657,7 @@ static int deliver_to_subscribers(client_t *client,
642 else 657 else
643 down_read(&grp->list_mutex); 658 down_read(&grp->list_mutex);
644 list_for_each(p, &grp->list_head) { 659 list_for_each(p, &grp->list_head) {
645 subs = list_entry(p, subscribers_t, src_list); 660 subs = list_entry(p, struct snd_seq_subscribers, src_list);
646 event->dest = subs->info.dest; 661 event->dest = subs->info.dest;
647 if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) 662 if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
648 /* convert time according to flag with subscription */ 663 /* convert time according to flag with subscription */
@@ -670,12 +685,12 @@ static int deliver_to_subscribers(client_t *client,
670/* 685/*
671 * broadcast to all ports: 686 * broadcast to all ports:
672 */ 687 */
673static int port_broadcast_event(client_t *client, 688static int port_broadcast_event(struct snd_seq_client *client,
674 snd_seq_event_t *event, 689 struct snd_seq_event *event,
675 int atomic, int hop) 690 int atomic, int hop)
676{ 691{
677 int num_ev = 0, err = 0; 692 int num_ev = 0, err = 0;
678 client_t *dest_client; 693 struct snd_seq_client *dest_client;
679 struct list_head *p; 694 struct list_head *p;
680 695
681 dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST); 696 dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST);
@@ -684,7 +699,7 @@ static int port_broadcast_event(client_t *client,
684 699
685 read_lock(&dest_client->ports_lock); 700 read_lock(&dest_client->ports_lock);
686 list_for_each(p, &dest_client->ports_list_head) { 701 list_for_each(p, &dest_client->ports_list_head) {
687 client_port_t *port = list_entry(p, client_port_t, list); 702 struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
688 event->dest.port = port->addr.port; 703 event->dest.port = port->addr.port;
689 /* pass NULL as source client to avoid error bounce */ 704 /* pass NULL as source client to avoid error bounce */
690 err = snd_seq_deliver_single_event(NULL, event, 705 err = snd_seq_deliver_single_event(NULL, event,
@@ -704,12 +719,12 @@ static int port_broadcast_event(client_t *client,
704 * send the event to all clients: 719 * send the event to all clients:
705 * if destination port is also ADDRESS_BROADCAST, deliver to all ports. 720 * if destination port is also ADDRESS_BROADCAST, deliver to all ports.
706 */ 721 */
707static int broadcast_event(client_t *client, 722static int broadcast_event(struct snd_seq_client *client,
708 snd_seq_event_t *event, int atomic, int hop) 723 struct snd_seq_event *event, int atomic, int hop)
709{ 724{
710 int err = 0, num_ev = 0; 725 int err = 0, num_ev = 0;
711 int dest; 726 int dest;
712 snd_seq_addr_t addr; 727 struct snd_seq_addr addr;
713 728
714 addr = event->dest; /* save */ 729 addr = event->dest; /* save */
715 730
@@ -736,7 +751,7 @@ static int broadcast_event(client_t *client,
736 751
737 752
738/* multicast - not supported yet */ 753/* multicast - not supported yet */
739static int multicast_event(client_t *client, snd_seq_event_t *event, 754static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event,
740 int atomic, int hop) 755 int atomic, int hop)
741{ 756{
742 snd_printd("seq: multicast not supported yet.\n"); 757 snd_printd("seq: multicast not supported yet.\n");
@@ -753,7 +768,7 @@ static int multicast_event(client_t *client, snd_seq_event_t *event,
753 * n == 0 : the event was not passed to any client. 768 * n == 0 : the event was not passed to any client.
754 * n < 0 : error - event was not processed. 769 * n < 0 : error - event was not processed.
755 */ 770 */
756static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, 771static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event,
757 int atomic, int hop) 772 int atomic, int hop)
758{ 773{
759 int result; 774 int result;
@@ -794,9 +809,9 @@ static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event,
794 * n == 0 : the event was not passed to any client. 809 * n == 0 : the event was not passed to any client.
795 * n < 0 : error - event was not processed. 810 * n < 0 : error - event was not processed.
796 */ 811 */
797int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) 812int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop)
798{ 813{
799 client_t *client; 814 struct snd_seq_client *client;
800 int result; 815 int result;
801 816
802 snd_assert(cell != NULL, return -EINVAL); 817 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)
812 * the event cell is re-used as a NOTE-OFF event and 827 * the event cell is re-used as a NOTE-OFF event and
813 * enqueued again. 828 * enqueued again.
814 */ 829 */
815 snd_seq_event_t tmpev, *ev; 830 struct snd_seq_event tmpev, *ev;
816 831
817 /* reserve this event to enqueue note-off later */ 832 /* reserve this event to enqueue note-off later */
818 tmpev = cell->event; 833 tmpev = cell->event;
@@ -865,12 +880,12 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop)
865 * if pool is empty and blocking is TRUE, sleep until a new cell is 880 * if pool is empty and blocking is TRUE, sleep until a new cell is
866 * available. 881 * available.
867 */ 882 */
868static int snd_seq_client_enqueue_event(client_t *client, 883static int snd_seq_client_enqueue_event(struct snd_seq_client *client,
869 snd_seq_event_t *event, 884 struct snd_seq_event *event,
870 struct file *file, int blocking, 885 struct file *file, int blocking,
871 int atomic, int hop) 886 int atomic, int hop)
872{ 887{
873 snd_seq_event_cell_t *cell; 888 struct snd_seq_event_cell *cell;
874 int err; 889 int err;
875 890
876 /* special queue values - force direct passing */ 891 /* special queue values - force direct passing */
@@ -886,7 +901,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
886#endif 901#endif
887 if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { 902 if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) {
888 /* check presence of source port */ 903 /* check presence of source port */
889 client_port_t *src_port = snd_seq_port_use_ptr(client, event->source.port); 904 struct snd_seq_client_port *src_port = snd_seq_port_use_ptr(client, event->source.port);
890 if (src_port == NULL) 905 if (src_port == NULL)
891 return -EINVAL; 906 return -EINVAL;
892 snd_seq_port_unlock(src_port); 907 snd_seq_port_unlock(src_port);
@@ -924,7 +939,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
924 * check validity of event type and data length. 939 * check validity of event type and data length.
925 * return non-zero if invalid. 940 * return non-zero if invalid.
926 */ 941 */
927static int check_event_type_and_length(snd_seq_event_t *ev) 942static int check_event_type_and_length(struct snd_seq_event *ev)
928{ 943{
929 switch (snd_seq_ev_length_type(ev)) { 944 switch (snd_seq_ev_length_type(ev)) {
930 case SNDRV_SEQ_EVENT_LENGTH_FIXED: 945 case SNDRV_SEQ_EVENT_LENGTH_FIXED:
@@ -957,12 +972,13 @@ static int check_event_type_and_length(snd_seq_event_t *ev)
957 * -EMLINK too many hops 972 * -EMLINK too many hops
958 * others depends on return value from driver callback 973 * others depends on return value from driver callback
959 */ 974 */
960static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) 975static ssize_t snd_seq_write(struct file *file, const char __user *buf,
976 size_t count, loff_t *offset)
961{ 977{
962 client_t *client = (client_t *) file->private_data; 978 struct snd_seq_client *client = file->private_data;
963 int written = 0, len; 979 int written = 0, len;
964 int err = -EINVAL; 980 int err = -EINVAL;
965 snd_seq_event_t event; 981 struct snd_seq_event event;
966 982
967 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) 983 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
968 return -ENXIO; 984 return -ENXIO;
@@ -980,7 +996,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
980 } 996 }
981 997
982 /* only process whole events */ 998 /* only process whole events */
983 while (count >= sizeof(snd_seq_event_t)) { 999 while (count >= sizeof(struct snd_seq_event)) {
984 /* Read in the event header from the user */ 1000 /* Read in the event header from the user */
985 len = sizeof(event); 1001 len = sizeof(event);
986 if (copy_from_user(&event, buf, len)) { 1002 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
1012 /* set user space pointer */ 1028 /* set user space pointer */
1013 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; 1029 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
1014 event.data.ext.ptr = (char __force *)buf 1030 event.data.ext.ptr = (char __force *)buf
1015 + sizeof(snd_seq_event_t); 1031 + sizeof(struct snd_seq_event);
1016 len += extlen; /* increment data length */ 1032 len += extlen; /* increment data length */
1017 } else { 1033 } else {
1018#ifdef CONFIG_COMPAT 1034#ifdef CONFIG_COMPAT
@@ -1046,7 +1062,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1046 */ 1062 */
1047static unsigned int snd_seq_poll(struct file *file, poll_table * wait) 1063static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
1048{ 1064{
1049 client_t *client = (client_t *) file->private_data; 1065 struct snd_seq_client *client = file->private_data;
1050 unsigned int mask = 0; 1066 unsigned int mask = 0;
1051 1067
1052 /* check client structures are in place */ 1068 /* check client structures are in place */
@@ -1076,9 +1092,9 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
1076 1092
1077 1093
1078/* SYSTEM_INFO ioctl() */ 1094/* SYSTEM_INFO ioctl() */
1079static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) 1095static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg)
1080{ 1096{
1081 snd_seq_system_info_t info; 1097 struct snd_seq_system_info info;
1082 1098
1083 memset(&info, 0, sizeof(info)); 1099 memset(&info, 0, sizeof(info));
1084 /* fill the info fields */ 1100 /* fill the info fields */
@@ -1096,10 +1112,10 @@ static int snd_seq_ioctl_system_info(client_t *client, void __user *arg)
1096 1112
1097 1113
1098/* RUNNING_MODE ioctl() */ 1114/* RUNNING_MODE ioctl() */
1099static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg) 1115static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void __user *arg)
1100{ 1116{
1101 struct sndrv_seq_running_info info; 1117 struct snd_seq_running_info info;
1102 client_t *cptr; 1118 struct snd_seq_client *cptr;
1103 int err = 0; 1119 int err = 0;
1104 1120
1105 if (copy_from_user(&info, arg, sizeof(info))) 1121 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)
1133} 1149}
1134 1150
1135/* CLIENT_INFO ioctl() */ 1151/* CLIENT_INFO ioctl() */
1136static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) 1152static void get_client_info(struct snd_seq_client *cptr,
1153 struct snd_seq_client_info *info)
1137{ 1154{
1138 info->client = cptr->number; 1155 info->client = cptr->number;
1139 1156
@@ -1147,10 +1164,11 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info)
1147 memset(info->reserved, 0, sizeof(info->reserved)); 1164 memset(info->reserved, 0, sizeof(info->reserved));
1148} 1165}
1149 1166
1150static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) 1167static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client,
1168 void __user *arg)
1151{ 1169{
1152 client_t *cptr; 1170 struct snd_seq_client *cptr;
1153 snd_seq_client_info_t client_info; 1171 struct snd_seq_client_info client_info;
1154 1172
1155 if (copy_from_user(&client_info, arg, sizeof(client_info))) 1173 if (copy_from_user(&client_info, arg, sizeof(client_info)))
1156 return -EFAULT; 1174 return -EFAULT;
@@ -1170,9 +1188,10 @@ static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg)
1170 1188
1171 1189
1172/* CLIENT_INFO ioctl() */ 1190/* CLIENT_INFO ioctl() */
1173static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) 1191static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
1192 void __user *arg)
1174{ 1193{
1175 snd_seq_client_info_t client_info; 1194 struct snd_seq_client_info client_info;
1176 1195
1177 if (copy_from_user(&client_info, arg, sizeof(client_info))) 1196 if (copy_from_user(&client_info, arg, sizeof(client_info)))
1178 return -EFAULT; 1197 return -EFAULT;
@@ -1199,11 +1218,12 @@ static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg)
1199/* 1218/*
1200 * CREATE PORT ioctl() 1219 * CREATE PORT ioctl()
1201 */ 1220 */
1202static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) 1221static int snd_seq_ioctl_create_port(struct snd_seq_client *client,
1222 void __user *arg)
1203{ 1223{
1204 client_port_t *port; 1224 struct snd_seq_client_port *port;
1205 snd_seq_port_info_t info; 1225 struct snd_seq_port_info info;
1206 snd_seq_port_callback_t *callback; 1226 struct snd_seq_port_callback *callback;
1207 1227
1208 if (copy_from_user(&info, arg, sizeof(info))) 1228 if (copy_from_user(&info, arg, sizeof(info)))
1209 return -EFAULT; 1229 return -EFAULT;
@@ -1249,9 +1269,10 @@ static int snd_seq_ioctl_create_port(client_t * client, void __user *arg)
1249/* 1269/*
1250 * DELETE PORT ioctl() 1270 * DELETE PORT ioctl()
1251 */ 1271 */
1252static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) 1272static int snd_seq_ioctl_delete_port(struct snd_seq_client *client,
1273 void __user *arg)
1253{ 1274{
1254 snd_seq_port_info_t info; 1275 struct snd_seq_port_info info;
1255 int err; 1276 int err;
1256 1277
1257 /* set passed parameters */ 1278 /* set passed parameters */
@@ -1272,11 +1293,12 @@ static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg)
1272/* 1293/*
1273 * GET_PORT_INFO ioctl() (on any client) 1294 * GET_PORT_INFO ioctl() (on any client)
1274 */ 1295 */
1275static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) 1296static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client,
1297 void __user *arg)
1276{ 1298{
1277 client_t *cptr; 1299 struct snd_seq_client *cptr;
1278 client_port_t *port; 1300 struct snd_seq_client_port *port;
1279 snd_seq_port_info_t info; 1301 struct snd_seq_port_info info;
1280 1302
1281 if (copy_from_user(&info, arg, sizeof(info))) 1303 if (copy_from_user(&info, arg, sizeof(info)))
1282 return -EFAULT; 1304 return -EFAULT;
@@ -1304,10 +1326,11 @@ static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg)
1304/* 1326/*
1305 * SET_PORT_INFO ioctl() (only ports on this/own client) 1327 * SET_PORT_INFO ioctl() (only ports on this/own client)
1306 */ 1328 */
1307static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) 1329static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client,
1330 void __user *arg)
1308{ 1331{
1309 client_port_t *port; 1332 struct snd_seq_client_port *port;
1310 snd_seq_port_info_t info; 1333 struct snd_seq_port_info info;
1311 1334
1312 if (copy_from_user(&info, arg, sizeof(info))) 1335 if (copy_from_user(&info, arg, sizeof(info)))
1313 return -EFAULT; 1336 return -EFAULT;
@@ -1329,9 +1352,10 @@ static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg)
1329#define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ) 1352#define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ)
1330#define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE) 1353#define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE)
1331 1354
1332static int check_subscription_permission(client_t *client, client_port_t *sport, 1355static int check_subscription_permission(struct snd_seq_client *client,
1333 client_port_t *dport, 1356 struct snd_seq_client_port *sport,
1334 snd_seq_port_subscribe_t *subs) 1357 struct snd_seq_client_port *dport,
1358 struct snd_seq_port_subscribe *subs)
1335{ 1359{
1336 if (client->number != subs->sender.client && 1360 if (client->number != subs->sender.client &&
1337 client->number != subs->dest.client) { 1361 client->number != subs->dest.client) {
@@ -1363,9 +1387,10 @@ static int check_subscription_permission(client_t *client, client_port_t *sport,
1363 * client must be user client. 1387 * client must be user client.
1364 */ 1388 */
1365int snd_seq_client_notify_subscription(int client, int port, 1389int snd_seq_client_notify_subscription(int client, int port,
1366 snd_seq_port_subscribe_t *info, int evtype) 1390 struct snd_seq_port_subscribe *info,
1391 int evtype)
1367{ 1392{
1368 snd_seq_event_t event; 1393 struct snd_seq_event event;
1369 1394
1370 memset(&event, 0, sizeof(event)); 1395 memset(&event, 0, sizeof(event));
1371 event.type = evtype; 1396 event.type = evtype;
@@ -1379,12 +1404,13 @@ int snd_seq_client_notify_subscription(int client, int port,
1379/* 1404/*
1380 * add to port's subscription list IOCTL interface 1405 * add to port's subscription list IOCTL interface
1381 */ 1406 */
1382static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) 1407static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client,
1408 void __user *arg)
1383{ 1409{
1384 int result = -EINVAL; 1410 int result = -EINVAL;
1385 client_t *receiver = NULL, *sender = NULL; 1411 struct snd_seq_client *receiver = NULL, *sender = NULL;
1386 client_port_t *sport = NULL, *dport = NULL; 1412 struct snd_seq_client_port *sport = NULL, *dport = NULL;
1387 snd_seq_port_subscribe_t subs; 1413 struct snd_seq_port_subscribe subs;
1388 1414
1389 if (copy_from_user(&subs, arg, sizeof(subs))) 1415 if (copy_from_user(&subs, arg, sizeof(subs)))
1390 return -EFAULT; 1416 return -EFAULT;
@@ -1423,12 +1449,13 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg)
1423/* 1449/*
1424 * remove from port's subscription list 1450 * remove from port's subscription list
1425 */ 1451 */
1426static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) 1452static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
1453 void __user *arg)
1427{ 1454{
1428 int result = -ENXIO; 1455 int result = -ENXIO;
1429 client_t *receiver = NULL, *sender = NULL; 1456 struct snd_seq_client *receiver = NULL, *sender = NULL;
1430 client_port_t *sport = NULL, *dport = NULL; 1457 struct snd_seq_client_port *sport = NULL, *dport = NULL;
1431 snd_seq_port_subscribe_t subs; 1458 struct snd_seq_port_subscribe subs;
1432 1459
1433 if (copy_from_user(&subs, arg, sizeof(subs))) 1460 if (copy_from_user(&subs, arg, sizeof(subs)))
1434 return -EFAULT; 1461 return -EFAULT;
@@ -1464,11 +1491,12 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg)
1464 1491
1465 1492
1466/* CREATE_QUEUE ioctl() */ 1493/* CREATE_QUEUE ioctl() */
1467static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) 1494static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
1495 void __user *arg)
1468{ 1496{
1469 snd_seq_queue_info_t info; 1497 struct snd_seq_queue_info info;
1470 int result; 1498 int result;
1471 queue_t *q; 1499 struct snd_seq_queue *q;
1472 1500
1473 if (copy_from_user(&info, arg, sizeof(info))) 1501 if (copy_from_user(&info, arg, sizeof(info)))
1474 return -EFAULT; 1502 return -EFAULT;
@@ -1498,9 +1526,10 @@ static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg)
1498} 1526}
1499 1527
1500/* DELETE_QUEUE ioctl() */ 1528/* DELETE_QUEUE ioctl() */
1501static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) 1529static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client,
1530 void __user *arg)
1502{ 1531{
1503 snd_seq_queue_info_t info; 1532 struct snd_seq_queue_info info;
1504 1533
1505 if (copy_from_user(&info, arg, sizeof(info))) 1534 if (copy_from_user(&info, arg, sizeof(info)))
1506 return -EFAULT; 1535 return -EFAULT;
@@ -1509,10 +1538,11 @@ static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg)
1509} 1538}
1510 1539
1511/* GET_QUEUE_INFO ioctl() */ 1540/* GET_QUEUE_INFO ioctl() */
1512static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) 1541static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client,
1542 void __user *arg)
1513{ 1543{
1514 snd_seq_queue_info_t info; 1544 struct snd_seq_queue_info info;
1515 queue_t *q; 1545 struct snd_seq_queue *q;
1516 1546
1517 if (copy_from_user(&info, arg, sizeof(info))) 1547 if (copy_from_user(&info, arg, sizeof(info)))
1518 return -EFAULT; 1548 return -EFAULT;
@@ -1535,10 +1565,11 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg)
1535} 1565}
1536 1566
1537/* SET_QUEUE_INFO ioctl() */ 1567/* SET_QUEUE_INFO ioctl() */
1538static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) 1568static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client,
1569 void __user *arg)
1539{ 1570{
1540 snd_seq_queue_info_t info; 1571 struct snd_seq_queue_info info;
1541 queue_t *q; 1572 struct snd_seq_queue *q;
1542 1573
1543 if (copy_from_user(&info, arg, sizeof(info))) 1574 if (copy_from_user(&info, arg, sizeof(info)))
1544 return -EFAULT; 1575 return -EFAULT;
@@ -1570,10 +1601,10 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg)
1570} 1601}
1571 1602
1572/* GET_NAMED_QUEUE ioctl() */ 1603/* GET_NAMED_QUEUE ioctl() */
1573static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) 1604static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, void __user *arg)
1574{ 1605{
1575 snd_seq_queue_info_t info; 1606 struct snd_seq_queue_info info;
1576 queue_t *q; 1607 struct snd_seq_queue *q;
1577 1608
1578 if (copy_from_user(&info, arg, sizeof(info))) 1609 if (copy_from_user(&info, arg, sizeof(info)))
1579 return -EFAULT; 1610 return -EFAULT;
@@ -1593,11 +1624,12 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg)
1593} 1624}
1594 1625
1595/* GET_QUEUE_STATUS ioctl() */ 1626/* GET_QUEUE_STATUS ioctl() */
1596static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) 1627static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client,
1628 void __user *arg)
1597{ 1629{
1598 snd_seq_queue_status_t status; 1630 struct snd_seq_queue_status status;
1599 queue_t *queue; 1631 struct snd_seq_queue *queue;
1600 seq_timer_t *tmr; 1632 struct snd_seq_timer *tmr;
1601 1633
1602 if (copy_from_user(&status, arg, sizeof(status))) 1634 if (copy_from_user(&status, arg, sizeof(status)))
1603 return -EFAULT; 1635 return -EFAULT;
@@ -1626,11 +1658,12 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg)
1626 1658
1627 1659
1628/* GET_QUEUE_TEMPO ioctl() */ 1660/* GET_QUEUE_TEMPO ioctl() */
1629static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) 1661static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
1662 void __user *arg)
1630{ 1663{
1631 snd_seq_queue_tempo_t tempo; 1664 struct snd_seq_queue_tempo tempo;
1632 queue_t *queue; 1665 struct snd_seq_queue *queue;
1633 seq_timer_t *tmr; 1666 struct snd_seq_timer *tmr;
1634 1667
1635 if (copy_from_user(&tempo, arg, sizeof(tempo))) 1668 if (copy_from_user(&tempo, arg, sizeof(tempo)))
1636 return -EFAULT; 1669 return -EFAULT;
@@ -1656,17 +1689,18 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg)
1656 1689
1657 1690
1658/* SET_QUEUE_TEMPO ioctl() */ 1691/* SET_QUEUE_TEMPO ioctl() */
1659int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo) 1692int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo)
1660{ 1693{
1661 if (!snd_seq_queue_check_access(tempo->queue, client)) 1694 if (!snd_seq_queue_check_access(tempo->queue, client))
1662 return -EPERM; 1695 return -EPERM;
1663 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); 1696 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo);
1664} 1697}
1665 1698
1666static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) 1699static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
1700 void __user *arg)
1667{ 1701{
1668 int result; 1702 int result;
1669 snd_seq_queue_tempo_t tempo; 1703 struct snd_seq_queue_tempo tempo;
1670 1704
1671 if (copy_from_user(&tempo, arg, sizeof(tempo))) 1705 if (copy_from_user(&tempo, arg, sizeof(tempo)))
1672 return -EFAULT; 1706 return -EFAULT;
@@ -1677,11 +1711,12 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg)
1677 1711
1678 1712
1679/* GET_QUEUE_TIMER ioctl() */ 1713/* GET_QUEUE_TIMER ioctl() */
1680static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) 1714static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
1715 void __user *arg)
1681{ 1716{
1682 snd_seq_queue_timer_t timer; 1717 struct snd_seq_queue_timer timer;
1683 queue_t *queue; 1718 struct snd_seq_queue *queue;
1684 seq_timer_t *tmr; 1719 struct snd_seq_timer *tmr;
1685 1720
1686 if (copy_from_user(&timer, arg, sizeof(timer))) 1721 if (copy_from_user(&timer, arg, sizeof(timer)))
1687 return -EFAULT; 1722 return -EFAULT;
@@ -1713,10 +1748,11 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg)
1713 1748
1714 1749
1715/* SET_QUEUE_TIMER ioctl() */ 1750/* SET_QUEUE_TIMER ioctl() */
1716static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) 1751static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
1752 void __user *arg)
1717{ 1753{
1718 int result = 0; 1754 int result = 0;
1719 snd_seq_queue_timer_t timer; 1755 struct snd_seq_queue_timer timer;
1720 1756
1721 if (copy_from_user(&timer, arg, sizeof(timer))) 1757 if (copy_from_user(&timer, arg, sizeof(timer)))
1722 return -EFAULT; 1758 return -EFAULT;
@@ -1725,8 +1761,8 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
1725 return -EINVAL; 1761 return -EINVAL;
1726 1762
1727 if (snd_seq_queue_check_access(timer.queue, client->number)) { 1763 if (snd_seq_queue_check_access(timer.queue, client->number)) {
1728 queue_t *q; 1764 struct snd_seq_queue *q;
1729 seq_timer_t *tmr; 1765 struct snd_seq_timer *tmr;
1730 1766
1731 q = queueptr(timer.queue); 1767 q = queueptr(timer.queue);
1732 if (q == NULL) 1768 if (q == NULL)
@@ -1754,9 +1790,10 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
1754 1790
1755 1791
1756/* GET_QUEUE_CLIENT ioctl() */ 1792/* GET_QUEUE_CLIENT ioctl() */
1757static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg) 1793static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client,
1794 void __user *arg)
1758{ 1795{
1759 snd_seq_queue_client_t info; 1796 struct snd_seq_queue_client info;
1760 int used; 1797 int used;
1761 1798
1762 if (copy_from_user(&info, arg, sizeof(info))) 1799 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)
1775 1812
1776 1813
1777/* SET_QUEUE_CLIENT ioctl() */ 1814/* SET_QUEUE_CLIENT ioctl() */
1778static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) 1815static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client,
1816 void __user *arg)
1779{ 1817{
1780 int err; 1818 int err;
1781 snd_seq_queue_client_t info; 1819 struct snd_seq_queue_client info;
1782 1820
1783 if (copy_from_user(&info, arg, sizeof(info))) 1821 if (copy_from_user(&info, arg, sizeof(info)))
1784 return -EFAULT; 1822 return -EFAULT;
@@ -1794,10 +1832,11 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg)
1794 1832
1795 1833
1796/* GET_CLIENT_POOL ioctl() */ 1834/* GET_CLIENT_POOL ioctl() */
1797static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) 1835static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client,
1836 void __user *arg)
1798{ 1837{
1799 snd_seq_client_pool_t info; 1838 struct snd_seq_client_pool info;
1800 client_t *cptr; 1839 struct snd_seq_client *cptr;
1801 1840
1802 if (copy_from_user(&info, arg, sizeof(info))) 1841 if (copy_from_user(&info, arg, sizeof(info)))
1803 return -EFAULT; 1842 return -EFAULT;
@@ -1828,9 +1867,10 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg)
1828} 1867}
1829 1868
1830/* SET_CLIENT_POOL ioctl() */ 1869/* SET_CLIENT_POOL ioctl() */
1831static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg) 1870static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
1871 void __user *arg)
1832{ 1872{
1833 snd_seq_client_pool_t info; 1873 struct snd_seq_client_pool info;
1834 int rc; 1874 int rc;
1835 1875
1836 if (copy_from_user(&info, arg, sizeof(info))) 1876 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)
1872 1912
1873 1913
1874/* REMOVE_EVENTS ioctl() */ 1914/* REMOVE_EVENTS ioctl() */
1875static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) 1915static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
1916 void __user *arg)
1876{ 1917{
1877 snd_seq_remove_events_t info; 1918 struct snd_seq_remove_events info;
1878 1919
1879 if (copy_from_user(&info, arg, sizeof(info))) 1920 if (copy_from_user(&info, arg, sizeof(info)))
1880 return -EFAULT; 1921 return -EFAULT;
@@ -1901,13 +1942,14 @@ static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg)
1901/* 1942/*
1902 * get subscription info 1943 * get subscription info
1903 */ 1944 */
1904static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) 1945static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
1946 void __user *arg)
1905{ 1947{
1906 int result; 1948 int result;
1907 client_t *sender = NULL; 1949 struct snd_seq_client *sender = NULL;
1908 client_port_t *sport = NULL; 1950 struct snd_seq_client_port *sport = NULL;
1909 snd_seq_port_subscribe_t subs; 1951 struct snd_seq_port_subscribe subs;
1910 subscribers_t *p; 1952 struct snd_seq_subscribers *p;
1911 1953
1912 if (copy_from_user(&subs, arg, sizeof(subs))) 1954 if (copy_from_user(&subs, arg, sizeof(subs)))
1913 return -EFAULT; 1955 return -EFAULT;
@@ -1940,13 +1982,14 @@ static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg)
1940/* 1982/*
1941 * get subscription info - check only its presence 1983 * get subscription info - check only its presence
1942 */ 1984 */
1943static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) 1985static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
1986 void __user *arg)
1944{ 1987{
1945 int result = -ENXIO; 1988 int result = -ENXIO;
1946 client_t *cptr = NULL; 1989 struct snd_seq_client *cptr = NULL;
1947 client_port_t *port = NULL; 1990 struct snd_seq_client_port *port = NULL;
1948 snd_seq_query_subs_t subs; 1991 struct snd_seq_query_subs subs;
1949 port_subs_info_t *group; 1992 struct snd_seq_port_subs_info *group;
1950 struct list_head *p; 1993 struct list_head *p;
1951 int i; 1994 int i;
1952 1995
@@ -1977,12 +2020,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
1977 list_for_each(p, &group->list_head) { 2020 list_for_each(p, &group->list_head) {
1978 if (i++ == subs.index) { 2021 if (i++ == subs.index) {
1979 /* found! */ 2022 /* found! */
1980 subscribers_t *s; 2023 struct snd_seq_subscribers *s;
1981 if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) { 2024 if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) {
1982 s = list_entry(p, subscribers_t, src_list); 2025 s = list_entry(p, struct snd_seq_subscribers, src_list);
1983 subs.addr = s->info.dest; 2026 subs.addr = s->info.dest;
1984 } else { 2027 } else {
1985 s = list_entry(p, subscribers_t, dest_list); 2028 s = list_entry(p, struct snd_seq_subscribers, dest_list);
1986 subs.addr = s->info.sender; 2029 subs.addr = s->info.sender;
1987 } 2030 }
1988 subs.flags = s->info.flags; 2031 subs.flags = s->info.flags;
@@ -2009,10 +2052,11 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
2009/* 2052/*
2010 * query next client 2053 * query next client
2011 */ 2054 */
2012static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) 2055static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
2056 void __user *arg)
2013{ 2057{
2014 client_t *cptr = NULL; 2058 struct snd_seq_client *cptr = NULL;
2015 snd_seq_client_info_t info; 2059 struct snd_seq_client_info info;
2016 2060
2017 if (copy_from_user(&info, arg, sizeof(info))) 2061 if (copy_from_user(&info, arg, sizeof(info)))
2018 return -EFAULT; 2062 return -EFAULT;
@@ -2040,11 +2084,12 @@ static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg)
2040/* 2084/*
2041 * query next port 2085 * query next port
2042 */ 2086 */
2043static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) 2087static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client,
2088 void __user *arg)
2044{ 2089{
2045 client_t *cptr; 2090 struct snd_seq_client *cptr;
2046 client_port_t *port = NULL; 2091 struct snd_seq_client_port *port = NULL;
2047 snd_seq_port_info_t info; 2092 struct snd_seq_port_info info;
2048 2093
2049 if (copy_from_user(&info, arg, sizeof(info))) 2094 if (copy_from_user(&info, arg, sizeof(info)))
2050 return -EFAULT; 2095 return -EFAULT;
@@ -2075,7 +2120,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg)
2075 2120
2076static struct seq_ioctl_table { 2121static struct seq_ioctl_table {
2077 unsigned int cmd; 2122 unsigned int cmd;
2078 int (*func)(client_t *client, void __user * arg); 2123 int (*func)(struct snd_seq_client *client, void __user * arg);
2079} ioctl_tables[] = { 2124} ioctl_tables[] = {
2080 { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info }, 2125 { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info },
2081 { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode }, 2126 { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode },
@@ -2109,7 +2154,8 @@ static struct seq_ioctl_table {
2109 { 0, NULL }, 2154 { 0, NULL },
2110}; 2155};
2111 2156
2112static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg) 2157static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd,
2158 void __user *arg)
2113{ 2159{
2114 struct seq_ioctl_table *p; 2160 struct seq_ioctl_table *p;
2115 2161
@@ -2136,7 +2182,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg
2136 2182
2137static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2183static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2138{ 2184{
2139 client_t *client = (client_t *) file->private_data; 2185 struct snd_seq_client *client = file->private_data;
2140 2186
2141 snd_assert(client != NULL, return -ENXIO); 2187 snd_assert(client != NULL, return -ENXIO);
2142 2188
@@ -2153,9 +2199,10 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg
2153 2199
2154 2200
2155/* exported to kernel modules */ 2201/* exported to kernel modules */
2156int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t * callback) 2202int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
2203 struct snd_seq_client_callback *callback)
2157{ 2204{
2158 client_t *client; 2205 struct snd_seq_client *client;
2159 2206
2160 snd_assert(! in_interrupt(), return -EBUSY); 2207 snd_assert(! in_interrupt(), return -EBUSY);
2161 2208
@@ -2199,7 +2246,7 @@ int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_cli
2199/* exported to kernel modules */ 2246/* exported to kernel modules */
2200int snd_seq_delete_kernel_client(int client) 2247int snd_seq_delete_kernel_client(int client)
2201{ 2248{
2202 client_t *ptr; 2249 struct snd_seq_client *ptr;
2203 2250
2204 snd_assert(! in_interrupt(), return -EBUSY); 2251 snd_assert(! in_interrupt(), return -EBUSY);
2205 2252
@@ -2216,11 +2263,11 @@ int snd_seq_delete_kernel_client(int client)
2216/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue 2263/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue
2217 * and snd_seq_kernel_client_enqueue_blocking 2264 * and snd_seq_kernel_client_enqueue_blocking
2218 */ 2265 */
2219static int kernel_client_enqueue(int client, snd_seq_event_t *ev, 2266static int kernel_client_enqueue(int client, struct snd_seq_event *ev,
2220 struct file *file, int blocking, 2267 struct file *file, int blocking,
2221 int atomic, int hop) 2268 int atomic, int hop)
2222{ 2269{
2223 client_t *cptr; 2270 struct snd_seq_client *cptr;
2224 int result; 2271 int result;
2225 2272
2226 snd_assert(ev != NULL, return -EINVAL); 2273 snd_assert(ev != NULL, return -EINVAL);
@@ -2254,7 +2301,7 @@ static int kernel_client_enqueue(int client, snd_seq_event_t *ev,
2254 * 2301 *
2255 * RETURN VALUE: zero if succeed, negative if error 2302 * RETURN VALUE: zero if succeed, negative if error
2256 */ 2303 */
2257int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev, 2304int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev,
2258 int atomic, int hop) 2305 int atomic, int hop)
2259{ 2306{
2260 return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop); 2307 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,
2265 * 2312 *
2266 * RETURN VALUE: zero if succeed, negative if error 2313 * RETURN VALUE: zero if succeed, negative if error
2267 */ 2314 */
2268int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, 2315int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
2269 struct file *file, 2316 struct file *file,
2270 int atomic, int hop) 2317 int atomic, int hop)
2271{ 2318{
@@ -2280,10 +2327,10 @@ int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev,
2280 * RETURN VALUE: negative = delivery failed, 2327 * RETURN VALUE: negative = delivery failed,
2281 * zero, or positive: the number of delivered events 2328 * zero, or positive: the number of delivered events
2282 */ 2329 */
2283int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, 2330int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev,
2284 int atomic, int hop) 2331 int atomic, int hop)
2285{ 2332{
2286 client_t *cptr; 2333 struct snd_seq_client *cptr;
2287 int result; 2334 int result;
2288 2335
2289 snd_assert(ev != NULL, return -EINVAL); 2336 snd_assert(ev != NULL, return -EINVAL);
@@ -2315,7 +2362,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
2315 */ 2362 */
2316int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) 2363int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
2317{ 2364{
2318 client_t *client; 2365 struct snd_seq_client *client;
2319 mm_segment_t fs; 2366 mm_segment_t fs;
2320 int result; 2367 int result;
2321 2368
@@ -2332,7 +2379,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
2332/* exported (for OSS emulator) */ 2379/* exported (for OSS emulator) */
2333int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait) 2380int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait)
2334{ 2381{
2335 client_t *client; 2382 struct snd_seq_client *client;
2336 2383
2337 client = clientptr(clientid); 2384 client = clientptr(clientid);
2338 if (client == NULL) 2385 if (client == NULL)
@@ -2350,10 +2397,12 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table
2350/* 2397/*
2351 * /proc interface 2398 * /proc interface
2352 */ 2399 */
2353static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_info_t *group, int is_src, char *msg) 2400static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer,
2401 struct snd_seq_port_subs_info *group,
2402 int is_src, char *msg)
2354{ 2403{
2355 struct list_head *p; 2404 struct list_head *p;
2356 subscribers_t *s; 2405 struct snd_seq_subscribers *s;
2357 int count = 0; 2406 int count = 0;
2358 2407
2359 down_read(&group->list_mutex); 2408 down_read(&group->list_mutex);
@@ -2364,9 +2413,9 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
2364 snd_iprintf(buffer, msg); 2413 snd_iprintf(buffer, msg);
2365 list_for_each(p, &group->list_head) { 2414 list_for_each(p, &group->list_head) {
2366 if (is_src) 2415 if (is_src)
2367 s = list_entry(p, subscribers_t, src_list); 2416 s = list_entry(p, struct snd_seq_subscribers, src_list);
2368 else 2417 else
2369 s = list_entry(p, subscribers_t, dest_list); 2418 s = list_entry(p, struct snd_seq_subscribers, dest_list);
2370 if (count++) 2419 if (count++)
2371 snd_iprintf(buffer, ", "); 2420 snd_iprintf(buffer, ", ");
2372 snd_iprintf(buffer, "%d:%d", 2421 snd_iprintf(buffer, "%d:%d",
@@ -2387,13 +2436,14 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
2387 2436
2388#define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-') 2437#define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-')
2389 2438
2390static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client) 2439static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
2440 struct snd_seq_client *client)
2391{ 2441{
2392 struct list_head *l; 2442 struct list_head *l;
2393 2443
2394 down(&client->ports_mutex); 2444 down(&client->ports_mutex);
2395 list_for_each(l, &client->ports_list_head) { 2445 list_for_each(l, &client->ports_list_head) {
2396 client_port_t *p = list_entry(l, client_port_t, list); 2446 struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
2397 snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", 2447 snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n",
2398 p->addr.port, p->name, 2448 p->addr.port, p->name,
2399 FLAG_PERM_RD(p->capability), 2449 FLAG_PERM_RD(p->capability),
@@ -2407,13 +2457,15 @@ static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client)
2407} 2457}
2408 2458
2409 2459
2460void snd_seq_info_pool(struct snd_info_buffer *buffer,
2461 struct snd_seq_pool *pool, char *space);
2462
2410/* exported to seq_info.c */ 2463/* exported to seq_info.c */
2411void snd_seq_info_clients_read(snd_info_entry_t *entry, 2464void snd_seq_info_clients_read(struct snd_info_entry *entry,
2412 snd_info_buffer_t * buffer) 2465 struct snd_info_buffer *buffer)
2413{ 2466{
2414 extern void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t * pool, char *space);
2415 int c; 2467 int c;
2416 client_t *client; 2468 struct snd_seq_client *client;
2417 2469
2418 snd_iprintf(buffer, "Client info\n"); 2470 snd_iprintf(buffer, "Client info\n");
2419 snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur); 2471 snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur);
@@ -2468,7 +2520,7 @@ static struct file_operations snd_seq_f_ops =
2468 .compat_ioctl = snd_seq_ioctl_compat, 2520 .compat_ioctl = snd_seq_ioctl_compat,
2469}; 2521};
2470 2522
2471static snd_minor_t snd_seq_reg = 2523static struct snd_minor snd_seq_reg =
2472{ 2524{
2473 .comment = "sequencer", 2525 .comment = "sequencer",
2474 .f_ops = &snd_seq_f_ops, 2526 .f_ops = &snd_seq_f_ops,