[Midnightbsd-cvs] src [9254] trunk: add /dev/full device.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Feb 19 20:17:33 EST 2017


Revision: 9254
          http://svnweb.midnightbsd.org/src/?rev=9254
Author:   laffer1
Date:     2017-02-19 20:17:33 -0500 (Sun, 19 Feb 2017)
Log Message:
-----------
add /dev/full device.

Modified Paths:
--------------
    trunk/UPDATING
    trunk/share/man/man4/null.4
    trunk/share/man/man4/zero.4
    trunk/sys/dev/null/null.c

Added Paths:
-----------
    trunk/share/man/man4/full.4

Modified: trunk/UPDATING
===================================================================
--- trunk/UPDATING	2017-01-30 02:09:18 UTC (rev 9253)
+++ trunk/UPDATING	2017-02-20 01:17:33 UTC (rev 9254)
@@ -1,5 +1,8 @@
 Updating Information for MidnightBSD users.
 
+20170219:
+	Add /dev/full device.
+
 20170129:
 	add doas utility from OpenBSD.
 

Added: trunk/share/man/man4/full.4
===================================================================
--- trunk/share/man/man4/full.4	                        (rev 0)
+++ trunk/share/man/man4/full.4	2017-02-20 01:17:33 UTC (rev 9254)
@@ -0,0 +1,47 @@
+.\" Copyright (c) 2014
+.\"	Eitan Adler <eadler at FreeBSD.org>.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2014
+.Dt FULL 4
+.Os
+.Sh NAME
+.Nm full
+.Nd the full device
+.Sh DESCRIPTION
+The
+.Nm
+device supplies an endless stream of zeros when read.
+However, it will always be full when writing to it.
+.Sh FILES
+.Bl -tag -width /dev/full
+.It Pa /dev/full
+.El
+.Sh SEE ALSO
+.Xr null 4
+.Xr zero 4
+.Sh Author
+This device and man page was written by
+.An Eitan Adler Aq eadler at FreeBSD.org .


Property changes on: trunk/share/man/man4/full.4
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/share/man/man4/null.4
===================================================================
--- trunk/share/man/man4/null.4	2017-01-30 02:09:18 UTC (rev 9253)
+++ trunk/share/man/man4/null.4	2017-02-20 01:17:33 UTC (rev 9254)
@@ -52,6 +52,7 @@
 .It Pa /dev/null
 .El
 .Sh SEE ALSO
+.Xr full 4
 .Xr zero 4
 .Sh HISTORY
 A

Modified: trunk/share/man/man4/zero.4
===================================================================
--- trunk/share/man/man4/zero.4	2017-01-30 02:09:18 UTC (rev 9253)
+++ trunk/share/man/man4/zero.4	2017-02-20 01:17:33 UTC (rev 9254)
@@ -49,6 +49,7 @@
 .It Pa /dev/zero
 .El
 .Sh SEE ALSO
+.Xr full 4
 .Xr null 4
 .Sh HISTORY
 A

Modified: trunk/sys/dev/null/null.c
===================================================================
--- trunk/sys/dev/null/null.c	2017-01-30 02:09:18 UTC (rev 9253)
+++ trunk/sys/dev/null/null.c	2017-02-20 01:17:33 UTC (rev 9254)
@@ -1,7 +1,8 @@
-/* $MidnightBSD: src/sys/dev/null/null.c,v 1.2 2008/12/02 02:42:58 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000 Mark R. V. Murray & Jeroen C. van Gelderen
  * Copyright (c) 2001-2004 Mark R. V. Murray
+ * Copyright (c) 2014 Eitan Adler
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,7 +49,9 @@
 /* For use with destroy_dev(9). */
 static struct cdev *null_dev;
 static struct cdev *zero_dev;
+static struct cdev *full_dev;
 
+static d_write_t full_write;
 static d_write_t null_write;
 static d_ioctl_t null_ioctl;
 static d_ioctl_t zero_ioctl;
@@ -71,8 +74,25 @@
 	.d_flags =	D_MMAP_ANON,
 };
 
+static struct cdevsw full_cdevsw = {
+	.d_version =	D_VERSION,
+	.d_read =	zero_read,
+	.d_write =	full_write,
+	.d_ioctl =	zero_ioctl,
+	.d_name =	"full",
+};
+
+
 /* ARGSUSED */
 static int
+full_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
+{
+
+	return (ENOSPC);
+}
+
+/* ARGSUSED */
+static int
 null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
 {
 	uio->uio_resid = 0;
@@ -156,7 +176,9 @@
 	switch(type) {
 	case MOD_LOAD:
 		if (bootverbose)
-			printf("null: <null device, zero device>\n");
+			printf("null: <full device, null device, zero device>\n");
+		full_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &full_cdevsw, 0,
+		    NULL, UID_ROOT, GID_WHEEL, 0666, "full");
 		null_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &null_cdevsw, 0,
 		    NULL, UID_ROOT, GID_WHEEL, 0666, "null");
 		zero_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &zero_cdevsw, 0,
@@ -164,6 +186,7 @@
 		break;
 
 	case MOD_UNLOAD:
+		destroy_dev(full_dev);
 		destroy_dev(null_dev);
 		destroy_dev(zero_dev);
 		break;



More information about the Midnightbsd-cvs mailing list