Deleted Added
full compact
mkfs.c (115235) mkfs.c (118493)
1/*
2 * Copyright (c) 2002 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by Marshall
6 * Kirk McKusick and Network Associates Laboratories, the Security
7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR
8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS

--- 32 unchanged lines hidden (view full) ---

41 */
42
43#if 0
44#ifndef lint
45static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
46#endif /* not lint */
47#endif
48#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2002 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by Marshall
6 * Kirk McKusick and Network Associates Laboratories, the Security
7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR
8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS

--- 32 unchanged lines hidden (view full) ---

41 */
42
43#if 0
44#ifndef lint
45static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
46#endif /* not lint */
47#endif
48#include <sys/cdefs.h>
49__FBSDID("$FreeBSD: head/sbin/newfs/mkfs.c 115235 2003-05-22 18:38:54Z dougb $");
49__FBSDID("$FreeBSD: head/sbin/newfs/mkfs.c 118493 2003-08-05 13:35:17Z yar $");
50
51#include <err.h>
52#include <limits.h>
53#include <signal.h>
54#include <stdlib.h>
55#include <string.h>
56#include <stdint.h>
57#include <stdio.h>

--- 726 unchanged lines hidden (view full) ---

784alloc(int size, int mode)
785{
786 int i, d, blkno, frag;
787
788 bread(&disk, fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg,
789 sblock.fs_cgsize);
790 if (acg.cg_magic != CG_MAGIC) {
791 printf("cg 0: bad magic number\n");
50
51#include <err.h>
52#include <limits.h>
53#include <signal.h>
54#include <stdlib.h>
55#include <string.h>
56#include <stdint.h>
57#include <stdio.h>

--- 726 unchanged lines hidden (view full) ---

784alloc(int size, int mode)
785{
786 int i, d, blkno, frag;
787
788 bread(&disk, fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg,
789 sblock.fs_cgsize);
790 if (acg.cg_magic != CG_MAGIC) {
791 printf("cg 0: bad magic number\n");
792 return (0);
792 exit(38);
793 }
794 if (acg.cg_cs.cs_nbfree == 0) {
795 printf("first cylinder group ran out of space\n");
793 }
794 if (acg.cg_cs.cs_nbfree == 0) {
795 printf("first cylinder group ran out of space\n");
796 return (0);
796 exit(39);
797 }
798 for (d = 0; d < acg.cg_ndblk; d += sblock.fs_frag)
799 if (isblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag))
800 goto goth;
801 printf("internal error: can't find block in cyl 0\n");
797 }
798 for (d = 0; d < acg.cg_ndblk; d += sblock.fs_frag)
799 if (isblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag))
800 goto goth;
801 printf("internal error: can't find block in cyl 0\n");
802 return (0);
802 exit(40);
803goth:
804 blkno = fragstoblks(&sblock, d);
805 clrblock(&sblock, cg_blksfree(&acg), blkno);
806 if (sblock.fs_contigsumsize > 0)
807 clrbit(cg_clustersfree(&acg), blkno);
808 acg.cg_cs.cs_nbfree--;
809 sblock.fs_cstotal.cs_nbfree--;
810 fscs[0].cs_nbfree--;

--- 191 unchanged lines hidden ---
803goth:
804 blkno = fragstoblks(&sblock, d);
805 clrblock(&sblock, cg_blksfree(&acg), blkno);
806 if (sblock.fs_contigsumsize > 0)
807 clrbit(cg_clustersfree(&acg), blkno);
808 acg.cg_cs.cs_nbfree--;
809 sblock.fs_cstotal.cs_nbfree--;
810 fscs[0].cs_nbfree--;

--- 191 unchanged lines hidden ---