From rmh@khazad.dyndns.org  Mon Jul 12 21:24:50 2004
Return-Path: <rmh@khazad.dyndns.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2B89016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Jul 2004 21:24:50 +0000 (GMT)
Received: from khazad.dyndns.org (86.Red-80-24-13.pooles.rima-tde.net [80.24.13.86])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5DF5843D31
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Jul 2004 21:24:44 +0000 (GMT)
	(envelope-from rmh@khazad.dyndns.org)
Received: from rmh by khazad.dyndns.org with local (Exim 3.36 #1 (Debian))
	id 1Bk8Hc-0005iz-00
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Jul 2004 23:24:20 +0200
Message-Id: <E1Bk8Hc-0005iz-00@khazad.dyndns.org>
Date: Mon, 12 Jul 2004 23:24:20 +0200
From: Robert Millan <rmh@debian.org>
Sender: <rmh@khazad.dyndns.org>
Reply-To: Robert Millan <rmh@debian.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Implement /dev/full
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         68961
>Category:       kern
>Synopsis:       [PATCH] Implement /dev/full
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 12 21:30:22 GMT 2004
>Closed-Date:    Mon Mar 28 12:59:16 GMT 2005
>Last-Modified:  Sun Dec 13 17:00:07 UTC 2009
>Originator:     Robert Millan
>Release:        FreeBSD 5.2.1
>Organization:
Debian
>Environment:
System: GNU/Linux aragorn 2.4.26-1-k7 #1 Sat May 1 21:40:09 EST 2004 i686
Architecture: i686

	
>Description:
	This patch implements /dev/full, a device that returns ENOSPC when
	attempting to write on it. It is commonly used on other Un*x OSes
	(e.g. GNU/Linux) and some applications assume it is present.

	Note: I'm the maintainer of the Debian package "kfreebsd5" (kernel
	of FreeBSD 5.x). I have made some changes to the kernel for portability
	and some improvements, and I'll be forwarding more patches in the
	future.

>How-To-Repeat:
	
>Fix:

I don't know the policy for assigning minor numbers, so I just defined
FULL_MINOR as 3 which apparently is free. Let me know if I missed something.

--- src/sys/dev/null/null.c.old	2004-07-12 20:20:37.000000000 +0200
+++ src/sys/dev/null/null.c	2004-07-12 20:27:10.000000000 +0200
@@ -41,14 +41,17 @@
 
 /* For use with destroy_dev(9). */
 static dev_t null_dev;
+static dev_t full_dev;
 static dev_t zero_dev;
 
 static d_write_t null_write;
+static d_write_t full_write;
 static d_ioctl_t null_ioctl;
 static d_read_t zero_read;
 
 #define CDEV_MAJOR	2
 #define NULL_MINOR	2
+#define FULL_MINOR	3
 #define ZERO_MINOR	12
 
 static struct cdevsw null_cdevsw = {
@@ -60,6 +63,15 @@
 	.d_flags =	D_NOGIANT,
 };
 
+static struct cdevsw full_cdevsw = {
+	.d_read =	(d_read_t *)nullop,
+	.d_write =	full_write,
+	.d_ioctl =	null_ioctl,
+	.d_name =	"full",
+	.d_maj =	CDEV_MAJOR,
+	.d_flags =	D_NOGIANT,
+};
+
 static struct cdevsw zero_cdevsw = {
 	.d_read =	zero_read,
 	.d_write =	null_write,
@@ -80,6 +92,14 @@
 
 /* ARGSUSED */
 static int
+full_write(dev_t dev __unused, struct uio *uio, int flags __unused)
+{
+	uio->uio_resid = 0;
+	return (ENOSPC);
+}
+
+/* ARGSUSED */
+static int
 null_ioctl(dev_t dev __unused, u_long cmd, caddr_t data __unused,
     int flags __unused, struct thread *td)
 {
@@ -120,10 +140,13 @@
 			GID_WHEEL, 0666, "zero");
 		null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT,
 			GID_WHEEL, 0666, "null");
+		full_dev = make_dev(&full_cdevsw, FULL_MINOR, UID_ROOT,
+			GID_WHEEL, 0666, "full");
 		return 0;
 
 	case MOD_UNLOAD:
 		destroy_dev(null_dev);
+		destroy_dev(full_dev);
 		destroy_dev(zero_dev);
 		free(zbuf, M_TEMP);
 		return 0;

>Release-Note:
>Audit-Trail:

From: "David O'Brien" <obrien@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, rmh@debian.org
Cc:  
Subject: Re: kern/68961: [PATCH] Impliement /dev/full
Date: Sat, 17 Jul 2004 20:14:51 -0700

 I just don't see the point in /dev/full.  Could you please give some good
 examples of its use?  Also what "Un*x OSes" besides Linux has this?
 
 -- 
 -- David  (obrien@FreeBSD.org)
State-Changed-From-To: open->feedback 
State-Changed-By: markm 
State-Changed-When: Sun Aug 1 18:19:30 GMT 2004 
State-Changed-Why:  
Could I please ask you to re-implement this as part of the Linux 
emulator? The only OS that we seem to be able to find that uses this 
is Linux, so it makes most sense to add it to the Linux compatibility 
layer. 


Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: markm 
Responsible-Changed-When: Sun Aug 1 18:19:30 GMT 2004 
Responsible-Changed-Why:  
Could I please ask you to re-implement this as part of the Linux 
emulator? The only OS that we seem to be able to find that uses this 
is Linux, so it makes most sense to add it to the Linux compatibility 
layer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68961 
State-Changed-From-To: feedback->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 28 12:57:11 GMT 2005 
State-Changed-Why:  
It has been agreed/decided by the kernel architect gurus that 
this is not a good idea right now. Sorry! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68961 

From: Robert Millan <rmh@aybabtu.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/68961: [PATCH] Implement /dev/full
Date: Mon, 20 Feb 2006 10:54:22 +0100

 --EeQfGwPcQSOJBaQU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 Hi!
 
 I've re-implemented /dev/full as part of the Linux compatibility module as
 requested.
 
 Please could you consider the attached patch?
 
 -- 
 Robert Millan
 
 --EeQfGwPcQSOJBaQU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="linux_full.diff"
 
 --- sys/modules/linux/Makefile~	2006-02-19 19:53:06.000000000 +0100
 +++ sys/modules/linux/Makefile	2006-02-19 20:43:55.000000000 +0100
 @@ -3,7 +3,7 @@
  .PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux
  
  KMOD=	linux
 -SRCS=	linux_dummy.c linux_file.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
 +SRCS=	linux_dummy.c linux_file.c linux_full.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
  	linux_machdep.c linux_mib.c linux_misc.c linux_signal.c linux_socket.c \
  	linux_stats.c linux_sysctl.c linux_sysent.c linux_sysvec.c \
  	linux_util.c opt_compat.h opt_inet6.h opt_mac.h \
 diff -Nur sys/compat/linux.old/linux_full.c sys/compat/linux/linux_full.c
 --- sys/compat/linux.old/linux_full.c	1970-01-01 01:00:00.000000000 +0100
 +++ sys/compat/linux/linux_full.c	2006-02-20 08:00:28.000000000 +0100
 @@ -0,0 +1,114 @@
 +/*-
 + * Copyright (c) 2000 Mark R. V. Murray & Jeroen C. van Gelderen
 + * Copyright (c) 2001-2004 Mark R. V. Murray
 + * 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
 + *    in this position and unchanged.
 + * 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 AUTHORS ``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 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.
 + *
 + */
 +
 +#include <sys/cdefs.h>
 +
 +
 +#include <sys/param.h>
 +#include <sys/systm.h>
 +#include <sys/conf.h>
 +#include <sys/uio.h>
 +#include <sys/kernel.h>
 +#include <sys/malloc.h>
 +#include <sys/module.h>
 +#include <sys/disk.h>
 +#include <sys/bus.h>
 +#include <machine/bus.h>
 +
 +/* For use with destroy_dev(9). */
 +static struct cdev *full_dev;
 +
 +static d_write_t full_write;
 +static d_ioctl_t full_ioctl;
 +
 +#define FULL_MINOR	3
 +
 +static struct cdevsw full_cdevsw = {
 +	.d_version =	D_VERSION,
 +	.d_read =	(d_read_t *)nullop,
 +	.d_write =	full_write,
 +	.d_ioctl =	full_ioctl,
 +	.d_name =	"full",
 +};
 +
 +static void *zbuf;
 +
 +/* ARGSUSED */
 +static int
 +full_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
 +{
 +	uio->uio_resid = 0;
 +
 +	return (ENOSPC);
 +}
 +
 +/* ARGSUSED */
 +static int
 +full_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused,
 +    int flags __unused, struct thread *td)
 +{
 +	int error;
 +
 +	if (cmd != DIOCSKERNELDUMP)
 +		return (ENOIOCTL);
 +	error = suser(td);
 +	if (error)
 +		return (error);
 +	return (set_dumper(NULL));
 +}
 +
 +/* ARGSUSED */
 +static int
 +full_modevent(module_t mod __unused, int type, void *data __unused)
 +{
 +	switch(type) {
 +	case MOD_LOAD:
 +		if (bootverbose)
 +			printf("full: <full device>\n");
 +		zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO);
 +		full_dev = make_dev(&full_cdevsw, FULL_MINOR, UID_ROOT,
 +			GID_WHEEL, 0666, "full");
 +		break;
 +
 +	case MOD_UNLOAD:
 +		destroy_dev(full_dev);
 +		free(zbuf, M_TEMP);
 +		break;
 +
 +	case MOD_SHUTDOWN:
 +		break;
 +
 +	default:
 +		return (EOPNOTSUPP);
 +	}
 +
 +	return (0);
 +}
 +
 +DEV_MODULE(full, full_modevent, NULL);
 +MODULE_VERSION(full, 1);
 
 --EeQfGwPcQSOJBaQU--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/68961: commit references a PR
