免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: assiss
打印 上一主题 下一主题

[NetBSD] NetBSD: Kernel Programming FAQ翻译 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2006-02-17 18:48 |只看该作者
原帖由 gvim 于 2006-2-17 18:32 发表
说说怎么看的???我找了很久都没有找到答案,mail-list都看遍了也没有说怎么办!!!
谢谢,谢谢。


我没有专门做过处理。下面是我使用的环境:

Windows XP 磁盘使用的是 NTFS。

NetBSD:
版本是 current, 3.99.15

X 系统的 locale 是:

LANG=zh_CN.UTF-8
LC_CTYPE=zh_CN.UTF-8

NetBSD 里面 zh_CN.UTF-8 好像是假的,直接指向 en_US.UTF-8。

mount 命令也没有加任何参数,就是简单键入:

mount /dev/wd0i /mnt/wd0i

剩下的就是 emacs 版本为 22.0.50,语言环境也设成 UTF-8 了。上图用的是 eshell mode。

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
12 [报告]
发表于 2006-02-17 18:52 |只看该作者
是吗?我去试试,我那个时候用的2.0.2的内核,所以一直以为不可以,现在的3.0连试都没有试,难道内核core team的人改进了?
谢谢你。

论坛徽章:
0
13 [报告]
发表于 2006-02-17 20:02 |只看该作者
原帖由 assiss 于 2006-2-17 15:13 发表
水平有限,错误再所难免。请大家多批评指正。

tex文档可到我BLOG下载。


autoconf 的部分我重翻了一下,供你参考:

The autoconf machinery is quite simple once you figure out the way it
works. If you want to ignore the exact details of how the device probe
tree is built and walked on runtime, the bits needed for each
individual "leaf" driver are like this:

一旦知道 autoconf 是如何工作的,那么 autoconf 的机制就显得很简单。如果
不想知道设备探测树(device probe tree)在运行时是如何建立和遍历的细节,每
个独立的 "leaf" 驱动所需的内容如下:

   1. each driver specifies a structure holding three things - size of
      its private structure, probe function and attach function; this
      is compiled in and used in runtime - example:

      每个驱动指定一个 structure 包含三项内容 - 私有 structrue 的尺寸、
      probe 函数和 attach 函数;它被编译并在运行时使用 - 例如:

      struct cfattach foo_baz_ca = {
          sizeof(struct foo_baz_softc), foo_baz_match, foo_baz_attach
      };

   2. on kernel startup, once the time comes to attach the device,
      autoconf code calls device's probe routine and passes it pointer
      to parent (struct device *parent), pointer to attach tag
      structure (void *aux), and appropriate autoconf node (struct
      cfdata *cf). The driver is expected to find out if it's where
      it's supposed to be (commonly, the location and configuration
      information is passed by the attach tag). If yes, the probe
      routine should return 1. If device is not there, probe routine
      has to return 0. NO STATE SHOULD BE KEPT in either case.

      内核启动后,attach 设备时,autoconf 代码调用设备的探测程序(probe
      routine) 并传入父设备 (struct device *parent) 、attach tag
      structure (void *aux) 和相应的 autoconf 节点 (struct cfdata *cf)
      的指针。驱动程序期望在假定的位置(通常,所在位置和配置信息通过
      attach tag 传递)找出设备。如果找到,探测程序返回 1。如果未发现设
      备,返回 0。两种情况都不应该保留状态。

   3. if probe returned success, autoconf allocates chunk of memory
      sized as specified in device's *_ca and calls its attach
      routine, passing it pointer to parent (struct device *parent),
      pointer to the freshly allocated memory (struct device *self)
      and the attach tag (void *aux). Driver is expected to find out
      exact ports and memory, allocate resources and initialize its
      internal structure accordingly. Preferably, all driver instance
      specific information should be kept in the allocated memory.

      如果探测程序返回成功,autoconf 分配一块内存,大小是设备的 *_ca
      里面指定的,并调用 attach 程序,传入父设备 (struct device
      *parent)、所分配内存 (struct device *self) 和 attach tag (void
      *aux) 的指针。驱动程序期望找到正确的端口和内存,并同时分配资源和
      初始化内部结构。所有驱动实例指定的信息应该都保存在所分配的内存中。

论坛徽章:
0
14 [报告]
发表于 2006-02-17 20:23 |只看该作者
原帖由 szjungle 于 2006-2-17 20:02 发表


autoconf 的部分我重翻了一下,供你参考:

The autoconf machinery is quite simple once you figure out the way it
works. If you want to ignore the exact details of how the device probe
tree is  ...

非常感谢。回头看看我的翻译,太儿戏了。

论坛徽章:
0
15 [报告]
发表于 2006-02-17 21:54 |只看该作者
都系大牛,学习ing。。。

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
16 [报告]
发表于 2006-02-18 14:24 |只看该作者
原帖由 szjungle 于 2006-2-17 18:48 发表


呵呵,我试了下,明白你的意思了,你实际使用的是emace提供的中文环境。(我不会这个东西)
我们指的 locate环境指像 Linux的mount -o参数那样的环境。
不过还是感谢你提供的信息。

论坛徽章:
0
17 [报告]
发表于 2006-02-18 17:19 |只看该作者
原帖由 gvim 于 2006-2-18 14:24 发表


呵呵,我试了下,明白你的意思了,你实际使用的是emace提供的中文环境。(我不会这个东西)
我们指的 locate环境指像 Linux的mount -o参数那样的环境。
不过还是感谢你提供的信息。


应该是 X 环境的 locale 设好就行了。不用 emacs,拿 firefox 也可以看到同样的中文信息。

论坛徽章:
0
18 [报告]
发表于 2006-06-13 11:03 |只看该作者
多少积分可以下啊

论坛徽章:
0
19 [报告]
发表于 2006-08-30 00:43 |只看该作者

回复 1楼 assiss 的帖子

下了一份!学习中!!!多谢分享!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP