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

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

博客

device iterator

已有 3099 次閱讀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
返回頂部
主站蜘蛛池模板: 国产成人欧美一区二区三区vr | 国产成人黄网址在线视频 | 国产高清a| 一本大道久久香蕉成人网 | 狠狠色丁香婷婷综合久久来 | 亚洲成年人网 | 黑人视频在线观看 | 国产麻豆免费视频 | 国产肉丝 | 毛片网站在线播放 | 亚洲国产精品一区二区第四页 | fc2ppv在线播放| 午夜欧美性视频在线播放 | 免费视频久久看 | 狠狠色丁香久久婷婷 | 视频在线国产 | 韩国毛片基地 | 欧美视频高清在线观看 | 国产成人亚洲毛片 | 99久久精品久久久久久清纯 | 天天操天天干天天舔 | 九九视频只有精品 | 国产精品免费久久久免费 | 91在线看视频 | 香蕉成人 | 天天干天天操天天玩 | 色黄网站aaaaaa级毛片 | 91精品欧美 | 久久久久蜜桃 | 日本精品久久久一区二区三区 | 欧美成人三级一区二区在线观看 | 亚洲综合区| 日韩精品一级a毛片 | 97在线观看视频免费 | 天天干天天曰天天操 | 黄页网址大全免费观看22 | 日韩簧片| 久久一二 | 日韩一级欧美一级一级国产 | 国产精品欧美一区二区在线看 | 亚洲精品视频在线 |