LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: josh@joshtriplett.org
Cc: linux-kernel@vger.kernel.org, Tom Zanussi <tom.zanussi@linux.intel.com>
Subject: [PATCH 06/10] drivers/char: Support compiling out /dev/full
Date: Fri, 23 Jan 2015 12:37:12 -0600	[thread overview]
Message-ID: <42f8b4b6c8b37e1f349c4607feceff4472cc9d6c.1422035184.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1422035184.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1422035184.git.tom.zanussi@linux.intel.com>

Most embedded systems have no use for /dev/full, and omitting it saves
space.  Add a new EMBEDDED config option to disable it.

bloat-o-meter (based on tinyconfig):

add/remove: 0/2 grow/shrink: 0/0 up/down: 0/-122 (-122)
function                                     old     new   delta
write_full                                     6       -      -6
full_fops                                    116       -    -116

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 drivers/char/Kconfig | 11 +++++++++++
 drivers/char/mem.c   |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 00f9b8a..62290e0 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -56,6 +56,17 @@ config DEVZERO
 	  systems with strictly controlled userspace may not need it.
 	  When in doubt, say "Y".
 
+config DEVFULL
+	bool "/dev/full virtual device support" if EMBEDDED
+	depends on DEVMEM_BASE
+	default y
+	help
+	  Say Y here if you want to support the /dev/full device. The
+	  /dev/full device is used mainly for testing how programs
+	  respond to ENOSPC, and can be disabled on systems that will
+	  never use it in production, such as many embedded systems.
+	  When in doubt, say "Y".
+
 config SGI_SNSC
 	bool "SGI Altix system controller communication support"
 	depends on (IA64_SGI_SN2 || IA64_GENERIC)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 96f7a9d..5b60003 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -665,11 +665,13 @@ static int mmap_zero(struct file *file, struct vm_area_struct *vma)
 }
 #endif
 
+#ifdef CONFIG_DEVFULL
 static ssize_t write_full(struct file *file, const char __user *buf,
 			  size_t count, loff_t *ppos)
 {
 	return -ENOSPC;
 }
+#endif
 
 /*
  * Special lseek() function for /dev/null and /dev/zero.  Most notably, you
@@ -791,12 +793,14 @@ static struct backing_dev_info zero_bdi = {
 };
 #endif
 
+#ifdef CONFIG_DEVFULL
 static const struct file_operations full_fops = {
 	.llseek		= full_lseek,
 	.read		= new_sync_read,
 	.read_iter	= read_iter_zero,
 	.write		= write_full,
 };
+#endif
 
 static const struct memdev {
 	const char *name;
@@ -819,7 +823,9 @@ static const struct memdev {
 #ifdef CONFIG_DEVZERO
 	 [5] = { "zero", 0666, &zero_fops, &zero_bdi },
 #endif
+#ifdef CONFIG_DEVFULL
 	 [7] = { "full", 0666, &full_fops, NULL },
+#endif
 	 [8] = { "random", 0666, &random_fops, NULL },
 	 [9] = { "urandom", 0666, &urandom_fops, NULL },
 #ifdef CONFIG_PRINTK
-- 
1.9.3


  parent reply	other threads:[~2015-01-23 18:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 18:37 [PATCH 00/10] tinification: Make memory-access char devices optional Tom Zanussi
2015-01-23 18:37 ` [PATCH 01/10] drivers/char: Support compiling out memory-access char devices Tom Zanussi
2015-01-23 18:37 ` [PATCH 02/10] drivers/char: Support compiling out /dev/mem Tom Zanussi
2015-01-23 18:37 ` [PATCH 03/10] drivers/char: Support compiling out /dev/port Tom Zanussi
2015-01-23 18:37 ` [PATCH 04/10] drivers/char: Support compiling out /dev/null Tom Zanussi
2015-01-23 18:37 ` [PATCH 05/10] drivers/char: Support compiling out /dev/zero Tom Zanussi
2015-01-28 21:07   ` Pavel Machek
2015-01-28 21:51     ` josh
2015-01-28 21:52       ` Pavel Machek
2015-01-28 23:20       ` Tom Zanussi
2015-01-31 23:08         ` Josh Triplett
2015-01-23 18:37 ` Tom Zanussi [this message]
2015-01-23 18:37 ` [PATCH 07/10] drivers/char: Support compiling out /dev/random Tom Zanussi
2015-01-23 18:37 ` [PATCH 08/10] drivers/char: Support compiling out /dev/urandom Tom Zanussi
2015-01-23 18:37 ` [PATCH 09/10] drivers/char: Support compiling out /dev/kmsg Tom Zanussi
2015-01-23 18:37 ` [PATCH 10/10] drivers/char: Support compiling out the getrandom(2) syscall Tom Zanussi
2015-01-23 19:46   ` Theodore Ts'o
2015-01-23 20:04     ` Tom Zanussi
2015-01-23 22:30     ` josh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42f8b4b6c8b37e1f349c4607feceff4472cc9d6c.1422035184.git.tom.zanussi@linux.intel.com \
    --to=tom.zanussi@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 06/10] drivers/char: Support compiling out /dev/full' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).