aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Robbins <drobbins@funtoo.org>2011-01-30 21:05:09 -0700
committerDaniel Robbins <drobbins@funtoo.org>2011-01-30 21:05:09 -0700
commitb8f8b5cc4bcfef805570a08dab8eac11e7e97de6 (patch)
tree18b4ac8c76e8ce022bd675d560d3270c41a1ee4e
parentgentoo upstream merge (diff)
parentBump version to 3.4.12.5 (diff)
downloadgenkernel-b8f8b5cc4bcfef805570a08dab8eac11e7e97de6.tar.gz
genkernel-b8f8b5cc4bcfef805570a08dab8eac11e7e97de6.tar.bz2
genkernel-b8f8b5cc4bcfef805570a08dab8eac11e7e97de6.zip
Merge remote-tracking branch 'gentoo/master'
-rw-r--r--ChangeLog66
-rw-r--r--Makefile2
-rw-r--r--arch/x86/kernel-config2
-rw-r--r--arch/x86_64/kernel-config2005
-rwxr-xr-xdefaults/initrd.scripts10
-rw-r--r--doc/genkernel.8.txt18
-rwxr-xr-xgen_cmdline.sh17
-rwxr-xr-xgen_compile.sh50
-rwxr-xr-xgen_configkernel.sh1
-rwxr-xr-xgen_determineargs.sh5
-rwxr-xr-xgen_funcs.sh4
-rwxr-xr-xgen_initramfs.sh19
-rwxr-xr-xgenkernel2
-rw-r--r--genkernel.conf8
-rw-r--r--maintenance/docmatcher.py26
-rw-r--r--netboot/busy-config6
-rwxr-xr-xnetboot/linuxrc.x4
-rw-r--r--patches/busybox/1.18.1/1.18.1-mdadm.diff5874
-rw-r--r--patches/busybox/1.18.1/README5
-rw-r--r--patches/busybox/1.7.4/1.7.4-mdadm.diff5882
-rw-r--r--patches/busybox/1.7.4/README4
21 files changed, 1401 insertions, 12609 deletions
diff --git a/ChangeLog b/ChangeLog
index d27bb0ba..90cbacd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,68 @@
# Distributed under the GPL v2
# $Id$
+ 30 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12.5
+
+ 30 Jan 2011; Sebastian Pipping <sping@gentoo.org> gen_initramfs.sh:
+ Give blkid of e2fsprogs precedence over busybox re-write by putting it into
+ /sbin, not /bin (bug #352746)
+
+ 30 Jan 2011; Sebastian Pipping <sping@gentoo.org> arch/x86_64/kernel-config:
+ Enable CONFIG_USB_SUSPEND and CONFIG_PM_RUNTIME for x86_64 (bug #351376)
+
+ 30 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12.4
+
+ 30 Jan 2011; Sebastian Pipping <sping@gentoo.org> ChangeLog:
+ Enhance console handling on netboot linuxrc (bug #353084)
+ Enable shadow on netboot's busybox config (bug #353085)
+
+ Special thanks:
+ - Raúl Porcel
+
+ 29 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12.3
+
+ 29 Jan 2011; Sebastian Pipping <sping@gentoo.org> gen_compile.sh:
+ No longer require device mapper bincache for compiling lvm (bug #353026)
+
+ Special thanks:
+ - Peter Hjalmarsson
+
+ 27 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12.2
+
+ 27 Jan 2011; Sebastian Pipping <sping@gentoo.org> gen_determineargs.sh:
+ Revert kernel release detection fix (regression) (bug #352787)
+
+ 23 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12.1
+
+ 23 Jan 2011; Sebastian Pipping <sping@gentoo.org> gen_initramfs.sh:
+ Fix copying of mdadm/mdmon to the initramfs (bug #352496). Thanks to Malcolm
+ Lashley for reporting.
+
+ 23 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
+ Bump version to 3.4.12
+
+ 22 Jan 2011; Sebastian Pipping <sping@gentoo.org> ChangeLog:
+ Enable CONFIG_USB_SUSPEND for x86/amd64 (bug #351376)
+ Replace "${MAKEOPTS/-j?/j1}" by "${MAKEOPTS} -j1" (bug #277607)
+
+ 21 Jan 2011; Sebastian Pipping <sping@gentoo.org> gen_determineargs.sh:
+ Do not query generated files (like include/config/kernel.release) for kernel
+ version, as they may be out of sync (bug #263927)
+
+ 20 Jan 2011; Sebastian Pipping <sping@gentoo.org> ChangeLog:
+ Add proper mdadm support (bug #282100)
+
+ Special thanks:
+ - Craig Andrews (Testing)
+ - Laurent Pinchart (mdmon/IMSM support)
+ - Matthias Dahl (Initial patch)
+ - Peter Hjalmarsson (Testing)
+
20 Jan 2011; Sebastian Pipping <sping@gentoo.org> genkernel:
Bump version to 3.4.11.1
@@ -13,7 +75,7 @@
.config (whereas "make clean" does not) (bug #351906)
Special thanks:
- - Xake
+ - Peter Hjalmarsson
20 Jan 2011; Sebastian Pipping <sping@gentoo.org>
patches/busybox/1.18.1/1.18.1-mdstart.diff:
@@ -51,7 +113,7 @@
- devsk (Multi-device patch)
- Fabio Erculiani (Slowusb fixes)
- Kai Dietrich (Symlink analysis)
- - Kolbj�rn Barmen (Arithmetic fix)
+ - Kolbjørn Barmen (Arithmetic fix)
13 Dec 2010; Sebastian Pipping <sping@gentoo.org> genkernel:
Bump version to 3.4.10.908
diff --git a/Makefile b/Makefile
index 74c5bb97..751bb462 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ distdir = genkernel-$(PACKAGE_VERSION)
# Add off-Git/generated files here that need to be shipped with releases
EXTRA_DIST = genkernel.8
-genkernel.8: doc/genkernel.8.txt doc/asciidoc.conf Makefile
+genkernel.8: doc/genkernel.8.txt doc/asciidoc.conf Makefile genkernel
a2x --conf-file=doc/asciidoc.conf --attribute="genkernelversion=$(PACKAGE_VERSION)" \
--format=manpage -D . "$<"
diff --git a/arch/x86/kernel-config b/arch/x86/kernel-config
index 1dbc07e9..829ad84c 100644
--- a/arch/x86/kernel-config
+++ b/arch/x86/kernel-config
@@ -2940,7 +2940,7 @@ CONFIG_USB=m
CONFIG_USB_DEVICEFS=y
CONFIG_USB_DEVICE_CLASS=y
# CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_SUSPEND is not set
+CONFIG_USB_SUSPEND=y
# CONFIG_USB_PERSIST is not set
# CONFIG_USB_OTG is not set
diff --git a/arch/x86_64/kernel-config b/arch/x86_64/kernel-config
index 1260e39c..cc714c29 100644
--- a/arch/x86_64/kernel-config
+++ b/arch/x86_64/kernel-config
@@ -1,45 +1,66 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24-gentoo-r7
-# Fri May 9 01:16:07 2008
+# Linux kernel version: 2.6.36-gentoo-r5
+# Sun Jan 30 02:06:39 2011
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
CONFIG_X86_64=y
CONFIG_X86=y
-CONFIG_GENERIC_TIME=y
+CONFIG_INSTRUCTION_DECODER=y
+CONFIG_OUTPUT_FORMAT="elf64-x86-64"
+CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
-CONFIG_SEMAPHORE_SLEEPERS=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
-# CONFIG_QUICKLIST is not set
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_DMI=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_TIME_VSYSCALL=y
-CONFIG_ARCH_SUPPORTS_OPROFILE=y
-CONFIG_DEFCONFIG_LIST="arch/x86/configs/x86_64_defconfig"
+CONFIG_ARCH_HAS_CPU_RELAX=y
+CONFIG_ARCH_HAS_DEFAULT_IDLE=y
+CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
+CONFIG_HAVE_SETUP_PER_CPU_AREA=y
+CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
+CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
+CONFIG_HAVE_CPUMASK_OF_CPU_MAP=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ZONE_DMA32=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_AUDIT_ARCH=y
+CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_HAVE_EARLY_RES=y
+CONFIG_HAVE_INTEL_TXT=y
CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_PENDING_IRQ=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_X86_64_SMP=y
CONFIG_X86_HT=y
+CONFIG_X86_TRAMPOLINE=y
+CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11"
# CONFIG_KTIME_SCALAR is not set
+CONFIG_ARCH_CPU_PROBE_RELEASE=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
#
# General setup
@@ -47,40 +68,68 @@ CONFIG_X86_HT=y
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_BZIP2 is not set
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_LZO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
# CONFIG_TASK_DELAY_ACCT is not set
# CONFIG_TASK_XACCT is not set
-CONFIG_USER_NS=y
-# CONFIG_PID_NS is not set
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
+CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=64
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=15
+CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
+# CONFIG_CGROUP_FREEZER is not set
+# CONFIG_CGROUP_DEVICE is not set
CONFIG_CPUSETS=y
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
-CONFIG_CGROUP_CPUACCT=y
-CONFIG_SYSFS_DEPRECATED=y
CONFIG_PROC_PID_CPUSET=y
+CONFIG_CGROUP_CPUACCT=y
+# CONFIG_RESOURCE_COUNTERS is not set
+# CONFIG_CGROUP_SCHED is not set
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_LZO is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
CONFIG_EMBEDDED=y
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
@@ -89,46 +138,107 @@ CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
+CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_PCI_QUIRKS=y
+CONFIG_COMPAT_BRK=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_USER_RETURN_NOTIFIER=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_OPTPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
+CONFIG_HAVE_USER_RETURN_NOTIFIER=y
+CONFIG_HAVE_PERF_EVENTS_NMI=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
CONFIG_BLOCK_COMPAT=y
#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
CONFIG_PREEMPT_NOTIFIERS=y
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
#
# Processor type and features
@@ -138,87 +248,105 @@ CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_SMP=y
-CONFIG_X86_PC=y
-# CONFIG_X86_ELAN is not set
-# CONFIG_X86_VOYAGER is not set
-# CONFIG_X86_NUMAQ is not set
-# CONFIG_X86_SUMMIT is not set
-# CONFIG_X86_BIGSMP is not set
-# CONFIG_X86_VISWS is not set
-# CONFIG_X86_GENERICARCH is not set
-# CONFIG_X86_ES7000 is not set
+# CONFIG_SPARSE_IRQ is not set
+CONFIG_X86_MPPARSE=y
+CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_VSMP is not set
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-# CONFIG_M686 is not set
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
+CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+# CONFIG_PARAVIRT_GUEST is not set
+CONFIG_NO_BOOTMEM=y
+# CONFIG_MEMTEST is not set
# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MEFFICEON is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP2 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MGEODEGX1 is not set
-# CONFIG_MGEODE_LX is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-# CONFIG_MVIAC7 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
+# CONFIG_MATOM is not set
CONFIG_GENERIC_CPU=y
-CONFIG_X86_L1_CACHE_BYTES=128
-CONFIG_X86_INTERNODE_CACHE_BYTES=128
+CONFIG_X86_CPU=y
+CONFIG_X86_INTERNODE_CACHE_SHIFT=6
CONFIG_X86_CMPXCHG=y
-CONFIG_X86_L1_CACHE_SHIFT=7
-CONFIG_X86_GOOD_APIC=y
+CONFIG_X86_L1_CACHE_SHIFT=6
+CONFIG_X86_XADD=y
+CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_TSC=y
+CONFIG_X86_CMPXCHG64=y
+CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
+CONFIG_X86_DEBUGCTLMSR=y
+# CONFIG_PROCESSOR_SELECT is not set
+CONFIG_CPU_SUP_INTEL=y
+CONFIG_CPU_SUP_AMD=y
+CONFIG_CPU_SUP_CENTAUR=y
CONFIG_HPET_TIMER=y
+CONFIG_HPET_EMULATE_RTC=y
+CONFIG_DMI=y
CONFIG_GART_IOMMU=y
CONFIG_CALGARY_IOMMU=y
CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
+# CONFIG_AMD_IOMMU is not set
CONFIG_SWIOTLB=y
+CONFIG_IOMMU_HELPER=y
+CONFIG_IOMMU_API=y
+# CONFIG_MAXSMP is not set
CONFIG_NR_CPUS=32
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
-CONFIG_PREEMPT_BKL=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
+# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set
CONFIG_X86_MCE=y
CONFIG_X86_MCE_INTEL=y
CONFIG_X86_MCE_AMD=y
+CONFIG_X86_MCE_THRESHOLD=y
+# CONFIG_X86_MCE_INJECT is not set
+CONFIG_X86_THERMAL_VECTOR=y
+# CONFIG_I8K is not set
CONFIG_MICROCODE=m
+CONFIG_MICROCODE_INTEL=y
+# CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=m
CONFIG_X86_CPUID=m
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+CONFIG_DIRECT_GBPAGES=y
# CONFIG_NUMA is not set
-CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y
+CONFIG_SPARSEMEM_VMEMMAP=y
+# CONFIG_MEMORY_HOTPLUG is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_RESOURCES_64BIT=y
+CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
+CONFIG_MMU_NOTIFIER=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
+# CONFIG_MEMORY_FAILURE is not set
+# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
+CONFIG_X86_RESERVE_LOW_64K=y
CONFIG_MTRR=y
+CONFIG_MTRR_SANITIZER=y
+CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
+CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
+CONFIG_X86_PAT=y
+CONFIG_ARCH_USES_PG_UNCACHED=y
+# CONFIG_EFI is not set
CONFIG_SECCOMP=y
# CONFIG_CC_STACKPROTECTOR is not set
CONFIG_HZ_100=y
@@ -226,54 +354,61 @@ CONFIG_HZ_100=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
+CONFIG_SCHED_HRTICK=y
CONFIG_KEXEC=y
CONFIG_CRASH_DUMP=y
+# CONFIG_KEXEC_JUMP is not set
CONFIG_PHYSICAL_START=0x200000
CONFIG_RELOCATABLE=y
-CONFIG_PHYSICAL_ALIGN=0x200000
+CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_HOTPLUG_CPU=y
+CONFIG_COMPAT_VDSO=y
+# CONFIG_CMDLINE_BOOL is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
-# Power management options
+# Power management and ACPI options
#
CONFIG_ARCH_HIBERNATION_HEADER=y
CONFIG_PM=y
-CONFIG_PM_LEGACY=y
# CONFIG_PM_DEBUG is not set
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_SLEEP=y
-CONFIG_SUSPEND_SMP_POSSIBLE=y
+CONFIG_SUSPEND_NVS=y
CONFIG_SUSPEND=y
-CONFIG_HIBERNATION_SMP_POSSIBLE=y
+CONFIG_SUSPEND_FREEZER=y
CONFIG_HIBERNATION=y
CONFIG_PM_STD_PARTITION=""
+CONFIG_PM_RUNTIME=y
+CONFIG_PM_OPS=y
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_PROCFS=y
CONFIG_ACPI_PROCFS_POWER=y
+# CONFIG_ACPI_POWER_METER is not set
CONFIG_ACPI_SYSFS_POWER=y
+# CONFIG_ACPI_EC_DEBUGFS is not set
CONFIG_ACPI_PROC_EVENT=y
CONFIG_ACPI_AC=m
CONFIG_ACPI_BATTERY=m
CONFIG_ACPI_BUTTON=m
CONFIG_ACPI_VIDEO=m
CONFIG_ACPI_FAN=m
-CONFIG_ACPI_DOCK=m
-CONFIG_ACPI_BAY=m
+# CONFIG_ACPI_DOCK is not set
CONFIG_ACPI_PROCESSOR=m
CONFIG_ACPI_HOTPLUG_CPU=y
+# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set
CONFIG_ACPI_THERMAL=m
-CONFIG_ACPI_ASUS=m
-CONFIG_ACPI_TOSHIBA=m
+# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_EC=y
-CONFIG_ACPI_POWER=y
-CONFIG_ACPI_SYSTEM=y
+# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_X86_PM_TIMER=y
CONFIG_ACPI_CONTAINER=m
# CONFIG_ACPI_SBS is not set
+# CONFIG_ACPI_HED is not set
+# CONFIG_ACPI_APEI is not set
+# CONFIG_SFI is not set
#
# CPU Frequency scaling
@@ -284,6 +419,7 @@ CONFIG_CPU_FREQ_TABLE=m
CONFIG_CPU_FREQ_STAT=m
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
@@ -296,20 +432,25 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
#
# CPUFreq processor drivers
#
+# CONFIG_X86_PCC_CPUFREQ is not set
CONFIG_X86_ACPI_CPUFREQ=m
CONFIG_X86_POWERNOW_K8=m
-CONFIG_X86_POWERNOW_K8_ACPI=y
CONFIG_X86_SPEEDSTEP_CENTRINO=m
CONFIG_X86_P4_CLOCKMOD=m
#
# shared options
#
-# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
CONFIG_X86_SPEEDSTEP_LIB=m
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_IDLE_GOV_MENU=y
+# CONFIG_INTEL_IDLE is not set
+
+#
+# Memory power savings
+#
+# CONFIG_I7300_IDLE is not set
#
# Bus options (PCI etc.)
@@ -318,23 +459,30 @@ CONFIG_PCI=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_DOMAINS=y
+# CONFIG_PCI_CNB20LE_QUIRK is not set
CONFIG_DMAR=y
-CONFIG_DMAR_GFX_WA=y
+CONFIG_DMAR_DEFAULT_ON=y
CONFIG_DMAR_FLOPPY_WA=y
+# CONFIG_INTR_REMAP is not set
CONFIG_PCIEPORTBUS=y
CONFIG_PCIEAER=y
+# CONFIG_PCIE_ECRC is not set
+# CONFIG_PCIEAER_INJECT is not set
+CONFIG_PCIEASPM=y
+# CONFIG_PCIEASPM_DEBUG is not set
+CONFIG_PCIE_PME=y
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
-CONFIG_PCI_LEGACY=y
# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
CONFIG_HT_IRQ=y
+# CONFIG_PCI_IOV is not set
+CONFIG_PCI_IOAPIC=y
CONFIG_ISA_DMA_API=y
CONFIG_K8_NB=y
CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
CONFIG_PCMCIA=m
CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
CONFIG_CARDBUS=y
#
@@ -348,35 +496,36 @@ CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
CONFIG_PD6729=m
CONFIG_I82092=m
-CONFIG_PCCARD_NONSTATIC=m
+CONFIG_PCCARD_NONSTATIC=y
# CONFIG_HOTPLUG_PCI is not set
#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
+CONFIG_COMPAT_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
CONFIG_BINFMT_MISC=m
CONFIG_IA32_EMULATION=y
# CONFIG_IA32_AOUT is not set
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
CONFIG_SYSVIPC_COMPAT=y
-
-#
-# Networking
-#
CONFIG_NET=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
#
# Networking options
#
CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
CONFIG_XFRM=y
CONFIG_XFRM_USER=m
# CONFIG_XFRM_SUB_POLICY is not set
# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_XFRM_IPCOMP=m
CONFIG_NET_KEY=m
# CONFIG_NET_KEY_MIGRATE is not set
CONFIG_INET=y
@@ -396,6 +545,7 @@ CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
+# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
# CONFIG_ARPD is not set
@@ -415,7 +565,6 @@ CONFIG_INET_TCP_DIAG=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
-# CONFIG_IP_VS is not set
CONFIG_IPV6=m
CONFIG_IPV6_PRIVACY=y
CONFIG_IPV6_ROUTER_PREF=y
@@ -432,11 +581,16 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
CONFIG_INET6_XFRM_MODE_BEET=m
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=m
# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
CONFIG_NETWORK_SECMARK=y
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
CONFIG_BRIDGE_NETFILTER=y
#
@@ -445,12 +599,11 @@ CONFIG_BRIDGE_NETFILTER=y
CONFIG_NETFILTER_NETLINK=m
CONFIG_NETFILTER_NETLINK_QUEUE=m
CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_EVENTS=y
+# CONFIG_NF_CT_PROTO_DCCP is not set
CONFIG_NF_CT_PROTO_GRE=m
CONFIG_NF_CT_PROTO_SCTP=m
CONFIG_NF_CT_PROTO_UDPLITE=m
@@ -464,37 +617,69 @@ CONFIG_NF_CONNTRACK_SANE=m
CONFIG_NF_CONNTRACK_SIP=m
CONFIG_NF_CONNTRACK_TFTP=m
CONFIG_NF_CT_NETLINK=m
+# CONFIG_NETFILTER_TPROXY is not set
CONFIG_NETFILTER_XTABLES=m
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=m
+CONFIG_NETFILTER_XT_CONNMARK=m
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
+CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
CONFIG_NETFILTER_XT_TARGET_DSCP=m
+CONFIG_NETFILTER_XT_TARGET_HL=m
+# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
+# CONFIG_NETFILTER_XT_TARGET_LED is not set
CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
CONFIG_NETFILTER_XT_TARGET_NFLOG=m
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
CONFIG_NETFILTER_XT_TARGET_TRACE=m
CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
CONFIG_NETFILTER_XT_MATCH_COMMENT=m
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
+# CONFIG_NETFILTER_XT_MATCH_CPU is not set
CONFIG_NETFILTER_XT_MATCH_DCCP=m
CONFIG_NETFILTER_XT_MATCH_DSCP=m
CONFIG_NETFILTER_XT_MATCH_ESP=m
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
CONFIG_NETFILTER_XT_MATCH_HELPER=m
+CONFIG_NETFILTER_XT_MATCH_HL=m
+# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
CONFIG_NETFILTER_XT_MATCH_LENGTH=m
CONFIG_NETFILTER_XT_MATCH_LIMIT=m
CONFIG_NETFILTER_XT_MATCH_MAC=m
CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+CONFIG_NETFILTER_XT_MATCH_POLICY=m
# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
CONFIG_NETFILTER_XT_MATCH_QUOTA=m
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
CONFIG_NETFILTER_XT_MATCH_REALM=m
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
CONFIG_NETFILTER_XT_MATCH_SCTP=m
CONFIG_NETFILTER_XT_MATCH_STATE=m
CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
@@ -502,23 +687,20 @@ CONFIG_NETFILTER_XT_MATCH_STRING=m
CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
CONFIG_NETFILTER_XT_MATCH_TIME=m
CONFIG_NETFILTER_XT_MATCH_U32=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
+# CONFIG_IP_VS is not set
#
# IP: Netfilter Configuration
#
+CONFIG_NF_DEFRAG_IPV4=m
CONFIG_NF_CONNTRACK_IPV4=m
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
# CONFIG_IP_NF_QUEUE is not set
CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
CONFIG_IP_NF_MATCH_AH=m
+CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_ADDRTYPE=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_TARGET_LOG=m
@@ -526,11 +708,12 @@ CONFIG_IP_NF_TARGET_ULOG=m
CONFIG_NF_NAT=m
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
+CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_NF_NAT_SNMP_BASIC=m
CONFIG_NF_NAT_PROTO_GRE=m
+CONFIG_NF_NAT_PROTO_UDPLITE=m
+CONFIG_NF_NAT_PROTO_SCTP=m
CONFIG_NF_NAT_FTP=m
CONFIG_NF_NAT_IRC=m
CONFIG_NF_NAT_TFTP=m
@@ -539,40 +722,34 @@ CONFIG_NF_NAT_PPTP=m
CONFIG_NF_NAT_H323=m
CONFIG_NF_NAT_SIP=m
CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
CONFIG_IP_NF_TARGET_ECN=m
CONFIG_IP_NF_TARGET_TTL=m
-CONFIG_IP_NF_TARGET_CLUSTERIP=m
CONFIG_IP_NF_RAW=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_ARP_MANGLE=m
#
-# IPv6: Netfilter Configuration (EXPERIMENTAL)
+# IPv6: Netfilter Configuration
#
CONFIG_NF_CONNTRACK_IPV6=m
# CONFIG_IP6_NF_QUEUE is not set
CONFIG_IP6_NF_IPTABLES=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_MATCH_OPTS=m
+CONFIG_IP6_NF_MATCH_AH=m
+CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_FRAG=m
+CONFIG_IP6_NF_MATCH_OPTS=m
CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_OWNER=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_AH=m
CONFIG_IP6_NF_MATCH_MH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_FILTER=m
+CONFIG_IP6_NF_MATCH_RT=m
+CONFIG_IP6_NF_TARGET_HL=m
CONFIG_IP6_NF_TARGET_LOG=m
+CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_TARGET_REJECT=m
CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_TARGET_HL=m
CONFIG_IP6_NF_RAW=m
-
-#
-# Bridge: Netfilter Configuration
-#
# CONFIG_BRIDGE_NF_EBTABLES is not set
# CONFIG_IP_DCCP is not set
CONFIG_IP_SCTP=m
@@ -581,6 +758,7 @@ CONFIG_IP_SCTP=m
# CONFIG_SCTP_HMAC_NONE is not set
CONFIG_SCTP_HMAC_SHA1=y
# CONFIG_SCTP_HMAC_MD5 is not set
+# CONFIG_RDS is not set
# CONFIG_TIPC is not set
CONFIG_ATM=m
CONFIG_ATM_CLIP=m
@@ -589,8 +767,13 @@ CONFIG_ATM_LANE=m
CONFIG_ATM_MPOA=m
CONFIG_ATM_BR2684=m
# CONFIG_ATM_BR2684_IPFILTER is not set
+# CONFIG_L2TP is not set
+CONFIG_STP=m
CONFIG_BRIDGE=m
+CONFIG_BRIDGE_IGMP_SNOOPING=y
+# CONFIG_NET_DSA is not set
CONFIG_VLAN_8021Q=m
+# CONFIG_VLAN_8021Q_GVRP is not set
# CONFIG_DECNET is not set
CONFIG_LLC=y
# CONFIG_LLC2 is not set
@@ -600,6 +783,8 @@ CONFIG_LLC=y
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
CONFIG_NET_SCHED=y
#
@@ -610,7 +795,7 @@ CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_HFSC=m
CONFIG_NET_SCH_ATM=m
CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RR=m
+# CONFIG_NET_SCH_MULTIQ is not set
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
@@ -618,6 +803,7 @@ CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
# CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
CONFIG_NET_SCH_INGRESS=m
#
@@ -634,6 +820,8 @@ CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
+# CONFIG_NET_CLS_FLOW is not set
+# CONFIG_NET_CLS_CGROUP is not set
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_CMP=m
@@ -650,15 +838,19 @@ CONFIG_NET_ACT_IPT=m
CONFIG_NET_ACT_NAT=m
CONFIG_NET_ACT_PEDIT=m
# CONFIG_NET_ACT_SIMP is not set
-# CONFIG_NET_CLS_POLICE is not set
+# CONFIG_NET_ACT_SKBEDIT is not set
# CONFIG_NET_CLS_IND is not set
CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
+# CONFIG_DNS_RESOLVER is not set
+CONFIG_RPS=y
#
# Network testing
#
CONFIG_NET_PKTGEN=m
# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
CONFIG_IRDA=m
#
@@ -704,14 +896,6 @@ CONFIG_KSDAZZLE_DONGLE=m
CONFIG_KS959_DONGLE=m
#
-# Old SIR device drivers
-#
-
-#
-# Old Serial dongle support
-#
-
-#
# FIR device drivers
#
CONFIG_USB_IRDA=m
@@ -731,18 +915,17 @@ CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
-# CONFIG_BT_CMTP is not set
CONFIG_BT_HIDP=m
#
# Bluetooth device drivers
#
-CONFIG_BT_HCIUSB=m
-CONFIG_BT_HCIUSB_SCO=y
+# CONFIG_BT_HCIBTUSB is not set
CONFIG_BT_HCIBTSDIO=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
+# CONFIG_BT_HCIUART_ATH3K is not set
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
@@ -752,34 +935,48 @@ CONFIG_BT_HCIBT3C=m
CONFIG_BT_HCIBLUECARD=m
CONFIG_BT_HCIBTUART=m
CONFIG_BT_HCIVHCI=m
+# CONFIG_BT_MRVL is not set
CONFIG_AF_RXRPC=m
# CONFIG_AF_RXRPC_DEBUG is not set
CONFIG_RXKAD=m
CONFIG_FIB_RULES=y
-
-#
-# Wireless
-#
-CONFIG_CFG80211=m
-CONFIG_NL80211=y
+CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=m
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+CONFIG_CFG80211_WEXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
+CONFIG_LIB80211=m
+CONFIG_LIB80211_CRYPT_WEP=m
+CONFIG_LIB80211_CRYPT_CCMP=m
+CONFIG_LIB80211_CRYPT_TKIP=m
+# CONFIG_LIB80211_DEBUG is not set
CONFIG_MAC80211=m
-CONFIG_MAC80211_RCSIMPLE=y
+CONFIG_MAC80211_HAS_RC=y
+# CONFIG_MAC80211_RC_PID is not set
+CONFIG_MAC80211_RC_MINSTREL=y
+CONFIG_MAC80211_RC_MINSTREL_HT=y
+CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
+CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
+# CONFIG_MAC80211_MESH is not set
CONFIG_MAC80211_LEDS=y
-# CONFIG_MAC80211_DEBUG is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_CRYPT_TKIP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
+# CONFIG_MAC80211_DEBUG_MENU is not set
+# CONFIG_WIMAX is not set
CONFIG_RFKILL=m
-CONFIG_RFKILL_INPUT=m
CONFIG_RFKILL_LEDS=y
+# CONFIG_RFKILL_INPUT is not set
CONFIG_NET_9P=m
-CONFIG_NET_9P_FD=m
+# CONFIG_NET_9P_RDMA is not set
# CONFIG_NET_9P_DEBUG is not set
+# CONFIG_CAIF is not set
#
# Device Drivers
@@ -789,9 +986,12 @@ CONFIG_NET_9P_FD=m
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH="/sbin/udevadm"
+# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
@@ -808,7 +1008,7 @@ CONFIG_PARPORT_AX88796=m
CONFIG_PARPORT_1284=y
CONFIG_PARPORT_NOT_PC=y
CONFIG_PNP=y
-# CONFIG_PNP_DEBUG is not set
+CONFIG_PNP_DEBUG_MESSAGES=y
#
# Protocols
@@ -853,47 +1053,67 @@ CONFIG_BLK_DEV_UMEM=m
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_SX8=m
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=8192
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+# CONFIG_BLK_DEV_XIP is not set
# CONFIG_CDROM_PKTCDVD is not set
CONFIG_ATA_OVER_ETH=m
+# CONFIG_BLK_DEV_HD is not set
CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
# CONFIG_IBM_ASM is not set
CONFIG_PHANTOM=m
-CONFIG_EEPROM_93CX6=m
# CONFIG_SGI_IOC4 is not set
CONFIG_TIFM_CORE=m
CONFIG_TIFM_7XX1=m
-CONFIG_ASUS_LAPTOP=m
-CONFIG_FUJITSU_LAPTOP=m
-CONFIG_MSI_LAPTOP=m
-CONFIG_SONY_LAPTOP=m
-CONFIG_SONYPI_COMPAT=y
-CONFIG_THINKPAD_ACPI=m
-# CONFIG_THINKPAD_ACPI_DEBUG is not set
-CONFIG_THINKPAD_ACPI_BAY=y
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_CS5535_MFGPT is not set
+# CONFIG_HP_ILO is not set
+# CONFIG_ISL29003 is not set
+CONFIG_SENSORS_TSL2550=m
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_HMC6352 is not set
+CONFIG_DS1682=m
+# CONFIG_VMWARE_BALLOON is not set
+# CONFIG_BMP085 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+CONFIG_EEPROM_93CX6=m
+# CONFIG_CB710_CORE is not set
+# CONFIG_IWMC3200TOP is not set
+CONFIG_HAVE_IDE=y
CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=8
-CONFIG_BLK_DEV_IDE=y
#
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
#
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_TIMINGS=y
+CONFIG_IDE_ATAPI=y
# CONFIG_BLK_DEV_IDE_SATA is not set
-# CONFIG_BLK_DEV_HD_IDE is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
CONFIG_BLK_DEV_IDECS=m
CONFIG_BLK_DEV_DELKIN=m
CONFIG_BLK_DEV_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
CONFIG_BLK_DEV_IDETAPE=m
-CONFIG_BLK_DEV_IDEFLOPPY=m
-# CONFIG_BLK_DEV_IDESCSI is not set
CONFIG_BLK_DEV_IDEACPI=y
# CONFIG_IDE_TASK_IOCTL is not set
CONFIG_IDE_PROC_FS=y
@@ -906,12 +1126,12 @@ CONFIG_BLK_DEV_PLATFORM=m
CONFIG_BLK_DEV_CMD640=y
CONFIG_BLK_DEV_CMD640_ENHANCED=y
CONFIG_BLK_DEV_IDEPNP=y
+CONFIG_BLK_DEV_IDEDMA_SFF=y
#
# PCI IDE chipsets support
#
CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_IDEPCI_PCIBUS_ORDER=y
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_BLK_DEV_GENERIC=y
@@ -920,25 +1140,21 @@ CONFIG_BLK_DEV_RZ1000=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_BLK_DEV_AEC62XX=y
CONFIG_BLK_DEV_ALI15X3=y
-# CONFIG_WDC_ALI15X3 is not set
CONFIG_BLK_DEV_AMD74XX=y
CONFIG_BLK_DEV_ATIIXP=y
CONFIG_BLK_DEV_CMD64X=y
CONFIG_BLK_DEV_TRIFLEX=y
-CONFIG_BLK_DEV_CY82C693=y
CONFIG_BLK_DEV_CS5520=y
CONFIG_BLK_DEV_CS5530=y
-CONFIG_BLK_DEV_HPT34X=y
-# CONFIG_HPT34X_AUTODMA is not set
CONFIG_BLK_DEV_HPT366=y
CONFIG_BLK_DEV_JMICRON=m
CONFIG_BLK_DEV_SC1200=y
CONFIG_BLK_DEV_PIIX=y
+# CONFIG_BLK_DEV_IT8172 is not set
CONFIG_BLK_DEV_IT8213=m
CONFIG_BLK_DEV_IT821X=y
CONFIG_BLK_DEV_NS87415=y
CONFIG_BLK_DEV_PDC202XX_OLD=y
-# CONFIG_PDC202XX_BURST is not set
CONFIG_BLK_DEV_PDC202XX_NEW=y
CONFIG_BLK_DEV_SVWKS=y
CONFIG_BLK_DEV_SIIMAGE=m
@@ -947,14 +1163,12 @@ CONFIG_BLK_DEV_SLC90E66=y
CONFIG_BLK_DEV_TRM290=y
CONFIG_BLK_DEV_VIA82CXXX=y
CONFIG_BLK_DEV_TC86C001=m
-# CONFIG_IDE_ARM is not set
CONFIG_BLK_DEV_IDEDMA=y
-CONFIG_IDE_ARCH_OBSOLETE_INIT=y
-# CONFIG_BLK_DEV_HD is not set
#
# SCSI device support
#
+CONFIG_SCSI_MOD=y
CONFIG_RAID_ATTRS=m
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
@@ -972,10 +1186,6 @@ CONFIG_BLK_DEV_SR=y
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_CHR_DEV_SG=m
CONFIG_CHR_DEV_SCH=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
CONFIG_SCSI_MULTI_LUN=y
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
@@ -992,13 +1202,20 @@ CONFIG_SCSI_ISCSI_ATTRS=m
CONFIG_SCSI_SAS_ATTRS=m
CONFIG_SCSI_SAS_LIBSAS=m
CONFIG_SCSI_SAS_ATA=y
+CONFIG_SCSI_SAS_HOST_SMP=y
# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
CONFIG_SCSI_SRP_ATTRS=m
CONFIG_SCSI_SRP_TGT_ATTRS=y
CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_SCSI_CXGB3_ISCSI is not set
+# CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
CONFIG_BLK_DEV_3W_XXXX_RAID=m
+# CONFIG_SCSI_HPSA is not set
CONFIG_SCSI_3W_9XXX=m
+# CONFIG_SCSI_3W_SAS is not set
CONFIG_SCSI_ACARD=m
CONFIG_SCSI_AACRAID=m
CONFIG_SCSI_AIC7XXX=m
@@ -1016,6 +1233,8 @@ CONFIG_AIC79XX_DEBUG_MASK=0
# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
CONFIG_SCSI_AIC94XX=m
# CONFIG_AIC94XX_DEBUG is not set
+# CONFIG_SCSI_MVSAS is not set
+# CONFIG_SCSI_DPT_I2O is not set
CONFIG_SCSI_ADVANSYS=m
CONFIG_SCSI_ARCMSR=m
# CONFIG_SCSI_ARCMSR_AER is not set
@@ -1024,9 +1243,14 @@ CONFIG_MEGARAID_MM=m
CONFIG_MEGARAID_MAILBOX=m
CONFIG_MEGARAID_LEGACY=m
CONFIG_MEGARAID_SAS=m
+# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_HPTIOP=m
CONFIG_SCSI_BUSLOGIC=m
-# CONFIG_SCSI_OMIT_FLASHPOINT is not set
+# CONFIG_VMWARE_PVSCSI is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_FCOE is not set
+# CONFIG_FCOE_FNIC is not set
CONFIG_SCSI_DMX3191D=m
CONFIG_SCSI_EATA=m
CONFIG_SCSI_EATA_TAGGED_QUEUE=y
@@ -1055,79 +1279,120 @@ CONFIG_SCSI_LPFC=m
CONFIG_SCSI_DC395x=m
CONFIG_SCSI_DC390T=m
# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
CONFIG_SCSI_SRP=m
+# CONFIG_SCSI_BFA_FC is not set
CONFIG_SCSI_LOWLEVEL_PCMCIA=y
CONFIG_PCMCIA_FDOMAIN=m
CONFIG_PCMCIA_QLOGIC=m
CONFIG_PCMCIA_SYM53C500=m
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=m
# CONFIG_ATA_NONSTANDARD is not set
+CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_ACPI=y
+CONFIG_SATA_PMP=y
+
+#
+# Controllers with non-SFF native interface
+#
CONFIG_SATA_AHCI=m
-CONFIG_SATA_SVW=m
+# CONFIG_SATA_AHCI_PLATFORM is not set
+CONFIG_SATA_INIC162X=m
+CONFIG_SATA_SIL24=m
+CONFIG_ATA_SFF=y
+
+#
+# SFF controllers with custom DMA interface
+#
+CONFIG_PDC_ADMA=m
+CONFIG_SATA_QSTOR=m
+CONFIG_SATA_SX4=m
+CONFIG_ATA_BMDMA=y
+
+#
+# SATA SFF controllers with BMDMA
+#
CONFIG_ATA_PIIX=m
CONFIG_SATA_MV=m
CONFIG_SATA_NV=m
-CONFIG_PDC_ADMA=m
-CONFIG_SATA_QSTOR=m
CONFIG_SATA_PROMISE=m
-CONFIG_SATA_SX4=m
CONFIG_SATA_SIL=m
-CONFIG_SATA_SIL24=m
CONFIG_SATA_SIS=m
+CONFIG_SATA_SVW=m
CONFIG_SATA_ULI=m
CONFIG_SATA_VIA=m
CONFIG_SATA_VITESSE=m
-CONFIG_SATA_INIC162X=m
-CONFIG_PATA_ACPI=m
+
+#
+# PATA SFF controllers with BMDMA
+#
CONFIG_PATA_ALI=m
CONFIG_PATA_AMD=m
CONFIG_PATA_ARTOP=m
CONFIG_PATA_ATIIXP=m
-CONFIG_PATA_CMD640_PCI=m
+# CONFIG_PATA_ATP867X is not set
CONFIG_PATA_CMD64X=m
CONFIG_PATA_CS5520=m
CONFIG_PATA_CS5530=m
# CONFIG_PATA_CYPRESS is not set
CONFIG_PATA_EFAR=m
-#CONFIG_ATA_GENERIC=m
CONFIG_PATA_HPT366=m
CONFIG_PATA_HPT37X=m
CONFIG_PATA_HPT3X2N=m
CONFIG_PATA_HPT3X3=m
# CONFIG_PATA_HPT3X3_DMA is not set
-CONFIG_PATA_IT821X=m
CONFIG_PATA_IT8213=m
+CONFIG_PATA_IT821X=m
CONFIG_PATA_JMICRON=m
-CONFIG_PATA_TRIFLEX=m
CONFIG_PATA_MARVELL=m
-CONFIG_PATA_MPIIX=m
-# CONFIG_PATA_OLDPIIX is not set
CONFIG_PATA_NETCELL=m
-CONFIG_PATA_NS87410=m
+# CONFIG_PATA_NINJA32 is not set
CONFIG_PATA_NS87415=m
-CONFIG_PATA_OPTI=m
+# CONFIG_PATA_OLDPIIX is not set
CONFIG_PATA_OPTIDMA=m
-CONFIG_PATA_PCMCIA=m
+CONFIG_PATA_PDC2027X=m
CONFIG_PATA_PDC_OLD=m
CONFIG_PATA_RADISYS=m
-CONFIG_PATA_RZ1000=m
+# CONFIG_PATA_RDC is not set
CONFIG_PATA_SC1200=m
+# CONFIG_PATA_SCH is not set
CONFIG_PATA_SERVERWORKS=m
-CONFIG_PATA_PDC2027X=m
CONFIG_PATA_SIL680=m
CONFIG_PATA_SIS=m
+# CONFIG_PATA_TOSHIBA is not set
+CONFIG_PATA_TRIFLEX=m
CONFIG_PATA_VIA=m
CONFIG_PATA_WINBOND=m
+
+#
+# PIO-only SFF controllers
+#
+CONFIG_PATA_CMD640_PCI=m
+CONFIG_PATA_MPIIX=m
+CONFIG_PATA_NS87410=m
+CONFIG_PATA_OPTI=m
+CONFIG_PATA_PCMCIA=m
CONFIG_PATA_PLATFORM=m
+CONFIG_PATA_RZ1000=m
+
+#
+# Generic fallback / legacy drivers
+#
+CONFIG_PATA_ACPI=m
+# CONFIG_ATA_GENERIC is not set
+# CONFIG_PATA_LEGACY is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
+CONFIG_MD_AUTODETECT=y
CONFIG_MD_LINEAR=m
CONFIG_MD_RAID0=m
CONFIG_MD_RAID1=m
CONFIG_MD_RAID10=m
CONFIG_MD_RAID456=m
-CONFIG_MD_RAID5_RESHAPE=y
+# CONFIG_MULTICORE_RAID456 is not set
CONFIG_MD_MULTIPATH=m
CONFIG_MD_FAULTY=m
CONFIG_BLK_DEV_DM=m
@@ -1135,14 +1400,13 @@ CONFIG_BLK_DEV_DM=m
CONFIG_DM_CRYPT=m
CONFIG_DM_SNAPSHOT=m
CONFIG_DM_MIRROR=m
+# CONFIG_DM_LOG_USERSPACE is not set
CONFIG_DM_ZERO=m
CONFIG_DM_MULTIPATH=m
-CONFIG_DM_MULTIPATH_EMC=m
-CONFIG_DM_MULTIPATH_RDAC=m
-CONFIG_DM_MULTIPATH_HP=m
+# CONFIG_DM_MULTIPATH_QL is not set
+# CONFIG_DM_MULTIPATH_ST is not set
# CONFIG_DM_DELAY is not set
CONFIG_DM_UEVENT=y
-CONFIG_BLK_DEV_DM_BBR=m
CONFIG_FUSION=y
CONFIG_FUSION_SPI=m
CONFIG_FUSION_FC=m
@@ -1155,30 +1419,27 @@ CONFIG_FUSION_LAN=m
#
# IEEE 1394 (FireWire) support
#
-# CONFIG_FIREWIRE is not set
-CONFIG_IEEE1394=m
#
-# Subsystem Options
+# You can enable one or both FireWire driver stacks.
#
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
#
-# Controllers
+# The newer stack is recommended.
#
-# CONFIG_IEEE1394_PCILYNX is not set
+# CONFIG_FIREWIRE is not set
+CONFIG_IEEE1394=m
CONFIG_IEEE1394_OHCI1394=m
-
-#
-# Protocols
-#
-CONFIG_IEEE1394_VIDEO1394=m
+# CONFIG_IEEE1394_PCILYNX is not set
CONFIG_IEEE1394_SBP2=m
# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y
CONFIG_IEEE1394_ETH1394=m
-CONFIG_IEEE1394_DV1394=m
CONFIG_IEEE1394_RAWIO=m
+CONFIG_IEEE1394_VIDEO1394=m
+CONFIG_IEEE1394_DV1394=m
+# CONFIG_IEEE1394_VERBOSEDEBUG is not set
+# CONFIG_FIREWIRE_NOSY is not set
CONFIG_I2O=m
# CONFIG_I2O_LCT_NOTIFY_ON_CHANGES is not set
CONFIG_I2O_EXT_ADAPTEC=y
@@ -1192,11 +1453,11 @@ CONFIG_I2O_PROC=m
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
-CONFIG_NETDEVICES_MULTIQUEUE=y
# CONFIG_IFB is not set
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
CONFIG_MACVLAN=m
+# CONFIG_MACVTAP is not set
# CONFIG_EQUALIZER is not set
CONFIG_TUN=m
CONFIG_VETH=m
@@ -1216,11 +1477,11 @@ CONFIG_VITESSE_PHY=m
CONFIG_SMSC_PHY=m
CONFIG_BROADCOM_PHY=m
CONFIG_ICPLUS_PHY=m
-CONFIG_FIXED_PHY=m
-CONFIG_FIXED_MII_10_FDX=y
-CONFIG_FIXED_MII_100_FDX=y
-CONFIG_FIXED_MII_1000_FDX=y
-CONFIG_FIXED_MII_AMNT=1
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
CONFIG_MDIO_BITBANG=m
CONFIG_NET_ETHERNET=y
CONFIG_MII=m
@@ -1230,8 +1491,11 @@ CONFIG_CASSINI=m
CONFIG_NET_VENDOR_3COM=y
CONFIG_VORTEX=m
CONFIG_TYPHOON=m
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
CONFIG_NET_TULIP=y
CONFIG_DE2104X=m
+CONFIG_DE2104X_DSL=0
CONFIG_TULIP=m
CONFIG_TULIP_MWI=y
CONFIG_TULIP_MMIO=y
@@ -1247,20 +1511,19 @@ CONFIG_HP100=m
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
CONFIG_NET_PCI=y
CONFIG_PCNET32=m
-# CONFIG_PCNET32_NAPI is not set
CONFIG_AMD8111_ETH=m
-# CONFIG_AMD8111E_NAPI is not set
CONFIG_ADAPTEC_STARFIRE=m
-# CONFIG_ADAPTEC_STARFIRE_NAPI is not set
+# CONFIG_KSZ884X_PCI is not set
CONFIG_B44=m
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_FORCEDETH=m
-# CONFIG_FORCEDETH_NAPI is not set
-# CONFIG_EEPRO100 is not set
CONFIG_E100=m
CONFIG_FEALNX=m
CONFIG_NATSEMI=m
@@ -1271,163 +1534,190 @@ CONFIG_8139TOO=m
CONFIG_8139TOO_TUNE_TWISTER=y
CONFIG_8139TOO_8129=y
# CONFIG_8139_OLD_RX_RESET is not set
+# CONFIG_R6040 is not set
CONFIG_SIS900=m
CONFIG_EPIC100=m
+# CONFIG_SMSC9420 is not set
CONFIG_SUNDANCE=m
CONFIG_SUNDANCE_MMIO=y
+# CONFIG_TLAN is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
CONFIG_VIA_RHINE=m
CONFIG_VIA_RHINE_MMIO=y
-CONFIG_VIA_RHINE_NAPI=y
CONFIG_SC92031=m
CONFIG_NET_POCKET=y
CONFIG_ATP=m
CONFIG_DE600=m
CONFIG_DE620=m
+# CONFIG_ATL2 is not set
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=m
# CONFIG_ACENIC_OMIT_TIGON_I is not set
CONFIG_DL2K=m
CONFIG_E1000=m
-# CONFIG_E1000_NAPI is not set
-# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
CONFIG_E1000E=m
CONFIG_IP1000=m
+# CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
CONFIG_NS83820=m
CONFIG_HAMACHI=m
CONFIG_YELLOWFIN=m
CONFIG_R8169=m
-# CONFIG_R8169_NAPI is not set
CONFIG_R8169_VLAN=y
CONFIG_SIS190=m
CONFIG_SKGE=m
CONFIG_SKY2=m
-# CONFIG_SK98LIN is not set
CONFIG_VIA_VELOCITY=m
CONFIG_TIGON3=m
CONFIG_BNX2=m
+# CONFIG_CNIC is not set
CONFIG_QLA3XXX=m
CONFIG_ATL1=m
+# CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
+# CONFIG_JME is not set
CONFIG_NETDEV_10000=y
+CONFIG_MDIO=m
CONFIG_CHELSIO_T1=m
CONFIG_CHELSIO_T1_1G=y
-CONFIG_CHELSIO_T1_NAPI=y
+CONFIG_CHELSIO_T3_DEPENDS=y
CONFIG_CHELSIO_T3=m
+CONFIG_CHELSIO_T4_DEPENDS=y
+# CONFIG_CHELSIO_T4 is not set
+CONFIG_CHELSIO_T4VF_DEPENDS=y
+# CONFIG_CHELSIO_T4VF is not set
+# CONFIG_ENIC is not set
CONFIG_IXGBE=m
+CONFIG_IXGBE_DCA=y
+# CONFIG_IXGBEVF is not set
CONFIG_IXGB=m
-# CONFIG_IXGB_NAPI is not set
CONFIG_S2IO=m
-# CONFIG_S2IO_NAPI is not set
+# CONFIG_VXGE is not set
CONFIG_MYRI10GE=m
+CONFIG_MYRI10GE_DCA=y
CONFIG_NETXEN_NIC=m
CONFIG_NIU=m
+# CONFIG_MLX4_EN is not set
CONFIG_MLX4_CORE=m
# CONFIG_MLX4_DEBUG is not set
CONFIG_TEHUTI=m
+# CONFIG_BNX2X is not set
+# CONFIG_QLCNIC is not set
+# CONFIG_QLGE is not set
+# CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
CONFIG_TR=y
CONFIG_IBMOL=m
CONFIG_3C359=m
CONFIG_TMS380TR=m
CONFIG_TMSPCI=m
CONFIG_ABYSS=m
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-CONFIG_WLAN_80211=y
+CONFIG_WLAN=y
CONFIG_PCMCIA_RAYCS=m
-CONFIG_IPW2100=m
-CONFIG_IPW2100_MONITOR=y
-# CONFIG_IPW2100_DEBUG is not set
-CONFIG_IPW2200=m
-CONFIG_IPW2200_MONITOR=y
-CONFIG_IPW2200_RADIOTAP=y
-CONFIG_IPW2200_PROMISCUOUS=y
-CONFIG_IPW2200_QOS=y
-# CONFIG_IPW2200_DEBUG is not set
-CONFIG_LIBERTAS=m
-CONFIG_LIBERTAS_USB=m
-CONFIG_LIBERTAS_CS=m
-CONFIG_LIBERTAS_SDIO=m
-# CONFIG_LIBERTAS_DEBUG is not set
+# CONFIG_LIBERTAS_THINFIRM is not set
CONFIG_AIRO=m
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_NORTEL_HERMES=m
-CONFIG_PCI_HERMES=m
-CONFIG_PCMCIA_HERMES=m
-CONFIG_PCMCIA_SPECTRUM=m
CONFIG_ATMEL=m
CONFIG_PCI_ATMEL=m
CONFIG_PCMCIA_ATMEL=m
+# CONFIG_AT76C50X_USB is not set
CONFIG_AIRO_CS=m
CONFIG_PCMCIA_WL3501=m
CONFIG_PRISM54=m
CONFIG_USB_ZD1201=m
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_RTL8180 is not set
CONFIG_RTL8187=m
+CONFIG_RTL8187_LEDS=y
CONFIG_ADM8211=m
-CONFIG_P54_COMMON=m
-CONFIG_P54_USB=m
-CONFIG_P54_PCI=m
-CONFIG_IWLWIFI=y
-# CONFIG_IWLWIFI_DEBUG is not set
-CONFIG_IWLWIFI_SENSITIVITY=y
-CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
-CONFIG_IWLWIFI_QOS=y
-CONFIG_IWL4965=m
-CONFIG_IWL3945=m
-CONFIG_HOSTAP=m
-CONFIG_HOSTAP_FIRMWARE=y
-CONFIG_HOSTAP_FIRMWARE_NVRAM=y
-CONFIG_HOSTAP_PLX=m
-CONFIG_HOSTAP_PCI=m
-CONFIG_HOSTAP_CS=m
-CONFIG_BCM43XX=m
-CONFIG_BCM43XX_DEBUG=y
-CONFIG_BCM43XX_DMA=y
-CONFIG_BCM43XX_PIO=y
-CONFIG_BCM43XX_DMA_AND_PIO_MODE=y
-# CONFIG_BCM43XX_DMA_MODE is not set
-# CONFIG_BCM43XX_PIO_MODE is not set
+# CONFIG_MAC80211_HWSIM is not set
+# CONFIG_MWL8K is not set
+# CONFIG_ATH_COMMON is not set
CONFIG_B43=m
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
CONFIG_B43_PCMCIA=y
+# CONFIG_B43_SDIO is not set
+CONFIG_B43_PIO=y
+CONFIG_B43_PHY_LP=y
CONFIG_B43_LEDS=y
-CONFIG_B43_RFKILL=y
+CONFIG_B43_HWRNG=y
# CONFIG_B43_DEBUG is not set
-CONFIG_B43_DMA=y
-CONFIG_B43_PIO=y
-CONFIG_B43_DMA_AND_PIO_MODE=y
-# CONFIG_B43_DMA_MODE is not set
-# CONFIG_B43_PIO_MODE is not set
CONFIG_B43LEGACY=m
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
+CONFIG_B43LEGACY_LEDS=y
+CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y
# CONFIG_B43LEGACY_DMA_MODE is not set
# CONFIG_B43LEGACY_PIO_MODE is not set
-CONFIG_ZD1211RW=m
-# CONFIG_ZD1211RW_DEBUG is not set
+CONFIG_HOSTAP=m
+CONFIG_HOSTAP_FIRMWARE=y
+CONFIG_HOSTAP_FIRMWARE_NVRAM=y
+CONFIG_HOSTAP_PLX=m
+CONFIG_HOSTAP_PCI=m
+CONFIG_HOSTAP_CS=m
+CONFIG_IPW2100=m
+CONFIG_IPW2100_MONITOR=y
+# CONFIG_IPW2100_DEBUG is not set
+CONFIG_IPW2200=m
+CONFIG_IPW2200_MONITOR=y
+CONFIG_IPW2200_RADIOTAP=y
+CONFIG_IPW2200_PROMISCUOUS=y
+CONFIG_IPW2200_QOS=y
+# CONFIG_IPW2200_DEBUG is not set
+CONFIG_LIBIPW=m
+# CONFIG_LIBIPW_DEBUG is not set
+CONFIG_IWLWIFI=m
+# CONFIG_IWLWIFI_DEBUG is not set
+# CONFIG_IWLAGN is not set
+CONFIG_IWL3945=m
+# CONFIG_IWM is not set
+CONFIG_LIBERTAS=m
+CONFIG_LIBERTAS_USB=m
+CONFIG_LIBERTAS_CS=m
+CONFIG_LIBERTAS_SDIO=m
+# CONFIG_LIBERTAS_DEBUG is not set
+# CONFIG_LIBERTAS_MESH is not set
+CONFIG_HERMES=m
+# CONFIG_HERMES_PRISM is not set
+CONFIG_HERMES_CACHE_FW_ON_INIT=y
+CONFIG_PLX_HERMES=m
+CONFIG_TMD_HERMES=m
+CONFIG_NORTEL_HERMES=m
+CONFIG_PCMCIA_HERMES=m
+CONFIG_PCMCIA_SPECTRUM=m
+# CONFIG_ORINOCO_USB is not set
+CONFIG_P54_COMMON=m
+CONFIG_P54_USB=m
+CONFIG_P54_PCI=m
+CONFIG_P54_LEDS=y
CONFIG_RT2X00=m
-CONFIG_RT2X00_LIB=m
-CONFIG_RT2X00_LIB_PCI=m
-CONFIG_RT2X00_LIB_USB=m
-CONFIG_RT2X00_LIB_FIRMWARE=y
-CONFIG_RT2X00_LIB_RFKILL=y
CONFIG_RT2400PCI=m
-CONFIG_RT2400PCI_RFKILL=y
CONFIG_RT2500PCI=m
-CONFIG_RT2500PCI_RFKILL=y
CONFIG_RT61PCI=m
-CONFIG_RT61PCI_RFKILL=y
+CONFIG_RT2800PCI_PCI=y
+# CONFIG_RT2800PCI is not set
CONFIG_RT2500USB=m
CONFIG_RT73USB=m
+# CONFIG_RT2800USB is not set
+CONFIG_RT2X00_LIB_PCI=m
+CONFIG_RT2X00_LIB_USB=m
+CONFIG_RT2X00_LIB=m
+CONFIG_RT2X00_LIB_FIRMWARE=y
+CONFIG_RT2X00_LIB_CRYPTO=y
+CONFIG_RT2X00_LIB_LEDS=y
# CONFIG_RT2X00_DEBUG is not set
+# CONFIG_WL12XX is not set
+CONFIG_ZD1211RW=m
+# CONFIG_ZD1211RW_DEBUG is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
#
# USB Network Adapters
@@ -1439,7 +1729,10 @@ CONFIG_USB_RTL8150=m
CONFIG_USB_USBNET=m
CONFIG_USB_NET_AX8817X=m
CONFIG_USB_NET_CDCETHER=m
+# CONFIG_USB_NET_CDC_EEM is not set
CONFIG_USB_NET_DM9601=m
+# CONFIG_USB_NET_SMSC75XX is not set
+# CONFIG_USB_NET_SMSC95XX is not set
# CONFIG_USB_NET_GL620A is not set
CONFIG_USB_NET_NET1080=m
# CONFIG_USB_NET_PLUSB is not set
@@ -1447,6 +1740,10 @@ CONFIG_USB_NET_MCS7830=m
# CONFIG_USB_NET_RNDIS_HOST is not set
# CONFIG_USB_NET_CDC_SUBSET is not set
CONFIG_USB_NET_ZAURUS=m
+# CONFIG_USB_HSO is not set
+# CONFIG_USB_NET_INT51X1 is not set
+# CONFIG_USB_IPHETH is not set
+# CONFIG_USB_SIERRA_NET is not set
CONFIG_NET_PCMCIA=y
CONFIG_PCMCIA_3C589=m
CONFIG_PCMCIA_3C574=m
@@ -1456,6 +1753,7 @@ CONFIG_PCMCIA_NMCLAN=m
CONFIG_PCMCIA_SMC91C92=m
CONFIG_PCMCIA_XIRC2PS=m
CONFIG_PCMCIA_AXNET=m
+# CONFIG_PCMCIA_IBMTR is not set
CONFIG_WAN=y
CONFIG_LANMEDIA=m
CONFIG_HDLC=m
@@ -1470,16 +1768,6 @@ CONFIG_HDLC_PPP=m
#
CONFIG_PCI200SYN=m
CONFIG_WANXL=m
-CONFIG_PC300=m
-CONFIG_PC300_MLPPP=y
-
-#
-# Cyclades-PC300 MLPPP support is disabled.
-#
-
-#
-# Refer to the file README.mlppp, provided by PC300 package.
-#
CONFIG_PC300TOO=m
CONFIG_FARSYNC=m
CONFIG_DSCC4=m
@@ -1496,11 +1784,18 @@ CONFIG_ATM_DRIVERS=y
# CONFIG_ATM_ENI is not set
# CONFIG_ATM_FIRESTREAM is not set
# CONFIG_ATM_ZATM is not set
+# CONFIG_ATM_NICSTAR is not set
# CONFIG_ATM_IDT77252 is not set
# CONFIG_ATM_AMBASSADOR is not set
# CONFIG_ATM_HORIZON is not set
-# CONFIG_ATM_FORE200E_MAYBE is not set
+# CONFIG_ATM_IA is not set
+# CONFIG_ATM_FORE200E is not set
# CONFIG_ATM_HE is not set
+# CONFIG_ATM_SOLOS is not set
+
+#
+# CAIF transport drivers
+#
CONFIG_FDDI=y
CONFIG_DEFXX=m
CONFIG_DEFXX_MMIO=y
@@ -1519,44 +1814,17 @@ CONFIG_PPP_BSDCOMP=m
CONFIG_PPP_MPPE=m
CONFIG_PPPOE=m
CONFIG_PPPOATM=m
-CONFIG_PPPOL2TP=m
CONFIG_SLIP=m
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=m
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_NET_FC=y
-# CONFIG_SHAPER is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
-CONFIG_ISDN=m
-# CONFIG_ISDN_I4L is not set
-CONFIG_ISDN_CAPI=m
-# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set
-CONFIG_CAPI_TRACE=y
-CONFIG_ISDN_CAPI_MIDDLEWARE=y
-CONFIG_ISDN_CAPI_CAPI20=m
-CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
-CONFIG_ISDN_CAPI_CAPIFS=m
-
-#
-# CAPI hardware drivers
-#
-CONFIG_CAPI_AVM=y
-CONFIG_ISDN_DRV_AVMB1_B1PCI=m
-CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y
-CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
-CONFIG_ISDN_DRV_AVMB1_AVM_CS=m
-CONFIG_ISDN_DRV_AVMB1_T1PCI=m
-CONFIG_ISDN_DRV_AVMB1_C4=m
-CONFIG_CAPI_EICON=y
-CONFIG_ISDN_DIVAS=m
-CONFIG_ISDN_DIVAS_BRIPCI=y
-CONFIG_ISDN_DIVAS_PRIPCI=y
-CONFIG_ISDN_DIVAS_DIVACAPI=m
-CONFIG_ISDN_DIVAS_USERIDI=m
-CONFIG_ISDN_DIVAS_MAINT=m
+# CONFIG_VMXNET3 is not set
+# CONFIG_ISDN is not set
# CONFIG_PHONE is not set
#
@@ -1565,6 +1833,7 @@ CONFIG_ISDN_DIVAS_MAINT=m
CONFIG_INPUT=y
CONFIG_INPUT_FF_MEMLESS=m
CONFIG_INPUT_POLLDEV=m
+CONFIG_INPUT_SPARSEKMAP=m
#
# Userland interfaces
@@ -1581,12 +1850,19 @@ CONFIG_INPUT_EVDEV=y
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
CONFIG_KEYBOARD_ATKBD=y
-CONFIG_KEYBOARD_SUNKBD=m
+# CONFIG_KEYBOARD_QT2160 is not set
CONFIG_KEYBOARD_LKKBD=m
-CONFIG_KEYBOARD_XTKBD=m
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
CONFIG_KEYBOARD_NEWTON=m
+# CONFIG_KEYBOARD_OPENCORES is not set
CONFIG_KEYBOARD_STOWAWAY=m
+CONFIG_KEYBOARD_SUNKBD=m
+CONFIG_KEYBOARD_XTKBD=m
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
@@ -1594,10 +1870,14 @@ CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_LIFEBOOK=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
CONFIG_MOUSE_PS2_TOUCHKIT=y
CONFIG_MOUSE_SERIAL=m
CONFIG_MOUSE_APPLETOUCH=m
+# CONFIG_MOUSE_BCM5974 is not set
# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_ANALOG=m
CONFIG_JOYSTICK_A3D=m
@@ -1619,6 +1899,7 @@ CONFIG_JOYSTICK_SPACEORB=m
CONFIG_JOYSTICK_SPACEBALL=m
CONFIG_JOYSTICK_STINGER=m
CONFIG_JOYSTICK_TWIDJOY=m
+# CONFIG_JOYSTICK_ZHENHUA is not set
CONFIG_JOYSTICK_DB9=m
CONFIG_JOYSTICK_GAMECON=m
CONFIG_JOYSTICK_TURBOGRAFX=m
@@ -1626,6 +1907,7 @@ CONFIG_JOYSTICK_JOYDUMP=m
CONFIG_JOYSTICK_XPAD=m
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
+# CONFIG_JOYSTICK_WALKERA0701 is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=m
CONFIG_TABLET_USB_AIPTEK=m
@@ -1633,15 +1915,23 @@ CONFIG_TABLET_USB_GTCO=m
CONFIG_TABLET_USB_KBTAB=m
CONFIG_TABLET_USB_WACOM=m
CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
CONFIG_TOUCHSCREEN_FUJITSU=m
CONFIG_TOUCHSCREEN_GUNZE=m
CONFIG_TOUCHSCREEN_ELO=m
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
CONFIG_TOUCHSCREEN_MTOUCH=m
+# CONFIG_TOUCHSCREEN_INEXIO is not set
CONFIG_TOUCHSCREEN_MK712=m
CONFIG_TOUCHSCREEN_PENMOUNT=m
+# CONFIG_TOUCHSCREEN_QT602240 is not set
CONFIG_TOUCHSCREEN_TOUCHRIGHT=m
CONFIG_TOUCHSCREEN_TOUCHWIN=m
-CONFIG_TOUCHSCREEN_UCB1400=m
+# CONFIG_TOUCHSCREEN_WM97XX is not set
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m
CONFIG_TOUCHSCREEN_USB_EGALAX=y
CONFIG_TOUCHSCREEN_USB_PANJIT=y
@@ -1654,15 +1944,29 @@ CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
+CONFIG_TOUCHSCREEN_USB_JASTEC=y
+CONFIG_TOUCHSCREEN_USB_E2I=y
+CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y
+CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y
+CONFIG_TOUCHSCREEN_USB_NEXIO=y
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
CONFIG_INPUT_PCSPKR=m
+# CONFIG_INPUT_APANEL is not set
CONFIG_INPUT_ATLAS_BTNS=m
CONFIG_INPUT_ATI_REMOTE=m
CONFIG_INPUT_ATI_REMOTE2=m
CONFIG_INPUT_KEYSPAN_REMOTE=m
CONFIG_INPUT_POWERMATE=m
CONFIG_INPUT_YEALINK=m
+# CONFIG_INPUT_CM109 is not set
# CONFIG_INPUT_UINPUT is not set
+# CONFIG_INPUT_WINBOND_CIR is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_ADXL34X is not set
#
# Hardware I/O ports
@@ -1675,6 +1979,7 @@ CONFIG_SERIO_PARKBD=m
CONFIG_SERIO_PCIPS2=m
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
CONFIG_GAMEPORT=m
CONFIG_GAMEPORT_NS558=m
CONFIG_GAMEPORT_L4=m
@@ -1685,10 +1990,14 @@ CONFIG_GAMEPORT_FM801=m
# Character devices
#
CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_NOZOMI is not set
#
# Serial drivers
@@ -1710,20 +2019,25 @@ CONFIG_SERIAL_8250_RSA=y
#
# Non-8250 serial port support
#
+# CONFIG_SERIAL_MFD_HSU is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
# CONFIG_LEGACY_PTYS is not set
# CONFIG_PRINTER is not set
CONFIG_PPDEV=m
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_INTEL=y
CONFIG_HW_RANDOM_AMD=y
+CONFIG_HW_RANDOM_VIA=y
CONFIG_NVRAM=m
-CONFIG_RTC=m
-# CONFIG_GEN_RTC is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
@@ -1733,27 +2047,30 @@ CONFIG_RTC=m
# CONFIG_SYNCLINK_CS is not set
# CONFIG_CARDMAN_4000 is not set
# CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
CONFIG_MWAVE=m
-# CONFIG_PC8736x_GPIO is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_HPET is not set
# CONFIG_HANGCHECK_TIMER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set
CONFIG_DEVPORT=y
+# CONFIG_RAMOOPS is not set
CONFIG_I2C=m
CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=m
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_SMBUS=m
+CONFIG_I2C_ALGOBIT=m
#
-# I2C Algorithms
+# I2C Hardware Bus support
#
-CONFIG_I2C_ALGOBIT=m
-CONFIG_I2C_ALGOPCF=m
-CONFIG_I2C_ALGOPCA=m
#
-# I2C Hardware Bus support
+# PC SMBus host controller drivers
#
CONFIG_I2C_ALI1535=m
CONFIG_I2C_ALI1563=m
@@ -1762,56 +2079,71 @@ CONFIG_I2C_AMD756=m
CONFIG_I2C_AMD756_S4882=m
CONFIG_I2C_AMD8111=m
CONFIG_I2C_I801=m
-CONFIG_I2C_I810=m
+# CONFIG_I2C_ISCH is not set
CONFIG_I2C_PIIX4=m
CONFIG_I2C_NFORCE2=m
-CONFIG_I2C_OCORES=m
-CONFIG_I2C_PARPORT=m
-# CONFIG_I2C_PARPORT_LIGHT is not set
-CONFIG_I2C_PROSAVAGE=m
-CONFIG_I2C_SAVAGE4=m
-CONFIG_I2C_SIMTEC=m
+# CONFIG_I2C_NFORCE2_S4985 is not set
CONFIG_I2C_SIS5595=m
CONFIG_I2C_SIS630=m
CONFIG_I2C_SIS96X=m
-CONFIG_I2C_TAOS_EVM=m
-# CONFIG_I2C_STUB is not set
-CONFIG_I2C_TINY_USB=m
CONFIG_I2C_VIA=m
CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_VOODOO3=m
#
-# Miscellaneous I2C Chip support
+# ACPI drivers
#
-CONFIG_SENSORS_DS1337=m
-CONFIG_SENSORS_DS1374=m
-CONFIG_DS1682=m
-CONFIG_SENSORS_EEPROM=m
-CONFIG_SENSORS_PCF8574=m
-CONFIG_SENSORS_PCA9539=m
-CONFIG_SENSORS_PCF8591=m
-CONFIG_SENSORS_MAX6875=m
-CONFIG_SENSORS_TSL2550=m
+# CONFIG_I2C_SCMI is not set
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_OCORES=m
+# CONFIG_I2C_PCA_PLATFORM is not set
+CONFIG_I2C_SIMTEC=m
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+CONFIG_I2C_PARPORT=m
+# CONFIG_I2C_PARPORT_LIGHT is not set
+CONFIG_I2C_TAOS_EVM=m
+CONFIG_I2C_TINY_USB=m
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
+# CONFIG_SPI is not set
#
-# SPI support
+# PPS support
#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
# CONFIG_BATTERY_DS2760 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
CONFIG_HWMON=y
CONFIG_HWMON_VID=m
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
CONFIG_SENSORS_ABITUGURU=m
CONFIG_SENSORS_ABITUGURU3=m
+# CONFIG_SENSORS_AD7414 is not set
CONFIG_SENSORS_AD7418=m
CONFIG_SENSORS_ADM1021=m
CONFIG_SENSORS_ADM1025=m
@@ -1819,8 +2151,13 @@ CONFIG_SENSORS_ADM1026=m
CONFIG_SENSORS_ADM1029=m
CONFIG_SENSORS_ADM1031=m
CONFIG_SENSORS_ADM9240=m
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
CONFIG_SENSORS_ADT7470=m
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
CONFIG_SENSORS_K8TEMP=m
+# CONFIG_SENSORS_K10TEMP is not set
CONFIG_SENSORS_ASB100=m
CONFIG_SENSORS_ATXP1=m
CONFIG_SENSORS_DS1621=m
@@ -1828,14 +2165,16 @@ CONFIG_SENSORS_I5K_AMB=m
CONFIG_SENSORS_F71805F=m
CONFIG_SENSORS_F71882FG=m
CONFIG_SENSORS_F75375S=m
-CONFIG_SENSORS_FSCHER=m
-CONFIG_SENSORS_FSCPOS=m
CONFIG_SENSORS_FSCHMD=m
+# CONFIG_SENSORS_G760A is not set
CONFIG_SENSORS_GL518SM=m
CONFIG_SENSORS_GL520SM=m
CONFIG_SENSORS_CORETEMP=m
+# CONFIG_SENSORS_PKGTEMP is not set
CONFIG_SENSORS_IT87=m
+# CONFIG_SENSORS_JC42 is not set
CONFIG_SENSORS_LM63=m
+# CONFIG_SENSORS_LM73 is not set
CONFIG_SENSORS_LM75=m
CONFIG_SENSORS_LM77=m
CONFIG_SENSORS_LM78=m
@@ -1846,16 +2185,29 @@ CONFIG_SENSORS_LM87=m
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_LM92=m
CONFIG_SENSORS_LM93=m
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LM95241 is not set
CONFIG_SENSORS_MAX1619=m
CONFIG_SENSORS_MAX6650=m
CONFIG_SENSORS_PC87360=m
CONFIG_SENSORS_PC87427=m
+CONFIG_SENSORS_PCF8591=m
CONFIG_SENSORS_SIS5595=m
+# CONFIG_SENSORS_SMM665 is not set
CONFIG_SENSORS_DME1737=m
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
CONFIG_SENSORS_SMSC47M1=m
CONFIG_SENSORS_SMSC47M192=m
CONFIG_SENSORS_SMSC47B397=m
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_AMC6821 is not set
CONFIG_SENSORS_THMC50=m
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VIA_CPUTEMP is not set
CONFIG_SENSORS_VIA686A=m
CONFIG_SENSORS_VT1211=m
CONFIG_SENSORS_VT8231=m
@@ -1864,255 +2216,54 @@ CONFIG_SENSORS_W83791D=m
CONFIG_SENSORS_W83792D=m
CONFIG_SENSORS_W83793=m
CONFIG_SENSORS_W83L785TS=m
+# CONFIG_SENSORS_W83L786NG is not set
CONFIG_SENSORS_W83627HF=m
CONFIG_SENSORS_W83627EHF=m
CONFIG_SENSORS_HDAPS=m
+# CONFIG_SENSORS_LIS3_I2C is not set
CONFIG_SENSORS_APPLESMC=m
-# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# ACPI drivers
+#
+# CONFIG_SENSORS_ATK0110 is not set
+# CONFIG_SENSORS_LIS3LV02D is not set
+CONFIG_THERMAL=m
+# CONFIG_THERMAL_HWMON is not set
# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
#
# Sonics Silicon Backplane
#
-CONFIG_SSB_POSSIBLE=y
CONFIG_SSB=m
+CONFIG_SSB_SPROM=y
+CONFIG_SSB_BLOCKIO=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
+CONFIG_SSB_B43_PCI_BRIDGE=y
CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
CONFIG_SSB_PCMCIAHOST=y
+CONFIG_SSB_SDIOHOST_POSSIBLE=y
+# CONFIG_SSB_SDIOHOST is not set
# CONFIG_SSB_SILENT is not set
# CONFIG_SSB_DEBUG is not set
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y
-
-#
-# Multifunction device drivers
-#
+CONFIG_MFD_SUPPORT=y
+# CONFIG_MFD_CORE is not set
CONFIG_MFD_SM501=m
-
-#
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-CONFIG_VIDEO_V4L1=y
-CONFIG_VIDEO_V4L1_COMPAT=y
-CONFIG_VIDEO_V4L2=y
-CONFIG_VIDEO_CAPTURE_DRIVERS=y
-# CONFIG_VIDEO_ADV_DEBUG is not set
-CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
-CONFIG_VIDEO_TVAUDIO=m
-CONFIG_VIDEO_MSP3400=m
-CONFIG_VIDEO_CS53L32A=m
-CONFIG_VIDEO_WM8775=m
-CONFIG_VIDEO_WM8739=m
-CONFIG_VIDEO_VP27SMPX=m
-CONFIG_VIDEO_OV7670=m
-CONFIG_VIDEO_SAA711X=m
-CONFIG_VIDEO_CX25840=m
-CONFIG_VIDEO_CX2341X=m
-CONFIG_VIDEO_SAA7127=m
-CONFIG_VIDEO_UPD64031A=m
-CONFIG_VIDEO_UPD64083=m
-# CONFIG_VIDEO_VIVI is not set
-# CONFIG_VIDEO_BT848 is not set
-# CONFIG_VIDEO_BWQCAM is not set
-# CONFIG_VIDEO_CQCAM is not set
-# CONFIG_VIDEO_W9966 is not set
-# CONFIG_VIDEO_CPIA is not set
-# CONFIG_VIDEO_CPIA2 is not set
-# CONFIG_VIDEO_SAA5246A is not set
-# CONFIG_VIDEO_SAA5249 is not set
-# CONFIG_TUNER_3036 is not set
-# CONFIG_VIDEO_STRADIS is not set
-# CONFIG_VIDEO_ZORAN is not set
-CONFIG_VIDEO_MEYE=m
-# CONFIG_VIDEO_SAA7134 is not set
-# CONFIG_VIDEO_MXB is not set
-# CONFIG_VIDEO_DPC is not set
-# CONFIG_VIDEO_HEXIUM_ORION is not set
-# CONFIG_VIDEO_HEXIUM_GEMINI is not set
-# CONFIG_VIDEO_CX88 is not set
-CONFIG_VIDEO_CX23885=m
-CONFIG_VIDEO_IVTV=m
-CONFIG_VIDEO_FB_IVTV=m
-CONFIG_VIDEO_CAFE_CCIC=m
-CONFIG_V4L_USB_DRIVERS=y
-# CONFIG_VIDEO_PVRUSB2 is not set
-# CONFIG_VIDEO_EM28XX is not set
-CONFIG_VIDEO_USBVISION=m
-CONFIG_VIDEO_USBVIDEO=m
-# CONFIG_USB_VICAM is not set
-# CONFIG_USB_IBMCAM is not set
-# CONFIG_USB_KONICAWC is not set
-CONFIG_USB_QUICKCAM_MESSENGER=m
-# CONFIG_USB_ET61X251 is not set
-# CONFIG_VIDEO_OVCAMCHIP is not set
-# CONFIG_USB_W9968CF is not set
-# CONFIG_USB_OV511 is not set
-# CONFIG_USB_SE401 is not set
-# CONFIG_USB_SN9C102 is not set
-# CONFIG_USB_STV680 is not set
-# CONFIG_USB_ZC0301 is not set
-# CONFIG_USB_PWC is not set
-CONFIG_USB_ZR364XX=m
-CONFIG_RADIO_ADAPTERS=y
-# CONFIG_RADIO_GEMTEK_PCI is not set
-# CONFIG_RADIO_MAXIRADIO is not set
-# CONFIG_RADIO_MAESTRO is not set
-# CONFIG_USB_DSBR is not set
-CONFIG_DVB_CORE=m
-CONFIG_DVB_CORE_ATTACH=y
-CONFIG_DVB_CAPTURE_DRIVERS=y
-
-#
-# Supported SAA7146 based PCI Adapters
-#
-CONFIG_DVB_AV7110=m
-CONFIG_DVB_AV7110_OSD=y
-CONFIG_DVB_BUDGET=m
-CONFIG_DVB_BUDGET_CI=m
-CONFIG_DVB_BUDGET_AV=m
-CONFIG_DVB_BUDGET_PATCH=m
-
-#
-# Supported USB Adapters
-#
-CONFIG_DVB_USB=m
-# CONFIG_DVB_USB_DEBUG is not set
-CONFIG_DVB_USB_A800=m
-CONFIG_DVB_USB_DIBUSB_MB=m
-CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y
-CONFIG_DVB_USB_DIBUSB_MC=m
-CONFIG_DVB_USB_DIB0700=m
-CONFIG_DVB_USB_UMT_010=m
-CONFIG_DVB_USB_CXUSB=m
-CONFIG_DVB_USB_M920X=m
-CONFIG_DVB_USB_GL861=m
-CONFIG_DVB_USB_AU6610=m
-CONFIG_DVB_USB_DIGITV=m
-CONFIG_DVB_USB_VP7045=m
-CONFIG_DVB_USB_VP702X=m
-CONFIG_DVB_USB_GP8PSK=m
-CONFIG_DVB_USB_NOVA_T_USB2=m
-CONFIG_DVB_USB_TTUSB2=m
-CONFIG_DVB_USB_DTT200U=m
-CONFIG_DVB_USB_OPERA1=m
-CONFIG_DVB_USB_AF9005=m
-CONFIG_DVB_USB_AF9005_REMOTE=m
-CONFIG_DVB_TTUSB_BUDGET=m
-CONFIG_DVB_TTUSB_DEC=m
-CONFIG_DVB_CINERGYT2=m
-# CONFIG_DVB_CINERGYT2_TUNING is not set
-
-#
-# Supported FlexCopII (B2C2) Adapters
-#
-CONFIG_DVB_B2C2_FLEXCOP=m
-CONFIG_DVB_B2C2_FLEXCOP_PCI=m
-CONFIG_DVB_B2C2_FLEXCOP_USB=m
-# CONFIG_DVB_B2C2_FLEXCOP_DEBUG is not set
-
-#
-# Supported BT878 Adapters
-#
-
-#
-# Supported Pluto2 Adapters
-#
-CONFIG_DVB_PLUTO2=m
-
-#
-# Supported DVB Frontends
-#
-
-#
-# Customise DVB Frontends
-#
-# CONFIG_DVB_FE_CUSTOMISE is not set
-
-#
-# DVB-S (satellite) frontends
-#
-CONFIG_DVB_STV0299=m
-CONFIG_DVB_CX24110=m
-CONFIG_DVB_CX24123=m
-CONFIG_DVB_TDA8083=m
-CONFIG_DVB_MT312=m
-CONFIG_DVB_VES1X93=m
-CONFIG_DVB_S5H1420=m
-CONFIG_DVB_TDA10086=m
-
-#
-# DVB-T (terrestrial) frontends
-#
-CONFIG_DVB_SP8870=m
-CONFIG_DVB_SP887X=m
-CONFIG_DVB_CX22700=m
-CONFIG_DVB_CX22702=m
-CONFIG_DVB_L64781=m
-CONFIG_DVB_TDA1004X=m
-CONFIG_DVB_NXT6000=m
-CONFIG_DVB_MT352=m
-CONFIG_DVB_ZL10353=m
-CONFIG_DVB_DIB3000MB=m
-CONFIG_DVB_DIB3000MC=m
-CONFIG_DVB_DIB7000M=m
-CONFIG_DVB_DIB7000P=m
-
-#
-# DVB-C (cable) frontends
-#
-CONFIG_DVB_VES1820=m
-CONFIG_DVB_TDA10021=m
-CONFIG_DVB_TDA10023=m
-CONFIG_DVB_STV0297=m
-
-#
-# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
-#
-CONFIG_DVB_NXT200X=m
-CONFIG_DVB_OR51211=m
-CONFIG_DVB_OR51132=m
-CONFIG_DVB_BCM3510=m
-CONFIG_DVB_LGDT330X=m
-CONFIG_DVB_S5H1409=m
-
-#
-# Tuners/PLL support
-#
-CONFIG_DVB_PLL=m
-CONFIG_DVB_TDA826X=m
-CONFIG_DVB_TDA827X=m
-CONFIG_DVB_TUNER_QT1010=m
-CONFIG_DVB_TUNER_MT2060=m
-CONFIG_DVB_TUNER_MT2266=m
-CONFIG_DVB_TUNER_MT2131=m
-CONFIG_DVB_TUNER_DIB0070=m
-
-#
-# Miscellaneous devices
-#
-CONFIG_DVB_LNBP21=m
-CONFIG_DVB_ISL6421=m
-CONFIG_DVB_TUA6100=m
-CONFIG_VIDEO_SAA7146=m
-CONFIG_VIDEO_SAA7146_VV=m
-CONFIG_VIDEO_TUNER=m
-# CONFIG_VIDEO_TUNER_CUSTOMIZE is not set
-CONFIG_TUNER_MT20XX=m
-CONFIG_TUNER_TDA8290=m
-CONFIG_TUNER_TEA5761=m
-CONFIG_TUNER_TEA5767=m
-CONFIG_TUNER_SIMPLE=m
-CONFIG_VIDEOBUF_GEN=m
-CONFIG_VIDEOBUF_DMA_SG=m
-CONFIG_VIDEOBUF_DVB=m
-CONFIG_VIDEO_BTCX=m
-CONFIG_VIDEO_IR_I2C=m
-CONFIG_VIDEO_IR=m
-CONFIG_VIDEO_TVEEPROM=m
-CONFIG_DAB=y
-# CONFIG_USB_DABUSB is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_LPC_SCH is not set
+# CONFIG_MFD_RDC321X is not set
+# CONFIG_MFD_JANZ_CMODIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
#
# Graphics support
@@ -2122,13 +2273,20 @@ CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=m
CONFIG_AGP_SIS=m
CONFIG_AGP_VIA=m
+CONFIG_VGA_ARB=y
+CONFIG_VGA_ARB_MAX_GPUS=16
+# CONFIG_VGA_SWITCHEROO is not set
CONFIG_DRM=m
+CONFIG_DRM_KMS_HELPER=m
+CONFIG_DRM_TTM=m
CONFIG_DRM_TDFX=m
CONFIG_DRM_R128=m
CONFIG_DRM_RADEON=m
+# CONFIG_DRM_RADEON_KMS is not set
CONFIG_DRM_I810=m
CONFIG_DRM_I830=m
CONFIG_DRM_I915=m
+# CONFIG_DRM_I915_KMS is not set
CONFIG_DRM_MGA=m
CONFIG_DRM_SIS=m
CONFIG_DRM_VIA=m
@@ -2138,6 +2296,7 @@ CONFIG_VIDEO_OUTPUT_CONTROL=m
CONFIG_FB=y
CONFIG_FIRMWARE_EDID=y
# CONFIG_FB_DDC is not set
+CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
@@ -2145,8 +2304,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=m
CONFIG_FB_SYS_COPYAREA=m
CONFIG_FB_SYS_IMAGEBLIT=m
+# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYS_FOPS=m
-CONFIG_FB_DEFERRED_IO=y
# CONFIG_FB_SVGALIB is not set
# CONFIG_FB_MACMODES is not set
# CONFIG_FB_BACKLIGHT is not set
@@ -2164,8 +2323,7 @@ CONFIG_FB_DEFERRED_IO=y
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_VGA16 is not set
CONFIG_FB_VESA=y
-CONFIG_FB_EFI=y
-# CONFIG_FB_HECUBA is not set
+# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
@@ -2179,6 +2337,7 @@ CONFIG_FB_EFI=y
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
+# CONFIG_FB_VIA is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
@@ -2187,14 +2346,22 @@ CONFIG_FB_EFI=y
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
+# CONFIG_FB_CARMINE is not set
# CONFIG_FB_GEODE is not set
# CONFIG_FB_SM501 is not set
# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=m
+# CONFIG_LCD_PLATFORM is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=m
-# CONFIG_BACKLIGHT_CORGI is not set
+CONFIG_BACKLIGHT_GENERIC=m
CONFIG_BACKLIGHT_PROGEAR=m
+# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
+# CONFIG_BACKLIGHT_SAHARA is not set
+# CONFIG_BACKLIGHT_ADP8860 is not set
#
# Display device support
@@ -2210,7 +2377,6 @@ CONFIG_DISPLAY_SUPPORT=m
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
-CONFIG_VIDEO_SELECT=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
@@ -2220,20 +2386,15 @@ CONFIG_FB_CON_DECOR=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
# CONFIG_LOGO is not set
-
-#
-# Sound
-#
CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
+CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=m
# CONFIG_SND_SEQ_DUMMY is not set
CONFIG_SND_OSSEMUL=y
@@ -2241,21 +2402,25 @@ CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
-CONFIG_SND_RTCTIMER=m
-CONFIG_SND_SEQ_RTCTIMER_DEFAULT=y
-# CONFIG_SND_DYNAMIC_MINORS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
# CONFIG_SND_VERBOSE_PROCFS is not set
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
+CONFIG_SND_VMASTER=y
+CONFIG_SND_DMA_SGBUF=y
+CONFIG_SND_RAWMIDI_SEQ=m
+CONFIG_SND_OPL3_LIB_SEQ=m
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+CONFIG_SND_EMU10K1_SEQ=m
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_VX_LIB=m
CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_PCSP is not set
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_VIRMIDI is not set
# CONFIG_SND_MTPAV is not set
@@ -2263,30 +2428,33 @@ CONFIG_SND_MTS64=m
# CONFIG_SND_SERIAL_U16550 is not set
CONFIG_SND_MPU401=m
CONFIG_SND_PORTMAN2X4=m
+# CONFIG_SND_AC97_POWER_SAVE is not set
CONFIG_SND_SB_COMMON=m
CONFIG_SND_SB16_DSP=m
-
-#
-# PCI devices
-#
+CONFIG_SND_PCI=y
CONFIG_SND_AD1889=m
CONFIG_SND_ALS300=m
CONFIG_SND_ALS4000=m
CONFIG_SND_ALI5451=m
+# CONFIG_SND_ASIHPI is not set
CONFIG_SND_ATIIXP=m
CONFIG_SND_ATIIXP_MODEM=m
CONFIG_SND_AU8810=m
CONFIG_SND_AU8820=m
CONFIG_SND_AU8830=m
+# CONFIG_SND_AW2 is not set
CONFIG_SND_AZT3328=m
CONFIG_SND_BT87X=m
# CONFIG_SND_BT87X_OVERCLOCK is not set
CONFIG_SND_CA0106=m
CONFIG_SND_CMIPCI=m
+# CONFIG_SND_OXYGEN is not set
CONFIG_SND_CS4281=m
CONFIG_SND_CS46XX=m
CONFIG_SND_CS46XX_NEW_DSP=y
CONFIG_SND_CS5530=m
+# CONFIG_SND_CS5535AUDIO is not set
+# CONFIG_SND_CTXFI is not set
CONFIG_SND_DARLA20=m
CONFIG_SND_GINA20=m
CONFIG_SND_LAYLA20=m
@@ -2299,22 +2467,33 @@ CONFIG_SND_ECHO3G=m
CONFIG_SND_INDIGO=m
CONFIG_SND_INDIGOIO=m
CONFIG_SND_INDIGODJ=m
+# CONFIG_SND_INDIGOIOX is not set
+# CONFIG_SND_INDIGODJX is not set
CONFIG_SND_EMU10K1=m
CONFIG_SND_EMU10K1X=m
CONFIG_SND_ENS1370=m
CONFIG_SND_ENS1371=m
CONFIG_SND_ES1938=m
CONFIG_SND_ES1968=m
+# CONFIG_SND_ES1968_INPUT is not set
CONFIG_SND_FM801=m
-# CONFIG_SND_FM801_TEA575X_BOOL is not set
CONFIG_SND_HDA_INTEL=m
CONFIG_SND_HDA_HWDEP=y
+# CONFIG_SND_HDA_RECONFIG is not set
+# CONFIG_SND_HDA_INPUT_BEEP is not set
+# CONFIG_SND_HDA_INPUT_JACK is not set
+# CONFIG_SND_HDA_PATCH_LOADER is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_ATIHDMI=y
+CONFIG_SND_HDA_CODEC_NVHDMI=y
+CONFIG_SND_HDA_CODEC_INTELHDMI=y
+CONFIG_SND_HDA_ELD=y
+CONFIG_SND_HDA_CODEC_CIRRUS=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
+CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
@@ -2322,14 +2501,15 @@ CONFIG_SND_HDA_POWER_SAVE=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
CONFIG_SND_HDSP=m
CONFIG_SND_HDSPM=m
+# CONFIG_SND_HIFIER is not set
CONFIG_SND_ICE1712=m
CONFIG_SND_ICE1724=m
CONFIG_SND_INTEL8X0=m
CONFIG_SND_INTEL8X0M=m
CONFIG_SND_KORG1212=m
-# CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL is not set
+# CONFIG_SND_LX6464ES is not set
CONFIG_SND_MAESTRO3=m
-# CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL is not set
+# CONFIG_SND_MAESTRO3_INPUT is not set
CONFIG_SND_MIXART=m
CONFIG_SND_NM256=m
CONFIG_SND_PCXHR=m
@@ -2341,79 +2521,90 @@ CONFIG_SND_SONICVIBES=m
CONFIG_SND_TRIDENT=m
CONFIG_SND_VIA82XX=m
CONFIG_SND_VIA82XX_MODEM=m
+# CONFIG_SND_VIRTUOSO is not set
CONFIG_SND_VX222=m
CONFIG_SND_YMFPCI=m
-# CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL is not set
-# CONFIG_SND_AC97_POWER_SAVE is not set
-
-#
-# USB devices
-#
+CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
+# CONFIG_SND_USB_UA101 is not set
CONFIG_SND_USB_USX2Y=m
CONFIG_SND_USB_CAIAQ=m
CONFIG_SND_USB_CAIAQ_INPUT=y
-
-#
-# PCMCIA devices
-#
+# CONFIG_SND_USB_US122L is not set
+CONFIG_SND_PCMCIA=y
CONFIG_SND_VXPOCKET=m
CONFIG_SND_PDAUDIOCF=m
-
-#
-# System on Chip audio support
-#
CONFIG_SND_SOC=m
-
-#
-# SoC Audio support for SuperH
-#
-
-#
-# Open Sound System
-#
+CONFIG_SND_SOC_I2C_AND_SPI=m
+# CONFIG_SND_SOC_ALL_CODECS is not set
# CONFIG_SOUND_PRIME is not set
CONFIG_AC97_BUS=m
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
-# CONFIG_HID_DEBUG is not set
CONFIG_HIDRAW=y
#
# USB Input Devices
#
CONFIG_USB_HID=m
-CONFIG_USB_HIDINPUT_POWERBOOK=y
-# CONFIG_HID_FF is not set
+# CONFIG_HID_PID is not set
CONFIG_USB_HIDDEV=y
#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+
+#
# Special HID drivers
#
-CONFIG_HID_COMPAT=y
+# CONFIG_HID_3M_PCT is not set
CONFIG_HID_A4TECH=m
+# CONFIG_HID_ACRUX_FF is not set
CONFIG_HID_APPLE=m
CONFIG_HID_BELKIN=m
-CONFIG_HID_BRIGHT=m
+# CONFIG_HID_CANDO is not set
CONFIG_HID_CHERRY=m
CONFIG_HID_CHICONY=m
+# CONFIG_HID_PRODIKEYS is not set
CONFIG_HID_CYPRESS=m
-CONFIG_HID_DELL=m
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EGALAX is not set
+# CONFIG_HID_ELECOM is not set
CONFIG_HID_EZKEY=m
+# CONFIG_HID_KYE is not set
CONFIG_HID_GYRATION=m
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
CONFIG_HID_LOGITECH=m
# CONFIG_LOGITECH_FF is not set
# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_HID_MAGICMOUSE is not set
CONFIG_HID_MICROSOFT=m
+# CONFIG_HID_MOSART is not set
CONFIG_HID_MONTEREY=m
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
CONFIG_HID_PANTHERLORD=m
# CONFIG_PANTHERLORD_FF is not set
CONFIG_HID_PETALYNX=m
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_QUANTA is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_ROCCAT_KONE is not set
CONFIG_HID_SAMSUNG=m
CONFIG_HID_SONY=m
+# CONFIG_HID_STANTUM is not set
CONFIG_HID_SUNPLUS=m
-# CONFIG_THRUSTMASTER_FF is not set
-# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_ZEROPLUS is not set
+# CONFIG_HID_ZYDACRON is not set
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
@@ -2423,35 +2614,31 @@ CONFIG_USB=m
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
#
-# USB HID Boot Protocol drivers
-#
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE is not set
-CONFIG_USB_SUPPORT=y
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARCH_HAS_EHCI=y
-CONFIG_USB=m
-# CONFIG_USB_DEBUG is not set
-
-#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_SUSPEND is not set
-# CONFIG_USB_PERSIST is not set
+CONFIG_USB_SUSPEND=y
# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
#
# USB Host Controller Drivers
#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_USB_OXU210HP_HCD is not set
CONFIG_USB_ISP116X_HCD=m
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_SSB=y
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -2462,32 +2649,41 @@ CONFIG_USB_U132_HCD=m
CONFIG_USB_SL811_HCD=m
CONFIG_USB_SL811_CS=m
CONFIG_USB_R8A66597_HCD=m
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
+
+#
+# Enable Host or Gadget support to see Inventra options
+#
#
# USB Device Class drivers
#
CONFIG_USB_ACM=m
# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#
#
-# may also be needed; see USB_STORAGE Help for more information
+# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_DATAFAB=y
-CONFIG_USB_STORAGE_FREECOM=y
-CONFIG_USB_STORAGE_ISD200=y
-CONFIG_USB_STORAGE_DPCM=y
-CONFIG_USB_STORAGE_USBAT=y
-CONFIG_USB_STORAGE_SDDR09=y
-CONFIG_USB_STORAGE_SDDR55=y
-CONFIG_USB_STORAGE_JUMPSHOT=y
-CONFIG_USB_STORAGE_ALAUDA=y
-CONFIG_USB_STORAGE_KARMA=y
+CONFIG_USB_STORAGE_DATAFAB=m
+CONFIG_USB_STORAGE_FREECOM=m
+CONFIG_USB_STORAGE_ISD200=m
+CONFIG_USB_STORAGE_USBAT=m
+CONFIG_USB_STORAGE_SDDR09=m
+CONFIG_USB_STORAGE_SDDR55=m
+CONFIG_USB_STORAGE_JUMPSHOT=m
+CONFIG_USB_STORAGE_ALAUDA=m
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+CONFIG_USB_STORAGE_KARMA=m
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_LIBUSUAL is not set
#
@@ -2495,26 +2691,21 @@ CONFIG_USB_STORAGE_KARMA=y
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_MON is not set
#
# USB port drivers
#
CONFIG_USB_USS720=m
-
-#
-# USB Serial Converter support
-#
CONFIG_USB_SERIAL=m
+CONFIG_USB_EZUSB=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_AIRCABLE=m
-CONFIG_USB_SERIAL_AIRPRIME=m
CONFIG_USB_SERIAL_ARK3116=m
# CONFIG_USB_SERIAL_BELKIN is not set
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_WHITEHEAT=m
# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
-CONFIG_USB_SERIAL_CP2101=m
+# CONFIG_USB_SERIAL_CP210X is not set
# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
# CONFIG_USB_SERIAL_EMPEG is not set
# CONFIG_USB_SERIAL_FTDI_SIO is not set
@@ -2526,26 +2717,38 @@ CONFIG_USB_SERIAL_FUNSOFT=m
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
# CONFIG_USB_SERIAL_GARMIN is not set
CONFIG_USB_SERIAL_IPW=m
+# CONFIG_USB_SERIAL_IUU is not set
# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
# CONFIG_USB_SERIAL_KEYSPAN is not set
# CONFIG_USB_SERIAL_KLSI is not set
# CONFIG_USB_SERIAL_KOBIL_SCT is not set
# CONFIG_USB_SERIAL_MCT_U232 is not set
CONFIG_USB_SERIAL_MOS7720=m
+# CONFIG_USB_SERIAL_MOS7715_PARPORT is not set
CONFIG_USB_SERIAL_MOS7840=m
+# CONFIG_USB_SERIAL_MOTOROLA is not set
CONFIG_USB_SERIAL_NAVMAN=m
# CONFIG_USB_SERIAL_PL2303 is not set
CONFIG_USB_SERIAL_OTI6858=m
+# CONFIG_USB_SERIAL_QCAUX is not set
+# CONFIG_USB_SERIAL_QUALCOMM is not set
+# CONFIG_USB_SERIAL_SPCP8X5 is not set
# CONFIG_USB_SERIAL_HP4X is not set
# CONFIG_USB_SERIAL_SAFE is not set
+# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
+# CONFIG_USB_SERIAL_SYMBOL is not set
# CONFIG_USB_SERIAL_TI is not set
# CONFIG_USB_SERIAL_CYBERJACK is not set
# CONFIG_USB_SERIAL_XIRCOM is not set
+CONFIG_USB_SERIAL_WWAN=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_OMNINET=m
+# CONFIG_USB_SERIAL_OPTICON is not set
+# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set
+# CONFIG_USB_SERIAL_ZIO is not set
+# CONFIG_USB_SERIAL_SSU100 is not set
# CONFIG_USB_SERIAL_DEBUG is not set
-CONFIG_USB_EZUSB=y
#
# USB Miscellaneous drivers
@@ -2553,18 +2756,13 @@ CONFIG_USB_EZUSB=y
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
CONFIG_USB_ADUTUX=m
-CONFIG_USB_AUERSWALD=m
+# CONFIG_USB_SEVSEG is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_LEGOTOWER is not set
# CONFIG_USB_LCD is not set
-CONFIG_USB_BERRY_CHARGE=m
# CONFIG_USB_LED is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
# CONFIG_USB_CYTHERM is not set
-CONFIG_USB_PHIDGET=m
-CONFIG_USB_PHIDGETKIT=m
-CONFIG_USB_PHIDGETMOTORCONTROL=m
-CONFIG_USB_PHIDGETSERVO=m
# CONFIG_USB_IDMOUSE is not set
CONFIG_USB_FTDI_ELAN=m
CONFIG_USB_APPLEDISPLAY=m
@@ -2574,52 +2772,71 @@ CONFIG_USB_SISUSBVGA_CON=y
CONFIG_USB_TRANCEVIBRATOR=m
CONFIG_USB_IOWARRIOR=m
# CONFIG_USB_TEST is not set
-
-#
-# USB DSL modem support
-#
+# CONFIG_USB_ISIGHTFW is not set
CONFIG_USB_ATM=m
CONFIG_USB_SPEEDTOUCH=m
CONFIG_USB_CXACRU=m
CONFIG_USB_UEAGLEATM=m
CONFIG_USB_XUSBATM=m
+# CONFIG_USB_GADGET is not set
#
-# USB Gadget Support
+# OTG and related infrastructure
#
-# CONFIG_USB_GADGET is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
CONFIG_MMC=m
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_UNSAFE_RESUME is not set
#
-# MMC/SD Card Drivers
+# MMC/SD/SDIO Card Drivers
#
CONFIG_MMC_BLOCK=m
CONFIG_MMC_BLOCK_BOUNCE=y
CONFIG_SDIO_UART=m
+# CONFIG_MMC_TEST is not set
#
-# MMC/SD Host Controller Drivers
+# MMC/SD/SDIO Host Controller Drivers
#
CONFIG_MMC_SDHCI=m
-CONFIG_MMC_RICOH_MMC=m
+# CONFIG_MMC_SDHCI_PCI is not set
+# CONFIG_MMC_SDHCI_PLTFM is not set
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
+# CONFIG_MMC_SDRICOH_CS is not set
+# CONFIG_MMC_CB710 is not set
+# CONFIG_MMC_VIA_SDMMC is not set
+# CONFIG_MEMSTICK is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=m
#
# LED drivers
#
+# CONFIG_LEDS_ALIX2 is not set
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_CLEVO_MAIL is not set
+# CONFIG_LEDS_PCA955X is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_INTEL_SS4200 is not set
+CONFIG_LEDS_TRIGGERS=y
#
# LED Triggers
#
-CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_IDE_DISK=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
+
+#
+# iptables trigger is under Netfilter config (LED target)
+#
+# CONFIG_ACCESSIBILITY is not set
CONFIG_INFINIBAND=m
# CONFIG_INFINIBAND_USER_MAD is not set
# CONFIG_INFINIBAND_USER_ACCESS is not set
@@ -2627,11 +2844,13 @@ CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_MTHCA=m
# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
CONFIG_INFINIBAND_IPATH=m
+# CONFIG_INFINIBAND_QIB is not set
CONFIG_INFINIBAND_AMSO1100=m
# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set
CONFIG_INFINIBAND_CXGB3=m
# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
CONFIG_MLX4_INFINIBAND=m
+# CONFIG_INFINIBAND_NES is not set
CONFIG_INFINIBAND_IPOIB=m
CONFIG_INFINIBAND_IPOIB_CM=y
# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
@@ -2656,14 +2875,21 @@ CONFIG_RTC_INTF_DEV_UIE_EMUL=y
# CONFIG_RTC_DRV_DS1307 is not set
CONFIG_RTC_DRV_DS1374=m
# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
CONFIG_RTC_DRV_MAX6900=m
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
CONFIG_RTC_DRV_M41T80=m
CONFIG_RTC_DRV_M41T80_WDT=y
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
#
# SPI RTC drivers
@@ -2673,28 +2899,41 @@ CONFIG_RTC_DRV_M41T80_WDT=y
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=m
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
CONFIG_RTC_DRV_DS1553=m
-CONFIG_RTC_DRV_STK17TA8=m
CONFIG_RTC_DRV_DS1742=m
+CONFIG_RTC_DRV_STK17TA8=m
CONFIG_RTC_DRV_M48T86=m
+# CONFIG_RTC_DRV_M48T35 is not set
CONFIG_RTC_DRV_M48T59=m
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
CONFIG_RTC_DRV_V3020=m
#
# on-CPU RTC drivers
#
CONFIG_DMADEVICES=y
+# CONFIG_DMADEVICES_DEBUG is not set
#
# DMA Devices
#
+# CONFIG_INTEL_MID_DMAC is not set
+CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH=y
CONFIG_INTEL_IOATDMA=m
+# CONFIG_TIMB_DMA is not set
+# CONFIG_PCH_DMA is not set
CONFIG_DMA_ENGINE=y
#
# DMA Clients
#
CONFIG_NET_DMA=y
+# CONFIG_ASYNC_TX_DMA is not set
+# CONFIG_DMATEST is not set
CONFIG_DCA=m
CONFIG_AUXDISPLAY=y
CONFIG_KS0108=m
@@ -2702,24 +2941,52 @@ CONFIG_KS0108_PORT=0x378
CONFIG_KS0108_DELAY=2
CONFIG_CFAG12864B=m
CONFIG_CFAG12864B_RATE=20
-CONFIG_VIRTUALIZATION=y
-CONFIG_KVM=m
-CONFIG_KVM_INTEL=m
-CONFIG_KVM_AMD=m
-
-#
-# Userspace I/O
-#
CONFIG_UIO=m
CONFIG_UIO_CIF=m
+# CONFIG_UIO_PDRV is not set
+# CONFIG_UIO_PDRV_GENIRQ is not set
+# CONFIG_UIO_AEC is not set
+# CONFIG_UIO_SERCOS3 is not set
+# CONFIG_UIO_PCI_GENERIC is not set
+# CONFIG_UIO_NETX is not set
+# CONFIG_STAGING is not set
+CONFIG_X86_PLATFORM_DEVICES=y
+# CONFIG_ACER_WMI is not set
+CONFIG_ASUS_LAPTOP=m
+# CONFIG_DELL_LAPTOP is not set
+CONFIG_FUJITSU_LAPTOP=m
+# CONFIG_FUJITSU_LAPTOP_DEBUG is not set
+CONFIG_MSI_LAPTOP=m
+# CONFIG_PANASONIC_LAPTOP is not set
+# CONFIG_COMPAL_LAPTOP is not set
+CONFIG_SONY_LAPTOP=m
+CONFIG_SONYPI_COMPAT=y
+# CONFIG_IDEAPAD_ACPI is not set
+CONFIG_THINKPAD_ACPI=m
+CONFIG_THINKPAD_ACPI_ALSA_SUPPORT=y
+# CONFIG_THINKPAD_ACPI_DEBUGFACILITIES is not set
+# CONFIG_THINKPAD_ACPI_DEBUG is not set
+# CONFIG_THINKPAD_ACPI_UNSAFE_LEDS is not set
+CONFIG_THINKPAD_ACPI_VIDEO=y
+CONFIG_THINKPAD_ACPI_HOTKEY_POLL=y
+# CONFIG_INTEL_MENLOW is not set
+# CONFIG_ACPI_WMI is not set
+CONFIG_ACPI_ASUS=m
+# CONFIG_TOPSTAR_LAPTOP is not set
+CONFIG_ACPI_TOSHIBA=m
+# CONFIG_TOSHIBA_BT_RFKILL is not set
+# CONFIG_ACPI_CMPC is not set
+# CONFIG_INTEL_IPS is not set
#
# Firmware Drivers
#
# CONFIG_EDD is not set
+CONFIG_FIRMWARE_MEMMAP=y
CONFIG_DELL_RBU=m
CONFIG_DCDBAS=m
CONFIG_DMIID=y
+# CONFIG_ISCSI_IBFT_FIND is not set
#
# File systems
@@ -2730,6 +2997,7 @@ CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=y
+CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
@@ -2737,6 +3005,7 @@ CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
+# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD=y
CONFIG_JBD2=y
CONFIG_FS_MBCACHE=y
@@ -2754,28 +3023,44 @@ CONFIG_JFS_SECURITY=y
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
+# CONFIG_XFS_DEBUG is not set
CONFIG_GFS2_FS=y
-CONFIG_GFS2_FS_LOCKING_NOLOCK=y
-CONFIG_GFS2_FS_LOCKING_DLM=m
+# CONFIG_GFS2_FS_LOCKING_DLM is not set
CONFIG_OCFS2_FS=y
+CONFIG_OCFS2_FS_O2CB=y
+CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
+CONFIG_OCFS2_FS_STATS=y
CONFIG_OCFS2_DEBUG_MASKLOG=y
# CONFIG_OCFS2_DEBUG_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_INOTIFY=y
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
+CONFIG_QUOTA=y
+# CONFIG_QUOTA_NETLINK_INTERFACE is not set
+CONFIG_PRINT_QUOTA_WARNING=y
+# CONFIG_QUOTA_DEBUG is not set
+CONFIG_QUOTA_TREE=y
+# CONFIG_QFMT_V1 is not set
+# CONFIG_QFMT_V2 is not set
CONFIG_QUOTACTL=y
-CONFIG_DNOTIFY=y
+CONFIG_QUOTACTL_COMPAT=y
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
CONFIG_FUSE_FS=m
+# CONFIG_CUSE is not set
CONFIG_GENERIC_ACL=y
#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
@@ -2803,16 +3088,14 @@ CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_VMCORE=y
CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
# CONFIG_HUGETLBFS is not set
# CONFIG_HUGETLB_PAGE is not set
CONFIG_CONFIGFS_FS=y
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
CONFIG_ECRYPT_FS=m
@@ -2821,13 +3104,19 @@ CONFIG_ECRYPT_FS=m
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
+# CONFIG_LOGFS is not set
# CONFIG_CRAMFS is not set
CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_XATTR is not set
+# CONFIG_SQUASHFS_LZO is not set
CONFIG_SQUASHFS_EMBEDDED=y
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
@@ -2835,28 +3124,28 @@ CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
CONFIG_NFSD=m
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
# CONFIG_NFSD_V4 is not set
-CONFIG_NFSD_TCP=y
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
+CONFIG_EXPORTFS=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=m
CONFIG_SUNRPC_XPRT_RDMA=m
-CONFIG_SUNRPC_BIND34=y
# CONFIG_RPCSEC_GSS_KRB5 is not set
# CONFIG_RPCSEC_GSS_SPKM3 is not set
# CONFIG_SMB_FS is not set
+# CONFIG_CEPH_FS is not set
CONFIG_CIFS=m
# CONFIG_CIFS_STATS is not set
# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
# CONFIG_CIFS_EXPERIMENTAL is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
@@ -2927,9 +3216,6 @@ CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=y
CONFIG_DLM=m
# CONFIG_DLM_DEBUG is not set
-CONFIG_INSTRUMENTATION=y
-# CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
#
# Kernel hacking
@@ -2938,17 +3224,23 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
# CONFIG_PRINTK_TIME is not set
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
CONFIG_UNUSED_SYMBOLS=y
# CONFIG_DEBUG_FS is not set
# CONFIG_HEADERS_CHECK is not set
CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_SHIRQ is not set
-CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_SCHED_DEBUG is not set
# CONFIG_SCHEDSTATS is not set
# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
@@ -2962,19 +3254,79 @@ CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_VIRTUAL is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
# CONFIG_DEBUG_LIST is not set
# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
-CONFIG_FORCED_INLINING=y
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_DETECTOR=y
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
# CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_USER_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_FTRACE_SYSCALLS is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_MMIOTRACE is not set
+# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_HAVE_ARCH_KMEMCHECK=y
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
+# CONFIG_EARLY_PRINTK_DBGP is not set
# CONFIG_DEBUG_STACKOVERFLOW is not set
# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_X86_PTDUMP is not set
# CONFIG_DEBUG_RODATA is not set
+# CONFIG_DEBUG_NX_TEST is not set
# CONFIG_IOMMU_DEBUG is not set
+# CONFIG_IOMMU_STRESS is not set
+CONFIG_HAVE_MMIOTRACE_SUPPORT=y
+CONFIG_IO_DELAY_TYPE_0X80=0
+CONFIG_IO_DELAY_TYPE_0XED=1
+CONFIG_IO_DELAY_TYPE_UDELAY=2
+CONFIG_IO_DELAY_TYPE_NONE=3
+CONFIG_IO_DELAY_0X80=y
+# CONFIG_IO_DELAY_0XED is not set
+# CONFIG_IO_DELAY_UDELAY is not set
+# CONFIG_IO_DELAY_NONE is not set
+CONFIG_DEFAULT_IO_DELAY_TYPE=0
+# CONFIG_CPA_DEBUG is not set
+# CONFIG_OPTIMIZE_INLINING is not set
+# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
#
# Security options
@@ -2982,78 +3334,169 @@ CONFIG_EARLY_PRINTK=y
CONFIG_KEYS=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
# CONFIG_SECURITY is not set
-CONFIG_SECURITY_FILE_CAPABILITIES=y
+# CONFIG_SECURITYFS is not set
+# CONFIG_INTEL_TXT is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
CONFIG_XOR_BLOCKS=m
CONFIG_ASYNC_CORE=m
CONFIG_ASYNC_MEMCPY=m
CONFIG_ASYNC_XOR=m
+CONFIG_ASYNC_PQ=m
+CONFIG_ASYNC_RAID6_RECOV=m
+# CONFIG_ASYNC_RAID6_TEST is not set
+CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA=y
+CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA=y
CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_FIPS is not set
CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_ABLKCIPHER=m
+CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=m
+CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=m
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+CONFIG_CRYPTO_GF128MUL=m
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_CRYPTO_CRYPTD=m
+CONFIG_CRYPTO_AUTHENC=m
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=m
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_LRW=m
+CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_XTS=m
+
+#
+# Hash modes
+#
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_XCBC=m
-# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=m
+# CONFIG_CRYPTO_CRC32C_INTEL is not set
+# CONFIG_CRYPTO_GHASH is not set
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=m
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
CONFIG_CRYPTO_SHA1=m
CONFIG_CRYPTO_SHA256=m
CONFIG_CRYPTO_SHA512=m
-# CONFIG_CRYPTO_WP512 is not set
# CONFIG_CRYPTO_TGR192 is not set
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_XTS=m
-CONFIG_CRYPTO_CRYPTD=m
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=m
-CONFIG_CRYPTO_TWOFISH_X86_64=m
-CONFIG_CRYPTO_SERPENT=m
+# CONFIG_CRYPTO_WP512 is not set
+# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set
+
+#
+# Ciphers
+#
CONFIG_CRYPTO_AES=m
CONFIG_CRYPTO_AES_X86_64=m
+# CONFIG_CRYPTO_AES_NI_INTEL is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_BLOWFISH=m
+CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_TEA=m
-CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_FCRYPT=m
# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SALSA20_X86_64 is not set
CONFIG_CRYPTO_SEED=m
+CONFIG_CRYPTO_SERPENT=m
+CONFIG_CRYPTO_TEA=m
+CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_TWOFISH_COMMON=m
+CONFIG_CRYPTO_TWOFISH_X86_64=m
+
+#
+# Compression
+#
CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-CONFIG_CRYPTO_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-CONFIG_CRYPTO_AUTHENC=m
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=m
CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_PADLOCK is not set
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
+CONFIG_HAVE_KVM=y
+CONFIG_HAVE_KVM_IRQCHIP=y
+CONFIG_HAVE_KVM_EVENTFD=y
+CONFIG_KVM_APIC_ARCHITECTURE=y
+CONFIG_KVM_MMIO=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_KVM=m
+CONFIG_KVM_INTEL=m
+CONFIG_KVM_AMD=m
+# CONFIG_VHOST_NET is not set
+# CONFIG_VIRTIO_PCI is not set
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_BINARY_PRINTF is not set
#
# Library routines
#
+CONFIG_RAID6_PQ=m
CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_FIRST_BIT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_CRC_CCITT=m
CONFIG_CRC16=y
-CONFIG_CRC_ITU_T=m
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
CONFIG_CRC7=m
CONFIG_LIBCRC32C=m
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=m
+CONFIG_DECOMPRESS_GZIP=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=m
CONFIG_TEXTSEARCH_BM=m
CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=y
+CONFIG_NLATTR=y
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index b7493aa3..0901cec6 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -405,11 +405,6 @@ whereis(){
esac
}
-bind_mount_dev() {
- # bind-mount /dev/ so that loop devices can be found
- mount -o bind ${NEW_ROOT}/dev /dev
-}
-
setup_hotplug() {
if [ "${KV_2_6_OR_GREATER}" ]
then
@@ -622,9 +617,10 @@ startVolumes() {
then
if [ ! -e '/etc/mdadm.conf' ]
then
- /sbin/mdadm --examine > /etc/mdadm.conf
+ echo "DEVICE /dev/sd[a-z]* /dev/hd[a-z]*" >/etc/mdadm.conf
+ /sbin/mdadm --examine --scan >>/etc/mdadm.conf
fi
- /sbin/mdadm --assemble
+ /sbin/mdadm --assemble --scan
fi
if [ "${USE_DMRAID_NORMAL}" = '1' ]
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index b36137a9..cd276d2b 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -137,9 +137,6 @@ KERNEL COMPILATION
*--oldconfig*::
Implies *--no-clean*, and thus *--no-mrproper*, running a "make oldconfig".
-*--gensplash*::
- Install framebuffer splash support into initramfs.
-
*--*[*no-*]*splash*::
Installs, or not, framebuffer splash support into initramfs.
@@ -222,10 +219,10 @@ LOW-LEVEL COMPILATION OPTIONS
INITIALIZATION
~~~~~~~~~~~~~~
-*--gensplash*=<theme>::
+*--splash*=<theme>::
Enable framebuffer splash using <theme>.
-*--gensplash-res*=<resolutions>::
+*--splash-res*=<resolutions>::
Select gensplash resolutions to include.
*--*[*no-*]*splash*=<theme>::
@@ -233,9 +230,6 @@ INITIALIZATION
<theme> rather than the default theme specified in your splash
configuration. If *--no-splash* is specified, then splash is disabled.
-*--splash-res*=<resolutions>::
- Optionally select splash resolutions to include.
-
*--do-keymap-auto*::
Force keymap selection at boot.
@@ -243,18 +237,17 @@ INITIALIZATION
Disables keymap selection at boot.
*--evms*::
-*--evms2*::
Add in EVMS support from static binaries if they exist on the system:
you should run "emerge evms" first (in the host system).
*--lvm*::
-*--lvm2*::
Add in LVM support from static binaries if they exist on the
system, or compile static LVM binaries if static ones do not
exist.
*--mdadm*::
- Copy '/etc/mdadm.conf' to initramfs.
+ Copy '/etc/mdadm.conf' and mdadm/mdmon binaries to initramfs.
+ Without sys-fs/mdadm[static] installed, this will compile mdadm for you.
*--dmraid*::
Add DMRAID support.
@@ -290,7 +283,7 @@ INITIALIZATION
*--gpg*::
Add support for GnuPG 1.x, the portable standalone branch of GnuPG.
A key can be made from
- `gpg --encrypt --symmetric /path/to/LUKS-key > /path/to/LUKS-key.gpg` .
+ `gpg --symmetric -o /path/to/LUKS-key.gpg /path/to/LUKS-key` .
After that, re-point the *root_key* argument to the new .gpg file.
*--no-busybox*::
@@ -471,6 +464,7 @@ AUTHORS
- Eric Edgar <rocket@gentoo.org>
- NFS Support by Thomas Seiler <thseiler@gmail.com>
- GnuPG 1.x integration by dacook <schism@subverted.org>
+- MDADM integration by Matthias Dahl <ua_bugz_gentoo@mortal-soul.de>
SEE ALSO
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 1bf5de3c..ebf69ea2 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -35,7 +35,6 @@ longusage() {
echo " --no-clean Do not run make clean before compilation"
echo " --no-mrproper Do not run make mrproper before compilation"
echo " --oldconfig Implies --no-clean and runs a 'make oldconfig'"
- echo " --gensplash Install framebuffer splash support into initramfs"
echo " --splash Install framebuffer splash support into initramfs"
echo " --no-splash Do not install framebuffer splash"
echo " --install Install the kernel after building"
@@ -70,8 +69,8 @@ longusage() {
echo " --no-mountboot Don't mount BOOTDIR automatically"
echo " --bootdir=<dir> Set the location of the boot-directory, default is /boot"
echo " Initialization"
- echo " --gensplash=<theme> Enable framebuffer splash using <theme>"
- echo " --gensplash-res=<res> Select splash theme resolutions to install"
+ echo " --splash=<theme> Enable framebuffer splash using <theme>"
+ echo " --splash-res=<res> Select splash theme resolutions to install"
echo " --splash=<theme> Enable framebuffer splash using <theme>"
echo " --splash-res=<res> Select splash theme resolutions to install"
echo " --do-keymap-auto Forces keymap selection at boot"
@@ -79,11 +78,7 @@ longusage() {
echo " --evms Include EVMS support"
echo " --> 'emerge evms' in the host operating system"
echo " first"
- echo " --evms2 Include EVMS support"
- echo " --> 'emerge evms' in the host operating system"
- echo " first"
echo " --lvm Include LVM support"
- echo " --lvm2 Include LVM support"
echo " --mdadm Copy /etc/mdadm.conf to initramfs"
echo " --dmraid Include DMRAID support"
echo " --multipath Include Multipath support"
@@ -98,10 +93,10 @@ longusage() {
echo " --luks Include LUKS support"
echo " --> 'emerge cryptsetup-luks' with USE=-dynamic"
echo " --gpg Include GPG-armored LUKS key support"
- echo " --no-busybox Do not include busybox in the initramfs."
- echo " --unionfs Include support for unionfs"
- echo " --netboot Create a self-contained env in the initramfs"
- echo " --real-root=<foo> Specify a default for real_root="
+ echo " --no-busybox Do not include busybox in the initramfs."
+ echo " --unionfs Include support for unionfs"
+ echo " --netboot Create a self-contained env in the initramfs"
+ echo " --real-root=<foo> Specify a default for real_root="
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect"
echo " --cachedir=<dir> Override the default cache location"
diff --git a/gen_compile.sh b/gen_compile.sh
index 7438f34d..b60b921e 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -252,8 +252,8 @@ compile_generic() {
# ARGS='CC="ccache gcc"'
if [ "${argstype}" == 'runtask' ]
then
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${target} $*
+ print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1
+ eval ${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $*
RET=$?
elif [ "${LOGLEVEL}" -gt "1" ]
then
@@ -417,8 +417,10 @@ compile_busybox() {
}
compile_lvm() {
- if [ ! -f "${LVM_BINCACHE}" ]
+ if [ -f "${LVM_BINCACHE}" ]
then
+ print_info 1 "lvm: >> Using cache"
+ else
[ -f "${LVM_SRCTAR}" ] ||
gen_die "Could not find LVM source tarball: ${LVM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
cd "${TEMP}"
@@ -427,10 +429,6 @@ compile_lvm() {
gen_die 'Could not extract LVM source tarball!'
[ -d "${LVM_DIR}" ] ||
gen_die 'LVM directory ${LVM_DIR} is invalid!'
- rm -rf "${TEMP}/device-mapper" > /dev/null
- /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
- gen_die "Could not extract device-mapper binary cache!";
-
cd "${LVM_DIR}"
apply_patches lvm ${LVM_VER}
print_info 1 'lvm: >> Configuring...'
@@ -457,6 +455,44 @@ compile_lvm() {
fi
}
+compile_mdadm() {
+ if [ -f "${MDADM_BINCACHE}" ]
+ then
+ print_info 1 ' MDADM: Using cache'
+ else
+ [ -f "${MDADM_SRCTAR}" ] ||
+ gen_die "Could not find MDADM source tarball: ${MDADM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${MDADM_DIR}" > /dev/null
+ /bin/tar -jxpf "${MDADM_SRCTAR}" ||
+ gen_die 'Could not extract MDADM source tarball!'
+ [ -d "${MDADM_DIR}" ] ||
+ gen_die 'MDADM directory ${MDADM_DIR} is invalid!'
+
+ cd "${MDADM_DIR}"
+ sed -i "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = -Os:" Makefile
+ sed -i "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = -Os:" Makefile
+ sed -i "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" Makefile
+ sed -i "s/^# LDFLAGS = -static/LDFLAGS = -static/" Makefile
+
+ print_info 1 'mdadm: >> Compiling...'
+ compile_generic 'mdadm mdmon' utils
+
+ mkdir -p "${TEMP}/mdadm/sbin"
+ install -m 0755 -s mdadm "${TEMP}/mdadm/sbin/mdadm"
+ install -m 0755 -s mdmon "${TEMP}/mdadm/sbin/mdmon"
+ print_info 1 ' >> Copying to bincache...'
+ cd "${TEMP}/mdadm"
+ strip "sbin/mdadm" "sbin/mdmon" ||
+ gen_die 'Could not strip mdadm binaries!'
+ /bin/tar -cjf "${MDADM_BINCACHE}" sbin/mdadm sbin/mdmon ||
+ gen_die 'Could not create binary cache'
+
+ cd "${TEMP}"
+ rm -rf "${MDADM_DIR}" mdadm
+ fi
+}
+
compile_dmraid() {
compile_device_mapper
if [ ! -f "${DMRAID_BINCACHE}" ]
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 2f14b4d8..2e0737f3 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# $Id$
+# Fills variable KERNEL_CONFIG
determine_config_file() {
if [ "${CMD_KERNEL_CONFIG}" != "" ]
then
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 3e39e867..2049d0c1 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -58,7 +58,8 @@ get_KV() {
LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"`
KV=${VER}.${PAT}.${SUB}${EXV}${LOV}
else
- LCV=`grep ^CONFIG_LOCALVERSION= ${KERNEL_DIR}/.config | sed -r -e "s/.*=\"(.*)\"/\1/"`
+ determine_config_file
+ LCV=`grep ^CONFIG_LOCALVERSION= "${KERNEL_CONFIG}" | sed -r -e "s/.*=\"(.*)\"/\1/"`
KV=${VER}.${PAT}.${SUB}${EXV}${LCV}
fi
fi
@@ -135,6 +136,7 @@ determine_real_args() {
BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
+ MDADM_BINCACHE=`cache_replace "${MDADM_BINCACHE}"`
DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
@@ -147,6 +149,7 @@ determine_real_args() {
BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
+ MDADM_BINCACHE=`arch_replace "${MDADM_BINCACHE}"`
DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
ISCSI_BINCACHE=`arch_replace "${ISCSI_BINCACHE}"`
BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 6af595ef..beff6604 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -186,10 +186,6 @@ arch_replace() {
var_replace "ARCH" "${ARCH}" "${1}"
}
-kv_replace() {
- var_replace "KV" "${KV}" "${1}"
-}
-
cache_replace() {
var_replace "CACHE" "${CACHE_DIR}" "${1}"
}
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index ac32516e..582df2cc 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -75,10 +75,10 @@ append_blkid(){
rm -r "${TEMP}/initramfs-blkid-temp/"
fi
cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
- [ "${DISKLABEL}" = '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
+ mkdir -p "${TEMP}/initramfs-blkid-temp/sbin/"
+ [ "${DISKLABEL}" = '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/sbin/blkid" ||
gen_die "Could not extract blkid binary cache!"; }
- chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
+ chmod a+x "${TEMP}/initramfs-blkid-temp/sbin/blkid"
cd "${TEMP}/initramfs-blkid-temp/"
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
|| gen_die "compressing blkid cpio"
@@ -339,10 +339,23 @@ append_mdadm(){
fi
cd ${TEMP}
mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
+ mkdir -p "${TEMP}/initramfs-mdadm-temp/sbin/"
if [ "${MDADM}" = '1' ]
then
cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \
|| gen_die "Could not copy mdadm.conf!"
+ if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \
+ && [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable'
+ then
+ print_info 1 ' MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)...'
+ cp /sbin/mdadm /sbin/mdmon "${TEMP}/initramfs-mdadm-temp/sbin/" ||
+ gen_die 'Could not copy over mdadm!'
+ else
+ print_info 1 ' MDADM: Adding support (compiling binaries)...'
+ compile_mdadm
+ /bin/tar -jxpf "${MDADM_BINCACHE}" -C "${TEMP}/initramfs-mdadm-temp" ||
+ gen_die "Could not extract mdadm binary cache!";
+ fi
fi
cd "${TEMP}/initramfs-mdadm-temp/"
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
diff --git a/genkernel b/genkernel
index 6a3351fc..94614b52 100755
--- a/genkernel
+++ b/genkernel
@@ -2,7 +2,7 @@
# $Id$
PATH="${PATH}:/sbin:/usr/sbin"
-GK_V='3.4.11.1'
+GK_V='3.4.12.5'
# Set the default for TMPDIR. May be modified by genkernel.conf or the
# --tempdir command line option.
diff --git a/genkernel.conf b/genkernel.conf
index 2bc81838..3f52a322 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -70,7 +70,8 @@ USECOLOR="yes"
# If included, busybox is rebuilt if the cached copy is out of date.
# BUSYBOX="yes"
-# Copy /etc/mdadm.conf to initramfs.
+# Copy /etc/mdadm.conf, mdadm/mdmon binaries to initramfs.
+# Without sys-fs/mdadm[static] installed, this will build a static mdadm.
# MDADM="no"
# Add Multipath support.
@@ -169,6 +170,11 @@ LVM_DIR="LVM2.${LVM_VER}"
LVM_SRCTAR="${DISTDIR}/LVM2.${LVM_VER}.tgz"
LVM_BINCACHE="%%CACHE%%/LVM2.${LVM_VER}-%%ARCH%%.tar.bz2"
+MDADM_VER="VERSION_MDADM"
+MDADM_DIR="mdadm-${MDADM_VER}"
+MDADM_SRCTAR="${DISTDIR}/mdadm-${MDADM_VER}.tar.bz2"
+MDADM_BINCACHE="%%CACHE%%/mdadm-${MDADM_VER}-%%ARCH%%.tar.bz2"
+
DMRAID_VER="VERSION_DMRAID"
DMRAID_DIR="dmraid/${DMRAID_VER}"
DMRAID_SRCTAR="${DISTDIR}/dmraid-${DMRAID_VER}.tar.bz2"
diff --git a/maintenance/docmatcher.py b/maintenance/docmatcher.py
index 4b6b94e0..9e82c532 100644
--- a/maintenance/docmatcher.py
+++ b/maintenance/docmatcher.py
@@ -15,12 +15,15 @@ NON_VARIABLES = ('UTF', 'USE', 'TCP', 'SMP', 'PXE', 'PPC', 'MAC',
'GRP', 'DOCTYPE', 'DHCP', 'DEFAULT', 'ATARAID', 'APPEND')
EXTRA_VARIABLES = ['ARCH_OVERRIDE', 'BOOTLOADER', 'CLEAR_CACHE_DIR', 'DEFAULT_KERNEL_SOURCE', 'DISTDIR', 'GK_SHARE', 'BUSYBOX_APPLETS']
-for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM', 'ISCSI', 'FUSE', 'GPG'):
+for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM', 'ISCSI', 'FUSE', 'GPG', 'MDADM'):
for prop in ('DIR', 'SRCTAR', 'VER'):
EXTRA_VARIABLES.append('%s_%s' % (app, prop))
EXTRA_VARIABLES = tuple(EXTRA_VARIABLES)
IGNORE_OPTIONS = ('help', 'version')
+_GPG_PARAMETERS = ('symmetric', )
+IGNORE_PARAMETERS = _GPG_PARAMETERS
+DEPRECATED_PARAMETERS = ('lvm2', 'evms2', 'gensplash', 'gensplash-res')
def exract_gen_cmdline_sh():
@@ -55,6 +58,8 @@ def exract_gen_cmdline_sh():
para_name = match.group(1)
if para_name in IGNORE_OPTIONS:
continue
+ if para_name in DEPRECATED_PARAMETERS:
+ continue
gen_cmdline_sh_parsing_long_params.add(para_name)
gen_cmdline_sh_variables = set()
@@ -96,6 +101,9 @@ def extract_genkernel_8_txt():
if para_name == 'no-':
continue
+ if para_name in IGNORE_PARAMETERS:
+ continue
+
m = yes_no.match(para_name)
if m:
p_yes = m.group(2)
@@ -244,21 +252,21 @@ def main():
# Future work (due extensions)
- print('Options missing from the *man page*:')
- print_set(gen_cmdline_sh_parsing_long_params.difference(genkernel_8_txt_long_params))
-
- print('Options missing from *--help*:')
- print_set(gen_cmdline_sh_parsing_long_params.difference(gen_cmdline_sh_usage_long_params))
+ print('Variables missing from *web page*:')
+ print_set(known_variales.difference(genkernel_xml_variables))
print('Options missing from *web page*:')
print_set(gen_cmdline_sh_parsing_long_params.difference(genkernel_xml_long_params))
- print('Variables missing from *web page*:')
- print_set(known_variales.difference(genkernel_xml_variables))
-
print('Variables missing from *genkernel.conf*:')
print_set(known_variales.difference(genkernel_conf_variables))
+ print('Options missing from the *man page*:')
+ print_set(gen_cmdline_sh_parsing_long_params.difference(genkernel_8_txt_long_params))
+
+ print('Options missing from *--help*:')
+ print_set(gen_cmdline_sh_parsing_long_params.difference(gen_cmdline_sh_usage_long_params))
+
# Future work (due removal and updates)
print('Removed options still mentioned in the *man page*:')
diff --git a/netboot/busy-config b/netboot/busy-config
index 0691ff0f..2aa4804d 100644
--- a/netboot/busy-config
+++ b/netboot/busy-config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.7.4
-# Thu Apr 16 15:04:31 2009
+# Tue Apr 13 21:28:34 2010
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -372,8 +372,8 @@ CONFIG_MESG=y
# Login/Password Management Utilities
#
CONFIG_FEATURE_SHADOWPASSWDS=y
-# CONFIG_USE_BB_SHADOW is not set
-# CONFIG_USE_BB_PWD_GRP is not set
+CONFIG_USE_BB_SHADOW=y
+CONFIG_USE_BB_PWD_GRP=y
# CONFIG_ADDGROUP is not set
# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
# CONFIG_DELGROUP is not set
diff --git a/netboot/linuxrc.x b/netboot/linuxrc.x
index 8586ff69..dc4a9bf3 100755
--- a/netboot/linuxrc.x
+++ b/netboot/linuxrc.x
@@ -14,6 +14,10 @@ BasicSetup() {
CPYYEAR="$(echo ${MYDATE} | cut -c 1-4)"
BBDATE="$(echo ${MYDATE} | cut -c 5-8)$(echo ${MYDATE} | cut -c 1-4)"
DISDATE="$(echo ${MYDATE} | cut -c 7-8) $(echo ${MYDATE} | cut -c 5-6) $(echo ${MYDATE} | cut -c 1-4)"
+
+ . /etc/initrd.defaults
+ # Clean input/output
+ exec >${CONSOLE} <${CONSOLE} 2>&1
}
#//--------------------------------------------------------------------------------
diff --git a/patches/busybox/1.18.1/1.18.1-mdadm.diff b/patches/busybox/1.18.1/1.18.1-mdadm.diff
deleted file mode 100644
index 0f3107eb..00000000
--- a/patches/busybox/1.18.1/1.18.1-mdadm.diff
+++ /dev/null
@@ -1,5874 +0,0 @@
-Based on:
-
-> Forward-port the mdadm tool from the Gentoo Busybox-1.1.3.
-> Should handle all types of metadata 0.90, 1.0, 1.1, 1.2.
-> If /etc/mdadm.conf does not exist in the initrd, it is created first, by
-> scanning devices, and then it is used.
-
---- a/Config.in 2010-12-21 06:31:04.000000000 +0200
-+++ mdadm/Config.in 2011-01-12 21:33:01.000000000 +0200
-@@ -749,6 +749,7 @@ source findutils/Config.in
- source init/Config.in
- source loginutils/Config.in
- source e2fsprogs/Config.in
-+source mdadm/Config.in
- source modutils/Config.in
- source util-linux/Config.in
- source miscutils/Config.in
---- a/include/applets.src.h 2010-12-21 06:31:04.000000000 +0200
-+++ mdadm/include/applets.src.h 2011-01-12 21:33:01.000000000 +0200
-@@ -206,6 +206,7 @@ IF_KILLALL5(APPLET_ODDNAME(killall5, kil
- IF_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_DROP))
- IF_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_DROP))
- IF_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_DROP, length))
-+IF_MDADM(APPLET(mdadm, _BB_DIR_SBIN, _BB_SUID_DROP))
- IF_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_DROP))
- IF_SETARCH(APPLET_ODDNAME(linux32, setarch, _BB_DIR_BIN, _BB_SUID_DROP, linux32))
- IF_SETARCH(APPLET_ODDNAME(linux64, setarch, _BB_DIR_BIN, _BB_SUID_DROP, linux64))
---- a/include/usage.src.h 2010-12-21 06:29:45.000000000 +0200
-+++ mdadm/include/usage.src.h 2011-01-12 21:33:01.000000000 +0200
-@@ -2404,6 +2404,11 @@ INSERT
- "\n -w Warn about improperly formatted checksum lines" \
- )
-
-+#define mdadm_trivial_usage \
-+ ""
-+#define mdadm_full_usage \
-+ "Assemble or Examine the mdadm arrays."
-+
- #define mdev_trivial_usage \
- "[-s]"
- #define mdev_full_usage "\n\n" \
---- a/Makefile 2010-12-21 06:31:43.000000000 +0200
-+++ mdadm/Makefile 2011-01-12 21:33:01.000000000 +0200
-@@ -478,6 +478,7 @@ libs-y := \
- loginutils/ \
- mailutils/ \
- miscutils/ \
-+ mdadm/ \
- modutils/ \
- networking/ \
- networking/libiproute/ \
---- a/mdadm/bitmap.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/bitmap.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,287 @@
-+/*
-+ * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
-+ *
-+ * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
-+ */
-+#ifndef BITMAP_H
-+#define BITMAP_H 1
-+
-+#define BITMAP_MAJOR_LO 3
-+/* version 4 insists the bitmap is in little-endian order
-+ * with version 3, it is host-endian which is non-portable
-+ */
-+#define BITMAP_MAJOR_HI 4
-+#define BITMAP_MAJOR_HOSTENDIAN 3
-+
-+#define BITMAP_MINOR 39
-+
-+/*
-+ * in-memory bitmap:
-+ *
-+ * Use 16 bit block counters to track pending writes to each "chunk".
-+ * The 2 high order bits are special-purpose, the first is a flag indicating
-+ * whether a resync is needed. The second is a flag indicating whether a
-+ * resync is active.
-+ * This means that the counter is actually 14 bits:
-+ *
-+ * +--------+--------+------------------------------------------------+
-+ * | resync | resync | counter |
-+ * | needed | active | |
-+ * | (0-1) | (0-1) | (0-16383) |
-+ * +--------+--------+------------------------------------------------+
-+ *
-+ * The "resync needed" bit is set when:
-+ * a '1' bit is read from storage at startup.
-+ * a write request fails on some drives
-+ * a resync is aborted on a chunk with 'resync active' set
-+ * It is cleared (and resync-active set) when a resync starts across all drives
-+ * of the chunk.
-+ *
-+ *
-+ * The "resync active" bit is set when:
-+ * a resync is started on all drives, and resync_needed is set.
-+ * resync_needed will be cleared (as long as resync_active wasn't already set).
-+ * It is cleared when a resync completes.
-+ *
-+ * The counter counts pending write requests, plus the on-disk bit.
-+ * When the counter is '1' and the resync bits are clear, the on-disk
-+ * bit can be cleared aswell, thus setting the counter to 0.
-+ * When we set a bit, or in the counter (to start a write), if the fields is
-+ * 0, we first set the disk bit and set the counter to 1.
-+ *
-+ * If the counter is 0, the on-disk bit is clear and the stipe is clean
-+ * Anything that dirties the stipe pushes the counter to 2 (at least)
-+ * and sets the on-disk bit (lazily).
-+ * If a periodic sweep find the counter at 2, it is decremented to 1.
-+ * If the sweep find the counter at 1, the on-disk bit is cleared and the
-+ * counter goes to zero.
-+ *
-+ * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
-+ * counters as a fallback when "page" memory cannot be allocated:
-+ *
-+ * Normal case (page memory allocated):
-+ *
-+ * page pointer (32-bit)
-+ *
-+ * [ ] ------+
-+ * |
-+ * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
-+ * c1 c2 c2048
-+ *
-+ * Hijacked case (page memory allocation failed):
-+ *
-+ * hijacked page pointer (32-bit)
-+ *
-+ * [ ][ ] (no page memory allocated)
-+ * counter #1 (16-bit) counter #2 (16-bit)
-+ *
-+ */
-+
-+#ifdef __KERNEL__
-+
-+#define PAGE_BITS (PAGE_SIZE << 3)
-+#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
-+
-+typedef __u16 bitmap_counter_t;
-+#define COUNTER_BITS 16
-+#define COUNTER_BIT_SHIFT 4
-+#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
-+#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
-+
-+#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
-+#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
-+#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
-+#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
-+#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
-+#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
-+
-+/* how many counters per page? */
-+#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
-+/* same, except a shift value for more efficient bitops */
-+#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
-+/* same, except a mask value for more efficient bitops */
-+#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
-+
-+#define BITMAP_BLOCK_SIZE 512
-+#define BITMAP_BLOCK_SHIFT 9
-+
-+/* how many blocks per chunk? (this is variable) */
-+#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
-+
-+/* when hijacked, the counters and bits represent even larger "chunks" */
-+/* there will be 1024 chunks represented by each counter in the page pointers */
-+#define PAGEPTR_BLOCK_RATIO(bitmap) \
-+ (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
-+#define PAGEPTR_BLOCK_SHIFT(bitmap) \
-+ (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
-+#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
-+
-+/*
-+ * on-disk bitmap:
-+ *
-+ * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
-+ * file a page at a time. There's a superblock at the start of the file.
-+ */
-+
-+/* map chunks (bits) to file pages - offset by the size of the superblock */
-+#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
-+
-+#endif
-+
-+/*
-+ * bitmap structures:
-+ */
-+
-+#define BITMAP_MAGIC 0x6d746962
-+
-+/* use these for bitmap->flags and bitmap->sb->state bit-fields */
-+enum bitmap_state {
-+ BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
-+ BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */
-+};
-+
-+/* the superblock at the front of the bitmap file -- little endian */
-+typedef struct bitmap_super_s {
-+ __u32 magic; /* 0 BITMAP_MAGIC */
-+ __u32 version; /* 4 the bitmap major for now, could change... */
-+ __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
-+ __u64 events; /* 24 event counter for the bitmap (1)*/
-+ __u64 events_cleared;/*32 event counter when last bit cleared (2) */
-+ __u64 sync_size; /* 40 the size of the md device's sync range(3) */
-+ __u32 state; /* 48 bitmap state information */
-+ __u32 chunksize; /* 52 the bitmap chunk size in bytes */
-+ __u32 daemon_sleep; /* 56 seconds between disk flushes */
-+ __u32 write_behind; /* 60 number of outstanding write-behind writes */
-+
-+ __u8 pad[256 - 64]; /* set to zero */
-+} bitmap_super_t;
-+
-+/* notes:
-+ * (1) This event counter is updated before the eventcounter in the md superblock
-+ * When a bitmap is loaded, it is only accepted if this event counter is equal
-+ * to, or one greater than, the event counter in the superblock.
-+ * (2) This event counter is updated when the other one is *if*and*only*if* the
-+ * array is not degraded. As bits are not cleared when the array is degraded,
-+ * this represents the last time that any bits were cleared.
-+ * If a device is being added that has an event count with this value or
-+ * higher, it is accepted as conforming to the bitmap.
-+ * (3)This is the number of sectors represented by the bitmap, and is the range that
-+ * resync happens across. For raid1 and raid5/6 it is the size of individual
-+ * devices. For raid10 it is the size of the array.
-+ */
-+
-+#ifdef __KERNEL__
-+
-+/* the in-memory bitmap is represented by bitmap_pages */
-+struct bitmap_page {
-+ /*
-+ * map points to the actual memory page
-+ */
-+ char *map;
-+ /*
-+ * in emergencies (when map cannot be alloced), hijack the map
-+ * pointer and use it as two counters itself
-+ */
-+ unsigned int hijacked;
-+ /*
-+ * count of dirty bits on the page
-+ */
-+ int count;
-+};
-+
-+/* keep track of bitmap file pages that have pending writes on them */
-+struct page_list {
-+ struct list_head list;
-+ struct page *page;
-+};
-+
-+/* the main bitmap structure - one per mddev */
-+struct bitmap {
-+ struct bitmap_page *bp;
-+ unsigned long pages; /* total number of pages in the bitmap */
-+ unsigned long missing_pages; /* number of pages not yet allocated */
-+
-+ mddev_t *mddev; /* the md device that the bitmap is for */
-+
-+ int counter_bits; /* how many bits per block counter */
-+
-+ /* bitmap chunksize -- how much data does each bit represent? */
-+ unsigned long chunksize;
-+ unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
-+ unsigned long chunks; /* total number of data chunks for the array */
-+
-+ /* We hold a count on the chunk currently being synced, and drop
-+ * it when the last block is started. If the resync is aborted
-+ * midway, we need to be able to drop that count, so we remember
-+ * the counted chunk..
-+ */
-+ unsigned long syncchunk;
-+
-+ __u64 events_cleared;
-+
-+ /* bitmap spinlock */
-+ spinlock_t lock;
-+
-+ struct file *file; /* backing disk file */
-+ struct page *sb_page; /* cached copy of the bitmap file superblock */
-+ struct page **filemap; /* list of cache pages for the file */
-+ unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
-+ unsigned long file_pages; /* number of pages in the file */
-+
-+ unsigned long flags;
-+
-+ /*
-+ * the bitmap daemon - periodically wakes up and sweeps the bitmap
-+ * file, cleaning up bits and flushing out pages to disk as necessary
-+ */
-+ mdk_thread_t *daemon;
-+ unsigned long daemon_sleep; /* how many seconds between updates? */
-+
-+ /*
-+ * bitmap write daemon - this daemon performs writes to the bitmap file
-+ * this thread is only needed because of a limitation in ext3 (jbd)
-+ * that does not allow a task to have two journal transactions ongoing
-+ * simultaneously (even if the transactions are for two different
-+ * filesystems) -- in the case of bitmap, that would be the filesystem
-+ * that the bitmap file resides on and the filesystem that is mounted
-+ * on the md device -- see current->journal_info in jbd/transaction.c
-+ */
-+ mdk_thread_t *write_daemon;
-+ mdk_thread_t *writeback_daemon;
-+ spinlock_t write_lock;
-+ struct semaphore write_ready;
-+ struct semaphore write_done;
-+ unsigned long writes_pending;
-+ wait_queue_head_t write_wait;
-+ struct list_head write_pages;
-+ struct list_head complete_pages;
-+ mempool_t *write_pool;
-+};
-+
-+/* the bitmap API */
-+
-+/* these are used only by md/bitmap */
-+int bitmap_create(mddev_t *mddev);
-+void bitmap_destroy(mddev_t *mddev);
-+int bitmap_active(struct bitmap *bitmap);
-+
-+char *file_path(struct file *file, char *buf, int count);
-+void bitmap_print_sb(struct bitmap *bitmap);
-+int bitmap_update_sb(struct bitmap *bitmap);
-+
-+int bitmap_setallbits(struct bitmap *bitmap);
-+
-+/* these are exported */
-+void bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
-+void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
-+ int success);
-+int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks);
-+void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
-+void bitmap_close_sync(struct bitmap *bitmap);
-+
-+int bitmap_unplug(struct bitmap *bitmap);
-+#endif
-+
-+#endif
-diff -pruN a/mdadm/config.c mdadm/mdadm/config.c
---- a/mdadm/config.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/config.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,824 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+#include <sys/dir.h>
-+#include <glob.h>
-+#include <fnmatch.h>
-+#include <ctype.h>
-+#include <pwd.h>
-+#include <grp.h>
-+
-+mapping_t r5layout[] = {
-+ { "left-asymmetric", 0},
-+ { "right-asymmetric", 1},
-+ { "left-symmetric", 2},
-+ { "right-symmetric", 3},
-+
-+ { "default", 2},
-+ { "la", 0},
-+ { "ra", 1},
-+ { "ls", 2},
-+ { "rs", 3},
-+ { NULL, 0}
-+};
-+
-+mapping_t pers[] = {
-+ { "linear", -1},
-+ { "raid0", 0},
-+ { "0", 0},
-+ { "stripe", 0},
-+ { "raid1", 1},
-+ { "1", 1},
-+ { "mirror", 1},
-+ { "raid4", 4},
-+ { "4", 4},
-+ { "raid5", 5},
-+ { "5", 5},
-+ { "multipath", -4},
-+ { "mp", -4},
-+ { "raid6", 6},
-+ { "6", 6},
-+ { "raid10", 10},
-+ { "10", 10},
-+ { "faulty", -5},
-+ { NULL, 0}
-+};
-+/*
-+ * Read the config file
-+ *
-+ * conf_get_uuids gets a list of devicename+uuid pairs
-+ * conf_get_devs gets device names after expanding wildcards
-+ *
-+ * Each keeps the returned list and frees it when asked to make
-+ * a new list.
-+ *
-+ * The format of the config file needs to be fairly extensible.
-+ * Now, arrays only have names and uuids and devices merely are.
-+ * But later arrays might want names, and devices might want superblock
-+ * versions, and who knows what else.
-+ * I like free format, abhore backslash line continuation, adore
-+ * indentation for structure and am ok about # comments.
-+ *
-+ * So, each line that isn't blank or a #comment must either start
-+ * with a key word, and not be indented, or must start with a
-+ * non-key-word and must be indented.
-+ *
-+ * Keywords are DEVICE and ARRAY
-+ * DEV{ICE} introduces some devices that might contain raid components.
-+ * e.g.
-+ * DEV style=0 /dev/sda* /dev/hd*
-+ * DEV style=1 /dev/sd[b-f]*
-+ * ARR{AY} describes an array giving md device and attributes like uuid=whatever
-+ * e.g.
-+ * ARRAY /dev/md0 uuid=whatever name=something
-+ * Spaces separate words on each line. Quoting, with "" or '' protects them,
-+ * but may not wrap over lines
-+ *
-+ */
-+
-+#ifndef CONFFILE
-+#define CONFFILE "/etc/mdadm.conf"
-+#endif
-+#ifndef CONFFILE2
-+/* for Debian compatibility .... */
-+#define CONFFILE2 "/etc/mdadm/mdadm.conf"
-+#endif
-+char DefaultConfFile[] = CONFFILE;
-+char DefaultAltConfFile[] = CONFFILE2;
-+
-+enum linetype { Devices, Array, Mailaddr, Mailfrom, Program, CreateDev, Homehost, LTEnd };
-+char *keywords[] = {
-+ [Devices] = "devices",
-+ [Array] = "array",
-+ [Mailaddr] = "mailaddr",
-+ [Mailfrom] = "mailfrom",
-+ [Program] = "program",
-+ [CreateDev]= "create",
-+ [Homehost] = "homehost",
-+ [LTEnd] = NULL
-+};
-+
-+/*
-+ * match_keyword returns an index into the keywords array, or -1 for no match
-+ * case is ignored, and at least three characters must be given
-+ */
-+
-+int match_keyword(char *word)
-+{
-+ int len = strlen(word);
-+ int n;
-+
-+ if (len < 3) return -1;
-+ for (n=0; keywords[n]; n++) {
-+ if (strncasecmp(word, keywords[n], len)==0)
-+ return n;
-+ }
-+ return -1;
-+}
-+
-+/* conf_word gets one word from the conf file.
-+ * if "allow_key", then accept words at the start of a line,
-+ * otherwise stop when such a word is found.
-+ * We assume that the file pointer is at the end of a word, so the
-+ * next character is a space, or a newline. If not, it is the start of a line.
-+ */
-+
-+char *conf_word(FILE *file, int allow_key)
-+{
-+ int wsize = 100;
-+ int len = 0;
-+ int c;
-+ int quote;
-+ int wordfound = 0;
-+ char *word = malloc(wsize);
-+
-+ if (!word) abort();
-+
-+ while (wordfound==0) {
-+ /* at the end of a word.. */
-+ c = getc(file);
-+ if (c == '#')
-+ while (c != EOF && c != '\n')
-+ c = getc(file);
-+ if (c == EOF) break;
-+ if (c == '\n') continue;
-+
-+ if (c != ' ' && c != '\t' && ! allow_key) {
-+ ungetc(c, file);
-+ break;
-+ }
-+ /* looks like it is safe to get a word here, if there is one */
-+ quote = 0;
-+ /* first, skip any spaces */
-+ while (c == ' ' || c == '\t')
-+ c = getc(file);
-+ if (c != EOF && c != '\n' && c != '#') {
-+ /* we really have a character of a word, so start saving it */
-+ while (c != EOF && c != '\n' && (quote || (c!=' ' && c != '\t'))) {
-+ wordfound = 1;
-+ if (quote && c == quote) quote = 0;
-+ else if (quote == 0 && (c == '\'' || c == '"'))
-+ quote = c;
-+ else {
-+ if (len == wsize-1) {
-+ wsize += 100;
-+ word = realloc(word, wsize);
-+ if (!word) abort();
-+ }
-+ word[len++] = c;
-+ }
-+ c = getc(file);
-+ }
-+ }
-+ if (c != EOF) ungetc(c, file);
-+ }
-+ word[len] = 0;
-+/* printf("word is <%s>\n", word); */
-+ if (!wordfound) {
-+ free(word);
-+ word = NULL;
-+ }
-+ return word;
-+}
-+
-+/*
-+ * conf_line reads one logical line from the conffile.
-+ * It skips comments and continues until it finds a line that starts
-+ * with a non blank/comment. This character is pushed back for the next call
-+ * A doubly linked list of words is returned.
-+ * the first word will be a keyword. Other words will have had quotes removed.
-+ */
-+
-+char *conf_line(FILE *file)
-+{
-+ char *w;
-+ char *list;
-+
-+ w = conf_word(file, 1);
-+ if (w == NULL) return NULL;
-+
-+ list = dl_strdup(w);
-+ free(w);
-+ dl_init(list);
-+
-+ while ((w = conf_word(file,0))){
-+ char *w2 = dl_strdup(w);
-+ free(w);
-+ dl_add(list, w2);
-+ }
-+/* printf("got a line\n");*/
-+ return list;
-+}
-+
-+void free_line(char *line)
-+{
-+ char *w;
-+ for (w=dl_next(line); w != line; w=dl_next(line)) {
-+ dl_del(w);
-+ dl_free(w);
-+ }
-+ dl_free(line);
-+}
-+
-+
-+struct conf_dev {
-+ struct conf_dev *next;
-+ char *name;
-+} *cdevlist = NULL;
-+
-+mddev_dev_t load_partitions(void)
-+{
-+ FILE *f = fopen("/proc/partitions", "r");
-+ char buf[1024];
-+ mddev_dev_t rv = NULL;
-+ if (f == NULL) {
-+ fprintf(stderr, Name ": cannot open /proc/partitions\n");
-+ return NULL;
-+ }
-+ while (fgets(buf, 1024, f)) {
-+ int major, minor;
-+ char *name, *mp;
-+ mddev_dev_t d;
-+
-+ buf[1023] = '\0';
-+ if (buf[0] != ' ')
-+ continue;
-+ major = strtoul(buf, &mp, 10);
-+ if (mp == buf || *mp != ' ')
-+ continue;
-+ minor = strtoul(mp, NULL, 10);
-+
-+ name = map_dev(major, minor, 1);
-+ if (!name)
-+ continue;
-+ d = malloc(sizeof(*d));
-+ d->devname = strdup(name);
-+ d->next = rv;
-+ d->used = 0;
-+ rv = d;
-+ }
-+ fclose(f);
-+ return rv;
-+}
-+
-+struct createinfo createinfo = {
-+ .autof = 2, /* by default, create devices with standard names */
-+ .symlinks = 1,
-+#ifdef DEBIAN
-+ .gid = 6, /* disk */
-+ .mode = 0660,
-+#else
-+ .mode = 0600,
-+#endif
-+};
-+
-+int parse_auto(char *str, char *msg, int config)
-+{
-+ int autof;
-+ if (str == NULL || *str == 0)
-+ autof = 2;
-+ else if (strcasecmp(str,"no")==0)
-+ autof = 1;
-+ else if (strcasecmp(str,"yes")==0)
-+ autof = 2;
-+ else if (strcasecmp(str,"md")==0)
-+ autof = config?5:3;
-+ else {
-+ /* There might be digits, and maybe a hypen, at the end */
-+ char *e = str + strlen(str);
-+ int num = 4;
-+ int len;
-+ while (e > str && isdigit(e[-1]))
-+ e--;
-+ if (*e) {
-+ num = atoi(e);
-+ if (num <= 0) num = 1;
-+ }
-+ if (e > str && e[-1] == '-')
-+ e--;
-+ len = e - str;
-+ if ((len == 2 && strncasecmp(str,"md",2)==0)) {
-+ autof = config ? 5 : 3;
-+ } else if ((len == 3 && strncasecmp(str,"yes",3)==0)) {
-+ autof = 2;
-+ } else if ((len == 3 && strncasecmp(str,"mdp",3)==0)) {
-+ autof = config ? 6 : 4;
-+ } else if ((len == 1 && strncasecmp(str,"p",1)==0) ||
-+ (len >= 4 && strncasecmp(str,"part",4)==0)) {
-+ autof = 6;
-+ } else {
-+ fprintf(stderr, Name ": %s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
-+ " optionally followed by a number.\n",
-+ msg, str);
-+ exit(2);
-+ }
-+ autof |= num << 3;
-+ }
-+ return autof;
-+}
-+
-+static void createline(char *line)
-+{
-+ char *w;
-+ char *ep;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (strncasecmp(w, "auto=", 5) == 0)
-+ createinfo.autof = parse_auto(w+5, "auto=", 1);
-+ else if (strncasecmp(w, "owner=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing owner name\n");
-+ continue;
-+ }
-+ createinfo.uid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct passwd *pw;
-+ /* must be a name */
-+ pw = getpwnam(w+6);
-+ if (pw)
-+ createinfo.uid = pw->pw_uid;
-+ else
-+ fprintf(stderr, Name ": CREATE user %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "group=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing group name\n");
-+ continue;
-+ }
-+ createinfo.gid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct group *gr;
-+ /* must be a name */
-+ gr = getgrnam(w+6);
-+ if (gr)
-+ createinfo.gid = gr->gr_gid;
-+ else
-+ fprintf(stderr, Name ": CREATE group %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "mode=", 5) == 0) {
-+ if (w[5] == 0) {
-+ fprintf(stderr, Name ": missing CREATE mode\n");
-+ continue;
-+ }
-+ createinfo.mode = strtoul(w+5, &ep, 8);
-+ if (*ep != 0) {
-+ createinfo.mode = 0600;
-+ fprintf(stderr, Name ": unrecognised CREATE mode %s\n",
-+ w+5);
-+ }
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata to use by default */
-+ int i;
-+ for (i=0; superlist[i] && !createinfo.supertype; i++)
-+ createinfo.supertype =
-+ superlist[i]->match_metadata_desc(w+9);
-+ if (!createinfo.supertype)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignoring\n",
-+ w+9);
-+ } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
-+ createinfo.symlinks = 1;
-+ else if (strncasecmp(w, "symlinks=no", 11) == 0)
-+ createinfo.symlinks = 0;
-+ else {
-+ fprintf(stderr, Name ": unrecognised word on CREATE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+void devline(char *line)
-+{
-+ char *w;
-+ struct conf_dev *cd;
-+
-+ for (w=dl_next(line); w != line; w=dl_next(w)) {
-+ if (w[0] == '/' || strcasecmp(w, "partitions") == 0) {
-+ cd = malloc(sizeof(*cd));
-+ cd->name = strdup(w);
-+ cd->next = cdevlist;
-+ cdevlist = cd;
-+ } else {
-+ fprintf(stderr, Name ": unreconised word on DEVICE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+mddev_ident_t mddevlist = NULL;
-+mddev_ident_t *mddevlp = &mddevlist;
-+
-+void arrayline(char *line)
-+{
-+ char *w;
-+
-+ struct mddev_ident_s mis;
-+ mddev_ident_t mi;
-+
-+ mis.uuid_set = 0;
-+ mis.super_minor = UnSet;
-+ mis.level = UnSet;
-+ mis.raid_disks = UnSet;
-+ mis.spare_disks = 0;
-+ mis.devices = NULL;
-+ mis.devname = NULL;
-+ mis.spare_group = NULL;
-+ mis.autof = 0;
-+ mis.next = NULL;
-+ mis.st = NULL;
-+ mis.bitmap_fd = -1;
-+ mis.bitmap_file = NULL;
-+ mis.name[0] = 0;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (w[0] == '/') {
-+ if (mis.devname)
-+ fprintf(stderr, Name ": only give one device per ARRAY line: %s and %s\n",
-+ mis.devname, w);
-+ else mis.devname = w;
-+ } else if (strncasecmp(w, "uuid=", 5)==0 ) {
-+ if (mis.uuid_set)
-+ fprintf(stderr, Name ": only specify uuid once, %s ignored.\n",
-+ w);
-+ else {
-+ if (parse_uuid(w+5, mis.uuid))
-+ mis.uuid_set = 1;
-+ else
-+ fprintf(stderr, Name ": bad uuid: %s\n", w);
-+ }
-+ } else if (strncasecmp(w, "super-minor=", 12)==0 ) {
-+ if (mis.super_minor != UnSet)
-+ fprintf(stderr, Name ": only specify super-minor once, %s ignored.\n",
-+ w);
-+ else {
-+ char *endptr;
-+ mis.super_minor= strtol(w+12, &endptr, 10);
-+ if (w[12]==0 || endptr[0]!=0 || mis.super_minor < 0) {
-+ fprintf(stderr, Name ": invalid super-minor number: %s\n",
-+ w);
-+ mis.super_minor = UnSet;
-+ }
-+ }
-+ } else if (strncasecmp(w, "name=", 5)==0) {
-+ if (mis.name[0])
-+ fprintf(stderr, Name ": only specify name once, %s ignored.\n",
-+ w);
-+ else if (strlen(w+5) > 32)
-+ fprintf(stderr, Name ": name too long, ignoring %s\n", w);
-+ else
-+ strcpy(mis.name, w+5);
-+
-+ } else if (strncasecmp(w, "bitmap=", 7) == 0) {
-+ if (mis.bitmap_file)
-+ fprintf(stderr, Name ": only specify bitmap file once. %s ignored\n",
-+ w);
-+ else
-+ mis.bitmap_file = strdup(w+7);
-+
-+ } else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
-+ if (mis.devices)
-+ fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
-+ w);
-+ else
-+ mis.devices = strdup(w+8);
-+ } else if (strncasecmp(w, "spare-group=", 12) == 0 ) {
-+ if (mis.spare_group)
-+ fprintf(stderr, Name ": only specify one spare group per array. %s ignored.\n",
-+ w);
-+ else
-+ mis.spare_group = strdup(w+12);
-+ } else if (strncasecmp(w, "level=", 6) == 0 ) {
-+ /* this is mainly for compatability with --brief output */
-+ mis.level = map_name(pers, w+6);
-+ } else if (strncasecmp(w, "disks=", 6) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+6);
-+ } else if (strncasecmp(w, "num-devices=", 12) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+12);
-+ } else if (strncasecmp(w, "spares=", 7) == 0 ) {
-+ /* for warning if not all spares present */
-+ mis.spare_disks = atoi(w+7);
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata on the devices. */
-+ int i;
-+
-+ for(i=0; superlist[i] && !mis.st; i++)
-+ mis.st = superlist[i]->match_metadata_desc(w+9);
-+
-+ if (!mis.st)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignored.\n", w+9);
-+ } else if (strncasecmp(w, "auto=", 5) == 0 ) {
-+ /* whether to create device special files as needed */
-+ mis.autof = parse_auto(w+5, "auto type", 0);
-+ } else {
-+ fprintf(stderr, Name ": unrecognised word on ARRAY line: %s\n",
-+ w);
-+ }
-+ }
-+ if (mis.devname == NULL)
-+ fprintf(stderr, Name ": ARRAY line with no device\n");
-+ else if (mis.uuid_set == 0 && mis.devices == NULL && mis.super_minor == UnSet && mis.name[0] == 0)
-+ fprintf(stderr, Name ": ARRAY line %s has no identity information.\n", mis.devname);
-+ else {
-+ mi = malloc(sizeof(*mi));
-+ *mi = mis;
-+ mi->devname = strdup(mis.devname);
-+ mi->next = NULL;
-+ *mddevlp = mi;
-+ mddevlp = &mi->next;
-+ }
-+}
-+
-+static char *alert_email = NULL;
-+void mailline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_email == NULL)
-+ alert_email = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess address on MAIL line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *alert_mail_from = NULL;
-+void mailfromline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_mail_from == NULL)
-+ alert_mail_from = strdup(w);
-+ else {
-+ char *t= NULL;
-+ asprintf(&t, "%s %s", alert_mail_from, w);
-+ free(alert_mail_from);
-+ alert_mail_from = t;
-+ }
-+ }
-+}
-+
-+
-+static char *alert_program = NULL;
-+void programline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_program == NULL)
-+ alert_program = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess program on PROGRAM line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *home_host = NULL;
-+void homehostline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (home_host == NULL)
-+ home_host = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess host name on HOMEHOST line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+
-+int loaded = 0;
-+
-+static char *conffile = NULL;
-+void set_conffile(char *file)
-+{
-+ conffile = file;
-+}
-+
-+void load_conffile(void)
-+{
-+ FILE *f;
-+ char *line;
-+
-+ if (loaded) return;
-+ if (conffile == NULL)
-+ conffile = DefaultConfFile;
-+
-+ if (strcmp(conffile, "none") == 0) {
-+ loaded = 1;
-+ return;
-+ }
-+ if (strcmp(conffile, "partitions")==0) {
-+ char *list = dl_strdup("DEV");
-+ dl_init(list);
-+ dl_add(list, dl_strdup("partitions"));
-+ devline(list);
-+ free_line(list);
-+ loaded = 1;
-+ return;
-+ }
-+ f = fopen(conffile, "r");
-+ /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
-+ * To allow Debian users to compile from clean source and still
-+ * have a working mdadm, we read /etc/mdadm/mdadm.conf
-+ * if /etc/mdadm.conf doesn't exist
-+ */
-+ if (f == NULL &&
-+ conffile == DefaultConfFile) {
-+ f = fopen(DefaultAltConfFile, "r");
-+ if (f)
-+ conffile = DefaultAltConfFile;
-+ }
-+ if (f == NULL)
-+ return;
-+
-+ loaded = 1;
-+ while ((line=conf_line(f))) {
-+ switch(match_keyword(line)) {
-+ case Devices:
-+ devline(line);
-+ break;
-+ case Array:
-+ arrayline(line);
-+ break;
-+ case Mailaddr:
-+ mailline(line);
-+ break;
-+ case Mailfrom:
-+ mailfromline(line);
-+ break;
-+ case Program:
-+ programline(line);
-+ break;
-+ case CreateDev:
-+ createline(line);
-+ break;
-+ case Homehost:
-+ homehostline(line);
-+ break;
-+ default:
-+ fprintf(stderr, Name ": Unknown keyword %s\n", line);
-+ }
-+ free_line(line);
-+ }
-+
-+ fclose(f);
-+
-+/* printf("got file\n"); */
-+}
-+
-+char *conf_get_mailaddr(void)
-+{
-+ load_conffile();
-+ return alert_email;
-+}
-+
-+char *conf_get_mailfrom(void)
-+{
-+ load_conffile();
-+ return alert_mail_from;
-+}
-+
-+char *conf_get_program(void)
-+{
-+ load_conffile();
-+ return alert_program;
-+}
-+
-+char *conf_get_homehost(void)
-+{
-+ load_conffile();
-+ return home_host;
-+}
-+
-+struct createinfo *conf_get_create_info(void)
-+{
-+ load_conffile();
-+ return &createinfo;
-+}
-+
-+mddev_ident_t conf_get_ident(char *dev)
-+{
-+ mddev_ident_t rv;
-+ load_conffile();
-+ rv = mddevlist;
-+ while (dev && rv && strcmp(dev, rv->devname)!=0)
-+ rv = rv->next;
-+ return rv;
-+}
-+
-+mddev_dev_t conf_get_devs()
-+{
-+ glob_t globbuf;
-+ struct conf_dev *cd;
-+ int flags = 0;
-+ static mddev_dev_t dlist = NULL;
-+ unsigned int i;
-+
-+ while (dlist) {
-+ mddev_dev_t t = dlist;
-+ dlist = dlist->next;
-+ free(t->devname);
-+ free(t);
-+ }
-+
-+ load_conffile();
-+
-+ if (cdevlist == NULL)
-+ /* default to 'partitions */
-+ dlist = load_partitions();
-+
-+ for (cd=cdevlist; cd; cd=cd->next) {
-+ if (strcasecmp(cd->name, "partitions")==0 && dlist == NULL)
-+ dlist = load_partitions();
-+ else {
-+ glob(cd->name, flags, NULL, &globbuf);
-+ flags |= GLOB_APPEND;
-+ }
-+ }
-+ if (flags & GLOB_APPEND) {
-+ for (i=0; i<globbuf.gl_pathc; i++) {
-+ mddev_dev_t t = malloc(sizeof(*t));
-+ t->devname = strdup(globbuf.gl_pathv[i]);
-+ t->next = dlist;
-+ t->used = 0;
-+ dlist = t;
-+/* printf("one dev is %s\n", t->devname);*/
-+ }
-+ globfree(&globbuf);
-+ }
-+
-+ return dlist;
-+}
-+
-+int conf_test_dev(char *devname)
-+{
-+ struct conf_dev *cd;
-+ if (cdevlist == NULL)
-+ /* allow anything by default */
-+ return 1;
-+ for (cd = cdevlist ; cd ; cd = cd->next) {
-+ if (strcasecmp(cd->name, "partitions") == 0)
-+ return 1;
-+ if (fnmatch(cd->name, devname, FNM_PATHNAME) == 0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+
-+int match_oneof(char *devices, char *devname)
-+{
-+ /* check if one of the comma separated patterns in devices
-+ * matches devname
-+ */
-+
-+
-+ while (devices && *devices) {
-+ char patn[1024];
-+ char *p = devices;
-+ devices = strchr(devices, ',');
-+ if (!devices)
-+ devices = p + strlen(p);
-+ if (devices-p < 1024) {
-+ strncpy(patn, p, devices-p);
-+ patn[devices-p] = 0;
-+ if (fnmatch(patn, devname, FNM_PATHNAME)==0)
-+ return 1;
-+ }
-+ if (*devices == ',')
-+ devices++;
-+ }
-+ return 0;
-+}
---- a/mdadm/Config.in 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/Config.in 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,15 @@
-+#
-+# For a description of the syntax of this configuration file,
-+# see scripts/kbuild/config-language.txt.
-+#
-+
-+menu "Linux mdadm Utilities"
-+
-+config MDADM
-+ bool "mdadm"
-+ default n
-+ help
-+ assemble or examine raid array
-+
-+endmenu
-+
---- a/mdadm/dlink.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/dlink.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,79 @@
-+
-+/* doubly linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+#include <unistd.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#ifdef __dietlibc__
-+char *strncpy(char *dest, const char *src, size_t n) __THROW;
-+#endif
-+#include "dlink.h"
-+
-+
-+void *dl_head()
-+{
-+ void *h;
-+ h = dl_alloc(0);
-+ dl_next(h) = h;
-+ dl_prev(h) = h;
-+ return h;
-+}
-+
-+void dl_free(void *v)
-+{
-+ struct __dl_head *vv = v;
-+ free(vv-1);
-+}
-+
-+void dl_init(void *v)
-+{
-+ dl_next(v) = v;
-+ dl_prev(v) = v;
-+}
-+
-+void dl_insert(void *head, void *val)
-+{
-+ dl_next(val) = dl_next(head);
-+ dl_prev(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_add(void *head, void *val)
-+{
-+ dl_prev(val) = dl_prev(head);
-+ dl_next(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_del(void *val)
-+{
-+ if (dl_prev(val) == 0 || dl_next(val) == 0)
-+ return;
-+ dl_prev(dl_next(val)) = dl_prev(val);
-+ dl_next(dl_prev(val)) = dl_next(val);
-+ dl_prev(val) = dl_next(val) = 0;
-+}
-+
-+char *dl_strndup(char *s, int l)
-+{
-+ char *n;
-+ if (s == NULL)
-+ return NULL;
-+ n = dl_newv(char, l+1);
-+ if (n == NULL)
-+ return NULL;
-+ else
-+ {
-+ strncpy(n, s, l);
-+ n[l] = 0;
-+ return n;
-+ }
-+}
-+
-+char *dl_strdup(char *s)
-+{
-+ return dl_strndup(s, (int)strlen(s));
-+}
---- a/mdadm/dlink.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/dlink.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,25 @@
-+
-+/* doubley linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+struct __dl_head
-+{
-+ void * dh_prev;
-+ void * dh_next;
-+};
-+
-+#define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
-+#define dl_new(t) ((t*)dl_alloc(sizeof(t)))
-+#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n))
-+
-+#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next))
-+#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
-+
-+void *dl_head(void);
-+char *dl_strdup(char *);
-+char *dl_strndup(char *, int);
-+void dl_insert(void*, void*);
-+void dl_add(void*, void*);
-+void dl_del(void*);
-+void dl_free(void*);
-+void dl_init(void*);
---- a/mdadm/Kbuild 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/Kbuild 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,9 @@
-+# Makefile for busybox
-+#
-+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
-+#
-+# Licensed under the GPL v2, see the file LICENSE in this tarball.
-+
-+lib-y:=
-+MDADM-y:= config.o util.o dlink.o sha1.o super0.o super1.o mdexamine.o mdassemble.o
-+lib-$(CONFIG_MDADM) += mdadm.o $(MDADM-y)
---- a/mdadm/md5.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/md5.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,134 @@
-+/* Declaration of functions and data types used for MD5 sum computing
-+ library functions.
-+ Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc.
-+
-+ NOTE: The canonical source of this file is maintained with the GNU C
-+ Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+#ifndef _MD5_H
-+#define _MD5_H 1
-+
-+#include <stdio.h>
-+
-+# include <inttypes.h>
-+#if HAVE_STDINT_H || _LIBC
-+# include <stdint.h>
-+#endif
-+
-+#ifndef __GNUC_PREREQ
-+# if defined __GNUC__ && defined __GNUC_MINOR__
-+# define __GNUC_PREREQ(maj, min) \
-+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-+# else
-+# define __GNUC_PREREQ(maj, min) 0
-+# endif
-+#endif
-+
-+#ifndef __THROW
-+# if defined __cplusplus && __GNUC_PREREQ (2,8)
-+# define __THROW throw ()
-+# else
-+# define __THROW
-+# endif
-+#endif
-+
-+#ifndef __attribute__
-+# if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
-+# define __attribute__(x)
-+# endif
-+#endif
-+
-+#ifndef _LIBC
-+# define __md5_buffer md5_buffer
-+# define __md5_finish_ctx md5_finish_ctx
-+# define __md5_init_ctx md5_init_ctx
-+# define __md5_process_block md5_process_block
-+# define __md5_process_bytes md5_process_bytes
-+# define __md5_read_ctx md5_read_ctx
-+# define __md5_stream md5_stream
-+#endif
-+
-+typedef uint32_t md5_uint32;
-+
-+/* Structure to save state of computation between the single steps. */
-+struct md5_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+/*
-+ * The following three functions are build up the low level used in
-+ * the functions `md5_stream' and `md5_buffer'.
-+ */
-+
-+/* Initialize structure containing state of computation.
-+ (RFC 1321, 3.3: Step 3) */
-+extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void __md5_process_block (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void __md5_process_bytes (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 16 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Put result from CTX in first 16 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Compute MD5 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+extern int __md5_stream (FILE *stream, void *resblock) __THROW;
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *__md5_buffer (const char *buffer, size_t len,
-+ void *resblock) __THROW;
-+
-+#endif /* md5.h */
---- a/mdadm/mdadm.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/mdadm.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,18 @@
-+/*
-+ * mdadm support for busybox.
-+ * added by Alan Hourihane <alanh@fairlite.demon.co.uk>
-+ */
-+#include <string.h>
-+
-+extern int mdassemble_main(int argc, char **argv);
-+extern int mdexamine_main(int argc, char **argv);
-+
-+int mdadm_main(int argc, char **argv) {
-+ if (argc >= 2) {
-+ if (!strncmp(argv[1],"--assemble",10))
-+ return mdassemble_main(argc, argv);
-+ if (!strncmp(argv[1],"--examine",9))
-+ return mdexamine_main(argc, argv);
-+ }
-+ return 0;
-+}
---- a/mdadm/mdadm.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/mdadm.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,540 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include <unistd.h>
-+#ifndef __dietlibc__
-+extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
-+#else
-+# if defined(__NO_STAT64) || __WORDSIZE != 32
-+# define lseek64 lseek
-+# endif
-+#endif
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sys/time.h>
-+#include <getopt.h>
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <errno.h>
-+#include <string.h>
-+#include <syslog.h>
-+#ifdef __dietlibc__
-+#include <strings.h>
-+/* dietlibc has deprecated random and srandom!! */
-+#define random rand
-+#define srandom srand
-+#endif
-+
-+
-+#include <linux/kdev_t.h>
-+/*#include <linux/fs.h> */
-+#include <sys/mount.h>
-+#include <asm/types.h>
-+#include <sys/ioctl.h>
-+#define MD_MAJOR 9
-+#define MdpMinorShift 6
-+
-+#ifndef BLKGETSIZE64
-+#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
-+#endif
-+
-+#define DEFAULT_BITMAP_CHUNK 4096
-+#define DEFAULT_BITMAP_DELAY 5
-+#define DEFAULT_MAX_WRITE_BEHIND 256
-+
-+#include "md_u.h"
-+#include "md_p.h"
-+#include "bitmap.h"
-+
-+#include <endian.h>
-+/* Redhat don't like to #include <asm/byteorder.h>, and
-+ * some time include <linux/byteorder/xxx_endian.h> isn't enough,
-+ * and there is no standard conversion function so... */
-+/* And dietlibc doesn't think byteswap is ok, so.. */
-+/* #include <byteswap.h> */
-+#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
-+ ((x) & 0xff00U) >> 8)
-+#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
-+ ((x) & 0xff000000U) >> 24 | \
-+ ((x) & 0x0000ff00U) << 8 | \
-+ ((x) & 0x00ff0000U) >> 8)
-+#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
-+ ((x) & 0xff00000000000000ULL) >> 56 | \
-+ ((x) & 0x000000000000ff00ULL) << 40 | \
-+ ((x) & 0x00ff000000000000ULL) >> 40 | \
-+ ((x) & 0x0000000000ff0000ULL) << 24 | \
-+ ((x) & 0x0000ff0000000000ULL) >> 24 | \
-+ ((x) & 0x00000000ff000000ULL) << 8 | \
-+ ((x) & 0x000000ff00000000ULL) >> 8)
-+
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+#define __cpu_to_le16(_x) (_x)
-+#define __cpu_to_le32(_x) (_x)
-+#define __cpu_to_le64(_x) (_x)
-+#define __le16_to_cpu(_x) (_x)
-+#define __le32_to_cpu(_x) (_x)
-+#define __le64_to_cpu(_x) (_x)
-+#elif BYTE_ORDER == BIG_ENDIAN
-+#define __cpu_to_le16(_x) bswap_16(_x)
-+#define __cpu_to_le32(_x) bswap_32(_x)
-+#define __cpu_to_le64(_x) bswap_64(_x)
-+#define __le16_to_cpu(_x) bswap_16(_x)
-+#define __le32_to_cpu(_x) bswap_32(_x)
-+#define __le64_to_cpu(_x) bswap_64(_x)
-+#else
-+# error "unknown endianness."
-+#endif
-+
-+
-+
-+/* general information that might be extracted from a superblock */
-+struct mdinfo {
-+ mdu_array_info_t array;
-+ mdu_disk_info_t disk;
-+ __u64 events;
-+ int uuid[4];
-+ char name[33];
-+ unsigned long long data_offset;
-+ unsigned long long component_size;
-+ int reshape_active;
-+ unsigned long long reshape_progress;
-+ int new_level, delta_disks, new_layout, new_chunk;
-+};
-+
-+struct createinfo {
-+ int uid;
-+ int gid;
-+ int autof;
-+ int mode;
-+ int symlinks;
-+ struct supertype *supertype;
-+};
-+
-+#define Name "mdadm"
-+
-+enum mode {
-+ ASSEMBLE=1,
-+ BUILD,
-+ CREATE,
-+ MANAGE,
-+ MISC,
-+ MONITOR,
-+ GROW,
-+ INCREMENTAL,
-+ AUTODETECT,
-+};
-+
-+extern char short_options[];
-+extern char short_bitmap_auto_options[];
-+extern struct option long_options[];
-+extern char Version[], Usage[], Help[], OptionHelp[],
-+ Help_create[], Help_build[], Help_assemble[], Help_grow[],
-+ Help_incr[],
-+ Help_manage[], Help_misc[], Help_monitor[], Help_config[];
-+
-+/* for option that don't have short equivilents, we assign arbitrary
-+ * small numbers. '1' means an undecorated option, so we start at '2'.
-+ */
-+enum special_options {
-+ AssumeClean = 2,
-+ BitmapChunk,
-+ WriteBehind,
-+ ReAdd,
-+ NoDegraded,
-+ Sparc22,
-+ BackupFile,
-+ HomeHost,
-+ AutoHomeHost,
-+ Symlinks,
-+ AutoDetect,
-+};
-+
-+/* structures read from config file */
-+/* List of mddevice names and identifiers
-+ * Identifiers can be:
-+ * uuid=128-hex-uuid
-+ * super-minor=decimal-minor-number-from-superblock
-+ * devices=comma,separated,list,of,device,names,with,wildcards
-+ *
-+ * If multiple fields are present, the intersection of all matching
-+ * devices is considered
-+ */
-+#define UnSet (0xfffe)
-+typedef struct mddev_ident_s {
-+ char *devname;
-+
-+ int uuid_set;
-+ int uuid[4];
-+ char name[33];
-+
-+ unsigned int super_minor;
-+
-+ char *devices; /* comma separated list of device
-+ * names with wild cards
-+ */
-+ int level;
-+ unsigned int raid_disks;
-+ unsigned int spare_disks;
-+ struct supertype *st;
-+ int autof; /* 1 for normal, 2 for partitioned */
-+ char *spare_group;
-+ char *bitmap_file;
-+ int bitmap_fd;
-+
-+ struct mddev_ident_s *next;
-+} *mddev_ident_t;
-+
-+/* List of device names - wildcards expanded */
-+typedef struct mddev_dev_s {
-+ char *devname;
-+ char disposition; /* 'a' for add, 'r' for remove, 'f' for fail.
-+ * Not set for names read from .config
-+ */
-+ char writemostly;
-+ char re_add;
-+ char used; /* set when used */
-+ struct mddev_dev_s *next;
-+} *mddev_dev_t;
-+
-+typedef struct mapping {
-+ char *name;
-+ int num;
-+} mapping_t;
-+
-+
-+struct mdstat_ent {
-+ char *dev;
-+ int devnum;
-+ int active;
-+ char *level;
-+ char *pattern; /* U or up, _ for down */
-+ int percent; /* -1 if no resync */
-+ int resync; /* 1 if resync, 0 if recovery */
-+ struct mdstat_ent *next;
-+};
-+
-+extern struct mdstat_ent *mdstat_read(int hold, int start);
-+extern void free_mdstat(struct mdstat_ent *ms);
-+extern void mdstat_wait(int seconds);
-+extern int mddev_busy(int devnum);
-+
-+struct map_ent {
-+ struct map_ent *next;
-+ int devnum;
-+ int major,minor;
-+ int uuid[4];
-+ char *path;
-+};
-+extern int map_update(struct map_ent **mpp, int devnum, int major, int minor,
-+ int uuid[4], char *path);
-+extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]);
-+extern void map_read(struct map_ent **melp);
-+extern int map_write(struct map_ent *mel);
-+extern void map_delete(struct map_ent **mapp, int devnum);
-+extern void map_free(struct map_ent *map);
-+extern void map_add(struct map_ent **melp,
-+ int devnum, int major, int minor, int uuid[4], char *path);
-+
-+/* Data structure for holding info read from sysfs */
-+struct sysdev {
-+ char name[20];
-+ int role;
-+ int major, minor;
-+ unsigned long long offset, size;
-+ int state;
-+ int errors;
-+ struct sysdev *next;
-+};
-+struct sysarray {
-+ char name[20];
-+ struct sysdev *devs;
-+ int chunk;
-+ unsigned long long component_size;
-+ int layout;
-+ int level;
-+ int spares;
-+ int cache_size;
-+ int mismatch_cnt;
-+ int major_version, minor_version;
-+};
-+/* various details can be requested */
-+#define GET_LEVEL 1
-+#define GET_LAYOUT 2
-+#define GET_COMPONENT 4
-+#define GET_CHUNK 8
-+#define GET_CACHE 16
-+#define GET_MISMATCH 32
-+#define GET_VERSION 64
-+
-+#define GET_DEVS 1024 /* gets role, major, minor */
-+#define GET_OFFSET 2048
-+#define GET_SIZE 4096
-+#define GET_STATE 8192
-+#define GET_ERROR 16384
-+
-+/* If fd >= 0, get the array it is open on,
-+ * else use devnum. >=0 -> major9. <0.....
-+ */
-+extern void sysfs_free(struct sysarray *sra);
-+extern struct sysarray *sysfs_read(int fd, int devnum, unsigned long options);
-+extern int sysfs_set_str(struct sysarray *sra, struct sysdev *dev,
-+ char *name, char *val);
-+extern int sysfs_set_num(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long val);
-+extern int sysfs_get_ll(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long *val);
-+
-+
-+extern int save_stripes(int *source, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int nwrites, int *dest,
-+ unsigned long long start, unsigned long long length);
-+extern int restore_stripes(int *dest, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int source, unsigned long long read_offset,
-+ unsigned long long start, unsigned long long length);
-+
-+#ifndef Sendmail
-+#define Sendmail "/usr/lib/sendmail -t"
-+#endif
-+
-+#define SYSLOG_FACILITY LOG_DAEMON
-+
-+extern char *map_num(mapping_t *map, int num);
-+extern int map_name(mapping_t *map, char *name);
-+extern mapping_t r5layout[], pers[], modes[], faultylayout[];
-+
-+extern char *map_dev(int major, int minor, int create);
-+
-+
-+extern struct superswitch {
-+ void (*examine_super)(void *sbv, char *homehost);
-+ void (*brief_examine_super)(void *sbv);
-+ void (*detail_super)(void *sbv, char *homehost);
-+ void (*export_super)(void *sbv);
-+ void (*brief_detail_super)(void *sbv);
-+ void (*uuid_from_super)(int uuid[4], void *sbv);
-+ void (*getinfo_super)(struct mdinfo *info, void *sbv);
-+ int (*match_home)(void *sbv, char *homehost);
-+ int (*update_super)(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost);
-+ int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid);
-+ void (*add_to_super)(void *sbv, mdu_disk_info_t *dinfo);
-+ int (*store_super)(struct supertype *st, int fd, void *sbv);
-+ int (*write_init_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo, char *devname);
-+ int (*compare_super)(void **firstp, void *secondv);
-+ int (*load_super)(struct supertype *st, int fd, void **sbp, char *devname);
-+ struct supertype * (*match_metadata_desc)(char *arg);
-+ __u64 (*avail_size)(struct supertype *st, __u64 size);
-+ int (*add_internal_bitmap)(struct supertype *st, void *sbv, int *chunkp,
-+ int delay, int write_behind,
-+ unsigned long long size, int may_change, int major);
-+ void (*locate_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int (*write_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int major;
-+ int swapuuid; /* true if uuid is bigending rather than hostendian */
-+} super0, super1, *superlist[];
-+
-+struct supertype {
-+ struct superswitch *ss;
-+ int minor_version;
-+ int max_devs;
-+};
-+
-+extern struct supertype *super_by_version(int vers, int minor);
-+extern struct supertype *guess_super(int fd);
-+extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
-+extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
-+ mdu_disk_info_t *disk);
-+
-+#if __GNUC__ < 3
-+struct stat64;
-+#endif
-+
-+#define HAVE_NFTW we assume
-+#define HAVE_FTW
-+
-+#ifdef UCLIBC
-+# include <features.h>
-+# ifndef __UCLIBC_HAS_FTW__
-+# undef HAVE_FTW
-+# undef HAVE_NFTW
-+# endif
-+#endif
-+
-+#ifdef __dietlibc__
-+# undef HAVE_NFTW
-+#endif
-+
-+#ifndef HAVE_NFTW
-+# define FTW_PHYS 1
-+# ifndef HAVE_FTW
-+ struct FTW {};
-+# endif
-+#endif
-+
-+#ifdef HAVE_FTW
-+# include <ftw.h>
-+#endif
-+
-+extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
-+
-+
-+extern int Manage_ro(char *devname, int fd, int readonly);
-+extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
-+extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
-+extern int Manage_reconfig(char *devname, int fd, int layout);
-+extern int Manage_subdevs(char *devname, int fd,
-+ mddev_dev_t devlist, int verbose);
-+extern int autodetect(void);
-+extern int Grow_Add_device(char *devname, int fd, char *newdev);
-+extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force);
-+extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
-+ long long size,
-+ int level, int layout, int chunksize, int raid_disks);
-+extern int Grow_restart(struct supertype *st, struct mdinfo *info,
-+ int *fdlist, int cnt, char *backup_file);
-+
-+
-+extern int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force);
-+
-+extern int Build(char *mddev, int mdfd, int chunk, int level, int layout,
-+ int raiddisks,
-+ mddev_dev_t devlist, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int verbose);
-+
-+
-+extern int Create(struct supertype *st, char *mddev, int mdfd,
-+ int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
-+ char *name, char *homehost, int *uuid,
-+ int subdevs, mddev_dev_t devlist,
-+ int runstop, int verbose, int force, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
-+
-+extern int Detail(char *dev, int brief, int export, int test, char *homehost);
-+extern int Query(char *dev);
-+
-+extern int md_get_version(int fd);
-+extern int get_linux_version(void);
-+extern int parse_uuid(char *str, int uuid[4]);
-+extern int check_ext2(int fd, char *name);
-+extern int check_reiser(int fd, char *name);
-+extern int check_raid(int fd, char *name);
-+
-+extern int get_mdp_major(void);
-+extern int dev_open(char *dev, int flags);
-+extern int is_standard(char *dev, int *nump);
-+
-+extern int parse_auto(char *str, char *msg, int config);
-+extern mddev_ident_t conf_get_ident(char *dev);
-+extern mddev_dev_t conf_get_devs(void);
-+extern int conf_test_dev(char *devname);
-+extern struct createinfo *conf_get_create_info(void);
-+extern void set_conffile(char *file);
-+extern char *conf_get_mailaddr(void);
-+extern char *conf_get_mailfrom(void);
-+extern char *conf_get_program(void);
-+extern char *conf_get_homehost(void);
-+extern char *conf_line(FILE *file);
-+extern char *conf_word(FILE *file, int allow_key);
-+extern void free_line(char *line);
-+extern int match_oneof(char *devices, char *devname);
-+extern void uuid_from_super(int uuid[4], mdp_super_t *super);
-+extern int same_uuid(int a[4], int b[4], int swapuuid);
-+extern void copy_uuid(void *a, int b[4], int swapuuid);
-+/* extern int compare_super(mdp_super_t *first, mdp_super_t *second);*/
-+extern unsigned long calc_csum(void *super, int bytes);
-+extern int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks);
-+extern int ask(char *mesg);
-+extern unsigned long long get_component_size(int fd);
-+extern void remove_partitions(int fd);
-+
-+
-+extern char *human_size(long long bytes);
-+char *human_size_brief(long long bytes);
-+
-+extern void put_md_name(char *name);
-+extern char *get_md_name(int dev);
-+
-+extern char DefaultConfFile[];
-+
-+extern int open_mddev(char *dev, int autof);
-+extern int open_mddev_devnum(char *devname, int devnum, char *name,
-+ char *chosen_name);
-+
-+
-+#define LEVEL_MULTIPATH (-4)
-+#define LEVEL_LINEAR (-1)
-+#define LEVEL_FAULTY (-5)
-+
-+
-+/* faulty stuff */
-+
-+#define WriteTransient 0
-+#define ReadTransient 1
-+#define WritePersistent 2
-+#define ReadPersistent 3
-+#define WriteAll 4 /* doesn't go to device */
-+#define ReadFixable 5
-+#define Modes 6
-+
-+#define ClearErrors 31
-+#define ClearFaults 30
-+
-+#define AllPersist 100 /* internal use only */
-+#define NoPersist 101
-+
-+#define ModeMask 0x1f
-+#define ModeShift 5
-+
-+
-+#ifdef __TINYC__
-+#undef minor
-+#undef major
-+#undef makedev
-+#define minor(x) ((x)&0xff)
-+#define major(x) (((x)>>8)&0xff)
-+#define makedev(M,m) (((M)<<8) | (m))
-+#endif
-+
-+/* for raid5 */
-+#define ALGORITHM_LEFT_ASYMMETRIC 0
-+#define ALGORITHM_RIGHT_ASYMMETRIC 1
-+#define ALGORITHM_LEFT_SYMMETRIC 2
-+#define ALGORITHM_RIGHT_SYMMETRIC 3
---- a/mdadm/mdassemble.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/mdassemble.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,908 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include <ctype.h>
-+
-+static int name_matches(char *found, char *required, char *homehost)
-+{
-+ /* See if the name found matches the required name, possibly
-+ * prefixed with 'homehost'
-+ */
-+ char fnd[33];
-+
-+ strncpy(fnd, found, 32);
-+ fnd[32] = 0;
-+ if (strcmp(found, required)==0)
-+ return 1;
-+ if (homehost) {
-+ int l = strlen(homehost);
-+ if (l < 32 && fnd[l] == ':' &&
-+ strcmp(fnd+l+1, required)==0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+int open_mddev(char *dev, int autof/*unused */)
-+{
-+ int mdfd = open(dev, O_RDWR, 0);
-+ if (mdfd < 0)
-+ fprintf(stderr, Name ": error opening %s: %s\n",
-+ dev, strerror(errno));
-+ else if (md_get_version(mdfd) <= 0) {
-+ fprintf(stderr, Name ": %s does not appear to be an md device\n",
-+ dev);
-+ close(mdfd);
-+ mdfd = -1;
-+ }
-+ return mdfd;
-+}
-+
-+int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force)
-+{
-+ /*
-+ * The task of Assemble is to find a collection of
-+ * devices that should (according to their superblocks)
-+ * form an array, and to give this collection to the MD driver.
-+ * In Linux-2.4 and later, this involves submitting a
-+ * SET_ARRAY_INFO ioctl with no arg - to prepare
-+ * the array - and then submit a number of
-+ * ADD_NEW_DISK ioctls to add disks into
-+ * the array. Finally RUN_ARRAY might
-+ * be submitted to start the array.
-+ *
-+ * Much of the work of Assemble is in finding and/or
-+ * checking the disks to make sure they look right.
-+ *
-+ * If mddev is not set, then scan must be set and we
-+ * read through the config file for dev+uuid mapping
-+ * We recurse, setting mddev, for each device that
-+ * - isn't running
-+ * - has a valid uuid (or any uuid if !uuidset)
-+ *
-+ * If mddev is set, we try to determine state of md.
-+ * check version - must be at least 0.90.0
-+ * check kernel version. must be at least 2.4.
-+ * If not, we can possibly fall back on START_ARRAY
-+ * Try to GET_ARRAY_INFO.
-+ * If possible, give up
-+ * If not, try to STOP_ARRAY just to make sure
-+ *
-+ * If !uuidset and scan, look in conf-file for uuid
-+ * If not found, give up
-+ * If !devlist and scan and uuidset, get list of devs from conf-file
-+ *
-+ * For each device:
-+ * Check superblock - discard if bad
-+ * Check uuid (set if we don't have one) - discard if no match
-+ * Check superblock similarity if we have a superblock - discard if different
-+ * Record events, devicenum
-+ * This should give us a list of devices for the array
-+ * We should collect the most recent event number
-+ *
-+ * Count disks with recent enough event count
-+ * While force && !enough disks
-+ * Choose newest rejected disks, update event count
-+ * mark clean and rewrite superblock
-+ * If recent kernel:
-+ * SET_ARRAY_INFO
-+ * foreach device with recent events : ADD_NEW_DISK
-+ * if runstop == 1 || "enough" disks and runstop==0 -> RUN_ARRAY
-+ * If old kernel:
-+ * Check the device numbers in superblock are right
-+ * update superblock if any changes
-+ * START_ARRAY
-+ *
-+ */
-+ int clean = 0;
-+ int old_linux = 0;
-+ int vers = 0; /* Keep gcc quite - it really is initialised */
-+ void *first_super = NULL, *super = NULL;
-+ struct {
-+ char *devname;
-+ unsigned int major, minor;
-+ unsigned int oldmajor, oldminor;
-+ long long events;
-+ int uptodate;
-+ int state;
-+ int raid_disk;
-+ int disk_nr;
-+ } *devices;
-+ int *best = NULL; /* indexed by raid_disk */
-+ unsigned int bestcnt = 0;
-+ int devcnt = 0;
-+ unsigned int okcnt, sparecnt;
-+ unsigned int req_cnt;
-+ unsigned int i;
-+ int most_recent = 0;
-+ int chosen_drive;
-+ int change = 0;
-+ int inargv = 0;
-+ int bitmap_done;
-+ int start_partial_ok = (runstop >= 0) && (force || devlist==NULL || mdfd < 0);
-+ unsigned int num_devs;
-+ mddev_dev_t tmpdev;
-+ struct mdinfo info;
-+ char *avail;
-+ int nextspare = 0;
-+
-+ if (mdfd < 0)
-+ return 2;
-+
-+ if (get_linux_version() < 2004000)
-+ old_linux = 1;
-+
-+ if (mdfd >= 0) {
-+ vers = md_get_version(mdfd);
-+ if (vers <= 0) {
-+ fprintf(stderr, Name ": %s appears not to be an md device.\n", mddev);
-+ return 1;
-+ }
-+ if (vers < 9000) {
-+ fprintf(stderr, Name ": Assemble requires driver version 0.90.0 or later.\n"
-+ " Upgrade your kernel or try --build\n");
-+ return 1;
-+ }
-+
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &info.array)>=0) {
-+ fprintf(stderr, Name ": device %s already active - cannot assemble it\n",
-+ mddev);
-+ return 1;
-+ }
-+ ioctl(mdfd, STOP_ARRAY, NULL); /* just incase it was started but has no content */
-+ }
-+ /*
-+ * If any subdevs are listed, then any that don't
-+ * match ident are discarded. Remainder must all match and
-+ * become the array.
-+ * If no subdevs, then we scan all devices in the config file, but
-+ * there must be something in the identity
-+ */
-+
-+ if (!devlist &&
-+ ident->uuid_set == 0 &&
-+ ident->super_minor < 0 &&
-+ ident->devices == NULL) {
-+ fprintf(stderr, Name ": No identity information available for %s - cannot assemble.\n",
-+ mddev ? mddev : "further assembly");
-+ return 1;
-+ }
-+ if (devlist == NULL)
-+ devlist = conf_get_devs();
-+ else if (mdfd >= 0)
-+ inargv = 1;
-+
-+ tmpdev = devlist; num_devs = 0;
-+ while (tmpdev) {
-+ if (tmpdev->used)
-+ tmpdev->used = 2;
-+ else
-+ num_devs++;
-+ tmpdev = tmpdev->next;
-+ }
-+ devices = malloc(num_devs * sizeof(*devices));
-+
-+ if (!st && ident->st) st = ident->st;
-+
-+ if (verbose>0)
-+ fprintf(stderr, Name ": looking for devices for %s\n",
-+ mddev ? mddev : "further assembly");
-+
-+ /* first walk the list of devices to find a consistent set
-+ * that match the criterea, if that is possible.
-+ * We flag the one we like with 'used'.
-+ */
-+ for (tmpdev = devlist;
-+ tmpdev;
-+ tmpdev = tmpdev->next) {
-+ char *devname = tmpdev->devname;
-+ int dfd;
-+ struct stat stb;
-+ struct supertype *tst = st;
-+
-+ if (tmpdev->used > 1) continue;
-+
-+ if (ident->devices &&
-+ !match_oneof(ident->devices, devname)) {
-+ if ((inargv && verbose>=0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
-+ continue;
-+ }
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ dfd = dev_open(devname, O_RDONLY|O_EXCL);
-+ if (dfd < 0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": cannot open device %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if (fstat(dfd, &stb)< 0) {
-+ /* Impossible! */
-+ fprintf(stderr, Name ": fstat failed for %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if ((stb.st_mode & S_IFMT) != S_IFBLK) {
-+ fprintf(stderr, Name ": %s is not a block device.\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (!tst && (tst = guess_super(dfd)) == NULL) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": no recogniseable superblock on %s\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (tst->ss->load_super(tst,dfd, &super, NULL)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf( stderr, Name ": no RAID superblock on %s\n",
-+ devname);
-+ } else {
-+ tst->ss->getinfo_super(&info, super);
-+ }
-+ if (dfd >= 0) close(dfd);
-+
-+ if (ident->uuid_set && (!update || strcmp(update, "uuid")!= 0) &&
-+ (!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong uuid.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->name[0] && (!update || strcmp(update, "name")!= 0) &&
-+ (!super || name_matches(info.name, ident->name, homehost)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong name.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->super_minor != UnSet &&
-+ (!super || ident->super_minor != info.array.md_minor)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong super-minor.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->level != UnSet &&
-+ (!super|| ident->level != info.array.level)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong raid level.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->raid_disks != UnSet &&
-+ (!super || ident->raid_disks!= info.array.raid_disks)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s requires wrong number of drives.\n",
-+ devname);
-+ continue;
-+ }
-+ if (mdfd < 0) {
-+ if (tst == NULL || super == NULL)
-+ continue;
-+ if (update == NULL &&
-+ tst->ss->match_home(super, homehost)==0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not built for host %s.\n",
-+ devname, homehost);
-+ /* Auto-assemble, and this is not a usable host */
-+ /* if update != NULL, we are updating the host
-+ * name... */
-+ continue;
-+ }
-+ }
-+ /* If we are this far, then we are nearly commited to this device.
-+ * If the super_block doesn't exist, or doesn't match others,
-+ * then we probably cannot continue
-+ * However if one of the arrays is for the homehost, and
-+ * the other isn't that can disambiguate.
-+ */
-+
-+ if (!super) {
-+ fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
-+ devname);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ if (st == NULL)
-+ st = tst;
-+ if (st->ss != tst->ss ||
-+ st->minor_version != tst->minor_version ||
-+ st->ss->compare_super(&first_super, super) != 0) {
-+ /* Some mismatch. If exactly one array matches this host,
-+ * we can resolve on that one.
-+ * Or, if we are auto assembling, we just ignore the second
-+ * for now.
-+ */
-+ if (mdfd < 0)
-+ continue;
-+ if (homehost) {
-+ int first = st->ss->match_home(first_super, homehost);
-+ int last = tst->ss->match_home(super, homehost);
-+ if (first+last == 1) {
-+ /* We can do something */
-+ if (first) {/* just ignore this one */
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s misses out due to wrong homehost\n",
-+ devname);
-+ continue;
-+ } else { /* reject all those sofar */
-+ mddev_dev_t td;
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s overrides previous devices due to good homehost\n",
-+ devname);
-+ for (td=devlist; td != tmpdev; td=td->next)
-+ if (td->used == 1)
-+ td->used = 0;
-+ tmpdev->used = 1;
-+ continue;
-+ }
-+ }
-+ }
-+ fprintf(stderr, Name ": superblock on %s doesn't match others - assembly aborted\n",
-+ devname);
-+ free(super);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ tmpdev->used = 1;
-+ }
-+
-+ /* Ok, no bad inconsistancy, we can try updating etc */
-+ bitmap_done = 0;
-+ for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) if (tmpdev->used == 1) {
-+ char *devname = tmpdev->devname;
-+ struct stat stb;
-+ /* looks like a good enough match to update the super block if needed */
-+ {
-+ int dfd;
-+ dfd = dev_open(devname, O_RDWR|O_EXCL);
-+
-+ remove_partitions(dfd);
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ st->ss->load_super(st, dfd, &super, NULL);
-+ st->ss->getinfo_super(&info, super);
-+ close(dfd);
-+ }
-+
-+ stat(devname, &stb);
-+
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n",
-+ devname, mddev, info.disk.raid_disk);
-+ devices[devcnt].devname = devname;
-+ devices[devcnt].major = major(stb.st_rdev);
-+ devices[devcnt].minor = minor(stb.st_rdev);
-+ devices[devcnt].oldmajor = info.disk.major;
-+ devices[devcnt].oldminor = info.disk.minor;
-+ devices[devcnt].events = info.events;
-+ devices[devcnt].raid_disk = info.disk.raid_disk;
-+ devices[devcnt].disk_nr = info.disk.number;
-+ devices[devcnt].uptodate = 0;
-+ devices[devcnt].state = info.disk.state;
-+ if (most_recent < devcnt) {
-+ if (devices[devcnt].events
-+ > devices[most_recent].events)
-+ most_recent = devcnt;
-+ }
-+ if (info.array.level == -4)
-+ /* with multipath, the raid_disk from the superblock is meaningless */
-+ i = devcnt;
-+ else
-+ i = devices[devcnt].raid_disk;
-+ if (i+1 == 0) {
-+ if (nextspare < info.array.raid_disks)
-+ nextspare = info.array.raid_disks;
-+ i = nextspare++;
-+ } else {
-+ if (i >= info.array.raid_disks &&
-+ i >= nextspare)
-+ nextspare = i+1;
-+ }
-+ if (i < 10000) {
-+ if (i >= bestcnt) {
-+ unsigned int newbestcnt = i+10;
-+ int *newbest = malloc(sizeof(int)*newbestcnt);
-+ unsigned int c;
-+ for (c=0; c < newbestcnt; c++)
-+ if (c < bestcnt)
-+ newbest[c] = best[c];
-+ else
-+ newbest[c] = -1;
-+ if (best)free(best);
-+ best = newbest;
-+ bestcnt = newbestcnt;
-+ }
-+ if (best[i] >=0 &&
-+ devices[best[i]].events == devices[devcnt].events &&
-+ devices[best[i]].minor != devices[devcnt].minor &&
-+ st->ss->major == 0 &&
-+ info.array.level != -4) {
-+ /* two different devices with identical superblock.
-+ * Could be a mis-detection caused by overlapping
-+ * partitions. fail-safe.
-+ */
-+ fprintf(stderr, Name ": WARNING %s and %s appear"
-+ " to have very similar superblocks.\n"
-+ " If they are really different, "
-+ "please --zero the superblock on one\n"
-+ " If they are the same or overlap,"
-+ " please remove one from %s.\n",
-+ devices[best[i]].devname, devname,
-+ inargv ? "the list" :
-+ "the\n DEVICE list in mdadm.conf"
-+ );
-+ return 1;
-+ }
-+ if (best[i] == -1
-+ || devices[best[i]].events < devices[devcnt].events)
-+ best[i] = devcnt;
-+ }
-+ devcnt++;
-+ }
-+
-+ if (super)
-+ free(super);
-+ super = NULL;
-+
-+ if (update && strcmp(update, "byteorder")==0)
-+ st->minor_version = 90;
-+
-+ if (devcnt == 0) {
-+ fprintf(stderr, Name ": no devices found for %s\n",
-+ mddev);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ st->ss->getinfo_super(&info, first_super);
-+ clean = info.array.state & 1;
-+
-+ /* now we have some devices that might be suitable.
-+ * I wonder how many
-+ */
-+ avail = malloc(info.array.raid_disks);
-+ memset(avail, 0, info.array.raid_disks);
-+ okcnt = 0;
-+ sparecnt=0;
-+ for (i=0; i< bestcnt ;i++) {
-+ int j = best[i];
-+ int event_margin = 1; /* always allow a difference of '1'
-+ * like the kernel does
-+ */
-+ if (j < 0) continue;
-+ /* note: we ignore error flags in multipath arrays
-+ * as they don't make sense
-+ */
-+ if (info.array.level != -4)
-+ if (!(devices[j].state & (1<<MD_DISK_SYNC))) {
-+ if (!(devices[j].state & (1<<MD_DISK_FAULTY)))
-+ sparecnt++;
-+ continue;
-+ }
-+ if (devices[j].events+event_margin >=
-+ devices[most_recent].events) {
-+ devices[j].uptodate = 1;
-+ if (i < info.array.raid_disks) {
-+ okcnt++;
-+ avail[i]=1;
-+ } else
-+ sparecnt++;
-+ }
-+ }
-+ while (force && !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1,
-+ avail, okcnt)) {
-+ /* Choose the newest best drive which is
-+ * not up-to-date, update the superblock
-+ * and add it.
-+ */
-+ int fd;
-+ long long current_events;
-+ chosen_drive = -1;
-+ for (i=0; i<info.array.raid_disks && i < bestcnt; i++) {
-+ int j = best[i];
-+ if (j>=0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ (chosen_drive < 0 ||
-+ devices[j].events > devices[chosen_drive].events))
-+ chosen_drive = j;
-+ }
-+ if (chosen_drive < 0)
-+ break;
-+ current_events = devices[chosen_drive].events;
-+ add_another:
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": forcing event count in %s(%d) from %d upto %d\n",
-+ devices[chosen_drive].devname, devices[chosen_drive].raid_disk,
-+ (int)(devices[chosen_drive].events),
-+ (int)(devices[most_recent].events));
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Couldn't open %s for write - not updating\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock disappeared from %s - not updating.\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ info.events = devices[most_recent].events;
-+ st->ss->update_super(&info, super, "force-one",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ free(super);
-+ continue;
-+ }
-+ close(fd);
-+ devices[chosen_drive].events = devices[most_recent].events;
-+ devices[chosen_drive].uptodate = 1;
-+ avail[chosen_drive] = 1;
-+ okcnt++;
-+ free(super);
-+
-+ /* If there are any other drives of the same vintage,
-+ * add them in as well. We can't lose and we might gain
-+ */
-+ for (i=0; i<info.array.raid_disks && i < bestcnt ; i++) {
-+ int j = best[i];
-+ if (j >= 0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ devices[j].events == current_events) {
-+ chosen_drive = j;
-+ goto add_another;
-+ }
-+ }
-+ }
-+
-+ /* Now we want to look at the superblock which the kernel will base things on
-+ * and compare the devices that we think are working with the devices that the
-+ * superblock thinks are working.
-+ * If there are differences and --force is given, then update this chosen
-+ * superblock.
-+ */
-+ chosen_drive = -1;
-+ super = NULL;
-+ for (i=0; chosen_drive < 0 && i<bestcnt; i++) {
-+ int j = best[i];
-+ int fd;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ chosen_drive = j;
-+ if ((fd=dev_open(devices[j].devname, O_RDONLY|O_EXCL))< 0) {
-+ fprintf(stderr, Name ": Cannot open %s: %s\n",
-+ devices[j].devname, strerror(errno));
-+ return 1;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock has disappeared from %s\n",
-+ devices[j].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+ if (super == NULL) {
-+ fprintf(stderr, Name ": No suitable drives found for %s\n", mddev);
-+ return 1;
-+ }
-+ st->ss->getinfo_super(&info, super);
-+ for (i=0; i<bestcnt; i++) {
-+ int j = best[i];
-+ unsigned int desired_state;
-+
-+ if (i < info.array.raid_disks)
-+ desired_state = (1<<MD_DISK_ACTIVE) | (1<<MD_DISK_SYNC);
-+ else
-+ desired_state = 0;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ info.disk.number = devices[j].disk_nr;
-+ info.disk.raid_disk = i;
-+ info.disk.state = desired_state;
-+
-+ if (devices[j].uptodate &&
-+ st->ss->update_super(&info, super, "assemble", NULL, verbose, 0, NULL)) {
-+ if (force) {
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": "
-+ "clearing FAULTY flag for device %d in %s for %s\n",
-+ j, mddev, devices[j].devname);
-+ change = 1;
-+ } else {
-+ if (verbose >= -1)
-+ fprintf(stderr, Name ": "
-+ "device %d in %s has wrong state in superblock, but %s seems ok\n",
-+ i, mddev, devices[j].devname);
-+ }
-+ }
-+#if 0
-+ if (!devices[j].uptodate &&
-+ !(super.disks[i].state & (1 << MD_DISK_FAULTY))) {
-+ fprintf(stderr, Name ": devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-+ i, mddev);
-+ }
-+#endif
-+ }
-+ if (force && !clean &&
-+ !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt)) {
-+ change += st->ss->update_super(&info, super, "force-array",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+ clean = 1;
-+ }
-+
-+ if (change) {
-+ int fd;
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Could not open %s for write - cannot Assemble array.\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+
-+ /* count number of in-sync devices according to the superblock.
-+ * We must have this number to start the array without -s or -R
-+ */
-+ req_cnt = info.array.working_disks;
-+
-+ /* Almost ready to actually *do* something */
-+ if (!old_linux) {
-+ int rv;
-+ if ((vers % 100) >= 1) { /* can use different versions */
-+ mdu_array_info_t inf;
-+ memset(&inf, 0, sizeof(inf));
-+ inf.major_version = st->ss->major;
-+ inf.minor_version = st->minor_version;
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, &inf);
-+ } else
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, NULL);
-+
-+ if (rv) {
-+ fprintf(stderr, Name ": SET_ARRAY_INFO failed for %s: %s\n",
-+ mddev, strerror(errno));
-+ return 1;
-+ }
-+ if (ident->bitmap_fd >= 0) {
-+ if (ioctl(mdfd, SET_BITMAP_FILE, ident->bitmap_fd) != 0) {
-+ fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
-+ return 1;
-+ }
-+ } else if (ident->bitmap_file) {
-+ /* From config file */
-+ int bmfd = open(ident->bitmap_file, O_RDWR);
-+ if (bmfd < 0) {
-+ fprintf(stderr, Name ": Could not open bitmap file %s\n",
-+ ident->bitmap_file);
-+ return 1;
-+ }
-+ if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
-+ fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
-+ close(bmfd);
-+ return 1;
-+ }
-+ close(bmfd);
-+ }
-+
-+ /* First, add the raid disks, but add the chosen one last */
-+ for (i=0; i<= bestcnt; i++) {
-+ int j;
-+ if (i < bestcnt) {
-+ j = best[i];
-+ if (j == chosen_drive)
-+ continue;
-+ } else
-+ j = chosen_drive;
-+
-+ if (j >= 0 /* && devices[j].uptodate */) {
-+ mdu_disk_info_t disk;
-+ memset(&disk, 0, sizeof(disk));
-+ disk.major = devices[j].major;
-+ disk.minor = devices[j].minor;
-+ if (ioctl(mdfd, ADD_NEW_DISK, &disk)!=0) {
-+ fprintf(stderr, Name ": failed to add %s to %s: %s\n",
-+ devices[j].devname,
-+ mddev,
-+ strerror(errno));
-+ if (i < info.array.raid_disks || i == bestcnt)
-+ okcnt--;
-+ else
-+ sparecnt--;
-+ } else if (verbose > 0)
-+ fprintf(stderr, Name ": added %s to %s as %d\n",
-+ devices[j].devname, mddev, devices[j].raid_disk);
-+ } else if (verbose > 0 && i < info.array.raid_disks)
-+ fprintf(stderr, Name ": no uptodate device for slot %d of %s\n",
-+ i, mddev);
-+ }
-+
-+ if (runstop == 1 ||
-+ (runstop <= 0 &&
-+ ( enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean, avail, okcnt) &&
-+ (okcnt >= req_cnt || start_partial_ok)
-+ ))) {
-+ if (ioctl(mdfd, RUN_ARRAY, NULL)==0) {
-+ if (verbose >= 0) {
-+ fprintf(stderr, Name ": %s has been started with %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt < info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ fprintf(stderr, ".\n");
-+ }
-+ return 0;
-+ }
-+ fprintf(stderr, Name ": failed to RUN_ARRAY %s: %s\n",
-+ mddev, strerror(errno));
-+
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array while not clean "
-+ "- consider --force.\n");
-+
-+ return 1;
-+ }
-+ if (runstop == -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt != info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ fprintf(stderr, ", but not started.\n");
-+ return 0;
-+ }
-+ if (verbose >= -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s");
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, " - not enough to start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, " - not enough to start the "
-+ "array while not clean - consider "
-+ "--force.\n");
-+ else {
-+ if (req_cnt == info.array.raid_disks)
-+ fprintf(stderr, " - need all %d to start it", req_cnt);
-+ else
-+ fprintf(stderr, " - need %d of %d to start", req_cnt, info.array.raid_disks);
-+ fprintf(stderr, " (use --run to insist).\n");
-+ }
-+ }
-+ return 1;
-+ } else {
-+ /* The "chosen_drive" is a good choice, and if necessary, the superblock has
-+ * been updated to point to the current locations of devices.
-+ * so we can just start the array
-+ */
-+ unsigned long dev;
-+ dev = makedev(devices[chosen_drive].major,
-+ devices[chosen_drive].minor);
-+ if (ioctl(mdfd, START_ARRAY, dev)) {
-+ fprintf(stderr, Name ": Cannot start array: %s\n",
-+ strerror(errno));
-+ }
-+
-+ }
-+ return 0;
-+}
-+
-+int mdfd = -1;
-+int runstop = 0;
-+int readonly = 0;
-+int verbose = 0;
-+int force = 0;
-+
-+int mdassemble_main(int argc, char **argv) {
-+ mddev_ident_t array_list = conf_get_ident(NULL);
-+ int minor;
-+ if (!array_list) {
-+ fprintf(stderr, Name ": No arrays found in config file\n");
-+ return 1;
-+ } else {
-+ for (; array_list; array_list = array_list->next) {
-+ mdu_array_info_t array;
-+ if (!strncmp("/dev/md", array_list->devname, 7)) {
-+ errno = 0;
-+ minor = strtoul(array_list->devname + 7, NULL, 0);
-+ if (!errno) {
-+ mknod(array_list->devname, S_IFBLK|0600, makedev(MD_MAJOR, minor));
-+ }
-+ }
-+ mdfd = open_mddev(array_list->devname, array_list->autof);
-+ if (mdfd < 0) {
-+
-+ fprintf(stderr, Name ": failed to open array\n");
-+ continue;
-+ }
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &array) < 0) {
-+ Assemble(array_list->st, array_list->devname, mdfd,
-+ array_list, NULL, NULL,
-+ readonly, runstop, NULL, NULL, verbose, force);
-+ }
-+ close(mdfd);
-+ }
-+ }
-+ return 0;
-+}
-+
---- a/mdadm/mdexamine.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/mdexamine.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,157 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+
-+#if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN)
-+#error no endian defined
-+#endif
-+#include "md_u.h"
-+#include "md_p.h"
-+
-+static int Examine(mddev_dev_t devlist, int brief, int scan,
-+ int SparcAdjust, struct supertype *forcest,
-+ char *homehost)
-+{
-+
-+ /* Read the raid superblock from a device and
-+ * display important content.
-+ *
-+ * If cannot be found, print reason: too small, bad magic
-+ *
-+ * Print:
-+ * version, ctime, level, size, raid+spare+
-+ * prefered minor
-+ * uuid
-+ *
-+ * utime, state etc
-+ *
-+ * If (brief) gather devices for same array and just print a mdadm.conf line including devices=
-+ * if devlist==NULL, use conf_get_devs()
-+ */
-+ int fd;
-+ void *super = NULL;
-+ int rv = 0;
-+ int err = 0;
-+
-+ struct array {
-+ void *super;
-+ struct supertype *st;
-+ struct mdinfo info;
-+ void *devs;
-+ struct array *next;
-+ int spares;
-+ } *arrays = NULL;
-+
-+ for (; devlist ; devlist=devlist->next) {
-+ struct supertype *st = forcest;
-+
-+ fd = dev_open(devlist->devname, O_RDONLY);
-+ if (fd < 0) {
-+ if (!scan) {
-+ fprintf(stderr,Name ": cannot open %s: %s\n",
-+ devlist->devname, strerror(errno));
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ else {
-+ if (!st)
-+ st = guess_super(fd);
-+ if (st)
-+ err = st->ss->load_super(st, fd, &super, (brief||scan)?NULL:devlist->devname);
-+ else {
-+ if (!brief) {
-+ fprintf(stderr, Name ": No md superblock detected on %s.\n", devlist->devname);
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ close(fd);
-+ }
-+ if (err)
-+ continue;
-+
-+ if (SparcAdjust)
-+ st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0, 0, NULL);
-+ /* Ok, its good enough to try, though the checksum could be wrong */
-+ if (brief) {
-+ struct array *ap;
-+ char *d;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ if (st->ss == ap->st->ss && st->ss->compare_super(&ap->super, super)==0)
-+ break;
-+ }
-+ if (!ap) {
-+ ap = malloc(sizeof(*ap));
-+ ap->super = super;
-+ ap->devs = dl_head();
-+ ap->next = arrays;
-+ ap->spares = 0;
-+ ap->st = st;
-+ arrays = ap;
-+ st->ss->getinfo_super(&ap->info, super);
-+ } else {
-+ st->ss->getinfo_super(&ap->info, super);
-+ free(super);
-+ }
-+ if (!(ap->info.disk.state & MD_DISK_SYNC))
-+ ap->spares++;
-+ d = dl_strdup(devlist->devname);
-+ dl_add(ap->devs, d);
-+ }
-+ }
-+ if (brief) {
-+ struct array *ap;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ char sep='=';
-+ char *d;
-+ ap->st->ss->brief_examine_super(ap->super);
-+ if (ap->spares) printf(" spares=%d", ap->spares);
-+ if (brief > 1) {
-+ printf(" devices");
-+ for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
-+ printf("%c%s", sep, d);
-+ sep=',';
-+ }
-+ }
-+ free(ap->super);
-+ /* FIXME free ap */
-+ if (ap->spares || brief > 1)
-+ printf("\n");
-+ }
-+ }
-+ return rv;
-+}
-+
-+int mdexamine_main(int argc, char **argv) {
-+ return Examine(conf_get_devs(), 1, 0, 0, NULL, NULL);
-+}
-+
---- a/mdadm/md_p.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/md_p.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,194 @@
-+/*
-+ md_p.h : physical layout of Linux RAID devices
-+ Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_P_H
-+#define _MD_P_H
-+
-+/*
-+ * RAID superblock.
-+ *
-+ * The RAID superblock maintains some statistics on each RAID configuration.
-+ * Each real device in the RAID set contains it near the end of the device.
-+ * Some of the ideas are copied from the ext2fs implementation.
-+ *
-+ * We currently use 4096 bytes as follows:
-+ *
-+ * word offset function
-+ *
-+ * 0 - 31 Constant generic RAID device information.
-+ * 32 - 63 Generic state information.
-+ * 64 - 127 Personality specific information.
-+ * 128 - 511 12 32-words descriptors of the disks in the raid set.
-+ * 512 - 911 Reserved.
-+ * 912 - 1023 Disk specific descriptor.
-+ */
-+
-+/*
-+ * If x is the real device size in bytes, we return an apparent size of:
-+ *
-+ * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES
-+ *
-+ * and place the 4kB superblock at offset y.
-+ */
-+#define MD_RESERVED_BYTES (64 * 1024)
-+#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
-+#define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE)
-+
-+#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
-+#define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS)
-+
-+#define MD_SB_BYTES 4096
-+#define MD_SB_WORDS (MD_SB_BYTES / 4)
-+#define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE)
-+#define MD_SB_SECTORS (MD_SB_BYTES / 512)
-+
-+/*
-+ * The following are counted in 32-bit words
-+ */
-+#define MD_SB_GENERIC_OFFSET 0
-+#define MD_SB_PERSONALITY_OFFSET 64
-+#define MD_SB_DISKS_OFFSET 128
-+#define MD_SB_DESCRIPTOR_OFFSET 992
-+
-+#define MD_SB_GENERIC_CONSTANT_WORDS 32
-+#define MD_SB_GENERIC_STATE_WORDS 32
-+#define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS)
-+#define MD_SB_PERSONALITY_WORDS 64
-+#define MD_SB_DESCRIPTOR_WORDS 32
-+#define MD_SB_DISKS 27
-+#define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS)
-+
-+/*
-+ * Device "operational" state bits
-+ */
-+#define MD_DISK_FAULTY 0 /* disk is faulty / operational */
-+#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
-+#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
-+#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
-+
-+#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
-+ * read requests will only be sent here in
-+ * dire need
-+ */
-+
-+typedef struct mdp_device_descriptor_s {
-+ __u32 number; /* 0 Device number in the entire set */
-+ __u32 major; /* 1 Device major number */
-+ __u32 minor; /* 2 Device minor number */
-+ __u32 raid_disk; /* 3 The role of the device in the raid set */
-+ __u32 state; /* 4 Operational state */
-+ __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5];
-+} mdp_disk_t;
-+
-+#define MD_SB_MAGIC 0xa92b4efc
-+
-+/*
-+ * Superblock state bits
-+ */
-+#define MD_SB_CLEAN 0
-+#define MD_SB_ERRORS 1
-+
-+#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
-+
-+typedef struct mdp_superblock_s {
-+ /*
-+ * Constant generic information
-+ */
-+ __u32 md_magic; /* 0 MD identifier */
-+ __u32 major_version; /* 1 major version to which the set conforms */
-+ __u32 minor_version; /* 2 minor version ... */
-+ __u32 patch_version; /* 3 patchlevel version ... */
-+ __u32 gvalid_words; /* 4 Number of used words in this section */
-+ __u32 set_uuid0; /* 5 Raid set identifier */
-+ __u32 ctime; /* 6 Creation time */
-+ __u32 level; /* 7 Raid personality */
-+ __u32 size; /* 8 Apparent size of each individual disk */
-+ __u32 nr_disks; /* 9 total disks in the raid set */
-+ __u32 raid_disks; /* 10 disks in a fully functional raid set */
-+ __u32 md_minor; /* 11 preferred MD minor device number */
-+ __u32 not_persistent; /* 12 does it have a persistent superblock */
-+ __u32 set_uuid1; /* 13 Raid set identifier #2 */
-+ __u32 set_uuid2; /* 14 Raid set identifier #3 */
-+ __u32 set_uuid3; /* 15 Raid set identifier #4 */
-+ __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16];
-+
-+ /*
-+ * Generic state information
-+ */
-+ __u32 utime; /* 0 Superblock update time */
-+ __u32 state; /* 1 State bits (clean, ...) */
-+ __u32 active_disks; /* 2 Number of currently active disks */
-+ __u32 working_disks; /* 3 Number of working disks */
-+ __u32 failed_disks; /* 4 Number of failed disks */
-+ __u32 spare_disks; /* 5 Number of spare disks */
-+ __u32 sb_csum; /* 6 checksum of the whole superblock */
-+#if __BYTE_ORDER == __BIG_ENDIAN
-+ __u32 events_hi; /* 7 high-order of superblock update count */
-+ __u32 events_lo; /* 8 low-order of superblock update count */
-+ __u32 cp_events_hi; /* 9 high-order of checkpoint update count */
-+ __u32 cp_events_lo; /* 10 low-order of checkpoint update count */
-+#else
-+ __u32 events_lo; /* 7 low-order of superblock update count */
-+ __u32 events_hi; /* 8 high-order of superblock update count */
-+ __u32 cp_events_lo; /* 9 low-order of checkpoint update count */
-+ __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
-+#endif
-+ __u32 recovery_cp; /* 11 recovery checkpoint sector count */
-+ /* There are only valid for minor_version > 90 */
-+ __u64 reshape_position; /* 12,13 next address in array-space for reshape */
-+ __u32 new_level; /* 14 new level we are reshaping to */
-+ __u32 delta_disks; /* 15 change in number of raid_disks */
-+ __u32 new_layout; /* 16 new layout */
-+ __u32 new_chunk; /* 17 new chunk size (bytes) */
-+ __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
-+
-+ /*
-+ * Personality information
-+ */
-+ __u32 layout; /* 0 the array's physical layout */
-+ __u32 chunk_size; /* 1 chunk size in bytes */
-+ __u32 root_pv; /* 2 LV root PV */
-+ __u32 root_block; /* 3 LV root block */
-+ __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4];
-+
-+ /*
-+ * Disks information
-+ */
-+ mdp_disk_t disks[MD_SB_DISKS];
-+
-+ /*
-+ * Reserved
-+ */
-+ __u32 reserved[MD_SB_RESERVED_WORDS];
-+
-+ /*
-+ * Active descriptor
-+ */
-+ mdp_disk_t this_disk;
-+
-+} mdp_super_t;
-+
-+#ifdef __TINYC__
-+typedef unsigned long long __u64;
-+#endif
-+
-+static inline __u64 md_event(mdp_super_t *sb) {
-+ __u64 ev = sb->events_hi;
-+ return (ev<<32)| sb->events_lo;
-+}
-+
-+#endif
-+
---- a/mdadm/md_u.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/md_u.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,123 @@
-+/*
-+ md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
-+ Copyright (C) 1998 Ingo Molnar
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_U_H
-+#define _MD_U_H
-+
-+/* ioctls */
-+
-+/* status */
-+#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
-+#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
-+#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
-+#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
-+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
-+#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
-+
-+/* configuration */
-+#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
-+#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
-+#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
-+#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
-+#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
-+#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
-+#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
-+#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
-+#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
-+#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
-+#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
-+
-+/* usage */
-+#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
-+#define START_ARRAY _IO (MD_MAJOR, 0x31)
-+#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
-+#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
-+#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
-+
-+typedef struct mdu_version_s {
-+ int major;
-+ int minor;
-+ int patchlevel;
-+} mdu_version_t;
-+
-+typedef struct mdu_array_info_s {
-+ /*
-+ * Generic constant information
-+ */
-+ int major_version;
-+ int minor_version;
-+ int patch_version;
-+ int ctime;
-+ int level;
-+ int size;
-+ int nr_disks;
-+ int raid_disks;
-+ int md_minor;
-+ int not_persistent;
-+
-+ /*
-+ * Generic state information
-+ */
-+ int utime; /* 0 Superblock update time */
-+ int state; /* 1 State bits (clean, ...) */
-+ int active_disks; /* 2 Number of currently active disks */
-+ int working_disks; /* 3 Number of working disks */
-+ int failed_disks; /* 4 Number of failed disks */
-+ int spare_disks; /* 5 Number of spare disks */
-+
-+ /*
-+ * Personality information
-+ */
-+ int layout; /* 0 the array's physical layout */
-+ int chunk_size; /* 1 chunk size in bytes */
-+
-+} mdu_array_info_t;
-+
-+typedef struct mdu_disk_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int number;
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_disk_info_t;
-+
-+typedef struct mdu_start_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_start_info_t;
-+
-+typedef struct mdu_bitmap_file_s
-+{
-+ char pathname[4096];
-+} mdu_bitmap_file_t;
-+
-+typedef struct mdu_param_s
-+{
-+ int personality; /* 1,2,3,4 */
-+ int chunk_size; /* in bytes */
-+ int max_fault; /* unused for now */
-+} mdu_param_t;
-+
-+#endif
-+
---- a/mdadm/sha1.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/sha1.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,423 @@
-+/* sha1.c - Functions to compute SHA1 message digest of files or
-+ memory blocks according to the NIST specification FIPS-180-1.
-+
-+ Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+/* Written by Scott G. Miller
-+ Credits:
-+ Robert Klep <robert@ilse.nl> -- Expansion function fix
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "sha1.h"
-+
-+#include <stddef.h>
-+#include <string.h>
-+
-+#if USE_UNLOCKED_IO
-+# include "unlocked-io.h"
-+#endif
-+
-+/* SWAP does an endian swap on architectures that are little-endian,
-+ as SHA1 needs some data in a big-endian form. */
-+
-+#ifdef WORDS_BIGENDIAN
-+# define SWAP(n) (n)
-+#else
-+# define SWAP(n) \
-+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-+#endif
-+
-+#define BLOCKSIZE 4096
-+#if BLOCKSIZE % 64 != 0
-+# error "invalid BLOCKSIZE"
-+#endif
-+
-+/* This array contains the bytes used to pad the buffer to the next
-+ 64-byte boundary. (RFC 1321, 3.1: Step 1) */
-+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-+
-+
-+/*
-+ Takes a pointer to a 160 bit block of data (five 32 bit ints) and
-+ intializes it to the start constants of the SHA1 algorithm. This
-+ must be called before using hash in the call to sha1_hash.
-+*/
-+void
-+sha1_init_ctx (struct sha1_ctx *ctx)
-+{
-+ ctx->A = 0x67452301;
-+ ctx->B = 0xefcdab89;
-+ ctx->C = 0x98badcfe;
-+ ctx->D = 0x10325476;
-+ ctx->E = 0xc3d2e1f0;
-+
-+ ctx->total[0] = ctx->total[1] = 0;
-+ ctx->buflen = 0;
-+}
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result
-+ must be in little endian byte order.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
-+{
-+ ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
-+ ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
-+ ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
-+ ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
-+ ((md5_uint32 *) resbuf)[4] = SWAP (ctx->E);
-+
-+ return resbuf;
-+}
-+
-+/* Process the remaining bytes in the internal buffer and the usual
-+ prolog according to the standard and write the result to RESBUF.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
-+{
-+ /* Take yet unprocessed bytes into account. */
-+ md5_uint32 bytes = ctx->buflen;
-+ size_t pad;
-+
-+ /* Now count remaining bytes. */
-+ ctx->total[0] += bytes;
-+ if (ctx->total[0] < bytes)
-+ ++ctx->total[1];
-+
-+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
-+ memcpy (&ctx->buffer[bytes], fillbuf, pad);
-+
-+ /* Put the 64-bit file length in *bits* at the end of the buffer. */
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3);
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) |
-+ (ctx->total[0] >> 29));
-+
-+ /* Process last bytes. */
-+ sha1_process_block (ctx->buffer, bytes + pad + 8, ctx);
-+
-+ return sha1_read_ctx (ctx, resbuf);
-+}
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+int
-+sha1_stream (FILE *stream, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+ char buffer[BLOCKSIZE + 72];
-+ size_t sum;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Iterate over full file contents. */
-+ while (1)
-+ {
-+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
-+ computation function processes the whole buffer so that with the
-+ next round of the loop another block can be read. */
-+ size_t n;
-+ sum = 0;
-+
-+ /* Read block. Take care for partial reads. */
-+ while (1)
-+ {
-+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-+
-+ sum += n;
-+
-+ if (sum == BLOCKSIZE)
-+ break;
-+
-+ if (n == 0)
-+ {
-+ /* Check for the error flag IFF N == 0, so that we don't
-+ exit the loop after a partial read due to e.g., EAGAIN
-+ or EWOULDBLOCK. */
-+ if (ferror (stream))
-+ return 1;
-+ goto process_partial_block;
-+ }
-+
-+ /* We've read at least one byte, so ignore errors. But always
-+ check for EOF, since feof may be true even though N > 0.
-+ Otherwise, we could end up calling fread after EOF. */
-+ if (feof (stream))
-+ goto process_partial_block;
-+ }
-+
-+ /* Process buffer with BLOCKSIZE bytes. Note that
-+ BLOCKSIZE % 64 == 0
-+ */
-+ sha1_process_block (buffer, BLOCKSIZE, &ctx);
-+ }
-+
-+ process_partial_block:;
-+
-+ /* Process any remaining bytes. */
-+ if (sum > 0)
-+ sha1_process_bytes (buffer, sum, &ctx);
-+
-+ /* Construct result in desired memory. */
-+ sha1_finish_ctx (&ctx, resblock);
-+ return 0;
-+}
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+void *
-+sha1_buffer (const char *buffer, size_t len, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Process whole buffer but last len % 64 bytes. */
-+ sha1_process_bytes (buffer, len, &ctx);
-+
-+ /* Put result in desired memory area. */
-+ return sha1_finish_ctx (&ctx, resblock);
-+}
-+
-+void
-+sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ /* When we already have some bits in our internal buffer concatenate
-+ both inputs first. */
-+ if (ctx->buflen != 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+ size_t add = 128 - left_over > len ? len : 128 - left_over;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, add);
-+ ctx->buflen += add;
-+
-+ if (ctx->buflen > 64)
-+ {
-+ sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
-+
-+ ctx->buflen &= 63;
-+ /* The regions in the following copy operation cannot overlap. */
-+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
-+ ctx->buflen);
-+ }
-+
-+ buffer = (const char *) buffer + add;
-+ len -= add;
-+ }
-+
-+ /* Process available complete blocks. */
-+ if (len >= 64)
-+ {
-+#if !_STRING_ARCH_unaligned
-+# define alignof(type) offsetof (struct { char c; type x; }, x)
-+# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0)
-+ if (UNALIGNED_P (buffer))
-+ while (len > 64)
-+ {
-+ sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-+ buffer = (const char *) buffer + 64;
-+ len -= 64;
-+ }
-+ else
-+#endif
-+ {
-+ sha1_process_block (buffer, len & ~63, ctx);
-+ buffer = (const char *) buffer + (len & ~63);
-+ len &= 63;
-+ }
-+ }
-+
-+ /* Move remaining bytes in internal buffer. */
-+ if (len > 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, len);
-+ left_over += len;
-+ if (left_over >= 64)
-+ {
-+ sha1_process_block (ctx->buffer, 64, ctx);
-+ left_over -= 64;
-+ memcpy (ctx->buffer, &ctx->buffer[64], left_over);
-+ }
-+ ctx->buflen = left_over;
-+ }
-+}
-+
-+/* --- Code below is the primary difference between md5.c and sha1.c --- */
-+
-+/* SHA1 round constants */
-+#define K1 0x5a827999L
-+#define K2 0x6ed9eba1L
-+#define K3 0x8f1bbcdcL
-+#define K4 0xca62c1d6L
-+
-+/* Round functions. Note that F2 is the same as F4. */
-+#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
-+#define F2(B,C,D) (B ^ C ^ D)
-+#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
-+#define F4(B,C,D) (B ^ C ^ D)
-+
-+/* Process LEN bytes of BUFFER, accumulating context into CTX.
-+ It is assumed that LEN % 64 == 0.
-+ Most of this code comes from GnuPG's cipher/sha1.c. */
-+
-+void
-+sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ const md5_uint32 *words = buffer;
-+ size_t nwords = len / sizeof (md5_uint32);
-+ const md5_uint32 *endp = words + nwords;
-+ md5_uint32 x[16];
-+ md5_uint32 a = ctx->A;
-+ md5_uint32 b = ctx->B;
-+ md5_uint32 c = ctx->C;
-+ md5_uint32 d = ctx->D;
-+ md5_uint32 e = ctx->E;
-+
-+ /* First increment the byte count. RFC 1321 specifies the possible
-+ length of the file up to 2^64 bits. Here we only compute the
-+ number of bytes. Do a double word increment. */
-+ ctx->total[0] += len;
-+ if (ctx->total[0] < len)
-+ ++ctx->total[1];
-+
-+#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
-+
-+#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
-+ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
-+ , (x[I&0x0f] = rol(tm, 1)) )
-+
-+#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \
-+ + F( B, C, D ) \
-+ + K \
-+ + M; \
-+ B = rol( B, 30 ); \
-+ } while(0)
-+
-+ while (words < endp)
-+ {
-+ md5_uint32 tm;
-+ int t;
-+ for (t = 0; t < 16; t++)
-+ {
-+ x[t] = SWAP (*words);
-+ words++;
-+ }
-+
-+ R( a, b, c, d, e, F1, K1, x[ 0] );
-+ R( e, a, b, c, d, F1, K1, x[ 1] );
-+ R( d, e, a, b, c, F1, K1, x[ 2] );
-+ R( c, d, e, a, b, F1, K1, x[ 3] );
-+ R( b, c, d, e, a, F1, K1, x[ 4] );
-+ R( a, b, c, d, e, F1, K1, x[ 5] );
-+ R( e, a, b, c, d, F1, K1, x[ 6] );
-+ R( d, e, a, b, c, F1, K1, x[ 7] );
-+ R( c, d, e, a, b, F1, K1, x[ 8] );
-+ R( b, c, d, e, a, F1, K1, x[ 9] );
-+ R( a, b, c, d, e, F1, K1, x[10] );
-+ R( e, a, b, c, d, F1, K1, x[11] );
-+ R( d, e, a, b, c, F1, K1, x[12] );
-+ R( c, d, e, a, b, F1, K1, x[13] );
-+ R( b, c, d, e, a, F1, K1, x[14] );
-+ R( a, b, c, d, e, F1, K1, x[15] );
-+ R( e, a, b, c, d, F1, K1, M(16) );
-+ R( d, e, a, b, c, F1, K1, M(17) );
-+ R( c, d, e, a, b, F1, K1, M(18) );
-+ R( b, c, d, e, a, F1, K1, M(19) );
-+ R( a, b, c, d, e, F2, K2, M(20) );
-+ R( e, a, b, c, d, F2, K2, M(21) );
-+ R( d, e, a, b, c, F2, K2, M(22) );
-+ R( c, d, e, a, b, F2, K2, M(23) );
-+ R( b, c, d, e, a, F2, K2, M(24) );
-+ R( a, b, c, d, e, F2, K2, M(25) );
-+ R( e, a, b, c, d, F2, K2, M(26) );
-+ R( d, e, a, b, c, F2, K2, M(27) );
-+ R( c, d, e, a, b, F2, K2, M(28) );
-+ R( b, c, d, e, a, F2, K2, M(29) );
-+ R( a, b, c, d, e, F2, K2, M(30) );
-+ R( e, a, b, c, d, F2, K2, M(31) );
-+ R( d, e, a, b, c, F2, K2, M(32) );
-+ R( c, d, e, a, b, F2, K2, M(33) );
-+ R( b, c, d, e, a, F2, K2, M(34) );
-+ R( a, b, c, d, e, F2, K2, M(35) );
-+ R( e, a, b, c, d, F2, K2, M(36) );
-+ R( d, e, a, b, c, F2, K2, M(37) );
-+ R( c, d, e, a, b, F2, K2, M(38) );
-+ R( b, c, d, e, a, F2, K2, M(39) );
-+ R( a, b, c, d, e, F3, K3, M(40) );
-+ R( e, a, b, c, d, F3, K3, M(41) );
-+ R( d, e, a, b, c, F3, K3, M(42) );
-+ R( c, d, e, a, b, F3, K3, M(43) );
-+ R( b, c, d, e, a, F3, K3, M(44) );
-+ R( a, b, c, d, e, F3, K3, M(45) );
-+ R( e, a, b, c, d, F3, K3, M(46) );
-+ R( d, e, a, b, c, F3, K3, M(47) );
-+ R( c, d, e, a, b, F3, K3, M(48) );
-+ R( b, c, d, e, a, F3, K3, M(49) );
-+ R( a, b, c, d, e, F3, K3, M(50) );
-+ R( e, a, b, c, d, F3, K3, M(51) );
-+ R( d, e, a, b, c, F3, K3, M(52) );
-+ R( c, d, e, a, b, F3, K3, M(53) );
-+ R( b, c, d, e, a, F3, K3, M(54) );
-+ R( a, b, c, d, e, F3, K3, M(55) );
-+ R( e, a, b, c, d, F3, K3, M(56) );
-+ R( d, e, a, b, c, F3, K3, M(57) );
-+ R( c, d, e, a, b, F3, K3, M(58) );
-+ R( b, c, d, e, a, F3, K3, M(59) );
-+ R( a, b, c, d, e, F4, K4, M(60) );
-+ R( e, a, b, c, d, F4, K4, M(61) );
-+ R( d, e, a, b, c, F4, K4, M(62) );
-+ R( c, d, e, a, b, F4, K4, M(63) );
-+ R( b, c, d, e, a, F4, K4, M(64) );
-+ R( a, b, c, d, e, F4, K4, M(65) );
-+ R( e, a, b, c, d, F4, K4, M(66) );
-+ R( d, e, a, b, c, F4, K4, M(67) );
-+ R( c, d, e, a, b, F4, K4, M(68) );
-+ R( b, c, d, e, a, F4, K4, M(69) );
-+ R( a, b, c, d, e, F4, K4, M(70) );
-+ R( e, a, b, c, d, F4, K4, M(71) );
-+ R( d, e, a, b, c, F4, K4, M(72) );
-+ R( c, d, e, a, b, F4, K4, M(73) );
-+ R( b, c, d, e, a, F4, K4, M(74) );
-+ R( a, b, c, d, e, F4, K4, M(75) );
-+ R( e, a, b, c, d, F4, K4, M(76) );
-+ R( d, e, a, b, c, F4, K4, M(77) );
-+ R( c, d, e, a, b, F4, K4, M(78) );
-+ R( b, c, d, e, a, F4, K4, M(79) );
-+
-+ a = ctx->A += a;
-+ b = ctx->B += b;
-+ c = ctx->C += c;
-+ d = ctx->D += d;
-+ e = ctx->E += e;
-+ }
-+}
---- a/mdadm/sha1.h 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/sha1.h 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,87 @@
-+/* Declarations of functions and data types used for SHA1 sum
-+ library functions.
-+ Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+#ifndef SHA1_H
-+# define SHA1_H 1
-+
-+# include <stdio.h>
-+# include "md5.h"
-+
-+/* Structure to save state of computation between the single steps. */
-+struct sha1_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+ md5_uint32 E;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+
-+/* Initialize structure containing state of computation. */
-+extern void sha1_init_ctx (struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void sha1_process_block (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void sha1_process_bytes (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 20 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 20 bytes
-+ beginning at RESBLOCK. */
-+extern int sha1_stream (FILE *stream, void *resblock);
-+
-+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
-+
-+#endif
---- a/mdadm/super0.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/super0.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,562 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#define HAVE_STDINT_H 1
-+#include "mdadm.h"
-+/*
-+ * All handling for the 0.90.0 version superblock is in
-+ * this file.
-+ * This includes:
-+ * - finding, loading, and writing the superblock.
-+ * - initialising a new superblock
-+ * - printing the superblock for --examine
-+ * - printing part of the superblock for --detail
-+ * .. other stuff
-+ */
-+
-+
-+static unsigned long calc_sb0_csum(mdp_super_t *super)
-+{
-+ unsigned long csum = super->sb_csum;
-+ unsigned long newcsum;
-+ super->sb_csum= 0 ;
-+ newcsum = calc_csum(super, MD_SB_BYTES);
-+ super->sb_csum = csum;
-+ return newcsum;
-+}
-+
-+
-+void super0_swap_endian(struct mdp_superblock_s *sb)
-+{
-+ /* as super0 superblocks are host-endian, it is sometimes
-+ * useful to be able to swap the endianness
-+ * as (almost) everything is u32's we byte-swap every 4byte
-+ * number.
-+ * We then also have to swap the events_hi and events_lo
-+ */
-+ char *sbc = (char *)sb;
-+ __u32 t32;
-+ int i;
-+
-+ for (i=0; i < MD_SB_BYTES ; i+=4) {
-+ char t = sbc[i];
-+ sbc[i] = sbc[i+3];
-+ sbc[i+3] = t;
-+ t=sbc[i+1];
-+ sbc[i+1]=sbc[i+2];
-+ sbc[i+2]=t;
-+ }
-+ t32 = sb->events_hi;
-+ sb->events_hi = sb->events_lo;
-+ sb->events_lo = t32;
-+
-+ t32 = sb->cp_events_hi;
-+ sb->cp_events_hi = sb->cp_events_lo;
-+ sb->cp_events_lo = t32;
-+
-+}
-+
-+static void brief_examine_super0(void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ char *c=map_num(pers, sb->level);
-+ char devname[20];
-+
-+ sprintf(devname, "/dev/md%d", sb->md_minor);
-+
-+ printf("ARRAY %s level=%s num-devices=%d UUID=",
-+ devname,
-+ c?c:"-unknown-", sb->raid_disks);
-+ if (sb->minor_version >= 90)
-+ printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
-+ sb->set_uuid2, sb->set_uuid3);
-+ else
-+ printf("%08x", sb->set_uuid0);
-+ printf("\n");
-+}
-+
-+static int match_home0(void *sbv, char *homehost)
-+{
-+ mdp_super_t *sb = sbv;
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+
-+ return (memcmp(&sb->set_uuid2, hash, 8)==0);
-+}
-+
-+static void uuid_from_super0(int uuid[4], void * sbv)
-+{
-+ mdp_super_t *super = sbv;
-+ uuid[0] = super->set_uuid0;
-+ if (super->minor_version >= 90) {
-+ uuid[1] = super->set_uuid1;
-+ uuid[2] = super->set_uuid2;
-+ uuid[3] = super->set_uuid3;
-+ } else {
-+ uuid[1] = 0;
-+ uuid[2] = 0;
-+ uuid[3] = 0;
-+ }
-+}
-+
-+static void getinfo_super0(struct mdinfo *info, void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ int working = 0;
-+ int i;
-+
-+ info->array.major_version = sb->major_version;
-+ info->array.minor_version = sb->minor_version;
-+ info->array.patch_version = sb->patch_version;
-+ info->array.raid_disks = sb->raid_disks;
-+ info->array.level = sb->level;
-+ info->array.layout = sb->layout;
-+ info->array.md_minor = sb->md_minor;
-+ info->array.ctime = sb->ctime;
-+ info->array.utime = sb->utime;
-+ info->array.chunk_size = sb->chunk_size;
-+ info->array.state = sb->state;
-+ info->component_size = sb->size*2;
-+
-+ info->disk.state = sb->this_disk.state;
-+ info->disk.major = sb->this_disk.major;
-+ info->disk.minor = sb->this_disk.minor;
-+ info->disk.raid_disk = sb->this_disk.raid_disk;
-+ info->disk.number = sb->this_disk.number;
-+
-+ info->events = md_event(sb);
-+ info->data_offset = 0;
-+
-+ uuid_from_super0(info->uuid, sbv);
-+
-+ if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = sb->reshape_position;
-+ info->new_level = sb->new_level;
-+ info->delta_disks = sb->delta_disks;
-+ info->new_layout = sb->new_layout;
-+ info->new_chunk = sb->new_chunk;
-+ } else
-+ info->reshape_active = 0;
-+
-+ sprintf(info->name, "%d", sb->md_minor);
-+ /* work_disks is calculated rather than read directly */
-+ for (i=0; i < MD_SB_DISKS; i++)
-+ if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
-+ (sb->disks[i].raid_disk < info->array.raid_disks) &&
-+ (sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
-+ !(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
-+ working ++;
-+ info->array.working_disks = working;
-+}
-+
-+
-+static int update_super0(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ mdp_super_t *sb = sbv;
-+ if (strcmp(update, "sparc2.2")==0 ) {
-+ /* 2.2 sparc put the events in the wrong place
-+ * So we copy the tail of the superblock
-+ * up 4 bytes before continuing
-+ */
-+ __u32 *sb32 = (__u32*)sb;
-+ memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-+ sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-+ (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
-+ if (verbose >= 0)
-+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
-+ devname);
-+ }
-+ if (strcmp(update, "super-minor") ==0) {
-+ sb->md_minor = info->array.md_minor;
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": updating superblock of %s with minor number %d\n",
-+ devname, info->array.md_minor);
-+ }
-+ if (strcmp(update, "summaries") == 0) {
-+ int i;
-+ /* set nr_disks, active_disks, working_disks,
-+ * failed_disks, spare_disks based on disks[]
-+ * array in superblock.
-+ * Also make sure extra slots aren't 'failed'
-+ */
-+ sb->nr_disks = sb->active_disks =
-+ sb->working_disks = sb->failed_disks =
-+ sb->spare_disks = 0;
-+ for (i=0; i < MD_SB_DISKS ; i++)
-+ if (sb->disks[i].major ||
-+ sb->disks[i].minor) {
-+ int state = sb->disks[i].state;
-+ if (state & (1<<MD_DISK_REMOVED))
-+ continue;
-+ sb->nr_disks++;
-+ if (state & (1<<MD_DISK_ACTIVE))
-+ sb->active_disks++;
-+ if (state & (1<<MD_DISK_FAULTY))
-+ sb->failed_disks++;
-+ else
-+ sb->working_disks++;
-+ if (state == 0)
-+ sb->spare_disks++;
-+ } else if (i >= sb->raid_disks && sb->disks[i].number == 0)
-+ sb->disks[i].state = 0;
-+ }
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array, so
-+ * bring this one up-to-date.
-+ */
-+ __u32 ehi = sb->events_hi, elo = sb->events_lo;
-+ sb->events_hi = (info->events>>32) & 0xFFFFFFFF;
-+ sb->events_lo = (info->events) & 0xFFFFFFFF;
-+ if (sb->events_hi != ehi ||
-+ sb->events_lo != elo)
-+ rv = 1;
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* degraded array and 'force' requested, so
-+ * maybe need to mark it 'clean'
-+ */
-+ if ((sb->level == 5 || sb->level == 4 || sb->level == 6) &&
-+ (sb->state & (1 << MD_SB_CLEAN)) == 0) {
-+ /* need to force clean */
-+ sb->state |= (1 << MD_SB_CLEAN);
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int wonly = sb->disks[d].state & (1<<MD_DISK_WRITEMOSTLY);
-+ if ((sb->disks[d].state & ~(1<<MD_DISK_WRITEMOSTLY))
-+ != info->disk.state) {
-+ sb->disks[d].state = info->disk.state | wonly;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ sb->this_disk = sb->disks[info->disk.number];
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = info->array.raid_disks;
-+ sb->nr_disks = info->array.nr_disks;
-+ sb->active_disks = info->array.active_disks;
-+ sb->working_disks = info->array.working_disks;
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->state &= ~(1<<MD_SB_CLEAN);
-+ sb->recovery_cp = 0;
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ uuid_set = 0;
-+ update = "uuid";
-+ info->uuid[0] = sb->set_uuid0;
-+ info->uuid[1] = sb->set_uuid1;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ if (!uuid_set && homehost) {
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+ memcpy(info->uuid+2, hash, 8);
-+ }
-+ sb->set_uuid0 = info->uuid[0];
-+ sb->set_uuid1 = info->uuid[1];
-+ sb->set_uuid2 = info->uuid[2];
-+ sb->set_uuid3 = info->uuid[3];
-+ if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sb+1);
-+ uuid_from_super0((int*)bm->uuid, sbv);
-+ }
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = info->reshape_progress;
-+
-+ sb->sb_csum = calc_sb0_csum(sb);
-+ return rv;
-+}
-+
-+static int store_super0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super = sbv;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*2*512)
-+ return 2;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ if (lseek64(fd, offset, 0)< 0LL)
-+ return 3;
-+
-+ if (write(fd, super, sizeof(*super)) != sizeof(*super))
-+ return 4;
-+
-+ if (super->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC)
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int compare_super0(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ mdp_super_t *first = *firstp;
-+ mdp_super_t *second = secondv;
-+
-+ int uuid1[4], uuid2[4];
-+ if (second->md_magic != MD_SB_MAGIC)
-+ return 1;
-+ if (!first) {
-+ first = malloc(MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ *firstp = first;
-+ return 0;
-+ }
-+
-+ uuid_from_super0(uuid1, first);
-+ uuid_from_super0(uuid2, second);
-+ if (!same_uuid(uuid1, uuid2, 0))
-+ return 2;
-+ if (first->major_version != second->major_version ||
-+ first->minor_version != second->minor_version ||
-+ first->patch_version != second->patch_version ||
-+ first->gvalid_words != second->gvalid_words ||
-+ first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->size != second->size ||
-+ first->raid_disks != second->raid_disks )
-+ return 3;
-+
-+ return 0;
-+}
-+
-+
-+static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ /* try to read in the superblock
-+ * Return:
-+ * 0 on success
-+ * 1 on cannot get superblock
-+ * 2 on superblock meaningless
-+ */
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2) {
-+ if (devname)
-+ fprintf(stderr, Name
-+ ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+ if (lseek64(fd, offset, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(MD_SB_BYTES + sizeof(bitmap_super_t));
-+
-+ if (read(fd, super, sizeof(*super)) != MD_SB_BYTES) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (st->ss && st->minor_version == 9)
-+ super0_swap_endian(super);
-+
-+ if (super->md_magic != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, super->md_magic);
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (super->major_version != 0) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, super->major_version);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+ if (st->ss == NULL) {
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ /* Now check on the bitmap superblock */
-+ if ((super->state & (1<<MD_SB_BITMAP_PRESENT)) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ if (read(fd, super+1, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super0(uuid, super);
-+ bsb = (struct bitmap_super_s *)(super+1);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->state &= ~(1<<MD_SB_BITMAP_PRESENT);
-+
-+ return 0;
-+}
-+
-+static struct supertype *match_metadata_desc0(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ if (strcmp(arg, "0") == 0 ||
-+ strcmp(arg, "0.90") == 0 ||
-+ strcmp(arg, "default") == 0
-+ )
-+ return st;
-+
-+ st->minor_version = 9; /* flag for 'byte-swapped' */
-+ if (strcmp(arg, "0.swap")==0)
-+ return st;
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+void locate_bitmap0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2)
-+ return;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ offset += MD_SB_BYTES;
-+
-+ lseek64(fd, offset, 0);
-+}
-+
-+struct superswitch super0 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super0,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home0,
-+ .uuid_from_super = uuid_from_super0,
-+ .getinfo_super = getinfo_super0,
-+ .update_super = update_super0,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super0,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super0,
-+ .load_super = load_super0,
-+ .match_metadata_desc = match_metadata_desc0,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap0,
-+ .write_bitmap = NULL,
-+ .major = 0,
-+ .swapuuid = 0,
-+};
---- a/mdadm/super1.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/super1.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,731 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+/*
-+ * The version-1 superblock :
-+ * All numeric fields are little-endian.
-+ *
-+ * total size: 256 bytes plus 2 per device.
-+ * 1K allows 384 devices.
-+ */
-+struct mdp_superblock_1 {
-+ /* constant array information - 128 bytes */
-+ __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
-+ __u32 major_version; /* 1 */
-+ __u32 feature_map; /* 0 for now */
-+ __u32 pad0; /* always set to 0 when writing */
-+
-+ __u8 set_uuid[16]; /* user-space generated. */
-+ char set_name[32]; /* set and interpreted by user-space */
-+
-+ __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
-+ __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
-+ __u32 layout; /* only for raid5 currently */
-+ __u64 size; /* used size of component devices, in 512byte sectors */
-+
-+ __u32 chunksize; /* in 512byte sectors */
-+ __u32 raid_disks;
-+ __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
-+ * NOTE: signed, so bitmap can be before superblock
-+ * only meaningful of feature_map[0] is set.
-+ */
-+
-+ /* These are only valid with feature bit '4' */
-+ __u32 new_level; /* new level we are reshaping to */
-+ __u64 reshape_position; /* next address in array-space for reshape */
-+ __u32 delta_disks; /* change in number of raid_disks */
-+ __u32 new_layout; /* new layout */
-+ __u32 new_chunk; /* new chunk size (bytes) */
-+ __u8 pad1[128-124]; /* set to 0 when written */
-+
-+ /* constant this-device information - 64 bytes */
-+ __u64 data_offset; /* sector start of data, often 0 */
-+ __u64 data_size; /* sectors in this device that can be used for data */
-+ __u64 super_offset; /* sector start of this superblock */
-+ __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
-+ __u32 dev_number; /* permanent identifier of this device - not role in raid */
-+ __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
-+ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
-+ __u8 devflags; /* per-device flags. Only one defined...*/
-+#define WriteMostly1 1 /* mask for writemostly flag in above */
-+ __u8 pad2[64-57]; /* set to 0 when writing */
-+
-+ /* array state information - 64 bytes */
-+ __u64 utime; /* 40 bits second, 24 btes microseconds */
-+ __u64 events; /* incremented when superblock updated */
-+ __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
-+ __u32 sb_csum; /* checksum upto devs[max_dev] */
-+ __u32 max_dev; /* size of devs[] array to consider */
-+ __u8 pad3[64-32]; /* set to 0 when writing */
-+
-+ /* device state information. Indexed by dev_number.
-+ * 2 bytes per device
-+ * Note there are no per-device state flags. State information is rolled
-+ * into the 'roles' value. If a device is spare or faulty, then it doesn't
-+ * have a meaningful role.
-+ */
-+ __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
-+};
-+
-+struct misc_dev_info {
-+ __u64 device_size;
-+};
-+
-+/* feature_map bits */
-+#define MD_FEATURE_BITMAP_OFFSET 1
-+#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and
-+ * must be honoured
-+ */
-+#define MD_FEATURE_RESHAPE_ACTIVE 4
-+
-+#define MD_FEATURE_ALL (1|2|4)
-+
-+#ifndef offsetof
-+#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-+#endif
-+static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
-+{
-+ unsigned int disk_csum, csum;
-+ unsigned long long newcsum;
-+ int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
-+ unsigned int *isuper = (unsigned int*)sb;
-+ int i;
-+
-+/* make sure I can count... */
-+ if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
-+ offsetof(struct mdp_superblock_1, utime) != 192 ||
-+ sizeof(struct mdp_superblock_1) != 256) {
-+ fprintf(stderr, "WARNING - superblock isn't sized correctly\n");
-+ }
-+
-+ disk_csum = sb->sb_csum;
-+ sb->sb_csum = 0;
-+ newcsum = 0;
-+ for (i=0; size>=4; size -= 4 ) {
-+ newcsum += __le32_to_cpu(*isuper);
-+ isuper++;
-+ }
-+
-+ if (size == 2)
-+ newcsum += __le16_to_cpu(*(unsigned short*) isuper);
-+
-+ csum = (newcsum & 0xffffffff) + (newcsum >> 32);
-+ sb->sb_csum = disk_csum;
-+ return __cpu_to_le32(csum);
-+}
-+
-+static void brief_examine_super1(void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int i;
-+ unsigned long long sb_offset;
-+ char *nm;
-+ char *c=map_num(pers, __le32_to_cpu(sb->level));
-+
-+ nm = strchr(sb->set_name, ':');
-+ if (nm)
-+ nm++;
-+ else if (sb->set_name[0])
-+ nm = sb->set_name;
-+ else
-+ nm = "??";
-+
-+ printf("ARRAY /dev/md%s level=%s ", nm, c?c:"-unknown-");
-+ sb_offset = __le64_to_cpu(sb->super_offset);
-+ if (sb_offset <= 4)
-+ printf("metadata=1.1 ");
-+ else if (sb_offset <= 8)
-+ printf("metadata=1.2 ");
-+ else
-+ printf("metadata=1.0 ");
-+ printf("num-devices=%d UUID=", __le32_to_cpu(sb->raid_disks));
-+ for (i=0; i<16; i++) {
-+ if ((i&3)==0 && i != 0) printf(":");
-+ printf("%02x", sb->set_uuid[i]);
-+ }
-+ if (sb->set_name[0])
-+ printf(" name=%.32s", sb->set_name);
-+ printf("\n");
-+}
-+
-+static int match_home1(void *sbv, char *homehost)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int l = homehost ? strlen(homehost) : 0;
-+
-+ return (l > 0 && l < 32 &&
-+ sb->set_name[l] == ':' &&
-+ strncmp(sb->set_name, homehost, l) == 0);
-+}
-+
-+static void uuid_from_super1(int uuid[4], void * sbv)
-+{
-+ struct mdp_superblock_1 *super = sbv;
-+ char *cuuid = (char*)uuid;
-+ int i;
-+ for (i=0; i<16; i++)
-+ cuuid[i] = super->set_uuid[i];
-+}
-+
-+static void getinfo_super1(struct mdinfo *info, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int working = 0;
-+ int i;
-+ int role;
-+
-+ info->array.major_version = 1;
-+ info->array.minor_version = __le32_to_cpu(sb->feature_map);
-+ info->array.patch_version = 0;
-+ info->array.raid_disks = __le32_to_cpu(sb->raid_disks);
-+ info->array.level = __le32_to_cpu(sb->level);
-+ info->array.layout = __le32_to_cpu(sb->layout);
-+ info->array.md_minor = -1;
-+ info->array.ctime = __le64_to_cpu(sb->ctime);
-+ info->array.utime = __le64_to_cpu(sb->utime);
-+ info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
-+ info->array.state =
-+ (__le64_to_cpu(sb->resync_offset) >= __le64_to_cpu(sb->size))
-+ ? 1 : 0;
-+
-+ info->data_offset = __le64_to_cpu(sb->data_offset);
-+ info->component_size = __le64_to_cpu(sb->size);
-+
-+ info->disk.major = 0;
-+ info->disk.minor = 0;
-+ info->disk.number = __le32_to_cpu(sb->dev_number);
-+ if (__le32_to_cpu(sb->dev_number) >= __le32_to_cpu(sb->max_dev) ||
-+ __le32_to_cpu(sb->max_dev) > 512)
-+ role = 0xfffe;
-+ else
-+ role = __le16_to_cpu(sb->dev_roles[__le32_to_cpu(sb->dev_number)]);
-+
-+ info->disk.raid_disk = -1;
-+ switch(role) {
-+ case 0xFFFF:
-+ info->disk.state = 2; /* spare: ACTIVE, not sync, not faulty */
-+ break;
-+ case 0xFFFE:
-+ info->disk.state = 1; /* faulty */
-+ break;
-+ default:
-+ info->disk.state = 6; /* active and in sync */
-+ info->disk.raid_disk = role;
-+ }
-+ info->events = __le64_to_cpu(sb->events);
-+
-+ memcpy(info->uuid, sb->set_uuid, 16);
-+
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+
-+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = __le64_to_cpu(sb->reshape_position);
-+ info->new_level = __le32_to_cpu(sb->new_level);
-+ info->delta_disks = __le32_to_cpu(sb->delta_disks);
-+ info->new_layout = __le32_to_cpu(sb->new_layout);
-+ info->new_chunk = __le32_to_cpu(sb->new_chunk)<<9;
-+ } else
-+ info->reshape_active = 0;
-+
-+ for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
-+ role = __le16_to_cpu(sb->dev_roles[i]);
-+ if (/*role == 0xFFFF || */role < info->array.raid_disks)
-+ working++;
-+ }
-+
-+ info->array.working_disks = working;
-+}
-+
-+static int update_super1(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ struct mdp_superblock_1 *sb = sbv;
-+
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array,
-+ * so bring this one up-to-date
-+ */
-+ if (sb->events != __cpu_to_le64(info->events))
-+ rv = 1;
-+ sb->events = __cpu_to_le64(info->events);
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* Degraded array and 'force' requests to
-+ * maybe need to mark it 'clean'.
-+ */
-+ switch(__le32_to_cpu(sb->level)) {
-+ case 5: case 4: case 6:
-+ /* need to force clean */
-+ if (sb->resync_offset != ~0ULL)
-+ rv = 1;
-+ sb->resync_offset = ~0ULL;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int want;
-+ if (info->disk.state == 6)
-+ want = __cpu_to_le32(info->disk.raid_disk);
-+ else
-+ want = 0xFFFF;
-+ if (sb->dev_roles[d] != want) {
-+ sb->dev_roles[d] = want;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ int i;
-+ int rfd;
-+ int max = __le32_to_cpu(sb->max_dev);
-+
-+ for (i=0 ; i < max ; i++)
-+ if (__le16_to_cpu(sb->dev_roles[i]) >= 0xfffe)
-+ break;
-+ sb->dev_number = __cpu_to_le32(i);
-+ info->disk.number = i;
-+ if (max >= __le32_to_cpu(sb->max_dev))
-+ sb->max_dev = __cpu_to_le32(max+1);
-+
-+ if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
-+ read(rfd, sb->device_uuid, 16) != 16) {
-+ *(__u32*)(sb->device_uuid) = random();
-+ *(__u32*)(sb->device_uuid+4) = random();
-+ *(__u32*)(sb->device_uuid+8) = random();
-+ *(__u32*)(sb->device_uuid+12) = random();
-+ }
-+
-+ sb->dev_roles[i] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
-+ sb->dev_roles[info->disk.number] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->resync_offset = 0ULL;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid);
-+
-+ if (__le32_to_cpu(sb->feature_map)&MD_FEATURE_BITMAP_OFFSET) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sbv+1024);
-+ memcpy(bm->uuid, sb->set_uuid, 16);
-+ }
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ char *c;
-+ update = "name";
-+ c = strchr(sb->set_name, ':');
-+ if (c)
-+ strncpy(info->name, c+1, 31 - (c-sb->set_name));
-+ else
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+ }
-+ if (strcmp(update, "name") == 0) {
-+ if (info->name[0] == 0)
-+ sprintf(info->name, "%d", info->array.md_minor);
-+ memset(sb->set_name, 0, sizeof(sb->set_name));
-+ if (homehost &&
-+ strchr(info->name, ':') == NULL &&
-+ strlen(homehost)+1+strlen(info->name) < 32) {
-+ strcpy(sb->set_name, homehost);
-+ strcat(sb->set_name, ":");
-+ strcat(sb->set_name, info->name);
-+ } else
-+ strcpy(sb->set_name, info->name);
-+ }
-+ if (strcmp(update, "devicesize") == 0 &&
-+ __le64_to_cpu(sb->super_offset) <
-+ __le64_to_cpu(sb->data_offset)) {
-+ /* set data_size to device size less data_offset */
-+ struct misc_dev_info *misc = (struct misc_dev_info*)
-+ (sbv + 1024 + sizeof(struct bitmap_super_s));
-+ printf("Size was %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ sb->data_size = __cpu_to_le64(
-+ misc->device_size - __le64_to_cpu(sb->data_offset));
-+ printf("Size is %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = __cpu_to_le64(info->reshape_progress);
-+
-+ sb->sb_csum = calc_sb_1_csum(sb);
-+ return rv;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv);
-+
-+static int store_super1(struct supertype *st, int fd, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ unsigned long long sb_offset;
-+ int sbsize;
-+ unsigned long long dsize;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ dsize >>= 9;
-+
-+ if (dsize < 24)
-+ return 2;
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+
-+
-+ if (sb_offset != __le64_to_cpu(sb->super_offset) &&
-+ 0 != __le64_to_cpu(sb->super_offset)
-+ ) {
-+ fprintf(stderr, Name ": internal error - sb_offset is wrong\n");
-+ abort();
-+ }
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL)
-+ return 3;
-+
-+ sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev);
-+
-+ if (write(fd, sb, sbsize) != sbsize)
-+ return 4;
-+
-+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
-+ struct bitmap_super_s *bm = (struct bitmap_super_s*)
-+ (((char*)sb)+1024);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) {
-+ locate_bitmap1(st, fd, sbv);
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+ }
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname);
-+
-+static int compare_super1(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ struct mdp_superblock_1 *first = *firstp;
-+ struct mdp_superblock_1 *second = secondv;
-+
-+ if (second->magic != __cpu_to_le32(MD_SB_MAGIC))
-+ return 1;
-+ if (second->major_version != __cpu_to_le32(1))
-+ return 1;
-+
-+ if (!first) {
-+ first = malloc(1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ memcpy(first, second, 1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ *firstp = first;
-+ return 0;
-+ }
-+ if (memcmp(first->set_uuid, second->set_uuid, 16)!= 0)
-+ return 2;
-+
-+ if (first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->layout != second->layout ||
-+ first->size != second->size ||
-+ first->chunksize != second->chunksize ||
-+ first->raid_disks != second->raid_disks)
-+ return 3;
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ unsigned long long dsize;
-+ unsigned long long sb_offset;
-+ struct mdp_superblock_1 *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+ struct misc_dev_info *misc;
-+
-+
-+ if (st->ss == NULL) {
-+ int bestvers = -1;
-+ __u64 bestctime = 0;
-+ /* guess... choose latest ctime */
-+ st->ss = &super1;
-+ for (st->minor_version = 0; st->minor_version <= 2 ; st->minor_version++) {
-+ switch(load_super1(st, fd, sbp, devname)) {
-+ case 0: super = *sbp;
-+ if (bestvers == -1 ||
-+ bestctime < __le64_to_cpu(super->ctime)) {
-+ bestvers = st->minor_version;
-+ bestctime = __le64_to_cpu(super->ctime);
-+ }
-+ free(super);
-+ *sbp = NULL;
-+ break;
-+ case 1: st->ss = NULL; return 1; /*bad device */
-+ case 2: break; /* bad, try next */
-+ }
-+ }
-+ if (bestvers != -1) {
-+ int rv;
-+ st->minor_version = bestvers;
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ rv = load_super1(st, fd, sbp, devname);
-+ if (rv) st->ss = NULL;
-+ return rv;
-+ }
-+ st->ss = NULL;
-+ return 2;
-+ }
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+ dsize >>= 9;
-+
-+ if (dsize < 24) {
-+ if (devname)
-+ fprintf(stderr, Name ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(1024 + sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+
-+ if (read(fd, super, 1024) != 1024) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (__le32_to_cpu(super->magic) != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, __le32_to_cpu(super->magic));
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (__le32_to_cpu(super->major_version) != 1) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, __le32_to_cpu(super->major_version));
-+ free(super);
-+ return 2;
-+ }
-+ if (__le64_to_cpu(super->super_offset) != sb_offset) {
-+ if (devname)
-+ fprintf(stderr, Name ": No superblock found on %s (super_offset is wrong)\n",
-+ devname);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+
-+ bsb = (struct bitmap_super_s *)(((char*)super)+1024);
-+
-+ misc = (struct misc_dev_info*) (bsb+1);
-+ misc->device_size = dsize;
-+
-+ /* Now check on the bitmap superblock */
-+ if ((__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ locate_bitmap1(st, fd, super);
-+ if (read(fd, ((char*)super)+1024, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super1(uuid, super);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->feature_map = __cpu_to_le32(__le32_to_cpu(super->feature_map) & ~1);
-+ return 0;
-+}
-+
-+
-+static struct supertype *match_metadata_desc1(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ if (strcmp(arg, "1") == 0 ||
-+ strcmp(arg, "1.0") == 0 ||
-+ strcmp(arg, "default/large") == 0) {
-+ st->minor_version = 0;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.1") == 0) {
-+ st->minor_version = 1;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.2") == 0) {
-+ st->minor_version = 2;
-+ return st;
-+ }
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long offset;
-+ struct mdp_superblock_1 *sb;
-+ int mustfree = 0;
-+
-+ if (!sbv) {
-+ if (st->ss->load_super(st, fd, &sbv, NULL))
-+ return; /* no error I hope... */
-+ mustfree = 1;
-+ }
-+ sb = sbv;
-+
-+ offset = __le64_to_cpu(sb->super_offset);
-+ offset += (int32_t) __le32_to_cpu(sb->bitmap_offset);
-+ if (mustfree)
-+ free(sb);
-+ lseek64(fd, offset<<9, 0);
-+}
-+
-+struct superswitch super1 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super1,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home1,
-+ .uuid_from_super = uuid_from_super1,
-+ .getinfo_super = getinfo_super1,
-+ .update_super = update_super1,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super1,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super1,
-+ .load_super = load_super1,
-+ .match_metadata_desc = match_metadata_desc1,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap1,
-+ .write_bitmap = NULL,
-+ .major = 1,
-+#if __BYTE_ORDER == BIG_ENDIAN
-+ .swapuuid = 0,
-+#else
-+ .swapuuid = 1,
-+#endif
-+};
---- a/mdadm/util.c 1970-01-01 03:00:00.000000000 +0300
-+++ mdadm/mdadm/util.c 2011-01-12 21:33:01.000000000 +0200
-@@ -0,0 +1,652 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "md_p.h"
-+#include <sys/utsname.h>
-+#include <ctype.h>
-+
-+/*
-+ * following taken from linux/blkpg.h because they aren't
-+ * anywhere else and it isn't safe to #include linux/ * stuff.
-+ */
-+
-+#define BLKPG _IO(0x12,105)
-+
-+/* The argument structure */
-+struct blkpg_ioctl_arg {
-+ int op;
-+ int flags;
-+ int datalen;
-+ void *data;
-+};
-+
-+/* The subfunctions (for the op field) */
-+#define BLKPG_ADD_PARTITION 1
-+#define BLKPG_DEL_PARTITION 2
-+
-+/* Sizes of name fields. Unused at present. */
-+#define BLKPG_DEVNAMELTH 64
-+#define BLKPG_VOLNAMELTH 64
-+
-+/* The data structure for ADD_PARTITION and DEL_PARTITION */
-+struct blkpg_partition {
-+ long long start; /* starting offset in bytes */
-+ long long length; /* length in bytes */
-+ int pno; /* partition number */
-+ char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
-+ to be used in kernel messages */
-+ char volname[BLKPG_VOLNAMELTH]; /* volume label */
-+};
-+
-+/*
-+ * Parse a 128 bit uuid in 4 integers
-+ * format is 32 hexx nibbles with options :.<space> separator
-+ * If not exactly 32 hex digits are found, return 0
-+ * else return 1
-+ */
-+int parse_uuid(char *str, int uuid[4])
-+{
-+ int hit = 0; /* number of Hex digIT */
-+ int i;
-+ char c;
-+ for (i=0; i<4; i++) uuid[i]=0;
-+
-+ while ((c= *str++)) {
-+ int n;
-+ if (c>='0' && c<='9')
-+ n = c-'0';
-+ else if (c>='a' && c <= 'f')
-+ n = 10 + c - 'a';
-+ else if (c>='A' && c <= 'F')
-+ n = 10 + c - 'A';
-+ else if (strchr(":. -", c))
-+ continue;
-+ else return 0;
-+
-+ if (hit<32) {
-+ uuid[hit/8] <<= 4;
-+ uuid[hit/8] += n;
-+ }
-+ hit++;
-+ }
-+ if (hit == 32)
-+ return 1;
-+ return 0;
-+
-+}
-+
-+
-+/*
-+ * Get the md version number.
-+ * We use the RAID_VERSION ioctl if it is supported
-+ * If not, but we have a block device with major '9', we assume
-+ * 0.36.0
-+ *
-+ * Return version number as 24 but number - assume version parts
-+ * always < 255
-+ */
-+
-+int md_get_version(int fd)
-+{
-+ struct stat stb;
-+ mdu_version_t vers;
-+
-+ if (fstat(fd, &stb)<0)
-+ return -1;
-+ if ((S_IFMT&stb.st_mode) != S_IFBLK)
-+ return -1;
-+
-+ if (ioctl(fd, RAID_VERSION, &vers) == 0)
-+ return (vers.major*10000) + (vers.minor*100) + vers.patchlevel;
-+ if (errno == EACCES)
-+ return -1;
-+ if (major(stb.st_rdev) == MD_MAJOR)
-+ return (3600);
-+ return -1;
-+}
-+
-+
-+int get_linux_version()
-+{
-+ struct utsname name;
-+ char *cp;
-+ int a,b,c;
-+ if (uname(&name) <0)
-+ return -1;
-+
-+ cp = name.release;
-+ a = strtoul(cp, &cp, 10);
-+ if (*cp != '.') return -1;
-+ b = strtoul(cp+1, &cp, 10);
-+ if (*cp != '.') return -1;
-+ c = strtoul(cp+1, NULL, 10);
-+
-+ return (a*1000000)+(b*1000)+c;
-+}
-+
-+void remove_partitions(int fd)
-+{
-+ /* remove partitions from this block devices.
-+ * This is used for components added to an array
-+ */
-+#ifdef BLKPG_DEL_PARTITION
-+ struct blkpg_ioctl_arg a;
-+ struct blkpg_partition p;
-+
-+ a.op = BLKPG_DEL_PARTITION;
-+ a.data = (void*)&p;
-+ a.datalen = sizeof(p);
-+ a.flags = 0;
-+ memset(a.data, 0, a.datalen);
-+ for (p.pno=0; p.pno < 16; p.pno++)
-+ ioctl(fd, BLKPG, &a);
-+#endif
-+}
-+
-+int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks)
-+{
-+ int copies, first;
-+ switch (level) {
-+ case 10:
-+ /* This is the tricky one - we need to check
-+ * which actual disks are present.
-+ */
-+ copies = (layout&255)* ((layout>>8) & 255);
-+ first=0;
-+ do {
-+ /* there must be one of the 'copies' form 'first' */
-+ int n = copies;
-+ int cnt=0;
-+ while (n--) {
-+ if (avail[first])
-+ cnt++;
-+ first = (first+1) % raid_disks;
-+ }
-+ if (cnt == 0)
-+ return 0;
-+
-+ } while (first != 0);
-+ return 1;
-+
-+ case -4:
-+ return avail_disks>= 1;
-+ case -1:
-+ case 0:
-+ return avail_disks == raid_disks;
-+ case 1:
-+ return avail_disks >= 1;
-+ case 4:
-+ case 5:
-+ if (clean)
-+ return avail_disks >= raid_disks-1;
-+ else
-+ return avail_disks >= raid_disks;
-+ case 6:
-+ if (clean)
-+ return avail_disks >= raid_disks-2;
-+ else
-+ return avail_disks >= raid_disks;
-+ default:
-+ return 0;
-+ }
-+}
-+
-+int same_uuid(int a[4], int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ if (ac[i+0] != bc[i+3] ||
-+ ac[i+1] != bc[i+2] ||
-+ ac[i+2] != bc[i+1] ||
-+ ac[i+3] != bc[i+0])
-+ return 0;
-+ }
-+ return 1;
-+ } else {
-+ if (a[0]==b[0] &&
-+ a[1]==b[1] &&
-+ a[2]==b[2] &&
-+ a[3]==b[3])
-+ return 1;
-+ return 0;
-+ }
-+}
-+void copy_uuid(void *a, int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ ac[i+0] = bc[i+3];
-+ ac[i+1] = bc[i+2];
-+ ac[i+2] = bc[i+1];
-+ ac[i+3] = bc[i+0];
-+ }
-+ } else
-+ memcpy(a, b, 16);
-+}
-+
-+char *map_num(mapping_t *map, int num)
-+{
-+ while (map->name) {
-+ if (map->num == num)
-+ return map->name;
-+ map++;
-+ }
-+ return NULL;
-+}
-+
-+int map_name(mapping_t *map, char *name)
-+{
-+ while (map->name) {
-+ if (strcmp(map->name, name)==0)
-+ return map->num;
-+ map++;
-+ }
-+ return UnSet;
-+}
-+
-+
-+int is_standard(char *dev, int *nump)
-+{
-+ /* tests if dev is a "standard" md dev name.
-+ * i.e if the last component is "/dNN" or "/mdNN",
-+ * where NN is a string of digits
-+ */
-+ char *d = strrchr(dev, '/');
-+ int type=0;
-+ int num;
-+ if (!d)
-+ return 0;
-+ if (strncmp(d, "/d",2)==0)
-+ d += 2, type=1; /* /dev/md/dN{pM} */
-+ else if (strncmp(d, "/md_d", 5)==0)
-+ d += 5, type=1; /* /dev/md_dNpM */
-+ else if (strncmp(d, "/md", 3)==0)
-+ d += 3, type=-1; /* /dev/mdN */
-+ else if (d-dev > 3 && strncmp(d-2, "md/", 3)==0)
-+ d += 1, type=-1; /* /dev/md/N */
-+ else
-+ return 0;
-+ if (!*d)
-+ return 0;
-+ num = atoi(d);
-+ while (isdigit(*d))
-+ d++;
-+ if (*d)
-+ return 0;
-+ if (nump) *nump = num;
-+
-+ return type;
-+}
-+
-+
-+/*
-+ * convert a major/minor pair for a block device into a name in /dev, if possible.
-+ * On the first call, walk /dev collecting name.
-+ * Put them in a simple linked listfor now.
-+ */
-+struct devmap {
-+ int major, minor;
-+ char *name;
-+ struct devmap *next;
-+} *devlist = NULL;
-+int devlist_ready = 0;
-+
-+int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
-+{
-+ struct stat st;
-+ if (S_ISLNK(stb->st_mode)) {
-+ stat(name, &st);
-+ stb = &st;
-+ }
-+
-+ if ((stb->st_mode&S_IFMT)== S_IFBLK) {
-+ char *n = strdup(name);
-+ struct devmap *dm = malloc(sizeof(*dm));
-+ if (strncmp(n, "/dev/./", 7)==0)
-+ strcpy(n+4, name+6);
-+ if (dm) {
-+ dm->major = major(stb->st_rdev);
-+ dm->minor = minor(stb->st_rdev);
-+ dm->name = n;
-+ dm->next = devlist;
-+ devlist = dm;
-+ }
-+ }
-+ return 0;
-+}
-+
-+#ifndef HAVE_NFTW
-+#ifdef HAVE_FTW
-+int add_dev_1(const char *name, const struct stat *stb, int flag)
-+{
-+ return add_dev(name, stb, flag, NULL);
-+}
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return ftw(path, add_dev_1, nopenfd);
-+}
-+#else
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return 0;
-+}
-+#endif /* HAVE_FTW */
-+#endif /* HAVE_NFTW */
-+
-+/*
-+ * Find a block device with the right major/minor number.
-+ * If we find multiple names, choose the shortest.
-+ * If we find a non-standard name, it is probably there
-+ * deliberately so prefer it over a standard name.
-+ * This applies only to names for MD devices.
-+ */
-+char *map_dev(int major, int minor, int create)
-+{
-+ struct devmap *p;
-+ char *std = NULL, *nonstd=NULL;
-+ int did_check = 0;
-+
-+ if (major == 0 && minor == 0)
-+ return NULL;
-+
-+ retry:
-+ if (!devlist_ready) {
-+ char *dev = "/dev";
-+ struct stat stb;
-+ while(devlist) {
-+ struct devmap *d = devlist;
-+ devlist = d->next;
-+ free(d->name);
-+ free(d);
-+ }
-+ if (lstat(dev, &stb)==0 &&
-+ S_ISLNK(stb.st_mode))
-+ dev = "/dev/.";
-+ nftw(dev, add_dev, 10, FTW_PHYS);
-+ devlist_ready=1;
-+ did_check = 1;
-+ }
-+
-+ for (p=devlist; p; p=p->next)
-+ if (p->major == major &&
-+ p->minor == minor) {
-+ if (is_standard(p->name, NULL)) {
-+ if (std == NULL ||
-+ strlen(p->name) < strlen(std))
-+ std = p->name;
-+ } else {
-+ if (nonstd == NULL ||
-+ strlen(p->name) < strlen(nonstd))
-+ nonstd = p->name;
-+ }
-+ }
-+ if (!std && !nonstd && !did_check) {
-+ devlist_ready = 0;
-+ goto retry;
-+ }
-+ if (create && !std && !nonstd) {
-+ static char buf[30];
-+ snprintf(buf, sizeof(buf), "%d:%d", major, minor);
-+ nonstd = buf;
-+ }
-+
-+ return nonstd ? nonstd : std;
-+}
-+
-+unsigned long calc_csum(void *super, int bytes)
-+{
-+ unsigned long long newcsum = 0;
-+ int i;
-+ unsigned int csum;
-+ unsigned int *superc = (unsigned int*) super;
-+
-+ for(i=0; i<bytes/4; i++)
-+ newcsum+= superc[i];
-+ csum = (newcsum& 0xffffffff) + (newcsum>>32);
-+#ifdef __alpha__
-+/* The in-kernel checksum calculation is always 16bit on
-+ * the alpha, though it is 32 bit on i386...
-+ * I wonder what it is elsewhere... (it uses and API in
-+ * a way that it shouldn't).
-+ */
-+ csum = (csum & 0xffff) + (csum >> 16);
-+ csum = (csum & 0xffff) + (csum >> 16);
-+#endif
-+ return csum;
-+}
-+
-+char *human_size(long long bytes)
-+{
-+ static char buf[30];
-+
-+ /* We convert bytes to either centi-M{ega,ibi}bytes or
-+ * centi-G{igi,ibi}bytes, with appropriate rounding,
-+ * and then print 1/100th of those as a decimal.
-+ * We allow upto 2048Megabytes before converting to
-+ * gigabytes, as that shows more precision and isn't
-+ * too large a number.
-+ * Terrabytes are not yet handled.
-+ */
-+
-+ if (bytes < 5000*1024)
-+ buf[0]=0;
-+ else if (bytes < 2*1024LL*1024LL*1024LL) {
-+ long cMiB = (bytes / ( (1LL<<20) / 200LL ) +1) /2;
-+ long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)",
-+ cMiB/100 , cMiB % 100,
-+ cMB/100, cMB % 100);
-+ } else {
-+ long cGiB = (bytes / ( (1LL<<30) / 200LL ) +1) /2;
-+ long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",
-+ cGiB/100 , cGiB % 100,
-+ cGB/100, cGB % 100);
-+ }
-+ return buf;
-+}
-+
-+char *human_size_brief(long long bytes)
-+{
-+ static char buf[30];
-+
-+
-+ if (bytes < 5000*1024)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldKiB",
-+ (long)(bytes>>10), (long)(((bytes&1023)*100+512)/1024)
-+ );
-+ else if (bytes < 2*1024LL*1024LL*1024LL)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldMiB",
-+ (long)(bytes>>20),
-+ (long)((bytes&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ else
-+ snprintf(buf, sizeof(buf), "%ld.%02ldGiB",
-+ (long)(bytes>>30),
-+ (long)(((bytes>>10)&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ return buf;
-+}
-+
-+int get_mdp_major(void)
-+{
-+static int mdp_major = -1;
-+ FILE *fl;
-+ char *w;
-+ int have_block = 0;
-+ int have_devices = 0;
-+ int last_num = -1;
-+
-+ if (mdp_major != -1)
-+ return mdp_major;
-+ fl = fopen("/proc/devices", "r");
-+ if (!fl)
-+ return -1;
-+ while ((w = conf_word(fl, 1))) {
-+ if (have_block && strcmp(w, "devices:")==0)
-+ have_devices = 1;
-+ have_block = (strcmp(w, "Block")==0);
-+ if (isdigit(w[0]))
-+ last_num = atoi(w);
-+ if (have_devices && strcmp(w, "mdp")==0)
-+ mdp_major = last_num;
-+ free(w);
-+ }
-+ fclose(fl);
-+ return mdp_major;
-+}
-+
-+int dev_open(char *dev, int flags)
-+{
-+ /* like 'open', but if 'dev' matches %d:%d, create a temp
-+ * block device and open that
-+ */
-+ char *e;
-+ int fd = -1;
-+ char devname[32];
-+ int major;
-+ int minor;
-+
-+ if (!dev) return -1;
-+
-+ major = strtoul(dev, &e, 0);
-+ if (e > dev && *e == ':' && e[1] &&
-+ (minor = strtoul(e+1, &e, 0)) >= 0 &&
-+ *e == 0) {
-+ snprintf(devname, sizeof(devname), "/dev/.tmp.md.%d:%d", major, minor);
-+ if (mknod(devname, S_IFBLK|0600, makedev(major, minor))==0) {
-+ fd = open(devname, flags);
-+ unlink(devname);
-+ }
-+ } else
-+ fd = open(dev, flags);
-+ return fd;
-+}
-+
-+struct superswitch *superlist[] = { &super0, &super1, NULL };
-+
-+struct supertype *super_by_version(int vers, int minor)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+ if (vers == 0) {
-+ st->ss = &super0;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ if (vers == 1) {
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ }
-+ st->minor_version = minor;
-+ return st;
-+}
-+
-+struct supertype *guess_super(int fd)
-+{
-+ /* try each load_super to find the best match,
-+ * and return the best superswitch
-+ */
-+ struct superswitch *ss;
-+ struct supertype *st;
-+ unsigned long besttime = 0;
-+ int bestsuper = -1;
-+
-+ void *sbp = NULL;
-+ int i;
-+
-+ st = malloc(sizeof(*st));
-+ memset(st, 0, sizeof(*st));
-+ for (i=0 ; superlist[i]; i++) {
-+ int rv;
-+ ss = superlist[i];
-+ st->ss = NULL;
-+ rv = ss->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ struct mdinfo info;
-+ ss->getinfo_super(&info, sbp);
-+ if (bestsuper == -1 ||
-+ besttime < info.array.ctime) {
-+ bestsuper = i;
-+ besttime = info.array.ctime;
-+ }
-+ free(sbp);
-+ }
-+ }
-+ if (bestsuper != -1) {
-+ int rv;
-+ st->ss = NULL;
-+ rv = superlist[bestsuper]->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ free(sbp);
-+ return st;
-+ }
-+ }
-+ free(st);
-+ return NULL;
-+}
-+
-+/* Return size of device in bytes */
-+int get_dev_size(int fd, char *dname, unsigned long long *sizep)
-+{
-+ unsigned long long ldsize;
-+#ifdef BLKGETSIZE64
-+ if (ioctl(fd, BLKGETSIZE64, &ldsize) != 0)
-+#endif
-+ {
-+ unsigned long dsize;
-+ if (ioctl(fd, BLKGETSIZE, &dsize) == 0) {
-+ ldsize = dsize;
-+ ldsize <<= 9;
-+ } else {
-+ if (dname)
-+ fprintf(stderr, Name ": Cannot get size of %s: %s\b",
-+ dname, strerror(errno));
-+ return 0;
-+ }
-+ }
-+ *sizep = ldsize;
-+ return 1;
-+}
diff --git a/patches/busybox/1.18.1/README b/patches/busybox/1.18.1/README
index 27c23fe7..654c1725 100644
--- a/patches/busybox/1.18.1/README
+++ b/patches/busybox/1.18.1/README
@@ -1,8 +1,3 @@
-1.18.1-mdadm.diff:
-This adds a minimal mdadm implementation to busybox for scanning for and
-activating mdraid arrays. You can blame robbat2 for this one :)
-Patch ported from 1.7.4 to 1.18.1 by Denis Kaganovich.
-
1.18.1-mdstart.diff:
This adds a 'mdstart' command to busybox, which is used for the activation of
individual mdraid arrays. It originated with 1.1.3+gentoo or earlier.
diff --git a/patches/busybox/1.7.4/1.7.4-mdadm.diff b/patches/busybox/1.7.4/1.7.4-mdadm.diff
deleted file mode 100644
index deb89933..00000000
--- a/patches/busybox/1.7.4/1.7.4-mdadm.diff
+++ /dev/null
@@ -1,5882 +0,0 @@
-Forward-port the mdadm tool from the Gentoo Busybox-1.1.3.
-Should handle all types of metadata 0.90, 1.0, 1.1, 1.2.
-If /etc/mdadm.conf does not exist in the initrd, it is created first, by
-scanning devices, and then it is used.
-
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/Config.in busybox-1.7.4+gentoo+mdadm/Config.in
---- busybox-1.7.4+gentoo/Config.in 2007-09-03 04:48:58.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/Config.in 2008-03-11 10:31:00.000000000 -0700
-@@ -499,2 +499,3 @@
- source e2fsprogs/Config.in
-+source mdadm/Config.in
- source modutils/Config.in
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/include/applets.h busybox-1.7.4+gentoo+mdadm/include/applets.h
---- busybox-1.7.4+gentoo/include/applets.h 2008-03-11 10:25:43.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/include/applets.h 2008-03-11 10:32:22.000000000 -0700
-@@ -223,2 +223,3 @@
- USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
-+USE_MDADM(APPLET(mdadm, _BB_DIR_SBIN, _BB_SUID_NEVER))
- USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/include/usage.h busybox-1.7.4+gentoo+mdadm/include/usage.h
---- busybox-1.7.4+gentoo/include/usage.h 2008-03-11 10:19:04.000000000 -0700
-+++ busybox-1.7.4+gentoo+mdadm/include/usage.h 2008-03-11 10:31:00.000000000 -0700
-@@ -2048,2 +2048,7 @@
-
-+#define mdadm_trivial_usage \
-+ ""
-+#define mdadm_full_usage \
-+ "Assemble or Examine the mdadm arrays."
-+
- #define mdev_trivial_usage \
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/Makefile busybox-1.7.4+gentoo+mdadm/Makefile
---- busybox-1.7.4+gentoo/Makefile 2007-11-23 20:34:41.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/Makefile 2008-03-11 10:31:49.000000000 -0700
-@@ -442,6 +442,7 @@
- libpwdgrp/ \
- loginutils/ \
- miscutils/ \
-+ mdadm/ \
- modutils/ \
- networking/ \
- networking/libiproute/ \
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/bitmap.h busybox-1.7.4+gentoo+mdadm/mdadm/bitmap.h
---- busybox-1.7.4+gentoo/mdadm/bitmap.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/bitmap.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,287 @@
-+/*
-+ * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
-+ *
-+ * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
-+ */
-+#ifndef BITMAP_H
-+#define BITMAP_H 1
-+
-+#define BITMAP_MAJOR_LO 3
-+/* version 4 insists the bitmap is in little-endian order
-+ * with version 3, it is host-endian which is non-portable
-+ */
-+#define BITMAP_MAJOR_HI 4
-+#define BITMAP_MAJOR_HOSTENDIAN 3
-+
-+#define BITMAP_MINOR 39
-+
-+/*
-+ * in-memory bitmap:
-+ *
-+ * Use 16 bit block counters to track pending writes to each "chunk".
-+ * The 2 high order bits are special-purpose, the first is a flag indicating
-+ * whether a resync is needed. The second is a flag indicating whether a
-+ * resync is active.
-+ * This means that the counter is actually 14 bits:
-+ *
-+ * +--------+--------+------------------------------------------------+
-+ * | resync | resync | counter |
-+ * | needed | active | |
-+ * | (0-1) | (0-1) | (0-16383) |
-+ * +--------+--------+------------------------------------------------+
-+ *
-+ * The "resync needed" bit is set when:
-+ * a '1' bit is read from storage at startup.
-+ * a write request fails on some drives
-+ * a resync is aborted on a chunk with 'resync active' set
-+ * It is cleared (and resync-active set) when a resync starts across all drives
-+ * of the chunk.
-+ *
-+ *
-+ * The "resync active" bit is set when:
-+ * a resync is started on all drives, and resync_needed is set.
-+ * resync_needed will be cleared (as long as resync_active wasn't already set).
-+ * It is cleared when a resync completes.
-+ *
-+ * The counter counts pending write requests, plus the on-disk bit.
-+ * When the counter is '1' and the resync bits are clear, the on-disk
-+ * bit can be cleared aswell, thus setting the counter to 0.
-+ * When we set a bit, or in the counter (to start a write), if the fields is
-+ * 0, we first set the disk bit and set the counter to 1.
-+ *
-+ * If the counter is 0, the on-disk bit is clear and the stipe is clean
-+ * Anything that dirties the stipe pushes the counter to 2 (at least)
-+ * and sets the on-disk bit (lazily).
-+ * If a periodic sweep find the counter at 2, it is decremented to 1.
-+ * If the sweep find the counter at 1, the on-disk bit is cleared and the
-+ * counter goes to zero.
-+ *
-+ * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
-+ * counters as a fallback when "page" memory cannot be allocated:
-+ *
-+ * Normal case (page memory allocated):
-+ *
-+ * page pointer (32-bit)
-+ *
-+ * [ ] ------+
-+ * |
-+ * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
-+ * c1 c2 c2048
-+ *
-+ * Hijacked case (page memory allocation failed):
-+ *
-+ * hijacked page pointer (32-bit)
-+ *
-+ * [ ][ ] (no page memory allocated)
-+ * counter #1 (16-bit) counter #2 (16-bit)
-+ *
-+ */
-+
-+#ifdef __KERNEL__
-+
-+#define PAGE_BITS (PAGE_SIZE << 3)
-+#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
-+
-+typedef __u16 bitmap_counter_t;
-+#define COUNTER_BITS 16
-+#define COUNTER_BIT_SHIFT 4
-+#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
-+#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
-+
-+#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
-+#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
-+#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
-+#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
-+#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
-+#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
-+
-+/* how many counters per page? */
-+#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
-+/* same, except a shift value for more efficient bitops */
-+#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
-+/* same, except a mask value for more efficient bitops */
-+#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
-+
-+#define BITMAP_BLOCK_SIZE 512
-+#define BITMAP_BLOCK_SHIFT 9
-+
-+/* how many blocks per chunk? (this is variable) */
-+#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
-+#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
-+
-+/* when hijacked, the counters and bits represent even larger "chunks" */
-+/* there will be 1024 chunks represented by each counter in the page pointers */
-+#define PAGEPTR_BLOCK_RATIO(bitmap) \
-+ (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
-+#define PAGEPTR_BLOCK_SHIFT(bitmap) \
-+ (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
-+#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
-+
-+/*
-+ * on-disk bitmap:
-+ *
-+ * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
-+ * file a page at a time. There's a superblock at the start of the file.
-+ */
-+
-+/* map chunks (bits) to file pages - offset by the size of the superblock */
-+#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
-+
-+#endif
-+
-+/*
-+ * bitmap structures:
-+ */
-+
-+#define BITMAP_MAGIC 0x6d746962
-+
-+/* use these for bitmap->flags and bitmap->sb->state bit-fields */
-+enum bitmap_state {
-+ BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
-+ BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */
-+};
-+
-+/* the superblock at the front of the bitmap file -- little endian */
-+typedef struct bitmap_super_s {
-+ __u32 magic; /* 0 BITMAP_MAGIC */
-+ __u32 version; /* 4 the bitmap major for now, could change... */
-+ __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
-+ __u64 events; /* 24 event counter for the bitmap (1)*/
-+ __u64 events_cleared;/*32 event counter when last bit cleared (2) */
-+ __u64 sync_size; /* 40 the size of the md device's sync range(3) */
-+ __u32 state; /* 48 bitmap state information */
-+ __u32 chunksize; /* 52 the bitmap chunk size in bytes */
-+ __u32 daemon_sleep; /* 56 seconds between disk flushes */
-+ __u32 write_behind; /* 60 number of outstanding write-behind writes */
-+
-+ __u8 pad[256 - 64]; /* set to zero */
-+} bitmap_super_t;
-+
-+/* notes:
-+ * (1) This event counter is updated before the eventcounter in the md superblock
-+ * When a bitmap is loaded, it is only accepted if this event counter is equal
-+ * to, or one greater than, the event counter in the superblock.
-+ * (2) This event counter is updated when the other one is *if*and*only*if* the
-+ * array is not degraded. As bits are not cleared when the array is degraded,
-+ * this represents the last time that any bits were cleared.
-+ * If a device is being added that has an event count with this value or
-+ * higher, it is accepted as conforming to the bitmap.
-+ * (3)This is the number of sectors represented by the bitmap, and is the range that
-+ * resync happens across. For raid1 and raid5/6 it is the size of individual
-+ * devices. For raid10 it is the size of the array.
-+ */
-+
-+#ifdef __KERNEL__
-+
-+/* the in-memory bitmap is represented by bitmap_pages */
-+struct bitmap_page {
-+ /*
-+ * map points to the actual memory page
-+ */
-+ char *map;
-+ /*
-+ * in emergencies (when map cannot be alloced), hijack the map
-+ * pointer and use it as two counters itself
-+ */
-+ unsigned int hijacked;
-+ /*
-+ * count of dirty bits on the page
-+ */
-+ int count;
-+};
-+
-+/* keep track of bitmap file pages that have pending writes on them */
-+struct page_list {
-+ struct list_head list;
-+ struct page *page;
-+};
-+
-+/* the main bitmap structure - one per mddev */
-+struct bitmap {
-+ struct bitmap_page *bp;
-+ unsigned long pages; /* total number of pages in the bitmap */
-+ unsigned long missing_pages; /* number of pages not yet allocated */
-+
-+ mddev_t *mddev; /* the md device that the bitmap is for */
-+
-+ int counter_bits; /* how many bits per block counter */
-+
-+ /* bitmap chunksize -- how much data does each bit represent? */
-+ unsigned long chunksize;
-+ unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
-+ unsigned long chunks; /* total number of data chunks for the array */
-+
-+ /* We hold a count on the chunk currently being synced, and drop
-+ * it when the last block is started. If the resync is aborted
-+ * midway, we need to be able to drop that count, so we remember
-+ * the counted chunk..
-+ */
-+ unsigned long syncchunk;
-+
-+ __u64 events_cleared;
-+
-+ /* bitmap spinlock */
-+ spinlock_t lock;
-+
-+ struct file *file; /* backing disk file */
-+ struct page *sb_page; /* cached copy of the bitmap file superblock */
-+ struct page **filemap; /* list of cache pages for the file */
-+ unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
-+ unsigned long file_pages; /* number of pages in the file */
-+
-+ unsigned long flags;
-+
-+ /*
-+ * the bitmap daemon - periodically wakes up and sweeps the bitmap
-+ * file, cleaning up bits and flushing out pages to disk as necessary
-+ */
-+ mdk_thread_t *daemon;
-+ unsigned long daemon_sleep; /* how many seconds between updates? */
-+
-+ /*
-+ * bitmap write daemon - this daemon performs writes to the bitmap file
-+ * this thread is only needed because of a limitation in ext3 (jbd)
-+ * that does not allow a task to have two journal transactions ongoing
-+ * simultaneously (even if the transactions are for two different
-+ * filesystems) -- in the case of bitmap, that would be the filesystem
-+ * that the bitmap file resides on and the filesystem that is mounted
-+ * on the md device -- see current->journal_info in jbd/transaction.c
-+ */
-+ mdk_thread_t *write_daemon;
-+ mdk_thread_t *writeback_daemon;
-+ spinlock_t write_lock;
-+ struct semaphore write_ready;
-+ struct semaphore write_done;
-+ unsigned long writes_pending;
-+ wait_queue_head_t write_wait;
-+ struct list_head write_pages;
-+ struct list_head complete_pages;
-+ mempool_t *write_pool;
-+};
-+
-+/* the bitmap API */
-+
-+/* these are used only by md/bitmap */
-+int bitmap_create(mddev_t *mddev);
-+void bitmap_destroy(mddev_t *mddev);
-+int bitmap_active(struct bitmap *bitmap);
-+
-+char *file_path(struct file *file, char *buf, int count);
-+void bitmap_print_sb(struct bitmap *bitmap);
-+int bitmap_update_sb(struct bitmap *bitmap);
-+
-+int bitmap_setallbits(struct bitmap *bitmap);
-+
-+/* these are exported */
-+void bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
-+void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
-+ int success);
-+int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks);
-+void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
-+void bitmap_close_sync(struct bitmap *bitmap);
-+
-+int bitmap_unplug(struct bitmap *bitmap);
-+#endif
-+
-+#endif
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/config.c busybox-1.7.4+gentoo+mdadm/mdadm/config.c
---- busybox-1.7.4+gentoo/mdadm/config.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/config.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,824 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+#include <sys/dir.h>
-+#include <glob.h>
-+#include <fnmatch.h>
-+#include <ctype.h>
-+#include <pwd.h>
-+#include <grp.h>
-+
-+mapping_t r5layout[] = {
-+ { "left-asymmetric", 0},
-+ { "right-asymmetric", 1},
-+ { "left-symmetric", 2},
-+ { "right-symmetric", 3},
-+
-+ { "default", 2},
-+ { "la", 0},
-+ { "ra", 1},
-+ { "ls", 2},
-+ { "rs", 3},
-+ { NULL, 0}
-+};
-+
-+mapping_t pers[] = {
-+ { "linear", -1},
-+ { "raid0", 0},
-+ { "0", 0},
-+ { "stripe", 0},
-+ { "raid1", 1},
-+ { "1", 1},
-+ { "mirror", 1},
-+ { "raid4", 4},
-+ { "4", 4},
-+ { "raid5", 5},
-+ { "5", 5},
-+ { "multipath", -4},
-+ { "mp", -4},
-+ { "raid6", 6},
-+ { "6", 6},
-+ { "raid10", 10},
-+ { "10", 10},
-+ { "faulty", -5},
-+ { NULL, 0}
-+};
-+/*
-+ * Read the config file
-+ *
-+ * conf_get_uuids gets a list of devicename+uuid pairs
-+ * conf_get_devs gets device names after expanding wildcards
-+ *
-+ * Each keeps the returned list and frees it when asked to make
-+ * a new list.
-+ *
-+ * The format of the config file needs to be fairly extensible.
-+ * Now, arrays only have names and uuids and devices merely are.
-+ * But later arrays might want names, and devices might want superblock
-+ * versions, and who knows what else.
-+ * I like free format, abhore backslash line continuation, adore
-+ * indentation for structure and am ok about # comments.
-+ *
-+ * So, each line that isn't blank or a #comment must either start
-+ * with a key word, and not be indented, or must start with a
-+ * non-key-word and must be indented.
-+ *
-+ * Keywords are DEVICE and ARRAY
-+ * DEV{ICE} introduces some devices that might contain raid components.
-+ * e.g.
-+ * DEV style=0 /dev/sda* /dev/hd*
-+ * DEV style=1 /dev/sd[b-f]*
-+ * ARR{AY} describes an array giving md device and attributes like uuid=whatever
-+ * e.g.
-+ * ARRAY /dev/md0 uuid=whatever name=something
-+ * Spaces separate words on each line. Quoting, with "" or '' protects them,
-+ * but may not wrap over lines
-+ *
-+ */
-+
-+#ifndef CONFFILE
-+#define CONFFILE "/etc/mdadm.conf"
-+#endif
-+#ifndef CONFFILE2
-+/* for Debian compatibility .... */
-+#define CONFFILE2 "/etc/mdadm/mdadm.conf"
-+#endif
-+char DefaultConfFile[] = CONFFILE;
-+char DefaultAltConfFile[] = CONFFILE2;
-+
-+enum linetype { Devices, Array, Mailaddr, Mailfrom, Program, CreateDev, Homehost, LTEnd };
-+char *keywords[] = {
-+ [Devices] = "devices",
-+ [Array] = "array",
-+ [Mailaddr] = "mailaddr",
-+ [Mailfrom] = "mailfrom",
-+ [Program] = "program",
-+ [CreateDev]= "create",
-+ [Homehost] = "homehost",
-+ [LTEnd] = NULL
-+};
-+
-+/*
-+ * match_keyword returns an index into the keywords array, or -1 for no match
-+ * case is ignored, and at least three characters must be given
-+ */
-+
-+int match_keyword(char *word)
-+{
-+ int len = strlen(word);
-+ int n;
-+
-+ if (len < 3) return -1;
-+ for (n=0; keywords[n]; n++) {
-+ if (strncasecmp(word, keywords[n], len)==0)
-+ return n;
-+ }
-+ return -1;
-+}
-+
-+/* conf_word gets one word from the conf file.
-+ * if "allow_key", then accept words at the start of a line,
-+ * otherwise stop when such a word is found.
-+ * We assume that the file pointer is at the end of a word, so the
-+ * next character is a space, or a newline. If not, it is the start of a line.
-+ */
-+
-+char *conf_word(FILE *file, int allow_key)
-+{
-+ int wsize = 100;
-+ int len = 0;
-+ int c;
-+ int quote;
-+ int wordfound = 0;
-+ char *word = malloc(wsize);
-+
-+ if (!word) abort();
-+
-+ while (wordfound==0) {
-+ /* at the end of a word.. */
-+ c = getc(file);
-+ if (c == '#')
-+ while (c != EOF && c != '\n')
-+ c = getc(file);
-+ if (c == EOF) break;
-+ if (c == '\n') continue;
-+
-+ if (c != ' ' && c != '\t' && ! allow_key) {
-+ ungetc(c, file);
-+ break;
-+ }
-+ /* looks like it is safe to get a word here, if there is one */
-+ quote = 0;
-+ /* first, skip any spaces */
-+ while (c == ' ' || c == '\t')
-+ c = getc(file);
-+ if (c != EOF && c != '\n' && c != '#') {
-+ /* we really have a character of a word, so start saving it */
-+ while (c != EOF && c != '\n' && (quote || (c!=' ' && c != '\t'))) {
-+ wordfound = 1;
-+ if (quote && c == quote) quote = 0;
-+ else if (quote == 0 && (c == '\'' || c == '"'))
-+ quote = c;
-+ else {
-+ if (len == wsize-1) {
-+ wsize += 100;
-+ word = realloc(word, wsize);
-+ if (!word) abort();
-+ }
-+ word[len++] = c;
-+ }
-+ c = getc(file);
-+ }
-+ }
-+ if (c != EOF) ungetc(c, file);
-+ }
-+ word[len] = 0;
-+/* printf("word is <%s>\n", word); */
-+ if (!wordfound) {
-+ free(word);
-+ word = NULL;
-+ }
-+ return word;
-+}
-+
-+/*
-+ * conf_line reads one logical line from the conffile.
-+ * It skips comments and continues until it finds a line that starts
-+ * with a non blank/comment. This character is pushed back for the next call
-+ * A doubly linked list of words is returned.
-+ * the first word will be a keyword. Other words will have had quotes removed.
-+ */
-+
-+char *conf_line(FILE *file)
-+{
-+ char *w;
-+ char *list;
-+
-+ w = conf_word(file, 1);
-+ if (w == NULL) return NULL;
-+
-+ list = dl_strdup(w);
-+ free(w);
-+ dl_init(list);
-+
-+ while ((w = conf_word(file,0))){
-+ char *w2 = dl_strdup(w);
-+ free(w);
-+ dl_add(list, w2);
-+ }
-+/* printf("got a line\n");*/
-+ return list;
-+}
-+
-+void free_line(char *line)
-+{
-+ char *w;
-+ for (w=dl_next(line); w != line; w=dl_next(line)) {
-+ dl_del(w);
-+ dl_free(w);
-+ }
-+ dl_free(line);
-+}
-+
-+
-+struct conf_dev {
-+ struct conf_dev *next;
-+ char *name;
-+} *cdevlist = NULL;
-+
-+mddev_dev_t load_partitions(void)
-+{
-+ FILE *f = fopen("/proc/partitions", "r");
-+ char buf[1024];
-+ mddev_dev_t rv = NULL;
-+ if (f == NULL) {
-+ fprintf(stderr, Name ": cannot open /proc/partitions\n");
-+ return NULL;
-+ }
-+ while (fgets(buf, 1024, f)) {
-+ int major, minor;
-+ char *name, *mp;
-+ mddev_dev_t d;
-+
-+ buf[1023] = '\0';
-+ if (buf[0] != ' ')
-+ continue;
-+ major = strtoul(buf, &mp, 10);
-+ if (mp == buf || *mp != ' ')
-+ continue;
-+ minor = strtoul(mp, NULL, 10);
-+
-+ name = map_dev(major, minor, 1);
-+ if (!name)
-+ continue;
-+ d = malloc(sizeof(*d));
-+ d->devname = strdup(name);
-+ d->next = rv;
-+ d->used = 0;
-+ rv = d;
-+ }
-+ fclose(f);
-+ return rv;
-+}
-+
-+struct createinfo createinfo = {
-+ .autof = 2, /* by default, create devices with standard names */
-+ .symlinks = 1,
-+#ifdef DEBIAN
-+ .gid = 6, /* disk */
-+ .mode = 0660,
-+#else
-+ .mode = 0600,
-+#endif
-+};
-+
-+int parse_auto(char *str, char *msg, int config)
-+{
-+ int autof;
-+ if (str == NULL || *str == 0)
-+ autof = 2;
-+ else if (strcasecmp(str,"no")==0)
-+ autof = 1;
-+ else if (strcasecmp(str,"yes")==0)
-+ autof = 2;
-+ else if (strcasecmp(str,"md")==0)
-+ autof = config?5:3;
-+ else {
-+ /* There might be digits, and maybe a hypen, at the end */
-+ char *e = str + strlen(str);
-+ int num = 4;
-+ int len;
-+ while (e > str && isdigit(e[-1]))
-+ e--;
-+ if (*e) {
-+ num = atoi(e);
-+ if (num <= 0) num = 1;
-+ }
-+ if (e > str && e[-1] == '-')
-+ e--;
-+ len = e - str;
-+ if ((len == 2 && strncasecmp(str,"md",2)==0)) {
-+ autof = config ? 5 : 3;
-+ } else if ((len == 3 && strncasecmp(str,"yes",3)==0)) {
-+ autof = 2;
-+ } else if ((len == 3 && strncasecmp(str,"mdp",3)==0)) {
-+ autof = config ? 6 : 4;
-+ } else if ((len == 1 && strncasecmp(str,"p",1)==0) ||
-+ (len >= 4 && strncasecmp(str,"part",4)==0)) {
-+ autof = 6;
-+ } else {
-+ fprintf(stderr, Name ": %s arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
-+ " optionally followed by a number.\n",
-+ msg, str);
-+ exit(2);
-+ }
-+ autof |= num << 3;
-+ }
-+ return autof;
-+}
-+
-+static void createline(char *line)
-+{
-+ char *w;
-+ char *ep;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (strncasecmp(w, "auto=", 5) == 0)
-+ createinfo.autof = parse_auto(w+5, "auto=", 1);
-+ else if (strncasecmp(w, "owner=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing owner name\n");
-+ continue;
-+ }
-+ createinfo.uid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct passwd *pw;
-+ /* must be a name */
-+ pw = getpwnam(w+6);
-+ if (pw)
-+ createinfo.uid = pw->pw_uid;
-+ else
-+ fprintf(stderr, Name ": CREATE user %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "group=", 6) == 0) {
-+ if (w[6] == 0) {
-+ fprintf(stderr, Name ": missing group name\n");
-+ continue;
-+ }
-+ createinfo.gid = strtoul(w+6, &ep, 10);
-+ if (*ep != 0) {
-+ struct group *gr;
-+ /* must be a name */
-+ gr = getgrnam(w+6);
-+ if (gr)
-+ createinfo.gid = gr->gr_gid;
-+ else
-+ fprintf(stderr, Name ": CREATE group %s not found\n", w+6);
-+ }
-+ } else if (strncasecmp(w, "mode=", 5) == 0) {
-+ if (w[5] == 0) {
-+ fprintf(stderr, Name ": missing CREATE mode\n");
-+ continue;
-+ }
-+ createinfo.mode = strtoul(w+5, &ep, 8);
-+ if (*ep != 0) {
-+ createinfo.mode = 0600;
-+ fprintf(stderr, Name ": unrecognised CREATE mode %s\n",
-+ w+5);
-+ }
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata to use by default */
-+ int i;
-+ for (i=0; superlist[i] && !createinfo.supertype; i++)
-+ createinfo.supertype =
-+ superlist[i]->match_metadata_desc(w+9);
-+ if (!createinfo.supertype)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignoring\n",
-+ w+9);
-+ } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
-+ createinfo.symlinks = 1;
-+ else if (strncasecmp(w, "symlinks=no", 11) == 0)
-+ createinfo.symlinks = 0;
-+ else {
-+ fprintf(stderr, Name ": unrecognised word on CREATE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+void devline(char *line)
-+{
-+ char *w;
-+ struct conf_dev *cd;
-+
-+ for (w=dl_next(line); w != line; w=dl_next(w)) {
-+ if (w[0] == '/' || strcasecmp(w, "partitions") == 0) {
-+ cd = malloc(sizeof(*cd));
-+ cd->name = strdup(w);
-+ cd->next = cdevlist;
-+ cdevlist = cd;
-+ } else {
-+ fprintf(stderr, Name ": unreconised word on DEVICE line: %s\n",
-+ w);
-+ }
-+ }
-+}
-+
-+mddev_ident_t mddevlist = NULL;
-+mddev_ident_t *mddevlp = &mddevlist;
-+
-+void arrayline(char *line)
-+{
-+ char *w;
-+
-+ struct mddev_ident_s mis;
-+ mddev_ident_t mi;
-+
-+ mis.uuid_set = 0;
-+ mis.super_minor = UnSet;
-+ mis.level = UnSet;
-+ mis.raid_disks = UnSet;
-+ mis.spare_disks = 0;
-+ mis.devices = NULL;
-+ mis.devname = NULL;
-+ mis.spare_group = NULL;
-+ mis.autof = 0;
-+ mis.next = NULL;
-+ mis.st = NULL;
-+ mis.bitmap_fd = -1;
-+ mis.bitmap_file = NULL;
-+ mis.name[0] = 0;
-+
-+ for (w=dl_next(line); w!=line; w=dl_next(w)) {
-+ if (w[0] == '/') {
-+ if (mis.devname)
-+ fprintf(stderr, Name ": only give one device per ARRAY line: %s and %s\n",
-+ mis.devname, w);
-+ else mis.devname = w;
-+ } else if (strncasecmp(w, "uuid=", 5)==0 ) {
-+ if (mis.uuid_set)
-+ fprintf(stderr, Name ": only specify uuid once, %s ignored.\n",
-+ w);
-+ else {
-+ if (parse_uuid(w+5, mis.uuid))
-+ mis.uuid_set = 1;
-+ else
-+ fprintf(stderr, Name ": bad uuid: %s\n", w);
-+ }
-+ } else if (strncasecmp(w, "super-minor=", 12)==0 ) {
-+ if (mis.super_minor != UnSet)
-+ fprintf(stderr, Name ": only specify super-minor once, %s ignored.\n",
-+ w);
-+ else {
-+ char *endptr;
-+ mis.super_minor= strtol(w+12, &endptr, 10);
-+ if (w[12]==0 || endptr[0]!=0 || mis.super_minor < 0) {
-+ fprintf(stderr, Name ": invalid super-minor number: %s\n",
-+ w);
-+ mis.super_minor = UnSet;
-+ }
-+ }
-+ } else if (strncasecmp(w, "name=", 5)==0) {
-+ if (mis.name[0])
-+ fprintf(stderr, Name ": only specify name once, %s ignored.\n",
-+ w);
-+ else if (strlen(w+5) > 32)
-+ fprintf(stderr, Name ": name too long, ignoring %s\n", w);
-+ else
-+ strcpy(mis.name, w+5);
-+
-+ } else if (strncasecmp(w, "bitmap=", 7) == 0) {
-+ if (mis.bitmap_file)
-+ fprintf(stderr, Name ": only specify bitmap file once. %s ignored\n",
-+ w);
-+ else
-+ mis.bitmap_file = strdup(w+7);
-+
-+ } else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
-+ if (mis.devices)
-+ fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
-+ w);
-+ else
-+ mis.devices = strdup(w+8);
-+ } else if (strncasecmp(w, "spare-group=", 12) == 0 ) {
-+ if (mis.spare_group)
-+ fprintf(stderr, Name ": only specify one spare group per array. %s ignored.\n",
-+ w);
-+ else
-+ mis.spare_group = strdup(w+12);
-+ } else if (strncasecmp(w, "level=", 6) == 0 ) {
-+ /* this is mainly for compatability with --brief output */
-+ mis.level = map_name(pers, w+6);
-+ } else if (strncasecmp(w, "disks=", 6) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+6);
-+ } else if (strncasecmp(w, "num-devices=", 12) == 0 ) {
-+ /* again, for compat */
-+ mis.raid_disks = atoi(w+12);
-+ } else if (strncasecmp(w, "spares=", 7) == 0 ) {
-+ /* for warning if not all spares present */
-+ mis.spare_disks = atoi(w+7);
-+ } else if (strncasecmp(w, "metadata=", 9) == 0) {
-+ /* style of metadata on the devices. */
-+ int i;
-+
-+ for(i=0; superlist[i] && !mis.st; i++)
-+ mis.st = superlist[i]->match_metadata_desc(w+9);
-+
-+ if (!mis.st)
-+ fprintf(stderr, Name ": metadata format %s unknown, ignored.\n", w+9);
-+ } else if (strncasecmp(w, "auto=", 5) == 0 ) {
-+ /* whether to create device special files as needed */
-+ mis.autof = parse_auto(w+5, "auto type", 0);
-+ } else {
-+ fprintf(stderr, Name ": unrecognised word on ARRAY line: %s\n",
-+ w);
-+ }
-+ }
-+ if (mis.devname == NULL)
-+ fprintf(stderr, Name ": ARRAY line with no device\n");
-+ else if (mis.uuid_set == 0 && mis.devices == NULL && mis.super_minor == UnSet && mis.name[0] == 0)
-+ fprintf(stderr, Name ": ARRAY line %s has no identity information.\n", mis.devname);
-+ else {
-+ mi = malloc(sizeof(*mi));
-+ *mi = mis;
-+ mi->devname = strdup(mis.devname);
-+ mi->next = NULL;
-+ *mddevlp = mi;
-+ mddevlp = &mi->next;
-+ }
-+}
-+
-+static char *alert_email = NULL;
-+void mailline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_email == NULL)
-+ alert_email = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess address on MAIL line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *alert_mail_from = NULL;
-+void mailfromline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_mail_from == NULL)
-+ alert_mail_from = strdup(w);
-+ else {
-+ char *t= NULL;
-+ asprintf(&t, "%s %s", alert_mail_from, w);
-+ free(alert_mail_from);
-+ alert_mail_from = t;
-+ }
-+ }
-+}
-+
-+
-+static char *alert_program = NULL;
-+void programline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (alert_program == NULL)
-+ alert_program = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess program on PROGRAM line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+static char *home_host = NULL;
-+void homehostline(char *line)
-+{
-+ char *w;
-+
-+ for (w=dl_next(line); w != line ; w=dl_next(w)) {
-+ if (home_host == NULL)
-+ home_host = strdup(w);
-+ else
-+ fprintf(stderr, Name ": excess host name on HOMEHOST line: %s - ignored\n",
-+ w);
-+ }
-+}
-+
-+
-+int loaded = 0;
-+
-+static char *conffile = NULL;
-+void set_conffile(char *file)
-+{
-+ conffile = file;
-+}
-+
-+void load_conffile(void)
-+{
-+ FILE *f;
-+ char *line;
-+
-+ if (loaded) return;
-+ if (conffile == NULL)
-+ conffile = DefaultConfFile;
-+
-+ if (strcmp(conffile, "none") == 0) {
-+ loaded = 1;
-+ return;
-+ }
-+ if (strcmp(conffile, "partitions")==0) {
-+ char *list = dl_strdup("DEV");
-+ dl_init(list);
-+ dl_add(list, dl_strdup("partitions"));
-+ devline(list);
-+ free_line(list);
-+ loaded = 1;
-+ return;
-+ }
-+ f = fopen(conffile, "r");
-+ /* Debian chose to relocate mdadm.conf into /etc/mdadm/.
-+ * To allow Debian users to compile from clean source and still
-+ * have a working mdadm, we read /etc/mdadm/mdadm.conf
-+ * if /etc/mdadm.conf doesn't exist
-+ */
-+ if (f == NULL &&
-+ conffile == DefaultConfFile) {
-+ f = fopen(DefaultAltConfFile, "r");
-+ if (f)
-+ conffile = DefaultAltConfFile;
-+ }
-+ if (f == NULL)
-+ return;
-+
-+ loaded = 1;
-+ while ((line=conf_line(f))) {
-+ switch(match_keyword(line)) {
-+ case Devices:
-+ devline(line);
-+ break;
-+ case Array:
-+ arrayline(line);
-+ break;
-+ case Mailaddr:
-+ mailline(line);
-+ break;
-+ case Mailfrom:
-+ mailfromline(line);
-+ break;
-+ case Program:
-+ programline(line);
-+ break;
-+ case CreateDev:
-+ createline(line);
-+ break;
-+ case Homehost:
-+ homehostline(line);
-+ break;
-+ default:
-+ fprintf(stderr, Name ": Unknown keyword %s\n", line);
-+ }
-+ free_line(line);
-+ }
-+
-+ fclose(f);
-+
-+/* printf("got file\n"); */
-+}
-+
-+char *conf_get_mailaddr(void)
-+{
-+ load_conffile();
-+ return alert_email;
-+}
-+
-+char *conf_get_mailfrom(void)
-+{
-+ load_conffile();
-+ return alert_mail_from;
-+}
-+
-+char *conf_get_program(void)
-+{
-+ load_conffile();
-+ return alert_program;
-+}
-+
-+char *conf_get_homehost(void)
-+{
-+ load_conffile();
-+ return home_host;
-+}
-+
-+struct createinfo *conf_get_create_info(void)
-+{
-+ load_conffile();
-+ return &createinfo;
-+}
-+
-+mddev_ident_t conf_get_ident(char *dev)
-+{
-+ mddev_ident_t rv;
-+ load_conffile();
-+ rv = mddevlist;
-+ while (dev && rv && strcmp(dev, rv->devname)!=0)
-+ rv = rv->next;
-+ return rv;
-+}
-+
-+mddev_dev_t conf_get_devs()
-+{
-+ glob_t globbuf;
-+ struct conf_dev *cd;
-+ int flags = 0;
-+ static mddev_dev_t dlist = NULL;
-+ unsigned int i;
-+
-+ while (dlist) {
-+ mddev_dev_t t = dlist;
-+ dlist = dlist->next;
-+ free(t->devname);
-+ free(t);
-+ }
-+
-+ load_conffile();
-+
-+ if (cdevlist == NULL)
-+ /* default to 'partitions */
-+ dlist = load_partitions();
-+
-+ for (cd=cdevlist; cd; cd=cd->next) {
-+ if (strcasecmp(cd->name, "partitions")==0 && dlist == NULL)
-+ dlist = load_partitions();
-+ else {
-+ glob(cd->name, flags, NULL, &globbuf);
-+ flags |= GLOB_APPEND;
-+ }
-+ }
-+ if (flags & GLOB_APPEND) {
-+ for (i=0; i<globbuf.gl_pathc; i++) {
-+ mddev_dev_t t = malloc(sizeof(*t));
-+ t->devname = strdup(globbuf.gl_pathv[i]);
-+ t->next = dlist;
-+ t->used = 0;
-+ dlist = t;
-+/* printf("one dev is %s\n", t->devname);*/
-+ }
-+ globfree(&globbuf);
-+ }
-+
-+ return dlist;
-+}
-+
-+int conf_test_dev(char *devname)
-+{
-+ struct conf_dev *cd;
-+ if (cdevlist == NULL)
-+ /* allow anything by default */
-+ return 1;
-+ for (cd = cdevlist ; cd ; cd = cd->next) {
-+ if (strcasecmp(cd->name, "partitions") == 0)
-+ return 1;
-+ if (fnmatch(cd->name, devname, FNM_PATHNAME) == 0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+
-+int match_oneof(char *devices, char *devname)
-+{
-+ /* check if one of the comma separated patterns in devices
-+ * matches devname
-+ */
-+
-+
-+ while (devices && *devices) {
-+ char patn[1024];
-+ char *p = devices;
-+ devices = strchr(devices, ',');
-+ if (!devices)
-+ devices = p + strlen(p);
-+ if (devices-p < 1024) {
-+ strncpy(patn, p, devices-p);
-+ patn[devices-p] = 0;
-+ if (fnmatch(patn, devname, FNM_PATHNAME)==0)
-+ return 1;
-+ }
-+ if (*devices == ',')
-+ devices++;
-+ }
-+ return 0;
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/Config.in busybox-1.7.4+gentoo+mdadm/mdadm/Config.in
---- busybox-1.7.4+gentoo/mdadm/Config.in 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/Config.in 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,15 @@
-+#
-+# For a description of the syntax of this configuration file,
-+# see scripts/kbuild/config-language.txt.
-+#
-+
-+menu "Linux mdadm Utilities"
-+
-+config MDADM
-+ bool "mdadm"
-+ default n
-+ help
-+ assemble or examine raid array
-+
-+endmenu
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/dlink.c busybox-1.7.4+gentoo+mdadm/mdadm/dlink.c
---- busybox-1.7.4+gentoo/mdadm/dlink.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/dlink.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,79 @@
-+
-+/* doubly linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+#include <unistd.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#ifdef __dietlibc__
-+char *strncpy(char *dest, const char *src, size_t n) __THROW;
-+#endif
-+#include "dlink.h"
-+
-+
-+void *dl_head()
-+{
-+ void *h;
-+ h = dl_alloc(0);
-+ dl_next(h) = h;
-+ dl_prev(h) = h;
-+ return h;
-+}
-+
-+void dl_free(void *v)
-+{
-+ struct __dl_head *vv = v;
-+ free(vv-1);
-+}
-+
-+void dl_init(void *v)
-+{
-+ dl_next(v) = v;
-+ dl_prev(v) = v;
-+}
-+
-+void dl_insert(void *head, void *val)
-+{
-+ dl_next(val) = dl_next(head);
-+ dl_prev(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_add(void *head, void *val)
-+{
-+ dl_prev(val) = dl_prev(head);
-+ dl_next(val) = head;
-+ dl_next(dl_prev(val)) = val;
-+ dl_prev(dl_next(val)) = val;
-+}
-+
-+void dl_del(void *val)
-+{
-+ if (dl_prev(val) == 0 || dl_next(val) == 0)
-+ return;
-+ dl_prev(dl_next(val)) = dl_prev(val);
-+ dl_next(dl_prev(val)) = dl_next(val);
-+ dl_prev(val) = dl_next(val) = 0;
-+}
-+
-+char *dl_strndup(char *s, int l)
-+{
-+ char *n;
-+ if (s == NULL)
-+ return NULL;
-+ n = dl_newv(char, l+1);
-+ if (n == NULL)
-+ return NULL;
-+ else
-+ {
-+ strncpy(n, s, l);
-+ n[l] = 0;
-+ return n;
-+ }
-+}
-+
-+char *dl_strdup(char *s)
-+{
-+ return dl_strndup(s, (int)strlen(s));
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/dlink.h busybox-1.7.4+gentoo+mdadm/mdadm/dlink.h
---- busybox-1.7.4+gentoo/mdadm/dlink.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/dlink.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,25 @@
-+
-+/* doubley linked lists */
-+/* This is free software. No strings attached. No copyright claimed */
-+
-+struct __dl_head
-+{
-+ void * dh_prev;
-+ void * dh_next;
-+};
-+
-+#define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
-+#define dl_new(t) ((t*)dl_alloc(sizeof(t)))
-+#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n))
-+
-+#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next))
-+#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
-+
-+void *dl_head(void);
-+char *dl_strdup(char *);
-+char *dl_strndup(char *, int);
-+void dl_insert(void*, void*);
-+void dl_add(void*, void*);
-+void dl_del(void*);
-+void dl_free(void*);
-+void dl_init(void*);
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md5.h busybox-1.7.4+gentoo+mdadm/mdadm/md5.h
---- busybox-1.7.4+gentoo/mdadm/md5.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md5.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,134 @@
-+/* Declaration of functions and data types used for MD5 sum computing
-+ library functions.
-+ Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc.
-+
-+ NOTE: The canonical source of this file is maintained with the GNU C
-+ Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+#ifndef _MD5_H
-+#define _MD5_H 1
-+
-+#include <stdio.h>
-+
-+# include <inttypes.h>
-+#if HAVE_STDINT_H || _LIBC
-+# include <stdint.h>
-+#endif
-+
-+#ifndef __GNUC_PREREQ
-+# if defined __GNUC__ && defined __GNUC_MINOR__
-+# define __GNUC_PREREQ(maj, min) \
-+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-+# else
-+# define __GNUC_PREREQ(maj, min) 0
-+# endif
-+#endif
-+
-+#ifndef __THROW
-+# if defined __cplusplus && __GNUC_PREREQ (2,8)
-+# define __THROW throw ()
-+# else
-+# define __THROW
-+# endif
-+#endif
-+
-+#ifndef __attribute__
-+# if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
-+# define __attribute__(x)
-+# endif
-+#endif
-+
-+#ifndef _LIBC
-+# define __md5_buffer md5_buffer
-+# define __md5_finish_ctx md5_finish_ctx
-+# define __md5_init_ctx md5_init_ctx
-+# define __md5_process_block md5_process_block
-+# define __md5_process_bytes md5_process_bytes
-+# define __md5_read_ctx md5_read_ctx
-+# define __md5_stream md5_stream
-+#endif
-+
-+typedef uint32_t md5_uint32;
-+
-+/* Structure to save state of computation between the single steps. */
-+struct md5_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+/*
-+ * The following three functions are build up the low level used in
-+ * the functions `md5_stream' and `md5_buffer'.
-+ */
-+
-+/* Initialize structure containing state of computation.
-+ (RFC 1321, 3.3: Step 3) */
-+extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void __md5_process_block (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void __md5_process_bytes (const void *buffer, size_t len,
-+ struct md5_ctx *ctx) __THROW;
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 16 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Put result from CTX in first 16 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
-+
-+
-+/* Compute MD5 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+extern int __md5_stream (FILE *stream, void *resblock) __THROW;
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *__md5_buffer (const char *buffer, size_t len,
-+ void *resblock) __THROW;
-+
-+#endif /* md5.h */
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdadm.c busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.c
---- busybox-1.7.4+gentoo/mdadm/mdadm.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,18 @@
-+/*
-+ * mdadm support for busybox.
-+ * added by Alan Hourihane <alanh@fairlite.demon.co.uk>
-+ */
-+#include <string.h>
-+
-+extern int mdassemble_main(int argc, char **argv);
-+extern int mdexamine_main(int argc, char **argv);
-+
-+int mdadm_main(int argc, char **argv) {
-+ if (argc >= 2) {
-+ if (!strncmp(argv[1],"--assemble",10))
-+ return mdassemble_main(argc, argv);
-+ if (!strncmp(argv[1],"--examine",9))
-+ return mdexamine_main(argc, argv);
-+ }
-+ return 0;
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdadm.h busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.h
---- busybox-1.7.4+gentoo/mdadm/mdadm.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdadm.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,540 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include <unistd.h>
-+#ifndef __dietlibc__
-+extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
-+#else
-+# if defined(__NO_STAT64) || __WORDSIZE != 32
-+# define lseek64 lseek
-+# endif
-+#endif
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sys/time.h>
-+#include <getopt.h>
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <errno.h>
-+#include <string.h>
-+#include <syslog.h>
-+#ifdef __dietlibc__
-+#include <strings.h>
-+/* dietlibc has deprecated random and srandom!! */
-+#define random rand
-+#define srandom srand
-+#endif
-+
-+
-+#include <linux/kdev_t.h>
-+/*#include <linux/fs.h> */
-+#include <sys/mount.h>
-+#include <asm/types.h>
-+#include <sys/ioctl.h>
-+#define MD_MAJOR 9
-+#define MdpMinorShift 6
-+
-+#ifndef BLKGETSIZE64
-+#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
-+#endif
-+
-+#define DEFAULT_BITMAP_CHUNK 4096
-+#define DEFAULT_BITMAP_DELAY 5
-+#define DEFAULT_MAX_WRITE_BEHIND 256
-+
-+#include "md_u.h"
-+#include "md_p.h"
-+#include "bitmap.h"
-+
-+#include <endian.h>
-+/* Redhat don't like to #include <asm/byteorder.h>, and
-+ * some time include <linux/byteorder/xxx_endian.h> isn't enough,
-+ * and there is no standard conversion function so... */
-+/* And dietlibc doesn't think byteswap is ok, so.. */
-+/* #include <byteswap.h> */
-+#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
-+ ((x) & 0xff00U) >> 8)
-+#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
-+ ((x) & 0xff000000U) >> 24 | \
-+ ((x) & 0x0000ff00U) << 8 | \
-+ ((x) & 0x00ff0000U) >> 8)
-+#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
-+ ((x) & 0xff00000000000000ULL) >> 56 | \
-+ ((x) & 0x000000000000ff00ULL) << 40 | \
-+ ((x) & 0x00ff000000000000ULL) >> 40 | \
-+ ((x) & 0x0000000000ff0000ULL) << 24 | \
-+ ((x) & 0x0000ff0000000000ULL) >> 24 | \
-+ ((x) & 0x00000000ff000000ULL) << 8 | \
-+ ((x) & 0x000000ff00000000ULL) >> 8)
-+
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+#define __cpu_to_le16(_x) (_x)
-+#define __cpu_to_le32(_x) (_x)
-+#define __cpu_to_le64(_x) (_x)
-+#define __le16_to_cpu(_x) (_x)
-+#define __le32_to_cpu(_x) (_x)
-+#define __le64_to_cpu(_x) (_x)
-+#elif BYTE_ORDER == BIG_ENDIAN
-+#define __cpu_to_le16(_x) bswap_16(_x)
-+#define __cpu_to_le32(_x) bswap_32(_x)
-+#define __cpu_to_le64(_x) bswap_64(_x)
-+#define __le16_to_cpu(_x) bswap_16(_x)
-+#define __le32_to_cpu(_x) bswap_32(_x)
-+#define __le64_to_cpu(_x) bswap_64(_x)
-+#else
-+# error "unknown endianness."
-+#endif
-+
-+
-+
-+/* general information that might be extracted from a superblock */
-+struct mdinfo {
-+ mdu_array_info_t array;
-+ mdu_disk_info_t disk;
-+ __u64 events;
-+ int uuid[4];
-+ char name[33];
-+ unsigned long long data_offset;
-+ unsigned long long component_size;
-+ int reshape_active;
-+ unsigned long long reshape_progress;
-+ int new_level, delta_disks, new_layout, new_chunk;
-+};
-+
-+struct createinfo {
-+ int uid;
-+ int gid;
-+ int autof;
-+ int mode;
-+ int symlinks;
-+ struct supertype *supertype;
-+};
-+
-+#define Name "mdadm"
-+
-+enum mode {
-+ ASSEMBLE=1,
-+ BUILD,
-+ CREATE,
-+ MANAGE,
-+ MISC,
-+ MONITOR,
-+ GROW,
-+ INCREMENTAL,
-+ AUTODETECT,
-+};
-+
-+extern char short_options[];
-+extern char short_bitmap_auto_options[];
-+extern struct option long_options[];
-+extern char Version[], Usage[], Help[], OptionHelp[],
-+ Help_create[], Help_build[], Help_assemble[], Help_grow[],
-+ Help_incr[],
-+ Help_manage[], Help_misc[], Help_monitor[], Help_config[];
-+
-+/* for option that don't have short equivilents, we assign arbitrary
-+ * small numbers. '1' means an undecorated option, so we start at '2'.
-+ */
-+enum special_options {
-+ AssumeClean = 2,
-+ BitmapChunk,
-+ WriteBehind,
-+ ReAdd,
-+ NoDegraded,
-+ Sparc22,
-+ BackupFile,
-+ HomeHost,
-+ AutoHomeHost,
-+ Symlinks,
-+ AutoDetect,
-+};
-+
-+/* structures read from config file */
-+/* List of mddevice names and identifiers
-+ * Identifiers can be:
-+ * uuid=128-hex-uuid
-+ * super-minor=decimal-minor-number-from-superblock
-+ * devices=comma,separated,list,of,device,names,with,wildcards
-+ *
-+ * If multiple fields are present, the intersection of all matching
-+ * devices is considered
-+ */
-+#define UnSet (0xfffe)
-+typedef struct mddev_ident_s {
-+ char *devname;
-+
-+ int uuid_set;
-+ int uuid[4];
-+ char name[33];
-+
-+ unsigned int super_minor;
-+
-+ char *devices; /* comma separated list of device
-+ * names with wild cards
-+ */
-+ int level;
-+ unsigned int raid_disks;
-+ unsigned int spare_disks;
-+ struct supertype *st;
-+ int autof; /* 1 for normal, 2 for partitioned */
-+ char *spare_group;
-+ char *bitmap_file;
-+ int bitmap_fd;
-+
-+ struct mddev_ident_s *next;
-+} *mddev_ident_t;
-+
-+/* List of device names - wildcards expanded */
-+typedef struct mddev_dev_s {
-+ char *devname;
-+ char disposition; /* 'a' for add, 'r' for remove, 'f' for fail.
-+ * Not set for names read from .config
-+ */
-+ char writemostly;
-+ char re_add;
-+ char used; /* set when used */
-+ struct mddev_dev_s *next;
-+} *mddev_dev_t;
-+
-+typedef struct mapping {
-+ char *name;
-+ int num;
-+} mapping_t;
-+
-+
-+struct mdstat_ent {
-+ char *dev;
-+ int devnum;
-+ int active;
-+ char *level;
-+ char *pattern; /* U or up, _ for down */
-+ int percent; /* -1 if no resync */
-+ int resync; /* 1 if resync, 0 if recovery */
-+ struct mdstat_ent *next;
-+};
-+
-+extern struct mdstat_ent *mdstat_read(int hold, int start);
-+extern void free_mdstat(struct mdstat_ent *ms);
-+extern void mdstat_wait(int seconds);
-+extern int mddev_busy(int devnum);
-+
-+struct map_ent {
-+ struct map_ent *next;
-+ int devnum;
-+ int major,minor;
-+ int uuid[4];
-+ char *path;
-+};
-+extern int map_update(struct map_ent **mpp, int devnum, int major, int minor,
-+ int uuid[4], char *path);
-+extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]);
-+extern void map_read(struct map_ent **melp);
-+extern int map_write(struct map_ent *mel);
-+extern void map_delete(struct map_ent **mapp, int devnum);
-+extern void map_free(struct map_ent *map);
-+extern void map_add(struct map_ent **melp,
-+ int devnum, int major, int minor, int uuid[4], char *path);
-+
-+/* Data structure for holding info read from sysfs */
-+struct sysdev {
-+ char name[20];
-+ int role;
-+ int major, minor;
-+ unsigned long long offset, size;
-+ int state;
-+ int errors;
-+ struct sysdev *next;
-+};
-+struct sysarray {
-+ char name[20];
-+ struct sysdev *devs;
-+ int chunk;
-+ unsigned long long component_size;
-+ int layout;
-+ int level;
-+ int spares;
-+ int cache_size;
-+ int mismatch_cnt;
-+ int major_version, minor_version;
-+};
-+/* various details can be requested */
-+#define GET_LEVEL 1
-+#define GET_LAYOUT 2
-+#define GET_COMPONENT 4
-+#define GET_CHUNK 8
-+#define GET_CACHE 16
-+#define GET_MISMATCH 32
-+#define GET_VERSION 64
-+
-+#define GET_DEVS 1024 /* gets role, major, minor */
-+#define GET_OFFSET 2048
-+#define GET_SIZE 4096
-+#define GET_STATE 8192
-+#define GET_ERROR 16384
-+
-+/* If fd >= 0, get the array it is open on,
-+ * else use devnum. >=0 -> major9. <0.....
-+ */
-+extern void sysfs_free(struct sysarray *sra);
-+extern struct sysarray *sysfs_read(int fd, int devnum, unsigned long options);
-+extern int sysfs_set_str(struct sysarray *sra, struct sysdev *dev,
-+ char *name, char *val);
-+extern int sysfs_set_num(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long val);
-+extern int sysfs_get_ll(struct sysarray *sra, struct sysdev *dev,
-+ char *name, unsigned long long *val);
-+
-+
-+extern int save_stripes(int *source, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int nwrites, int *dest,
-+ unsigned long long start, unsigned long long length);
-+extern int restore_stripes(int *dest, unsigned long long *offsets,
-+ int raid_disks, int chunk_size, int level, int layout,
-+ int source, unsigned long long read_offset,
-+ unsigned long long start, unsigned long long length);
-+
-+#ifndef Sendmail
-+#define Sendmail "/usr/lib/sendmail -t"
-+#endif
-+
-+#define SYSLOG_FACILITY LOG_DAEMON
-+
-+extern char *map_num(mapping_t *map, int num);
-+extern int map_name(mapping_t *map, char *name);
-+extern mapping_t r5layout[], pers[], modes[], faultylayout[];
-+
-+extern char *map_dev(int major, int minor, int create);
-+
-+
-+extern struct superswitch {
-+ void (*examine_super)(void *sbv, char *homehost);
-+ void (*brief_examine_super)(void *sbv);
-+ void (*detail_super)(void *sbv, char *homehost);
-+ void (*export_super)(void *sbv);
-+ void (*brief_detail_super)(void *sbv);
-+ void (*uuid_from_super)(int uuid[4], void *sbv);
-+ void (*getinfo_super)(struct mdinfo *info, void *sbv);
-+ int (*match_home)(void *sbv, char *homehost);
-+ int (*update_super)(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost);
-+ int (*init_super)(struct supertype *st, void **sbp, mdu_array_info_t *info, unsigned long long size, char *name, char *homehost, int *uuid);
-+ void (*add_to_super)(void *sbv, mdu_disk_info_t *dinfo);
-+ int (*store_super)(struct supertype *st, int fd, void *sbv);
-+ int (*write_init_super)(struct supertype *st, void *sbv, mdu_disk_info_t *dinfo, char *devname);
-+ int (*compare_super)(void **firstp, void *secondv);
-+ int (*load_super)(struct supertype *st, int fd, void **sbp, char *devname);
-+ struct supertype * (*match_metadata_desc)(char *arg);
-+ __u64 (*avail_size)(struct supertype *st, __u64 size);
-+ int (*add_internal_bitmap)(struct supertype *st, void *sbv, int *chunkp,
-+ int delay, int write_behind,
-+ unsigned long long size, int may_change, int major);
-+ void (*locate_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int (*write_bitmap)(struct supertype *st, int fd, void *sbv);
-+ int major;
-+ int swapuuid; /* true if uuid is bigending rather than hostendian */
-+} super0, super1, *superlist[];
-+
-+struct supertype {
-+ struct superswitch *ss;
-+ int minor_version;
-+ int max_devs;
-+};
-+
-+extern struct supertype *super_by_version(int vers, int minor);
-+extern struct supertype *guess_super(int fd);
-+extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
-+extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
-+ mdu_disk_info_t *disk);
-+
-+#if __GNUC__ < 3
-+struct stat64;
-+#endif
-+
-+#define HAVE_NFTW we assume
-+#define HAVE_FTW
-+
-+#ifdef UCLIBC
-+# include <features.h>
-+# ifndef __UCLIBC_HAS_FTW__
-+# undef HAVE_FTW
-+# undef HAVE_NFTW
-+# endif
-+#endif
-+
-+#ifdef __dietlibc__
-+# undef HAVE_NFTW
-+#endif
-+
-+#ifndef HAVE_NFTW
-+# define FTW_PHYS 1
-+# ifndef HAVE_FTW
-+ struct FTW {};
-+# endif
-+#endif
-+
-+#ifdef HAVE_FTW
-+# include <ftw.h>
-+#endif
-+
-+extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
-+
-+
-+extern int Manage_ro(char *devname, int fd, int readonly);
-+extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
-+extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
-+extern int Manage_reconfig(char *devname, int fd, int layout);
-+extern int Manage_subdevs(char *devname, int fd,
-+ mddev_dev_t devlist, int verbose);
-+extern int autodetect(void);
-+extern int Grow_Add_device(char *devname, int fd, char *newdev);
-+extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force);
-+extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
-+ long long size,
-+ int level, int layout, int chunksize, int raid_disks);
-+extern int Grow_restart(struct supertype *st, struct mdinfo *info,
-+ int *fdlist, int cnt, char *backup_file);
-+
-+
-+extern int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force);
-+
-+extern int Build(char *mddev, int mdfd, int chunk, int level, int layout,
-+ int raiddisks,
-+ mddev_dev_t devlist, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int verbose);
-+
-+
-+extern int Create(struct supertype *st, char *mddev, int mdfd,
-+ int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
-+ char *name, char *homehost, int *uuid,
-+ int subdevs, mddev_dev_t devlist,
-+ int runstop, int verbose, int force, int assume_clean,
-+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
-+
-+extern int Detail(char *dev, int brief, int export, int test, char *homehost);
-+extern int Query(char *dev);
-+
-+extern int md_get_version(int fd);
-+extern int get_linux_version(void);
-+extern int parse_uuid(char *str, int uuid[4]);
-+extern int check_ext2(int fd, char *name);
-+extern int check_reiser(int fd, char *name);
-+extern int check_raid(int fd, char *name);
-+
-+extern int get_mdp_major(void);
-+extern int dev_open(char *dev, int flags);
-+extern int is_standard(char *dev, int *nump);
-+
-+extern int parse_auto(char *str, char *msg, int config);
-+extern mddev_ident_t conf_get_ident(char *dev);
-+extern mddev_dev_t conf_get_devs(void);
-+extern int conf_test_dev(char *devname);
-+extern struct createinfo *conf_get_create_info(void);
-+extern void set_conffile(char *file);
-+extern char *conf_get_mailaddr(void);
-+extern char *conf_get_mailfrom(void);
-+extern char *conf_get_program(void);
-+extern char *conf_get_homehost(void);
-+extern char *conf_line(FILE *file);
-+extern char *conf_word(FILE *file, int allow_key);
-+extern void free_line(char *line);
-+extern int match_oneof(char *devices, char *devname);
-+extern void uuid_from_super(int uuid[4], mdp_super_t *super);
-+extern int same_uuid(int a[4], int b[4], int swapuuid);
-+extern void copy_uuid(void *a, int b[4], int swapuuid);
-+/* extern int compare_super(mdp_super_t *first, mdp_super_t *second);*/
-+extern unsigned long calc_csum(void *super, int bytes);
-+extern int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks);
-+extern int ask(char *mesg);
-+extern unsigned long long get_component_size(int fd);
-+extern void remove_partitions(int fd);
-+
-+
-+extern char *human_size(long long bytes);
-+char *human_size_brief(long long bytes);
-+
-+extern void put_md_name(char *name);
-+extern char *get_md_name(int dev);
-+
-+extern char DefaultConfFile[];
-+
-+extern int open_mddev(char *dev, int autof);
-+extern int open_mddev_devnum(char *devname, int devnum, char *name,
-+ char *chosen_name);
-+
-+
-+#define LEVEL_MULTIPATH (-4)
-+#define LEVEL_LINEAR (-1)
-+#define LEVEL_FAULTY (-5)
-+
-+
-+/* faulty stuff */
-+
-+#define WriteTransient 0
-+#define ReadTransient 1
-+#define WritePersistent 2
-+#define ReadPersistent 3
-+#define WriteAll 4 /* doesn't go to device */
-+#define ReadFixable 5
-+#define Modes 6
-+
-+#define ClearErrors 31
-+#define ClearFaults 30
-+
-+#define AllPersist 100 /* internal use only */
-+#define NoPersist 101
-+
-+#define ModeMask 0x1f
-+#define ModeShift 5
-+
-+
-+#ifdef __TINYC__
-+#undef minor
-+#undef major
-+#undef makedev
-+#define minor(x) ((x)&0xff)
-+#define major(x) (((x)>>8)&0xff)
-+#define makedev(M,m) (((M)<<8) | (m))
-+#endif
-+
-+/* for raid5 */
-+#define ALGORITHM_LEFT_ASYMMETRIC 0
-+#define ALGORITHM_RIGHT_ASYMMETRIC 1
-+#define ALGORITHM_LEFT_SYMMETRIC 2
-+#define ALGORITHM_RIGHT_SYMMETRIC 3
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdassemble.c busybox-1.7.4+gentoo+mdadm/mdadm/mdassemble.c
---- busybox-1.7.4+gentoo/mdadm/mdassemble.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdassemble.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,908 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include <ctype.h>
-+
-+static int name_matches(char *found, char *required, char *homehost)
-+{
-+ /* See if the name found matches the required name, possibly
-+ * prefixed with 'homehost'
-+ */
-+ char fnd[33];
-+
-+ strncpy(fnd, found, 32);
-+ fnd[32] = 0;
-+ if (strcmp(found, required)==0)
-+ return 1;
-+ if (homehost) {
-+ int l = strlen(homehost);
-+ if (l < 32 && fnd[l] == ':' &&
-+ strcmp(fnd+l+1, required)==0)
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+int open_mddev(char *dev, int autof/*unused */)
-+{
-+ int mdfd = open(dev, O_RDWR, 0);
-+ if (mdfd < 0)
-+ fprintf(stderr, Name ": error opening %s: %s\n",
-+ dev, strerror(errno));
-+ else if (md_get_version(mdfd) <= 0) {
-+ fprintf(stderr, Name ": %s does not appear to be an md device\n",
-+ dev);
-+ close(mdfd);
-+ mdfd = -1;
-+ }
-+ return mdfd;
-+}
-+
-+int Assemble(struct supertype *st, char *mddev, int mdfd,
-+ mddev_ident_t ident,
-+ mddev_dev_t devlist, char *backup_file,
-+ int readonly, int runstop,
-+ char *update, char *homehost,
-+ int verbose, int force)
-+{
-+ /*
-+ * The task of Assemble is to find a collection of
-+ * devices that should (according to their superblocks)
-+ * form an array, and to give this collection to the MD driver.
-+ * In Linux-2.4 and later, this involves submitting a
-+ * SET_ARRAY_INFO ioctl with no arg - to prepare
-+ * the array - and then submit a number of
-+ * ADD_NEW_DISK ioctls to add disks into
-+ * the array. Finally RUN_ARRAY might
-+ * be submitted to start the array.
-+ *
-+ * Much of the work of Assemble is in finding and/or
-+ * checking the disks to make sure they look right.
-+ *
-+ * If mddev is not set, then scan must be set and we
-+ * read through the config file for dev+uuid mapping
-+ * We recurse, setting mddev, for each device that
-+ * - isn't running
-+ * - has a valid uuid (or any uuid if !uuidset)
-+ *
-+ * If mddev is set, we try to determine state of md.
-+ * check version - must be at least 0.90.0
-+ * check kernel version. must be at least 2.4.
-+ * If not, we can possibly fall back on START_ARRAY
-+ * Try to GET_ARRAY_INFO.
-+ * If possible, give up
-+ * If not, try to STOP_ARRAY just to make sure
-+ *
-+ * If !uuidset and scan, look in conf-file for uuid
-+ * If not found, give up
-+ * If !devlist and scan and uuidset, get list of devs from conf-file
-+ *
-+ * For each device:
-+ * Check superblock - discard if bad
-+ * Check uuid (set if we don't have one) - discard if no match
-+ * Check superblock similarity if we have a superblock - discard if different
-+ * Record events, devicenum
-+ * This should give us a list of devices for the array
-+ * We should collect the most recent event number
-+ *
-+ * Count disks with recent enough event count
-+ * While force && !enough disks
-+ * Choose newest rejected disks, update event count
-+ * mark clean and rewrite superblock
-+ * If recent kernel:
-+ * SET_ARRAY_INFO
-+ * foreach device with recent events : ADD_NEW_DISK
-+ * if runstop == 1 || "enough" disks and runstop==0 -> RUN_ARRAY
-+ * If old kernel:
-+ * Check the device numbers in superblock are right
-+ * update superblock if any changes
-+ * START_ARRAY
-+ *
-+ */
-+ int clean = 0;
-+ int old_linux = 0;
-+ int vers = 0; /* Keep gcc quite - it really is initialised */
-+ void *first_super = NULL, *super = NULL;
-+ struct {
-+ char *devname;
-+ unsigned int major, minor;
-+ unsigned int oldmajor, oldminor;
-+ long long events;
-+ int uptodate;
-+ int state;
-+ int raid_disk;
-+ int disk_nr;
-+ } *devices;
-+ int *best = NULL; /* indexed by raid_disk */
-+ unsigned int bestcnt = 0;
-+ int devcnt = 0;
-+ unsigned int okcnt, sparecnt;
-+ unsigned int req_cnt;
-+ unsigned int i;
-+ int most_recent = 0;
-+ int chosen_drive;
-+ int change = 0;
-+ int inargv = 0;
-+ int bitmap_done;
-+ int start_partial_ok = (runstop >= 0) && (force || devlist==NULL || mdfd < 0);
-+ unsigned int num_devs;
-+ mddev_dev_t tmpdev;
-+ struct mdinfo info;
-+ char *avail;
-+ int nextspare = 0;
-+
-+ if (mdfd < 0)
-+ return 2;
-+
-+ if (get_linux_version() < 2004000)
-+ old_linux = 1;
-+
-+ if (mdfd >= 0) {
-+ vers = md_get_version(mdfd);
-+ if (vers <= 0) {
-+ fprintf(stderr, Name ": %s appears not to be an md device.\n", mddev);
-+ return 1;
-+ }
-+ if (vers < 9000) {
-+ fprintf(stderr, Name ": Assemble requires driver version 0.90.0 or later.\n"
-+ " Upgrade your kernel or try --build\n");
-+ return 1;
-+ }
-+
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &info.array)>=0) {
-+ fprintf(stderr, Name ": device %s already active - cannot assemble it\n",
-+ mddev);
-+ return 1;
-+ }
-+ ioctl(mdfd, STOP_ARRAY, NULL); /* just incase it was started but has no content */
-+ }
-+ /*
-+ * If any subdevs are listed, then any that don't
-+ * match ident are discarded. Remainder must all match and
-+ * become the array.
-+ * If no subdevs, then we scan all devices in the config file, but
-+ * there must be something in the identity
-+ */
-+
-+ if (!devlist &&
-+ ident->uuid_set == 0 &&
-+ ident->super_minor < 0 &&
-+ ident->devices == NULL) {
-+ fprintf(stderr, Name ": No identity information available for %s - cannot assemble.\n",
-+ mddev ? mddev : "further assembly");
-+ return 1;
-+ }
-+ if (devlist == NULL)
-+ devlist = conf_get_devs();
-+ else if (mdfd >= 0)
-+ inargv = 1;
-+
-+ tmpdev = devlist; num_devs = 0;
-+ while (tmpdev) {
-+ if (tmpdev->used)
-+ tmpdev->used = 2;
-+ else
-+ num_devs++;
-+ tmpdev = tmpdev->next;
-+ }
-+ devices = malloc(num_devs * sizeof(*devices));
-+
-+ if (!st && ident->st) st = ident->st;
-+
-+ if (verbose>0)
-+ fprintf(stderr, Name ": looking for devices for %s\n",
-+ mddev ? mddev : "further assembly");
-+
-+ /* first walk the list of devices to find a consistent set
-+ * that match the criterea, if that is possible.
-+ * We flag the one we like with 'used'.
-+ */
-+ for (tmpdev = devlist;
-+ tmpdev;
-+ tmpdev = tmpdev->next) {
-+ char *devname = tmpdev->devname;
-+ int dfd;
-+ struct stat stb;
-+ struct supertype *tst = st;
-+
-+ if (tmpdev->used > 1) continue;
-+
-+ if (ident->devices &&
-+ !match_oneof(ident->devices, devname)) {
-+ if ((inargv && verbose>=0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
-+ continue;
-+ }
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ dfd = dev_open(devname, O_RDONLY|O_EXCL);
-+ if (dfd < 0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": cannot open device %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if (fstat(dfd, &stb)< 0) {
-+ /* Impossible! */
-+ fprintf(stderr, Name ": fstat failed for %s: %s\n",
-+ devname, strerror(errno));
-+ tmpdev->used = 2;
-+ } else if ((stb.st_mode & S_IFMT) != S_IFBLK) {
-+ fprintf(stderr, Name ": %s is not a block device.\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (!tst && (tst = guess_super(dfd)) == NULL) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": no recogniseable superblock on %s\n",
-+ devname);
-+ tmpdev->used = 2;
-+ } else if (tst->ss->load_super(tst,dfd, &super, NULL)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf( stderr, Name ": no RAID superblock on %s\n",
-+ devname);
-+ } else {
-+ tst->ss->getinfo_super(&info, super);
-+ }
-+ if (dfd >= 0) close(dfd);
-+
-+ if (ident->uuid_set && (!update || strcmp(update, "uuid")!= 0) &&
-+ (!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong uuid.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->name[0] && (!update || strcmp(update, "name")!= 0) &&
-+ (!super || name_matches(info.name, ident->name, homehost)==0)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong name.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->super_minor != UnSet &&
-+ (!super || ident->super_minor != info.array.md_minor)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong super-minor.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->level != UnSet &&
-+ (!super|| ident->level != info.array.level)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s has wrong raid level.\n",
-+ devname);
-+ continue;
-+ }
-+ if (ident->raid_disks != UnSet &&
-+ (!super || ident->raid_disks!= info.array.raid_disks)) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s requires wrong number of drives.\n",
-+ devname);
-+ continue;
-+ }
-+ if (mdfd < 0) {
-+ if (tst == NULL || super == NULL)
-+ continue;
-+ if (update == NULL &&
-+ tst->ss->match_home(super, homehost)==0) {
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s is not built for host %s.\n",
-+ devname, homehost);
-+ /* Auto-assemble, and this is not a usable host */
-+ /* if update != NULL, we are updating the host
-+ * name... */
-+ continue;
-+ }
-+ }
-+ /* If we are this far, then we are nearly commited to this device.
-+ * If the super_block doesn't exist, or doesn't match others,
-+ * then we probably cannot continue
-+ * However if one of the arrays is for the homehost, and
-+ * the other isn't that can disambiguate.
-+ */
-+
-+ if (!super) {
-+ fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
-+ devname);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ if (st == NULL)
-+ st = tst;
-+ if (st->ss != tst->ss ||
-+ st->minor_version != tst->minor_version ||
-+ st->ss->compare_super(&first_super, super) != 0) {
-+ /* Some mismatch. If exactly one array matches this host,
-+ * we can resolve on that one.
-+ * Or, if we are auto assembling, we just ignore the second
-+ * for now.
-+ */
-+ if (mdfd < 0)
-+ continue;
-+ if (homehost) {
-+ int first = st->ss->match_home(first_super, homehost);
-+ int last = tst->ss->match_home(super, homehost);
-+ if (first+last == 1) {
-+ /* We can do something */
-+ if (first) {/* just ignore this one */
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s misses out due to wrong homehost\n",
-+ devname);
-+ continue;
-+ } else { /* reject all those sofar */
-+ mddev_dev_t td;
-+ if ((inargv && verbose >= 0) || verbose > 0)
-+ fprintf(stderr, Name ": %s overrides previous devices due to good homehost\n",
-+ devname);
-+ for (td=devlist; td != tmpdev; td=td->next)
-+ if (td->used == 1)
-+ td->used = 0;
-+ tmpdev->used = 1;
-+ continue;
-+ }
-+ }
-+ }
-+ fprintf(stderr, Name ": superblock on %s doesn't match others - assembly aborted\n",
-+ devname);
-+ free(super);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ tmpdev->used = 1;
-+ }
-+
-+ /* Ok, no bad inconsistancy, we can try updating etc */
-+ bitmap_done = 0;
-+ for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) if (tmpdev->used == 1) {
-+ char *devname = tmpdev->devname;
-+ struct stat stb;
-+ /* looks like a good enough match to update the super block if needed */
-+ {
-+ int dfd;
-+ dfd = dev_open(devname, O_RDWR|O_EXCL);
-+
-+ remove_partitions(dfd);
-+
-+ if (super) {
-+ free(super);
-+ super = NULL;
-+ }
-+
-+ st->ss->load_super(st, dfd, &super, NULL);
-+ st->ss->getinfo_super(&info, super);
-+ close(dfd);
-+ }
-+
-+ stat(devname, &stb);
-+
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n",
-+ devname, mddev, info.disk.raid_disk);
-+ devices[devcnt].devname = devname;
-+ devices[devcnt].major = major(stb.st_rdev);
-+ devices[devcnt].minor = minor(stb.st_rdev);
-+ devices[devcnt].oldmajor = info.disk.major;
-+ devices[devcnt].oldminor = info.disk.minor;
-+ devices[devcnt].events = info.events;
-+ devices[devcnt].raid_disk = info.disk.raid_disk;
-+ devices[devcnt].disk_nr = info.disk.number;
-+ devices[devcnt].uptodate = 0;
-+ devices[devcnt].state = info.disk.state;
-+ if (most_recent < devcnt) {
-+ if (devices[devcnt].events
-+ > devices[most_recent].events)
-+ most_recent = devcnt;
-+ }
-+ if (info.array.level == -4)
-+ /* with multipath, the raid_disk from the superblock is meaningless */
-+ i = devcnt;
-+ else
-+ i = devices[devcnt].raid_disk;
-+ if (i+1 == 0) {
-+ if (nextspare < info.array.raid_disks)
-+ nextspare = info.array.raid_disks;
-+ i = nextspare++;
-+ } else {
-+ if (i >= info.array.raid_disks &&
-+ i >= nextspare)
-+ nextspare = i+1;
-+ }
-+ if (i < 10000) {
-+ if (i >= bestcnt) {
-+ unsigned int newbestcnt = i+10;
-+ int *newbest = malloc(sizeof(int)*newbestcnt);
-+ unsigned int c;
-+ for (c=0; c < newbestcnt; c++)
-+ if (c < bestcnt)
-+ newbest[c] = best[c];
-+ else
-+ newbest[c] = -1;
-+ if (best)free(best);
-+ best = newbest;
-+ bestcnt = newbestcnt;
-+ }
-+ if (best[i] >=0 &&
-+ devices[best[i]].events == devices[devcnt].events &&
-+ devices[best[i]].minor != devices[devcnt].minor &&
-+ st->ss->major == 0 &&
-+ info.array.level != -4) {
-+ /* two different devices with identical superblock.
-+ * Could be a mis-detection caused by overlapping
-+ * partitions. fail-safe.
-+ */
-+ fprintf(stderr, Name ": WARNING %s and %s appear"
-+ " to have very similar superblocks.\n"
-+ " If they are really different, "
-+ "please --zero the superblock on one\n"
-+ " If they are the same or overlap,"
-+ " please remove one from %s.\n",
-+ devices[best[i]].devname, devname,
-+ inargv ? "the list" :
-+ "the\n DEVICE list in mdadm.conf"
-+ );
-+ return 1;
-+ }
-+ if (best[i] == -1
-+ || devices[best[i]].events < devices[devcnt].events)
-+ best[i] = devcnt;
-+ }
-+ devcnt++;
-+ }
-+
-+ if (super)
-+ free(super);
-+ super = NULL;
-+
-+ if (update && strcmp(update, "byteorder")==0)
-+ st->minor_version = 90;
-+
-+ if (devcnt == 0) {
-+ fprintf(stderr, Name ": no devices found for %s\n",
-+ mddev);
-+ free(first_super);
-+ return 1;
-+ }
-+
-+ st->ss->getinfo_super(&info, first_super);
-+ clean = info.array.state & 1;
-+
-+ /* now we have some devices that might be suitable.
-+ * I wonder how many
-+ */
-+ avail = malloc(info.array.raid_disks);
-+ memset(avail, 0, info.array.raid_disks);
-+ okcnt = 0;
-+ sparecnt=0;
-+ for (i=0; i< bestcnt ;i++) {
-+ int j = best[i];
-+ int event_margin = 1; /* always allow a difference of '1'
-+ * like the kernel does
-+ */
-+ if (j < 0) continue;
-+ /* note: we ignore error flags in multipath arrays
-+ * as they don't make sense
-+ */
-+ if (info.array.level != -4)
-+ if (!(devices[j].state & (1<<MD_DISK_SYNC))) {
-+ if (!(devices[j].state & (1<<MD_DISK_FAULTY)))
-+ sparecnt++;
-+ continue;
-+ }
-+ if (devices[j].events+event_margin >=
-+ devices[most_recent].events) {
-+ devices[j].uptodate = 1;
-+ if (i < info.array.raid_disks) {
-+ okcnt++;
-+ avail[i]=1;
-+ } else
-+ sparecnt++;
-+ }
-+ }
-+ while (force && !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1,
-+ avail, okcnt)) {
-+ /* Choose the newest best drive which is
-+ * not up-to-date, update the superblock
-+ * and add it.
-+ */
-+ int fd;
-+ long long current_events;
-+ chosen_drive = -1;
-+ for (i=0; i<info.array.raid_disks && i < bestcnt; i++) {
-+ int j = best[i];
-+ if (j>=0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ (chosen_drive < 0 ||
-+ devices[j].events > devices[chosen_drive].events))
-+ chosen_drive = j;
-+ }
-+ if (chosen_drive < 0)
-+ break;
-+ current_events = devices[chosen_drive].events;
-+ add_another:
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": forcing event count in %s(%d) from %d upto %d\n",
-+ devices[chosen_drive].devname, devices[chosen_drive].raid_disk,
-+ (int)(devices[chosen_drive].events),
-+ (int)(devices[most_recent].events));
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Couldn't open %s for write - not updating\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock disappeared from %s - not updating.\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ continue;
-+ }
-+ info.events = devices[most_recent].events;
-+ st->ss->update_super(&info, super, "force-one",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ devices[chosen_drive].events = 0;
-+ free(super);
-+ continue;
-+ }
-+ close(fd);
-+ devices[chosen_drive].events = devices[most_recent].events;
-+ devices[chosen_drive].uptodate = 1;
-+ avail[chosen_drive] = 1;
-+ okcnt++;
-+ free(super);
-+
-+ /* If there are any other drives of the same vintage,
-+ * add them in as well. We can't lose and we might gain
-+ */
-+ for (i=0; i<info.array.raid_disks && i < bestcnt ; i++) {
-+ int j = best[i];
-+ if (j >= 0 &&
-+ !devices[j].uptodate &&
-+ devices[j].events > 0 &&
-+ devices[j].events == current_events) {
-+ chosen_drive = j;
-+ goto add_another;
-+ }
-+ }
-+ }
-+
-+ /* Now we want to look at the superblock which the kernel will base things on
-+ * and compare the devices that we think are working with the devices that the
-+ * superblock thinks are working.
-+ * If there are differences and --force is given, then update this chosen
-+ * superblock.
-+ */
-+ chosen_drive = -1;
-+ super = NULL;
-+ for (i=0; chosen_drive < 0 && i<bestcnt; i++) {
-+ int j = best[i];
-+ int fd;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ chosen_drive = j;
-+ if ((fd=dev_open(devices[j].devname, O_RDONLY|O_EXCL))< 0) {
-+ fprintf(stderr, Name ": Cannot open %s: %s\n",
-+ devices[j].devname, strerror(errno));
-+ return 1;
-+ }
-+ if (st->ss->load_super(st,fd, &super, NULL)) {
-+ close(fd);
-+ fprintf(stderr, Name ": RAID superblock has disappeared from %s\n",
-+ devices[j].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+ if (super == NULL) {
-+ fprintf(stderr, Name ": No suitable drives found for %s\n", mddev);
-+ return 1;
-+ }
-+ st->ss->getinfo_super(&info, super);
-+ for (i=0; i<bestcnt; i++) {
-+ int j = best[i];
-+ unsigned int desired_state;
-+
-+ if (i < info.array.raid_disks)
-+ desired_state = (1<<MD_DISK_ACTIVE) | (1<<MD_DISK_SYNC);
-+ else
-+ desired_state = 0;
-+
-+ if (j<0)
-+ continue;
-+ if (!devices[j].uptodate)
-+ continue;
-+ info.disk.number = devices[j].disk_nr;
-+ info.disk.raid_disk = i;
-+ info.disk.state = desired_state;
-+
-+ if (devices[j].uptodate &&
-+ st->ss->update_super(&info, super, "assemble", NULL, verbose, 0, NULL)) {
-+ if (force) {
-+ if (verbose >= 0)
-+ fprintf(stderr, Name ": "
-+ "clearing FAULTY flag for device %d in %s for %s\n",
-+ j, mddev, devices[j].devname);
-+ change = 1;
-+ } else {
-+ if (verbose >= -1)
-+ fprintf(stderr, Name ": "
-+ "device %d in %s has wrong state in superblock, but %s seems ok\n",
-+ i, mddev, devices[j].devname);
-+ }
-+ }
-+#if 0
-+ if (!devices[j].uptodate &&
-+ !(super.disks[i].state & (1 << MD_DISK_FAULTY))) {
-+ fprintf(stderr, Name ": devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-+ i, mddev);
-+ }
-+#endif
-+ }
-+ if (force && !clean &&
-+ !enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt)) {
-+ change += st->ss->update_super(&info, super, "force-array",
-+ devices[chosen_drive].devname, verbose,
-+ 0, NULL);
-+ clean = 1;
-+ }
-+
-+ if (change) {
-+ int fd;
-+ fd = dev_open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
-+ if (fd < 0) {
-+ fprintf(stderr, Name ": Could not open %s for write - cannot Assemble array.\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ if (st->ss->store_super(st, fd, super)) {
-+ close(fd);
-+ fprintf(stderr, Name ": Could not re-write superblock on %s\n",
-+ devices[chosen_drive].devname);
-+ return 1;
-+ }
-+ close(fd);
-+ }
-+
-+ /* count number of in-sync devices according to the superblock.
-+ * We must have this number to start the array without -s or -R
-+ */
-+ req_cnt = info.array.working_disks;
-+
-+ /* Almost ready to actually *do* something */
-+ if (!old_linux) {
-+ int rv;
-+ if ((vers % 100) >= 1) { /* can use different versions */
-+ mdu_array_info_t inf;
-+ memset(&inf, 0, sizeof(inf));
-+ inf.major_version = st->ss->major;
-+ inf.minor_version = st->minor_version;
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, &inf);
-+ } else
-+ rv = ioctl(mdfd, SET_ARRAY_INFO, NULL);
-+
-+ if (rv) {
-+ fprintf(stderr, Name ": SET_ARRAY_INFO failed for %s: %s\n",
-+ mddev, strerror(errno));
-+ return 1;
-+ }
-+ if (ident->bitmap_fd >= 0) {
-+ if (ioctl(mdfd, SET_BITMAP_FILE, ident->bitmap_fd) != 0) {
-+ fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
-+ return 1;
-+ }
-+ } else if (ident->bitmap_file) {
-+ /* From config file */
-+ int bmfd = open(ident->bitmap_file, O_RDWR);
-+ if (bmfd < 0) {
-+ fprintf(stderr, Name ": Could not open bitmap file %s\n",
-+ ident->bitmap_file);
-+ return 1;
-+ }
-+ if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
-+ fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
-+ close(bmfd);
-+ return 1;
-+ }
-+ close(bmfd);
-+ }
-+
-+ /* First, add the raid disks, but add the chosen one last */
-+ for (i=0; i<= bestcnt; i++) {
-+ int j;
-+ if (i < bestcnt) {
-+ j = best[i];
-+ if (j == chosen_drive)
-+ continue;
-+ } else
-+ j = chosen_drive;
-+
-+ if (j >= 0 /* && devices[j].uptodate */) {
-+ mdu_disk_info_t disk;
-+ memset(&disk, 0, sizeof(disk));
-+ disk.major = devices[j].major;
-+ disk.minor = devices[j].minor;
-+ if (ioctl(mdfd, ADD_NEW_DISK, &disk)!=0) {
-+ fprintf(stderr, Name ": failed to add %s to %s: %s\n",
-+ devices[j].devname,
-+ mddev,
-+ strerror(errno));
-+ if (i < info.array.raid_disks || i == bestcnt)
-+ okcnt--;
-+ else
-+ sparecnt--;
-+ } else if (verbose > 0)
-+ fprintf(stderr, Name ": added %s to %s as %d\n",
-+ devices[j].devname, mddev, devices[j].raid_disk);
-+ } else if (verbose > 0 && i < info.array.raid_disks)
-+ fprintf(stderr, Name ": no uptodate device for slot %d of %s\n",
-+ i, mddev);
-+ }
-+
-+ if (runstop == 1 ||
-+ (runstop <= 0 &&
-+ ( enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, clean, avail, okcnt) &&
-+ (okcnt >= req_cnt || start_partial_ok)
-+ ))) {
-+ if (ioctl(mdfd, RUN_ARRAY, NULL)==0) {
-+ if (verbose >= 0) {
-+ fprintf(stderr, Name ": %s has been started with %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt < info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ fprintf(stderr, ".\n");
-+ }
-+ return 0;
-+ }
-+ fprintf(stderr, Name ": failed to RUN_ARRAY %s: %s\n",
-+ mddev, strerror(errno));
-+
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, Name ": Not enough devices to "
-+ "start the array while not clean "
-+ "- consider --force.\n");
-+
-+ return 1;
-+ }
-+ if (runstop == -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s",
-+ mddev, okcnt, okcnt==1?"":"s");
-+ if (okcnt != info.array.raid_disks)
-+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
-+ fprintf(stderr, ", but not started.\n");
-+ return 0;
-+ }
-+ if (verbose >= -1) {
-+ fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s");
-+ if (sparecnt)
-+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
-+ if (!enough(info.array.level, info.array.raid_disks,
-+ info.array.layout, 1, avail, okcnt))
-+ fprintf(stderr, " - not enough to start the array.\n");
-+ else if (!enough(info.array.level,
-+ info.array.raid_disks,
-+ info.array.layout, clean,
-+ avail, okcnt))
-+ fprintf(stderr, " - not enough to start the "
-+ "array while not clean - consider "
-+ "--force.\n");
-+ else {
-+ if (req_cnt == info.array.raid_disks)
-+ fprintf(stderr, " - need all %d to start it", req_cnt);
-+ else
-+ fprintf(stderr, " - need %d of %d to start", req_cnt, info.array.raid_disks);
-+ fprintf(stderr, " (use --run to insist).\n");
-+ }
-+ }
-+ return 1;
-+ } else {
-+ /* The "chosen_drive" is a good choice, and if necessary, the superblock has
-+ * been updated to point to the current locations of devices.
-+ * so we can just start the array
-+ */
-+ unsigned long dev;
-+ dev = makedev(devices[chosen_drive].major,
-+ devices[chosen_drive].minor);
-+ if (ioctl(mdfd, START_ARRAY, dev)) {
-+ fprintf(stderr, Name ": Cannot start array: %s\n",
-+ strerror(errno));
-+ }
-+
-+ }
-+ return 0;
-+}
-+
-+int mdfd = -1;
-+int runstop = 0;
-+int readonly = 0;
-+int verbose = 0;
-+int force = 0;
-+
-+int mdassemble_main(int argc, char **argv) {
-+ mddev_ident_t array_list = conf_get_ident(NULL);
-+ int minor;
-+ if (!array_list) {
-+ fprintf(stderr, Name ": No arrays found in config file\n");
-+ return 1;
-+ } else {
-+ for (; array_list; array_list = array_list->next) {
-+ mdu_array_info_t array;
-+ if (!strncmp("/dev/md", array_list->devname, 7)) {
-+ errno = 0;
-+ minor = strtoul(array_list->devname + 7, NULL, 0);
-+ if (!errno) {
-+ mknod(array_list->devname, S_IFBLK|0600, makedev(MD_MAJOR, minor));
-+ }
-+ }
-+ mdfd = open_mddev(array_list->devname, array_list->autof);
-+ if (mdfd < 0) {
-+
-+ fprintf(stderr, Name ": failed to open array\n");
-+ continue;
-+ }
-+ if (ioctl(mdfd, GET_ARRAY_INFO, &array) < 0) {
-+ Assemble(array_list->st, array_list->devname, mdfd,
-+ array_list, NULL, NULL,
-+ readonly, runstop, NULL, NULL, verbose, force);
-+ }
-+ close(mdfd);
-+ }
-+ }
-+ return 0;
-+}
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/mdexamine.c busybox-1.7.4+gentoo+mdadm/mdadm/mdexamine.c
---- busybox-1.7.4+gentoo/mdadm/mdexamine.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/mdexamine.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,157 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "dlink.h"
-+
-+#if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN)
-+#error no endian defined
-+#endif
-+#include "md_u.h"
-+#include "md_p.h"
-+
-+static int Examine(mddev_dev_t devlist, int brief, int scan,
-+ int SparcAdjust, struct supertype *forcest,
-+ char *homehost)
-+{
-+
-+ /* Read the raid superblock from a device and
-+ * display important content.
-+ *
-+ * If cannot be found, print reason: too small, bad magic
-+ *
-+ * Print:
-+ * version, ctime, level, size, raid+spare+
-+ * prefered minor
-+ * uuid
-+ *
-+ * utime, state etc
-+ *
-+ * If (brief) gather devices for same array and just print a mdadm.conf line including devices=
-+ * if devlist==NULL, use conf_get_devs()
-+ */
-+ int fd;
-+ void *super = NULL;
-+ int rv = 0;
-+ int err = 0;
-+
-+ struct array {
-+ void *super;
-+ struct supertype *st;
-+ struct mdinfo info;
-+ void *devs;
-+ struct array *next;
-+ int spares;
-+ } *arrays = NULL;
-+
-+ for (; devlist ; devlist=devlist->next) {
-+ struct supertype *st = forcest;
-+
-+ fd = dev_open(devlist->devname, O_RDONLY);
-+ if (fd < 0) {
-+ if (!scan) {
-+ fprintf(stderr,Name ": cannot open %s: %s\n",
-+ devlist->devname, strerror(errno));
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ else {
-+ if (!st)
-+ st = guess_super(fd);
-+ if (st)
-+ err = st->ss->load_super(st, fd, &super, (brief||scan)?NULL:devlist->devname);
-+ else {
-+ if (!brief) {
-+ fprintf(stderr, Name ": No md superblock detected on %s.\n", devlist->devname);
-+ rv = 1;
-+ }
-+ err = 1;
-+ }
-+ close(fd);
-+ }
-+ if (err)
-+ continue;
-+
-+ if (SparcAdjust)
-+ st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0, 0, NULL);
-+ /* Ok, its good enough to try, though the checksum could be wrong */
-+ if (brief) {
-+ struct array *ap;
-+ char *d;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ if (st->ss == ap->st->ss && st->ss->compare_super(&ap->super, super)==0)
-+ break;
-+ }
-+ if (!ap) {
-+ ap = malloc(sizeof(*ap));
-+ ap->super = super;
-+ ap->devs = dl_head();
-+ ap->next = arrays;
-+ ap->spares = 0;
-+ ap->st = st;
-+ arrays = ap;
-+ st->ss->getinfo_super(&ap->info, super);
-+ } else {
-+ st->ss->getinfo_super(&ap->info, super);
-+ free(super);
-+ }
-+ if (!(ap->info.disk.state & MD_DISK_SYNC))
-+ ap->spares++;
-+ d = dl_strdup(devlist->devname);
-+ dl_add(ap->devs, d);
-+ }
-+ }
-+ if (brief) {
-+ struct array *ap;
-+ for (ap=arrays; ap; ap=ap->next) {
-+ char sep='=';
-+ char *d;
-+ ap->st->ss->brief_examine_super(ap->super);
-+ if (ap->spares) printf(" spares=%d", ap->spares);
-+ if (brief > 1) {
-+ printf(" devices");
-+ for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
-+ printf("%c%s", sep, d);
-+ sep=',';
-+ }
-+ }
-+ free(ap->super);
-+ /* FIXME free ap */
-+ if (ap->spares || brief > 1)
-+ printf("\n");
-+ }
-+ }
-+ return rv;
-+}
-+
-+int mdexamine_main(int argc, char **argv) {
-+ return Examine(conf_get_devs(), 1, 0, 0, NULL, NULL);
-+}
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md_p.h busybox-1.7.4+gentoo+mdadm/mdadm/md_p.h
---- busybox-1.7.4+gentoo/mdadm/md_p.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md_p.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,194 @@
-+/*
-+ md_p.h : physical layout of Linux RAID devices
-+ Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_P_H
-+#define _MD_P_H
-+
-+/*
-+ * RAID superblock.
-+ *
-+ * The RAID superblock maintains some statistics on each RAID configuration.
-+ * Each real device in the RAID set contains it near the end of the device.
-+ * Some of the ideas are copied from the ext2fs implementation.
-+ *
-+ * We currently use 4096 bytes as follows:
-+ *
-+ * word offset function
-+ *
-+ * 0 - 31 Constant generic RAID device information.
-+ * 32 - 63 Generic state information.
-+ * 64 - 127 Personality specific information.
-+ * 128 - 511 12 32-words descriptors of the disks in the raid set.
-+ * 512 - 911 Reserved.
-+ * 912 - 1023 Disk specific descriptor.
-+ */
-+
-+/*
-+ * If x is the real device size in bytes, we return an apparent size of:
-+ *
-+ * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES
-+ *
-+ * and place the 4kB superblock at offset y.
-+ */
-+#define MD_RESERVED_BYTES (64 * 1024)
-+#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
-+#define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE)
-+
-+#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
-+#define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS)
-+
-+#define MD_SB_BYTES 4096
-+#define MD_SB_WORDS (MD_SB_BYTES / 4)
-+#define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE)
-+#define MD_SB_SECTORS (MD_SB_BYTES / 512)
-+
-+/*
-+ * The following are counted in 32-bit words
-+ */
-+#define MD_SB_GENERIC_OFFSET 0
-+#define MD_SB_PERSONALITY_OFFSET 64
-+#define MD_SB_DISKS_OFFSET 128
-+#define MD_SB_DESCRIPTOR_OFFSET 992
-+
-+#define MD_SB_GENERIC_CONSTANT_WORDS 32
-+#define MD_SB_GENERIC_STATE_WORDS 32
-+#define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS)
-+#define MD_SB_PERSONALITY_WORDS 64
-+#define MD_SB_DESCRIPTOR_WORDS 32
-+#define MD_SB_DISKS 27
-+#define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS)
-+#define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS)
-+
-+/*
-+ * Device "operational" state bits
-+ */
-+#define MD_DISK_FAULTY 0 /* disk is faulty / operational */
-+#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
-+#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
-+#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
-+
-+#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
-+ * read requests will only be sent here in
-+ * dire need
-+ */
-+
-+typedef struct mdp_device_descriptor_s {
-+ __u32 number; /* 0 Device number in the entire set */
-+ __u32 major; /* 1 Device major number */
-+ __u32 minor; /* 2 Device minor number */
-+ __u32 raid_disk; /* 3 The role of the device in the raid set */
-+ __u32 state; /* 4 Operational state */
-+ __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5];
-+} mdp_disk_t;
-+
-+#define MD_SB_MAGIC 0xa92b4efc
-+
-+/*
-+ * Superblock state bits
-+ */
-+#define MD_SB_CLEAN 0
-+#define MD_SB_ERRORS 1
-+
-+#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
-+
-+typedef struct mdp_superblock_s {
-+ /*
-+ * Constant generic information
-+ */
-+ __u32 md_magic; /* 0 MD identifier */
-+ __u32 major_version; /* 1 major version to which the set conforms */
-+ __u32 minor_version; /* 2 minor version ... */
-+ __u32 patch_version; /* 3 patchlevel version ... */
-+ __u32 gvalid_words; /* 4 Number of used words in this section */
-+ __u32 set_uuid0; /* 5 Raid set identifier */
-+ __u32 ctime; /* 6 Creation time */
-+ __u32 level; /* 7 Raid personality */
-+ __u32 size; /* 8 Apparent size of each individual disk */
-+ __u32 nr_disks; /* 9 total disks in the raid set */
-+ __u32 raid_disks; /* 10 disks in a fully functional raid set */
-+ __u32 md_minor; /* 11 preferred MD minor device number */
-+ __u32 not_persistent; /* 12 does it have a persistent superblock */
-+ __u32 set_uuid1; /* 13 Raid set identifier #2 */
-+ __u32 set_uuid2; /* 14 Raid set identifier #3 */
-+ __u32 set_uuid3; /* 15 Raid set identifier #4 */
-+ __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16];
-+
-+ /*
-+ * Generic state information
-+ */
-+ __u32 utime; /* 0 Superblock update time */
-+ __u32 state; /* 1 State bits (clean, ...) */
-+ __u32 active_disks; /* 2 Number of currently active disks */
-+ __u32 working_disks; /* 3 Number of working disks */
-+ __u32 failed_disks; /* 4 Number of failed disks */
-+ __u32 spare_disks; /* 5 Number of spare disks */
-+ __u32 sb_csum; /* 6 checksum of the whole superblock */
-+#if __BYTE_ORDER == __BIG_ENDIAN
-+ __u32 events_hi; /* 7 high-order of superblock update count */
-+ __u32 events_lo; /* 8 low-order of superblock update count */
-+ __u32 cp_events_hi; /* 9 high-order of checkpoint update count */
-+ __u32 cp_events_lo; /* 10 low-order of checkpoint update count */
-+#else
-+ __u32 events_lo; /* 7 low-order of superblock update count */
-+ __u32 events_hi; /* 8 high-order of superblock update count */
-+ __u32 cp_events_lo; /* 9 low-order of checkpoint update count */
-+ __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
-+#endif
-+ __u32 recovery_cp; /* 11 recovery checkpoint sector count */
-+ /* There are only valid for minor_version > 90 */
-+ __u64 reshape_position; /* 12,13 next address in array-space for reshape */
-+ __u32 new_level; /* 14 new level we are reshaping to */
-+ __u32 delta_disks; /* 15 change in number of raid_disks */
-+ __u32 new_layout; /* 16 new layout */
-+ __u32 new_chunk; /* 17 new chunk size (bytes) */
-+ __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
-+
-+ /*
-+ * Personality information
-+ */
-+ __u32 layout; /* 0 the array's physical layout */
-+ __u32 chunk_size; /* 1 chunk size in bytes */
-+ __u32 root_pv; /* 2 LV root PV */
-+ __u32 root_block; /* 3 LV root block */
-+ __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4];
-+
-+ /*
-+ * Disks information
-+ */
-+ mdp_disk_t disks[MD_SB_DISKS];
-+
-+ /*
-+ * Reserved
-+ */
-+ __u32 reserved[MD_SB_RESERVED_WORDS];
-+
-+ /*
-+ * Active descriptor
-+ */
-+ mdp_disk_t this_disk;
-+
-+} mdp_super_t;
-+
-+#ifdef __TINYC__
-+typedef unsigned long long __u64;
-+#endif
-+
-+static inline __u64 md_event(mdp_super_t *sb) {
-+ __u64 ev = sb->events_hi;
-+ return (ev<<32)| sb->events_lo;
-+}
-+
-+#endif
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/md_u.h busybox-1.7.4+gentoo+mdadm/mdadm/md_u.h
---- busybox-1.7.4+gentoo/mdadm/md_u.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/md_u.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,123 @@
-+/*
-+ md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
-+ Copyright (C) 1998 Ingo Molnar
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+
-+ You should have received a copy of the GNU General Public License
-+ (for example /usr/src/linux/COPYING); if not, write to the Free
-+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+*/
-+
-+#ifndef _MD_U_H
-+#define _MD_U_H
-+
-+/* ioctls */
-+
-+/* status */
-+#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
-+#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
-+#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
-+#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
-+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
-+#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
-+
-+/* configuration */
-+#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
-+#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
-+#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
-+#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
-+#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
-+#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
-+#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
-+#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
-+#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
-+#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
-+#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
-+
-+/* usage */
-+#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
-+#define START_ARRAY _IO (MD_MAJOR, 0x31)
-+#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
-+#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
-+#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
-+
-+typedef struct mdu_version_s {
-+ int major;
-+ int minor;
-+ int patchlevel;
-+} mdu_version_t;
-+
-+typedef struct mdu_array_info_s {
-+ /*
-+ * Generic constant information
-+ */
-+ int major_version;
-+ int minor_version;
-+ int patch_version;
-+ int ctime;
-+ int level;
-+ int size;
-+ int nr_disks;
-+ int raid_disks;
-+ int md_minor;
-+ int not_persistent;
-+
-+ /*
-+ * Generic state information
-+ */
-+ int utime; /* 0 Superblock update time */
-+ int state; /* 1 State bits (clean, ...) */
-+ int active_disks; /* 2 Number of currently active disks */
-+ int working_disks; /* 3 Number of working disks */
-+ int failed_disks; /* 4 Number of failed disks */
-+ int spare_disks; /* 5 Number of spare disks */
-+
-+ /*
-+ * Personality information
-+ */
-+ int layout; /* 0 the array's physical layout */
-+ int chunk_size; /* 1 chunk size in bytes */
-+
-+} mdu_array_info_t;
-+
-+typedef struct mdu_disk_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int number;
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_disk_info_t;
-+
-+typedef struct mdu_start_info_s {
-+ /*
-+ * configuration/status of one particular disk
-+ */
-+ int major;
-+ int minor;
-+ int raid_disk;
-+ int state;
-+
-+} mdu_start_info_t;
-+
-+typedef struct mdu_bitmap_file_s
-+{
-+ char pathname[4096];
-+} mdu_bitmap_file_t;
-+
-+typedef struct mdu_param_s
-+{
-+ int personality; /* 1,2,3,4 */
-+ int chunk_size; /* in bytes */
-+ int max_fault; /* unused for now */
-+} mdu_param_t;
-+
-+#endif
-+
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/sha1.c busybox-1.7.4+gentoo+mdadm/mdadm/sha1.c
---- busybox-1.7.4+gentoo/mdadm/sha1.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/sha1.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,423 @@
-+/* sha1.c - Functions to compute SHA1 message digest of files or
-+ memory blocks according to the NIST specification FIPS-180-1.
-+
-+ Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+/* Written by Scott G. Miller
-+ Credits:
-+ Robert Klep <robert@ilse.nl> -- Expansion function fix
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "sha1.h"
-+
-+#include <stddef.h>
-+#include <string.h>
-+
-+#if USE_UNLOCKED_IO
-+# include "unlocked-io.h"
-+#endif
-+
-+/* SWAP does an endian swap on architectures that are little-endian,
-+ as SHA1 needs some data in a big-endian form. */
-+
-+#ifdef WORDS_BIGENDIAN
-+# define SWAP(n) (n)
-+#else
-+# define SWAP(n) \
-+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-+#endif
-+
-+#define BLOCKSIZE 4096
-+#if BLOCKSIZE % 64 != 0
-+# error "invalid BLOCKSIZE"
-+#endif
-+
-+/* This array contains the bytes used to pad the buffer to the next
-+ 64-byte boundary. (RFC 1321, 3.1: Step 1) */
-+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-+
-+
-+/*
-+ Takes a pointer to a 160 bit block of data (five 32 bit ints) and
-+ intializes it to the start constants of the SHA1 algorithm. This
-+ must be called before using hash in the call to sha1_hash.
-+*/
-+void
-+sha1_init_ctx (struct sha1_ctx *ctx)
-+{
-+ ctx->A = 0x67452301;
-+ ctx->B = 0xefcdab89;
-+ ctx->C = 0x98badcfe;
-+ ctx->D = 0x10325476;
-+ ctx->E = 0xc3d2e1f0;
-+
-+ ctx->total[0] = ctx->total[1] = 0;
-+ ctx->buflen = 0;
-+}
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result
-+ must be in little endian byte order.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
-+{
-+ ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
-+ ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
-+ ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
-+ ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
-+ ((md5_uint32 *) resbuf)[4] = SWAP (ctx->E);
-+
-+ return resbuf;
-+}
-+
-+/* Process the remaining bytes in the internal buffer and the usual
-+ prolog according to the standard and write the result to RESBUF.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+void *
-+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
-+{
-+ /* Take yet unprocessed bytes into account. */
-+ md5_uint32 bytes = ctx->buflen;
-+ size_t pad;
-+
-+ /* Now count remaining bytes. */
-+ ctx->total[0] += bytes;
-+ if (ctx->total[0] < bytes)
-+ ++ctx->total[1];
-+
-+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
-+ memcpy (&ctx->buffer[bytes], fillbuf, pad);
-+
-+ /* Put the 64-bit file length in *bits* at the end of the buffer. */
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3);
-+ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) |
-+ (ctx->total[0] >> 29));
-+
-+ /* Process last bytes. */
-+ sha1_process_block (ctx->buffer, bytes + pad + 8, ctx);
-+
-+ return sha1_read_ctx (ctx, resbuf);
-+}
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 16 bytes
-+ beginning at RESBLOCK. */
-+int
-+sha1_stream (FILE *stream, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+ char buffer[BLOCKSIZE + 72];
-+ size_t sum;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Iterate over full file contents. */
-+ while (1)
-+ {
-+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
-+ computation function processes the whole buffer so that with the
-+ next round of the loop another block can be read. */
-+ size_t n;
-+ sum = 0;
-+
-+ /* Read block. Take care for partial reads. */
-+ while (1)
-+ {
-+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-+
-+ sum += n;
-+
-+ if (sum == BLOCKSIZE)
-+ break;
-+
-+ if (n == 0)
-+ {
-+ /* Check for the error flag IFF N == 0, so that we don't
-+ exit the loop after a partial read due to e.g., EAGAIN
-+ or EWOULDBLOCK. */
-+ if (ferror (stream))
-+ return 1;
-+ goto process_partial_block;
-+ }
-+
-+ /* We've read at least one byte, so ignore errors. But always
-+ check for EOF, since feof may be true even though N > 0.
-+ Otherwise, we could end up calling fread after EOF. */
-+ if (feof (stream))
-+ goto process_partial_block;
-+ }
-+
-+ /* Process buffer with BLOCKSIZE bytes. Note that
-+ BLOCKSIZE % 64 == 0
-+ */
-+ sha1_process_block (buffer, BLOCKSIZE, &ctx);
-+ }
-+
-+ process_partial_block:;
-+
-+ /* Process any remaining bytes. */
-+ if (sum > 0)
-+ sha1_process_bytes (buffer, sum, &ctx);
-+
-+ /* Construct result in desired memory. */
-+ sha1_finish_ctx (&ctx, resblock);
-+ return 0;
-+}
-+
-+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+void *
-+sha1_buffer (const char *buffer, size_t len, void *resblock)
-+{
-+ struct sha1_ctx ctx;
-+
-+ /* Initialize the computation context. */
-+ sha1_init_ctx (&ctx);
-+
-+ /* Process whole buffer but last len % 64 bytes. */
-+ sha1_process_bytes (buffer, len, &ctx);
-+
-+ /* Put result in desired memory area. */
-+ return sha1_finish_ctx (&ctx, resblock);
-+}
-+
-+void
-+sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ /* When we already have some bits in our internal buffer concatenate
-+ both inputs first. */
-+ if (ctx->buflen != 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+ size_t add = 128 - left_over > len ? len : 128 - left_over;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, add);
-+ ctx->buflen += add;
-+
-+ if (ctx->buflen > 64)
-+ {
-+ sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
-+
-+ ctx->buflen &= 63;
-+ /* The regions in the following copy operation cannot overlap. */
-+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
-+ ctx->buflen);
-+ }
-+
-+ buffer = (const char *) buffer + add;
-+ len -= add;
-+ }
-+
-+ /* Process available complete blocks. */
-+ if (len >= 64)
-+ {
-+#if !_STRING_ARCH_unaligned
-+# define alignof(type) offsetof (struct { char c; type x; }, x)
-+# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0)
-+ if (UNALIGNED_P (buffer))
-+ while (len > 64)
-+ {
-+ sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-+ buffer = (const char *) buffer + 64;
-+ len -= 64;
-+ }
-+ else
-+#endif
-+ {
-+ sha1_process_block (buffer, len & ~63, ctx);
-+ buffer = (const char *) buffer + (len & ~63);
-+ len &= 63;
-+ }
-+ }
-+
-+ /* Move remaining bytes in internal buffer. */
-+ if (len > 0)
-+ {
-+ size_t left_over = ctx->buflen;
-+
-+ memcpy (&ctx->buffer[left_over], buffer, len);
-+ left_over += len;
-+ if (left_over >= 64)
-+ {
-+ sha1_process_block (ctx->buffer, 64, ctx);
-+ left_over -= 64;
-+ memcpy (ctx->buffer, &ctx->buffer[64], left_over);
-+ }
-+ ctx->buflen = left_over;
-+ }
-+}
-+
-+/* --- Code below is the primary difference between md5.c and sha1.c --- */
-+
-+/* SHA1 round constants */
-+#define K1 0x5a827999L
-+#define K2 0x6ed9eba1L
-+#define K3 0x8f1bbcdcL
-+#define K4 0xca62c1d6L
-+
-+/* Round functions. Note that F2 is the same as F4. */
-+#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
-+#define F2(B,C,D) (B ^ C ^ D)
-+#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
-+#define F4(B,C,D) (B ^ C ^ D)
-+
-+/* Process LEN bytes of BUFFER, accumulating context into CTX.
-+ It is assumed that LEN % 64 == 0.
-+ Most of this code comes from GnuPG's cipher/sha1.c. */
-+
-+void
-+sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
-+{
-+ const md5_uint32 *words = buffer;
-+ size_t nwords = len / sizeof (md5_uint32);
-+ const md5_uint32 *endp = words + nwords;
-+ md5_uint32 x[16];
-+ md5_uint32 a = ctx->A;
-+ md5_uint32 b = ctx->B;
-+ md5_uint32 c = ctx->C;
-+ md5_uint32 d = ctx->D;
-+ md5_uint32 e = ctx->E;
-+
-+ /* First increment the byte count. RFC 1321 specifies the possible
-+ length of the file up to 2^64 bits. Here we only compute the
-+ number of bytes. Do a double word increment. */
-+ ctx->total[0] += len;
-+ if (ctx->total[0] < len)
-+ ++ctx->total[1];
-+
-+#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
-+
-+#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
-+ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
-+ , (x[I&0x0f] = rol(tm, 1)) )
-+
-+#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \
-+ + F( B, C, D ) \
-+ + K \
-+ + M; \
-+ B = rol( B, 30 ); \
-+ } while(0)
-+
-+ while (words < endp)
-+ {
-+ md5_uint32 tm;
-+ int t;
-+ for (t = 0; t < 16; t++)
-+ {
-+ x[t] = SWAP (*words);
-+ words++;
-+ }
-+
-+ R( a, b, c, d, e, F1, K1, x[ 0] );
-+ R( e, a, b, c, d, F1, K1, x[ 1] );
-+ R( d, e, a, b, c, F1, K1, x[ 2] );
-+ R( c, d, e, a, b, F1, K1, x[ 3] );
-+ R( b, c, d, e, a, F1, K1, x[ 4] );
-+ R( a, b, c, d, e, F1, K1, x[ 5] );
-+ R( e, a, b, c, d, F1, K1, x[ 6] );
-+ R( d, e, a, b, c, F1, K1, x[ 7] );
-+ R( c, d, e, a, b, F1, K1, x[ 8] );
-+ R( b, c, d, e, a, F1, K1, x[ 9] );
-+ R( a, b, c, d, e, F1, K1, x[10] );
-+ R( e, a, b, c, d, F1, K1, x[11] );
-+ R( d, e, a, b, c, F1, K1, x[12] );
-+ R( c, d, e, a, b, F1, K1, x[13] );
-+ R( b, c, d, e, a, F1, K1, x[14] );
-+ R( a, b, c, d, e, F1, K1, x[15] );
-+ R( e, a, b, c, d, F1, K1, M(16) );
-+ R( d, e, a, b, c, F1, K1, M(17) );
-+ R( c, d, e, a, b, F1, K1, M(18) );
-+ R( b, c, d, e, a, F1, K1, M(19) );
-+ R( a, b, c, d, e, F2, K2, M(20) );
-+ R( e, a, b, c, d, F2, K2, M(21) );
-+ R( d, e, a, b, c, F2, K2, M(22) );
-+ R( c, d, e, a, b, F2, K2, M(23) );
-+ R( b, c, d, e, a, F2, K2, M(24) );
-+ R( a, b, c, d, e, F2, K2, M(25) );
-+ R( e, a, b, c, d, F2, K2, M(26) );
-+ R( d, e, a, b, c, F2, K2, M(27) );
-+ R( c, d, e, a, b, F2, K2, M(28) );
-+ R( b, c, d, e, a, F2, K2, M(29) );
-+ R( a, b, c, d, e, F2, K2, M(30) );
-+ R( e, a, b, c, d, F2, K2, M(31) );
-+ R( d, e, a, b, c, F2, K2, M(32) );
-+ R( c, d, e, a, b, F2, K2, M(33) );
-+ R( b, c, d, e, a, F2, K2, M(34) );
-+ R( a, b, c, d, e, F2, K2, M(35) );
-+ R( e, a, b, c, d, F2, K2, M(36) );
-+ R( d, e, a, b, c, F2, K2, M(37) );
-+ R( c, d, e, a, b, F2, K2, M(38) );
-+ R( b, c, d, e, a, F2, K2, M(39) );
-+ R( a, b, c, d, e, F3, K3, M(40) );
-+ R( e, a, b, c, d, F3, K3, M(41) );
-+ R( d, e, a, b, c, F3, K3, M(42) );
-+ R( c, d, e, a, b, F3, K3, M(43) );
-+ R( b, c, d, e, a, F3, K3, M(44) );
-+ R( a, b, c, d, e, F3, K3, M(45) );
-+ R( e, a, b, c, d, F3, K3, M(46) );
-+ R( d, e, a, b, c, F3, K3, M(47) );
-+ R( c, d, e, a, b, F3, K3, M(48) );
-+ R( b, c, d, e, a, F3, K3, M(49) );
-+ R( a, b, c, d, e, F3, K3, M(50) );
-+ R( e, a, b, c, d, F3, K3, M(51) );
-+ R( d, e, a, b, c, F3, K3, M(52) );
-+ R( c, d, e, a, b, F3, K3, M(53) );
-+ R( b, c, d, e, a, F3, K3, M(54) );
-+ R( a, b, c, d, e, F3, K3, M(55) );
-+ R( e, a, b, c, d, F3, K3, M(56) );
-+ R( d, e, a, b, c, F3, K3, M(57) );
-+ R( c, d, e, a, b, F3, K3, M(58) );
-+ R( b, c, d, e, a, F3, K3, M(59) );
-+ R( a, b, c, d, e, F4, K4, M(60) );
-+ R( e, a, b, c, d, F4, K4, M(61) );
-+ R( d, e, a, b, c, F4, K4, M(62) );
-+ R( c, d, e, a, b, F4, K4, M(63) );
-+ R( b, c, d, e, a, F4, K4, M(64) );
-+ R( a, b, c, d, e, F4, K4, M(65) );
-+ R( e, a, b, c, d, F4, K4, M(66) );
-+ R( d, e, a, b, c, F4, K4, M(67) );
-+ R( c, d, e, a, b, F4, K4, M(68) );
-+ R( b, c, d, e, a, F4, K4, M(69) );
-+ R( a, b, c, d, e, F4, K4, M(70) );
-+ R( e, a, b, c, d, F4, K4, M(71) );
-+ R( d, e, a, b, c, F4, K4, M(72) );
-+ R( c, d, e, a, b, F4, K4, M(73) );
-+ R( b, c, d, e, a, F4, K4, M(74) );
-+ R( a, b, c, d, e, F4, K4, M(75) );
-+ R( e, a, b, c, d, F4, K4, M(76) );
-+ R( d, e, a, b, c, F4, K4, M(77) );
-+ R( c, d, e, a, b, F4, K4, M(78) );
-+ R( b, c, d, e, a, F4, K4, M(79) );
-+
-+ a = ctx->A += a;
-+ b = ctx->B += b;
-+ c = ctx->C += c;
-+ d = ctx->D += d;
-+ e = ctx->E += e;
-+ }
-+}
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/sha1.h busybox-1.7.4+gentoo+mdadm/mdadm/sha1.h
---- busybox-1.7.4+gentoo/mdadm/sha1.h 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/sha1.h 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,87 @@
-+/* Declarations of functions and data types used for SHA1 sum
-+ library functions.
-+ Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published by the
-+ Free Software Foundation; either version 2, or (at your option) any
-+ later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software Foundation,
-+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-+
-+#ifndef SHA1_H
-+# define SHA1_H 1
-+
-+# include <stdio.h>
-+# include "md5.h"
-+
-+/* Structure to save state of computation between the single steps. */
-+struct sha1_ctx
-+{
-+ md5_uint32 A;
-+ md5_uint32 B;
-+ md5_uint32 C;
-+ md5_uint32 D;
-+ md5_uint32 E;
-+
-+ md5_uint32 total[2];
-+ md5_uint32 buflen;
-+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
-+};
-+
-+
-+/* Initialize structure containing state of computation. */
-+extern void sha1_init_ctx (struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is necessary that LEN is a multiple of 64!!! */
-+extern void sha1_process_block (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Starting with the result of former calls of this function (or the
-+ initialization function update the context for the next LEN bytes
-+ starting at BUFFER.
-+ It is NOT required that LEN is a multiple of 64. */
-+extern void sha1_process_bytes (const void *buffer, size_t len,
-+ struct sha1_ctx *ctx);
-+
-+/* Process the remaining bytes in the buffer and put result from CTX
-+ in first 20 bytes following RESBUF. The result is always in little
-+ endian byte order, so that a byte-wise output yields to the wanted
-+ ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF be correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Put result from CTX in first 20 bytes following RESBUF. The result is
-+ always in little endian byte order, so that a byte-wise output yields
-+ to the wanted ASCII representation of the message digest.
-+
-+ IMPORTANT: On some systems it is required that RESBUF is correctly
-+ aligned for a 32 bits value. */
-+extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-+
-+
-+/* Compute SHA1 message digest for bytes read from STREAM. The
-+ resulting message digest number will be written into the 20 bytes
-+ beginning at RESBLOCK. */
-+extern int sha1_stream (FILE *stream, void *resblock);
-+
-+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
-+ result is always in little endian byte order, so that a byte-wise
-+ output yields to the wanted ASCII representation of the message
-+ digest. */
-+extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
-+
-+#endif
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/super0.c busybox-1.7.4+gentoo+mdadm/mdadm/super0.c
---- busybox-1.7.4+gentoo/mdadm/super0.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/super0.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,562 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#define HAVE_STDINT_H 1
-+#include "mdadm.h"
-+/*
-+ * All handling for the 0.90.0 version superblock is in
-+ * this file.
-+ * This includes:
-+ * - finding, loading, and writing the superblock.
-+ * - initialising a new superblock
-+ * - printing the superblock for --examine
-+ * - printing part of the superblock for --detail
-+ * .. other stuff
-+ */
-+
-+
-+static unsigned long calc_sb0_csum(mdp_super_t *super)
-+{
-+ unsigned long csum = super->sb_csum;
-+ unsigned long newcsum;
-+ super->sb_csum= 0 ;
-+ newcsum = calc_csum(super, MD_SB_BYTES);
-+ super->sb_csum = csum;
-+ return newcsum;
-+}
-+
-+
-+void super0_swap_endian(struct mdp_superblock_s *sb)
-+{
-+ /* as super0 superblocks are host-endian, it is sometimes
-+ * useful to be able to swap the endianness
-+ * as (almost) everything is u32's we byte-swap every 4byte
-+ * number.
-+ * We then also have to swap the events_hi and events_lo
-+ */
-+ char *sbc = (char *)sb;
-+ __u32 t32;
-+ int i;
-+
-+ for (i=0; i < MD_SB_BYTES ; i+=4) {
-+ char t = sbc[i];
-+ sbc[i] = sbc[i+3];
-+ sbc[i+3] = t;
-+ t=sbc[i+1];
-+ sbc[i+1]=sbc[i+2];
-+ sbc[i+2]=t;
-+ }
-+ t32 = sb->events_hi;
-+ sb->events_hi = sb->events_lo;
-+ sb->events_lo = t32;
-+
-+ t32 = sb->cp_events_hi;
-+ sb->cp_events_hi = sb->cp_events_lo;
-+ sb->cp_events_lo = t32;
-+
-+}
-+
-+static void brief_examine_super0(void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ char *c=map_num(pers, sb->level);
-+ char devname[20];
-+
-+ sprintf(devname, "/dev/md%d", sb->md_minor);
-+
-+ printf("ARRAY %s level=%s num-devices=%d UUID=",
-+ devname,
-+ c?c:"-unknown-", sb->raid_disks);
-+ if (sb->minor_version >= 90)
-+ printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
-+ sb->set_uuid2, sb->set_uuid3);
-+ else
-+ printf("%08x", sb->set_uuid0);
-+ printf("\n");
-+}
-+
-+static int match_home0(void *sbv, char *homehost)
-+{
-+ mdp_super_t *sb = sbv;
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+
-+ return (memcmp(&sb->set_uuid2, hash, 8)==0);
-+}
-+
-+static void uuid_from_super0(int uuid[4], void * sbv)
-+{
-+ mdp_super_t *super = sbv;
-+ uuid[0] = super->set_uuid0;
-+ if (super->minor_version >= 90) {
-+ uuid[1] = super->set_uuid1;
-+ uuid[2] = super->set_uuid2;
-+ uuid[3] = super->set_uuid3;
-+ } else {
-+ uuid[1] = 0;
-+ uuid[2] = 0;
-+ uuid[3] = 0;
-+ }
-+}
-+
-+static void getinfo_super0(struct mdinfo *info, void *sbv)
-+{
-+ mdp_super_t *sb = sbv;
-+ int working = 0;
-+ int i;
-+
-+ info->array.major_version = sb->major_version;
-+ info->array.minor_version = sb->minor_version;
-+ info->array.patch_version = sb->patch_version;
-+ info->array.raid_disks = sb->raid_disks;
-+ info->array.level = sb->level;
-+ info->array.layout = sb->layout;
-+ info->array.md_minor = sb->md_minor;
-+ info->array.ctime = sb->ctime;
-+ info->array.utime = sb->utime;
-+ info->array.chunk_size = sb->chunk_size;
-+ info->array.state = sb->state;
-+ info->component_size = sb->size*2;
-+
-+ info->disk.state = sb->this_disk.state;
-+ info->disk.major = sb->this_disk.major;
-+ info->disk.minor = sb->this_disk.minor;
-+ info->disk.raid_disk = sb->this_disk.raid_disk;
-+ info->disk.number = sb->this_disk.number;
-+
-+ info->events = md_event(sb);
-+ info->data_offset = 0;
-+
-+ uuid_from_super0(info->uuid, sbv);
-+
-+ if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = sb->reshape_position;
-+ info->new_level = sb->new_level;
-+ info->delta_disks = sb->delta_disks;
-+ info->new_layout = sb->new_layout;
-+ info->new_chunk = sb->new_chunk;
-+ } else
-+ info->reshape_active = 0;
-+
-+ sprintf(info->name, "%d", sb->md_minor);
-+ /* work_disks is calculated rather than read directly */
-+ for (i=0; i < MD_SB_DISKS; i++)
-+ if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
-+ (sb->disks[i].raid_disk < info->array.raid_disks) &&
-+ (sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
-+ !(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
-+ working ++;
-+ info->array.working_disks = working;
-+}
-+
-+
-+static int update_super0(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ mdp_super_t *sb = sbv;
-+ if (strcmp(update, "sparc2.2")==0 ) {
-+ /* 2.2 sparc put the events in the wrong place
-+ * So we copy the tail of the superblock
-+ * up 4 bytes before continuing
-+ */
-+ __u32 *sb32 = (__u32*)sb;
-+ memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-+ sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-+ (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
-+ if (verbose >= 0)
-+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
-+ devname);
-+ }
-+ if (strcmp(update, "super-minor") ==0) {
-+ sb->md_minor = info->array.md_minor;
-+ if (verbose > 0)
-+ fprintf(stderr, Name ": updating superblock of %s with minor number %d\n",
-+ devname, info->array.md_minor);
-+ }
-+ if (strcmp(update, "summaries") == 0) {
-+ int i;
-+ /* set nr_disks, active_disks, working_disks,
-+ * failed_disks, spare_disks based on disks[]
-+ * array in superblock.
-+ * Also make sure extra slots aren't 'failed'
-+ */
-+ sb->nr_disks = sb->active_disks =
-+ sb->working_disks = sb->failed_disks =
-+ sb->spare_disks = 0;
-+ for (i=0; i < MD_SB_DISKS ; i++)
-+ if (sb->disks[i].major ||
-+ sb->disks[i].minor) {
-+ int state = sb->disks[i].state;
-+ if (state & (1<<MD_DISK_REMOVED))
-+ continue;
-+ sb->nr_disks++;
-+ if (state & (1<<MD_DISK_ACTIVE))
-+ sb->active_disks++;
-+ if (state & (1<<MD_DISK_FAULTY))
-+ sb->failed_disks++;
-+ else
-+ sb->working_disks++;
-+ if (state == 0)
-+ sb->spare_disks++;
-+ } else if (i >= sb->raid_disks && sb->disks[i].number == 0)
-+ sb->disks[i].state = 0;
-+ }
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array, so
-+ * bring this one up-to-date.
-+ */
-+ __u32 ehi = sb->events_hi, elo = sb->events_lo;
-+ sb->events_hi = (info->events>>32) & 0xFFFFFFFF;
-+ sb->events_lo = (info->events) & 0xFFFFFFFF;
-+ if (sb->events_hi != ehi ||
-+ sb->events_lo != elo)
-+ rv = 1;
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* degraded array and 'force' requested, so
-+ * maybe need to mark it 'clean'
-+ */
-+ if ((sb->level == 5 || sb->level == 4 || sb->level == 6) &&
-+ (sb->state & (1 << MD_SB_CLEAN)) == 0) {
-+ /* need to force clean */
-+ sb->state |= (1 << MD_SB_CLEAN);
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int wonly = sb->disks[d].state & (1<<MD_DISK_WRITEMOSTLY);
-+ if ((sb->disks[d].state & ~(1<<MD_DISK_WRITEMOSTLY))
-+ != info->disk.state) {
-+ sb->disks[d].state = info->disk.state | wonly;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ sb->this_disk = sb->disks[info->disk.number];
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = info->array.raid_disks;
-+ sb->nr_disks = info->array.nr_disks;
-+ sb->active_disks = info->array.active_disks;
-+ sb->working_disks = info->array.working_disks;
-+ memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
-+ sb->disks[info->disk.number].number = info->disk.number;
-+ sb->disks[info->disk.number].major = info->disk.major;
-+ sb->disks[info->disk.number].minor = info->disk.minor;
-+ sb->disks[info->disk.number].raid_disk = info->disk.raid_disk;
-+ sb->disks[info->disk.number].state = info->disk.state;
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->state &= ~(1<<MD_SB_CLEAN);
-+ sb->recovery_cp = 0;
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ uuid_set = 0;
-+ update = "uuid";
-+ info->uuid[0] = sb->set_uuid0;
-+ info->uuid[1] = sb->set_uuid1;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ if (!uuid_set && homehost) {
-+ char buf[20];
-+ char *hash = sha1_buffer(homehost,
-+ strlen(homehost),
-+ buf);
-+ memcpy(info->uuid+2, hash, 8);
-+ }
-+ sb->set_uuid0 = info->uuid[0];
-+ sb->set_uuid1 = info->uuid[1];
-+ sb->set_uuid2 = info->uuid[2];
-+ sb->set_uuid3 = info->uuid[3];
-+ if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sb+1);
-+ uuid_from_super0((int*)bm->uuid, sbv);
-+ }
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = info->reshape_progress;
-+
-+ sb->sb_csum = calc_sb0_csum(sb);
-+ return rv;
-+}
-+
-+static int store_super0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super = sbv;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*2*512)
-+ return 2;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ if (lseek64(fd, offset, 0)< 0LL)
-+ return 3;
-+
-+ if (write(fd, super, sizeof(*super)) != sizeof(*super))
-+ return 4;
-+
-+ if (super->state & (1<<MD_SB_BITMAP_PRESENT)) {
-+ struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC)
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int compare_super0(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ mdp_super_t *first = *firstp;
-+ mdp_super_t *second = secondv;
-+
-+ int uuid1[4], uuid2[4];
-+ if (second->md_magic != MD_SB_MAGIC)
-+ return 1;
-+ if (!first) {
-+ first = malloc(MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
-+ *firstp = first;
-+ return 0;
-+ }
-+
-+ uuid_from_super0(uuid1, first);
-+ uuid_from_super0(uuid2, second);
-+ if (!same_uuid(uuid1, uuid2, 0))
-+ return 2;
-+ if (first->major_version != second->major_version ||
-+ first->minor_version != second->minor_version ||
-+ first->patch_version != second->patch_version ||
-+ first->gvalid_words != second->gvalid_words ||
-+ first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->size != second->size ||
-+ first->raid_disks != second->raid_disks )
-+ return 3;
-+
-+ return 0;
-+}
-+
-+
-+static int load_super0(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ /* try to read in the superblock
-+ * Return:
-+ * 0 on success
-+ * 1 on cannot get superblock
-+ * 2 on superblock meaningless
-+ */
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+ mdp_super_t *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2) {
-+ if (devname)
-+ fprintf(stderr, Name
-+ ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+ if (lseek64(fd, offset, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(MD_SB_BYTES + sizeof(bitmap_super_t));
-+
-+ if (read(fd, super, sizeof(*super)) != MD_SB_BYTES) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (st->ss && st->minor_version == 9)
-+ super0_swap_endian(super);
-+
-+ if (super->md_magic != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, super->md_magic);
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (super->major_version != 0) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, super->major_version);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+ if (st->ss == NULL) {
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ /* Now check on the bitmap superblock */
-+ if ((super->state & (1<<MD_SB_BITMAP_PRESENT)) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ if (read(fd, super+1, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super0(uuid, super);
-+ bsb = (struct bitmap_super_s *)(super+1);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->state &= ~(1<<MD_SB_BITMAP_PRESENT);
-+
-+ return 0;
-+}
-+
-+static struct supertype *match_metadata_desc0(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super0;
-+ st->minor_version = 90;
-+ st->max_devs = MD_SB_DISKS;
-+ if (strcmp(arg, "0") == 0 ||
-+ strcmp(arg, "0.90") == 0 ||
-+ strcmp(arg, "default") == 0
-+ )
-+ return st;
-+
-+ st->minor_version = 9; /* flag for 'byte-swapped' */
-+ if (strcmp(arg, "0.swap")==0)
-+ return st;
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+void locate_bitmap0(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long dsize;
-+ unsigned long long offset;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return;
-+
-+ if (dsize < MD_RESERVED_SECTORS*512 * 2)
-+ return;
-+
-+ offset = MD_NEW_SIZE_SECTORS(dsize>>9);
-+
-+ offset *= 512;
-+
-+ offset += MD_SB_BYTES;
-+
-+ lseek64(fd, offset, 0);
-+}
-+
-+struct superswitch super0 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super0,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home0,
-+ .uuid_from_super = uuid_from_super0,
-+ .getinfo_super = getinfo_super0,
-+ .update_super = update_super0,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super0,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super0,
-+ .load_super = load_super0,
-+ .match_metadata_desc = match_metadata_desc0,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap0,
-+ .write_bitmap = NULL,
-+ .major = 0,
-+ .swapuuid = 0,
-+};
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/super1.c busybox-1.7.4+gentoo+mdadm/mdadm/super1.c
---- busybox-1.7.4+gentoo/mdadm/super1.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/super1.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,731 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+/*
-+ * The version-1 superblock :
-+ * All numeric fields are little-endian.
-+ *
-+ * total size: 256 bytes plus 2 per device.
-+ * 1K allows 384 devices.
-+ */
-+struct mdp_superblock_1 {
-+ /* constant array information - 128 bytes */
-+ __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
-+ __u32 major_version; /* 1 */
-+ __u32 feature_map; /* 0 for now */
-+ __u32 pad0; /* always set to 0 when writing */
-+
-+ __u8 set_uuid[16]; /* user-space generated. */
-+ char set_name[32]; /* set and interpreted by user-space */
-+
-+ __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
-+ __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
-+ __u32 layout; /* only for raid5 currently */
-+ __u64 size; /* used size of component devices, in 512byte sectors */
-+
-+ __u32 chunksize; /* in 512byte sectors */
-+ __u32 raid_disks;
-+ __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
-+ * NOTE: signed, so bitmap can be before superblock
-+ * only meaningful of feature_map[0] is set.
-+ */
-+
-+ /* These are only valid with feature bit '4' */
-+ __u32 new_level; /* new level we are reshaping to */
-+ __u64 reshape_position; /* next address in array-space for reshape */
-+ __u32 delta_disks; /* change in number of raid_disks */
-+ __u32 new_layout; /* new layout */
-+ __u32 new_chunk; /* new chunk size (bytes) */
-+ __u8 pad1[128-124]; /* set to 0 when written */
-+
-+ /* constant this-device information - 64 bytes */
-+ __u64 data_offset; /* sector start of data, often 0 */
-+ __u64 data_size; /* sectors in this device that can be used for data */
-+ __u64 super_offset; /* sector start of this superblock */
-+ __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
-+ __u32 dev_number; /* permanent identifier of this device - not role in raid */
-+ __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
-+ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
-+ __u8 devflags; /* per-device flags. Only one defined...*/
-+#define WriteMostly1 1 /* mask for writemostly flag in above */
-+ __u8 pad2[64-57]; /* set to 0 when writing */
-+
-+ /* array state information - 64 bytes */
-+ __u64 utime; /* 40 bits second, 24 btes microseconds */
-+ __u64 events; /* incremented when superblock updated */
-+ __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
-+ __u32 sb_csum; /* checksum upto devs[max_dev] */
-+ __u32 max_dev; /* size of devs[] array to consider */
-+ __u8 pad3[64-32]; /* set to 0 when writing */
-+
-+ /* device state information. Indexed by dev_number.
-+ * 2 bytes per device
-+ * Note there are no per-device state flags. State information is rolled
-+ * into the 'roles' value. If a device is spare or faulty, then it doesn't
-+ * have a meaningful role.
-+ */
-+ __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
-+};
-+
-+struct misc_dev_info {
-+ __u64 device_size;
-+};
-+
-+/* feature_map bits */
-+#define MD_FEATURE_BITMAP_OFFSET 1
-+#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and
-+ * must be honoured
-+ */
-+#define MD_FEATURE_RESHAPE_ACTIVE 4
-+
-+#define MD_FEATURE_ALL (1|2|4)
-+
-+#ifndef offsetof
-+#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-+#endif
-+static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
-+{
-+ unsigned int disk_csum, csum;
-+ unsigned long long newcsum;
-+ int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
-+ unsigned int *isuper = (unsigned int*)sb;
-+ int i;
-+
-+/* make sure I can count... */
-+ if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
-+ offsetof(struct mdp_superblock_1, utime) != 192 ||
-+ sizeof(struct mdp_superblock_1) != 256) {
-+ fprintf(stderr, "WARNING - superblock isn't sized correctly\n");
-+ }
-+
-+ disk_csum = sb->sb_csum;
-+ sb->sb_csum = 0;
-+ newcsum = 0;
-+ for (i=0; size>=4; size -= 4 ) {
-+ newcsum += __le32_to_cpu(*isuper);
-+ isuper++;
-+ }
-+
-+ if (size == 2)
-+ newcsum += __le16_to_cpu(*(unsigned short*) isuper);
-+
-+ csum = (newcsum & 0xffffffff) + (newcsum >> 32);
-+ sb->sb_csum = disk_csum;
-+ return __cpu_to_le32(csum);
-+}
-+
-+static void brief_examine_super1(void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int i;
-+ unsigned long long sb_offset;
-+ char *nm;
-+ char *c=map_num(pers, __le32_to_cpu(sb->level));
-+
-+ nm = strchr(sb->set_name, ':');
-+ if (nm)
-+ nm++;
-+ else if (sb->set_name[0])
-+ nm = sb->set_name;
-+ else
-+ nm = "??";
-+
-+ printf("ARRAY /dev/md%s level=%s ", nm, c?c:"-unknown-");
-+ sb_offset = __le64_to_cpu(sb->super_offset);
-+ if (sb_offset <= 4)
-+ printf("metadata=1.1 ");
-+ else if (sb_offset <= 8)
-+ printf("metadata=1.2 ");
-+ else
-+ printf("metadata=1.0 ");
-+ printf("num-devices=%d UUID=", __le32_to_cpu(sb->raid_disks));
-+ for (i=0; i<16; i++) {
-+ if ((i&3)==0 && i != 0) printf(":");
-+ printf("%02x", sb->set_uuid[i]);
-+ }
-+ if (sb->set_name[0])
-+ printf(" name=%.32s", sb->set_name);
-+ printf("\n");
-+}
-+
-+static int match_home1(void *sbv, char *homehost)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int l = homehost ? strlen(homehost) : 0;
-+
-+ return (l > 0 && l < 32 &&
-+ sb->set_name[l] == ':' &&
-+ strncmp(sb->set_name, homehost, l) == 0);
-+}
-+
-+static void uuid_from_super1(int uuid[4], void * sbv)
-+{
-+ struct mdp_superblock_1 *super = sbv;
-+ char *cuuid = (char*)uuid;
-+ int i;
-+ for (i=0; i<16; i++)
-+ cuuid[i] = super->set_uuid[i];
-+}
-+
-+static void getinfo_super1(struct mdinfo *info, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ int working = 0;
-+ int i;
-+ int role;
-+
-+ info->array.major_version = 1;
-+ info->array.minor_version = __le32_to_cpu(sb->feature_map);
-+ info->array.patch_version = 0;
-+ info->array.raid_disks = __le32_to_cpu(sb->raid_disks);
-+ info->array.level = __le32_to_cpu(sb->level);
-+ info->array.layout = __le32_to_cpu(sb->layout);
-+ info->array.md_minor = -1;
-+ info->array.ctime = __le64_to_cpu(sb->ctime);
-+ info->array.utime = __le64_to_cpu(sb->utime);
-+ info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
-+ info->array.state =
-+ (__le64_to_cpu(sb->resync_offset) >= __le64_to_cpu(sb->size))
-+ ? 1 : 0;
-+
-+ info->data_offset = __le64_to_cpu(sb->data_offset);
-+ info->component_size = __le64_to_cpu(sb->size);
-+
-+ info->disk.major = 0;
-+ info->disk.minor = 0;
-+ info->disk.number = __le32_to_cpu(sb->dev_number);
-+ if (__le32_to_cpu(sb->dev_number) >= __le32_to_cpu(sb->max_dev) ||
-+ __le32_to_cpu(sb->max_dev) > 512)
-+ role = 0xfffe;
-+ else
-+ role = __le16_to_cpu(sb->dev_roles[__le32_to_cpu(sb->dev_number)]);
-+
-+ info->disk.raid_disk = -1;
-+ switch(role) {
-+ case 0xFFFF:
-+ info->disk.state = 2; /* spare: ACTIVE, not sync, not faulty */
-+ break;
-+ case 0xFFFE:
-+ info->disk.state = 1; /* faulty */
-+ break;
-+ default:
-+ info->disk.state = 6; /* active and in sync */
-+ info->disk.raid_disk = role;
-+ }
-+ info->events = __le64_to_cpu(sb->events);
-+
-+ memcpy(info->uuid, sb->set_uuid, 16);
-+
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+
-+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
-+ info->reshape_active = 1;
-+ info->reshape_progress = __le64_to_cpu(sb->reshape_position);
-+ info->new_level = __le32_to_cpu(sb->new_level);
-+ info->delta_disks = __le32_to_cpu(sb->delta_disks);
-+ info->new_layout = __le32_to_cpu(sb->new_layout);
-+ info->new_chunk = __le32_to_cpu(sb->new_chunk)<<9;
-+ } else
-+ info->reshape_active = 0;
-+
-+ for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
-+ role = __le16_to_cpu(sb->dev_roles[i]);
-+ if (/*role == 0xFFFF || */role < info->array.raid_disks)
-+ working++;
-+ }
-+
-+ info->array.working_disks = working;
-+}
-+
-+static int update_super1(struct mdinfo *info, void *sbv, char *update,
-+ char *devname, int verbose,
-+ int uuid_set, char *homehost)
-+{
-+ /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
-+ * For others, the return value is ignored.
-+ */
-+ int rv = 0;
-+ struct mdp_superblock_1 *sb = sbv;
-+
-+ if (strcmp(update, "force-one")==0) {
-+ /* Not enough devices for a working array,
-+ * so bring this one up-to-date
-+ */
-+ if (sb->events != __cpu_to_le64(info->events))
-+ rv = 1;
-+ sb->events = __cpu_to_le64(info->events);
-+ }
-+ if (strcmp(update, "force-array")==0) {
-+ /* Degraded array and 'force' requests to
-+ * maybe need to mark it 'clean'.
-+ */
-+ switch(__le32_to_cpu(sb->level)) {
-+ case 5: case 4: case 6:
-+ /* need to force clean */
-+ if (sb->resync_offset != ~0ULL)
-+ rv = 1;
-+ sb->resync_offset = ~0ULL;
-+ }
-+ }
-+ if (strcmp(update, "assemble")==0) {
-+ int d = info->disk.number;
-+ int want;
-+ if (info->disk.state == 6)
-+ want = __cpu_to_le32(info->disk.raid_disk);
-+ else
-+ want = 0xFFFF;
-+ if (sb->dev_roles[d] != want) {
-+ sb->dev_roles[d] = want;
-+ rv = 1;
-+ }
-+ }
-+ if (strcmp(update, "linear-grow-new") == 0) {
-+ int i;
-+ int rfd;
-+ int max = __le32_to_cpu(sb->max_dev);
-+
-+ for (i=0 ; i < max ; i++)
-+ if (__le16_to_cpu(sb->dev_roles[i]) >= 0xfffe)
-+ break;
-+ sb->dev_number = __cpu_to_le32(i);
-+ info->disk.number = i;
-+ if (max >= __le32_to_cpu(sb->max_dev))
-+ sb->max_dev = __cpu_to_le32(max+1);
-+
-+ if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
-+ read(rfd, sb->device_uuid, 16) != 16) {
-+ *(__u32*)(sb->device_uuid) = random();
-+ *(__u32*)(sb->device_uuid+4) = random();
-+ *(__u32*)(sb->device_uuid+8) = random();
-+ *(__u32*)(sb->device_uuid+12) = random();
-+ }
-+
-+ sb->dev_roles[i] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "linear-grow-update") == 0) {
-+ sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
-+ sb->dev_roles[info->disk.number] =
-+ __cpu_to_le16(info->disk.raid_disk);
-+ }
-+ if (strcmp(update, "resync") == 0) {
-+ /* make sure resync happens */
-+ sb->resync_offset = 0ULL;
-+ }
-+ if (strcmp(update, "uuid") == 0) {
-+ copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid);
-+
-+ if (__le32_to_cpu(sb->feature_map)&MD_FEATURE_BITMAP_OFFSET) {
-+ struct bitmap_super_s *bm;
-+ bm = (struct bitmap_super_s*)(sbv+1024);
-+ memcpy(bm->uuid, sb->set_uuid, 16);
-+ }
-+ }
-+ if (strcmp(update, "homehost") == 0 &&
-+ homehost) {
-+ char *c;
-+ update = "name";
-+ c = strchr(sb->set_name, ':');
-+ if (c)
-+ strncpy(info->name, c+1, 31 - (c-sb->set_name));
-+ else
-+ strncpy(info->name, sb->set_name, 32);
-+ info->name[32] = 0;
-+ }
-+ if (strcmp(update, "name") == 0) {
-+ if (info->name[0] == 0)
-+ sprintf(info->name, "%d", info->array.md_minor);
-+ memset(sb->set_name, 0, sizeof(sb->set_name));
-+ if (homehost &&
-+ strchr(info->name, ':') == NULL &&
-+ strlen(homehost)+1+strlen(info->name) < 32) {
-+ strcpy(sb->set_name, homehost);
-+ strcat(sb->set_name, ":");
-+ strcat(sb->set_name, info->name);
-+ } else
-+ strcpy(sb->set_name, info->name);
-+ }
-+ if (strcmp(update, "devicesize") == 0 &&
-+ __le64_to_cpu(sb->super_offset) <
-+ __le64_to_cpu(sb->data_offset)) {
-+ /* set data_size to device size less data_offset */
-+ struct misc_dev_info *misc = (struct misc_dev_info*)
-+ (sbv + 1024 + sizeof(struct bitmap_super_s));
-+ printf("Size was %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ sb->data_size = __cpu_to_le64(
-+ misc->device_size - __le64_to_cpu(sb->data_offset));
-+ printf("Size is %llu\n", (unsigned long long)
-+ __le64_to_cpu(sb->data_size));
-+ }
-+ if (strcmp(update, "_reshape_progress")==0)
-+ sb->reshape_position = __cpu_to_le64(info->reshape_progress);
-+
-+ sb->sb_csum = calc_sb_1_csum(sb);
-+ return rv;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv);
-+
-+static int store_super1(struct supertype *st, int fd, void *sbv)
-+{
-+ struct mdp_superblock_1 *sb = sbv;
-+ unsigned long long sb_offset;
-+ int sbsize;
-+ unsigned long long dsize;
-+
-+ if (!get_dev_size(fd, NULL, &dsize))
-+ return 1;
-+
-+ dsize >>= 9;
-+
-+ if (dsize < 24)
-+ return 2;
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+
-+
-+ if (sb_offset != __le64_to_cpu(sb->super_offset) &&
-+ 0 != __le64_to_cpu(sb->super_offset)
-+ ) {
-+ fprintf(stderr, Name ": internal error - sb_offset is wrong\n");
-+ abort();
-+ }
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL)
-+ return 3;
-+
-+ sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev);
-+
-+ if (write(fd, sb, sbsize) != sbsize)
-+ return 4;
-+
-+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
-+ struct bitmap_super_s *bm = (struct bitmap_super_s*)
-+ (((char*)sb)+1024);
-+ if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) {
-+ locate_bitmap1(st, fd, sbv);
-+ if (write(fd, bm, sizeof(*bm)) != sizeof(*bm))
-+ return 5;
-+ }
-+ }
-+ fsync(fd);
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname);
-+
-+static int compare_super1(void **firstp, void *secondv)
-+{
-+ /*
-+ * return:
-+ * 0 same, or first was empty, and second was copied
-+ * 1 second had wrong number
-+ * 2 wrong uuid
-+ * 3 wrong other info
-+ */
-+ struct mdp_superblock_1 *first = *firstp;
-+ struct mdp_superblock_1 *second = secondv;
-+
-+ if (second->magic != __cpu_to_le32(MD_SB_MAGIC))
-+ return 1;
-+ if (second->major_version != __cpu_to_le32(1))
-+ return 1;
-+
-+ if (!first) {
-+ first = malloc(1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ memcpy(first, second, 1024+sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+ *firstp = first;
-+ return 0;
-+ }
-+ if (memcmp(first->set_uuid, second->set_uuid, 16)!= 0)
-+ return 2;
-+
-+ if (first->ctime != second->ctime ||
-+ first->level != second->level ||
-+ first->layout != second->layout ||
-+ first->size != second->size ||
-+ first->chunksize != second->chunksize ||
-+ first->raid_disks != second->raid_disks)
-+ return 3;
-+ return 0;
-+}
-+
-+static int load_super1(struct supertype *st, int fd, void **sbp, char *devname)
-+{
-+ unsigned long long dsize;
-+ unsigned long long sb_offset;
-+ struct mdp_superblock_1 *super;
-+ int uuid[4];
-+ struct bitmap_super_s *bsb;
-+ struct misc_dev_info *misc;
-+
-+
-+ if (st->ss == NULL) {
-+ int bestvers = -1;
-+ __u64 bestctime = 0;
-+ /* guess... choose latest ctime */
-+ st->ss = &super1;
-+ for (st->minor_version = 0; st->minor_version <= 2 ; st->minor_version++) {
-+ switch(load_super1(st, fd, sbp, devname)) {
-+ case 0: super = *sbp;
-+ if (bestvers == -1 ||
-+ bestctime < __le64_to_cpu(super->ctime)) {
-+ bestvers = st->minor_version;
-+ bestctime = __le64_to_cpu(super->ctime);
-+ }
-+ free(super);
-+ *sbp = NULL;
-+ break;
-+ case 1: st->ss = NULL; return 1; /*bad device */
-+ case 2: break; /* bad, try next */
-+ }
-+ }
-+ if (bestvers != -1) {
-+ int rv;
-+ st->minor_version = bestvers;
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ rv = load_super1(st, fd, sbp, devname);
-+ if (rv) st->ss = NULL;
-+ return rv;
-+ }
-+ st->ss = NULL;
-+ return 2;
-+ }
-+ if (!get_dev_size(fd, devname, &dsize))
-+ return 1;
-+ dsize >>= 9;
-+
-+ if (dsize < 24) {
-+ if (devname)
-+ fprintf(stderr, Name ": %s is too small for md: size is %llu sectors.\n",
-+ devname, dsize);
-+ return 1;
-+ }
-+
-+ /*
-+ * Calculate the position of the superblock.
-+ * It is always aligned to a 4K boundary and
-+ * depending on minor_version, it can be:
-+ * 0: At least 8K, but less than 12K, from end of device
-+ * 1: At start of device
-+ * 2: 4K from start of device.
-+ */
-+ switch(st->minor_version) {
-+ case 0:
-+ sb_offset = dsize;
-+ sb_offset -= 8*2;
-+ sb_offset &= ~(4*2-1);
-+ break;
-+ case 1:
-+ sb_offset = 0;
-+ break;
-+ case 2:
-+ sb_offset = 4*2;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-+
-+
-+ if (lseek64(fd, sb_offset << 9, 0)< 0LL) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot seek to superblock on %s: %s\n",
-+ devname, strerror(errno));
-+ return 1;
-+ }
-+
-+ super = malloc(1024 + sizeof(bitmap_super_t) +
-+ sizeof(struct misc_dev_info));
-+
-+ if (read(fd, super, 1024) != 1024) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot read superblock on %s\n",
-+ devname);
-+ free(super);
-+ return 1;
-+ }
-+
-+ if (__le32_to_cpu(super->magic) != MD_SB_MAGIC) {
-+ if (devname)
-+ fprintf(stderr, Name ": No super block found on %s (Expected magic %08x, got %08x)\n",
-+ devname, MD_SB_MAGIC, __le32_to_cpu(super->magic));
-+ free(super);
-+ return 2;
-+ }
-+
-+ if (__le32_to_cpu(super->major_version) != 1) {
-+ if (devname)
-+ fprintf(stderr, Name ": Cannot interpret superblock on %s - version is %d\n",
-+ devname, __le32_to_cpu(super->major_version));
-+ free(super);
-+ return 2;
-+ }
-+ if (__le64_to_cpu(super->super_offset) != sb_offset) {
-+ if (devname)
-+ fprintf(stderr, Name ": No superblock found on %s (super_offset is wrong)\n",
-+ devname);
-+ free(super);
-+ return 2;
-+ }
-+ *sbp = super;
-+
-+ bsb = (struct bitmap_super_s *)(((char*)super)+1024);
-+
-+ misc = (struct misc_dev_info*) (bsb+1);
-+ misc->device_size = dsize;
-+
-+ /* Now check on the bitmap superblock */
-+ if ((__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) == 0)
-+ return 0;
-+ /* Read the bitmap superblock and make sure it looks
-+ * valid. If it doesn't clear the bit. An --assemble --force
-+ * should get that written out.
-+ */
-+ locate_bitmap1(st, fd, super);
-+ if (read(fd, ((char*)super)+1024, sizeof(struct bitmap_super_s))
-+ != sizeof(struct bitmap_super_s))
-+ goto no_bitmap;
-+
-+ uuid_from_super1(uuid, super);
-+ if (__le32_to_cpu(bsb->magic) != BITMAP_MAGIC ||
-+ memcmp(bsb->uuid, uuid, 16) != 0)
-+ goto no_bitmap;
-+ return 0;
-+
-+ no_bitmap:
-+ super->feature_map = __cpu_to_le32(__le32_to_cpu(super->feature_map) & ~1);
-+ return 0;
-+}
-+
-+
-+static struct supertype *match_metadata_desc1(char *arg)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ if (strcmp(arg, "1") == 0 ||
-+ strcmp(arg, "1.0") == 0 ||
-+ strcmp(arg, "default/large") == 0) {
-+ st->minor_version = 0;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.1") == 0) {
-+ st->minor_version = 1;
-+ return st;
-+ }
-+ if (strcmp(arg, "1.2") == 0) {
-+ st->minor_version = 2;
-+ return st;
-+ }
-+
-+ free(st);
-+ return NULL;
-+}
-+
-+static void locate_bitmap1(struct supertype *st, int fd, void *sbv)
-+{
-+ unsigned long long offset;
-+ struct mdp_superblock_1 *sb;
-+ int mustfree = 0;
-+
-+ if (!sbv) {
-+ if (st->ss->load_super(st, fd, &sbv, NULL))
-+ return; /* no error I hope... */
-+ mustfree = 1;
-+ }
-+ sb = sbv;
-+
-+ offset = __le64_to_cpu(sb->super_offset);
-+ offset += (int32_t) __le32_to_cpu(sb->bitmap_offset);
-+ if (mustfree)
-+ free(sb);
-+ lseek64(fd, offset<<9, 0);
-+}
-+
-+struct superswitch super1 = {
-+ .examine_super = NULL,
-+ .brief_examine_super = brief_examine_super1,
-+ .detail_super = NULL,
-+ .brief_detail_super = NULL,
-+ .export_super = NULL,
-+ .match_home = match_home1,
-+ .uuid_from_super = uuid_from_super1,
-+ .getinfo_super = getinfo_super1,
-+ .update_super = update_super1,
-+ .init_super = NULL,
-+ .add_to_super = NULL,
-+ .store_super = store_super1,
-+ .write_init_super = NULL,
-+ .compare_super = compare_super1,
-+ .load_super = load_super1,
-+ .match_metadata_desc = match_metadata_desc1,
-+ .avail_size = NULL,
-+ .add_internal_bitmap = NULL,
-+ .locate_bitmap = locate_bitmap1,
-+ .write_bitmap = NULL,
-+ .major = 1,
-+#if __BYTE_ORDER == BIG_ENDIAN
-+ .swapuuid = 0,
-+#else
-+ .swapuuid = 1,
-+#endif
-+};
-diff -Nuar --exclude '*.orig' busybox-1.7.4+gentoo/mdadm/util.c busybox-1.7.4+gentoo+mdadm/mdadm/util.c
---- busybox-1.7.4+gentoo/mdadm/util.c 1969-12-31 16:00:00.000000000 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/util.c 2008-03-11 10:31:00.000000000 -0700
-@@ -0,0 +1,652 @@
-+/*
-+ * mdadm - manage Linux "md" devices aka RAID arrays.
-+ *
-+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Author: Neil Brown
-+ * Email: <neilb@cse.unsw.edu.au>
-+ * Paper: Neil Brown
-+ * School of Computer Science and Engineering
-+ * The University of New South Wales
-+ * Sydney, 2052
-+ * Australia
-+ */
-+
-+#include "mdadm.h"
-+#include "md_p.h"
-+#include <sys/utsname.h>
-+#include <ctype.h>
-+
-+/*
-+ * following taken from linux/blkpg.h because they aren't
-+ * anywhere else and it isn't safe to #include linux/ * stuff.
-+ */
-+
-+#define BLKPG _IO(0x12,105)
-+
-+/* The argument structure */
-+struct blkpg_ioctl_arg {
-+ int op;
-+ int flags;
-+ int datalen;
-+ void *data;
-+};
-+
-+/* The subfunctions (for the op field) */
-+#define BLKPG_ADD_PARTITION 1
-+#define BLKPG_DEL_PARTITION 2
-+
-+/* Sizes of name fields. Unused at present. */
-+#define BLKPG_DEVNAMELTH 64
-+#define BLKPG_VOLNAMELTH 64
-+
-+/* The data structure for ADD_PARTITION and DEL_PARTITION */
-+struct blkpg_partition {
-+ long long start; /* starting offset in bytes */
-+ long long length; /* length in bytes */
-+ int pno; /* partition number */
-+ char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
-+ to be used in kernel messages */
-+ char volname[BLKPG_VOLNAMELTH]; /* volume label */
-+};
-+
-+/*
-+ * Parse a 128 bit uuid in 4 integers
-+ * format is 32 hexx nibbles with options :.<space> separator
-+ * If not exactly 32 hex digits are found, return 0
-+ * else return 1
-+ */
-+int parse_uuid(char *str, int uuid[4])
-+{
-+ int hit = 0; /* number of Hex digIT */
-+ int i;
-+ char c;
-+ for (i=0; i<4; i++) uuid[i]=0;
-+
-+ while ((c= *str++)) {
-+ int n;
-+ if (c>='0' && c<='9')
-+ n = c-'0';
-+ else if (c>='a' && c <= 'f')
-+ n = 10 + c - 'a';
-+ else if (c>='A' && c <= 'F')
-+ n = 10 + c - 'A';
-+ else if (strchr(":. -", c))
-+ continue;
-+ else return 0;
-+
-+ if (hit<32) {
-+ uuid[hit/8] <<= 4;
-+ uuid[hit/8] += n;
-+ }
-+ hit++;
-+ }
-+ if (hit == 32)
-+ return 1;
-+ return 0;
-+
-+}
-+
-+
-+/*
-+ * Get the md version number.
-+ * We use the RAID_VERSION ioctl if it is supported
-+ * If not, but we have a block device with major '9', we assume
-+ * 0.36.0
-+ *
-+ * Return version number as 24 but number - assume version parts
-+ * always < 255
-+ */
-+
-+int md_get_version(int fd)
-+{
-+ struct stat stb;
-+ mdu_version_t vers;
-+
-+ if (fstat(fd, &stb)<0)
-+ return -1;
-+ if ((S_IFMT&stb.st_mode) != S_IFBLK)
-+ return -1;
-+
-+ if (ioctl(fd, RAID_VERSION, &vers) == 0)
-+ return (vers.major*10000) + (vers.minor*100) + vers.patchlevel;
-+ if (errno == EACCES)
-+ return -1;
-+ if (major(stb.st_rdev) == MD_MAJOR)
-+ return (3600);
-+ return -1;
-+}
-+
-+
-+int get_linux_version()
-+{
-+ struct utsname name;
-+ char *cp;
-+ int a,b,c;
-+ if (uname(&name) <0)
-+ return -1;
-+
-+ cp = name.release;
-+ a = strtoul(cp, &cp, 10);
-+ if (*cp != '.') return -1;
-+ b = strtoul(cp+1, &cp, 10);
-+ if (*cp != '.') return -1;
-+ c = strtoul(cp+1, NULL, 10);
-+
-+ return (a*1000000)+(b*1000)+c;
-+}
-+
-+void remove_partitions(int fd)
-+{
-+ /* remove partitions from this block devices.
-+ * This is used for components added to an array
-+ */
-+#ifdef BLKPG_DEL_PARTITION
-+ struct blkpg_ioctl_arg a;
-+ struct blkpg_partition p;
-+
-+ a.op = BLKPG_DEL_PARTITION;
-+ a.data = (void*)&p;
-+ a.datalen = sizeof(p);
-+ a.flags = 0;
-+ memset(a.data, 0, a.datalen);
-+ for (p.pno=0; p.pno < 16; p.pno++)
-+ ioctl(fd, BLKPG, &a);
-+#endif
-+}
-+
-+int enough(int level, int raid_disks, int layout, int clean,
-+ char *avail, int avail_disks)
-+{
-+ int copies, first;
-+ switch (level) {
-+ case 10:
-+ /* This is the tricky one - we need to check
-+ * which actual disks are present.
-+ */
-+ copies = (layout&255)* ((layout>>8) & 255);
-+ first=0;
-+ do {
-+ /* there must be one of the 'copies' form 'first' */
-+ int n = copies;
-+ int cnt=0;
-+ while (n--) {
-+ if (avail[first])
-+ cnt++;
-+ first = (first+1) % raid_disks;
-+ }
-+ if (cnt == 0)
-+ return 0;
-+
-+ } while (first != 0);
-+ return 1;
-+
-+ case -4:
-+ return avail_disks>= 1;
-+ case -1:
-+ case 0:
-+ return avail_disks == raid_disks;
-+ case 1:
-+ return avail_disks >= 1;
-+ case 4:
-+ case 5:
-+ if (clean)
-+ return avail_disks >= raid_disks-1;
-+ else
-+ return avail_disks >= raid_disks;
-+ case 6:
-+ if (clean)
-+ return avail_disks >= raid_disks-2;
-+ else
-+ return avail_disks >= raid_disks;
-+ default:
-+ return 0;
-+ }
-+}
-+
-+int same_uuid(int a[4], int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ if (ac[i+0] != bc[i+3] ||
-+ ac[i+1] != bc[i+2] ||
-+ ac[i+2] != bc[i+1] ||
-+ ac[i+3] != bc[i+0])
-+ return 0;
-+ }
-+ return 1;
-+ } else {
-+ if (a[0]==b[0] &&
-+ a[1]==b[1] &&
-+ a[2]==b[2] &&
-+ a[3]==b[3])
-+ return 1;
-+ return 0;
-+ }
-+}
-+void copy_uuid(void *a, int b[4], int swapuuid)
-+{
-+ if (swapuuid) {
-+ /* parse uuids are hostendian.
-+ * uuid's from some superblocks are big-ending
-+ * if there is a difference, we need to swap..
-+ */
-+ unsigned char *ac = (unsigned char *)a;
-+ unsigned char *bc = (unsigned char *)b;
-+ int i;
-+ for (i=0; i<16; i+= 4) {
-+ ac[i+0] = bc[i+3];
-+ ac[i+1] = bc[i+2];
-+ ac[i+2] = bc[i+1];
-+ ac[i+3] = bc[i+0];
-+ }
-+ } else
-+ memcpy(a, b, 16);
-+}
-+
-+char *map_num(mapping_t *map, int num)
-+{
-+ while (map->name) {
-+ if (map->num == num)
-+ return map->name;
-+ map++;
-+ }
-+ return NULL;
-+}
-+
-+int map_name(mapping_t *map, char *name)
-+{
-+ while (map->name) {
-+ if (strcmp(map->name, name)==0)
-+ return map->num;
-+ map++;
-+ }
-+ return UnSet;
-+}
-+
-+
-+int is_standard(char *dev, int *nump)
-+{
-+ /* tests if dev is a "standard" md dev name.
-+ * i.e if the last component is "/dNN" or "/mdNN",
-+ * where NN is a string of digits
-+ */
-+ char *d = strrchr(dev, '/');
-+ int type=0;
-+ int num;
-+ if (!d)
-+ return 0;
-+ if (strncmp(d, "/d",2)==0)
-+ d += 2, type=1; /* /dev/md/dN{pM} */
-+ else if (strncmp(d, "/md_d", 5)==0)
-+ d += 5, type=1; /* /dev/md_dNpM */
-+ else if (strncmp(d, "/md", 3)==0)
-+ d += 3, type=-1; /* /dev/mdN */
-+ else if (d-dev > 3 && strncmp(d-2, "md/", 3)==0)
-+ d += 1, type=-1; /* /dev/md/N */
-+ else
-+ return 0;
-+ if (!*d)
-+ return 0;
-+ num = atoi(d);
-+ while (isdigit(*d))
-+ d++;
-+ if (*d)
-+ return 0;
-+ if (nump) *nump = num;
-+
-+ return type;
-+}
-+
-+
-+/*
-+ * convert a major/minor pair for a block device into a name in /dev, if possible.
-+ * On the first call, walk /dev collecting name.
-+ * Put them in a simple linked listfor now.
-+ */
-+struct devmap {
-+ int major, minor;
-+ char *name;
-+ struct devmap *next;
-+} *devlist = NULL;
-+int devlist_ready = 0;
-+
-+int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
-+{
-+ struct stat st;
-+ if (S_ISLNK(stb->st_mode)) {
-+ stat(name, &st);
-+ stb = &st;
-+ }
-+
-+ if ((stb->st_mode&S_IFMT)== S_IFBLK) {
-+ char *n = strdup(name);
-+ struct devmap *dm = malloc(sizeof(*dm));
-+ if (strncmp(n, "/dev/./", 7)==0)
-+ strcpy(n+4, name+6);
-+ if (dm) {
-+ dm->major = major(stb->st_rdev);
-+ dm->minor = minor(stb->st_rdev);
-+ dm->name = n;
-+ dm->next = devlist;
-+ devlist = dm;
-+ }
-+ }
-+ return 0;
-+}
-+
-+#ifndef HAVE_NFTW
-+#ifdef HAVE_FTW
-+int add_dev_1(const char *name, const struct stat *stb, int flag)
-+{
-+ return add_dev(name, stb, flag, NULL);
-+}
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return ftw(path, add_dev_1, nopenfd);
-+}
-+#else
-+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
-+{
-+ return 0;
-+}
-+#endif /* HAVE_FTW */
-+#endif /* HAVE_NFTW */
-+
-+/*
-+ * Find a block device with the right major/minor number.
-+ * If we find multiple names, choose the shortest.
-+ * If we find a non-standard name, it is probably there
-+ * deliberately so prefer it over a standard name.
-+ * This applies only to names for MD devices.
-+ */
-+char *map_dev(int major, int minor, int create)
-+{
-+ struct devmap *p;
-+ char *std = NULL, *nonstd=NULL;
-+ int did_check = 0;
-+
-+ if (major == 0 && minor == 0)
-+ return NULL;
-+
-+ retry:
-+ if (!devlist_ready) {
-+ char *dev = "/dev";
-+ struct stat stb;
-+ while(devlist) {
-+ struct devmap *d = devlist;
-+ devlist = d->next;
-+ free(d->name);
-+ free(d);
-+ }
-+ if (lstat(dev, &stb)==0 &&
-+ S_ISLNK(stb.st_mode))
-+ dev = "/dev/.";
-+ nftw(dev, add_dev, 10, FTW_PHYS);
-+ devlist_ready=1;
-+ did_check = 1;
-+ }
-+
-+ for (p=devlist; p; p=p->next)
-+ if (p->major == major &&
-+ p->minor == minor) {
-+ if (is_standard(p->name, NULL)) {
-+ if (std == NULL ||
-+ strlen(p->name) < strlen(std))
-+ std = p->name;
-+ } else {
-+ if (nonstd == NULL ||
-+ strlen(p->name) < strlen(nonstd))
-+ nonstd = p->name;
-+ }
-+ }
-+ if (!std && !nonstd && !did_check) {
-+ devlist_ready = 0;
-+ goto retry;
-+ }
-+ if (create && !std && !nonstd) {
-+ static char buf[30];
-+ snprintf(buf, sizeof(buf), "%d:%d", major, minor);
-+ nonstd = buf;
-+ }
-+
-+ return nonstd ? nonstd : std;
-+}
-+
-+unsigned long calc_csum(void *super, int bytes)
-+{
-+ unsigned long long newcsum = 0;
-+ int i;
-+ unsigned int csum;
-+ unsigned int *superc = (unsigned int*) super;
-+
-+ for(i=0; i<bytes/4; i++)
-+ newcsum+= superc[i];
-+ csum = (newcsum& 0xffffffff) + (newcsum>>32);
-+#ifdef __alpha__
-+/* The in-kernel checksum calculation is always 16bit on
-+ * the alpha, though it is 32 bit on i386...
-+ * I wonder what it is elsewhere... (it uses and API in
-+ * a way that it shouldn't).
-+ */
-+ csum = (csum & 0xffff) + (csum >> 16);
-+ csum = (csum & 0xffff) + (csum >> 16);
-+#endif
-+ return csum;
-+}
-+
-+char *human_size(long long bytes)
-+{
-+ static char buf[30];
-+
-+ /* We convert bytes to either centi-M{ega,ibi}bytes or
-+ * centi-G{igi,ibi}bytes, with appropriate rounding,
-+ * and then print 1/100th of those as a decimal.
-+ * We allow upto 2048Megabytes before converting to
-+ * gigabytes, as that shows more precision and isn't
-+ * too large a number.
-+ * Terrabytes are not yet handled.
-+ */
-+
-+ if (bytes < 5000*1024)
-+ buf[0]=0;
-+ else if (bytes < 2*1024LL*1024LL*1024LL) {
-+ long cMiB = (bytes / ( (1LL<<20) / 200LL ) +1) /2;
-+ long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)",
-+ cMiB/100 , cMiB % 100,
-+ cMB/100, cMB % 100);
-+ } else {
-+ long cGiB = (bytes / ( (1LL<<30) / 200LL ) +1) /2;
-+ long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
-+ snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",
-+ cGiB/100 , cGiB % 100,
-+ cGB/100, cGB % 100);
-+ }
-+ return buf;
-+}
-+
-+char *human_size_brief(long long bytes)
-+{
-+ static char buf[30];
-+
-+
-+ if (bytes < 5000*1024)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldKiB",
-+ (long)(bytes>>10), (long)(((bytes&1023)*100+512)/1024)
-+ );
-+ else if (bytes < 2*1024LL*1024LL*1024LL)
-+ snprintf(buf, sizeof(buf), "%ld.%02ldMiB",
-+ (long)(bytes>>20),
-+ (long)((bytes&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ else
-+ snprintf(buf, sizeof(buf), "%ld.%02ldGiB",
-+ (long)(bytes>>30),
-+ (long)(((bytes>>10)&0xfffff)+0x100000/200)/(0x100000/100)
-+ );
-+ return buf;
-+}
-+
-+int get_mdp_major(void)
-+{
-+static int mdp_major = -1;
-+ FILE *fl;
-+ char *w;
-+ int have_block = 0;
-+ int have_devices = 0;
-+ int last_num = -1;
-+
-+ if (mdp_major != -1)
-+ return mdp_major;
-+ fl = fopen("/proc/devices", "r");
-+ if (!fl)
-+ return -1;
-+ while ((w = conf_word(fl, 1))) {
-+ if (have_block && strcmp(w, "devices:")==0)
-+ have_devices = 1;
-+ have_block = (strcmp(w, "Block")==0);
-+ if (isdigit(w[0]))
-+ last_num = atoi(w);
-+ if (have_devices && strcmp(w, "mdp")==0)
-+ mdp_major = last_num;
-+ free(w);
-+ }
-+ fclose(fl);
-+ return mdp_major;
-+}
-+
-+int dev_open(char *dev, int flags)
-+{
-+ /* like 'open', but if 'dev' matches %d:%d, create a temp
-+ * block device and open that
-+ */
-+ char *e;
-+ int fd = -1;
-+ char devname[32];
-+ int major;
-+ int minor;
-+
-+ if (!dev) return -1;
-+
-+ major = strtoul(dev, &e, 0);
-+ if (e > dev && *e == ':' && e[1] &&
-+ (minor = strtoul(e+1, &e, 0)) >= 0 &&
-+ *e == 0) {
-+ snprintf(devname, sizeof(devname), "/dev/.tmp.md.%d:%d", major, minor);
-+ if (mknod(devname, S_IFBLK|0600, makedev(major, minor))==0) {
-+ fd = open(devname, flags);
-+ unlink(devname);
-+ }
-+ } else
-+ fd = open(dev, flags);
-+ return fd;
-+}
-+
-+struct superswitch *superlist[] = { &super0, &super1, NULL };
-+
-+struct supertype *super_by_version(int vers, int minor)
-+{
-+ struct supertype *st = malloc(sizeof(*st));
-+ if (!st) return st;
-+ if (vers == 0) {
-+ st->ss = &super0;
-+ st->max_devs = MD_SB_DISKS;
-+ }
-+
-+ if (vers == 1) {
-+ st->ss = &super1;
-+ st->max_devs = 384;
-+ }
-+ st->minor_version = minor;
-+ return st;
-+}
-+
-+struct supertype *guess_super(int fd)
-+{
-+ /* try each load_super to find the best match,
-+ * and return the best superswitch
-+ */
-+ struct superswitch *ss;
-+ struct supertype *st;
-+ unsigned long besttime = 0;
-+ int bestsuper = -1;
-+
-+ void *sbp = NULL;
-+ int i;
-+
-+ st = malloc(sizeof(*st));
-+ memset(st, 0, sizeof(*st));
-+ for (i=0 ; superlist[i]; i++) {
-+ int rv;
-+ ss = superlist[i];
-+ st->ss = NULL;
-+ rv = ss->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ struct mdinfo info;
-+ ss->getinfo_super(&info, sbp);
-+ if (bestsuper == -1 ||
-+ besttime < info.array.ctime) {
-+ bestsuper = i;
-+ besttime = info.array.ctime;
-+ }
-+ free(sbp);
-+ }
-+ }
-+ if (bestsuper != -1) {
-+ int rv;
-+ st->ss = NULL;
-+ rv = superlist[bestsuper]->load_super(st, fd, &sbp, NULL);
-+ if (rv == 0) {
-+ free(sbp);
-+ return st;
-+ }
-+ }
-+ free(st);
-+ return NULL;
-+}
-+
-+/* Return size of device in bytes */
-+int get_dev_size(int fd, char *dname, unsigned long long *sizep)
-+{
-+ unsigned long long ldsize;
-+#ifdef BLKGETSIZE64
-+ if (ioctl(fd, BLKGETSIZE64, &ldsize) != 0)
-+#endif
-+ {
-+ unsigned long dsize;
-+ if (ioctl(fd, BLKGETSIZE, &dsize) == 0) {
-+ ldsize = dsize;
-+ ldsize <<= 9;
-+ } else {
-+ if (dname)
-+ fprintf(stderr, Name ": Cannot get size of %s: %s\b",
-+ dname, strerror(errno));
-+ return 0;
-+ }
-+ }
-+ *sizep = ldsize;
-+ return 1;
-+}
---- busybox-1.7.4+gentoo/mdadm/Kbuild 2008-03-01 18:44:05.526713152 -0800
-+++ busybox-1.7.4+gentoo+mdadm/mdadm/Kbuild 2008-03-11 12:19:18.000000000 -0700
-@@ -0,0 +1,9 @@
-+# Makefile for busybox
-+#
-+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
-+#
-+# Licensed under the GPL v2, see the file LICENSE in this tarball.
-+
-+lib-y:=
-+MDADM-y:= config.o util.o dlink.o sha1.o super0.o super1.o mdexamine.o mdassemble.o
-+lib-$(CONFIG_MDADM) += mdadm.o $(MDADM-y)
diff --git a/patches/busybox/1.7.4/README b/patches/busybox/1.7.4/README
index a02e17bc..6061dc75 100644
--- a/patches/busybox/1.7.4/README
+++ b/patches/busybox/1.7.4/README
@@ -2,10 +2,6 @@
This patch adds support for the -t option to the 'read' command in ash. It's
used for prompting for the keymap. It originated with 1.1.3+gentoo or earlier.
-1.7.4-mdadm.diff:
-This adds a minimal mdadm implementation to busybox for scanning for and
-activating mdraid arrays. You can blame robbat2 for this one :)
-
1.7.4-mdstart.diff:
This adds a 'mdstart' command to busybox, which is used for the activation of
individual mdraid arrays. It originated with 1.1.3+gentoo or earlier.