Lines Matching defs:fsp

44 static pc_cluster32_t pc_getcluster(struct pcfs *fsp, pc_cluster32_t cn);
59 struct pcfs *fsp; /* pcfs that file is in */
65 fsp = VFSTOPCFS(vp->v_vfsp);
74 if (!IS_FAT32(fsp) && (vp->v_flag & VROOT)) {
77 lbn = pc_cltodb(fsp, lcn);
78 if (lbn >= fsp->pcfs_rdirsec) {
82 *dbnp = pc_dbdaddr(fsp, fsp->pcfs_rdirstart + lbn);
84 ASSERT (*contigbp >= fsp->pcfs_secsize);
86 fsp->pcfs_secsize * (fsp->pcfs_rdirsec - lbn));
91 if (lcn >= fsp->pcfs_ncluster) {
98 fsp->pcfs_clsize))) {
103 if (IS_FAT32(fsp) && ncn == 0)
104 ncn = fsp->pcfs_rdirstart;
113 if (!pc_validcl(fsp, cn)) {
114 if (IS_FAT32(fsp) && cn >= PCF_LASTCLUSTER32 &&
118 } else if (!IS_FAT32(fsp) &&
126 (void) pc_badfs(fsp);
130 ncn = pc_getcluster(fsp, cn);
140 *dbnp = pc_cldaddr(fsp, cn);
142 if (contigbp && *contigbp > fsp->pcfs_clsize) {
143 uint_t count = fsp->pcfs_clsize;
146 pc_validcl(fsp, ncn)) {
147 count += fsp->pcfs_clsize;
149 ncn = pc_getcluster(fsp, ncn);
167 struct pcfs *fsp; /* pcfs that file is in */
173 fsp = VFSTOPCFS(vp -> v_vfsp);
182 if (!IS_FAT32(fsp) && (vp->v_flag & VROOT)) {
185 lbn = pc_cltodb(fsp, lcn);
186 if (lbn >= fsp->pcfs_rdirsec)
188 *dbnp = pc_dbdaddr(fsp, fsp->pcfs_rdirstart + lbn);
192 if (lcn >= fsp->pcfs_ncluster)
196 switch (cn = pc_alloccluster(fsp, 1)) {
205 if (IS_FAT32(fsp) && cn == 0)
206 cn = fsp->pcfs_rdirstart;
207 if (!pc_validcl(fsp, cn)) {
209 (void) pc_badfs(fsp);
219 ncn = pc_getcluster(fsp, cn);
220 if ((IS_FAT32(fsp) && ncn >= PCF_LASTCLUSTER32) ||
221 (!IS_FAT32(fsp) && ncn >= PCF_LASTCLUSTER)) {
225 switch (ncn = pc_alloccluster(fsp, zwrite)) {
231 pc_setcluster(fsp, cn, ncn);
232 } else if (!pc_validcl(fsp, ncn)) {
235 (void) pc_badfs(fsp);
245 *dbnp = pc_cldaddr(fsp, cn);
256 struct pcfs *fsp;
263 fsp = VFSTOPCFS(vp->v_vfsp);
264 if (!IS_FAT32(fsp) && (vp->v_flag & VROOT)) {
272 n = (int)howmany((offset_t)pcp->pc_size, fsp->pcfs_clsize);
273 if (n > fsp->pcfs_ncluster) {
275 (void) pc_badfs(fsp);
279 n = fsp->pcfs_ncluster;
282 if (IS_FAT32(fsp) && cn == 0)
283 cn = fsp->pcfs_rdirstart;
285 if (IS_FAT32(fsp))
296 if (!pc_validcl(fsp, cn)) {
298 (void) pc_badfs(fsp);
301 ncn = pc_getcluster(fsp, cn);
303 pc_setcluster(fsp, cn, PCF_FREECLUSTER);
307 if (IS_FAT32(fsp)) {
308 pc_setcluster(fsp, cn,
311 pc_setcluster(fsp, cn,
315 if (IS_FAT32(fsp) && ncn >= PCF_LASTCLUSTER32 &&
318 if (!IS_FAT32(fsp) && ncn >= PCF_LASTCLUSTER &&
330 pc_freeclusters(struct pcfs *fsp)
335 if (IS_FAT32(fsp) &&
336 fsp->pcfs_fsinfo.fs_free_clusters != FSINFO_UNKNOWN)
337 return (fsp->pcfs_fsinfo.fs_free_clusters);
342 for (cn = PCF_FIRSTCLUSTER; pc_validcl(fsp, cn); cn++) {
343 if (pc_getcluster(fsp, cn) == PCF_FREECLUSTER) {
348 if (IS_FAT32(fsp)) {
349 ASSERT(fsp->pcfs_fsinfo.fs_free_clusters == FSINFO_UNKNOWN);
350 fsp->pcfs_fsinfo.fs_free_clusters = free;
365 pc_getcluster(struct pcfs *fsp, pc_cluster32_t cn)
369 if (fsp->pcfs_fatp == (uchar_t *)0 || !pc_validcl(fsp, cn))
372 switch (fsp->pcfs_fattype) {
374 fp = fsp->pcfs_fatp + (cn << 2);
378 fp = fsp->pcfs_fatp + (cn << 1);
382 fp = fsp->pcfs_fatp + (cn + (cn >> 1));
394 pc_mark_irrecov(fsp);
406 pc_setcluster(struct pcfs *fsp, pc_cluster32_t cn, pc_cluster32_t ncn)
411 if (fsp->pcfs_fatp == (uchar_t *)0 || !pc_validcl(fsp, cn))
413 fsp->pcfs_flags |= PCFS_FATMOD;
414 pc_mark_fat_updated(fsp, cn);
415 switch (fsp->pcfs_fattype) {
417 fp = fsp->pcfs_fatp + (cn << 2);
421 fp = fsp->pcfs_fatp + (cn << 1);
426 fp = fsp->pcfs_fatp + (cn + (cn >> 1));
437 pc_mark_irrecov(fsp);
440 fsp->pcfs_nxfrecls = PCF_FIRSTCLUSTER;
441 if (IS_FAT32(fsp)) {
442 if (fsp->pcfs_fsinfo.fs_free_clusters !=
444 fsp->pcfs_fsinfo.fs_free_clusters++;
454 struct pcfs *fsp, /* file sys to allocate in */
460 if (fsp->pcfs_fatp == (uchar_t *)0)
463 for (cn = fsp->pcfs_nxfrecls; pc_validcl(fsp, cn); cn++) {
464 if (pc_getcluster(fsp, cn) == PCF_FREECLUSTER) {
467 if (IS_FAT32(fsp)) {
468 pc_setcluster(fsp, cn, PCF_LASTCLUSTERMARK32);
469 if (fsp->pcfs_fsinfo.fs_free_clusters !=
471 fsp->pcfs_fsinfo.fs_free_clusters--;
473 pc_setcluster(fsp, cn, PCF_LASTCLUSTERMARK);
478 bp = ngeteblk(fsp->pcfs_clsize);
479 bp->b_edev = fsp->pcfs_xdev;
481 bp->b_blkno = pc_cldaddr(fsp, cn);
487 pc_mark_irrecov(fsp);
491 fsp->pcfs_nxfrecls = cn + 1;
503 struct pcfs *fsp,
509 for (count = 0; pc_validcl(fsp, startcl);
510 startcl = pc_getcluster(fsp, startcl)) {
511 if (count++ >= fsp->pcfs_ncluster)