Re: Compiling issues with enbd-2.4.35a and kernel 2.6.25.9

"Peter T. Breuer" <[email protected]> Tue, 22 Jul 2008 12:13:51 +0200 (CEST)
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach uwe schmeling:"
> /tmp/linux-2.6.x/drivers/block/enbd/enbd_base.c: In function
> ?enbd_find_kobj?:
> /tmp/linux-2.6.x/drivers/block/enbd/enbd_base.c:3426: error: ?struct
> gendisk? has no member named ?kobj?

This may be more delicate.  It's the point at which enbd first locates
an existing kernel object (some very generic struct representing a real
but more specialized thing like a device) and grabs a reference to it
for itself so that it can use it later - I think when it gives
notifications to udev (via kobject_uevent).

Enbd has been careful to deal with the reference counters ("owners") in
the kobj right.

Now I'll have to see how to get hold of it and deal with it when it's no
longer available through the gendisk struct that enbd located earlier.
Or maybe I don't need it, because there's now a different way of talking
to udev.

There is a kernel nbd change that looks relevant:

--- /usr/local/src/linux-2.6.24.2/drivers/block/nbd.c	2008-02-11 06:51:11.000000000 +0100
+++ /tmp/nbd-new.c	2008-07-22 10:19:41.000000000 +0200
@@ -394,7 +401,7 @@
 	BUG_ON(lo->magic != LO_MAGIC);
 
 	lo->pid = current->pid;
-	ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+	ret = sysfs_create_file(&lo->disk->dev.kobj, &pid_attr.attr);
 	if (ret) {
 		printk(KERN_ERR "nbd: sysfs_create_file failed!");
 		return ret;
 
So I would guess that where I currently do:

        if (!lo->kobj)
               lo->kobj = &lo->disk->kobj; // PTB avoids incrementing owners

in enbd_find_kobj, I should instead do

        if (!lo->kobj)
               lo->kobj = &lo->disk->dev.kobj; // PTB avoids incrementing owners

though maybe there's some other interface function that works to get
hold of it. And I'm worried about the counters.

> /tmp/linux-2.6.x/drivers/block/enbd/enbd_base.c: In function ?enbd_init?:
> /tmp/linux-2.6.x/drivers/block/enbd/enbd_base.c:7133: error: ?struct
> gendisk? has no member named ?kobj?

That's the same sort of thing. I have

         lo->kobj = &disk->kobj;

and I suppose it now should be


         lo->kobj = &disk->dev.kobj;
                      

Peter