linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* More Pointer Woes
@ 2003-12-28 13:45 Joseph D. Wagner
  2003-12-29  2:32 ` Jeff Woods
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph D. Wagner @ 2003-12-28 13:45 UTC (permalink / raw)
  To: linux-c-programming

I get:

find.c:341: error: request for member `blocksize' in something not a 
structure or union

on line 341:

block_order_log.total_blocks = inode.i_blocks / ((fs->blocksize) / 512);

fs is a pointer but blocksize isn't.

This one's probably staring me in the face but I can't figure it out.  I 
need a fresh pair of eyes.

TIA guys (and gals) for all your support.

Joseph D. Wagner


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

* Re: More Pointer Woes
  2003-12-29  2:32 ` Jeff Woods
@ 2003-12-28 16:06   ` Joseph D. Wagner
  2003-12-29 13:44     ` Mariano Moreyra
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph D. Wagner @ 2003-12-28 16:06 UTC (permalink / raw)
  To: Jeff Woods; +Cc: linux-c-programming

> "fs->blocksize" refers to a field "blocksize" in a struct or union that
> the pointer "fs" indicates.  If  "fs" isn't a pointer to a struct (or
> union) then the "->" operator isn't valid.  What type is "fs"?

ext2_filsys *fs which can be found in ext2fs.h

> P.S.  Did you get this code from an email? Perhaps the ">" came from an
> email quote that didn't get cleaned up and "fs-blocksize" morphed into
> "fs->blocksize".  But this looks like a long-shot to me.  I expect that
> "fs" is supposed to be a pointer to a struct.

No, I wrote it myself.  I've tried:

fs.blocksize
fs->blocksize
*(fs).blocksize (which should be the same thing)
*(fs->blocksize)
*fs->blocksize
*(fs.blocksize)
&(fs->blocksize)

To simplify it:

int blocksize_k = fs->blocksize;

also fails.  blocksize is of type int.

Joseph D. Wagner


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

* Re: More Pointer Woes
  2003-12-28 13:45 More Pointer Woes Joseph D. Wagner
@ 2003-12-29  2:32 ` Jeff Woods
  2003-12-28 16:06   ` Joseph D. Wagner
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Woods @ 2003-12-29  2:32 UTC (permalink / raw)
  To: Joseph D. Wagner; +Cc: linux-c-programming

At 12/28/2003 07:45 PM +0600, Joseph D. Wagner wrote:
>find.c:341: error: request for member `blocksize' in something not a 
>structure or union
>
>on line 341:
>
>block_order_log.total_blocks = inode.i_blocks / ((fs->blocksize) / 512);
>
>fs is a pointer but blocksize isn't.

"fs->blocksize" refers to a field "blocksize" in a struct or union that the 
pointer "fs" indicates.  If  "fs" isn't a pointer to a struct (or union) 
then the "->" operator isn't valid.  What type is "fs"?

P.S.  Did you get this code from an email? Perhaps the ">" came from an 
email quote that didn't get cleaned up and "fs-blocksize" morphed into 
"fs->blocksize".  But this looks like a long-shot to me.  I expect that 
"fs" is supposed to be a pointer to a struct.

--
Jeff Woods <kazrak+kernel@cesmail.net> 



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

* RE: More Pointer Woes
  2003-12-28 16:06   ` Joseph D. Wagner
@ 2003-12-29 13:44     ` Mariano Moreyra
  0 siblings, 0 replies; 4+ messages in thread
From: Mariano Moreyra @ 2003-12-29 13:44 UTC (permalink / raw)
  To: 'Joseph D. Wagner', 'Jeff Woods'; +Cc: linux-c-programming

The problem is that ext2_filsys is a pointer itself to a
struct struct_ext2_filsys
declaration in ext2fs.h:
typedef struct struct_ext2_filsys *ext2_filsys

so, you have a pointer to a pointer to a structure.
I think you should declare fs as an ext2_filsys type, like this:
ext2_filsys fs;
Then you could reference blocksize the way you are doing it in your
code...that is
fs->blocksize

Mariano Moreyra.


-----Mensaje original-----
De: linux-c-programming-owner@vger.kernel.org
[mailto:linux-c-programming-owner@vger.kernel.org]En nombre de Joseph D.
Wagner
Enviado el: Domingo, 28 de Diciembre de 2003 13:06
Para: Jeff Woods
CC: linux-c-programming@vger.kernel.org
Asunto: Re: More Pointer Woes


> "fs->blocksize" refers to a field "blocksize" in a struct or union that
> the pointer "fs" indicates.  If  "fs" isn't a pointer to a struct (or
> union) then the "->" operator isn't valid.  What type is "fs"?

ext2_filsys *fs which can be found in ext2fs.h

> P.S.  Did you get this code from an email? Perhaps the ">" came from an
> email quote that didn't get cleaned up and "fs-blocksize" morphed into
> "fs->blocksize".  But this looks like a long-shot to me.  I expect that
> "fs" is supposed to be a pointer to a struct.

No, I wrote it myself.  I've tried:

fs.blocksize
fs->blocksize
*(fs).blocksize (which should be the same thing)
*(fs->blocksize)
*fs->blocksize
*(fs.blocksize)
&(fs->blocksize)

To simplify it:

int blocksize_k = fs->blocksize;

also fails.  blocksize is of type int.

Joseph D. Wagner

-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2003-12-29 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-28 13:45 More Pointer Woes Joseph D. Wagner
2003-12-29  2:32 ` Jeff Woods
2003-12-28 16:06   ` Joseph D. Wagner
2003-12-29 13:44     ` Mariano Moreyra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).