Increase efficiency of CONFIG_NET=n
PATCH 1/1 Increase efficiency of CONFIG_NET=n
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?
net/Makefile +2 -1
@@ -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/
net/nonet.c +122 -0
122 lines not on this page · raw message
Signature · 3 lines
"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
net/nonet.c line 35
Quoted 4 lines · Matthew Wilcox
net/nonet.c +4
-0+asmlinkage long sys_socket (int family,int type,int protocol) +{ +return -ENOSYS ; +}
Please just use cond_syscall in kernel/sys.c for all this stubbed out syscalls.
Quoted 8 lines · Christoph Hellwig
Review
Quoted 4 lines · Matthew Wilcox
(quoted diff) +4
-0+asmlinkage long sys_socket(int family, int type, int protocol) +{ + return -ENOSYS; +}Please just use
cond_syscallinkernel/sys.cfor all this stubbed out syscalls.
OK.
kernel/sys.c +17 -0
@@ -209,6 +209,23 @@ cond_syscall(sys_swapon)cond_syscall (sys_swapoff)cond_syscall (sys_init_module )cond_syscall (sys_delete_module) +cond_syscall (sys_socketpair) +cond_syscall (sys_bind) +cond_syscall (sys_listen) +cond_syscall (sys_accept) +cond_syscall (sys_connect) +cond_syscall (sys_getsockname) +cond_syscall (sys_getpeername) +cond_syscall (sys_sendto) +cond_syscall (sys_send) +cond_syscall (sys_recvfrom) +cond_syscall (sys_recv) +cond_syscall (sys_setsockopt) +cond_syscall (sys_getsockopt) +cond_syscall (sys_shutdown) +cond_syscall (sys_sendmsg) +cond_syscall (sys_recvmsg) +cond_syscall (sys_socketcall) static int set_one_prio(struct task_struct *p, int niceval, int error) {
net/Makefile +2 -1
@@ -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/
net/nonet.c +28 -0
@@ -0,0 +1,28 @@ +/* +* 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> + +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, +};
Signature · 3 lines
"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