PDA

Visualizza la versione completa : [C] Errore "Structure has no member"


Caleb
21-10-2005, 13:32
qualcuno sa individuare l'errore qui dentro?



#include "linux/fs.h"
#include "linux/htfs_fs.h"


static inline int htfs_match (int len, const char * const name,
struct htfs_direct * de)
{
if (len != de->d_namlen)
return 0;
if (!de->d_ino)
return 0;
return !memcmp(name, de->d_name, len);
}


static struct buffer_head * htfs_find_entry(struct inode * dir,
const char * name, int namelen, struct htfs_direct ** res_dir)
{
struct super_block * sb;
unsigned long pos, block, offset; /* pos = block * block_size + offset */
struct buffer_head * bh;

*res_dir = NULL;
sb = dir->i_sb;
if (namelen > HTFS_MAXNAMLEN)
return NULL;

bh = NULL;
pos = block = offset = 0;
while (pos < dir->i_size) {
if (!bh) {
bh = htfs_file_bread(dir, block, 0);
if (!bh) {
/* offset = 0; */ block++;
pos += sb->s_blocksize;
continue;
}
}
if (htfs_match(namelen, name,
*res_dir = (struct htfs_direct *) (bh->b_data + offset) ))
return bh;
pos += (*res_dir)->d_reclen;
offset += (*res_dir)->d_reclen;
if (offset < sb->sv_block_size)
continue;
brelse(bh);
bh = NULL;
offset = 0; block++;
}
brelse(bh);
*res_dir = NULL;
return NULL;
}

static struct dentry *htfs_lookup(struct inode * dir, struct dentry * dentry)
{
struct inode * inode = NULL;
struct htfs_direct * de;
struct buffer_head * bh;

bh = htfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de);


if (bh) {
int ino = de->d_ino;
brelse(bh);
inode = iget(dir->i_sb, ino);

if (!inode)
return ERR_PTR(-EACCES);
}
d_add(dentry, inode);
return NULL;
}

struct inode_operations htfs_dir_inode_operations = {
lookup: htfs_lookup
};



namei.c:64: structure has no member named 'sv_block_size'

ho frugato un po' fra gli header e ho visto che sv_block_size viene definito in include/linux/sysv_fs.h ma anche includendolo l'errore non cambia

qualche idea?

anx721
21-10-2005, 20:35
ma com' la definizione della struct super_block ?

Caleb
21-10-2005, 22:26
nel frattempo ho risolto grazie comunque per l'interesse

c'era un errore di battitura, non sv_block_size ma s_blocksize

Loading