summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jackd/clientengine.c37
-rw-r--r--jackd/engine.c28
-rw-r--r--libjack/client.c31
-rw-r--r--libjack/intclient.c10
-rw-r--r--libjack/metadata.c14
-rw-r--r--libjack/port.c12
-rw-r--r--libjack/transclient.c6
-rw-r--r--libjack/uuid.c77
-rw-r--r--man/jack_lsp.04
9 files changed, 124 insertions, 95 deletions
diff --git a/jackd/clientengine.c b/jackd/clientengine.c
index 157de5d..59a0829 100644
--- a/jackd/clientengine.c
+++ b/jackd/clientengine.c
@@ -176,8 +176,9 @@ void
jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client)
{
JSList *node;
- jack_uuid_t finalizer;
- jack_uuid_clear (finalizer);
+ jack_uuid_t finalizer = JACK_UUID_EMPTY_INITIALIZER;
+
+ jack_uuid_clear (&finalizer);
/* caller must write-hold the client lock */
@@ -439,7 +440,7 @@ jack_client_id_by_name (jack_engine_t *engine, const char *name, jack_uuid_t id)
JSList *node;
int ret = -1;
- jack_uuid_clear (id);
+ jack_uuid_clear (&id);
jack_rdlock_graph (engine);
@@ -449,7 +450,7 @@ jack_client_id_by_name (jack_engine_t *engine, const char *name, jack_uuid_t id)
name) == 0) {
jack_client_internal_t *client =
(jack_client_internal_t *) node->data;
- jack_uuid_copy (id, client->control->uuid);
+ jack_uuid_copy (&id, client->control->uuid);
ret = 0;
break;
}
@@ -615,9 +616,9 @@ jack_setup_client_control (jack_engine_t *engine, int fd, ClientType type, const
client->control->timed_out = 0;
if (jack_uuid_empty (uuid)) {
- jack_uuid_generate (client->control->uuid);
+ client->control->uuid = jack_client_uuid_generate ();
} else {
- jack_uuid_copy (client->control->uuid, uuid);
+ jack_uuid_copy (&client->control->uuid, uuid);
}
strcpy ((char *) client->control->name, name);
@@ -676,7 +677,6 @@ static void
jack_ensure_uuid_unique (jack_engine_t *engine, jack_uuid_t uuid)
{
JSList *node;
- jack_uuid_t jj;
if (jack_uuid_empty (uuid)) {
return;
@@ -686,7 +686,7 @@ jack_ensure_uuid_unique (jack_engine_t *engine, jack_uuid_t uuid)
for (node=engine->clients; node; node=jack_slist_next (node)) {
jack_client_internal_t *client = (jack_client_internal_t *) node->data;
if (jack_uuid_compare (client->control->uuid, uuid) == 0) {
- jack_uuid_clear (uuid);
+ jack_uuid_clear (&uuid);
}
}
jack_unlock_graph (engine);
@@ -803,13 +803,13 @@ jack_create_driver_client (jack_engine_t *engine, char *name)
jack_client_connect_request_t req;
jack_status_t status;
jack_client_internal_t *client;
- jack_uuid_t empty_uuid;
+ jack_uuid_t empty_uuid = JACK_UUID_EMPTY_INITIALIZER;
VALGRIND_MEMSET(&empty_uuid, 0, sizeof(empty_uuid));
snprintf (req.name, sizeof (req.name), "%s", name);
- jack_uuid_clear (empty_uuid);
+ jack_uuid_clear (&empty_uuid);
pthread_mutex_lock (&engine->request_lock);
client = setup_client (engine, ClientDriver, name, empty_uuid, JackUseExactName,
@@ -898,7 +898,7 @@ jack_client_create (jack_engine_t *engine, int client_fd)
if (!req.load) { /* internal client close? */
int rc = -1;
- jack_uuid_t id;
+ jack_uuid_t id = JACK_UUID_EMPTY_INITIALIZER;
if (jack_client_id_by_name(engine, req.name, id) == 0) {
rc = handle_unload_client (engine, id);
@@ -1093,8 +1093,8 @@ jack_mark_client_socket_error (jack_engine_t *engine, int fd)
void
jack_client_delete (jack_engine_t *engine, jack_client_internal_t *client)
{
- jack_uuid_t uuid;
- jack_uuid_copy (uuid, client->control->uuid);
+ jack_uuid_t uuid = JACK_UUID_EMPTY_INITIALIZER;
+ jack_uuid_copy (&uuid, client->control->uuid);
jack_client_registration_notify (engine, (const char*) client->control->name, 0);
@@ -1131,7 +1131,7 @@ jack_intclient_handle_request (jack_engine_t *engine, jack_request_t *req)
req->status = 0;
if ((client = jack_client_by_name (engine, req->x.intclient.name))) {
- jack_uuid_copy (req->x.intclient.uuid, client->control->uuid);
+ jack_uuid_copy (&req->x.intclient.uuid, client->control->uuid);
} else {
req->status |= (JackNoSuchClient|JackFailure);
}
@@ -1143,15 +1143,14 @@ jack_intclient_load_request (jack_engine_t *engine, jack_request_t *req)
/* called with the request_lock */
jack_client_internal_t *client;
jack_status_t status = 0;
- jack_uuid_t empty_uuid;
+ jack_uuid_t empty_uuid = JACK_UUID_EMPTY_INITIALIZER;
VERBOSE (engine, "load internal client %s from %s, init `%s', "
"options: 0x%x", req->x.intclient.name,
req->x.intclient.path, req->x.intclient.init,
req->x.intclient.options);
- VALGRIND_MEMSET (&empty_uuid, 0, sizeof (empty_uuid));
- jack_uuid_clear (empty_uuid);
+ jack_uuid_clear (&empty_uuid);
client = setup_client (engine, ClientInternal, req->x.intclient.name, empty_uuid,
req->x.intclient.options|JackUseExactName, &status, -1,
@@ -1159,10 +1158,10 @@ jack_intclient_load_request (jack_engine_t *engine, jack_request_t *req)
if (client == NULL) {
status |= JackFailure; /* just making sure */
- jack_uuid_clear (req->x.intclient.uuid);
+ jack_uuid_clear (&req->x.intclient.uuid);
VERBOSE (engine, "load failed, status = 0x%x", status);
} else {
- jack_uuid_copy (req->x.intclient.uuid, client->control->uuid);
+ jack_uuid_copy (&req->x.intclient.uuid, client->control->uuid);
}
req->status = status;
diff --git a/jackd/engine.c b/jackd/engine.c
index 3818b17..e35e245 100644
--- a/jackd/engine.c
+++ b/jackd/engine.c
@@ -1806,7 +1806,7 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock,
engine->temporary = temporary;
engine->freewheeling = 0;
engine->stop_freewheeling = 0;
- jack_uuid_clear (engine->fwclient);
+ jack_uuid_clear (&engine->fwclient);
engine->feedbackcount = 0;
engine->wait_pid = wait_pid;
engine->nozombies = nozombies;
@@ -2226,7 +2226,7 @@ jack_start_freewheeling (jack_engine_t* engine, jack_uuid_t client_id)
client = jack_client_internal_by_id (engine, client_id);
if (client->control->process_cbset || client->control->thread_cb_cbset) {
- jack_uuid_copy (engine->fwclient, client_id);
+ jack_uuid_copy (&engine->fwclient, client_id);
}
engine->freewheeling = 1;
@@ -2274,7 +2274,7 @@ jack_stop_freewheeling (jack_engine_t* engine, int engine_exiting)
pthread_join (engine->freewheel_thread, &ftstatus);
VERBOSE (engine, "freewheel thread has returned");
- jack_uuid_clear (engine->fwclient);
+ jack_uuid_clear (&engine->fwclient);
engine->freewheeling = 0;
engine->first_wakeup = 1;
@@ -2672,7 +2672,7 @@ static void jack_do_get_uuid_by_client_name (jack_engine_t *engine, jack_request
if (strcmp (req->x.name, "system") == 0) {
/* request concerns the driver */
if (engine->driver) {
- jack_uuid_copy (req->x.client_id, engine->driver->internal_client->control->uuid);
+ jack_uuid_copy (&req->x.client_id, engine->driver->internal_client->control->uuid);
req->status = 0;
}
return;
@@ -2681,7 +2681,7 @@ static void jack_do_get_uuid_by_client_name (jack_engine_t *engine, jack_request
for (node = engine->clients; node; node = jack_slist_next (node)) {
jack_client_internal_t* client = (jack_client_internal_t*) node->data;
if (strcmp (client->control->name, req->x.name) == 0) {
- jack_uuid_copy (req->x.client_id, client->control->uuid);
+ jack_uuid_copy (&req->x.client_id, client->control->uuid);
req->status = 0;
return;
}
@@ -2708,7 +2708,7 @@ static void jack_do_reserve_name (jack_engine_t *engine, jack_request_t *req)
}
snprintf (reservation->name, sizeof (reservation->name), "%s", req->x.reservename.name);
- jack_uuid_copy (reservation->uuid, req->x.reservename.uuid);
+ jack_uuid_copy (&reservation->uuid, req->x.reservename.uuid);
engine->reserved_client_names = jack_slist_append (engine->reserved_client_names, reservation);
req->status = 0;
@@ -2760,7 +2760,7 @@ jack_do_session_notify (jack_engine_t *engine, jack_request_t *req, int reply_fd
jack_uuid_t finalizer;
struct stat sbuf;
- jack_uuid_clear (finalizer);
+ jack_uuid_clear (&finalizer);
if (engine->session_reply_fd != -1) {
// we should have a notion of busy or somthing.
@@ -2855,11 +2855,11 @@ static void jack_do_session_reply (jack_engine_t *engine, jack_request_t *req )
{
jack_uuid_t client_id;
jack_client_internal_t *client;
- jack_uuid_t finalizer;
+ jack_uuid_t finalizer = JACK_UUID_EMPTY_INITIALIZER;
- jack_uuid_copy (client_id, req->x.client_id);
+ jack_uuid_copy (&client_id, req->x.client_id);
client = jack_client_internal_by_id (engine, client_id);
- jack_uuid_clear (finalizer);
+ jack_uuid_clear (&finalizer);
req->status = 0;
@@ -4445,8 +4445,8 @@ fallback:
next:
shared->ptype_id = engine->control->port_types[i].ptype_id;
- jack_uuid_copy (shared->client_id, req->x.port_info.client_id);
- jack_uuid_generate (shared->uuid);
+ jack_uuid_copy (&shared->client_id, req->x.port_info.client_id);
+ shared->uuid = jack_port_uuid_generate (port_id);
shared->flags = req->x.port_info.flags;
shared->latency = 0;
shared->capture_latency.min = shared->capture_latency.max = 0;
@@ -4505,7 +4505,7 @@ jack_port_do_unregister (jack_engine_t *engine, jack_request_t *req)
return -1;
}
- jack_uuid_copy (uuid, shared->uuid);
+ jack_uuid_copy (&uuid, shared->uuid);
jack_lock_graph (engine);
if ((client = jack_client_internal_by_id (engine, shared->client_id))
@@ -4702,7 +4702,7 @@ jack_property_change_notify (jack_engine_t *engine,
event.type = PropertyChange;
event.z.property_change = change;
- jack_uuid_copy (event.x.uuid, uuid);
+ jack_uuid_copy (&event.x.uuid, uuid);
if (key) {
event.y.key_size = strlen (key) + 1;
diff --git a/libjack/client.c b/libjack/client.c
index 21cb544..8bd9350 100644
--- a/libjack/client.c
+++ b/libjack/client.c
@@ -538,7 +538,7 @@ jack_client_handle_session_callback (jack_client_t *client, jack_event_t *event)
return -1;
}
- uuid_unparse (client->control->uuid, uuidstr);
+ jack_uuid_unparse (client->control->uuid, uuidstr);
s_event = malloc( sizeof(jack_session_event_t) );
s_event->type = event->y.n;
@@ -820,7 +820,7 @@ server_event_connect (jack_client_t *client, const char *server_name)
return -1;
}
- jack_uuid_copy (req.client_id, client->control->uuid);
+ jack_uuid_copy (&req.client_id, client->control->uuid);
if (write (fd, &req, sizeof (req)) != sizeof (req)) {
jack_error ("cannot write event connect request to server (%s)",
@@ -1048,12 +1048,12 @@ jack_request_client (ClientType type,
/* format connection request */
if (va->sess_uuid && strlen (va->sess_uuid)) {
- if (jack_uuid_parse (va->sess_uuid, req.uuid) != 0) {
+ if (jack_uuid_parse (va->sess_uuid, &req.uuid) != 0) {
jack_error ("Given UUID [%s] is not parseable", va->sess_uuid);
goto fail;
}
} else {
- jack_uuid_clear (req.uuid);
+ jack_uuid_clear (&req.uuid);
}
req.protocol_v = jack_protocol_version;
req.load = TRUE;
@@ -1490,7 +1490,7 @@ jack_set_freewheel (jack_client_t* client, int onoff)
VALGRIND_MEMSET (&request, 0, sizeof (request));
request.type = onoff ? FreeWheel : StopFreeWheel;
- jack_uuid_copy (request.x.client_id, client->control->uuid);
+ jack_uuid_copy (&request.x.client_id, client->control->uuid);
return jack_client_deliver_request (client, &request);
}
@@ -1516,7 +1516,7 @@ jack_session_reply (jack_client_t *client, jack_session_event_t *event )
VALGRIND_MEMSET (&request, 0, sizeof (request));
request.type = SessionReply;
- jack_uuid_copy (request.x.client_id, client->control->uuid);
+ jack_uuid_copy (&request.x.client_id, client->control->uuid);
retval = jack_client_deliver_request(client, &request);
}
@@ -1626,7 +1626,7 @@ jack_session_notify (jack_client_t* client, const char *target, jack_session_eve
" server (%s)", request.type, strerror (errno));
goto out;
}
- uuid_unparse (uid, (char *)retval[num_replies-1].uuid);
+ jack_uuid_unparse (uid, (char *)retval[num_replies-1].uuid);
}
free((char *)retval[num_replies-1].uuid);
retval[num_replies-1].uuid = NULL;
@@ -2386,7 +2386,7 @@ jack_activate (jack_client_t *client)
startit:
req.type = ActivateClient;
- jack_uuid_copy (req.x.client_id, client->control->uuid);
+ jack_uuid_copy (&req.x.client_id, client->control->uuid);
return jack_client_deliver_request (client, &req);
}
@@ -2402,7 +2402,7 @@ jack_deactivate_aux (jack_client_t *client)
if (client->control->active) { /* still active? */
VALGRIND_MEMSET (&req, 0, sizeof (req));
req.type = DeactivateClient;
- jack_uuid_copy (req.x.client_id, client->control->uuid);
+ jack_uuid_copy (&req.x.client_id, client->control->uuid);
rc = jack_client_deliver_request (client, &req);
}
}
@@ -2824,7 +2824,7 @@ jack_get_client_name_by_uuid (jack_client_t *client, const char *uuid_str)
VALGRIND_MEMSET (&request, 0, sizeof (request));
- if (uuid_parse (uuid_str, request.x.client_id) != 0) {
+ if (jack_uuid_parse (uuid_str, &request.x.client_id) != 0) {
return NULL;
}
@@ -2853,7 +2853,7 @@ jack_get_uuid_for_client_name (jack_client_t *client, const char *client_name)
}
char buf[37];
- uuid_unparse (request.x.client_id, buf);
+ jack_uuid_unparse (request.x.client_id, buf);
return strdup (buf);
}
@@ -2861,7 +2861,7 @@ char *
jack_client_get_uuid (jack_client_t *client)
{
char retval[37];
- uuid_unparse (client->control->uuid, retval);
+ jack_uuid_unparse (client->control->uuid, retval);
return strdup (retval);
}
@@ -2873,10 +2873,9 @@ jack_reserve_client_name (jack_client_t *client, const char *name, const char *u
VALGRIND_MEMSET (&request, 0, sizeof (request));
request.type = ReserveName;
- snprintf( request.x.reservename.name, sizeof( request.x.reservename.name ),
- "%s", name );
- if (uuid_parse (uuid_str, request.x.reservename.uuid) != 0) {
- return NULL;
+ snprintf( request.x.reservename.name, sizeof( request.x.reservename.name ), "%s", name );
+ if (jack_uuid_parse (uuid_str, &request.x.reservename.uuid) != 0) {
+ return -1;
}
return jack_client_deliver_request (client, &request);
diff --git a/libjack/intclient.c b/libjack/intclient.c
index 4503d61..9969482 100644
--- a/libjack/intclient.c
+++ b/libjack/intclient.c
@@ -85,7 +85,7 @@ jack_intclient_request(RequestType type, jack_client_t *client,
if (*status & JackFailure)
return -1;
- jack_uuid_copy (uuid, req.x.intclient.uuid);
+ jack_uuid_copy (&uuid, req.x.intclient.uuid);
return 0;
}
@@ -99,7 +99,7 @@ jack_get_internal_client_name (jack_client_t *client,
memset (&req, 0, sizeof (req));
req.type = IntClientName;
req.x.intclient.options = JackNullOption;
- jack_uuid_copy (req.x.intclient.uuid, intclient);
+ jack_uuid_copy (&req.x.intclient.uuid, intclient);
jack_client_deliver_request (client, &req);
@@ -137,7 +137,7 @@ jack_internal_client_handle (jack_client_t *client,
*status = jack_client_deliver_request (client, &req);
if (!jack_uuid_empty (req.x.intclient.uuid)) {
- jack_uuid_copy (handle, req.x.intclient.uuid);
+ jack_uuid_copy (&handle, req.x.intclient.uuid);
return 0;
}
@@ -179,7 +179,7 @@ jack_internal_client_load (jack_client_t *client,
jack_intclient_t handle, ...)
{
va_list ap;
- va_start(ap, status);
+ va_start(ap, handle);
int res = jack_internal_client_load_aux(client, client_name, options, status, handle, ap);
va_end(ap);
return res;
@@ -197,7 +197,7 @@ jack_internal_client_unload (jack_client_t *client,
memset (&req, 0, sizeof (req));
req.type = IntClientUnload;
req.x.intclient.options = JackNullOption;
- jack_uuid_copy (req.x.intclient.uuid, intclient);
+ jack_uuid_copy (&req.x.intclient.uuid, intclient);
jack_client_deliver_request (client, &req);
status = req.status;
diff --git a/libjack/metadata.c b/libjack/metadata.c
index 4615985..339f56c 100644
--- a/libjack/metadata.c
+++ b/libjack/metadata.c
@@ -125,7 +125,7 @@ jack_property_change_notify (jack_client_t* client, jack_uuid_t uuid, const char
req.type = PropertyChangeNotify;
req.x.property.change = change;
- jack_uuid_copy (req.x.property.uuid, uuid);
+ jack_uuid_copy (&req.x.property.uuid, uuid);
req.x.property.keylen = key ? strlen (key) + 1 : 0;
req.x.property.key = key;
return jack_client_deliver_request (client, &req);
@@ -138,6 +138,7 @@ make_key_dbt (DBT* dbt, jack_uuid_t subject, const char* key)
size_t len1, len2;
memset(dbt, 0, sizeof(DBT));
+ memset(ustr, 0, JACK_UUID_STRING_SIZE);
jack_uuid_unparse (subject, ustr);
len1 = JACK_UUID_STRING_SIZE;
len2 = strlen (key) + 1;
@@ -364,7 +365,7 @@ jack_get_properties (jack_uuid_t subject,
/* store UUID/subject */
- jack_uuid_copy (desc->subject, subject);
+ jack_uuid_copy (&desc->subject, subject);
/* copy key (without leading UUID as subject */
@@ -414,7 +415,7 @@ jack_get_all_properties (jack_description_t** descriptions)
size_t dsize = 0;
size_t n = 0;
jack_description_t* desc = NULL;
- jack_uuid_t uuid;
+ jack_uuid_t uuid = JACK_UUID_EMPTY_INITIALIZER;
jack_description_t* current_desc = NULL;
jack_property_t* current_prop = NULL;
size_t len1, len2;
@@ -449,7 +450,7 @@ jack_get_all_properties (jack_description_t** descriptions)
continue;
}
- if (jack_uuid_parse (key.data, uuid) != 0) {
+ if (jack_uuid_parse (key.data, &uuid) != 0) {
continue;
}
@@ -477,7 +478,7 @@ jack_get_all_properties (jack_description_t** descriptions)
/* set up UUID */
- jack_uuid_copy (desc[n].subject, uuid);
+ jack_uuid_copy (&desc[n].subject, uuid);
dcnt++;
}
@@ -657,7 +658,7 @@ int
jack_remove_all_properties (jack_client_t* client)
{
int ret;
- jack_uuid_t empty_uuid;
+ jack_uuid_t empty_uuid = JACK_UUID_EMPTY_INITIALIZER;
if (jack_property_init (NULL)) {
return -1;
@@ -668,7 +669,6 @@ jack_remove_all_properties (jack_client_t* client)
return -1;
}
- jack_uuid_clear (empty_uuid);
jack_property_change_notify (client, empty_uuid, NULL, PropertyDeleted);
return 0;
diff --git a/libjack/port.c b/libjack/port.c
index 2c74f06..bc60807 100644
--- a/libjack/port.c
+++ b/libjack/port.c
@@ -272,7 +272,7 @@ jack_port_register (jack_client_t *client,
"%s", port_type);
req.x.port_info.flags = flags;
req.x.port_info.buffer_size = buffer_size;
- jack_uuid_copy (req.x.port_info.client_id, client->control->uuid);
+ jack_uuid_copy (&req.x.port_info.client_id, client->control->uuid);
if (jack_client_deliver_request (client, &req)) {
jack_error ("cannot deliver port registration request");
@@ -300,7 +300,7 @@ jack_port_unregister (jack_client_t *client, jack_port_t *port)
req.type = UnRegisterPort;
req.x.port_info.port_id = port->shared->id;
- jack_uuid_copy (req.x.port_info.client_id, client->control->uuid);
+ jack_uuid_copy (&req.x.port_info.client_id, client->control->uuid);
return jack_client_deliver_request (client, &req);
}
@@ -403,7 +403,7 @@ jack_port_get_all_connections (const jack_client_t *client,
req.x.port_info.type[0] = '\0';
req.x.port_info.flags = 0;
req.x.port_info.buffer_size = 0;
- jack_uuid_clear (req.x.port_info.client_id);
+ jack_uuid_clear (&req.x.port_info.client_id);
req.x.port_info.port_id = port->shared->id;
jack_client_deliver_request (client, &req);
@@ -747,10 +747,10 @@ jack_port_name (const jack_port_t *port)
return port->shared->name;
}
-void
-jack_port_uuid (const jack_port_t *port, jack_uuid_t uuid)
+jack_uuid_t
+jack_port_uuid (const jack_port_t *port)
{
- return jack_uuid_copy (uuid, port->shared->uuid);
+ return port->shared->uuid;
}
int
diff --git a/libjack/transclient.c b/libjack/transclient.c
index b4861fd..e28f83e 100644
--- a/libjack/transclient.c
+++ b/libjack/transclient.c
@@ -361,7 +361,7 @@ jack_release_timebase (jack_client_t *client)
VALGRIND_MEMSET (&req, 0, sizeof (req));
req.type = ResetTimeBaseClient;
- jack_uuid_copy (req.x.client_id, ctl->uuid);
+ jack_uuid_copy (&req.x.client_id, ctl->uuid);
rc = jack_client_deliver_request (client, &req);
if (rc == 0) {
@@ -387,7 +387,7 @@ jack_set_sync_callback (jack_client_t *client,
req.type = SetSyncClient;
else
req.type = ResetSyncClient;
- jack_uuid_copy (req.x.client_id, ctl->uuid);
+ jack_uuid_copy (&req.x.client_id, ctl->uuid);
rc = jack_client_deliver_request (client, &req);
if (rc == 0) {
@@ -422,7 +422,7 @@ jack_set_timebase_callback (jack_client_t *client, int conditional,
VALGRIND_MEMSET (&req, 0, sizeof (req));
req.type = SetTimeBaseClient;
- jack_uuid_copy (req.x.timebase.client_id, ctl->uuid);
+ jack_uuid_copy (&req.x.timebase.client_id, ctl->uuid);
req.x.timebase.conditional = conditional;
rc = jack_client_deliver_request (client, &req);
diff --git a/libjack/uuid.c b/libjack/uuid.c
index c069137..8e23c39 100644
--- a/libjack/uuid.c
+++ b/libjack/uuid.c
@@ -17,55 +17,90 @@
*/
+#include <stdio.h>
+#include <stdint.h>
+
#include <jack/types.h>
#include <jack/uuid.h>
#include "internal.h"
-void
-jack_uuid_generate (jack_uuid_t uuid)
+static pthread_mutex_t uuid_lock = PTHREAD_MUTEX_INITIALIZER;
+static uint32_t uuid_cnt = 0;
+
+enum JackUUIDType {
+ JackUUIDPort = 0x1,
+ JackUUIDClient = 0x2
+};
+
+jack_uuid_t
+jack_client_uuid_generate ()
+{
+ jack_uuid_t uuid = JackUUIDClient;
+ pthread_mutex_lock (&uuid_lock);
+ uuid = (uuid << 32) | ++uuid_cnt;
+ pthread_mutex_unlock (&uuid_lock);
+ return uuid;
+}
+
+jack_uuid_t
+jack_port_uuid_generate (uint32_t port_id)
+{
+ jack_uuid_t uuid = JackUUIDPort;
+ uuid = (uuid << 32) | (port_id + 1);
+ return uuid;
+}
+
+uint32_t
+jack_uuid_to_index (jack_uuid_t u)
{
- uuid_generate (uuid);
+ return (u & 0xffff) - 1;
}
int
-jack_uuid_empty (const jack_uuid_t u)
+jack_uuid_empty (jack_uuid_t u)
{
- jack_uuid_t empty;
- VALGRIND_MEMSET(&empty, 0, sizeof(empty));
- uuid_clear (empty);
- if (jack_uuid_compare (u, empty) == 0) {
- return 1;
- }
- return 0;
+ return (u == 0);
}
int
-jack_uuid_compare (const jack_uuid_t a, const jack_uuid_t b)
+jack_uuid_compare (jack_uuid_t a, jack_uuid_t b)
{
- return uuid_compare (a, b);
+ if (a == b) {
+ return 0;
+ }
+
+ if (a < b) {
+ return -1;
+ }
+
+ return 1;
}
void
-jack_uuid_copy (jack_uuid_t a, const jack_uuid_t b)
+jack_uuid_copy (jack_uuid_t* dst, jack_uuid_t src)
{
- uuid_copy (a, b);
+ *dst = src;
}
void
-jack_uuid_clear (jack_uuid_t u)
+jack_uuid_clear (jack_uuid_t* u)
{
- uuid_clear (u);
+ *u = 0;
}
void
-jack_uuid_unparse (const jack_uuid_t u, char b[JACK_UUID_STRING_SIZE])
+jack_uuid_unparse (jack_uuid_t u, char b[JACK_UUID_STRING_SIZE])
{
- uuid_unparse (u, b);
+ snprintf (b, JACK_UUID_STRING_SIZE, "%" PRIu64, u);
}
int
-jack_uuid_parse (const char *b, jack_uuid_t u)
+jack_uuid_parse (const char *b, jack_uuid_t* u)
{
- return uuid_parse (b, u);
+ if (sscanf (b, "%" PRIu64, u) == 1) {
+ return 0;
+ }
+
+ return -1;
}
diff --git a/man/jack_lsp.0 b/man/jack_lsp.0
index e3c53fe..c3f8a6b 100644
--- a/man/jack_lsp.0
+++ b/man/jack_lsp.0
@@ -24,10 +24,6 @@ List connections to/from each port
.br
Display per-port latency in frames at each port
.TP
-\fB-L\fR, \fI--latency\fR
-.br
-Display total latency in frames at each port
-.TP
\fB-p\fR, \fB--properties\fR
.br
Display port properties. Output may include input|output, can-monitor, physical, terminal