After linux2.6.38, the kernel version calls open

  

linux2.6.38 and the kernel module is compiled under the kernel version. When the open_by_devnum() function is called, an error occurs. The reason for this problem is that in the kernel after linux2.6.37, the open_by_devnum() function has been removed, and the function has been replaced with the blkdev_get_by_dev function.

Refer to the following reference:

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 usersReferences: <1288628129-12811-1-git-send-email…@kernel.org>In-Reply-To: <1288628129-12811-1-git-send-email…@kernel.org> X-Enigmail-Version: 1.1.1Content-Type: text/plain; charset=ISO-8859-1Content-Transfer-Encoding: 7bitX-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn= Ham version=3.3.1X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hera.kernel.orgX-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.orgPrecedence: bulkList-ID: <linux-kernel. Vger.kernel.org>X-Mailing-List: linux-ker…@vger.kernel.org

After recent blkdev_get() modifications, open_by_devnum() andopen_bdev_exclusive() a Re 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'tautomatically add %FMODE_EXCL To @mode.

All users are converted. Most conversions are mechanical and don'tintroduce 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 knowledge All Rights Reserved