Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux教程 >> linux2.6.38之後內核版本調用open

linux2.6.38之後內核版本調用open

日期:2017/2/7 14:22:21      編輯:Linux教程
 

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.

Copyright © Windows教程網 All Rights Reserved