Date: Sat, 26 Sep 2009 12:45:38 +0000 (UTC)

 Author: bz
 Date: Sat Sep 26 12:45:28 2009
 New Revision: 197518
 URL: http://svn.freebsd.org/changeset/base/197518
 
 Log:
   lindev(4) [1] is supposed to be a collection of linux-specific pseudo
   devices that we also support, just not by default (thus only LINT or
   module builds by default).
   
   While currently there is only "/dev/full" [2], we are planning to see more
   in the future.  We may decide to change the module/dependency logic in the
   future should the list grow too long.
   
   This is not part of linux.ko as also non-linux binaries like kFreeBSD
   userland or ports can make use of this as well.
   
   Suggested by:	rwatson [1] (name)
   Submitted by:	ed [2]
   Discussed with:	markm, ed, rwatson, kib (weeks ago)
   Reviewed by:	rwatson, brueffer (prev. version)
   PR:		kern/68961
   MFC after:	6 weeks
 
 Added:
   head/share/man/man4/lindev.4   (contents, props changed)
   head/sys/dev/lindev/
   head/sys/dev/lindev/full.c   (contents, props changed)
   head/sys/dev/lindev/lindev.c   (contents, props changed)
   head/sys/dev/lindev/lindev.h   (contents, props changed)
   head/sys/modules/lindev/
   head/sys/modules/lindev/Makefile   (contents, props changed)
 Modified:
   head/share/man/man4/Makefile
   head/sys/amd64/conf/NOTES
   head/sys/boot/forth/loader.conf
   head/sys/conf/files.amd64
   head/sys/conf/files.i386
   head/sys/conf/files.pc98
   head/sys/i386/conf/NOTES
   head/sys/modules/Makefile
   head/sys/pc98/conf/NOTES
 
 Modified: head/share/man/man4/Makefile
 ==============================================================================
 --- head/share/man/man4/Makefile	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/share/man/man4/Makefile	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -173,6 +173,7 @@ MAN=	aac.4 \
  	le.4 \
  	led.4 \
  	lge.4 \
 +	${_lindev.4} \
  	${_linux.4} \
  	lmc.4 \
  	lo.4 \
 @@ -625,6 +626,7 @@ _if_urtw.4=	if_urtw.4
  _if_wpi.4=	if_wpi.4
  _ipmi.4=	ipmi.4
  _io.4=		io.4
 +_lindev.4=	lindev.4
  _linux.4=	linux.4
  _ndis.4=	ndis.4
  _nfe.4=		nfe.4
 @@ -636,6 +638,8 @@ _speaker.4=	speaker.4
  _spkr.4=	spkr.4
  _urtw.4=	urtw.4
  _wpi.4=		wpi.4
 +
 +MLINKS+=lindev.4 full.4
  .endif
  
  .if exists(${.CURDIR}/man4.${MACHINE_ARCH})
 
 Added: head/share/man/man4/lindev.4
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/share/man/man4/lindev.4	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -0,0 +1,73 @@
 +.\"-
 +.\" Copyright (c) 2009 "Bjoern A. Zeeb" <bz@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 September 26, 2009
 +.Dt LINDEV 4
 +.Os
 +.Sh NAME
 +.Nm lindev
 +.Nd the lindev module
 +.Sh SYNOPSIS
 +To compile this collection of linux-specific pseudo devices into the kernel,
 +place the following line in your kernel configuration file:
 +.Bd -ragged -offset indent
 +.Cd "device lindev"
 +.Ed
 +.Pp
 +Alternatively, to load the driver as a module at boot time,
 +place the following line in
 +.Xr loader.conf 5 :
 +.Bd -literal -offset indent
 +lindev_load="YES"
 +.Ed
 +.Sh DESCRIPTION
 +The
 +.Nm
 +module provides a collection of linux-specific pseudo devices.
 +.Sh DEVICES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +The
 +.Xr full
 +device always returns
 +.Er ENOSPC
 +on write attempts.
 +For reads it emulates
 +.Xr zero 4 .
 +.El
 +.Sh FILES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +.El
 +.Sh SEE ALSO
 +.Xr null 4 ,
 +.Xr zero 4
 +.Sh HISTORY
 +The
 +.Nm
 +module first appeared in
 +.Fx 9.0 .
 
 Modified: head/sys/amd64/conf/NOTES
 ==============================================================================
 --- head/sys/amd64/conf/NOTES	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/amd64/conf/NOTES	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -517,3 +517,6 @@ options 	VM_KMEM_SIZE_SCALE
  # Enable NDIS binary driver support
  options 	NDISAPI
  device		ndis
 +
 +# Linux-specific pseudo devices support
 +device		lindev
 
 Modified: head/sys/boot/forth/loader.conf
 ==============================================================================
 --- head/sys/boot/forth/loader.conf	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/boot/forth/loader.conf	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -179,6 +179,7 @@ screensave_name="green_saver"	# Set to t
  ibcs2_load="NO"			# IBCS2 (SCO) emulation
  ibcs2_coff_load="NO"
  linux_load="NO"			# Linux emulation
 +lindev_load="NO"		# Linux-specific pseudo devices (see lindev(4))
  svr4_load="NO"			# SystemV R4 emulation
  streams_load="NO"		# System V streams module
  
 
 Modified: head/sys/conf/files.amd64
 ==============================================================================
 --- head/sys/conf/files.amd64	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/conf/files.amd64	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -208,6 +208,8 @@ dev/hwpmc/hwpmc_piv.c		optional	hwpmc
  dev/hwpmc/hwpmc_tsc.c		optional	hwpmc
  dev/hwpmc/hwpmc_x86.c		optional	hwpmc
  dev/kbd/kbd.c			optional	atkbd | sc | ukbd | usb2_input_kbd
 +dev/lindev/full.c		optional	lindev
 +dev/lindev/lindev.c		optional	lindev
  dev/mem/memutil.c		optional	mem
  dev/nfe/if_nfe.c		optional	nfe pci
  dev/nve/if_nve.c		optional	nve pci
 
 Modified: head/sys/conf/files.i386
 ==============================================================================
 --- head/sys/conf/files.i386	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/conf/files.i386	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -201,6 +201,8 @@ dev/ipmi/ipmi_pci.c		optional ipmi pci
  dev/ipmi/ipmi_linux.c		optional ipmi compat_linux
  dev/kbd/kbd.c			optional atkbd | sc | ukbd | usb2_input_kbd
  dev/le/if_le_isa.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_isa.c		optional mse isa
 
 Modified: head/sys/conf/files.pc98
 ==============================================================================
 --- head/sys/conf/files.pc98	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/conf/files.pc98	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -107,6 +107,8 @@ dev/hwpmc/hwpmc_x86.c		optional hwpmc
  dev/io/iodev.c			optional io
  dev/kbd/kbd.c			optional pckbd | sc | ukbd | usb2_input_kbd
  dev/le/if_le_cbus.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_cbus.c		optional mse isa
 
 Added: head/sys/dev/lindev/full.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/sys/dev/lindev/full.c	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -0,0 +1,103 @@
 +/*-
 + * Copyright (c) 2009 Ed Schouten <ed@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.
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/param.h>
 +#include <sys/conf.h>
 +#include <sys/kernel.h>
 +#include <sys/malloc.h>
 +#include <sys/module.h>
 +#include <sys/systm.h>
 +#include <sys/uio.h>
 +
 +#include <dev/lindev/lindev.h>
 +
 +static struct cdev *full_dev;
 +
 +static d_read_t full_read;
 +static d_write_t full_write;
 +
 +static struct cdevsw full_cdevsw = {
 +	.d_version =	D_VERSION,
 +	.d_read =	full_read,
 +	.d_write =	full_write,
 +	.d_name =	"full",
 +};
 +
 +static void *zbuf;
 +
 +/* ARGSUSED */
 +static int
 +full_read(struct cdev *dev __unused, struct uio *uio, int flags __unused)
 +{
 +	int error = 0;
 +
 +	while (uio->uio_resid > 0 && error == 0)
 +		error = uiomove(zbuf, MIN(uio->uio_resid, PAGE_SIZE), uio);
 +
 +	return (error);
 +}
 +
 +/* ARGSUSED */
 +static int
 +full_write(struct cdev *dev __unused, struct uio *uio __unused,
 +    int flags __unused)
 +{
 +
 +	return (ENOSPC);
 +}
 +
 +/* ARGSUSED */
 +int
 +lindev_modevent_full(module_t mod __unused, int type, void *data __unused)
 +{
 +
 +	switch(type) {
 +	case MOD_LOAD:
 +		zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO);
 +		full_dev = make_dev(&full_cdevsw, 0, UID_ROOT, GID_WHEEL,
 +		    0666, "full");
 +		if (bootverbose)
 +			printf("full: <full device>\n");
 +		break;
 +
 +	case MOD_UNLOAD:
 +		destroy_dev(full_dev);
 +		free(zbuf, M_TEMP);
 +		break;
 +
 +	case MOD_SHUTDOWN:
 +		break;
 +
 +	default:
 +		return (EOPNOTSUPP);
 +	}
 +
 +	return (0);
 +}
 +
 
 Added: head/sys/dev/lindev/lindev.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/sys/dev/lindev/lindev.c	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -0,0 +1,73 @@
 +/*-
 + * Copyright (c) 2009 "Bjoern A. Zeeb" <bz@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.
 + */
 +
 +/*
 + * "lindev" is supposed to be a collection of linux-specific devices
 + * that we also support, just not by default.
 + * While currently there is only "/dev/full", we are planning to see
 + * more in the future.
 + * This file is only the container to load/unload all supported devices;
 + * the implementation of each should go into its own file.
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/param.h>
 +#include <sys/conf.h>
 +#include <sys/kernel.h>
 +#include <sys/module.h>
 +
 +#include <dev/lindev/lindev.h>
 +
 +/* ARGSUSED */
 +static int
 +lindev_modevent(module_t mod, int type, void *data)
 +{
 +	int error;
 +
 +	switch(type) {
 +	case MOD_LOAD:
 +		error = lindev_modevent_full(mod, type, data);
 +		break;
 +
 +	case MOD_UNLOAD:
 +		error = lindev_modevent_full(mod, type, data);
 +		break;
 +
 +	case MOD_SHUTDOWN:
 +		error = lindev_modevent_full(mod, type, data);
 +		break;
 +
 +	default:
 +		return (EOPNOTSUPP);
 +	}
 +
 +	return (error);
 +}
 +
 +DEV_MODULE(lindev, lindev_modevent, NULL);
 +MODULE_VERSION(lindev, 1);
 
 Added: head/sys/dev/lindev/lindev.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/sys/dev/lindev/lindev.h	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -0,0 +1,34 @@
 +/*-
 + * Copyright (c) 2009 "Bjoern A. Zeeb" <bz@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$
 + */
 +
 +#ifndef	_DEV_LINDEV_LINDEV_H
 +#define	_DEV_LINDEV_LINDEV_H
 +
 +int lindev_modevent_full(module_t, int, void *);
 +
 +#endif /* _DEV_LINDEV_LINDEV_H */
 
 Modified: head/sys/i386/conf/NOTES
 ==============================================================================
 --- head/sys/i386/conf/NOTES	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/i386/conf/NOTES	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -880,6 +880,9 @@ device		streams		# STREAMS network drive
  options 	NDISAPI
  device		ndis
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 
 Modified: head/sys/modules/Makefile
 ==============================================================================
 --- head/sys/modules/Makefile	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/modules/Makefile	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -151,6 +151,7 @@ SUBDIR=	${_3dfx} \
  	libiconv \
  	libmbpool \
  	libmchain \
 +	${_lindev} \
  	${_linprocfs} \
  	${_linsysfs} \
  	${_linux} \
 @@ -373,6 +374,7 @@ _ie=		ie
  _if_ndis=	if_ndis
  _igb=		igb
  _io=		io
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 @@ -510,6 +512,7 @@ _ipwfw=		ipwfw
  _iwn=		iwn
  _iwnfw=		iwnfw
  _ixgb=		ixgb
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 
 Added: head/sys/modules/lindev/Makefile
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/sys/modules/lindev/Makefile	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -0,0 +1,8 @@
 +# $FreeBSD$
 +
 +.PATH: ${.CURDIR}/../../dev/lindev
 +
 +KMOD=	lindev
 +SRCS=	full.c lindev.c
 +
 +.include <bsd.kmod.mk>
 
 Modified: head/sys/pc98/conf/NOTES
 ==============================================================================
 --- head/sys/pc98/conf/NOTES	Sat Sep 26 11:44:04 2009	(r197517)
 +++ head/sys/pc98/conf/NOTES	Sat Sep 26 12:45:28 2009	(r197518)
 @@ -565,6 +565,9 @@ options 	COMPAT_SVR4	# build emulator st
  options 	DEBUG_SVR4	# enable verbose debugging
  device		streams		# STREAMS network driver (required for svr4).
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/68961: commit references a PR
Date: Sat,  5 Dec 2009 20:38:00 +0000 (UTC)

 Author: bz
 Date: Sat Dec  5 20:37:46 2009
 New Revision: 200163
 URL: http://svn.freebsd.org/changeset/base/200163
 
 Log:
   MFC r197518:
   
     lindev(4) [1] is supposed to be a collection of linux-specific pseudo
     devices that we also support, just not by default (thus only LINT or
     module builds by default).
   
     While currently there is only "/dev/full" [2], we are planning to see more
     in the future.  We may decide to change the module/dependency logic in the
     future should the list grow too long.
   
     This is not part of linux.ko as also non-linux binaries like kFreeBSD
     userland or ports can make use of this as well.
   
   Suggested by:	rwatson [1] (name)
   Submitted by:	ed [2]
   Discussed with:	markm, ed, rwatson, kib (weeks ago)
   Reviewed by:	rwatson, brueffer (prev. version)
   PR:		kern/68961
 
 Added:
   stable/8/share/man/man4/lindev.4
      - copied unchanged from r197518, head/share/man/man4/lindev.4
   stable/8/sys/dev/lindev/
      - copied from r197518, head/sys/dev/lindev/
   stable/8/sys/modules/lindev/
      - copied from r197518, head/sys/modules/lindev/
 Modified:
   stable/8/share/man/man4/Makefile
   stable/8/sys/amd64/conf/NOTES
   stable/8/sys/boot/forth/loader.conf
   stable/8/sys/conf/files.amd64
   stable/8/sys/conf/files.i386
   stable/8/sys/conf/files.pc98
   stable/8/sys/i386/conf/NOTES
   stable/8/sys/modules/Makefile
   stable/8/sys/pc98/conf/NOTES
 Directory Properties:
   stable/8/share/man/man4/   (props changed)
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
 
 Modified: stable/8/share/man/man4/Makefile
 ==============================================================================
 --- stable/8/share/man/man4/Makefile	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/share/man/man4/Makefile	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -173,6 +173,7 @@ MAN=	aac.4 \
  	le.4 \
  	led.4 \
  	lge.4 \
 +	${_lindev.4} \
  	${_linux.4} \
  	lmc.4 \
  	lo.4 \
 @@ -624,6 +625,7 @@ _if_urtw.4=	if_urtw.4
  _if_wpi.4=	if_wpi.4
  _ipmi.4=	ipmi.4
  _io.4=		io.4
 +_lindev.4=	lindev.4
  _linux.4=	linux.4
  _ndis.4=	ndis.4
  _nfe.4=		nfe.4
 @@ -635,6 +637,8 @@ _speaker.4=	speaker.4
  _spkr.4=	spkr.4
  _urtw.4=	urtw.4
  _wpi.4=		wpi.4
 +
 +MLINKS+=lindev.4 full.4
  .endif
  
  .if exists(${.CURDIR}/man4.${MACHINE_ARCH})
 
 Copied: stable/8/share/man/man4/lindev.4 (from r197518, head/share/man/man4/lindev.4)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/share/man/man4/lindev.4	Sat Dec  5 20:37:46 2009	(r200163, copy of r197518, head/share/man/man4/lindev.4)
 @@ -0,0 +1,73 @@
 +.\"-
 +.\" Copyright (c) 2009 "Bjoern A. Zeeb" <bz@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 September 26, 2009
 +.Dt LINDEV 4
 +.Os
 +.Sh NAME
 +.Nm lindev
 +.Nd the lindev module
 +.Sh SYNOPSIS
 +To compile this collection of linux-specific pseudo devices into the kernel,
 +place the following line in your kernel configuration file:
 +.Bd -ragged -offset indent
 +.Cd "device lindev"
 +.Ed
 +.Pp
 +Alternatively, to load the driver as a module at boot time,
 +place the following line in
 +.Xr loader.conf 5 :
 +.Bd -literal -offset indent
 +lindev_load="YES"
 +.Ed
 +.Sh DESCRIPTION
 +The
 +.Nm
 +module provides a collection of linux-specific pseudo devices.
 +.Sh DEVICES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +The
 +.Xr full
 +device always returns
 +.Er ENOSPC
 +on write attempts.
 +For reads it emulates
 +.Xr zero 4 .
 +.El
 +.Sh FILES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +.El
 +.Sh SEE ALSO
 +.Xr null 4 ,
 +.Xr zero 4
 +.Sh HISTORY
 +The
 +.Nm
 +module first appeared in
 +.Fx 9.0 .
 
 Modified: stable/8/sys/amd64/conf/NOTES
 ==============================================================================
 --- stable/8/sys/amd64/conf/NOTES	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/amd64/conf/NOTES	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -503,3 +503,6 @@ options 	VM_KMEM_SIZE_SCALE
  # Enable NDIS binary driver support
  options 	NDISAPI
  device		ndis
 +
 +# Linux-specific pseudo devices support
 +device		lindev
 
 Modified: stable/8/sys/boot/forth/loader.conf
 ==============================================================================
 --- stable/8/sys/boot/forth/loader.conf	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/boot/forth/loader.conf	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -179,6 +179,7 @@ screensave_name="green_saver"	# Set to t
  ibcs2_load="NO"			# IBCS2 (SCO) emulation
  ibcs2_coff_load="NO"
  linux_load="NO"			# Linux emulation
 +lindev_load="NO"		# Linux-specific pseudo devices (see lindev(4))
  svr4_load="NO"			# SystemV R4 emulation
  streams_load="NO"		# System V streams module
  
 
 Modified: stable/8/sys/conf/files.amd64
 ==============================================================================
 --- stable/8/sys/conf/files.amd64	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/conf/files.amd64	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -205,6 +205,8 @@ dev/hwpmc/hwpmc_piv.c		optional	hwpmc
  dev/hwpmc/hwpmc_tsc.c		optional	hwpmc
  dev/hwpmc/hwpmc_x86.c		optional	hwpmc
  dev/kbd/kbd.c			optional	atkbd | sc | ukbd | usb2_input_kbd
 +dev/lindev/full.c		optional	lindev
 +dev/lindev/lindev.c		optional	lindev
  dev/mem/memutil.c		optional	mem
  dev/nfe/if_nfe.c		optional	nfe pci
  dev/nve/if_nve.c		optional	nve pci
 
 Modified: stable/8/sys/conf/files.i386
 ==============================================================================
 --- stable/8/sys/conf/files.i386	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/conf/files.i386	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -198,6 +198,8 @@ dev/ipmi/ipmi_pci.c		optional ipmi pci
  dev/ipmi/ipmi_linux.c		optional ipmi compat_linux
  dev/kbd/kbd.c			optional atkbd | sc | ukbd | usb2_input_kbd
  dev/le/if_le_isa.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_isa.c		optional mse isa
 
 Modified: stable/8/sys/conf/files.pc98
 ==============================================================================
 --- stable/8/sys/conf/files.pc98	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/conf/files.pc98	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -107,6 +107,8 @@ dev/hwpmc/hwpmc_x86.c		optional hwpmc
  dev/io/iodev.c			optional io
  dev/kbd/kbd.c			optional pckbd | sc | ukbd | usb2_input_kbd
  dev/le/if_le_cbus.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_cbus.c		optional mse isa
 
 Modified: stable/8/sys/i386/conf/NOTES
 ==============================================================================
 --- stable/8/sys/i386/conf/NOTES	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/i386/conf/NOTES	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -876,6 +876,9 @@ device		streams		# STREAMS network drive
  options 	NDISAPI
  device		ndis
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 
 Modified: stable/8/sys/modules/Makefile
 ==============================================================================
 --- stable/8/sys/modules/Makefile	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/modules/Makefile	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -150,6 +150,7 @@ SUBDIR=	${_3dfx} \
  	libiconv \
  	libmbpool \
  	libmchain \
 +	${_lindev} \
  	${_linprocfs} \
  	${_linsysfs} \
  	${_linux} \
 @@ -370,6 +371,7 @@ _ie=		ie
  _if_ndis=	if_ndis
  _igb=		igb
  _io=		io
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 @@ -505,6 +507,7 @@ _ipwfw=		ipwfw
  _iwn=		iwn
  _iwnfw=		iwnfw
  _ixgb=		ixgb
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 
 Modified: stable/8/sys/pc98/conf/NOTES
 ==============================================================================
 --- stable/8/sys/pc98/conf/NOTES	Sat Dec  5 20:36:42 2009	(r200162)
 +++ stable/8/sys/pc98/conf/NOTES	Sat Dec  5 20:37:46 2009	(r200163)
 @@ -565,6 +565,9 @@ options 	COMPAT_SVR4	# build emulator st
  options 	DEBUG_SVR4	# enable verbose debugging
  device		streams		# STREAMS network driver (required for svr4).
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/68961: commit references a PR
Date: Sun, 13 Dec 2009 16:53:25 +0000 (UTC)

 Author: bz
 Date: Sun Dec 13 16:53:06 2009
 New Revision: 200479
 URL: http://svn.freebsd.org/changeset/base/200479
 
 Log:
   MFC r197518:
   
     lindev(4) [1] is supposed to be a collection of linux-specific pseudo
     devices that we also support, just not by default (thus only LINT or
     module builds by default).
   
     While currently there is only "/dev/full" [2], we are planning to see more
     in the future.  We may decide to change the module/dependency logic in the
     future should the list grow too long.
   
     This is not part of linux.ko as also non-linux binaries like kFreeBSD
     userland or ports can make use of this as well.
   
     Suggested by:		rwatson [1] (name)
     Submitted by:		ed [2]
     Discussed with:	markm, ed, rwatson, kib (weeks ago)
     Reviewed by:		rwatson, brueffer (prev. version)
   PR:			kern/68961
 
 Added:
   stable/7/share/man/man4/lindev.4
      - copied unchanged from r197518, head/share/man/man4/lindev.4
   stable/7/sys/dev/lindev/
      - copied from r197518, head/sys/dev/lindev/
   stable/7/sys/modules/lindev/
      - copied from r197518, head/sys/modules/lindev/
 Modified:
   stable/7/share/man/man4/Makefile
   stable/7/sys/amd64/conf/NOTES
   stable/7/sys/boot/forth/loader.conf
   stable/7/sys/conf/files.amd64
   stable/7/sys/conf/files.i386
   stable/7/sys/conf/files.pc98
   stable/7/sys/i386/conf/NOTES
   stable/7/sys/modules/Makefile
   stable/7/sys/pc98/conf/NOTES
 Directory Properties:
   stable/7/share/man/man4/   (props changed)
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/share/man/man4/Makefile
 ==============================================================================
 --- stable/7/share/man/man4/Makefile	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/share/man/man4/Makefile	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -156,6 +156,7 @@ MAN=	aac.4 \
  	le.4 \
  	led.4 \
  	lge.4 \
 +	${_lindev.4} \
  	lmc.4 \
  	lo.4 \
  	lp.4 \
 @@ -571,6 +572,7 @@ _if_nxge.4=	if_nxge.4
  _if_wpi.4=	if_wpi.4
  _ipmi.4=	ipmi.4
  _k8temp.4=	k8temp.4
 +_lindev.4=	lindev.4
  _nfe.4=		nfe.4
  _nfsmb.4=	nfsmb.4
  _nve.4=		nve.4
 @@ -579,6 +581,8 @@ _rr232x.4=	rr232x.4
  _speaker.4=	speaker.4
  _spkr.4=	spkr.4
  _wpi.4=		wpi.4
 +
 +MLINKS+=lindev.4 full.4
  .endif
  
  .if exists(${.CURDIR}/man4.${MACHINE_ARCH})
 
 Copied: stable/7/share/man/man4/lindev.4 (from r197518, head/share/man/man4/lindev.4)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/7/share/man/man4/lindev.4	Sun Dec 13 16:53:06 2009	(r200479, copy of r197518, head/share/man/man4/lindev.4)
 @@ -0,0 +1,73 @@
 +.\"-
 +.\" Copyright (c) 2009 "Bjoern A. Zeeb" <bz@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 September 26, 2009
 +.Dt LINDEV 4
 +.Os
 +.Sh NAME
 +.Nm lindev
 +.Nd the lindev module
 +.Sh SYNOPSIS
 +To compile this collection of linux-specific pseudo devices into the kernel,
 +place the following line in your kernel configuration file:
 +.Bd -ragged -offset indent
 +.Cd "device lindev"
 +.Ed
 +.Pp
 +Alternatively, to load the driver as a module at boot time,
 +place the following line in
 +.Xr loader.conf 5 :
 +.Bd -literal -offset indent
 +lindev_load="YES"
 +.Ed
 +.Sh DESCRIPTION
 +The
 +.Nm
 +module provides a collection of linux-specific pseudo devices.
 +.Sh DEVICES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +The
 +.Xr full
 +device always returns
 +.Er ENOSPC
 +on write attempts.
 +For reads it emulates
 +.Xr zero 4 .
 +.El
 +.Sh FILES
 +.Bl -tag -width /dev/full
 +.It Pa /dev/full
 +.El
 +.Sh SEE ALSO
 +.Xr null 4 ,
 +.Xr zero 4
 +.Sh HISTORY
 +The
 +.Nm
 +module first appeared in
 +.Fx 9.0 .
 
 Modified: stable/7/sys/amd64/conf/NOTES
 ==============================================================================
 --- stable/7/sys/amd64/conf/NOTES	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/amd64/conf/NOTES	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -681,3 +681,6 @@ options 	VM_KMEM_SIZE_SCALE
  # Enable NDIS binary driver support
  options 	NDISAPI
  device		ndis
 +
 +# Linux-specific pseudo devices support
 +device		lindev
 
 Modified: stable/7/sys/boot/forth/loader.conf
 ==============================================================================
 --- stable/7/sys/boot/forth/loader.conf	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/boot/forth/loader.conf	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -178,6 +178,7 @@ screensave_name="green_saver"	# Set to t
  ibcs2_load="NO"			# IBCS2 (SCO) emulation
  ibcs2_coff_load="NO"
  linux_load="NO"			# Linux emulation
 +lindev_load="NO"		# Linux-specific pseudo devices (see lindev(4))
  svr4_load="NO"			# SystemV R4 emulation
  streams_load="NO"		# System V streams module
  
 
 Modified: stable/7/sys/conf/files.amd64
 ==============================================================================
 --- stable/7/sys/conf/files.amd64	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/conf/files.amd64	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -187,6 +187,8 @@ dev/hwpmc/hwpmc_piv.c		optional	hwpmc
  dev/hwpmc/hwpmc_tsc.c		optional	hwpmc
  dev/hwpmc/hwpmc_x86.c		optional	hwpmc
  dev/kbd/kbd.c			optional	atkbd | sc | ukbd
 +dev/lindev/full.c		optional	lindev
 +dev/lindev/lindev.c		optional	lindev
  dev/mem/memutil.c		optional	mem
  dev/nfe/if_nfe.c		optional	nfe pci
  dev/nve/if_nve.c		optional	nve pci
 
 Modified: stable/7/sys/conf/files.i386
 ==============================================================================
 --- stable/7/sys/conf/files.i386	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/conf/files.i386	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -205,6 +205,8 @@ dev/ipmi/ipmi_ssif.c		optional ipmi smbu
  dev/ipmi/ipmi_pci.c		optional ipmi pci
  dev/kbd/kbd.c			optional atkbd | sc | ukbd | vt
  dev/le/if_le_isa.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_isa.c		optional mse isa
 
 Modified: stable/7/sys/conf/files.pc98
 ==============================================================================
 --- stable/7/sys/conf/files.pc98	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/conf/files.pc98	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -113,6 +113,8 @@ dev/hwpmc/hwpmc_x86.c		optional hwpmc
  dev/io/iodev.c			optional io
  dev/kbd/kbd.c			optional pckbd | sc | ukbd
  dev/le/if_le_cbus.c		optional le isa
 +dev/lindev/full.c		optional lindev
 +dev/lindev/lindev.c		optional lindev
  dev/mem/memutil.c		optional mem
  dev/mse/mse.c			optional mse
  dev/mse/mse_cbus.c		optional mse isa
 
 Modified: stable/7/sys/i386/conf/NOTES
 ==============================================================================
 --- stable/7/sys/i386/conf/NOTES	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/i386/conf/NOTES	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -1189,6 +1189,9 @@ device		streams		# STREAMS network drive
  options 	NDISAPI
  device		ndis
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 
 Modified: stable/7/sys/modules/Makefile
 ==============================================================================
 --- stable/7/sys/modules/Makefile	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/modules/Makefile	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -155,6 +155,7 @@ SUBDIR=	${_3dfx} \
  	libiconv \
  	libmbpool \
  	libmchain \
 +	${_lindev} \
  	${_linprocfs} \
  	${_linsysfs} \
  	${_linux} \
 @@ -413,6 +414,7 @@ _ie=		ie
  _if_ndis=	if_ndis
  _igb=		igb
  _io=		io
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 @@ -548,6 +550,7 @@ _ips=		ips
  _ipw=		ipw
  _ipwfw=		ipwfw
  _ixgb=   	ixgb
 +_lindev=	lindev
  _linprocfs=	linprocfs
  _linsysfs=	linsysfs
  _linux=		linux
 
 Modified: stable/7/sys/pc98/conf/NOTES
 ==============================================================================
 --- stable/7/sys/pc98/conf/NOTES	Sun Dec 13 15:19:01 2009	(r200478)
 +++ stable/7/sys/pc98/conf/NOTES	Sun Dec 13 16:53:06 2009	(r200479)
 @@ -717,6 +717,9 @@ options 	COMPAT_SVR4	# build emulator st
  options 	DEBUG_SVR4	# enable verbose debugging
  device		streams		# STREAMS network driver (required for svr4).
  
 +# Linux-specific pseudo devices support
 +device		lindev
 +
  
  #####################################################################
  # VM OPTIONS
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
