这篇教程C++ timer_pending函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中timer_pending函数的典型用法代码示例。如果您正苦于以下问题:C++ timer_pending函数的具体用法?C++ timer_pending怎么用?C++ timer_pending使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了timer_pending函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: rx_completevoid rx_complete(struct urb *urb){ struct sk_buff *skb = (struct sk_buff *) urb->context; struct skb_data *entry = (struct skb_data *) skb->cb; struct usbnet *dev = entry->dev; int urb_status = urb->status; enum skb_state state; skb_put (skb, urb->actual_length); state = rx_done; entry->urb = NULL; switch (urb_status) { case 0: if (skb->len < dev->net->hard_header_len) { state = rx_cleanup; dev->net->stats.rx_errors++; dev->net->stats.rx_length_errors++; netif_dbg(dev, rx_err, dev->net, "rx length %d/n", skb->len); } break; case -EPIPE: dev->net->stats.rx_errors++; usbnet_defer_kevent (dev, EVENT_RX_HALT); case -ECONNRESET: case -ESHUTDOWN: netif_dbg(dev, ifdown, dev->net, "rx shutdown, code %d/n", urb_status); goto block; case -EPROTO: case -ETIME: case -EILSEQ: dev->net->stats.rx_errors++; if (!timer_pending (&dev->delay)) { mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); netif_dbg(dev, link, dev->net, "rx throttle %d/n", urb_status); }block: state = rx_cleanup; entry->urb = urb; urb = NULL; break; case -EOVERFLOW: dev->net->stats.rx_over_errors++; default: state = rx_cleanup; dev->net->stats.rx_errors++; netif_dbg(dev, rx_err, dev->net, "rx status %d/n", urb_status); break; } state = defer_bh(dev, skb, &dev->rxq, state); if (urb) { if (netif_running (dev->net) && !test_bit (EVENT_RX_HALT, &dev->flags) && state != unlink_start) { rx_submit (dev, urb, GFP_ATOMIC); usb_mark_last_busy(dev->udev); return; } usb_free_urb (urb); } netif_dbg(dev, rx_err, dev->net, "no read resubmitted/n");}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:77,
示例2: fib6_force_start_gcvoid fib6_force_start_gc(struct net *net){ if (!timer_pending(&net->ipv6.ip6_fib_timer)) mod_timer(&net->ipv6.ip6_fib_timer, jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);}
开发者ID:xdatravelbug,项目名称:android_kernel_sony_msm8974,代码行数:6,
示例3: rx_completestatic void rx_complete (struct urb *urb){ struct sk_buff *skb = (struct sk_buff *) urb->context; struct skb_data *entry = (struct skb_data *) skb->cb; struct usbnet *dev = entry->dev; int urb_status = urb->status; enum skb_state state; skb_put (skb, urb->actual_length); state = rx_done; entry->urb = NULL; switch (urb_status) { /* success */ case 0: if (skb->len < dev->net->hard_header_len) { state = rx_cleanup; dev->net->stats.rx_errors++; dev->net->stats.rx_length_errors++; netif_dbg(dev, rx_err, dev->net, "rx length %d/n", skb->len); } break; /* stalls need manual reset. this is rare ... except that * when going through USB 2.0 TTs, unplug appears this way. * we avoid the highspeed version of the ETIMEDOUT/EILSEQ * storm, recovering as needed. */ case -EPIPE: dev->net->stats.rx_errors++; usbnet_defer_kevent (dev, EVENT_RX_HALT); // FALLTHROUGH /* software-driven interface shutdown */ case -ECONNRESET: /* async unlink */ case -ESHUTDOWN: /* hardware gone */ netif_dbg(dev, ifdown, dev->net, "rx shutdown, code %d/n", urb_status); goto block; /* we get controller i/o faults during khubd disconnect() delays. * throttle down resubmits, to avoid log floods; just temporarily, * so we still recover when the fault isn't a khubd delay. */ case -EPROTO: case -ETIME: case -EILSEQ: dev->net->stats.rx_errors++; if (!timer_pending (&dev->delay)) { mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); netif_dbg(dev, link, dev->net, "rx throttle %d/n", urb_status); }block: state = rx_cleanup; entry->urb = urb; urb = NULL; break; /* data overrun ... flush fifo? */ case -EOVERFLOW: dev->net->stats.rx_over_errors++; // FALLTHROUGH default: state = rx_cleanup; dev->net->stats.rx_errors++; netif_dbg(dev, rx_err, dev->net, "rx status %d/n", urb_status); break; } state = defer_bh(dev, skb, &dev->rxq, state); if (urb) { if (netif_running (dev->net) && !test_bit (EVENT_RX_HALT, &dev->flags) && state != unlink_start) { rx_submit (dev, urb, GFP_ATOMIC); usb_mark_last_busy(dev->udev); return; } usb_free_urb (urb); } netif_dbg(dev, rx_err, dev->net, "no read resubmitted/n");}
开发者ID:LucasFeliciano21,项目名称:BeagleBoard-Stable_Linux,代码行数:86,
示例4: rose_ftimer_runningint rose_ftimer_running(struct rose_neigh *neigh){ return timer_pending(&neigh->ftimer);}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:4,
示例5: cpufreq_interactivex_timerstatic void cpufreq_interactivex_timer(unsigned long data){ u64 delta_idle; u64 update_time; u64 *cpu_time_in_idle; u64 *cpu_idle_exit_time; struct timer_list *t; u64 now_idle = get_cpu_idle_time_us(data, &update_time); cpu_time_in_idle = &per_cpu(time_in_idle, data); cpu_idle_exit_time = &per_cpu(idle_exit_time, data); if (update_time == *cpu_idle_exit_time) return; delta_idle = cputime64_sub(now_idle, *cpu_time_in_idle); /* Scale up if there were no idle cycles since coming out of idle */ if (delta_idle == 0) { if (policy->cur == policy->max) return; if (nr_running() < 1) return; target_freq = policy->max; cpumask_set_cpu(data, &work_cpumask); queue_work(up_wq, &freq_scale_work); return; } /* * There is a window where if the cpu utlization can go from low to high * between the timer expiring, delta_idle will be > 0 and the cpu will * be 100% busy, preventing idle from running, and this timer from * firing. So setup another timer to fire to check cpu utlization. * Do not setup the timer if there is no scheduled work. */ t = &per_cpu(cpu_timer, data); if (!timer_pending(t) && nr_running() > 0) { *cpu_time_in_idle = get_cpu_idle_time_us( data, cpu_idle_exit_time); mod_timer(t, jiffies + 2); } if (policy->cur == policy->min) return; /* * Do not scale down unless we have been at this frequency for the * minimum sample time. */ if (cputime64_sub(update_time, freq_change_time) < min_sample_time) return; target_freq = policy->min; cpumask_set_cpu(data, &work_cpumask); queue_work(down_wq, &freq_scale_work);}
开发者ID:Aarush,项目名称:shardul-xperia-4.1.B.0.431,代码行数:63,
示例6: sclp_console_write/* * Writes the given message to S390 system console */static voidsclp_console_write(struct console *console, const char *message, unsigned int count){ unsigned long flags; void *page; int written; if (count == 0) return; spin_lock_irqsave(&sclp_con_lock, flags); /* * process escape characters, write message into buffer, * send buffer to SCLP */ do { /* make sure we have a console output buffer */ if (sclp_conbuf == NULL) { if (list_empty(&sclp_con_pages)) sclp_console_full++; while (list_empty(&sclp_con_pages)) { if (sclp_con_suspended) goto out; if (sclp_console_drop_buffer()) break; spin_unlock_irqrestore(&sclp_con_lock, flags); sclp_sync_wait(); spin_lock_irqsave(&sclp_con_lock, flags); } page = sclp_con_pages.next; list_del((struct list_head *) page); sclp_conbuf = sclp_make_buffer(page, sclp_con_columns, sclp_con_width_htab); } /* try to write the string to the current output buffer */ written = sclp_write(sclp_conbuf, (const unsigned char *) message, count); if (written == count) break; /* * Not all characters could be written to the current * output buffer. Emit the buffer, create a new buffer * and then output the rest of the string. */ spin_unlock_irqrestore(&sclp_con_lock, flags); sclp_conbuf_emit(); spin_lock_irqsave(&sclp_con_lock, flags); message += written; count -= written; } while (count > 0); /* Setup timer to output current console buffer after 1/10 second */ if (sclp_conbuf != NULL && sclp_chars_in_buffer(sclp_conbuf) != 0 && !timer_pending(&sclp_con_timer)) { init_timer(&sclp_con_timer); sclp_con_timer.function = sclp_console_timeout; sclp_con_timer.data = 0UL; sclp_con_timer.expires = jiffies + HZ/10; add_timer(&sclp_con_timer); }out: spin_unlock_irqrestore(&sclp_con_lock, flags);}
开发者ID:020gzh,项目名称:linux,代码行数:65,
示例7: nfulnl_log_packet//.........这里部分代码省略......... + nla_total_size(sizeof(u_int32_t)) /* ifindex */ + nla_total_size(sizeof(u_int32_t)) /* ifindex */#endif + nla_total_size(sizeof(u_int32_t)) /* mark */ + nla_total_size(sizeof(u_int32_t)) /* uid */ + nla_total_size(sizeof(u_int32_t)) /* gid */ + nla_total_size(plen) /* prefix */ + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)) + nla_total_size(sizeof(struct nfgenmsg)); /* NLMSG_DONE */ if (in && skb_mac_header_was_set(skb)) { size += nla_total_size(skb->dev->hard_header_len) + nla_total_size(sizeof(u_int16_t)) /* hwtype */ + nla_total_size(sizeof(u_int16_t)); /* hwlen */ } spin_lock_bh(&inst->lock); if (inst->flags & NFULNL_CFG_F_SEQ) size += nla_total_size(sizeof(u_int32_t)); if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) size += nla_total_size(sizeof(u_int32_t)); if (inst->flags & NFULNL_CFG_F_CONNTRACK) { nfnl_ct = rcu_dereference(nfnl_ct_hook); if (nfnl_ct != NULL) { ct = nfnl_ct->get_ct(skb, &ctinfo); if (ct != NULL) size += nfnl_ct->build_size(ct); } } qthreshold = inst->qthreshold; /* per-rule qthreshold overrides per-instance */ if (li->u.ulog.qthreshold) if (qthreshold > li->u.ulog.qthreshold) qthreshold = li->u.ulog.qthreshold; switch (inst->copy_mode) { case NFULNL_COPY_META: case NFULNL_COPY_NONE: data_len = 0; break; case NFULNL_COPY_PACKET: data_len = inst->copy_range; if ((li->u.ulog.flags & NF_LOG_F_COPY_LEN) && (li->u.ulog.copy_len < data_len)) data_len = li->u.ulog.copy_len; if (data_len > skb->len) data_len = skb->len; size += nla_total_size(data_len); break; case NFULNL_COPY_DISABLED: default: goto unlock_and_release; } if (inst->skb && size > skb_tailroom(inst->skb)) { /* either the queue len is too high or we don't have * enough room in the skb left. flush to userspace. */ __nfulnl_flush(inst); } if (!inst->skb) { inst->skb = nfulnl_alloc_skb(net, inst->peer_portid, inst->nlbufsiz, size); if (!inst->skb) goto alloc_failure; } inst->qlen++; __build_packet_message(log, inst, skb, data_len, pf, hooknum, in, out, prefix, plen, nfnl_ct, ct, ctinfo); if (inst->qlen >= qthreshold) __nfulnl_flush(inst); /* timer_pending always called within inst->lock, so there * is no chance of a race here */ else if (!timer_pending(&inst->timer)) { instance_get(inst); inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100); add_timer(&inst->timer); }unlock_and_release: spin_unlock_bh(&inst->lock); instance_put(inst); return;alloc_failure: /* FIXME: statistics */ goto unlock_and_release;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:101,
示例8: touchkey_interruptstatic irqreturn_t touchkey_interrupt(int irq, void *dev_id){ struct touchkey_i2c *tkey_i2c = dev_id; static const int ledCmd[] = {TK_CMD_LED_ON, TK_CMD_LED_OFF}; u8 data[3]; int ret; int retry = 10; int keycode_type = 0; int pressed; set_touchkey_debug('a'); retry = 3; while (retry--) { ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3); if (!ret) break; else { pr_debug("[TouchKey] i2c read failed, ret:%d, retry: %d/n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { pr_debug("[Touchkey] keycode_type err/n"); return IRQ_HANDLED; } if (pressed) { set_touchkey_debug('P'); // enable lights on keydown if (touch_led_disabled == 0) { if (touchkey_led_status == TK_CMD_LED_OFF) { pr_debug("[Touchkey] %s: keydown - LED ON/n", __func__); i2c_touchkey_write(tkey_i2c->client, (u8 *) &ledCmd[0], 1); touchkey_led_status = TK_CMD_LED_ON; } if (timer_pending(&touch_led_timer) == 1) { mod_timer(&touch_led_timer, jiffies + (HZ * touch_led_timeout)); } } } else { // touch led timeout on keyup if (touch_led_disabled == 0) { if (timer_pending(&touch_led_timer) == 0) { pr_debug("[Touchkey] %s: keyup - add_timer/n", __func__); touch_led_timer.expires = jiffies + (HZ * touch_led_timeout); add_timer(&touch_led_timer); } else { mod_timer(&touch_led_timer, jiffies + (HZ * touch_led_timeout)); } } } if (get_tsp_status() && pressed) pr_debug("[TouchKey] touchkey pressed but don't send event because touch is pressed./n"); else { input_report_key(tkey_i2c->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(tkey_i2c->input_dev);#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) pr_debug("[TouchKey] keycode:%d pressed:%d/n", touchkey_keycode[keycode_type], pressed);#else pr_debug("[TouchKey] pressed:%d/n", pressed);#endif #if defined(CONFIG_TARGET_LOCALE_KOR) if (g_debug_tkey == true) { pr_debug("[TouchKey] keycode[%d]=%d pressed:%d/n", keycode_type, touchkey_keycode[keycode_type], pressed); } else { pr_debug("[TouchKey] pressed:%d/n", pressed); } #endif } set_touchkey_debug('A'); return IRQ_HANDLED;}
开发者ID:belalang-tempur,项目名称:kernel_3.4_samsung_exynos4,代码行数:90,
示例9: rx_submit//.........这里部分代码省略......... case 0: if (skb->len < dev->net->hard_header_len) { state = rx_cleanup; dev->stats.rx_errors++; dev->stats.rx_length_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx length %d", skb->len); } break; // stalls need manual reset. this is rare ... except that // when going through USB 2.0 TTs, unplug appears this way. // we avoid the highspeed version of the ETIMEOUT/EILSEQ // storm, recovering as needed. case -EPIPE: dev->stats.rx_errors++; usbnet_defer_kevent (dev, EVENT_RX_HALT); // FALLTHROUGH // software-driven interface shutdown case -ECONNRESET: // async unlink case -ESHUTDOWN: // hardware gone if (netif_msg_ifdown (dev)) devdbg (dev, "rx shutdown, code %d", urb_status); goto block; // we get controller i/o faults during khubd disconnect() delays. // throttle down resubmits, to avoid log floods; just temporarily, // so we still recover when the fault isn't a khubd delay. case -EPROTO: case -ETIME: case -EILSEQ: dev->stats.rx_errors++; if (!timer_pending (&dev->delay)) { mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); if (netif_msg_link (dev)) devdbg (dev, "rx throttle %d", urb_status); }block: state = rx_cleanup; entry->urb = urb; urb = NULL; break; // data overrun ... flush fifo? case -EOVERFLOW: dev->stats.rx_over_errors++; // FALLTHROUGH default: state = rx_cleanup; dev->stats.rx_errors++; if (netif_msg_rx_err (dev)) devdbg (dev, "rx status %d", urb_status); break; } state = defer_bh(dev, skb, &dev->rxq, state); if (urb) { if (netif_running (dev->net) && !test_bit (EVENT_RX_HALT, &dev->flags) && state != unlink_start) { rx_submit (dev, urb, GFP_ATOMIC); return; }
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:67,
示例10: touchkey_led_controlstatic ssize_t touchkey_led_control(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){ struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev); int data; int ret; static const int ledCmd[] = {TK_CMD_LED_ON, TK_CMD_LED_OFF};#if defined(CONFIG_TARGET_LOCALE_KOR) if (touchkey_probe == false) return size;#endif ret = sscanf(buf, "%d", &data); if (ret != 1) { printk(KERN_DEBUG "[Touchkey] %s: %d err/n", __func__, __LINE__); return size; } if (data != 1 && data != 2) { printk(KERN_DEBUG "[Touchkey] %s: wrong cmd %x/n", __func__, data); return size; }#if defined(CONFIG_TARGET_LOCALE_NA) if (tkey_i2c->module_ver >= 8) data = ledCmd[data-1];#else data = ledCmd[data-1];#endif if (touch_led_disabled == 0) { ret = i2c_touchkey_write(tkey_i2c->client, (u8 *) &data, 1); } if(data == ledCmd[0]) { if (touch_led_disabled == 0) { if (timer_pending(&touch_led_timer) == 0) { pr_debug("[Touchkey] %s: add_timer/n", __func__); touch_led_timer.expires = jiffies + (HZ * touch_led_timeout); add_timer(&touch_led_timer); } else { mod_timer(&touch_led_timer, jiffies + (HZ * touch_led_timeout)); } } } else { if (timer_pending(&touch_led_timer) == 1) { pr_debug("[Touchkey] %s: del_timer/n", __func__); del_timer(&touch_led_timer); } } if (ret == -ENODEV) { pr_err("[Touchkey] error to write i2c/n"); touchled_cmd_reversed = 1; } pr_debug("[Touchkey] %s: touchkey_led_status=%d/n", __func__, data); touchkey_led_status = data; return size;}
开发者ID:belalang-tempur,项目名称:kernel_3.4_samsung_exynos4,代码行数:64,
示例11: tz_policy_check//.........这里部分代码省略......... */ previous_temperature = tz->policy.temperature; previous_state = tz->policy.state; /* * Get Temperature: * ---------------- */ status = tz_get_temperature(tz); if (ACPI_FAILURE(status)) { return_VOID; } /* * Calculate State: * ---------------- */ policy->state = TZ_STATE_OK; /* Critical? */ if (policy->temperature >= thresholds->critical.temperature) policy->state |= TZ_STATE_CRITICAL; /* Hot? */ if ((thresholds->hot.is_valid) && (policy->temperature >= thresholds->hot.temperature)) policy->state |= TZ_STATE_CRITICAL; /* Passive? */ if ((thresholds->passive.is_valid) && (policy->temperature >= thresholds->passive.temperature)) policy->state |= TZ_STATE_PASSIVE; /* Active? */ if (thresholds->active[0].is_valid) { for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) { if ((thresholds->active[i].is_valid) && (policy->temperature >= thresholds->active[i].temperature)) { policy->state |= TZ_STATE_ACTIVE; if (i > active_index) active_index = i; } } policy->state |= active_index; } /* * Invoke Policy: * -------------- * Note that policy must be invoked both when 'going into' a * policy state (e.g. to allow fans to be turned on) and 'going * out of' a policy state (e.g. to allow fans to be turned off); * thus we must preserve the previous state. */ if (policy->state & TZ_STATE_CRITICAL) tz_policy_critical(tz); if (policy->state & TZ_STATE_HOT) tz_policy_hot(tz); if ((policy->state & TZ_STATE_PASSIVE) || (previous_state & TZ_STATE_PASSIVE)) tz_policy_passive(tz); if ((policy->state & TZ_STATE_ACTIVE) || (previous_state & TZ_STATE_ACTIVE)) tz_policy_active(tz); /* * Calculate Sleep Time: * --------------------- * If we're in the passive state, use _TSP's value. Otherwise * use _TZP or the OS's default polling frequency. If no polling * frequency is specified then we'll wait forever (that is, until * a thermal event occurs -- e.g. never poll). Note that _TSP * and _TZD values are given in 1/10th seconds. */ if (policy->state & TZ_STATE_PASSIVE) sleep_time = thresholds->passive.tsp * 100; else if (policy->polling_freq > 0) sleep_time = policy->polling_freq * 100; else sleep_time = WAIT_FOREVER; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Thermal_zone[%02x]: temperature[%d] state[%08x]/n", tz->device_handle, policy->temperature, policy->state)); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling next poll in [%d]ms./n", sleep_time)); /* * Schedule Next Poll: * ------------------- */ if (sleep_time < WAIT_FOREVER) { if (timer_pending(&(policy->timer))) mod_timer(&(policy->timer), (HZ*sleep_time)/1000); else { policy->timer.data = (unsigned long)tz; policy->timer.function = tz_policy_run; policy->timer.expires = jiffies + (HZ*sleep_time)/1000; add_timer(&(policy->timer)); } } else { if (timer_pending(&(policy->timer))) del_timer(&(policy->timer)); } return_VOID;}
开发者ID:huangyukun2012,项目名称:linux-2.4.21,代码行数:101,
示例12: _mali_osk_timer_pendingmali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim){ MALI_DEBUG_ASSERT_POINTER(tim); return 1 == timer_pending(&(tim->timer));}
开发者ID:CM13-HI6210SFT,项目名称:hisi_kernel_3.10.86_hi6210sft,代码行数:5,
示例13: via_dmablit_handlervoidvia_dmablit_handler(drm_device_t *dev, int engine, int from_irq){ drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; int cur; int done_transfer; unsigned long irqsave=0; uint32_t status = 0; DRM_DEBUG("DMA blit handler called. engine = %d, from_irq = %d, blitq = 0x%lx/n", engine, from_irq, (unsigned long) blitq); if (from_irq) { spin_lock(&blitq->blit_lock); } else { spin_lock_irqsave(&blitq->blit_lock, irqsave); } done_transfer = blitq->is_active && (( status = VIA_READ(VIA_PCI_DMA_CSR0 + engine*0x04)) & VIA_DMA_CSR_TD); done_transfer = done_transfer || ( blitq->aborting && !(status & VIA_DMA_CSR_DE)); cur = blitq->cur; if (done_transfer) { blitq->blits[cur]->aborted = blitq->aborting; blitq->done_blit_handle++; DRM_WAKEUP(blitq->blit_queue + cur); cur++; if (cur >= VIA_NUM_BLIT_SLOTS) cur = 0; blitq->cur = cur; /* * Clear transfer done flag. */ VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_TD); blitq->is_active = 0; blitq->aborting = 0; schedule_work(&blitq->wq); } else if (blitq->is_active && time_after_eq(jiffies, blitq->end)) { /* * Abort transfer after one second. */ via_abort_dmablit(dev, engine); blitq->aborting = 1; blitq->end = jiffies + DRM_HZ; } if (!blitq->is_active) { if (blitq->num_outstanding) { via_fire_dmablit(dev, blitq->blits[cur], engine); blitq->is_active = 1; blitq->cur = cur; blitq->num_outstanding--; blitq->end = jiffies + DRM_HZ; if (!timer_pending(&blitq->poll_timer)) { blitq->poll_timer.expires = jiffies+1; add_timer(&blitq->poll_timer); } } else { if (timer_pending(&blitq->poll_timer)) { del_timer(&blitq->poll_timer); } via_dmablit_engine_off(dev, engine); } } if (from_irq) { spin_unlock(&blitq->blit_lock); } else { spin_unlock_irqrestore(&blitq->blit_lock, irqsave); }}
开发者ID:Ionic,项目名称:nx-libs,代码行数:81,
示例14: dccp_sendmsgint dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len){ const struct dccp_sock *dp = dccp_sk(sk); const int flags = msg->msg_flags; const int noblock = flags & MSG_DONTWAIT; struct sk_buff *skb; int rc, size; long timeo; if (len > dp->dccps_mss_cache) return -EMSGSIZE; lock_sock(sk); if (dccp_qpolicy_full(sk)) { rc = -EAGAIN; goto out_release; } timeo = sock_sndtimeo(sk, noblock); /* * We have to use sk_stream_wait_connect here to set sk_write_pending, * so that the trick in dccp_rcv_request_sent_state_process. */ /* Wait for a connection to finish. */ if ((1 << sk->sk_state) & ~(DCCPF_OPEN | DCCPF_PARTOPEN)) if ((rc = sk_stream_wait_connect(sk, &timeo)) != 0) goto out_release; size = sk->sk_prot->max_header + len; release_sock(sk); skb = sock_alloc_send_skb(sk, size, noblock, &rc); lock_sock(sk); if (skb == NULL) goto out_release; skb_reserve(skb, sk->sk_prot->max_header); rc = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); if (rc != 0) goto out_discard; rc = dccp_msghdr_parse(msg, skb); if (rc != 0) goto out_discard; dccp_qpolicy_push(sk, skb); /* * The xmit_timer is set if the TX CCID is rate-based and will expire * when congestion control permits to release further packets into the * network. Window-based CCIDs do not use this timer. */ if (!timer_pending(&dp->dccps_xmit_timer)) dccp_write_xmit(sk);out_release: release_sock(sk); return rc ? : len;out_discard: kfree_skb(skb); goto out_release;}
开发者ID:daltenty,项目名称:kernel-ubuntu.trusty-vgt,代码行数:62,
示例15: print_request_statsstatic int print_request_stats (threadinfo_t *ti, char *page, unsigned int skip_count, unsigned int max_count){ struct list_head *head, *curr; tux_req_t *req; unsigned int count = 0, size, line_off, len; char stat_line [LINE_SIZE]; if (!max_count) BUG(); head = &ti->all_requests; curr = head->next; while (curr != head) { req = list_entry(curr, tux_req_t, all); curr = curr->next; count++; if (count <= skip_count) continue; line_off = 0;#define SP(x...) / line_off += sprintf(stat_line + line_off, x) if (req->proto == &tux_proto_http) SP("0 "); else SP("1 "); SP("%p ", req); SP("%d ", req->atom_idx); if (req->atom_idx >= 1) SP("%p ", req->atoms[0]); else SP("........ "); if (req->atom_idx >= 2) SP("%p ", req->atoms[1]); else SP("........ "); if (!list_empty(&req->work)) SP("W"); else SP("."); if (!list_empty(&req->free)) SP("F"); else SP("."); if (!list_empty(&req->lru)) SP("L"); else SP("."); if (req->keep_alive) SP("K"); else SP("."); if (req->idle_input) SP("I"); else SP("."); if (timer_pending(&req->keepalive_timer)) SP("T(%lu/%lu)",jiffies,req->keepalive_timer.expires); else SP("."); if (req->wait_output_space) SP("O"); else SP("."); if (timer_pending(&req->output_timer)) SP("T"); else SP("."); SP(" %d ", req->error); SP(" %d ", req->status);#define SP_HOST(ip,port) / SP("%d.%d.%d.%d:%d ",NIPQUAD(ip),port) if (req->sock) { if (req->sock->sk) SP("%d:", req->sock->sk->sk_state); else SP("-2:"); } else SP("-1:"); SP_HOST(req->client_addr, req->client_port); SP("%Ld ", req->total_file_len); SP("%Ld ", req->in_file ? req->in_file->f_pos : -1); if (req->proto == &tux_proto_http) { SP("%d ", req->method); SP("%d ", req->version); } if (req->proto == &tux_proto_ftp) { SP("%d ", req->ftp_command); if (req->data_sock) { if (req->data_sock->sk) SP("%d:",req->data_sock->sk->sk_state); else SP("-2:"); if (req->data_sock->sk) SP_HOST(inet_sk(req->data_sock->sk)->daddr, inet_sk(req->data_sock->sk)->dport); else SP("-1:-1 "); } else SP("-1 "); } SP("%p/%p %p/%p ", req->sock, req->sock ? req->sock->sk : (void *)-1, req->data_sock, req->data_sock ? req->data_sock->sk : (void *)-1); SP("%d/n", req->parsed_len); len = req->headers_len; if (len > 500) len = 500; SP("/n%d/n", len); memcpy(stat_line + line_off, req->headers, len); line_off += len; len = req->objectname_len; if (len > 100) len = 100; SP("/n%d/n", len); memcpy(stat_line + line_off, req->objectname, len); line_off += len; SP("/n/n<END>");//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:101,
示例16: dbg_status_printstatic int dbg_status_print(struct seq_file *s, void *p){ struct ap9540_c2c *c2c = (struct ap9540_c2c *) s->private; struct c2c_genio *genio; int i , j; if (c2c == NULL) { seq_printf(s, "No C2C device avaiable/n"); return 0; } seq_printf(s, "Subscribed GENI/GENOs:/n"); seq_printf(s, "- setter 0x%08X getter 0x%08X irq1 0x%08X/n", c2c->setter_mask, c2c->getter_mask, c2c->irq1_mask); ; for (i = 0, j = 0, genio = c2c->genio; i < 31; i++, genio++) { if (genio->mask == 0) continue; seq_printf(s, "- bit %02d : %s, timeout:%d, pending:%d, " "event_cb:%p, cnt:%d/n", i, (genio->mask & c2c->setter_mask) ? "Fast-Setter" : (genio->mask & c2c->getter_mask) ? "Fast-Getter" : (genio->mask & c2c->irq1_mask) ? "Irq1-Getter" : "unknown", genio->poll_timeout, genio->pending, genio->event_cb, genio->hs_cnt); j++; } if (j == 0) seq_printf(s, "- no pending set bit, no subscribed bit./n"); seq_printf(s, "/n"); seq_printf(s, "Powerup timeout: trigged=%s armed=%s, pending=%s, " "timer-ms=%d/n", (c2c->powerup_timeout) ? "Yes" : "No", (c2c->powerup_timeout_armed) ? "Yes" : "No", (timer_pending(&c2c->powerup_timer)) ? "Yes" : "No", c2c->powerup_timeout_ms); seq_printf(s, "Misc: init=%04X reset=%d prot_evt=%d pwr_is_on=%d " "pwr_last_req=%d/n", c2c->init_flags, c2c->reset_flag, c2c->protection_event, c2c->pwr_is_on, c2c->pwr_last_req); seq_printf(s, "/n"); seq_printf(s, "C2C Registers:/n"); if (c2c->pwr_is_on) { seq_printf(s, "- wake_req %d wake_ack %d standby %d " "standby_in %d wait %d/n", readl(c2c_dev->c2c_base + C2COFF_WAKE_REQ), readl(c2c_dev->c2c_base + C2COFF_WAKE_ACK), readl(c2c_dev->c2c_base + C2COFF_STANDBY), readl(c2c_dev->c2c_base + C2COFF_STANDBY_IN), readl(c2c_dev->c2c_base + C2COFF_WAIT)); seq_printf(s, "- fclk_freq %-4d rx_max %-4d " "tx_max %-4d rx_max_ack %-4d/n", readl(c2c_dev->c2c_base + C2COFF_FCLK_FREQ), readl(c2c_dev->c2c_base + C2COFF_RX_MAX_FREQ), readl(c2c_dev->c2c_base + C2COFF_TX_MAX_FREQ), readl(c2c_dev->c2c_base + C2COFF_RX_MAX_FREQ_ACK)); seq_printf(s, "- portconfig 0x%04X mirrormode %d/n", readl(c2c_dev->c2c_base + C2COFF_PORTCONFIG), readl(c2c_dev->c2c_base + C2COFF_MIRRORMODE)); seq_printf(s, "- irq_raw_st_0 0x%08X irq_raw_st_1 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_IRQ_RAW_STATUS_0), readl(c2c_dev->c2c_base + C2COFF_IRQ_RAW_STATUS_1)); seq_printf(s, "- irq_status_0 0x%08X irq_status_1 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_STATUS_0), readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_STATUS_1)); seq_printf(s, "- irq_set_0 0x%08X irq_set_1 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_SET_0), readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_SET_1)); seq_printf(s, "- irq_clear_0 0x%08X irq_clear_1 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_CLEAR_0), readl(c2c_dev->c2c_base + C2COFF_IRQ_ENABLE_CLEAR_1)); seq_printf(s, "- geni_control 0x%08X geni_mask 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_GENI_CONTROL), readl(c2c_dev->c2c_base + C2COFF_GENI_MASK)); seq_printf(s, "- geno_status 0x%08X geno_interr. 0x%08X " "geno_level 0x%08X/n", readl(c2c_dev->c2c_base + C2COFF_GENO_STATUS), readl(c2c_dev->c2c_base + C2COFF_GENO_INTERRUPT), readl(c2c_dev->c2c_base + C2COFF_GENO_LEVEL)); } else { seq_printf(s, "- can't access C2C IP: not sure it is 'On'/n"); } seq_printf(s, "/n"); seq_printf(s, "PRCM Registers/n"); seq_printf(s, "- a9_geno_mask 0x%08X geni_val 0x%08X geno 0x%08X/n", readl(c2c_dev->prcm_base + PRCMOFF_A9_C2C_GENO_MASK_VAL), readl(c2c_dev->prcm_base + PRCMOFF_C2C_SSCM_GENI_VAL), readl(c2c_dev->prcm_base + PRCMOFF_C2C_SSCM_GENO)); return 0;}
开发者ID:Abhinav1997,项目名称:android_kernel_snda_u8500,代码行数:90,
示例17: ace_fsm_dostatestatic void ace_fsm_dostate(struct ace_device *ace){ struct request *req; u32 status; u16 val; int count;#if defined(DEBUG) dev_dbg(ace->dev, "fsm_state=%i, id_req_count=%i/n", ace->fsm_state, ace->id_req_count);#endif /* */ status = ace_in32(ace, ACE_STATUS); if ((status & ACE_STATUS_CFDETECT) == 0) { ace->fsm_state = ACE_FSM_STATE_IDLE; ace->media_change = 1; set_capacity(ace->gd, 0); dev_info(ace->dev, "No CF in slot/n"); /* */ if (ace->req) { __blk_end_request_all(ace->req, -EIO); ace->req = NULL; } while ((req = blk_fetch_request(ace->queue)) != NULL) __blk_end_request_all(req, -EIO); /* */ ace->fsm_state = ACE_FSM_STATE_IDLE; ace->id_result = -EIO; while (ace->id_req_count) { complete(&ace->id_completion); ace->id_req_count--; } } switch (ace->fsm_state) { case ACE_FSM_STATE_IDLE: /* */ if (ace->id_req_count || ace_get_next_request(ace->queue)) { ace->fsm_iter_num++; ace->fsm_state = ACE_FSM_STATE_REQ_LOCK; mod_timer(&ace->stall_timer, jiffies + HZ); if (!timer_pending(&ace->stall_timer)) add_timer(&ace->stall_timer); break; } del_timer(&ace->stall_timer); ace->fsm_continue_flag = 0; break; case ACE_FSM_STATE_REQ_LOCK: if (ace_in(ace, ACE_STATUS) & ACE_STATUS_MPULOCK) { /* */ ace->fsm_state = ACE_FSM_STATE_WAIT_CFREADY; break; } /* */ val = ace_in(ace, ACE_CTRL); ace_out(ace, ACE_CTRL, val | ACE_CTRL_LOCKREQ); ace->fsm_state = ACE_FSM_STATE_WAIT_LOCK; break; case ACE_FSM_STATE_WAIT_LOCK: if (ace_in(ace, ACE_STATUS) & ACE_STATUS_MPULOCK) { /* */ ace->fsm_state = ACE_FSM_STATE_WAIT_CFREADY; break; } /* */ ace_fsm_yield(ace); break; case ACE_FSM_STATE_WAIT_CFREADY: status = ace_in32(ace, ACE_STATUS); if (!(status & ACE_STATUS_RDYFORCFCMD) || (status & ACE_STATUS_CFBSY)) { /* */ ace_fsm_yield(ace); break; } /* */ if (ace->id_req_count) ace->fsm_state = ACE_FSM_STATE_IDENTIFY_PREPARE; else ace->fsm_state = ACE_FSM_STATE_REQ_PREPARE; break; case ACE_FSM_STATE_IDENTIFY_PREPARE: /* */ ace->fsm_task = ACE_TASK_IDENTIFY; ace->data_ptr = ace->cf_id; ace->data_count = ACE_BUF_PER_SECTOR; ace_out(ace, ACE_SECCNTCMD, ACE_SECCNTCMD_IDENTIFY);//.........这里部分代码省略.........
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:101,
示例18: jpeg_device_dec_runstatic void jpeg_device_dec_run(void *priv){ struct jpeg_ctx *ctx = priv; struct jpeg_dev *dev = ctx->dev; struct jpeg_dec_param dec_param; struct vb2_buffer *vb = NULL; unsigned long flags; dev = ctx->dev; spin_lock_irqsave(&ctx->slock, flags); printk(KERN_DEBUG "dec_run./n"); if (timer_pending(&ctx->dev->watchdog_timer) == 0) { ctx->dev->watchdog_timer.expires = jiffies + msecs_to_jiffies(JPEG_WATCHDOG_INTERVAL); add_timer(&ctx->dev->watchdog_timer); } set_bit(0, &ctx->dev->hw_run); dev->mode = DECODING; dec_param = ctx->param.dec_param; jpeg_sw_reset(dev->reg_base); jpeg_set_interrupt(dev->reg_base); jpeg_set_encode_tbl_select(dev->reg_base, 0); vb = v4l2_m2m_next_src_buf(ctx->m2m_ctx); jpeg_set_stream_buf_address(dev->reg_base, dev->vb2->plane_addr(vb, 0)); vb = v4l2_m2m_next_dst_buf(ctx->m2m_ctx); if (dec_param.out_plane == 1) jpeg_set_frame_buf_address(dev->reg_base, dec_param.out_fmt, dev->vb2->plane_addr(vb, 0), 0, 0); else if (dec_param.out_plane == 2) { jpeg_set_frame_buf_address(dev->reg_base, dec_param.out_fmt, dev->vb2->plane_addr(vb, 0), dev->vb2->plane_addr(vb, 1), 0); } else if (dec_param.out_plane == 3) jpeg_set_frame_buf_address(dev->reg_base, dec_param.out_fmt, dev->vb2->plane_addr(vb, 0), dev->vb2->plane_addr(vb, 1), dev->vb2->plane_addr(vb, 2)); if (dec_param.out_width > 0 && dec_param.out_height > 0) { if ((dec_param.out_width * 2 == dec_param.in_width) && (dec_param.out_height * 2 == dec_param.in_height)) jpeg_set_dec_scaling(dev->reg_base, JPEG_SCALE_2, JPEG_SCALE_2); else if ((dec_param.out_width * 4 == dec_param.in_width) && (dec_param.out_height * 4 == dec_param.in_height)) jpeg_set_dec_scaling(dev->reg_base, JPEG_SCALE_4, JPEG_SCALE_4); else jpeg_set_dec_scaling(dev->reg_base, JPEG_SCALE_NORMAL, JPEG_SCALE_NORMAL); } jpeg_set_dec_out_fmt(dev->reg_base, dec_param.out_fmt); jpeg_set_dec_bitstream_size(dev->reg_base, dec_param.size); jpeg_set_enc_dec_mode(dev->reg_base, DECODING); spin_unlock_irqrestore(&ctx->slock, flags);}
开发者ID:Thinkware-Device,项目名称:willow,代码行数:62,
示例19: rose_t0timer_runningstatic int rose_t0timer_running(struct rose_neigh *neigh){ return timer_pending(&neigh->t0timer);}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:4,
示例20: lapb_t1timer_runningint lapb_t1timer_running(struct lapb_cb *lapb){ return timer_pending(&lapb->t1timer);}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:4,
示例21: hfc4s8s_bhstatic voidhfc4s8s_bh(struct work_struct *work){ hfc4s8s_hw *hw = container_of(work, hfc4s8s_hw, tqueue); u_char b; struct hfc4s8s_l1 *l1p; volatile u_char *fifo_stat; int idx; /* handle layer 1 state changes */ b = 1; l1p = hw->l1; while (b) { if ((b & hw->mr.r_irq_statech)) { /* reset l1 event */ hw->mr.r_irq_statech &= ~b; if (l1p->enabled) { if (l1p->nt_mode) { u_char oldstate = l1p->l1_state; Write_hfc8(l1p->hw, R_ST_SEL, l1p->st_num); l1p->l1_state = Read_hfc8(l1p->hw, A_ST_RD_STA) & 0xf; if ((oldstate == 3) && (l1p->l1_state != 3)) l1p->d_if.ifc.l1l2(&l1p-> d_if. ifc, PH_DEACTIVATE | INDICATION, NULL); if (l1p->l1_state != 2) { del_timer(&l1p->l1_timer); if (l1p->l1_state == 3) { l1p->d_if.ifc. l1l2(&l1p-> d_if.ifc, PH_ACTIVATE | INDICATION, NULL); } } else { /* allow transition */ Write_hfc8(hw, A_ST_WR_STA, M_SET_G2_G3); mod_timer(&l1p->l1_timer, jiffies + L1_TIMER_T1); } printk(KERN_INFO "HFC-4S/8S: NT ch %d l1 state %d -> %d/n", l1p->st_num, oldstate, l1p->l1_state); } else { u_char oldstate = l1p->l1_state; Write_hfc8(l1p->hw, R_ST_SEL, l1p->st_num); l1p->l1_state = Read_hfc8(l1p->hw, A_ST_RD_STA) & 0xf; if (((l1p->l1_state == 3) && ((oldstate == 7) || (oldstate == 8))) || ((timer_pending (&l1p->l1_timer)) && (l1p->l1_state == 8))) { mod_timer(&l1p->l1_timer, L1_TIMER_T4 + jiffies); } else { if (l1p->l1_state == 7) { del_timer(&l1p-> l1_timer); l1p->d_if.ifc. l1l2(&l1p-> d_if.ifc, PH_ACTIVATE | INDICATION, NULL); tx_d_frame(l1p); } if (l1p->l1_state == 3) { if (oldstate != 3) l1p->d_if. ifc. l1l2 (&l1p-> d_if. ifc, PH_DEACTIVATE |//.........这里部分代码省略.........
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:101,
示例22: xenvif_read_io_ringstatic int xenvif_read_io_ring(struct seq_file *m, void *v){ struct xenvif_queue *queue = m->private; struct xen_netif_tx_back_ring *tx_ring = &queue->tx; struct xen_netif_rx_back_ring *rx_ring = &queue->rx; struct netdev_queue *dev_queue; if (tx_ring->sring) { struct xen_netif_tx_sring *sring = tx_ring->sring; seq_printf(m, "Queue %d/nTX: nr_ents %u/n", queue->id, tx_ring->nr_ents); seq_printf(m, "req prod %u (%d) cons %u (%d) event %u (%d)/n", sring->req_prod, sring->req_prod - sring->rsp_prod, tx_ring->req_cons, tx_ring->req_cons - sring->rsp_prod, sring->req_event, sring->req_event - sring->rsp_prod); seq_printf(m, "rsp prod %u (base) pvt %u (%d) event %u (%d)/n", sring->rsp_prod, tx_ring->rsp_prod_pvt, tx_ring->rsp_prod_pvt - sring->rsp_prod, sring->rsp_event, sring->rsp_event - sring->rsp_prod); seq_printf(m, "pending prod %u pending cons %u nr_pending_reqs %u/n", queue->pending_prod, queue->pending_cons, nr_pending_reqs(queue)); seq_printf(m, "dealloc prod %u dealloc cons %u dealloc_queue %u/n/n", queue->dealloc_prod, queue->dealloc_cons, queue->dealloc_prod - queue->dealloc_cons); } if (rx_ring->sring) { struct xen_netif_rx_sring *sring = rx_ring->sring; seq_printf(m, "RX: nr_ents %u/n", rx_ring->nr_ents); seq_printf(m, "req prod %u (%d) cons %u (%d) event %u (%d)/n", sring->req_prod, sring->req_prod - sring->rsp_prod, rx_ring->req_cons, rx_ring->req_cons - sring->rsp_prod, sring->req_event, sring->req_event - sring->rsp_prod); seq_printf(m, "rsp prod %u (base) pvt %u (%d) event %u (%d)/n/n", sring->rsp_prod, rx_ring->rsp_prod_pvt, rx_ring->rsp_prod_pvt - sring->rsp_prod, sring->rsp_event, sring->rsp_event - sring->rsp_prod); } seq_printf(m, "NAPI state: %lx NAPI weight: %d TX queue len %u/n" "Credit timer_pending: %d, credit: %lu, usec: %lu/n" "remaining: %lu, expires: %lu, now: %lu/n", queue->napi.state, queue->napi.weight, skb_queue_len(&queue->tx_queue), timer_pending(&queue->credit_timeout), queue->credit_bytes, queue->credit_usec, queue->remaining_credit, queue->credit_timeout.expires, jiffies); dev_queue = netdev_get_tx_queue(queue->vif->dev, queue->id); seq_printf(m, "/nRx internal queue: len %u max %u pkts %u %s/n", queue->rx_queue_len, queue->rx_queue_max, skb_queue_len(&queue->rx_queue), netif_tx_queue_stopped(dev_queue) ? "stopped" : "running"); return 0;}
开发者ID:Chong-Li,项目名称:cse522,代码行数:75,
示例23: ipt_acct_handle//.........这里部分代码省略......... dport = ntohs (tcp_header->dest); } else if (ip_header->protocol == IPPROTO_UDP) { struct udphdr tmp_udph, *udp_header; udp_header = skb_header_pointer (skb, ip_header->ihl * 4, sizeof (tmp_udph), &tmp_udph); if (!udp_header) return info->critical_p ? info->retcode : NF_DROP; sport = ntohs (udp_header->source); dport = ntohs (udp_header->dest); } else { sport = 0; dport = 0; } proto = ip_header->protocol; src = ip_header->saddr; dst = ip_header->daddr; size = ntohs (ip_header->tot_len); if (info->header_p) { size += info->header; } else {#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 5, 0) size += sizeof (*skb->mac.ethernet);#else size += skb->mac_len;#endif } i = HASH (src, dst, sport, dport, proto, info->magic) % nlayers; spin_lock_bh (&hash_table_lock); for (item = layers[i]; item; item = item->next) if (item->record->src == src && item->record->dst == dst && item->record->sport == sport && item->record->dport == dport && item->record->proto == proto && item->record->magic == info->magic) break; if (!item) { if (!free_item) ipt_acct_dump_records (0); if (!free_item) { spin_lock_bh (&stat_lock); if (info->critical_p) pkts_not_accted += 1; else pkts_dropped += 1; spin_unlock_bh (&stat_lock); spin_unlock_bh (&hash_table_lock); return info->critical_p ? info->retcode : NF_DROP; } item = free_item; item->record = free_record; if (++free_item == acct_item_pool + max_records) free_item = NULL; ++free_record; item->next = layers[i]; layers[i] = item; item->record->src = src; item->record->dst = dst; item->record->sport = sport; item->record->dport = dport; item->record->proto = proto; item->record->npkts = 0; item->record->size = 0; item->record->first = get_seconds (); item->record->magic = info->magic; } item->record->npkts += 1; item->record->size += size; item->record->last = get_seconds (); spin_lock_bh (&stat_lock); if (pkts_accted == 0) startup_ts = item->record->last; pkts_accted += 1; spin_unlock_bh (&stat_lock); if (timeout > 0 && !timer_pending (&dump_timer)) { dump_timer.expires = jiffies + timeout * HZ; add_timer (&dump_timer); } spin_unlock_bh (&hash_table_lock); return info->retcode;}
开发者ID:BackupTheBerlios,项目名称:ipt-acct-svn,代码行数:101,
示例24: ipt_ulog_packet//.........这里部分代码省略......... copy_len = loginfo->copy_range; size = NLMSG_SPACE(sizeof(*pm) + copy_len); ub = &ulog_buffers[groupnum]; spin_lock_bh(&ulog_lock); if (!ub->skb) { if (!(ub->skb = ulog_alloc_skb(size))) goto alloc_failure; } else if (ub->qlen >= loginfo->qthreshold || size > skb_tailroom(ub->skb)) { /* either the queue len is too high or we don't have * enough room in nlskb left. send it to userspace. */ ulog_send(groupnum); if (!(ub->skb = ulog_alloc_skb(size))) goto alloc_failure; } pr_debug("qlen %d, qthreshold %Zu/n", ub->qlen, loginfo->qthreshold); /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, sizeof(*pm)+copy_len); ub->qlen++; pm = NLMSG_DATA(nlh); /* We might not have a timestamp, get one */ if (skb->tstamp.tv64 == 0) __net_timestamp((struct sk_buff *)skb); /* copy hook, prefix, timestamp, payload, etc. */ pm->data_len = copy_len; tv = ktime_to_timeval(skb->tstamp); put_unaligned(tv.tv_sec, &pm->timestamp_sec); put_unaligned(tv.tv_usec, &pm->timestamp_usec); put_unaligned(skb->mark, &pm->mark); pm->hook = hooknum; if (prefix != NULL) strncpy(pm->prefix, prefix, sizeof(pm->prefix)); else if (loginfo->prefix[0] != '/0') strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix)); else *(pm->prefix) = '/0'; if (in && in->hard_header_len > 0 && skb->mac_header != skb->network_header && in->hard_header_len <= ULOG_MAC_LEN) { memcpy(pm->mac, skb_mac_header(skb), in->hard_header_len); pm->mac_len = in->hard_header_len; } else pm->mac_len = 0; if (in) strncpy(pm->indev_name, in->name, sizeof(pm->indev_name)); else pm->indev_name[0] = '/0'; if (out) strncpy(pm->outdev_name, out->name, sizeof(pm->outdev_name)); else pm->outdev_name[0] = '/0'; /* copy_len <= skb->len, so can't fail. */ if (skb_copy_bits(skb, 0, pm->payload, copy_len) < 0) BUG(); /* check if we are building multi-part messages */ if (ub->qlen > 1) ub->lastnlh->nlmsg_flags |= NLM_F_MULTI; ub->lastnlh = nlh; /* if timer isn't already running, start it */ if (!timer_pending(&ub->timer)) { ub->timer.expires = jiffies + flushtimeout * HZ / 100; add_timer(&ub->timer); } /* if threshold is reached, send message to userspace */ if (ub->qlen >= loginfo->qthreshold) { if (loginfo->qthreshold > 1) nlh->nlmsg_type = NLMSG_DONE; ulog_send(groupnum); } spin_unlock_bh(&ulog_lock); return;nlmsg_failure: pr_debug("error during NLMSG_PUT/n");alloc_failure: pr_debug("Error building netlink message/n"); spin_unlock_bh(&ulog_lock);}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:101,
示例25: nr_loopback_runningstatic inline int nr_loopback_running(void){ return timer_pending(&loopback_timer);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:4,
注:本文中的timer_pending函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ timer_printf函数代码示例 C++ timer_irq_handler函数代码示例 |