if (flags & DE_CLEAR && (dep->de_Attributes & ATTR_DIRECTORY)) {
if (flags & DE_CLEAR) {
extendfile(dep, count, bpp, ncp, flags)	struct denode *dep;	u_long count;	struct buf **bpp;	u_long *ncp;	int flags;{	int error;	u_long frcn = 0, cn, got;	struct msdosfsmount *pmp = dep->de_pmp;	struct buf *bp;		/*	 * Don't try to extend the root directory	 */	if (dep->de_StartCluster == MSDOSFSROOT	    && (dep->de_Attributes & ATTR_DIRECTORY)) {		printf("extendfile(): attempt to extend root directory\n");		return (ENOSPC);	}	/*	 * If the "file's last cluster" cache entry is empty, and the file	 * is not empty, then fill the cache entry by calling pcbmap().	 */	fc_fileextends++;	if (dep->de_fc[FC_LASTFC].fc_frcn == FCE_EMPTY &&	    dep->de_StartCluster != 0) {		fc_lfcempty++;		error = pcbmap(dep, 0xffff, 0, &cn, 0);		/* we expect it to return E2BIG */		if (error != E2BIG)			return (error);	}	while (count > 0) {		/*		 * Allocate a new cluster chain and cat onto the end of the		 * file.  * If the file is empty we make de_StartCluster point		 * to the new block.  Note that de_StartCluster being 0 is		 * sufficient to be sure the file is empty since we exclude		 * attempts to extend the root directory above, and the root		 * dir is the only file with a startcluster of 0 that has		 * blocks allocated (sort of).		 */		if (dep->de_StartCluster == 0)			cn = 0;		else			cn = dep->de_fc[FC_LASTFC].fc_fsrcn + 1;		error = clusteralloc(pmp, cn, count, CLUST_EOFE, &cn, &got);		if (error)			return (error);				count -= got;				/*		 * Give them the filesystem relative cluster number if they want		 * it.		 */		if (ncp) {			*ncp = cn;			ncp = NULL;		}				if (dep->de_StartCluster == 0) {			dep->de_StartCluster = cn;			frcn = 0;		} else {			error = fatentry(FAT_SET, pmp,					 dep->de_fc[FC_LASTFC].fc_fsrcn,					 0, cn);			if (error) {				clusterfree(pmp, cn, NULL);				return (error);			}			frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1;		}				/*		 * Update the "last cluster of the file" entry in the		 * denode's fat cache.		 */		fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);		if (flags & DE_CLEAR &&		    (dep->de_Attributes & ATTR_DIRECTORY)) {			while (got-- > 0) {				bp = getblk(pmp->pm_devvp, cntobn(pmp, cn++),				    pmp->pm_bpcluster, 0, 0);				clrbuf(bp);				if (bpp) {					*bpp = bp;					bpp = NULL;				} else {					bdwrite(bp);				}			}		}	}	return (0);}