Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-block/iscsitarget/files: iscsitarget-0.4.17+linux-2.6.28.patch
Date: Fri, 02 Jan 2009 23:21:20
Message-Id: E1LItKP-0002ty-P0@stork.gentoo.org
1 flameeyes 09/01/02 23:21:17
2
3 Added: iscsitarget-0.4.17+linux-2.6.28.patch
4 Log:
5 Add patch to fix bug #252608 (failure to build on kernel 2.6.28 and later).
6 (Portage version: 2.2_rc20/cvs/Linux 2.6.28-gentoo x86_64)
7
8 Revision Changes Path
9 1.1 sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-block/iscsitarget/files/iscsitarget-0.4.17+linux-2.6.28.patch?rev=1.1&content-type=text/plain
13
14 Index: iscsitarget-0.4.17+linux-2.6.28.patch
15 ===================================================================
16 From c5e70fc826aad5efb786c47d294e3c0c76246d63 Mon Sep 17 00:00:00 2001
17 From: =?utf-8?q?Diego=20E.=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@×××××.com>
18 Date: Sat, 3 Jan 2009 00:09:43 +0100
19 Subject: [PATCH] Fix building with Linux kernel 2.6.28 and later.
20
21 With changeset 30c40d2c01f68c7eb1a41ab3552bdaf5dbf300d4 of the Linux
22 kernel, the functions open_bdev_excl and close_bdev_excl were replaced with
23 functionally-equivalent open_bdev_exclusive and close_bdev_exclusive.
24
25 The new interface uses fmode_t instead of integer flags to carry on the
26 opening mode for a block device, thus require some minor changes in the
27 calls.
28 ---
29 kernel/block-io.c | 21 +++++++++++++++++++++
30 1 files changed, 21 insertions(+), 0 deletions(-)
31
32 diff --git a/kernel/block-io.c b/kernel/block-io.c
33 index e4a25f7..2c5f6f6 100644
34 --- a/kernel/block-io.c
35 +++ b/kernel/block-io.c
36 @@ -18,6 +18,12 @@
37 #include "iscsi_dbg.h"
38 #include "iotype.h"
39
40 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
41 +# define HAVE_OPEN_BDEV_EXCLUSIVE 1
42 +#else
43 +# define HAVE_OPEN_BDEV_EXCLUSIVE 0
44 +#endif
45 +
46 struct blockio_data {
47 char *path;
48 struct block_device *bdev;
49 @@ -154,14 +160,22 @@ blockio_open_path(struct iet_volume *volume, const char *path)
50 {
51 struct blockio_data *bio_data = volume->private;
52 struct block_device *bdev;
53 +#if HAVE_OPEN_BDEV_EXCLUSIVE
54 + fmode_t mode = FMODE_READ | ( LUReadonly(volume) ? 0 : FMODE_WRITE );
55 +#else
56 int flags = LUReadonly(volume) ? MS_RDONLY : 0;
57 +#endif
58 int err = 0;
59
60 bio_data->path = kstrdup(path, GFP_KERNEL);
61 if (!bio_data->path)
62 return -ENOMEM;
63
64 +#if HAVE_OPEN_BDEV_EXCLUSIVE
65 + bdev = open_bdev_exclusive(path, mode, THIS_MODULE);
66 +#else
67 bdev = open_bdev_excl(path, flags, THIS_MODULE);
68 +#endif
69 if (IS_ERR(bdev)) {
70 err = PTR_ERR(bdev);
71 eprintk("Can't open device %s, error %d\n", path, err);
72 @@ -323,9 +337,16 @@ static void
73 blockio_detach(struct iet_volume *volume)
74 {
75 struct blockio_data *bio_data = volume->private;
76 +#if HAVE_OPEN_BDEV_EXCLUSIVE
77 + fmode_t mode = FMODE_READ | ( LUReadonly(volume) ? 0 : FMODE_WRITE );
78 +#endif
79
80 if (bio_data->bdev)
81 +#if HAVE_OPEN_BDEV_EXCLUSIVE
82 + close_bdev_exclusive(bio_data->bdev, mode);
83 +#else
84 close_bdev_excl(bio_data->bdev);
85 +#endif
86 kfree(bio_data->path);
87
88 kfree(volume->private);
89 --
90 1.6.0.6