Plan 9 from Bell Labs’s /usr/web/sources/nix/nix/sys/src/cmd/creepy/fsfmt.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "all.h"

int
usrid(char*)
{
	return 3;
}

char*
usrname(int)
{
	return "sys";
}

int
member(int uid, int member)
{
	return uid == member;
}

int
allowed(int)
{
	return 1;
}

void
meltfids(void)
{
}

void
rwusers(Memblk*)
{
}

char*
ninestats(char *s, char*, int, int)
{
	return s;
}

char*
ixstats(char *s, char*, int, int)
{
	return s;
}

void
countfidrefs(void)
{
}

static void
usage(void)
{
	fprint(2, "usage: %s [-DFLAGS] [-vy] [disk]\n", argv0);
	exits("usage");
}

void
threadmain(int argc, char *argv[])
{
	char *dev;
	int verb, force;

	dev = "disk";
	verb = force = 0;
	ARGBEGIN{
	case 'v':
		verb = 1;
		break;
	case 'y':
		force = 1;
		break;
	default:
		if((ARGC() >= 'A' && ARGC() <= 'Z') || ARGC() == '9'){
			dbg['d'] = 1;
			dbg[ARGC()] = 1;
			fatalaborts = 1;
		}else
			usage();
	}ARGEND;
	if(argc == 1)
		dev = argv[0];
	else if(argc > 0)
		usage();
	fmtinstall('P', pathfmt);
	fmtinstall('H', mbfmt);
	fmtinstall('M', dirmodefmt);
	errinit(Errstack);
	if(catcherror())
		fatal("error: %r");
	fsfmt(dev, force);
	if(verb)
		fsdump(0, Mem);
	else
		print("%lld %ldK blocks\n", fs->ndblk, Dblksz/1024);
	noerror();
	exits(nil);
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.