hi all,
i m here again with my queries... below i m giving my source code of bitmap.c... there i
m includinh fs.h and myfs_fs.h....
fs.h is already existing... and myfs_fs.h is created by me...
the source code is .............
/*
* linux/fs/myfs/bitmap.c
*/
#include "fs.h"
#include "myfs_fs.h"
static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
unsigned long myfs_count_free (struct buffer_head * map, unsigned int numchars)
{
unsigned int i;
unsigned long sum = 0;
if (!map)
return (0);
for (i = 0; i < numchars; i++)
sum += nibblemap[map->b_data[i] & 0xf] + /*(line no 19) */
nibblemap[(map->b_data[i] >> 4) & 0xf]; /*(line no20) */
return (sum);
}
now when i try to make an binary object file with the command gcc -c bitmap.c it gives me
the follwoing error. the realted structe part in the fs.h is given below....
*********************************************************************
ERROR :-
[root@localhost root]# cd /usr/src/
[root@localhost src]# cd linux-2.4.7-10
[root@localhost linux-2.4.7-10]# cd fs
[root@localhost fs]# cd myfs
[root@localhost myfs]# gcc -c bitmap.c
bitmap.c:11: warning: `struct buffer_head' declared inside parameter list
bitmap.c:11: warning: its scope is only this definition or declaration, which is probably
not what you want.
bitmap.c: In function `myfs_count_free':
bitmap.c:19: dereferencing pointer to incomplete type
bitmap.c:20: dereferencing pointer to incomplete type
[root@localhost myfs]#
********************************************************************
fs.h:
struct buffer_head {
/* First cache line: */
struct buffer_head *b_next; /* Hash queue list */
unsigned long b_blocknr; /* block number */
unsigned short b_size; /* block size */
unsigned short b_list; /* List that this buffer appears */
kdev_t b_dev; /* device (B_FREE = free) */
atomic_t b_count; /* users using this block */
kdev_t b_rdev; /* Real device */
unsigned long b_state; /* buffer state bitmap (see above) */
unsigned long b_flushtime; /* Time when (dirty) buffer should be written */
struct buffer_head *b_next_free;/* lru/free list linkage */
struct buffer_head *b_prev_free;/* doubly linked list of buffers */
struct buffer_head *b_this_page;/* circular list of buffers in one page */
struct buffer_head *b_reqnext; /* request queue */
struct buffer_head **b_pprev; /* doubly linked list of hash-queue */
/***************** it can't access b_data *******************/
char * b_data; /* pointer to data block */
/************************************************************/
struct page *b_page; /* the page this bh is mapped to */
void (*b_end_io)(struct buffer_head *bh, int uptodate); /* I/O completion */
void *b_private; /* reserved for b_end_io */
unsigned long b_rsector; /* Real buffer location on disk */
wait_queue_head_t b_wait;
struct inode * b_inode;
struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */
#ifdef CONFIG_BUFFER_DEBUG
struct buffer_history b_history;
#endif
};
***********************************************
" dereferencing pointer to incomplete type "
y this error?... its has this field then y it can't access?... is it that bitmap.c
can't access fs.h.. its in the same folder.... plz help me..
tahnx in advance...
take care
Deepali
-------------------------------------------------
Click here to find your dream partner!
Know more at
http://www.bharatmatrimony.com/partner/sify.html
Sify Power mail- a Premium Service from Sify Mail!
know more at
http://mail.sify.com