File:  [MW Coherent from dump] / coherent / b / kernel / tools / ftmkdev.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:37 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * File:	ftmkdev.c
 *
 * Purpose:	create nodes for floppy tape
 *
 * $Log: ftmkdev.c,v $
 * Revision 1.1.1.1  2019/05/29 04:56:37  root
 * coherent
 *
 * Revision 1.1  93/06/14  13:29:32  bin
 * Initial revision
 * 
 */
/*
 * ----------------------------------------------------------------------
 * Includes.
 */
#include <sys/xlft.h>

/*
 * ----------------------------------------------------------------------
 * Definitions.
 *	Constants.
 *	Macros with argument lists.
 *	Typedefs.
 *	Enums.
 */
#define LO_MN		0x40		/* low minor number to generate  */
#define NUM_DEVS	64		/* number of devices to generate */

#define DNAME_LEN	20

/*
 * ----------------------------------------------------------------------
 * Functions.
 *	Import Functions.
 *	Export Functions.
 *	Local Functions.
 */
static void genName();

/*
 * ----------------------------------------------------------------------
 * Global Data.
 *	Import Variables.
 *	Export Variables.
 *	Local Variables.
 */

/*
 * ----------------------------------------------------------------------
 * Code.
 */

main(argc, argv)
int argc;
char * argv[];
{
	int	m;	/* minor number */
	char	dname[DNAME_LEN];

	printf("/bin/mkdir /dev/ft\n");
	printf("/bin/chmog 777 sys sys /dev/ft\n");

	for (m = LO_MN; m < LO_MN + NUM_DEVS; m++) {

		/* Generate device name. */
		genName(m, dname);

		printf("/etc/mknod -f /dev/ft/%s c 4 %d\n", dname, m);
	}
	printf("/bin/chmog 666 sys sys /dev/ft/*\n");
}

static void
genName(m, str)
int m;
char * str;
{
	int	unit, format, control, noRewind, retension;

	unit = m & M_UNT;
	format = m & M_FMT;
	control = m & M_CTL;
	noRewind = m & M_REW;
	retension = m & M_RET;

	sprintf(str, "f%dq%d0%s%s%s",
	  unit,
	  (format) ? 8 : 4,
	  (control) ? "c" : "",
	  (noRewind) ? "n" : "",
	  (retension) ? "r" : "");
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.