mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 01:01:02 +00:00
rename chandup() and clarify its usage
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@145027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -8943,7 +8943,12 @@ static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t g
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dahdi_pvt *chandup(struct dahdi_pvt *src)
|
/* This function can *ONLY* be used for copying pseudo (CHAN_PSEUDO) private
|
||||||
|
structures; it makes no attempt to safely copy regular channel private
|
||||||
|
structures that might contain reference-counted object pointers and other
|
||||||
|
scary bits
|
||||||
|
*/
|
||||||
|
static struct dahdi_pvt *duplicate_pseudo(struct dahdi_pvt *src)
|
||||||
{
|
{
|
||||||
struct dahdi_pvt *p;
|
struct dahdi_pvt *p;
|
||||||
struct dahdi_bufferinfo bi;
|
struct dahdi_bufferinfo bi;
|
||||||
@@ -8953,7 +8958,6 @@ static struct dahdi_pvt *chandup(struct dahdi_pvt *src)
|
|||||||
memcpy(p, src, sizeof(struct dahdi_pvt));
|
memcpy(p, src, sizeof(struct dahdi_pvt));
|
||||||
ast_mutex_init(&p->lock);
|
ast_mutex_init(&p->lock);
|
||||||
p->subs[SUB_REAL].dfd = dahdi_open("/dev/dahdi/pseudo");
|
p->subs[SUB_REAL].dfd = dahdi_open("/dev/dahdi/pseudo");
|
||||||
/* Allocate a dahdi structure */
|
|
||||||
if (p->subs[SUB_REAL].dfd < 0) {
|
if (p->subs[SUB_REAL].dfd < 0) {
|
||||||
ast_log(LOG_ERROR, "Unable to dup channel: %s\n", strerror(errno));
|
ast_log(LOG_ERROR, "Unable to dup channel: %s\n", strerror(errno));
|
||||||
destroy_dahdi_pvt(&p);
|
destroy_dahdi_pvt(&p);
|
||||||
@@ -9155,7 +9159,7 @@ static struct ast_channel *dahdi_request(const char *type, int format, void *dat
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (p->channel == CHAN_PSEUDO) {
|
if (p->channel == CHAN_PSEUDO) {
|
||||||
p = chandup(p);
|
p = duplicate_pseudo(p);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -14525,14 +14529,13 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
|
|||||||
/*< \todo why check for the pseudo in the per-channel section.
|
/*< \todo why check for the pseudo in the per-channel section.
|
||||||
* Any actual use for manual setup of the pseudo channel? */
|
* Any actual use for manual setup of the pseudo channel? */
|
||||||
if (!found_pseudo && reload == 0) {
|
if (!found_pseudo && reload == 0) {
|
||||||
/* Make sure pseudo isn't a member of any groups if
|
/* use the default configuration for a channel, so
|
||||||
we're automatically making it. */
|
that any settings from real configured channels
|
||||||
|
don't "leak" into the pseudo channel config
|
||||||
confp->chan.group = 0;
|
*/
|
||||||
confp->chan.callgroup = 0;
|
struct dahdi_chan_conf conf = dahdi_chan_conf_default();
|
||||||
confp->chan.pickupgroup = 0;
|
|
||||||
|
|
||||||
tmp = mkintf(CHAN_PSEUDO, confp, NULL, reload);
|
tmp = mkintf(CHAN_PSEUDO, &conf, NULL, reload);
|
||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
ast_verb(3, "Automatically generated pseudo channel\n");
|
ast_verb(3, "Automatically generated pseudo channel\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user