creds: Rename pa_ancil to pa_cmsg_ancil_data

Makes the purpose of the structure clearear.
This commit is contained in:
Arun Raghavan 2014-08-06 07:48:19 +05:30
parent 72e5671ece
commit 8718496d14
12 changed files with 82 additions and 82 deletions

View file

@ -1780,14 +1780,14 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
} }
/* Called from main context */ /* Called from main context */
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) { static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
struct userdata *u = userdata; struct userdata *u = userdata;
pa_assert(p); pa_assert(p);
pa_assert(packet); pa_assert(packet);
pa_assert(u); pa_assert(u);
if (pa_pdispatch_run(u->pdispatch, packet, ancil, u) < 0) { if (pa_pdispatch_run(u->pdispatch, packet, ancil_data, u) < 0) {
pa_log("Invalid packet"); pa_log("Invalid packet");
pa_module_unload_request(u->module, true); pa_module_unload_request(u->module, true);
return; return;

View file

@ -328,7 +328,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
pa_context_fail(c, PA_ERR_CONNECTIONTERMINATED); pa_context_fail(c, PA_ERR_CONNECTIONTERMINATED);
} }
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) { static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
pa_context *c = userdata; pa_context *c = userdata;
pa_assert(p); pa_assert(p);
@ -337,7 +337,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_a
pa_context_ref(c); pa_context_ref(c);
if (pa_pdispatch_run(c->pdispatch, packet, ancil, c) < 0) if (pa_pdispatch_run(c->pdispatch, packet, ancil_data, c) < 0)
pa_context_fail(c, PA_ERR_PROTOCOL); pa_context_fail(c, PA_ERR_PROTOCOL);
pa_context_unref(c); pa_context_unref(c);

View file

@ -31,10 +31,10 @@
#include <pulsecore/socket.h> #include <pulsecore/socket.h>
#include <stdbool.h> #include <stdbool.h>
#define MAX_ANCIL_FDS 2 #define MAX_ANCIL_DATA_FDS 2
typedef struct pa_creds pa_creds; typedef struct pa_creds pa_creds;
typedef struct pa_ancil pa_ancil; typedef struct pa_cmsg_ancil_data pa_cmsg_ancil_data;
#if defined(SCM_CREDENTIALS) #if defined(SCM_CREDENTIALS)
@ -46,12 +46,12 @@ struct pa_creds {
}; };
/* Struct for handling ancillary data, i e, extra data that can be sent together with a message /* Struct for handling ancillary data, i e, extra data that can be sent together with a message
over unix pipes. Supports sending and receiving credentials and file descriptors. */ * over unix pipes. Supports sending and receiving credentials and file descriptors. */
struct pa_ancil { struct pa_cmsg_ancil_data {
pa_creds creds; pa_creds creds;
bool creds_valid; bool creds_valid;
int nfd; int nfd;
int fds[MAX_ANCIL_FDS]; int fds[MAX_ANCIL_DATA_FDS];
}; };
#else #else

View file

