Lines Matching defs:cn

86 		usemap_alloc(struct msdosfsmount *pmp, u_long cn);
88 usemap_free(struct msdosfsmount *pmp, u_long cn);
136 u_long cn;
148 cn = dep->de_StartCluster;
155 if (cn == MSDOSFSROOT) {
189 fc_lookup(dep, findcn, &i, &cn);
198 if ((cn | ~pmp->pm_fatmask) >= CLUST_RSRVD)
200 byteoffset = FATOFS(pmp, cn);
213 prevcn = cn;
220 cn = getulong(bp->b_data + bo);
222 cn = getushort(bp->b_data + bo);
224 cn >>= 4;
225 cn &= pmp->pm_fatmask;
233 if ((cn | ~pmp->pm_fatmask) >= CLUST_RSRVD)
234 cn |= ~pmp->pm_fatmask;
237 if (!MSDOSFSEOF(pmp, cn)) {
241 *bnp = cntobn(pmp, cn);
243 *cnp = cn;
244 fc_setcache(dep, FC_LASTMAP, i, cn);
266 u_long cn;
270 cn = dep->de_fc[i].fc_frcn;
271 if (cn != FCE_EMPTY && cn <= findcn) {
272 if (closest == NULL || cn > closest->fc_frcn)
382 usemap_alloc(struct msdosfsmount *pmp, u_long cn)
385 assert(cn <= pmp->pm_maxcluster);
387 assert((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
391 pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
397 usemap_free(struct msdosfsmount *pmp, u_long cn)
400 assert(cn <= pmp->pm_maxcluster);
402 assert((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
407 pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS));
433 * cn - which cluster is of interest
447 fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents,
457 function, pmp, cn, oldcontents, newcontents);
486 if (cn < CLUST_FIRST || cn > pmp->pm_maxcluster)
489 byteoffset = FATOFS(pmp, cn);
502 if (FAT12(pmp) & (cn & 1))
514 if (cn & 1) {
738 u_long len, newst, foundl, cn, l;
753 for (cn = newst; cn <= pmp->pm_maxcluster;) {
754 idx = cn / N_INUSEBITS;
756 map |= (1U << (cn % N_INUSEBITS)) - 1;
758 cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
759 if ((l = chainlength(pmp, cn, count)) >= count)
760 return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
762 foundcn = cn;
765 cn += l + 1;
768 cn += N_INUSEBITS - cn % N_INUSEBITS;
770 for (cn = 0; cn < newst;) {
771 idx = cn / N_INUSEBITS;
773 map |= (1U << (cn % N_INUSEBITS)) - 1;
775 cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
776 if ((l = chainlength(pmp, cn, count)) >= count)
777 return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
779 foundcn = cn;
782 cn += l + 1;
785 cn += N_INUSEBITS - cn % N_INUSEBITS;
870 u_long bn, bo, bsize, byteoffset, cn, readcn;
879 for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++)
880 pmp->pm_inusemap[cn] = FULL_RUN;
888 for (cn = 0; cn <= pmp->pm_maxcluster; cn++) {
889 byteoffset = FATOFS(pmp, cn);
905 if (FAT12(pmp) && (cn & 1))
913 if (cn == 0 && readcn != ((pmp->pm_fatmask & 0xffffff00) |
922 usemap_free(pmp, cn);
927 for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster +
928 N_INUSEBITS) / N_INUSEBITS; cn++)
929 pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
955 u_long cn, got;
976 error = pcbmap(dep, 0xffff, 0, &cn, 0);
997 cn = 0;
999 cn = dep->de_fc[FC_LASTFC].fc_fsrcn + 1;
1000 error = clusteralloc(pmp, cn, count, CLUST_EOFE, &cn, &got);
1011 *ncp = cn;
1016 dep->de_StartCluster = cn;
1021 0, cn);
1023 clusterfree(pmp, cn);
1033 fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);
1039 cntobn(pmp, cn++),