--- a/Makefile Wed Jul 11 20:31:37 2012 +0900 +++ a/Makefile Tue Aug 28 17:55:08 2012 +0200 @@ -1,9 +1,9 @@ SRCDIR=$(dir $(firstword $(MAKEFILE_LIST))) INSTALL_DIR=/usr VPATH=$(SRCDIR) -KERNEL_DIR=net-next-2.6 -KERNEL_VERSION=fed66381d65a35198639f564365e61a7f256bf79 -KERNEL_DOWNLOAD=git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git +KERNEL_DIR=linux-stable +KERNEL_VERSION=763c71b1319c56272e42cf6ada6994131f0193a7 +KERNEL_DOWNLOAD=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git SIM_SRC=\ fs.c random.c sim.c softirq.c time.c \ @@ -11,10 +11,11 @@ hrtimer.c sched.c sim-socket.c sysfs.c workqueue.c \ print.c security.c slab.c tasklet.c \ proc.c seq.c socket.c tasklet-hrtimer.c \ -cred.c pid.c modules.c +cred.c pid.c modules.c filemap.c splice.c vmscan.c dcache.o super.o inode.o \ +atomic64.o -OPT?=no +OPT?=yes opt_yes=-O3 -fomit-frame-pointer opt_no=-O0 PIC?=yes @@ -29,11 +30,12 @@ -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks \ -fno-stack-protector \ -DKBUILD_MODNAME=\"nsc\" -DMODVERSIONS -DEXPORT_SYMTAB \ - -include autoconf.h \ + -include $(SRCDIR)$(KERNEL_DIR)/include/linux/kconfig.h \ -U__FreeBSD__ -D__linux__=1 -Dlinux=1 -D__linux=1 \ - -I$(SRCDIR)sim/include -I$(SRCDIR)$(KERNEL_DIR)/include \ + -I$(SRCDIR)sim/include -I$(SRCDIR)$(KERNEL_DIR)/include -I$(SRCDIR)$(KERNEL_DIR)/ \ $(PIC_CFLAGS) -D_DEBUG -I$(PWD) + include $(SRCDIR)processor.mk ifeq ($(PROCESSOR_SIZE),64) @@ -51,7 +53,7 @@ AUTOCONF=autoconf.h # note: the directory order below matters to ensure that we match the kernel order -dirs=kernel/ mm/ crypto/ lib/ drivers/base/ drivers/net/ net/ +dirs=kernel/ mm/ fs/ fs/proc/ crypto/ lib/ drivers/base/ drivers/net/ net/ empty:= space:= $(empty) $(empty) colon:= : @@ -66,12 +68,14 @@ find_last_bit.o find_next_bit.o bitmap.o nlattr.o idr.o libcrc32c.o \ ctype.o string.o kasprintf.o rbtree.o sha1.o textsearch.o vsprintf.o \ rwsem-spinlock.o scatterlist.o ratelimit.o hexdump.o dec_and_lock.o \ -div64.o +div64.o dynamic_queue_limits.o md5.o kstrtox.o +fs/_to_keep=read_write.o libfs.o namei.o +fs/proc/_to_keep=proc_sysctl.o objs.mk: Makefile.print $(KERNEL_DIR)/.config -for i in 1; do \ $(foreach d,$(dirs), \ - $(MAKE) -s -f $< srcdir=$(SRCDIR)$(KERNEL_DIR)/$(d) \ + $(MAKE) -i -s -f $< srcdir=$(SRCDIR)$(KERNEL_DIR)/$(d) \ objdir=$(KERNEL_DIR)/$(d) \ config=$(KERNEL_DIR)/.config \ to_keep=$(subst $(space),$(colon),$($(d)_to_keep)) print;) \ @@ -83,6 +87,8 @@ $(AUTOCONF): generate-autoconf.py $(KERNEL_DIR)/.config timeconst.h ./generate-autoconf.py $(KERNEL_DIR)/.config > $@ + cp -u autoconf.h sim/include/generated/autoconf.h + timeconst.h: $(KERNEL_DIR)/.config perl $(SRCDIR)$(KERNEL_DIR)/kernel/timeconst.pl $(CONFIG_HZ) > $@ linker.lds: ./generate-linker-script.py @@ -121,17 +127,17 @@ install-dir: setup: $(KERNEL_DIR) .patch.ts $(KERNEL_DIR)/arch/sim +.patch.ts: kernel345.patch + CWD=`pwd` && cd $(KERNEL_DIR) && patch -p1 < $$CWD/kernel345.patch && cd $$CWD && touch .patch.ts +unpatch: + CWD=`pwd` && cd $(KERNEL_DIR) && git reset --hard $(KERNEL_VERSION) && cd $$CWD && rm -f .patch.ts $(KERNEL_DIR)/arch/sim: if test ! -L $@; then ln -s $(PWD)/sim $(KERNEL_DIR)/arch/sim; fi -.patch.ts: kernel.patch - CWD=`pwd` && cd $(KERNEL_DIR) && patch -p1 < $$CWD/kernel.patch && cd $$CWD && touch .patch.ts -unpatch: - CWD=`pwd` && cd $(KERNEL_DIR) && git reset --hard $(KERNEL_VERSION) && cd $$CWD && rm -f .patch.ts $(KERNEL_DIR): git clone $(KERNEL_DOWNLOAD) $(KERNEL_DIR); cd $(KERNEL_DIR) && git reset --hard \ $(KERNEL_VERSION) ALL_OBJS=$(OBJS) $(KERNEL_LIB) $(modules) $(all-obj-for-clean) -clean: unpatch +clean: @for f in $(foreach m,$(modules),$($(m))) ; do rm -f $$f 2>/dev/null; done @for f in $(OBJS) $(KERNEL_LIB) $(modules) $(all-obj-for-clean); do rm -f $$f; done 2>/dev/null @rm -rf linker.lds $(AUTOCONF) objs.mk $(KERNEL_DIR)/.config timeconst.h 2>/dev/null --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,13 @@ +diff --git a/include/linux/slab.h b/include/linux/slab.h +index a595dce..4a4dea3 100644 +--- a/include/linux/slab.h ++++ b/include/linux/slab.h +@@ -185,6 +185,8 @@ size_t ksize(const void *); + #include + #elif defined(CONFIG_SLOB) + #include ++#elif defined(CONFIG_SIM) ++#include + #else + #include + #endif --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,18 @@ +#include +#include "sim-assert.h" + +long atomic64_read(const atomic64_t *v) +{ + return &(v)->counter; +} + +long atomic64_add_return(long i, atomic64_t *v) + { + v->counter += i; + return v->counter; + } + +void atomic64_sub(long i, atomic64_t *v) +{ + v->counter -= i; +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,85 @@ +#include +#include +#include +#include "sim-assert.h" + +static struct kmem_cache *dentry_cache __read_mostly; +struct kmem_cache *names_cachep __read_mostly; + +/** + * __d_alloc - allocate a dcache entry + * @sb: filesystem it will belong to + * @name: qstr of the name + * + * Allocates a dentry. It returns %NULL if there is insufficient memory + * available. On a success the dentry is returned. The name passed in is + * copied and the copy passed in may be reused after this call. + */ +struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) +{ + struct dentry *dentry; + char *dname; + + dentry = dentry = kmalloc(sizeof (struct dentry), GFP_KERNEL); // kmem_cache_alloc(dentry_cache, GFP_KERNEL); + if (!dentry) + return NULL; + + if (name->len > DNAME_INLINE_LEN-1) { + dname = kmalloc(name->len + 1, GFP_KERNEL); + if (!dname) { + kmem_cache_free(dentry_cache, dentry); + return NULL; + } + } else { + dname = dentry->d_iname; + } + dentry->d_name.name = dname; + + dentry->d_name.len = name->len; + dentry->d_name.hash = name->hash; + memcpy(dname, name->name, name->len); + dname[name->len] = 0; + + dentry->d_count = 1; + dentry->d_flags = 0; + spin_lock_init(&dentry->d_lock); + seqcount_init(&dentry->d_seq); + dentry->d_inode = NULL; + dentry->d_parent = dentry; + dentry->d_sb = sb; + dentry->d_op = NULL; + dentry->d_fsdata = NULL; + INIT_HLIST_BL_NODE(&dentry->d_hash); + INIT_LIST_HEAD(&dentry->d_lru); + INIT_LIST_HEAD(&dentry->d_subdirs); + INIT_LIST_HEAD(&dentry->d_alias); + INIT_LIST_HEAD(&dentry->d_u.d_child); + d_set_d_op(dentry, dentry->d_sb->s_d_op); + +// this_cpu_inc(nr_dentry); + + return dentry; +} + +void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) +{ + WARN_ON_ONCE(dentry->d_op); + WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | + DCACHE_OP_COMPARE | + DCACHE_OP_REVALIDATE | + DCACHE_OP_DELETE )); + dentry->d_op = op; + if (!op) + return; + if (op->d_hash) + dentry->d_flags |= DCACHE_OP_HASH; + if (op->d_compare) + dentry->d_flags |= DCACHE_OP_COMPARE; + if (op->d_revalidate) + dentry->d_flags |= DCACHE_OP_REVALIDATE; + if (op->d_delete) + dentry->d_flags |= DCACHE_OP_DELETE; + if (op->d_prune) + dentry->d_flags |= DCACHE_OP_PRUNE; + +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,17 @@ +#include "sim.h" +#include "sim-assert.h" +#include + + +ssize_t generic_file_aio_read(struct kiocb *a, const struct iovec *b, unsigned long c, loff_t d) +{ + sim_assert (false); + + return 0; +} + +int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma) +{ + return -ENOSYS; +} + --- a/sim/fs.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/fs.c Tue Aug 28 17:55:08 2012 +0200 @@ -1,13 +1,25 @@ #include #include #include +#include +#include +#include +#include +#include +#include + #include "sim-assert.h" struct super_block; -void kill_anon_super(struct super_block *sb) -{ - sim_assert (false); -} + +struct backing_dev_info default_backing_dev_info = { + .name = "default", + .ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE, + .state = 0, + .capabilities = BDI_CAP_MAP_COPY, +}; +struct user_namespace init_user_ns ; + int get_sb_pseudo(struct file_system_type *type, char *str, const struct super_operations *ops, unsigned long z, struct vfsmount *mnt) @@ -39,15 +51,36 @@ { memset(inode, 0, sizeof(*inode)); } -struct vfsmount *kern_mount_data(struct file_system_type *fs, void *data) + +// Implementation taken from vfs_kern_mount from linux/namespace.c +struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) { - // minimum stuff needed by the network stack to avoid segfaults. - static struct vfsmount mnt; - static struct super_block sb; - mnt.mnt_sb = &sb; - // initialize the superblock - fs->get_sb (fs, 0, 0, 0, &mnt); - return &mnt; + static struct mount local_mnt; + struct mount *mnt = &local_mnt; + struct dentry *root = 0; + + memset (mnt,0,sizeof (struct mount)); + if (!type) + return ERR_PTR(-ENODEV); + int flags = MS_KERNMOUNT; + char *name = type->name; + if (flags & MS_KERNMOUNT) + mnt->mnt.mnt_flags = MNT_INTERNAL; + + root = type->mount(type, flags, name, data); + if (IS_ERR(root)) { + return ERR_CAST(root); + } + + mnt->mnt.mnt_root = root; + mnt->mnt.mnt_sb = root->d_sb; + mnt->mnt_mountpoint = mnt->mnt.mnt_root; + mnt->mnt_parent = mnt; +// br_write_lock(vfsmount_lock); DCE is monothreaded , so we do not care of lock here + list_add_tail(&mnt->mnt_instance, &root->d_sb->s_mounts); +// br_write_unlock(vfsmount_lock); DCE is monothreaded , so we do not care of lock here + + return &mnt->mnt; } int register_filesystem(struct file_system_type *fs) @@ -100,7 +133,6 @@ } void d_instantiate(struct dentry *entry, struct inode *inode) { - sim_assert (false); } char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen, const char *fmt, ...) @@ -134,42 +166,25 @@ sim_assert (false); return 0; } -loff_t no_llseek(struct file *file, loff_t offset, int origin) -{ - sim_assert (false); - return 0; -} -void path_put(struct path *path) -{ - sim_assert (false); -} -int simple_statfs(struct dentry *entry, struct kstatfs *statfs) -{ - sim_assert (false); - return 0; -} long sys_close(unsigned int fd) { sim_assert (false); return 0; } - ssize_t splice_to_pipe(struct pipe_inode_info *info, struct splice_pipe_desc *desc) { sim_assert (false); return 0; } -int splice_grow_spd(struct pipe_inode_info *info, struct splice_pipe_desc *desc) +int splice_grow_spd(const struct pipe_inode_info *info, struct splice_pipe_desc *desc) { sim_assert (false); return 0; } -void splice_shrink_spd(struct pipe_inode_info *info, - struct splice_pipe_desc *desc) +void splice_shrink_spd(struct splice_pipe_desc *desc) { sim_assert (false); - return 0; } ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, @@ -192,6 +207,40 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { - sim_assert (false); - return 0; + sim_assert (false); + return 0; } + +int proc_nr_inodes(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) +{ + sim_assert (false); + return 0; +} + +int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, + size_t *lenp, loff_t *ppos) +{ + sim_assert (false); + return 0; +} + +/* + * Handle writeback of dirty data for the device backed by this bdi. Also + * wakes up periodically and does kupdated style flushing. + */ +int bdi_writeback_thread(void *data) +{ + sim_assert (false); + + return 0; +} + +void get_filesystem(struct file_system_type *fs) +{ + return; +} +//#include +unsigned int nr_free_buffer_pages(void) +{ + return 1024; +} --- a/sim/glue.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/glue.c Tue Aug 28 17:55:08 2012 +0200 @@ -49,6 +49,7 @@ // XXX figure out initial value unsigned int interrupt_pending = 0; static unsigned long g_irqflags = 0; +static unsigned long local_irqflags = 0; int overflowgid = 0; int overflowuid = 0; int fs_overflowgid = 0; @@ -58,11 +59,14 @@ { return g_irqflags; } -void raw_local_irq_restore(unsigned long flags) +unsigned long arch_local_save_flags(void) { - g_irqflags = flags; + return local_irqflags; } - +void arch_local_irq_restore(unsigned long flags) +{ + local_irqflags = flags; +} int in_egroup_p(gid_t grp) { @@ -289,3 +293,4 @@ void add_taint(unsigned flag) {} struct pid *cad_pid = 0; + --- a/sim/hrtimer.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/hrtimer.c Tue Aug 28 17:55:08 2012 +0200 @@ -19,7 +19,7 @@ enum hrtimer_restart restart = timer->function (timer); if (restart == HRTIMER_RESTART) { - void *event = sim_event_schedule_ns (ktime_to_ns (timer->_expires), + void *event = sim_event_schedule_ns (ktime_to_ns (timer->_softexpires), &trampoline, timer); timer->base = event; } @@ -50,7 +50,6 @@ { ns -= sim_current_ns (); } - timer->_expires = ns_to_ktime (ns); timer->_softexpires = ns_to_ktime (ns); void *event = sim_event_schedule_ns (ns, &trampoline, timer); timer->base = event; --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,2 @@ +#include + --- a/sim/include/asm/irqflags.h Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/include/asm/irqflags.h Tue Aug 28 17:55:08 2012 +0200 @@ -2,10 +2,8 @@ #define _ASM_SIM_IRQFLAGS_H unsigned long __raw_local_save_flags(void); -void raw_local_irq_restore(unsigned long flags); #define __raw_local_save_flags __raw_local_save_flags -#define raw_local_irq_restore raw_local_irq_restore #include --- a/sim/include/asm/slab.h Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/include/asm/slab.h Tue Aug 28 17:55:08 2012 +0200 @@ -5,6 +5,4 @@ void *__kmalloc(size_t size, gfp_t flags); void *kmem_cache_alloc(struct kmem_cache *, gfp_t); -#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) - #endif /* _ASM_SIM_SLAB_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,238 @@ +#define CONFIG_SIM 1 +#define CONFIG_EXPERIMENTAL 1 +#define CONFIG_KTIME_SCALAR 1 +#define CONFIG_MODULES 1 +#define CONFIG_GENERIC_CSUM 1 +#define CONFIG_PRINTK 1 +#define CONFIG_RWSEM_GENERIC_SPINLOCK 1 +#define CONFIG_GENERIC_FIND_NEXT_BIT 1 +#define CONFIG_GENERIC_HWEIGHT 1 +#define CONFIG_TRACE_IRQFLAGS_SUPPORT 1 +#define CONFIG_NO_HZ 1 +#define CONFIG_HZ 250 +#define CONFIG_TINY_RCU 1 +#define CONFIG_HZ_250 1 +#define CONFIG_BASE_SMALL 1 +#define CONFIG_SPLIT_PTLOCK_CPUS 1 +#define CONFIG_FLATMEM 1 +#define CONFIG_SYSCTL 1 +#define CONFIG_PROC_FS 1 +#define CONFIG_SYSFS 1 +#define CONFIG_PROC_SYSCTL 1 +#define CONFIG_NET 1 +#define CONFIG_PACKET 1 +#define CONFIG_UNIX 1 +#define CONFIG_XFRM 1 +#define CONFIG_XFRM_USER 1 +#define CONFIG_XFRM_SUB_POLICY 1 +#define CONFIG_XFRM_MIGRATE 1 +#define CONFIG_XFRM_STATISTICS 1 +#define CONFIG_XFRM_IPCOMP_MODULE 1 +#define CONFIG_NET_KEY 1 +#define CONFIG_NET_KEY_MIGRATE 1 +#define CONFIG_INET 1 +#define CONFIG_IP_MULTICAST 1 +#define CONFIG_IP_ADVANCED_ROUTER 1 +#define CONFIG_IP_MULTIPLE_TABLES 1 +#define CONFIG_IP_ROUTE_MULTIPATH 1 +#define CONFIG_IP_ROUTE_VERBOSE 1 +#define CONFIG_NET_IPIP_MODULE 1 +#define CONFIG_IP_MROUTE 1 +#define CONFIG_IP_MROUTE_MULTIPLE_TABLES 1 +#define CONFIG_IP_PIMSM_V1 1 +#define CONFIG_IP_PIMSM_V2 1 +#define CONFIG_ARPD 1 +#define CONFIG_SYN_COOKIES 1 +#define CONFIG_INET_AH_MODULE 1 +#define CONFIG_INET_ESP_MODULE 1 +#define CONFIG_INET_IPCOMP_MODULE 1 +#define CONFIG_INET_XFRM_TUNNEL_MODULE 1 +#define CONFIG_INET_TUNNEL 1 +#define CONFIG_INET_XFRM_MODE_TRANSPORT 1 +#define CONFIG_INET_XFRM_MODE_TUNNEL 1 +#define CONFIG_INET_XFRM_MODE_BEET 1 +#define CONFIG_INET_DIAG_MODULE 1 +#define CONFIG_INET_TCP_DIAG_MODULE 1 +#define CONFIG_TCP_CONG_ADVANCED 1 +#define CONFIG_TCP_CONG_BIC_MODULE 1 +#define CONFIG_TCP_CONG_CUBIC_MODULE 1 +#define CONFIG_TCP_CONG_WESTWOOD_MODULE 1 +#define CONFIG_TCP_CONG_HTCP_MODULE 1 +#define CONFIG_DEFAULT_RENO 1 +#define CONFIG_DEFAULT_TCP_CONG "reno" +#define CONFIG_IPV6 1 +#define CONFIG_IPV6_PRIVACY 1 +#define CONFIG_IPV6_ROUTER_PREF 1 +#define CONFIG_INET6_AH_MODULE 1 +#define CONFIG_INET6_ESP_MODULE 1 +#define CONFIG_INET6_IPCOMP_MODULE 1 +#define CONFIG_IPV6_MIP6 1 +#define CONFIG_INET6_XFRM_TUNNEL_MODULE 1 +#define CONFIG_INET6_TUNNEL 1 +#define CONFIG_INET6_XFRM_MODE_TRANSPORT 1 +#define CONFIG_INET6_XFRM_MODE_TUNNEL 1 +#define CONFIG_INET6_XFRM_MODE_BEET 1 +#define CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION 1 +#define CONFIG_IPV6_SIT 1 +#define CONFIG_IPV6_NDISC_NODETYPE 1 +#define CONFIG_IPV6_TUNNEL 1 +#define CONFIG_IPV6_MULTIPLE_TABLES 1 +#define CONFIG_IPV6_SUBTREES 1 +#define CONFIG_ATM_MODULE 1 +#define CONFIG_ATM_CLIP_MODULE 1 +#define CONFIG_ATM_CLIP_NO_ICMP 1 +#define CONFIG_ATM_LANE_MODULE 1 +#define CONFIG_ATM_MPOA_MODULE 1 +#define CONFIG_ATM_BR2684_MODULE 1 +#define CONFIG_ATM_BR2684_IPFILTER 1 +#define CONFIG_L2TP_MODULE 1 +#define CONFIG_STP_MODULE 1 +#define CONFIG_GARP_MODULE 1 +#define CONFIG_BRIDGE_MODULE 1 +#define CONFIG_BRIDGE_IGMP_SNOOPING 1 +#define CONFIG_VLAN_8021Q_MODULE 1 +#define CONFIG_VLAN_8021Q_GVRP 1 +#define CONFIG_DECNET_MODULE 1 +#define CONFIG_LLC_MODULE 1 +#define CONFIG_LLC2_MODULE 1 +#define CONFIG_IPX_MODULE 1 +#define CONFIG_IPX_INTERN 1 +#define CONFIG_ATALK_MODULE 1 +#define CONFIG_DEV_APPLETALK_MODULE 1 +#define CONFIG_IPDDP_MODULE 1 +#define CONFIG_IPDDP_ENCAP 1 +#define CONFIG_IPDDP_DECAP 1 +#define CONFIG_PHONET_MODULE 1 +#define CONFIG_BQL 1 +#define CONFIG_NET_PKTGEN_MODULE 1 +#define CONFIG_CAN_MODULE 1 +#define CONFIG_CAN_RAW_MODULE 1 +#define CONFIG_CAN_BCM_MODULE 1 +#define CONFIG_CAN_VCAN_MODULE 1 +#define CONFIG_CAN_DEV_MODULE 1 +#define CONFIG_CAN_CALC_BITTIMING 1 +#define CONFIG_CAN_SJA1000_MODULE 1 +#define CONFIG_CAN_SJA1000_PLATFORM_MODULE 1 +#define CONFIG_CAN_DEBUG_DEVICES 1 +#define CONFIG_IRDA_MODULE 1 +#define CONFIG_IRLAN_MODULE 1 +#define CONFIG_IRCOMM_MODULE 1 +#define CONFIG_IRDA_ULTRA 1 +#define CONFIG_IRDA_CACHE_LAST_LSAP 1 +#define CONFIG_IRDA_FAST_RR 1 +#define CONFIG_IRDA_DEBUG 1 +#define CONFIG_IRTTY_SIR_MODULE 1 +#define CONFIG_DONGLE 1 +#define CONFIG_ESI_DONGLE_MODULE 1 +#define CONFIG_ACTISYS_DONGLE_MODULE 1 +#define CONFIG_TEKRAM_DONGLE_MODULE 1 +#define CONFIG_TOIM3232_DONGLE_MODULE 1 +#define CONFIG_LITELINK_DONGLE_MODULE 1 +#define CONFIG_BT_MODULE 1 +#define CONFIG_BT_RFCOMM_MODULE 1 +#define CONFIG_BT_RFCOMM_TTY 1 +#define CONFIG_BT_BNEP_MODULE 1 +#define CONFIG_BT_BNEP_MC_FILTER 1 +#define CONFIG_BT_BNEP_PROTO_FILTER 1 +#define CONFIG_BT_HCIUART_MODULE 1 +#define CONFIG_BT_HCIUART_H4 1 +#define CONFIG_BT_HCIUART_BCSP 1 +#define CONFIG_BT_HCIUART_LL 1 +#define CONFIG_BT_HCIVHCI_MODULE 1 +#define CONFIG_BT_MRVL_MODULE 1 +#define CONFIG_FIB_RULES 1 +#define CONFIG_WIMAX_MODULE 1 +#define CONFIG_WIMAX_DEBUG_LEVEL 8 +#define CONFIG_RFKILL_MODULE 1 +#define CONFIG_CAIF_MODULE 1 +#define CONFIG_CAIF_DEBUG 1 +#define CONFIG_CAIF_NETDEV_MODULE 1 +#define CONFIG_STANDALONE 1 +#define CONFIG_PREVENT_FIRMWARE_BUILD 1 +#define CONFIG_FW_LOADER 1 +#define CONFIG_FIRMWARE_IN_KERNEL 1 +#define CONFIG_EXTRA_FIRMWARE "" +#define CONFIG_CRYPTO 1 +#define CONFIG_CRYPTO_ALGAPI_MODULE 1 +#define CONFIG_CRYPTO_ALGAPI2_MODULE 1 +#define CONFIG_CRYPTO_AEAD_MODULE 1 +#define CONFIG_CRYPTO_AEAD2_MODULE 1 +#define CONFIG_CRYPTO_BLKCIPHER_MODULE 1 +#define CONFIG_CRYPTO_BLKCIPHER2_MODULE 1 +#define CONFIG_CRYPTO_HASH_MODULE 1 +#define CONFIG_CRYPTO_HASH2_MODULE 1 +#define CONFIG_CRYPTO_RNG_MODULE 1 +#define CONFIG_CRYPTO_RNG2_MODULE 1 +#define CONFIG_CRYPTO_PCOMP_MODULE 1 +#define CONFIG_CRYPTO_PCOMP2_MODULE 1 +#define CONFIG_CRYPTO_MANAGER_MODULE 1 +#define CONFIG_CRYPTO_MANAGER2_MODULE 1 +#define CONFIG_CRYPTO_MANAGER_DISABLE_TESTS 1 +#define CONFIG_CRYPTO_GF128MUL_MODULE 1 +#define CONFIG_CRYPTO_NULL_MODULE 1 +#define CONFIG_CRYPTO_WORKQUEUE_MODULE 1 +#define CONFIG_CRYPTO_CRYPTD_MODULE 1 +#define CONFIG_CRYPTO_AUTHENC_MODULE 1 +#define CONFIG_CRYPTO_TEST_MODULE 1 +#define CONFIG_CRYPTO_CCM_MODULE 1 +#define CONFIG_CRYPTO_GCM_MODULE 1 +#define CONFIG_CRYPTO_SEQIV_MODULE 1 +#define CONFIG_CRYPTO_CBC_MODULE 1 +#define CONFIG_CRYPTO_CTR_MODULE 1 +#define CONFIG_CRYPTO_CTS_MODULE 1 +#define CONFIG_CRYPTO_ECB_MODULE 1 +#define CONFIG_CRYPTO_PCBC_MODULE 1 +#define CONFIG_CRYPTO_HMAC_MODULE 1 +#define CONFIG_CRYPTO_CRC32C_MODULE 1 +#define CONFIG_CRYPTO_GHASH_MODULE 1 +#define CONFIG_CRYPTO_MD4_MODULE 1 +#define CONFIG_CRYPTO_MD5_MODULE 1 +#define CONFIG_CRYPTO_MICHAEL_MIC_MODULE 1 +#define CONFIG_CRYPTO_RMD128_MODULE 1 +#define CONFIG_CRYPTO_RMD160_MODULE 1 +#define CONFIG_CRYPTO_RMD256_MODULE 1 +#define CONFIG_CRYPTO_RMD320_MODULE 1 +#define CONFIG_CRYPTO_SHA1_MODULE 1 +#define CONFIG_CRYPTO_SHA256_MODULE 1 +#define CONFIG_CRYPTO_SHA512_MODULE 1 +#define CONFIG_CRYPTO_TGR192_MODULE 1 +#define CONFIG_CRYPTO_WP512_MODULE 1 +#define CONFIG_CRYPTO_AES_MODULE 1 +#define CONFIG_CRYPTO_ANUBIS_MODULE 1 +#define CONFIG_CRYPTO_ARC4_MODULE 1 +#define CONFIG_CRYPTO_BLOWFISH_MODULE 1 +#define CONFIG_CRYPTO_BLOWFISH_COMMON_MODULE 1 +#define CONFIG_CRYPTO_CAMELLIA_MODULE 1 +#define CONFIG_CRYPTO_CAST5_MODULE 1 +#define CONFIG_CRYPTO_CAST6_MODULE 1 +#define CONFIG_CRYPTO_DES_MODULE 1 +#define CONFIG_CRYPTO_FCRYPT_MODULE 1 +#define CONFIG_CRYPTO_KHAZAD_MODULE 1 +#define CONFIG_CRYPTO_SEED_MODULE 1 +#define CONFIG_CRYPTO_SERPENT_MODULE 1 +#define CONFIG_CRYPTO_TEA_MODULE 1 +#define CONFIG_CRYPTO_TWOFISH_MODULE 1 +#define CONFIG_CRYPTO_TWOFISH_COMMON_MODULE 1 +#define CONFIG_CRYPTO_DEFLATE_MODULE 1 +#define CONFIG_CRYPTO_ZLIB_MODULE 1 +#define CONFIG_CRYPTO_LZO_MODULE 1 +#define CONFIG_CRYPTO_ANSI_CPRNG_MODULE 1 +#define CONFIG_CRYPTO_HW 1 +#define CONFIG_BITREVERSE_MODULE 1 +#define CONFIG_GENERIC_IO 1 +#define CONFIG_CRC_CCITT_MODULE 1 +#define CONFIG_CRC16_MODULE 1 +#define CONFIG_CRC_T10DIF_MODULE 1 +#define CONFIG_CRC_ITU_T_MODULE 1 +#define CONFIG_CRC32_MODULE 1 +#define CONFIG_CRC32_SLICEBY8 1 +#define CONFIG_CRC7_MODULE 1 +#define CONFIG_LIBCRC32C_MODULE 1 +#define CONFIG_ZLIB_INFLATE_MODULE 1 +#define CONFIG_ZLIB_DEFLATE_MODULE 1 +#define CONFIG_LZO_COMPRESS_MODULE 1 +#define CONFIG_LZO_DECOMPRESS_MODULE 1 +#define CONFIG_HAS_IOMEM 1 +#define CONFIG_HAS_IOPORT 1 +#define CONFIG_DQL 1 +#define CONFIG_NLATTR 1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,154 @@ +#include +#include +#include +#include +#include +#include + + +static struct kmem_cache *inode_cachep __read_mostly; +/* + * Empty aops. Can be used for the cases where the user does not + * define any of the address_space operations. + */ +const struct address_space_operations empty_aops = { +}; + +unsigned int get_next_ino(void) +{ + static unsigned int res = 0; + + return ++res; +} + +/** + * inode_init_always - perform inode structure intialisation + * @sb: superblock inode belongs to + * @inode: inode to initialise + * + * These are initializations that need to be done on every inode + * allocation as the fields are not initialised by slab allocation. + */ +int inode_init_always(struct super_block *sb, struct inode *inode) +{ + static const struct inode_operations empty_iops; + static const struct file_operations empty_fops; + struct address_space *const mapping = &inode->i_data; + + inode->i_sb = sb; + inode->i_blkbits = sb->s_blocksize_bits; + inode->i_flags = 0; + atomic_set(&inode->i_count, 1); + inode->i_op = &empty_iops; + inode->i_fop = &empty_fops; + inode->__i_nlink = 1; + inode->i_opflags = 0; + inode->i_uid = 0; + inode->i_gid = 0; + atomic_set(&inode->i_writecount, 0); + inode->i_size = 0; + inode->i_blocks = 0; + inode->i_bytes = 0; + inode->i_generation = 0; +#ifdef CONFIG_QUOTA + memset(&inode->i_dquot, 0, sizeof(inode->i_dquot)); +#endif + inode->i_pipe = NULL; + inode->i_bdev = NULL; + inode->i_cdev = NULL; + inode->i_rdev = 0; + inode->dirtied_when = 0; + + if (security_inode_alloc(inode)) + goto out; + spin_lock_init(&inode->i_lock); + lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); + + mutex_init(&inode->i_mutex); + lockdep_set_class(&inode->i_mutex, &sb->s_type->i_mutex_key); + + atomic_set(&inode->i_dio_count, 0); + + mapping->a_ops = &empty_aops; + mapping->host = inode; + mapping->flags = 0; + mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE); + mapping->assoc_mapping = NULL; + mapping->backing_dev_info = &default_backing_dev_info; + mapping->writeback_index = 0; + + /* + * If the block_device provides a backing_dev_info for client + * inodes then use that. Otherwise the inode share the bdev's + * backing_dev_info. + */ + if (sb->s_bdev) { + struct backing_dev_info *bdi; + + bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; + mapping->backing_dev_info = bdi; + } + inode->i_private = NULL; + inode->i_mapping = mapping; + INIT_LIST_HEAD(&inode->i_dentry); /* buggered by rcu freeing */ +#ifdef CONFIG_FS_POSIX_ACL + inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; +#endif + +#ifdef CONFIG_FSNOTIFY + inode->i_fsnotify_mask = 0; +#endif + +// this_cpu_inc(nr_inodes); + + return 0; +out: + return -ENOMEM; +} + + +static struct inode *alloc_inode(struct super_block *sb) +{ + struct inode *inode; + + if (sb->s_op->alloc_inode) + inode = sb->s_op->alloc_inode(sb); + else + inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL); + + if (!inode) + return NULL; + + if (unlikely(inode_init_always(sb, inode))) { + if (inode->i_sb->s_op->destroy_inode) + inode->i_sb->s_op->destroy_inode(inode); + else + kmem_cache_free(inode_cachep, inode); + return NULL; + } + + return inode; +} + +/** + * new_inode_pseudo - obtain an inode + * @sb: superblock + * + * Allocates a new inode for given superblock. + * Inode wont be chained in superblock s_inodes list + * This means : + * - fs can't be unmount + * - quotas, fsnotify, writeback can't work + */ +struct inode *new_inode_pseudo(struct super_block *sb) +{ + struct inode *inode = alloc_inode(sb); + + if (inode) { + spin_lock(&inode->i_lock); + inode->i_state = 0; + spin_unlock(&inode->i_lock); + INIT_LIST_HEAD(&inode->i_sb_list); + } + return inode; +} --- a/sim/modules.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/modules.c Tue Aug 28 17:55:08 2012 +0200 @@ -1,6 +1,7 @@ #include "sim-assert.h" #include #include +#include int modules_disabled = 0; char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; @@ -11,9 +12,40 @@ struct kernel_param *__start___param = &g_empty_param_buffer; struct kernel_param *__stop___param = &g_empty_param_buffer; +const struct module_version_attribute no_modules[1] = { + { + .mattr = { + .attr = { + .name = "version", + .mode = S_IRUGO, + }, + .show = __modver_version_show, + }, + .module_name = KBUILD_MODNAME, + .version = "V0", + } +}; + +const struct module_version_attribute **__start___modver = &no_modules; +const struct module_version_attribute **__stop___modver = &no_modules; + +static ssize_t store_uevent(struct module_attribute *mattr, + struct module_kobject *mk, + const char *buffer, size_t count) +{ + sim_assert (false); + return 0; +} + +struct module_attribute module_uevent = + __ATTR(uevent, 0200, NULL, store_uevent); + int __request_module(bool wait, const char *fmt, ...) { // we really should never be trying to load modules that way. - sim_assert (false); return 0; } + +struct ctl_table usermodehelper_table[] = { + { } +}; --- a/sim/print.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/print.c Tue Aug 28 17:55:08 2012 +0200 @@ -3,6 +3,8 @@ #include "sim.h" #include "sim-assert.h" +int dmesg_restrict = 1; + int printk(const char * fmt, ...) { va_list args; --- a/sim/proc.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/proc.c Tue Aug 28 17:55:08 2012 +0200 @@ -5,24 +5,26 @@ #include #include #include "sim-types.h" +#include "sim-assert.h" -static struct proc_dir_entry proc_root; +static char proc_root_data[sizeof(struct proc_dir_entry)+4]; + +static struct proc_dir_entry *proc_root = (struct proc_dir_entry *) proc_root_data; void sim_proc_net_initialize(void) { - proc_root.parent = &proc_root; - proc_root.name = "net"; - proc_root.mode = S_IFDIR | S_IRUGO | S_IXUGO; - proc_root.next = 0; - proc_root.subdir = 0; - init_net.proc_net = &proc_root; - init_net.proc_net_stat = proc_mkdir("stat", &proc_root); + proc_root->parent = proc_root; + strcpy ( proc_root->name , "net"); + proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO; + proc_root->next = 0; + proc_root->subdir = 0; + init_net.proc_net = proc_root; + init_net.proc_net_stat = proc_mkdir("stat", proc_root); } - struct proc_dir_entry * proc_net_fops_create(struct net *net, const char *name, - mode_t mode, const struct file_operations *fops) + umode_t mode, const struct file_operations *fops) { return proc_create_data (name, mode, net->proc_net, fops, 0); } @@ -32,8 +34,12 @@ struct proc_dir_entry *parent) { // insert new entry at head of subdir list in parent - struct proc_dir_entry * child = kzalloc (sizeof(struct proc_dir_entry), GFP_KERNEL); - child->name = kstrdup (name, GFP_KERNEL); + struct proc_dir_entry * child = kzalloc (sizeof(struct proc_dir_entry) + + strlen (name) + 1 + , GFP_KERNEL); + + strcpy ( child->name, name ); + child->namelen = strlen (name); child->parent = parent; if (parent == 0) @@ -45,36 +51,29 @@ parent->subdir = child; return child; } - -struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, - struct proc_dir_entry *parent, - const struct file_operations *proc_fops, - void *data) +struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, + struct proc_dir_entry *parent, + const struct file_operations *proc_fops, + void *data) { struct proc_dir_entry *de = proc_create_entry (name, mode, parent); de->proc_fops = proc_fops; de->data = data; return de; } -struct proc_dir_entry *proc_mkdir(const char *name, - struct proc_dir_entry *parent) -{ - return proc_create_entry (name, S_IRUGO | S_IXUGO, parent); -} void remove_proc_entry(const char *name, struct proc_dir_entry *parent) { - struct proc_dir_entry *de, **prev; - for (de = parent->subdir, prev = &parent->subdir; de ; prev = &de->next, de = de->next) - { - if (strcmp (name, de->name) == 0) + struct proc_dir_entry *de, **prev; + for (de = parent->subdir, prev = &parent->subdir; de ; prev = &de->next, de = de->next) { - *prev = de->next; - kfree (de->name); - kfree (de); - break; + if (strcmp (name, de->name) == 0) + { + *prev = de->next; + kfree (de->name); + kfree (de); + break; + } } - } - } void proc_net_remove(struct net *net, const char *name) { @@ -85,3 +84,11 @@ { return -ENOSYS; } + +struct proc_dir_entry *proc_mkdir(const char *name, + struct proc_dir_entry *parent) +{ + return proc_create_entry (name, S_IRUGO | S_IXUGO, parent); +} + + --- a/sim/random.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/random.c Tue Aug 28 17:55:08 2012 +0200 @@ -1,35 +1,6 @@ #include "sim.h" #include -__u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, - __be16 sport, __be16 dport) -{ - return sim_random (); -} -__u32 secure_ip_id(__be32 daddr) -{ - return sim_random (); -} -__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, - __be16 sport, __be16 dport) -{ - return sim_random (); -} -u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, - __be16 sport, __be16 dport) -{ - return sim_random (); -} - -u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) -{ - return sim_random (); -} -u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, - __be16 dport) -{ - return sim_random (); -} u32 random32(void) { return sim_random (); --- a/sim/sched.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/sched.c Tue Aug 28 17:55:08 2012 +0200 @@ -148,7 +148,7 @@ return ret; } -void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *key) +void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *k) { INIT_LIST_HEAD(&q->task_list); } @@ -273,8 +273,9 @@ x->done++; __wake_up(&x->wait, TASK_NORMAL, 1, 0); } -unsigned long -wait_for_completion_interruptible_timeout(struct completion *x, unsigned long timeout) + +long wait_for_completion_interruptible_timeout( + struct completion *x, unsigned long timeout) { return wait_for_completion_timeout(x, timeout); } @@ -292,10 +293,6 @@ // we never schedule to decrease latency. return 0; } -void synchronize_sched_expedited(void) -{ - // nothing to do because we have !CONFIG_SMP -} int idle_cpu (int cpu) { // we are never idle: we call this from rcutiny.c and the answer --- a/sim/security.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/security.c Tue Aug 28 17:55:08 2012 +0200 @@ -3,7 +3,7 @@ struct sock; struct sk_buff; -int capable(int cap) +bool capable(int cap) { switch (cap) { --- a/sim/sim-device.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/sim-device.c Tue Aug 28 17:55:08 2012 +0200 @@ -31,7 +31,6 @@ static const struct ethtool_ops sim_ethtool_ops = { .get_link = always_on, - .get_sg = always_on, }; static const struct net_device_ops sim_dev_ops = { @@ -50,7 +49,6 @@ dev->flags = 0; //dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; dev->features = 0 - | NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_NETNS_LOCAL; // disabled NETIF_F_TSO NETIF_F_SG NETIF_F_FRAGLIST NETIF_F_LLTX --- a/sim/softirq.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/softirq.c Tue Aug 28 17:55:08 2012 +0200 @@ -80,6 +80,11 @@ sim_softirq_wakeup (); } +void __raise_softirq_irqoff(unsigned int nr) +{ + //trace_softirq_raise(nr); + or_softirq_pending(1UL << nr); +} int __cond_resched_softirq(void) { // tell the caller that we did not need to re-schedule. --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,12 @@ +#include "sim.h" +#include "sim-assert.h" +#include + +ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, size_t len, + unsigned int flags) +{ + sim_assert (false); + + return 0; +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,212 @@ +#include +#include +#include +#include +#include +#include +#include /* for the emergency remount stuff */ +#include +#include +#include +#include +#include +#include +#include + + +int set_anon_super(struct super_block *s, void *data) +{ + return 0; +} + +struct super_block; +LIST_HEAD(super_blocks); + +/** + * alloc_super - create new superblock + * @type: filesystem type superblock should belong to + * + * Allocates and initializes a new &struct super_block. alloc_super() + * returns a pointer new superblock or %NULL if allocation had failed. + */ +static struct super_block *alloc_super(struct file_system_type *type) +{ + struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); + static const struct super_operations default_op; + + if (s) { + if (security_sb_alloc(s)) { + kfree(s); + s = NULL; + goto out; + } +#ifdef CONFIG_SMP + s->s_files = alloc_percpu(struct list_head); + if (!s->s_files) { + security_sb_free(s); + kfree(s); + s = NULL; + goto out; + } else { + int i; + + for_each_possible_cpu(i) + INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); + } +#else + INIT_LIST_HEAD(&s->s_files); +#endif + s->s_bdi = &default_backing_dev_info; + INIT_HLIST_NODE(&s->s_instances); + INIT_HLIST_BL_HEAD(&s->s_anon); + INIT_LIST_HEAD(&s->s_inodes); + INIT_LIST_HEAD(&s->s_dentry_lru); + INIT_LIST_HEAD(&s->s_inode_lru); + spin_lock_init(&s->s_inode_lru_lock); + INIT_LIST_HEAD(&s->s_mounts); + init_rwsem(&s->s_umount); + mutex_init(&s->s_lock); + lockdep_set_class(&s->s_umount, &type->s_umount_key); + /* + * The locking rules for s_lock are up to the + * filesystem. For example ext3fs has different + * lock ordering than usbfs: + */ + lockdep_set_class(&s->s_lock, &type->s_lock_key); + /* + * sget() can have s_umount recursion. + * + * When it cannot find a suitable sb, it allocates a new + * one (this one), and tries again to find a suitable old + * one. + * + * In case that succeeds, it will acquire the s_umount + * lock of the old one. Since these are clearly distrinct + * locks, and this object isn't exposed yet, there's no + * risk of deadlocks. + * + * Annotate this by putting this lock in a different + * subclass. + */ + down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); + s->s_count = 1; + atomic_set(&s->s_active, 1); + mutex_init(&s->s_vfs_rename_mutex); + lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key); + mutex_init(&s->s_dquot.dqio_mutex); + mutex_init(&s->s_dquot.dqonoff_mutex); + init_rwsem(&s->s_dquot.dqptr_sem); + init_waitqueue_head(&s->s_wait_unfrozen); + s->s_maxbytes = MAX_NON_LFS; + s->s_op = &default_op; + s->s_time_gran = 1000000000; + s->cleancache_poolid = -1; + + s->s_shrink.seeks = DEFAULT_SEEKS; + s->s_shrink.shrink = 0; // prune_super; + s->s_shrink.batch = 1024; + } +out: + return s; +} + +/** + * deactivate_locked_super - drop an active reference to superblock + * @s: superblock to deactivate + * + * Drops an active reference to superblock, converting it into a temprory + * one if there is no other active references left. In that case we + * tell fs driver to shut it down and drop the temporary reference we + * had just acquired. + * + * Caller holds exclusive lock on superblock; that lock is released. + */ +void deactivate_locked_super(struct super_block *s) +{ + struct file_system_type *fs = s->s_type; + if (atomic_dec_and_test(&s->s_active)) { + cleancache_invalidate_fs(s); + fs->kill_sb(s); + + /* caches are now gone, we can safely kill the shrinker now */ + unregister_shrinker(&s->s_shrink); + + /* + * We need to call rcu_barrier so all the delayed rcu free + * inodes are flushed before we release the fs module. + */ + rcu_barrier(); + put_filesystem(fs); + put_super(s); + } else { + up_write(&s->s_umount); + } +} + +/** + * sget - find or create a superblock + * @type: filesystem type superblock should belong to + * @test: comparison callback + * @set: setup callback + * @data: argument to each of them + */ +struct super_block *sget(struct file_system_type *type, + int (*test)(struct super_block *,void *), + int (*set)(struct super_block *,void *), + void *data) +{ + struct super_block *s = NULL; + struct hlist_node *node; + struct super_block *old; + int err; + +retry: + spin_lock(&sb_lock); + if (test) { + hlist_for_each_entry(old, node, &type->fs_supers, s_instances) { + if (!test(old, data)) + continue; + if (!grab_super(old)) + goto retry; + if (s) { + up_write(&s->s_umount); + destroy_super(s); + s = NULL; + } + down_write(&old->s_umount); + if (unlikely(!(old->s_flags & MS_BORN))) { + deactivate_locked_super(old); + goto retry; + } + return old; + } + } + if (!s) { + spin_unlock(&sb_lock); + s = alloc_super(type); + if (!s) + return ERR_PTR(-ENOMEM); + goto retry; + } + + err = set(s, data); + if (err) { + spin_unlock(&sb_lock); + up_write(&s->s_umount); + destroy_super(s); + return ERR_PTR(err); + } + s->s_type = type; + strlcpy(s->s_id, type->name, sizeof(s->s_id)); + list_add_tail(&s->s_list, &super_blocks); + hlist_add_head(&s->s_instances, &type->fs_supers); + spin_unlock(&sb_lock); +// get_filesystem(type); +// register_shrinker(&s->s_shrink); + return s; +} + +void kill_anon_super(struct super_block *sb) +{ + +} --- a/sim/sysctl.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/sysctl.c Tue Aug 28 17:55:08 2012 +0200 @@ -191,11 +191,11 @@ iterate_table_recursive (iter, table); for (cur = root; cur != 0; cur = sysctl_head_next (cur)) { - if (cur->attached_to != table) + if (cur->set != table) { continue; } - iterate_table_recursive (iter, cur->attached_by); + iterate_table_recursive (iter, cur->root); } } @@ -204,6 +204,8 @@ void sim_sys_iterate_files (const struct SimSysIterator *iter) { +// sim_assert (0); + return; struct ctl_table_header *root = sysctl_head_next (NULL); iterate_recursive (iter, root->ctl_table); } --- a/sim/time.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/time.c Tue Aug 28 17:55:08 2012 +0200 @@ -39,7 +39,7 @@ *tv = ns_to_timeval (ns); } -int do_settimeofday(struct timespec *tv) +int do_settimeofday(const struct timespec *tv) { sim_assert (false); return -EPERM; // quiet compiler --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 84912269f151 Tue Aug 28 17:55:08 2012 +0200 @@ -0,0 +1,19 @@ +#include +#include + +/* + * Add a shrinker callback to be called from the vm + */ +void register_shrinker(struct shrinker *shrinker) +{ + +} + +/* + * Remove one + */ +void unregister_shrinker(struct shrinker *shrinker) +{ + +} + --- a/sim/workqueue.c Wed Jul 11 20:31:37 2012 +0900 +++ a/sim/workqueue.c Tue Aug 28 17:55:08 2012 +0200 @@ -58,7 +58,7 @@ if (!list_empty(&g_work)) { active = 1; - INIT_WORK_ON_STACK(&barr.work, &workqueue_barrier_fn); + INIT_WORK_ONSTACK(&barr.work, &workqueue_barrier_fn); __set_bit(WORK_STRUCT_PENDING, work_data_bits(&barr.work)); list_add(&barr.work.entry, prev); sim_task_wakeup (workqueue_task ()); @@ -99,11 +99,11 @@ { flush_entry (g_work.prev); } -int flush_work(struct work_struct *work) +bool flush_work(struct work_struct *work) { return flush_entry (&work->entry); } -int cancel_work_sync(struct work_struct *work) +bool cancel_work_sync(struct work_struct *work) { int retval = 0; if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) @@ -142,3 +142,11 @@ } return ret; } +struct workqueue_struct *__alloc_workqueue_key(const char *fmt, + unsigned int flags, + int max_active, + struct lock_class_key *key, + const char *lock_name, ...) +{ + return 0; +}