@ -355,7 +355,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
struct iovec iov; struct iovec iov;
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_FDS)]; uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)];
} cmsg; } cmsg;
pa_assert(io); pa_assert(io);
@ -364,7 +364,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
pa_assert(io->ofd >= 0); pa_assert(io->ofd >= 0);
pa_assert(fds); pa_assert(fds);
pa_assert(nfd > 0); pa_assert(nfd > 0);
pa_assert(nfd <= MAX_ANCIL_FDS); pa_assert(nfd <= MAX_ANCIL_DATA_FDS);
pa_zero(iov); pa_zero(iov);
iov.iov_base = (void*) data; iov.iov_base = (void*) data;
@ -391,24 +391,24 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
return r; return r;
} }
ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_ancil *ancil) { ssize_t pa_iochannel_read_with_ancil_data(pa_iochannel*io, void*data, size_t l, pa_cmsg_ancil_data *ancil_data) {
ssize_t r; ssize_t r;
struct msghdr mh; struct msghdr mh;
struct iovec iov; struct iovec iov;
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
uint8_t data[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(int) * MAX_ANCIL_FDS)]; uint8_t data[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)];
} cmsg; } cmsg;
pa_assert(io); pa_assert(io);
pa_assert(data); pa_assert(data);
pa_assert(l); pa_assert(l);
pa_assert(io->ifd >= 0); pa_assert(io->ifd >= 0);
pa_assert(ancil); pa_assert(ancil_data);
if (io->ifd_type > 0) { if (io->ifd_type > 0) {
ancil->creds_valid = false; ancil_data->creds_valid = false;
ancil->nfd = 0; ancil_data->nfd = 0;
return pa_iochannel_read(io, data, l); return pa_iochannel_read(io, data, l);
} }
@ -426,8 +426,8 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
if ((r = recvmsg(io->ifd, &mh, 0)) >= 0) { if ((r = recvmsg(io->ifd, &mh, 0)) >= 0) {
struct cmsghdr *cmh; struct cmsghdr *cmh;
ancil->creds_valid = false; ancil_data->creds_valid = false;
ancil->nfd = 0; ancil_data->nfd = 0;
for (cmh = CMSG_FIRSTHDR(&mh); cmh; cmh = CMSG_NXTHDR(&mh, cmh)) { for (cmh = CMSG_FIRSTHDR(&mh); cmh; cmh = CMSG_NXTHDR(&mh, cmh)) {
@ -439,21 +439,21 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
pa_assert(cmh->cmsg_len == CMSG_LEN(sizeof(struct ucred))); pa_assert(cmh->cmsg_len == CMSG_LEN(sizeof(struct ucred)));
memcpy(&u, CMSG_DATA(cmh), sizeof(struct ucred)); memcpy(&u, CMSG_DATA(cmh), sizeof(struct ucred));
ancil->creds.gid = u.gid; ancil_data->creds.gid = u.gid;
ancil->creds.uid = u.uid; ancil_data->creds.uid = u.uid;
ancil->creds_valid = true; ancil_data->creds_valid = true;
} }
else if (cmh->cmsg_type == SCM_RIGHTS) { else if (cmh->cmsg_type == SCM_RIGHTS) {
int nfd = (cmh->cmsg_len - CMSG_LEN(0)) / sizeof(int); int nfd = (cmh->cmsg_len - CMSG_LEN(0)) / sizeof(int);
if (nfd > MAX_ANCIL_FDS) { if (nfd > MAX_ANCIL_DATA_FDS) {
int i; int i;
pa_log("Trying to receive too many file descriptors!"); pa_log("Trying to receive too many file descriptors!");
for (i = 0; i < nfd; i++) for (i = 0; i < nfd; i++)
pa_close(((int*) CMSG_DATA(cmh))[i]); pa_close(((int*) CMSG_DATA(cmh))[i]);
continue; continue;
} }
memcpy(ancil->fds, CMSG_DATA(cmh), nfd * sizeof(int)); memcpy(ancil_data->fds, CMSG_DATA(cmh), nfd * sizeof(int));
ancil->nfd = nfd; ancil_data->nfd = nfd;
} }
} }
@ -463,7 +463,7 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
if (r == -1 && errno == ENOTSOCK) { if (r == -1 && errno == ENOTSOCK) {
io->ifd_type = 1; io->ifd_type = 1;
return pa_iochannel_read_with_ancil(io, data, l, ancil); return pa_iochannel_read_with_ancil_data(io, data, l, ancil_data);
} }
return r; return r;

View file

@ -59,7 +59,7 @@ int pa_iochannel_creds_enable(pa_iochannel *io);
ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l, int nfd, const int *fds); ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l, int nfd, const int *fds);
ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l, const pa_creds *ucred); ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l, const pa_creds *ucred);
ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_ancil *ancil); ssize_t pa_iochannel_read_with_ancil_data(pa_iochannel*io, void*data, size_t l, pa_cmsg_ancil_data *ancil_data);
#endif #endif
bool pa_iochannel_is_readable(pa_iochannel*io); bool pa_iochannel_is_readable(pa_iochannel*io);

View file

