Lines Matching full:client

3  *  ALSA sequencer Client Manager
28 /* Client Manager
35 * There are four ranges of client numbers (last two shared):
37 * 16..127: statically allocated client numbers for cards 0..27
38 * 128..191: dynamically allocated client numbers for cards 28..31
39 * 128..191: dynamically allocated client numbers for applications
46 /* dynamically allocated client numbers (both kernel drivers and user space) */
57 * client table
66 static int bounce_error_event(struct snd_seq_client *client,
69 static int snd_seq_deliver_single_event(struct snd_seq_client *client,
87 static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client) in snd_seq_write_pool_allocated() argument
89 return snd_seq_total_cells(client->pool) > 0; in snd_seq_write_pool_allocated()
92 /* return pointer to client structure for specified id */
96 pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n", in clientptr()
106 struct snd_seq_client *client; in snd_seq_client_use_ptr() local
109 pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n", in snd_seq_client_use_ptr()
114 client = clientptr(clientid); in snd_seq_client_use_ptr()
115 if (client) in snd_seq_client_use_ptr()
135 request_module("snd-seq-client-%i", in snd_seq_client_use_ptr()
153 client = clientptr(clientid); in snd_seq_client_use_ptr()
154 if (client) in snd_seq_client_use_ptr()
162 snd_use_lock_use(&client->use_lock); in snd_seq_client_use_ptr()
164 return client; in snd_seq_client_use_ptr()
167 /* Take refcount and perform ioctl_mutex lock on the given client;
173 struct snd_seq_client *client; in snd_seq_client_ioctl_lock() local
175 client = snd_seq_client_use_ptr(clientid); in snd_seq_client_ioctl_lock()
176 if (!client) in snd_seq_client_ioctl_lock()
178 mutex_lock(&client->ioctl_mutex); in snd_seq_client_ioctl_lock()
179 /* The client isn't unrefed here; see snd_seq_client_ioctl_unlock() */ in snd_seq_client_ioctl_lock()
184 /* Unlock and unref the given client; for OSS sequencer use only */
187 struct snd_seq_client *client; in snd_seq_client_ioctl_unlock() local
189 client = snd_seq_client_use_ptr(clientid); in snd_seq_client_ioctl_unlock()
190 if (WARN_ON(!client)) in snd_seq_client_ioctl_unlock()
192 mutex_unlock(&client->ioctl_mutex); in snd_seq_client_ioctl_unlock()
197 snd_seq_client_unlock(client); in snd_seq_client_ioctl_unlock()
198 snd_seq_client_unlock(client); in snd_seq_client_ioctl_unlock()
217 /* zap out the client table */ in client_init_data()
227 struct snd_seq_client *client; in seq_create_client1() local
229 /* init client data */ in seq_create_client1()
230 client = kzalloc(sizeof(*client), GFP_KERNEL); in seq_create_client1()
231 if (client == NULL) in seq_create_client1()
233 client->pool = snd_seq_pool_new(poolsize); in seq_create_client1()
234 if (client->pool == NULL) { in seq_create_client1()
235 kfree(client); in seq_create_client1()
238 client->type = NO_CLIENT; in seq_create_client1()
239 snd_use_lock_init(&client->use_lock); in seq_create_client1()
240 rwlock_init(&client->ports_lock); in seq_create_client1()
241 mutex_init(&client->ports_mutex); in seq_create_client1()
242 INIT_LIST_HEAD(&client->ports_list_head); in seq_create_client1()
243 mutex_init(&client->ioctl_mutex); in seq_create_client1()
245 /* find free slot in the client table */ in seq_create_client1()
253 clienttab[client->number = c] = client; in seq_create_client1()
255 return client; in seq_create_client1()
259 clienttab[client->number = client_index] = client; in seq_create_client1()
261 return client; in seq_create_client1()
265 snd_seq_pool_delete(&client->pool); in seq_create_client1()
266 kfree(client); in seq_create_client1()
271 static int seq_free_client1(struct snd_seq_client *client) in seq_free_client1() argument
273 if (!client) in seq_free_client1()
276 clienttablock[client->number] = 1; in seq_free_client1()
277 clienttab[client->number] = NULL; in seq_free_client1()
279 snd_seq_delete_all_ports(client); in seq_free_client1()
280 snd_seq_queue_client_leave(client->number); in seq_free_client1()
281 snd_use_lock_sync(&client->use_lock); in seq_free_client1()
282 if (client->pool) in seq_free_client1()
283 snd_seq_pool_delete(&client->pool); in seq_free_client1()
285 clienttablock[client->number] = 0; in seq_free_client1()
291 static void seq_free_client(struct snd_seq_client * client) in seq_free_client() argument
294 switch (client->type) { in seq_free_client()
296 pr_warn("ALSA: seq: Trying to free unused client %d\n", in seq_free_client()
297 client->number); in seq_free_client()
301 seq_free_client1(client); in seq_free_client()
306 pr_err("ALSA: seq: Trying to free client %d with undefined type = %d\n", in seq_free_client()
307 client->number, client->type); in seq_free_client()
311 snd_seq_system_client_ev_client_exit(client->number); in seq_free_client()
318 /* create a user client */
321 int c, mode; /* client id */ in snd_seq_open()
322 struct snd_seq_client *client; in snd_seq_open() local
331 client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); in snd_seq_open()
332 if (!client) { in snd_seq_open()
339 client->accept_input = 1; in snd_seq_open()
341 client->accept_output = 1; in snd_seq_open()
343 user = &client->data.user; in snd_seq_open()
351 seq_free_client1(client); in snd_seq_open()
352 kfree(client); in snd_seq_open()
359 client->type = USER_CLIENT; in snd_seq_open()
362 c = client->number; in snd_seq_open()
363 file->private_data = client; in snd_seq_open()
365 /* fill client data */ in snd_seq_open()
367 sprintf(client->name, "Client-%d", c); in snd_seq_open()
368 client->data.user.owner = get_pid(task_pid(current)); in snd_seq_open()
370 /* make others aware this new client */ in snd_seq_open()
376 /* delete a user client */
379 struct snd_seq_client *client = file->private_data; in snd_seq_release() local
381 if (client) { in snd_seq_release()
382 seq_free_client(client); in snd_seq_release()
383 if (client->data.user.fifo) in snd_seq_release()
384 snd_seq_fifo_delete(&client->data.user.fifo); in snd_seq_release()
385 put_pid(client->data.user.owner); in snd_seq_release()
386 kfree(client); in snd_seq_release()
393 /* handle client read() */
395 * -ENXIO invalid client or file open mode
403 struct snd_seq_client *client = file->private_data; in snd_seq_read() local
415 /* check client structures are in place */ in snd_seq_read()
416 if (snd_BUG_ON(!client)) in snd_seq_read()
419 if (!client->accept_input) in snd_seq_read()
421 fifo = client->data.user.fifo; in snd_seq_read()
498 * check if the destination client is available, and return the pointer
499 * if filter is non-zero, client filter bitmap is tested.
506 dest = snd_seq_client_use_ptr(event->dest.client); in get_event_dest_client()
527 * If the receiver client is a user client, the original event is
531 * If the receiver client is a kernel client, the original event is
535 static int bounce_error_event(struct snd_seq_client *client, in bounce_error_event() argument
542 if (client == NULL || in bounce_error_event()
543 ! (client->filter & SNDRV_SEQ_FILTER_BOUNCE) || in bounce_error_event()
544 ! client->accept_input) in bounce_error_event()
552 bounce_ev.source.client = SNDRV_SEQ_CLIENT_SYSTEM; in bounce_error_event()
554 bounce_ev.dest.client = client->number; in bounce_error_event()
561 client->event_lost++; in bounce_error_event()
598 * if filter is non-zero, client filter bitmap is tested.
603 static int snd_seq_deliver_single_event(struct snd_seq_client *client, in snd_seq_deliver_single_event() argument
655 result = bounce_error_event(client, event, result, atomic, hop); in snd_seq_deliver_single_event()
664 static int deliver_to_subscribers(struct snd_seq_client *client, in deliver_to_subscribers() argument
674 src_port = snd_seq_port_use_ptr(client, event->source.port); in deliver_to_subscribers()
695 err = snd_seq_deliver_single_event(client, event, in deliver_to_subscribers()
721 static int port_broadcast_event(struct snd_seq_client *client, in port_broadcast_event() argument
736 /* pass NULL as source client to avoid error bounce */ in port_broadcast_event()
758 static int broadcast_event(struct snd_seq_client *client, in broadcast_event() argument
769 if (dest == client->number) in broadcast_event()
771 event->dest.client = dest; in broadcast_event()
774 err = port_broadcast_event(client, event, atomic, hop); in broadcast_event()
776 /* pass NULL as source client to avoid error bounce */ in broadcast_event()
794 static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event, in multicast_event() argument
808 * n == 0 : the event was not passed to any client.
811 static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event, in snd_seq_deliver_event() argument
819 event->source.client, event->source.port, in snd_seq_deliver_event()
820 event->dest.client, event->dest.port); in snd_seq_deliver_event()
829 event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) in snd_seq_deliver_event()
830 result = deliver_to_subscribers(client, event, atomic, hop); in snd_seq_deliver_event()
833 event->dest.client == SNDRV_SEQ_ADDRESS_BROADCAST) in snd_seq_deliver_event()
834 result = broadcast_event(client, event, atomic, hop); in snd_seq_deliver_event()
835 else if (event->dest.client >= SNDRV_SEQ_MAX_CLIENTS) in snd_seq_deliver_event()
836 result = multicast_event(client, event, atomic, hop); in snd_seq_deliver_event()
838 result = port_broadcast_event(client, event, atomic, hop); in snd_seq_deliver_event()
841 result = snd_seq_deliver_single_event(client, event, 0, atomic, hop); in snd_seq_deliver_event()
853 * n == 0 : the event was not passed to any client.
858 struct snd_seq_client *client; in snd_seq_dispatch_event() local
864 client = snd_seq_client_use_ptr(cell->event.source.client); in snd_seq_dispatch_event()
865 if (client == NULL) { in snd_seq_dispatch_event()
880 result = snd_seq_deliver_event(client, &tmpev, atomic, hop); in snd_seq_dispatch_event()
915 result = snd_seq_deliver_event(client, &cell->event, atomic, hop); in snd_seq_dispatch_event()
919 snd_seq_client_unlock(client); in snd_seq_dispatch_event()
924 /* Allocate a cell from client pool and enqueue it to queue:
928 static int snd_seq_client_enqueue_event(struct snd_seq_client *client, in snd_seq_client_enqueue_event() argument
939 event->dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS; in snd_seq_client_enqueue_event()
944 event->dest.client = SNDRV_SEQ_ADDRESS_BROADCAST; in snd_seq_client_enqueue_event()
948 if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { in snd_seq_client_enqueue_event()
950 struct snd_seq_client_port *src_port = snd_seq_port_use_ptr(client, event->source.port); in snd_seq_client_enqueue_event()
960 return snd_seq_deliver_event(client, event, atomic, hop); in snd_seq_client_enqueue_event()
964 if (snd_seq_queue_is_used(event->queue, client->number) <= 0) in snd_seq_client_enqueue_event()
966 if (! snd_seq_write_pool_allocated(client)) in snd_seq_client_enqueue_event()
970 err = snd_seq_event_dup(client->pool, event, &cell, !blocking || atomic, in snd_seq_client_enqueue_event()
1013 * -ENXIO invalid client or file open mode
1025 struct snd_seq_client *client = file->private_data; in snd_seq_write() local
1033 /* check client structures are in place */ in snd_seq_write()
1034 if (snd_BUG_ON(!client)) in snd_seq_write()
1037 if (!client->accept_output || client->pool == NULL) in snd_seq_write()
1043 mutex_lock(&client->ioctl_mutex); in snd_seq_write()
1044 if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) { in snd_seq_write()
1045 err = snd_seq_pool_init(client->pool); in snd_seq_write()
1059 event.source.client = client->number; /* fill in client number */ in snd_seq_write()
1088 if (client->convert32 && snd_seq_ev_is_varusr(&event)) { in snd_seq_write()
1096 err = snd_seq_client_enqueue_event(client, &event, file, in snd_seq_write()
1098 0, 0, &client->ioctl_mutex); in snd_seq_write()
1111 mutex_unlock(&client->ioctl_mutex); in snd_seq_write()
1117 mutex_unlock(&client->ioctl_mutex); in snd_seq_write()
1127 struct snd_seq_client *client = file->private_data; in snd_seq_poll() local
1130 /* check client structures are in place */ in snd_seq_poll()
1131 if (snd_BUG_ON(!client)) in snd_seq_poll()
1135 client->data.user.fifo) { in snd_seq_poll()
1138 if (snd_seq_fifo_poll_wait(client->data.user.fifo, file, wait)) in snd_seq_poll()
1145 if (!snd_seq_write_pool_allocated(client) || in snd_seq_poll()
1146 snd_seq_pool_poll_wait(client->pool, file, wait)) in snd_seq_poll()
1156 static int snd_seq_ioctl_pversion(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_pversion() argument
1164 static int snd_seq_ioctl_client_id(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_client_id() argument
1168 *client_id = client->number; in snd_seq_ioctl_client_id()
1173 static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_system_info() argument
1191 static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_running_mode() argument
1197 /* requested client number */ in snd_seq_ioctl_running_mode()
1198 cptr = snd_seq_client_use_ptr(info->client); in snd_seq_ioctl_running_mode()
1228 info->client = cptr->number; in get_client_info()
1251 static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client, in snd_seq_ioctl_get_client_info() argument
1257 /* requested client number */ in snd_seq_ioctl_get_client_info()
1258 cptr = snd_seq_client_use_ptr(client_info->client); in snd_seq_ioctl_get_client_info()
1270 static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client, in snd_seq_ioctl_set_client_info() argument
1275 /* it is not allowed to set the info fields for an another client */ in snd_seq_ioctl_set_client_info()
1276 if (client->number != client_info->client) in snd_seq_ioctl_set_client_info()
1278 /* also client type must be set now */ in snd_seq_ioctl_set_client_info()
1279 if (client->type != client_info->type) in snd_seq_ioctl_set_client_info()
1284 strscpy(client->name, client_info->name, sizeof(client->name)); in snd_seq_ioctl_set_client_info()
1286 client->filter = client_info->filter; in snd_seq_ioctl_set_client_info()
1287 client->event_lost = client_info->event_lost; in snd_seq_ioctl_set_client_info()
1288 memcpy(client->event_filter, client_info->event_filter, 32); in snd_seq_ioctl_set_client_info()
1297 static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_create_port() argument
1304 /* it is not allowed to create the port for an another client */ in snd_seq_ioctl_create_port()
1305 if (info->addr.client != client->number) in snd_seq_ioctl_create_port()
1308 …port = snd_seq_create_port(client, (info->flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) ? info->addr.port… in snd_seq_ioctl_create_port()
1312 if (client->type == USER_CLIENT && info->kernel) { in snd_seq_ioctl_create_port()
1315 snd_seq_delete_port(client, port_idx); in snd_seq_ioctl_create_port()
1318 if (client->type == KERNEL_CLIENT) { in snd_seq_ioctl_create_port()
1336 snd_seq_system_client_ev_port_start(port->addr.client, port->addr.port); in snd_seq_ioctl_create_port()
1345 static int snd_seq_ioctl_delete_port(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_delete_port() argument
1350 /* it is not allowed to remove the port for an another client */ in snd_seq_ioctl_delete_port()
1351 if (info->addr.client != client->number) in snd_seq_ioctl_delete_port()
1354 err = snd_seq_delete_port(client, info->addr.port); in snd_seq_ioctl_delete_port()
1356 snd_seq_system_client_ev_port_exit(client->number, info->addr.port); in snd_seq_ioctl_delete_port()
1362 * GET_PORT_INFO ioctl() (on any client)
1364 static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_get_port_info() argument
1370 cptr = snd_seq_client_use_ptr(info->addr.client); in snd_seq_ioctl_get_port_info()
1390 * SET_PORT_INFO ioctl() (only ports on this/own client)
1392 static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_set_port_info() argument
1397 if (info->addr.client != client->number) /* only set our own ports ! */ in snd_seq_ioctl_set_port_info()
1399 port = snd_seq_port_use_ptr(client, info->addr.port); in snd_seq_ioctl_set_port_info()
1414 static int check_subscription_permission(struct snd_seq_client *client, in check_subscription_permission() argument
1419 if (client->number != subs->sender.client && in check_subscription_permission()
1420 client->number != subs->dest.client) { in check_subscription_permission()
1421 /* connection by third client - check export permission */ in check_subscription_permission()
1429 /* if sender or receiver is the subscribing client itself, in check_subscription_permission()
1432 if (client->number != subs->sender.client) { in check_subscription_permission()
1437 if (client->number != subs->dest.client) { in check_subscription_permission()
1445 * send an subscription notify event to user client:
1446 * client must be user client.
1448 int snd_seq_client_notify_subscription(int client, int port, in snd_seq_client_notify_subscription() argument
1459 return snd_seq_system_notify(client, port, &event); /* non-atomic */ in snd_seq_client_notify_subscription()
1466 static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client, in snd_seq_ioctl_subscribe_port() argument
1474 receiver = snd_seq_client_use_ptr(subs->dest.client); in snd_seq_ioctl_subscribe_port()
1477 sender = snd_seq_client_use_ptr(subs->sender.client); in snd_seq_ioctl_subscribe_port()
1487 result = check_subscription_permission(client, sport, dport, subs); in snd_seq_ioctl_subscribe_port()
1492 result = snd_seq_port_connect(client, sender, sport, receiver, dport, subs); in snd_seq_ioctl_subscribe_port()
1512 static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, in snd_seq_ioctl_unsubscribe_port() argument
1520 receiver = snd_seq_client_use_ptr(subs->dest.client); in snd_seq_ioctl_unsubscribe_port()
1523 sender = snd_seq_client_use_ptr(subs->sender.client); in snd_seq_ioctl_unsubscribe_port()
1533 result = check_subscription_permission(client, sport, dport, subs); in snd_seq_ioctl_unsubscribe_port()
1537 result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, subs); in snd_seq_ioctl_unsubscribe_port()
1555 static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_create_queue() argument
1560 q = snd_seq_queue_alloc(client->number, info->locked, info->flags); in snd_seq_ioctl_create_queue()
1578 static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_delete_queue() argument
1582 return snd_seq_queue_delete(client->number, info->queue); in snd_seq_ioctl_delete_queue()
1586 static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_info() argument
1607 static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_info() argument
1613 if (info->owner != client->number) in snd_seq_ioctl_set_queue_info()
1617 if (snd_seq_queue_check_access(info->queue, client->number)) { in snd_seq_ioctl_set_queue_info()
1618 if (snd_seq_queue_set_owner(info->queue, client->number, info->locked) < 0) in snd_seq_ioctl_set_queue_info()
1621 snd_seq_queue_use(info->queue, client->number, 1); in snd_seq_ioctl_set_queue_info()
1629 if (q->owner != client->number) { in snd_seq_ioctl_set_queue_info()
1640 static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, in snd_seq_ioctl_get_named_queue() argument
1658 static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_status() argument
1687 static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_tempo() argument
1713 int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo) in snd_seq_set_queue_tempo() argument
1715 if (!snd_seq_queue_check_access(tempo->queue, client)) in snd_seq_set_queue_tempo()
1717 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); in snd_seq_set_queue_tempo()
1721 static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_tempo() argument
1727 result = snd_seq_set_queue_tempo(client->number, tempo); in snd_seq_ioctl_set_queue_tempo()
1733 static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_timer() argument
1762 static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_timer() argument
1771 if (snd_seq_queue_check_access(timer->queue, client->number)) { in snd_seq_ioctl_set_queue_timer()
1798 static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client, in snd_seq_ioctl_get_queue_client() argument
1804 used = snd_seq_queue_is_used(info->queue, client->number); in snd_seq_ioctl_get_queue_client()
1808 info->client = client->number; in snd_seq_ioctl_get_queue_client()
1815 static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client, in snd_seq_ioctl_set_queue_client() argument
1822 err = snd_seq_queue_use(info->queue, client->number, info->used); in snd_seq_ioctl_set_queue_client()
1827 return snd_seq_ioctl_get_queue_client(client, arg); in snd_seq_ioctl_set_queue_client()
1832 static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client, in snd_seq_ioctl_get_client_pool() argument
1838 cptr = snd_seq_client_use_ptr(info->client); in snd_seq_ioctl_get_client_pool()
1842 info->client = cptr->number; in snd_seq_ioctl_get_client_pool()
1861 static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client, in snd_seq_ioctl_set_client_pool() argument
1867 if (client->number != info->client) in snd_seq_ioctl_set_client_pool()
1871 (! snd_seq_write_pool_allocated(client) || in snd_seq_ioctl_set_client_pool()
1872 info->output_pool != client->pool->size)) { in snd_seq_ioctl_set_client_pool()
1873 if (snd_seq_write_pool_allocated(client)) { in snd_seq_ioctl_set_client_pool()
1875 if (atomic_read(&client->pool->counter)) in snd_seq_ioctl_set_client_pool()
1878 snd_seq_pool_mark_closing(client->pool); in snd_seq_ioctl_set_client_pool()
1879 snd_seq_pool_done(client->pool); in snd_seq_ioctl_set_client_pool()
1881 client->pool->size = info->output_pool; in snd_seq_ioctl_set_client_pool()
1882 rc = snd_seq_pool_init(client->pool); in snd_seq_ioctl_set_client_pool()
1886 if (client->type == USER_CLIENT && client->data.user.fifo != NULL && in snd_seq_ioctl_set_client_pool()
1889 info->input_pool != client->data.user.fifo_pool_size) { in snd_seq_ioctl_set_client_pool()
1891 rc = snd_seq_fifo_resize(client->data.user.fifo, info->input_pool); in snd_seq_ioctl_set_client_pool()
1894 client->data.user.fifo_pool_size = info->input_pool; in snd_seq_ioctl_set_client_pool()
1897 info->output_room <= client->pool->size) { in snd_seq_ioctl_set_client_pool()
1898 client->pool->room = info->output_room; in snd_seq_ioctl_set_client_pool()
1901 return snd_seq_ioctl_get_client_pool(client, arg); in snd_seq_ioctl_set_client_pool()
1906 static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, in snd_seq_ioctl_remove_events() argument
1916 * No restrictions so for a user client we can clear in snd_seq_ioctl_remove_events()
1919 if (client->type == USER_CLIENT && client->data.user.fifo) in snd_seq_ioctl_remove_events()
1920 snd_seq_fifo_clear(client->data.user.fifo); in snd_seq_ioctl_remove_events()
1924 snd_seq_queue_remove_cells(client->number, info); in snd_seq_ioctl_remove_events()
1933 static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, in snd_seq_ioctl_get_subscription() argument
1942 sender = snd_seq_client_use_ptr(subs->sender.client); in snd_seq_ioctl_get_subscription()
1963 static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg) in snd_seq_ioctl_query_subs() argument
1973 cptr = snd_seq_client_use_ptr(subs->root.client); in snd_seq_ioctl_query_subs()
2026 * query next client
2028 static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client, in snd_seq_ioctl_query_next_client() argument
2034 /* search for next client */ in snd_seq_ioctl_query_next_client()
2035 if (info->client < INT_MAX) in snd_seq_ioctl_query_next_client()
2036 info->client++; in snd_seq_ioctl_query_next_client()
2037 if (info->client < 0) in snd_seq_ioctl_query_next_client()
2038 info->client = 0; in snd_seq_ioctl_query_next_client()
2039 for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) { in snd_seq_ioctl_query_next_client()
2040 cptr = snd_seq_client_use_ptr(info->client); in snd_seq_ioctl_query_next_client()
2056 static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client, in snd_seq_ioctl_query_next_port() argument
2063 cptr = snd_seq_client_use_ptr(info->addr.client); in snd_seq_ioctl_query_next_port()
2088 int (*func)(struct snd_seq_client *client, void *arg);
2127 struct snd_seq_client *client = file->private_data; in snd_seq_ioctl() local
2150 if (snd_BUG_ON(!client)) in snd_seq_ioctl()
2172 mutex_lock(&client->ioctl_mutex); in snd_seq_ioctl()
2173 err = handler->func(client, &buf); in snd_seq_ioctl()
2174 mutex_unlock(&client->ioctl_mutex); in snd_seq_ioctl()
2200 struct snd_seq_client *client; in snd_seq_create_kernel_client() local
2221 client = seq_create_client1(client_index, 0); in snd_seq_create_kernel_client()
2222 if (client == NULL) { in snd_seq_create_kernel_client()
2228 client->accept_input = 1; in snd_seq_create_kernel_client()
2229 client->accept_output = 1; in snd_seq_create_kernel_client()
2230 client->data.kernel.card = card; in snd_seq_create_kernel_client()
2233 vsnprintf(client->name, sizeof(client->name), name_fmt, args); in snd_seq_create_kernel_client()
2236 client->type = KERNEL_CLIENT; in snd_seq_create_kernel_client()
2239 /* make others aware this new client */ in snd_seq_create_kernel_client()
2240 snd_seq_system_client_ev_client_start(client->number); in snd_seq_create_kernel_client()
2242 /* return client number to caller */ in snd_seq_create_kernel_client()
2243 return client->number; in snd_seq_create_kernel_client()
2248 int snd_seq_delete_kernel_client(int client) in snd_seq_delete_kernel_client() argument
2255 ptr = clientptr(client); in snd_seq_delete_kernel_client()
2270 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, in snd_seq_kernel_client_enqueue() argument
2284 /* fill in client number */ in snd_seq_kernel_client_enqueue()
2285 ev->source.client = client; in snd_seq_kernel_client_enqueue()
2290 cptr = snd_seq_client_use_ptr(client); in snd_seq_kernel_client_enqueue()
2316 int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev, in snd_seq_kernel_client_dispatch() argument
2325 /* fill in client number */ in snd_seq_kernel_client_dispatch()
2327 ev->source.client = client; in snd_seq_kernel_client_dispatch()
2332 cptr = snd_seq_client_use_ptr(client); in snd_seq_kernel_client_dispatch()
2347 * snd_seq_kernel_client_ctl - operate a command for a client with data in
2349 * @clientid: A numerical ID for a client.
2353 * Against its name, both kernel/application client can be handled by this
2361 struct snd_seq_client *client; in snd_seq_kernel_client_ctl() local
2363 client = clientptr(clientid); in snd_seq_kernel_client_ctl()
2364 if (client == NULL) in snd_seq_kernel_client_ctl()
2369 return handler->func(client, arg); in snd_seq_kernel_client_ctl()
2381 struct snd_seq_client *client; in snd_seq_kernel_client_write_poll() local
2383 client = clientptr(clientid); in snd_seq_kernel_client_write_poll()
2384 if (client == NULL) in snd_seq_kernel_client_write_poll()
2387 if (! snd_seq_write_pool_allocated(client)) in snd_seq_kernel_client_write_poll()
2389 if (snd_seq_pool_poll_wait(client->pool, file, wait)) in snd_seq_kernel_client_write_poll()
2423 is_src ? s->info.dest.client : s->info.sender.client, in snd_seq_info_dump_subscribers()
2441 struct snd_seq_client *client) in snd_seq_info_dump_ports() argument
2445 mutex_lock(&client->ports_mutex); in snd_seq_info_dump_ports()
2446 list_for_each_entry(p, &client->ports_list_head, list) { in snd_seq_info_dump_ports()
2456 mutex_unlock(&client->ports_mutex); in snd_seq_info_dump_ports()
2465 struct snd_seq_client *client; in snd_seq_info_clients_read() local
2467 snd_iprintf(buffer, "Client info\n"); in snd_seq_info_clients_read()
2473 /* list the client table */ in snd_seq_info_clients_read()
2475 client = snd_seq_client_use_ptr(c); in snd_seq_info_clients_read()
2476 if (client == NULL) in snd_seq_info_clients_read()
2478 if (client->type == NO_CLIENT) { in snd_seq_info_clients_read()
2479 snd_seq_client_unlock(client); in snd_seq_info_clients_read()
2483 snd_iprintf(buffer, "Client %3d : \"%s\" [%s]\n", in snd_seq_info_clients_read()
2484 c, client->name, in snd_seq_info_clients_read()
2485 client->type == USER_CLIENT ? "User" : "Kernel"); in snd_seq_info_clients_read()
2486 snd_seq_info_dump_ports(buffer, client); in snd_seq_info_clients_read()
2487 if (snd_seq_write_pool_allocated(client)) { in snd_seq_info_clients_read()
2489 snd_seq_info_pool(buffer, client->pool, " "); in snd_seq_info_clients_read()
2491 if (client->type == USER_CLIENT && client->data.user.fifo && in snd_seq_info_clients_read()
2492 client->data.user.fifo->pool) { in snd_seq_info_clients_read()
2494 snd_seq_info_pool(buffer, client->data.user.fifo->pool, " "); in snd_seq_info_clients_read()
2496 snd_seq_client_unlock(client); in snd_seq_info_clients_read()