Lines Matching defs:fs
92 #include <ufs/ffs/fs.h>
167 register struct fs *fs;
180 fs = ump->um_fs;
181 if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
195 fs->fs_clean = 1;
196 fs->fs_ronly = 1;
198 fs->fs_clean = 0;
199 fs->fs_ronly = 0;
204 ronly = fs->fs_ronly;
211 fs->fs_ronly = ronly;
216 if (!fs->fs_clean && ronly) {
219 printf("WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",fs->fs_fsmnt);
224 fs->fs_ronly = 1;
230 fs->fs_ronly = 0;
231 fs->fs_clean = 0;
249 fs = ump->um_fs;
250 bzero(fs->fs_fsmnt , sizeof(fs->fs_fsmnt));
251 strncpy(fs->fs_fsmnt, (caddr_t)mp->mnt_vfsstat.f_mntonname, sizeof(fs->fs_fsmnt) - 1);
260 struct fs *fs;
274 struct fs *fs;
289 fs = args->fs;
291 if (args->error = (int)buf_bread(args->devvp, (daddr64_t)((unsigned)fsbtodb(fs, ino_to_fsba(fs, ip->i_number))),
292 (int)fs->fs_bsize, NOCRED, &bp)) {
301 ino_to_fsbo(fs, ip->i_number)), ip);
305 ino_to_fsbo(fs, ip->i_number));
334 struct fs *fs, *newfs;
360 newfs = (struct fs *)buf_dataptr(bp);
371 newfs->fs_bsize < sizeof(struct fs)) {
380 fs = VFSTOUFS(mountp)->um_fs;
386 newfs->fs_csp = fs->fs_csp;
387 newfs->fs_maxcluster = fs->fs_maxcluster;
388 newfs->fs_contigdirs = fs->fs_contigdirs;
389 bcopy(newfs, fs, (u_int)fs->fs_sbsize);
390 if (fs->fs_sbsize < SBSIZE)
397 mountp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
398 ffs_oldfscompat(fs);
400 if (fs->fs_maxfilesize > maxfilesize) /* XXX */
401 fs->fs_maxfilesize = maxfilesize; /* XXX */
405 blks = howmany(fs->fs_cssize, fs->fs_fsize);
406 space = fs->fs_csp;
407 for (i = 0; i < blks; i += fs->fs_frag) {
408 size = fs->fs_bsize;
409 if (i + fs->fs_frag > blks)
410 size = (blks - i) * fs->fs_fsize;
411 if (error = (int)buf_bread(devvp, (daddr64_t)((unsigned)fsbtodb(fs, fs->fs_csaddr + i)), size,
435 if (fs->fs_contigsumsize > 0) {
436 lp = fs->fs_maxcluster;
437 for (i = 0; i < fs->fs_ncg; i++)
438 *lp++ = fs->fs_contigsumsize;
445 args.fs = fs;
471 struct fs *fs;
505 fs = (struct fs *)buf_dataptr(bp);
507 if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
508 fs->fs_bsize < sizeof(struct fs)) {
509 int magic = fs->fs_magic;
516 if (error = byte_swap_sbin(fs))
519 if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
520 fs->fs_bsize < sizeof(struct fs)) {
521 byte_swap_sbout(fs);
528 if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
529 fs->fs_bsize < sizeof(struct fs)) {
532 byte_swap_sbout(fs);
538 if (fs->fs_sbsize < 0 || fs->fs_sbsize > SBSIZE) {
559 if ((fs->fs_bsize > PAGE_SIZE) || (fs->fs_fsize < DIRBLKSIZ) ||
560 ((!(mp->mnt_flag & MNT_ROOTFS)) && (!fs->fs_clean))) {
563 byte_swap_sbout(fs);
572 dbsize = fs->fs_fsize / NSPF(fs);
585 if (fs->fs_postblformat == FS_42POSTBLFMT && !ronly) {
588 byte_swap_sbout(fs);
600 if (error = (int)buf_bread (devvp, (daddr64_t)((unsigned)fsbtodb(fs, cgtod(fs, 0))),
601 (int)fs->fs_cgsize, NOCRED, &cgbp)) {
608 byte_swap_cgin(cgp,fs);
613 byte_swap_cgout(cgp,fs);
621 howmany(fs->fs_cpg * fs->fs_spc / NSPF(fs), NBBY);
631 byte_swap_cgout(cgp,fs);
638 ump->um_fs = _MALLOC((u_long)fs->fs_sbsize, M_UFSMNT,
640 bcopy((char *)buf_dataptr(bp), ump->um_fs, (u_int)fs->fs_sbsize);
641 if (fs->fs_sbsize < SBSIZE)
645 byte_swap_sbout(fs);
649 fs = ump->um_fs;
650 fs->fs_ronly = ronly;
651 if (fs->fs_cssize < 1 || fs->fs_fsize < 1 || fs->fs_ncg < 1) {
655 if (fs->fs_frag < 1 || fs->fs_frag > MAXFRAG) {
660 size = fs->fs_cssize;
661 blks = howmany(size, fs->fs_fsize);
662 if (fs->fs_contigsumsize > 0) {
663 if (fs->fs_ncg > INT_MAX / sizeof(int32_t) || size > INT_MAX - fs->fs_ncg * sizeof(int32_t)) {
667 size += fs->fs_ncg * sizeof(int32_t);
669 if (fs->fs_ncg > INT_MAX / sizeof(u_int8_t) || size > INT_MAX - fs->fs_ncg * sizeof(u_int8_t)) {
673 size += fs->fs_ncg * sizeof(u_int8_t);
675 fs->fs_csp = space;
676 for (i = 0; i < blks; i += fs->fs_frag) {
677 size = fs->fs_bsize;
678 if (i + fs->fs_frag > blks)
679 size = (blks - i) * fs->fs_fsize;
680 if (error = (int)buf_bread(devvp, (daddr64_t)((unsigned)fsbtodb(fs, fs->fs_csaddr + i)),
682 _FREE(fs->fs_csp, M_UFSMNT);
694 if (fs->fs_contigsumsize > 0) {
695 fs->fs_maxcluster = lp = space;
696 for (i = 0; i < fs->fs_ncg; i++)
697 *lp++ = fs->fs_contigsumsize;
700 size = fs->fs_ncg * sizeof(u_int8_t);
701 fs->fs_contigdirs = (u_int8_t *)space;
703 bzero(fs->fs_contigdirs, size);
705 if (fs->fs_avgfilesize <= 0)
706 fs->fs_avgfilesize = AVFILESIZ;
707 if (fs->fs_avgfpdir <= 0)
708 fs->fs_avgfpdir = AFPDIR;
713 /* XXX warning hardcoded max symlen and not "mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;" */
722 ump->um_nindir = fs->fs_nindir;
723 ump->um_bptrtodb = fs->fs_fsbtodb;
724 ump->um_seqinc = fs->fs_frag;
727 ffs_oldfscompat(fs);
728 ump->um_savedmaxfilesize = fs->fs_maxfilesize; /* XXX */
731 maxfilesize = (u_int64_t)0x40000000 * fs->fs_bsize - 1; /* XXX */
733 if (fs->fs_maxfilesize > maxfilesize) /* XXX */
734 fs->fs_maxfilesize = maxfilesize; /* XXX */
736 fs->fs_clean = 0;
755 ffs_oldfscompat(fs)
756 struct fs *fs;
760 fs->fs_npsect = max(fs->fs_npsect, fs->fs_nsect); /* XXX */
761 fs->fs_interleave = max(fs->fs_interleave, 1); /* XXX */
762 if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
763 fs->fs_nrpos = 8; /* XXX */
764 if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
765 u_int64_t sizepb = fs->fs_bsize; /* XXX */
767 fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1; /* XXX */
769 sizepb *= NINDIR(fs); /* XXX */
770 fs->fs_maxfilesize += sizepb; /* XXX */
772 fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
773 fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
789 register struct fs *fs;
802 fs = ump->um_fs;
804 if (fs->fs_ronly == 0) {
805 fs->fs_clean = 1;
807 fs->fs_clean = 0;
818 _FREE(fs->fs_csp, M_UFSMNT);
819 _FREE(fs, M_UFSMNT);
903 register struct fs *fs;
906 fs = ump->um_fs;
907 if (fs->fs_magic != FS_MAGIC)
909 sbp->f_bsize = fs->fs_fsize;
910 sbp->f_iosize = fs->fs_bsize;
911 sbp->f_blocks = (uint64_t)((unsigned long)fs->fs_dsize);
912 sbp->f_bfree = (uint64_t) ((unsigned long)(fs->fs_cstotal.cs_nbfree * fs->fs_frag +
913 fs->fs_cstotal.cs_nffree));
914 sbp->f_bavail = (uint64_t) ((unsigned long)freespace(fs, fs->fs_minfree));
915 sbp->f_files = (uint64_t) ((unsigned long)(fs->fs_ncg * fs->fs_ipg - ROOTINO));
916 sbp->f_ffree = (uint64_t) ((unsigned long)fs->fs_cstotal.cs_nifree);
927 struct fs *fs;
936 fs = ump->um_fs;
939 VFSATTR_RETURN(fsap, f_bsize, fs->fs_fsize);
940 VFSATTR_RETURN(fsap, f_iosize, fs->fs_bsize);
941 VFSATTR_RETURN(fsap, f_blocks, (uint64_t)((unsigned long)fs->fs_dsize));
943 (fs->fs_cstotal.cs_nbfree * fs->fs_frag +
944 fs->fs_cstotal.cs_nffree)));
945 VFSATTR_RETURN(fsap, f_bavail, (uint64_t)((unsigned long)freespace(fs,
946 fs->fs_minfree)));
948 (fs->fs_ncg * fs->fs_ipg - ROOTINO)));
950 fs->fs_cstotal.cs_nifree));
1181 struct fs *fs;
1186 fs = ump->um_fs;
1187 if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */
1188 printf("fs = %s\n", fs->fs_fsmnt);
1218 if (fs->fs_fmod != 0) {
1219 fs->fs_fmod = 0;
1221 fs->fs_time = tv.tv_sec;
1256 struct fs *fs;
1303 ip->i_fs = fs = ump->um_fs;
1320 if (error = (int)buf_bread(ump->um_devvp, (daddr64_t)((unsigned)fsbtodb(fs, ino_to_fsba(fs, ino))),
1321 (int)fs->fs_bsize, NOCRED, &bp)) {
1327 byte_swap_inode_in(((struct dinode *)buf_dataptr(bp) + ino_to_fsbo(fs, ino)),ip);
1329 ip->i_din = *((struct dinode *)buf_dataptr(bp) + ino_to_fsbo(fs, ino));
1332 ip->i_din = *((struct dinode *)buf_dataptr(bp) + ino_to_fsbo(fs, ino));
1422 if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
1464 struct fs *fs;
1471 fs = VFSTOUFS(mp)->um_fs;
1473 if (ino < ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
1563 register struct fs *dfs, *fs = mp->um_fs;
1576 blks = howmany(fs->fs_cssize, fs->fs_fsize);
1577 space = fs->fs_csp;
1578 for (i = 0; i < blks; i += fs->fs_frag) {
1579 size = fs->fs_bsize;
1580 if (i + fs->fs_frag > blks)
1581 size = (blks - i) * fs->fs_fsize;
1582 bp = buf_getblk(mp->um_devvp, (daddr64_t)((unsigned)fsbtodb(fs, fs->fs_csaddr + i)),
1605 bp = buf_getblk(mp->um_devvp, (daddr64_t)((unsigned)(SBOFF/devBlockSize)), (int)fs->fs_sbsize, 0, 0, BLK_META);
1606 bcopy((caddr_t)fs, (char *)buf_dataptr(bp), (u_int)fs->fs_sbsize);
1608 dfs = (struct fs *)buf_dataptr(bp); /* XXX */
1609 if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
1618 byte_swap_sbout((struct fs *)buf_dataptr(bp));
1621 if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */