shithub: riscv

Download patch

ref: 4d4fc2ca3453a4deb79b26eb62449eab94b86827
parent: 65b058830b619bf682c8900a207d2c6b87d2c37e
author: aiju <devnull@localhost>
date: Sat Apr 16 10:15:01 EDT 2011

moved /dev/mordor to devcons

--- a/sys/man/3/arch
+++ b/sys/man/3/arch
@@ -12,7 +12,6 @@
 .B /dev/iol
 .B /dev/iow
 .B /dev/irqalloc
-.B /dev/mordor
 .SH DESCRIPTION
 This device presents textual information about PC hardware and allows
 user-level control of the I/O ports on x86-class and DEC Alpha machines.
@@ -122,10 +121,6 @@
 I/O ports.
 The port accessed is determined by the byte offset of the
 file descriptor.
-.PP
-Reads and writes to
-.IR mordor
-will inevitably cause the front to fall off.
 .SH EXAMPLE
 The following code reads from an x86 byte I/O port.
 .IP
--- a/sys/man/3/cons
+++ b/sys/man/3/cons
@@ -334,6 +334,10 @@
 See
 .IR swap (8).
 .PP
+Reads and writes to
+.IR mordor
+will inevitably cause the front to fall off.
+.PP
 The other files served by the
 .I cons
 device are all single numbers:
--- a/sys/src/9/pc/devarch.c
+++ b/sys/src/9/pc/devarch.c
@@ -987,20 +987,6 @@
 	return n;
 }
 
-static long
-mordorread(Chan*, void*, long, vlong)
-{
-	error("one does not simply read from mordor");
-	return 0;
-}
-
-static long
-mordorwrite(Chan*, void*, long, vlong)
-{
-	error("one does not simply write into mordor");
-	return 0;
-}
-
 void
 archinit(void)
 {
@@ -1049,7 +1035,6 @@
 
 	addarchfile("cputype", 0444, cputyperead, nil);
 	addarchfile("archctl", 0664, archctlread, archctlwrite);
-	addarchfile("mordor", 0666, mordorread, mordorwrite);
 }
 
 /*
--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -594,6 +594,7 @@
 	Qtime,
 	Quser,
 	Qzero,
+	Qmordor,
 	Qconfig,
 };
 
@@ -627,6 +628,7 @@
 	"user",		{Quser},	0,		0666,
 	"zero",		{Qzero},	0,		0444,
 	"config",	{Qconfig},	0,		0444,
+	"mordor",	{Qmordor},	0,		0666,
 };
 
 int
@@ -958,6 +960,10 @@
 	case Qzero:
 		memset(buf, 0, n);
 		return n;
+	
+	case Qmordor:
+		error("one does not simply read from mordor");
+		return 0;
 
 	case Qosversion:
 		snprint(tmp, sizeof tmp, "2000");
@@ -1122,6 +1128,10 @@
 			buf[n-1] = 0;
 		kstrdup(&sysname, buf);
 		break;
+	
+	case Qmordor:
+		error("one does not simply write to mordor");
+		return 0;
 
 	default:
 		print("conswrite: %#llux\n", c->qid.path);