Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [C] structure has no member

    qualcuno sa individuare l'errore qui dentro?

    codice:
    #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?
    Sotto la panza la mazza avanza.

  2. #2
    Utente di HTML.it L'avatar di anx721
    Registrato dal
    Apr 2003
    Messaggi
    2,352
    ma com'è la definizione della struct super_block ?

    Sun Certified Java Programmer

    EUCIP Core Level Certified

    European Certification of Informatics Professionals

  3. #3
    nel frattempo ho risolto grazie comunque per l'interesse

    c'era un errore di battitura, non sv_block_size ma s_blocksize
    Sotto la panza la mazza avanza.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.