国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

linux_Ultra的個人空間 http://m.qingdxww.cn/space-uid-2909.html [收藏] [復制] [RSS]

博客

device iterator

已有 3115 次閱讀2010-4-18 17:44 |

還是得用Google的.com啊。
//--------------------drivers/base/Bus.c----------------------------------
....
.....
/**
 * bus_for_each_dev - device iterator.
 * @bus: bus type.
 * @start: device to start iterating from.
 * @data: data for the callback.
 * @fn: function to be called for each device.
 *
 * Iterate over @bus's list of devices, and call @fn for each,
 * passing it @data. If @start is not NULL, we use that device to
 * begin iterating from.
 *
 * We check the return of @fn each time. If it returns anything
 * other than 0, we break out and return that value.
 *
 * NOTE: The device that returns a non-zero value is not retained
 * in any way, nor is its refcount incremented. If the caller needs
 * to retain this data, it should do so, and increment the reference
 * count in the supplied callback.
 */
int bus_for_each_dev(struct bus_type *bus, struct device *start,
             void *data, int (*fn)(struct device *, void *))
{
    struct klist_iter i;
    struct device *dev;
    int error = 0;

    if (!bus)
        return -EINVAL;

    klist_iter_init_node(&bus->p->klist_devices, &i,
                 (start ? &start->p->knode_bus : NULL));
    while ((dev = next_device(&i)) && !error)
        error = fn(dev, data);
    klist_iter_exit(&i);
    return error;
}
-----------------------------------------------------------------------------------------------------
C/Iterators
The problem

Suppose we have an abstract data type that represents some sort of container, such as a list or dictionary. We'd like to be able to do something to every element of the container; say, count them up. How can we write operations on the abstract data type to allow this, without exposing the implementation?

To make the problem more concrete, let's suppose we have an abstract data type that represents the set of all non-negative numbers less than some fixed bound. The core of its interface might look like this:

nums.h

function isnumbered(obj) { return obj.childNodes.length && obj.firstChild.childNodes.length && obj.firstChild.firstChild.className == 'LineNumber'; } function nformat(num,chrs,add) { var nlen = Math.max(0,chrs-(''+num).length), res = ''; while (nlen>0) { res += ' '; nlen-- } return res+num+add; } function addnumber(did, nstart, nstep) { var c = document.getElementById(did), l = c.firstChild, n = 1; if (!isnumbered(c)) if (typeof nstart == 'undefined') nstart = 1; if (typeof nstep == 'undefined') nstep = 1; n = nstart; while (l != null) { if (l.tagName == 'SPAN') { var s = document.createElement('SPAN'); s.className = 'LineNumber' s.appendChild(document.createTextNode(nformat(n,4,' '))); n += nstep; if (l.childNodes.length)

路過

雞蛋

鮮花

握手

雷人

發表評論 評論 (1 個評論)

facelist

您需要登錄后才可以評論 登錄 | 立即注冊

關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
返回頂部
主站蜘蛛池模板: 另类五月天 | 欧美成人免费tv在线播放 | 日本一区二区三区精品视频 | 免费精品在线观看 | 欧美三级在线观看不卡视频 | 天天干天操| 欧美v亚洲 | 国产情趣酒店鸳鸯浴在线观看 | h在线免费观看 | 日本韩国一区 | 99久久精品国产高清一区二区 | 有人有在线观看的片吗www | 成人黄色在线播放 | 国产精品久久久久久影院 | 99精品视频免费在线观看 | 国产欧美日韩一区二区三区视频 | 四虎黄色片 | 2022国内精品免费福利视频 | 日韩精品一区二区三区视频网 | 日韩伦理片免费在线观看 | 嫩草成人影院 | 最新一本大道香蕉综合 | 四虎成人永久地址 | 特级aaa毛片 | 日韩欧美在线视频一区二区 | 国产欧美亚洲专区第一页 | 国产swag在线| 亚洲欧美综合在线观看 | 久久香蕉国产线看观看亚洲卡 | 欧美一区二区三区四区五区六区 | 青草视频在线观看免费资源 | 两个人的视频在线观看 | 亚洲欧美日韩在线精品一区二区 | 成 人 黄 色 视频免费播放 | 色男人的天堂久久综合 | 一级做a爰片久久毛片16 | 91免费视频播放 | se天堂 | 国内精品国语自产拍在线观看91 | 亚洲精品tv久久久久久久久久 | 在线视频一区二区三区三区不卡 |