@ -221,7 +221,7 @@ struct pa_pdispatch {
PA_LLIST_HEAD(struct reply_info, replies); PA_LLIST_HEAD(struct reply_info, replies);
pa_pdispatch_drain_cb_t drain_callback; pa_pdispatch_drain_cb_t drain_callback;
void *drain_userdata; void *drain_userdata;
const pa_ancil *ancil; const pa_cmsg_ancil_data *ancil_data;
bool use_rtclock; bool use_rtclock;
}; };
@ -291,7 +291,7 @@ static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command,
pa_pdispatch_unref(pd); pa_pdispatch_unref(pd);
} }
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil, void *userdata) { int pa_pdispatch_run(pa_pdispatch *pd, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
uint32_t tag, command; uint32_t tag, command;
pa_tagstruct *ts = NULL; pa_tagstruct *ts = NULL;
int ret = -1; int ret = -1;
@ -325,7 +325,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil,
} }
#endif #endif
pd->ancil = ancil; pd->ancil_data = ancil_data;
if (command == PA_COMMAND_ERROR || command == PA_COMMAND_REPLY) { if (command == PA_COMMAND_ERROR || command == PA_COMMAND_REPLY) {
struct reply_info *r; struct reply_info *r;
@ -349,7 +349,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil,
ret = 0; ret = 0;
finish: finish:
pd->ancil = NULL; pd->ancil_data = NULL;
if (ts) if (ts)
pa_tagstruct_free(ts); pa_tagstruct_free(ts);
@ -444,8 +444,8 @@ const pa_creds * pa_pdispatch_creds(pa_pdispatch *pd) {
pa_assert(pd); pa_assert(pd);
pa_assert(PA_REFCNT_VALUE(pd) >= 1); pa_assert(PA_REFCNT_VALUE(pd) >= 1);
if (pd->ancil && pd->ancil->creds_valid) if (pd->ancil_data && pd->ancil_data->creds_valid)
return &pd->ancil->creds; return &pd->ancil_data->creds;
return NULL; return NULL;
} }
@ -454,9 +454,9 @@ const int * pa_pdispatch_fds(pa_pdispatch *pd, int *nfd) {
pa_assert(PA_REFCNT_VALUE(pd) >= 1); pa_assert(PA_REFCNT_VALUE(pd) >= 1);
pa_assert(nfd); pa_assert(nfd);
if (pd->ancil) { if (pd->ancil_data) {
*nfd = pd->ancil->nfd; *nfd = pd->ancil_data->nfd;
return pd->ancil->fds; return pd->ancil_data->fds;
} }
*nfd = 0; *nfd = 0;

View file

@ -41,7 +41,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, bool use_rtclock, const pa_pd
void pa_pdispatch_unref(pa_pdispatch *pd); void pa_pdispatch_unref(pa_pdispatch *pd);
pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd); pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd);
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*p, const pa_ancil *ancil, void *userdata); int pa_pdispatch_run(pa_pdispatch *pd, pa_packet *p, const pa_cmsg_ancil_data *ancil_data, void *userdata);
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata, pa_free_cb_t free_cb); void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata, pa_free_cb_t free_cb);

View file

