From: Matthew Wilcox <willy@debian.org>
To: linux-kernel@vger.kernel.org, linux-net@vger.kernel.org
Subject: [PATCH] Increase efficiency of CONFIG_NET=n
Date: Sun, 16 Mar 2003 21:43:34 +0000 [thread overview]
Message-ID: <20030316214334.GR29631@parcelfarce.linux.theplanet.co.uk> (raw)
This patch adds a file net/nonet.c and amends the Makefile to compile
this and nothing else when CONFIG_NET=n. It shaves approximately 90k
off the size of a CONFIG_NET=n build (and allows us to remove some ifdefs
from other files which is my real motivation). Still, this should make
some embedded people happy.
Comments?
diff -urpNX ../dontdiff linux-2.5.64/net/Makefile linux-2.5.64-flock/net/Makefile
--- linux-2.5.64/net/Makefile 2003-02-20 22:46:57.000000000 -0500
+++ linux-2.5.64-flock/net/Makefile 2003-03-16 16:07:00.000000000 -0500
@@ -5,8 +5,9 @@
# Rewritten to use lists instead of if-statements.
#
-obj-y := socket.o core/
+obj-y := nonet.o
+obj-$(CONFIG_NET) := socket.o core/
# LLC has to be linked before the files in net/802/
obj-$(CONFIG_LLC) += llc/
obj-$(CONFIG_NET) += ethernet/ 802/ sched/ netlink/
diff -urpNX ../dontdiff linux-2.5.64/net/nonet.c linux-2.5.64-flock/net/nonet.c
--- linux-2.5.64/net/nonet.c 1969-12-31 19:00:00.000000000 -0500
+++ linux-2.5.64-flock/net/nonet.c 2003-03-16 16:11:19.000000000 -0500
@@ -0,0 +1,122 @@
+/*
+ * net/nonet.c
+ *
+ * Dummy functions to allow us to configure network support entirely
+ * out of the kernel.
+ *
+ * Distributed under the terms of the GNU GPL version 2.
+ * Copyright (c) Matthew Wilcox 2003
+ */
+
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/linkage.h>
+#include <linux/socket.h>
+
+void __init sock_init(void)
+{
+ printk(KERN_INFO "Linux NoNET1.0 for Linux 2.6\n");
+}
+
+static int sock_no_open(struct inode *irrelevant, struct file *dontcare)
+{
+ return -ENXIO;
+}
+
+struct file_operations bad_sock_fops = {
+ .open = sock_no_open,
+};
+
+asmlinkage long sys_socket(int family, int type, int protocol)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_socketpair(int family, int type, int protocol, int usockvec[2])
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_bind(int fd, struct sockaddr *umyaddr, int addrlen)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_listen(int fd, int backlog)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_accept(int fd, struct sockaddr *upeer_sockaddr, int *upeer_addrlen)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_connect(int fd, struct sockaddr *uservaddr, int addrlen)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_getsockname(int fd, struct sockaddr *usockaddr, int *usockaddr_len)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_getpeername(int fd, struct sockaddr *usockaddr, int *usockaddr_len)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_sendto(int fd, void * buff, size_t len, unsigned flags,
+ struct sockaddr *addr, int addr_len)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_send(int fd, void * buff, size_t len, unsigned flags)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_recvfrom(int fd, void * ubuf, size_t size, unsigned flags,
+ struct sockaddr *addr, int *addr_len)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_recv(int fd, void * ubuf, size_t size, unsigned flags)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_setsockopt(int fd, int level, int optname, char *optval, int optlen)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_getsockopt(int fd, int level, int optname, char *optval, int *optlen)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_shutdown(int fd, int how)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_sendmsg(int fd, struct msghdr *msg, unsigned flags)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_recvmsg(int fd, struct msghdr *msg, unsigned int flags)
+{
+ return -ENOSYS;
+}
+
+asmlinkage long sys_socketcall(int call, unsigned long *args)
+{
+ return -ENOSYS;
+}
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
next reply other threads:[~2003-03-16 21:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-16 21:43 Matthew Wilcox [this message]
2003-03-16 23:57 ` [PATCH] Increase efficiency of CONFIG_NET=n Christoph Hellwig
2003-03-17 2:09 ` Matthew Wilcox
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=20030316214334.GR29631@parcelfarce.linux.theplanet.co.uk \
--to=willy@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox