WRITE32(NFS4_FH_VOLATILE_ANY); 
WRITE32(NFS4_FH_PERSISTENT); 
nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,		struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval,		struct svc_rqst *rqstp){	u32 bmval0 = bmval[0];	u32 bmval1 = bmval[1];	struct kstat stat;	struct svc_fh tempfh;	struct kstatfs statfs;	int buflen = *countp << 2;	u32 *attrlenp;	u32 dummy;	u64 dummy64;	u32 *p = buffer;	int status;	int aclsupport = 0;	struct nfs4_acl *acl = NULL;	BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1);	BUG_ON(bmval0 & ~NFSD_SUPPORTED_ATTRS_WORD0);	BUG_ON(bmval1 & ~NFSD_SUPPORTED_ATTRS_WORD1);	status = vfs_getattr(exp->ex_mnt, dentry, &stat);	if (status)		goto out_nfserr;	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |		       FATTR4_WORD1_SPACE_TOTAL))) {		status = vfs_statfs(dentry->d_inode->i_sb, &statfs);		if (status)			goto out_nfserr;	}	if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {		fh_init(&tempfh, NFS4_FHSIZE);		status = fh_compose(&tempfh, exp, dentry, NULL);		if (status)			goto out;		fhp = &tempfh;	}	if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT			| FATTR4_WORD0_SUPPORTED_ATTRS)) {		status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);		aclsupport = (status == 0);		if (bmval0 & FATTR4_WORD0_ACL) {			if (status == -EOPNOTSUPP)				bmval0 &= ~FATTR4_WORD0_ACL;			else if (status == -EINVAL) {				status = nfserr_attrnotsupp;				goto out;			} else if (status != 0)				goto out_nfserr;		}	}	if ((buflen -= 16) < 0)		goto out_resource;	WRITE32(2);	WRITE32(bmval0);	WRITE32(bmval1);	attrlenp = p++;                /* to be backfilled later */	if (bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {		if ((buflen -= 12) < 0)			goto out_resource;		WRITE32(2);		WRITE32(aclsupport ?			NFSD_SUPPORTED_ATTRS_WORD0 :			NFSD_SUPPORTED_ATTRS_WORD0 & ~FATTR4_WORD0_ACL);		WRITE32(NFSD_SUPPORTED_ATTRS_WORD1);	}	if (bmval0 & FATTR4_WORD0_TYPE) {		if ((buflen -= 4) < 0)			goto out_resource;		dummy = nfs4_ftypes[(stat.mode & S_IFMT) >> 12];		if (dummy == NF4BAD)			goto out_serverfault;		WRITE32(dummy);	}	if (bmval0 & FATTR4_WORD0_FH_EXPIRE_TYPE) {		if ((buflen -= 4) < 0)			goto out_resource;		if (exp->ex_flags & NFSEXP_NOSUBTREECHECK)			WRITE32(NFS4_FH_VOLATILE_ANY);		else			WRITE32(NFS4_FH_VOLATILE_ANY|NFS4_FH_VOL_RENAME);	}	if (bmval0 & FATTR4_WORD0_CHANGE) {		/*		 * Note: This _must_ be consistent with the scheme for writing		 * change_info, so any changes made here must be reflected there		 * as well.  (See xdr4.h:set_change_info() and the WRITECINFO()		 * macro above.)		 */		if ((buflen -= 8) < 0)			goto out_resource;		WRITE32(stat.ctime.tv_sec);		WRITE32(stat.ctime.tv_nsec);	}	if (bmval0 & FATTR4_WORD0_SIZE) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64(stat.size);	}	if (bmval0 & FATTR4_WORD0_LINK_SUPPORT) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_SYMLINK_SUPPORT) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_NAMED_ATTR) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(0);	}	if (bmval0 & FATTR4_WORD0_FSID) {		if ((buflen -= 16) < 0)			goto out_resource;		if (is_fsid(fhp, rqstp->rq_reffh)) {			WRITE64((u64)exp->ex_fsid);			WRITE64((u64)0);		} else {			WRITE32(0);			WRITE32(MAJOR(stat.dev));			WRITE32(0);			WRITE32(MINOR(stat.dev));		}	}	if (bmval0 & FATTR4_WORD0_UNIQUE_HANDLES) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(0);	}	if (bmval0 & FATTR4_WORD0_LEASE_TIME) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(NFSD_LEASE_TIME);	}	if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(0);	}	if (bmval0 & FATTR4_WORD0_ACL) {		struct nfs4_ace *ace;		struct list_head *h;		if (acl == NULL) {			if ((buflen -= 4) < 0)				goto out_resource;			WRITE32(0);			goto out_acl;		}		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(acl->naces);		list_for_each(h, &acl->ace_head) {			ace = list_entry(h, struct nfs4_ace, l_ace);			if ((buflen -= 4*3) < 0)				goto out_resource;			WRITE32(ace->type);			WRITE32(ace->flag);			WRITE32(ace->access_mask & NFS4_ACE_MASK_ALL);			status = nfsd4_encode_aclname(rqstp, ace->whotype,				ace->who, ace->flag & NFS4_ACE_IDENTIFIER_GROUP,				&p, &buflen);			if (status == nfserr_resource)				goto out_resource;			if (status)				goto out;		}	}out_acl:	if (bmval0 & FATTR4_WORD0_ACLSUPPORT) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(aclsupport ?			ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL : 0);	}	if (bmval0 & FATTR4_WORD0_CANSETTIME) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_CASE_INSENSITIVE) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_CHOWN_RESTRICTED) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_FILEHANDLE) {		buflen -= (XDR_QUADLEN(fhp->fh_handle.fh_size) << 2) + 4;		if (buflen < 0)			goto out_resource;		WRITE32(fhp->fh_handle.fh_size);		WRITEMEM(&fhp->fh_handle.fh_base, fhp->fh_handle.fh_size);	}	if (bmval0 & FATTR4_WORD0_FILEID) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) stat.ino);	}	if (bmval0 & FATTR4_WORD0_FILES_AVAIL) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) statfs.f_ffree);	}	if (bmval0 & FATTR4_WORD0_FILES_FREE) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) statfs.f_ffree);	}	if (bmval0 & FATTR4_WORD0_FILES_TOTAL) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) statfs.f_files);	}	if (bmval0 & FATTR4_WORD0_HOMOGENEOUS) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval0 & FATTR4_WORD0_MAXFILESIZE) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64(~(u64)0);	}	if (bmval0 & FATTR4_WORD0_MAXLINK) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(255);	}	if (bmval0 & FATTR4_WORD0_MAXNAME) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(~(u32) 0);	}	if (bmval0 & FATTR4_WORD0_MAXREAD) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) NFSSVC_MAXBLKSIZE);	}	if (bmval0 & FATTR4_WORD0_MAXWRITE) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE64((u64) NFSSVC_MAXBLKSIZE);	}	if (bmval1 & FATTR4_WORD1_MODE) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(stat.mode & S_IALLUGO);	}	if (bmval1 & FATTR4_WORD1_NO_TRUNC) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(1);	}	if (bmval1 & FATTR4_WORD1_NUMLINKS) {		if ((buflen -= 4) < 0)			goto out_resource;		WRITE32(stat.nlink);	}	if (bmval1 & FATTR4_WORD1_OWNER) {		status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen);		if (status == nfserr_resource)			goto out_resource;		if (status)			goto out;	}	if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {		status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen);		if (status == nfserr_resource)			goto out_resource;		if (status)			goto out;	}	if (bmval1 & FATTR4_WORD1_RAWDEV) {		if ((buflen -= 8) < 0)			goto out_resource;		WRITE32((u32) MAJOR(stat.rdev));		WRITE32((u32) MINOR(stat.rdev));	}	if (bmval1 & FATTR4_WORD1_SPACE_AVAIL) {		if ((buflen -= 8) < 0)			goto out_resource;		dummy64 = (u64)statfs.f_bavail * (u64)statfs.f_bsize;		WRITE64(dummy64);	}	if (bmval1 & FATTR4_WORD1_SPACE_FREE) {		if ((buflen -= 8) < 0)			goto out_resource;		dummy64 = (u64)statfs.f_bfree * (u64)statfs.f_bsize;		WRITE64(dummy64);	}	if (bmval1 & FATTR4_WORD1_SPACE_TOTAL) {		if ((buflen -= 8) < 0)			goto out_resource;		dummy64 = (u64)statfs.f_blocks * (u64)statfs.f_bsize;		WRITE64(dummy64);	}	if (bmval1 & FATTR4_WORD1_SPACE_USED) {		if ((buflen -= 8) < 0)			goto out_resource;		dummy64 = (u64)stat.blocks << 9;		WRITE64(dummy64);	}	if (bmval1 & FATTR4_WORD1_TIME_ACCESS) {		if ((buflen -= 12) < 0)			goto out_resource;		WRITE32(0);		WRITE32(stat.atime.tv_sec);		WRITE32(stat.atime.tv_nsec);	}	if (bmval1 & FATTR4_WORD1_TIME_DELTA) {		if ((buflen -= 12) < 0)			goto out_resource;		WRITE32(0);		WRITE32(1);		WRITE32(0);	}	if (bmval1 & FATTR4_WORD1_TIME_METADATA) {		if ((buflen -= 12) < 0)			goto out_resource;		WRITE32(0);		WRITE32(stat.ctime.tv_sec);		WRITE32(stat.ctime.tv_nsec);	}	if (bmval1 & FATTR4_WORD1_TIME_MODIFY) {		if ((buflen -= 12) < 0)			goto out_resource;		WRITE32(0);		WRITE32(stat.mtime.tv_sec);		WRITE32(stat.mtime.tv_nsec);	}	if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {		struct dentry *mnt_pnt, *mnt_root;		if ((buflen -= 8) < 0)                	goto out_resource;		mnt_root = exp->ex_mnt->mnt_root;		if (mnt_root->d_inode == dentry->d_inode) {			mnt_pnt = exp->ex_mnt->mnt_mountpoint;			WRITE64((u64) mnt_pnt->d_inode->i_ino);		} else                	WRITE64((u64) stat.ino);	}	*attrlenp = htonl((char *)p - (char *)attrlenp - 4);	*countp = p - buffer;	status = nfs_ok;out:	nfs4_acl_free(acl);	if (fhp == &tempfh)		fh_put(&tempfh);	return status;out_nfserr:	status = nfserrno(status);	goto out;out_resource:	*countp = 0;	status = nfserr_resource;	goto out;out_serverfault:	status = nfserr_serverfault;	goto out;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/e34ac862ee6644378bfe6ea65c2e0dda4545513d/nfs4xdr.c/buggy/fs/nfsd/nfs4xdr.c