@ -4888,14 +4888,14 @@ static void command_set_port_latency_offset(pa_pdispatch *pd, uint32_t command,
/*** pstream callbacks ***/ /*** pstream callbacks ***/
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) { static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
pa_assert(p); pa_assert(p);
pa_assert(packet); pa_assert(packet);
pa_native_connection_assert_ref(c); pa_native_connection_assert_ref(c);
if (pa_pdispatch_run(c->pdispatch, packet, ancil, c) < 0) { if (pa_pdispatch_run(c->pdispatch, packet, ancil_data, c) < 0) {
pa_log("invalid packet."); pa_log("invalid packet.");
native_connection_unlink(c); native_connection_unlink(c);
} }

View file

@ -28,7 +28,7 @@
#include "pstream-util.h" #include "pstream-util.h"
static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t, const pa_ancil *ancil) { static void pa_pstream_send_tagstruct_with_ancil_data(pa_pstream *p, pa_tagstruct *t, const pa_cmsg_ancil_data *ancil_data) {
size_t length; size_t length;
uint8_t *data; uint8_t *data;
pa_packet *packet; pa_packet *packet;
@ -38,7 +38,7 @@ static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t,
pa_assert_se(data = pa_tagstruct_free_data(t, &length)); pa_assert_se(data = pa_tagstruct_free_data(t, &length));
pa_assert_se(packet = pa_packet_new_dynamic(data, length)); pa_assert_se(packet = pa_packet_new_dynamic(data, length));
pa_pstream_send_packet(p, packet, ancil); pa_pstream_send_packet(p, packet, ancil_data);
pa_packet_unref(packet); pa_packet_unref(packet);
} }
@ -46,35 +46,35 @@ static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t,
void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) { void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
if (creds) { if (creds) {
pa_ancil a; pa_cmsg_ancil_data a;
a.nfd = 0; a.nfd = 0;
a.creds_valid = true; a.creds_valid = true;
a.creds = *creds; a.creds = *creds;
pa_pstream_send_tagstruct_with_ancil(p, t, &a); pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
} }
else else
pa_pstream_send_tagstruct_with_ancil(p, t, NULL); pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
} }
void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) { void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {
if (nfd > 0) { if (nfd > 0) {
pa_ancil a; pa_cmsg_ancil_data a;
a.nfd = nfd; a.nfd = nfd;
a.creds_valid = false; a.creds_valid = false;
pa_assert(nfd <= MAX_ANCIL_FDS); pa_assert(nfd <= MAX_ANCIL_DATA_FDS);
memcpy(a.fds, fds, sizeof(int) * nfd); memcpy(a.fds, fds, sizeof(int) * nfd);
pa_pstream_send_tagstruct_with_ancil(p, t, &a); pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
} }
else else
pa_pstream_send_tagstruct_with_ancil(p, t, NULL); pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
} }
#else #else
void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) { void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
pa_pstream_send_tagstruct_with_ancil(p, t, NULL); pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
} }
void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) { void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {

View file

@ -95,8 +95,8 @@ struct item_info {
/* packet info */ /* packet info */
pa_packet *packet; pa_packet *packet;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
bool with_ancil; bool with_ancil_data;
pa_ancil ancil; pa_cmsg_ancil_data ancil_data;
#endif #endif
/* memblock info */ /* memblock info */
@ -170,8 +170,8 @@ struct pa_pstream {
pa_mempool *mempool; pa_mempool *mempool;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
pa_ancil read_ancil, write_ancil; pa_cmsg_ancil_data read_ancil_data, write_ancil_data;
bool send_ancil_now; bool send_ancil_data_now;
#endif #endif
}; };
@ -324,7 +324,7 @@ static void pstream_free(pa_pstream *p) {
pa_xfree(p); pa_xfree(p);
} }
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *ancil) { void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data) {
struct item_info *i; struct item_info *i;
pa_assert(p); pa_assert(p);
@ -341,12 +341,12 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *anc
i->packet = pa_packet_ref(packet); i->packet = pa_packet_ref(packet);
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
if ((i->with_ancil = !!ancil)) { if ((i->with_ancil_data = !!ancil_data)) {
i->ancil = *ancil; i->ancil_data = *ancil_data;
if (ancil->creds_valid) if (ancil_data->creds_valid)
pa_assert(ancil->nfd == 0); pa_assert(ancil_data->nfd == 0);
else else
pa_assert(ancil->nfd > 0); pa_assert(ancil_data->nfd > 0);
} }
#endif #endif
@ -389,7 +389,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
i->offset = offset; i->offset = offset;
i->seek_mode = seek_mode; i->seek_mode = seek_mode;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
i->with_ancil = false; i->with_ancil_data = false;
#endif #endif
pa_queue_push(p->send_queue, i); pa_queue_push(p->send_queue, i);
@ -416,7 +416,7 @@ void pa_pstream_send_release(pa_pstream *p, uint32_t block_id) {
item->type = PA_PSTREAM_ITEM_SHMRELEASE; item->type = PA_PSTREAM_ITEM_SHMRELEASE;
item->block_id = block_id; item->block_id = block_id;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
item->with_ancil = false; item->with_ancil_data = false;
#endif #endif
pa_queue_push(p->send_queue, item); pa_queue_push(p->send_queue, item);
@ -453,7 +453,7 @@ void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id) {
item->type = PA_PSTREAM_ITEM_SHMREVOKE; item->type = PA_PSTREAM_ITEM_SHMREVOKE;
item->block_id = block_id; item->block_id = block_id;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
item->with_ancil = false; item->with_ancil_data = false;
#endif #endif
pa_queue_push(p->send_queue, item); pa_queue_push(p->send_queue, item);
@ -577,8 +577,8 @@ static void prepare_next_write_item(pa_pstream *p) {
} }
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
if ((p->send_ancil_now = p->write.current->with_ancil)) if ((p->send_ancil_data_now = p->write.current->with_ancil_data))
p->write_ancil = p->write.current->ancil; p->write_ancil_data = p->write.current->ancil_data;
#endif #endif
} }
@ -637,16 +637,16 @@ static int do_write(pa_pstream *p) {
pa_assert(l > 0); pa_assert(l > 0);
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
if (p->send_ancil_now) { if (p->send_ancil_data_now) {
if (p->write_ancil.creds_valid) { if (p->write_ancil_data.creds_valid) {
pa_assert(p->write_ancil.nfd == 0); pa_assert(p->write_ancil_data.nfd == 0);
if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_ancil.creds)) < 0) if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_ancil_data.creds)) < 0)
goto fail; goto fail;
} }
else else
if ((r = pa_iochannel_write_with_fds(p->io, d, l, p->write_ancil.nfd, p->write_ancil.fds)) < 0) if ((r = pa_iochannel_write_with_fds(p->io, d, l, p->write_ancil_data.nfd, p->write_ancil_data.fds)) < 0)
goto fail; goto fail;
p->send_ancil_now = false; p->send_ancil_data_now = false;
} else } else
#endif #endif
if (p->srb) if (p->srb)
@ -719,19 +719,19 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
else else
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
{ {
pa_ancil b; pa_cmsg_ancil_data b;
if ((r = pa_iochannel_read_with_ancil(p->io, d, l, &b)) <= 0) if ((r = pa_iochannel_read_with_ancil_data(p->io, d, l, &b)) <= 0)
goto fail; goto fail;
if (b.creds_valid) { if (b.creds_valid) {
p->read_ancil.creds_valid = true; p->read_ancil_data.creds_valid = true;
p->read_ancil.creds = b.creds; p->read_ancil_data.creds = b.creds;
} }
if (b.nfd > 0) { if (b.nfd > 0) {
pa_assert(b.nfd <= MAX_ANCIL_FDS); pa_assert(b.nfd <= MAX_ANCIL_DATA_FDS);
p->read_ancil.nfd = b.nfd; p->read_ancil_data.nfd = b.nfd;
memcpy(p->read_ancil.fds, b.fds, sizeof(int) * b.nfd); memcpy(p->read_ancil_data.fds, b.fds, sizeof(int) * b.nfd);
} }
} }
#else #else
@ -880,7 +880,7 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
if (p->receive_packet_callback) if (p->receive_packet_callback)
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
p->receive_packet_callback(p, re->packet, &p->read_ancil, p->receive_packet_callback_userdata); p->receive_packet_callback(p, re->packet, &p->read_ancil_data, p->receive_packet_callback_userdata);
#else #else
p->receive_packet_callback(p, re->packet, NULL, p->receive_packet_callback_userdata); p->receive_packet_callback(p, re->packet, NULL, p->receive_packet_callback_userdata);
#endif #endif
@ -942,8 +942,8 @@ frame_done:
re->data = NULL; re->data = NULL;
#ifdef HAVE_CREDS #ifdef HAVE_CREDS
p->read_ancil.creds_valid = false; p->read_ancil_data.creds_valid = false;
p->read_ancil.nfd = 0; p->read_ancil_data.nfd = 0;
#endif #endif
return 0; return 0;

