diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-03-19 16:47:20 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-03-19 16:47:20 +0000 |
commit | 959fd0e42e1d0e39c9ceaf52922de94d9f22135c (patch) | |
tree | 237aa18f7b8a7b088b07b894e223b8c6dd97e410 /sbin/newfs/mkfs.c | |
parent | 2423fff46fa1d2f7925c0dddf4dbcaa47a8c7e2c (diff) | |
download | FreeBSD-src-959fd0e42e1d0e39c9ceaf52922de94d9f22135c.zip FreeBSD-src-959fd0e42e1d0e39c9ceaf52922de94d9f22135c.tar.gz |
Remove the ancient STANDALONE code.
Approved by: phk
Diffstat (limited to 'sbin/newfs/mkfs.c')
-rw-r--r-- | sbin/newfs/mkfs.c | 119 |
1 files changed, 1 insertions, 118 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 0c2c13f..5d78010 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -41,6 +41,7 @@ static const char rcsid[] = #include <err.h> #include <signal.h> +#include <stdlib.h> #include <string.h> #include <stdio.h> #include <unistd.h> @@ -58,13 +59,6 @@ static const char rcsid[] = #include <sys/mman.h> #include <sys/ioctl.h> -#ifndef STANDALONE -#include <stdlib.h> -#else -extern int atoi (char *); -extern char * getenv (char *); -#endif - #ifdef FSIRAND extern long random (void); extern void srandomdev (void); @@ -118,7 +112,6 @@ extern int bbsize; /* boot block size */ extern int sbsize; /* superblock size */ extern int avgfilesize; /* expected average file size */ extern int avgfilesperdir; /* expected number of files per directory */ -extern u_long memleft; /* virtual memory available */ union { struct fs fs; @@ -153,14 +146,6 @@ void setblock (struct fs *, unsigned char *, int); void wtfs (daddr_t, int, char *); void wtfsflush (void); -#ifndef STANDALONE -#else -void free (char *); -char * calloc (u_long, u_long); -caddr_t malloc (u_long); -caddr_t realloc (char *, u_long); -#endif - void mkfs(pp, fsys, fi, fo) struct partition *pp; @@ -178,9 +163,7 @@ mkfs(pp, fsys, fi, fo) int width; char tmpbuf[100]; /* XXX this will break in about 2,500 years */ -#ifndef STANDALONE time(&utime); -#endif #ifdef FSIRAND if (!randinit) { randinit = 1; @@ -1101,94 +1084,6 @@ iput(ip, ino) wtfs(d, sblock.fs_bsize, (char *)buf); } -#ifdef STANDALONE -/* - * Replace libc function with one suited to our needs. - */ -caddr_t -malloc(size) - u_long size; -{ - char *base, *i; - static u_long pgsz; - struct rlimit rlp; - - if (pgsz == 0) { - base = sbrk(0); - pgsz = getpagesize() - 1; - i = (char *)((u_long)(base + pgsz) & ~pgsz); - base = sbrk(i - base); - if (getrlimit(RLIMIT_DATA, &rlp) < 0) - warn("getrlimit"); - rlp.rlim_cur = rlp.rlim_max; - if (setrlimit(RLIMIT_DATA, &rlp) < 0) - warn("setrlimit"); - memleft = rlp.rlim_max - (u_long)base; - } - size = (size + pgsz) & ~pgsz; - if (size > memleft) - size = memleft; - memleft -= size; - if (size == 0) - return (0); - return ((caddr_t)sbrk(size)); -} - -/* - * Replace libc function with one suited to our needs. - */ -caddr_t -realloc(ptr, size) - char *ptr; - u_long size; -{ - void *p; - - if ((p = malloc(size)) == NULL) - return (NULL); - memmove(p, ptr, size); - free(ptr); - return (p); -} - -/* - * Replace libc function with one suited to our needs. - */ -char * -calloc(size, numelm) - u_long size, numelm; -{ - caddr_t base; - - size *= numelm; - if ((base = malloc(size)) == NULL) - return (NULL); - memset(base, 0, size); - return (base); -} - -/* - * Replace libc function with one suited to our needs. - */ -void -free(ptr) - char *ptr; -{ - - /* do not worry about it for now */ -} - -#else /* !STANDALONE */ - -#ifdef __ELF__ -extern char *_etext; -#define etext _etext -#else -extern char *etext; -#endif - -#endif /* STANDALONE */ - /* * read a block from the file system */ @@ -1307,11 +1202,7 @@ isblock(fs, cp, h) mask = 0x01 << (h & 0x7); return ((cp[h >> 3] & mask) == mask); default: -#ifdef STANDALONE - printf("isblock bad fs_frag %d\n", fs->fs_frag); -#else fprintf(stderr, "isblock bad fs_frag %d\n", fs->fs_frag); -#endif return (0); } } @@ -1339,11 +1230,7 @@ clrblock(fs, cp, h) cp[h >> 3] &= ~(0x01 << (h & 0x7)); return; default: -#ifdef STANDALONE - printf("clrblock bad fs_frag %d\n", fs->fs_frag); -#else fprintf(stderr, "clrblock bad fs_frag %d\n", fs->fs_frag); -#endif return; } } @@ -1371,11 +1258,7 @@ setblock(fs, cp, h) cp[h >> 3] |= (0x01 << (h & 0x7)); return; default: -#ifdef STANDALONE - printf("setblock bad fs_frag %d\n", fs->fs_frag); -#else fprintf(stderr, "setblock bad fs_frag %d\n", fs->fs_frag); -#endif return; } } |