本文整理汇总了C++中LIST_NEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ LIST_NEXT函数的具体用法?C++ LIST_NEXT怎么用?C++ LIST_NEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LIST_NEXT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imp_interface_find
imp_interface* imp_interface_find(int family, if_type type)
{
imp_interface *p_if = imp_interface_first();
for(; p_if; p_if = LIST_NEXT(p_if, link)){
if(p_if->if_addr.ss.ss_family == family &&
p_if->type == type)
return p_if;
}
return NULL;
}
示例2: rc_addrpool_alloc_any
/*
* allocate one address from address pool
* if successful, returns pointer to struct of allocated address
* if fails, returns 0
*
* caller must do LIST_INSERT_HEAD(&child_sa->lease_list, addr, link_sa)
*/
struct rcf_address *
rc_addrpool_alloc_any(struct rcf_addresspool *conf, int af)
{
size_t addrsize;
struct rcf_address_pool_item *i;
uint8_t addr[MAX_ADDRESS_LENGTH];
struct rcf_address *a;
if (!conf) {
plog(PLOG_INTERR, PLOGLOC, NULL,
"no address pool specified\n");
return 0;
}
addrsize = af_addrsize(af);
if (addrsize == 0)
return 0;
/*
* for each range of address pool
*/
for (i = LIST_FIRST(&conf->pool_list); i != NULL; i = LIST_NEXT(i, link)) {
if (af != i->af)
continue;
/*
* try if it's possible to assign one
* XXX need better algorithm
*/
for (memcpy(addr, &i->start, addrsize);
memcmp(addr, &i->end, addrsize) <= 0;
addrbits_incr(af, addr)) {
if (addrpool_check(i, addr) != 0)
continue;
/*
* OK. Assign it.
*/
a = rc_address_new(af, addr, IPV6_ADDRESS_PREFIX_LEN,
0, &i->lease_list);
if (!a)
return 0;
return a;
}
/* all address in use. try next range */
}
/* No address available for use */
return 0;
}
示例3: spec_fsync
/*
* Synch buffers associated with a block device
*/
int
spec_fsync(void *v)
{
struct vop_fsync_args *ap = v;
struct vnode *vp = ap->a_vp;
struct buf *bp;
struct buf *nbp;
int s;
if (vp->v_type == VCHR)
return (0);
#ifdef WAPBL
if (vp->v_type == VBLK &&
vp->v_specmountpoint != NULL &&
vp->v_specmountpoint->mnt_wapbl != NULL)
return (ffs_wapbl_fsync_vfs(vp, ap->a_waitfor));
#endif
/*
* Flush all dirty buffers associated with a block device.
*/
loop:
s = splbio();
for (bp = LIST_FIRST(&vp->v_dirtyblkhd);
bp != LIST_END(&vp->v_dirtyblkhd); bp = nbp) {
nbp = LIST_NEXT(bp, b_vnbufs);
if ((bp->b_flags & B_BUSY))
continue;
if ((bp->b_flags & B_DELWRI) == 0)
panic("spec_fsync: not dirty");
bremfree(bp);
buf_acquire(bp);
splx(s);
bawrite(bp);
goto loop;
}
if (ap->a_waitfor == MNT_WAIT) {
vwaitforio (vp, 0, "spec_fsync", 0);
#ifdef DIAGNOSTIC
if (!LIST_EMPTY(&vp->v_dirtyblkhd)) {
splx(s);
vprint("spec_fsync: dirty", vp);
goto loop;
}
#endif
}
splx(s);
return (0);
}
示例4: sys_timer_delete
/* Delete a POSIX realtime timer */
int
sys_timer_delete(struct lwp *l, const struct sys_timer_delete_args *uap,
register_t *retval)
{
/* {
syscallarg(timer_t) timerid;
} */
struct proc *p = l->l_proc;
timer_t timerid;
struct ptimers *pts;
struct ptimer *pt, *ptn;
timerid = SCARG(uap, timerid);
pts = p->p_timers;
if (pts == NULL || timerid < 2 || timerid >= TIMER_MAX)
return (EINVAL);
mutex_spin_enter(&timer_lock);
if ((pt = pts->pts_timers[timerid]) == NULL) {
mutex_spin_exit(&timer_lock);
return (EINVAL);
}
if (CLOCK_VIRTUAL_P(pt->pt_type)) {
if (pt->pt_active) {
ptn = LIST_NEXT(pt, pt_list);
LIST_REMOVE(pt, pt_list);
for ( ; ptn; ptn = LIST_NEXT(ptn, pt_list))
timespecadd(&pt->pt_time.it_value,
&ptn->pt_time.it_value,
&ptn->pt_time.it_value);
pt->pt_active = 0;
}
}
itimerfree(pts, timerid);
return (0);
}
示例5: mcast_if_get_by_addr
static imp_interface* mcast_if_get_by_addr(pi_addr *p_pia)
{
imp_interface *p_if = imp_interface_first();
while(p_if) {
if (memcmp(&p_if->if_addr, p_pia, sizeof(pi_addr)) == 0)
return p_if;
p_if = LIST_NEXT(p_if, link);
}
return NULL;
}
示例6: hcirawpr
static void
hcirawpr(kvm_t *kvmd, u_long addr)
{
ng_btsocket_hci_raw_pcb_p this = NULL, next = NULL;
ng_btsocket_hci_raw_pcb_t pcb;
struct socket so;
int first = 1;
if (addr == 0)
return;
if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
return;
for ( ; this != NULL; this = next) {
if (kread(kvmd, (u_long) this, (char *) &pcb, sizeof(pcb)) < 0)
return;
if (kread(kvmd, (u_long) pcb.so, (char *) &so, sizeof(so)) < 0)
return;
next = LIST_NEXT(&pcb, next);
if (first) {
first = 0;
fprintf(stdout,
"Active raw HCI sockets\n" \
"%-8.8s %-8.8s %-6.6s %-6.6s %-6.6s %-16.16s\n",
"Socket",
"PCB",
"Flags",
"Recv-Q",
"Send-Q",
"Local address");
}
if (pcb.addr.hci_node[0] == 0) {
pcb.addr.hci_node[0] = '*';
pcb.addr.hci_node[1] = 0;
}
fprintf(stdout,
"%-8lx %-8lx %-6.6x %6d %6d %-16.16s\n",
(unsigned long) pcb.so,
(unsigned long) this,
pcb.flags,
so.so_rcv.sb_ccc,
so.so_snd.sb_ccc,
pcb.addr.hci_node);
}
} /* hcirawpr */
示例7: bio_unregister
void
bio_unregister(struct device *dev)
{
struct bio_mapping *bm, *next;
for (bm = LIST_FIRST(&bios); bm != NULL; bm = next) {
next = LIST_NEXT(bm, bm_link);
if (dev == bm->bm_dev) {
LIST_REMOVE(bm, bm_link);
free(bm, M_DEVBUF, sizeof(*bm));
}
}
}
示例8: usb_allocmem
usbd_status
usb_allocmem(usbd_bus_handle bus, size_t size, size_t align, usb_dma_t *p)
{
bus_dma_tag_t tag = bus->dmatag;
usbd_status err;
struct usb_frag_dma *f;
usb_dma_block_t *b;
int i;
int s;
/* If the request is large then just use a full block. */
if (size > USB_MEM_SMALL || align > USB_MEM_SMALL) {
DPRINTFN(1, ("usb_allocmem: large alloc %d\n", (int)size));
size = (size + USB_MEM_BLOCK - 1) & ~(USB_MEM_BLOCK - 1);
err = usb_block_allocmem(tag, size, align, &p->block);
if (!err) {
p->block->fullblock = 1;
p->offs = 0;
}
return (err);
}
s = splusb();
/* Check for free fragments. */
for (f = LIST_FIRST(&usb_frag_freelist); f; f = LIST_NEXT(f, next))
if (f->block->tag == tag)
break;
if (f == NULL) {
DPRINTFN(1, ("usb_allocmem: adding fragments\n"));
err = usb_block_allocmem(tag, USB_MEM_BLOCK, USB_MEM_SMALL,&b);
if (err) {
splx(s);
return (err);
}
b->fullblock = 0;
for (i = 0; i < USB_MEM_BLOCK; i += USB_MEM_SMALL) {
f = (struct usb_frag_dma *)(b->kaddr + i);
f->block = b;
f->offs = i;
LIST_INSERT_HEAD(&usb_frag_freelist, f, next);
}
f = LIST_FIRST(&usb_frag_freelist);
}
p->block = f->block;
p->offs = f->offs;
LIST_REMOVE(f, next);
splx(s);
DPRINTFN(5, ("usb_allocmem: use frag=%p size=%d\n", f, (int)size));
return (USBD_NORMAL_COMPLETION);
}
示例9: imp_source_find_scheduled
imp_source* imp_source_find_scheduled(imp_group *p_gp, int sflag)
{
imp_source *p_is = NULL;
for (p_is = LIST_FIRST(&p_gp->src_list); p_is ;
p_is = LIST_NEXT(p_is, link)) {
if (imp_source_is_scheduled(p_is, sflag) != 0)
return p_is;;
}
return NULL;
}
示例10: imp_source_exist_allow
/*-----------------------------------------------------------------------
* Name : imp_source_exist_allow
*
* Brief : check if there exsit source which is allowed in group
* Params : [in] p_gp -- struct imp_group
* Return : 1:exsit 0:not exsit
*------------------------------------------------------------------------
*/
int imp_source_exist_allow(imp_group *p_gp)
{
imp_source *p_is = NULL;
for (p_is = LIST_FIRST(&p_gp->src_list); p_is ;
p_is = LIST_NEXT(p_is, link)) {
if(!TIMEVAL_ISZERO(p_is->timer->tm))
return 1;
}
return 0;
}
示例11: next_battle_turn
static void next_battle_turn(
BATTLE *battle
)
{
BATTLE_ACTOR *ba;
for (ba = (BATTLE_ACTOR *) LIST_HEAD(&battle->battleList);
ba != NULL;
ba = (BATTLE_ACTOR *) LIST_NEXT(&ba->listNode) ) {
set_battle_state(battle, ba, BATTLE_STATE_IDLE, NULL);
}
}
示例12: draw_battle_field
static void draw_battle_field(
BATTLE *battle
)
{
BATTLE_ACTOR *ba;
for (ba = (BATTLE_ACTOR *) LIST_HEAD(&battle->battleList);
ba != NULL;
ba = (BATTLE_ACTOR *) LIST_NEXT(&ba->listNode) ) {
draw_player(ba->player, battle->world);
}
}
示例13: find_ad
/**
* @brief Cancel mass ad cache from a user
* @param u User to flush out
* @param rcv -1 = cancel all, or cancel where ad->rcvd_by == rcv
*/
aMassAd *
find_ad(UserList * u, int rcv)
{
aMassAd *search;
if ((search = LIST_FIRST(&masslist)) == NULL)
return NULL;
while (search) {
if (search->sender == u && (search->rcvd_by == rcv || rcv == -1))
return search;
search = LIST_NEXT(search, ma_lst);
}
return NULL;
}
示例14: pfil_head_get
/*
* pfil_head_get() returns the pfil_head for a given key/dlt.
*/
struct pfil_head *
pfil_head_get(int type, u_long val)
{
struct pfil_head *ph;
for (ph = LIST_FIRST(&pfil_head_list); ph != NULL;
ph = LIST_NEXT(ph, ph_list)) {
if (ph->ph_type == type &&
ph->ph_un.phu_val == val)
break;
}
return (ph);
}
示例15: inpcb_count_opportunistic
__private_extern__ uint32_t
inpcb_count_opportunistic(unsigned int ifindex, struct inpcbinfo *pcbinfo,
u_int32_t flags)
{
uint32_t opportunistic = 0;
struct inpcb *inp;
inp_gen_t gencnt;
lck_rw_lock_shared(pcbinfo->ipi_lock);
gencnt = pcbinfo->ipi_gencnt;
for (inp = LIST_FIRST(pcbinfo->ipi_listhead);
inp != NULL; inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt &&
inp->inp_state != INPCB_STATE_DEAD &&
inp->inp_socket != NULL &&
so_get_opportunistic(inp->inp_socket) &&
inp->inp_last_outifp != NULL &&
ifindex == inp->inp_last_outifp->if_index) {
opportunistic++;
struct socket *so = inp->inp_socket;
if ((flags & INPCB_OPPORTUNISTIC_SETCMD) &&
(so->so_state & SS_ISCONNECTED)) {
socket_lock(so, 1);
if (flags & INPCB_OPPORTUNISTIC_THROTTLEON) {
so->so_flags |= SOF_SUSPENDED;
soevent(so,
(SO_FILT_HINT_LOCKED |
SO_FILT_HINT_SUSPEND));
} else {
so->so_flags &= ~(SOF_SUSPENDED);
soevent(so,
(SO_FILT_HINT_LOCKED |
SO_FILT_HINT_RESUME));
}
SOTHROTTLELOG(("throttle[%d]: so 0x%llx "
"[%d,%d] %s\n", so->last_pid,
(uint64_t)VM_KERNEL_ADDRPERM(so),
SOCK_DOM(so), SOCK_TYPE(so),
(so->so_flags & SOF_SUSPENDED) ?
"SUSPENDED" : "RESUMED"));
socket_unlock(so, 1);
}
}
}
lck_rw_done(pcbinfo->ipi_lock);
return (opportunistic);
}