View file

@ -38,7 +38,7 @@
typedef struct pa_pstream pa_pstream; typedef struct pa_pstream pa_pstream;
typedef void (*pa_pstream_packet_cb_t)(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata); typedef void (*pa_pstream_packet_cb_t)(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata);
typedef void (*pa_pstream_memblock_cb_t)(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata); typedef void (*pa_pstream_memblock_cb_t)(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata);
typedef void (*pa_pstream_notify_cb_t)(pa_pstream *p, void *userdata); typedef void (*pa_pstream_notify_cb_t)(pa_pstream *p, void *userdata);
typedef void (*pa_pstream_block_id_cb_t)(pa_pstream *p, uint32_t block_id, void *userdata); typedef void (*pa_pstream_block_id_cb_t)(pa_pstream *p, uint32_t block_id, void *userdata);
@ -50,7 +50,7 @@ void pa_pstream_unref(pa_pstream*p);
void pa_pstream_unlink(pa_pstream *p); void pa_pstream_unlink(pa_pstream *p);
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *ancil); void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data);
void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk); void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk);
void pa_pstream_send_release(pa_pstream *p, uint32_t block_id); void pa_pstream_send_release(pa_pstream *p, uint32_t block_id);
void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id); void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id);

View file

@ -36,7 +36,7 @@ static unsigned packets_received;
static unsigned packets_checksum; static unsigned packets_checksum;
static size_t packets_length; static size_t packets_length;
static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) { static void packet_received(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
unsigned i; unsigned i;
fail_unless(packets_length == packet->length); fail_unless(packets_length == packet->length);
packets_received++; packets_received++;