Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1090795
  • 博文数量: 646
  • 博客积分: 288
  • 博客等级: 二等列兵
  • 技术积分: 5375
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-08 14:33
个人简介

为了技术,我不会停下学习的脚步,我相信我还能走二十年。

文章分类

全部博文(646)

文章存档

2014年(8)

2013年(134)

2012年(504)

分类:

2012-06-13 12:59:59

在网络驱动程序中,分配net_device和sizeof_priv的内存空间,用到以下算法:

alloc_size = sizeof(struct net_device);

if (sizeof_priv) {
       /* ensure 32-byte alignment of private area */
       alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
       alloc_size += sizeof_priv;
}

#define NETDEV_ALIGN        32
#define NETDEV_ALIGN_CONST  (NETDEV_ALIGN - 1)

阅读(340) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~