All of lore.kernel.org
 help / color / mirror / Atom feed
* Compile warning in fs/partitions/check.c
@ 2002-07-12 22:46 Thunder from the hill
  2002-07-12 23:05 ` Thunder from the hill
  2002-07-13  3:16 ` Patrick Mochel
  0 siblings, 2 replies; 6+ messages in thread
From: Thunder from the hill @ 2002-07-12 22:46 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Richard Gooch

Hi,

Compiling fs/partitions/check.c, I get a couple of warnings of "pointer to 
integer of different size":


kdev is a kdev_t here, driverfs_dev is a struct device.

	kdev.value=(int)driverfs_dev->driver_data;

Is it okay to replace this with

	kdev.value=(unsigned short)driverfs_dev->driver_data;

to make the warnings go away?

Also, struct driver_file_entry->show gets initialized here:

	show: partition_device_kdev_read,

show being (ssize_t *)(struct device *driverfs_dev, char *page, size_t 
		       count, loff_t off);
but expecting (ssize_t *)(void *, char *page, size_t count, loff_t off);

Is it okay to ignore this one?

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compile warning in fs/partitions/check.c
  2002-07-12 22:46 Compile warning in fs/partitions/check.c Thunder from the hill
@ 2002-07-12 23:05 ` Thunder from the hill
  2002-07-12 23:14   ` Greg KH
  2002-07-13  3:16 ` Patrick Mochel
  1 sibling, 1 reply; 6+ messages in thread
From: Thunder from the hill @ 2002-07-12 23:05 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Linux Kernel Mailing List, Richard Gooch

Hi,

Possible fix for the show ones seems:

Index: include/linux/driverfs_fs.h
===================================================================
RCS file: /var/cvs/thunder-2.5/include/linux/driverfs_fs.h,v
retrieving revision 1.2
diff -p -u -r1.2 driverfs_fs.h
--- include/linux/driverfs_fs.h	9 Jul 2002 12:15:28 -0000	1.2
+++ include/linux/driverfs_fs.h	12 Jul 2002 23:04:08 -0000
@@ -41,8 +41,8 @@ struct driver_dir_entry {
 
 struct device;
 
-typedef ssize_t (*driverfs_show)(void * obj, char * buf, size_t count, loff_t off);
-typedef ssize_t (*driverfs_store)(void * obj, const char * buf, size_t count, loff_t off);
+typedef ssize_t (*driverfs_show)(struct device * obj, char * buf, size_t count, loff_t off);
+typedef ssize_t (*driverfs_store)(struct device * obj, const char * buf, size_t count, loff_t off);
 
 struct driver_file_entry {
 	struct driver_dir_entry * parent;

Not yet tested to compile, just on it...

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compile warning in fs/partitions/check.c
  2002-07-12 23:05 ` Thunder from the hill
@ 2002-07-12 23:14   ` Greg KH
  2002-07-12 23:20     ` Thunder from the hill
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-07-12 23:14 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Linux Kernel Mailing List, Richard Gooch

