kernels/linux-2.4.0/fs/nfs/inode.c
/*
 * Fill in inode information from the fattr.
 */
Fill in inode information from the fattr.
Fill in inode information from the fattr .
static void
nfs_fill_inode(struct inode *inode, struct nfs_fh *fh, struct nfs_fattr *fattr)
{
	if (inode->i_mode == 0) {
		NFS_FILEID(inode) = fattr->fileid;
		NFS_FSID(inode) = fattr->fsid;
		inode->i_mode = fattr->mode;
		inode->i_op = &nfs_file_inode_operations;
		if (S_ISREG(inode->i_mode)) {
			inode->i_fop = &nfs_file_operations;
			inode->i_data.a_ops = &nfs_file_aops;
		} else if (S_ISDIR(inode->i_mode)) {
			inode->i_op = &nfs_dir_inode_operations;
			inode->i_fop = &nfs_dir_operations;
		} else if (S_ISLNK(inode->i_mode))
			inode->i_op = &nfs_symlink_inode_operations;
		else
			init_special_inode(inode, inode->i_mode, fattr->rdev);
		inode->i_size  = nfs_size_to_loff_t(fattr->size);
		inode->i_mtime = nfs_time_to_secs(fattr->mtime);
		inode->i_atime = nfs_time_to_secs(fattr->atime);
		inode->i_ctime = nfs_time_to_secs(fattr->ctime);
		NFS_CACHE_CTIME(inode) = fattr->ctime;
		NFS_CACHE_MTIME(inode) = fattr->mtime;
		NFS_CACHE_ATIME(inode) = fattr->atime;
		NFS_CACHE_ISIZE(inode) = fattr->size;
		NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
		NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
		memcpy(&inode->u.nfs_i.fh, fh, sizeof(inode->u.nfs_i.fh));
	}
	nfs_refresh_inode(inode, fattr);
}
static void nfs_fill_inode ( struct inode * inode , struct nfs_fh * fh , struct nfs_fattr * fattr ) { if ( inode -> i_mode == 0 ) { NFS_FILEID ( inode ) = fattr -> fileid ; NFS_FSID ( inode ) = fattr -> fsid ; inode -> i_mode = fattr -> mode ; inode -> i_op = & nfs_file_inode_operations ; if ( S_ISREG ( inode -> i_mode ) ) { inode -> i_fop = & nfs_file_operations ; inode -> i_data . a_ops = & nfs_file_aops ; } else if ( S_ISDIR ( inode -> i_mode ) ) { inode -> i_op = & nfs_dir_inode_operations ; inode -> i_fop = & nfs_dir_operations ; } else if ( S_ISLNK ( inode -> i_mode ) ) inode -> i_op = & nfs_symlink_inode_operations ; else init_special_inode ( inode , inode -> i_mode , fattr -> rdev ) ; inode -> i_size = nfs_size_to_loff_t ( fattr -> size ) ; inode -> i_mtime = nfs_time_to_secs ( fattr -> mtime ) ; inode -> i_atime = nfs_time_to_secs ( fattr -> atime ) ; inode -> i_ctime = nfs_time_to_secs ( fattr -> ctime ) ; NFS_CACHE_CTIME ( inode ) = fattr -> ctime ; NFS_CACHE_MTIME ( inode ) = fattr -> mtime ; NFS_CACHE_ATIME ( inode ) = fattr -> atime ; NFS_CACHE_ISIZE ( inode ) = fattr -> size ; NFS_ATTRTIMEO ( inode ) = NFS_MINATTRTIMEO ( inode ) ; NFS_ATTRTIMEO_UPDATE ( inode ) = jiffies ; memcpy ( & inode -> u . nfs_i . fh , fh , sizeof ( inode -> u . nfs_i . fh ) ) ; } nfs_refresh_inode ( inode , fattr ) ; }
Fill in inode information from the fattr.
Fill in inode information from the fattr .
/*
	 * Check whether the mode has been set, as we only want to
	 * do this once. (We don't allow inodes to change types.)
	 */ /* Why so? Because we want revalidate for devices/FIFOs, and
		 * that's precisely what we have in nfs_file_inode_operations.
		 */ /*
		 * Preset the size and mtime, as there's no need
		 * to invalidate the caches.
		 */