返回首页
当前位置: 主页 > 操作系统 > Linux教程 >

linux2.6.38之后内核版本调用open_by_devnum()函数出错

时间:2016-12-04 23:27来源:电脑教程学习网 www.etwiki.cn 编辑:admin

linux2.6.38之后内核版本下编译内核模块,当调用open_by_devnum()函数时会出错。该问题原因在于:在linux2.6.37版本以后的内核中,已将open_by_devnum()函数去除,而用 blkdev_get_by_dev函数取代其功能。

可参考如下引用内容:

xen/blkback: Update to use blkdev_get_by_dev instead of open_by_devnum.

Subject: [PATCH 7/5] block: clean up blkdev_get() wrappers and their users
References: <1288628129-12811-1-git-send-email…@kernel.org>
In-Reply-To: <1288628129-12811-1-git-send-email…@kernel.org>
X-Enigmail-Version: 1.1.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00
 autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hera.kernel.org
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Thu, 11 Nov 2010 17:11:26 +0000 (UTC)
Sender: linux-kernel-ow…@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-ker…@vger.kernel.org

After recent blkdev_get() modifications, open_by_devnum() and
open_bdev_exclusive() are simple wrappers around blkdev_get().
Replace them with blkdev_get_by_dev() and blkdev_get_by_path().

blkdev_get_by_dev() is identical to open_by_devnum().
blkdev_get_by_path() is slightly different in that it doesn't
automatically add %FMODE_EXCL to @mode.

All users are converted.  Most conversions are mechanical and don't
introduce any behavior difference.  There are several exceptions.

* btrfs now sets FMODE_EXCL in btrfs_device->mode, so there's no
  reason to or it explicitly on blkdev_put().

* gfs2, nilfs2 and the generic mount_bdev() now set FMODE_EXCL in
  sb->s_mode.

* With the above changes, sb->s_mode now always should contain
  FMODE_EXCL.  WARN_ON_ONCE() added to kill_block_super() to detect
  errors.

The new blkdev_get_*() functions are with proper docbook comments.
While at it, add function description to blkdev_get() too.

顶一下
(1)
100%
踩一下
(0)
0%
标签(Tag):Linux LVM逻辑卷 LVM逻辑卷管理
------分隔线----------------------------
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
验证码:点击我更换图片
推荐内容