On Fri, Jul 12, 2002 at 05:05:23PM -0600, Thunder from the hill wrote:
> Hi,
> 
> Possible fix for the show ones seems:
> 
> Index: include/linux/driverfs_fs.h
> ===================================================================
> RCS file: /var/cvs/thunder-2.5/include/linux/driverfs_fs.h,v
> retrieving revision 1.2
> diff -p -u -r1.2 driverfs_fs.h
> --- include/linux/driverfs_fs.h	9 Jul 2002 12:15:28 -0000	1.2
> +++ include/linux/driverfs_fs.h	12 Jul 2002 23:04:08 -0000
> @@ -41,8 +41,8 @@ struct driver_dir_entry {
>  
>  struct device;
>  
> -typedef ssize_t (*driverfs_show)(void * obj, char * buf, size_t count, loff_t off);
> -typedef ssize_t (*driverfs_store)(void * obj, const char * buf, size_t count, loff_t off);
> +typedef ssize_t (*driverfs_show)(struct device * obj, char * buf, size_t count, loff_t off);
> +typedef ssize_t (*driverfs_store)(struct device * obj, const char * buf, size_t count, loff_t off);

No, this patch is incorrect.  See Pat's patch that was posted a few
days ago.

And I don't think Richard really wants to be bothered with driverfs
questions :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compile warning in fs/partitions/check.c
  2002-07-12 23:14   ` Greg KH
@ 2002-07-12 23:20     ` Thunder from the hill
  2002-07-13  3:17       ` Patrick Mochel
  0 siblings, 1 reply; 6+ messages in thread
From: Thunder from the hill @ 2002-07-12 23:20 UTC (permalink / raw)
  To: Greg KH; +Cc: Thunder from the hill, Linux Kernel Mailing List

Hi,

> And I don't think Richard really wants to be bothered with driverfs
> questions :)

kernel oops at fs/partitions/check.c:-1!

							Regards,
							Thunder
-- 
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o?  K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y- 
------END GEEK CODE BLOCK------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compile warning in fs/partitions/check.c
  2002-07-12 22:46 Compile warning in fs/partitions/check.c Thunder from the hill
  2002-07-12 23:05 ` Thunder from the hill
@ 2002-07-13  3:16 ` Patrick Mochel
  1 sibling, 0 replies; 6+ messages in thread
From: Patrick Mochel @ 2002-07-13  3:16 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Linux Kernel Mailing List


On Fri, 12 Jul 2002, Thunder from the hill wrote:

> Hi,
> 
> Compiling fs/partitions/check.c, I get a couple of warnings of "pointer to 
> integer of different size":
> 
> 
> kdev is a kdev_t here, driverfs_dev is a struct device.
> 
> 	kdev.value=(int)driverfs_dev->driver_data;
> 
> Is it okay to replace this with
> 
> 	kdev.value=(unsigned short)driverfs_dev->driver_data;
> 
> to make the warnings go away?

This code definitely shouldn't rely on the format of the kdev_t structure. 
It looks like it should be something like:

-	kdev.value=(int)driverfs_dev->driver_data;
-	return off ? 0 : sprintf (page, "%x\n",kdev.value);
+	kdev = val_to_kdev((int)driverfs_dev->driver_data);
+	return off ? 0 : sprintf (page, "%x\n",kdev_val(kdev));

> Also, struct driver_file_entry->show gets initialized here:
> 
> 	show: partition_device_kdev_read,
> 
> show being (ssize_t *)(struct device *driverfs_dev, char *page, size_t 
> 		       count, loff_t off);
> but expecting (ssize_t *)(void *, char *page, size_t count, loff_t off);

First off, you might want to specify that you are using a specific patch. 
The change of the first parameter of the show() and store() callbacks was 
in a patch I posted last week. As of a few seconds ago, it hadn't been 
merged into Linus' kernel.org tree. 

Second, the definition of the callbacks should change, and there should be
an appropriate cast in the function. I have patches for all the users of
those callbacks, but I'm waiting until I finally resolve the refcounting
issues and post and updated patch to post those. FWIW, the pointer passed
to those callbacks is guaranteed to be a struct device, so the warning is, 
for now, harmless. 

Finally, if you have driverfs questions/problems/concerns, please copy me 
(and not Richard). :)

	-pat


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compile warning in fs/partitions/check.c
  2002-07-12 23:20     ` Thunder from the hill
@ 2002-07-13  3:17       ` Patrick Mochel
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick Mochel @ 2002-07-13  3:17 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Greg KH, Linux Kernel Mailing List


On Fri, 12 Jul 2002, Thunder from the hill wrote:

> Hi,
> 
> > And I don't think Richard really wants to be bothered with driverfs
> > questions :)
> 
> kernel oops at fs/partitions/check.c:-1!

Could you post the decoded output of the oops, and specify what patches 
you have applied (and modified).

Thanks,

	-pat


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-07-13  3:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 22:46 Compile warning in fs/partitions/check.c Thunder from the hill
2002-07-12 23:05 ` Thunder from the hill
2002-07-12 23:14   ` Greg KH
2002-07-12 23:20     ` Thunder from the hill
2002-07-13  3:17       ` Patrick Mochel
2002-07-13  3:16 ` Patrick Mochel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.