Merge git://oss.sgi.com:8090/xfs/xfs-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:36:55 +0000 (09:36 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:36:55 +0000 (09:36 -0700)
* git://oss.sgi.com:8090/xfs/xfs-2.6: (49 commits)
  [XFS] Remove v1 dir trace macro - missed in a past commit.
  [XFS] 955947: Infinite loop in xfs_bulkstat() on formatter() error
  [XFS] pv 956241, author: nathans, rv: vapo - make ino validation checks
  [XFS] pv 956240, author: nathans, rv: vapo - Minor fixes in
  [XFS] Really fix use after free in xfs_iunpin.
  [XFS] Collapse sv_init and init_sv into just the one interface.
  [XFS] standardize on one sema init macro
  [XFS] Reduce endian flipping in alloc_btree, same as was done for
  [XFS] Minor cleanup from dio locking fix, remove an extra conditional.
  [XFS] Fix kmem_zalloc_greedy warnings on 64 bit platforms.
  [XFS] pv 955157, rv bnaujok - break the loop on EFAULT formatter() error
  [XFS] pv 955157, rv bnaujok - break the loop on formatter() error
  [XFS] Fixes the leak in reservation space because we weren't ungranting
  [XFS] Add lock annotations to xfs_trans_update_ail and
  [XFS] Fix a porting botch on the realtime subvol growfs code path.
  [XFS] Minor code rearranging and cleanup to prevent some coverity false
  [XFS] Remove a no-longer-correct debug assert from dio completion
  [XFS] Add a greedy allocation interface, allocating within a min/max size
  [XFS] Improve error handling for the zero-fsblock extent detection code.
  [XFS] Be more defensive with page flags (error/private) for metadata
  ...

550 files changed:
CREDITS
Documentation/CodingStyle
Documentation/DocBook/kernel-api.tmpl
Documentation/SubmitChecklist
Documentation/SubmittingDrivers
Documentation/SubmittingPatches
Documentation/cpusets.txt
Documentation/filesystems/proc.txt
Documentation/kernel-parameters.txt
Documentation/networking/pktgen.txt
Documentation/seclvl.txt [deleted file]
MAINTAINERS
arch/alpha/kernel/time.c
arch/alpha/mm/fault.c
arch/arm/kernel/time.c
arch/arm/mach-omap1/board-fsample.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mm/fault.c
arch/arm26/kernel/time.c
arch/arm26/mm/fault.c
arch/avr32/kernel/time.c
arch/cris/arch-v10/kernel/time.c
arch/cris/arch-v32/kernel/time.c
arch/frv/kernel/time.c
arch/h8300/kernel/time.c
arch/i386/kernel/apm.c
arch/i386/kernel/efi.c
arch/i386/kernel/smpboot.c
arch/i386/kernel/srat.c
arch/i386/lib/usercopy.c
arch/i386/mm/fault.c
arch/i386/oprofile/op_model_ppro.c
arch/ia64/hp/sim/simeth.c
arch/ia64/kernel/time.c
arch/ia64/mm/fault.c
arch/m32r/kernel/time.c
arch/m32r/mm/fault.c
arch/m68k/kernel/time.c
arch/m68k/mm/fault.c
arch/m68k/sun3/sun3ints.c
arch/m68knommu/kernel/time.c
arch/mips/au1000/common/time.c
arch/mips/gt64120/common/time.c
arch/mips/kernel/time.c
arch/mips/mm/fault.c
arch/mips/momentum/ocelot_g/gt-irq.c
arch/mips/sgi-ip27/ip27-timer.c
arch/parisc/kernel/module.c
arch/parisc/kernel/time.c
arch/powerpc/kernel/time.c
arch/powerpc/mm/fault.c
arch/powerpc/platforms/pseries/ras.c
arch/ppc/kernel/time.c
arch/ppc/kernel/traps.c
arch/ppc/mm/fault.c
arch/s390/appldata/appldata_base.c
arch/s390/kernel/time.c
arch/s390/mm/fault.c
arch/sh/kernel/time.c
arch/sh/mm/fault.c
arch/sh64/kernel/time.c
arch/sh64/mm/fault.c
arch/sparc/kernel/pcic.c
arch/sparc/kernel/time.c
arch/sparc64/kernel/time.c
arch/sparc64/solaris/misc.c
arch/um/drivers/mconsole_kern.c
arch/um/drivers/mconsole_user.c
arch/um/drivers/net_kern.c
arch/um/drivers/net_user.c
arch/um/drivers/null.c
arch/um/drivers/random.c
arch/um/drivers/stderr_console.c
arch/um/drivers/stdio_console.c
arch/um/drivers/ubd_kern.c
arch/um/include/net_kern.h
arch/um/include/net_user.h
arch/um/kernel/exitcode.c
arch/um/kernel/skas/mmu.c
arch/um/kernel/skas/process_kern.c [deleted file]
arch/um/kernel/time.c
arch/um/kernel/trap.c
arch/um/os-Linux/mem.c
arch/v850/kernel/time.c
arch/x86_64/kernel/pci-swiotlb.c
arch/x86_64/kernel/time.c
arch/x86_64/mm/fault.c
arch/xtensa/kernel/time.c
arch/xtensa/mm/fault.c
arch/xtensa/platform-iss/network.c
block/blktrace.c
block/genhd.c
block/ll_rw_blk.c
drivers/base/class.c
drivers/base/firmware_class.c
drivers/block/loop.c
drivers/bluetooth/bfusb.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_usb.c
drivers/bluetooth/hci_vhci.c
drivers/char/Kconfig
drivers/char/Makefile
drivers/char/generic_serial.c
drivers/char/hw_random/intel-rng.c
drivers/char/istallion.c
drivers/char/lp.c
drivers/char/mem.c
drivers/char/pc8736x_gpio.c
drivers/char/raw.c
drivers/char/rtc.c
drivers/char/s3c2410-rtc.c [deleted file]
drivers/char/scx200_gpio.c
drivers/char/selection.c
drivers/char/specialix.c
drivers/char/sysrq.c
drivers/char/tty_io.c
drivers/char/tty_ioctl.c
drivers/char/vc_screen.c
drivers/char/vt.c
drivers/char/vt_ioctl.c
drivers/char/watchdog/Kconfig
drivers/char/watchdog/Makefile
drivers/char/watchdog/omap_wdt.c [new file with mode: 0644]
drivers/char/watchdog/omap_wdt.h [new file with mode: 0644]
drivers/firmware/dmi_scan.c
drivers/i2c/busses/i2c-sibyte.c
drivers/ide/pci/atiixp.c
drivers/infiniband/core/addr.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/Makefile
drivers/input/keyboard/omap-keypad.c [new file with mode: 0644]
drivers/isdn/i4l/isdn_net.c
drivers/leds/leds-net48xx.c
drivers/macintosh/via-pmu-backlight.c
drivers/macintosh/windfarm_smu_sat.c
drivers/mfd/ucb1x00-ts.c
drivers/net/8390.c
drivers/net/Kconfig
drivers/net/appletalk/ipddp.c
drivers/net/bonding/bond_main.c
drivers/net/fec_8xx/fec_main.c
drivers/net/fs_enet/fs_enet.h
drivers/net/irda/Kconfig
drivers/net/irda/nsc-ircc.c
drivers/net/irda/smsc-ircc2.c
drivers/net/irda/stir4200.c
drivers/net/irda/via-ircc.c
drivers/net/loopback.c
drivers/net/pppoe.c
drivers/net/smc91x.h
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/wan/hdlc_cisco.c
drivers/net/wan/syncppp.c
drivers/net/wireless/strip.c
drivers/parport/parport_serial.c
drivers/rtc/Kconfig
drivers/rtc/rtc-rs5c348.c
drivers/s390/net/qeth_main.c
drivers/serial/Kconfig
fs/9p/v9fs.c
fs/Kconfig
fs/Makefile
fs/afs/proc.c
fs/autofs4/root.c
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/binfmt_misc.c
fs/block_dev.c
fs/char_dev.c
fs/cramfs/inode.c
fs/cramfs/uncompress.c
fs/dquot.c
fs/exec.c
fs/fat/file.c
fs/fat/inode.c
fs/file.c
fs/filesystems.c
fs/freevxfs/vxfs_super.c
fs/fuse/dev.c
fs/fuse/dir.c
fs/fuse/inode.c
fs/generic_acl.c [new file with mode: 0644]
fs/hugetlbfs/inode.c
fs/inode.c
fs/isofs/inode.c
fs/jbd/journal.c
fs/jbd/recovery.c
fs/libfs.c
fs/mbcache.c
fs/msdos/namei.c
fs/namei.c
fs/namespace.c
fs/open.c
fs/partitions/msdos.c
fs/proc/array.c
fs/proc/base.c
fs/proc/kcore.c
fs/reiserfs/Makefile
fs/reiserfs/file.c
fs/reiserfs/inode.c
fs/reiserfs/journal.c
fs/reiserfs/super.c
fs/select.c
fs/super.c
fs/udf/super.c
include/asm-arm/arch-clps711x/time.h
include/asm-arm/arch-l7200/time.h
include/asm-arm/arch-omap/keypad.h
include/asm-generic/bug.h
include/asm-i386/dma-mapping.h
include/asm-i386/mach-default/do_timer.h
include/asm-i386/mach-summit/mach_apic.h
include/asm-i386/mach-visws/do_timer.h
include/asm-i386/mach-voyager/do_timer.h
include/asm-i386/smp.h
include/asm-powerpc/bug.h
include/asm-s390/irq.h
include/asm-s390/pgtable.h
include/asm-um/pgtable.h
include/asm-x86_64/dma-mapping.h
include/linux/Kbuild
include/linux/atalk.h
include/linux/audit.h
include/linux/blkdev.h
include/linux/compiler.h
include/linux/cpuset.h
include/linux/cramfs_fs.h
include/linux/dma-mapping.h
include/linux/dmi.h
include/linux/errqueue.h
include/linux/file.h
include/linux/fs.h
include/linux/generic_acl.h [new file with mode: 0644]
include/linux/hrtimer.h
include/linux/icmp.h
include/linux/if.h
include/linux/if_arp.h
include/linux/if_link.h [new file with mode: 0644]
include/linux/igmp.h
include/linux/in.h
include/linux/in6.h
include/linux/inet_diag.h
include/linux/inetdevice.h
include/linux/interrupt.h
include/linux/ip.h
include/linux/ipv6.h
include/linux/jbd.h
include/linux/leds.h
include/linux/list.h
include/linux/lockdep.h
include/linux/loop.h
include/linux/module.h
include/linux/mroute.h
include/linux/msdos_fs.h
include/linux/namei.h
include/linux/netdevice.h
include/linux/netfilter_arp/arp_tables.h
include/linux/netfilter_ipv4/ip_conntrack.h
include/linux/netfilter_ipv4/ip_conntrack_h323.h
include/linux/netfilter_ipv4/ip_conntrack_tuple.h
include/linux/netfilter_ipv4/ip_nat.h
include/linux/netfilter_ipv4/ip_queue.h
include/linux/netfilter_ipv4/ipt_iprange.h
include/linux/nmi.h
include/linux/page-flags.h
include/linux/pci_ids.h
include/linux/percpu.h
include/linux/posix-timers.h
include/linux/ptrace.h
include/linux/reiserfs_acl.h
include/linux/reiserfs_fs_i.h
include/linux/reiserfs_xattr.h
include/linux/rtnetlink.h
include/linux/sched.h
include/linux/scx200_gpio.h
include/linux/security.h
include/linux/shmem_fs.h
include/linux/spinlock.h
include/linux/spinlock_api_smp.h
include/linux/sunrpc/auth.h
include/linux/sunrpc/msg_prot.h
include/linux/sunrpc/svc.h
include/linux/sunrpc/svcauth.h
include/linux/sunrpc/xdr.h
include/linux/sunrpc/xprt.h
include/linux/syscalls.h
include/linux/tcp.h
include/linux/trdevice.h
include/linux/tty.h
include/linux/udp.h
include/linux/vmstat.h
include/linux/vt_kern.h
include/linux/writeback.h
include/linux/xfrm.h
include/net/arp.h
include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
include/net/cipso_ipv4.h
include/net/dst.h
include/net/flow.h
include/net/icmp.h
include/net/inet_connection_sock.h
include/net/inet_hashtables.h
include/net/inet_sock.h
include/net/inet_timewait_sock.h
include/net/inetpeer.h
include/net/ip.h
include/net/ip_fib.h
include/net/ip_mp_alg.h
include/net/ip_vs.h
include/net/ipv6.h
include/net/irda/irlan_common.h
include/net/irda/irlap_frame.h
include/net/irda/irlmp.h
include/net/netlabel.h
include/net/netlink.h
include/net/route.h
include/net/xfrm.h
kernel/acct.c
kernel/auditsc.c
kernel/capability.c
kernel/compat.c
kernel/cpuset.c
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/hrtimer.c
kernel/irq/chip.c
kernel/kexec.c
kernel/kfifo.c
kernel/kmod.c
kernel/lockdep.c
kernel/module.c
kernel/params.c
kernel/posix-cpu-timers.c
kernel/posix-timers.c
kernel/ptrace.c
kernel/rcutorture.c
kernel/relay.c
kernel/rtmutex.c
kernel/sched.c
kernel/signal.c
kernel/softirq.c
kernel/softlockup.c
kernel/spinlock.c
kernel/stop_machine.c
kernel/sys.c
kernel/sysctl.c
kernel/timer.c
kernel/unwind.c
lib/Kconfig.debug
lib/Makefile
lib/list_debug.c [new file with mode: 0644]
lib/rwsem.c
lib/spinlock_debug.c
lib/ts_fsm.c
mm/Makefile
mm/filemap.c
mm/memory.c
mm/memory_hotplug.c
mm/oom_kill.c
mm/page-writeback.c
mm/shmem.c
mm/shmem_acl.c [new file with mode: 0644]
mm/slab.c
mm/swapfile.c
net/802/tr.c
net/Kconfig
net/appletalk/ddp.c
net/atm/mpc.c
net/atm/mpoa_caches.c
net/bluetooth/af_bluetooth.c
net/bluetooth/bnep/core.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c
net/bluetooth/hci_sysfs.c
net/bluetooth/hidp/core.c
net/bluetooth/rfcomm/core.c
net/bluetooth/rfcomm/tty.c
net/bridge/netfilter/ebt_arpreply.c
net/core/dev.c
net/core/ethtool.c
net/core/neighbour.c
net/core/pktgen.c
net/core/rtnetlink.c
net/core/utils.c
net/dccp/ipv4.c
net/ethernet/eth.c
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/cipso_ipv4.c
net/ipv4/datagram.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/fib_hash.c
net/ipv4/fib_lookup.h
net/ipv4/fib_rules.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/inet_connection_sock.c
net/ipv4/inet_diag.c
net/ipv4/inet_hashtables.c
net/ipv4/inetpeer.c
net/ipv4/ip_fragment.c
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/ip_sockglue.c
net/ipv4/ipcomp.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_conn.c
net/ipv4/ipvs/ip_vs_core.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_dh.c
net/ipv4/ipvs/ip_vs_ftp.c
net/ipv4/ipvs/ip_vs_lblc.c
net/ipv4/ipvs/ip_vs_lblcr.c
net/ipv4/ipvs/ip_vs_proto.c
net/ipv4/ipvs/ip_vs_proto_tcp.c
net/ipv4/ipvs/ip_vs_proto_udp.c
net/ipv4/ipvs/ip_vs_sh.c
net/ipv4/ipvs/ip_vs_sync.c
net/ipv4/ipvs/ip_vs_xmit.c
net/ipv4/multipath_wrandom.c
net/ipv4/netfilter.c
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_conntrack_amanda.c
net/ipv4/netfilter/ip_conntrack_core.c
net/ipv4/netfilter/ip_conntrack_ftp.c
net/ipv4/netfilter/ip_conntrack_helper_h323.c
net/ipv4/netfilter/ip_conntrack_helper_pptp.c
net/ipv4/netfilter/ip_conntrack_irc.c
net/ipv4/netfilter/ip_conntrack_netbios_ns.c
net/ipv4/netfilter/ip_conntrack_netlink.c
net/ipv4/netfilter/ip_conntrack_proto_icmp.c
net/ipv4/netfilter/ip_conntrack_proto_sctp.c
net/ipv4/netfilter/ip_conntrack_proto_tcp.c
net/ipv4/netfilter/ip_conntrack_sip.c
net/ipv4/netfilter/ip_conntrack_tftp.c
net/ipv4/netfilter/ip_nat_core.c
net/ipv4/netfilter/ip_nat_ftp.c
net/ipv4/netfilter/ip_nat_helper.c
net/ipv4/netfilter/ip_nat_helper_h323.c
net/ipv4/netfilter/ip_nat_helper_pptp.c
net/ipv4/netfilter/ip_nat_proto_icmp.c
net/ipv4/netfilter/ip_nat_proto_tcp.c
net/ipv4/netfilter/ip_nat_proto_udp.c
net/ipv4/netfilter/ip_nat_rule.c
net/ipv4/netfilter/ip_nat_sip.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/netfilter/ip_nat_standalone.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/ipt_ECN.c
net/ipv4/netfilter/ipt_MASQUERADE.c
net/ipv4/netfilter/ipt_NETMAP.c
net/ipv4/netfilter/ipt_REDIRECT.c
net/ipv4/netfilter/ipt_REJECT.c
net/ipv4/netfilter/ipt_SAME.c
net/ipv4/netfilter/ipt_TCPMSS.c
net/ipv4/netfilter/ipt_TOS.c
net/ipv4/netfilter/ipt_TTL.c
net/ipv4/netfilter/ipt_addrtype.c
net/ipv4/netfilter/ipt_hashlimit.c
net/ipv4/netfilter/ipt_recent.c
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_lp.c
net/ipv4/tcp_output.c
net/ipv4/udp.c
net/ipv4/xfrm4_input.c
net/ipv4/xfrm4_policy.c
net/ipv4/xfrm4_state.c
net/ipv6/addrconf.c
net/ipv6/af_inet6.c
net/ipv6/inet6_hashtables.c
net/ipv6/ipcomp6.c
net/ipv6/ipv6_sockglue.c
net/ipv6/tcp_ipv6.c
net/ipv6/xfrm6_input.c
net/ipv6/xfrm6_state.c
net/ipv6/xfrm6_tunnel.c
net/irda/af_irda.c
net/irda/ircomm/ircomm_lmp.c
net/irda/iriap.c
net/irda/iriap_event.c
net/irda/irlan/irlan_common.c
net/irda/irlan/irlan_provider.c
net/irda/irlap_frame.c
net/irda/irlmp.c
net/irda/irttp.c
net/key/af_key.c
net/netlabel/netlabel_cipso_v4.c
net/netlabel/netlabel_domainhash.c
net/netlabel/netlabel_domainhash.h
net/netlabel/netlabel_mgmt.c
net/netlabel/netlabel_unlabeled.c
net/netlabel/netlabel_user.c
net/netlabel/netlabel_user.h
net/sched/cls_api.c
net/sched/cls_basic.c
net/sched/sch_api.c
net/sched/sch_generic.c
net/sched/sch_htb.c
net/sunrpc/auth.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_seal.c
net/sunrpc/auth_gss/gss_krb5_wrap.c
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/auth_null.c
net/sunrpc/auth_unix.c
net/sunrpc/clnt.c
net/sunrpc/pmap_clnt.c
net/sunrpc/svc.c
net/sunrpc/svcauth.c
net/sunrpc/svcauth_unix.c
net/sunrpc/svcsock.c
net/sunrpc/xdr.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c
net/xfrm/xfrm_hash.h
net/xfrm/xfrm_input.c
net/xfrm/xfrm_state.c
scripts/basic/docproc.c
security/Kconfig
security/Makefile
security/commoncap.c
security/seclvl.c [deleted file]
security/selinux/hooks.c
sound/Makefile
sound/mips/au1x00.c
sound/oss/COPYING [deleted file]
sound/oss/cs46xx.c
sound/oss/cs46xxpm-24.h [deleted file]
sound/oss/trident.c
sound/sound_core.c
sound/sound_firmware.c
sound/sparc/dbri.c

diff --git a/CREDITS b/CREDITS
index cc3453a55fb948f5173ff82715c304d18dc1212d..66e82466dde8af73c814354d8e4df82398e78e5c 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1620,7 +1620,8 @@ D: fbdev hacking
 
 N: Jesper Juhl
 E: jesper.juhl@gmail.com
-D: Various fixes, cleanups and minor features.
+D: Various fixes, cleanups and minor features all over the tree.
+D: Wrote initial version of the hdaps driver (since passed on to others).
 S: Lemnosvej 1, 3.tv
 S: 2300 Copenhagen S.
 S: Denmark
@@ -2477,7 +2478,8 @@ S: Derbyshire DE4 3RL
 S: United Kingdom
 
 N: Ian S. Nelson
-E: ian.nelson@echostar.com
+E: nelsonis@earthlink.net
+P: 1024D/00D3D983 3EFD 7B86 B888 D7E2 29B6  9E97 576F 1B97 00D3 D983
 D: Minor mmap and ide hacks
 S: 1370 Atlantis Ave.
 S: Lafayette CO, 80026
index 6d2412ec91edb21ebab0c13e581951bbe352b610..29c18966b0502c3489e1058bd361db50a6c07686 100644 (file)
@@ -532,6 +532,40 @@ appears outweighs the potential value of the hint that tells gcc to do
 something it would have done anyway.
 
 
+               Chapter 16: Function return values and names
+
+Functions can return values of many different kinds, and one of the
+most common is a value indicating whether the function succeeded or
+failed.  Such a value can be represented as an error-code integer
+(-Exxx = failure, 0 = success) or a "succeeded" boolean (0 = failure,
+non-zero = success).
+
+Mixing up these two sorts of representations is a fertile source of
+difficult-to-find bugs.  If the C language included a strong distinction
+between integers and booleans then the compiler would find these mistakes
+for us... but it doesn't.  To help prevent such bugs, always follow this
+convention:
+
+       If the name of a function is an action or an imperative command,
+       the function should return an error-code integer.  If the name
+       is a predicate, the function should return a "succeeded" boolean.
+
+For example, "add work" is a command, and the add_work() function returns 0
+for success or -EBUSY for failure.  In the same way, "PCI device present" is
+a predicate, and the pci_dev_present() function returns 1 if it succeeds in
+finding a matching device or 0 if it doesn't.
+
+All EXPORTed functions must respect this convention, and so should all
+public functions.  Private (static) functions need not, but it is
+recommended that they do.
+
+Functions whose return value is the actual result of a computation, rather
+than an indication of whether the computation succeeded, are not subject to
+this rule.  Generally they indicate failure by returning some out-of-range
+result.  Typical examples would be functions that return pointers; they use
+NULL or the ERR_PTR mechanism to report failure.
+
+
 
                Appendix I: References
 
index f8fe882e33dccfc50f6e5add6ca89a53389d649f..6d4b1ef5b6f11a24a1705e1c0e73b17220feb35c 100644 (file)
@@ -181,27 +181,6 @@ X!Ilib/string.c
      </sect1>
   </chapter>
 
-  <chapter id="proc">
-     <title>The proc filesystem</title>
-     <sect1><title>sysctl interface</title>
-!Ekernel/sysctl.c
-     </sect1>
-
-     <sect1><title>proc filesystem interface</title>
-!Ifs/proc/base.c
-     </sect1>
-  </chapter>
-
-  <chapter id="debugfs">
-     <title>The debugfs filesystem</title>
-     <sect1><title>debugfs interface</title>
-!Efs/debugfs/inode.c
-!Efs/debugfs/file.c
-     </sect1>
-  </chapter>
-
   <chapter id="vfs">
      <title>The Linux VFS</title>
      <sect1><title>The Filesystem types</title>
@@ -234,6 +213,50 @@ X!Ilib/string.c
      </sect1>
   </chapter>
 
+  <chapter id="proc">
+     <title>The proc filesystem</title>
+     <sect1><title>sysctl interface</title>
+!Ekernel/sysctl.c
+     </sect1>
+
+     <sect1><title>proc filesystem interface</title>
+!Ifs/proc/base.c
+     </sect1>
+  </chapter>
+
+  <chapter id="sysfs">
+     <title>The Filesystem for Exporting Kernel Objects</title>
+!Efs/sysfs/file.c
+!Efs/sysfs/symlink.c
+!Efs/sysfs/bin.c
+  </chapter>
+
+  <chapter id="debugfs">
+     <title>The debugfs filesystem</title>
+     <sect1><title>debugfs interface</title>
+!Efs/debugfs/inode.c
+!Efs/debugfs/file.c
+     </sect1>
+  </chapter>
+
+  <chapter id="relayfs">
+     <title>relay interface support</title>
+
+     <para>
+       Relay interface support
+       is designed to provide an efficient mechanism for tools and
+       facilities to relay large amounts of data from kernel space to
+       user space.
+     </para>
+
+     <sect1><title>relay interface</title>
+!Ekernel/relay.c
+!Ikernel/relay.c
+     </sect1>
+  </chapter>
+
   <chapter id="netcore">
      <title>Linux Networking</title>
      <sect1><title>Networking Base Types</title>
@@ -349,13 +372,6 @@ X!Earch/i386/kernel/mca.c
      </sect1>
   </chapter>
 
-  <chapter id="sysfs">
-     <title>The Filesystem for Exporting Kernel Objects</title>
-!Efs/sysfs/file.c
-!Efs/sysfs/symlink.c
-!Efs/sysfs/bin.c
-  </chapter>
-
   <chapter id="security">
      <title>Security Framework</title>
 !Esecurity/security.c
@@ -386,6 +402,7 @@ X!Iinclude/linux/device.h
 -->
 !Edrivers/base/driver.c
 !Edrivers/base/core.c
+!Edrivers/base/class.c
 !Edrivers/base/firmware_class.c
 !Edrivers/base/transport_class.c
 !Edrivers/base/dmapool.c
@@ -437,6 +454,11 @@ X!Edrivers/pnp/system.c
 !Eblock/ll_rw_blk.c
   </chapter>
 
+  <chapter id="chrdev">
+       <title>Char devices</title>
+!Efs/char_dev.c
+  </chapter>
+
   <chapter id="miscdev">
      <title>Miscellaneous Devices</title>
 !Edrivers/char/misc.c
index a10bfb6ecd9fa4e55c9beecd2e588c9a0359ec71..a6cb6ffd293377bef9a19cd077299626fcb5bf47 100644 (file)
@@ -61,3 +61,6 @@ kernel patches.
     Documentation/kernel-parameters.txt.
 
 18: All new module parameters are documented with MODULE_PARM_DESC()
+
+19: All new userspace interfaces are documented in Documentation/ABI/.
+    See Documentation/ABI/README for more information.
index 6bd30fdd0786b9a7c64aa4c34f5a732b4c7096e0..58bead05eabb057fb777bdd5fe7a56b44f35b0e0 100644 (file)
@@ -59,11 +59,11 @@ Copyright:  The copyright owner must agree to use of GPL.
                are the same person/entity. If not, the name of
                the person/entity authorizing use of GPL should be
                listed in case it's necessary to verify the will of
-               the copright owner.
+               the copyright owner.
 
 Interfaces:    If your driver uses existing interfaces and behaves like
                other drivers in the same class it will be much more likely
-               to be accepted than if it invents gratuitous new ones. 
+               to be accepted than if it invents gratuitous new ones.
                If you need to implement a common API over Linux and NT
                drivers do it in userspace.
 
@@ -88,7 +88,7 @@ Clarity:      It helps if anyone can see how to fix the driver. It helps
                it will go in the bitbucket.
 
 Control:       In general if there is active maintainance of a driver by
-               the author then patches will be redirected to them unless 
+               the author then patches will be redirected to them unless
                they are totally obvious and without need of checking.
                If you want to be the contact and update point for the
                driver it is a good idea to state this in the comments,
@@ -100,7 +100,7 @@ What Criteria Do Not Determine Acceptance
 Vendor:                Being the hardware vendor and maintaining the driver is
                often a good thing. If there is a stable working driver from
                other people already in the tree don't expect 'we are the
-               vendor' to get your driver chosen. Ideally work with the 
+               vendor' to get your driver chosen. Ideally work with the
                existing driver author to build a single perfect driver.
 
 Author:                It doesn't matter if a large Linux company wrote the driver,
@@ -116,17 +116,13 @@ Linux kernel master tree:
        ftp.??.kernel.org:/pub/linux/kernel/...
        ?? == your country code, such as "us", "uk", "fr", etc.
 
-Linux kernel mailing list:             
+Linux kernel mailing list:
        linux-kernel@vger.kernel.org
        [mail majordomo@vger.kernel.org to subscribe]
 
 Linux Device Drivers, Third Edition (covers 2.6.10):
        http://lwn.net/Kernel/LDD3/  (free version)
 
-Kernel traffic:
-       Weekly summary of kernel list activity (much easier to read)
-       http://www.kerneltraffic.org/kernel-traffic/
-
 LWN.net:
        Weekly summary of kernel development activity - http://lwn.net/
        2.6 API changes:
@@ -145,11 +141,8 @@ KernelNewbies:
 Linux USB project:
        http://www.linux-usb.org/
 
-How to NOT write kernel driver by arjanv@redhat.com
-       http://people.redhat.com/arjanv/olspaper.pdf
+How to NOT write kernel driver by Arjan van de Ven:
+       http://www.fenrus.org/how-to-not-write-a-device-driver-paper.pdf
 
 Kernel Janitor:
        http://janitor.kernelnewbies.org/
-
---
-Last updated on 17 Nov 2005.
index d42ab4c9e893b787d0918cc9f5a540a785a11aee..302d148c2e18f0e0fe565bc9c9c1a2f4b232d346 100644 (file)
@@ -173,15 +173,15 @@ For small patches you may want to CC the Trivial Patch Monkey
 trivial@kernel.org managed by Adrian Bunk; which collects "trivial"
 patches. Trivial patches must qualify for one of the following rules:
  Spelling fixes in documentation
- Spelling fixes which could break grep(1).
+ Spelling fixes which could break grep(1)
  Warning fixes (cluttering with useless warnings is bad)
  Compilation fixes (only if they are actually correct)
  Runtime fixes (only if they actually fix things)
- Removing use of deprecated functions/macros (eg. check_region).
+ Removing use of deprecated functions/macros (eg. check_region)
  Contact detail and documentation fixes
  Non-portable code replaced by portable code (even in arch-specific,
  since people copy, as long as it's trivial)
- Any fix by the author/maintainer of the file. (ie. patch monkey
+ Any fix by the author/maintainer of the file (ie. patch monkey
  in re-transmission mode)
 URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/>
 
@@ -209,6 +209,19 @@ Exception:  If your mailer is mangling patches then someone may ask
 you to re-send them using MIME.
 
 
+WARNING: Some mailers like Mozilla send your messages with
+---- message header ----
+Content-Type: text/plain; charset=us-ascii; format=flowed
+---- message header ----
+The problem is that "format=flowed" makes some of the mailers
+on receiving side to replace TABs with spaces and do similar
+changes. Thus the patches from you can look corrupted.
+
+To fix this just make your mozilla defaults/pref/mailnews.js file to look like:
+pref("mailnews.send_plaintext_flowed", false); // RFC 2646=======
+pref("mailnews.display.disable_format_flowed_support", true);
+
+
 
 7) E-mail size.
 
@@ -245,13 +258,13 @@ updated change.
 It is quite common for Linus to "drop" your patch without comment.
 That's the nature of the system.  If he drops your patch, it could be
 due to
-* Your patch did not apply cleanly to the latest kernel version
+* Your patch did not apply cleanly to the latest kernel version.
 * Your patch was not sufficiently discussed on linux-kernel.
-* A style issue (see section 2),
-* An e-mail formatting issue (re-read this section)
-* A technical problem with your change
-* He gets tons of e-mail, and yours got lost in the shuffle
-* You are being annoying (See Figure 1)
+* A style issue (see section 2).
+* An e-mail formatting issue (re-read this section).
+* A technical problem with your change.
+* He gets tons of e-mail, and yours got lost in the shuffle.
+* You are being annoying.
 
 When in doubt, solicit comments on linux-kernel mailing list.
 
@@ -476,10 +489,10 @@ SECTION 3 - REFERENCES
 Andrew Morton, "The perfect patch" (tpp).
   <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt>
 
-Jeff Garzik, "Linux kernel patch submission format."
+Jeff Garzik, "Linux kernel patch submission format".
   <http://linux.yyz.us/patch-format.html>
 
-Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer".
+Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
   <http://www.kroah.com/log/2005/03/31/>
   <http://www.kroah.com/log/2005/07/08/>
   <http://www.kroah.com/log/2005/10/19/>
@@ -488,9 +501,9 @@ Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer".
 NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
   <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>
 
-Kernel Documentation/CodingStyle
+Kernel Documentation/CodingStyle:
   <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle>
 
-Linus Torvald's mail on the canonical patch format:
+Linus Torvalds's mail on the canonical patch format:
   <http://lkml.org/lkml/2005/4/7/183>
 --
index 76b44290c1546c50a4e15527c18a19e626249f35..842f0d1ab2165781420fdd53b3875a16ba91adb6 100644 (file)
@@ -217,11 +217,11 @@ exclusive cpuset.  Also, the use of a Linux virtual file system (vfs)
 to represent the cpuset hierarchy provides for a familiar permission
 and name space for cpusets, with a minimum of additional kernel code.
 
-The cpus file in the root (top_cpuset) cpuset is read-only.
-It automatically tracks the value of cpu_online_map, using a CPU
-hotplug notifier.  If and when memory nodes can be hotplugged,
-we expect to make the mems file in the root cpuset read-only
-as well, and have it track the value of node_online_map.
+The cpus and mems files in the root (top_cpuset) cpuset are
+read-only.  The cpus file automatically tracks the value of
+cpu_online_map using a CPU hotplug notifier, and the mems file
+automatically tracks the value of node_online_map using the
+cpuset_track_online_nodes() hook.
 
 
 1.4 What are exclusive cpusets ?
index 7db71d6fba824bc92f08785578d7dc8fefb4c5aa..7240ee7515decf7b8d5205a18e43b891ddba2f9a 100644 (file)
@@ -39,6 +39,8 @@ Table of Contents
   2.9  Appletalk
   2.10 IPX
   2.11 /proc/sys/fs/mqueue - POSIX message queues filesystem
+  2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score
+  2.13 /proc/<pid>/oom_score - Display current oom-killer score
 
 ------------------------------------------------------------------------------
 Preface
@@ -1962,6 +1964,22 @@ a queue must be less or equal then msg_max.
 maximum  message size value (it is every  message queue's attribute set during
 its creation).
 
+2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score
+------------------------------------------------------
+
+This file can be used to adjust the score used to select which processes
+should be killed in an  out-of-memory  situation.  Giving it a high score will
+increase the likelihood of this process being killed by the oom-killer.  Valid
+values are in the range -16 to +15, plus the special value -17, which disables
+oom-killing altogether for this process.
+
+2.13 /proc/<pid>/oom_score - Display current oom-killer score
+-------------------------------------------------------------
+
+------------------------------------------------------------------------------
+This file can be used to check the current score used by the oom-killer is for
+any given <pid>. Use it together with /proc/<pid>/oom_adj to tune which
+process should be killed in an out-of-memory situation.
 
 ------------------------------------------------------------------------------
 Summary
index 54983246930d1aeb922c3691ac0b5a96028d97ef..137e993f4329aa9c6cc83a7835dcc9380312dbd6 100644 (file)
@@ -110,6 +110,13 @@ be entered as an environment variable, whereas its absence indicates that
 it will appear as a kernel argument readable via /proc/cmdline by programs
 running once the system is up.
 
+The number of kernel parameters is not limited, but the length of the
+complete command line (parameters including spaces etc.) is limited to
+a fixed number of characters. This limit depends on the architecture
+and is between 256 and 4096 characters. It is defined in the file
+./include/asm/setup.h as COMMAND_LINE_SIZE.
+
+
        53c7xx=         [HW,SCSI] Amiga SCSI controllers
                        See header of drivers/scsi/53c7xx.c.
                        See also Documentation/scsi/ncr53c7xx.txt.
@@ -1324,7 +1331,7 @@ running once the system is up.
        pt.             [PARIDE]
                        See Documentation/paride.txt.
 
-       quiet=          [KNL] Disable log messages
+       quiet           [KNL] Disable most log messages
 
        r128=           [HW,DRM]
 
index 44f2f769e8659dd2565c82a9ece8771150091a5f..18d385c068fc85b8a87deaef82caadd27e4204e6 100644 (file)
@@ -100,6 +100,7 @@ Examples:
                          are: IPSRC_RND #IP Source is random (between min/max),
                               IPDST_RND, UDPSRC_RND,
                               UDPDST_RND, MACSRC_RND, MACDST_RND 
+                              MPLS_RND, VID_RND, SVID_RND
 
  pgset "udp_src_min 9"   set UDP source port min, If < udp_src_max, then
                          cycle through the port range.
@@ -125,6 +126,21 @@ Examples:
 
  pgset "mpls 0"                  turn off mpls (or any invalid argument works too!)
 
+ pgset "vlan_id 77"       set VLAN ID 0-4095
+ pgset "vlan_p 3"         set priority bit 0-7 (default 0)
+ pgset "vlan_cfi 0"       set canonical format identifier 0-1 (default 0)
+
+ pgset "svlan_id 22"      set SVLAN ID 0-4095
+ pgset "svlan_p 3"        set priority bit 0-7 (default 0)
+ pgset "svlan_cfi 0"      set canonical format identifier 0-1 (default 0)
+
+ pgset "vlan_id 9999"     > 4095 remove vlan and svlan tags
+ pgset "svlan 9999"       > 4095 remove svlan tag
+
+
+ pgset "tos XX"           set former IPv4 TOS field (e.g. "tos 28" for AF11 no ECN, default 00)
+ pgset "traffic_class XX" set former IPv6 TRAFFIC CLASS (e.g. "traffic_class B8" for EF no ECN, default 00)
+
  pgset stop                      aborts injection. Also, ^C aborts generator.
 
 
diff --git a/Documentation/seclvl.txt b/Documentation/seclvl.txt
deleted file mode 100644 (file)
index 97274d1..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-BSD Secure Levels Linux Security Module
-Michael A. Halcrow <mike@halcrow.us>
-
-
-Introduction
-
-Under the BSD Secure Levels security model, sets of policies are
-associated with levels. Levels range from -1 to 2, with -1 being the
-weakest and 2 being the strongest. These security policies are
-enforced at the kernel level, so not even the superuser is able to
-disable or circumvent them. This hardens the machine against attackers
-who gain root access to the system.
-
-
-Levels and Policies
-
-Level -1 (Permanently Insecure):
- - Cannot increase the secure level
-
-Level 0 (Insecure):
- - Cannot ptrace the init process
-
-Level 1 (Default):
- - /dev/mem and /dev/kmem are read-only
- - IMMUTABLE and APPEND extended attributes, if set, may not be unset
- - Cannot load or unload kernel modules
- - Cannot write directly to a mounted block device
- - Cannot perform raw I/O operations
- - Cannot perform network administrative tasks
- - Cannot setuid any file
-
-Level 2 (Secure):
- - Cannot decrement the system time
- - Cannot write to any block device, whether mounted or not
- - Cannot unmount any mounted filesystems
-
-
-Compilation
-
-To compile the BSD Secure Levels LSM, seclvl.ko, enable the
-SECURITY_SECLVL configuration option.  This is found under Security
-options -> BSD Secure Levels in the kernel configuration menu.
-
-
-Basic Usage
-
-Once the machine is in a running state, with all the necessary modules
-loaded and all the filesystems mounted, you can load the seclvl.ko
-module:
-
-# insmod seclvl.ko
-
-The module defaults to secure level 1, except when compiled directly
-into the kernel, in which case it defaults to secure level 0. To raise
-the secure level to 2, the administrator writes ``2'' to the
-seclvl/seclvl file under the sysfs mount point (assumed to be /sys in
-these examples):
-
-# echo -n "2" > /sys/seclvl/seclvl
-
-Alternatively, you can initialize the module at secure level 2 with
-the initlvl module parameter:
-
-# insmod seclvl.ko initlvl=2
-
-At this point, it is impossible to remove the module or reduce the
-secure level.  If the administrator wishes to have the option of doing
-so, he must provide a module parameter, sha1_passwd, that specifies
-the SHA1 hash of the password that can be used to reduce the secure
-level to 0.
-
-To generate this SHA1 hash, the administrator can use OpenSSL:
-
-# echo -n "boogabooga" | openssl sha1
-abeda4e0f33defa51741217592bf595efb8d289c
-
-In order to use password-instigated secure level reduction, the SHA1
-crypto module must be loaded or compiled into the kernel:
-
-# insmod sha1.ko
-
-The administrator can then insmod the seclvl module, including the
-SHA1 hash of the password:
-
-# insmod seclvl.ko
-         sha1_passwd=abeda4e0f33defa51741217592bf595efb8d289c
-
-To reduce the secure level, write the password to seclvl/passwd under
-your sysfs mount point:
-
-# echo -n "boogabooga" > /sys/seclvl/passwd
-
-The September 2004 edition of Sys Admin Magazine has an article about
-the BSD Secure Levels LSM.  I encourage you to refer to that article
-for a more in-depth treatment of this security module:
-
-http://www.samag.com/documents/s=9304/sam0409a/0409a.htm
index 332b220f8a23462b3c8930098a53c1354b7dec63..2c752d18e24b677f865a1a9d5a81f7aa38972045 100644 (file)
@@ -851,7 +851,7 @@ P:  Doug Warzecha
 M:     Douglas_Warzecha@dell.com
 S:     Maintained
 
-DEVICE-MAPPER
+DEVICE-MAPPER  (LVM)
 P:     Alasdair Kergon
 L:     dm-devel@redhat.com
 W:     http://sources.redhat.com/dm
@@ -2062,7 +2062,7 @@ L:        linux-hams@vger.kernel.org
 W:     http://www.linux-ax25.org/
 S:     Maintained
 
-NETWORK BLOCK DEVICE
+NETWORK BLOCK DEVICE (NBD)
 P:     Paul Clements
 M:     Paul.Clements@steeleye.com
 S:     Maintained
@@ -2810,6 +2810,12 @@ M:       R.E.Wolff@BitWizard.nl
 L:     linux-kernel@vger.kernel.org ?
 S:     Supported
 
+SPIDERNET NETWORK DRIVER for CELL
+P:     Jim Lewis
+M:     jim@jklewis.com
+L:     netdev@vger.kernel.org
+S:     Supported
+
 SRM (Alpha) environment access
 P:     Jan-Benedict Glaw
 M:     jbglaw@lug-owl.de
@@ -2834,12 +2840,9 @@ S:       Maintained
 SUPERH (sh)
 P:     Paul Mundt
 M:     lethal@linux-sh.org
-P:     Kazumoto Kojima
-M:     kkojima@rr.iij4u.or.jp
-L:     linuxsh-dev@lists.sourceforge.net
+L:     linuxsh-dev@lists.sourceforge.net (subscribers-only)
 W:     http://www.linux-sh.org
 W:     http://www.m17n.org/linux-sh/
-W:     http://www.rr.iij4u.or.jp/~kkojima/linux-sh4.html
 S:     Maintained
 
 SUPERH64 (sh64)
index b191cc75973751d5bdfe6137596a051a1c821b13..7c1e44420a78ce8ffa5e63ac6ec1930e2d0c80f9 100644 (file)
@@ -132,7 +132,7 @@ irqreturn_t timer_interrupt(int irq, void *dev, struct pt_regs * regs)
        nticks = delta >> FIX_SHIFT;
 
        while (nticks > 0) {
-               do_timer(regs);
+               do_timer(1);
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
index 622dabd846800b14fb13c623eff5c61da0ac9cf7..8871529a34e2026e4f2bd4eda531df7ec59808a4 100644 (file)
@@ -193,7 +193,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
        /* We ran out of memory, or some other thing happened to us that
           made us unable to handle the page fault gracefully.  */
  out_of_memory:
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index d4dceb5f06e94181b0300fbd3a1375f6a573194d..f7d5165796ef2e337ea6a8473c4db562535efb1c 100644 (file)
@@ -337,7 +337,7 @@ void timer_tick(struct pt_regs *regs)
        profile_tick(CPU_PROFILING, regs);
        do_leds();
        do_set_rtc();
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index c753a3c5aadd4f09d9e0e7e0cbde7de606410a0d..62e42c7a628e55ac1f86616064667ea2e0188534 100644 (file)
@@ -172,9 +172,11 @@ static struct resource kp_resources[] = {
 };
 
 static struct omap_kp_platform_data kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = fsample_keymap,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = fsample_keymap,
+       .keymapsize     = ARRAY_SIZE(fsample_keymap),
+       .delay          = 4,
 };
 
 static struct platform_device kp_device = {
index cd3a06dfc0a83d2e5f0d280c4ace0f49cef988c3..6e113078f7ab4fa3415f42d68901e3e0ecc0aaaf 100644 (file)
@@ -167,10 +167,13 @@ static struct resource h2_kp_resources[] = {
 };
 
 static struct omap_kp_platform_data h2_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = h2_keymap,
-       .rep    = 1,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = h2_keymap,
+       .keymapsize     = ARRAY_SIZE(h2_keymap),
+       .rep            = 1,
+       .delay          = 9,
+       .dbounce        = 1,
 };
 
 static struct platform_device h2_kp_device = {
index 7b206116cd0391882f6d093325150bf9577acd80..f225a083dee1bb13073127a6cc05c6a21e199cfa 100644 (file)
@@ -247,10 +247,13 @@ static struct resource h3_kp_resources[] = {
 };
 
 static struct omap_kp_platform_data h3_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = h3_keymap,
-       .rep    = 1,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = h3_keymap,
+       .keymapsize     = ARRAY_SIZE(h3_keymap),
+       .rep            = 1,
+       .delay          = 9,
+       .dbounce        = 1,
 };
 
 static struct platform_device h3_kp_device = {
index 4cbc62db5b5dd5cd6a72da1c4efbdf2ec56b8aa2..cb00530ad279392725581ae81b57c07a215eb1e6 100644 (file)
@@ -159,9 +159,11 @@ static struct resource innovator_kp_resources[] = {
 };
 
 static struct omap_kp_platform_data innovator_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = innovator_keymap,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = innovator_keymap,
+       .keymapsize     = ARRAY_SIZE(innovator_keymap),
+       .delay          = 4,
 };
 
 static struct platform_device innovator_kp_device = {
index 02b980d77b12d2079e84d23a27eea010005707be..dbc555d209ff914eeff8b0b51d77d814212e430b 100644 (file)
@@ -71,9 +71,11 @@ static struct resource nokia770_kp_resources[] = {
 };
 
 static struct omap_kp_platform_data nokia770_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = nokia770_keymap
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = nokia770_keymap,
+       .keymapsize     = ARRAY_SIZE(nokia770_keymap)
+       .delay          = 4,
 };
 
 static struct platform_device nokia770_kp_device = {
index b742261c97ade63be4e744070d374ab66407bd4e..6b05647a6c01743504650c1021013b19dc367f51 100644 (file)
@@ -266,9 +266,11 @@ static const int osk_keymap[] = {
 };
 
 static struct omap_kp_platform_data osk_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = (int *) osk_keymap,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = (int *) osk_keymap,
+       .keymapsize     = ARRAY_SIZE(osk_keymap),
+       .delay          = 9,
 };
 
 static struct resource osk5912_kp_resources[] = {
index 64b45d8ae357e9e7e3addb767707201672aa6031..fa4be962df67b454c09afc2ea956f11251904825 100644 (file)
@@ -171,9 +171,12 @@ static struct resource kp_resources[] = {
 };
 
 static struct omap_kp_platform_data kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = p2_keymap,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = p2_keymap,
+       .keymapsize     = ARRAY_SIZE(p2_keymap),
+       .delay          = 4,
+       .dbounce        = 1,
 };
 
 static struct platform_device kp_device = {
index 4933fce766c8269569b3e4f8bec8843e5c987916..996aeda1285d058e6abe2b39df36bfb5bbcf75b1 100644 (file)
@@ -245,6 +245,7 @@ static struct omap_kp_platform_data h4_kp_data = {
        .rows           = 6,
        .cols           = 7,
        .keymap         = h4_keymap,
+       .keymapsize     = ARRAY_SIZE(h4_keymap),
        .rep            = 1,
        .row_gpios      = row_gpios,
        .col_gpios      = col_gpios,
index f0943d160ffeccc8d02ece3f82d023bc7c68970a..5e658a8744984688ee171e16b67a44aee65c1331 100644 (file)
@@ -171,7 +171,7 @@ good_area:
        if (fsr & (1 << 11)) /* write? */
                mask = VM_WRITE;
        else
-               mask = VM_READ|VM_EXEC;
+               mask = VM_READ|VM_EXEC|VM_WRITE;
 
        fault = VM_FAULT_BADACCESS;
        if (!(vma->vm_flags & mask))
@@ -198,7 +198,7 @@ survive:
                return fault;
        }
 
-       if (tsk->pid != 1)
+       if (!is_init(tsk))
                goto out;
 
        /*
index db63d75d0715927bda8d6379a63dcdb8dd224822..80adbd005fc51812a8a0bc1701e37513c424f5b0 100644 (file)
@@ -194,7 +194,7 @@ EXPORT_SYMBOL(do_settimeofday);
 
 static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-        do_timer(regs);
+        do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 761938b56679453d350adb663187b4d9b52399ac..a1f6d8a9cc32919084d14b5cf9181dbceb013ca6 100644 (file)
@@ -155,7 +155,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
         */
 good_area:
        if (READ_FAULT(fsr)) /* read? */
-               mask = VM_READ|VM_EXEC;
+               mask = VM_READ|VM_EXEC|VM_WRITE;
        else
                mask = VM_WRITE;
 
@@ -185,7 +185,7 @@ survive:
        }
 
        fault = -3; /* out of memory */
-       if (tsk->pid != 1)
+       if (!is_init(tsk))
                goto out;
 
        /*
index b0e6b5855a381d2096c9a9b581874be3fd5b634e..3e56b9f4358af4a3728c96ed2815eb033a0fc841 100644 (file)
@@ -148,7 +148,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
         * Call the generic timer interrupt handler
         */
        write_seqlock(&xtime_lock);
-       do_timer(regs);
+       do_timer(1);
        write_sequnlock(&xtime_lock);
 
        /*
index 9c22b76e129a32a18e49da042a675d23f8756ed2..ebacf1457d914cacae4069c21094639fbc906dd7 100644 (file)
@@ -227,7 +227,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        
        /* call the real timer interrupt handler */
 
-       do_timer(regs);
+       do_timer(1);
        
         cris_do_profile(regs); /* Save profiling information */
 
index 50f3f93293d64d33c8b1183a6971faf68eca0912..be0a01657d4fc88076e120b88264977acd25d2ed 100644 (file)
@@ -219,7 +219,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                return IRQ_HANDLED;
 
        /* call the real timer interrupt handler */
-       do_timer(regs);
+       do_timer(1);
 
        /*
         * If we have an externally synchronized Linux clock, then update
index 3d0284bccb940ba2d62c8c3e9e26f099065ff0b4..7e55884135ed8ee2cf460cd0c03c0f223853256d 100644 (file)
@@ -70,7 +70,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
         */
        write_seqlock(&xtime_lock);
 
-       do_timer(regs);
+       do_timer(1);
        update_process_times(user_mode(regs));
        profile_tick(CPU_PROFILING, regs);
 
index 688a5100604c943c614e5ffeb8fef25ba5c9b2fd..e569d17b4ae6b92b5ceccf554795d6cd83070945 100644 (file)
@@ -41,7 +41,7 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
        /* may need to kick the hardware timer */
        platform_timer_eoi();
 
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index ff9ce4b5eaa86489fec9dc55b272358ece1bf586..b42f2d914af3bb15eada724c854bc92581f47169 100644 (file)
 #include <linux/smp_lock.h>
 #include <linux/dmi.h>
 #include <linux/suspend.h>
+#include <linux/kthread.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -402,8 +403,6 @@ static int                  realmode_power_off = 1;
 #else
 static int                     realmode_power_off;
 #endif
-static int                     exit_kapmd __read_mostly;
-static int                     kapmd_running __read_mostly;
 #ifdef CONFIG_APM_ALLOW_INTS
 static int                     allow_ints = 1;
 #else
@@ -419,6 +418,8 @@ static const struct desc_struct     bad_bios_desc = { 0, 0x00409200 };
 
 static const char              driver_version[] = "1.16ac";    /* no spaces */
 
+static struct task_struct *kapmd_task;
+
 /*
  *     APM event names taken from the APM 1.2 specification. These are
  *     the message codes that the BIOS uses to tell us about events
@@ -1423,7 +1424,7 @@ static void apm_mainloop(void)
        set_current_state(TASK_INTERRUPTIBLE);
        for (;;) {
                schedule_timeout(APM_CHECK_TIMEOUT);
-               if (exit_kapmd)
+               if (kthread_should_stop())
                        break;
                /*
                 * Ok, check all events, check for idle (and mark us sleeping
@@ -1706,12 +1707,6 @@ static int apm(void *unused)
        char *          power_stat;
        char *          bat_stat;
 
-       kapmd_running = 1;
-
-       daemonize("kapmd");
-
-       current->flags |= PF_NOFREEZE;
-
 #ifdef CONFIG_SMP
        /* 2002/08/01 - WT
         * This is to avoid random crashes at boot time during initialization
@@ -1821,7 +1816,6 @@ static int apm(void *unused)
                console_blank_hook = NULL;
 #endif
        }
-       kapmd_running = 0;
 
        return 0;
 }
@@ -2220,7 +2214,7 @@ static int __init apm_init(void)
 {
        struct proc_dir_entry *apm_proc;
        struct desc_struct *gdt;
-       int ret;
+       int err;
 
        dmi_check_system(apm_dmi_table);
 
@@ -2329,12 +2323,17 @@ static int __init apm_init(void)
        if (apm_proc)
                apm_proc->owner = THIS_MODULE;
 
-       ret = kernel_thread(apm, NULL, CLONE_KERNEL | SIGCHLD);
-       if (ret < 0) {
-               printk(KERN_ERR "apm: disabled - Unable to start kernel thread.\n");
+       kapmd_task = kthread_create(apm, NULL, "kapmd");
+       if (IS_ERR(kapmd_task)) {
+               printk(KERN_ERR "apm: disabled - Unable to start kernel "
+                               "thread.\n");
+               err = PTR_ERR(kapmd_task);
+               kapmd_task = NULL;
                remove_proc_entry("apm", NULL);
-               return -ENOMEM;
+               return err;
        }
+       kapmd_task->flags |= PF_NOFREEZE;
+       wake_up_process(kapmd_task);
 
        if (num_online_cpus() > 1 && !smp ) {
                printk(KERN_NOTICE
@@ -2384,9 +2383,10 @@ static void __exit apm_exit(void)
        remove_proc_entry("apm", NULL);
        if (power_off)
                pm_power_off = NULL;
-       exit_kapmd = 1;
-       while (kapmd_running)
-               schedule();
+       if (kapmd_task) {
+               kthread_stop(kapmd_task);
+               kapmd_task = NULL;
+       }
 #ifdef CONFIG_PM_LEGACY
        pm_active = 0;
 #endif
index fe158042110bea08fd7774234dfdb3c7275712a0..f9436989473c23fa0f57ac4ddea21dc8a2f117f0 100644 (file)
@@ -65,7 +65,7 @@ static unsigned long efi_rt_eflags;
 static DEFINE_SPINLOCK(efi_rt_lock);
 static pgd_t efi_bak_pg_dir_pointer[2];
 
-static void efi_call_phys_prelog(void)
+static void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
 {
        unsigned long cr4;
        unsigned long temp;
@@ -109,7 +109,7 @@ static void efi_call_phys_prelog(void)
        load_gdt(cpu_gdt_descr);
 }
 
-static void efi_call_phys_epilog(void)
+static void efi_call_phys_epilog(void) __releases(efi_rt_lock)
 {
        unsigned long cr4;
        struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0);
index 020d873b7d2130584e84906186703c8cd6079498..82b26d5ce476554bd3eb6158cda3d664a6974224 100644 (file)
@@ -102,6 +102,8 @@ u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
                        { [0 ... NR_CPUS-1] = 0xff };
 EXPORT_SYMBOL(x86_cpu_to_apicid);
 
+u8 apicid_2_node[MAX_APICID];
+
 /*
  * Trampoline 80x86 program as an array.
  */
@@ -645,7 +647,7 @@ static void map_cpu_to_logical_apicid(void)
 {
        int cpu = smp_processor_id();
        int apicid = logical_smp_processor_id();
-       int node = apicid_to_node(apicid);
+       int node = apicid_to_node(hard_smp_processor_id());
 
        if (!node_online(node))
                node = first_online_node;
@@ -954,6 +956,7 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
 
        irq_ctx_init(cpu);
 
+       x86_cpu_to_apicid[cpu] = apicid;
        /*
         * This grunge runs the startup process for
         * the targeted processor.
index 32413122c4c2650f1114db0f10bb1d8e12c116b8..f7e735c077c35df71c4ae0c2262113f3ea7a92e4 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/nodemask.h>
 #include <asm/srat.h>
 #include <asm/topology.h>
+#include <asm/smp.h>
 
 /*
  * proximity macros and definitions
@@ -54,6 +55,7 @@ struct node_memory_chunk_s {
 static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS];
 
 static int num_memory_chunks;          /* total number of memory chunks */
+static u8 __initdata apicid_to_pxm[MAX_APICID];
 
 extern void * boot_ioremap(unsigned long, unsigned long);
 
@@ -69,6 +71,8 @@ static void __init parse_cpu_affinity_structure(char *p)
        /* mark this node as "seen" in node bitmap */
        BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain);
 
+       apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain;
+
        printk("CPU 0x%02X in proximity domain 0x%02X\n",
                cpu_affinity->apic_id, cpu_affinity->proximity_domain);
 }
@@ -235,6 +239,9 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
        printk("Number of logical nodes in system = %d\n", num_online_nodes());
        printk("Number of memory chunks in system = %d\n", num_memory_chunks);
 
+       for (i = 0; i < MAX_APICID; i++)
+               apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]);
+
        for (j = 0; j < num_memory_chunks; j++){
                struct node_memory_chunk_s * chunk = &node_memory_chunk[j];
                printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n",
index efc7e7d5f4d0f518847b5232f38aad75ea9367f4..08502fc6d0cb8d0fc819682d26b499e5aab08efb 100644 (file)
@@ -739,7 +739,7 @@ survive:
                        retval = get_user_pages(current, current->mm,
                                        (unsigned long )to, 1, 1, 0, &pg, NULL);
 
-                       if (retval == -ENOMEM && current->pid == 1) {
+                       if (retval == -ENOMEM && is_init(current)) {
                                up_read(&current->mm->mmap_sem);
                                blk_congestion_wait(WRITE, HZ/50);
                                goto survive;
index 5e17a3f43b41ba89c15b17e7390f04dc730ada64..2581575786c135a0a0201cf63caf754a8654a755 100644 (file)
@@ -440,7 +440,7 @@ good_area:
                case 1:         /* read, present */
                        goto bad_area;
                case 0:         /* read, not present */
-                       if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+                       if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                                goto bad_area;
        }
 
@@ -589,7 +589,7 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (tsk->pid == 1) {
+       if (is_init(tsk)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index f88e05ba8eb34acd2aac784da0e9c592dcb20ef4..ca2447e05e15d90a70012e4d2b725c8fa9a47e78 100644 (file)
@@ -138,11 +138,14 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
 static void ppro_start(struct op_msrs const * const msrs)
 {
        unsigned int low,high;
+       int i;
 
-       if (reset_value[0]) {
-               CTRL_READ(low, high, msrs, 0);
-               CTRL_SET_ACTIVE(low);
-               CTRL_WRITE(low, high, msrs, 0);
+       for (i = 0; i < NUM_COUNTERS; ++i) {
+               if (reset_value[i]) {
+                       CTRL_READ(low, high, msrs, i);
+                       CTRL_SET_ACTIVE(low);
+                       CTRL_WRITE(low, high, msrs, i);
+               }
        }
 }
 
@@ -150,11 +153,14 @@ static void ppro_start(struct op_msrs const * const msrs)
 static void ppro_stop(struct op_msrs const * const msrs)
 {
        unsigned int low,high;
+       int i;
 
-       if (reset_value[0]) {
-               CTRL_READ(low, high, msrs, 0);
+       for (i = 0; i < NUM_COUNTERS; ++i) {
+               if (!reset_value[i])
+                       continue;
+               CTRL_READ(low, high, msrs, i);
                CTRL_SET_INACTIVE(low);
-               CTRL_WRITE(low, high, msrs, 0);
+               CTRL_WRITE(low, high, msrs, i);
        }
 }
 
index b5195be6281895d3ea6fb42eca4cb4fb5b41308d..e1a1b11473e221a95e2988107f2d45a9572817e8 100644 (file)
@@ -320,7 +320,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
        }
 
        printk(KERN_INFO "simeth_device_event: %s ipaddr=0x%x\n",
-              dev->name, htonl(ifa->ifa_local));
+              dev->name, ntohl(ifa->ifa_local));
 
        /*
         * XXX Fix me
@@ -331,7 +331,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
        local = dev->priv;
        /* now do it for real */
        r = event == NETDEV_UP ?
-               netdev_attach(local->simfd, dev->irq, htonl(ifa->ifa_local)):
+               netdev_attach(local->simfd, dev->irq, ntohl(ifa->ifa_local)):
                netdev_detach(local->simfd);
 
        printk(KERN_INFO "simeth: netdev_attach/detach: event=%s ->%d\n",
index 6928ef0d64d852abc4a41b7ff5cfc2e1f14d5249..16262687a103a1be82d04f8b6acba09d2f7a2bd0 100644 (file)
@@ -78,7 +78,7 @@ timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
                         * xtime_lock.
                         */
                        write_seqlock(&xtime_lock);
-                       do_timer(regs);
+                       do_timer(1);
                        local_cpu_data->itm_next = new_itm;
                        write_sequnlock(&xtime_lock);
                } else
index 14ef7cceb208bbd45031036cecadfda5e5527487..59f3ab937615fb0fbe40ae08061b3aa47a32a775 100644 (file)
@@ -146,9 +146,11 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
 #              error File is out of sync with <linux/mm.h>.  Please update.
 #      endif
 
+       if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE))))
+               goto bad_area;
+
        mask = (  (((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
-               | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT)
-               | (((isr >> IA64_ISR_R_BIT) & 1UL) << VM_READ_BIT));
+               | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));
 
        if ((vma->vm_flags & mask) != mask)
                goto bad_area;
@@ -278,7 +280,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
 
   out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index ded0be07a476f62aca9f42ed17ea3f757f0453f0..7a896893cd284b80dbd4d2793dca650ec6032848 100644 (file)
@@ -202,7 +202,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 #ifndef CONFIG_SMP
        profile_tick(CPU_PROFILING, regs);
 #endif
-       do_timer(regs);
+       do_timer(1);
 
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
index dc18a33eefef36ccd10790525b2537e4cae89255..8d5f551b5754305e87474b617b8e437925b48f76 100644 (file)
@@ -299,7 +299,7 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (tsk->pid == 1) {
+       if (is_init(tsk)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index 98e4b1adfa29f3836cf69ddd339f02017669bff5..1072e4946a4acab38173ba2246773c363782164c 100644 (file)
@@ -40,7 +40,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
  */
 static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
 {
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index aec15270d334b74795fbfdf7ec214434f35a923f..911f2ce3f53e11ec6d1e0deeba875735d5c2a13b 100644 (file)
@@ -144,7 +144,7 @@ good_area:
                case 1:         /* read, present */
                        goto acc_err;
                case 0:         /* read, not present */
-                       if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+                       if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                                goto acc_err;
        }
 
@@ -181,7 +181,7 @@ good_area:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index f18b9d3ef16df601915abadca0d7f9d1df2b2726..dc4ea7e074a620e21e500b66b75ab10c21a31965 100644 (file)
@@ -65,7 +65,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
 #ifdef CONFIG_SUN3
        intersil_clear();
 #endif
-        do_timer(fp);
+        do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(fp));
 #endif
index 1db9872722200b91fc56dde75be3781dca13b567..db1e1ce0a34960392e44999cfc1e793e6e93532e 100644 (file)
@@ -51,7 +51,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
 
        write_seqlock(&xtime_lock);
 
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 7fbea1bf7b4824afb61d2bacc1c28ab40d1e9458..0a067f3113a54704a454501a14452996ec8b87c2 100644 (file)
@@ -96,7 +96,7 @@ void mips_timer_interrupt(struct pt_regs *regs)
                timerlo = count;
 
                kstat_this_cpu.irqs[irq]++;
-               do_timer(regs);
+               do_timer(1);
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
@@ -137,7 +137,7 @@ irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
        }
 
        while (time_elapsed > 0) {
-               do_timer(regs);
+               do_timer(1);
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
@@ -156,7 +156,7 @@ irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
 
        if (jiffie_drift >= 999) {
                jiffie_drift -= 999;
-               do_timer(regs); /* increment jiffies by one */
+               do_timer(1); /* increment jiffies by one */
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
index d837b26fbe517e5602be5aec2ae5cb4d3b4ff244..7feca49350d18b4bc6ea2ed630c09bbfb3fd1937 100644 (file)
@@ -34,7 +34,7 @@ static void gt64120_irq(int irq, void *dev_id, struct pt_regs *regs)
        if (irq_src & 0x00000800) {     /* Check for timer interrupt */
                handled = 1;
                irq_src &= ~0x00000800;
-               do_timer(regs);
+               do_timer(1);
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
index 170cb67f4ede504d67f38072a14735056daad8c2..6ab8d975a974213a3e7fe3c16014ebe4279d9c50 100644 (file)
@@ -434,7 +434,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        /*
         * call the generic timer interrupt handling
         */
-       do_timer(regs);
+       do_timer(1);
 
        /*
         * If we have an externally synchronized Linux clock, then update
index a4f8c45c4e8ede95a018f85da394317a88153ba4..8423d859077949520de140f5b03d7cfdecda92e1 100644 (file)
@@ -171,7 +171,7 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (tsk->pid == 1) {
+       if (is_init(tsk)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index 9fb2493fff02494c0bb8789d4e273f5ac786c4c4..6cd87cf0195a1ca8ce2dea022502527054ff1aec 100644 (file)
@@ -133,7 +133,7 @@ static irqreturn_t gt64240_p0int_irq(int irq, void *dev, struct pt_regs *regs)
                MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_CAUSE, 0x0);
 
                /* handle the timer call */
-               do_timer(regs);
+               do_timer(1);
 #ifndef CONFIG_SMP
                update_process_times(user_mode(regs));
 #endif
index b029ba79c27af0f685079ba562c3d980122cc884..c62a3a9ef867fa6e3af03ecb773b8418e3ebed37 100644 (file)
@@ -111,7 +111,7 @@ again:
        kstat_this_cpu.irqs[irq]++;             /* kstat only for bootcpu? */
 
        if (cpu == 0)
-               do_timer(regs);
+               do_timer(1);
 
        update_process_times(user_mode(regs));
 
index aee311884f3fa114c2a4fa5f5f4b0dc4fbe2d5f3..f50b982b0834ce8b2598d1b66d1c06b5306ca29f 100644 (file)
@@ -27,7 +27,7 @@
  *    - SEGREL32 handling
  *      We are not doing SEGREL32 handling correctly. According to the ABI, we
  *      should do a value offset, like this:
- *                     if (is_init(me, (void *)val))
+ *                     if (in_init(me, (void *)val))
  *                             val -= (uint32_t)me->module_init;
  *                     else
  *                             val -= (uint32_t)me->module_core;
 
 /* three functions to determine where in the module core
  * or init pieces the location is */
-static inline int is_init(struct module *me, void *loc)
+static inline int in_init(struct module *me, void *loc)
 {
        return (loc >= me->module_init &&
                loc <= (me->module_init + me->init_size));
 }
 
-static inline int is_core(struct module *me, void *loc)
+static inline int in_core(struct module *me, void *loc)
 {
        return (loc >= me->module_core &&
                loc <= (me->module_core + me->core_size));
 }
 
-static inline int is_local(struct module *me, void *loc)
+static inline int in_local(struct module *me, void *loc)
 {
-       return is_init(me, loc) || is_core(me, loc);
+       return in_init(me, loc) || in_core(me, loc);
 }
 
-static inline int is_local_section(struct module *me, void *loc, void *dot)
+static inline int in_local_section(struct module *me, void *loc, void *dot)
 {
-       return (is_init(me, loc) && is_init(me, dot)) ||
-               (is_core(me, loc) && is_core(me, dot));
+       return (in_init(me, loc) && in_init(me, dot)) ||
+               (in_core(me, loc) && in_core(me, dot));
 }
 
 
@@ -566,14 +566,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
                        break;
                case R_PARISC_PCREL17F:
                        /* 17-bit PC relative address */
-                       val = get_stub(me, val, addend, ELF_STUB_GOT, is_init(me, loc));
+                       val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc));
                        val = (val - dot - 8)/4;
                        CHECK_RELOC(val, 17)
                        *loc = (*loc & ~0x1f1ffd) | reassemble_17(val);
                        break;
                case R_PARISC_PCREL22F:
                        /* 22-bit PC relative address; only defined for pa20 */
-                       val = get_stub(me, val, addend, ELF_STUB_GOT, is_init(me, loc));
+                       val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc));
                        DEBUGP("STUB FOR %s loc %lx+%lx at %lx\n", 
                               strtab + sym->st_name, (unsigned long)loc, addend, 
                               val)
@@ -670,9 +670,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
                               strtab + sym->st_name,
                               loc, val);
                        /* can we reach it locally? */
-                       if(!is_local_section(me, (void *)val, (void *)dot)) {
+                       if(!in_local_section(me, (void *)val, (void *)dot)) {
 
-                               if (is_local(me, (void *)val))
+                               if (in_local(me, (void *)val))
                                        /* this is the case where the
                                         * symbol is local to the
                                         * module, but in a different
@@ -680,14 +680,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
                                         * in case it's more than 22
                                         * bits away */
                                        val = get_stub(me, val, addend, ELF_STUB_DIRECT,
-                                                      is_init(me, loc));
+                                                      in_init(me, loc));
                                else if (strncmp(strtab + sym->st_name, "$$", 2)
                                    == 0)
                                        val = get_stub(me, val, addend, ELF_STUB_MILLI,
-                                                      is_init(me, loc));
+                                                      in_init(me, loc));
                                else
                                        val = get_stub(me, val, addend, ELF_STUB_GOT,
-                                                      is_init(me, loc));
+                                                      in_init(me, loc));
                        }
                        DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n", 
                               strtab + sym->st_name, loc, sym->st_value,
@@ -720,7 +720,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
                        break;
                case R_PARISC_FPTR64:
                        /* 64-bit function address */
-                       if(is_local(me, (void *)(val + addend))) {
+                       if(in_local(me, (void *)(val + addend))) {
                                *loc64 = get_fdesc(me, val+addend);
                                DEBUGP("FDESC for %s at %p points to %lx\n",
                                       strtab + sym->st_name, *loc64,
index 5facc9bff4ef68b584aa32fb263b99461e90eb77..700df10924dd8d671b9ae1d6f62b8763ad3f1c0a 100644 (file)
@@ -79,7 +79,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 #endif
                if (cpu == 0) {
                        write_seqlock(&xtime_lock);
-                       do_timer(regs);
+                       do_timer(1);
                        write_sequnlock(&xtime_lock);
                }
        }
index 7a3c3f791ade2aaac30bbadc0994da40ea12e80a..71f71da98e7deb6288a9acdeb6a0449e493787b6 100644 (file)
@@ -693,7 +693,7 @@ void timer_interrupt(struct pt_regs * regs)
                tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
                if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
                        tb_last_jiffy = tb_next_jiffy;
-                       do_timer(regs);
+                       do_timer(1);
                        timer_recalc_offset(tb_last_jiffy);
                        timer_check_rtc();
                }
index 78a0d59903ee69d2b8ac96de20e18c17fd5f9206..e8fa50624b70dae41c27ce669e10f472b18970a8 100644 (file)
@@ -333,7 +333,7 @@ good_area:
                /* protection fault */
                if (error_code & 0x08000000)
                        goto bad_area;
-               if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+               if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                        goto bad_area;
        }
 
@@ -386,7 +386,7 @@ bad_area_nosemaphore:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index 903115d67fdcc5230b718abb6dfb25038881d5b8..311ed1993fc036de995f444bac92d1a327236c89 100644 (file)
@@ -337,7 +337,7 @@ static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err)
                   err->disposition == RTAS_DISP_NOT_RECOVERED &&
                   err->target == RTAS_TARGET_MEMORY &&
                   err->type == RTAS_TYPE_ECC_UNCORR &&
-                  !(current->pid == 0 || current->pid == 1)) {
+                  !(current->pid == 0 || is_init(current))) {
                /* Kill off a user process with an ECC error */
                printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
                       current->pid);
index 6ab8cc7226ab232b220d9d555f0ed66358c0f6c0..1e1f315547671503d0370a2e36bb31eb071b7167 100644 (file)
@@ -153,7 +153,7 @@ void timer_interrupt(struct pt_regs * regs)
                /* We are in an interrupt, no need to save/restore flags */
                write_seqlock(&xtime_lock);
                tb_last_stamp = jiffy_stamp;
-               do_timer(regs);
+               do_timer(1);
 
                /*
                 * update the rtc when needed, this should be performed on the
index d7a433049b4857b3acf2caa59e6f7c981d1c5f21..aafc8e8893d1ebc0ac969b097f77d9f976d616ee 100644 (file)
@@ -119,7 +119,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
         * generate the same exception over and over again and we get
         * nowhere.  Better to kill it and let the kernel panic.
         */
-       if (current->pid == 1) {
+       if (is_init(current)) {
                __sighandler_t handler;
 
                spin_lock_irq(&current->sighand->siglock);
index 5cdfb71fcb078ca50f56059a907e0104ab452194..465f451f3bc3a8a95908dcaa4d31757e04bc9f26 100644 (file)
@@ -239,7 +239,7 @@ good_area:
                /* protection fault */
                if (error_code & 0x08000000)
                        goto bad_area;
-               if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+               if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                        goto bad_area;
        }
 
@@ -291,7 +291,7 @@ bad_area:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index 9a8f6ff216529be88bf8557d7bd787866056b3eb..2b1e6c9a6e0e539826a3a8d45181ec5a7c72e76c 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/proc_fs.h>
-#include <linux/page-flags.h>
+#include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/pagemap.h>
 #include <linux/sysctl.h>
index 1981c6199fa20c559aefaf671565b09a3d10a22b..abab42e9f5f8718cfcda91702803e8d797f70544 100644 (file)
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(do_settimeofday);
 void account_ticks(struct pt_regs *regs)
 {
        __u64 tmp;
-       __u32 ticks, xticks;
+       __u32 ticks;
 
        /* Calculate how many ticks have passed. */
        if (S390_lowcore.int_clock < S390_lowcore.jiffy_timer) {
@@ -204,6 +204,7 @@ void account_ticks(struct pt_regs *regs)
         */
        write_seqlock(&xtime_lock);
        if (S390_lowcore.jiffy_timer > xtime_cc) {
+               __u32 xticks;
                tmp = S390_lowcore.jiffy_timer - xtime_cc;
                if (tmp >= 2*CLK_TICKS_PER_JIFFY) {
                        xticks = __div(tmp, CLK_TICKS_PER_JIFFY);
@@ -212,13 +213,11 @@ void account_ticks(struct pt_regs *regs)
                        xticks = 1;
                        xtime_cc += CLK_TICKS_PER_JIFFY;
                }
-               while (xticks--)
-                       do_timer(regs);
+               do_timer(xticks);
        }
        write_sequnlock(&xtime_lock);
 #else
-       for (xticks = ticks; xticks > 0; xticks--)
-               do_timer(regs);
+       do_timer(ticks);
 #endif
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
index f2b9a84dc2bff3e424be20442a1835146c7f2924..9c3c19fe62fcd99dfb3893730d7f54b354b731f5 100644 (file)
@@ -353,7 +353,7 @@ no_context:
 */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (tsk->pid == 1) {
+       if (is_init(tsk)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index 149d9713eddf0432ff8321972cd31320652f4c30..f664a196c4f58dd635cd6ec960fd7808a8e8532f 100644 (file)
@@ -117,7 +117,7 @@ static long last_rtc_update;
  */
 void handle_timer_tick(struct pt_regs *regs)
 {
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index c69fd603226aa80a20ba084aebd545e65c5142c3..68663b8f99aec28619ea7cb92d16978c5a08be25 100644 (file)
@@ -69,7 +69,7 @@ good_area:
                if (!(vma->vm_flags & VM_WRITE))
                        goto bad_area;
        } else {
-               if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+               if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                        goto bad_area;
        }
 
@@ -149,7 +149,7 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index b8162e59030e447c6fcc1d12cdb0c59e15ce34e6..3b61e06f9d7258622d9aaa6123d433b66dd0f7d9 100644 (file)
@@ -298,7 +298,7 @@ static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
        asm ("getcon cr62, %0" : "=r" (current_ctc));
        ctc_last_interrupt = (unsigned long) current_ctc;
 
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index f08d0eaf6497d34c716d8f0c5ee4baf2aa4eb27c..8e2f6c28b7390fc712a8d07f8e8e567fbd7b6853 100644 (file)
@@ -277,7 +277,7 @@ bad_area:
                        show_regs(regs);
 #endif
                }
-               if (tsk->pid == 1) {
+               if (is_init(tsk)) {
                        panic("INIT had user mode bad_area\n");
                }
                tsk->thread.address = address;
@@ -319,14 +319,14 @@ no_context:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-       if (current->pid == 1) {
+       if (is_init(current)) {
                panic("INIT out of memory\n");
                yield();
                goto survive;
        }
        printk("fault:Out of memory\n");
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index bfd31aac2df3b2c7992f082fd08b9f5ba78da4c2..e19b1bad9bc56e0c1710c4c1d006b6867fdc5984 100644 (file)
@@ -712,7 +712,7 @@ static irqreturn_t pcic_timer_handler (int irq, void *h, struct pt_regs *regs)
 {
        write_seqlock(&xtime_lock);     /* Dummy, to show that we remember */
        pcic_clear_clock_irq();
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 845081b0126760ac14e8b7c2735ad089bee991f2..6f84fa1b58e5e54b94c8ce42b05ee82c484c837b 100644 (file)
@@ -128,7 +128,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 #endif
        clear_clock_irq();
 
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index b0b4feeec09826f84a70e29d9ad8b77d6347ab7c..ca1193482f07d2df1cd292bd6cce62531bad3426 100644 (file)
@@ -465,7 +465,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
                profile_tick(CPU_PROFILING, regs);
                update_process_times(user_mode(regs));
 #endif
-               do_timer(regs);
+               do_timer(1);
 
                /* Guarantee that the following sequences execute
                 * uninterrupted.
@@ -496,7 +496,7 @@ void timer_tick_interrupt(struct pt_regs *regs)
 {
        write_seqlock(&xtime_lock);
 
-       do_timer(regs);
+       do_timer(1);
 
        timer_check_rtc();
 
index 642541769a179970c077dba52e23c2d1d90984a3..9c581328e76a191e3b4aa4903840276db2c3aab2 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/limits.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/tty.h>
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/timex.h>
@@ -422,7 +423,9 @@ asmlinkage int solaris_procids(int cmd, s32 pid, s32 pgid)
                           Solaris setpgrp and setsid? */
                        ret = sys_setpgid(0, 0);
                        if (ret) return ret;
+                       mutex_lock(&tty_mutex);
                        current->signal->tty = NULL;
+                       mutex_unlock(&tty_mutex);
                        return process_group(current);
                }
        case 2: /* getsid */
index 79610b5ce67ed5978aa5b74ee109411616c76e60..773a134e7fdb806fd6b63c80ceb3576ede57a370 100644 (file)
@@ -598,6 +598,11 @@ out:
        mconsole_reply(req, err_msg, err, 0);
 }
 
+struct mconsole_output {
+       struct list_head list;
+       struct mc_request *req;
+};
+
 static DEFINE_SPINLOCK(console_lock);
 static LIST_HEAD(clients);
 static char console_buf[MCONSOLE_MAX_DATA];
@@ -622,10 +627,10 @@ static void console_write(struct console *console, const char *string,
                        return;
 
                list_for_each(ele, &clients){
-                       struct mconsole_entry *entry;
+                       struct mconsole_output *entry;
 
-                       entry = list_entry(ele, struct mconsole_entry, list);
-                       mconsole_reply_len(&entry->request, console_buf,
+                       entry = list_entry(ele, struct mconsole_output, list);
+                       mconsole_reply_len(entry->req, console_buf,
                                           console_index, 0, 1);
                }
 
@@ -649,10 +654,10 @@ late_initcall(mc_add_console);
 static void with_console(struct mc_request *req, void (*proc)(void *),
                         void *arg)
 {
-       struct mconsole_entry entry;
+       struct mconsole_output entry;
        unsigned long flags;
 
-       entry.request = *req;
+       entry.req = req;
        list_add(&entry.list, &clients);
        spin_lock_irqsave(&console_lock, flags);
 
index 5b2f5fe9e426d3d45043bae9a49badb804a9426e..17068eb746c0bda5204a8ffd49ee0ab5de16c46a 100644 (file)
@@ -131,6 +131,10 @@ int mconsole_get_request(int fd, struct mc_request *req)
 int mconsole_reply_len(struct mc_request *req, const char *str, int total,
                       int err, int more)
 {
+       /* XXX This is a stack consumption problem.  It'd be nice to
+        * make it global and serialize access to it, but there are a
+        * ton of callers to this function.
+        */
        struct mconsole_reply reply;
        int len, n;
 
index 664c2e2fb8209de464e27a951407e7d9fb58ae56..16aa572325c9b4870c0fd2feacda2154a0a83119 100644 (file)
@@ -119,11 +119,6 @@ static int uml_net_open(struct net_device *dev)
                goto out;
        }
 
-       if(!lp->have_mac){
-               dev_ip_addr(dev, &lp->mac[2]);
-               set_ether_mac(dev, lp->mac);
-       }
-
        lp->fd = (*lp->open)(&lp->user);
        if(lp->fd < 0){
                err = lp->fd;
@@ -287,6 +282,37 @@ void uml_net_user_timer_expire(unsigned long _conn)
 #endif
 }
 
+static void setup_etheraddr(char *str, unsigned char *addr)
+{
+       char *end;
+       int i;
+
+       if(str == NULL)
+               goto random;
+
+       for(i=0;i<6;i++){
+               addr[i] = simple_strtoul(str, &end, 16);
+               if((end == str) ||
+                  ((*end != ':') && (*end != ',') && (*end != '\0'))){
+                       printk(KERN_ERR
+                              "setup_etheraddr: failed to parse '%s' "
+                              "as an ethernet address\n", str);
+                       goto random;
+               }
+               str = end + 1;
+       }
+       if(addr[0] & 1){
+               printk(KERN_ERR
+                      "Attempt to assign a broadcast ethernet address to a "
+                      "device disallowed\n");
+               goto random;
+       }
+       return;
+
+random:
+       random_ether_addr(addr)
+}
+
 static DEFINE_SPINLOCK(devices_lock);
 static LIST_HEAD(devices);
 
@@ -322,15 +348,13 @@ static int eth_configure(int n, void *init, char *mac,
        list_add(&device->list, &devices);
        spin_unlock(&devices_lock);
 
-       if (setup_etheraddr(mac, device->mac))
-               device->have_mac = 1;
+       setup_etheraddr(mac, device->mac);
 
        printk(KERN_INFO "Netdevice %d ", n);
-       if (device->have_mac)
-               printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
-                      device->mac[0], device->mac[1],
-                      device->mac[2], device->mac[3],
-                      device->mac[4], device->mac[5]);
+       printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
+              device->mac[0], device->mac[1],
+              device->mac[2], device->mac[3],
+              device->mac[4], device->mac[5]);
        printk(": ");
        dev = alloc_etherdev(size);
        if (dev == NULL) {
@@ -396,7 +420,6 @@ static int eth_configure(int n, void *init, char *mac,
                  .dev                  = dev,
                  .fd                   = -1,
                  .mac                  = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
-                 .have_mac             = device->have_mac,
                  .protocol             = transport->kern->protocol,
                  .open                 = transport->user->open,
                  .close                = transport->user->close,
@@ -411,14 +434,12 @@ static int eth_configure(int n, void *init, char *mac,
        init_timer(&lp->tl);
        spin_lock_init(&lp->lock);
        lp->tl.function = uml_net_user_timer_expire;
-       if (lp->have_mac)
-               memcpy(lp->mac, device->mac, sizeof(lp->mac));
+       memcpy(lp->mac, device->mac, sizeof(lp->mac));
 
        if (transport->user->init) 
                (*transport->user->init)(&lp->user, dev);
 
-       if (device->have_mac)
-               set_ether_mac(dev, device->mac);
+       set_ether_mac(dev, device->mac);
 
        return 0;
 }
@@ -747,47 +768,6 @@ static void close_devices(void)
 
 __uml_exitcall(close_devices);
 
-int setup_etheraddr(char *str, unsigned char *addr)
-{
-       char *end;
-       int i;
-
-       if(str == NULL)
-               return(0);
-       for(i=0;i<6;i++){
-               addr[i] = simple_strtoul(str, &end, 16);
-               if((end == str) ||
-                  ((*end != ':') && (*end != ',') && (*end != '\0'))){
-                       printk(KERN_ERR 
-                              "setup_etheraddr: failed to parse '%s' "
-                              "as an ethernet address\n", str);
-                       return(0);
-               }
-               str = end + 1;
-       }
-       if(addr[0] & 1){
-               printk(KERN_ERR 
-                      "Attempt to assign a broadcast ethernet address to a "
-                      "device disallowed\n");
-               return(0);
-       }
-       return(1);
-}
-
-void dev_ip_addr(void *d, unsigned char *bin_buf)
-{
-       struct net_device *dev = d;
-       struct in_device *ip = dev->ip_ptr;
-       struct in_ifaddr *in;
-
-       if((ip == NULL) || ((in = ip->ifa_list) == NULL)){
-               printk(KERN_WARNING "dev_ip_addr - device not assigned an "
-                      "IP address\n");
-               return;
-       }
-       memcpy(bin_buf, &in->ifa_address, sizeof(in->ifa_address));
-}
-
 struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
 {
        if((skb != NULL) && (skb_tailroom(skb) < extra)){
@@ -825,7 +805,7 @@ int dev_netmask(void *d, void *m)
        struct net_device *dev = d;
        struct in_device *ip = dev->ip_ptr;
        struct in_ifaddr *in;
-       __u32 *mask_out = m;
+       __be32 *mask_out = m;
 
        if(ip == NULL) 
                return(1);
index 107c5e43fa00fec37d6fcf8c3b01851274a9b87e..f3a3f8a29c7af877d327692f2f30f89a7ef6f081 100644 (file)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
+#include <sys/time.h>
 #include "user.h"
 #include "user_util.h"
 #include "kern_util.h"
index 3683ed44315d6e2da21707c9293bf82eb22e326b..9016c68beee8d3287761b1da07001c5915bde7c6 100644 (file)
@@ -8,6 +8,7 @@
 #include "chan_user.h"
 #include "os.h"
 
+/* This address is used only as a unique identifer */
 static int null_chan;
 
 static void *null_init(char *str, int device, const struct chan_opts *opts)
index ae9909415b9cdb372c1f1f0c1602a21a4c2e86b3..73b2bdd6d2d3b867165e116b7a1b430f34096c9b 100644 (file)
 
 #define RNG_MISCDEV_MINOR              183 /* official */
 
+/* Changed at init time, in the non-modular case, and at module load
+ * time, in the module case.  Presumably, the module subsystem
+ * protects against a module being loaded twice at the same time.
+ */
 static int random_fd = -1;
 
 static int rng_dev_open (struct inode *inode, struct file *filp)
index 6d2cf32a9e8f880eeaf7439e874ef4640f3ec7dc..911539293871d271ed306c36fd1b113f6acc9203 100644 (file)
@@ -9,6 +9,8 @@
 /*
  * Don't register by default -- as this registeres very early in the
  * boot process it becomes the default console.
+ *
+ * Initialized at init time.
  */
 static int use_stderr_console = 0;
 
index 5e44adb07051723333236caa67d9358e2cb7aabc..e4bfcfe8550ba91cc7515c3d3bd46bd7e39ba325 100644 (file)
@@ -108,6 +108,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
        return line_open(vts, tty);
 }
 
+/* Set in an initcall, checked in an exitcall */
 static int con_init_done = 0;
 
 static const struct tty_operations console_ops = {
index 34085315aa57e045232a20abeea45ec1111dda79..5fa4c8e258a4e4d76d9406b5e002589e6c042374 100644 (file)
@@ -668,18 +668,15 @@ static int ubd_add(int n)
        if(dev->file == NULL)
                goto out;
 
-       if (ubd_open_dev(dev))
-               goto out;
-
        err = ubd_file_size(dev, &dev->size);
        if(err < 0)
-               goto out_close;
+               goto out;
 
        dev->size = ROUND_BLOCK(dev->size);
 
        err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
        if(err)
-               goto out_close;
+               goto out;
 
        if(fake_major != MAJOR_NR)
                ubd_new_disk(fake_major, dev->size, n,
@@ -691,8 +688,6 @@ static int ubd_add(int n)
                make_ide_entries(ubd_gendisk[n]->disk_name);
 
        err = 0;
-out_close:
-       ubd_close(dev);
 out:
        return err;
 }
index 769fba43ee039a2bfb93fd33d32f23a49ba623cd..280459fb0b2619ded00ce874565a5d6c93ef6c49 100644 (file)
@@ -18,7 +18,6 @@ struct uml_net {
        struct platform_device pdev;
        int index;
        unsigned char mac[ETH_ALEN];
-       int have_mac;
 };
 
 struct uml_net_private {
@@ -29,7 +28,6 @@ struct uml_net_private {
        struct net_device_stats stats;
        int fd;
        unsigned char mac[ETH_ALEN];
-       int have_mac;
        unsigned short (*protocol)(struct sk_buff *);
        int (*open)(void *);
        void (*close)(int, void *);
@@ -62,7 +60,6 @@ struct transport {
 
 extern struct net_device *ether_init(int);
 extern unsigned short ether_protocol(struct sk_buff *);
-extern int setup_etheraddr(char *str, unsigned char *addr);
 extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
 extern int tap_setup_common(char *str, char *type, char **dev_name, 
                            char **mac_out, char **gate_addr);
@@ -70,14 +67,3 @@ extern void register_transport(struct transport *new);
 extern unsigned short eth_protocol(struct sk_buff *skb);
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index 47ef7cb49a8e3f19619d7417ca856c7762907f3c..19f207cd70fe4b3bf6ed33dee917a58622055d9a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  * Licensed under the GPL
  */
@@ -25,9 +25,8 @@ struct net_user_info {
 };
 
 extern void ether_user_init(void *data, void *dev);
-extern void dev_ip_addr(void *d, unsigned char *bin_buf);
-extern void iter_addresses(void *d, void (*cb)(unsigned char *, 
-                                              unsigned char *, void *), 
+extern void iter_addresses(void *d, void (*cb)(unsigned char *,
+                                              unsigned char *, void *),
                           void *arg);
 
 extern void *get_output_buffer(int *len_out);
@@ -52,14 +51,3 @@ extern char *split_if_spec(char *str, ...);
 extern int dev_netmask(void *d, void *m);
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index d21ebad666b4246f45c99d2667dbcc82702b6f6c..8b7f2cdedf945148ffd96306ac04024dc9a0a7ee 100644 (file)
@@ -16,9 +16,13 @@ int uml_exitcode = 0;
 static int read_proc_exitcode(char *page, char **start, off_t off,
                              int count, int *eof, void *data)
 {
-       int len;
+       int len, val;
 
-       len = sprintf(page, "%d\n", uml_exitcode);
+       /* Save uml_exitcode in a local so that we don't need to guarantee
+        * that sprintf accesses it atomically.
+        */
+       val = uml_exitcode;
+       len = sprintf(page, "%d\n", val);
        len -= off;
        if(len <= off+count) *eof = 1;
        *start = page + off;
index 79c22707a6375c84cbda0f89df31abf0eda28836..4cd2ff546ef6f9d322b2f882ca182bf5315cf7c9 100644 (file)
@@ -61,8 +61,10 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
 #endif
 
        *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT));
-       *pte = pte_mkexec(*pte);
-       *pte = pte_wrprotect(*pte);
+       /* This is wrong for the code page, but it doesn't matter since the
+        * stub is mapped by hand with the correct permissions.
+        */
+       *pte = pte_mkwrite(*pte);
        return(0);
 
  out_pmd:
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
deleted file mode 100644 (file)
index 0f3d5d0..0000000
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
- * Copyright 2003 PathScale, Inc.
- * Licensed under the GPL
- */
-
-#include "linux/config.h"
-#include "linux/kernel.h"
-#include "linux/sched.h"
-#include "linux/interrupt.h"
-#include "linux/string.h"
-#include "linux/mm.h"
-#include "linux/slab.h"
-#include "linux/utsname.h"
-#include "linux/fs.h"
-#include "linux/utime.h"
-#include "linux/smp_lock.h"
-#include "linux/module.h"
-#include "linux/init.h"
-#include "linux/capability.h"
-#include "linux/vmalloc.h"
-#include "linux/spinlock.h"
-#include "linux/proc_fs.h"
-#include "linux/ptrace.h"
-#include "linux/random.h"
-#include "linux/personality.h"
-#include "asm/unistd.h"
-#include "asm/mman.h"
-#include "asm/segment.h"
-#include "asm/stat.h"
-#include "asm/pgtable.h"
-#include "asm/processor.h"
-#include "asm/tlbflush.h"
-#include "asm/uaccess.h"
-#include "asm/user.h"
-#include "user_util.h"
-#include "kern_util.h"
-#include "kern.h"
-#include "signal_kern.h"
-#include "init.h"
-#include "irq_user.h"
-#include "mem_user.h"
-#include "tlb.h"
-#include "frame_kern.h"
-#include "sigcontext.h"
-#include "os.h"
-#include "mode.h"
-#include "mode_kern.h"
-#include "choose-mode.h"
-
-/* This is a per-cpu array.  A processor only modifies its entry and it only
- * cares about its entry, so it's OK if another processor is modifying its
- * entry.
- */
-struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
-
-int external_pid(void *t)
-{
-       struct task_struct *task = t ? t : current;
-
-       return(CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task));
-}
-
-int pid_to_processor_id(int pid)
-{
-       int i;
-
-       for(i = 0; i < ncpus; i++){
-               if(cpu_tasks[i].pid == pid) return(i);
-       }
-       return(-1);
-}
-
-void free_stack(unsigned long stack, int order)
-{
-       free_pages(stack, order);
-}
-
-unsigned long alloc_stack(int order, int atomic)
-{
-       unsigned long page;
-       gfp_t flags = GFP_KERNEL;
-
-       if (atomic)
-               flags = GFP_ATOMIC;
-       page = __get_free_pages(flags, order);
-       if(page == 0)
-               return(0);
-       stack_protections(page);
-       return(page);
-}
-
-int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
-       int pid;
-
-       current->thread.request.u.thread.proc = fn;
-       current->thread.request.u.thread.arg = arg;
-       pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0,
-                     &current->thread.regs, 0, NULL, NULL);
-       if(pid < 0)
-               panic("do_fork failed in kernel_thread, errno = %d", pid);
-       return(pid);
-}
-
-void set_current(void *t)
-{
-       struct task_struct *task = t;
-
-       cpu_tasks[task_thread_info(task)->cpu] = ((struct cpu_task)
-               { external_pid(task), task });
-}
-
-void *_switch_to(void *prev, void *next, void *last)
-{
-        struct task_struct *from = prev;
-        struct task_struct *to= next;
-
-        to->thread.prev_sched = from;
-        set_current(to);
-
-       do {
-               current->thread.saved_task = NULL ;
-               CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next);
-               if(current->thread.saved_task)
-                       show_regs(&(current->thread.regs));
-               next= current->thread.saved_task;
-               prev= current;
-       } while(current->thread.saved_task);
-
-        return(current->thread.prev_sched);
-
-}
-
-void interrupt_end(void)
-{
-       if(need_resched()) schedule();
-       if(test_tsk_thread_flag(current, TIF_SIGPENDING)) do_signal();
-}
-
-void release_thread(struct task_struct *task)
-{
-       CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task));
-}
-
-void exit_thread(void)
-{
-       unprotect_stack((unsigned long) current_thread);
-}
-
-void *get_current(void)
-{
-       return(current);
-}
-
-int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
-               unsigned long stack_top, struct task_struct * p,
-               struct pt_regs *regs)
-{
-       int ret;
-
-       p->thread = (struct thread_struct) INIT_THREAD;
-       ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr,
-                               clone_flags, sp, stack_top, p, regs);
-
-       if (ret || !current->thread.forking)
-               goto out;
-
-       clear_flushed_tls(p);
-
-       /*
-        * Set a new TLS for the child thread?
-        */
-       if (clone_flags & CLONE_SETTLS)
-               ret = arch_copy_tls(p);
-
-out:
-       return ret;
-}
-
-void initial_thread_cb(void (*proc)(void *), void *arg)
-{
-       int save_kmalloc_ok = kmalloc_ok;
-
-       kmalloc_ok = 0;
-       CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc,
-                        arg);
-       kmalloc_ok = save_kmalloc_ok;
-}
-
-unsigned long stack_sp(unsigned long page)
-{
-       return(page + PAGE_SIZE - sizeof(void *));
-}
-
-int current_pid(void)
-{
-       return(current->pid);
-}
-
-void default_idle(void)
-{
-       CHOOSE_MODE(uml_idle_timer(), (void) 0);
-
-       while(1){
-               /* endless idle loop with no priority at all */
-
-               /*
-                * although we are an idle CPU, we do not want to
-                * get into the scheduler unnecessarily.
-                */
-               if(need_resched())
-                       schedule();
-
-               idle_sleep(10);
-       }
-}
-
-void cpu_idle(void)
-{
-       CHOOSE_MODE(init_idle_tt(), init_idle_skas());
-}
-
-int page_size(void)
-{
-       return(PAGE_SIZE);
-}
-
-void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
-                     pte_t *pte_out)
-{
-       pgd_t *pgd;
-       pud_t *pud;
-       pmd_t *pmd;
-       pte_t *pte;
-       pte_t ptent;
-
-       if(task->mm == NULL)
-               return(ERR_PTR(-EINVAL));
-       pgd = pgd_offset(task->mm, addr);
-       if(!pgd_present(*pgd))
-               return(ERR_PTR(-EINVAL));
-
-       pud = pud_offset(pgd, addr);
-       if(!pud_present(*pud))
-               return(ERR_PTR(-EINVAL));
-
-       pmd = pmd_offset(pud, addr);
-       if(!pmd_present(*pmd))
-               return(ERR_PTR(-EINVAL));
-
-       pte = pte_offset_kernel(pmd, addr);
-       ptent = *pte;
-       if(!pte_present(ptent))
-               return(ERR_PTR(-EINVAL));
-
-       if(pte_out != NULL)
-               *pte_out = ptent;
-       return((void *) (pte_val(ptent) & PAGE_MASK) + (addr & ~PAGE_MASK));
-}
-
-char *current_cmd(void)
-{
-#if defined(CONFIG_SMP) || defined(CONFIG_HIGHMEM)
-       return("(Unknown)");
-#else
-       void *addr = um_virt_to_phys(current, current->mm->arg_start, NULL);
-       return IS_ERR(addr) ? "(Unknown)": __va((unsigned long) addr);
-#endif
-}
-
-void force_sigbus(void)
-{
-       printk(KERN_ERR "Killing pid %d because of a lack of memory\n",
-              current->pid);
-       lock_kernel();
-       sigaddset(&current->pending.signal, SIGBUS);
-       recalc_sigpending();
-       current->flags |= PF_SIGNALED;
-       do_exit(SIGBUS | 0x80);
-}
-
-void dump_thread(struct pt_regs *regs, struct user *u)
-{
-}
-
-void enable_hlt(void)
-{
-       panic("enable_hlt");
-}
-
-EXPORT_SYMBOL(enable_hlt);
-
-void disable_hlt(void)
-{
-       panic("disable_hlt");
-}
-
-EXPORT_SYMBOL(disable_hlt);
-
-void *um_kmalloc(int size)
-{
-       return kmalloc(size, GFP_KERNEL);
-}
-
-void *um_kmalloc_atomic(int size)
-{
-       return kmalloc(size, GFP_ATOMIC);
-}
-
-void *um_vmalloc(int size)
-{
-       return vmalloc(size);
-}
-
-void *um_vmalloc_atomic(int size)
-{
-       return __vmalloc(size, GFP_ATOMIC | __GFP_HIGHMEM, PAGE_KERNEL);
-}
-
-int __cant_sleep(void) {
-       return in_atomic() || irqs_disabled() || in_interrupt();
-       /* Is in_interrupt() really needed? */
-}
-
-unsigned long get_fault_addr(void)
-{
-       return((unsigned long) current->thread.fault_addr);
-}
-
-EXPORT_SYMBOL(get_fault_addr);
-
-void not_implemented(void)
-{
-       printk(KERN_DEBUG "Something isn't implemented in here\n");
-}
-
-EXPORT_SYMBOL(not_implemented);
-
-int user_context(unsigned long sp)
-{
-       unsigned long stack;
-
-       stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER);
-       return(stack != (unsigned long) current_thread);
-}
-
-extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end;
-
-void do_uml_exitcalls(void)
-{
-       exitcall_t *call;
-
-       call = &__uml_exitcall_end;
-       while (--call >= &__uml_exitcall_begin)
-               (*call)();
-}
-
-char *uml_strdup(char *string)
-{
-       return kstrdup(string, GFP_KERNEL);
-}
-
-int copy_to_user_proc(void __user *to, void *from, int size)
-{
-       return(copy_to_user(to, from, size));
-}
-
-int copy_from_user_proc(void *to, void __user *from, int size)
-{
-       return(copy_from_user(to, from, size));
-}
-
-int clear_user_proc(void __user *buf, int size)
-{
-       return(clear_user(buf, size));
-}
-
-int strlen_user_proc(char __user *str)
-{
-       return(strlen_user(str));
-}
-
-int smp_sigio_handler(void)
-{
-#ifdef CONFIG_SMP
-       int cpu = current_thread->cpu;
-       IPI_handler(cpu);
-       if(cpu != 0)
-               return(1);
-#endif
-       return(0);
-}
-
-int cpu(void)
-{
-       return(current_thread->cpu);
-}
-
-static atomic_t using_sysemu = ATOMIC_INIT(0);
-int sysemu_supported;
-
-void set_using_sysemu(int value)
-{
-       if (value > sysemu_supported)
-               return;
-       atomic_set(&using_sysemu, value);
-}
-
-int get_using_sysemu(void)
-{
-       return atomic_read(&using_sysemu);
-}
-
-static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int *eof, void *data)
-{
-       if (snprintf(buf, size, "%d\n", get_using_sysemu()) < size) /*No overflow*/
-               *eof = 1;
-
-       return strlen(buf);
-}
-
-static int proc_write_sysemu(struct file *file,const char __user *buf, unsigned long count,void *data)
-{
-       char tmp[2];
-
-       if (copy_from_user(tmp, buf, 1))
-               return -EFAULT;
-
-       if (tmp[0] >= '0' && tmp[0] <= '2')
-               set_using_sysemu(tmp[0] - '0');
-       return count; /*We use the first char, but pretend to write everything*/
-}
-
-int __init make_proc_sysemu(void)
-{
-       struct proc_dir_entry *ent;
-       if (!sysemu_supported)
-               return 0;
-
-       ent = create_proc_entry("sysemu", 0600, &proc_root);
-
-       if (ent == NULL)
-       {
-               printk(KERN_WARNING "Failed to register /proc/sysemu\n");
-               return(0);
-       }
-
-       ent->read_proc  = proc_read_sysemu;
-       ent->write_proc = proc_write_sysemu;
-
-       return 0;
-}
-
-late_initcall(make_proc_sysemu);
-
-int singlestepping(void * t)
-{
-       struct task_struct *task = t ? t : current;
-
-       if ( ! (task->ptrace & PT_DTRACE) )
-               return(0);
-
-       if (task->thread.singlestep_syscall)
-               return(1);
-
-       return 2;
-}
-
-/*
- * Only x86 and x86_64 have an arch_align_stack().
- * All other arches have "#define arch_align_stack(x) (x)"
- * in their asm/system.h
- * As this is included in UML from asm-um/system-generic.h,
- * we can use it to behave as the subarch does.
- */
-#ifndef arch_align_stack
-unsigned long arch_align_stack(unsigned long sp)
-{
-       if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
-               sp -= get_random_int() % 8192;
-       return sp & ~0xf;
-}
-#endif
index 820affbf3e163cc4b99abc627fac7421786b8d57..a92965f8f9cdd57d600e229e136dee8fafa64d5a 100644 (file)
@@ -93,7 +93,7 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
 
        write_seqlock_irqsave(&xtime_lock, flags);
 
-       do_timer(regs);
+       do_timer(1);
 
        nsecs = get_time();
        xtime.tv_sec = nsecs / NSEC_PER_SEC;
index 61a23fff4395e822f1ee481a9ab589003201b1ba..c7b195c7e51fa3ddc3d46da245f2f0f5ce7fa6fe 100644 (file)
@@ -120,7 +120,7 @@ out_nosemaphore:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-       if (current->pid == 1) {
+       if (is_init(current)) {
                up_read(&mm->mmap_sem);
                yield();
                down_read(&mm->mmap_sem);
index b170b4704dc40aa25137f6ab29ece4b36eb03078..4203681e508d0a680635347c53a2168fdd3a68be 100644 (file)
@@ -132,6 +132,9 @@ err:
        else if(found < 0)
                printf("read returned errno %d\n", -found);
 
+out:
+       close(fd);
+
        return;
 
 found:
@@ -141,11 +144,12 @@ found:
 
        if(strncmp(buf, "tmpfs", strlen("tmpfs"))){
                printf("not tmpfs\n");
-               return;
+               goto out;
        }
 
        printf("OK\n");
        default_tmpdir = "/dev/shm";
+       goto out;
 }
 
 /*
index a0b46695f186f03921a7a09b66cde5af0bf5bfa8..f4d1a4d3cdc231696e55802039541e5b024b3c76 100644 (file)
@@ -51,7 +51,7 @@ static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
        if (mach_tick)
          mach_tick ();
 
-       do_timer (regs);
+       do_timer (1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 6a55f87ba97f917ed2814bc3c11c3f21a3ad096b..697f0aa794b960a663b15ee09e161f86890119ab 100644 (file)
@@ -3,7 +3,8 @@
 #include <linux/pci.h>
 #include <linux/cache.h>
 #include <linux/module.h>
-#include <asm/dma-mapping.h>
+#include <linux/dma-mapping.h>
+
 #include <asm/proto.h>
 #include <asm/swiotlb.h>
 #include <asm/dma.h>
index 1c255ee76e7c81870768f54adc9a5fe149dc0239..7ea3bf2a858c6299c1c686fc0530b1da14bbef63 100644 (file)
@@ -415,16 +415,16 @@ void main_timer_handler(struct pt_regs *regs)
                                (((long) offset << US_SCALE) / vxtime.tsc_quot) - 1;
        }
 
-       if (lost > 0) {
+       if (lost > 0)
                handle_lost_ticks(lost, regs);
-               jiffies += lost;
-       }
+       else
+               lost = 0;
 
 /*
  * Do the timer stuff.
  */
 
-       do_timer(regs);
+       do_timer(lost + 1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 1a17b0733ab5d38ad81ccdf4263e2d58571d9e24..3751b4788e288748112c05df0121a1186aac5fab 100644 (file)
@@ -244,7 +244,7 @@ static int is_errata93(struct pt_regs *regs, unsigned long address)
 
 int unhandled_signal(struct task_struct *tsk, int sig)
 {
-       if (tsk->pid == 1)
+       if (is_init(tsk))
                return 1;
        if (tsk->ptrace & PT_PTRACED)
                return 0;
@@ -464,7 +464,7 @@ good_area:
                case PF_PROT:           /* read, present */
                        goto bad_area;
                case 0:                 /* read, not present */
-                       if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+                       if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                                goto bad_area;
        }
 
@@ -580,7 +580,7 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) { 
+       if (is_init(current)) {
                yield();
                goto again;
        }
index 412ab32de391788de830fe5786adffe2ac3ca854..241db201f40e59300bb97691bdcc4b2608c80c23 100644 (file)
@@ -175,7 +175,7 @@ again:
 
                last_ccount_stamp = next;
                next += CCOUNT_PER_JIFFY;
-               do_timer (regs); /* Linux handler in kernel/timer.c */
+               do_timer (1); /* Linux handler in kernel/timer.c */
 
                if (ntp_synced() &&
                    xtime.tv_sec - last_rtc_update >= 659 &&
index a945a33e85a129d0e268b1e20cf9a54710ec93c6..dd0dbec2e57e4f39b51ab7a73359a0117e638b48 100644 (file)
@@ -144,7 +144,7 @@ bad_area:
         */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
index d96164e602fea496c7b33b35d4e685261eef7647..15d64414bd6018e2394d3485ec6070730614eb5a 100644 (file)
@@ -201,7 +201,7 @@ static void dev_ip_addr(void *d, char *buf, char *bin_buf)
        struct net_device *dev = d;
        struct in_device *ip = dev->ip_ptr;
        struct in_ifaddr *in;
-       u32 addr;
+       __be32 addr;
 
        if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) {
                printk(KERN_WARNING "Device not assigned an IP address!\n");
index 2b4ef2b89b8d74b376a2011b5455039fd3730e20..8ff33441d8a214259bd2c718ddb4735874dd2fc5 100644 (file)
@@ -450,8 +450,10 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
  **/
 void blk_trace_shutdown(request_queue_t *q)
 {
-       blk_trace_startstop(q, 0);
-       blk_trace_remove(q);
+       if (q->blk_trace) {
+               blk_trace_startstop(q, 0);
+               blk_trace_remove(q);
+       }
 }
 
 /*
index 25d1f42568cc19714a2f8a5469ecd2842e9ea7e5..653919d50cd4d06aea68d8e027d15a473e5b4f5a 100644 (file)
@@ -295,10 +295,15 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
 
 static int __init genhd_device_init(void)
 {
+       int err;
+
        bdev_map = kobj_map_init(base_probe, &block_subsys_lock);
        blk_dev_init();
-       subsystem_register(&block_subsys);
-       return 0;
+       err = subsystem_register(&block_subsys);
+       if (err < 0)
+               printk(KERN_WARNING "%s: subsystem_register error: %d\n",
+                       __FUNCTION__, err);
+       return err;
 }
 
 subsys_initcall(genhd_device_init);
index 9c3a06bcb7ba97b02d12de6638944ac79e33baa2..51dc0edf76e0281f52e53da15576e4ffa62b0eab 100644 (file)
@@ -1847,8 +1847,7 @@ static void blk_release_queue(struct kobject *kobj)
        if (q->queue_tags)
                __blk_queue_free_tags(q);
 
-       if (q->blk_trace)
-               blk_trace_shutdown(q);
+       blk_trace_shutdown(q);
 
        kmem_cache_free(requestq_cachep, q);
 }
index b06b0e2b9c62b536a321d12295988af5801012b3..b32b77ff2dcd7c1814c66318a477b74840b88e2f 100644 (file)
@@ -228,7 +228,7 @@ error:
 
 /**
  * class_destroy - destroys a struct class structure
- * @cs: pointer to the struct class that is to be destroyed
+ * @cls: pointer to the struct class that is to be destroyed
  *
  * Note, the pointer to be destroyed must have been created with a call
  * to class_create().
@@ -658,9 +658,9 @@ int class_device_register(struct class_device *class_dev)
 
 /**
  * class_device_create - creates a class device and registers it with sysfs
- * @cs: pointer to the struct class that this device should be registered to.
+ * @cls: pointer to the struct class that this device should be registered to.
  * @parent: pointer to the parent struct class_device of this new device, if any.
- * @dev: the dev_t for the char device to be added.
+ * @devt: the dev_t for the char device to be added.
  * @device: a pointer to a struct device that is assiociated with this class device.
  * @fmt: string for the class device's name
  *
@@ -766,7 +766,7 @@ void class_device_unregister(struct class_device *class_dev)
 /**
  * class_device_destroy - removes a class device that was created with class_device_create()
  * @cls: the pointer to the struct class that this device was registered * with.
- * @dev: the dev_t of the device that was previously registered.
+ * @devt: the dev_t of the device that was previously registered.
  *
  * This call unregisters and cleans up a class device that was created with a
  * call to class_device_create()
index 77bf8826e2f97b9d19cfaad6457df1371e660262..14615694ae9aa3e707435f2f04a1c6dde4586c5c 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
 #include <linux/mutex.h>
+#include <linux/kthread.h>
 
 #include <linux/firmware.h>
 #include "base.h"
@@ -511,7 +512,6 @@ request_firmware_work_func(void *arg)
                WARN_ON(1);
                return 0;
        }
-       daemonize("%s/%s", "firmware", fw_work->name);
        ret = _request_firmware(&fw, fw_work->name, fw_work->device,
                fw_work->uevent);
        if (ret < 0)
@@ -546,9 +546,9 @@ request_firmware_nowait(
        const char *name, struct device *device, void *context,
        void (*cont)(const struct firmware *fw, void *context))
 {
+       struct task_struct *task;
        struct firmware_work *fw_work = kmalloc(sizeof (struct firmware_work),
                                                GFP_ATOMIC);
-       int ret;
 
        if (!fw_work)
                return -ENOMEM;
@@ -566,14 +566,14 @@ request_firmware_nowait(
                .uevent = uevent,
        };
 
-       ret = kernel_thread(request_firmware_work_func, fw_work,
-                           CLONE_FS | CLONE_FILES);
+       task = kthread_run(request_firmware_work_func, fw_work,
+                           "firmware/%s", name);
 
-       if (ret < 0) {
+       if (IS_ERR(task)) {
                fw_work->cont(NULL, fw_work->context);
                module_put(fw_work->module);
                kfree(fw_work);
-               return ret;
+               return PTR_ERR(task);
        }
        return 0;
 }
index c774121684d7f8951ff8b0acafef0e74ce11e23d..68b0471ad5a64e52a2b53135ab58523507fb700d 100644 (file)
@@ -72,6 +72,7 @@
 #include <linux/completion.h>
 #include <linux/highmem.h>
 #include <linux/gfp.h>
+#include <linux/kthread.h>
 
 #include <asm/uaccess.h>
 
@@ -522,15 +523,12 @@ static int loop_make_request(request_queue_t *q, struct bio *old_bio)
                goto out;
        if (unlikely(rw == WRITE && (lo->lo_flags & LO_FLAGS_READ_ONLY)))
                goto out;
-       lo->lo_pending++;
        loop_add_bio(lo, old_bio);
+       wake_up(&lo->lo_event);
        spin_unlock_irq(&lo->lo_lock);
-       complete(&lo->lo_bh_done);
        return 0;
 
 out:
-       if (lo->lo_pending == 0)
-               complete(&lo->lo_bh_done);
        spin_unlock_irq(&lo->lo_lock);
        bio_io_error(old_bio, old_bio->bi_size);
        return 0;
@@ -570,14 +568,18 @@ static inline void loop_handle_bio(struct loop_device *lo, struct bio *bio)
  * to avoid blocking in our make_request_fn. it also does loop decrypting
  * on reads for block backed loop, as that is too heavy to do from
  * b_end_io context where irqs may be disabled.
+ *
+ * Loop explanation:  loop_clr_fd() sets lo_state to Lo_rundown before
+ * calling kthread_stop().  Therefore once kthread_should_stop() is
+ * true, make_request will not place any more requests.  Therefore
+ * once kthread_should_stop() is true and lo_bio is NULL, we are
+ * done with the loop.
  */
 static int loop_thread(void *data)
 {
        struct loop_device *lo = data;
        struct bio *bio;
 
-       daemonize("loop%d", lo->lo_number);
-
        /*
         * loop can be used in an encrypted device,
         * hence, it mustn't be stopped at all
@@ -587,47 +589,21 @@ static int loop_thread(void *data)
 
        set_user_nice(current, -20);
 
-       lo->lo_state = Lo_bound;
-       lo->lo_pending = 1;
+       while (!kthread_should_stop() || lo->lo_bio) {
 
-       /*
-        * complete it, we are running
-        */
-       complete(&lo->lo_done);
-
-       for (;;) {
-               int pending;
+               wait_event_interruptible(lo->lo_event,
+                               lo->lo_bio || kthread_should_stop());
 
-               if (wait_for_completion_interruptible(&lo->lo_bh_done))
+               if (!lo->lo_bio)
                        continue;
-
                spin_lock_irq(&lo->lo_lock);
-
-               /*
-                * could be completed because of tear-down, not pending work
-                */
-               if (unlikely(!lo->lo_pending)) {
-                       spin_unlock_irq(&lo->lo_lock);
-                       break;
-               }
-
                bio = loop_get_bio(lo);
-               lo->lo_pending--;
-               pending = lo->lo_pending;
                spin_unlock_irq(&lo->lo_lock);
 
                BUG_ON(!bio);
                loop_handle_bio(lo, bio);
-
-               /*
-                * upped both for pending work and tear-down, lo_pending
-                * will hit zero then
-                */
-               if (unlikely(!pending))
-                       break;
        }
 
-       complete(&lo->lo_done);
        return 0;
 }
 
@@ -840,12 +816,26 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
 
        set_blocksize(bdev, lo_blocksize);
 
-       error = kernel_thread(loop_thread, lo, CLONE_KERNEL);
-       if (error < 0)
-               goto out_putf;
-       wait_for_completion(&lo->lo_done);
+       lo->lo_thread = kthread_create(loop_thread, lo, "loop%d",
+                                               lo->lo_number);
+       if (IS_ERR(lo->lo_thread)) {
+               error = PTR_ERR(lo->lo_thread);
+               goto out_clr;
+       }
+       lo->lo_state = Lo_bound;
+       wake_up_process(lo->lo_thread);
        return 0;
 
+out_clr:
+       lo->lo_thread = NULL;
+       lo->lo_device = NULL;
+       lo->lo_backing_file = NULL;
+       lo->lo_flags = 0;
+       set_capacity(disks[lo->lo_number], 0);
+       invalidate_bdev(bdev, 0);
+       bd_set_size(bdev, 0);
+       mapping_set_gfp_mask(mapping, lo->old_gfp_mask);
+       lo->lo_state = Lo_unbound;
  out_putf:
        fput(file);
  out:
@@ -907,12 +897,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
 
        spin_lock_irq(&lo->lo_lock);
        lo->lo_state = Lo_rundown;
-       lo->lo_pending--;
-       if (!lo->lo_pending)
-               complete(&lo->lo_bh_done);
        spin_unlock_irq(&lo->lo_lock);
 
-       wait_for_completion(&lo->lo_done);
+       kthread_stop(lo->lo_thread);
 
        lo->lo_backing_file = NULL;
 
@@ -925,6 +912,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
        lo->lo_sizelimit = 0;
        lo->lo_encrypt_key_size = 0;
        lo->lo_flags = 0;
+       lo->lo_thread = NULL;
        memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
        memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
        memset(lo->lo_file_name, 0, LO_NAME_SIZE);
@@ -1287,9 +1275,9 @@ static int __init loop_init(void)
                if (!lo->lo_queue)
                        goto out_mem4;
                mutex_init(&lo->lo_ctl_mutex);
-               init_completion(&lo->lo_done);
-               init_completion(&lo->lo_bh_done);
                lo->lo_number = i;
+               lo->lo_thread = NULL;
+               init_waitqueue_head(&lo->lo_event);
                spin_lock_init(&lo->lo_lock);
                disk->major = LOOP_MAJOR;
                disk->first_minor = i;
index 23f96213f4acad7e9c5f72b51e1e392e22a208c8..efcc28ec9d9a2a1b719fc8e5a5e87d527a71ab20 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  AVM BlueFRITZ! USB driver
  *
- *  Copyright (C) 2003  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2003-2006  Marcel Holtmann <marcel@holtmann.org>
  *
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -59,7 +59,6 @@ static struct usb_device_id bfusb_table[] = {
 
 MODULE_DEVICE_TABLE(usb, bfusb_table);
 
-
 #define BFUSB_MAX_BLOCK_SIZE   256
 
 #define BFUSB_BLOCK_TIMEOUT    3000
@@ -70,7 +69,7 @@ MODULE_DEVICE_TABLE(usb, bfusb_table);
 #define BFUSB_MAX_BULK_TX      2
 #define BFUSB_MAX_BULK_RX      2
 
-struct bfusb {
+struct bfusb_data {
        struct hci_dev          *hdev;
 
        unsigned long           state;
@@ -92,137 +91,136 @@ struct bfusb {
        struct sk_buff_head     completed_q;
 };
 
-struct bfusb_scb {
+struct bfusb_data_scb {
        struct urb *urb;
 };
 
 static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs);
 static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs);
 
-static struct urb *bfusb_get_completed(struct bfusb *bfusb)
+static struct urb *bfusb_get_completed(struct bfusb_data *data)
 {
        struct sk_buff *skb;
        struct urb *urb = NULL;
 
-       BT_DBG("bfusb %p", bfusb);
+       BT_DBG("bfusb %p", data);
 
-       skb = skb_dequeue(&bfusb->completed_q);
+       skb = skb_dequeue(&data->completed_q);
        if (skb) {
-               urb = ((struct bfusb_scb *) skb->cb)->urb;
+               urb = ((struct bfusb_data_scb *) skb->cb)->urb;
                kfree_skb(skb);
        }
 
        return urb;
 }
 
-static void bfusb_unlink_urbs(struct bfusb *bfusb)
+static void bfusb_unlink_urbs(struct bfusb_data *data)
 {
        struct sk_buff *skb;
        struct urb *urb;
 
-       BT_DBG("bfusb %p", bfusb);
+       BT_DBG("bfusb %p", data);
 
-       while ((skb = skb_dequeue(&bfusb->pending_q))) {
-               urb = ((struct bfusb_scb *) skb->cb)->urb;
+       while ((skb = skb_dequeue(&data->pending_q))) {
+               urb = ((struct bfusb_data_scb *) skb->cb)->urb;
                usb_kill_urb(urb);
-               skb_queue_tail(&bfusb->completed_q, skb);
+               skb_queue_tail(&data->completed_q, skb);
        }
 
-       while ((urb = bfusb_get_completed(bfusb)))
+       while ((urb = bfusb_get_completed(data)))
                usb_free_urb(urb);
 }
 
-
-static int bfusb_send_bulk(struct bfusb *bfusb, struct sk_buff *skb)
+static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
 {
-       struct bfusb_scb *scb = (void *) skb->cb;
-       struct urb *urb = bfusb_get_completed(bfusb);
+       struct bfusb_data_scb *scb = (void *) skb->cb;
+       struct urb *urb = bfusb_get_completed(data);
        int err, pipe;
 
-       BT_DBG("bfusb %p skb %p len %d", bfusb, skb, skb->len);
+       BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
 
        if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
                return -ENOMEM;
 
-       pipe = usb_sndbulkpipe(bfusb->udev, bfusb->bulk_out_ep);
+       pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
 
-       usb_fill_bulk_urb(urb, bfusb->udev, pipe, skb->data, skb->len,
+       usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, skb->len,
                        bfusb_tx_complete, skb);
 
        scb->urb = urb;
 
-       skb_queue_tail(&bfusb->pending_q, skb);
+       skb_queue_tail(&data->pending_q, skb);
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
                BT_ERR("%s bulk tx submit failed urb %p err %d", 
-                                       bfusb->hdev->name, urb, err);
-               skb_unlink(skb, &bfusb->pending_q);
+                                       data->hdev->name, urb, err);
+               skb_unlink(skb, &data->pending_q);
                usb_free_urb(urb);
        } else
-               atomic_inc(&bfusb->pending_tx);
+               atomic_inc(&data->pending_tx);
 
        return err;
 }
 
-static void bfusb_tx_wakeup(struct bfusb *bfusb)
+static void bfusb_tx_wakeup(struct bfusb_data *data)
 {
        struct sk_buff *skb;
 
-       BT_DBG("bfusb %p", bfusb);
+       BT_DBG("bfusb %p", data);
 
-       if (test_and_set_bit(BFUSB_TX_PROCESS, &bfusb->state)) {
-               set_bit(BFUSB_TX_WAKEUP, &bfusb->state);
+       if (test_and_set_bit(BFUSB_TX_PROCESS, &data->state)) {
+               set_bit(BFUSB_TX_WAKEUP, &data->state);
                return;
        }
 
        do {
-               clear_bit(BFUSB_TX_WAKEUP, &bfusb->state);
+               clear_bit(BFUSB_TX_WAKEUP, &data->state);
 
-               while ((atomic_read(&bfusb->pending_tx) < BFUSB_MAX_BULK_TX) &&
-                               (skb = skb_dequeue(&bfusb->transmit_q))) {
-                       if (bfusb_send_bulk(bfusb, skb) < 0) {
-                               skb_queue_head(&bfusb->transmit_q, skb);
+               while ((atomic_read(&data->pending_tx) < BFUSB_MAX_BULK_TX) &&
+                               (skb = skb_dequeue(&data->transmit_q))) {
+                       if (bfusb_send_bulk(data, skb) < 0) {
+                               skb_queue_head(&data->transmit_q, skb);
                                break;
                        }
                }
 
-       } while (test_bit(BFUSB_TX_WAKEUP, &bfusb->state));
+       } while (test_bit(BFUSB_TX_WAKEUP, &data->state));
 
-       clear_bit(BFUSB_TX_PROCESS, &bfusb->state);
+       clear_bit(BFUSB_TX_PROCESS, &data->state);
 }
 
 static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs)
 {
        struct sk_buff *skb = (struct sk_buff *) urb->context;
-       struct bfusb *bfusb = (struct bfusb *) skb->dev;
+       struct bfusb_data *data = (struct bfusb_data *) skb->dev;
 
-       BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len);
+       BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len);
 
-       atomic_dec(&bfusb->pending_tx);
+       atomic_dec(&data->pending_tx);
 
-       if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
+       if (!test_bit(HCI_RUNNING, &data->hdev->flags))
                return;
 
        if (!urb->status)
-               bfusb->hdev->stat.byte_tx += skb->len;
+               data->hdev->stat.byte_tx += skb->len;
        else
-               bfusb->hdev->stat.err_tx++;
+               data->hdev->stat.err_tx++;
 
-       read_lock(&bfusb->lock);
+       read_lock(&data->lock);
 
-       skb_unlink(skb, &bfusb->pending_q);
-       skb_queue_tail(&bfusb->completed_q, skb);
+       skb_unlink(skb, &data->pending_q);
+       skb_queue_tail(&data->completed_q, skb);
 
-       bfusb_tx_wakeup(bfusb);
+       bfusb_tx_wakeup(data);
 
-       read_unlock(&bfusb->lock);
+       read_unlock(&data->lock);
 }
 
 
-static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb)
+static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
 {
-       struct bfusb_scb *scb;
+       struct bfusb_data_scb *scb;
        struct sk_buff *skb;
        int err, pipe, size = HCI_MAX_FRAME_SIZE + 32;
 
@@ -231,28 +229,29 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb)
        if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
                return -ENOMEM;
 
-       if (!(skb = bt_skb_alloc(size, GFP_ATOMIC))) {
+       skb = bt_skb_alloc(size, GFP_ATOMIC);
+       if (!skb) {
                usb_free_urb(urb);
                return -ENOMEM;
        }
 
-       skb->dev = (void *) bfusb;
+       skb->dev = (void *) data;
 
-       scb = (struct bfusb_scb *) skb->cb;
+       scb = (struct bfusb_data_scb *) skb->cb;
        scb->urb = urb;
 
-       pipe = usb_rcvbulkpipe(bfusb->udev, bfusb->bulk_in_ep);
+       pipe = usb_rcvbulkpipe(data->udev, data->bulk_in_ep);
 
-       usb_fill_bulk_urb(urb, bfusb->udev, pipe, skb->data, size,
+       usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, size,
                        bfusb_rx_complete, skb);
 
-       skb_queue_tail(&bfusb->pending_q, skb);
+       skb_queue_tail(&data->pending_q, skb);
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
                BT_ERR("%s bulk rx submit failed urb %p err %d",
-                                       bfusb->hdev->name, urb, err);
-               skb_unlink(skb, &bfusb->pending_q);
+                                       data->hdev->name, urb, err);
+               skb_unlink(skb, &data->pending_q);
                kfree_skb(skb);
                usb_free_urb(urb);
        }
@@ -260,15 +259,15 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb)
        return err;
 }
 
-static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *data, int len)
+static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned char *buf, int len)
 {
-       BT_DBG("bfusb %p hdr 0x%02x data %p len %d", bfusb, hdr, data, len);
+       BT_DBG("bfusb %p hdr 0x%02x data %p len %d", data, hdr, buf, len);
 
        if (hdr & 0x10) {
-               BT_ERR("%s error in block", bfusb->hdev->name);
-               if (bfusb->reassembly)
-                       kfree_skb(bfusb->reassembly);
-               bfusb->reassembly = NULL;
+               BT_ERR("%s error in block", data->hdev->name);
+               if (data->reassembly)
+                       kfree_skb(data->reassembly);
+               data->reassembly = NULL;
                return -EIO;
        }
 
@@ -277,46 +276,46 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
                unsigned char pkt_type;
                int pkt_len = 0;
 
-               if (bfusb->reassembly) {
-                       BT_ERR("%s unexpected start block", bfusb->hdev->name);
-                       kfree_skb(bfusb->reassembly);
-                       bfusb->reassembly = NULL;
+               if (data->reassembly) {
+                       BT_ERR("%s unexpected start block", data->hdev->name);
+                       kfree_skb(data->reassembly);
+                       data->reassembly = NULL;
                }
 
                if (len < 1) {
-                       BT_ERR("%s no packet type found", bfusb->hdev->name);
+                       BT_ERR("%s no packet type found", data->hdev->name);
                        return -EPROTO;
                }
 
-               pkt_type = *data++; len--;
+               pkt_type = *buf++; len--;
 
                switch (pkt_type) {
                case HCI_EVENT_PKT:
                        if (len >= HCI_EVENT_HDR_SIZE) {
-                               struct hci_event_hdr *hdr = (struct hci_event_hdr *) data;
+                               struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
                                pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
                        } else {
-                               BT_ERR("%s event block is too short", bfusb->hdev->name);
+                               BT_ERR("%s event block is too short", data->hdev->name);
                                return -EILSEQ;
                        }
                        break;
 
                case HCI_ACLDATA_PKT:
                        if (len >= HCI_ACL_HDR_SIZE) {
-                               struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) data;
+                               struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
                                pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
                        } else {
-                               BT_ERR("%s data block is too short", bfusb->hdev->name);
+                               BT_ERR("%s data block is too short", data->hdev->name);
                                return -EILSEQ;
                        }
                        break;
 
                case HCI_SCODATA_PKT:
                        if (len >= HCI_SCO_HDR_SIZE) {
-                               struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) data;
+                               struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
                                pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
                        } else {
-                               BT_ERR("%s audio block is too short", bfusb->hdev->name);
+                               BT_ERR("%s audio block is too short", data->hdev->name);
                                return -EILSEQ;
                        }
                        break;
@@ -324,27 +323,27 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
 
                skb = bt_skb_alloc(pkt_len, GFP_ATOMIC);
                if (!skb) {
-                       BT_ERR("%s no memory for the packet", bfusb->hdev->name);
+                       BT_ERR("%s no memory for the packet", data->hdev->name);
                        return -ENOMEM;
                }
 
-               skb->dev = (void *) bfusb->hdev;
+               skb->dev = (void *) data->hdev;
                bt_cb(skb)->pkt_type = pkt_type;
 
-               bfusb->reassembly = skb;
+               data->reassembly = skb;
        } else {
-               if (!bfusb->reassembly) {
-                       BT_ERR("%s unexpected continuation block", bfusb->hdev->name);
+               if (!data->reassembly) {
+                       BT_ERR("%s unexpected continuation block", data->hdev->name);
                        return -EIO;
                }
        }
 
        if (len > 0)
-               memcpy(skb_put(bfusb->reassembly, len), data, len);
+               memcpy(skb_put(data->reassembly, len), buf, len);
 
        if (hdr & 0x08) {
-               hci_recv_frame(bfusb->reassembly);
-               bfusb->reassembly = NULL;
+               hci_recv_frame(data->reassembly);
+               data->reassembly = NULL;
        }
 
        return 0;
@@ -353,22 +352,22 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
 static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
 {
        struct sk_buff *skb = (struct sk_buff *) urb->context;
-       struct bfusb *bfusb = (struct bfusb *) skb->dev;
+       struct bfusb_data *data = (struct bfusb_data *) skb->dev;
        unsigned char *buf = urb->transfer_buffer;
        int count = urb->actual_length;
        int err, hdr, len;
 
        BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len);
 
-       read_lock(&bfusb->lock);
+       read_lock(&data->lock);
 
-       if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
+       if (!test_bit(HCI_RUNNING, &data->hdev->flags))
                goto unlock;
 
        if (urb->status || !count)
                goto resubmit;
 
-       bfusb->hdev->stat.byte_rx += count;
+       data->hdev->stat.byte_rx += count;
 
        skb_put(skb, count);
 
@@ -387,90 +386,89 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
 
                if (count < len) {
                        BT_ERR("%s block extends over URB buffer ranges",
-                                       bfusb->hdev->name);
+                                       data->hdev->name);
                }
 
                if ((hdr & 0xe1) == 0xc1)
-                       bfusb_recv_block(bfusb, hdr, buf, len);
+                       bfusb_recv_block(data, hdr, buf, len);
 
                count -= len;
                buf   += len;
        }
 
-       skb_unlink(skb, &bfusb->pending_q);
+       skb_unlink(skb, &data->pending_q);
        kfree_skb(skb);
 
-       bfusb_rx_submit(bfusb, urb);
+       bfusb_rx_submit(data, urb);
 
-       read_unlock(&bfusb->lock);
+       read_unlock(&data->lock);
 
        return;
 
 resubmit:
-       urb->dev = bfusb->udev;
+       urb->dev = data->udev;
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
                BT_ERR("%s bulk resubmit failed urb %p err %d",
-                                       bfusb->hdev->name, urb, err);
+                                       data->hdev->name, urb, err);
        }
 
 unlock:
-       read_unlock(&bfusb->lock);
+       read_unlock(&data->lock);
 }
 
-
 static int bfusb_open(struct hci_dev *hdev)
 {
-       struct bfusb *bfusb = (struct bfusb *) hdev->driver_data;
+       struct bfusb_data *data = hdev->driver_data;
        unsigned long flags;
        int i, err;
 
-       BT_DBG("hdev %p bfusb %p", hdev, bfusb);
+       BT_DBG("hdev %p bfusb %p", hdev, data);
 
        if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
                return 0;
 
-       write_lock_irqsave(&bfusb->lock, flags);
+       write_lock_irqsave(&data->lock, flags);
 
-       err = bfusb_rx_submit(bfusb, NULL);
+       err = bfusb_rx_submit(data, NULL);
        if (!err) {
                for (i = 1; i < BFUSB_MAX_BULK_RX; i++)
-                       bfusb_rx_submit(bfusb, NULL);
+                       bfusb_rx_submit(data, NULL);
        } else {
                clear_bit(HCI_RUNNING, &hdev->flags);
        }
 
-       write_unlock_irqrestore(&bfusb->lock, flags);
+       write_unlock_irqrestore(&data->lock, flags);
 
        return err;
 }
 
 static int bfusb_flush(struct hci_dev *hdev)
 {
-       struct bfusb *bfusb = (struct bfusb *) hdev->driver_data;
+       struct bfusb_data *data = hdev->driver_data;
 
-       BT_DBG("hdev %p bfusb %p", hdev, bfusb);
+       BT_DBG("hdev %p bfusb %p", hdev, data);
 
-       skb_queue_purge(&bfusb->transmit_q);
+       skb_queue_purge(&data->transmit_q);
 
        return 0;
 }
 
 static int bfusb_close(struct hci_dev *hdev)
 {
-       struct bfusb *bfusb = (struct bfusb *) hdev->driver_data;
+       struct bfusb_data *data = hdev->driver_data;
        unsigned long flags;
 
-       BT_DBG("hdev %p bfusb %p", hdev, bfusb);
+       BT_DBG("hdev %p bfusb %p", hdev, data);
 
        if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
                return 0;
 
-       write_lock_irqsave(&bfusb->lock, flags);
-       write_unlock_irqrestore(&bfusb->lock, flags);
+       write_lock_irqsave(&data->lock, flags);
+       write_unlock_irqrestore(&data->lock, flags);
 
-       bfusb_unlink_urbs(bfusb);
+       bfusb_unlink_urbs(data);
        bfusb_flush(hdev);
 
        return 0;
@@ -479,7 +477,7 @@ static int bfusb_close(struct hci_dev *hdev)
 static int bfusb_send_frame(struct sk_buff *skb)
 {
        struct hci_dev *hdev = (struct hci_dev *) skb->dev;
-       struct bfusb *bfusb;
+       struct bfusb_data *data;
        struct sk_buff *nskb;
        unsigned char buf[3];
        int sent = 0, size, count;
@@ -494,7 +492,7 @@ static int bfusb_send_frame(struct sk_buff *skb)
        if (!test_bit(HCI_RUNNING, &hdev->flags))
                return -EBUSY;
 
-       bfusb = (struct bfusb *) hdev->driver_data;
+       data = hdev->driver_data;
 
        switch (bt_cb(skb)->pkt_type) {
        case HCI_COMMAND_PKT:
@@ -514,12 +512,13 @@ static int bfusb_send_frame(struct sk_buff *skb)
        count = skb->len;
 
        /* Max HCI frame size seems to be 1511 + 1 */
-       if (!(nskb = bt_skb_alloc(count + 32, GFP_ATOMIC))) {
+       nskb = bt_skb_alloc(count + 32, GFP_ATOMIC);
+       if (!nskb) {
                BT_ERR("Can't allocate memory for new packet");
                return -ENOMEM;
        }
 
-       nskb->dev = (void *) bfusb;
+       nskb->dev = (void *) data;
 
        while (count) {
                size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE);
@@ -536,18 +535,18 @@ static int bfusb_send_frame(struct sk_buff *skb)
        }
 
        /* Don't send frame with multiple size of bulk max packet */
-       if ((nskb->len % bfusb->bulk_pkt_size) == 0) {
+       if ((nskb->len % data->bulk_pkt_size) == 0) {
                buf[0] = 0xdd;
                buf[1] = 0x00;
                memcpy(skb_put(nskb, 2), buf, 2);
        }
 
-       read_lock(&bfusb->lock);
+       read_lock(&data->lock);
 
-       skb_queue_tail(&bfusb->transmit_q, nskb);
-       bfusb_tx_wakeup(bfusb);
+       skb_queue_tail(&data->transmit_q, nskb);
+       bfusb_tx_wakeup(data);
 
-       read_unlock(&bfusb->lock);
+       read_unlock(&data->lock);
 
        kfree_skb(skb);
 
@@ -556,11 +555,11 @@ static int bfusb_send_frame(struct sk_buff *skb)
 
 static void bfusb_destruct(struct hci_dev *hdev)
 {
-       struct bfusb *bfusb = (struct bfusb *) hdev->driver_data;
+       struct bfusb_data *data = hdev->driver_data;
 
-       BT_DBG("hdev %p bfusb %p", hdev, bfusb);
+       BT_DBG("hdev %p bfusb %p", hdev, data);
 
-       kfree(bfusb);
+       kfree(data);
 }
 
 static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
@@ -568,25 +567,24 @@ static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg
        return -ENOIOCTLCMD;
 }
 
-
-static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int count)
+static int bfusb_load_firmware(struct bfusb_data *data, unsigned char *firmware, int count)
 {
        unsigned char *buf;
        int err, pipe, len, size, sent = 0;
 
-       BT_DBG("bfusb %p udev %p", bfusb, bfusb->udev);
+       BT_DBG("bfusb %p udev %p", data, data->udev);
 
        BT_INFO("BlueFRITZ! USB loading firmware");
 
-       pipe = usb_sndctrlpipe(bfusb->udev, 0);
+       pipe = usb_sndctrlpipe(data->udev, 0);
 
-       if (usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
+       if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION,
                                0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) {
                BT_ERR("Can't change to loading configuration");
                return -EBUSY;
        }
 
-       bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;
+       data->udev->toggle[0] = data->udev->toggle[1] = 0;
 
        buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
        if (!buf) {
@@ -594,14 +592,14 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int
                return -ENOMEM;
        }
 
-       pipe = usb_sndbulkpipe(bfusb->udev, bfusb->bulk_out_ep);
+       pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
 
        while (count) {
                size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE + 3);
 
                memcpy(buf, firmware + sent, size);
 
-               err = usb_bulk_msg(bfusb->udev, pipe, buf, size,
+               err = usb_bulk_msg(data->udev, pipe, buf, size,
                                        &len, BFUSB_BLOCK_TIMEOUT);
 
                if (err || (len != size)) {
@@ -613,21 +611,23 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int
                count -= size;
        }
 
-       if ((err = usb_bulk_msg(bfusb->udev, pipe, NULL, 0,
-                               &len, BFUSB_BLOCK_TIMEOUT)) < 0) {
+       err = usb_bulk_msg(data->udev, pipe, NULL, 0,
+                                       &len, BFUSB_BLOCK_TIMEOUT);
+       if (err < 0) {
                BT_ERR("Error in null packet request");
                goto error;
        }
 
-       pipe = usb_sndctrlpipe(bfusb->udev, 0);
+       pipe = usb_sndctrlpipe(data->udev, 0);
 
-        if ((err = usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
-                               0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0) {
+       err = usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION,
+                               0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
+       if (err < 0) {
                BT_ERR("Can't change to running configuration");
                goto error;
        }
 
-       bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;
+       data->udev->toggle[0] = data->udev->toggle[1] = 0;
 
        BT_INFO("BlueFRITZ! USB device ready");
 
@@ -637,9 +637,9 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int
 error:
        kfree(buf);
 
-       pipe = usb_sndctrlpipe(bfusb->udev, 0);
+       pipe = usb_sndctrlpipe(data->udev, 0);
 
-       usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
+       usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION,
                                0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
 
        return err;
@@ -652,7 +652,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
        struct usb_host_endpoint *bulk_out_ep;
        struct usb_host_endpoint *bulk_in_ep;
        struct hci_dev *hdev;
-       struct bfusb *bfusb;
+       struct bfusb_data *data;
 
        BT_DBG("intf %p id %p", intf, id);
 
@@ -672,23 +672,24 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
        }
 
        /* Initialize control structure and load firmware */
-       if (!(bfusb = kzalloc(sizeof(struct bfusb), GFP_KERNEL))) {
+       data = kzalloc(sizeof(struct bfusb_data), GFP_KERNEL);
+       if (!data) {
                BT_ERR("Can't allocate memory for control structure");
                goto done;
        }
 
-       bfusb->udev = udev;
-       bfusb->bulk_in_ep    = bulk_in_ep->desc.bEndpointAddress;
-       bfusb->bulk_out_ep   = bulk_out_ep->desc.bEndpointAddress;
-       bfusb->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize);
+       data->udev = udev;
+       data->bulk_in_ep    = bulk_in_ep->desc.bEndpointAddress;
+       data->bulk_out_ep   = bulk_out_ep->desc.bEndpointAddress;
+       data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize);
 
-       rwlock_init(&bfusb->lock);
+       rwlock_init(&data->lock);
 
-       bfusb->reassembly = NULL;
+       data->reassembly = NULL;
 
-       skb_queue_head_init(&bfusb->transmit_q);
-       skb_queue_head_init(&bfusb->pending_q);
-       skb_queue_head_init(&bfusb->completed_q);
+       skb_queue_head_init(&data->transmit_q);
+       skb_queue_head_init(&data->pending_q);
+       skb_queue_head_init(&data->completed_q);
 
        if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) {
                BT_ERR("Firmware request failed");
@@ -697,7 +698,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
 
        BT_DBG("firmware data %p size %d", firmware->data, firmware->size);
 
-       if (bfusb_load_firmware(bfusb, firmware->data, firmware->size) < 0) {
+       if (bfusb_load_firmware(data, firmware->data, firmware->size) < 0) {
                BT_ERR("Firmware loading failed");
                goto release;
        }
@@ -711,10 +712,10 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
                goto error;
        }
 
-       bfusb->hdev = hdev;
+       data->hdev = hdev;
 
        hdev->type = HCI_USB;
-       hdev->driver_data = bfusb;
+       hdev->driver_data = data;
        SET_HCIDEV_DEV(hdev, &intf->dev);
 
        hdev->open     = bfusb_open;
@@ -732,7 +733,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
                goto error;
        }
 
-       usb_set_intfdata(intf, bfusb);
+       usb_set_intfdata(intf, data);
 
        return 0;
 
@@ -740,7 +741,7 @@ release:
        release_firmware(firmware);
 
 error:
-       kfree(bfusb);
+       kfree(data);
 
 done:
        return -EIO;
@@ -748,8 +749,8 @@ done:
 
 static void bfusb_disconnect(struct usb_interface *intf)
 {
-       struct bfusb *bfusb = usb_get_intfdata(intf);
-       struct hci_dev *hdev = bfusb->hdev;
+       struct bfusb_data *data = usb_get_intfdata(intf);
+       struct hci_dev *hdev = data->hdev;
 
        BT_DBG("intf %p", intf);
 
@@ -779,7 +780,8 @@ static int __init bfusb_init(void)
 
        BT_INFO("BlueFRITZ! USB driver ver %s", VERSION);
 
-       if ((err = usb_register(&bfusb_driver)) < 0)
+       err = usb_register(&bfusb_driver);
+       if (err < 0)
                BT_ERR("Failed to register BlueFRITZ! USB driver");
 
        return err;
index 93ba25b7ea328303fad462372ddb575e69ea207e..420b645c4c9f0d20db0e5790e44a3c854890f6c8 100644 (file)
@@ -241,15 +241,11 @@ static int hci_uart_send_frame(struct sk_buff *skb)
 
 static void hci_uart_destruct(struct hci_dev *hdev)
 {
-       struct hci_uart *hu;
-
        if (!hdev)
                return;
 
        BT_DBG("%s", hdev->name);
-
-       hu = (struct hci_uart *) hdev->driver_data;
-       kfree(hu);
+       kfree(hdev->driver_data);
 }
 
 /* ------ LDISC part ------ */
@@ -272,7 +268,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
                return -EEXIST;
 
        if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
-               BT_ERR("Can't allocate controll structure");
+               BT_ERR("Can't allocate control structure");
                return -ENFILE;
        }
 
@@ -360,7 +356,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
  *     
  * Return Value:    None
  */
-static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char *flags, int count)
+static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count)
 {
        struct hci_uart *hu = (void *)tty->disc_data;
 
@@ -375,7 +371,8 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char
        hu->hdev->stat.byte_rx += count;
        spin_unlock(&hu->rx_lock);
 
-       if (test_and_clear_bit(TTY_THROTTLED,&tty->flags) && tty->driver->unthrottle)
+       if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) &&
+                                       tty->driver->unthrottle)
                tty->driver->unthrottle(tty);
 }
 
index e2d4beac74207c711bdafaf11399d0170d73d07b..0801af4ad2b9cab68ca22db8206e98031a090fb6 100644 (file)
@@ -96,6 +96,9 @@ static struct usb_device_id bluetooth_ids[] = {
        /* Ericsson with non-standard id */
        { USB_DEVICE(0x0bdb, 0x1002) },
 
+       /* Canyon CN-BTU1 with HID interfaces */
+       { USB_DEVICE(0x0c10, 0x0000), .driver_info = HCI_RESET },
+
        { }     /* Terminating entry */
 };
 
index aac67a3a6019958a5ad77347aa0dcc11c6609c99..a278d98a915126a2dac78c6d1865fc11d89181cf 100644 (file)
@@ -2,9 +2,9 @@
  *
  *  Bluetooth virtual HCI driver
  *
- *  Copyright (C) 2000-2001 Qualcomm Incorporated
- *  Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- *  Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2000-2001  Qualcomm Incorporated
+ *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
+ *  Copyright (C) 2004-200 Marcel Holtmann <marcel@holtmann.org>
  *
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -72,21 +72,21 @@ static int vhci_open_dev(struct hci_dev *hdev)
 
 static int vhci_close_dev(struct hci_dev *hdev)
 {
-       struct vhci_data *vhci = hdev->driver_data;
+       struct vhci_data *data = hdev->driver_data;
 
        if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
                return 0;
 
-       skb_queue_purge(&vhci->readq);
+       skb_queue_purge(&data->readq);
 
        return 0;
 }
 
 static int vhci_flush(struct hci_dev *hdev)
 {
-       struct vhci_data *vhci = hdev->driver_data;
+       struct vhci_data *data = hdev->driver_data;
 
-       skb_queue_purge(&vhci->readq);
+       skb_queue_purge(&data->readq);
 
        return 0;
 }
@@ -94,7 +94,7 @@ static int vhci_flush(struct hci_dev *hdev)
 static int vhci_send_frame(struct sk_buff *skb)
 {
        struct hci_dev* hdev = (struct hci_dev *) skb->dev;
-       struct vhci_data *vhci;
+       struct vhci_data *data;
 
        if (!hdev) {
                BT_ERR("Frame for unknown HCI device (hdev=NULL)");
@@ -104,15 +104,15 @@ static int vhci_send_frame(struct sk_buff *skb)
        if (!test_bit(HCI_RUNNING, &hdev->flags))
                return -EBUSY;
 
-       vhci = hdev->driver_data;
+       data = hdev->driver_data;
 
        memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
-       skb_queue_tail(&vhci->readq, skb);
+       skb_queue_tail(&data->readq, skb);
 
-       if (vhci->flags & VHCI_FASYNC)
-               kill_fasync(&vhci->fasync, SIGIO, POLL_IN);
+       if (data->flags & VHCI_FASYNC)
+               kill_fasync(&data->fasync, SIGIO, POLL_IN);
 
-       wake_up_interruptible(&vhci->read_wait);
+       wake_up_interruptible(&data->read_wait);
 
        return 0;
 }
@@ -122,7 +122,7 @@ static void vhci_destruct(struct hci_dev *hdev)
        kfree(hdev->driver_data);
 }
 
-static inline ssize_t vhci_get_user(struct vhci_data *vhci,
+static inline ssize_t vhci_get_user(struct vhci_data *data,
                                        const char __user *buf, size_t count)
 {
        struct sk_buff *skb;
@@ -139,7 +139,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *vhci,
                return -EFAULT;
        }
 
-       skb->dev = (void *) vhci->hdev;
+       skb->dev = (void *) data->hdev;
        bt_cb(skb)->pkt_type = *((__u8 *) skb->data);
        skb_pull(skb, 1);
 
@@ -148,7 +148,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *vhci,
        return count;
 }
 
-static inline ssize_t vhci_put_user(struct vhci_data *vhci,
+static inline ssize_t vhci_put_user(struct vhci_data *data,
                        struct sk_buff *skb, char __user *buf, int count)
 {
        char __user *ptr = buf;
@@ -161,42 +161,43 @@ static inline ssize_t vhci_put_user(struct vhci_data *vhci,
 
        total += len;
 
-       vhci->hdev->stat.byte_tx += len;
+       data->hdev->stat.byte_tx += len;
 
        switch (bt_cb(skb)->pkt_type) {
        case HCI_COMMAND_PKT:
-               vhci->hdev->stat.cmd_tx++;
+               data->hdev->stat.cmd_tx++;
                break;
 
        case HCI_ACLDATA_PKT:
-               vhci->hdev->stat.acl_tx++;
+               data->hdev->stat.acl_tx++;
                break;
 
        case HCI_SCODATA_PKT:
-               vhci->hdev->stat.cmd_tx++;
+               data->hdev->stat.cmd_tx++;
                break;
        };
 
        return total;
 }
 
-static loff_t vhci_llseek(struct file * file, loff_t offset, int origin)
+static loff_t vhci_llseek(struct file *file, loff_t offset, int origin)
 {
        return -ESPIPE;
 }
 
-static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, loff_t *pos)
+static ssize_t vhci_read(struct file *file,
+                               char __user *buf, size_t count, loff_t *pos)
 {
        DECLARE_WAITQUEUE(wait, current);
-       struct vhci_data *vhci = file->private_data;
+       struct vhci_data *data = file->private_data;
        struct sk_buff *skb;
        ssize_t ret = 0;
 
-       add_wait_queue(&vhci->read_wait, &wait);
+       add_wait_queue(&data->read_wait, &wait);
        while (count) {
                set_current_state(TASK_INTERRUPTIBLE);
 
-               skb = skb_dequeue(&vhci->readq);
+               skb = skb_dequeue(&data->readq);
                if (!skb) {
                        if (file->f_flags & O_NONBLOCK) {
                                ret = -EAGAIN;
@@ -213,7 +214,7 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo
                }
 
                if (access_ok(VERIFY_WRITE, buf, count))
-                       ret = vhci_put_user(vhci, skb, buf, count);
+                       ret = vhci_put_user(data, skb, buf, count);
                else
                        ret = -EFAULT;
 
@@ -221,7 +222,7 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo
                break;
        }
        set_current_state(TASK_RUNNING);
-       remove_wait_queue(&vhci->read_wait, &wait);
+       remove_wait_queue(&data->read_wait, &wait);
 
        return ret;
 }
@@ -229,21 +230,21 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo
 static ssize_t vhci_write(struct file *file,
                        const char __user *buf, size_t count, loff_t *pos)
 {
-       struct vhci_data *vhci = file->private_data;
+       struct vhci_data *data = file->private_data;
 
        if (!access_ok(VERIFY_READ, buf, count))
                return -EFAULT;
 
-       return vhci_get_user(vhci, buf, count);
+       return vhci_get_user(data, buf, count);
 }
 
 static unsigned int vhci_poll(struct file *file, poll_table *wait)
 {
-       struct vhci_data *vhci = file->private_data;
+       struct vhci_data *data = file->private_data;
 
-       poll_wait(file, &vhci->read_wait, wait);
+       poll_wait(file, &data->read_wait, wait);
 
-       if (!skb_queue_empty(&vhci->readq))
+       if (!skb_queue_empty(&data->readq))
                return POLLIN | POLLRDNORM;
 
        return POLLOUT | POLLWRNORM;
@@ -257,26 +258,26 @@ static int vhci_ioctl(struct inode *inode, struct file *file,
 
 static int vhci_open(struct inode *inode, struct file *file)
 {
-       struct vhci_data *vhci;
+       struct vhci_data *data;
        struct hci_dev *hdev;
 
-       vhci = kzalloc(sizeof(struct vhci_data), GFP_KERNEL);
-       if (!vhci)
+       data = kzalloc(sizeof(struct vhci_data), GFP_KERNEL);
+       if (!data)
                return -ENOMEM;
 
-       skb_queue_head_init(&vhci->readq);
-       init_waitqueue_head(&vhci->read_wait);
+       skb_queue_head_init(&data->readq);
+       init_waitqueue_head(&data->read_wait);
 
        hdev = hci_alloc_dev();
        if (!hdev) {
-               kfree(vhci);
+               kfree(data);
                return -ENOMEM;
        }
 
-       vhci->hdev = hdev;
+       data->hdev = hdev;
 
-       hdev->type = HCI_VHCI;
-       hdev->driver_data = vhci;
+       hdev->type = HCI_VIRTUAL;
+       hdev->driver_data = data;
 
        hdev->open     = vhci_open_dev;
        hdev->close    = vhci_close_dev;
@@ -288,20 +289,20 @@ static int vhci_open(struct inode *inode, struct file *file)
 
        if (hci_register_dev(hdev) < 0) {
                BT_ERR("Can't register HCI device");
-               kfree(vhci);
+               kfree(data);
                hci_free_dev(hdev);
                return -EBUSY;
        }
 
-       file->private_data = vhci;
+       file->private_data = data;
 
        return nonseekable_open(inode, file);
 }
 
 static int vhci_release(struct inode *inode, struct file *file)
 {
-       struct vhci_data *vhci = file->private_data;
-       struct hci_dev *hdev = vhci->hdev;
+       struct vhci_data *data = file->private_data;
+       struct hci_dev *hdev = data->hdev;
 
        if (hci_unregister_dev(hdev) < 0) {
                BT_ERR("Can't unregister HCI device %s", hdev->name);
@@ -316,17 +317,17 @@ static int vhci_release(struct inode *inode, struct file *file)
 
 static int vhci_fasync(int fd, struct file *file, int on)
 {
-       struct vhci_data *vhci = file->private_data;
+       struct vhci_data *data = file->private_data;
        int err;
 
-       err = fasync_helper(fd, file, on, &vhci->fasync);
+       err = fasync_helper(fd, file, on, &data->fasync);
        if (err < 0)
                return err;
 
        if (on)
-               vhci->flags |= VHCI_FASYNC;
+               data->flags |= VHCI_FASYNC;
        else
-               vhci->flags &= ~VHCI_FASYNC;
+               data->flags &= ~VHCI_FASYNC;
 
        return 0;
 }
index 1b21c3a911d954f571634e05fc6b6be2815f1592..4cc619edf42466e02f08079f186338a7eb7a5959 100644 (file)
@@ -831,14 +831,6 @@ config DS1302
          will get access to the real time clock (or hardware clock) built
          into your computer.
 
-config S3C2410_RTC
-       bool "S3C2410 RTC Driver"
-       depends on ARCH_S3C2410
-       help
-         RTC (Realtime Clock) driver for the clock inbuilt into the
-         Samsung S3C2410. This can provide periodic interrupt rates
-         from 1Hz to 64Hz for user programs, and wakeup from Alarm.
-
 config COBALT_LCD
        bool "Support for Cobalt LCD"
        depends on MIPS_COBALT
index b583d0cd9fbe207b00fc97abca82a2ecd15fa70f..19114df59bbdf72e973812808f66caaa65ca4df2 100644 (file)
@@ -69,7 +69,6 @@ obj-$(CONFIG_EFI_RTC)         += efirtc.o
 obj-$(CONFIG_SGI_DS1286)       += ds1286.o
 obj-$(CONFIG_SGI_IP27_RTC)     += ip27-rtc.o
 obj-$(CONFIG_DS1302)           += ds1302.o
-obj-$(CONFIG_S3C2410_RTC)      += s3c2410-rtc.o
 ifeq ($(CONFIG_GENERIC_NVRAM),y)
   obj-$(CONFIG_NVRAM)  += generic_nvram.o
 else
index 5e59c0b42731990818df9c713adb635f378ec236..4711d9b3a59545f870d769f4818f967923bf21a9 100644 (file)
@@ -746,11 +746,9 @@ void gs_set_termios (struct tty_struct * tty,
                gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp);
        }
 
-#if 0
        /* This is an optimization that is only allowed for dumb cards */
        /* Smart cards require knowledge of iflags and oflags too: that 
           might change hardware cooking mode.... */
-#endif
        if (old_termios) {
                if(   (tiosp->c_iflag == old_termios->c_iflag)
                   && (tiosp->c_oflag == old_termios->c_oflag)
@@ -774,14 +772,7 @@ void gs_set_termios (struct tty_struct * tty,
                if(!memcmp(tiosp->c_cc, old_termios->c_cc, NCC)) printk("c_cc changed\n");
        }
 
-       baudrate = tiosp->c_cflag & CBAUD;
-       if (baudrate & CBAUDEX) {
-               baudrate &= ~CBAUDEX;
-               if ((baudrate < 1) || (baudrate > 4))
-                       tiosp->c_cflag &= ~CBAUDEX;
-               else
-                       baudrate += 15;
-       }
+       baudrate = tty_get_baud_rate(tty);
 
        baudrate = gs_baudrates[baudrate];
        if ((tiosp->c_cflag & CBAUD) == B38400) {
index ccd7e7102234cf09cfda77bdb49db017389d197a..8efbc9c0e5450e53868af1117556c1b89db29270 100644 (file)
 #define INTEL_RNG_ADDR                         0xFFBC015F
 #define INTEL_RNG_ADDR_LEN                     3
 
+/*
+ * LPC bridge PCI config space registers
+ */
+#define FWH_DEC_EN1_REG_OLD                    0xe3
+#define FWH_DEC_EN1_REG_NEW                    0xd9 /* high byte of 16-bit register */
+#define FWH_F8_EN_MASK                         0x80
+
+#define BIOS_CNTL_REG_OLD                      0x4e
+#define BIOS_CNTL_REG_NEW                      0xdc
+#define BIOS_CNTL_WRITE_ENABLE_MASK            0x01
+#define BIOS_CNTL_LOCK_ENABLE_MASK             0x02
+
+/*
+ * Magic address at which Intel Firmware Hubs get accessed
+ */
+#define INTEL_FWH_ADDR                         0xffff0000
+#define INTEL_FWH_ADDR_LEN                     2
+
+/*
+ * Intel Firmware Hub command codes (write to any address inside the device)
+ */
+#define INTEL_FWH_RESET_CMD                    0xff /* aka READ_ARRAY */
+#define INTEL_FWH_READ_ID_CMD                  0x90
+
+/*
+ * Intel Firmware Hub Read ID command result addresses
+ */
+#define INTEL_FWH_MANUFACTURER_CODE_ADDRESS    0x000000
+#define INTEL_FWH_DEVICE_CODE_ADDRESS          0x000001
+
+/*
+ * Intel Firmware Hub Read ID command result values
+ */
+#define INTEL_FWH_MANUFACTURER_CODE            0x89
+#define INTEL_FWH_DEVICE_CODE_8M               0xac
+#define INTEL_FWH_DEVICE_CODE_4M               0xad
+
 /*
  * Data for PCI driver interface
  *
  * want to register another driver on the same PCI id.
  */
 static const struct pci_device_id pci_tbl[] = {
-       { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
-       { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
-       { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
-       { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
-       { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
-       { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
+/* AA
+       { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+       { 0x8086, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* AA */
+/* AB
+       { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+       { 0x8086, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* AB */
+/* ??
+       { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+/* BAM, CAM, DBM, FBM, GxM
+       { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+       { 0x8086, 0x244c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* BAM */
+       { 0x8086, 0x248c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CAM */
+       { 0x8086, 0x24cc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* DBM */
+       { 0x8086, 0x2641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* FBM */
+       { 0x8086, 0x27b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* GxM */
+       { 0x8086, 0x27bd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* GxM DH */
+/* BA, CA, DB, Ex, 6300, Fx, 631x/632x, Gx
+       { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+       { 0x8086, 0x2440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* BA */
+       { 0x8086, 0x2480, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CA */
+       { 0x8086, 0x24c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* DB */
+       { 0x8086, 0x24d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Ex */
+       { 0x8086, 0x25a1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 6300 */
+       { 0x8086, 0x2640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Fx */
+       { 0x8086, 0x2670, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
+       { 0x8086, 0x27b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Gx */
+/* E
+       { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
+       { 0x8086, 0x2450, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* E  */
        { 0, }, /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, pci_tbl);
@@ -138,22 +213,115 @@ static struct hwrng intel_rng = {
 };
 
 
+#ifdef CONFIG_SMP
+static char __initdata waitflag;
+
+static void __init intel_init_wait(void *unused)
+{
+       while (waitflag)
+               cpu_relax();
+}
+#endif
+
 static int __init mod_init(void)
 {
        int err = -ENODEV;
+       unsigned i;
+       struct pci_dev *dev = NULL;
        void __iomem *mem;
-       u8 hw_status;
+       unsigned long flags;
+       u8 bios_cntl_off, fwh_dec_en1_off;
+       u8 bios_cntl_val = 0xff, fwh_dec_en1_val = 0xff;
+       u8 hw_status, mfc, dvc;
 
-       if (!pci_dev_present(pci_tbl))
+       for (i = 0; !dev && pci_tbl[i].vendor; ++i)
+               dev = pci_get_device(pci_tbl[i].vendor, pci_tbl[i].device, NULL);
+
+       if (!dev)
                goto out; /* Device not found. */
 
+       /* Check for Intel 82802 */
+       if (dev->device < 0x2640) {
+               fwh_dec_en1_off = FWH_DEC_EN1_REG_OLD;
+               bios_cntl_off = BIOS_CNTL_REG_OLD;
+       } else {
+               fwh_dec_en1_off = FWH_DEC_EN1_REG_NEW;
+               bios_cntl_off = BIOS_CNTL_REG_NEW;
+       }
+
+       pci_read_config_byte(dev, fwh_dec_en1_off, &fwh_dec_en1_val);
+       pci_read_config_byte(dev, bios_cntl_off, &bios_cntl_val);
+
+       mem = ioremap_nocache(INTEL_FWH_ADDR, INTEL_FWH_ADDR_LEN);
+       if (mem == NULL) {
+               pci_dev_put(dev);
+               err = -EBUSY;
+               goto out;
+       }
+
+       /*
+        * Since the BIOS code/data is going to disappear from its normal
+        * location with the Read ID command, all activity on the system
+        * must be stopped until the state is back to normal.
+        */
+#ifdef CONFIG_SMP
+       set_mb(waitflag, 1);
+       if (smp_call_function(intel_init_wait, NULL, 1, 0) != 0) {
+               set_mb(waitflag, 0);
+               pci_dev_put(dev);
+               printk(KERN_ERR PFX "cannot run on all processors\n");
+               err = -EAGAIN;
+               goto err_unmap;
+       }
+#endif
+       local_irq_save(flags);
+
+       if (!(fwh_dec_en1_val & FWH_F8_EN_MASK))
+               pci_write_config_byte(dev,
+                                     fwh_dec_en1_off,
+                                     fwh_dec_en1_val | FWH_F8_EN_MASK);
+       if (!(bios_cntl_val &
+             (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)))
+               pci_write_config_byte(dev,
+                                     bios_cntl_off,
+                                     bios_cntl_val | BIOS_CNTL_WRITE_ENABLE_MASK);
+
+       writeb(INTEL_FWH_RESET_CMD, mem);
+       writeb(INTEL_FWH_READ_ID_CMD, mem);
+       mfc = readb(mem + INTEL_FWH_MANUFACTURER_CODE_ADDRESS);
+       dvc = readb(mem + INTEL_FWH_DEVICE_CODE_ADDRESS);
+       writeb(INTEL_FWH_RESET_CMD, mem);
+
+       if (!(bios_cntl_val &
+             (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)))
+               pci_write_config_byte(dev, bios_cntl_off, bios_cntl_val);
+       if (!(fwh_dec_en1_val & FWH_F8_EN_MASK))
+               pci_write_config_byte(dev, fwh_dec_en1_off, fwh_dec_en1_val);
+
+       local_irq_restore(flags);
+#ifdef CONFIG_SMP
+       /* Tell other CPUs to resume. */
+       set_mb(waitflag, 0);
+#endif
+
+       iounmap(mem);
+       pci_dev_put(dev);
+
+       if (mfc != INTEL_FWH_MANUFACTURER_CODE ||
+           (dvc != INTEL_FWH_DEVICE_CODE_8M &&
+            dvc != INTEL_FWH_DEVICE_CODE_4M)) {
+               printk(KERN_ERR PFX "FWH not detected\n");
+               err = -ENODEV;
+               goto out;
+       }
+
        err = -ENOMEM;
        mem = ioremap(INTEL_RNG_ADDR, INTEL_RNG_ADDR_LEN);
        if (!mem)
                goto out;
        intel_rng.priv = (unsigned long)mem;
 
-       /* Check for Intel 82802 */
+       /* Check for Random Number Generator */
        err = -ENODEV;
        hw_status = hwstatus_get(mem);
        if ((hw_status & INTEL_RNG_PRESENT) == 0)
index 8c09997cc3d63b9108c7c4f948a9eb611a580bff..6b4d82a4565fbf9ec533891f8043b6aa3d5ca707 100644 (file)
@@ -612,16 +612,6 @@ MODULE_DEVICE_TABLE(pci, istallion_pci_tbl);
 #define        MINOR2BRD(min)          (((min) & 0xc0) >> 6)
 #define        MINOR2PORT(min)         ((min) & 0x3f)
 
-/*
- *     Define a baud rate table that converts termios baud rate selector
- *     into the actual baud rate value. All baud rate calculations are based
- *     on the actual baud rate required.
- */
-static unsigned int    stli_baudrates[] = {
-       0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-       9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
-};
-
 /*****************************************************************************/
 
 /*
@@ -2747,15 +2737,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
 /*
  *     Start of by setting the baud, char size, parity and stop bit info.
  */
-       pp->baudout = tiosp->c_cflag & CBAUD;
-       if (pp->baudout & CBAUDEX) {
-               pp->baudout &= ~CBAUDEX;
-               if ((pp->baudout < 1) || (pp->baudout > 4))
-                       tiosp->c_cflag &= ~CBAUDEX;
-               else
-                       pp->baudout += 15;
-       }
-       pp->baudout = stli_baudrates[pp->baudout];
+       pp->baudout = tty_get_baud_rate(portp->tty);
        if ((tiosp->c_cflag & CBAUD) == B38400) {
                if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                        pp->baudout = 57600;
index f875fda3b089d54332341671388716c99ebd05eb..1ecea7d448f14618e19112b6c84dd75a25c25d7d 100644 (file)
@@ -906,7 +906,7 @@ static int __init lp_init (void)
        lp_class = class_create(THIS_MODULE, "printer");
        if (IS_ERR(lp_class)) {
                err = PTR_ERR(lp_class);
-               goto out_devfs;
+               goto out_reg;
        }
 
        if (parport_register_driver (&lp_driver)) {
@@ -927,7 +927,7 @@ static int __init lp_init (void)
 
 out_class:
        class_destroy(lp_class);
-out_devfs:
+out_reg:
        unregister_chrdev(LP_MAJOR, "lp");
        return err;
 }
index 4ac70ec697f07f7b6b15c52d231709b7dd64577b..6511012cbdcd86d971a6cdebcf6e1baad66ccded 100644 (file)
@@ -551,7 +551,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
        return virtr + wrote;
 }
 
-#if defined(CONFIG_ISA) || !defined(__mc68000__)
+#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
 static ssize_t read_port(struct file * file, char __user * buf,
                         size_t count, loff_t *ppos)
 {
@@ -830,7 +830,7 @@ static const struct file_operations null_fops = {
        .splice_write   = splice_write_null,
 };
 
-#if defined(CONFIG_ISA) || !defined(__mc68000__)
+#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
 static const struct file_operations port_fops = {
        .llseek         = memory_lseek,
        .read           = read_port,
@@ -908,7 +908,7 @@ static int memory_open(struct inode * inode, struct file * filp)
                case 3:
                        filp->f_op = &null_fops;
                        break;
-#if defined(CONFIG_ISA) || !defined(__mc68000__)
+#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
                case 4:
                        filp->f_op = &port_fops;
                        break;
@@ -955,7 +955,7 @@ static const struct {
        {1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
        {2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
        {3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
-#if defined(CONFIG_ISA) || !defined(__mc68000__)
+#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
        {4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
 #endif
        {5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
index 84e5a68635f12203c361cf837aab3f2bd4fdbca0..ecfaf180e5bd8b106ee12e06da33fc0c1a88f702 100644 (file)
@@ -188,16 +188,6 @@ static void pc8736x_gpio_set(unsigned minor, int val)
        pc8736x_gpio_shadow[port] = val;
 }
 
-static void pc8736x_gpio_set_high(unsigned index)
-{
-       pc8736x_gpio_set(index, 1);
-}
-
-static void pc8736x_gpio_set_low(unsigned index)
-{
-       pc8736x_gpio_set(index, 0);
-}
-
 static int pc8736x_gpio_current(unsigned minor)
 {
        int port, bit;
index 579868af4a54d91be8f0707c96053e3d9bfb7b5e..c596a08c07b3591da8025955a236fd8fb908303b 100644 (file)
@@ -288,31 +288,34 @@ static struct cdev raw_cdev = {
 static int __init raw_init(void)
 {
        dev_t dev = MKDEV(RAW_MAJOR, 0);
+       int ret;
 
-       if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw"))
+       ret = register_chrdev_region(dev, MAX_RAW_MINORS, "raw");
+       if (ret)
                goto error;
 
        cdev_init(&raw_cdev, &raw_fops);
-       if (cdev_add(&raw_cdev, dev, MAX_RAW_MINORS)) {
+       ret = cdev_add(&raw_cdev, dev, MAX_RAW_MINORS);
+       if (ret) {
                kobject_put(&raw_cdev.kobj);
-               unregister_chrdev_region(dev, MAX_RAW_MINORS);
-               goto error;
+               goto error_region;
        }
 
        raw_class = class_create(THIS_MODULE, "raw");
        if (IS_ERR(raw_class)) {
                printk(KERN_ERR "Error creating raw class.\n");
                cdev_del(&raw_cdev);
-               unregister_chrdev_region(dev, MAX_RAW_MINORS);
-               goto error;
+               ret = PTR_ERR(raw_class);
+               goto error_region;
        }
        class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
 
        return 0;
 
+error_region:
+       unregister_chrdev_region(dev, MAX_RAW_MINORS);
 error:
-       printk(KERN_ERR "error register raw device\n");
-       return 1;
+       return ret;
 }
 
 static void __exit raw_exit(void)
index ab6429b4a84e424a9e390d3946bbd1ff6a8c316f..656f8c0ca52effdc31f343360a91309278ae5760 100644 (file)
@@ -1262,10 +1262,8 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
         * Once the read clears, read the RTC time (again via ioctl). Easy.
         */
 
-       while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) {
-               barrier();
+       while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100)
                cpu_relax();
-       }
 
        /*
         * Only the values that we read from the RTC are set. We leave
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
deleted file mode 100644 (file)
index 5458ef1..0000000
+++ /dev/null
@@ -1,591 +0,0 @@
-/* drivers/char/s3c2410_rtc.c
- *
- * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
- *                   http://www.simtec.co.uk/products/SWLINUX/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C2410 Internal RTC Driver
- *
- *  Changelog:
- *     08-Nov-2004     BJD     Initial creation
- *     12-Nov-2004     BJD     Added periodic IRQ and PM code
- *     22-Nov-2004     BJD     Sign-test on alarm code to check for <0
- *     10-Mar-2005     LCVR    Changed S3C2410_VA_RTC to S3C24XX_VA_RTC
-*/
-
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/string.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/clk.h>
-
-#include <asm/hardware.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/rtc.h>
-
-#include <asm/mach/time.h>
-
-#include <asm/arch/regs-rtc.h>
-
-/* need this for the RTC_AF definitions */
-#include <linux/mc146818rtc.h>
-
-#undef S3C24XX_VA_RTC
-#define S3C24XX_VA_RTC s3c2410_rtc_base
-
-static struct resource *s3c2410_rtc_mem;
-
-static void __iomem *s3c2410_rtc_base;
-static int s3c2410_rtc_alarmno = NO_IRQ;
-static int s3c2410_rtc_tickno  = NO_IRQ;
-static int s3c2410_rtc_freq    = 1;
-
-static DEFINE_SPINLOCK(s3c2410_rtc_pie_lock);
-
-/* IRQ Handlers */
-
-static irqreturn_t s3c2410_rtc_alarmirq(int irq, void *id, struct pt_regs *r)
-{
-       rtc_update(1, RTC_AF | RTC_IRQF);
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t s3c2410_rtc_tickirq(int irq, void *id, struct pt_regs *r)
-{
-       rtc_update(1, RTC_PF | RTC_IRQF);
-       return IRQ_HANDLED;
-}
-
-/* Update control registers */
-static void s3c2410_rtc_setaie(int to)
-{
-       unsigned int tmp;
-
-       pr_debug("%s: aie=%d\n", __FUNCTION__, to);
-
-       tmp = readb(S3C2410_RTCALM);
-
-       if (to)
-               tmp |= S3C2410_RTCALM_ALMEN;
-       else
-               tmp &= ~S3C2410_RTCALM_ALMEN;
-
-
-       writeb(tmp, S3C2410_RTCALM);
-}
-
-static void s3c2410_rtc_setpie(int to)
-{
-       unsigned int tmp;
-
-       pr_debug("%s: pie=%d\n", __FUNCTION__, to);
-
-       spin_lock_irq(&s3c2410_rtc_pie_lock);
-       tmp = readb(S3C2410_TICNT) & ~S3C2410_TICNT_ENABLE;
-
-       if (to)
-               tmp |= S3C2410_TICNT_ENABLE;
-
-       writeb(tmp, S3C2410_TICNT);
-       spin_unlock_irq(&s3c2410_rtc_pie_lock);
-}
-
-static void s3c2410_rtc_setfreq(int freq)
-{
-       unsigned int tmp;
-
-       spin_lock_irq(&s3c2410_rtc_pie_lock);
-       tmp = readb(S3C2410_TICNT) & S3C2410_TICNT_ENABLE;
-
-       s3c2410_rtc_freq = freq;
-
-       tmp |= (128 / freq)-1;
-
-       writeb(tmp, S3C2410_TICNT);
-       spin_unlock_irq(&s3c2410_rtc_pie_lock);
-}
-
-/* Time read/write */
-
-static int s3c2410_rtc_gettime(struct rtc_time *rtc_tm)
-{
-       unsigned int have_retried = 0;
-
- retry_get_time:
-       rtc_tm->tm_min  = readb(S3C2410_RTCMIN);
-       rtc_tm->tm_hour = readb(S3C2410_RTCHOUR);
-       rtc_tm->tm_mday = readb(S3C2410_RTCDATE);
-       rtc_tm->tm_mon  = readb(S3C2410_RTCMON);
-       rtc_tm->tm_year = readb(S3C2410_RTCYEAR);
-       rtc_tm->tm_sec  = readb(S3C2410_RTCSEC);
-
-       /* the only way to work out wether the system was mid-update
-        * when we read it is to check the second counter, and if it
-        * is zero, then we re-try the entire read
-        */
-
-       if (rtc_tm->tm_sec == 0 && !have_retried) {
-               have_retried = 1;
-               goto retry_get_time;
-       }
-
-       pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n",
-                rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday,
-                rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);
-
-       BCD_TO_BIN(rtc_tm->tm_sec);
-       BCD_TO_BIN(rtc_tm->tm_min);
-       BCD_TO_BIN(rtc_tm->tm_hour);
-       BCD_TO_BIN(rtc_tm->tm_mday);
-       BCD_TO_BIN(rtc_tm->tm_mon);
-       BCD_TO_BIN(rtc_tm->tm_year);
-
-       rtc_tm->tm_year += 100;
-       rtc_tm->tm_mon -= 1;
-
-       return 0;
-}
-
-
-static int s3c2410_rtc_settime(struct rtc_time *tm)
-{
-       /* the rtc gets round the y2k problem by just not supporting it */
-
-       if (tm->tm_year < 100)
-               return -EINVAL;
-
-       writeb(BIN2BCD(tm->tm_sec),  S3C2410_RTCSEC);
-       writeb(BIN2BCD(tm->tm_min),  S3C2410_RTCMIN);
-       writeb(BIN2BCD(tm->tm_hour), S3C2410_RTCHOUR);
-       writeb(BIN2BCD(tm->tm_mday), S3C2410_RTCDATE);
-       writeb(BIN2BCD(tm->tm_mon + 1), S3C2410_RTCMON);
-       writeb(BIN2BCD(tm->tm_year - 100), S3C2410_RTCYEAR);
-
-       return 0;
-}
-
-static int s3c2410_rtc_getalarm(struct rtc_wkalrm *alrm)
-{
-       struct rtc_time *alm_tm = &alrm->time;
-       unsigned int alm_en;
-
-       alm_tm->tm_sec  = readb(S3C2410_ALMSEC);
-       alm_tm->tm_min  = readb(S3C2410_ALMMIN);
-       alm_tm->tm_hour = readb(S3C2410_ALMHOUR);
-       alm_tm->tm_mon  = readb(S3C2410_ALMMON);
-       alm_tm->tm_mday = readb(S3C2410_ALMDATE);
-       alm_tm->tm_year = readb(S3C2410_ALMYEAR);
-
-       alm_en = readb(S3C2410_RTCALM);
-
-       pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n",
-                alm_en,
-                alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday,
-                alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec);
-
-
-       /* decode the alarm enable field */
-
-       if (alm_en & S3C2410_RTCALM_SECEN) {
-               BCD_TO_BIN(alm_tm->tm_sec);
-       } else {
-               alm_tm->tm_sec = 0xff;
-       }
-
-       if (alm_en & S3C2410_RTCALM_MINEN) {
-               BCD_TO_BIN(alm_tm->tm_min);
-       } else {
-               alm_tm->tm_min = 0xff;
-       }
-
-       if (alm_en & S3C2410_RTCALM_HOUREN) {
-               BCD_TO_BIN(alm_tm->tm_hour);
-       } else {
-               alm_tm->tm_hour = 0xff;
-       }
-
-       if (alm_en & S3C2410_RTCALM_DAYEN) {
-               BCD_TO_BIN(alm_tm->tm_mday);
-       } else {
-               alm_tm->tm_mday = 0xff;
-       }
-
-       if (alm_en & S3C2410_RTCALM_MONEN) {
-               BCD_TO_BIN(alm_tm->tm_mon);
-               alm_tm->tm_mon -= 1;
-       } else {
-               alm_tm->tm_mon = 0xff;
-       }
-
-       if (alm_en & S3C2410_RTCALM_YEAREN) {
-               BCD_TO_BIN(alm_tm->tm_year);
-       } else {
-               alm_tm->tm_year = 0xffff;
-       }
-
-       /* todo - set alrm->enabled ? */
-
-       return 0;
-}
-
-static int s3c2410_rtc_setalarm(struct rtc_wkalrm *alrm)
-{
-       struct rtc_time *tm = &alrm->time;
-       unsigned int alrm_en;
-
-       pr_debug("s3c2410_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n",
-                alrm->enabled,
-                tm->tm_mday & 0xff, tm->tm_mon & 0xff, tm->tm_year & 0xff,
-                tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec);
-
-       if (alrm->enabled || 1) {
-               alrm_en = readb(S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN;
-               writeb(0x00, S3C2410_RTCALM);
-
-               if (tm->tm_sec < 60 && tm->tm_sec >= 0) {
-                       alrm_en |= S3C2410_RTCALM_SECEN;
-                       writeb(BIN2BCD(tm->tm_sec), S3C2410_ALMSEC);
-               }
-
-               if (tm->tm_min < 60 && tm->tm_min >= 0) {
-                       alrm_en |= S3C2410_RTCALM_MINEN;
-                       writeb(BIN2BCD(tm->tm_min), S3C2410_ALMMIN);
-               }
-
-               if (tm->tm_hour < 24 && tm->tm_hour >= 0) {
-                       alrm_en |= S3C2410_RTCALM_HOUREN;
-                       writeb(BIN2BCD(tm->tm_hour), S3C2410_ALMHOUR);
-               }
-
-               pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en);
-
-               writeb(alrm_en, S3C2410_RTCALM);
-               enable_irq_wake(s3c2410_rtc_alarmno);
-       } else {
-               alrm_en = readb(S3C2410_RTCALM);
-               alrm_en &= ~S3C2410_RTCALM_ALMEN;
-               writeb(alrm_en, S3C2410_RTCALM);
-               disable_irq_wake(s3c2410_rtc_alarmno);
-       }
-
-       return 0;
-}
-
-static int s3c2410_rtc_ioctl(unsigned int cmd, unsigned long arg)
-{
-       switch (cmd) {
-       case RTC_AIE_OFF:
-       case RTC_AIE_ON:
-               s3c2410_rtc_setaie((cmd == RTC_AIE_ON) ? 1 : 0);
-               return 0;
-
-       case RTC_PIE_OFF:
-       case RTC_PIE_ON:
-               s3c2410_rtc_setpie((cmd == RTC_PIE_ON) ? 1 : 0);
-               return 0;
-
-       case RTC_IRQP_READ:
-               return put_user(s3c2410_rtc_freq, (unsigned long __user *)arg);
-
-       case RTC_IRQP_SET:
-               if (arg < 1 || arg > 64)
-                       return -EINVAL;
-
-               if (!capable(CAP_SYS_RESOURCE))
-                       return -EACCES;
-
-               /* check for power of 2 */
-
-               if ((arg & (arg-1)) != 0)
-                       return -EINVAL;
-
-               pr_debug("s3c2410_rtc: setting frequency %ld\n", arg);
-
-               s3c2410_rtc_setfreq(arg);
-               return 0;
-
-       case RTC_UIE_ON:
-       case RTC_UIE_OFF:
-               return -EINVAL;
-       }
-
-       return -EINVAL;
-}
-
-static int s3c2410_rtc_proc(char *buf)
-{
-       unsigned int rtcalm = readb(S3C2410_RTCALM);
-       unsigned int ticnt = readb (S3C2410_TICNT);
-       char *p = buf;
-
-       p += sprintf(p, "alarm_IRQ\t: %s\n",
-                    (rtcalm & S3C2410_RTCALM_ALMEN) ? "yes" : "no" );
-       p += sprintf(p, "periodic_IRQ\t: %s\n",
-                    (ticnt & S3C2410_TICNT_ENABLE) ? "yes" : "no" );
-       p += sprintf(p, "periodic_freq\t: %d\n", s3c2410_rtc_freq);
-
-       return p - buf;
-}
-
-static int s3c2410_rtc_open(void)
-{
-       int ret;
-
-       ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq,
-                         IRQF_DISABLED,  "s3c2410-rtc alarm", NULL);
-
-       if (ret)
-               printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno);
-
-       ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq,
-                         IRQF_DISABLED,  "s3c2410-rtc tick", NULL);
-
-       if (ret) {
-               printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno);
-               goto tick_err;
-       }
-
-       return ret;
-
- tick_err:
-       free_irq(s3c2410_rtc_alarmno, NULL);
-       return ret;
-}
-
-static void s3c2410_rtc_release(void)
-{
-       /* do not clear AIE here, it may be needed for wake */
-
-       s3c2410_rtc_setpie(0);
-       free_irq(s3c2410_rtc_alarmno, NULL);
-       free_irq(s3c2410_rtc_tickno, NULL);
-}
-
-static struct rtc_ops s3c2410_rtcops = {
-       .owner          = THIS_MODULE,
-       .open           = s3c2410_rtc_open,
-       .release        = s3c2410_rtc_release,
-       .ioctl          = s3c2410_rtc_ioctl,
-       .read_time      = s3c2410_rtc_gettime,
-       .set_time       = s3c2410_rtc_settime,
-       .read_alarm     = s3c2410_rtc_getalarm,
-       .set_alarm      = s3c2410_rtc_setalarm,
-       .proc           = s3c2410_rtc_proc,
-};
-
-static void s3c2410_rtc_enable(struct platform_device *pdev, int en)
-{
-       unsigned int tmp;
-
-       if (s3c2410_rtc_base == NULL)
-               return;
-
-       if (!en) {
-               tmp = readb(S3C2410_RTCCON);
-               writeb(tmp & ~S3C2410_RTCCON_RTCEN, S3C2410_RTCCON);
-
-               tmp = readb(S3C2410_TICNT);
-               writeb(tmp & ~S3C2410_TICNT_ENABLE, S3C2410_TICNT);
-       } else {
-               /* re-enable the device, and check it is ok */
-
-               if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
-                       dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
-
-                       tmp = readb(S3C2410_RTCCON);
-                       writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
-               }
-
-               if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
-                       dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n");
-
-                       tmp = readb(S3C2410_RTCCON);
-                       writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
-               }
-
-               if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
-                       dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n");
-
-                       tmp = readb(S3C2410_RTCCON);
-                       writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON);
-               }
-       }
-}
-
-static int s3c2410_rtc_remove(struct platform_device *dev)
-{
-       unregister_rtc(&s3c2410_rtcops);
-
-       s3c2410_rtc_setpie(0);
-       s3c2410_rtc_setaie(0);
-
-       if (s3c2410_rtc_mem != NULL) {
-               pr_debug("s3c2410_rtc: releasing s3c2410_rtc_mem\n");
-               iounmap(s3c2410_rtc_base);
-               release_resource(s3c2410_rtc_mem);
-               kfree(s3c2410_rtc_mem);
-       }
-
-       return 0;
-}
-
-static int s3c2410_rtc_probe(struct platform_device *pdev)
-{
-       struct resource *res;
-       int ret;
-
-       pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
-
-       /* find the IRQs */
-
-       s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
-       if (s3c2410_rtc_tickno < 0) {
-               dev_err(&pdev->dev, "no irq for rtc tick\n");
-               return -ENOENT;
-       }
-
-       s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
-       if (s3c2410_rtc_alarmno < 0) {
-               dev_err(&pdev->dev, "no irq for alarm\n");
-               return -ENOENT;
-       }
-
-       pr_debug("s3c2410_rtc: tick irq %d, alarm irq %d\n",
-                s3c2410_rtc_tickno, s3c2410_rtc_alarmno);
-
-       /* get the memory region */
-
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (res == NULL) {
-               dev_err(&pdev->dev, "failed to get memory region resource\n");
-               return -ENOENT;
-       }
-
-       s3c2410_rtc_mem = request_mem_region(res->start, res->end-res->start+1,
-                                    pdev->name);
-
-       if (s3c2410_rtc_mem == NULL) {
-               dev_err(&pdev->dev, "failed to reserve memory region\n");
-               ret = -ENOENT;
-               goto exit_err;
-       }
-
-       s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1);
-       if (s3c2410_rtc_base == NULL) {
-               dev_err(&pdev->dev, "failed ioremap()\n");
-               ret = -EINVAL;
-               goto exit_err;
-       }
-
-       s3c2410_rtc_mem = res;
-       pr_debug("s3c2410_rtc_base=%p\n", s3c2410_rtc_base);
-
-       pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
-
-       /* check to see if everything is setup correctly */
-
-       s3c2410_rtc_enable(pdev, 1);
-
-       pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
-
-       s3c2410_rtc_setfreq(s3c2410_rtc_freq);
-
-       /* register RTC and exit */
-
-       register_rtc(&s3c2410_rtcops);
-       return 0;
-
- exit_err:
-       dev_err(&pdev->dev, "error %d during initialisation\n", ret);
-
-       return ret;
-}
-
-#ifdef CONFIG_PM
-
-/* S3C2410 RTC Power management control */
-
-static struct timespec s3c2410_rtc_delta;
-
-static int ticnt_save;
-
-static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state)
-{
-       struct rtc_time tm;
-       struct timespec time;
-
-       time.tv_nsec = 0;
-
-       /* save TICNT for anyone using periodic interrupts */
-
-       ticnt_save = readb(S3C2410_TICNT);
-
-       /* calculate time delta for suspend */
-
-       s3c2410_rtc_gettime(&tm);
-       rtc_tm_to_time(&tm, &time.tv_sec);
-       save_time_delta(&s3c2410_rtc_delta, &time);
-       s3c2410_rtc_enable(pdev, 0);
-
-       return 0;
-}
-
-static int s3c2410_rtc_resume(struct platform_device *pdev)
-{
-       struct rtc_time tm;
-       struct timespec time;
-
-       time.tv_nsec = 0;
-
-       s3c2410_rtc_enable(pdev, 1);
-       s3c2410_rtc_gettime(&tm);
-       rtc_tm_to_time(&tm, &time.tv_sec);
-       restore_time_delta(&s3c2410_rtc_delta, &time);
-
-       writeb(ticnt_save, S3C2410_TICNT);
-       return 0;
-}
-#else
-#define s3c2410_rtc_suspend NULL
-#define s3c2410_rtc_resume  NULL
-#endif
-
-static struct platform_driver s3c2410_rtcdrv = {
-       .probe          = s3c2410_rtc_probe,
-       .remove         = s3c2410_rtc_remove,
-       .suspend        = s3c2410_rtc_suspend,
-       .resume         = s3c2410_rtc_resume,
-       .driver         = {
-               .name   = "s3c2410-rtc",
-               .owner  = THIS_MODULE,
-       },
-};
-
-static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
-
-static int __init s3c2410_rtc_init(void)
-{
-       printk(banner);
-       return platform_driver_register(&s3c2410_rtcdrv);
-}
-
-static void __exit s3c2410_rtc_exit(void)
-{
-       platform_driver_unregister(&s3c2410_rtcdrv);
-}
-
-module_init(s3c2410_rtc_init);
-module_exit(s3c2410_rtc_exit);
-
-MODULE_DESCRIPTION("S3C24XX RTC Driver");
-MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
-MODULE_LICENSE("GPL");
index b956c7babd18a8a4933d6a99e74bd86ceb63c62d..99e5272e3c53e1ef1aa32f0733b1bbf0e9f2487e 100644 (file)
@@ -44,7 +44,7 @@ struct nsc_gpio_ops scx200_gpio_ops = {
        .gpio_change    = scx200_gpio_change,
        .gpio_current   = scx200_gpio_current
 };
-EXPORT_SYMBOL(scx200_gpio_ops);
+EXPORT_SYMBOL_GPL(scx200_gpio_ops);
 
 static int scx200_gpio_open(struct inode *inode, struct file *file)
 {
@@ -69,7 +69,7 @@ static const struct file_operations scx200_gpio_fileops = {
        .release = scx200_gpio_release,
 };
 
-struct cdev scx200_gpio_cdev;  /* use 1 cdev for all pins */
+static struct cdev scx200_gpio_cdev;  /* use 1 cdev for all pins */
 
 static int __init scx200_gpio_init(void)
 {
index 71093a9fc462ac8f562a8c8e980a7d7deceadd89..74cff839c8572c9bf560640b0ea513938627fd54 100644 (file)
@@ -33,7 +33,7 @@ extern void poke_blanked_console(void);
 
 /* Variables for selection control. */
 /* Use a dynamic buffer, instead of static (Dec 1994) */
-struct vc_data *sel_cons;              /* must not be disallocated */
+struct vc_data *sel_cons;              /* must not be deallocated */
 static volatile int sel_start = -1;    /* cleared by clear_selection */
 static int sel_end;
 static int sel_buffer_lth;
index a1d303f9a33dd30fa2260b82cacf4fdf1fa78308..c0ef0f0e5800dcd74a90e38cc483bc2e37ac60f0 100644 (file)
@@ -1087,24 +1087,16 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
                port->MSVR =  (sx_in(bp, CD186x_MSVR) & MSVR_RTS);
        spin_unlock_irqrestore(&bp->lock, flags);
        dprintk (SX_DEBUG_TERMIOS, "sx: got MSVR=%02x.\n", port->MSVR);
-       baud = C_BAUD(tty);
+       baud = tty_get_baud_rate(tty);
 
-       if (baud & CBAUDEX) {
-               baud &= ~CBAUDEX;
-               if (baud < 1 || baud > 2)
-                       port->tty->termios->c_cflag &= ~CBAUDEX;
-               else
-                       baud += 15;
-       }
-       if (baud == 15) {
+       if (baud == 38400) {
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                        baud ++;
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
                        baud += 2;
        }
 
-
-       if (!baud_table[baud]) {
+       if (!baud) {
                /* Drop DTR & exit */
                dprintk (SX_DEBUG_TERMIOS, "Dropping DTR...  Hmm....\n");
                if (!SX_CRTSCTS (tty)) {
@@ -1134,7 +1126,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
                                  "This is an untested option, please be carefull.\n",
                                  port_No (port), tmp);
        else
-               tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] +
+               tmp = (((SX_OSCFREQ + baud/2) / baud +
                         CD186x_TPC/2) / CD186x_TPC);
 
        if ((tmp < 0x10) && time_before(again, jiffies)) {
index ee3ca8f1768e9be995a62a252404ad4712d5d6bc..0ad6cb081db4d1b3681a7b069d9439454e3bd9fc 100644 (file)
@@ -208,7 +208,7 @@ static void send_sig_all(int sig)
        struct task_struct *p;
 
        for_each_process(p) {
-               if (p->mm && p->pid != 1)
+               if (p->mm && !is_init(p))
                        /* Not swapper, init nor kernel thread */
                        force_sig(sig, p);
        }
index bb0d9199e994867544bfc82da5d6530cd6dfe787..333741770f1e079f2fbe0df98b69699a4194f924 100644 (file)
@@ -129,6 +129,7 @@ LIST_HEAD(tty_drivers);                     /* linked list of tty drivers */
 /* Semaphore to protect creating and releasing a tty. This is shared with
    vt.c for deeply disgusting hack reasons */
 DEFINE_MUTEX(tty_mutex);
+EXPORT_SYMBOL(tty_mutex);
 
 #ifdef CONFIG_UNIX98_PTYS
 extern struct tty_driver *ptm_driver;  /* Unix98 pty masters; for /dev/ptmx */
@@ -160,17 +161,11 @@ static void release_mem(struct tty_struct *tty, int idx);
  *     been initialized in any way but has been zeroed
  *
  *     Locking: none
- *     FIXME: use kzalloc
  */
 
 static struct tty_struct *alloc_tty_struct(void)
 {
-       struct tty_struct *tty;
-
-       tty = kmalloc(sizeof(struct tty_struct), GFP_KERNEL);
-       if (tty)
-               memset(tty, 0, sizeof(struct tty_struct));
-       return tty;
+       return kzalloc(sizeof(struct tty_struct), GFP_KERNEL);
 }
 
 static void tty_buffer_free_all(struct tty_struct *);
@@ -483,10 +478,9 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars,
                tb->used += space;
                copied += space;
                chars += space;
-       }
-       /* There is a small chance that we need to split the data over
-          several buffers. If this is the case we must loop */
-       while (unlikely(size > copied));
+               /* There is a small chance that we need to split the data over
+                  several buffers. If this is the case we must loop */
+       } while (unlikely(size > copied));
        return copied;
 }
 EXPORT_SYMBOL(tty_insert_flip_string);
@@ -521,10 +515,9 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
                copied += space;
                chars += space;
                flags += space;
-       }
-       /* There is a small chance that we need to split the data over
-          several buffers. If this is the case we must loop */
-       while (unlikely(size > copied));
+               /* There is a small chance that we need to split the data over
+                  several buffers. If this is the case we must loop */
+       } while (unlikely(size > copied));
        return copied;
 }
 EXPORT_SYMBOL(tty_insert_flip_string_flags);
@@ -626,9 +619,9 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
  
 static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
 {
-       down(&tty->termios_sem);
+       mutex_lock(&tty->termios_mutex);
        tty->termios->c_line = num;
-       up(&tty->termios_sem);
+       mutex_unlock(&tty->termios_mutex);
 }
 
 /*
@@ -1346,9 +1339,9 @@ static void do_tty_hangup(void *data)
         */
        if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS)
        {
-               down(&tty->termios_sem);
+               mutex_lock(&tty->termios_mutex);
                *tty->termios = tty->driver->init_termios;
-               up(&tty->termios_sem);
+               mutex_unlock(&tty->termios_mutex);
        }
        
        /* Defer ldisc switch */
@@ -2072,8 +2065,9 @@ fail_no_mem:
 
        /* call the tty release_mem routine to clean out this slot */
 release_mem_out:
-       printk(KERN_INFO "init_dev: ldisc open failed, "
-                        "clearing slot %d\n", idx);
+       if (printk_ratelimit())
+               printk(KERN_INFO "init_dev: ldisc open failed, "
+                                "clearing slot %d\n", idx);
        release_mem(tty, idx);
        goto end_init;
 }
@@ -2726,6 +2720,8 @@ static int tty_fasync(int fd, struct file * filp, int on)
  *     Locking:
  *             Called functions take tty_ldisc_lock
  *             current->signal->tty check is safe without locks
+ *
+ *     FIXME: may race normal receive processing
  */
 
 static int tiocsti(struct tty_struct *tty, char __user *p)
@@ -2748,18 +2744,21 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
  *     @tty; tty
  *     @arg: user buffer for result
  *
- *     Copies the kernel idea of the window size into the user buffer. No
- *     locking is done.
+ *     Copies the kernel idea of the window size into the user buffer.
  *
- *     FIXME: Returning random values racing a window size set is wrong
- *     should lock here against that
+ *     Locking: tty->termios_sem is taken to ensure the winsize data
+ *             is consistent.
  */
 
 static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg)
 {
-       if (copy_to_user(arg, &tty->winsize, sizeof(*arg)))
-               return -EFAULT;
-       return 0;
+       int err;
+
+       mutex_lock(&tty->termios_mutex);
+       err = copy_to_user(arg, &tty->winsize, sizeof(*arg));
+       mutex_unlock(&tty->termios_mutex);
+
+       return err ? -EFAULT: 0;
 }
 
 /**
@@ -2772,12 +2771,11 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg)
  *     actually has driver level meaning and triggers a VC resize.
  *
  *     Locking:
- *             The console_sem is used to ensure we do not try and resize
- *     the console twice at once.
- *     FIXME: Two racing size sets may leave the console and kernel
- *             parameters disagreeing. Is this exploitable ?
- *     FIXME: Random values racing a window size get is wrong
- *     should lock here against that
+ *             Called function use the console_sem is used to ensure we do
+ *     not try and resize the console twice at once.
+ *             The tty->termios_sem is used to ensure we don't double
+ *     resize and get confused. Lock order - tty->termios.sem before
+ *     console sem
  */
 
 static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
@@ -2787,17 +2785,18 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
 
        if (copy_from_user(&tmp_ws, arg, sizeof(*arg)))
                return -EFAULT;
+
+       mutex_lock(&tty->termios_mutex);
        if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg)))
-               return 0;
+               goto done;
+
 #ifdef CONFIG_VT
        if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
-               int rc;
-
-               acquire_console_sem();
-               rc = vc_resize(tty->driver_data, tmp_ws.ws_col, tmp_ws.ws_row);
-               release_console_sem();
-               if (rc)
-                       return -ENXIO;
+               if (vc_lock_resize(tty->driver_data, tmp_ws.ws_col,
+                                       tmp_ws.ws_row)) {
+                       mutex_unlock(&tty->termios_mutex);
+                       return -ENXIO;
+               }
        }
 #endif
        if (tty->pgrp > 0)
@@ -2806,6 +2805,8 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
                kill_pg(real_tty->pgrp, SIGWINCH, 1);
        tty->winsize = tmp_ws;
        real_tty->winsize = tmp_ws;
+done:
+       mutex_unlock(&tty->termios_mutex);
        return 0;
 }
 
@@ -2880,9 +2881,7 @@ static int fionbio(struct file *file, int __user *p)
  *     Locking:
  *             Takes tasklist lock internally to walk sessions
  *             Takes task_lock() when updating signal->tty
- *
- *     FIXME: tty_mutex is needed to protect signal->tty references.
- *     FIXME: why task_lock on the signal->tty reference ??
+ *             Takes tty_mutex() to protect tty instance
  *
  */
 
@@ -2917,9 +2916,11 @@ static int tiocsctty(struct tty_struct *tty, int arg)
                } else
                        return -EPERM;
        }
+       mutex_lock(&tty_mutex);
        task_lock(current);
        current->signal->tty = tty;
        task_unlock(current);
+       mutex_unlock(&tty_mutex);
        current->signal->tty_old_pgrp = 0;
        tty->session = current->signal->session;
        tty->pgrp = process_group(current);
@@ -2959,8 +2960,6 @@ static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
  *     permitted where the tty session is our session.
  *
  *     Locking: None
- *
- *     FIXME: current->signal->tty referencing is unsafe.
  */
 
 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
@@ -3039,19 +3038,20 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)
  *     timed break functionality.
  *
  *     Locking:
- *             None
+ *             atomic_write_lock serializes
  *
- *     FIXME:
- *             What if two overlap
  */
 
 static int send_break(struct tty_struct *tty, unsigned int duration)
 {
+       if (mutex_lock_interruptible(&tty->atomic_write_lock))
+               return -EINTR;
        tty->driver->break_ctl(tty, -1);
        if (!signal_pending(current)) {
                msleep_interruptible(duration);
        }
        tty->driver->break_ctl(tty, 0);
+       mutex_unlock(&tty->atomic_write_lock);
        if (signal_pending(current))
                return -EINTR;
        return 0;
@@ -3144,6 +3144,8 @@ int tty_ioctl(struct inode * inode, struct file * file,
        if (tty_paranoia_check(tty, inode, "tty_ioctl"))
                return -EINVAL;
 
+       /* CHECKME: is this safe as one end closes ? */
+
        real_tty = tty;
        if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
            tty->driver->subtype == PTY_TYPE_MASTER)
@@ -3580,7 +3582,7 @@ static void initialize_tty_struct(struct tty_struct *tty)
        tty_buffer_init(tty);
        INIT_WORK(&tty->buf.work, flush_to_ldisc, tty);
        init_MUTEX(&tty->buf.pty_sem);
-       init_MUTEX(&tty->termios_sem);
+       mutex_init(&tty->termios_mutex);
        init_waitqueue_head(&tty->write_wait);
        init_waitqueue_head(&tty->read_wait);
        INIT_WORK(&tty->hangup_work, do_tty_hangup, tty);
index 4ad47d321bd426eb9e34364b4ad4c44c200fab43..3b6fa7b0be8ba81c1f9d658cf63740394225172d 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/bitops.h>
+#include <linux/mutex.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -131,7 +132,7 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios
 
        /* FIXME: we need to decide on some locking/ordering semantics
           for the set_termios notification eventually */
-       down(&tty->termios_sem);
+       mutex_lock(&tty->termios_mutex);
 
        *tty->termios = *new_termios;
        unset_locked_termios(tty->termios, &old_termios, tty->termios_locked);
@@ -176,7 +177,7 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios
                        (ld->set_termios)(tty, &old_termios);
                tty_ldisc_deref(ld);
        }
-       up(&tty->termios_sem);
+       mutex_unlock(&tty->termios_mutex);
 }
 
 /**
@@ -284,13 +285,13 @@ static int get_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
 {
        struct sgttyb tmp;
 
-       down(&tty->termios_sem);
+       mutex_lock(&tty->termios_mutex);
        tmp.sg_ispeed = 0;
        tmp.sg_ospeed = 0;
        tmp.sg_erase = tty->termios->c_cc[VERASE];
        tmp.sg_kill = tty->termios->c_cc[VKILL];
        tmp.sg_flags = get_sgflags(tty);
-       up(&tty->termios_sem);
+       mutex_unlock(&tty->termios_mutex);
        
        return copy_to_user(sgttyb, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
@@ -345,12 +346,12 @@ static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
        if (copy_from_user(&tmp, sgttyb, sizeof(tmp)))
                return -EFAULT;
 
-       down(&tty->termios_sem);                
+       mutex_lock(&tty->termios_mutex);
        termios =  *tty->termios;
        termios.c_cc[VERASE] = tmp.sg_erase;
        termios.c_cc[VKILL] = tmp.sg_kill;
        set_sgflags(&termios, tmp.sg_flags);
-       up(&tty->termios_sem);
+       mutex_unlock(&tty->termios_mutex);
        change_termios(tty, &termios);
        return 0;
 }
@@ -422,24 +423,28 @@ static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
  *
  *     Send a high priority character to the tty even if stopped
  *
- *     Locking: none
- *
- *     FIXME: overlapping calls with start/stop tty lose state of tty
+ *     Locking: none for xchar method, write ordering for write method.
  */
 
-static void send_prio_char(struct tty_struct *tty, char ch)
+static int send_prio_char(struct tty_struct *tty, char ch)
 {
        int     was_stopped = tty->stopped;
 
        if (tty->driver->send_xchar) {
                tty->driver->send_xchar(tty, ch);
-               return;
+               return 0;
        }
+
+       if (mutex_lock_interruptible(&tty->atomic_write_lock))
+               return -ERESTARTSYS;
+
        if (was_stopped)
                start_tty(tty);
        tty->driver->write(tty, &ch, 1);
        if (was_stopped)
                stop_tty(tty);
+       mutex_unlock(&tty->atomic_write_lock);
+       return 0;
 }
 
 int n_tty_ioctl(struct tty_struct * tty, struct file * file,
@@ -513,11 +518,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
                                break;
                        case TCIOFF:
                                if (STOP_CHAR(tty) != __DISABLED_CHAR)
-                                       send_prio_char(tty, STOP_CHAR(tty));
+                                       return send_prio_char(tty, STOP_CHAR(tty));
                                break;
                        case TCION:
                                if (START_CHAR(tty) != __DISABLED_CHAR)
-                                       send_prio_char(tty, START_CHAR(tty));
+                                       return send_prio_char(tty, START_CHAR(tty));
                                break;
                        default:
                                return -EINVAL;
@@ -592,11 +597,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
                case TIOCSSOFTCAR:
                        if (get_user(arg, (unsigned int __user *) arg))
                                return -EFAULT;
-                       down(&tty->termios_sem);
+                       mutex_lock(&tty->termios_mutex);
                        tty->termios->c_cflag =
                                ((tty->termios->c_cflag & ~CLOCAL) |
                                 (arg ? CLOCAL : 0));
-                       up(&tty->termios_sem);
+                       mutex_unlock(&tty->termios_mutex);
                        return 0;
                default:
                        return -ENOIOCTLCMD;
index a9247b5213d58e10708cef11b85892ccc8cb6a68..bd7a98c6ea7afb6b94bb392381157aa9e945c339 100644 (file)
@@ -474,14 +474,15 @@ static const struct file_operations vcs_fops = {
 
 static struct class *vc_class;
 
-void vcs_make_devfs(struct tty_struct *tty)
+void vcs_make_sysfs(struct tty_struct *tty)
 {
        class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1),
                        NULL, "vcs%u", tty->index + 1);
        class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129),
                        NULL, "vcsa%u", tty->index + 1);
 }
-void vcs_remove_devfs(struct tty_struct *tty)
+
+void vcs_remove_sysfs(struct tty_struct *tty)
 {
        class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1));
        class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129));
index da7e66a2a38b5dcda25270c6b4329069f36a886f..fb75da940b59c971472812795b3094966b5c8b73 100644 (file)
  *
  * Removed console_lock, enabled interrupts across all console operations
  * 13 March 2001, Andrew Morton
+ *
+ * Fixed UTF-8 mode so alternate charset modes always work according
+ * to control sequences interpreted in do_con_trol function
+ * preserving backward VT100 semigraphics compatibility,
+ * malformed UTF sequences represented as sequences of replacement glyphs,
+ * original codes or '?' as a last resort if replacement glyph is undefined
+ * by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006
  */
 
 #include <linux/module.h>
@@ -128,8 +135,8 @@ const struct consw *conswitchp;
 #define DEFAULT_BELL_PITCH     750
 #define DEFAULT_BELL_DURATION  (HZ/8)
 
-extern void vcs_make_devfs(struct tty_struct *tty);
-extern void vcs_remove_devfs(struct tty_struct *tty);
+extern void vcs_make_sysfs(struct tty_struct *tty);
+extern void vcs_remove_sysfs(struct tty_struct *tty);
 
 extern void console_map_init(void);
 #ifdef CONFIG_PROM_CONSOLE
@@ -730,7 +737,8 @@ int vc_allocate(unsigned int currcons)      /* return 0 on success */
            visual_init(vc, currcons, 1);
            if (!*vc->vc_uni_pagedir_loc)
                con_set_default_unimap(vc);
-           vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
+           if (!vc->vc_kmalloced)
+               vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
            if (!vc->vc_screenbuf) {
                kfree(vc);
                vc_cons[currcons].d = NULL;
@@ -878,8 +886,17 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
        return err;
 }
 
+int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
+{
+       int rc;
+
+       acquire_console_sem();
+       rc = vc_resize(vc, cols, lines);
+       release_console_sem();
+       return rc;
+}
 
-void vc_disallocate(unsigned int currcons)
+void vc_deallocate(unsigned int currcons)
 {
        WARN_CONSOLE_UNLOCKED();
 
@@ -2005,17 +2022,23 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
                /* Do no translation at all in control states */
                if (vc->vc_state != ESnormal) {
                        tc = c;
-               } else if (vc->vc_utf) {
+               } else if (vc->vc_utf && !vc->vc_disp_ctrl) {
                    /* Combine UTF-8 into Unicode */
-                   /* Incomplete characters silently ignored */
+                   /* Malformed sequences as sequences of replacement glyphs */
+rescan_last_byte:
                    if(c > 0x7f) {
-                       if (vc->vc_utf_count > 0 && (c & 0xc0) == 0x80) {
-                               vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f);
-                               vc->vc_utf_count--;
-                               if (vc->vc_utf_count == 0)
-                                   tc = c = vc->vc_utf_char;
-                               else continue;
+                       if (vc->vc_utf_count) {
+                              if ((c & 0xc0) == 0x80) {
+                                      vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f);
+                                              if (--vc->vc_utf_count) {
+                                              vc->vc_npar++;
+                                              continue;
+                                              }
+                                      tc = c = vc->vc_utf_char;
+                              } else
+                                      goto replacement_glyph;
                        } else {
+                               vc->vc_npar = 0;
                                if ((c & 0xe0) == 0xc0) {
                                    vc->vc_utf_count = 1;
                                    vc->vc_utf_char = (c & 0x1f);
@@ -2032,14 +2055,15 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
                                    vc->vc_utf_count = 5;
                                    vc->vc_utf_char = (c & 0x01);
                                } else
-                                   vc->vc_utf_count = 0;
+                                   goto replacement_glyph;
                                continue;
                              }
                    } else {
+                     if (vc->vc_utf_count)
+                             goto replacement_glyph;
                      tc = c;
-                     vc->vc_utf_count = 0;
                    }
-               } else {        /* no utf */
+               } else {        /* no utf or alternate charset mode */
                  tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c];
                }
 
@@ -2054,31 +2078,33 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
                  * direct-to-font zone in UTF-8 mode.
                  */
                 ok = tc && (c >= 32 ||
-                           (!vc->vc_utf && !(((vc->vc_disp_ctrl ? CTRL_ALWAYS
-                                               : CTRL_ACTION) >> c) & 1)))
+                           !(vc->vc_disp_ctrl ? (CTRL_ALWAYS >> c) & 1 :
+                                 vc->vc_utf || ((CTRL_ACTION >> c) & 1)))
                        && (c != 127 || vc->vc_disp_ctrl)
                        && (c != 128+27);
 
                if (vc->vc_state == ESnormal && ok) {
                        /* Now try to find out how to display it */
                        tc = conv_uni_to_pc(vc, tc);
-                       if ( tc == -4 ) {
+                       if (tc & ~charmask) {
+                               if ( tc == -4 ) {
                                 /* If we got -4 (not found) then see if we have
                                    defined a replacement character (U+FFFD) */
-                                tc = conv_uni_to_pc(vc, 0xfffd);
-
-                               /* One reason for the -4 can be that we just
-                                  did a clear_unimap();
-                                  try at least to show something. */
-                               if (tc == -4)
-                                    tc = c;
-                        } else if ( tc == -3 ) {
-                                /* Bad hash table -- hope for the best */
-                                tc = c;
-                        }
-                       if (tc & ~charmask)
-                                continue; /* Conversion failed */
+replacement_glyph:
+                                       tc = conv_uni_to_pc(vc, 0xfffd);
+                                       if (!(tc & ~charmask))
+                                               goto display_glyph;
+                               } else if ( tc != -3 )
+                                       continue; /* nothing to display */
+                                /* no hash table or no replacement --
+                                * hope for the best */
+                               if ( c & ~charmask )
+                                       tc = '?';
+                               else
+                                       tc = c;
+                       }
 
+display_glyph:
                        if (vc->vc_need_wrap || vc->vc_decim)
                                FLUSH
                        if (vc->vc_need_wrap) {
@@ -2102,6 +2128,15 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
                                vc->vc_x++;
                                draw_to = (vc->vc_pos += 2);
                        }
+                       if (vc->vc_utf_count) {
+                               if (vc->vc_npar) {
+                                       vc->vc_npar--;
+                                       goto display_glyph;
+                               }
+                               vc->vc_utf_count = 0;
+                               c = orig;
+                               goto rescan_last_byte;
+                       }
                        continue;
                }
                FLUSH
@@ -2498,7 +2533,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
                                tty->winsize.ws_col = vc_cons[currcons].d->vc_cols;
                        }
                        release_console_sem();
-                       vcs_make_devfs(tty);
+                       vcs_make_sysfs(tty);
                        return ret;
                }
        }
@@ -2511,7 +2546,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
  * and taking a ref against the tty while we're in the process of forgetting
  * about it and cleaning things up.
  *
- * This is because vcs_remove_devfs() can sleep and will drop the BKL.
+ * This is because vcs_remove_sysfs() can sleep and will drop the BKL.
  */
 static void con_close(struct tty_struct *tty, struct file *filp)
 {
@@ -2524,7 +2559,7 @@ static void con_close(struct tty_struct *tty, struct file *filp)
                        vc->vc_tty = NULL;
                tty->driver_data = NULL;
                release_console_sem();
-               vcs_remove_devfs(tty);
+               vcs_remove_sysfs(tty);
                mutex_unlock(&tty_mutex);
                /*
                 * tty_mutex is released, but we still hold BKL, so there is
@@ -3765,6 +3800,7 @@ EXPORT_SYMBOL(default_blu);
 EXPORT_SYMBOL(update_region);
 EXPORT_SYMBOL(redraw_screen);
 EXPORT_SYMBOL(vc_resize);
+EXPORT_SYMBOL(vc_lock_resize);
 EXPORT_SYMBOL(fg_console);
 EXPORT_SYMBOL(console_blank_hook);
 EXPORT_SYMBOL(console_blanked);
index a5628a8b66207a4420c99f91565a6746495b14ee..a53e382cc10747b2e73a9386c67a78f73700582f 100644 (file)
@@ -96,7 +96,7 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str
                if (!perm)
                        return -EPERM;
                if (!i && v == K_NOSUCHMAP) {
-                       /* disallocate map */
+                       /* deallocate map */
                        key_map = key_maps[s];
                        if (s && key_map) {
                            key_maps[s] = NULL;
@@ -819,20 +819,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (arg > MAX_NR_CONSOLES)
                        return -ENXIO;
                if (arg == 0) {
-                   /* disallocate all unused consoles, but leave 0 */
+                   /* deallocate all unused consoles, but leave 0 */
                        acquire_console_sem();
                        for (i=1; i<MAX_NR_CONSOLES; i++)
                                if (! VT_BUSY(i))
-                                       vc_disallocate(i);
+                                       vc_deallocate(i);
                        release_console_sem();
                } else {
-                       /* disallocate a single console, if possible */
+                       /* deallocate a single console, if possible */
                        arg--;
                        if (VT_BUSY(arg))
                                return -EBUSY;
                        if (arg) {                            /* leave 0 */
                                acquire_console_sem();
-                               vc_disallocate(arg);
+                               vc_deallocate(arg);
                                release_console_sem();
                        }
                }
@@ -847,11 +847,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (get_user(ll, &vtsizes->v_rows) ||
                    get_user(cc, &vtsizes->v_cols))
                        return -EFAULT;
-               for (i = 0; i < MAX_NR_CONSOLES; i++) {
-                       acquire_console_sem();
-                       vc_resize(vc_cons[i].d, cc, ll);
-                       release_console_sem();
-               }
+               for (i = 0; i < MAX_NR_CONSOLES; i++)
+                       vc_lock_resize(vc_cons[i].d, cc, ll);
                return 0;
        }
 
index f114d7b5bb2a0f195933cb377099c09fa4becb83..77ab7e020da0a8ee2672a379d79f93aed3235899 100644 (file)
@@ -165,6 +165,13 @@ config EP93XX_WATCHDOG
          To compile this driver as a module, choose M here: the
          module will be called ep93xx_wdt.
 
+config OMAP_WATCHDOG
+       tristate "OMAP Watchdog"
+       depends on WATCHDOG && (ARCH_OMAP16XX || ARCH_OMAP24XX)
+       help
+         Support for TI OMAP1610/OMAP1710/OMAP2420 watchdog.  Say 'Y' here to
+         enable the OMAP1610/OMAP1710 watchdog timer.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
index 6ab77b61a6434635a8a6e2ba8716d2b000bcf56a..5099f8be8cc51efab2bc38d98dfd2df495833daf 100644 (file)
@@ -24,6 +24,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
 
 # ARM Architecture
 obj-$(CONFIG_AT91_WATCHDOG) += at91_wdt.o
+obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
 obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
 obj-$(CONFIG_977_WATCHDOG) += wdt977.o
 obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
diff --git a/drivers/char/watchdog/omap_wdt.c b/drivers/char/watchdog/omap_wdt.c
new file mode 100644 (file)
index 0000000..8f90b90
--- /dev/null
@@ -0,0 +1,391 @@
+/*
+ * linux/drivers/char/watchdog/omap_wdt.c
+ *
+ * Watchdog driver for the TI OMAP 16xx & 24xx 32KHz (non-secure) watchdog
+ *
+ * Author: MontaVista Software, Inc.
+ *      <gdavis@mvista.com> or <source@mvista.com>
+ *
+ * 2003 (c) MontaVista Software, Inc. This file is licensed under the
+ * terms of the GNU General Public License version 2. This program is
+ * licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ *
+ * History:
+ *
+ * 20030527: George G. Davis <gdavis@mvista.com>
+ *     Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c
+ *     (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
+ *     Based on SoftDog driver by Alan Cox <alan@redhat.com>
+ *
+ * Copyright (c) 2004 Texas Instruments.
+ *     1. Modified to support OMAP1610 32-KHz watchdog timer
+ *     2. Ported to 2.6 kernel
+ *
+ * Copyright (c) 2005 David Brownell
+ *     Use the driver model and standard identifiers; handle bigger timeouts.
+ */
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/reboot.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/moduleparam.h>
+#include <linux/clk.h>
+
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#include <asm/hardware.h>
+#include <asm/bitops.h>
+
+#include <asm/arch/prcm.h>
+
+#include "omap_wdt.h"
+
+static unsigned timer_margin;
+module_param(timer_margin, uint, 0);
+MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
+
+static int omap_wdt_users;
+static struct clk *armwdt_ck = NULL;
+static struct clk *mpu_wdt_ick = NULL;
+static struct clk *mpu_wdt_fck = NULL;
+
+static unsigned int wdt_trgr_pattern = 0x1234;
+
+static void omap_wdt_ping(void)
+{
+       /* wait for posted write to complete */
+       while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x08)
+               cpu_relax();
+       wdt_trgr_pattern = ~wdt_trgr_pattern;
+       omap_writel(wdt_trgr_pattern, (OMAP_WATCHDOG_TGR));
+       /* wait for posted write to complete */
+       while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x08)
+               cpu_relax();
+       /* reloaded WCRR from WLDR */
+}
+
+static void omap_wdt_enable(void)
+{
+       /* Sequence to enable the watchdog */
+       omap_writel(0xBBBB, OMAP_WATCHDOG_SPR);
+       while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x10)
+               cpu_relax();
+       omap_writel(0x4444, OMAP_WATCHDOG_SPR);
+       while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x10)
+               cpu_relax();
+}
+
+static void omap_wdt_disable(void)
+{
+       /* sequence required to disable watchdog */
+       omap_writel(0xAAAA, OMAP_WATCHDOG_SPR); /* TIMER_MODE */
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x10)
+               cpu_relax();
+       omap_writel(0x5555, OMAP_WATCHDOG_SPR); /* TIMER_MODE */
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x10)
+               cpu_relax();
+}
+
+static void omap_wdt_adjust_timeout(unsigned new_timeout)
+{
+       if (new_timeout < TIMER_MARGIN_MIN)
+               new_timeout = TIMER_MARGIN_DEFAULT;
+       if (new_timeout > TIMER_MARGIN_MAX)
+               new_timeout = TIMER_MARGIN_MAX;
+       timer_margin = new_timeout;
+}
+
+static void omap_wdt_set_timeout(void)
+{
+       u32 pre_margin = GET_WLDR_VAL(timer_margin);
+
+       /* just count up at 32 KHz */
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x04)
+               cpu_relax();
+       omap_writel(pre_margin, OMAP_WATCHDOG_LDR);
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x04)
+               cpu_relax();
+}
+
+/*
+ *     Allow only one task to hold it open
+ */
+
+static int omap_wdt_open(struct inode *inode, struct file *file)
+{
+       if (test_and_set_bit(1, (unsigned long *)&omap_wdt_users))
+               return -EBUSY;
+
+       if (cpu_is_omap16xx())
+               clk_enable(armwdt_ck);  /* Enable the clock */
+
+       if (cpu_is_omap24xx()) {
+               clk_enable(mpu_wdt_ick);    /* Enable the interface clock */
+               clk_enable(mpu_wdt_fck);    /* Enable the functional clock */
+       }
+
+       /* initialize prescaler */
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x01)
+               cpu_relax();
+       omap_writel((1 << 5) | (PTV << 2), OMAP_WATCHDOG_CNTRL);
+       while (omap_readl(OMAP_WATCHDOG_WPS) & 0x01)
+               cpu_relax();
+
+       omap_wdt_set_timeout();
+       omap_wdt_enable();
+       return 0;
+}
+
+static int omap_wdt_release(struct inode *inode, struct file *file)
+{
+       /*
+        *      Shut off the timer unless NOWAYOUT is defined.
+        */
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+       omap_wdt_disable();
+
+       if (cpu_is_omap16xx()) {
+               clk_disable(armwdt_ck); /* Disable the clock */
+               clk_put(armwdt_ck);
+               armwdt_ck = NULL;
+       }
+
+       if (cpu_is_omap24xx()) {
+               clk_disable(mpu_wdt_ick);       /* Disable the clock */
+               clk_disable(mpu_wdt_fck);       /* Disable the clock */
+               clk_put(mpu_wdt_ick);
+               clk_put(mpu_wdt_fck);
+               mpu_wdt_ick = NULL;
+               mpu_wdt_fck = NULL;
+       }
+#else
+       printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n");
+#endif
+       omap_wdt_users = 0;
+       return 0;
+}
+
+static ssize_t
+omap_wdt_write(struct file *file, const char __user *data,
+               size_t len, loff_t *ppos)
+{
+       /* Refresh LOAD_TIME. */
+       if (len)
+               omap_wdt_ping();
+       return len;
+}
+
+static int
+omap_wdt_ioctl(struct inode *inode, struct file *file,
+       unsigned int cmd, unsigned long arg)
+{
+       int new_margin;
+       static struct watchdog_info ident = {
+               .identity = "OMAP Watchdog",
+               .options = WDIOF_SETTIMEOUT,
+               .firmware_version = 0,
+       };
+
+       switch (cmd) {
+       default:
+               return -ENOIOCTLCMD;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user((struct watchdog_info __user *)arg, &ident,
+                               sizeof(ident));
+       case WDIOC_GETSTATUS:
+               return put_user(0, (int __user *)arg);
+       case WDIOC_GETBOOTSTATUS:
+               if (cpu_is_omap16xx())
+                       return put_user(omap_readw(ARM_SYSST),
+                                       (int __user *)arg);
+               if (cpu_is_omap24xx())
+                       return put_user(omap_prcm_get_reset_sources(),
+                                       (int __user *)arg);
+       case WDIOC_KEEPALIVE:
+               omap_wdt_ping();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_margin, (int __user *)arg))
+                       return -EFAULT;
+               omap_wdt_adjust_timeout(new_margin);
+
+               omap_wdt_disable();
+               omap_wdt_set_timeout();
+               omap_wdt_enable();
+
+               omap_wdt_ping();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timer_margin, (int __user *)arg);
+       }
+}
+
+static struct file_operations omap_wdt_fops = {
+       .owner = THIS_MODULE,
+       .write = omap_wdt_write,
+       .ioctl = omap_wdt_ioctl,
+       .open = omap_wdt_open,
+       .release = omap_wdt_release,
+};
+
+static struct miscdevice omap_wdt_miscdev = {
+       .minor = WATCHDOG_MINOR,
+       .name = "watchdog",
+       .fops = &omap_wdt_fops
+};
+
+static int __init omap_wdt_probe(struct platform_device *pdev)
+{
+       struct resource *res, *mem;
+       int ret;
+
+       /* reserve static register mappings */
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -ENOENT;
+
+       mem = request_mem_region(res->start, res->end - res->start + 1,
+                                pdev->name);
+       if (mem == NULL)
+               return -EBUSY;
+
+       platform_set_drvdata(pdev, mem);
+
+       omap_wdt_users = 0;
+
+       if (cpu_is_omap16xx()) {
+               armwdt_ck = clk_get(&pdev->dev, "armwdt_ck");
+               if (IS_ERR(armwdt_ck)) {
+                       ret = PTR_ERR(armwdt_ck);
+                       armwdt_ck = NULL;
+                       goto fail;
+               }
+       }
+
+       if (cpu_is_omap24xx()) {
+               mpu_wdt_ick = clk_get(&pdev->dev, "mpu_wdt_ick");
+               if (IS_ERR(mpu_wdt_ick)) {
+                       ret = PTR_ERR(mpu_wdt_ick);
+                       mpu_wdt_ick = NULL;
+                       goto fail;
+               }
+               mpu_wdt_fck = clk_get(&pdev->dev, "mpu_wdt_fck");
+               if (IS_ERR(mpu_wdt_fck)) {
+                       ret = PTR_ERR(mpu_wdt_fck);
+                       mpu_wdt_fck = NULL;
+                       goto fail;
+               }
+       }
+
+       omap_wdt_disable();
+       omap_wdt_adjust_timeout(timer_margin);
+
+       omap_wdt_miscdev.dev = &pdev->dev;
+       ret = misc_register(&omap_wdt_miscdev);
+       if (ret)
+               goto fail;
+
+       pr_info("OMAP Watchdog Timer: initial timeout %d sec\n", timer_margin);
+
+       /* autogate OCP interface clock */
+       omap_writel(0x01, OMAP_WATCHDOG_SYS_CONFIG);
+       return 0;
+
+fail:
+       if (armwdt_ck)
+               clk_put(armwdt_ck);
+       if (mpu_wdt_ick)
+               clk_put(mpu_wdt_ick);
+       if (mpu_wdt_fck)
+               clk_put(mpu_wdt_fck);
+       release_resource(mem);
+       return ret;
+}
+
+static void omap_wdt_shutdown(struct platform_device *pdev)
+{
+       omap_wdt_disable();
+}
+
+static int omap_wdt_remove(struct platform_device *pdev)
+{
+       struct resource *mem = platform_get_drvdata(pdev);
+       misc_deregister(&omap_wdt_miscdev);
+       release_resource(mem);
+       if (armwdt_ck)
+               clk_put(armwdt_ck);
+       if (mpu_wdt_ick)
+               clk_put(mpu_wdt_ick);
+       if (mpu_wdt_fck)
+               clk_put(mpu_wdt_fck);
+       return 0;
+}
+
+#ifdef CONFIG_PM
+
+/* REVISIT ... not clear this is the best way to handle system suspend; and
+ * it's very inappropriate for selective device suspend (e.g. suspending this
+ * through sysfs rather than by stopping the watchdog daemon).  Also, this
+ * may not play well enough with NOWAYOUT...
+ */
+
+static int omap_wdt_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       if (omap_wdt_users)
+               omap_wdt_disable();
+       return 0;
+}
+
+static int omap_wdt_resume(struct platform_device *pdev)
+{
+       if (omap_wdt_users) {
+               omap_wdt_enable();
+               omap_wdt_ping();
+       }
+       return 0;
+}
+
+#else
+#define        omap_wdt_suspend        NULL
+#define        omap_wdt_resume         NULL
+#endif
+
+static struct platform_driver omap_wdt_driver = {
+       .probe          = omap_wdt_probe,
+       .remove         = omap_wdt_remove,
+       .shutdown       = omap_wdt_shutdown,
+       .suspend        = omap_wdt_suspend,
+       .resume         = omap_wdt_resume,
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = "omap_wdt",
+       },
+};
+
+static int __init omap_wdt_init(void)
+{
+       return platform_driver_register(&omap_wdt_driver);
+}
+
+static void __exit omap_wdt_exit(void)
+{
+       platform_driver_unregister(&omap_wdt_driver);
+}
+
+module_init(omap_wdt_init);
+module_exit(omap_wdt_exit);
+
+MODULE_AUTHOR("George G. Davis");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/omap_wdt.h b/drivers/char/watchdog/omap_wdt.h
new file mode 100644 (file)
index 0000000..52a532a
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *  linux/drivers/char/watchdog/omap_wdt.h
+ *
+ *  BRIEF MODULE DESCRIPTION
+ *      OMAP Watchdog timer register definitions
+ *
+ *  Copyright (C) 2004 Texas Instruments.
+ *
+ *  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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
+ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+ *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
+ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  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.,
+ *  675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _OMAP_WATCHDOG_H
+#define _OMAP_WATCHDOG_H
+
+#define OMAP1610_WATCHDOG_BASE         0xfffeb000
+#define OMAP2420_WATCHDOG_BASE         0x48022000      /*WDT Timer 2 */
+
+#ifdef CONFIG_ARCH_OMAP24XX
+#define OMAP_WATCHDOG_BASE             OMAP2420_WATCHDOG_BASE
+#else
+#define OMAP_WATCHDOG_BASE             OMAP1610_WATCHDOG_BASE
+#define RM_RSTST_WKUP                  0
+#endif
+
+#define OMAP_WATCHDOG_REV              (OMAP_WATCHDOG_BASE + 0x00)
+#define OMAP_WATCHDOG_SYS_CONFIG       (OMAP_WATCHDOG_BASE + 0x10)
+#define OMAP_WATCHDOG_STATUS           (OMAP_WATCHDOG_BASE + 0x14)
+#define OMAP_WATCHDOG_CNTRL            (OMAP_WATCHDOG_BASE + 0x24)
+#define OMAP_WATCHDOG_CRR              (OMAP_WATCHDOG_BASE + 0x28)
+#define OMAP_WATCHDOG_LDR              (OMAP_WATCHDOG_BASE + 0x2c)
+#define OMAP_WATCHDOG_TGR              (OMAP_WATCHDOG_BASE + 0x30)
+#define OMAP_WATCHDOG_WPS              (OMAP_WATCHDOG_BASE + 0x34)
+#define OMAP_WATCHDOG_SPR              (OMAP_WATCHDOG_BASE + 0x48)
+
+/* Using the prescaler, the OMAP watchdog could go for many
+ * months before firing.  These limits work without scaling,
+ * with the 60 second default assumed by most tools and docs.
+ */
+#define TIMER_MARGIN_MAX       (24 * 60 * 60)  /* 1 day */
+#define TIMER_MARGIN_DEFAULT   60      /* 60 secs */
+#define TIMER_MARGIN_MIN       1
+
+#define PTV                    0       /* prescale */
+#define GET_WLDR_VAL(secs)     (0xffffffff - ((secs) * (32768/(1<<PTV))) + 1)
+
+#endif                         /* _OMAP_WATCHDOG_H */
index b9e3886d9e1618cc4b85345e81a8a2c23fb876ea..b8b596d5778dbe03295395eccbad2176a25c3bfa 100644 (file)
@@ -123,6 +123,26 @@ static void __init dmi_save_devices(struct dmi_header *dm)
                dev->type = *d++ & 0x7f;
                dev->name = dmi_string(dm, *d);
                dev->device_data = NULL;
+               list_add(&dev->list, &dmi_devices);
+       }
+}
+
+static void __init dmi_save_oem_strings_devices(struct dmi_header *dm)
+{
+       int i, count = *(u8 *)(dm + 1);
+       struct dmi_device *dev;
+
+       for (i = 1; i <= count; i++) {
+               dev = dmi_alloc(sizeof(*dev));
+               if (!dev) {
+                       printk(KERN_ERR
+                          "dmi_save_oem_strings_devices: out of memory.\n");
+                       break;
+               }
+
+               dev->type = DMI_DEV_TYPE_OEM_STRING;
+               dev->name = dmi_string(dm, i);
+               dev->device_data = NULL;
 
                list_add(&dev->list, &dmi_devices);
        }
@@ -181,6 +201,9 @@ static void __init dmi_decode(struct dmi_header *dm)
        case 10:        /* Onboard Devices Information */
                dmi_save_devices(dm);
                break;
+       case 11:        /* OEM Strings */
+               dmi_save_oem_strings_devices(dm);
+               break;
        case 38:        /* IPMI Device Information */
                dmi_save_ipmi_device(dm);
        }
index 8f2b1f0deb813b6876fa233c525094ea522e1cf7..0ca599d3b4029851ddf022bab424759824060ec2 100644 (file)
@@ -210,8 +210,8 @@ static int __init i2c_sibyte_init(void)
 
 static void __exit i2c_sibyte_exit(void)
 {
-       i2c_del_bus(&sibyte_board_adapter[0]);
-       i2c_del_bus(&sibyte_board_adapter[1]);
+       i2c_del_adapter(&sibyte_board_adapter[0]);
+       i2c_del_adapter(&sibyte_board_adapter[1]);
 }
 
 module_init(i2c_sibyte_init);
index a574de5f083572933ce68c5898ccae7192d5218c..d55b938b1aebeb83bc7d60e3016e7e2b28fdc40b 100644 (file)
@@ -318,6 +318,20 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
        hwif->drives[0].autodma = hwif->autodma;
 }
 
+static void __devinit init_hwif_sb600_legacy(ide_hwif_t *hwif)
+{
+
+       hwif->atapi_dma = 1;
+       hwif->ultra_mask = 0x7f;
+       hwif->mwdma_mask = 0x07;
+       hwif->swdma_mask = 0x07;
+
+       if (!noautodma)
+               hwif->autodma = 1;
+       hwif->drives[0].autodma = hwif->autodma;
+       hwif->drives[1].autodma = hwif->autodma;
+}
+
 static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
        {       /* 0 */
                .name           = "ATIIXP",
@@ -326,6 +340,12 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
                .autodma        = AUTODMA,
                .enablebits     = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
                .bootable       = ON_BOARD,
+       },{     /* 1 */
+               .name           = "ATI SB600 SATA Legacy IDE",
+               .init_hwif      = init_hwif_sb600_legacy,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
        }
 };
 
@@ -348,6 +368,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
        { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, PCI_ANY_ID, PCI_ANY_ID, (PCI_CLASS_STORAGE_IDE<<8)|0x8a, 0xffff05, 1},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
index 9cbf09e2052f87d5845b41a3d348f129f7f5250d..60d3fbdd216c72833958cca3b51db16e3cd3d722 100644 (file)
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(rdma_copy_addr);
 int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
 {
        struct net_device *dev;
-       u32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
+       __be32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
        int ret;
 
        dev = ip_dev_find(ip);
@@ -239,7 +239,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in,
 {
        struct net_device *dev;
        u32 src_ip = src_in->sin_addr.s_addr;
-       u32 dst_ip = dst_in->sin_addr.s_addr;
+       __be32 dst_ip = dst_in->sin_addr.s_addr;
        int ret;
 
        dev = ip_dev_find(dst_ip);
index a9dda56f62c412a8af7b4be41edb94abe847b361..83eac3a66bc801d11f11d6f1535f3894b9950f18 100644 (file)
@@ -183,4 +183,13 @@ config KEYBOARD_HIL
          This driver implements support for HIL-keyboards attached
          to your machine, so normally you should say Y here.
 
+config KEYBOARD_OMAP
+       tristate "TI OMAP keypad support"
+       depends on (ARCH_OMAP1 || ARCH_OMAP2)
+       help
+         Say Y here if you want to use the OMAP keypad.
+
+         To compile this driver as a module, choose M here: the
+         module will be called omap-keypad.
+
 endif
index 2708167ba17585c062a74d7d7e5ac7946da99ad2..b265391f1f10a226e6054d3496cb296f3deeafc7 100644 (file)
@@ -15,4 +15,5 @@ obj-$(CONFIG_KEYBOARD_CORGI)          += corgikbd.o
 obj-$(CONFIG_KEYBOARD_SPITZ)           += spitzkbd.o
 obj-$(CONFIG_KEYBOARD_HIL)             += hil_kbd.o
 obj-$(CONFIG_KEYBOARD_HIL_OLD)         += hilkbd.o
+obj-$(CONFIG_KEYBOARD_OMAP)             += omap-keypad.o
 
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
new file mode 100644 (file)
index 0000000..d436287
--- /dev/null
@@ -0,0 +1,492 @@
+/*
+ * linux/drivers/input/keyboard/omap-keypad.c
+ *
+ * OMAP Keypad Driver
+ *
+ * Copyright (C) 2003 Nokia Corporation
+ * Written by Timo Teräs <ext-timo.teras@nokia.com>
+ *
+ * Added support for H2 & H3 Keypad
+ * Copyright (C) 2004 Texas Instruments
+ *
+ * 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
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/types.h>
+#include <linux/input.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/errno.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
+#include <asm/arch/menelaus.h>
+#include <asm/irq.h>
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+#include <asm/arch/mux.h>
+
+#undef NEW_BOARD_LEARNING_MODE
+
+static void omap_kp_tasklet(unsigned long);
+static void omap_kp_timer(unsigned long);
+
+static unsigned char keypad_state[8];
+static DEFINE_MUTEX(kp_enable_mutex);
+static int kp_enable = 1;
+static int kp_cur_group = -1;
+
+struct omap_kp {
+       struct input_dev *input;
+       struct timer_list timer;
+       int irq;
+       unsigned int rows;
+       unsigned int cols;
+       unsigned long delay;
+       unsigned int debounce;
+};
+
+DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
+
+static int *keymap;
+static unsigned int *row_gpios;
+static unsigned int *col_gpios;
+
+#ifdef CONFIG_ARCH_OMAP2
+static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value)
+{
+       int col;
+       for (col = 0; col < omap_kp->cols; col++) {
+               if (value & (1 << col))
+                       omap_set_gpio_dataout(col_gpios[col], 1);
+               else
+                       omap_set_gpio_dataout(col_gpios[col], 0);
+       }
+}
+
+static u8 get_row_gpio_val(struct omap_kp *omap_kp)
+{
+       int row;
+       u8 value = 0;
+
+       for (row = 0; row < omap_kp->rows; row++) {
+               if (omap_get_gpio_datain(row_gpios[row]))
+                       value |= (1 << row);
+       }
+       return value;
+}
+#else
+#define                set_col_gpio_val(x, y)  do {} while (0)
+#define                get_row_gpio_val(x)     0
+#endif
+
+static irqreturn_t omap_kp_interrupt(int irq, void *dev_id,
+                                    struct pt_regs *regs)
+{
+       struct omap_kp *omap_kp = dev_id;
+
+       /* disable keyboard interrupt and schedule for handling */
+       if (cpu_is_omap24xx()) {
+               int i;
+               for (i = 0; i < omap_kp->rows; i++)
+                       disable_irq(OMAP_GPIO_IRQ(row_gpios[i]));
+       } else
+               /* disable keyboard interrupt and schedule for handling */
+               omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+
+       tasklet_schedule(&kp_tasklet);
+
+       return IRQ_HANDLED;
+}
+
+static void omap_kp_timer(unsigned long data)
+{
+       tasklet_schedule(&kp_tasklet);
+}
+
+static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
+{
+       int col = 0;
+
+       /* read the keypad status */
+       if (cpu_is_omap24xx()) {
+               int i;
+               for (i = 0; i < omap_kp->rows; i++)
+                       disable_irq(OMAP_GPIO_IRQ(row_gpios[i]));
+
+               /* read the keypad status */
+               for (col = 0; col < omap_kp->cols; col++) {
+                       set_col_gpio_val(omap_kp, ~(1 << col));
+                       state[col] = ~(get_row_gpio_val(omap_kp)) & 0x3f;
+               }
+               set_col_gpio_val(omap_kp, 0);
+
+       } else {
+               /* disable keyboard interrupt and schedule for handling */
+               omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+
+               /* read the keypad status */
+               omap_writew(0xff, OMAP_MPUIO_BASE + OMAP_MPUIO_KBC);
+               for (col = 0; col < omap_kp->cols; col++) {
+                       omap_writew(~(1 << col) & 0xff,
+                                   OMAP_MPUIO_BASE + OMAP_MPUIO_KBC);
+
+                       udelay(omap_kp->delay);
+
+                       state[col] = ~omap_readw(OMAP_MPUIO_BASE +
+                                                OMAP_MPUIO_KBR_LATCH) & 0xff;
+               }
+               omap_writew(0x00, OMAP_MPUIO_BASE + OMAP_MPUIO_KBC);
+               udelay(2);
+       }
+}
+
+static inline int omap_kp_find_key(int col, int row)
+{
+       int i, key;
+
+       key = KEY(col, row, 0);
+       for (i = 0; keymap[i] != 0; i++)
+               if ((keymap[i] & 0xff000000) == key)
+                       return keymap[i] & 0x00ffffff;
+       return -1;
+}
+
+static void omap_kp_tasklet(unsigned long data)
+{
+       struct omap_kp *omap_kp_data = (struct omap_kp *) data;
+       unsigned char new_state[8], changed, key_down = 0;
+       int col, row;
+       int spurious = 0;
+
+       /* check for any changes */
+       omap_kp_scan_keypad(omap_kp_data, new_state);
+
+       /* check for changes and print those */
+       for (col = 0; col < omap_kp_data->cols; col++) {
+               changed = new_state[col] ^ keypad_state[col];
+               key_down |= new_state[col];
+               if (changed == 0)
+                       continue;
+
+               for (row = 0; row < omap_kp_data->rows; row++) {
+                       int key;
+                       if (!(changed & (1 << row)))
+                               continue;
+#ifdef NEW_BOARD_LEARNING_MODE
+                       printk(KERN_INFO "omap-keypad: key %d-%d %s\n", col,
+                              row, (new_state[col] & (1 << row)) ?
+                              "pressed" : "released");
+#else
+                       key = omap_kp_find_key(col, row);
+                       if (key < 0) {
+                               printk(KERN_WARNING
+                                     "omap-keypad: Spurious key event %d-%d\n",
+                                      col, row);
+                               /* We scan again after a couple of seconds */
+                               spurious = 1;
+                               continue;
+                       }
+
+                       if (!(kp_cur_group == (key & GROUP_MASK) ||
+                             kp_cur_group == -1))
+                               continue;
+
+                       kp_cur_group = key & GROUP_MASK;
+                       input_report_key(omap_kp_data->input, key & ~GROUP_MASK,
+                                        new_state[col] & (1 << row));
+#endif
+               }
+       }
+       memcpy(keypad_state, new_state, sizeof(keypad_state));
+
+       if (key_down) {
+                int delay = HZ / 20;
+               /* some key is pressed - keep irq disabled and use timer
+                * to poll the keypad */
+               if (spurious)
+                       delay = 2 * HZ;
+               mod_timer(&omap_kp_data->timer, jiffies + delay);
+       } else {
+               /* enable interrupts */
+               if (cpu_is_omap24xx()) {
+                       int i;
+                       for (i = 0; i < omap_kp_data->rows; i++)
+                               enable_irq(OMAP_GPIO_IRQ(row_gpios[i]));
+               } else {
+                       omap_writew(0, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+                       kp_cur_group = -1;
+               }
+       }
+}
+
+static ssize_t omap_kp_enable_show(struct device *dev,
+                                  struct device_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%u\n", kp_enable);
+}
+
+static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute *attr,
+                                   const char *buf, size_t count)
+{
+       int state;
+
+       if (sscanf(buf, "%u", &state) != 1)
+               return -EINVAL;
+
+       if ((state != 1) && (state != 0))
+               return -EINVAL;
+
+       mutex_lock(&kp_enable_mutex);
+       if (state != kp_enable) {
+               if (state)
+                       enable_irq(INT_KEYBOARD);
+               else
+                       disable_irq(INT_KEYBOARD);
+               kp_enable = state;
+       }
+       mutex_unlock(&kp_enable_mutex);
+
+       return strnlen(buf, count);
+}
+
+static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, omap_kp_enable_show, omap_kp_enable_store);
+
+#ifdef CONFIG_PM
+static int omap_kp_suspend(struct platform_device *dev, pm_message_t state)
+{
+       /* Nothing yet */
+
+       return 0;
+}
+
+static int omap_kp_resume(struct platform_device *dev)
+{
+       /* Nothing yet */
+
+       return 0;
+}
+#else
+#define omap_kp_suspend        NULL
+#define omap_kp_resume NULL
+#endif
+
+static int __init omap_kp_probe(struct platform_device *pdev)
+{
+       struct omap_kp *omap_kp;
+       struct input_dev *input_dev;
+       struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
+       int i, col_idx, row_idx, irq_idx, ret;
+
+       if (!pdata->rows || !pdata->cols || !pdata->keymap) {
+               printk(KERN_ERR "No rows, cols or keymap from pdata\n");
+               return -EINVAL;
+       }
+
+       omap_kp = kzalloc(sizeof(struct omap_kp), GFP_KERNEL);
+       input_dev = input_allocate_device();
+       if (!omap_kp || !input_dev) {
+               kfree(omap_kp);
+               input_free_device(input_dev);
+               return -ENOMEM;
+       }
+
+       platform_set_drvdata(pdev, omap_kp);
+
+       omap_kp->input = input_dev;
+
+       /* Disable the interrupt for the MPUIO keyboard */
+       if (!cpu_is_omap24xx())
+               omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+
+       keymap = pdata->keymap;
+
+       if (pdata->rep)
+               set_bit(EV_REP, input_dev->evbit);
+
+       if (pdata->delay)
+               omap_kp->delay = pdata->delay;
+
+       if (pdata->row_gpios && pdata->col_gpios) {
+               row_gpios = pdata->row_gpios;
+               col_gpios = pdata->col_gpios;
+       }
+
+       omap_kp->rows = pdata->rows;
+       omap_kp->cols = pdata->cols;
+
+       if (cpu_is_omap24xx()) {
+               /* Cols: outputs */
+               for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
+                       if (omap_request_gpio(col_gpios[col_idx]) < 0) {
+                               printk(KERN_ERR "Failed to request"
+                                      "GPIO%d for keypad\n",
+                                      col_gpios[col_idx]);
+                               goto err1;
+                       }
+                       omap_set_gpio_direction(col_gpios[col_idx], 0);
+               }
+               /* Rows: inputs */
+               for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) {
+                       if (omap_request_gpio(row_gpios[row_idx]) < 0) {
+                               printk(KERN_ERR "Failed to request"
+                                      "GPIO%d for keypad\n",
+                                      row_gpios[row_idx]);
+                               goto err2;
+                       }
+                       omap_set_gpio_direction(row_gpios[row_idx], 1);
+               }
+       }
+
+       setup_timer(&omap_kp->timer, omap_kp_timer, (unsigned long)omap_kp);
+
+       /* get the irq and init timer*/
+       tasklet_enable(&kp_tasklet);
+       kp_tasklet.data = (unsigned long) omap_kp;
+
+       ret = device_create_file(&pdev->dev, &dev_attr_enable);
+       if (ret < 0)
+               goto err2;
+
+       /* setup input device */
+       set_bit(EV_KEY, input_dev->evbit);
+       for (i = 0; keymap[i] != 0; i++)
+               set_bit(keymap[i] & KEY_MAX, input_dev->keybit);
+       input_dev->name = "omap-keypad";
+       input_dev->phys = "omap-keypad/input0";
+       input_dev->cdev.dev = &pdev->dev;
+       input_dev->private = omap_kp;
+
+       input_dev->id.bustype = BUS_HOST;
+       input_dev->id.vendor = 0x0001;
+       input_dev->id.product = 0x0001;
+       input_dev->id.version = 0x0100;
+
+       input_dev->keycode = keymap;
+       input_dev->keycodesize = sizeof(unsigned int);
+       input_dev->keycodemax = pdata->keymapsize;
+
+       ret = input_register_device(omap_kp->input);
+       if (ret < 0) {
+               printk(KERN_ERR "Unable to register omap-keypad input device\n");
+               goto err3;
+       }
+
+       if (pdata->dbounce)
+               omap_writew(0xff, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_DEBOUNCING);
+
+       /* scan current status and enable interrupt */
+       omap_kp_scan_keypad(omap_kp, keypad_state);
+       if (!cpu_is_omap24xx()) {
+               omap_kp->irq = platform_get_irq(pdev, 0);
+               if (omap_kp->irq >= 0) {
+                       if (request_irq(omap_kp->irq, omap_kp_interrupt, 0,
+                                       "omap-keypad", omap_kp) < 0)
+                               goto err4;
+               }
+               omap_writew(0, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+       } else {
+               for (irq_idx = 0; irq_idx < omap_kp->rows; irq_idx++) {
+                       if (request_irq(OMAP_GPIO_IRQ(row_gpios[irq_idx]),
+                                       omap_kp_interrupt,
+                                       IRQF_TRIGGER_FALLING,
+                                       "omap-keypad", omap_kp) < 0)
+                               goto err5;
+               }
+       }
+       return 0;
+err5:
+       for (i = irq_idx-1; i >=0; i--)
+               free_irq(row_gpios[i], 0);
+err4:
+       input_unregister_device(omap_kp->input);
+       input_dev = NULL;
+err3:
+       device_remove_file(&pdev->dev, &dev_attr_enable);
+err2:
+       for (i = row_idx-1; i >=0; i--)
+               omap_free_gpio(row_gpios[i]);
+err1:
+       for (i = col_idx-1; i >=0; i--)
+               omap_free_gpio(col_gpios[i]);
+
+       kfree(omap_kp);
+       input_free_device(input_dev);
+
+       return -EINVAL;
+}
+
+static int omap_kp_remove(struct platform_device *pdev)
+{
+       struct omap_kp *omap_kp = platform_get_drvdata(pdev);
+
+       /* disable keypad interrupt handling */
+       tasklet_disable(&kp_tasklet);
+       if (cpu_is_omap24xx()) {
+               int i;
+               for (i = 0; i < omap_kp->cols; i++)
+                       omap_free_gpio(col_gpios[i]);
+               for (i = 0; i < omap_kp->rows; i++) {
+                       omap_free_gpio(row_gpios[i]);
+                       free_irq(OMAP_GPIO_IRQ(row_gpios[i]), 0);
+               }
+       } else {
+               omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
+               free_irq(omap_kp->irq, 0);
+       }
+
+       del_timer_sync(&omap_kp->timer);
+       tasklet_kill(&kp_tasklet);
+
+       /* unregister everything */
+       input_unregister_device(omap_kp->input);
+
+       kfree(omap_kp);
+
+       return 0;
+}
+
+static struct platform_driver omap_kp_driver = {
+       .probe          = omap_kp_probe,
+       .remove         = omap_kp_remove,
+       .suspend        = omap_kp_suspend,
+       .resume         = omap_kp_resume,
+       .driver         = {
+               .name   = "omap-keypad",
+       },
+};
+
+static int __devinit omap_kp_init(void)
+{
+       printk(KERN_INFO "OMAP Keypad Driver\n");
+       return platform_driver_register(&omap_kp_driver);
+}
+
+static void __exit omap_kp_exit(void)
+{
+       platform_driver_unregister(&omap_kp_driver);
+}
+
+module_init(omap_kp_init);
+module_exit(omap_kp_exit);
+
+MODULE_AUTHOR("Timo Teräs");
+MODULE_DESCRIPTION("OMAP Keypad Driver");
+MODULE_LICENSE("GPL");
index 43da8ae1b2ada35d4b2f2bf51ef9a4f2a37f74a5..1f8d6ae66b41e47ac2be94ef6d44d25ffdc72b7b 100644 (file)
@@ -1614,8 +1614,8 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
        struct sk_buff *skb;
        unsigned char *p;
        struct in_device *in_dev = NULL;
-       u32 addr = 0;           /* local ipv4 address */
-       u32 mask = 0;           /* local netmask */
+       __be32 addr = 0;                /* local ipv4 address */
+       __be32 mask = 0;                /* local netmask */
 
        if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) {
                /* take primary(first) address of interface */
index 713c4a8aa77dc347af774edc6ddf2f11fe58176b..45ba3d45bcb8a8387461883ae050aa308213a812 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/leds.h>
 #include <linux/err.h>
 #include <asm/io.h>
+#include <linux/nsc_gpio.h>
 #include <linux/scx200_gpio.h>
 
 #define DRVNAME "net48xx-led"
@@ -26,10 +27,7 @@ static struct platform_device *pdev;
 static void net48xx_error_led_set(struct led_classdev *led_cdev,
                enum led_brightness value)
 {
-       if (value)
-               scx200_gpio_set_high(NET48XX_ERROR_LED_GPIO);
-       else
-               scx200_gpio_set_low(NET48XX_ERROR_LED_GPIO);
+       scx200_gpio_ops.gpio_set(NET48XX_ERROR_LED_GPIO, value ? 1 : 0);
 }
 
 static struct led_classdev net48xx_error_led = {
@@ -81,7 +79,8 @@ static int __init net48xx_led_init(void)
 {
        int ret;
 
-       if (!scx200_gpio_present()) {
+       /* small hack, but scx200_gpio doesn't set .dev if the probe fails */
+       if (!scx200_gpio_ops.dev) {
                ret = -ENODEV;
                goto out;
        }
index a82f313d9dc97681a8d7220d25d1faa5de6eceb0..6c29fe727c0f4ea7ee30d1daac58dc5efc309fc6 100644 (file)
@@ -16,7 +16,7 @@
 #define MAX_PMU_LEVEL 0xFF
 
 static struct backlight_properties pmu_backlight_data;
-static spinlock_t pmu_backlight_lock;
+static DEFINE_SPINLOCK(pmu_backlight_lock);
 static int sleeping;
 static u8 bl_curve[FB_BACKLIGHT_LEVELS];
 
index aceb61d9fbc8dcbc377610ac0f95e4f6b5d1c40f..83f79de7174beea3859afa905fe31b73a2bb50e4 100644 (file)
@@ -397,12 +397,7 @@ static int wf_sat_detach(struct i2c_client *client)
 
 static int __init sat_sensors_init(void)
 {
-       int err;
-
-       err = i2c_add_driver(&wf_sat_driver);
-       if (err < 0)
-               return err;
-       return 0;
+       return i2c_add_driver(&wf_sat_driver);
 }
 
 static void __exit sat_sensors_exit(void)
index 02776814443e24df9218fed9b703542e6d66c614..82938ad6ddbd8282752af18c91dcdf37e33b392a 100644 (file)
@@ -58,6 +58,7 @@ static int adcsync;
 static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
 {
        struct input_dev *idev = ts->idev;
+
        input_report_abs(idev, ABS_X, x);
        input_report_abs(idev, ABS_Y, y);
        input_report_abs(idev, ABS_PRESSURE, pressure);
@@ -67,6 +68,7 @@ static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x
 static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
 {
        struct input_dev *idev = ts->idev;
+
        input_report_abs(idev, ABS_PRESSURE, 0);
        input_sync(idev);
 }
@@ -189,6 +191,7 @@ static inline unsigned int ucb1x00_ts_read_yres(struct ucb1x00_ts *ts)
 static inline int ucb1x00_ts_pen_down(struct ucb1x00_ts *ts)
 {
        unsigned int val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR);
+
        if (machine_is_collie())
                return (!(val & (UCB_TS_CR_TSPX_LOW)));
        else
@@ -291,6 +294,7 @@ static int ucb1x00_thread(void *_ts)
 static void ucb1x00_ts_irq(int idx, void *id)
 {
        struct ucb1x00_ts *ts = id;
+
        ucb1x00_disable_irq(ts->ucb, UCB_IRQ_TSPX, UCB_FALLING);
        wake_up(&ts->irq_wait);
 }
@@ -372,36 +376,43 @@ static int ucb1x00_ts_resume(struct ucb1x00_dev *dev)
 static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
 {
        struct ucb1x00_ts *ts;
+       struct input_dev *idev;
+       int err;
 
        ts = kzalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL);
-       if (!ts)
-               return -ENOMEM;
-
-       ts->idev = input_allocate_device();
-       if (!ts->idev) {
-               kfree(ts);
-               return -ENOMEM;
+       idev = input_allocate_device();
+       if (!ts || !idev) {
+               err = -ENOMEM;
+               goto fail;
        }
 
        ts->ucb = dev->ucb;
+       ts->idev = idev;
        ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
 
-       ts->idev->private = ts;
-       ts->idev->name       = "Touchscreen panel";
-       ts->idev->id.product = ts->ucb->id;
-       ts->idev->open       = ucb1x00_ts_open;
-       ts->idev->close      = ucb1x00_ts_close;
+       idev->private    = ts;
+       idev->name       = "Touchscreen panel";
+       idev->id.product = ts->ucb->id;
+       idev->open       = ucb1x00_ts_open;
+       idev->close      = ucb1x00_ts_close;
 
-       __set_bit(EV_ABS, ts->idev->evbit);
-       __set_bit(ABS_X, ts->idev->absbit);
-       __set_bit(ABS_Y, ts->idev->absbit);
-       __set_bit(ABS_PRESSURE, ts->idev->absbit);
+       __set_bit(EV_ABS, idev->evbit);
+       __set_bit(ABS_X, idev->absbit);
+       __set_bit(ABS_Y, idev->absbit);
+       __set_bit(ABS_PRESSURE, idev->absbit);
 
-       input_register_device(ts->idev);
+       err = input_register_device(idev);
+       if (err)
+               goto fail;
 
        dev->priv = ts;
 
        return 0;
+
+ fail:
+       input_free_device(idev);
+       kfree(ts);
+       return err;
 }
 
 static void ucb1x00_ts_remove(struct ucb1x00_dev *dev)
index 5b6b05ed8f3c90553d5b9d710e39d4da54edb74d..9d34056147ad5c4c026b74e58a59ffc99cb1ec62 100644 (file)
@@ -299,7 +299,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
         *      Slow phase with lock held.
         */
 
-       disable_irq_nosync_lockdep(dev->irq);
+       disable_irq_nosync_lockdep_irqsave(dev->irq, &flags);
 
        spin_lock(&ei_local->page_lock);
 
@@ -338,7 +338,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
                netif_stop_queue(dev);
                outb_p(ENISR_ALL, e8390_base + EN0_IMR);
                spin_unlock(&ei_local->page_lock);
-               enable_irq_lockdep(dev->irq);
+               enable_irq_lockdep_irqrestore(dev->irq, &flags);
                ei_local->stat.tx_errors++;
                return 1;
        }
@@ -379,7 +379,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
        outb_p(ENISR_ALL, e8390_base + EN0_IMR);
 
        spin_unlock(&ei_local->page_lock);
-       enable_irq_lockdep(dev->irq);
+       enable_irq_lockdep_irqrestore(dev->irq, &flags);
 
        dev_kfree_skb (skb);
        ei_local->stat.tx_bytes += send_length;
index 63154774c257be95f733aef42320439aec55cd92..ff8a8c0a26d5ce33c227ab5b75cabc63472c3649 100644 (file)
@@ -24,6 +24,9 @@ config NETDEVICES
 
          If unsure, say Y.
 
+# All the following symbols are dependent on NETDEVICES - do not repeat
+# that for each of the symbols.
+if NETDEVICES
 
 config IFB
        tristate "Intermediate Functional Block support"
@@ -2852,6 +2855,8 @@ config NETCONSOLE
        If you want to log kernel messages over the network, enable this.
        See <file:Documentation/networking/netconsole.txt> for details.
 
+endif #NETDEVICES
+
 config NETPOLL
        def_bool NETCONSOLE
 
index 7f7dd450226a8f853224a987302a21b2bf24acc2..b98592a8bac8034fb899c6b7f6c452be1b1bb68e 100644 (file)
@@ -145,9 +145,7 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
 
        /* Create the Extended DDP header */
        ddp = (struct ddpehdr *)skb->data;
-        ddp->deh_len = skb->len;
-        ddp->deh_hops = 1;
-        ddp->deh_pad = 0;
+        ddp->deh_len_hops = htons(skb->len + (1<<10));
         ddp->deh_sum = 0;
 
        /*
@@ -170,7 +168,6 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
         ddp->deh_sport = 72;
 
         *((__u8 *)(ddp+1)) = 22;               /* ddp type = IP */
-        *((__u16 *)ddp)=ntohs(*((__u16 *)ddp));        /* fix up length field */
 
         skb->protocol = htons(ETH_P_ATALK);     /* Protocol has changed */
 
index 0fb5f653d3cebe4b41acdc4759d1934eb745542e..c0bbddae4ec41ef998d38f17a0a0c4ec8bd28a54 100644 (file)
@@ -2252,7 +2252,7 @@ static u32 bond_glean_dev_ip(struct net_device *dev)
 {
        struct in_device *idev;
        struct in_ifaddr *ifa;
-       u32 addr = 0;
+       __be32 addr = 0;
 
        if (!dev)
                return 0;
index 22ac2df1aeb0c513e0d4822cafe5e938d56826c6..e17a1449ee105366dcb0caccc703216edd7ee537 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/8xx_immap.h>
 #include <asm/pgtable.h>
@@ -37,7 +38,6 @@
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 #include <asm/commproc.h>
-#include <asm/dma-mapping.h>
 
 #include "fec_8xx.h"
 
index 95022c005f75cb3497f269476b00657e87b4c493..92590d8fc24b4ee39b9e7bf7175132d5fa5a9002 100644 (file)
@@ -6,11 +6,10 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/phy.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/fs_enet_pd.h>
 
-#include <asm/dma-mapping.h>
-
 #ifdef CONFIG_CPM1
 #include <asm/commproc.h>
 
index e9e6d99a9add263619e2278f756b59ab29709aa4..7c8ccc09b60126a448a70c1ef4e3f77975a1f434 100644 (file)
@@ -287,6 +287,7 @@ comment "FIR device drivers"
 config USB_IRDA
        tristate "IrDA USB dongles"
        depends on IRDA && USB
+       select FW_LOADER
        ---help---
          Say Y here if you want to build support for the USB IrDA FIR Dongle
          device driver.  To compile it as a module, choose M here: the module
index cb62f2a9676aeb7d46395c162aed054939f93de5..7185a4ee3c1e4bf6070840964c93355bcdcad7c7 100644 (file)
@@ -110,7 +110,7 @@ static nsc_chip_t chips[] = {
        { "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf8, 
          nsc_ircc_probe_338, nsc_ircc_init_338 },
        /* Contributed by Steffen Pingel - IBM X40 */
-       { "PC8738x", { 0x164e, 0x4e, 0x0 }, 0x20, 0xf4, 0xff,
+       { "PC8738x", { 0x164e, 0x4e, 0x2e }, 0x20, 0xf4, 0xff,
          nsc_ircc_probe_39x, nsc_ircc_init_39x },
        /* Contributed by Jan Frey - IBM A30/A31 */
        { "PC8739x", { 0x2e, 0x4e, 0x0 }, 0x20, 0xea, 0xff, 
index 2eff45bedc7cbc28a0f819fe44e43feece707bfe..22358ff68c4c7d2fe200a0e5517efb21600a9802 100644 (file)
@@ -2354,6 +2354,26 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
 #define PCIID_VENDOR_INTEL 0x8086
 #define PCIID_VENDOR_ALI 0x10b9
 static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = {
+       /*
+        * Subsystems needing entries:
+        * 0x10b9:0x1533 0x103c:0x0850 HP nx9010 family
+        * 0x10b9:0x1533 0x0e11:0x005a Compaq nc4000 family
+        * 0x8086:0x24cc 0x0e11:0x002a HP nx9000 family
+        */
+       {
+               /* Guessed entry */
+               .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
+               .device = 0x24cc,
+               .subvendor = 0x103c,
+               .subdevice = 0x08bc,
+               .sir_io = 0x02f8,
+               .fir_io = 0x0130,
+               .fir_irq = 0x05,
+               .fir_dma = 0x03,
+               .cfg_base = 0x004e,
+               .preconfigure = preconfigure_through_82801,
+               .name = "HP nx5000 family",
+       },
        {
                .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
                .device = 0x24cc,
@@ -2366,7 +2386,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
                .fir_dma = 0x03,
                .cfg_base = 0x004e,
                .preconfigure = preconfigure_through_82801,
-               .name = "HP nc8000",
+               .name = "HP nc8000 family",
        },
        {
                .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
@@ -2379,7 +2399,21 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini
                .fir_dma = 0x03,
                .cfg_base = 0x004e,
                .preconfigure = preconfigure_through_82801,
-               .name = "HP nc6000",
+               .name = "HP nc6000 family",
+       },
+       {
+               .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
+               .device = 0x24cc,
+               .subvendor = 0x0e11,
+               .subdevice = 0x0860,
+               /* I assume these are the same for x1000 as for the others */
+               .sir_io = 0x02e8,
+               .fir_io = 0x02f8,
+               .fir_irq = 0x07,
+               .fir_dma = 0x03,
+               .cfg_base = 0x002e,
+               .preconfigure = preconfigure_through_82801,
+               .name = "Compaq x1000 family",
        },
        {
                /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */
index d61b208b52a215d4825a72cd3929f57263c8f6d9..12103c93f7efb4622da065c77c9f184bdd76c10f 100644 (file)
@@ -149,8 +149,6 @@ enum StirFifoCtlMask {
        FIFOCTL_DIR = 0x10,
        FIFOCTL_CLR = 0x08,
        FIFOCTL_EMPTY = 0x04,
-       FIFOCTL_RXERR = 0x02,
-       FIFOCTL_TXERR = 0x01,
 };
 
 enum StirDiagMask {
@@ -615,19 +613,6 @@ static int fifo_txwait(struct stir_cb *stir, int space)
 
                pr_debug("fifo status 0x%lx count %lu\n", status, count);
 
-               /* error when receive/transmit fifo gets confused */
-               if (status & FIFOCTL_RXERR) {
-                       stir->stats.rx_fifo_errors++;
-                       stir->stats.rx_errors++;
-                       break;
-               }
-
-               if (status & FIFOCTL_TXERR) {
-                       stir->stats.tx_fifo_errors++;
-                       stir->stats.tx_errors++;
-                       break;
-               }
-
                /* is fifo receiving already, or empty */
                if (!(status & FIFOCTL_DIR)
                    || (status & FIFOCTL_EMPTY))
index 79b85f327500c4e553bccf2c69007d2e22e89468..d916e1257c471d8df1c14e172f9a25963a2c00b8 100644 (file)
@@ -1223,8 +1223,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
 
        IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len);
 
+       if ((len - 4) < 2) {
+               self->stats.rx_dropped++;
+               return FALSE;
+       }
+
        skb = dev_alloc_skb(len + 1);
-       if ((skb == NULL) || ((len - 4) < 2)) {
+       if (skb == NULL) {
                self->stats.rx_dropped++;
                return FALSE;
        }
index f429b19bf620edddfeb955077504cb67c20d4e1f..4178b4b1d2df544a5b7c20fe90a0c0b02727ddcf 100644 (file)
@@ -161,15 +161,13 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
        return(0);
 }
 
+static struct net_device_stats loopback_stats;
+
 static struct net_device_stats *get_stats(struct net_device *dev)
 {
-       struct net_device_stats *stats = dev->priv;
+       struct net_device_stats *stats = &loopback_stats;
        int i;
 
-       if (!stats) {
-               return NULL;
-       }
-
        memset(stats, 0, sizeof(struct net_device_stats));
 
        for_each_possible_cpu(i) {
@@ -185,19 +183,28 @@ static struct net_device_stats *get_stats(struct net_device *dev)
        return stats;
 }
 
-static u32 loopback_get_link(struct net_device *dev)
+static u32 always_on(struct net_device *dev)
 {
        return 1;
 }
 
 static const struct ethtool_ops loopback_ethtool_ops = {
-       .get_link               = loopback_get_link,
+       .get_link               = always_on,
        .get_tso                = ethtool_op_get_tso,
        .set_tso                = ethtool_op_set_tso,
+       .get_tx_csum            = always_on,
+       .get_sg                 = always_on,
+       .get_rx_csum            = always_on,
 };
 
+/*
+ * The loopback device is special. There is only one instance and
+ * it is statically allocated. Don't do this for other devices.
+ */
 struct net_device loopback_dev = {
        .name                   = "lo",
+       .get_stats              = &get_stats,
+       .priv                   = &loopback_stats,
        .mtu                    = (16 * 1024) + 20 + 20 + 12,
        .hard_start_xmit        = loopback_xmit,
        .hard_header            = eth_header,
@@ -221,16 +228,6 @@ struct net_device loopback_dev = {
 /* Setup and register the loopback device. */
 int __init loopback_init(void)
 {
-       struct net_device_stats *stats;
-
-       /* Can survive without statistics */
-       stats = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
-       if (stats) {
-               memset(stats, 0, sizeof(struct net_device_stats));
-               loopback_dev.priv = stats;
-               loopback_dev.get_stats = &get_stats;
-       }
-
        return register_netdev(&loopback_dev);
 };
 
index 5666ed998142475420fbd3f0a5e220a98f1afb6e..0adee733b76121126c4cbfcf0cbed8f9aadbc087 100644 (file)
@@ -600,6 +600,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
                                   dev->hard_header_len);
 
+               po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr);
                po->chan.private = sk;
                po->chan.ops = &pppoe_chan_ops;
 
index c660e33f43a2e35bbc7723ced259629bd740936f..fedd1a37bc3e71fa631ea9ebb39b97d1e0cf6e15 100644 (file)
@@ -195,6 +195,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define        SMC_IRQ_FLAGS (( \
                   machine_is_omap_h2() \
                || machine_is_omap_h3() \
+               || machine_is_omap_h4() \
                || (machine_is_omap_innovator() && !cpu_is_omap1510()) \
        ) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING)
 
index aaf45b907a786aaa9028e60fcf6d38668653ad6d..c25ba273b74596b9727d00d695b1083229efdf36 100644 (file)
@@ -68,8 +68,8 @@
 
 #define DRV_MODULE_NAME                "tg3"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "3.65"
-#define DRV_MODULE_RELDATE     "August 07, 2006"
+#define DRV_MODULE_VERSION     "3.66"
+#define DRV_MODULE_RELDATE     "September 23, 2006"
 
 #define TG3_DEF_MAC_MODE       0
 #define TG3_DEF_RX_MODE                0
@@ -173,6 +173,7 @@ static struct pci_device_id tg3_pci_tbl[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705F)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5720)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5722)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M)},
@@ -187,6 +188,7 @@ static struct pci_device_id tg3_pci_tbl[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5754M)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5756)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)},
@@ -197,6 +199,8 @@ static struct pci_device_id tg3_pci_tbl[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906M)},
        {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
        {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
        {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -424,6 +428,16 @@ static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val)
                readl(mbox);
 }
 
+static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off)
+{
+       return (readl(tp->regs + off + GRCMBOX_BASE));
+}
+
+static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
+{
+       writel(val, tp->regs + off + GRCMBOX_BASE);
+}
+
 #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val)
 #define tw32_mailbox_f(reg, val)       tw32_mailbox_flush(tp, (reg), (val))
 #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val)
@@ -439,6 +453,10 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
 {
        unsigned long flags;
 
+       if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) &&
+           (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC))
+               return;
+
        spin_lock_irqsave(&tp->indirect_lock, flags);
        if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
                pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
@@ -460,6 +478,12 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
 {
        unsigned long flags;
 
+       if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) &&
+           (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) {
+               *val = 0;
+               return;
+       }
+
        spin_lock_irqsave(&tp->indirect_lock, flags);
        if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
                pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
@@ -489,6 +513,9 @@ static inline void tg3_cond_int(struct tg3 *tp)
        if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) &&
            (tp->hw_status->status & SD_STATUS_UPDATED))
                tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
+       else
+               tw32(HOSTCC_MODE, tp->coalesce_mode |
+                    (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW));
 }
 
 static void tg3_enable_ints(struct tg3 *tp)
@@ -654,6 +681,10 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
        unsigned int loops;
        int ret;
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
+           (reg == MII_TG3_CTRL || reg == MII_TG3_AUX_CTRL))
+               return 0;
+
        if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) {
                tw32_f(MAC_MI_MODE,
                     (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL));
@@ -1004,6 +1035,24 @@ out:
                                 phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC);
        }
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               u32 phy_reg;
+
+               /* adjust output voltage */
+               tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x12);
+
+               if (!tg3_readphy(tp, MII_TG3_EPHY_TEST, &phy_reg)) {
+                       u32 phy_reg2;
+
+                       tg3_writephy(tp, MII_TG3_EPHY_TEST,
+                                    phy_reg | MII_TG3_EPHY_SHADOW_EN);
+                       /* Enable auto-MDIX */
+                       if (!tg3_readphy(tp, 0x10, &phy_reg2))
+                               tg3_writephy(tp, 0x10, phy_reg2 | 0x4000);
+                       tg3_writephy(tp, MII_TG3_EPHY_TEST, phy_reg);
+               }
+       }
+
        tg3_phy_set_wirespeed(tp);
        return 0;
 }
@@ -1117,6 +1166,15 @@ static void tg3_nvram_unlock(struct tg3 *);
 
 static void tg3_power_down_phy(struct tg3 *tp)
 {
+       if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
+               return;
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) {
+               tg3_writephy(tp, MII_TG3_EXT_CTRL,
+                            MII_TG3_EXT_CTRL_FORCE_LED_OFF);
+               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
+       }
+
        /* The PHY should not be powered down on some chips because
         * of bugs.
         */
@@ -1199,7 +1257,12 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                tg3_setup_phy(tp, 0);
        }
 
-       if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               u32 val;
+
+               val = tr32(GRC_VCPU_EXT_CTRL);
+               tw32(GRC_VCPU_EXT_CTRL, val | GRC_VCPU_EXT_CTRL_DISABLE_WOL);
+       } else if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
                int i;
                u32 val;
 
@@ -1223,7 +1286,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                        tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a);
                        udelay(40);
 
-                       mac_mode = MAC_MODE_PORT_MODE_MII;
+                       if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)
+                               mac_mode = MAC_MODE_PORT_MODE_GMII;
+                       else
+                               mac_mode = MAC_MODE_PORT_MODE_MII;
 
                        if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 ||
                            !(tp->tg3_flags & TG3_FLAG_WOL_SPEED_100MB))
@@ -1301,15 +1367,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
        }
 
        if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) &&
-           !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
-               /* Turn off the PHY */
-               if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
-                       tg3_writephy(tp, MII_TG3_EXT_CTRL,
-                                    MII_TG3_EXT_CTRL_FORCE_LED_OFF);
-                       tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
-                       tg3_power_down_phy(tp);
-               }
-       }
+           !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF))
+               tg3_power_down_phy(tp);
 
        tg3_frob_aux_power(tp);
 
@@ -1467,6 +1526,13 @@ static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8
                break;
 
        default:
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+                       *speed = (val & MII_TG3_AUX_STAT_100) ? SPEED_100 :
+                                SPEED_10;
+                       *duplex = (val & MII_TG3_AUX_STAT_FULL) ? DUPLEX_FULL :
+                                 DUPLEX_HALF;
+                       break;
+               }
                *speed = SPEED_INVALID;
                *duplex = DUPLEX_INVALID;
                break;
@@ -1749,7 +1815,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
 
        if (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT)
                tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG);
-       else
+       else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
                tg3_writephy(tp, MII_TG3_IMASK, ~0);
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -2406,24 +2472,27 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
        expected_sg_dig_ctrl |= (1 << 12);
 
        if (sg_dig_ctrl != expected_sg_dig_ctrl) {
+               if ((tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) &&
+                   tp->serdes_counter &&
+                   ((mac_status & (MAC_STATUS_PCS_SYNCED |
+                                   MAC_STATUS_RCVD_CFG)) ==
+                    MAC_STATUS_PCS_SYNCED)) {
+                       tp->serdes_counter--;
+                       current_link_up = 1;
+                       goto out;
+               }
+restart_autoneg:
                if (workaround)
                        tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000);
                tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1 << 30));
                udelay(5);
                tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl);
 
-               tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
+               tp->serdes_counter = SERDES_AN_TIMEOUT_5704S;
+               tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
        } else if (mac_status & (MAC_STATUS_PCS_SYNCED |
                                 MAC_STATUS_SIGNAL_DET)) {
-               int i;
-
-               /* Giver time to negotiate (~200ms) */
-               for (i = 0; i < 40000; i++) {
-                       sg_dig_status = tr32(SG_DIG_STATUS);
-                       if (sg_dig_status & (0x3))
-                               break;
-                       udelay(5);
-               }
+               sg_dig_status = tr32(SG_DIG_STATUS);
                mac_status = tr32(MAC_STATUS);
 
                if ((sg_dig_status & (1 << 1)) &&
@@ -2439,10 +2508,11 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
 
                        tg3_setup_flow_control(tp, local_adv, remote_adv);
                        current_link_up = 1;
-                       tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED;
+                       tp->serdes_counter = 0;
+                       tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
                } else if (!(sg_dig_status & (1 << 1))) {
-                       if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED)
-                               tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED;
+                       if (tp->serdes_counter)
+                               tp->serdes_counter--;
                        else {
                                if (workaround) {
                                        u32 val = serdes_cfg;
@@ -2466,9 +2536,17 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
                                    !(mac_status & MAC_STATUS_RCVD_CFG)) {
                                        tg3_setup_flow_control(tp, 0, 0);
                                        current_link_up = 1;
-                               }
+                                       tp->tg3_flags2 |=
+                                               TG3_FLG2_PARALLEL_DETECT;
+                                       tp->serdes_counter =
+                                               SERDES_PARALLEL_DET_TIMEOUT;
+                               } else
+                                       goto restart_autoneg;
                        }
                }
+       } else {
+               tp->serdes_counter = SERDES_AN_TIMEOUT_5704S;
+               tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
        }
 
 out:
@@ -2599,14 +2677,16 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
                                    MAC_STATUS_CFG_CHANGED));
                udelay(5);
                if ((tr32(MAC_STATUS) & (MAC_STATUS_SYNC_CHANGED |
-                                        MAC_STATUS_CFG_CHANGED)) == 0)
+                                        MAC_STATUS_CFG_CHANGED |
+                                        MAC_STATUS_LNKSTATE_CHANGED)) == 0)
                        break;
        }
 
        mac_status = tr32(MAC_STATUS);
        if ((mac_status & MAC_STATUS_PCS_SYNCED) == 0) {
                current_link_up = 0;
-               if (tp->link_config.autoneg == AUTONEG_ENABLE) {
+               if (tp->link_config.autoneg == AUTONEG_ENABLE &&
+                   tp->serdes_counter == 0) {
                        tw32_f(MAC_MODE, (tp->mac_mode |
                                          MAC_MODE_SEND_CONFIGS));
                        udelay(1);
@@ -2711,7 +2791,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
                        tg3_writephy(tp, MII_BMCR, bmcr);
 
                        tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
-                       tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
+                       tp->serdes_counter = SERDES_AN_TIMEOUT_5714S;
                        tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
 
                        return err;
@@ -2816,9 +2896,9 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
 
 static void tg3_serdes_parallel_detect(struct tg3 *tp)
 {
-       if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED) {
+       if (tp->serdes_counter) {
                /* Give autoneg time to complete. */
-               tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED;
+               tp->serdes_counter--;
                return;
        }
        if (!netif_carrier_ok(tp->dev) &&
@@ -3535,8 +3615,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id,
 
        if ((sblk->status & SD_STATUS_UPDATED) ||
            !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
-               tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
-                            0x00000001);
+               tg3_disable_ints(tp);
                return IRQ_RETVAL(1);
        }
        return IRQ_RETVAL(0);
@@ -4644,6 +4723,44 @@ static void tg3_write_sig_legacy(struct tg3 *tp, int kind)
        }
 }
 
+static int tg3_poll_fw(struct tg3 *tp)
+{
+       int i;
+       u32 val;
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               for (i = 0; i < 400; i++) {
+                       if (tr32(VCPU_STATUS) & VCPU_STATUS_INIT_DONE)
+                               return 0;
+                       udelay(10);
+               }
+               return -ENODEV;
+       }
+
+       /* Wait for firmware initialization to complete. */
+       for (i = 0; i < 100000; i++) {
+               tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
+               if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
+                       break;
+               udelay(10);
+       }
+
+       /* Chip might not be fitted with firmware.  Some Sun onboard
+        * parts are configured like that.  So don't signal the timeout
+        * of the above loop as an error, but do report the lack of
+        * running firmware once.
+        */
+       if (i >= 100000 &&
+           !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
+               tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
+
+               printk(KERN_INFO PFX "%s: No firmware running.\n",
+                      tp->dev->name);
+       }
+
+       return 0;
+}
+
 static void tg3_stop_fw(struct tg3 *);
 
 /* tp->lock is held. */
@@ -4651,7 +4768,7 @@ static int tg3_chip_reset(struct tg3 *tp)
 {
        u32 val;
        void (*write_op)(struct tg3 *, u32, u32);
-       int i;
+       int err;
 
        tg3_nvram_lock(tp);
 
@@ -4688,6 +4805,12 @@ static int tg3_chip_reset(struct tg3 *tp)
                }
        }
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               tw32(VCPU_STATUS, tr32(VCPU_STATUS) | VCPU_STATUS_DRV_RESET);
+               tw32(GRC_VCPU_EXT_CTRL,
+                    tr32(GRC_VCPU_EXT_CTRL) & ~GRC_VCPU_EXT_CTRL_HALT_CPU);
+       }
+
        if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)
                val |= GRC_MISC_CFG_KEEP_GPHY_POWER;
        tw32(GRC_MISC_CFG, val);
@@ -4811,26 +4934,9 @@ static int tg3_chip_reset(struct tg3 *tp)
                tw32_f(MAC_MODE, 0);
        udelay(40);
 
-       /* Wait for firmware initialization to complete. */
-       for (i = 0; i < 100000; i++) {
-               tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
-               if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
-                       break;
-               udelay(10);
-       }
-
-       /* Chip might not be fitted with firmare.  Some Sun onboard
-        * parts are configured like that.  So don't signal the timeout
-        * of the above loop as an error, but do report the lack of
-        * running firmware once.
-        */
-       if (i >= 100000 &&
-           !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
-               tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
-
-               printk(KERN_INFO PFX "%s: No firmware running.\n",
-                      tp->dev->name);
-       }
+       err = tg3_poll_fw(tp);
+       if (err)
+               return err;
 
        if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
            tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) {
@@ -5036,6 +5142,12 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
        BUG_ON(offset == TX_CPU_BASE &&
            (tp->tg3_flags2 & TG3_FLG2_5705_PLUS));
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               u32 val = tr32(GRC_VCPU_EXT_CTRL);
+
+               tw32(GRC_VCPU_EXT_CTRL, val | GRC_VCPU_EXT_CTRL_HALT_CPU);
+               return 0;
+       }
        if (offset == RX_CPU_BASE) {
                for (i = 0; i < 10000; i++) {
                        tw32(offset + CPU_STATE, 0xffffffff);
@@ -6040,6 +6152,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                val = 1;
        else if (val > tp->rx_std_max_post)
                val = tp->rx_std_max_post;
+       else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               if (tp->pci_chip_rev_id == CHIPREV_ID_5906_A1)
+                       tw32(ISO_PKT_TX, (tr32(ISO_PKT_TX) & ~0x3) | 0x2);
+
+               if (val > (TG3_RX_INTERNAL_RING_SZ_5906 / 2))
+                       val = TG3_RX_INTERNAL_RING_SZ_5906 / 2;
+       }
 
        tw32(RCVBDI_STD_THRESH, val);
 
@@ -6460,7 +6579,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
        if (err)
                return err;
 
-       if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
+       if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) &&
+           GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) {
                u32 tmp;
 
                /* Clear CRC stats. */
@@ -6660,12 +6780,14 @@ static void tg3_timer(unsigned long __opaque)
                                need_setup = 1;
                        }
                        if (need_setup) {
-                               tw32_f(MAC_MODE,
-                                    (tp->mac_mode &
-                                     ~MAC_MODE_PORT_MODE_MASK));
-                               udelay(40);
-                               tw32_f(MAC_MODE, tp->mac_mode);
-                               udelay(40);
+                               if (!tp->serdes_counter) {
+                                       tw32_f(MAC_MODE,
+                                            (tp->mac_mode &
+                                             ~MAC_MODE_PORT_MODE_MASK));
+                                       udelay(40);
+                                       tw32_f(MAC_MODE, tp->mac_mode);
+                                       udelay(40);
+                               }
                                tg3_setup_phy(tp, 0);
                        }
                } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)
@@ -6674,13 +6796,29 @@ static void tg3_timer(unsigned long __opaque)
                tp->timer_counter = tp->timer_multiplier;
        }
 
-       /* Heartbeat is only sent once every 2 seconds.  */
+       /* Heartbeat is only sent once every 2 seconds.
+        *
+        * The heartbeat is to tell the ASF firmware that the host
+        * driver is still alive.  In the event that the OS crashes,
+        * ASF needs to reset the hardware to free up the FIFO space
+        * that may be filled with rx packets destined for the host.
+        * If the FIFO is full, ASF will no longer function properly.
+        *
+        * Unintended resets have been reported on real time kernels
+        * where the timer doesn't run on time.  Netpoll will also have
+        * same problem.
+        *
+        * The new FWCMD_NICDRV_ALIVE3 command tells the ASF firmware
+        * to check the ring condition when the heartbeat is expiring
+        * before doing the reset.  This will prevent most unintended
+        * resets.
+        */
        if (!--tp->asf_counter) {
                if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
                        u32 val;
 
                        tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX,
-                                     FWCMD_NICDRV_ALIVE2);
+                                     FWCMD_NICDRV_ALIVE3);
                        tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4);
                        /* 5 seconds timeout */
                        tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5);
@@ -6721,8 +6859,7 @@ static int tg3_request_irq(struct tg3 *tp)
 static int tg3_test_interrupt(struct tg3 *tp)
 {
        struct net_device *dev = tp->dev;
-       int err, i;
-       u32 int_mbox = 0;
+       int err, i, intr_ok = 0;
 
        if (!netif_running(dev))
                return -ENODEV;
@@ -6743,10 +6880,18 @@ static int tg3_test_interrupt(struct tg3 *tp)
               HOSTCC_MODE_NOW);
 
        for (i = 0; i < 5; i++) {
+               u32 int_mbox, misc_host_ctrl;
+
                int_mbox = tr32_mailbox(MAILBOX_INTERRUPT_0 +
                                        TG3_64BIT_REG_LOW);
-               if (int_mbox != 0)
+               misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL);
+
+               if ((int_mbox != 0) ||
+                   (misc_host_ctrl & MISC_HOST_CTRL_MASK_PCI_INT)) {
+                       intr_ok = 1;
                        break;
+               }
+
                msleep(10);
        }
 
@@ -6759,7 +6904,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
        if (err)
                return err;
 
-       if (int_mbox != 0)
+       if (intr_ok)
                return 0;
 
        return -EIO;
@@ -6936,9 +7081,10 @@ static int tg3_open(struct net_device *dev)
 
                if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
                        if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) {
-                               u32 val = tr32(0x7c04);
+                               u32 val = tr32(PCIE_TRANSACTION_CFG);
 
-                               tw32(0x7c04, val | (1 << 29));
+                               tw32(PCIE_TRANSACTION_CFG,
+                                    val | PCIE_TRANS_CFG_1SHOT_MSI);
                        }
                }
        }
@@ -7857,7 +8003,7 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        if (wol->wolopts & ~WAKE_MAGIC)
                return -EINVAL;
        if ((wol->wolopts & WAKE_MAGIC) &&
-           tp->tg3_flags2 & TG3_FLG2_PHY_SERDES &&
+           tp->tg3_flags2 & TG3_FLG2_ANY_SERDES &&
            !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP))
                return -EINVAL;
 
@@ -7893,7 +8039,8 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
                        return -EINVAL;
                return 0;
        }
-       if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) {
+       if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) &&
+           (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)) {
                if (value)
                        dev->features |= NETIF_F_TSO6;
                else
@@ -8147,6 +8294,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
 
 #define NVRAM_TEST_SIZE 0x100
 #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14
+#define NVRAM_SELFBOOT_HW_SIZE 0x20
+#define NVRAM_SELFBOOT_DATA_SIZE 0x1c
 
 static int tg3_test_nvram(struct tg3 *tp)
 {
@@ -8158,12 +8307,14 @@ static int tg3_test_nvram(struct tg3 *tp)
 
        if (magic == TG3_EEPROM_MAGIC)
                size = NVRAM_TEST_SIZE;
-       else if ((magic & 0xff000000) == 0xa5000000) {
+       else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) {
                if ((magic & 0xe00000) == 0x200000)
                        size = NVRAM_SELFBOOT_FORMAT1_SIZE;
                else
                        return 0;
-       } else
+       } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
+               size = NVRAM_SELFBOOT_HW_SIZE;
+       else
                return -EIO;
 
        buf = kmalloc(size, GFP_KERNEL);
@@ -8182,7 +8333,8 @@ static int tg3_test_nvram(struct tg3 *tp)
                goto out;
 
        /* Selfboot format */
-       if (cpu_to_be32(buf[0]) != TG3_EEPROM_MAGIC) {
+       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) ==
+           TG3_EEPROM_MAGIC_FW) {
                u8 *buf8 = (u8 *) buf, csum8 = 0;
 
                for (i = 0; i < size; i++)
@@ -8197,6 +8349,51 @@ static int tg3_test_nvram(struct tg3 *tp)
                goto out;
        }
 
+       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) ==
+           TG3_EEPROM_MAGIC_HW) {
+               u8 data[NVRAM_SELFBOOT_DATA_SIZE];
+               u8 parity[NVRAM_SELFBOOT_DATA_SIZE];
+               u8 *buf8 = (u8 *) buf;
+               int j, k;
+
+               /* Separate the parity bits and the data bytes.  */
+               for (i = 0, j = 0, k = 0; i < NVRAM_SELFBOOT_HW_SIZE; i++) {
+                       if ((i == 0) || (i == 8)) {
+                               int l;
+                               u8 msk;
+
+                               for (l = 0, msk = 0x80; l < 7; l++, msk >>= 1)
+                                       parity[k++] = buf8[i] & msk;
+                               i++;
+                       }
+                       else if (i == 16) {
+                               int l;
+                               u8 msk;
+
+                               for (l = 0, msk = 0x20; l < 6; l++, msk >>= 1)
+                                       parity[k++] = buf8[i] & msk;
+                               i++;
+
+                               for (l = 0, msk = 0x80; l < 8; l++, msk >>= 1)
+                                       parity[k++] = buf8[i] & msk;
+                               i++;
+                       }
+                       data[j++] = buf8[i];
+               }
+
+               err = -EIO;
+               for (i = 0; i < NVRAM_SELFBOOT_DATA_SIZE; i++) {
+                       u8 hw8 = hweight8(data[i]);
+
+                       if ((hw8 & 0x1) && parity[i])
+                               goto out;
+                       else if (!(hw8 & 0x1) && !parity[i])
+                               goto out;
+               }
+               err = 0;
+               goto out;
+       }
+
        /* Bootstrap checksum at offset 0x10 */
        csum = calc_crc((unsigned char *) buf, 0x10);
        if(csum != cpu_to_le32(buf[0x10/4]))
@@ -8243,7 +8440,7 @@ static int tg3_test_link(struct tg3 *tp)
 /* Only test the commonly used registers */
 static int tg3_test_registers(struct tg3 *tp)
 {
-       int i, is_5705;
+       int i, is_5705, is_5750;
        u32 offset, read_mask, write_mask, val, save_val, read_val;
        static struct {
                u16 offset;
@@ -8251,6 +8448,7 @@ static int tg3_test_registers(struct tg3 *tp)
 #define TG3_FL_5705    0x1
 #define TG3_FL_NOT_5705        0x2
 #define TG3_FL_NOT_5788        0x4
+#define TG3_FL_NOT_5750        0x8
                u32 read_mask;
                u32 write_mask;
        } reg_tbl[] = {
@@ -8361,9 +8559,9 @@ static int tg3_test_registers(struct tg3 *tp)
                        0xffffffff, 0x00000000 },
 
                /* Buffer Manager Control Registers. */
-               { BUFMGR_MB_POOL_ADDR, 0x0000,
+               { BUFMGR_MB_POOL_ADDR, TG3_FL_NOT_5750,
                        0x00000000, 0x007fff80 },
-               { BUFMGR_MB_POOL_SIZE, 0x0000,
+               { BUFMGR_MB_POOL_SIZE, TG3_FL_NOT_5750,
                        0x00000000, 0x007fffff },
                { BUFMGR_MB_RDMA_LOW_WATER, 0x0000,
                        0x00000000, 0x0000003f },
@@ -8389,10 +8587,12 @@ static int tg3_test_registers(struct tg3 *tp)
                { 0xffff, 0x0000, 0x00000000, 0x00000000 },
        };
 
-       if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)
+       is_5705 = is_5750 = 0;
+       if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
                is_5705 = 1;
-       else
-               is_5705 = 0;
+               if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
+                       is_5750 = 1;
+       }
 
        for (i = 0; reg_tbl[i].offset != 0xffff; i++) {
                if (is_5705 && (reg_tbl[i].flags & TG3_FL_NOT_5705))
@@ -8405,6 +8605,9 @@ static int tg3_test_registers(struct tg3 *tp)
                    (reg_tbl[i].flags & TG3_FL_NOT_5788))
                        continue;
 
+               if (is_5750 && (reg_tbl[i].flags & TG3_FL_NOT_5750))
+                       continue;
+
                offset = (u32) reg_tbl[i].offset;
                read_mask = reg_tbl[i].read_mask;
                write_mask = reg_tbl[i].write_mask;
@@ -8496,6 +8699,13 @@ static int tg3_test_memory(struct tg3 *tp)
                { 0x00008000, 0x02000},
                { 0x00010000, 0x0c000},
                { 0xffffffff, 0x00000}
+       }, mem_tbl_5906[] = {
+               { 0x00000200, 0x00008},
+               { 0x00004000, 0x00400},
+               { 0x00006000, 0x00400},
+               { 0x00008000, 0x01000},
+               { 0x00010000, 0x01000},
+               { 0xffffffff, 0x00000}
        };
        struct mem_entry *mem_tbl;
        int err = 0;
@@ -8505,6 +8715,8 @@ static int tg3_test_memory(struct tg3 *tp)
                if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
                    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
                        mem_tbl = mem_tbl_5755;
+               else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+                       mem_tbl = mem_tbl_5906;
                else
                        mem_tbl = mem_tbl_5705;
        } else
@@ -8541,13 +8753,41 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
                        return 0;
 
                mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) |
-                          MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY |
-                          MAC_MODE_PORT_MODE_GMII;
+                          MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY;
+               if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
+                       mac_mode |= MAC_MODE_PORT_MODE_MII;
+               else
+                       mac_mode |= MAC_MODE_PORT_MODE_GMII;
                tw32(MAC_MODE, mac_mode);
        } else if (loopback_mode == TG3_PHY_LOOPBACK) {
-               tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX |
-                                          BMCR_SPEED1000);
+               u32 val;
+
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+                       u32 phytest;
+
+                       if (!tg3_readphy(tp, MII_TG3_EPHY_TEST, &phytest)) {
+                               u32 phy;
+
+                               tg3_writephy(tp, MII_TG3_EPHY_TEST,
+                                            phytest | MII_TG3_EPHY_SHADOW_EN);
+                               if (!tg3_readphy(tp, 0x1b, &phy))
+                                       tg3_writephy(tp, 0x1b, phy & ~0x20);
+                               if (!tg3_readphy(tp, 0x10, &phy))
+                                       tg3_writephy(tp, 0x10, phy & ~0x4000);
+                               tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest);
+                       }
+               }
+               val = BMCR_LOOPBACK | BMCR_FULLDPLX;
+               if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
+                       val |= BMCR_SPEED100;
+               else
+                       val |= BMCR_SPEED1000;
+
+               tg3_writephy(tp, MII_BMCR, val);
                udelay(40);
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+                       tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800);
+
                /* reset to prevent losing 1st rx packet intermittently */
                if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
                        tw32_f(MAC_RX_MODE, RX_MODE_RESET);
@@ -8555,7 +8795,11 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
                        tw32_f(MAC_RX_MODE, tp->rx_mode);
                }
                mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) |
-                          MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII;
+                          MAC_MODE_LINK_POLARITY;
+               if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
+                       mac_mode |= MAC_MODE_PORT_MODE_MII;
+               else
+                       mac_mode |= MAC_MODE_PORT_MODE_GMII;
                if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
                        mac_mode &= ~MAC_MODE_LINK_POLARITY;
                        tg3_writephy(tp, MII_TG3_EXT_CTRL,
@@ -8604,7 +8848,8 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
 
        udelay(10);
 
-       for (i = 0; i < 10; i++) {
+       /* 250 usec to allow enough time on some 10/100 Mbps devices.  */
+       for (i = 0; i < 25; i++) {
                tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE |
                       HOSTCC_MODE_NOW);
 
@@ -8956,7 +9201,9 @@ static void __devinit tg3_get_eeprom_size(struct tg3 *tp)
        if (tg3_nvram_read_swab(tp, 0, &magic) != 0)
                return;
 
-       if ((magic != TG3_EEPROM_MAGIC) && ((magic & 0xff000000) != 0xa5000000))
+       if ((magic != TG3_EEPROM_MAGIC) &&
+           ((magic & TG3_EEPROM_MAGIC_FW_MSK) != TG3_EEPROM_MAGIC_FW) &&
+           ((magic & TG3_EEPROM_MAGIC_HW_MSK) != TG3_EEPROM_MAGIC_HW))
                return;
 
        /*
@@ -9194,6 +9441,13 @@ static void __devinit tg3_get_5787_nvram_info(struct tg3 *tp)
        }
 }
 
+static void __devinit tg3_get_5906_nvram_info(struct tg3 *tp)
+{
+       tp->nvram_jedecnum = JEDEC_ATMEL;
+       tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+       tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
+}
+
 /* Chips other than 5700/5701 use the NVRAM for fetching info. */
 static void __devinit tg3_nvram_init(struct tg3 *tp)
 {
@@ -9230,6 +9484,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
                        tg3_get_5755_nvram_info(tp);
                else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
                        tg3_get_5787_nvram_info(tp);
+               else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+                       tg3_get_5906_nvram_info(tp);
                else
                        tg3_get_nvram_info(tp);
 
@@ -9703,6 +9959,12 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
        /* Assume an onboard device by default.  */
        tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM))
+                       tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
+               return;
+       }
+
        tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
        if (val == NIC_SRAM_DATA_SIG_MAGIC) {
                u32 nic_cfg, led_cfg;
@@ -10034,7 +10296,10 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
        }
 
 out_not_found:
-       strcpy(tp->board_part_number, "none");
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+               strcpy(tp->board_part_number, "BCM95906");
+       else
+               strcpy(tp->board_part_number, "none");
 }
 
 static void __devinit tg3_read_fw_ver(struct tg3 *tp)
@@ -10236,6 +10501,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
            (tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
                tp->tg3_flags2 |= TG3_FLG2_5750_PLUS;
 
@@ -10245,7 +10511,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 
        if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {
                if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
-                   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) {
+                   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
+                   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
                        tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2;
                        tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI;
                } else {
@@ -10262,7 +10529,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
            GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 &&
            GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752 &&
            GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755 &&
-           GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787)
+           GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787 &&
+           GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
                tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE;
 
        if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0)
@@ -10392,6 +10660,12 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
                pci_cmd &= ~PCI_COMMAND_MEMORY;
                pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
        }
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+               tp->read32_mbox = tg3_read32_mbox_5906;
+               tp->write32_mbox = tg3_write32_mbox_5906;
+               tp->write32_tx_mbox = tg3_write32_mbox_5906;
+               tp->write32_rx_mbox = tg3_write32_mbox_5906;
+       }
 
        if (tp->write32 == tg3_write_indirect_reg32 ||
            ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
@@ -10463,6 +10737,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
            ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
             (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
             (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) ||
+           (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) ||
            (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES))
                tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED;
 
@@ -10476,7 +10751,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
                if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
                    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
                        tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG;
-               else
+               else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
                        tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
        }
 
@@ -10566,7 +10841,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
              tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) ||
            (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
             (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F ||
-             tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F)))
+             tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F)) ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
                tp->tg3_flags |= TG3_FLAG_10_100_ONLY;
 
        err = tg3_phy_probe(tp);
@@ -10617,7 +10893,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
         * straddle the 4GB address boundary in some cases.
         */
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
                tp->dev->hard_start_xmit = tg3_start_xmit;
        else
                tp->dev->hard_start_xmit = tg3_start_xmit_dma_bug;
@@ -10698,6 +10975,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
                else
                        tg3_nvram_unlock(tp);
        }
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+               mac_offset = 0x10;
 
        /* First try to get it from MAC address mailbox. */
        tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi);
@@ -11181,6 +11460,12 @@ static void __devinit tg3_init_bufmgr_config(struct tg3 *tp)
                        DEFAULT_MB_MACRX_LOW_WATER_5705;
                tp->bufmgr_config.mbuf_high_water =
                        DEFAULT_MB_HIGH_WATER_5705;
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
+                       tp->bufmgr_config.mbuf_mac_rx_low_water =
+                               DEFAULT_MB_MACRX_LOW_WATER_5906;
+                       tp->bufmgr_config.mbuf_high_water =
+                               DEFAULT_MB_HIGH_WATER_5906;
+               }
 
                tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
                        DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780;
@@ -11224,6 +11509,8 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
        case PHY_ID_BCM5780:    return "5780";
        case PHY_ID_BCM5755:    return "5755";
        case PHY_ID_BCM5787:    return "5787";
+       case PHY_ID_BCM5756:    return "5722/5756";
+       case PHY_ID_BCM5906:    return "5906";
        case PHY_ID_BCM8002:    return "8002/serdes";
        case 0:                 return "serdes";
        default:                return "unknown";
@@ -11526,7 +11813,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
         */
        if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
                dev->features |= NETIF_F_TSO;
-               if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2)
+               if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) &&
+                   (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906))
                        dev->features |= NETIF_F_TSO6;
        }
 
index 3ecf356cfb082e17cc17875aec9eaf0c7e5b3cbb..92f53000bce69f2895dad2183ac37013de7e58cb 100644 (file)
@@ -24,6 +24,8 @@
 
 #define RX_COPY_THRESHOLD              256
 
+#define TG3_RX_INTERNAL_RING_SZ_5906   32
+
 #define RX_STD_MAX_SIZE                        1536
 #define RX_STD_MAX_SIZE_5705           512
 #define RX_JUMBO_MAX_SIZE              0xdeadbeef /* XXX */
 #define  CHIPREV_ID_5752_A0_HW          0x5000
 #define  CHIPREV_ID_5752_A0             0x6000
 #define  CHIPREV_ID_5752_A1             0x6001
+#define  CHIPREV_ID_5906_A1             0xc001
 #define  GET_ASIC_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700                         0x07
 #define   ASIC_REV_5701                         0x00
 #define   ASIC_REV_5714                         0x09
 #define   ASIC_REV_5755                         0x0a
 #define   ASIC_REV_5787                         0x0b
+#define   ASIC_REV_5906                         0x0c
 #define  GET_CHIP_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 8)
 #define   CHIPREV_5700_AX               0x70
 #define   CHIPREV_5700_BX               0x71
 #define  SNDDATAI_SCTRL_FORCE_ZERO      0x00000010
 #define SNDDATAI_STATSENAB             0x00000c0c
 #define SNDDATAI_STATSINCMASK          0x00000c10
-/* 0xc14 --> 0xc80 unused */
+#define ISO_PKT_TX                     0x00000c20
+/* 0xc24 --> 0xc80 unused */
 #define SNDDATAI_COS_CNT_0             0x00000c80
 #define SNDDATAI_COS_CNT_1             0x00000c84
 #define SNDDATAI_COS_CNT_2             0x00000c88
 #define BUFMGR_MB_MACRX_LOW_WATER      0x00004414
 #define  DEFAULT_MB_MACRX_LOW_WATER      0x00000020
 #define  DEFAULT_MB_MACRX_LOW_WATER_5705  0x00000010
+#define  DEFAULT_MB_MACRX_LOW_WATER_5906  0x00000004
 #define  DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098
 #define  DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780 0x0000004b
 #define BUFMGR_MB_HIGH_WATER           0x00004418
 #define  DEFAULT_MB_HIGH_WATER          0x00000060
 #define  DEFAULT_MB_HIGH_WATER_5705     0x00000060
+#define  DEFAULT_MB_HIGH_WATER_5906     0x00000010
 #define  DEFAULT_MB_HIGH_WATER_JUMBO    0x0000017c
 #define  DEFAULT_MB_HIGH_WATER_JUMBO_5780 0x00000096
 #define BUFMGR_RX_MB_ALLOC_REQ         0x0000441c
 #define TX_CPU_STATE                   0x00005404
 #define TX_CPU_PGMCTR                  0x0000541c
 
+#define VCPU_STATUS                    0x00005100
+#define  VCPU_STATUS_INIT_DONE          0x04000000
+#define  VCPU_STATUS_DRV_RESET          0x08000000
+
 /* Mailboxes */
+#define GRCMBOX_BASE                   0x00005600
 #define GRCMBOX_INTERRUPT_0            0x00005800 /* 64-bit */
 #define GRCMBOX_INTERRUPT_1            0x00005808 /* 64-bit */
 #define GRCMBOX_INTERRUPT_2            0x00005810 /* 64-bit */
 #define GRC_EEPROM_CTRL                        0x00006840
 #define GRC_MDI_CTRL                   0x00006844
 #define GRC_SEEPROM_DELAY              0x00006848
-/* 0x684c --> 0x6c00 unused */
+/* 0x684c --> 0x6890 unused */
+#define GRC_VCPU_EXT_CTRL              0x00006890
+#define GRC_VCPU_EXT_CTRL_HALT_CPU      0x00400000
+#define GRC_VCPU_EXT_CTRL_DISABLE_WOL   0x20000000
 #define GRC_FASTBOOT_PC                        0x00006894      /* 5752, 5755, 5787 */
 
 /* 0x6c00 --> 0x7000 unused */
 #define NVRAM_WRITE1                   0x00007028
 /* 0x702c --> 0x7400 unused */
 
-/* 0x7400 --> 0x8000 unused */
+/* 0x7400 --> 0x7c00 unused */
+#define PCIE_TRANSACTION_CFG           0x00007c04
+#define PCIE_TRANS_CFG_1SHOT_MSI        0x20000000
+#define PCIE_TRANS_CFG_LOM              0x00000020
+
 
 #define TG3_EEPROM_MAGIC               0x669955aa
+#define TG3_EEPROM_MAGIC_FW            0xa5000000
+#define TG3_EEPROM_MAGIC_FW_MSK                0xff000000
+#define TG3_EEPROM_MAGIC_HW            0xabcd
+#define TG3_EEPROM_MAGIC_HW_MSK                0xffff
 
 /* 32K Window into NIC internal memory */
 #define NIC_SRAM_WIN_BASE              0x00008000
 #define  FWCMD_NICDRV_FIX_DMAR          0x00000005
 #define  FWCMD_NICDRV_FIX_DMAW          0x00000006
 #define  FWCMD_NICDRV_ALIVE2            0x0000000d
+#define  FWCMD_NICDRV_ALIVE3            0x0000000e
 #define NIC_SRAM_FW_CMD_LEN_MBOX       0x00000b7c
 #define NIC_SRAM_FW_CMD_DATA_MBOX      0x00000b80
 #define NIC_SRAM_FW_ASF_STATUS_MBOX    0x00000c00
 #define MII_TG3_DSP_RW_PORT            0x15 /* DSP coefficient read/write port */
 
 #define MII_TG3_DSP_ADDRESS            0x17 /* DSP address register */
+#define MII_TG3_EPHY_PTEST             0x17 /* 5906 PHY register */
 
 #define MII_TG3_AUX_CTRL               0x18 /* auxilliary control register */
 
 #define MII_TG3_AUX_STAT_100FULL       0x0500
 #define MII_TG3_AUX_STAT_1000HALF      0x0600
 #define MII_TG3_AUX_STAT_1000FULL      0x0700
+#define MII_TG3_AUX_STAT_100           0x0008
+#define MII_TG3_AUX_STAT_FULL          0x0001
 
 #define MII_TG3_ISTAT                  0x1a /* IRQ status register */
 #define MII_TG3_IMASK                  0x1b /* IRQ mask register */
 #define MII_TG3_INT_DUPLEXCHG          0x0008
 #define MII_TG3_INT_ANEG_PAGE_RX       0x0400
 
+#define MII_TG3_EPHY_TEST              0x1f /* 5906 PHY register */
+#define MII_TG3_EPHY_SHADOW_EN         0x80
+
 /* There are two ways to manage the TX descriptors on the tigon3.
  * Either the descriptors are in host DMA'able memory, or they
  * exist only in the cards on-chip SRAM.  All 16 send bds are under
@@ -2203,7 +2233,6 @@ struct tg3 {
 #define TG3_FLG2_PCI_EXPRESS           0x00000200
 #define TG3_FLG2_ASF_NEW_HANDSHAKE     0x00000400
 #define TG3_FLG2_HW_AUTONEG            0x00000800
-#define TG3_FLG2_PHY_JUST_INITTED      0x00001000
 #define TG3_FLG2_PHY_SERDES            0x00002000
 #define TG3_FLG2_CAPACITIVE_COUPLING   0x00004000
 #define TG3_FLG2_FLASH                 0x00008000
@@ -2236,6 +2265,12 @@ struct tg3 {
        u16                             asf_counter;
        u16                             asf_multiplier;
 
+       /* 1 second counter for transient serdes link events */
+       u32                             serdes_counter;
+#define SERDES_AN_TIMEOUT_5704S                2
+#define SERDES_PARALLEL_DET_TIMEOUT    1
+#define SERDES_AN_TIMEOUT_5714S                1
+
        struct tg3_link_config          link_config;
        struct tg3_bufmgr_config        bufmgr_config;
 
@@ -2276,6 +2311,8 @@ struct tg3 {
 #define PHY_ID_BCM5780                 0x60008350
 #define PHY_ID_BCM5755                 0xbc050cc0
 #define PHY_ID_BCM5787                 0xbc050ce0
+#define PHY_ID_BCM5756                 0xbc050ed0
+#define PHY_ID_BCM5906                 0xdc00ac40
 #define PHY_ID_BCM8002                 0x60010140
 #define PHY_ID_INVALID                 0xffffffff
 #define PHY_ID_REV_MASK                        0x0000000f
@@ -2302,7 +2339,8 @@ struct tg3 {
         (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
         (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \
         (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \
-        (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM8002)
+        (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM5756 || \
+        (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM8002)
 
        struct tg3_hw_stats             *hw_stats;
        dma_addr_t                      stats_mapping;
index 7ec2b2f9b7eec6750c7906ff7f281b23bb530fe5..b0bc5ddcf1b11df483912a33160ce074c75ffa5c 100644 (file)
@@ -161,7 +161,7 @@ static int cisco_rx(struct sk_buff *skb)
        struct hdlc_header *data = (struct hdlc_header*)skb->data;
        struct cisco_packet *cisco_data;
        struct in_device *in_dev;
-       u32 addr, mask;
+       __be32 addr, mask;
 
        if (skb->len < sizeof(struct hdlc_header))
                goto rx_error;
index c13b459a013789a62c1d7ade07739833791c9752..218f7b574ab3082012f2b4ec3a03262ffab98f9c 100644 (file)
@@ -469,7 +469,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb)
        struct net_device *dev = sp->pp_if;
        int len = skb->len;
        u8 *p, opt[6];
-       u32 rmagic;
+       u32 rmagic = 0;
 
        if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
                if (sp->pp_flags & PP_DEBUG)
@@ -763,7 +763,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
                {
                struct in_device *in_dev;
                struct in_ifaddr *ifa;
-               u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
+               __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
 #ifdef CONFIG_INET
                rcu_read_lock();
                if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
index ccaf28e8db0a28f529bf412b977b2546e14d266f..337c692f6fd66e98ba057cc46fc38b9a7e5fdad0 100644 (file)
@@ -1342,7 +1342,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
         * 'broadcast hub' radio (First byte of address being 0xFF means broadcast)
         */
        if (haddr.c[0] == 0xFF) {
-               u32 brd = 0;
+               __be32 brd = 0;
                struct in_device *in_dev;
 
                rcu_read_lock();
@@ -1406,7 +1406,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
        int doreset = (long) jiffies - strip_info->watchdog_doreset >= 0;
        int doprobe = (long) jiffies - strip_info->watchdog_doprobe >= 0
            && !doreset;
-       u32 addr, brd;
+       __be32 addr, brd;
 
        /*
         * 1. If we have a packet, encapsulate it and put it in the buffer
index 98b83a85c60e2d462fe92e4e39de2e6f0e977945..78c0a269a2ba3e24200b0c13e72a70c99b978141 100644 (file)
@@ -374,6 +374,7 @@ static void __devexit parport_serial_pci_remove (struct pci_dev *dev)
        return;
 }
 
+#ifdef CONFIG_PM
 static int parport_serial_pci_suspend(struct pci_dev *dev, pm_message_t state)
 {
        struct parport_serial_private *priv = pci_get_drvdata(dev);
@@ -407,14 +408,17 @@ static int parport_serial_pci_resume(struct pci_dev *dev)
 
        return 0;
 }
+#endif
 
 static struct pci_driver parport_serial_pci_driver = {
        .name           = "parport_serial",
        .id_table       = parport_serial_pci_tbl,
        .probe          = parport_serial_pci_probe,
        .remove         = __devexit_p(parport_serial_pci_remove),
+#ifdef CONFIG_PM
        .suspend        = parport_serial_pci_suspend,
        .resume         = parport_serial_pci_resume,
+#endif
 };
 
 
index 33a7b720539b081a8fabea5da18b06613565741d..62c804af9fbe473a5f20816d8f5fbaad3a1ff785 100644 (file)
@@ -27,7 +27,7 @@ config RTC_HCTOSYS
        help
          If you say yes here, the system time will be set using
          the value read from the specified RTC device. This is useful
-         in order to avoid unnecessary fschk runs.
+         in order to avoid unnecessary fsck runs.
 
 config RTC_HCTOSYS_DEVICE
        string "The RTC to read the time from"
index 0964d1dba92519e6fe3ab799f2c04bb4ae26db40..25589061f9310d6555d729205b09490982c19132 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/spi/spi.h>
 
-#define DRV_VERSION "0.1"
+#define DRV_VERSION "0.2"
 
 #define RS5C348_REG_SECS       0
 #define RS5C348_REG_MINS       1
@@ -175,8 +175,15 @@ static int __devinit rs5c348_probe(struct spi_device *spi)
                goto kfree_exit;
        if (ret & (RS5C348_BIT_XSTP | RS5C348_BIT_VDET)) {
                u8 buf[2];
+               struct rtc_time tm;
                if (ret & RS5C348_BIT_VDET)
                        dev_warn(&spi->dev, "voltage-low detected.\n");
+               if (ret & RS5C348_BIT_XSTP)
+                       dev_warn(&spi->dev, "oscillator-stop detected.\n");
+               rtc_time_to_tm(0, &tm); /* 1970/1/1 */
+               ret = rs5c348_rtc_set_time(&spi->dev, &tm);
+               if (ret < 0)
+                       goto kfree_exit;
                buf[0] = RS5C348_CMD_W(RS5C348_REG_CTL2);
                buf[1] = 0;
                ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0);
index 5613b4564fa2967f3b78a37fff49c87e621301be..8364d5475ac7fa5a8d2898f3a65d4d70a57b3066 100644 (file)
@@ -8067,7 +8067,7 @@ qeth_arp_constructor(struct neighbour *neigh)
        neigh->parms = neigh_parms_clone(parms);
        rcu_read_unlock();
 
-       neigh->type = inet_addr_type(*(u32 *) neigh->primary_key);
+       neigh->type = inet_addr_type(*(__be32 *) neigh->primary_key);
        neigh->nud_state = NUD_NOARP;
        neigh->ops = arp_direct_ops;
        neigh->output = neigh->ops->queue_xmit;
index 261eaa4429532cd9303a7dcf5cbfe0bda9985a65..d926272a40db59ed23a956078e90b58a640f0e84 100644 (file)
@@ -295,7 +295,7 @@ config SERIAL_AMBA_PL011_CONSOLE
          Even if you say Y here, the currently visible framebuffer console
          (/dev/tty0) will still be used as the system console by default, but
          you can alter that using a kernel command line option such as
-         "console=ttyAM0". (Try "man bootparam" or see the documentation of
+         "console=ttyAMA0". (Try "man bootparam" or see the documentation of
          your boot loader (lilo or loadlin) about how to pass options to the
          kernel at boot time.)
 
index 22f7ccd58d38725f7c23f5064c3ace5047aba97f..0f628041e3f7660c75fb846985b4124ba571cffe 100644 (file)
@@ -460,8 +460,10 @@ static int __init init_v9fs(void)
 
        ret = v9fs_mux_global_init();
        if (!ret)
-               ret = register_filesystem(&v9fs_fs_type);
-
+               return ret;
+       ret = register_filesystem(&v9fs_fs_type);
+       if (!ret)
+               v9fs_mux_global_exit();
        return ret;
 }
 
index d311198bba439d812421331e7aea06a5046aa176..4fd9efac29abad9fc5d1f3f75f862f8283f6a59c 100644 (file)
@@ -881,6 +881,19 @@ config TMPFS
 
          See <file:Documentation/filesystems/tmpfs.txt> for details.
 
+config TMPFS_POSIX_ACL
+       bool "Tmpfs POSIX Access Control Lists"
+       depends on TMPFS
+       select GENERIC_ACL
+       help
+         POSIX Access Control Lists (ACLs) support permissions for users and
+         groups beyond the owner/group/world scheme.
+
+         To learn more about Access Control Lists, visit the POSIX ACLs for
+         Linux website <http://acl.bestbits.at/>.
+
+         If you don't know what Access Control Lists are, say N.
+
 config HUGETLBFS
        bool "HugeTLB file system support"
        depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
@@ -1940,6 +1953,10 @@ config 9P_FS
 
          If unsure, say N.
 
+config GENERIC_ACL
+       bool
+       select FS_POSIX_ACL
+
 endmenu
 
 menu "Partition Types"
index 89135428a539184580b2b0305ec46f6e7d5bfa86..46b8cfe497b2206e66fd986617e5b554116174a9 100644 (file)
@@ -35,6 +35,7 @@ obj-$(CONFIG_BINFMT_FLAT)     += binfmt_flat.o
 obj-$(CONFIG_FS_MBCACHE)       += mbcache.o
 obj-$(CONFIG_FS_POSIX_ACL)     += posix_acl.o xattr_acl.o
 obj-$(CONFIG_NFS_COMMON)       += nfs_common/
+obj-$(CONFIG_GENERIC_ACL)      += generic_acl.o
 
 obj-$(CONFIG_QUOTA)            += dquot.o
 obj-$(CONFIG_QFMT_V1)          += quota_v1.o
index 101d21b6c03715b45ead510a2abccb706f23d209..86463ec9ccb496cea5907ec1de2075c982d4849d 100644 (file)
@@ -775,6 +775,7 @@ static int afs_proc_cell_servers_release(struct inode *inode,
  * first item
  */
 static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
+       __acquires(m->private->sv_lock)
 {
        struct list_head *_p;
        struct afs_cell *cell = m->private;
@@ -823,6 +824,7 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
  * clean up after reading from the cells list
  */
 static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
+       __releases(p->private->sv_lock)
 {
        struct afs_cell *cell = p->private;
 
index 27e17f96cada446d0858405493b46203fd0d57c3..563ef9d7da9ffa858ad754217861f4e2292b30ea 100644 (file)
@@ -281,9 +281,6 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
 
                DPRINTK("mount done status=%d", status);
 
-               if (status && dentry->d_inode)
-                       return status; /* Try to get the kernel to invalidate this dentry */
-
                /* Turn this into a real negative dentry? */
                if (status == -ENOENT) {
                        spin_lock(&dentry->d_lock);
@@ -359,7 +356,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
         * don't try to mount it again.
         */
        spin_lock(&dcache_lock);
-       if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
+       if (!d_mountpoint(dentry) && __simple_empty(dentry)) {
                spin_unlock(&dcache_lock);
 
                status = try_to_fill_dentry(dentry, 0);
@@ -540,6 +537,9 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
                            return ERR_PTR(-ERESTARTNOINTR);
                        }
                }
+               spin_lock(&dentry->d_lock);
+               dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+               spin_unlock(&dentry->d_lock);
        }
 
        /*
index f312103434d4594fcd8d532c90bb8b4cf4698289..517e111bb7ef4acbb94f95fb560cb4c2734f4d5b 100644 (file)
@@ -278,6 +278,13 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                return -ENOEXEC;
        }
 
+       /*
+        * Requires a mmap handler. This prevents people from using a.out
+        * as part of an exploit attack against /proc-related vulnerabilities.
+        */
+       if (!bprm->file->f_op || !bprm->file->f_op->mmap)
+               return -ENOEXEC;
+
        fd_offset = N_TXTOFF(ex);
 
        /* Check initial limits. This avoids letting people circumvent
@@ -476,6 +483,13 @@ static int load_aout_library(struct file *file)
                goto out;
        }
 
+       /*
+        * Requires a mmap handler. This prevents people from using a.out
+        * as part of an exploit attack against /proc-related vulnerabilities.
+        */
+       if (!file->f_op || !file->f_op->mmap)
+               goto out;
+
        if (N_FLAGS(ex))
                goto out;
 
index dfd8cfb7fb5dcd213ab74c41474c81e06a69f8e1..6eb48e1446ecb4fd7c239f2cdca17e7faef89c28 100644 (file)
@@ -1038,10 +1038,8 @@ out_free_interp:
 out_free_file:
        sys_close(elf_exec_fileno);
 out_free_fh:
-       if (files) {
-               put_files_struct(current->files);
-               current->files = files;
-       }
+       if (files)
+               reset_files_struct(current, files);
 out_free_ph:
        kfree(elf_phdata);
        goto out;
@@ -1481,20 +1479,19 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
 
        if (signr) {
                struct elf_thread_status *tmp;
-               read_lock(&tasklist_lock);
+               rcu_read_lock();
                do_each_thread(g,p)
                        if (current->mm == p->mm && current != p) {
                                tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
                                if (!tmp) {
-                                       read_unlock(&tasklist_lock);
+                                       rcu_read_unlock();
                                        goto cleanup;
                                }
-                               INIT_LIST_HEAD(&tmp->list);
                                tmp->thread = p;
                                list_add(&tmp->list, &thread_list);
                        }
                while_each_thread(g,p);
-               read_unlock(&tasklist_lock);
+               rcu_read_unlock();
                list_for_each(t, &thread_list) {
                        struct elf_thread_status *tmp;
                        int sz;
index 2f336582922940ffb9160d664f39acff70fe3ad1..f86d5c9ce5ebda5eaf4c94fbd441dd770a24b9c4 100644 (file)
@@ -1597,20 +1597,19 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
 
        if (signr) {
                struct elf_thread_status *tmp;
-               read_lock(&tasklist_lock);
+               rcu_read_lock();
                do_each_thread(g,p)
                        if (current->mm == p->mm && current != p) {
                                tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
                                if (!tmp) {
-                                       read_unlock(&tasklist_lock);
+                                       rcu_read_unlock();
                                        goto cleanup;
                                }
-                               INIT_LIST_HEAD(&tmp->list);
                                tmp->thread = p;
                                list_add(&tmp->list, &thread_list);
                        }
                while_each_thread(g,p);
-               read_unlock(&tasklist_lock);
+               rcu_read_unlock();
                list_for_each(t, &thread_list) {
                        struct elf_thread_status *tmp;
                        int sz;
index 66ba137f86618b25044a2beeb2a73a6f1dc81865..1713c48fef5494e5e8ef361a83b5795ecaae4ce9 100644 (file)
@@ -215,10 +215,8 @@ _error:
        bprm->interp_flags = 0;
        bprm->interp_data = 0;
 _unshare:
-       if (files) {
-               put_files_struct(current->files);
-               current->files = files;
-       }
+       if (files)
+               reset_files_struct(current, files);
        goto _ret;
 }
 
index 045f98854f14ab91c71cc6a61a9cafb1716a53c4..4346468139e80247e6db85d389a072cedf0d52a0 100644 (file)
@@ -543,11 +543,11 @@ static struct kobject *bdev_get_holder(struct block_device *bdev)
                return kobject_get(bdev->bd_disk->holder_dir);
 }
 
-static void add_symlink(struct kobject *from, struct kobject *to)
+static int add_symlink(struct kobject *from, struct kobject *to)
 {
        if (!from || !to)
-               return;
-       sysfs_create_link(from, to, kobject_name(to));
+               return 0;
+       return sysfs_create_link(from, to, kobject_name(to));
 }
 
 static void del_symlink(struct kobject *from, struct kobject *to)
@@ -648,30 +648,38 @@ static void free_bd_holder(struct bd_holder *bo)
  * If there is no matching entry with @bo in @bdev->bd_holder_list,
  * add @bo to the list, create symlinks.
  *
- * Returns 1 if @bo was added to the list.
- * Returns 0 if @bo wasn't used by any reason and should be freed.
+ * Returns 0 if symlinks are created or already there.
+ * Returns -ve if something fails and @bo can be freed.
  */
 static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
 {
        struct bd_holder *tmp;
+       int ret;
 
        if (!bo)
-               return 0;
+               return -EINVAL;
 
        list_for_each_entry(tmp, &bdev->bd_holder_list, list) {
                if (tmp->sdir == bo->sdir) {
                        tmp->count++;
+                       /* We've already done what we need to do here. */
+                       free_bd_holder(bo);
                        return 0;
                }
        }
 
        if (!bd_holder_grab_dirs(bdev, bo))
-               return 0;
+               return -EBUSY;
 
-       add_symlink(bo->sdir, bo->sdev);
-       add_symlink(bo->hdir, bo->hdev);
-       list_add_tail(&bo->list, &bdev->bd_holder_list);
-       return 1;
+       ret = add_symlink(bo->sdir, bo->sdev);
+       if (ret == 0) {
+               ret = add_symlink(bo->hdir, bo->hdev);
+               if (ret)
+                       del_symlink(bo->sdir, bo->sdev);
+       }
+       if (ret == 0)
+               list_add_tail(&bo->list, &bdev->bd_holder_list);
+       return ret;
 }
 
 /**
@@ -741,7 +749,9 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
 
        mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION);
        res = bd_claim(bdev, holder);
-       if (res || !add_bd_holder(bdev, bo))
+       if (res == 0)
+               res = add_bd_holder(bdev, bo);
+       if (res)
                free_bd_holder(bo);
        mutex_unlock(&bdev->bd_mutex);
 
@@ -1021,7 +1031,7 @@ do_open(struct block_device *bdev, struct file *file, unsigned int subclass)
                                rescan_partitions(bdev->bd_disk, bdev);
                } else {
                        mutex_lock_nested(&bdev->bd_contains->bd_mutex,
-                                         BD_MUTEX_PARTITION);
+                                         BD_MUTEX_WHOLE);
                        bdev->bd_contains->bd_part_count++;
                        mutex_unlock(&bdev->bd_contains->bd_mutex);
                }
index 0009346d827f52ad2da3c24bdbb6485d5cdfa6dd..1f3285affa39c9d06da9fb3af7bee91094d894f9 100644 (file)
@@ -128,13 +128,31 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
 
        for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
                if ((*cp)->major > major ||
-                   ((*cp)->major == major && (*cp)->baseminor >= baseminor))
+                   ((*cp)->major == major &&
+                    (((*cp)->baseminor >= baseminor) ||
+                     ((*cp)->baseminor + (*cp)->minorct > baseminor))))
                        break;
-       if (*cp && (*cp)->major == major &&
-           (*cp)->baseminor < baseminor + minorct) {
-               ret = -EBUSY;
-               goto out;
+
+       /* Check for overlapping minor ranges.  */
+       if (*cp && (*cp)->major == major) {
+               int old_min = (*cp)->baseminor;
+               int old_max = (*cp)->baseminor + (*cp)->minorct - 1;
+               int new_min = baseminor;
+               int new_max = baseminor + minorct - 1;
+
+               /* New driver overlaps from the left.  */
+               if (new_max >= old_min && new_max <= old_max) {
+                       ret = -EBUSY;
+                       goto out;
+               }
+
+               /* New driver overlaps from the right.  */
+               if (new_min <= old_max && new_min >= old_min) {
+                       ret = -EBUSY;
+                       goto out;
+               }
        }
+
        cd->next = *cp;
        *cp = cd;
        mutex_unlock(&chrdevs_lock);
@@ -165,6 +183,15 @@ __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct)
        return cd;
 }
 
+/**
+ * register_chrdev_region() - register a range of device numbers
+ * @from: the first in the desired range of device numbers; must include
+ *        the major number.
+ * @count: the number of consecutive device numbers required
+ * @name: the name of the device or driver.
+ *
+ * Return value is zero on success, a negative error code on failure.
+ */
 int register_chrdev_region(dev_t from, unsigned count, const char *name)
 {
        struct char_device_struct *cd;
@@ -190,6 +217,17 @@ fail:
        return PTR_ERR(cd);
 }
 
+/**
+ * alloc_chrdev_region() - register a range of char device numbers
+ * @dev: output parameter for first assigned number
+ * @baseminor: first of the requested range of minor numbers
+ * @count: the number of minor numbers required
+ * @name: the name of the associated device or driver
+ *
+ * Allocates a range of char device numbers.  The major number will be
+ * chosen dynamically, and returned (along with the first minor number)
+ * in @dev.  Returns zero or a negative error code.
+ */
 int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
                        const char *name)
 {
@@ -259,6 +297,15 @@ out2:
        return err;
 }
 
+/**
+ * unregister_chrdev_region() - return a range of device numbers
+ * @from: the first in the range of numbers to unregister
+ * @count: the number of device numbers to unregister
+ *
+ * This function will unregister a range of @count device numbers,
+ * starting with @from.  The caller should normally be the one who
+ * allocated those numbers in the first place...
+ */
 void unregister_chrdev_region(dev_t from, unsigned count)
 {
        dev_t to = from + count;
@@ -396,6 +443,16 @@ static int exact_lock(dev_t dev, void *data)
        return cdev_get(p) ? 0 : -1;
 }
 
+/**
+ * cdev_add() - add a char device to the system
+ * @p: the cdev structure for the device
+ * @dev: the first device number for which this device is responsible
+ * @count: the number of consecutive minor numbers corresponding to this
+ *         device
+ *
+ * cdev_add() adds the device represented by @p to the system, making it
+ * live immediately.  A negative error code is returned on failure.
+ */
 int cdev_add(struct cdev *p, dev_t dev, unsigned count)
 {
        p->dev = dev;
@@ -408,6 +465,13 @@ static void cdev_unmap(dev_t dev, unsigned count)
        kobj_unmap(cdev_map, dev, count);
 }
 
+/**
+ * cdev_del() - remove a cdev from the system
+ * @p: the cdev structure to be removed
+ *
+ * cdev_del() removes @p from the system, possibly freeing the structure
+ * itself.
+ */
 void cdev_del(struct cdev *p)
 {
        cdev_unmap(p->dev, p->count);
@@ -436,6 +500,11 @@ static struct kobj_type ktype_cdev_dynamic = {
        .release        = cdev_dynamic_release,
 };
 
+/**
+ * cdev_alloc() - allocate a cdev structure
+ *
+ * Allocates and returns a cdev structure, or NULL on failure.
+ */
 struct cdev *cdev_alloc(void)
 {
        struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL);
@@ -447,6 +516,14 @@ struct cdev *cdev_alloc(void)
        return p;
 }
 
+/**
+ * cdev_init() - initialize a cdev structure
+ * @cdev: the structure to initialize
+ * @fops: the file_operations for this device
+ *
+ * Initializes @cdev, remembering @fops, making it ready to add to the
+ * system with cdev_add().
+ */
 void cdev_init(struct cdev *cdev, const struct file_operations *fops)
 {
        memset(cdev, 0, sizeof *cdev);
index ad96b69907156c5e79879da38a4d928a47fa8b8e..a624c3ec81892870545cd80bea3f22c91069c2ab 100644 (file)
@@ -543,8 +543,15 @@ static struct file_system_type cramfs_fs_type = {
 
 static int __init init_cramfs_fs(void)
 {
-       cramfs_uncompress_init();
-       return register_filesystem(&cramfs_fs_type);
+       int rv;
+
+       rv = cramfs_uncompress_init();
+       if (rv < 0)
+               return rv;
+       rv = register_filesystem(&cramfs_fs_type);
+       if (rv < 0)
+               cramfs_uncompress_exit();
+       return rv;
 }
 
 static void __exit exit_cramfs_fs(void)
index 8def89f2c4383b052490eeba366241adc07ccaa8..fc3ccb74626ffb3a581da4049c703242352dedfa 100644 (file)
@@ -68,11 +68,10 @@ int cramfs_uncompress_init(void)
        return 0;
 }
 
-int cramfs_uncompress_exit(void)
+void cramfs_uncompress_exit(void)
 {
        if (!--initialized) {
                zlib_inflateEnd(&stream);
                vfree(stream.workspace);
        }
-       return 0;
 }
index 0122a279106a9dd4a0475557901471be5c428546..9af789567e513b4575c9066711b8b6f595c949c7 100644 (file)
@@ -834,6 +834,9 @@ static void print_warning(struct dquot *dquot, const char warntype)
        if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
                return;
 
+       mutex_lock(&tty_mutex);
+       if (!current->signal->tty)
+               goto out_lock;
        tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
        if (warntype == ISOFTWARN || warntype == BSOFTWARN)
                tty_write_message(current->signal->tty, ": warning, ");
@@ -861,6 +864,8 @@ static void print_warning(struct dquot *dquot, const char warntype)
                        break;
        }
        tty_write_message(current->signal->tty, msg);
+out_lock:
+       mutex_unlock(&tty_mutex);
 }
 
 static inline void flush_warnings(struct dquot **dquots, char *warntype)
index 97df6e0aeaeed58db0f63ab746883ee87c7c1985..a8efe35176b025626e4e49732ec49a1843862250 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -898,8 +898,7 @@ int flush_old_exec(struct linux_binprm * bprm)
        return 0;
 
 mmap_failed:
-       put_files_struct(current->files);
-       current->files = files;
+       reset_files_struct(current, files);
 out:
        return retval;
 }
index 1ee25232e6af3dd4cee629fdeba312f769cd8d02..d50fc47169c1aba4b4388677dfabfd4f53b11933 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 #include <linux/writeback.h>
+#include <linux/blkdev.h>
 
 int fat_generic_ioctl(struct inode *inode, struct file *filp,
                      unsigned int cmd, unsigned long arg)
@@ -112,6 +113,16 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
        }
 }
 
+static int fat_file_release(struct inode *inode, struct file *filp)
+{
+       if ((filp->f_mode & FMODE_WRITE) &&
+            MSDOS_SB(inode->i_sb)->options.flush) {
+               fat_flush_inodes(inode->i_sb, inode, NULL);
+               blk_congestion_wait(WRITE, HZ/10);
+       }
+       return 0;
+}
+
 const struct file_operations fat_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
@@ -121,6 +132,7 @@ const struct file_operations fat_file_operations = {
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
+       .release        = fat_file_release,
        .ioctl          = fat_generic_ioctl,
        .fsync          = file_fsync,
        .sendfile       = generic_file_sendfile,
@@ -289,6 +301,7 @@ void fat_truncate(struct inode *inode)
        lock_kernel();
        fat_free(inode, nr_clusters);
        unlock_kernel();
+       fat_flush_inodes(inode->i_sb, inode, NULL);
 }
 
 struct inode_operations fat_file_inode_operations = {
index ab96ae82375305ae295447bbef39a1728894eae0..045738032a83d5f4579208881d17088a65326e5a 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/vfs.h>
 #include <linux/parser.h>
 #include <linux/uio.h>
+#include <linux/writeback.h>
 #include <asm/unaligned.h>
 
 #ifndef CONFIG_FAT_DEFAULT_IOCHARSET
@@ -853,7 +854,7 @@ enum {
        Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
        Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
        Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
-       Opt_obsolate, Opt_err,
+       Opt_obsolate, Opt_flush, Opt_err,
 };
 
 static match_table_t fat_tokens = {
@@ -885,7 +886,8 @@ static match_table_t fat_tokens = {
        {Opt_obsolate, "cvf_format=%20s"},
        {Opt_obsolate, "cvf_options=%100s"},
        {Opt_obsolate, "posix"},
-       {Opt_err, NULL}
+       {Opt_flush, "flush"},
+       {Opt_err, NULL},
 };
 static match_table_t msdos_tokens = {
        {Opt_nodots, "nodots"},
@@ -1026,6 +1028,9 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
                                return 0;
                        opts->codepage = option;
                        break;
+               case Opt_flush:
+                       opts->flush = 1;
+                       break;
 
                /* msdos specific */
                case Opt_dots:
@@ -1425,6 +1430,56 @@ out_fail:
 
 EXPORT_SYMBOL_GPL(fat_fill_super);
 
+/*
+ * helper function for fat_flush_inodes.  This writes both the inode
+ * and the file data blocks, waiting for in flight data blocks before
+ * the start of the call.  It does not wait for any io started
+ * during the call
+ */
+static int writeback_inode(struct inode *inode)
+{
+
+       int ret;
+       struct address_space *mapping = inode->i_mapping;
+       struct writeback_control wbc = {
+              .sync_mode = WB_SYNC_NONE,
+             .nr_to_write = 0,
+       };
+       /* if we used WB_SYNC_ALL, sync_inode waits for the io for the
+       * inode to finish.  So WB_SYNC_NONE is sent down to sync_inode
+       * and filemap_fdatawrite is used for the data blocks
+       */
+       ret = sync_inode(inode, &wbc);
+       if (!ret)
+              ret = filemap_fdatawrite(mapping);
+       return ret;
+}
+
+/*
+ * write data and metadata corresponding to i1 and i2.  The io is
+ * started but we do not wait for any of it to finish.
+ *
+ * filemap_flush is used for the block device, so if there is a dirty
+ * page for a block already in flight, we will not wait and start the
+ * io over again
+ */
+int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
+{
+       int ret = 0;
+       if (!MSDOS_SB(sb)->options.flush)
+               return 0;
+       if (i1)
+               ret = writeback_inode(i1);
+       if (!ret && i2)
+               ret = writeback_inode(i2);
+       if (!ret && sb) {
+               struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
+               ret = filemap_flush(mapping);
+       }
+       return ret;
+}
+EXPORT_SYMBOL_GPL(fat_flush_inodes);
+
 static int __init init_fat_fs(void)
 {
        int err;
index 8d3bfca7714bf35e9e982caa761bb5c549909bc6..8e81775c5dc818bd3b9d66e3fd895524294f5c78 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -288,71 +288,63 @@ out:
 }
 
 /*
- * Expands the file descriptor table - it will allocate a new fdtable and
- * both fd array and fdset. It is expected to be called with the
- * files_lock held.
+ * Expand the file descriptor table.
+ * This function will allocate a new fdtable and both fd array and fdset, of
+ * the given size.
+ * Return <0 error code on error; 1 on successful completion.
+ * The files->file_lock should be held on entry, and will be held on exit.
  */
 static int expand_fdtable(struct files_struct *files, int nr)
        __releases(files->file_lock)
        __acquires(files->file_lock)
 {
-       int error = 0;
-       struct fdtable *fdt;
-       struct fdtable *nfdt = NULL;
+       struct fdtable *new_fdt, *cur_fdt;
 
        spin_unlock(&files->file_lock);
-       nfdt = alloc_fdtable(nr);
-       if (!nfdt) {
-               error = -ENOMEM;
-               spin_lock(&files->file_lock);
-               goto out;
-       }
-
+       new_fdt = alloc_fdtable(nr);
        spin_lock(&files->file_lock);
-       fdt = files_fdtable(files);
+       if (!new_fdt)
+               return -ENOMEM;
        /*
-        * Check again since another task may have expanded the
-        * fd table while we dropped the lock
+        * Check again since another task may have expanded the fd table while
+        * we dropped the lock
         */
-       if (nr >= fdt->max_fds || nr >= fdt->max_fdset) {
-               copy_fdtable(nfdt, fdt);
+       cur_fdt = files_fdtable(files);
+       if (nr >= cur_fdt->max_fds || nr >= cur_fdt->max_fdset) {
+               /* Continue as planned */
+               copy_fdtable(new_fdt, cur_fdt);
+               rcu_assign_pointer(files->fdt, new_fdt);
+               free_fdtable(cur_fdt);
        } else {
-               /* Somebody expanded while we dropped file_lock */
-               spin_unlock(&files->file_lock);
-               __free_fdtable(nfdt);
-               spin_lock(&files->file_lock);
-               goto out;
+               /* Somebody else expanded, so undo our attempt */
+               __free_fdtable(new_fdt);
        }
-       rcu_assign_pointer(files->fdt, nfdt);
-       free_fdtable(fdt);
-out:
-       return error;
+       return 1;
 }
 
 /*
  * Expand files.
- * Return <0 on error; 0 nothing done; 1 files expanded, we may have blocked.
- * Should be called with the files->file_lock spinlock held for write.
+ * This function will expand the file structures, if the requested size exceeds
+ * the current capacity and there is room for expansion.
+ * Return <0 error code on error; 0 when nothing done; 1 when files were
+ * expanded and execution may have blocked.
+ * The files->file_lock should be held on entry, and will be held on exit.
  */
 int expand_files(struct files_struct *files, int nr)
 {
-       int err, expand = 0;
        struct fdtable *fdt;
 
        fdt = files_fdtable(files);
-       if (nr >= fdt->max_fdset || nr >= fdt->max_fds) {
-               if (fdt->max_fdset >= NR_OPEN ||
-                       fdt->max_fds >= NR_OPEN || nr >= NR_OPEN) {
-                       err = -EMFILE;
-                       goto out;
-               }
-               expand = 1;
-               if ((err = expand_fdtable(files, nr)))
-                       goto out;
-       }
-       err = expand;
-out:
-       return err;
+       /* Do we need to expand? */
+       if (nr < fdt->max_fdset && nr < fdt->max_fds)
+               return 0;
+       /* Can we expand? */
+       if (fdt->max_fdset >= NR_OPEN || fdt->max_fds >= NR_OPEN ||
+           nr >= NR_OPEN)
+               return -EMFILE;
+
+       /* All good, so we try */
+       return expand_fdtable(files, nr);
 }
 
 static void __devinit fdtable_defer_list_init(int cpu)
index 9f1072836c8ea5c940c916d8236365a26c78da84..e3fa77c6ed56dce64e3fe68892022edaa85d0e56 100644 (file)
@@ -69,8 +69,6 @@ int register_filesystem(struct file_system_type * fs)
        int res = 0;
        struct file_system_type ** p;
 
-       if (!fs)
-               return -EINVAL;
        if (fs->next)
                return -EBUSY;
        INIT_LIST_HEAD(&fs->fs_supers);
index b74b791fc23ba6e4b905e2312518ddde0073ba16..ac28b0835ffc611a0236f3ba745744ba1ca05390 100644 (file)
@@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_type = {
 static int __init
 vxfs_init(void)
 {
+       int rv;
+
        vxfs_inode_cachep = kmem_cache_create("vxfs_inode",
                        sizeof(struct vxfs_inode_info), 0, 
                        SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL);
-       if (vxfs_inode_cachep)
-               return register_filesystem(&vxfs_fs_type);
-       return -ENOMEM;
+       if (!vxfs_inode_cachep)
+               return -ENOMEM;
+       rv = register_filesystem(&vxfs_fs_type);
+       if (rv < 0)
+               kmem_cache_destroy(vxfs_inode_cachep);
+       return rv;
 }
 
 static void __exit
index 1e2006caf15842b2c2beffe11968f3cc6311f16f..4fc557c40cc0c0bf8f158a7793d508f9ccb23111 100644 (file)
@@ -212,6 +212,7 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
  * Called with fc->lock, unlocks it
  */
 static void request_end(struct fuse_conn *fc, struct fuse_req *req)
+       __releases(fc->lock)
 {
        void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
        req->end = NULL;
@@ -640,6 +641,7 @@ static void request_wait(struct fuse_conn *fc)
  */
 static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_req *req,
                               const struct iovec *iov, unsigned long nr_segs)
+       __releases(fc->lock)
 {
        struct fuse_copy_state cs;
        struct fuse_in_header ih;
index 409ce6a7cca4ccd2e53f46693a5e4301bef87245..f85b2a282f130e2f0d4a5dc4d4bcfc61ed99b2f7 100644 (file)
@@ -776,7 +776,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
                if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
                        return -EACCES;
 
-               if (nd && (nd->flags & LOOKUP_ACCESS))
+               if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR)))
                        return fuse_access(inode, mask);
                return 0;
        }
index cb7cadb0b7901906e2dfd47bd5f3aac3b3578fb7..7d0a9aee01f248ef70bb1796a013fca8dda571af 100644 (file)
@@ -251,6 +251,7 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
        memset(&outarg, 0, sizeof(outarg));
        req->in.numargs = 0;
        req->in.h.opcode = FUSE_STATFS;
+       req->in.h.nodeid = get_node_id(dentry->d_inode);
        req->out.numargs = 1;
        req->out.args[0].size =
                fc->minor < 4 ? FUSE_COMPAT_STATFS_SIZE : sizeof(outarg);
diff --git a/fs/generic_acl.c b/fs/generic_acl.c
new file mode 100644 (file)
index 0000000..9ccb789
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * fs/generic_acl.c
+ *
+ * (C) 2005 Andreas Gruenbacher <agruen@suse.de>
+ *
+ * This file is released under the GPL.
+ */
+
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/generic_acl.h>
+
+/**
+ * generic_acl_list  -  Generic xattr_handler->list() operation
+ * @ops:       Filesystem specific getacl and setacl callbacks
+ */
+size_t
+generic_acl_list(struct inode *inode, struct generic_acl_operations *ops,
+                int type, char *list, size_t list_size)
+{
+       struct posix_acl *acl;
+       const char *name;
+       size_t size;
+
+       acl = ops->getacl(inode, type);
+       if (!acl)
+               return 0;
+       posix_acl_release(acl);
+
+       switch(type) {
+               case ACL_TYPE_ACCESS:
+                       name = POSIX_ACL_XATTR_ACCESS;
+                       break;
+
+               case ACL_TYPE_DEFAULT:
+                       name = POSIX_ACL_XATTR_DEFAULT;
+                       break;
+
+               default:
+                       return 0;
+       }
+       size = strlen(name) + 1;
+       if (list && size <= list_size)
+               memcpy(list, name, size);
+       return size;
+}
+
+/**
+ * generic_acl_get  -  Generic xattr_handler->get() operation
+ * @ops:       Filesystem specific getacl and setacl callbacks
+ */
+int
+generic_acl_get(struct inode *inode, struct generic_acl_operations *ops,
+               int type, void *buffer, size_t size)
+{
+       struct posix_acl *acl;
+       int error;
+
+       acl = ops->getacl(inode, type);
+       if (!acl)
+               return -ENODATA;
+       error = posix_acl_to_xattr(acl, buffer, size);
+       posix_acl_release(acl);
+
+       return error;
+}
+
+/**
+ * generic_acl_set  -  Generic xattr_handler->set() operation
+ * @ops:       Filesystem specific getacl and setacl callbacks
+ */
+int
+generic_acl_set(struct inode *inode, struct generic_acl_operations *ops,
+               int type, const void *value, size_t size)
+{
+       struct posix_acl *acl = NULL;
+       int error;
+
+       if (S_ISLNK(inode->i_mode))
+               return -EOPNOTSUPP;
+       if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
+               return -EPERM;
+       if (value) {
+               acl = posix_acl_from_xattr(value, size);
+               if (IS_ERR(acl))
+                       return PTR_ERR(acl);
+       }
+       if (acl) {
+               mode_t mode;
+
+               error = posix_acl_valid(acl);
+               if (error)
+                       goto failed;
+               switch(type) {
+                       case ACL_TYPE_ACCESS:
+                               mode = inode->i_mode;
+                               error = posix_acl_equiv_mode(acl, &mode);
+                               if (error < 0)
+                                       goto failed;
+                               inode->i_mode = mode;
+                               if (error == 0) {
+                                       posix_acl_release(acl);
+                                       acl = NULL;
+                               }
+                               break;
+
+                       case ACL_TYPE_DEFAULT:
+                               if (!S_ISDIR(inode->i_mode)) {
+                                       error = -EINVAL;
+                                       goto failed;
+                               }
+                               break;
+               }
+       }
+       ops->setacl(inode, type, acl);
+       error = 0;
+failed:
+       posix_acl_release(acl);
+       return error;
+}
+
+/**
+ * generic_acl_init  -  Take care of acl inheritance at @inode create time
+ * @ops:       Filesystem specific getacl and setacl callbacks
+ *
+ * Files created inside a directory with a default ACL inherit the
+ * directory's default ACL.
+ */
+int
+generic_acl_init(struct inode *inode, struct inode *dir,
+                struct generic_acl_operations *ops)
+{
+       struct posix_acl *acl = NULL;
+       mode_t mode = inode->i_mode;
+       int error;
+
+       inode->i_mode = mode & ~current->fs->umask;
+       if (!S_ISLNK(inode->i_mode))
+               acl = ops->getacl(dir, ACL_TYPE_DEFAULT);
+       if (acl) {
+               struct posix_acl *clone;
+
+               if (S_ISDIR(inode->i_mode)) {
+                       clone = posix_acl_clone(acl, GFP_KERNEL);
+                       error = -ENOMEM;
+                       if (!clone)
+                               goto cleanup;
+                       ops->setacl(inode, ACL_TYPE_DEFAULT, clone);
+                       posix_acl_release(clone);
+               }
+               clone = posix_acl_clone(acl, GFP_KERNEL);
+               error = -ENOMEM;
+               if (!clone)
+                       goto cleanup;
+               error = posix_acl_create_masq(clone, &mode);
+               if (error >= 0) {
+                       inode->i_mode = mode;
+                       if (error > 0)
+                               ops->setacl(inode, ACL_TYPE_ACCESS, clone);
+               }
+               posix_acl_release(clone);
+       }
+       error = 0;
+
+cleanup:
+       posix_acl_release(acl);
+       return error;
+}
+
+/**
+ * generic_acl_chmod  -  change the access acl of @inode upon chmod()
+ * @ops:       FIlesystem specific getacl and setacl callbacks
+ *
+ * A chmod also changes the permissions of the owner, group/mask, and
+ * other ACL entries.
+ */
+int
+generic_acl_chmod(struct inode *inode, struct generic_acl_operations *ops)
+{
+       struct posix_acl *acl, *clone;
+       int error = 0;
+
+       if (S_ISLNK(inode->i_mode))
+               return -EOPNOTSUPP;
+       acl = ops->getacl(inode, ACL_TYPE_ACCESS);
+       if (acl) {
+               clone = posix_acl_clone(acl, GFP_KERNEL);
+               posix_acl_release(acl);
+               if (!clone)
+                       return -ENOMEM;
+               error = posix_acl_chmod_masq(clone, inode->i_mode);
+               if (!error)
+                       ops->setacl(inode, ACL_TYPE_ACCESS, clone);
+               posix_acl_release(clone);
+       }
+       return error;
+}
index e025a31b4c64a9f2584e7e2f5e095aae3d8a353c..f5b8f329aca6d3e3c3b102cc50b1ee55c2663362 100644 (file)
@@ -229,7 +229,7 @@ static void hugetlbfs_delete_inode(struct inode *inode)
        clear_inode(inode);
 }
 
-static void hugetlbfs_forget_inode(struct inode *inode)
+static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
 {
        struct super_block *sb = inode->i_sb;
 
index f5c04dd9ae8ae54ba32ebfd4c8cba3bb4001f219..abf77471e6c4a68701421dc6df6994de6e7000eb 100644 (file)
@@ -133,7 +133,6 @@ static struct inode *alloc_inode(struct super_block *sb)
                inode->i_bdev = NULL;
                inode->i_cdev = NULL;
                inode->i_rdev = 0;
-               inode->i_security = NULL;
                inode->dirtied_when = 0;
                if (security_inode_alloc(inode)) {
                        if (inode->i_sb->s_op->destroy_inode)
index 4527692f432b1b262f74bc42027326628e06b5ee..c34b862cdbf204cf5e7124408659f89108289a82 100644 (file)
@@ -960,30 +960,30 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
                        goto abort;
                }
                
-               if (nextblk) {
-                       while (b_off >= (offset + sect_size)) {
-                               struct inode *ninode;
-                               
-                               offset += sect_size;
-                               if (nextblk == 0)
-                                       goto abort;
-                               ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
-                               if (!ninode)
-                                       goto abort;
-                               firstext  = ISOFS_I(ninode)->i_first_extent;
-                               sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
-                               nextblk   = ISOFS_I(ninode)->i_next_section_block;
-                               nextoff   = ISOFS_I(ninode)->i_next_section_offset;
-                               iput(ninode);
-                               
-                               if (++section > 100) {
-                                       printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n");
-                                       printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u "
-                                              "nextblk=%lu nextoff=%lu\n",
-                                              iblock, firstext, (unsigned) sect_size,
-                                              nextblk, nextoff);
-                                       goto abort;
-                               }
+               /* On the last section, nextblk == 0, section size is likely to
+                * exceed sect_size by a partial block, and access beyond the
+                * end of the file will reach beyond the section size, too.
+                */
+               while (nextblk && (b_off >= (offset + sect_size))) {
+                       struct inode *ninode;
+
+                       offset += sect_size;
+                       ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
+                       if (!ninode)
+                               goto abort;
+                       firstext  = ISOFS_I(ninode)->i_first_extent;
+                       sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
+                       nextblk   = ISOFS_I(ninode)->i_next_section_block;
+                       nextoff   = ISOFS_I(ninode)->i_next_section_offset;
+                       iput(ninode);
+
+                       if (++section > 100) {
+                               printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n");
+                               printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u "
+                                      "nextblk=%lu nextoff=%lu\n",
+                                      iblock, firstext, (unsigned) sect_size,
+                                      nextblk, nextoff);
+                               goto abort;
                        }
                }
                
index 2fc66c3e66818830904603d2023b4bd4422963ed..7af6099c911c2cbb584932f822788b5e92ab4d9f 100644 (file)
@@ -715,18 +715,8 @@ journal_t * journal_init_dev(struct block_device *bdev,
        if (!journal)
                return NULL;
 
-       journal->j_dev = bdev;
-       journal->j_fs_dev = fs_dev;
-       journal->j_blk_offset = start;
-       journal->j_maxlen = len;
-       journal->j_blocksize = blocksize;
-
-       bh = __getblk(journal->j_dev, start, journal->j_blocksize);
-       J_ASSERT(bh != NULL);
-       journal->j_sb_buffer = bh;
-       journal->j_superblock = (journal_superblock_t *)bh->b_data;
-
        /* journal descriptor can store up to n blocks -bzzz */
+       journal->j_blocksize = blocksize;
        n = journal->j_blocksize / sizeof(journal_block_tag_t);
        journal->j_wbufsize = n;
        journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
@@ -736,6 +726,15 @@ journal_t * journal_init_dev(struct block_device *bdev,
                kfree(journal);
                journal = NULL;
        }
+       journal->j_dev = bdev;
+       journal->j_fs_dev = fs_dev;
+       journal->j_blk_offset = start;
+       journal->j_maxlen = len;
+
+       bh = __getblk(journal->j_dev, start, journal->j_blocksize);
+       J_ASSERT(bh != NULL);
+       journal->j_sb_buffer = bh;
+       journal->j_superblock = (journal_superblock_t *)bh->b_data;
 
        return journal;
 }
index 445eed6ce5dc6d0c9196aab99b68d0e53cad1a67..11563fe2a52bed60eafe259d92ae3aedbfa64e98 100644 (file)
@@ -46,7 +46,7 @@ static int scan_revoke_records(journal_t *, struct buffer_head *,
 #ifdef __KERNEL__
 
 /* Release readahead buffers after use */
-void journal_brelse_array(struct buffer_head *b[], int n)
+static void journal_brelse_array(struct buffer_head *b[], int n)
 {
        while (--n >= 0)
                brelse (b[n]);
index 8db5afb7b0a7dec0cc8c6bf372c2445050f54b1f..3793aaa145776971a19fbbbb9b61934634f80731 100644 (file)
@@ -317,17 +317,9 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 int simple_readpage(struct file *file, struct page *page)
 {
-       void *kaddr;
-
-       if (PageUptodate(page))
-               goto out;
-
-       kaddr = kmap_atomic(page, KM_USER0);
-       memset(kaddr, 0, PAGE_CACHE_SIZE);
-       kunmap_atomic(kaddr, KM_USER0);
+       clear_highpage(page);
        flush_dcache_page(page);
        SetPageUptodate(page);
-out:
        unlock_page(page);
        return 0;
 }
index e4fde1ab22cdb0a5af105cdea66cccf9473ac08e..0ff71256e65b4fb0d3a9fc4352c0a8c9b4b5e365 100644 (file)
@@ -160,6 +160,7 @@ __mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask)
 
 static void
 __mb_cache_entry_release_unlock(struct mb_cache_entry *ce)
+       __releases(mb_cache_spinlock)
 {
        /* Wake up all processes queuing for this cache entry. */
        if (ce->e_queued)
index 9e44158a7540d3c41e6324c89ea78ebfa68c016b..d220165d49180fc53c6b66401e439ac2b9d36113 100644 (file)
@@ -280,7 +280,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, int mode,
                        struct nameidata *nd)
 {
        struct super_block *sb = dir->i_sb;
-       struct inode *inode;
+       struct inode *inode = NULL;
        struct fat_slot_info sinfo;
        struct timespec ts;
        unsigned char msdos_name[MSDOS_NAME];
@@ -316,6 +316,8 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, int mode,
        d_instantiate(dentry, inode);
 out:
        unlock_kernel();
+       if (!err)
+               err = fat_flush_inodes(sb, dir, inode);
        return err;
 }
 
@@ -348,6 +350,8 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
        fat_detach(inode);
 out:
        unlock_kernel();
+       if (!err)
+               err = fat_flush_inodes(inode->i_sb, dir, inode);
 
        return err;
 }
@@ -401,6 +405,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        d_instantiate(dentry, inode);
 
        unlock_kernel();
+       fat_flush_inodes(sb, dir, inode);
        return 0;
 
 out_free:
@@ -430,6 +435,8 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
        fat_detach(inode);
 out:
        unlock_kernel();
+       if (!err)
+               err = fat_flush_inodes(inode->i_sb, dir, inode);
 
        return err;
 }
@@ -635,6 +642,8 @@ static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
                              new_dir, new_msdos_name, new_dentry, is_hid);
 out:
        unlock_kernel();
+       if (!err)
+               err = fat_flush_inodes(old_dir->i_sb, old_dir, new_dir);
        return err;
 }
 
index 808e4ea2bb9413a446743fbcdf10caae8d0baf2f..2892e68d3a8647981e5aa7caf3c53e708584d4bf 100644 (file)
@@ -518,18 +518,20 @@ static int __emul_lookup_dentry(const char *, struct nameidata *);
 static __always_inline int
 walk_init_root(const char *name, struct nameidata *nd)
 {
-       read_lock(&current->fs->lock);
-       if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
-               nd->mnt = mntget(current->fs->altrootmnt);
-               nd->dentry = dget(current->fs->altroot);
-               read_unlock(&current->fs->lock);
+       struct fs_struct *fs = current->fs;
+
+       read_lock(&fs->lock);
+       if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
+               nd->mnt = mntget(fs->altrootmnt);
+               nd->dentry = dget(fs->altroot);
+               read_unlock(&fs->lock);
                if (__emul_lookup_dentry(name,nd))
                        return 0;
-               read_lock(&current->fs->lock);
+               read_lock(&fs->lock);
        }
-       nd->mnt = mntget(current->fs->rootmnt);
-       nd->dentry = dget(current->fs->root);
-       read_unlock(&current->fs->lock);
+       nd->mnt = mntget(fs->rootmnt);
+       nd->dentry = dget(fs->root);
+       read_unlock(&fs->lock);
        return 1;
 }
 
@@ -724,17 +726,19 @@ int follow_down(struct vfsmount **mnt, struct dentry **dentry)
 
 static __always_inline void follow_dotdot(struct nameidata *nd)
 {
+       struct fs_struct *fs = current->fs;
+
        while(1) {
                struct vfsmount *parent;
                struct dentry *old = nd->dentry;
 
-                read_lock(&current->fs->lock);
-               if (nd->dentry == current->fs->root &&
-                   nd->mnt == current->fs->rootmnt) {
-                        read_unlock(&current->fs->lock);
+                read_lock(&fs->lock);
+               if (nd->dentry == fs->root &&
+                   nd->mnt == fs->rootmnt) {
+                        read_unlock(&fs->lock);
                        break;
                }
-                read_unlock(&current->fs->lock);
+                read_unlock(&fs->lock);
                spin_lock(&dcache_lock);
                if (nd->dentry != nd->mnt->mnt_root) {
                        nd->dentry = dget(nd->dentry->d_parent);
@@ -1042,15 +1046,17 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
                struct vfsmount *old_mnt = nd->mnt;
                struct qstr last = nd->last;
                int last_type = nd->last_type;
+               struct fs_struct *fs = current->fs;
+
                /*
-                * NAME was not found in alternate root or it's a directory.  Try to find
-                * it in the normal root:
+                * NAME was not found in alternate root or it's a directory.
+                * Try to find it in the normal root:
                 */
                nd->last_type = LAST_ROOT;
-               read_lock(&current->fs->lock);
-               nd->mnt = mntget(current->fs->rootmnt);
-               nd->dentry = dget(current->fs->root);
-               read_unlock(&current->fs->lock);
+               read_lock(&fs->lock);
+               nd->mnt = mntget(fs->rootmnt);
+               nd->dentry = dget(fs->root);
+               read_unlock(&fs->lock);
                if (path_walk(name, nd) == 0) {
                        if (nd->dentry->d_inode) {
                                dput(old_dentry);
@@ -1074,6 +1080,7 @@ void set_fs_altroot(void)
        struct vfsmount *mnt = NULL, *oldmnt;
        struct dentry *dentry = NULL, *olddentry;
        int err;
+       struct fs_struct *fs = current->fs;
 
        if (!emul)
                goto set_it;
@@ -1083,12 +1090,12 @@ void set_fs_altroot(void)
                dentry = nd.dentry;
        }
 set_it:
-       write_lock(&current->fs->lock);
-       oldmnt = current->fs->altrootmnt;
-       olddentry = current->fs->altroot;
-       current->fs->altrootmnt = mnt;
-       current->fs->altroot = dentry;
-       write_unlock(&current->fs->lock);
+       write_lock(&fs->lock);
+       oldmnt = fs->altrootmnt;
+       olddentry = fs->altroot;
+       fs->altrootmnt = mnt;
+       fs->altroot = dentry;
+       write_unlock(&fs->lock);
        if (olddentry) {
                dput(olddentry);
                mntput(oldmnt);
@@ -1102,29 +1109,30 @@ static int fastcall do_path_lookup(int dfd, const char *name,
        int retval = 0;
        int fput_needed;
        struct file *file;
+       struct fs_struct *fs = current->fs;
 
        nd->last_type = LAST_ROOT; /* if there are only slashes... */
        nd->flags = flags;
        nd->depth = 0;
 
        if (*name=='/') {
-               read_lock(&current->fs->lock);
-               if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
-                       nd->mnt = mntget(current->fs->altrootmnt);
-                       nd->dentry = dget(current->fs->altroot);
-                       read_unlock(&current->fs->lock);
+               read_lock(&fs->lock);
+               if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
+                       nd->mnt = mntget(fs->altrootmnt);
+                       nd->dentry = dget(fs->altroot);
+                       read_unlock(&fs->lock);
                        if (__emul_lookup_dentry(name,nd))
                                goto out; /* found in altroot */
-                       read_lock(&current->fs->lock);
+                       read_lock(&fs->lock);
                }
-               nd->mnt = mntget(current->fs->rootmnt);
-               nd->dentry = dget(current->fs->root);
-               read_unlock(&current->fs->lock);
+               nd->mnt = mntget(fs->rootmnt);
+               nd->dentry = dget(fs->root);
+               read_unlock(&fs->lock);
        } else if (dfd == AT_FDCWD) {
-               read_lock(&current->fs->lock);
-               nd->mnt = mntget(current->fs->pwdmnt);
-               nd->dentry = dget(current->fs->pwd);
-               read_unlock(&current->fs->lock);
+               read_lock(&fs->lock);
+               nd->mnt = mntget(fs->pwdmnt);
+               nd->dentry = dget(fs->pwd);
+               read_unlock(&fs->lock);
        } else {
                struct dentry *dentry;
 
index 36d180858136fb46e256fcc6550baf7ea6c2dbed..6ede3a539ed82acb0eca0781ce78ba2fd86db1df 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/sched.h>
 #include <linux/smp_lock.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/quotaops.h>
 #include <linux/acct.h>
 #include <linux/capability.h>
@@ -1813,6 +1814,7 @@ void __init mnt_init(unsigned long mempages)
        struct list_head *d;
        unsigned int nr_hash;
        int i;
+       int err;
 
        init_rwsem(&namespace_sem);
 
@@ -1853,8 +1855,14 @@ void __init mnt_init(unsigned long mempages)
                d++;
                i--;
        } while (i);
-       sysfs_init();
-       subsystem_register(&fs_subsys);
+       err = sysfs_init();
+       if (err)
+               printk(KERN_WARNING "%s: sysfs_init error: %d\n",
+                       __FUNCTION__, err);
+       err = subsystem_register(&fs_subsys);
+       if (err)
+               printk(KERN_WARNING "%s: subsystem_register error: %d\n",
+                       __FUNCTION__, err);
        init_rootfs();
        init_mount_tree();
 }
index 303f06d2a7b92e8e001489cf2b1db17bdae6bd0c..304c1c7814cbacfec0695e8714c5557ea8ee0e9b 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -546,7 +546,8 @@ asmlinkage long sys_chdir(const char __user * filename)
        struct nameidata nd;
        int error;
 
-       error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
+       error = __user_walk(filename,
+                           LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
        if (error)
                goto out;
 
@@ -1172,6 +1173,7 @@ asmlinkage long sys_close(unsigned int fd)
        struct file * filp;
        struct files_struct *files = current->files;
        struct fdtable *fdt;
+       int retval;
 
        spin_lock(&files->file_lock);
        fdt = files_fdtable(files);
@@ -1184,7 +1186,16 @@ asmlinkage long sys_close(unsigned int fd)
        FD_CLR(fd, fdt->close_on_exec);
        __put_unused_fd(files, fd);
        spin_unlock(&files->file_lock);
-       return filp_close(filp, files);
+       retval = filp_close(filp, files);
+
+       /* can't restart close syscall because file table entry was cleared */
+       if (unlikely(retval == -ERESTARTSYS ||
+                    retval == -ERESTARTNOINTR ||
+                    retval == -ERESTARTNOHAND ||
+                    retval == -ERESTART_RESTARTBLOCK))
+               retval = -EINTR;
+
+       return retval;
 
 out_unlock:
        spin_unlock(&files->file_lock);
index 8f12587c3129731fcd92392b41f8c86a9be3c646..4f8df71e49d330038614c4f81a300f477b6f9a95 100644 (file)
@@ -58,6 +58,31 @@ msdos_magic_present(unsigned char *p)
        return (p[0] == MSDOS_LABEL_MAGIC1 && p[1] == MSDOS_LABEL_MAGIC2);
 }
 
+/* Value is EBCDIC 'IBMA' */
+#define AIX_LABEL_MAGIC1       0xC9
+#define AIX_LABEL_MAGIC2       0xC2
+#define AIX_LABEL_MAGIC3       0xD4
+#define AIX_LABEL_MAGIC4       0xC1
+static int aix_magic_present(unsigned char *p, struct block_device *bdev)
+{
+       Sector sect;
+       unsigned char *d;
+       int ret = 0;
+
+       if (p[0] != AIX_LABEL_MAGIC1 &&
+               p[1] != AIX_LABEL_MAGIC2 &&
+               p[2] != AIX_LABEL_MAGIC3 &&
+               p[3] != AIX_LABEL_MAGIC4)
+               return 0;
+       d = read_dev_sector(bdev, 7, &sect);
+       if (d) {
+               if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')
+                       ret = 1;
+               put_dev_sector(sect);
+       };
+       return ret;
+}
+
 /*
  * Create devices for each logical partition in an extended partition.
  * The logical partitions form a linked list, with each entry being
@@ -393,6 +418,12 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
                return 0;
        }
 
+       if (aix_magic_present(data, bdev)) {
+               put_dev_sector(sect);
+               printk( " [AIX]");
+               return 0;
+       }
+
        /*
         * Now that the 55aa signature is present, this is probably
         * either the boot sector of a FAT filesystem or a DOS-type
index 0b615d62a159b16eb8da4a593b52f4a469f46cc4..c0e554971df01dbac80e057bde18b94e6648faa9 100644 (file)
@@ -347,6 +347,8 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
        sigemptyset(&sigign);
        sigemptyset(&sigcatch);
        cutime = cstime = utime = stime = cputime_zero;
+
+       mutex_lock(&tty_mutex);
        read_lock(&tasklist_lock);
        if (task->sighand) {
                spin_lock_irq(&task->sighand->siglock);
@@ -388,6 +390,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
        }
        ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
        read_unlock(&tasklist_lock);
+       mutex_unlock(&tty_mutex);
 
        if (!whole || num_threads<2)
                wchan = get_wchan(task);
index fe8d55fb17cc37da251cfd524dfc14dfb1711c72..89c20d9d50bfbf09c77aca8ca921885bb7eb0084 100644 (file)
@@ -797,7 +797,7 @@ out_no_task:
 static ssize_t mem_write(struct file * file, const char * buf,
                         size_t count, loff_t *ppos)
 {
-       int copied = 0;
+       int copied;
        char *page;
        struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
        unsigned long dst = *ppos;
@@ -814,6 +814,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
        if (!page)
                goto out;
 
+       copied = 0;
        while (count > 0) {
                int this_len, retval;
 
index 3ceff385727273269018a6e4780a97a6bd234cc6..1294eda4acaeefc5739bd4ad267a7fca2dd679dd 100644 (file)
@@ -100,7 +100,7 @@ static int notesize(struct memelfnote *en)
        int sz;
 
        sz = sizeof(struct elf_note);
-       sz += roundup(strlen(en->name), 4);
+       sz += roundup((strlen(en->name) + 1), 4);
        sz += roundup(en->datasz, 4);
 
        return sz;
@@ -116,7 +116,7 @@ static char *storenote(struct memelfnote *men, char *bufp)
 
 #define DUMP_WRITE(addr,nr) do { memcpy(bufp,addr,nr); bufp += nr; } while(0)
 
-       en.n_namesz = strlen(men->name);
+       en.n_namesz = strlen(men->name) + 1;
        en.n_descsz = men->datasz;
        en.n_type = men->type;
 
index 3a59309f3ca90d9c0a96a834abb7255ecf92de2c..0eb7ac08048471ac4f34a81cd50c1b4ccc32e81d 100644 (file)
@@ -28,7 +28,7 @@ endif
 # will work around it. If any other architecture displays this behavior,
 # add it here.
 ifeq ($(CONFIG_PPC32),y)
-EXTRA_CFLAGS := -O1
+EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0400, -O1)
 endif
 
 TAGS:
index 1627edd50810b94df2f4003479092022c9952d9d..1cfbe857ba27216c03243c6eea5b07ab9d72b1f4 100644 (file)
@@ -130,7 +130,7 @@ static int reiserfs_sync_file(struct file *p_s_filp,
        reiserfs_write_lock(p_s_inode->i_sb);
        barrier_done = reiserfs_commit_for_inode(p_s_inode);
        reiserfs_write_unlock(p_s_inode->i_sb);
-       if (barrier_done != 1)
+       if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb))
                blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
        if (barrier_done < 0)
                return barrier_done;
index 8810fda0da469aa14ebf69ea51aeaedb2686e0f5..7e5a2f5ebeb0fc19e120a5d9f29c00c37b89624f 100644 (file)
@@ -1127,9 +1127,9 @@ static void init_inode(struct inode *inode, struct path *path)
        REISERFS_I(inode)->i_prealloc_count = 0;
        REISERFS_I(inode)->i_trans_id = 0;
        REISERFS_I(inode)->i_jl = NULL;
-       REISERFS_I(inode)->i_acl_access = NULL;
-       REISERFS_I(inode)->i_acl_default = NULL;
-       init_rwsem(&REISERFS_I(inode)->xattr_sem);
+       reiserfs_init_acl_access(inode);
+       reiserfs_init_acl_default(inode);
+       reiserfs_init_xattr_rwsem(inode);
 
        if (stat_data_v1(ih)) {
                struct stat_data_v1 *sd =
@@ -1834,9 +1834,9 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
        REISERFS_I(inode)->i_attrs =
            REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;
        sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode);
-       REISERFS_I(inode)->i_acl_access = NULL;
-       REISERFS_I(inode)->i_acl_default = NULL;
-       init_rwsem(&REISERFS_I(inode)->xattr_sem);
+       reiserfs_init_acl_access(inode);
+       reiserfs_init_acl_default(inode);
+       reiserfs_init_xattr_rwsem(inode);
 
        if (old_format_only(sb))
                make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,
@@ -1974,11 +1974,13 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
         * iput doesn't deadlock in reiserfs_delete_xattrs. The locking
         * code really needs to be reworked, but this will take care of it
         * for now. -jeffm */
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
        if (REISERFS_I(dir)->i_acl_default && !IS_ERR(REISERFS_I(dir)->i_acl_default)) {
                reiserfs_write_unlock_xattrs(dir->i_sb);
                iput(inode);
                reiserfs_write_lock_xattrs(dir->i_sb);
        } else
+#endif
                iput(inode);
        return err;
 }
index 9b3672d69367251b6109c6550c5e8e7f81986634..e6b5ccf23f152178eb2981423ae3218f1abab6c0 100644 (file)
@@ -1186,6 +1186,21 @@ static struct reiserfs_journal_list *find_newer_jl_for_cn(struct
        return NULL;
 }
 
+static int newer_jl_done(struct reiserfs_journal_cnode *cn)
+{
+       struct super_block *sb = cn->sb;
+       b_blocknr_t blocknr = cn->blocknr;
+
+       cn = cn->hprev;
+       while (cn) {
+               if (cn->sb == sb && cn->blocknr == blocknr && cn->jlist &&
+                   atomic_read(&cn->jlist->j_commit_left) != 0)
+                                   return 0;
+               cn = cn->hprev;
+       }
+       return 1;
+}
+
 static void remove_journal_hash(struct super_block *,
                                struct reiserfs_journal_cnode **,
                                struct reiserfs_journal_list *, unsigned long,
@@ -1604,6 +1619,31 @@ static int flush_journal_list(struct super_block *s,
        return err;
 }
 
+static int test_transaction(struct super_block *s,
+                            struct reiserfs_journal_list *jl)
+{
+       struct reiserfs_journal_cnode *cn;
+
+       if (jl->j_len == 0 || atomic_read(&jl->j_nonzerolen) == 0)
+               return 1;
+
+       cn = jl->j_realblock;
+       while (cn) {
+               /* if the blocknr == 0, this has been cleared from the hash,
+                ** skip it
+                */
+               if (cn->blocknr == 0) {
+                       goto next;
+               }
+               if (cn->bh && !newer_jl_done(cn))
+                       return 0;
+             next:
+               cn = cn->next;
+               cond_resched();
+       }
+       return 0;
+}
+
 static int write_one_transaction(struct super_block *s,
                                 struct reiserfs_journal_list *jl,
                                 struct buffer_chunk *chunk)
@@ -3433,16 +3473,6 @@ static void flush_async_commits(void *p)
                flush_commit_list(p_s_sb, jl, 1);
        }
        unlock_kernel();
-       /*
-        * this is a little racey, but there's no harm in missing
-        * the filemap_fdata_write
-        */
-       if (!atomic_read(&journal->j_async_throttle)
-           && !reiserfs_is_journal_aborted(journal)) {
-               atomic_inc(&journal->j_async_throttle);
-               filemap_fdatawrite(p_s_sb->s_bdev->bd_inode->i_mapping);
-               atomic_dec(&journal->j_async_throttle);
-       }
 }
 
 /*
@@ -3844,7 +3874,9 @@ static void flush_old_journal_lists(struct super_block *s)
                entry = journal->j_journal_list.next;
                jl = JOURNAL_LIST_ENTRY(entry);
                /* this check should always be run, to send old lists to disk */
-               if (jl->j_timestamp < (now - (JOURNAL_MAX_TRANS_AGE * 4))) {
+               if (jl->j_timestamp < (now - (JOURNAL_MAX_TRANS_AGE * 4)) &&
+                   atomic_read(&jl->j_commit_left) == 0 &&
+                   test_transaction(s, jl)) {
                        flush_used_journal_lists(s, jl);
                } else {
                        break;
index b40d4d64d598b83ce47b578ed487a7f282178605..80fc3b32802f827d6fe1bf8e9e919321d3f9e6d0 100644 (file)
@@ -510,8 +510,10 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
            SLAB_CTOR_CONSTRUCTOR) {
                INIT_LIST_HEAD(&ei->i_prealloc_list);
                inode_init_once(&ei->vfs_inode);
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
                ei->i_acl_access = NULL;
                ei->i_acl_default = NULL;
+#endif
        }
 }
 
@@ -560,6 +562,7 @@ static void reiserfs_dirty_inode(struct inode *inode)
        reiserfs_write_unlock(inode->i_sb);
 }
 
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
 static void reiserfs_clear_inode(struct inode *inode)
 {
        struct posix_acl *acl;
@@ -574,6 +577,9 @@ static void reiserfs_clear_inode(struct inode *inode)
                posix_acl_release(acl);
        REISERFS_I(inode)->i_acl_default = NULL;
 }
+#else
+#define reiserfs_clear_inode NULL
+#endif
 
 #ifdef CONFIG_QUOTA
 static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,
index 33b72ba0f86f45790bd7661053266cd8336c9757..dcbc1112b7ec214c063eaf5786bb17d5f208e6b0 100644 (file)
@@ -658,8 +658,6 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
        unsigned int i;
        struct poll_list *head;
        struct poll_list *walk;
-       struct fdtable *fdt;
-       int max_fdset;
        /* Allocate small arguments on the stack to save memory and be
           faster - use long to make sure the buffer is aligned properly
           on 64 bit archs to avoid unaligned access */
@@ -667,11 +665,7 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
        struct poll_list *stack_pp = NULL;
 
        /* Do a sanity check on nfds ... */
-       rcu_read_lock();
-       fdt = files_fdtable(current->files);
-       max_fdset = fdt->max_fdset;
-       rcu_read_unlock();
-       if (nfds > max_fdset && nfds > OPEN_MAX)
+       if (nfds > current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
                return -EINVAL;
 
        poll_initwait(&table);
index 5c4c94d5495e42588c9aef5a9fe4271d54f1da24..6987824d0dce0ec94713d3f394e8d2c8535c04aa 100644 (file)
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(deactivate_super);
  *     success, 0 if we had failed (superblock contents was already dead or
  *     dying when grab_super() had been called).
  */
-static int grab_super(struct super_block *s)
+static int grab_super(struct super_block *s) __releases(sb_lock)
 {
        s->s_count++;
        spin_unlock(&sb_lock);
index 5dd356cbbda607de674b825d40ecf0c72fce490b..1d3b5d2070e5474cbf2b212b457166487e32fbde 100644 (file)
@@ -1621,6 +1621,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
                goto error_out;
        }
 
+       if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY)
+               printk("UDF-fs: Partition marked readonly; forcing readonly mount\n");
+               sb->s_flags |= MS_RDONLY;
+
        if ( udf_find_fileset(sb, &fileset, &rootdir) )
        {
                printk("UDF-fs: No fileset found\n");
index 9cb27cd4e6ae9cb3237060ecd8c51f07c7a8822d..0e4a3901d3b36b0afa8ea1acbff9165e1bf515db 100644 (file)
@@ -29,7 +29,7 @@ static irqreturn_t
 p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
        do_leds();
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 7b98b533e63a85e84e36618a713d5a6412b9478f..c69cb508735f74aed3db85f0d7e1e662eba0896e 100644 (file)
@@ -45,7 +45,7 @@
 static irqreturn_t
 timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode(regs));
 #endif
index 8a023a984acb52435367435a21320259e604b37f..b7f83075436ec7e226e224d327fa678f4a8c4e41 100644 (file)
@@ -14,7 +14,10 @@ struct omap_kp_platform_data {
        int rows;
        int cols;
        int *keymap;
+       unsigned int keymapsize;
        unsigned int rep:1;
+       unsigned long delay;
+       unsigned int dbounce:1;
        /* specific to OMAP242x*/
        unsigned int *row_gpios;
        unsigned int *col_gpios;
index 8ceab7bcd8b4f229f45536f8208e5394c99e9695..a5250895155ef6e5affcae708a4a79f692f037e2 100644 (file)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) do { \
-       if (unlikely((condition)!=0)) { \
-               printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
-               dump_stack(); \
-       } \
-} while (0)
+#define WARN_ON(condition) ({                                          \
+       typeof(condition) __ret_warn_on = (condition);                  \
+       if (unlikely(__ret_warn_on)) {                                  \
+               printk("BUG: warning at %s:%d/%s()\n", __FILE__,        \
+                       __LINE__, __FUNCTION__);                        \
+               dump_stack();                                           \
+       }                                                               \
+       unlikely(__ret_warn_on);                                        \
+})
 #endif
 
 #else /* !CONFIG_BUG */
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) do { if (condition) ; } while(0)
+#define WARN_ON(condition) unlikely((condition))
 #endif
 #endif
 
-#define WARN_ON_ONCE(condition)                                \
-({                                                     \
+#define WARN_ON_ONCE(condition)        ({                      \
        static int __warn_once = 1;                     \
-       int __ret = 0;                                  \
+       typeof(condition) __ret_warn_once = (condition);\
                                                        \
-       if (unlikely((condition) && __warn_once)) {     \
-               __warn_once = 0;                        \
-               WARN_ON(1);                             \
-               __ret = 1;                              \
-       }                                               \
-       __ret;                                          \
+       if (likely(__warn_once))                        \
+               if (WARN_ON(__ret_warn_once))           \
+                       __warn_once = 0;                \
+       unlikely(__ret_warn_once);                      \
 })
 
 #ifdef CONFIG_SMP
index 576ae01d71c81d98d91357c55a56ddbeee1499e6..81999a3ebe7c4c712ac91da21fc963e24c638270 100644 (file)
@@ -21,7 +21,7 @@ static inline dma_addr_t
 dma_map_single(struct device *dev, void *ptr, size_t size,
               enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
        WARN_ON(size == 0);
        flush_write_buffers();
        return virt_to_phys(ptr);
@@ -31,7 +31,7 @@ static inline void
 dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
                 enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
 }
 
 static inline int
@@ -40,7 +40,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 {
        int i;
 
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
        WARN_ON(nents == 0 || sg[0].length == 0);
 
        for (i = 0; i < nents; i++ ) {
@@ -57,7 +57,7 @@ static inline dma_addr_t
 dma_map_page(struct device *dev, struct page *page, unsigned long offset,
             size_t size, enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
        return page_to_phys(page) + offset;
 }
 
@@ -65,7 +65,7 @@ static inline void
 dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
               enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
 }
 
 
@@ -73,7 +73,7 @@ static inline void
 dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
             enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       BUG_ON(!valid_dma_direction(direction));
 }
 
 static inline void
index 6312c3e798147d508c1c695c175559dd96dc8daf..4182c347ef85052178ee67b193d3c5750c14aa58 100644 (file)
@@ -16,7 +16,7 @@
 
 static inline void do_timer_interrupt_hook(struct pt_regs *regs)
 {
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode_vm(regs));
 #endif
index a81b0596159508618a3e2b2bfc11ea5b9d62fe47..254a0fe01c6a3f46b5983afc9336b11a61a3d81d 100644 (file)
@@ -88,7 +88,7 @@ static inline void clustered_apic_check(void)
 
 static inline int apicid_to_node(int logical_apicid)
 {
-       return logical_apicid >> 5;          /* 2 clusterids per CEC */
+       return apicid_2_node[logical_apicid];
 }
 
 /* Mapping from cpu number to logical apicid */
index 95568e6ca91cf3cff150c743ff9f0f87a070a4d9..8db618c5a72b0e50ec0502e7b0d6b8baadec456c 100644 (file)
@@ -9,7 +9,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
        /* Clear the interrupt */
        co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
 
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode_vm(regs));
 #endif
index eaf518098981cc843e564d3ec1b650f17442256e..099fe9f5c1b2bcc922079c7fa64b21b197d864b7 100644 (file)
@@ -3,7 +3,7 @@
 
 static inline void do_timer_interrupt_hook(struct pt_regs *regs)
 {
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
        update_process_times(user_mode_vm(regs));
 #endif
index 32ac8c91d5c5ccb2e8856ee2a6943d59609d090e..915c26a31b79a6f0a855ae06920810761978abe8 100644 (file)
@@ -46,6 +46,8 @@ extern u8 x86_cpu_to_apicid[];
 
 #define cpu_physical_id(cpu)   x86_cpu_to_apicid[cpu]
 
+extern u8 apicid_2_node[];
+
 #ifdef CONFIG_HOTPLUG_CPU
 extern void cpu_exit_clear(void);
 extern void cpu_uninit(void);
index f44b529e329821a91a2fedf715ac83b55f6f3085..978b2c7e84eaf25f9d32a7ffb06c8744ed65fdf4 100644 (file)
@@ -70,9 +70,10 @@ struct bug_entry *find_bug(unsigned long bugaddr);
                    "i" (__FILE__), "i" (__FUNCTION__));        \
 } while (0)
 
-#define WARN_ON(x) do {                                                \
-       if (__builtin_constant_p(x)) {                          \
-               if (x)                                          \
+#define WARN_ON(x) ({                                          \
+       typeof(x) __ret_warn_on = (x);                          \
+       if (__builtin_constant_p(__ret_warn_on)) {              \
+               if (__ret_warn_on)                              \
                        __WARN();                               \
        } else {                                                \
                __asm__ __volatile__(                           \
@@ -80,11 +81,12 @@ struct bug_entry *find_bug(unsigned long bugaddr);
                ".section __bug_table,\"a\"\n"                  \
                "\t"PPC_LONG"   1b,%1,%2,%3\n"                  \
                ".previous"                                     \
-               : : "r" ((long)(x)),                            \
+               : : "r" (__ret_warn_on),                        \
                    "i" (__LINE__ + BUG_WARNING_TRAP),          \
                    "i" (__FILE__), "i" (__FUNCTION__));        \
        }                                                       \
-} while (0)
+       unlikely(__ret_warn_on);                                \
+})
 
 #define HAVE_ARCH_BUG
 #define HAVE_ARCH_BUG_ON
index bd1a721f7aa2e82f1da34afb8d7f7771e260033c..7da991a858f8c97f1f390fd8285ebb3ab9e3c592 100644 (file)
@@ -19,8 +19,5 @@ enum interruption_class {
        NR_IRQS,
 };
 
-#define touch_nmi_watchdog() do { } while(0)
-
 #endif /* __KERNEL__ */
 #endif
-
index 83425cdefc91ee5eefd507ca8c3c562396d5684d..ecdff13b250512839a494c7d4432b5de2bd2dddc 100644 (file)
@@ -31,9 +31,9 @@
  * the S390 page table tree.
  */
 #ifndef __ASSEMBLY__
+#include <linux/mm_types.h>
 #include <asm/bug.h>
 #include <asm/processor.h>
-#include <linux/threads.h>
 
 struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
 struct mm_struct;
@@ -597,31 +597,31 @@ ptep_establish(struct vm_area_struct *vma,
  * should therefore only be called if it is not mapped in any
  * address space.
  */
-#define page_test_and_clear_dirty(_page)                                 \
-({                                                                       \
-       struct page *__page = (_page);                                    \
-       unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT);  \
-       int __skey = page_get_storage_key(__physpage);                    \
-       if (__skey & _PAGE_CHANGED)                                       \
-               page_set_storage_key(__physpage, __skey & ~_PAGE_CHANGED);\
-       (__skey & _PAGE_CHANGED);                                         \
-})
+static inline int page_test_and_clear_dirty(struct page *page)
+{
+       unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+       int skey = page_get_storage_key(physpage);
+
+       if (skey & _PAGE_CHANGED)
+               page_set_storage_key(physpage, skey & ~_PAGE_CHANGED);
+       return skey & _PAGE_CHANGED;
+}
 
 /*
  * Test and clear referenced bit in storage key.
  */
-#define page_test_and_clear_young(page)                                        \
-({                                                                     \
-       struct page *__page = (page);                                   \
-       unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT);\
-       int __ccode;                                                    \
-       asm volatile(                                                   \
-               "       rrbe    0,%1\n"                                 \
-               "       ipm     %0\n"                                   \
-               "       srl     %0,28\n"                                \
-               : "=d" (__ccode) : "a" (__physpage) : "cc");            \
-       (__ccode & 2);                                                  \
-})
+static inline int page_test_and_clear_young(struct page *page)
+{
+       unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+       int ccode;
+
+       asm volatile (
+               "rrbe 0,%1\n"
+               "ipm  %0\n"
+               "srl  %0,28\n"
+               : "=d" (ccode) : "a" (physpage) : "cc" );
+       return ccode & 2;
+}
 
 /*
  * Conversion functions: convert a page and protection to a page entry,
@@ -634,32 +634,28 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
        return __pte;
 }
 
-#define mk_pte(pg, pgprot)                                                \
-({                                                                        \
-       struct page *__page = (pg);                                       \
-       pgprot_t __pgprot = (pgprot);                                     \
-       unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT);  \
-       pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
-       __pte;                                                            \
-})
+static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
+{
+       unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
 
-#define pfn_pte(pfn, pgprot)                                              \
-({                                                                        \
-       pgprot_t __pgprot = (pgprot);                                     \
-       unsigned long __physpage = __pa((pfn) << PAGE_SHIFT);             \
-       pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
-       __pte;                                                            \
-})
+       return mk_pte_phys(physpage, pgprot);
+}
+
+static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
+{
+       unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+       return mk_pte_phys(physpage, pgprot);
+}
 
 #ifdef __s390x__
 
-#define pfn_pmd(pfn, pgprot)                                              \
-({                                                                        \
-       pgprot_t __pgprot = (pgprot);                                     \
-       unsigned long __physpage = __pa((pfn) << PAGE_SHIFT);             \
-       pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot));           \
-       __pmd;                                                            \
-})
+static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
+{
+       unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+       return __pmd(physpage + pgprot_val(pgprot));
+}
 
 #endif /* __s390x__ */
 
index 4862daf8b9068390c31e247d7fc2ed34dce7f9e7..188f726217766f8e45bc7dce5a130e509d9b2f68 100644 (file)
@@ -274,12 +274,6 @@ static inline pte_t pte_mkread(pte_t pte)
        return(pte_mknewprot(pte)); 
 }
 
-static inline pte_t pte_mkexec(pte_t pte)
-{ 
-       pte_set_bits(pte, _PAGE_USER);
-       return(pte_mknewprot(pte)); 
-}
-
 static inline pte_t pte_mkdirty(pte_t pte)
 { 
        pte_set_bits(pte, _PAGE_DIRTY);
index b6da83dcc7a6690e81bde6956cd16acf6ef12a15..10174b110a5cf9bb332b531c24f2cedef3b35c0a 100644 (file)
@@ -55,13 +55,6 @@ extern dma_addr_t bad_dma_address;
 extern struct dma_mapping_ops* dma_ops;
 extern int iommu_merge;
 
-static inline int valid_dma_direction(int dma_direction)
-{
-       return ((dma_direction == DMA_BIDIRECTIONAL) ||
-               (dma_direction == DMA_TO_DEVICE) ||
-               (dma_direction == DMA_FROM_DEVICE));
-}
-
 static inline int dma_mapping_error(dma_addr_t dma_addr)
 {
        if (dma_ops->mapping_error)
index 1df2ac30a4d2650fc952b0c0e9862abaac547852..f7a52e19b4bee532fd3fc988ac6421867e123a0f 100644 (file)
@@ -58,6 +58,7 @@ header-y += elf-em.h
 header-y += fadvise.h
 header-y += fd.h
 header-y += fdreg.h
+header-y += fib_rules.h
 header-y += ftape-header-segment.h
 header-y += ftape-vendors.h
 header-y += fuse.h
@@ -70,6 +71,7 @@ header-y += hysdn_if.h
 header-y += i2c-dev.h
 header-y += i8k.h
 header-y += icmp.h
+header-y += if_addr.h
 header-y += if_arcnet.h
 header-y += if_arp.h
 header-y += if_bonding.h
@@ -79,6 +81,7 @@ header-y += if_fddi.h
 header-y += if.h
 header-y += if_hippi.h
 header-y += if_infiniband.h
+header-y += if_link.h
 header-y += if_packet.h
 header-y += if_plip.h
 header-y += if_ppp.h
@@ -110,6 +113,7 @@ header-y += mmtimer.h
 header-y += mqueue.h
 header-y += mtio.h
 header-y += ncp_no.h
+header-y += neighbour.h
 header-y += netfilter_arp.h
 header-y += netrom.h
 header-y += nfs2.h
index 6ba3aa8a81f4953b84cb1ef0edf093ed1b7af8ad..75b8baca08f3a999d0b84da8d30ea80a35b479ed 100644 (file)
@@ -88,15 +88,7 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
 #include <asm/byteorder.h>
 
 struct ddpehdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   deh_len:10,
-               deh_hops:4,
-               deh_pad:2;
-#else
-       __u16   deh_pad:2,
-               deh_hops:4,
-               deh_len:10;
-#endif
+       __be16  deh_len_hops;   /* lower 10 bits are length, next 4 - hops */
        __be16  deh_sum;
        __be16  deh_dnet;
        __be16  deh_snet;
@@ -112,36 +104,6 @@ static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
        return (struct ddpehdr *)skb->h.raw;
 }
 
-/*
- *     Don't drop the struct into the struct above.  You'll get some
- *     surprise padding.
- */
-struct ddpebits {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   deh_len:10,
-               deh_hops:4,
-               deh_pad:2;
-#else
-       __u16   deh_pad:2,
-               deh_hops:4,
-               deh_len:10;
-#endif
-};
-
-/* Short form header */
-struct ddpshdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   dsh_len:10,
-               dsh_pad:6;
-#else
-       __u16   dsh_pad:6,
-               dsh_len:10;
-#endif
-       __u8    dsh_dport;
-       __u8    dsh_sport;
-       /* And netatalk apps expect to stick the type in themselves */
-};
-
 /* AppleTalk AARP headers */
 struct elapaarp {
        __be16  hw_type;
index 40a6c26294ae9fda282d26f27b8f7c9cac622d30..42719d07612a70a62e3bc2daab2d086f24192129 100644 (file)
 #define AUDIT_MAC_POLICY_LOAD  1403    /* Policy file load */
 #define AUDIT_MAC_STATUS       1404    /* Changed enforcing,permissive,off */
 #define AUDIT_MAC_CONFIG_CHANGE        1405    /* Changes to booleans */
+#define AUDIT_MAC_UNLBL_ACCEPT 1406    /* NetLabel: allow unlabeled traffic */
+#define AUDIT_MAC_UNLBL_DENY   1407    /* NetLabel: deny unlabeled traffic */
+#define AUDIT_MAC_CIPSOV4_ADD  1408    /* NetLabel: add CIPSOv4 DOI entry */
+#define AUDIT_MAC_CIPSOV4_DEL  1409    /* NetLabel: del CIPSOv4 DOI entry */
+#define AUDIT_MAC_MAP_ADD      1410    /* NetLabel: add LSM domain mapping */
+#define AUDIT_MAC_MAP_DEL      1411    /* NetLabel: del LSM domain mapping */
 
 #define AUDIT_FIRST_KERN_ANOM_MSG   1700
 #define AUDIT_LAST_KERN_ANOM_MSG    1799
index c773ee545ebd046a7256c3c13a44a1bb894760b2..cfde8b3ee9199293b17c883bd7a2292ecbad44c2 100644 (file)
@@ -417,9 +417,9 @@ struct request_queue
        unsigned int            sg_timeout;
        unsigned int            sg_reserved_size;
        int                     node;
-
+#ifdef CONFIG_BLK_DEV_IO_TRACE
        struct blk_trace        *blk_trace;
-
+#endif
        /*
         * reserved for flush operations
         */
index 060b96112ec66fcfebcd6e8f5ea4c86f4bec5dde..0780de440220e43211f6f9a00cd3dc29ba77b290 100644 (file)
@@ -14,7 +14,7 @@
 # define __releases(x) __attribute__((context(1,0)))
 # define __acquire(x)  __context__(1)
 # define __release(x)  __context__(-1)
-# define __cond_lock(x)        ((x) ? ({ __context__(1); 1; }) : 0)
+# define __cond_lock(x,c)      ((c) ? ({ __acquire(x); 1; }) : 0)
 extern void __chk_user_ptr(void __user *);
 extern void __chk_io_ptr(void __iomem *);
 #else
@@ -31,7 +31,7 @@ extern void __chk_io_ptr(void __iomem *);
 # define __releases(x)
 # define __acquire(x) (void)0
 # define __release(x) (void)0
-# define __cond_lock(x) (x)
+# define __cond_lock(x,c) (c)
 #endif
 
 #ifdef __KERNEL__
index 9354722a9217807cb0d4d6a2d3e716a0db73bb25..4d8adf6636810875b00f070dd548193e620b7015 100644 (file)
@@ -63,6 +63,8 @@ static inline int cpuset_do_slab_mem_spread(void)
        return current->flags & PF_SPREAD_SLAB;
 }
 
+extern void cpuset_track_online_nodes(void);
+
 #else /* !CONFIG_CPUSETS */
 
 static inline int cpuset_init_early(void) { return 0; }
@@ -126,6 +128,8 @@ static inline int cpuset_do_slab_mem_spread(void)
        return 0;
 }
 
+static inline void cpuset_track_online_nodes(void) {}
+
 #endif /* !CONFIG_CPUSETS */
 
 #endif /* _LINUX_CPUSET_H */
index a41f38428c37d794ac80f947502c4142123a4afc..1dba681e428d27e1750652e94b9a84c080cb1b59 100644 (file)
@@ -87,6 +87,6 @@ struct cramfs_super {
 /* Uncompression interfaces to the underlying zlib */
 int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
 int cramfs_uncompress_init(void);
-int cramfs_uncompress_exit(void);
+void cramfs_uncompress_exit(void);
 
 #endif
index 635690cf3e3dc77ff54f8d07555da2ffc4dff165..ff203c465fed260f75de3c0d80a71e7d90f101d2 100644 (file)
@@ -24,6 +24,13 @@ enum dma_data_direction {
 #define DMA_28BIT_MASK 0x000000000fffffffULL
 #define DMA_24BIT_MASK 0x0000000000ffffffULL
 
+static inline int valid_dma_direction(int dma_direction)
+{
+       return ((dma_direction == DMA_BIDIRECTIONAL) ||
+               (dma_direction == DMA_TO_DEVICE) ||
+               (dma_direction == DMA_FROM_DEVICE));
+}
+
 #include <asm/dma-mapping.h>
 
 /* Backwards compat, remove in 2.7.x */
index b2cd2071d432d137b8d913134c21b0b93a920b25..38dc403be70b5bc4f49aee4132ba7ea85ca61399 100644 (file)
@@ -27,7 +27,8 @@ enum dmi_device_type {
        DMI_DEV_TYPE_ETHERNET,
        DMI_DEV_TYPE_TOKENRING,
        DMI_DEV_TYPE_SOUND,
-       DMI_DEV_TYPE_IPMI = -1
+       DMI_DEV_TYPE_IPMI = -1,
+       DMI_DEV_TYPE_OEM_STRING = -2
 };
 
 struct dmi_header {
index 408118a07763fecc3718d8dcc6569857d3aa52e4..92f8d4fab32be96bd86e29612b78c6a8cb1b952b 100644 (file)
@@ -38,7 +38,7 @@ struct sock_exterr_skb
        } header;
        struct sock_extended_err        ee;
        u16                             addr_offset;
-       u16                             port;
+       __be16                          port;
 };
 
 #endif
index 9f7c2513866f4d1a857398711f09864239b7162c..74183e6f7f458052c72d0bf3e8297c83a32ff18c 100644 (file)
@@ -112,5 +112,6 @@ struct task_struct;
 
 struct files_struct *get_files_struct(struct task_struct *);
 void FASTCALL(put_files_struct(struct files_struct *fs));
+void reset_files_struct(struct task_struct *, struct files_struct *);
 
 #endif /* __LINUX_FILE_H */
index 8f74dfbb2edd256c312b5db9efdc33e4cbeb3cbd..6eafbe309483a56c91ec3ae4176dc9525321d457 100644 (file)
@@ -553,7 +553,9 @@ struct inode {
        unsigned int            i_flags;
 
        atomic_t                i_writecount;
+#ifdef CONFIG_SECURITY
        void                    *i_security;
+#endif
        void                    *i_private; /* fs or device private pointer */
 #ifdef __NEED_I_SIZE_ORDERED
        seqcount_t              i_size_seqcount;
@@ -645,7 +647,6 @@ struct fown_struct {
        rwlock_t lock;          /* protects pid, uid, euid fields */
        int pid;                /* pid or -pgrp where SIGIO should be sent */
        uid_t uid, euid;        /* uid/euid of process setting the owner */
-       void *security;
        int signum;             /* posix.1b rt signal to be delivered on IO */
 };
 
@@ -688,8 +689,9 @@ struct file {
        struct file_ra_state    f_ra;
 
        unsigned long           f_version;
+#ifdef CONFIG_SECURITY
        void                    *f_security;
-
+#endif
        /* needed for tty driver, and maybe others */
        void                    *private_data;
 
@@ -877,7 +879,9 @@ struct super_block {
        int                     s_syncing;
        int                     s_need_sync_fs;
        atomic_t                s_active;
+#ifdef CONFIG_SECURITY
        void                    *s_security;
+#endif
        struct xattr_handler    **s_xattr;
 
        struct list_head        s_inodes;       /* all inodes */
@@ -1143,9 +1147,10 @@ struct super_operations {
 
        int (*show_options)(struct seq_file *, struct vfsmount *);
        int (*show_stats)(struct seq_file *, struct vfsmount *);
-
+#ifdef CONFIG_QUOTA
        ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
        ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
+#endif
 };
 
 /* Inode state bits.  Protected by inode_lock. */
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
new file mode 100644 (file)
index 0000000..80764f4
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * fs/generic_acl.c
+ *
+ * (C) 2005 Andreas Gruenbacher <agruen@suse.de>
+ *
+ * This file is released under the GPL.
+ */
+
+#ifndef GENERIC_ACL_H
+#define GENERIC_ACL_H
+
+#include <linux/posix_acl.h>
+#include <linux/posix_acl_xattr.h>
+
+/**
+ * struct generic_acl_operations  -  filesystem operations
+ *
+ * Filesystems must make these operations available to the generic
+ * operations.
+ */
+struct generic_acl_operations {
+       struct posix_acl *(*getacl)(struct inode *, int);
+       void (*setacl)(struct inode *, int, struct posix_acl *);
+};
+
+size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int,
+                       char *, size_t);
+int generic_acl_get(struct inode *, struct generic_acl_operations *, int,
+                   void *, size_t);
+int generic_acl_set(struct inode *, struct generic_acl_operations *, int,
+                   const void *, size_t);
+int generic_acl_init(struct inode *, struct inode *,
+                    struct generic_acl_operations *);
+int generic_acl_chmod(struct inode *, struct generic_acl_operations *);
+
+#endif
index 4fc379de6c2ffceea015fa9b80ba987cfc42742e..fca93025ab5191db9a1d4aeb9734dbfa2f574a20 100644 (file)
@@ -138,6 +138,7 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
                              struct timespec __user *rmtp,
                              const enum hrtimer_mode mode,
                              const clockid_t clockid);
+extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
 
 extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
                                 struct task_struct *tsk);
index f0b571f1060ba23aa0542d1bc33943e2fbd0ef75..878cfe4e587f29d0d5dd3129180227bed8bf8990 100644 (file)
 struct icmphdr {
   __u8         type;
   __u8         code;
-  __u16                checksum;
+  __be16       checksum;
   union {
        struct {
-               __u16   id;
-               __u16   sequence;
+               __be16  id;
+               __be16  sequence;
        } echo;
-       __u32   gateway;
+       __be32  gateway;
        struct {
-               __u16   __unused;
-               __u16   mtu;
+               __be16  __unused;
+               __be16  mtu;
        } frag;
   } un;
 };
index 8018c2e22c0c3c6bdf237378cc18f15668eb89e4..32bf419351f184242dfd5af400dd1859f297282d 100644 (file)
@@ -214,134 +214,4 @@ struct ifconf
 #define        ifc_buf ifc_ifcu.ifcu_buf               /* buffer address       */
 #define        ifc_req ifc_ifcu.ifcu_req               /* array of structures  */
 
-/* The struct should be in sync with struct net_device_stats */
-struct rtnl_link_stats
-{
-       __u32   rx_packets;             /* total packets received       */
-       __u32   tx_packets;             /* total packets transmitted    */
-       __u32   rx_bytes;               /* total bytes received         */
-       __u32   tx_bytes;               /* total bytes transmitted      */
-       __u32   rx_errors;              /* bad packets received         */
-       __u32   tx_errors;              /* packet transmit problems     */
-       __u32   rx_dropped;             /* no space in linux buffers    */
-       __u32   tx_dropped;             /* no space available in linux  */
-       __u32   multicast;              /* multicast packets received   */
-       __u32   collisions;
-
-       /* detailed rx_errors: */
-       __u32   rx_length_errors;
-       __u32   rx_over_errors;         /* receiver ring buff overflow  */
-       __u32   rx_crc_errors;          /* recved pkt with crc error    */
-       __u32   rx_frame_errors;        /* recv'd frame alignment error */
-       __u32   rx_fifo_errors;         /* recv'r fifo overrun          */
-       __u32   rx_missed_errors;       /* receiver missed packet       */
-
-       /* detailed tx_errors */
-       __u32   tx_aborted_errors;
-       __u32   tx_carrier_errors;
-       __u32   tx_fifo_errors;
-       __u32   tx_heartbeat_errors;
-       __u32   tx_window_errors;
-
-       /* for cslip etc */
-       __u32   rx_compressed;
-       __u32   tx_compressed;
-};
-
-/* The struct should be in sync with struct ifmap */
-struct rtnl_link_ifmap
-{
-       __u64   mem_start;
-       __u64   mem_end;
-       __u64   base_addr;
-       __u16   irq;
-       __u8    dma;
-       __u8    port;
-};
-
-enum
-{
-       IFLA_UNSPEC,
-       IFLA_ADDRESS,
-       IFLA_BROADCAST,
-       IFLA_IFNAME,
-       IFLA_MTU,
-       IFLA_LINK,
-       IFLA_QDISC,
-       IFLA_STATS,
-       IFLA_COST,
-#define IFLA_COST IFLA_COST
-       IFLA_PRIORITY,
-#define IFLA_PRIORITY IFLA_PRIORITY
-       IFLA_MASTER,
-#define IFLA_MASTER IFLA_MASTER
-       IFLA_WIRELESS,          /* Wireless Extension event - see wireless.h */
-#define IFLA_WIRELESS IFLA_WIRELESS
-       IFLA_PROTINFO,          /* Protocol specific information for a link */
-#define IFLA_PROTINFO IFLA_PROTINFO
-       IFLA_TXQLEN,
-#define IFLA_TXQLEN IFLA_TXQLEN
-       IFLA_MAP,
-#define IFLA_MAP IFLA_MAP
-       IFLA_WEIGHT,
-#define IFLA_WEIGHT IFLA_WEIGHT
-       IFLA_OPERSTATE,
-       IFLA_LINKMODE,
-       __IFLA_MAX
-};
-
-
-#define IFLA_MAX (__IFLA_MAX - 1)
-
-/* ifi_flags.
-
-   IFF_* flags.
-
-   The only change is:
-   IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
-   more not changeable by user. They describe link media
-   characteristics and set by device driver.
-
-   Comments:
-   - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
-   - If neither of these three flags are set;
-     the interface is NBMA.
-
-   - IFF_MULTICAST does not mean anything special:
-   multicasts can be used on all not-NBMA links.
-   IFF_MULTICAST means that this media uses special encapsulation
-   for multicast frames. Apparently, all IFF_POINTOPOINT and
-   IFF_BROADCAST devices are able to use multicasts too.
- */
-
-/* IFLA_LINK.
-   For usual devices it is equal ifi_index.
-   If it is a "virtual interface" (f.e. tunnel), ifi_link
-   can point to real physical interface (f.e. for bandwidth calculations),
-   or maybe 0, what means, that real media is unknown (usual
-   for IPIP tunnels, when route to endpoint is allowed to change)
- */
-
-/* Subtype attributes for IFLA_PROTINFO */
-enum
-{
-       IFLA_INET6_UNSPEC,
-       IFLA_INET6_FLAGS,       /* link flags                   */
-       IFLA_INET6_CONF,        /* sysctl parameters            */
-       IFLA_INET6_STATS,       /* statistics                   */
-       IFLA_INET6_MCAST,       /* MC things. What of them?     */
-       IFLA_INET6_CACHEINFO,   /* time values and max reasm size */
-       __IFLA_INET6_MAX
-};
-
-#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
-
-struct ifla_cacheinfo
-{
-       __u32   max_reasm_len;
-       __u32   tstamp;         /* ipv6InterfaceTable updated timestamp */
-       __u32   reachable_time;
-       __u32   retrans_time;
-};
-
 #endif /* _LINUX_IF_H */
index a8b1a2071838f70794fc7605b0b44f5def7f44d4..7f5714214ee35e787aa77dfbd3b8cf63d21ca620 100644 (file)
@@ -130,11 +130,11 @@ struct arpreq_old {
 
 struct arphdr
 {
-       unsigned short  ar_hrd;         /* format of hardware address   */
-       unsigned short  ar_pro;         /* format of protocol address   */
+       __be16          ar_hrd;         /* format of hardware address   */
+       __be16          ar_pro;         /* format of protocol address   */
        unsigned char   ar_hln;         /* length of hardware address   */
        unsigned char   ar_pln;         /* length of protocol address   */
-       unsigned short  ar_op;          /* ARP opcode (command)         */
+       __be16          ar_op;          /* ARP opcode (command)         */
 
 #if 0
         /*
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
new file mode 100644 (file)
index 0000000..e963a07
--- /dev/null
@@ -0,0 +1,136 @@
+#ifndef _LINUX_IF_LINK_H
+#define _LINUX_IF_LINK_H
+
+#include <linux/netlink.h>
+
+/* The struct should be in sync with struct net_device_stats */
+struct rtnl_link_stats
+{
+       __u32   rx_packets;             /* total packets received       */
+       __u32   tx_packets;             /* total packets transmitted    */
+       __u32   rx_bytes;               /* total bytes received         */
+       __u32   tx_bytes;               /* total bytes transmitted      */
+       __u32   rx_errors;              /* bad packets received         */
+       __u32   tx_errors;              /* packet transmit problems     */
+       __u32   rx_dropped;             /* no space in linux buffers    */
+       __u32   tx_dropped;             /* no space available in linux  */
+       __u32   multicast;              /* multicast packets received   */
+       __u32   collisions;
+
+       /* detailed rx_errors: */
+       __u32   rx_length_errors;
+       __u32   rx_over_errors;         /* receiver ring buff overflow  */
+       __u32   rx_crc_errors;          /* recved pkt with crc error    */
+       __u32   rx_frame_errors;        /* recv'd frame alignment error */
+       __u32   rx_fifo_errors;         /* recv'r fifo overrun          */
+       __u32   rx_missed_errors;       /* receiver missed packet       */
+
+       /* detailed tx_errors */
+       __u32   tx_aborted_errors;
+       __u32   tx_carrier_errors;
+       __u32   tx_fifo_errors;
+       __u32   tx_heartbeat_errors;
+       __u32   tx_window_errors;
+
+       /* for cslip etc */
+       __u32   rx_compressed;
+       __u32   tx_compressed;
+};
+
+/* The struct should be in sync with struct ifmap */
+struct rtnl_link_ifmap
+{
+       __u64   mem_start;
+       __u64   mem_end;
+       __u64   base_addr;
+       __u16   irq;
+       __u8    dma;
+       __u8    port;
+};
+
+enum
+{
+       IFLA_UNSPEC,
+       IFLA_ADDRESS,
+       IFLA_BROADCAST,
+       IFLA_IFNAME,
+       IFLA_MTU,
+       IFLA_LINK,
+       IFLA_QDISC,
+       IFLA_STATS,
+       IFLA_COST,
+#define IFLA_COST IFLA_COST
+       IFLA_PRIORITY,
+#define IFLA_PRIORITY IFLA_PRIORITY
+       IFLA_MASTER,
+#define IFLA_MASTER IFLA_MASTER
+       IFLA_WIRELESS,          /* Wireless Extension event - see wireless.h */
+#define IFLA_WIRELESS IFLA_WIRELESS
+       IFLA_PROTINFO,          /* Protocol specific information for a link */
+#define IFLA_PROTINFO IFLA_PROTINFO
+       IFLA_TXQLEN,
+#define IFLA_TXQLEN IFLA_TXQLEN
+       IFLA_MAP,
+#define IFLA_MAP IFLA_MAP
+       IFLA_WEIGHT,
+#define IFLA_WEIGHT IFLA_WEIGHT
+       IFLA_OPERSTATE,
+       IFLA_LINKMODE,
+       __IFLA_MAX
+};
+
+
+#define IFLA_MAX (__IFLA_MAX - 1)
+
+/* ifi_flags.
+
+   IFF_* flags.
+
+   The only change is:
+   IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
+   more not changeable by user. They describe link media
+   characteristics and set by device driver.
+
+   Comments:
+   - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
+   - If neither of these three flags are set;
+     the interface is NBMA.
+
+   - IFF_MULTICAST does not mean anything special:
+   multicasts can be used on all not-NBMA links.
+   IFF_MULTICAST means that this media uses special encapsulation
+   for multicast frames. Apparently, all IFF_POINTOPOINT and
+   IFF_BROADCAST devices are able to use multicasts too.
+ */
+
+/* IFLA_LINK.
+   For usual devices it is equal ifi_index.
+   If it is a "virtual interface" (f.e. tunnel), ifi_link
+   can point to real physical interface (f.e. for bandwidth calculations),
+   or maybe 0, what means, that real media is unknown (usual
+   for IPIP tunnels, when route to endpoint is allowed to change)
+ */
+
+/* Subtype attributes for IFLA_PROTINFO */
+enum
+{
+       IFLA_INET6_UNSPEC,
+       IFLA_INET6_FLAGS,       /* link flags                   */
+       IFLA_INET6_CONF,        /* sysctl parameters            */
+       IFLA_INET6_STATS,       /* statistics                   */
+       IFLA_INET6_MCAST,       /* MC things. What of them?     */
+       IFLA_INET6_CACHEINFO,   /* time values and max reasm size */
+       __IFLA_INET6_MAX
+};
+
+#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
+
+struct ifla_cacheinfo
+{
+       __u32   max_reasm_len;
+       __u32   tstamp;         /* ipv6InterfaceTable updated timestamp */
+       __u32   reachable_time;
+       __u32   retrans_time;
+};
+
+#endif /* _LINUX_IF_LINK_H */
index 899c3d4776f3dffc690274bd3dfb44224c6608ab..03f43e2893a4a6110c55bd50372aeee716e9d113 100644 (file)
@@ -30,8 +30,8 @@ struct igmphdr
 {
        __u8 type;
        __u8 code;              /* For newer IGMP */
-       __u16 csum;
-       __u32 group;
+       __be16 csum;
+       __be32 group;
 };
 
 /* V3 group record types [grec_type] */
@@ -45,25 +45,25 @@ struct igmphdr
 struct igmpv3_grec {
        __u8    grec_type;
        __u8    grec_auxwords;
-       __u16   grec_nsrcs;
-       __u32   grec_mca;
-       __u32   grec_src[0];
+       __be16  grec_nsrcs;
+       __be32  grec_mca;
+       __be32  grec_src[0];
 };
 
 struct igmpv3_report {
        __u8 type;
        __u8 resv1;
-       __u16 csum;
-       __u16 resv2;
-       __u16 ngrec;
+       __be16 csum;
+       __be16 resv2;
+       __be16 ngrec;
        struct igmpv3_grec grec[0];
 };
 
 struct igmpv3_query {
        __u8 type;
        __u8 code;
-       __u16 csum;
-       __u32 group;
+       __be16 csum;
+       __be32 group;
 #if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8 qrv:3,
             suppress:1,
@@ -76,8 +76,8 @@ struct igmpv3_query {
 #error "Please fix <asm/byteorder.h>"
 #endif
        __u8 qqic;
-       __u16 nsrcs;
-       __u32 srcs[0];
+       __be16 nsrcs;
+       __be32 srcs[0];
 };
 
 #define IGMP_HOST_MEMBERSHIP_QUERY     0x11    /* From RFC1112 */
@@ -136,11 +136,11 @@ struct ip_sf_socklist
 {
        unsigned int            sl_max;
        unsigned int            sl_count;
-       __u32                   sl_addr[0];
+       __be32                  sl_addr[0];
 };
 
 #define IP_SFLSIZE(count)      (sizeof(struct ip_sf_socklist) + \
-       (count) * sizeof(__u32))
+       (count) * sizeof(__be32))
 
 #define IP_SFBLOCK     10      /* allocate this many at once */
 
@@ -159,7 +159,7 @@ struct ip_mc_socklist
 struct ip_sf_list
 {
        struct ip_sf_list       *sf_next;
-       __u32                   sf_inaddr;
+       __be32                  sf_inaddr;
        unsigned long           sf_count[2];    /* include/exclude counts */
        unsigned char           sf_gsresp;      /* include in g & s response? */
        unsigned char           sf_oldin;       /* change state */
@@ -197,7 +197,7 @@ struct ip_mc_list
 #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
 #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
 
-extern int ip_check_mc(struct in_device *dev, u32 mc_addr, u32 src_addr, u16 proto);
+extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
 extern int igmp_rcv(struct sk_buff *);
 extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
 extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
@@ -209,13 +209,13 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
                struct ip_msfilter __user *optval, int __user *optlen);
 extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
                struct group_filter __user *optval, int __user *optlen);
-extern int ip_mc_sf_allow(struct sock *sk, u32 local, u32 rmt, int dif);
+extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
 extern void ip_mr_init(void);
 extern void ip_mc_init_dev(struct in_device *);
 extern void ip_mc_destroy_dev(struct in_device *);
 extern void ip_mc_up(struct in_device *);
 extern void ip_mc_down(struct in_device *);
-extern void ip_mc_dec_group(struct in_device *in_dev, u32 addr);
-extern void ip_mc_inc_group(struct in_device *in_dev, u32 addr);
+extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
+extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
 #endif
 #endif
index bcaca8399aed62006eb601272771dbfe7c997039..d79fc75fa7c2c3d86dbf0c38f1834bc437aa524a 100644 (file)
@@ -123,17 +123,17 @@ struct ip_mreqn
 };
 
 struct ip_mreq_source {
-       __u32           imr_multiaddr;
-       __u32           imr_interface;
-       __u32           imr_sourceaddr;
+       __be32          imr_multiaddr;
+       __be32          imr_interface;
+       __be32          imr_sourceaddr;
 };
 
 struct ip_msfilter {
-       __u32           imsf_multiaddr;
-       __u32           imsf_interface;
+       __be32          imsf_multiaddr;
+       __be32          imsf_interface;
        __u32           imsf_fmode;
        __u32           imsf_numsrc;
-       __u32           imsf_slist[1];
+       __be32          imsf_slist[1];
 };
 
 #define IP_MSFILTER_SIZE(numsrc) \
index d776829b443f57e52f24e0bb8b45909936f4fd48..9be6a4756f0b39fc6cb22b7c80e3da310b52f77f 100644 (file)
@@ -32,8 +32,8 @@ struct in6_addr
        union 
        {
                __u8            u6_addr8[16];
-               __u16           u6_addr16[8];
-               __u32           u6_addr32[4];
+               __be16          u6_addr16[8];
+               __be32          u6_addr32[4];
        } in6_u;
 #define s6_addr                        in6_u.u6_addr8
 #define s6_addr16              in6_u.u6_addr16
@@ -53,7 +53,7 @@ extern const struct in6_addr in6addr_loopback;
 
 struct sockaddr_in6 {
        unsigned short int      sin6_family;    /* AF_INET6 */
-       __u16                   sin6_port;      /* Transport layer port # */
+       __be16                  sin6_port;      /* Transport layer port # */
        __u32                   sin6_flowinfo;  /* IPv6 flow information */
        struct in6_addr         sin6_addr;      /* IPv6 address */
        __u32                   sin6_scope_id;  /* scope id (new in RFC2553) */
index a4606e5810e570ae28158f6b73839f81585b231f..6e8bc548635af6a2cb1a685158751ca437dff476 100644 (file)
@@ -9,10 +9,10 @@
 
 /* Socket identity */
 struct inet_diag_sockid {
-       __u16   idiag_sport;
-       __u16   idiag_dport;
-       __u32   idiag_src[4];
-       __u32   idiag_dst[4];
+       __be16  idiag_sport;
+       __be16  idiag_dport;
+       __be32  idiag_src[4];
+       __be32  idiag_dst[4];
        __u32   idiag_if;
        __u32   idiag_cookie[2];
 #define INET_DIAG_NOCOOKIE (~0U)
@@ -67,7 +67,7 @@ struct inet_diag_hostcond {
        __u8    family;
        __u8    prefix_len;
        int     port;
-       __u32   addr[0];
+       __be32  addr[0];
 };
 
 /* Base info structure. It contains socket identity (addrs/ports/cookie)
index 92297ff24e8525de2617dff728b3420a4649f66a..5a0ab04627bc19a0c6dfd364fe56e6927db57f33 100644 (file)
@@ -90,11 +90,11 @@ struct in_ifaddr
        struct in_ifaddr        *ifa_next;
        struct in_device        *ifa_dev;
        struct rcu_head         rcu_head;
-       u32                     ifa_local;
-       u32                     ifa_address;
-       u32                     ifa_mask;
-       u32                     ifa_broadcast;
-       u32                     ifa_anycast;
+       __be32                  ifa_local;
+       __be32                  ifa_address;
+       __be32                  ifa_mask;
+       __be32                  ifa_broadcast;
+       __be32                  ifa_anycast;
        unsigned char           ifa_scope;
        unsigned char           ifa_flags;
        unsigned char           ifa_prefixlen;
@@ -104,18 +104,18 @@ struct in_ifaddr
 extern int register_inetaddr_notifier(struct notifier_block *nb);
 extern int unregister_inetaddr_notifier(struct notifier_block *nb);
 
-extern struct net_device       *ip_dev_find(u32 addr);
-extern int             inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
+extern struct net_device       *ip_dev_find(__be32 addr);
+extern int             inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
 extern int             devinet_ioctl(unsigned int cmd, void __user *);
 extern void            devinet_init(void);
 extern struct in_device *inetdev_init(struct net_device *dev);
 extern struct in_device        *inetdev_by_index(int);
-extern u32             inet_select_addr(const struct net_device *dev, u32 dst, int scope);
-extern u32             inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope);
-extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask);
+extern __be32          inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
+extern __be32          inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
+extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
 extern void            inet_forward_change(void);
 
-static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa)
+static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
 {
        return !((addr^ifa->ifa_address)&ifa->ifa_mask);
 }
@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev)
 
 #endif /* __KERNEL__ */
 
-static __inline__ __u32 inet_make_mask(int logmask)
+static __inline__ __be32 inet_make_mask(int logmask)
 {
        if (logmask)
                return htonl(~((1<<(32-logmask))-1));
index d5afee95fd435294f2ee894cd75a31b7cc96be7b..1f97e3d92639e75aaed86a8066518e2526fa1dee 100644 (file)
@@ -123,6 +123,14 @@ static inline void disable_irq_nosync_lockdep(unsigned int irq)
 #endif
 }
 
+static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
+{
+       disable_irq_nosync(irq);
+#ifdef CONFIG_LOCKDEP
+       local_irq_save(*flags);
+#endif
+}
+
 static inline void disable_irq_lockdep(unsigned int irq)
 {
        disable_irq(irq);
@@ -139,6 +147,14 @@ static inline void enable_irq_lockdep(unsigned int irq)
        enable_irq(irq);
 }
 
+static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
+{
+#ifdef CONFIG_LOCKDEP
+       local_irq_restore(*flags);
+#endif
+       enable_irq(irq);
+}
+
 /* IRQ wakeup (PM) control: */
 extern int set_irq_wake(unsigned int irq, unsigned int on);
 
index 2f4600146f833a509e3d7cac68b97013142c9e09..6b25d36fc54c481779a0d15b708e9bcca9c713a4 100644 (file)
@@ -96,7 +96,7 @@ struct iphdr {
        __be16  frag_off;
        __u8    ttl;
        __u8    protocol;
-       __u16   check;
+       __be16  check;
        __be32  saddr;
        __be32  daddr;
        /*The options start here. */
@@ -105,22 +105,22 @@ struct iphdr {
 struct ip_auth_hdr {
        __u8  nexthdr;
        __u8  hdrlen;           /* This one is measured in 32 bit units! */
-       __u16 reserved;
-       __u32 spi;
-       __u32 seq_no;           /* Sequence number */
+       __be16 reserved;
+       __be32 spi;
+       __be32 seq_no;          /* Sequence number */
        __u8  auth_data[0];     /* Variable len but >=4. Mind the 64 bit alignment! */
 };
 
 struct ip_esp_hdr {
-       __u32 spi;
-       __u32 seq_no;           /* Sequence number */
+       __be32 spi;
+       __be32 seq_no;          /* Sequence number */
        __u8  enc_data[0];      /* Variable len but >=8. Mind the 64 bit alignment! */
 };
 
 struct ip_comp_hdr {
        __u8 nexthdr;
        __u8 flags;
-       __u16 cpi;
+       __be16 cpi;
 };
 
 #endif /* _LINUX_IP_H */
index caca57df0d7d5f23039d961878dae5753e22718d..4f435c59de06775b5a1a5ba831ca3f0089006b80 100644 (file)
@@ -99,22 +99,22 @@ struct ipv6_destopt_hao {
 struct ipv6_auth_hdr {
        __u8  nexthdr;
        __u8  hdrlen;           /* This one is measured in 32 bit units! */
-       __u16 reserved;
-       __u32 spi;
-       __u32 seq_no;           /* Sequence number */
+       __be16 reserved;
+       __be32 spi;
+       __be32 seq_no;           /* Sequence number */
        __u8  auth_data[0];     /* Length variable but >=4. Mind the 64 bit alignment! */
 };
 
 struct ipv6_esp_hdr {
-       __u32 spi;
-       __u32 seq_no;           /* Sequence number */
+       __be32 spi;
+       __be32 seq_no;           /* Sequence number */
        __u8  enc_data[0];      /* Length variable but >=8. Mind the 64 bit alignment! */
 };
 
 struct ipv6_comp_hdr {
        __u8 nexthdr;
        __u8 flags;
-       __u16 cpi;
+       __be16 cpi;
 };
 
 /*
@@ -136,7 +136,7 @@ struct ipv6hdr {
 #endif
        __u8                    flow_lbl[3];
 
-       __u16                   payload_len;
+       __be16                  payload_len;
        __u8                    nexthdr;
        __u8                    hop_limit;
 
@@ -461,7 +461,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
 
 #define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
        (((__sk)->sk_hash == (__hash))                          && \
-        ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports))   && \
+        ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))      && \
         ((__sk)->sk_family             == AF_INET6)            && \
         ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr))     && \
         ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
index a6d9daa38c6d4da99fa6f6bffe9b99a5c6c79ae0..fe89444b1c6f32145f4a0a02d1e8f13258e3f299 100644 (file)
@@ -977,7 +977,6 @@ extern void    journal_write_revoke_records(journal_t *, transaction_t *);
 extern int     journal_set_revoke(journal_t *, unsigned long, tid_t);
 extern int     journal_test_revoke(journal_t *, unsigned long, tid_t);
 extern void    journal_clear_revoke(journal_t *);
-extern void    journal_brelse_array(struct buffer_head *b[], int n);
 extern void    journal_switch_revoke_table(journal_t *journal);
 
 /*
index dc23c7c639f321f9bbb857d2176130c3316c4489..88afceffb7cb45df03ecbcd1045af2117f429fb1 100644 (file)
@@ -12,6 +12,9 @@
 #ifndef __LINUX_LEDS_H_INCLUDED
 #define __LINUX_LEDS_H_INCLUDED
 
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
 struct device;
 struct class_device;
 /*
index 65a5b5ceda4947d1478bba79abbda826963d128e..a9c90287c0ffef0509a6ed74719a39a7dcee28ba 100644 (file)
@@ -39,6 +39,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
+#ifndef CONFIG_DEBUG_LIST
 static inline void __list_add(struct list_head *new,
                              struct list_head *prev,
                              struct list_head *next)
@@ -48,6 +49,11 @@ static inline void __list_add(struct list_head *new,
        new->prev = prev;
        prev->next = new;
 }
+#else
+extern void __list_add(struct list_head *new,
+                             struct list_head *prev,
+                             struct list_head *next);
+#endif
 
 /**
  * list_add - add a new entry
@@ -57,10 +63,15 @@ static inline void __list_add(struct list_head *new,
  * Insert a new entry after the specified head.
  * This is good for implementing stacks.
  */
+#ifndef CONFIG_DEBUG_LIST
 static inline void list_add(struct list_head *new, struct list_head *head)
 {
        __list_add(new, head, head->next);
 }
+#else
+extern void list_add(struct list_head *new, struct list_head *head);
+#endif
+
 
 /**
  * list_add_tail - add a new entry
@@ -153,12 +164,16 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
  * Note: list_empty on entry does not return true after this, the entry is
  * in an undefined state.
  */
+#ifndef CONFIG_DEBUG_LIST
 static inline void list_del(struct list_head *entry)
 {
        __list_del(entry->prev, entry->next);
        entry->next = LIST_POISON1;
        entry->prev = LIST_POISON2;
 }
+#else
+extern void list_del(struct list_head *entry);
+#endif
 
 /**
  * list_del_rcu - deletes entry from list without re-initialization
index c040a8c969aa503d2904b88cb61921aac212496a..1314ca0f29be78f637f027614d09d5a062e091a2 100644 (file)
@@ -8,13 +8,13 @@
 #ifndef __LINUX_LOCKDEP_H
 #define __LINUX_LOCKDEP_H
 
+#ifdef CONFIG_LOCKDEP
+
 #include <linux/linkage.h>
 #include <linux/list.h>
 #include <linux/debug_locks.h>
 #include <linux/stacktrace.h>
 
-#ifdef CONFIG_LOCKDEP
-
 /*
  * Lock-class usage-state bits:
  */
index e76c7611d6cc56e115ad71a49aa25861cc2208f6..191a595055f0063db70032a2074d8addb5eb0ad9 100644 (file)
@@ -59,10 +59,9 @@ struct loop_device {
        struct bio              *lo_bio;
        struct bio              *lo_biotail;
        int                     lo_state;
-       struct completion       lo_done;
-       struct completion       lo_bh_done;
        struct mutex            lo_ctl_mutex;
-       int                     lo_pending;
+       struct task_struct      *lo_thread;
+       wait_queue_head_t       lo_event;
 
        request_queue_t         *lo_queue;
 };
index d4486cc2e7fe6cdf822d95543610fddee2835185..2c599175c583c36a0bbd71528640489fceb6c149 100644 (file)
@@ -232,17 +232,17 @@ enum module_state
 };
 
 /* Similar stuff for section attributes. */
-#define MODULE_SECT_NAME_LEN 32
 struct module_sect_attr
 {
        struct module_attribute mattr;
-       char name[MODULE_SECT_NAME_LEN];
+       char *name;
        unsigned long address;
 };
 
 struct module_sect_attrs
 {
        struct attribute_group grp;
+       int nsections;
        struct module_sect_attr attrs[0];
 };
 
index e05d54a90743e4890a99436c0616ad428142643c..7da2cee8e1328731ef3fccbcb011f2d9524be3b6 100644 (file)
@@ -142,7 +142,7 @@ struct vif_device
        unsigned long   rate_limit;             /* Traffic shaping (NI)         */
        unsigned char   threshold;              /* TTL threshold                */
        unsigned short  flags;                  /* Control flags                */
-       __u32           local,remote;           /* Addresses(remote for tunnels)*/
+       __be32          local,remote;           /* Addresses(remote for tunnels)*/
        int             link;                   /* Physical interface index     */
 };
 
@@ -151,8 +151,8 @@ struct vif_device
 struct mfc_cache 
 {
        struct mfc_cache *next;                 /* Next entry on cache line     */
-       __u32 mfc_mcastgrp;                     /* Group the entry belongs to   */
-       __u32 mfc_origin;                       /* Source of packet             */
+       __be32 mfc_mcastgrp;                    /* Group the entry belongs to   */
+       __be32 mfc_origin;                      /* Source of packet             */
        vifi_t mfc_parent;                      /* Source interface             */
        int mfc_flags;                          /* Flags on line                */
 
@@ -179,9 +179,9 @@ struct mfc_cache
 #define MFC_LINES              64
 
 #ifdef __BIG_ENDIAN
-#define MFC_HASH(a,b)  ((((a)>>24)^((b)>>26))&(MFC_LINES-1))
+#define MFC_HASH(a,b)  (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
 #else
-#define MFC_HASH(a,b)  (((a)^((b)>>2))&(MFC_LINES-1))
+#define MFC_HASH(a,b)  ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
 #endif         
 
 #endif
@@ -213,8 +213,8 @@ struct pimreghdr
 {
        __u8    type;
        __u8    reserved;
-       __u16   csum;
-       __u32   flags;
+       __be16  csum;
+       __be32  flags;
 };
 
 extern int pim_rcv_v1(struct sk_buff *);
index bae62d62dc3e07e44b54d54c272f74d28c744c77..ce6c85815cbd17be44e95f9244c84bbc7c5f3b4b 100644 (file)
@@ -204,6 +204,7 @@ struct fat_mount_options {
                 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
                 numtail:1,       /* Does first alias have a numeric '~1' type tail? */
                 atari:1,         /* Use Atari GEMDOS variation of MS-DOS fs */
+                flush:1,         /* write things quickly */
                 nocase:1;        /* Does this need case conversion? 0=need case conversion*/
 };
 
@@ -412,6 +413,8 @@ extern int fat_sync_inode(struct inode *inode);
 extern int fat_fill_super(struct super_block *sb, void *data, int silent,
                        struct inode_operations *fs_dir_inode_ops, int isvfat);
 
+extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
+                           struct inode *i2);
 /* fat/misc.c */
 extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
 extern void fat_clusters_flush(struct super_block *sb);
index 45511a5918d3edf6be65188c3b1c64ab650da1e8..c6470ba006680a3d97191f7baf62c73bd3b0c96b 100644 (file)
@@ -54,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_OPEN            (0x0100)
 #define LOOKUP_CREATE          (0x0200)
 #define LOOKUP_ACCESS          (0x0400)
+#define LOOKUP_CHDIR           (0x0800)
 
 extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
 extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
index 13d6d4eb8b3af70b008be76f6fcf3fc23dc602cb..9264139bd8df0ee171c2d52531fa626720c42a1f 100644 (file)
@@ -187,7 +187,7 @@ struct hh_cache
 {
        struct hh_cache *hh_next;       /* Next entry                        */
        atomic_t        hh_refcnt;      /* number of users                   */
-       unsigned short  hh_type;        /* protocol identifier, f.e ETH_P_IP
+       __be16          hh_type;        /* protocol identifier, f.e ETH_P_IP
                                          *  NOTE:  For VLANs, this will be the
                                          *  encapuslated type. --BLG
                                          */
index 149e87c9ab1367cd95e5f058a40427f2167303f5..44e39b61d9e7e3b11e4b3e863204b4a89bb8cd1b 100644 (file)
@@ -46,11 +46,11 @@ struct arpt_arp {
        struct arpt_devaddr_info tgt_devaddr;
 
        /* ARP operation code. */
-       u_int16_t arpop, arpop_mask;
+       __be16 arpop, arpop_mask;
 
        /* ARP hardware address and protocol address format. */
-       u_int16_t arhrd, arhrd_mask;
-       u_int16_t arpro, arpro_mask;
+       __be16 arhrd, arhrd_mask;
+       __be16 arpro, arpro_mask;
 
        /* The protocol address length is only accepted if it is 4
         * so there is no use in offering a way to do filtering on it.
index 51dbec1892c802c3d313c3593fb0d2967a90ad2e..64e868034c4ab5868f3e2894194a39814bc66993 100644 (file)
@@ -157,7 +157,7 @@ struct ip_conntrack_expect
        unsigned int flags;
 
 #ifdef CONFIG_IP_NF_NAT_NEEDED
-       u_int32_t saved_ip;
+       __be32 saved_ip;
        /* This is the original per-proto part, used to map the
         * expected connection the way the recipient expects. */
        union ip_conntrack_manip_proto saved_proto;
index 3cbff7379002ced59a07d65ab88587767df8b59e..943cc6a4871d172d96ffc19f622ae5edc226c32f 100644 (file)
@@ -30,7 +30,7 @@ struct ip_ct_h323_master {
 struct ip_conntrack_expect;
 
 extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
-                        u_int32_t * ip, u_int16_t * port);
+                        __be32 * ip, u_int16_t * port);
 extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
                                     struct ip_conntrack_expect *this);
 extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
@@ -38,11 +38,11 @@ extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
 extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
                                  unsigned char **data, int dataoff,
                                  H245_TransportAddress * addr,
-                                 u_int32_t ip, u_int16_t port);
+                                 __be32 ip, u_int16_t port);
 extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
                                  unsigned char **data, int dataoff,
                                  TransportAddress * addr,
-                                 u_int32_t ip, u_int16_t port);
+                                 __be32 ip, u_int16_t port);
 extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
                                 struct ip_conntrack * ct,
                                 enum ip_conntrack_info ctinfo,
index 2fdabdb4c0ef5d0395cab5dc55d75eff1b378dd1..c228bde74c3325c0d26f3319297a63c36f1792dd 100644 (file)
@@ -23,13 +23,13 @@ union ip_conntrack_manip_proto
                __be16 port;
        } tcp;
        struct {
-               u_int16_t port;
+               __be16 port;
        } udp;
        struct {
-               u_int16_t id;
+               __be16 id;
        } icmp;
        struct {
-               u_int16_t port;
+               __be16 port;
        } sctp;
        struct {
                __be16 key;     /* key is 32bit, pptp only uses 16 */
@@ -39,7 +39,7 @@ union ip_conntrack_manip_proto
 /* The manipulable part of the tuple. */
 struct ip_conntrack_manip
 {
-       u_int32_t ip;
+       __be32 ip;
        union ip_conntrack_manip_proto u;
 };
 
@@ -50,22 +50,22 @@ struct ip_conntrack_tuple
 
        /* These are the parts of the tuple which are fixed. */
        struct {
-               u_int32_t ip;
+               __be32 ip;
                union {
                        /* Add other protocols here. */
                        u_int16_t all;
 
                        struct {
-                               u_int16_t port;
+                               __be16 port;
                        } tcp;
                        struct {
-                               u_int16_t port;
+                               __be16 port;
                        } udp;
                        struct {
                                u_int8_t type, code;
                        } icmp;
                        struct {
-                               u_int16_t port;
+                               __be16 port;
                        } sctp;
                        struct {
                                __be16 key;     /* key is 32bit, 
index 98f8407e4cb5011f0d343f241cc4b4741e56962b..bdf553620ca188ddbc53695d14d0389dd386d716 100644 (file)
@@ -33,7 +33,7 @@ struct ip_nat_range
        unsigned int flags;
 
        /* Inclusive: network order. */
-       u_int32_t min_ip, max_ip;
+       __be32 min_ip, max_ip;
 
        /* Inclusive: network order */
        union ip_conntrack_manip_proto min, max;
index aa08d68c4841ebdf265a99494bc9a88933f5d815..a03507f465f8e8be148f1accd413ca4373ff69e7 100644 (file)
@@ -26,7 +26,7 @@ typedef struct ipq_packet_msg {
        unsigned int hook;              /* Netfilter hook we rode in on */
        char indev_name[IFNAMSIZ];      /* Name of incoming interface */
        char outdev_name[IFNAMSIZ];     /* Name of outgoing interface */
-       unsigned short hw_protocol;     /* Hardware protocol (network order) */
+       __be16 hw_protocol;             /* Hardware protocol (network order) */
        unsigned short hw_type;         /* Hardware type */
        unsigned char hw_addrlen;       /* Hardware address length */
        unsigned char hw_addr[8];       /* Hardware address */
index 3ecb3bd63676a118de24f0e7616dfa1f27e0c2ef..34ab0fb736e2f75d057ea3c6e2bd1d9a65410eaf 100644 (file)
@@ -8,7 +8,7 @@
 
 struct ipt_iprange {
        /* Inclusive: network order. */
-       u_int32_t min_ip, max_ip;
+       __be32 min_ip, max_ip;
 };
 
 struct ipt_iprange_info
index c8f4d2f627d70099019f2e423cb8aec909d48034..e16904e28c3a39b57480d5bc5e64f5923cc5434a 100644 (file)
@@ -4,6 +4,7 @@
 #ifndef LINUX_NMI_H
 #define LINUX_NMI_H
 
+#include <linux/sched.h>
 #include <asm/irq.h>
 
 /**
@@ -16,7 +17,7 @@
 #ifdef ARCH_HAS_NMI_WATCHDOG
 extern void touch_nmi_watchdog(void);
 #else
-# define touch_nmi_watchdog() do { } while(0)
+# define touch_nmi_watchdog() touch_softlockup_watchdog()
 #endif
 
 #endif
index 9d7921dd50f0c19a3d500d4aeb8bc64a7d8242b9..4830a3bedfb240480e1ade7c58d030b0ab12e978 100644 (file)
 
 #define PageUptodate(page)     test_bit(PG_uptodate, &(page)->flags)
 #ifdef CONFIG_S390
-#define SetPageUptodate(_page) \
-       do {                                                                  \
-               struct page *__page = (_page);                                \
-               if (!test_and_set_bit(PG_uptodate, &__page->flags))           \
-                       page_test_and_clear_dirty(_page);                     \
-       } while (0)
+static inline void SetPageUptodate(struct page *page)
+{
+       if (!test_and_set_bit(PG_uptodate, &page->flags))
+               page_test_and_clear_dirty(page);
+}
 #else
 #define SetPageUptodate(page)  set_bit(PG_uptodate, &(page)->flags)
 #endif
index 61db1907f06fb3ac00eeefc1918982d5f46b5151..b7e85ff045ea5f97a35256a5d7941254ce086eb4 100644 (file)
 #define PCI_DEVICE_ID_TIGON3_5705_2    0x1654
 #define PCI_DEVICE_ID_TIGON3_5720      0x1658
 #define PCI_DEVICE_ID_TIGON3_5721      0x1659
+#define PCI_DEVICE_ID_TIGON3_5722      0x165a
 #define PCI_DEVICE_ID_TIGON3_5705M     0x165d
 #define PCI_DEVICE_ID_TIGON3_5705M_2   0x165e
 #define PCI_DEVICE_ID_TIGON3_5714      0x1668
 #define PCI_DEVICE_ID_TIGON3_5705F     0x166e
 #define PCI_DEVICE_ID_TIGON3_5754M     0x1672
 #define PCI_DEVICE_ID_TIGON3_5755M     0x1673
+#define PCI_DEVICE_ID_TIGON3_5756      0x1674
 #define PCI_DEVICE_ID_TIGON3_5750      0x1676
 #define PCI_DEVICE_ID_TIGON3_5751      0x1677
 #define PCI_DEVICE_ID_TIGON3_5715      0x1678
 #define PCI_DEVICE_ID_TIGON3_5901      0x170d
 #define PCI_DEVICE_ID_BCM4401B1                0x170c
 #define PCI_DEVICE_ID_TIGON3_5901_2    0x170e
+#define PCI_DEVICE_ID_TIGON3_5906      0x1712
+#define PCI_DEVICE_ID_TIGON3_5906M     0x1713
 #define PCI_DEVICE_ID_BCM4401          0x4401
 #define PCI_DEVICE_ID_BCM4401B0                0x4402
 
index 3835a9642f13f3702d31b6dfd3202dd96c194407..46ec72fa2c8435db3e9d8bd17605916aff3b5e54 100644 (file)
@@ -74,7 +74,7 @@ static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
        return 0;
 }
 
-static inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
+static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
 {
        return kzalloc(size, gfp);
 }
index 95572c434bc991dc23dd5b9074d3bb36bd69b192..a7dd38f30ade61d1cf6fba16d7f7f60b3e8cc944 100644 (file)
@@ -72,6 +72,7 @@ struct k_clock {
        int (*timer_create) (struct k_itimer *timer);
        int (*nsleep) (const clockid_t which_clock, int flags,
                       struct timespec *, struct timespec __user *);
+       long (*nsleep_restart) (struct restart_block *restart_block);
        int (*timer_set) (struct k_itimer * timr, int flags,
                          struct itimerspec * new_setting,
                          struct itimerspec * old_setting);
@@ -97,6 +98,7 @@ int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
 int posix_cpu_timer_create(struct k_itimer *timer);
 int posix_cpu_nsleep(const clockid_t which_clock, int flags,
                     struct timespec *rqtp, struct timespec __user *rmtp);
+long posix_cpu_nsleep_restart(struct restart_block *restart_block);
 int posix_cpu_timer_set(struct k_itimer *timer, int flags,
                        struct itimerspec *new, struct itimerspec *old);
 int posix_cpu_timer_del(struct k_itimer *timer);
@@ -111,4 +113,6 @@ void posix_cpu_timers_exit_group(struct task_struct *task);
 void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
                           cputime_t *newval, cputime_t *oldval);
 
+long clock_nanosleep_restart(struct restart_block *restart_block);
+
 #endif
index 8b2749a259dc0a040194b8c353c2e3a56ce7136a..eeb1976ef7bf2069a587c4a042624599c0c59099 100644 (file)
@@ -16,8 +16,8 @@
 #define PTRACE_KILL               8
 #define PTRACE_SINGLESTEP         9
 
-#define PTRACE_ATTACH          0x10
-#define PTRACE_DETACH          0x11
+#define PTRACE_ATTACH            16
+#define PTRACE_DETACH            17
 
 #define PTRACE_SYSCALL           24
 
index 806ec5b067075554792d5631996b24595157d697..fe00f781a622ab73a2230414a09b4e6fe6df96ae 100644 (file)
@@ -56,6 +56,16 @@ extern int reiserfs_xattr_posix_acl_init(void) __init;
 extern int reiserfs_xattr_posix_acl_exit(void);
 extern struct reiserfs_xattr_handler posix_acl_default_handler;
 extern struct reiserfs_xattr_handler posix_acl_access_handler;
+
+static inline void reiserfs_init_acl_access(struct inode *inode)
+{
+       REISERFS_I(inode)->i_acl_access = NULL;
+}
+
+static inline void reiserfs_init_acl_default(struct inode *inode)
+{
+       REISERFS_I(inode)->i_acl_default = NULL;
+}
 #else
 
 #define reiserfs_cache_default_acl(inode) 0
@@ -87,4 +97,11 @@ reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
        return 0;
 }
 
+static inline void reiserfs_init_acl_access(struct inode *inode)
+{
+}
+
+static inline void reiserfs_init_acl_default(struct inode *inode)
+{
+}
 #endif
index 149be8d9a0c9fe200f59ff809e8005b3ecca3ebc..5b3b297aa2c5b647294e69ac0090cef6c0deeb16 100644 (file)
@@ -52,10 +52,13 @@ struct reiserfs_inode_info {
         ** flushed */
        unsigned long i_trans_id;
        struct reiserfs_journal_list *i_jl;
-
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
        struct posix_acl *i_acl_access;
        struct posix_acl *i_acl_default;
+#endif
+#ifdef CONFIG_REISERFS_FS_XATTR
        struct rw_semaphore xattr_sem;
+#endif
        struct inode vfs_inode;
 };
 
index 5e961035c72576052cec535a48faf0814719f809..966c35851b2e784a445bac96e1458554ab8784de 100644 (file)
@@ -97,6 +97,11 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
        inode->i_flags |= S_PRIVATE;
 }
 
+static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
+{
+       init_rwsem(&REISERFS_I(inode)->xattr_sem);
+}
+
 #else
 
 #define is_reiserfs_priv_object(inode) 0
@@ -129,6 +134,9 @@ static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL);     /* to be sure */
        return 0;
 };
+static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
+{
+}
 #endif
 
 #endif                         /* __KERNEL__ */
index 9c92dc8b9a082616c4bc6622e87ca0176a622b8e..3a18addaed4ccb7436bffc9cf5fd0666f145d35c 100644 (file)
@@ -2,7 +2,7 @@
 #define __LINUX_RTNETLINK_H
 
 #include <linux/netlink.h>
-#include <linux/if.h>
+#include <linux/if_link.h>
 
 /****
  *             Routing/neighbour discovery messages.
index 9d4aa7f95bc8a9172b021f5d1c5137290f51c336..a06fc89cf6e5b8778c93ca53ebbb733948448948 100644 (file)
@@ -148,6 +148,7 @@ extern unsigned long weighted_cpuload(const int cpu);
 #define EXIT_DEAD              32
 /* in tsk->state again */
 #define TASK_NONINTERACTIVE    64
+#define TASK_DEAD              128
 
 #define __set_task_state(tsk, state_value)             \
        do { (tsk)->state = (state_value); } while (0)
@@ -504,8 +505,8 @@ struct signal_struct {
 #define rt_prio(prio)          unlikely((prio) < MAX_RT_PRIO)
 #define rt_task(p)             rt_prio((p)->prio)
 #define batch_task(p)          (unlikely((p)->policy == SCHED_BATCH))
-#define has_rt_policy(p) \
-       unlikely((p)->policy != SCHED_NORMAL && (p)->policy != SCHED_BATCH)
+#define is_rt_policy(p)                ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
+#define has_rt_policy(p)       unlikely(is_rt_policy((p)->policy))
 
 /*
  * Some day this will be a full-fledged user tracking system..
@@ -784,8 +785,9 @@ struct task_struct {
        struct prio_array *array;
 
        unsigned short ioprio;
+#ifdef CONFIG_BLK_DEV_IO_TRACE
        unsigned int btrace_seq;
-
+#endif
        unsigned long sleep_avg;
        unsigned long long timestamp, last_ran;
        unsigned long long sched_time; /* sched_clock time spent running */
@@ -886,8 +888,10 @@ struct task_struct {
                                     - initialized normally by flush_old_exec */
 /* file system info */
        int link_count, total_link_count;
+#ifdef CONFIG_SYSVIPC
 /* ipc stuff */
        struct sysv_sem sysvsem;
+#endif
 /* CPU-specific state of this task */
        struct thread_struct thread;
 /* filesystem information */
@@ -1030,6 +1034,16 @@ static inline int pid_alive(struct task_struct *p)
        return p->pids[PIDTYPE_PID].pid != NULL;
 }
 
+/**
+ * is_init - check if a task structure is the first user space
+ *          task the kernel created.
+ * @p: Task structure to be checked.
+ */
+static inline int is_init(struct task_struct *tsk)
+{
+       return tsk->pid == 1;
+}
+
 extern void free_task(struct task_struct *tsk);
 #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
 
@@ -1048,7 +1062,6 @@ static inline void put_task_struct(struct task_struct *t)
                                        /* Not implemented yet, only for 486*/
 #define PF_STARTING    0x00000002      /* being created */
 #define PF_EXITING     0x00000004      /* getting shut down */
-#define PF_DEAD                0x00000008      /* Dead */
 #define PF_FORKNOEXEC  0x00000040      /* forked but didn't exec */
 #define PF_SUPERPRIV   0x00000100      /* used super-user privileges */
 #define PF_DUMPCORE    0x00000200      /* dumped core */
@@ -1193,7 +1206,7 @@ extern void switch_uid(struct user_struct *);
 
 #include <asm/current.h>
 
-extern void do_timer(struct pt_regs *);
+extern void do_timer(unsigned long ticks);
 
 extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
 extern int FASTCALL(wake_up_process(struct task_struct * tsk));
index 90dd069cc145c4b26a6fefe020aacee17d28aa65..1a82d30c4b17eea493a8f1ff3fd6c293d48dc434 100644 (file)
@@ -4,6 +4,7 @@ u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);
 
 extern unsigned scx200_gpio_base;
 extern long scx200_gpio_shadow[2];
+extern struct nsc_gpio_ops scx200_gpio_ops;
 
 #define scx200_gpio_present() (scx200_gpio_base!=0)
 
index 9f56fb8a4a6c358091915aa34e5fae8c045a585d..9b5fea81f55e4e96dfdca7fb83a3ecd0834c2137 100644 (file)
@@ -1595,6 +1595,7 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
 
 static inline int security_inode_alloc (struct inode *inode)
 {
+       inode->i_security = NULL;
        return security_ops->inode_alloc_security (inode);
 }
 
index c057f0b32318bdc40ea879086805e174db29c035..f3c51899117f5e83abb3a44c5b94ff11574df382 100644 (file)
@@ -19,6 +19,10 @@ struct shmem_inode_info {
        swp_entry_t             i_direct[SHMEM_NR_DIRECT]; /* first blocks */
        struct list_head        swaplist;       /* chain of maybes on swap */
        struct inode            vfs_inode;
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       struct posix_acl        *i_acl;
+       struct posix_acl        *i_default_acl;
+#endif
 };
 
 struct shmem_sb_info {
@@ -36,4 +40,24 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
        return container_of(inode, struct shmem_inode_info, vfs_inode);
 }
 
+#ifdef CONFIG_TMPFS_POSIX_ACL
+int shmem_permission(struct inode *, int, struct nameidata *);
+int shmem_acl_init(struct inode *, struct inode *);
+void shmem_acl_destroy_inode(struct inode *);
+
+extern struct xattr_handler shmem_xattr_acl_access_handler;
+extern struct xattr_handler shmem_xattr_acl_default_handler;
+
+extern struct generic_acl_operations shmem_acl_ops;
+
+#else
+static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
+{
+       return 0;
+}
+static inline void shmem_acl_destroy_inode(struct inode *inode)
+{
+}
+#endif  /* CONFIG_TMPFS_POSIX_ACL */
+
 #endif
index 31473db92d3b68f81663687a55ef9521a19ccdc8..b800d2d68b325d139af36320db55e7d9db1d26f1 100644 (file)
@@ -167,9 +167,9 @@ do {                                                                \
  * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
  * methods are defined as nops in the case they are not required.
  */
-#define spin_trylock(lock)             __cond_lock(_spin_trylock(lock))
-#define read_trylock(lock)             __cond_lock(_read_trylock(lock))
-#define write_trylock(lock)            __cond_lock(_write_trylock(lock))
+#define spin_trylock(lock)             __cond_lock(lock, _spin_trylock(lock))
+#define read_trylock(lock)             __cond_lock(lock, _read_trylock(lock))
+#define write_trylock(lock)            __cond_lock(lock, _write_trylock(lock))
 
 #define spin_lock(lock)                        _spin_lock(lock)
 
@@ -236,19 +236,19 @@ do {                                                              \
                                        _write_unlock_irqrestore(lock, flags)
 #define write_unlock_bh(lock)          _write_unlock_bh(lock)
 
-#define spin_trylock_bh(lock)          __cond_lock(_spin_trylock_bh(lock))
+#define spin_trylock_bh(lock)  __cond_lock(lock, _spin_trylock_bh(lock))
 
 #define spin_trylock_irq(lock) \
 ({ \
        local_irq_disable(); \
-       _spin_trylock(lock) ? \
+       spin_trylock(lock) ? \
        1 : ({ local_irq_enable(); 0;  }); \
 })
 
 #define spin_trylock_irqsave(lock, flags) \
 ({ \
        local_irq_save(flags); \
-       _spin_trylock(lock) ? \
+       spin_trylock(lock) ? \
        1 : ({ local_irq_restore(flags); 0; }); \
 })
 
@@ -264,7 +264,7 @@ do {                                                                \
  */
 extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
 #define atomic_dec_and_lock(atomic, lock) \
-               __cond_lock(_atomic_dec_and_lock(atomic, lock))
+               __cond_lock(lock, _atomic_dec_and_lock(atomic, lock))
 
 /**
  * spin_can_lock - would spin_trylock() succeed?
index b2c4f8299464e86558b2721823bd0723da5f1ea3..8828b8155e9c11db7abb99c8342b7ee66d8e6839 100644 (file)
@@ -19,41 +19,41 @@ int in_lock_functions(unsigned long addr);
 
 #define assert_spin_locked(x)  BUG_ON(!spin_is_locked(x))
 
-void __lockfunc _spin_lock(spinlock_t *lock)           __acquires(spinlock_t);
+void __lockfunc _spin_lock(spinlock_t *lock)           __acquires(lock);
 void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
-                                                       __acquires(spinlock_t);
-void __lockfunc _read_lock(rwlock_t *lock)             __acquires(rwlock_t);
-void __lockfunc _write_lock(rwlock_t *lock)            __acquires(rwlock_t);
-void __lockfunc _spin_lock_bh(spinlock_t *lock)                __acquires(spinlock_t);
-void __lockfunc _read_lock_bh(rwlock_t *lock)          __acquires(rwlock_t);
-void __lockfunc _write_lock_bh(rwlock_t *lock)         __acquires(rwlock_t);
-void __lockfunc _spin_lock_irq(spinlock_t *lock)       __acquires(spinlock_t);
-void __lockfunc _read_lock_irq(rwlock_t *lock)         __acquires(rwlock_t);
-void __lockfunc _write_lock_irq(rwlock_t *lock)                __acquires(rwlock_t);
+                                                       __acquires(lock);
+void __lockfunc _read_lock(rwlock_t *lock)             __acquires(lock);
+void __lockfunc _write_lock(rwlock_t *lock)            __acquires(lock);
+void __lockfunc _spin_lock_bh(spinlock_t *lock)                __acquires(lock);
+void __lockfunc _read_lock_bh(rwlock_t *lock)          __acquires(lock);
+void __lockfunc _write_lock_bh(rwlock_t *lock)         __acquires(lock);
+void __lockfunc _spin_lock_irq(spinlock_t *lock)       __acquires(lock);
+void __lockfunc _read_lock_irq(rwlock_t *lock)         __acquires(lock);
+void __lockfunc _write_lock_irq(rwlock_t *lock)                __acquires(lock);
 unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
-                                                       __acquires(spinlock_t);
+                                                       __acquires(lock);
 unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
-                                                       __acquires(rwlock_t);
+                                                       __acquires(lock);
 unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
-                                                       __acquires(rwlock_t);
+                                                       __acquires(lock);
 int __lockfunc _spin_trylock(spinlock_t *lock);
 int __lockfunc _read_trylock(rwlock_t *lock);
 int __lockfunc _write_trylock(rwlock_t *lock);
 int __lockfunc _spin_trylock_bh(spinlock_t *lock);
-void __lockfunc _spin_unlock(spinlock_t *lock)         __releases(spinlock_t);
-void __lockfunc _read_unlock(rwlock_t *lock)           __releases(rwlock_t);
-void __lockfunc _write_unlock(rwlock_t *lock)          __releases(rwlock_t);
-void __lockfunc _spin_unlock_bh(spinlock_t *lock)      __releases(spinlock_t);
-void __lockfunc _read_unlock_bh(rwlock_t *lock)                __releases(rwlock_t);
-void __lockfunc _write_unlock_bh(rwlock_t *lock)       __releases(rwlock_t);
-void __lockfunc _spin_unlock_irq(spinlock_t *lock)     __releases(spinlock_t);
-void __lockfunc _read_unlock_irq(rwlock_t *lock)       __releases(rwlock_t);
-void __lockfunc _write_unlock_irq(rwlock_t *lock)      __releases(rwlock_t);
+void __lockfunc _spin_unlock(spinlock_t *lock)         __releases(lock);
+void __lockfunc _read_unlock(rwlock_t *lock)           __releases(lock);
+void __lockfunc _write_unlock(rwlock_t *lock)          __releases(lock);
+void __lockfunc _spin_unlock_bh(spinlock_t *lock)      __releases(lock);
+void __lockfunc _read_unlock_bh(rwlock_t *lock)                __releases(lock);
+void __lockfunc _write_unlock_bh(rwlock_t *lock)       __releases(lock);
+void __lockfunc _spin_unlock_irq(spinlock_t *lock)     __releases(lock);
+void __lockfunc _read_unlock_irq(rwlock_t *lock)       __releases(lock);
+void __lockfunc _write_unlock_irq(rwlock_t *lock)      __releases(lock);
 void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
-                                                       __releases(spinlock_t);
+                                                       __releases(lock);
 void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
-                                                       __releases(rwlock_t);
+                                                       __releases(lock);
 void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
-                                                       __releases(rwlock_t);
+                                                       __releases(lock);
 
 #endif /* __LINUX_SPINLOCK_API_SMP_H */
index a6de332e57d456a6243cc4496aa1b3ddf8491d96..862c0d8c83817ce2288dd5cd79f5d46ed7557654 100644 (file)
@@ -109,13 +109,13 @@ struct rpc_credops {
        void                    (*crdestroy)(struct rpc_cred *);
 
        int                     (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
-       u32 *                   (*crmarshal)(struct rpc_task *, u32 *);
+       __be32 *                (*crmarshal)(struct rpc_task *, __be32 *);
        int                     (*crrefresh)(struct rpc_task *);
-       u32 *                   (*crvalidate)(struct rpc_task *, u32 *);
+       __be32 *                (*crvalidate)(struct rpc_task *, __be32 *);
        int                     (*crwrap_req)(struct rpc_task *, kxdrproc_t,
-                                               void *, u32 *, void *);
+                                               void *, __be32 *, void *);
        int                     (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
-                                               void *, u32 *, void *);
+                                               void *, __be32 *, void *);
 };
 
 extern struct rpc_authops      authunix_ops;
@@ -134,10 +134,10 @@ struct rpc_cred * rpcauth_bindcred(struct rpc_task *);
 void                   rpcauth_holdcred(struct rpc_task *);
 void                   put_rpccred(struct rpc_cred *);
 void                   rpcauth_unbindcred(struct rpc_task *);
-u32 *                  rpcauth_marshcred(struct rpc_task *, u32 *);
-u32 *                  rpcauth_checkverf(struct rpc_task *, u32 *);
-int                    rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj);
-int                    rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, u32 *data, void *obj);
+__be32 *               rpcauth_marshcred(struct rpc_task *, __be32 *);
+__be32 *               rpcauth_checkverf(struct rpc_task *, __be32 *);
+int                    rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
+int                    rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj);
 int                    rpcauth_refreshcred(struct rpc_task *);
 void                   rpcauth_invalcred(struct rpc_task *);
 int                    rpcauth_uptodatecred(struct rpc_task *);
index f43f237360ae62099997c803b440e2efece721b5..d9f5934ac9fedbbe789fe0da125ac89b979c13b7 100644 (file)
@@ -95,7 +95,7 @@ enum rpc_auth_stat {
  * 2GB.
  */
 
-typedef u32    rpc_fraghdr;
+typedef __be32 rpc_fraghdr;
 
 #define        RPC_LAST_STREAM_FRAGMENT        (1U << 31)
 #define        RPC_FRAGMENT_SIZE_MASK          (~RPC_LAST_STREAM_FRAGMENT)
index 7b27c09b56046e19bef6e499922f628bec5c0a6e..73140ee5c638ab631916ecf6fb697da58384693d 100644 (file)
@@ -78,28 +78,45 @@ struct svc_serv {
  */
 #define RPCSVC_MAXPAGES                ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
 
-static inline u32 svc_getu32(struct kvec *iov)
+static inline u32 svc_getnl(struct kvec *iov)
 {
-       u32 val, *vp;
+       __be32 val, *vp;
        vp = iov->iov_base;
        val = *vp++;
        iov->iov_base = (void*)vp;
-       iov->iov_len -= sizeof(u32);
+       iov->iov_len -= sizeof(__be32);
+       return ntohl(val);
+}
+
+static inline void svc_putnl(struct kvec *iov, u32 val)
+{
+       __be32 *vp = iov->iov_base + iov->iov_len;
+       *vp = htonl(val);
+       iov->iov_len += sizeof(__be32);
+}
+
+static inline __be32 svc_getu32(struct kvec *iov)
+{
+       __be32 val, *vp;
+       vp = iov->iov_base;
+       val = *vp++;
+       iov->iov_base = (void*)vp;
+       iov->iov_len -= sizeof(__be32);
        return val;
 }
 
 static inline void svc_ungetu32(struct kvec *iov)
 {
-       u32 *vp = (u32 *)iov->iov_base;
+       __be32 *vp = (__be32 *)iov->iov_base;
        iov->iov_base = (void *)(vp - 1);
        iov->iov_len += sizeof(*vp);
 }
 
-static inline void svc_putu32(struct kvec *iov, u32 val)
+static inline void svc_putu32(struct kvec *iov, __be32 val)
 {
-       u32 *vp = iov->iov_base + iov->iov_len;
+       __be32 *vp = iov->iov_base + iov->iov_len;
        *vp = val;
-       iov->iov_len += sizeof(u32);
+       iov->iov_len += sizeof(__be32);
 }
 
        
@@ -130,7 +147,7 @@ struct svc_rqst {
        short                   rq_arghi;       /* pages available in argument page list */
        short                   rq_resused;     /* pages used for result */
 
-       u32                     rq_xid;         /* transmission id */
+       __be32                  rq_xid;         /* transmission id */
        u32                     rq_prog;        /* program number */
        u32                     rq_vers;        /* program version */
        u32                     rq_proc;        /* procedure number */
@@ -139,7 +156,7 @@ struct svc_rqst {
                                rq_secure  : 1; /* secure port */
 
 
-       __u32                   rq_daddr;       /* dest addr of request - reply from here */
+       __be32                  rq_daddr;       /* dest addr of request - reply from here */
 
        void *                  rq_argp;        /* decoded arguments */
        void *                  rq_resp;        /* xdr'd results */
@@ -169,7 +186,7 @@ struct svc_rqst {
  * Check buffer bounds after decoding arguments
  */
 static inline int
-xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
+xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
 {
        char *cp = (char *)p;
        struct kvec *vec = &rqstp->rq_arg.head[0];
@@ -178,7 +195,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
 }
 
 static inline int
-xdr_ressize_check(struct svc_rqst *rqstp, u32 *p)
+xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
 {
        struct kvec *vec = &rqstp->rq_res.head[0];
        char *cp = (char*)p;
@@ -249,10 +266,10 @@ struct svc_deferred_req {
        u32                     prot;   /* protocol (UDP or TCP) */
        struct sockaddr_in      addr;
        struct svc_sock         *svsk;  /* where reply must go */
-       u32                     daddr;  /* where reply must come from */
+       __be32                  daddr;  /* where reply must come from */
        struct cache_deferred_req handle;
        int                     argslen;
-       u32                     args[0];
+       __be32                  args[0];
 };
 
 /*
@@ -284,7 +301,7 @@ struct svc_version {
         * A return value of 0 means drop the request. 
         * vs_dispatch == NULL means use default dispatcher.
         */
-       int                     (*vs_dispatch)(struct svc_rqst *, u32 *);
+       int                     (*vs_dispatch)(struct svc_rqst *, __be32 *);
 };
 
 /*
index 2fe2087edd665130d75dac0836c5763e853bccf6..a6601650deeb4ef4131a319e4757bcadb313e0b1 100644 (file)
@@ -95,7 +95,7 @@ struct auth_ops {
        char *  name;
        struct module *owner;
        int     flavour;
-       int     (*accept)(struct svc_rqst *rq, u32 *authp);
+       int     (*accept)(struct svc_rqst *rq, __be32 *authp);
        int     (*release)(struct svc_rqst *rq);
        void    (*domain_release)(struct auth_domain *);
        int     (*set_client)(struct svc_rqst *rq);
@@ -112,7 +112,7 @@ struct auth_ops {
 #define        SVC_COMPLETE    9
 
 
-extern int     svc_authenticate(struct svc_rqst *rqstp, u32 *authp);
+extern int     svc_authenticate(struct svc_rqst *rqstp, __be32 *authp);
 extern int     svc_authorise(struct svc_rqst *rqstp);
 extern int     svc_set_client(struct svc_rqst *rqstp);
 extern int     svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops);
index e6d3d349506c6409f0a65e38a89c01723ee1c3ff..953723b09bc6d73cd5ad97bd0143bdf1fbd162f9 100644 (file)
@@ -32,7 +32,7 @@ struct xdr_netobj {
  * side) or svc_rqst pointer (server side).
  * Encode functions always assume there's enough room in the buffer.
  */
-typedef int    (*kxdrproc_t)(void *rqstp, u32 *data, void *obj);
+typedef int    (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
 
 /*
  * Basic structure for transmission/reception of a client XDR message.
@@ -88,19 +88,19 @@ struct xdr_buf {
 /*
  * Miscellaneous XDR helper functions
  */
-u32 *  xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len);
-u32 *  xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len);
-u32 *  xdr_encode_string(u32 *p, const char *s);
-u32 *  xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);
-u32 *  xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
-u32 *  xdr_decode_netobj(u32 *p, struct xdr_netobj *);
+__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
+__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
+__be32 *xdr_encode_string(__be32 *p, const char *s);
+__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen);
+__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
+__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
 
 void   xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int,
                         unsigned int);
 void   xdr_inline_pages(struct xdr_buf *, unsigned int,
                         struct page **, unsigned int, unsigned int);
 
-static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len)
+static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int len)
 {
        return xdr_encode_opaque(p, s, len);
 }
@@ -108,16 +108,16 @@ static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len)
 /*
  * Decode 64bit quantities (NFSv3 support)
  */
-static inline u32 *
-xdr_encode_hyper(u32 *p, __u64 val)
+static inline __be32 *
+xdr_encode_hyper(__be32 *p, __u64 val)
 {
        *p++ = htonl(val >> 32);
        *p++ = htonl(val & 0xFFFFFFFF);
        return p;
 }
 
-static inline u32 *
-xdr_decode_hyper(u32 *p, __u64 *valp)
+static inline __be32 *
+xdr_decode_hyper(__be32 *p, __u64 *valp)
 {
        *valp  = ((__u64) ntohl(*p++)) << 32;
        *valp |= ntohl(*p++);
@@ -128,7 +128,7 @@ xdr_decode_hyper(u32 *p, __u64 *valp)
  * Adjust kvec to reflect end of xdr'ed data (RPC client XDR)
  */
 static inline int
-xdr_adjust_iovec(struct kvec *iov, u32 *p)
+xdr_adjust_iovec(struct kvec *iov, __be32 *p)
 {
        return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);
 }
@@ -180,19 +180,19 @@ extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
  * Provide some simple tools for XDR buffer overflow-checking etc.
  */
 struct xdr_stream {
-       uint32_t *p;            /* start of available buffer */
+       __be32 *p;              /* start of available buffer */
        struct xdr_buf *buf;    /* XDR buffer to read/write */
 
-       uint32_t *end;          /* end of available buffer space */
+       __be32 *end;            /* end of available buffer space */
        struct kvec *iov;       /* pointer to the current kvec */
 };
 
-extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p);
-extern uint32_t *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
+extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
+extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
 extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
                unsigned int base, unsigned int len);
-extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p);
-extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
+extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
+extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
 extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
 extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
 
index bdeba8538c719892407c0f112e809bb166cc179c..6cf6265807529842e10b3b0553bb8d401d17e84a 100644 (file)
@@ -79,7 +79,7 @@ struct rpc_rqst {
         * This is the private part
         */
        struct rpc_task *       rq_task;        /* RPC task data */
-       __u32                   rq_xid;         /* request XID */
+       __be32                  rq_xid;         /* request XID */
        int                     rq_cong;        /* has incremented xprt->cong */
        int                     rq_received;    /* receive completed */
        u32                     rq_seqno;       /* gss seq no. used on req. */
@@ -171,9 +171,9 @@ struct rpc_xprt {
        /*
         * State of TCP reply receive stuff
         */
-       u32                     tcp_recm,       /* Fragment header */
-                               tcp_xid,        /* Current XID */
-                               tcp_reclen,     /* fragment length */
+       __be32                  tcp_recm,       /* Fragment header */
+                               tcp_xid;        /* Current XID */
+       u32                     tcp_reclen,     /* fragment length */
                                tcp_offset;     /* fragment offset */
        unsigned long           tcp_copied,     /* copied to request */
                                tcp_flags;
@@ -253,7 +253,7 @@ void                        xprt_release(struct rpc_task *task);
 struct rpc_xprt *      xprt_get(struct rpc_xprt *xprt);
 void                   xprt_put(struct rpc_xprt *xprt);
 
-static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p)
+static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
 {
        return p + xprt->tsh_size;
 }
@@ -268,7 +268,7 @@ void                        xprt_wait_for_buffer_space(struct rpc_task *task);
 void                   xprt_write_space(struct rpc_xprt *xprt);
 void                   xprt_update_rtt(struct rpc_task *task);
 void                   xprt_adjust_cwnd(struct rpc_task *task, int result);
-struct rpc_rqst *      xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid);
+struct rpc_rqst *      xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
 void                   xprt_complete_rqst(struct rpc_task *task, int copied);
 void                   xprt_release_rqst_cong(struct rpc_task *task);
 void                   xprt_disconnect(struct rpc_xprt *xprt);
index 3f0f716225ecd714d1c21fac4076e6ef6fbbce12..2d1c3d5c83acc150d9838c881d4d22d79509fc4b 100644 (file)
@@ -597,6 +597,6 @@ asmlinkage long sys_get_robust_list(int pid,
                                    size_t __user *len_ptr);
 asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
                                    size_t len);
-asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *cache);
+asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
 
 #endif
index 8ebf497907f8ec8cb8e014b8ff2f5f840261a3f5..0e058a2d1c6d72a62ddcef1e733830bff6323269 100644 (file)
 #include <asm/byteorder.h>
 
 struct tcphdr {
-       __u16   source;
-       __u16   dest;
-       __u32   seq;
-       __u32   ack_seq;
+       __be16  source;
+       __be16  dest;
+       __be32  seq;
+       __be32  ack_seq;
 #if defined(__LITTLE_ENDIAN_BITFIELD)
        __u16   res1:4,
                doff:4,
@@ -50,9 +50,9 @@ struct tcphdr {
 #else
 #error "Adjust your <asm/byteorder.h> defines"
 #endif 
-       __u16   window;
-       __u16   check;
-       __u16   urg_ptr;
+       __be16  window;
+       __be16  check;
+       __be16  urg_ptr;
 };
 
 /*
@@ -62,7 +62,7 @@ struct tcphdr {
  */
 union tcp_word_hdr { 
        struct tcphdr hdr;
-       __u32             words[5];
+       __be32            words[5];
 }; 
 
 #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 
@@ -166,6 +166,11 @@ struct tcp_info
 #include <net/inet_timewait_sock.h>
 
 /* This defines a selective acknowledgement block. */
+struct tcp_sack_block_wire {
+       __be32  start_seq;
+       __be32  end_seq;
+};
+
 struct tcp_sack_block {
        __u32   start_seq;
        __u32   end_seq;
@@ -211,7 +216,7 @@ struct tcp_sock {
  *     Header prediction flags
  *     0x5?10 << 16 + snd_wnd in net byte order
  */
-       __u32   pred_flags;
+       __be32  pred_flags;
 
 /*
  *     RFC793 variables by their proper names. This means you can
index 99e02ef54c47db8fa1e9ceff2644acb9c2b98b38..bfc84a7aecc5288a762b8d0d5303f2ba17f34d42 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/if_tr.h>
 
 #ifdef __KERNEL__
-extern unsigned short  tr_type_trans(struct sk_buff *skb, struct net_device *dev);
+extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
 extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
 extern struct net_device *alloc_trdev(int sizeof_priv);
 
index 04827ca65781c0a47177a656eece88906ff9069d..ea4c2605f8da8836128fd2e2f4fe7e712d536ee5 100644 (file)
@@ -174,7 +174,7 @@ struct tty_struct {
        struct tty_driver *driver;
        int index;
        struct tty_ldisc ldisc;
-       struct semaphore termios_sem;
+       struct mutex termios_mutex;
        struct termios *termios, *termios_locked;
        char name[64];
        int pgrp;
@@ -190,7 +190,6 @@ struct tty_struct {
        struct tty_struct *link;
        struct fasync_struct *fasync;
        struct tty_bufhead buf;
-       int max_flip_cnt;
        int alt_speed;          /* For magic substitution of 38400 bps */
        wait_queue_head_t write_wait;
        wait_queue_head_t read_wait;
index 90223f057d507bd86edf2c8e30333319773e8f23..014b41d1e308ca27f01e7f94bf46d906dc97252d 100644 (file)
 #include <linux/types.h>
 
 struct udphdr {
-       __u16   source;
-       __u16   dest;
-       __u16   len;
-       __u16   check;
+       __be16  source;
+       __be16  dest;
+       __be16  len;
+       __be16  check;
 };
 
 /* UDP socket options */
index 176c7f797339b2aa5d4bca59157b7181bcc5bd97..c89df55f6e035df2ef064726c870911506c7debc 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <linux/types.h>
 #include <linux/percpu.h>
-#include <linux/config.h>
 #include <linux/mmzone.h>
 #include <asm/atomic.h>
 
index 918a29763aea3e0afb58cb78d62db873bad16169..1009d3fe1fc214e8eb920e207483ebdd7d35f1b3 100644 (file)
@@ -33,7 +33,8 @@ extern int fg_console, last_console, want_console;
 int vc_allocate(unsigned int console);
 int vc_cons_allocated(unsigned int console);
 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
-void vc_disallocate(unsigned int console);
+int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
+void vc_deallocate(unsigned int console);
 void reset_palette(struct vc_data *vc);
 void do_blank_screen(int entering_gfx);
 void do_unblank_screen(int leaving_gfx);
index 56a23a0e7f2eb218a91fd889fb86bbdb3471bcef..9d4074ecd0cdc95248fb42dd4dde5b421f152518 100644 (file)
@@ -117,6 +117,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
 int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
                           loff_t pos, loff_t count);
 void set_page_dirty_balance(struct page *page);
+void writeback_set_ratelimit(void);
 
 /* pdflush.c */
 extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
index 14ecd19f4cdc5a7298691951d83c28f8f1ce55a4..430afd05826975e4df9a65afe68e5b9729c1b11c 100644 (file)
@@ -12,8 +12,8 @@
  */
 typedef union
 {
-       __u32           a4;
-       __u32           a6[4];
+       __be32          a4;
+       __be32          a6[4];
 } xfrm_address_t;
 
 /* Ident of a specific xfrm_state. It is used on input to lookup
@@ -23,7 +23,7 @@ typedef union
 struct xfrm_id
 {
        xfrm_address_t  daddr;
-       __u32           spi;
+       __be32          spi;
        __u8            proto;
 };
 
@@ -49,10 +49,10 @@ struct xfrm_selector
 {
        xfrm_address_t  daddr;
        xfrm_address_t  saddr;
-       __u16   dport;
-       __u16   dport_mask;
-       __u16   sport;
-       __u16   sport_mask;
+       __be16  dport;
+       __be16  dport_mask;
+       __be16  sport;
+       __be16  sport_mask;
        __u16   family;
        __u8    prefixlen_d;
        __u8    prefixlen_s;
@@ -281,7 +281,7 @@ struct xfrm_usersa_info {
 
 struct xfrm_usersa_id {
        xfrm_address_t                  daddr;
-       __u32                           spi;
+       __be32                          spi;
        __u16                           family;
        __u8                            proto;
 };
index 643bded9f557b5556ea159515b7915cf9016484d..6a3d9a7d302b1494f36e38ecfdf1415d3d24d1e3 100644 (file)
@@ -12,15 +12,15 @@ extern struct neigh_table arp_tbl;
 extern void    arp_init(void);
 extern int     arp_find(unsigned char *haddr, struct sk_buff *skb);
 extern int     arp_ioctl(unsigned int cmd, void __user *arg);
-extern void     arp_send(int type, int ptype, u32 dest_ip, 
-                        struct net_device *dev, u32 src_ip, 
+extern void     arp_send(int type, int ptype, __be32 dest_ip,
+                        struct net_device *dev, __be32 src_ip,
                         unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
 extern int     arp_bind_neighbour(struct dst_entry *dst);
 extern int     arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir);
 extern void    arp_ifdown(struct net_device *dev);
 
-extern struct sk_buff *arp_create(int type, int ptype, u32 dest_ip,
-                                 struct net_device *dev, u32 src_ip,
+extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
+                                 struct net_device *dev, __be32 src_ip,
                                  unsigned char *dest_hw, unsigned char *src_hw,
                                  unsigned char *target_hw);
 extern void arp_xmit(struct sk_buff *skb);
index b2bdb1aa04291c7104113ef93532dcb26c166a44..10a3eec191fd2bf6110fbd0b4dadaa6fbdf2af8a 100644 (file)
 #define HCI_NOTIFY_VOICE_SETTING       3
 
 /* HCI device types */
-#define HCI_VHCI       0
+#define HCI_VIRTUAL    0
 #define HCI_USB                1
 #define HCI_PCCARD     2
 #define HCI_UART       3
 #define HCI_RS232      4
 #define HCI_PCI                5
+#define HCI_SDIO       6
 
 /* HCI device quirks */
 enum {
@@ -296,6 +297,7 @@ struct hci_cp_host_buffer_size {
 
 /* Link Control */
 #define OGF_LINK_CTL   0x01 
+
 #define OCF_CREATE_CONN                0x0005
 struct hci_cp_create_conn {
        bdaddr_t bdaddr;
@@ -306,6 +308,11 @@ struct hci_cp_create_conn {
        __u8     role_switch;
 } __attribute__ ((packed));
 
+#define OCF_CREATE_CONN_CANCEL 0x0008
+struct hci_cp_create_conn_cancel {
+       bdaddr_t bdaddr;
+} __attribute__ ((packed));
+
 #define OCF_ACCEPT_CONN_REQ    0x0009
 struct hci_cp_accept_conn_req {
        bdaddr_t bdaddr;
@@ -339,6 +346,8 @@ struct hci_cp_inquiry {
 
 #define OCF_INQUIRY_CANCEL     0x0002
 
+#define OCF_EXIT_PERIODIC_INQ  0x0004
+
 #define OCF_LINK_KEY_REPLY     0x000B
 struct hci_cp_link_key_reply {
        bdaddr_t bdaddr;
index d84855fe7336d24938e0aed2055aaf316818cefe..df22efcfcc0b7deceb77ee1094a05d24f00c22d2 100644 (file)
@@ -72,6 +72,9 @@ struct hci_dev {
        __u8            type;
        bdaddr_t        bdaddr;
        __u8            features[8];
+       __u8            hci_ver;
+       __u16           hci_rev;
+       __u16           manufacturer;
        __u16           voice_setting;
 
        __u16           pkt_type;
@@ -165,6 +168,10 @@ struct hci_conn {
        struct timer_list disc_timer;
        struct timer_list idle_timer;
 
+       struct work_struct work;
+
+       struct device   dev;
+
        struct hci_dev  *hdev;
        void            *l2cap_data;
        void            *sco_data;
@@ -309,10 +316,13 @@ static inline void hci_conn_put(struct hci_conn *conn)
        if (atomic_dec_and_test(&conn->refcnt)) {
                unsigned long timeo;
                if (conn->type == ACL_LINK) {
-                       timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
-                       if (!conn->out)
-                               timeo *= 2;
                        del_timer(&conn->idle_timer);
+                       if (conn->state == BT_CONNECTED) {
+                               timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
+                               if (!conn->out)
+                                       timeo *= 2;
+                       } else
+                               timeo = msecs_to_jiffies(10);
                } else
                        timeo = msecs_to_jiffies(10);
                mod_timer(&conn->disc_timer, jiffies + timeo);
@@ -412,6 +422,8 @@ static inline int hci_recv_frame(struct sk_buff *skb)
 
 int hci_register_sysfs(struct hci_dev *hdev);
 void hci_unregister_sysfs(struct hci_dev *hdev);
+void hci_conn_add_sysfs(struct hci_conn *conn);
+void hci_conn_del_sysfs(struct hci_conn *conn);
 
 #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
 
index 2d72496c20294a4890d414415167d5c1455ecb3a..5d6ae1b2b196b69e4ceb34421df355cbb4eb47cb 100644 (file)
@@ -128,7 +128,9 @@ extern int cipso_v4_rbm_strictvalid;
 
 #ifdef CONFIG_NETLABEL
 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
-int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head));
+int cipso_v4_doi_remove(u32 doi,
+                       u32 audit_secid,
+                       void (*callback) (struct rcu_head * head));
 struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
 int cipso_v4_doi_walk(u32 *skip_cnt,
                     int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
@@ -143,6 +145,7 @@ static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
 }
 
 static inline int cipso_v4_doi_remove(u32 doi,
+                                   u32 audit_secid,
                                    void (*callback) (struct rcu_head * head))
 {
        return 0;
index a8d825f90305a751447c207d140853c9bf79c523..e156e38e4ac37db61db754822e59877299e2f9a0 100644 (file)
@@ -84,7 +84,7 @@ struct dst_entry
 struct dst_ops
 {
        unsigned short          family;
-       unsigned short          protocol;
+       __be16                  protocol;
        unsigned                gc_thresh;
 
        int                     (*gc)(void);
index 3ca210ec1379f549e0e2f0d4e3fd821283b70709..ddf5f3ca1720154be67aca197f628f1e7a83fd08 100644 (file)
@@ -16,8 +16,8 @@ struct flowi {
 
        union {
                struct {
-                       __u32                   daddr;
-                       __u32                   saddr;
+                       __be32                  daddr;
+                       __be32                  saddr;
                        __u32                   fwmark;
                        __u8                    tos;
                        __u8                    scope;
@@ -56,8 +56,8 @@ struct flowi {
 #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01
        union {
                struct {
-                       __u16   sport;
-                       __u16   dport;
+                       __be16  sport;
+                       __be16  dport;
                } ports;
 
                struct {
@@ -73,7 +73,7 @@ struct flowi {
                        __u8    objname[16]; /* Not zero terminated */
                } dnports;
 
-               __u32           spi;
+               __be32          spi;
 
 #ifdef CONFIG_IPV6_MIP6
                struct {
index 05f8ff7d9316fe9d881aec2c0238d44221b14b16..dc09474efcf38e2cb02329a4ef0bf2fd8633bf7f 100644 (file)
@@ -38,7 +38,7 @@ struct dst_entry;
 struct net_proto_family;
 struct sk_buff;
 
-extern void    icmp_send(struct sk_buff *skb_in,  int type, int code, u32 info);
+extern void    icmp_send(struct sk_buff *skb_in,  int type, int code, __be32 info);
 extern int     icmp_rcv(struct sk_buff *skb);
 extern int     icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 extern void    icmp_init(struct net_proto_family *ops);
index de4e83b6da4be2024ec04b1cb5fd53139adbc88e..0bcf9f237e1f0de8fc44bac445c290a9078e041a 100644 (file)
@@ -238,9 +238,9 @@ extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
 
 extern struct request_sock *inet_csk_search_req(const struct sock *sk,
                                                struct request_sock ***prevp,
-                                               const __u16 rport,
-                                               const __u32 raddr,
-                                               const __u32 laddr);
+                                               const __be16 rport,
+                                               const __be32 raddr,
+                                               const __be32 laddr);
 extern int inet_csk_bind_conflict(const struct sock *sk,
                                  const struct inet_bind_bucket *tb);
 extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
index b4491c9e2a5a028177913e4f21b45401346e5421..a9eb2eaf094eaf1e9d54c61f070359118309aac8 100644 (file)
@@ -272,42 +272,56 @@ static inline int inet_iif(const struct sk_buff *skb)
 }
 
 extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
-                                          const u32 daddr,
+                                          const __be32 daddr,
                                           const unsigned short hnum,
                                           const int dif);
 
 static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
-                                               u32 daddr, u16 dport, int dif)
+                                               __be32 daddr, __be16 dport, int dif)
 {
        return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif);
 }
 
 /* Socket demux engine toys. */
+/* What happens here is ugly; there's a pair of adjacent fields in
+   struct inet_sock; __be16 dport followed by __u16 num.  We want to
+   search by pair, so we combine the keys into a single 32bit value
+   and compare with 32bit value read from &...->dport.  Let's at least
+   make sure that it's not mixed with anything else...
+   On 64bit targets we combine comparisons with pair of adjacent __be32
+   fields in the same way.
+*/
+typedef __u32 __bitwise __portpair;
 #ifdef __BIG_ENDIAN
 #define INET_COMBINED_PORTS(__sport, __dport) \
-       (((__u32)(__sport) << 16) | (__u32)(__dport))
+       ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
 #else /* __LITTLE_ENDIAN */
 #define INET_COMBINED_PORTS(__sport, __dport) \
-       (((__u32)(__dport) << 16) | (__u32)(__sport))
+       ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport)))
 #endif
 
 #if (BITS_PER_LONG == 64)
+typedef __u64 __bitwise __addrpair;
 #ifdef __BIG_ENDIAN
 #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
-       const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr));
+       const __addrpair __name = (__force __addrpair) ( \
+                                  (((__force __u64)(__be32)(__saddr)) << 32) | \
+                                  ((__force __u64)(__be32)(__daddr)));
 #else /* __LITTLE_ENDIAN */
 #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
-       const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr));
+       const __addrpair __name = (__force __addrpair) ( \
+                                  (((__force __u64)(__be32)(__daddr)) << 32) | \
+                                  ((__force __u64)(__be32)(__saddr)));
 #endif /* __BIG_ENDIAN */
 #define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
        (((__sk)->sk_hash == (__hash))                          &&      \
-        ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie))  &&      \
-        ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports))   &&      \
+        ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie))     &&      \
+        ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))      &&      \
         (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
 #define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
        (((__sk)->sk_hash == (__hash))                          &&      \
-        ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) &&  \
-        ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&   \
+        ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) &&     \
+        ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&      \
         (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
 #else /* 32-bit arch */
 #define INET_ADDR_COOKIE(__name, __saddr, __daddr)
@@ -315,13 +329,13 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
        (((__sk)->sk_hash == (__hash))                          &&      \
         (inet_sk(__sk)->daddr          == (__saddr))           &&      \
         (inet_sk(__sk)->rcv_saddr      == (__daddr))           &&      \
-        ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports))   &&      \
+        ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))      &&      \
         (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
 #define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
        (((__sk)->sk_hash == (__hash))                          &&      \
         (inet_twsk(__sk)->tw_daddr     == (__saddr))           &&      \
         (inet_twsk(__sk)->tw_rcv_saddr == (__daddr))           &&      \
-        ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&   \
+        ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&      \
         (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
 #endif /* 64-bit arch */
 
@@ -333,12 +347,12 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
  */
 static inline struct sock *
        __inet_lookup_established(struct inet_hashinfo *hashinfo,
-                                 const u32 saddr, const u16 sport,
-                                 const u32 daddr, const u16 hnum,
+                                 const __be32 saddr, const __be16 sport,
+                                 const __be32 daddr, const u16 hnum,
                                  const int dif)
 {
        INET_ADDR_COOKIE(acookie, saddr, daddr)
-       const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
+       const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
        struct sock *sk;
        const struct hlist_node *node;
        /* Optimize here for direct hit, only listening connections can
@@ -370,8 +384,8 @@ hit:
 
 static inline struct sock *
        inet_lookup_established(struct inet_hashinfo *hashinfo,
-                               const u32 saddr, const u16 sport,
-                               const u32 daddr, const u16 dport,
+                               const __be32 saddr, const __be16 sport,
+                               const __be32 daddr, const __be16 dport,
                                const int dif)
 {
        return __inet_lookup_established(hashinfo, saddr, sport, daddr,
@@ -379,8 +393,8 @@ static inline struct sock *
 }
 
 static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
-                                        const u32 saddr, const u16 sport,
-                                        const u32 daddr, const u16 dport,
+                                        const __be32 saddr, const __be16 sport,
+                                        const __be32 daddr, const __be16 dport,
                                         const int dif)
 {
        u16 hnum = ntohs(dport);
@@ -390,8 +404,8 @@ static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
 }
 
 static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
-                                      const u32 saddr, const u16 sport,
-                                      const u32 daddr, const u16 dport,
+                                      const __be32 saddr, const __be16 sport,
+                                      const __be32 daddr, const __be16 dport,
                                       const int dif)
 {
        struct sock *sk;
index f6242710f2ffe208906cdb9b5857dbc3ace00eaa..ce6da97bc8489d4fc1e5d8838f0dd3541a78cfc5 100644 (file)
@@ -36,7 +36,7 @@
  * @ts_needaddr - Need to record addr of outgoing dev
  */
 struct ip_options {
-       __u32           faddr;
+       __be32          faddr;
        unsigned char   optlen;
        unsigned char   srr;
        unsigned char   rr;
@@ -62,9 +62,9 @@ struct inet_request_sock {
        u16                     inet6_rsk_offset;
        /* 2 bytes hole, try to pack */
 #endif
-       u32                     loc_addr;
-       u32                     rmt_addr;
-       u16                     rmt_port;
+       __be32                  loc_addr;
+       __be32                  rmt_addr;
+       __be16                  rmt_port;
        u16                     snd_wscale : 4, 
                                rcv_wscale : 4, 
                                tstamp_ok  : 1,
@@ -110,15 +110,15 @@ struct inet_sock {
        struct ipv6_pinfo       *pinet6;
 #endif
        /* Socket demultiplex comparisons on incoming packets. */
-       __u32                   daddr;
-       __u32                   rcv_saddr;
-       __u16                   dport;
+       __be32                  daddr;
+       __be32                  rcv_saddr;
+       __be16                  dport;
        __u16                   num;
-       __u32                   saddr;
+       __be32                  saddr;
        __s16                   uc_ttl;
        __u16                   cmsg_flags;
        struct ip_options       *opt;
-       __u16                   sport;
+       __be16                  sport;
        __u16                   id;
        __u8                    tos;
        __u8                    mc_ttl;
@@ -129,7 +129,7 @@ struct inet_sock {
                                hdrincl:1,
                                mc_loop:1;
        int                     mc_index;
-       __u32                   mc_addr;
+       __be32                  mc_addr;
        struct ip_mc_socklist   *mc_list;
        struct {
                unsigned int            flags;
@@ -137,7 +137,7 @@ struct inet_sock {
                struct ip_options       *opt;
                struct rtable           *rt;
                int                     length; /* Total length of all frames */
-               u32                     addr;
+               __be32                  addr;
                struct flowi            fl;
        } cork;
 };
@@ -167,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
 
 extern int inet_sk_rebuild_header(struct sock *sk);
 
-static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
-                                       const __u32 faddr, const __u16 fport)
+static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
+                                       const __be32 faddr, const __be16 fport)
 {
-       unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
+       unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport);
        h ^= h >> 16;
        h ^= h >> 8;
        return h;
@@ -179,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
 static inline int inet_sk_ehashfn(const struct sock *sk)
 {
        const struct inet_sock *inet = inet_sk(sk);
-       const __u32 laddr = inet->rcv_saddr;
+       const __be32 laddr = inet->rcv_saddr;
        const __u16 lport = inet->num;
-       const __u32 faddr = inet->daddr;
-       const __u16 fport = inet->dport;
+       const __be32 faddr = inet->daddr;
+       const __be16 fport = inet->dport;
 
        return inet_ehashfn(laddr, lport, faddr, fport);
 }
index 600cb543550d8b4f13c7b991b5d8dc308ba144fd..6d14c22a00c5e3e9ab750fb0c68434edba86c853 100644 (file)
@@ -120,10 +120,10 @@ struct inet_timewait_sock {
        unsigned char           tw_rcv_wscale;
        /* Socket demultiplex comparisons on incoming packets. */
        /* these five are in inet_sock */
-       __u16                   tw_sport;
-       __u32                   tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES)));
-       __u32                   tw_rcv_saddr;
-       __u16                   tw_dport;
+       __be16                  tw_sport;
+       __be32                  tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES)));
+       __be32                  tw_rcv_saddr;
+       __be16                  tw_dport;
        __u16                   tw_num;
        /* And these are ours. */
        __u8                    tw_ipv6only:1;
@@ -186,7 +186,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
        return (struct inet_timewait_sock *)sk;
 }
 
-static inline u32 inet_rcv_saddr(const struct sock *sk)
+static inline __be32 inet_rcv_saddr(const struct sock *sk)
 {
        return likely(sk->sk_state != TCP_TIME_WAIT) ?
                inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
index 0965515f40cfabba4e3839007ca51ebac6d22113..925573fd2aed04a91e41c0de1b84bf09f68e06c5 100644 (file)
@@ -22,7 +22,7 @@ struct inet_peer
        unsigned long           dtime;          /* the time of last use of not
                                                 * referenced entries */
        atomic_t                refcnt;
-       __u32                   v4daddr;        /* peer's address */
+       __be32                  v4daddr;        /* peer's address */
        __u16                   avl_height;
        __u16                   ip_id_count;    /* IP ID for the next packet */
        atomic_t                rid;            /* Frag reception counter */
@@ -33,7 +33,7 @@ struct inet_peer
 void                   inet_initpeers(void) __init;
 
 /* can be called with or without local BH being disabled */
-struct inet_peer       *inet_getpeer(__u32 daddr, int create);
+struct inet_peer       *inet_getpeer(__be32 daddr, int create);
 
 extern spinlock_t inet_peer_unused_lock;
 extern struct inet_peer **inet_peer_unused_tailp;
index 98f90840077186243bf910db40452ba7cfa881d9..b6d95e5534016c3a3440525bc4ec00d196fcaeb4 100644 (file)
@@ -45,7 +45,7 @@ struct inet_skb_parm
 
 struct ipcm_cookie
 {
-       u32                     addr;
+       __be32                  addr;
        int                     oif;
        struct ip_options       *opt;
 };
@@ -86,7 +86,7 @@ extern int            igmp_mc_proc_init(void);
  */
 
 extern int             ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
-                                             u32 saddr, u32 daddr,
+                                             __be32 saddr, __be32 daddr,
                                              struct ip_options *opt);
 extern int             ip_rcv(struct sk_buff *skb, struct net_device *dev,
                               struct packet_type *pt, struct net_device *orig_dev);
@@ -335,7 +335,7 @@ extern int ip_net_unreachable(struct sk_buff *skb);
  *     Functions provided by ip_options.c
  */
  
-extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, struct rtable *rt, int is_frag);
+extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag);
 extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
 extern void ip_options_fragment(struct sk_buff *skb);
 extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb);
@@ -363,8 +363,8 @@ extern int  ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(s
 
 extern int     ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
 extern void    ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 
-                             u16 port, u32 info, u8 *payload);
-extern void    ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport,
+                             __be16 port, u32 info, u8 *payload);
+extern void    ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
                               u32 info);
 
 /* sysctl helpers - any sysctl which holds a value that ends up being
index fcc159a4ac17f5fd2c9687abf43f6649079fdc1e..82229146bac7f127156050880edc5c150f0de882 100644 (file)
@@ -30,13 +30,13 @@ struct fib_config {
        u8                      fc_type;
        /* 1 byte unused */
        u32                     fc_table;
-       u32                     fc_dst;
-       u32                     fc_src;
-       u32                     fc_gw;
+       __be32                  fc_dst;
+       __be32                  fc_src;
+       __be32                  fc_gw;
        int                     fc_oif;
        u32                     fc_flags;
        u32                     fc_priority;
-       u32                     fc_prefsrc;
+       __be32                  fc_prefsrc;
        struct nlattr           *fc_mx;
        struct rtnexthop        *fc_mp;
        int                     fc_mx_len;
@@ -63,7 +63,7 @@ struct fib_nh {
        __u32                   nh_tclassid;
 #endif
        int                     nh_oif;
-       u32                     nh_gw;
+       __be32                  nh_gw;
 };
 
 /*
@@ -78,7 +78,7 @@ struct fib_info {
        int                     fib_dead;
        unsigned                fib_flags;
        int                     fib_protocol;
-       u32                     fib_prefsrc;
+       __be32                  fib_prefsrc;
        u32                     fib_priority;
        u32                     fib_metrics[RTAX_MAX];
 #define fib_mtu fib_metrics[RTAX_MTU-1]
@@ -107,8 +107,8 @@ struct fib_result {
        unsigned char   type;
        unsigned char   scope;
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
-       __u32           network;
-       __u32           netmask;
+       __be32          network;
+       __be32          netmask;
 #endif
        struct fib_info *fi;
 #ifdef CONFIG_IP_MULTIPLE_TABLES
@@ -117,7 +117,7 @@ struct fib_result {
 };
 
 struct fib_result_nl {
-       u32             fl_addr;   /* To be looked up*/ 
+       __be32          fl_addr;   /* To be looked up*/
        u32             fl_fwmark; 
        unsigned char   fl_tos;
        unsigned char   fl_scope;
@@ -222,17 +222,17 @@ extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
 extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
 extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
 extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
-extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
-                              struct net_device *dev, u32 *spec_dst, u32 *itag);
+extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
+                              struct net_device *dev, __be32 *spec_dst, u32 *itag);
 extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
 
 struct rtentry;
 
 /* Exported by fib_semantics.c */
-extern int ip_fib_check_default(u32 gw, struct net_device *dev);
-extern int fib_sync_down(u32 local, struct net_device *dev, int force);
+extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
+extern int fib_sync_down(__be32 local, struct net_device *dev, int force);
 extern int fib_sync_up(struct net_device *dev);
-extern u32  __fib_res_prefsrc(struct fib_result *res);
+extern __be32  __fib_res_prefsrc(struct fib_result *res);
 
 /* Exported by fib_hash.c */
 extern struct fib_table *fib_hash_init(u32 id);
index ac747b64734c56a9c83054cf5af20e81ed6e19d2..beffdd66ad74f81ac2c5a9d40003ff4ad372102f 100644 (file)
@@ -17,7 +17,7 @@ struct ip_mp_alg_ops {
        void    (*mp_alg_select_route)(const struct flowi *flp,
                                       struct rtable *rth, struct rtable **rp);
        void    (*mp_alg_flush)(void);
-       void    (*mp_alg_set_nhinfo)(__u32 network, __u32 netmask,
+       void    (*mp_alg_set_nhinfo)(__be32 network, __be32 netmask,
                                     unsigned char prefixlen,
                                     const struct fib_nh *nh);
        void    (*mp_alg_remove)(struct rtable *rth);
@@ -59,7 +59,7 @@ static inline void multipath_flush(void)
 }
 
 static inline void multipath_set_nhinfo(struct rtable *rth,
-                                       __u32 network, __u32 netmask,
+                                       __be32 network, __be32 netmask,
                                        unsigned char prefixlen,
                                        const struct fib_nh *nh)
 {
index 3b57b159b653dfe8dee821fef097ca234f73a2d6..49c717e3b040075562728bbda430369adf89aa93 100644 (file)
 struct ip_vs_service_user {
        /* virtual service addresses */
        u_int16_t               protocol;
-       u_int32_t               addr;           /* virtual ip address */
-       u_int16_t               port;
+       __be32                  addr;           /* virtual ip address */
+       __be16                  port;
        u_int32_t               fwmark;         /* firwall mark of service */
 
        /* virtual service options */
        char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
        unsigned                flags;          /* virtual service flags */
        unsigned                timeout;        /* persistent timeout in sec */
-       u_int32_t               netmask;        /* persistent netmask */
+       __be32                  netmask;        /* persistent netmask */
 };
 
 
 struct ip_vs_dest_user {
        /* destination server address */
-       u_int32_t               addr;
-       u_int16_t               port;
+       __be32                  addr;
+       __be16                  port;
 
        /* real server options */
        unsigned                conn_flags;     /* connection flags */
@@ -163,15 +163,15 @@ struct ip_vs_getinfo {
 struct ip_vs_service_entry {
        /* which service: user fills in these */
        u_int16_t               protocol;
-       u_int32_t               addr;           /* virtual address */
-       u_int16_t               port;
+       __be32                  addr;           /* virtual address */
+       __be16                  port;
        u_int32_t               fwmark;         /* firwall mark of service */
 
        /* service options */
        char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
        unsigned                flags;          /* virtual service flags */
        unsigned                timeout;        /* persistent timeout */
-       u_int32_t               netmask;        /* persistent netmask */
+       __be32                  netmask;        /* persistent netmask */
 
        /* number of real servers */
        unsigned int            num_dests;
@@ -182,8 +182,8 @@ struct ip_vs_service_entry {
 
 
 struct ip_vs_dest_entry {
-       u_int32_t               addr;           /* destination address */
-       u_int16_t               port;
+       __be32                  addr;           /* destination address */
+       __be16                  port;
        unsigned                conn_flags;     /* connection flags */
        int                     weight;         /* destination weight */
 
@@ -203,8 +203,8 @@ struct ip_vs_dest_entry {
 struct ip_vs_get_dests {
        /* which service: user fills in these */
        u_int16_t               protocol;
-       u_int32_t               addr;           /* virtual address */
-       u_int16_t               port;
+       __be32                  addr;           /* virtual address */
+       __be16                  port;
        u_int32_t               fwmark;         /* firwall mark of service */
 
        /* number of real servers */
@@ -502,12 +502,12 @@ struct ip_vs_conn {
        struct list_head        c_list;         /* hashed list heads */
 
        /* Protocol, addresses and port numbers */
-       __u32                   caddr;          /* client address */
-       __u32                   vaddr;          /* virtual address */
-       __u32                   daddr;          /* destination address */
-       __u16                   cport;
-       __u16                   vport;
-       __u16                   dport;
+       __be32                   caddr;          /* client address */
+       __be32                   vaddr;          /* virtual address */
+       __be32                   daddr;          /* destination address */
+       __be16                   cport;
+       __be16                   vport;
+       __be16                   dport;
        __u16                   protocol;       /* Which protocol (TCP/UDP) */
 
        /* counter and timer */
@@ -554,12 +554,12 @@ struct ip_vs_service {
        atomic_t                usecnt;   /* use counter */
 
        __u16                   protocol; /* which protocol (TCP/UDP) */
-       __u32                   addr;     /* IP address for virtual service */
-       __u16                   port;     /* port number for the service */
+       __be32                  addr;     /* IP address for virtual service */
+       __be16                  port;     /* port number for the service */
        __u32                   fwmark;   /* firewall mark of the service */
        unsigned                flags;    /* service status flags */
        unsigned                timeout;  /* persistent timeout in ticks */
-       __u32                   netmask;  /* grouping granularity */
+       __be32                  netmask;  /* grouping granularity */
 
        struct list_head        destinations;  /* real server d-linked list */
        __u32                   num_dests;     /* number of servers */
@@ -581,8 +581,8 @@ struct ip_vs_dest {
        struct list_head        n_list;   /* for the dests in the service */
        struct list_head        d_list;   /* for table with all the dests */
 
-       __u32                   addr;           /* IP address of the server */
-       __u16                   port;           /* port number of the server */
+       __be32                  addr;           /* IP address of the server */
+       __be16                  port;           /* port number of the server */
        volatile unsigned       flags;          /* dest status flags */
        atomic_t                conn_flags;     /* flags to copy to conn */
        atomic_t                weight;         /* server weight */
@@ -605,8 +605,8 @@ struct ip_vs_dest {
        /* for virtual service */
        struct ip_vs_service    *svc;           /* service it belongs to */
        __u16                   protocol;       /* which protocol (TCP/UDP) */
-       __u32                   vaddr;          /* virtual IP address */
-       __u16                   vport;          /* virtual port number */
+       __be32                  vaddr;          /* virtual IP address */
+       __be16                  vport;          /* virtual port number */
        __u32                   vfwmark;        /* firewall mark of service */
 };
 
@@ -648,7 +648,7 @@ struct ip_vs_app
        /* members for application incarnations */
        struct list_head        p_list;         /* member in proto app list */
        struct ip_vs_app        *app;           /* its real application */
-       __u16                   port;           /* port number in net order */
+       __be16                  port;           /* port number in net order */
        atomic_t                usecnt;         /* usage counter */
 
        /* output hook: return false if can't linearize. diff set for TCP.  */
@@ -740,11 +740,11 @@ enum {
 };
 
 extern struct ip_vs_conn *ip_vs_conn_in_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
 extern struct ip_vs_conn *ip_vs_ct_in_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
 extern struct ip_vs_conn *ip_vs_conn_out_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
 
 /* put back the conn without restarting its timer */
 static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
@@ -752,11 +752,11 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
        atomic_dec(&cp->refcnt);
 }
 extern void ip_vs_conn_put(struct ip_vs_conn *cp);
-extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport);
+extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
 
 extern struct ip_vs_conn *
-ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport,
-              __u32 daddr, __u16 dport, unsigned flags,
+ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport,
+              __be32 daddr, __be16 dport, unsigned flags,
               struct ip_vs_dest *dest);
 extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
 
@@ -887,7 +887,7 @@ extern int sysctl_ip_vs_nat_icmp_send;
 extern struct ip_vs_stats ip_vs_stats;
 
 extern struct ip_vs_service *
-ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport);
+ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport);
 
 static inline void ip_vs_service_put(struct ip_vs_service *svc)
 {
@@ -895,7 +895,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
 }
 
 extern struct ip_vs_dest *
-ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport);
+ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport);
 extern int ip_vs_use_count_inc(void);
 extern void ip_vs_use_count_dec(void);
 extern int ip_vs_control_init(void);
index 72bf47b2a4e0c9bfe34583980f429b1d691557c9..8223c4410b4bdb232c505c0e539a4d2cd7a52d2c 100644 (file)
@@ -318,8 +318,8 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
 
 #ifndef __HAVE_ARCH_ADDR_SET
 static inline void ipv6_addr_set(struct in6_addr *addr, 
-                                    __u32 w1, __u32 w2,
-                                    __u32 w3, __u32 w4)
+                                    __be32 w1, __be32 w2,
+                                    __be32 w3, __be32 w4)
 {
        addr->s6_addr32[0] = w1;
        addr->s6_addr32[1] = w2;
@@ -337,7 +337,7 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
                a1->s6_addr32[3] == a2->s6_addr32[3]);
 }
 
-static inline int __ipv6_prefix_equal(const u32 *a1, const u32 *a2,
+static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
                                      unsigned int prefixlen)
 {
        unsigned pdw, pbi;
index 1c73bdbc3eb3a76332a6312dee8b1e9d7fd58416..9592c374b41d536e182930ff6f16f7a70d71a813 100644 (file)
 #define IRLAN_SHORT  1
 #define IRLAN_ARRAY  2
 
-#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER)
+/* IrLAN sits on top if IrTTP */
+#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER)
+/* 1 byte for the command code and 1 byte for the parameter count */
+#define IRLAN_CMD_HEADER 2
+
+#define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \
+                                               + strlen ((value)))
+#define IRLAN_BYTE_PARAMETER_LEN(name)          (1 + strlen((name)) + 2 + 1)
+#define IRLAN_SHORT_PARAMETER_LEN(name)         (1 + strlen((name)) + 2 + 2)
 
 /*
  *  IrLAN client
index 3452ae257c845d1d3f93460ffc4165756cd9b3f1..9dd54a5002b2af123c3118f09db60838cc05add0 100644 (file)
@@ -74,6 +74,19 @@ struct discovery_t;
 
 #define PF_BIT    0x10 /* Poll/final bit */
 
+/* Some IrLAP field lengths */
+/*
+ * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
+ * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
+ */
+#define IRLAP_NEGOCIATION_PARAMS_LEN 25
+#define IRLAP_DISCOVERY_INFO_LEN     32
+
+struct disc_frame {
+       __u8 caddr;          /* Connection address */
+       __u8 control;
+} IRDA_PACK;
+
 struct xid_frame {
        __u8  caddr; /* Connection address */
        __u8  control;
@@ -95,11 +108,25 @@ struct test_frame {
 struct ua_frame {
        __u8 caddr;
        __u8 control;
-
        __u32 saddr; /* Source device address */
        __u32 daddr; /* Dest device address */
 } IRDA_PACK;
-       
+
+struct dm_frame {
+       __u8 caddr;          /* Connection address */
+       __u8 control;
+} IRDA_PACK;
+
+struct rd_frame {
+       __u8 caddr;          /* Connection address */
+       __u8 control;
+} IRDA_PACK;
+
+struct rr_frame {
+       __u8 caddr;          /* Connection address */
+       __u8 control;
+} IRDA_PACK;
+
 struct i_frame {
        __u8 caddr;
        __u8 control;
index 11ecfa58a648ff3ad145b8138055f6ac5ad9f54f..e212b9bc2503d64439cd70c3ffa4d080d15751dd 100644 (file)
@@ -48,7 +48,7 @@
 #define DEV_ADDR_ANY  0xffffffff
 
 #define LMP_HEADER          2    /* Dest LSAP + Source LSAP */
-#define LMP_CONTROL_HEADER  4
+#define LMP_CONTROL_HEADER  4    /* LMP_HEADER + opcode + parameter */
 #define LMP_PID_HEADER      1    /* Used by Ultra */
 #define LMP_MAX_HEADER      (LMP_CONTROL_HEADER+LAP_MAX_HEADER)
 
index 6692430063fdd4a9357aae7e964d0698c305e615..190bfdbbdba6eaf92da55f340d0b80fa64d6ac5f 100644 (file)
@@ -96,7 +96,7 @@
 struct netlbl_dom_map;
 
 /* Domain mapping operations */
-int netlbl_domhsh_remove(const char *domain);
+int netlbl_domhsh_remove(const char *domain, u32 audit_secid);
 
 /* LSM security attributes */
 struct netlbl_lsm_cache {
index 4ab68a7a636a927e915a66139ace5737cab78ed7..ce5cba19c393cf5206643300263e3971e50661d1 100644 (file)
@@ -831,6 +831,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
 #define NLA_PUT_U32(skb, attrtype, value) \
        NLA_PUT_TYPE(skb, u32, attrtype, value)
 
+#define NLA_PUT_BE32(skb, attrtype, value) \
+       NLA_PUT_TYPE(skb, __be32, attrtype, value)
+
 #define NLA_PUT_U64(skb, attrtype, value) \
        NLA_PUT_TYPE(skb, u64, attrtype, value)
 
@@ -852,6 +855,15 @@ static inline u32 nla_get_u32(struct nlattr *nla)
        return *(u32 *) nla_data(nla);
 }
 
+/**
+ * nla_get_be32 - return payload of __be32 attribute
+ * @nla: __be32 netlink attribute
+ */
+static inline __be32 nla_get_be32(struct nlattr *nla)
+{
+       return *(__be32 *) nla_data(nla);
+}
+
 /**
  * nla_get_u16 - return payload of u16 attribute
  * @nla: u16 netlink attribute
index 7f93ac0e089983a0ceed7e4a11c153f2210ce794..486e37aff06ca28751e2a4a1cbf645b52cd3ebee 100644 (file)
@@ -62,18 +62,18 @@ struct rtable
        __u16                   rt_type;
        __u16                   rt_multipath_alg;
 
-       __u32                   rt_dst; /* Path destination     */
-       __u32                   rt_src; /* Path source          */
+       __be32                  rt_dst; /* Path destination     */
+       __be32                  rt_src; /* Path source          */
        int                     rt_iif;
 
        /* Info on neighbour */
-       __u32                   rt_gateway;
+       __be32                  rt_gateway;
 
        /* Cache lookup keys */
        struct flowi            fl;
 
        /* Miscellaneous cached information */
-       __u32                   rt_spec_dst; /* RFC1122 specific destination */
+       __be32                  rt_spec_dst; /* RFC1122 specific destination */
        struct inet_peer        *peer; /* long-living peer info */
 };
 
@@ -109,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct;
 
 struct in_device;
 extern int             ip_rt_init(void);
-extern void            ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
-                                      u32 src, struct net_device *dev);
+extern void            ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
+                                      __be32 src, struct net_device *dev);
 extern void            ip_rt_advice(struct rtable **rp, int advice);
 extern void            rt_cache_flush(int how);
 extern int             __ip_route_output_key(struct rtable **, const struct flowi *flp);
 extern int             ip_route_output_key(struct rtable **, struct flowi *flp);
 extern int             ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
-extern int             ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin);
+extern int             ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
 extern unsigned short  ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
 extern void            ip_rt_send_redirect(struct sk_buff *skb);
 
-extern unsigned                inet_addr_type(u32 addr);
+extern unsigned                inet_addr_type(__be32 addr);
 extern void            ip_rt_multicast_event(struct in_device *);
 extern int             ip_rt_ioctl(unsigned int cmd, void __user *arg);
 extern void            ip_rt_get_source(u8 *src, struct rtable *rt);
@@ -144,9 +144,9 @@ static inline char rt_tos2priority(u8 tos)
        return ip_tos2prio[IPTOS_TOS(tos)>>1];
 }
 
-static inline int ip_route_connect(struct rtable **rp, u32 dst,
-                                  u32 src, u32 tos, int oif, u8 protocol,
-                                  u16 sport, u16 dport, struct sock *sk)
+static inline int ip_route_connect(struct rtable **rp, __be32 dst,
+                                  __be32 src, u32 tos, int oif, u8 protocol,
+                                  __be16 sport, __be16 dport, struct sock *sk)
 {
        struct flowi fl = { .oif = oif,
                            .nl_u = { .ip4_u = { .daddr = dst,
@@ -172,7 +172,7 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst,
 }
 
 static inline int ip_route_newports(struct rtable **rp, u8 protocol,
-                                   u16 sport, u16 dport, struct sock *sk)
+                                   __be16 sport, __be16 dport, struct sock *sk)
 {
        if (sport != (*rp)->fl.fl_ip_sport ||
            dport != (*rp)->fl.fl_ip_dport) {
index 11e0b1d6bd4734963a8675b7d4c25aa1867607f0..1e2a4ddec96e3c7cfdf8e5ef2010d234c0673821 100644 (file)
@@ -437,8 +437,8 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
 
 static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
 {
-       __u32 *a1 = token1;
-       __u32 *a2 = token2;
+       __be32 *a1 = token1;
+       __be32 *a2 = token2;
        int pdw;
        int pbi;
 
@@ -450,7 +450,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
                        return 0;
 
        if (pbi) {
-               __u32 mask;
+               __be32 mask;
 
                mask = htonl((0xffffffff) << (32 - pbi));
 
@@ -462,9 +462,9 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
 }
 
 static __inline__
-u16 xfrm_flowi_sport(struct flowi *fl)
+__be16 xfrm_flowi_sport(struct flowi *fl)
 {
-       u16 port;
+       __be16 port;
        switch(fl->proto) {
        case IPPROTO_TCP:
        case IPPROTO_UDP:
@@ -487,9 +487,9 @@ u16 xfrm_flowi_sport(struct flowi *fl)
 }
 
 static __inline__
-u16 xfrm_flowi_dport(struct flowi *fl)
+__be16 xfrm_flowi_dport(struct flowi *fl)
 {
-       u16 port;
+       __be16 port;
        switch(fl->proto) {
        case IPPROTO_TCP:
        case IPPROTO_UDP:
@@ -912,7 +912,7 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
 extern void xfrm_state_insert(struct xfrm_state *x);
 extern int xfrm_state_add(struct xfrm_state *x);
 extern int xfrm_state_update(struct xfrm_state *x);
-extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family);
+extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family);
 extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family);
 #ifdef CONFIG_XFRM_SUB_POLICY
 extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
@@ -935,8 +935,8 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
 extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
 extern int xfrm_state_delete(struct xfrm_state *x);
 extern void xfrm_state_flush(u8 proto);
-extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
-extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
+extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
+extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
 extern void xfrm_replay_notify(struct xfrm_state *x, int event);
 extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
 extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
@@ -945,7 +945,7 @@ extern int xfrm4_rcv(struct sk_buff *skb);
 extern int xfrm4_output(struct sk_buff *skb);
 extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
 extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
-extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi);
+extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
 extern int xfrm6_rcv(struct sk_buff **pskb);
 extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
                            xfrm_address_t *saddr, u8 proto);
@@ -989,7 +989,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
 struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete);
 void xfrm_policy_flush(u8 type);
 u32 xfrm_get_acqseq(void);
-void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
+void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
 struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 
                                  xfrm_address_t *daddr, xfrm_address_t *saddr, 
                                  int create, unsigned short family);
@@ -1004,7 +1004,7 @@ extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pi
 extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
 
 extern void xfrm_input_init(void);
-extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq);
+extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
 
 extern void xfrm_probe_algs(void);
 extern int xfrm_count_auth_supported(void);
index 2a7c933651c7c03b0777fcecdc1ea3e06fed259b..f4330acead468a8cd228d0249918dbd748e7fbf2 100644 (file)
@@ -483,10 +483,14 @@ static void do_acct_process(struct file *file)
        ac.ac_ppid = current->parent->tgid;
 #endif
 
-       read_lock(&tasklist_lock);      /* pin current->signal */
+       mutex_lock(&tty_mutex);
+       /* FIXME: Whoever is responsible for current->signal locking needs
+          to use the same locking all over the kernel and document it */
+       read_lock(&tasklist_lock);
        ac.ac_tty = current->signal->tty ?
                old_encode_dev(tty_devnum(current->signal->tty)) : 0;
        read_unlock(&tasklist_lock);
+       mutex_unlock(&tty_mutex);
 
        spin_lock_irq(&current->sighand->siglock);
        ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));
index fb83c5cb8c324226c47fb18ca7c708e61ef4421b..105147631753f1b4f68fc17878a0e4531b436593 100644 (file)
@@ -817,6 +817,8 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
                audit_log_format(ab, " success=%s exit=%ld", 
                                 (context->return_valid==AUDITSC_SUCCESS)?"yes":"no",
                                 context->return_code);
+
+       mutex_lock(&tty_mutex);
        if (tsk->signal && tsk->signal->tty && tsk->signal->tty->name)
                tty = tsk->signal->tty->name;
        else
@@ -838,6 +840,9 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
                  context->gid,
                  context->euid, context->suid, context->fsuid,
                  context->egid, context->sgid, context->fsgid, tty);
+
+       mutex_unlock(&tty_mutex);
+
        audit_log_task_info(ab, tsk);
        if (context->filterkey) {
                audit_log_format(ab, " key=");
index c7685ad00a97c4ddfd2f47029f0b5b4342da80be..edb845a6e84ae5e649ece39e18384620c5dac74e 100644 (file)
@@ -133,7 +133,7 @@ static inline int cap_set_all(kernel_cap_t *effective,
      int found = 0;
 
      do_each_thread(g, target) {
-             if (target == current || target->pid == 1)
+             if (target == current || is_init(target))
                      continue;
              found = 1;
             if (security_capset_check(target, effective, inheritable,
index 126dee9530aacc13a37d304ee8a4b54f69355a82..75573e5d27b05c92dd1a11aaf483415935032624 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/timex.h>
 #include <linux/migrate.h>
+#include <linux/posix-timers.h>
 
 #include <asm/uaccess.h>
 
@@ -601,6 +602,30 @@ long compat_sys_clock_getres(clockid_t which_clock,
        return err;
 } 
 
+static long compat_clock_nanosleep_restart(struct restart_block *restart)
+{
+       long err;
+       mm_segment_t oldfs;
+       struct timespec tu;
+       struct compat_timespec *rmtp = (struct compat_timespec *)(restart->arg1);
+
+       restart->arg1 = (unsigned long) &tu;
+       oldfs = get_fs();
+       set_fs(KERNEL_DS);
+       err = clock_nanosleep_restart(restart);
+       set_fs(oldfs);
+
+       if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
+           put_compat_timespec(&tu, rmtp))
+               return -EFAULT;
+
+       if (err == -ERESTART_RESTARTBLOCK) {
+               restart->fn = compat_clock_nanosleep_restart;
+               restart->arg1 = (unsigned long) rmtp;
+       }
+       return err;
+}
+
 long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
                            struct compat_timespec __user *rqtp,
                            struct compat_timespec __user *rmtp)
@@ -608,6 +633,7 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
        long err;
        mm_segment_t oldfs;
        struct timespec in, out; 
+       struct restart_block *restart;
 
        if (get_compat_timespec(&in, rqtp)) 
                return -EFAULT;
@@ -618,9 +644,16 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
                                  (struct timespec __user *) &in,
                                  (struct timespec __user *) &out);
        set_fs(oldfs);
+
        if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
            put_compat_timespec(&out, rmtp))
                return -EFAULT;
+
+       if (err == -ERESTART_RESTARTBLOCK) {
+               restart = &current_thread_info()->restart_block;
+               restart->fn = compat_clock_nanosleep_restart;
+               restart->arg1 = (unsigned long) rmtp;
+       }
        return err;     
 } 
 
index 1b32c2c04c153a056047134a28ed5f172eeb1f80..8c3c400cce91f4a679e0d034380ca16065b296a5 100644 (file)
@@ -240,7 +240,7 @@ static struct super_block *cpuset_sb;
  * A cpuset can only be deleted if both its 'count' of using tasks
  * is zero, and its list of 'children' cpusets is empty.  Since all
  * tasks in the system use _some_ cpuset, and since there is always at
- * least one task in the system (init, pid == 1), therefore, top_cpuset
+ * least one task in the system (init), therefore, top_cpuset
  * always has either children cpusets and/or using tasks.  So we don't
  * need a special hack to ensure that top_cpuset cannot be deleted.
  *
@@ -912,6 +912,10 @@ static int update_nodemask(struct cpuset *cs, char *buf)
        int fudge;
        int retval;
 
+       /* top_cpuset.mems_allowed tracks node_online_map; it's read-only */
+       if (cs == &top_cpuset)
+               return -EACCES;
+
        trialcs = *cs;
        retval = nodelist_parse(buf, trialcs.mems_allowed);
        if (retval < 0)
@@ -1221,7 +1225,12 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)
 
        task_lock(tsk);
        oldcs = tsk->cpuset;
-       if (!oldcs) {
+       /*
+        * After getting 'oldcs' cpuset ptr, be sure still not exiting.
+        * If 'oldcs' might be the top_cpuset due to the_top_cpuset_hack
+        * then fail this attach_task(), to avoid breaking top_cpuset.count.
+        */
+       if (tsk->flags & PF_EXITING) {
                task_unlock(tsk);
                mutex_unlock(&callback_mutex);
                put_task_struct(tsk);
@@ -2036,33 +2045,104 @@ out:
        return err;
 }
 
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
 /*
- * The top_cpuset tracks what CPUs and Memory Nodes are online,
- * period.  This is necessary in order to make cpusets transparent
- * (of no affect) on systems that are actively using CPU hotplug
- * but making no active use of cpusets.
- *
- * This handles CPU hotplug (cpuhp) events.  If someday Memory
- * Nodes can be hotplugged (dynamically changing node_online_map)
- * then we should handle that too, perhaps in a similar way.
+ * If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs
+ * or memory nodes, we need to walk over the cpuset hierarchy,
+ * removing that CPU or node from all cpusets.  If this removes the
+ * last CPU or node from a cpuset, then the guarantee_online_cpus()
+ * or guarantee_online_mems() code will use that emptied cpusets
+ * parent online CPUs or nodes.  Cpusets that were already empty of
+ * CPUs or nodes are left empty.
+ *
+ * This routine is intentionally inefficient in a couple of regards.
+ * It will check all cpusets in a subtree even if the top cpuset of
+ * the subtree has no offline CPUs or nodes.  It checks both CPUs and
+ * nodes, even though the caller could have been coded to know that
+ * only one of CPUs or nodes needed to be checked on a given call.
+ * This was done to minimize text size rather than cpu cycles.
+ *
+ * Call with both manage_mutex and callback_mutex held.
+ *
+ * Recursive, on depth of cpuset subtree.
  */
 
-#ifdef CONFIG_HOTPLUG_CPU
-static int cpuset_handle_cpuhp(struct notifier_block *nb,
-                               unsigned long phase, void *cpu)
+static void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur)
+{
+       struct cpuset *c;
+
+       /* Each of our child cpusets mems must be online */
+       list_for_each_entry(c, &cur->children, sibling) {
+               guarantee_online_cpus_mems_in_subtree(c);
+               if (!cpus_empty(c->cpus_allowed))
+                       guarantee_online_cpus(c, &c->cpus_allowed);
+               if (!nodes_empty(c->mems_allowed))
+                       guarantee_online_mems(c, &c->mems_allowed);
+       }
+}
+
+/*
+ * The cpus_allowed and mems_allowed nodemasks in the top_cpuset track
+ * cpu_online_map and node_online_map.  Force the top cpuset to track
+ * whats online after any CPU or memory node hotplug or unplug event.
+ *
+ * To ensure that we don't remove a CPU or node from the top cpuset
+ * that is currently in use by a child cpuset (which would violate
+ * the rule that cpusets must be subsets of their parent), we first
+ * call the recursive routine guarantee_online_cpus_mems_in_subtree().
+ *
+ * Since there are two callers of this routine, one for CPU hotplug
+ * events and one for memory node hotplug events, we could have coded
+ * two separate routines here.  We code it as a single common routine
+ * in order to minimize text size.
+ */
+
+static void common_cpu_mem_hotplug_unplug(void)
 {
        mutex_lock(&manage_mutex);
        mutex_lock(&callback_mutex);
 
+       guarantee_online_cpus_mems_in_subtree(&top_cpuset);
        top_cpuset.cpus_allowed = cpu_online_map;
+       top_cpuset.mems_allowed = node_online_map;
 
        mutex_unlock(&callback_mutex);
        mutex_unlock(&manage_mutex);
+}
+#endif
+
+#ifdef CONFIG_HOTPLUG_CPU
+/*
+ * The top_cpuset tracks what CPUs and Memory Nodes are online,
+ * period.  This is necessary in order to make cpusets transparent
+ * (of no affect) on systems that are actively using CPU hotplug
+ * but making no active use of cpusets.
+ *
+ * This routine ensures that top_cpuset.cpus_allowed tracks
+ * cpu_online_map on each CPU hotplug (cpuhp) event.
+ */
 
+static int cpuset_handle_cpuhp(struct notifier_block *nb,
+                               unsigned long phase, void *cpu)
+{
+       common_cpu_mem_hotplug_unplug();
        return 0;
 }
 #endif
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+/*
+ * Keep top_cpuset.mems_allowed tracking node_online_map.
+ * Call this routine anytime after you change node_online_map.
+ * See also the previous routine cpuset_handle_cpuhp().
+ */
+
+void cpuset_track_online_nodes()
+{
+       common_cpu_mem_hotplug_unplug();
+}
+#endif
+
 /**
  * cpuset_init_smp - initialize cpus_allowed
  *
index d891883420f7bfd64b0cbc29b7003fcd57d526ef..2e4c13cba95ae7af79bc373a859ecac42a340225 100644 (file)
@@ -219,7 +219,7 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task)
        do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
                if (p == ignored_task
                                || p->exit_state
-                               || p->real_parent->pid == 1)
+                               || is_init(p->real_parent))
                        continue;
                if (process_group(p->real_parent) != pgrp
                            && p->real_parent->signal->session == p->signal->session) {
@@ -249,17 +249,6 @@ static int has_stopped_jobs(int pgrp)
        do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
                if (p->state != TASK_STOPPED)
                        continue;
-
-               /* If p is stopped by a debugger on a signal that won't
-                  stop it, then don't count p as stopped.  This isn't
-                  perfect but it's a good approximation.  */
-               if (unlikely (p->ptrace)
-                   && p->exit_code != SIGSTOP
-                   && p->exit_code != SIGTSTP
-                   && p->exit_code != SIGTTOU
-                   && p->exit_code != SIGTTIN)
-                       continue;
-
                retval = 1;
                break;
        } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
@@ -292,9 +281,7 @@ static void reparent_to_init(void)
        /* Set the exit signal to SIGCHLD so we signal init on exit */
        current->exit_signal = SIGCHLD;
 
-       if ((current->policy == SCHED_NORMAL ||
-                       current->policy == SCHED_BATCH)
-                               && (task_nice(current) < 0))
+       if (!has_rt_policy(current) && (task_nice(current) < 0))
                set_user_nice(current, 0);
        /* cpus_allowed? */
        /* rt_priority? */
@@ -487,6 +474,18 @@ void fastcall put_files_struct(struct files_struct *files)
 
 EXPORT_SYMBOL(put_files_struct);
 
+void reset_files_struct(struct task_struct *tsk, struct files_struct *files)
+{
+       struct files_struct *old;
+
+       old = tsk->files;
+       task_lock(tsk);
+       tsk->files = files;
+       task_unlock(tsk);
+       put_files_struct(old);
+}
+EXPORT_SYMBOL(reset_files_struct);
+
 static inline void __exit_files(struct task_struct *tsk)
 {
        struct files_struct * files = tsk->files;
@@ -954,15 +953,15 @@ fastcall NORET_TYPE void do_exit(long code)
        if (tsk->splice_pipe)
                __free_pipe_info(tsk->splice_pipe);
 
-       /* PF_DEAD causes final put_task_struct after we schedule. */
        preempt_disable();
-       BUG_ON(tsk->flags & PF_DEAD);
-       tsk->flags |= PF_DEAD;
+       /* causes final put_task_struct in finish_task_switch(). */
+       tsk->state = TASK_DEAD;
 
        schedule();
        BUG();
        /* Avoid "noreturn function does return".  */
-       for (;;) ;
+       for (;;)
+               cpu_relax();    /* For when BUG is null */
 }
 
 EXPORT_SYMBOL_GPL(do_exit);
@@ -971,7 +970,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code)
 {
        if (comp)
                complete(comp);
-       
+
        do_exit(code);
 }
 
index 802b1cf0e63f322b4197e68111bca1a22b2800e1..1c999f3e0b47f02a4fd805daf90f9b914c44282b 100644 (file)
@@ -183,7 +183,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
        /* One for us, one for whoever does the "release_task()" (usually parent) */
        atomic_set(&tsk->usage,2);
        atomic_set(&tsk->fs_excl, 0);
+#ifdef CONFIG_BLK_DEV_IO_TRACE
        tsk->btrace_seq = 0;
+#endif
        tsk->splice_pipe = NULL;
        return tsk;
 }
@@ -1148,7 +1150,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
        /* Our parent execution domain becomes current domain
           These must match for thread signalling to apply */
-          
        p->parent_exec_id = p->self_exec_id;
 
        /* ok, now we should be set up.. */
@@ -1171,6 +1172,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        /* Need tasklist lock for parent etc handling! */
        write_lock_irq(&tasklist_lock);
 
+       /* for sys_ioprio_set(IOPRIO_WHO_PGRP) */
+       p->ioprio = current->ioprio;
+
        /*
         * The task hasn't been attached yet, so its cpus_allowed mask will
         * not be changed, nor will its assigned CPU.
@@ -1230,11 +1234,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
                }
        }
 
-       /*
-        * inherit ioprio
-        */
-       p->ioprio = current->ioprio;
-
        if (likely(p->pid)) {
                add_parent(p);
                if (unlikely(p->ptrace & PT_PTRACED))
index 9d260e838cffdca6f951d6625626ab9d62f19d81..4b6770e9806d0c080ef5f9bd542ddb778ddbcff2 100644 (file)
@@ -389,7 +389,7 @@ static struct task_struct * futex_find_get_task(pid_t pid)
 {
        struct task_struct *p;
 
-       read_lock(&tasklist_lock);
+       rcu_read_lock();
        p = find_task_by_pid(pid);
        if (!p)
                goto out_unlock;
@@ -403,7 +403,7 @@ static struct task_struct * futex_find_get_task(pid_t pid)
        }
        get_task_struct(p);
 out_unlock:
-       read_unlock(&tasklist_lock);
+       rcu_read_unlock();
 
        return p;
 }
@@ -1624,7 +1624,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr,
                struct task_struct *p;
 
                ret = -ESRCH;
-               read_lock(&tasklist_lock);
+               rcu_read_lock();
                p = find_task_by_pid(pid);
                if (!p)
                        goto err_unlock;
@@ -1633,7 +1633,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr,
                                !capable(CAP_SYS_PTRACE))
                        goto err_unlock;
                head = p->robust_list;
-               read_unlock(&tasklist_lock);
+               rcu_read_unlock();
        }
 
        if (put_user(sizeof(*head), len_ptr))
@@ -1641,7 +1641,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr,
        return put_user(head, head_ptr);
 
 err_unlock:
-       read_unlock(&tasklist_lock);
+       rcu_read_unlock();
 
        return ret;
 }
index 21c38a7e666ba74f373b9693770af4b22b63a685..d0ba190dfeb6b9ae81c98f135515b19a145f8206 100644 (file)
@@ -693,7 +693,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
        return t->task == NULL;
 }
 
-static long __sched nanosleep_restart(struct restart_block *restart)
+long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
 {
        struct hrtimer_sleeper t;
        struct timespec __user *rmtp;
@@ -702,13 +702,13 @@ static long __sched nanosleep_restart(struct restart_block *restart)
 
        restart->fn = do_no_restart_syscall;
 
-       hrtimer_init(&t.timer, restart->arg3, HRTIMER_ABS);
-       t.timer.expires.tv64 = ((u64)restart->arg1 << 32) | (u64) restart->arg0;
+       hrtimer_init(&t.timer, restart->arg0, HRTIMER_ABS);
+       t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;
 
        if (do_nanosleep(&t, HRTIMER_ABS))
                return 0;
 
-       rmtp = (struct timespec __user *) restart->arg2;
+       rmtp = (struct timespec __user *) restart->arg1;
        if (rmtp) {
                time = ktime_sub(t.timer.expires, t.timer.base->get_time());
                if (time.tv64 <= 0)
@@ -718,7 +718,7 @@ static long __sched nanosleep_restart(struct restart_block *restart)
                        return -EFAULT;
        }
 
-       restart->fn = nanosleep_restart;
+       restart->fn = hrtimer_nanosleep_restart;
 
        /* The other values in restart are already filled in */
        return -ERESTART_RESTARTBLOCK;
@@ -751,11 +751,11 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
        }
 
        restart = &current_thread_info()->restart_block;
-       restart->fn = nanosleep_restart;
-       restart->arg0 = t.timer.expires.tv64 & 0xFFFFFFFF;
-       restart->arg1 = t.timer.expires.tv64 >> 32;
-       restart->arg2 = (unsigned long) rmtp;
-       restart->arg3 = (unsigned long) t.timer.base->index;
+       restart->fn = hrtimer_nanosleep_restart;
+       restart->arg0 = (unsigned long) t.timer.base->index;
+       restart->arg1 = (unsigned long) rmtp;
+       restart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF;
+       restart->arg3 = t.timer.expires.tv64 >> 32;
 
        return -ERESTART_RESTARTBLOCK;
 }
index ac1f850d4937e5a020f22132a83da5a49fe9a3bf..736cb0bd498f8ff5c7a50d8b60e3130da43d9d7f 100644 (file)
@@ -40,10 +40,6 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
        spin_lock_irqsave(&desc->lock, flags);
        irq_chip_set_defaults(chip);
        desc->chip = chip;
-       /*
-        * For compatibility only:
-        */
-       desc->chip = chip;
        spin_unlock_irqrestore(&desc->lock, flags);
 
        return 0;
@@ -146,7 +142,7 @@ static void default_disable(unsigned int irq)
        struct irq_desc *desc = irq_desc + irq;
 
        if (!(desc->status & IRQ_DELAYED_DISABLE))
-               irq_desc[irq].chip->mask(irq);
+               desc->chip->mask(irq);
 }
 
 /*
index 50087ecf337ea17e5429188688187b6623a57f20..fcdd5d2bc3f4b47b57854c41a1cec882939c02ed 100644 (file)
@@ -40,7 +40,7 @@ struct resource crashk_res = {
 
 int kexec_should_crash(struct task_struct *p)
 {
-       if (in_interrupt() || !p->pid || p->pid == 1 || panic_on_oops)
+       if (in_interrupt() || !p->pid || is_init(p) || panic_on_oops)
                return 1;
        return 0;
 }
@@ -995,7 +995,8 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
        image = xchg(dest_image, image);
 
 out:
-       xchg(&kexec_lock, 0); /* Release the mutex */
+       locked = xchg(&kexec_lock, 0); /* Release the mutex */
+       BUG_ON(!locked);
        kimage_free(image);
 
        return result;
@@ -1061,7 +1062,8 @@ void crash_kexec(struct pt_regs *regs)
                        machine_crash_shutdown(&fixed_regs);
                        machine_kexec(kexec_crash_image);
                }
-               xchg(&kexec_lock, 0);
+               locked = xchg(&kexec_lock, 0);
+               BUG_ON(!locked);
        }
 }
 
index 64ab045c3d9d3a72126971f51c0081e199a4468d..5d1d907378a299ad6c6aab16b15d55d1248f296e 100644 (file)
@@ -122,6 +122,13 @@ unsigned int __kfifo_put(struct kfifo *fifo,
 
        len = min(len, fifo->size - fifo->in + fifo->out);
 
+       /*
+        * Ensure that we sample the fifo->out index -before- we
+        * start putting bytes into the kfifo.
+        */
+
+       smp_mb();
+
        /* first put the data starting from fifo->in to buffer end */
        l = min(len, fifo->size - (fifo->in & (fifo->size - 1)));
        memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l);
@@ -129,6 +136,13 @@ unsigned int __kfifo_put(struct kfifo *fifo,
        /* then put the rest (if any) at the beginning of the buffer */
        memcpy(fifo->buffer, buffer + l, len - l);
 
+       /*
+        * Ensure that we add the bytes to the kfifo -before-
+        * we update the fifo->in index.
+        */
+
+       smp_wmb();
+
        fifo->in += len;
 
        return len;
@@ -154,6 +168,13 @@ unsigned int __kfifo_get(struct kfifo *fifo,
 
        len = min(len, fifo->in - fifo->out);
 
+       /*
+        * Ensure that we sample the fifo->in index -before- we
+        * start removing bytes from the kfifo.
+        */
+
+       smp_rmb();
+
        /* first get the data from fifo->out until the end of the buffer */
        l = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
        memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l);
@@ -161,6 +182,13 @@ unsigned int __kfifo_get(struct kfifo *fifo,
        /* then get the rest (if any) from the beginning of the buffer */
        memcpy(buffer + l, fifo->buffer, len - l);
 
+       /*
+        * Ensure that we remove the bytes from the kfifo -before-
+        * we update the fifo->out index.
+        */
+
+       smp_mb();
+
        fifo->out += len;
 
        return len;
index 5c470c57fb57c0997bd5f76e24a1bb5cc24e687b..842f8015d7fd2e6c7bc07f86b9b6766b13864539 100644 (file)
@@ -176,6 +176,8 @@ static int wait_for_helper(void *data)
        if (pid < 0) {
                sub_info->retval = pid;
        } else {
+               int ret;
+
                /*
                 * Normally it is bogus to call wait4() from in-kernel because
                 * wait4() wants to write the exit code to a userspace address.
@@ -185,7 +187,15 @@ static int wait_for_helper(void *data)
                 *
                 * Thus the __user pointer cast is valid here.
                 */
-               sys_wait4(pid, (int __user *) &sub_info->retval, 0, NULL);
+               sys_wait4(pid, (int __user *)&ret, 0, NULL);
+
+               /*
+                * If ret is 0, either ____call_usermodehelper failed and the
+                * real error code is already in sub_info->retval or
+                * sub_info->retval is 0 anyway, so don't mess with it then.
+                */
+               if (ret)
+                       sub_info->retval = ret;
        }
 
        complete(sub_info->complete);
index c088e5542e84074d3f784108805c841c162b0ce9..e596525669ed4fa5018ee452c7bc429b945f8d00 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/stacktrace.h>
 #include <linux/debug_locks.h>
 #include <linux/irqflags.h>
+#include <linux/utsname.h>
 
 #include <asm/sections.h>
 
@@ -121,8 +122,8 @@ static struct list_head chainhash_table[CHAINHASH_SIZE];
  * unique.
  */
 #define iterate_chain_key(key1, key2) \
-       (((key1) << MAX_LOCKDEP_KEYS_BITS/2) ^ \
-       ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS/2)) ^ \
+       (((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \
+       ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \
        (key2))
 
 void lockdep_off(void)
@@ -515,6 +516,13 @@ print_circular_bug_entry(struct lock_list *target, unsigned int depth)
        return 0;
 }
 
+static void print_kernel_version(void)
+{
+       printk("%s %.*s\n", system_utsname.release,
+               (int)strcspn(system_utsname.version, " "),
+               system_utsname.version);
+}
+
 /*
  * When a circular dependency is detected, print the
  * header first:
@@ -531,6 +539,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth)
 
        printk("\n=======================================================\n");
        printk(  "[ INFO: possible circular locking dependency detected ]\n");
+       print_kernel_version();
        printk(  "-------------------------------------------------------\n");
        printk("%s/%d is trying to acquire lock:\n",
                curr->comm, curr->pid);
@@ -712,6 +721,7 @@ print_bad_irq_dependency(struct task_struct *curr,
        printk("\n======================================================\n");
        printk(  "[ INFO: %s-safe -> %s-unsafe lock order detected ]\n",
                irqclass, irqclass);
+       print_kernel_version();
        printk(  "------------------------------------------------------\n");
        printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
                curr->comm, curr->pid,
@@ -793,6 +803,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
 
        printk("\n=============================================\n");
        printk(  "[ INFO: possible recursive locking detected ]\n");
+       print_kernel_version();
        printk(  "---------------------------------------------\n");
        printk("%s/%d is trying to acquire lock:\n",
                curr->comm, curr->pid);
@@ -1375,6 +1386,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other,
 
        printk("\n=========================================================\n");
        printk(  "[ INFO: possible irq lock inversion dependency detected ]\n");
+       print_kernel_version();
        printk(  "---------------------------------------------------------\n");
        printk("%s/%d just changed the state of lock:\n",
                curr->comm, curr->pid);
@@ -1469,6 +1481,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
 
        printk("\n=================================\n");
        printk(  "[ INFO: inconsistent lock state ]\n");
+       print_kernel_version();
        printk(  "---------------------------------\n");
 
        printk("inconsistent {%s} -> {%s} usage.\n",
index b7fe6e84096303865f20e1c606c6bb35c77451c8..05625d5dc7583ac5567d3deec22ebd95c57b72bc 100644 (file)
@@ -933,6 +933,15 @@ static ssize_t module_sect_show(struct module_attribute *mattr,
        return sprintf(buf, "0x%lx\n", sattr->address);
 }
 
+static void free_sect_attrs(struct module_sect_attrs *sect_attrs)
+{
+       int section;
+
+       for (section = 0; section < sect_attrs->nsections; section++)
+               kfree(sect_attrs->attrs[section].name);
+       kfree(sect_attrs);
+}
+
 static void add_sect_attrs(struct module *mod, unsigned int nsect,
                char *secstrings, Elf_Shdr *sechdrs)
 {
@@ -949,21 +958,26 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
                        + nloaded * sizeof(sect_attrs->attrs[0]),
                        sizeof(sect_attrs->grp.attrs[0]));
        size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.attrs[0]);
-       if (! (sect_attrs = kmalloc(size[0] + size[1], GFP_KERNEL)))
+       sect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL);
+       if (sect_attrs == NULL)
                return;
 
        /* Setup section attributes. */
        sect_attrs->grp.name = "sections";
        sect_attrs->grp.attrs = (void *)sect_attrs + size[0];
 
+       sect_attrs->nsections = 0;
        sattr = &sect_attrs->attrs[0];
        gattr = &sect_attrs->grp.attrs[0];
        for (i = 0; i < nsect; i++) {
                if (! (sechdrs[i].sh_flags & SHF_ALLOC))
                        continue;
                sattr->address = sechdrs[i].sh_addr;
-               strlcpy(sattr->name, secstrings + sechdrs[i].sh_name,
-                       MODULE_SECT_NAME_LEN);
+               sattr->name = kstrdup(secstrings + sechdrs[i].sh_name,
+                                       GFP_KERNEL);
+               if (sattr->name == NULL)
+                       goto out;
+               sect_attrs->nsections++;
                sattr->mattr.show = module_sect_show;
                sattr->mattr.store = NULL;
                sattr->mattr.attr.name = sattr->name;
@@ -979,7 +993,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
        mod->sect_attrs = sect_attrs;
        return;
   out:
-       kfree(sect_attrs);
+       free_sect_attrs(sect_attrs);
 }
 
 static void remove_sect_attrs(struct module *mod)
@@ -989,13 +1003,13 @@ static void remove_sect_attrs(struct module *mod)
                                   &mod->sect_attrs->grp);
                /* We are positive that no one is using any sect attrs
                 * at this point.  Deallocate immediately. */
-               kfree(mod->sect_attrs);
+               free_sect_attrs(mod->sect_attrs);
                mod->sect_attrs = NULL;
        }
 }
 
-
 #else
+
 static inline void add_sect_attrs(struct module *mod, unsigned int nsect,
                char *sectstrings, Elf_Shdr *sechdrs)
 {
index 91aea7aa532e53940fc7c63367d6a9634249be95..f406655d66536b8a373b62c082b9ef64364d2c20 100644 (file)
@@ -547,6 +547,7 @@ static void __init kernel_param_sysfs_setup(const char *name,
                                            unsigned int name_skip)
 {
        struct module_kobject *mk;
+       int ret;
 
        mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);
        BUG_ON(!mk);
@@ -554,7 +555,8 @@ static void __init kernel_param_sysfs_setup(const char *name,
        mk->mod = THIS_MODULE;
        kobj_set_kset_s(mk, module_subsys);
        kobject_set_name(&mk->kobj, name);
-       kobject_register(&mk->kobj);
+       ret = kobject_register(&mk->kobj);
+       BUG_ON(ret < 0);
 
        /* no need to keep the kobject if no parameter is exported */
        if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) {
@@ -684,13 +686,20 @@ decl_subsys(module, &module_ktype, NULL);
  */
 static int __init param_sysfs_init(void)
 {
-       subsystem_register(&module_subsys);
+       int ret;
+
+       ret = subsystem_register(&module_subsys);
+       if (ret < 0) {
+               printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n",
+                       __FILE__, __LINE__, ret);
+               return ret;
+       }
 
        param_sysfs_builtin();
 
        return 0;
 }
-__initcall(param_sysfs_init);
+subsys_initcall(param_sysfs_init);
 
 EXPORT_SYMBOL(param_set_byte);
 EXPORT_SYMBOL(param_get_byte);
index d38d9ec3276c3069c1259744496e9d2a05fef117..479b16b44f79f6b639683c724405f51b3ecc156f 100644 (file)
@@ -1393,24 +1393,12 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
        }
 }
 
-static long posix_cpu_clock_nanosleep_restart(struct restart_block *);
-
-int posix_cpu_nsleep(const clockid_t which_clock, int flags,
-                    struct timespec *rqtp, struct timespec __user *rmtp)
+static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
+                           struct timespec *rqtp, struct itimerspec *it)
 {
-       struct restart_block *restart_block =
-           &current_thread_info()->restart_block;
        struct k_itimer timer;
        int error;
 
-       /*
-        * Diagnose required errors first.
-        */
-       if (CPUCLOCK_PERTHREAD(which_clock) &&
-           (CPUCLOCK_PID(which_clock) == 0 ||
-            CPUCLOCK_PID(which_clock) == current->pid))
-               return -EINVAL;
-
        /*
         * Set up a temporary timer and then wait for it to go off.
         */
@@ -1422,11 +1410,12 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
        timer.it_process = current;
        if (!error) {
                static struct itimerspec zero_it;
-               struct itimerspec it = { .it_value = *rqtp,
-                                        .it_interval = {} };
+
+               memset(it, 0, sizeof *it);
+               it->it_value = *rqtp;
 
                spin_lock_irq(&timer.it_lock);
-               error = posix_cpu_timer_set(&timer, flags, &it, NULL);
+               error = posix_cpu_timer_set(&timer, flags, it, NULL);
                if (error) {
                        spin_unlock_irq(&timer.it_lock);
                        return error;
@@ -1454,49 +1443,89 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
                 * We were interrupted by a signal.
                 */
                sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp);
-               posix_cpu_timer_set(&timer, 0, &zero_it, &it);
+               posix_cpu_timer_set(&timer, 0, &zero_it, it);
                spin_unlock_irq(&timer.it_lock);
 
-               if ((it.it_value.tv_sec | it.it_value.tv_nsec) == 0) {
+               if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) {
                        /*
                         * It actually did fire already.
                         */
                        return 0;
                }
 
+               error = -ERESTART_RESTARTBLOCK;
+       }
+
+       return error;
+}
+
+int posix_cpu_nsleep(const clockid_t which_clock, int flags,
+                    struct timespec *rqtp, struct timespec __user *rmtp)
+{
+       struct restart_block *restart_block =
+           &current_thread_info()->restart_block;
+       struct itimerspec it;
+       int error;
+
+       /*
+        * Diagnose required errors first.
+        */
+       if (CPUCLOCK_PERTHREAD(which_clock) &&
+           (CPUCLOCK_PID(which_clock) == 0 ||
+            CPUCLOCK_PID(which_clock) == current->pid))
+               return -EINVAL;
+
+       error = do_cpu_nanosleep(which_clock, flags, rqtp, &it);
+
+       if (error == -ERESTART_RESTARTBLOCK) {
+
+               if (flags & TIMER_ABSTIME)
+                       return -ERESTARTNOHAND;
                /*
-                * Report back to the user the time still remaining.
-                */
-               if (rmtp != NULL && !(flags & TIMER_ABSTIME) &&
-                   copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
+                * Report back to the user the time still remaining.
+                */
+               if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
                        return -EFAULT;
 
-               restart_block->fn = posix_cpu_clock_nanosleep_restart;
-               /* Caller already set restart_block->arg1 */
+               restart_block->fn = posix_cpu_nsleep_restart;
                restart_block->arg0 = which_clock;
                restart_block->arg1 = (unsigned long) rmtp;
                restart_block->arg2 = rqtp->tv_sec;
                restart_block->arg3 = rqtp->tv_nsec;
-
-               error = -ERESTART_RESTARTBLOCK;
        }
-
        return error;
 }
 
-static long
-posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block)
+long posix_cpu_nsleep_restart(struct restart_block *restart_block)
 {
        clockid_t which_clock = restart_block->arg0;
        struct timespec __user *rmtp;
        struct timespec t;
+       struct itimerspec it;
+       int error;
 
        rmtp = (struct timespec __user *) restart_block->arg1;
        t.tv_sec = restart_block->arg2;
        t.tv_nsec = restart_block->arg3;
 
        restart_block->fn = do_no_restart_syscall;
-       return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t, rmtp);
+       error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it);
+
+       if (error == -ERESTART_RESTARTBLOCK) {
+               /*
+                * Report back to the user the time still remaining.
+                */
+               if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
+                       return -EFAULT;
+
+               restart_block->fn = posix_cpu_nsleep_restart;
+               restart_block->arg0 = which_clock;
+               restart_block->arg1 = (unsigned long) rmtp;
+               restart_block->arg2 = t.tv_sec;
+               restart_block->arg3 = t.tv_nsec;
+       }
+       return error;
+
 }
 
 
@@ -1524,6 +1553,10 @@ static int process_cpu_nsleep(const clockid_t which_clock, int flags,
 {
        return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);
 }
+static long process_cpu_nsleep_restart(struct restart_block *restart_block)
+{
+       return -EINVAL;
+}
 static int thread_cpu_clock_getres(const clockid_t which_clock,
                                   struct timespec *tp)
 {
@@ -1544,6 +1577,10 @@ static int thread_cpu_nsleep(const clockid_t which_clock, int flags,
 {
        return -EINVAL;
 }
+static long thread_cpu_nsleep_restart(struct restart_block *restart_block)
+{
+       return -EINVAL;
+}
 
 static __init int init_posix_cpu_timers(void)
 {
@@ -1553,6 +1590,7 @@ static __init int init_posix_cpu_timers(void)
                .clock_set = do_posix_clock_nosettime,
                .timer_create = process_cpu_timer_create,
                .nsleep = process_cpu_nsleep,
+               .nsleep_restart = process_cpu_nsleep_restart,
        };
        struct k_clock thread = {
                .clock_getres = thread_cpu_clock_getres,
@@ -1560,6 +1598,7 @@ static __init int init_posix_cpu_timers(void)
                .clock_set = do_posix_clock_nosettime,
                .timer_create = thread_cpu_timer_create,
                .nsleep = thread_cpu_nsleep,
+               .nsleep_restart = thread_cpu_nsleep_restart,
        };
 
        register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process);
index ac6dc8744429f986f2f6c6b628513b2524316374..e5ebcc1ec3a0f4c612ca4f9db9ead45d07d424ce 100644 (file)
@@ -973,3 +973,24 @@ sys_clock_nanosleep(const clockid_t which_clock, int flags,
        return CLOCK_DISPATCH(which_clock, nsleep,
                              (which_clock, flags, &t, rmtp));
 }
+
+/*
+ * nanosleep_restart for monotonic and realtime clocks
+ */
+static int common_nsleep_restart(struct restart_block *restart_block)
+{
+       return hrtimer_nanosleep_restart(restart_block);
+}
+
+/*
+ * This will restart clock_nanosleep. This is required only by
+ * compat_clock_nanosleep_restart for now.
+ */
+long
+clock_nanosleep_restart(struct restart_block *restart_block)
+{
+       clockid_t which_clock = restart_block->arg0;
+
+       return CLOCK_DISPATCH(which_clock, nsleep_restart,
+                             (restart_block));
+}
index 8aad0331d82eae17482a37056c0368a8e6274661..4d50e06fd745cf28fc940252d856b51d1b372110 100644 (file)
@@ -440,6 +440,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
        child = find_task_by_pid(pid);
        if (child)
                get_task_struct(child);
+
        read_unlock(&tasklist_lock);
        if (!child)
                return ERR_PTR(-ESRCH);
index 4d1c3d2471278ebe93e00d7291eb253e83f7d89a..4f2c4272d59c91bda58823e8f6e04e121c85458d 100644 (file)
@@ -192,13 +192,13 @@ static struct rcu_torture_ops *cur_ops = NULL;
  * Definitions for rcu torture testing.
  */
 
-static int rcu_torture_read_lock(void)
+static int rcu_torture_read_lock(void) __acquires(RCU)
 {
        rcu_read_lock();
        return 0;
 }
 
-static void rcu_torture_read_unlock(int idx)
+static void rcu_torture_read_unlock(int idx) __releases(RCU)
 {
        rcu_read_unlock();
 }
@@ -250,13 +250,13 @@ static struct rcu_torture_ops rcu_ops = {
  * Definitions for rcu_bh torture testing.
  */
 
-static int rcu_bh_torture_read_lock(void)
+static int rcu_bh_torture_read_lock(void) __acquires(RCU_BH)
 {
        rcu_read_lock_bh();
        return 0;
 }
 
-static void rcu_bh_torture_read_unlock(int idx)
+static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)
 {
        rcu_read_unlock_bh();
 }
index 85786ff2a4f9b1a9f79ecedb646c316a56a292e6..1d63ecddfa7018cd4a14f8b6dc24c352a9ddc447 100644 (file)
@@ -95,7 +95,7 @@ int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
  *     @buf: the buffer struct
  *     @size: total size of the buffer
  *
- *     Returns a pointer to the resulting buffer, NULL if unsuccessful. The
+ *     Returns a pointer to the resulting buffer, %NULL if unsuccessful. The
  *     passed in size will get page aligned, if it isn't already.
  */
 static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)
@@ -132,10 +132,9 @@ depopulate:
 
 /**
  *     relay_create_buf - allocate and initialize a channel buffer
- *     @alloc_size: size of the buffer to allocate
- *     @n_subbufs: number of sub-buffers in the channel
+ *     @chan: the relay channel
  *
- *     Returns channel buffer if successful, NULL otherwise
+ *     Returns channel buffer if successful, %NULL otherwise.
  */
 struct rchan_buf *relay_create_buf(struct rchan *chan)
 {
@@ -163,6 +162,7 @@ free_buf:
 
 /**
  *     relay_destroy_channel - free the channel struct
+ *     @kref: target kernel reference that contains the relay channel
  *
  *     Should only be called from kref_put().
  */
@@ -194,6 +194,7 @@ void relay_destroy_buf(struct rchan_buf *buf)
 
 /**
  *     relay_remove_buf - remove a channel buffer
+ *     @kref: target kernel reference that contains the relay buffer
  *
  *     Removes the file from the fileystem, which also frees the
  *     rchan_buf_struct and the channel buffer.  Should only be called from
@@ -374,7 +375,7 @@ void relay_reset(struct rchan *chan)
 }
 EXPORT_SYMBOL_GPL(relay_reset);
 
-/**
+/*
  *     relay_open_buf - create a new relay channel buffer
  *
  *     Internal - used by relay_open().
@@ -448,12 +449,12 @@ static inline void setup_callbacks(struct rchan *chan,
 /**
  *     relay_open - create a new relay channel
  *     @base_filename: base name of files to create
- *     @parent: dentry of parent directory, NULL for root directory
+ *     @parent: dentry of parent directory, %NULL for root directory
  *     @subbuf_size: size of sub-buffers
  *     @n_subbufs: number of sub-buffers
  *     @cb: client callback functions
  *
- *     Returns channel pointer if successful, NULL otherwise.
+ *     Returns channel pointer if successful, %NULL otherwise.
  *
  *     Creates a channel buffer for each cpu using the sizes and
  *     attributes specified.  The created channel buffer files
@@ -585,7 +586,7 @@ EXPORT_SYMBOL_GPL(relay_switch_subbuf);
  *     subbufs_consumed should be the number of sub-buffers newly consumed,
  *     not the total consumed.
  *
- *     NOTE: kernel clients don't need to call this function if the channel
+ *     NOTE: Kernel clients don't need to call this function if the channel
  *     mode is 'overwrite'.
  */
 void relay_subbufs_consumed(struct rchan *chan,
@@ -641,7 +642,7 @@ EXPORT_SYMBOL_GPL(relay_close);
  *     relay_flush - close the channel
  *     @chan: the channel
  *
- *     Flushes all channel buffers i.e. forces buffer switch.
+ *     Flushes all channel buffers, i.e. forces buffer switch.
  */
 void relay_flush(struct rchan *chan)
 {
@@ -729,7 +730,7 @@ static int relay_file_release(struct inode *inode, struct file *filp)
        return 0;
 }
 
-/**
+/*
  *     relay_file_read_consume - update the consumed count for the buffer
  */
 static void relay_file_read_consume(struct rchan_buf *buf,
@@ -756,7 +757,7 @@ static void relay_file_read_consume(struct rchan_buf *buf,
        }
 }
 
-/**
+/*
  *     relay_file_read_avail - boolean, are there unconsumed bytes available?
  */
 static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
@@ -793,6 +794,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
 
 /**
  *     relay_file_read_subbuf_avail - return bytes available in sub-buffer
+ *     @read_pos: file read position
+ *     @buf: relay channel buffer
  */
 static size_t relay_file_read_subbuf_avail(size_t read_pos,
                                           struct rchan_buf *buf)
@@ -818,6 +821,8 @@ static size_t relay_file_read_subbuf_avail(size_t read_pos,
 
 /**
  *     relay_file_read_start_pos - find the first available byte to read
+ *     @read_pos: file read position
+ *     @buf: relay channel buffer
  *
  *     If the read_pos is in the middle of padding, return the
  *     position of the first actually available byte, otherwise
@@ -844,6 +849,9 @@ static size_t relay_file_read_start_pos(size_t read_pos,
 
 /**
  *     relay_file_read_end_pos - return the new read position
+ *     @read_pos: file read position
+ *     @buf: relay channel buffer
+ *     @count: number of bytes to be read
  */
 static size_t relay_file_read_end_pos(struct rchan_buf *buf,
                                      size_t read_pos,
@@ -865,7 +873,7 @@ static size_t relay_file_read_end_pos(struct rchan_buf *buf,
        return end_pos;
 }
 
-/**
+/*
  *     subbuf_read_actor - read up to one subbuf's worth of data
  */
 static int subbuf_read_actor(size_t read_start,
@@ -890,7 +898,7 @@ static int subbuf_read_actor(size_t read_start,
        return ret;
 }
 
-/**
+/*
  *     subbuf_send_actor - send up to one subbuf's worth of data
  */
 static int subbuf_send_actor(size_t read_start,
@@ -933,7 +941,7 @@ typedef int (*subbuf_actor_t) (size_t read_start,
                               read_descriptor_t *desc,
                               read_actor_t actor);
 
-/**
+/*
  *     relay_file_read_subbufs - read count bytes, bridging subbuf boundaries
  */
 static inline ssize_t relay_file_read_subbufs(struct file *filp,
index 3e13a1e5856fecf8a06eab48372d12a01efb428b..4ab17da46fd80de1690744f9022691923942cb70 100644 (file)
@@ -251,6 +251,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 
        /* Grab the next task */
        task = rt_mutex_owner(lock);
+       get_task_struct(task);
        spin_lock_irqsave(&task->pi_lock, flags);
 
        if (waiter == rt_mutex_top_waiter(lock)) {
@@ -269,7 +270,6 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
                __rt_mutex_adjust_prio(task);
        }
 
-       get_task_struct(task);
        spin_unlock_irqrestore(&task->pi_lock, flags);
 
        top_waiter = rt_mutex_top_waiter(lock);
@@ -409,7 +409,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
        struct task_struct *owner = rt_mutex_owner(lock);
        struct rt_mutex_waiter *top_waiter = waiter;
        unsigned long flags;
-       int boost = 0, res;
+       int chain_walk = 0, res;
 
        spin_lock_irqsave(&current->pi_lock, flags);
        __rt_mutex_adjust_prio(current);
@@ -433,25 +433,23 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
                plist_add(&waiter->pi_list_entry, &owner->pi_waiters);
 
                __rt_mutex_adjust_prio(owner);
-               if (owner->pi_blocked_on) {
-                       boost = 1;
-                       /* gets dropped in rt_mutex_adjust_prio_chain()! */
-                       get_task_struct(owner);
-               }
-               spin_unlock_irqrestore(&owner->pi_lock, flags);
-       }
-       else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) {
-               spin_lock_irqsave(&owner->pi_lock, flags);
-               if (owner->pi_blocked_on) {
-                       boost = 1;
-                       /* gets dropped in rt_mutex_adjust_prio_chain()! */
-                       get_task_struct(owner);
-               }
+               if (owner->pi_blocked_on)
+                       chain_walk = 1;
                spin_unlock_irqrestore(&owner->pi_lock, flags);
        }
-       if (!boost)
+       else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock))
+               chain_walk = 1;
+
+       if (!chain_walk)
                return 0;
 
+       /*
+        * The owner can't disappear while holding a lock,
+        * so the owner struct is protected by wait_lock.
+        * Gets dropped in rt_mutex_adjust_prio_chain()!
+        */
+       get_task_struct(owner);
+
        spin_unlock(&lock->wait_lock);
 
        res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter,
@@ -532,7 +530,7 @@ static void remove_waiter(struct rt_mutex *lock,
        int first = (waiter == rt_mutex_top_waiter(lock));
        struct task_struct *owner = rt_mutex_owner(lock);
        unsigned long flags;
-       int boost = 0;
+       int chain_walk = 0;
 
        spin_lock_irqsave(&current->pi_lock, flags);
        plist_del(&waiter->list_entry, &lock->wait_list);
@@ -554,19 +552,20 @@ static void remove_waiter(struct rt_mutex *lock,
                }
                __rt_mutex_adjust_prio(owner);
 
-               if (owner->pi_blocked_on) {
-                       boost = 1;
-                       /* gets dropped in rt_mutex_adjust_prio_chain()! */
-                       get_task_struct(owner);
-               }
+               if (owner->pi_blocked_on)
+                       chain_walk = 1;
+
                spin_unlock_irqrestore(&owner->pi_lock, flags);
        }
 
        WARN_ON(!plist_node_empty(&waiter->pi_list_entry));
 
-       if (!boost)
+       if (!chain_walk)
                return;
 
+       /* gets dropped in rt_mutex_adjust_prio_chain()! */
+       get_task_struct(owner);
+
        spin_unlock(&lock->wait_lock);
 
        rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current);
@@ -592,10 +591,10 @@ void rt_mutex_adjust_pi(struct task_struct *task)
                return;
        }
 
-       /* gets dropped in rt_mutex_adjust_prio_chain()! */
-       get_task_struct(task);
        spin_unlock_irqrestore(&task->pi_lock, flags);
 
+       /* gets dropped in rt_mutex_adjust_prio_chain()! */
+       get_task_struct(task);
        rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task);
 }
 
index 5c848fd4e461c67bded9c27b81405889a80cd656..74f169ac0773cd2ac3eeac0bfbb3c3a631d70c65 100644 (file)
@@ -1755,27 +1755,27 @@ static inline void finish_task_switch(struct rq *rq, struct task_struct *prev)
        __releases(rq->lock)
 {
        struct mm_struct *mm = rq->prev_mm;
-       unsigned long prev_task_flags;
+       long prev_state;
 
        rq->prev_mm = NULL;
 
        /*
         * A task struct has one reference for the use as "current".
-        * If a task dies, then it sets EXIT_ZOMBIE in tsk->exit_state and
-        * calls schedule one last time. The schedule call will never return,
-        * and the scheduled task must drop that reference.
-        * The test for EXIT_ZOMBIE must occur while the runqueue locks are
+        * If a task dies, then it sets TASK_DEAD in tsk->state and calls
+        * schedule one last time. The schedule call will never return, and
+        * the scheduled task must drop that reference.
+        * The test for TASK_DEAD must occur while the runqueue locks are
         * still held, otherwise prev could be scheduled on another cpu, die
         * there before we look at prev->state, and then the reference would
         * be dropped twice.
         *              Manfred Spraul <manfred@colorfullife.com>
         */
-       prev_task_flags = prev->flags;
+       prev_state = prev->state;
        finish_arch_switch(prev);
        finish_lock_switch(rq, prev);
        if (mm)
                mmdrop(mm);
-       if (unlikely(prev_task_flags & PF_DEAD)) {
+       if (unlikely(prev_state == TASK_DEAD)) {
                /*
                 * Remove function-return probe instances associated with this
                 * task and put them back on the free list.
@@ -3348,9 +3348,6 @@ need_resched_nonpreemptible:
 
        spin_lock_irq(&rq->lock);
 
-       if (unlikely(prev->flags & PF_DEAD))
-               prev->state = EXIT_DEAD;
-
        switch_count = &prev->nivcsw;
        if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
                switch_count = &prev->nvcsw;
@@ -4080,6 +4077,8 @@ static void __setscheduler(struct task_struct *p, int policy, int prio)
  * @p: the task in question.
  * @policy: new policy.
  * @param: structure containing the new RT priority.
+ *
+ * NOTE: the task may be already dead
  */
 int sched_setscheduler(struct task_struct *p, int policy,
                       struct sched_param *param)
@@ -4107,28 +4106,32 @@ recheck:
            (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
            (!p->mm && param->sched_priority > MAX_RT_PRIO-1))
                return -EINVAL;
-       if ((policy == SCHED_NORMAL || policy == SCHED_BATCH)
-                                       != (param->sched_priority == 0))
+       if (is_rt_policy(policy) != (param->sched_priority != 0))
                return -EINVAL;
 
        /*
         * Allow unprivileged RT tasks to decrease priority:
         */
        if (!capable(CAP_SYS_NICE)) {
-               /*
-                * can't change policy, except between SCHED_NORMAL
-                * and SCHED_BATCH:
-                */
-               if (((policy != SCHED_NORMAL && p->policy != SCHED_BATCH) &&
-                       (policy != SCHED_BATCH && p->policy != SCHED_NORMAL)) &&
-                               !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
-                       return -EPERM;
-               /* can't increase priority */
-               if ((policy != SCHED_NORMAL && policy != SCHED_BATCH) &&
-                   param->sched_priority > p->rt_priority &&
-                   param->sched_priority >
-                               p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
-                       return -EPERM;
+               if (is_rt_policy(policy)) {
+                       unsigned long rlim_rtprio;
+                       unsigned long flags;
+
+                       if (!lock_task_sighand(p, &flags))
+                               return -ESRCH;
+                       rlim_rtprio = p->signal->rlim[RLIMIT_RTPRIO].rlim_cur;
+                       unlock_task_sighand(p, &flags);
+
+                       /* can't set/change the rt policy */
+                       if (policy != p->policy && !rlim_rtprio)
+                               return -EPERM;
+
+                       /* can't increase priority */
+                       if (param->sched_priority > p->rt_priority &&
+                           param->sched_priority > rlim_rtprio)
+                               return -EPERM;
+               }
+
                /* can't change other user's priorities */
                if ((current->euid != p->euid) &&
                    (current->euid != p->uid))
@@ -4193,14 +4196,13 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
                return -EINVAL;
        if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
                return -EFAULT;
-       read_lock_irq(&tasklist_lock);
+
+       rcu_read_lock();
+       retval = -ESRCH;
        p = find_process_by_pid(pid);
-       if (!p) {
-               read_unlock_irq(&tasklist_lock);
-               return -ESRCH;
-       }
-       retval = sched_setscheduler(p, policy, &lparam);
-       read_unlock_irq(&tasklist_lock);
+       if (p != NULL)
+               retval = sched_setscheduler(p, policy, &lparam);
+       rcu_read_unlock();
 
        return retval;
 }
@@ -5151,7 +5153,7 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p)
        BUG_ON(p->exit_state != EXIT_ZOMBIE && p->exit_state != EXIT_DEAD);
 
        /* Cannot have done final schedule yet: would have vanished. */
-       BUG_ON(p->flags & PF_DEAD);
+       BUG_ON(p->state == TASK_DEAD);
 
        get_task_struct(p);
 
@@ -5272,9 +5274,11 @@ static struct notifier_block __cpuinitdata migration_notifier = {
 int __init migration_init(void)
 {
        void *cpu = (void *)(long)smp_processor_id();
+       int err;
 
        /* Start one for the boot CPU: */
-       migration_call(&migration_notifier, CPU_UP_PREPARE, cpu);
+       err = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu);
+       BUG_ON(err == NOTIFY_BAD);
        migration_call(&migration_notifier, CPU_ONLINE, cpu);
        register_cpu_notifier(&migration_notifier);
 
index 05853a7337e3268be684ae2f53248b6e9fc75e56..fb5da6d19f14eef721f28750307c9654f17a8bfa 100644 (file)
@@ -417,9 +417,8 @@ static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
                        siginfo_t *info)
 {
-       int sig = 0;
+       int sig = next_signal(pending, mask);
 
-       sig = next_signal(pending, mask);
        if (sig) {
                if (current->notifier) {
                        if (sigismember(current->notifier_mask, sig)) {
@@ -432,9 +431,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
 
                if (!collect_signal(sig, pending, info))
                        sig = 0;
-                               
        }
-       recalc_sigpending();
 
        return sig;
 }
@@ -451,6 +448,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
        if (!signr)
                signr = __dequeue_signal(&tsk->signal->shared_pending,
                                         mask, info);
+       recalc_sigpending_tsk(tsk);
        if (signr && unlikely(sig_kernel_stop(signr))) {
                /*
                 * Set a marker that we have dequeued a stop signal.  Our
index 3789ca98197c2a793b25dc6ac403e26202312133..bf25015dce162a541059c051567c3569069985b9 100644 (file)
@@ -612,7 +612,9 @@ static struct notifier_block __cpuinitdata cpu_nfb = {
 __init int spawn_ksoftirqd(void)
 {
        void *cpu = (void *)(long)smp_processor_id();
-       cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
+       int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
+
+       BUG_ON(err == NOTIFY_BAD);
        cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
        register_cpu_notifier(&cpu_nfb);
        return 0;
index 03e6a2b0b787a97f426887f6ecdf709951acaced..50afeb813305d76435e8c6852a80b5b9dc5c8cd9 100644 (file)
@@ -149,8 +149,9 @@ static struct notifier_block __cpuinitdata cpu_nfb = {
 __init void spawn_softlockup_task(void)
 {
        void *cpu = (void *)(long)smp_processor_id();
+       int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
 
-       cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
+       BUG_ON(err == NOTIFY_BAD);
        cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
        register_cpu_notifier(&cpu_nfb);
 
index 9644a41e0bef60fd40773976705c6529b49c45d1..d48143eafbfde6388717e67c1c3b74011ea8a747 100644 (file)
 #include <linux/debug_locks.h>
 #include <linux/module.h>
 
-/*
- * Generic declaration of the raw read_trylock() function,
- * architectures are supposed to optimize this:
- */
-int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock)
-{
-       __raw_read_lock(lock);
-       return 1;
-}
-EXPORT_SYMBOL(generic__raw_read_trylock);
-
 int __lockfunc _spin_trylock(spinlock_t *lock)
 {
        preempt_disable();
index 51cacd111dbd8412c35a1d9578cfb3d7eaf86c6a..12458040e66500aec1040b91448c458972d08d69 100644 (file)
@@ -1,3 +1,6 @@
+/* Copyright 2005 Rusty Russell rusty@rustcorp.com.au IBM Corporation.
+ * GPL v2 and any later version.
+ */
 #include <linux/stop_machine.h>
 #include <linux/kthread.h>
 #include <linux/sched.h>
index 3f894775488dd7fb62907d149d0d1959b67de049..8647061c084a6d67b6a484b5287656306f52049b 100644 (file)
@@ -612,7 +612,6 @@ void kernel_restart(char *cmd)
        } else {
                printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
        }
-       printk(".\n");
        machine_restart(cmd);
 }
 EXPORT_SYMBOL_GPL(kernel_restart);
index 8bfa7d117c54fb8ef2b0e5e458caf3303e17b366..9535a38399307130b0a1f5728fbfece8333d3d93 100644 (file)
@@ -1915,7 +1915,7 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
                return -EPERM;
        }
 
-       op = (current->pid == 1) ? OP_SET : OP_AND;
+       op = is_init(current) ? OP_SET : OP_AND;
        return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
                                do_proc_dointvec_bset_conv,&op);
 }
index 1d7dd6267c2de52206bb2f09ca981ff81db4b1a1..4f55622b0d38462ad59b28322d31ebeee8a0c40c 100644 (file)
@@ -136,7 +136,7 @@ static void internal_add_timer(tvec_base_t *base, struct timer_list *timer)
        list_add_tail(&timer->entry, vec);
 }
 
-/***
+/**
  * init_timer - initialize a timer.
  * @timer: the timer to be initialized
  *
@@ -175,6 +175,7 @@ static inline void detach_timer(struct timer_list *timer,
  */
 static tvec_base_t *lock_timer_base(struct timer_list *timer,
                                        unsigned long *flags)
+       __acquires(timer->base->lock)
 {
        tvec_base_t *base;
 
@@ -235,7 +236,7 @@ int __mod_timer(struct timer_list *timer, unsigned long expires)
 
 EXPORT_SYMBOL(__mod_timer);
 
-/***
+/**
  * add_timer_on - start a timer on a particular CPU
  * @timer: the timer to be added
  * @cpu: the CPU to start it on
@@ -255,9 +256,10 @@ void add_timer_on(struct timer_list *timer, int cpu)
 }
 
 
-/***
+/**
  * mod_timer - modify a timer's timeout
  * @timer: the timer to be modified
+ * @expires: new timeout in jiffies
  *
  * mod_timer is a more efficient way to update the expire field of an
  * active timer (if the timer is inactive it will be activated)
@@ -291,7 +293,7 @@ int mod_timer(struct timer_list *timer, unsigned long expires)
 
 EXPORT_SYMBOL(mod_timer);
 
-/***
+/**
  * del_timer - deactive a timer.
  * @timer: the timer to be deactivated
  *
@@ -323,7 +325,10 @@ int del_timer(struct timer_list *timer)
 EXPORT_SYMBOL(del_timer);
 
 #ifdef CONFIG_SMP
-/*
+/**
+ * try_to_del_timer_sync - Try to deactivate a timer
+ * @timer: timer do del
+ *
  * This function tries to deactivate a timer. Upon successful (ret >= 0)
  * exit the timer is not queued and the handler is not running on any CPU.
  *
@@ -351,7 +356,7 @@ out:
        return ret;
 }
 
-/***
+/**
  * del_timer_sync - deactivate a timer and wait for the handler to finish.
  * @timer: the timer to be deactivated
  *
@@ -401,15 +406,15 @@ static int cascade(tvec_base_t *base, tvec_t *tv, int index)
        return index;
 }
 
-/***
+#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
+
+/**
  * __run_timers - run all expired timers (if any) on this CPU.
  * @base: the timer vector to be processed.
  *
  * This function cascades all vectors and executes all expired timer
  * vectors.
  */
-#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
-
 static inline void __run_timers(tvec_base_t *base)
 {
        struct timer_list *timer;
@@ -970,7 +975,7 @@ void __init timekeeping_init(void)
 
 
 static int timekeeping_suspended;
-/*
+/**
  * timekeeping_resume - Resumes the generic timekeeping subsystem.
  * @dev:       unused
  *
@@ -1106,7 +1111,7 @@ static void clocksource_adjust(struct clocksource *clock, s64 offset)
        clock->error -= (interval - offset) << (TICK_LENGTH_SHIFT - clock->shift);
 }
 
-/*
+/**
  * update_wall_time - Uses the current clocksource to increment the wall time
  *
  * Called from the timer interrupt, must hold a write on xtime_lock.
@@ -1217,10 +1222,8 @@ static inline void calc_load(unsigned long ticks)
        unsigned long active_tasks; /* fixed-point */
        static int count = LOAD_FREQ;
 
-       count -= ticks;
-       if (count < 0) {
-               count += LOAD_FREQ;
-               active_tasks = count_active_tasks();
+       active_tasks = count_active_tasks();
+       for (count -= ticks; count < 0; count += LOAD_FREQ) {
                CALC_LOAD(avenrun[0], EXP_1, active_tasks);
                CALC_LOAD(avenrun[1], EXP_5, active_tasks);
                CALC_LOAD(avenrun[2], EXP_15, active_tasks);
@@ -1265,11 +1268,8 @@ void run_local_timers(void)
  * Called by the timer interrupt. xtime_lock must already be taken
  * by the timer IRQ!
  */
-static inline void update_times(void)
+static inline void update_times(unsigned long ticks)
 {
-       unsigned long ticks;
-
-       ticks = jiffies - wall_jiffies;
        wall_jiffies += ticks;
        update_wall_time();
        calc_load(ticks);
@@ -1281,12 +1281,10 @@ static inline void update_times(void)
  * jiffies is defined in the linker script...
  */
 
-void do_timer(struct pt_regs *regs)
+void do_timer(unsigned long ticks)
 {
-       jiffies_64++;
-       /* prevent loading jiffies before storing new jiffies_64 value. */
-       barrier();
-       update_times();
+       jiffies_64 += ticks;
+       update_times(ticks);
 }
 
 #ifdef __ARCH_WANT_SYS_ALARM
@@ -1470,8 +1468,9 @@ asmlinkage long sys_gettid(void)
        return current->pid;
 }
 
-/*
+/**
  * sys_sysinfo - fill in sysinfo struct
+ * @info: pointer to buffer to fill
  */ 
 asmlinkage long sys_sysinfo(struct sysinfo __user *info)
 {
@@ -1688,8 +1687,10 @@ static struct notifier_block __cpuinitdata timers_nb = {
 
 void __init init_timers(void)
 {
-       timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
+       int err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
                                (void *)(long)smp_processor_id());
+
+       BUG_ON(err == NOTIFY_BAD);
        register_cpu_notifier(&timers_nb);
        open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
 }
index 3430475fcd886d011c01370a558e0a5965dd950d..2e2368607aab1a8293739315d832c608463d8d5f 100644 (file)
@@ -102,7 +102,7 @@ static struct unwind_table {
        unsigned long size;
        struct unwind_table *link;
        const char *name;
-} root_table, *last_table;
+} root_table;
 
 struct unwind_item {
        enum item_location {
@@ -174,6 +174,8 @@ void __init unwind_init(void)
 
 #ifdef CONFIG_MODULES
 
+static struct unwind_table *last_table;
+
 /* Must be called with module_mutex held. */
 void *unwind_add_table(struct module *module,
                        const void *table_start,
index b0f5ca72599fee5f4ed868457a85c39b5f6e57ef..f9ae75cc014566b95609983b803e0ef6282723f8 100644 (file)
@@ -320,6 +320,15 @@ config DEBUG_VM
 
          If unsure, say N.
 
+config DEBUG_LIST
+       bool "Debug linked list manipulation"
+       depends on DEBUG_KERNEL
+       help
+         Enable this to turn on extended checks in the linked-list
+         walking routines.
+
+         If unsure, say N.
+
 config FRAME_POINTER
        bool "Compile the kernel with frame pointers"
        depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH)
index ef1d37afbbb66df24e3b60ccb304c063abe981f1..402762fead70f6b8e8384b84d85f89d70e7d63f1 100644 (file)
@@ -28,6 +28,7 @@ lib-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
 obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
 obj-$(CONFIG_PLIST) += plist.o
 obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
+obj-$(CONFIG_DEBUG_LIST) += list_debug.o
 
 ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
   lib-y += dec_and_lock.o
diff --git a/lib/list_debug.c b/lib/list_debug.c
new file mode 100644 (file)
index 0000000..e80d27c
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006, Red Hat, Inc., Dave Jones
+ * Released under the General Public License (GPL).
+ *
+ * This file contains the linked list implementations for
+ * DEBUG_LIST.
+ */
+
+#include <linux/module.h>
+#include <linux/list.h>
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+
+void __list_add(struct list_head *new,
+                             struct list_head *prev,
+                             struct list_head *next)
+{
+       if (unlikely(next->prev != prev)) {
+               printk(KERN_ERR "list_add corruption. next->prev should be %p, but was %p\n",
+                       prev, next->prev);
+               BUG();
+       }
+       if (unlikely(prev->next != next)) {
+               printk(KERN_ERR "list_add corruption. prev->next should be %p, but was %p\n",
+                       next, prev->next);
+               BUG();
+       }
+       next->prev = new;
+       new->next = next;
+       new->prev = prev;
+       prev->next = new;
+}
+EXPORT_SYMBOL(__list_add);
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+void list_add(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head, head->next);
+}
+EXPORT_SYMBOL(list_add);
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+void list_del(struct list_head *entry)
+{
+       BUG_ON(entry->prev->next != entry);
+       BUG_ON(entry->next->prev != entry);
+
+       if (unlikely(entry->prev->next != entry)) {
+               printk(KERN_ERR "list_del corruption. prev->next should be %p, "
+                               "but was %p\n", entry, entry->prev->next);
+               BUG();
+       }
+       if (unlikely(entry->next->prev != entry)) {
+               printk(KERN_ERR "list_del corruption. next->prev should be %p, "
+                               "but was %p\n", entry, entry->next->prev);
+               BUG();
+       }
+       __list_del(entry->prev, entry->next);
+       entry->next = LIST_POISON1;
+       entry->prev = LIST_POISON2;
+}
+EXPORT_SYMBOL(list_del);
index b322421c2969f1e3046313e91dcd3a07aa3fca9a..901d0e7da89220fae47848d349633ae43c1afd7e 100644 (file)
@@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
 /*
  * wait for a lock to be granted
  */
-static inline struct rw_semaphore *
+static struct rw_semaphore *
 rwsem_down_failed_common(struct rw_semaphore *sem,
                        struct rwsem_waiter *waiter, signed long adjustment)
 {
index 58c577dd82e5240e551d151b73ea31c55de8c309..dafaf1de2491aedb0a323aed4951e5084e58e18c 100644 (file)
@@ -99,11 +99,12 @@ static inline void debug_spin_unlock(spinlock_t *lock)
 
 static void __spin_lock_debug(spinlock_t *lock)
 {
-       int print_once = 1;
        u64 i;
+       u64 loops = loops_per_jiffy * HZ;
+       int print_once = 1;
 
        for (;;) {
-               for (i = 0; i < loops_per_jiffy * HZ; i++) {
+               for (i = 0; i < loops; i++) {
                        if (__raw_spin_trylock(&lock->raw_lock))
                                return;
                        __delay(1);
@@ -165,11 +166,12 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
 #if 0          /* __write_lock_debug() can lock up - maybe this can too? */
 static void __read_lock_debug(rwlock_t *lock)
 {
-       int print_once = 1;
        u64 i;
+       u64 loops = loops_per_jiffy * HZ;
+       int print_once = 1;
 
        for (;;) {
-               for (i = 0; i < loops_per_jiffy * HZ; i++) {
+               for (i = 0; i < loops; i++) {
                        if (__raw_read_trylock(&lock->raw_lock))
                                return;
                        __delay(1);
@@ -239,11 +241,12 @@ static inline void debug_write_unlock(rwlock_t *lock)
 #if 0          /* This can cause lockups */
 static void __write_lock_debug(rwlock_t *lock)
 {
-       int print_once = 1;
        u64 i;
+       u64 loops = loops_per_jiffy * HZ;
+       int print_once = 1;
 
        for (;;) {
-               for (i = 0; i < loops_per_jiffy * HZ; i++) {
+               for (i = 0; i < loops; i++) {
                        if (__raw_write_trylock(&lock->raw_lock))
                                return;
                        __delay(1);
index 87847c2ae9e28d9330c28df80dbef75ad99206b4..af575b61526b97749c31bb65221af72eb457353c 100644 (file)
  *
  *   A finite state machine consists of n states (struct ts_fsm_token)
  *   representing the pattern as a finite automation. The data is read
- *   sequentially on a octet basis. Every state token specifies the number
+ *   sequentially on an octet basis. Every state token specifies the number
  *   of recurrences and the type of value accepted which can be either a
  *   specific character or ctype based set of characters. The available
  *   type of recurrences include 1, (0|1), [0 n], and [1 n].
  *
- *   The algorithm differs between strict/non-strict mode specyfing
- *   whether the pattern has to start at the first octect. Strict mode
+ *   The algorithm differs between strict/non-strict mode specifying
+ *   whether the pattern has to start at the first octet. Strict mode
  *   is enabled by default and can be disabled by inserting
  *   TS_FSM_HEAD_IGNORE as the first token in the chain.
  *
@@ -44,7 +44,7 @@ struct ts_fsm
 #define _W             0x200 /* wildcard */
 
 /* Map to _ctype flags and some magic numbers */
-static u16 token_map[TS_FSM_TYPE_MAX+1] = {
+static const u16 token_map[TS_FSM_TYPE_MAX+1] = {
        [TS_FSM_SPECIFIC] = 0,
        [TS_FSM_WILDCARD] = _W,
        [TS_FSM_CNTRL]    = _C,
@@ -61,7 +61,7 @@ static u16 token_map[TS_FSM_TYPE_MAX+1] = {
        [TS_FSM_ASCII]    = _A,
 };
 
-static u16 token_lookup_tbl[256] = {
+static const u16 token_lookup_tbl[256] = {
 _W|_A|_C,      _W|_A|_C,     _W|_A|_C,     _W|_A|_C,           /*   0-  3 */
 _W|_A|_C,      _W|_A|_C,     _W|_A|_C,     _W|_A|_C,           /*   4-  7 */
 _W|_A|_C,      _W|_A|_C|_S,  _W|_A|_C|_S,  _W|_A|_C|_S,                /*   8- 11 */
index 60c56c0b5e1049218d38bf81df35ae897dbfdc5a..6200c6d6afd20812acd95af4409b2467dd3a1f6f 100644 (file)
@@ -17,6 +17,7 @@ obj-$(CONFIG_HUGETLBFS)       += hugetlb.o
 obj-$(CONFIG_NUMA)     += mempolicy.o
 obj-$(CONFIG_SPARSEMEM)        += sparse.o
 obj-$(CONFIG_SHMEM) += shmem.o
+obj-$(CONFIG_TMPFS_POSIX_ACL) += shmem_acl.o
 obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o
 obj-$(CONFIG_SLOB) += slob.o
 obj-$(CONFIG_SLAB) += slab.o
index afcdc72b5e906658475a8ff47b5e3dcd389c0188..3277f3b2352441eb6d0a5e4d8caf8437bab16460 100644 (file)
@@ -1471,7 +1471,7 @@ outside_data_content:
         * accessible..
         */
        if (area->vm_mm == current->mm)
-               return NULL;
+               return NOPAGE_SIGBUS;
        /* Fall through to the non-read-ahead case */
 no_cached_page:
        /*
@@ -1496,7 +1496,7 @@ no_cached_page:
         */
        if (error == -ENOMEM)
                return NOPAGE_OOM;
-       return NULL;
+       return NOPAGE_SIGBUS;
 
 page_not_uptodate:
        if (!did_readaround) {
@@ -1565,7 +1565,7 @@ page_not_uptodate:
         */
        shrink_readahead_size_eio(file, ra);
        page_cache_release(page);
-       return NULL;
+       return NOPAGE_SIGBUS;
 }
 EXPORT_SYMBOL(filemap_nopage);
 
index 601159a46ab64e538dc1c2cbe710776e3ecb5208..160f5b503eaddeb5880cc0c4ac63c08821074e5c 100644 (file)
@@ -1577,7 +1577,14 @@ gotten:
                entry = mk_pte(new_page, vma->vm_page_prot);
                entry = maybe_mkwrite(pte_mkdirty(entry), vma);
                lazy_mmu_prot_update(entry);
-               ptep_establish(vma, address, page_table, entry);
+               /*
+                * Clear the pte entry and flush it first, before updating the
+                * pte with the new entry. This will avoid a race condition
+                * seen in the presence of one thread doing SMC and another
+                * thread doing COW.
+                */
+               ptep_clear_flush(vma, address, page_table);
+               set_pte_at(mm, address, page_table, entry);
                update_mmu_cache(vma, address, entry);
                lru_cache_add_active(new_page);
                page_add_new_anon_rmap(new_page, vma, address);
index c37319542b700a92339fdfc4427a5fc4d6fa2ee4..2053bb165a21a81d4d32fce38a1cd528981d197d 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/compiler.h>
 #include <linux/module.h>
 #include <linux/pagevec.h>
+#include <linux/writeback.h>
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/cpu.h>
@@ -21,6 +22,7 @@
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
 #include <linux/ioport.h>
+#include <linux/cpuset.h>
 
 #include <asm/tlbflush.h>
 
@@ -191,6 +193,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
        if (need_zonelists_rebuild)
                build_all_zonelists();
        vm_total_pages = nr_free_pagecache_pages();
+       writeback_set_ratelimit();
        return 0;
 }
 
@@ -283,6 +286,8 @@ int add_memory(int nid, u64 start, u64 size)
        /* we online node here. we can't roll back from here. */
        node_set_online(nid);
 
+       cpuset_track_online_nodes();
+
        if (new_pgdat) {
                ret = register_one_node(nid);
                /*
index bada3d03119ff01381d6d47c1b828b59c3867106..20f41b082e16484a8c52aa04272bf4f30359593c 100644 (file)
@@ -204,15 +204,29 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
        do_posix_clock_monotonic_gettime(&uptime);
        do_each_thread(g, p) {
                unsigned long points;
-               int releasing;
 
-               /* skip kernel threads */
+               /*
+                * skip kernel threads and tasks which have already released
+                * their mm.
+                */
                if (!p->mm)
                        continue;
-               /* skip the init task with pid == 1 */
-               if (p->pid == 1)
+               /* skip the init task */
+               if (is_init(p))
                        continue;
 
+               /*
+                * This task already has access to memory reserves and is
+                * being killed. Don't allow any other task access to the
+                * memory reserve.
+                *
+                * Note: this may have a chance of deadlock if it gets
+                * blocked waiting for another task which itself is waiting
+                * for memory. Is there a better alternative?
+                */
+               if (test_tsk_thread_flag(p, TIF_MEMDIE))
+                       return ERR_PTR(-1UL);
+
                /*
                 * This is in the process of releasing memory so wait for it
                 * to finish before killing some other task by mistake.
@@ -221,21 +235,16 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
                 * go ahead if it is exiting: this will simply set TIF_MEMDIE,
                 * which will allow it to gain access to memory reserves in
                 * the process of exiting and releasing its resources.
-                * Otherwise we could get an OOM deadlock.
+                * Otherwise we could get an easy OOM deadlock.
                 */
-               releasing = test_tsk_thread_flag(p, TIF_MEMDIE) ||
-                                               p->flags & PF_EXITING;
-               if (releasing) {
-                       /* PF_DEAD tasks have already released their mm */
-                       if (p->flags & PF_DEAD)
-                               continue;
-                       if (p->flags & PF_EXITING && p == current) {
-                               chosen = p;
-                               *ppoints = ULONG_MAX;
-                               break;
-                       }
-                       return ERR_PTR(-1UL);
+               if (p->flags & PF_EXITING) {
+                       if (p != current)
+                               return ERR_PTR(-1UL);
+
+                       chosen = p;
+                       *ppoints = ULONG_MAX;
                }
+
                if (p->oomkilladj == OOM_DISABLE)
                        continue;
 
@@ -245,6 +254,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
                        *ppoints = points;
                }
        } while_each_thread(g, p);
+
        return chosen;
 }
 
@@ -255,20 +265,17 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
  */
 static void __oom_kill_task(struct task_struct *p, const char *message)
 {
-       if (p->pid == 1) {
+       if (is_init(p)) {
                WARN_ON(1);
                printk(KERN_WARNING "tried to kill init!\n");
                return;
        }
 
-       task_lock(p);
-       if (!p->mm || p->mm == &init_mm) {
+       if (!p->mm) {
                WARN_ON(1);
                printk(KERN_WARNING "tried to kill an mm-less task!\n");
-               task_unlock(p);
                return;
        }
-       task_unlock(p);
 
        if (message) {
                printk(KERN_ERR "%s: Killed process %d (%s).\n",
@@ -302,7 +309,7 @@ static int oom_kill_task(struct task_struct *p, const char *message)
         * However, this is of no concern to us.
         */
 
-       if (mm == NULL || mm == &init_mm)
+       if (mm == NULL)
                return 1;
 
        __oom_kill_task(p, message);
index 555752907dc3111b8fea4f042f5b1440f041f28d..488b7088557c549840b7cf6cf9daba1efc38bd44 100644 (file)
@@ -46,7 +46,6 @@
  */
 static long ratelimit_pages = 32;
 
-static long total_pages;       /* The total number of pages in the machine. */
 static int dirty_exceeded __cacheline_aligned_in_smp;  /* Dirty mem may be over limit */
 
 /*
@@ -126,7 +125,7 @@ get_dirty_limits(long *pbackground, long *pdirty,
        int unmapped_ratio;
        long background;
        long dirty;
-       unsigned long available_memory = total_pages;
+       unsigned long available_memory = vm_total_pages;
        struct task_struct *tsk;
 
 #ifdef CONFIG_HIGHMEM
@@ -141,7 +140,7 @@ get_dirty_limits(long *pbackground, long *pdirty,
 
        unmapped_ratio = 100 - ((global_page_state(NR_FILE_MAPPED) +
                                global_page_state(NR_ANON_PAGES)) * 100) /
-                                       total_pages;
+                                       vm_total_pages;
 
        dirty_ratio = vm_dirty_ratio;
        if (dirty_ratio > unmapped_ratio / 2)
@@ -502,9 +501,9 @@ void laptop_sync_completion(void)
  * will write six megabyte chunks, max.
  */
 
-static void set_ratelimit(void)
+void writeback_set_ratelimit(void)
 {
-       ratelimit_pages = total_pages / (num_online_cpus() * 32);
+       ratelimit_pages = vm_total_pages / (num_online_cpus() * 32);
        if (ratelimit_pages < 16)
                ratelimit_pages = 16;
        if (ratelimit_pages * PAGE_CACHE_SIZE > 4096 * 1024)
@@ -514,7 +513,7 @@ static void set_ratelimit(void)
 static int __cpuinit
 ratelimit_handler(struct notifier_block *self, unsigned long u, void *v)
 {
-       set_ratelimit();
+       writeback_set_ratelimit();
        return 0;
 }
 
@@ -533,9 +532,7 @@ void __init page_writeback_init(void)
        long buffer_pages = nr_free_buffer_pages();
        long correction;
 
-       total_pages = nr_free_pagecache_pages();
-
-       correction = (100 * 4 * buffer_pages) / total_pages;
+       correction = (100 * 4 * buffer_pages) / vm_total_pages;
 
        if (correction < 100) {
                dirty_background_ratio *= correction;
@@ -549,7 +546,7 @@ void __init page_writeback_init(void)
                        vm_dirty_ratio = 1;
        }
        mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
-       set_ratelimit();
+       writeback_set_ratelimit();
        register_cpu_notifier(&ratelimit_nb);
 }
 
index eda907c3a86aa14399e8a30aab95ec8dc8cff88c..b96de69f236b22225c4dcb9221d807808a7c8945 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+#include <linux/xattr.h>
+#include <linux/generic_acl.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
 #include <linux/file.h>
@@ -177,6 +179,7 @@ static const struct address_space_operations shmem_aops;
 static struct file_operations shmem_file_operations;
 static struct inode_operations shmem_inode_operations;
 static struct inode_operations shmem_dir_inode_operations;
+static struct inode_operations shmem_special_inode_operations;
 static struct vm_operations_struct shmem_vm_ops;
 
 static struct backing_dev_info shmem_backing_dev_info  __read_mostly = {
@@ -637,7 +640,7 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
        struct page *page = NULL;
        int error;
 
-       if (attr->ia_valid & ATTR_SIZE) {
+       if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
                if (attr->ia_size < inode->i_size) {
                        /*
                         * If truncating down to a partial page, then
@@ -670,6 +673,10 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
        error = inode_change_ok(inode, attr);
        if (!error)
                error = inode_setattr(inode, attr);
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       if (!error && (attr->ia_valid & ATTR_MODE))
+               error = generic_acl_chmod(inode, &shmem_acl_ops);
+#endif
        if (page)
                page_cache_release(page);
        return error;
@@ -1362,6 +1369,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
 
                switch (mode & S_IFMT) {
                default:
+                       inode->i_op = &shmem_special_inode_operations;
                        init_special_inode(inode, mode, dev);
                        break;
                case S_IFREG:
@@ -1682,7 +1690,11 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
                                iput(inode);
                                return error;
                        }
-                       error = 0;
+               }
+               error = shmem_acl_init(inode, dir);
+               if (error) {
+                       iput(inode);
+                       return error;
                }
                if (dir->i_mode & S_ISGID) {
                        inode->i_gid = dir->i_gid;
@@ -1897,6 +1909,53 @@ static struct inode_operations shmem_symlink_inode_operations = {
        .put_link       = shmem_put_link,
 };
 
+#ifdef CONFIG_TMPFS_POSIX_ACL
+/**
+ * Superblocks without xattr inode operations will get security.* xattr
+ * support from the VFS "for free". As soon as we have any other xattrs
+ * like ACLs, we also need to implement the security.* handlers at
+ * filesystem level, though.
+ */
+
+static size_t shmem_xattr_security_list(struct inode *inode, char *list,
+                                       size_t list_len, const char *name,
+                                       size_t name_len)
+{
+       return security_inode_listsecurity(inode, list, list_len);
+}
+
+static int shmem_xattr_security_get(struct inode *inode, const char *name,
+                                   void *buffer, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return security_inode_getsecurity(inode, name, buffer, size,
+                                         -EOPNOTSUPP);
+}
+
+static int shmem_xattr_security_set(struct inode *inode, const char *name,
+                                   const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return security_inode_setsecurity(inode, name, value, size, flags);
+}
+
+struct xattr_handler shmem_xattr_security_handler = {
+       .prefix = XATTR_SECURITY_PREFIX,
+       .list   = shmem_xattr_security_list,
+       .get    = shmem_xattr_security_get,
+       .set    = shmem_xattr_security_set,
+};
+
+static struct xattr_handler *shmem_xattr_handlers[] = {
+       &shmem_xattr_acl_access_handler,
+       &shmem_xattr_acl_default_handler,
+       &shmem_xattr_security_handler,
+       NULL
+};
+#endif
+
 static int shmem_parse_options(char *options, int *mode, uid_t *uid,
        gid_t *gid, unsigned long *blocks, unsigned long *inodes,
        int *policy, nodemask_t *policy_nodes)
@@ -2094,6 +2153,10 @@ static int shmem_fill_super(struct super_block *sb,
        sb->s_magic = TMPFS_MAGIC;
        sb->s_op = &shmem_ops;
        sb->s_time_gran = 1;
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       sb->s_xattr = shmem_xattr_handlers;
+       sb->s_flags |= MS_POSIXACL;
+#endif
 
        inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
        if (!inode)
@@ -2130,6 +2193,7 @@ static void shmem_destroy_inode(struct inode *inode)
                /* only struct inode is valid if it's an inline symlink */
                mpol_free_shared_policy(&SHMEM_I(inode)->policy);
        }
+       shmem_acl_destroy_inode(inode);
        kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
 }
 
@@ -2141,6 +2205,10 @@ static void init_once(void *foo, struct kmem_cache *cachep,
        if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
            SLAB_CTOR_CONSTRUCTOR) {
                inode_init_once(&p->vfs_inode);
+#ifdef CONFIG_TMPFS_POSIX_ACL
+               p->i_acl = NULL;
+               p->i_default_acl = NULL;
+#endif
        }
 }
 
@@ -2184,6 +2252,14 @@ static struct inode_operations shmem_inode_operations = {
        .truncate       = shmem_truncate,
        .setattr        = shmem_notify_change,
        .truncate_range = shmem_truncate_range,
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
+       .listxattr      = generic_listxattr,
+       .removexattr    = generic_removexattr,
+       .permission     = shmem_permission,
+#endif
+
 };
 
 static struct inode_operations shmem_dir_inode_operations = {
@@ -2198,6 +2274,25 @@ static struct inode_operations shmem_dir_inode_operations = {
        .mknod          = shmem_mknod,
        .rename         = shmem_rename,
 #endif
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       .setattr        = shmem_notify_change,
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
+       .listxattr      = generic_listxattr,
+       .removexattr    = generic_removexattr,
+       .permission     = shmem_permission,
+#endif
+};
+
+static struct inode_operations shmem_special_inode_operations = {
+#ifdef CONFIG_TMPFS_POSIX_ACL
+       .setattr        = shmem_notify_change,
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
+       .listxattr      = generic_listxattr,
+       .removexattr    = generic_removexattr,
+       .permission     = shmem_permission,
+#endif
 };
 
 static struct super_operations shmem_ops = {
diff --git a/mm/shmem_acl.c b/mm/shmem_acl.c
new file mode 100644 (file)
index 0000000..c946bf4
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * mm/shmem_acl.c
+ *
+ * (C) 2005 Andreas Gruenbacher <agruen@suse.de>
+ *
+ * This file is released under the GPL.
+ */
+
+#include <linux/fs.h>
+#include <linux/shmem_fs.h>
+#include <linux/xattr.h>
+#include <linux/generic_acl.h>
+
+/**
+ * shmem_get_acl  -   generic_acl_operations->getacl() operation
+ */
+static struct posix_acl *
+shmem_get_acl(struct inode *inode, int type)
+{
+       struct posix_acl *acl = NULL;
+
+       spin_lock(&inode->i_lock);
+       switch(type) {
+               case ACL_TYPE_ACCESS:
+                       acl = posix_acl_dup(SHMEM_I(inode)->i_acl);
+                       break;
+
+               case ACL_TYPE_DEFAULT:
+                       acl = posix_acl_dup(SHMEM_I(inode)->i_default_acl);
+                       break;
+       }
+       spin_unlock(&inode->i_lock);
+
+       return acl;
+}
+
+/**
+ * shmem_get_acl  -   generic_acl_operations->setacl() operation
+ */
+static void
+shmem_set_acl(struct inode *inode, int type, struct posix_acl *acl)
+{
+       struct posix_acl *free = NULL;
+
+       spin_lock(&inode->i_lock);
+       switch(type) {
+               case ACL_TYPE_ACCESS:
+                       free = SHMEM_I(inode)->i_acl;
+                       SHMEM_I(inode)->i_acl = posix_acl_dup(acl);
+                       break;
+
+               case ACL_TYPE_DEFAULT:
+                       free = SHMEM_I(inode)->i_default_acl;
+                       SHMEM_I(inode)->i_default_acl = posix_acl_dup(acl);
+                       break;
+       }
+       spin_unlock(&inode->i_lock);
+       posix_acl_release(free);
+}
+
+struct generic_acl_operations shmem_acl_ops = {
+       .getacl = shmem_get_acl,
+       .setacl = shmem_set_acl,
+};
+
+/**
+ * shmem_list_acl_access, shmem_get_acl_access, shmem_set_acl_access,
+ * shmem_xattr_acl_access_handler  -  plumbing code to implement the
+ * system.posix_acl_access xattr using the generic acl functions.
+ */
+
+static size_t
+shmem_list_acl_access(struct inode *inode, char *list, size_t list_size,
+                     const char *name, size_t name_len)
+{
+       return generic_acl_list(inode, &shmem_acl_ops, ACL_TYPE_ACCESS,
+                               list, list_size);
+}
+
+static int
+shmem_get_acl_access(struct inode *inode, const char *name, void *buffer,
+                    size_t size)
+{
+       if (strcmp(name, "") != 0)
+               return -EINVAL;
+       return generic_acl_get(inode, &shmem_acl_ops, ACL_TYPE_ACCESS, buffer,
+                              size);
+}
+
+static int
+shmem_set_acl_access(struct inode *inode, const char *name, const void *value,
+                    size_t size, int flags)
+{
+       if (strcmp(name, "") != 0)
+               return -EINVAL;
+       return generic_acl_set(inode, &shmem_acl_ops, ACL_TYPE_ACCESS, value,
+                              size);
+}
+
+struct xattr_handler shmem_xattr_acl_access_handler = {
+       .prefix = POSIX_ACL_XATTR_ACCESS,
+       .list   = shmem_list_acl_access,
+       .get    = shmem_get_acl_access,
+       .set    = shmem_set_acl_access,
+};
+
+/**
+ * shmem_list_acl_default, shmem_get_acl_default, shmem_set_acl_default,
+ * shmem_xattr_acl_default_handler  -  plumbing code to implement the
+ * system.posix_acl_default xattr using the generic acl functions.
+ */
+
+static size_t
+shmem_list_acl_default(struct inode *inode, char *list, size_t list_size,
+                      const char *name, size_t name_len)
+{
+       return generic_acl_list(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT,
+                               list, list_size);
+}
+
+static int
+shmem_get_acl_default(struct inode *inode, const char *name, void *buffer,
+                     size_t size)
+{
+       if (strcmp(name, "") != 0)
+               return -EINVAL;
+       return generic_acl_get(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT, buffer,
+                              size);
+}
+
+static int
+shmem_set_acl_default(struct inode *inode, const char *name, const void *value,
+                     size_t size, int flags)
+{
+       if (strcmp(name, "") != 0)
+               return -EINVAL;
+       return generic_acl_set(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT, value,
+                              size);
+}
+
+struct xattr_handler shmem_xattr_acl_default_handler = {
+       .prefix = POSIX_ACL_XATTR_DEFAULT,
+       .list   = shmem_list_acl_default,
+       .get    = shmem_get_acl_default,
+       .set    = shmem_set_acl_default,
+};
+
+/**
+ * shmem_acl_init  -  Inizialize the acl(s) of a new inode
+ */
+int
+shmem_acl_init(struct inode *inode, struct inode *dir)
+{
+       return generic_acl_init(inode, dir, &shmem_acl_ops);
+}
+
+/**
+ * shmem_acl_destroy_inode  -  destroy acls hanging off the in-memory inode
+ *
+ * This is done before destroying the actual inode.
+ */
+
+void
+shmem_acl_destroy_inode(struct inode *inode)
+{
+       if (SHMEM_I(inode)->i_acl)
+               posix_acl_release(SHMEM_I(inode)->i_acl);
+       SHMEM_I(inode)->i_acl = NULL;
+       if (SHMEM_I(inode)->i_default_acl)
+               posix_acl_release(SHMEM_I(inode)->i_default_acl);
+       SHMEM_I(inode)->i_default_acl = NULL;
+}
+
+/**
+ * shmem_check_acl  -  check_acl() callback for generic_permission()
+ */
+static int
+shmem_check_acl(struct inode *inode, int mask)
+{
+       struct posix_acl *acl = shmem_get_acl(inode, ACL_TYPE_ACCESS);
+
+       if (acl) {
+               int error = posix_acl_permission(inode, acl, mask);
+               posix_acl_release(acl);
+               return error;
+       }
+       return -EAGAIN;
+}
+
+/**
+ * shmem_permission  -  permission() inode operation
+ */
+int
+shmem_permission(struct inode *inode, int mask, struct nameidata *nd)
+{
+       return generic_permission(inode, mask, shmem_check_acl);
+}
index 792bfe320a8b2c0896f8568f8d07de40203f8cf2..3dbd6f4e74774be9fd1db7e19d581ae31b1f4cce 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1683,10 +1683,32 @@ static void poison_obj(struct kmem_cache *cachep, void *addr, unsigned char val)
 static void dump_line(char *data, int offset, int limit)
 {
        int i;
+       unsigned char error = 0;
+       int bad_count = 0;
+
        printk(KERN_ERR "%03x:", offset);
-       for (i = 0; i < limit; i++)
+       for (i = 0; i < limit; i++) {
+               if (data[offset + i] != POISON_FREE) {
+                       error = data[offset + i];
+                       bad_count++;
+               }
                printk(" %02x", (unsigned char)data[offset + i]);
+       }
        printk("\n");
+
+       if (bad_count == 1) {
+               error ^= POISON_FREE;
+               if (!(error & (error - 1))) {
+                       printk(KERN_ERR "Single bit error detected. Probably "
+                                       "bad RAM.\n");
+#ifdef CONFIG_X86
+                       printk(KERN_ERR "Run memtest86+ or a similar memory "
+                                       "test tool.\n");
+#else
+                       printk(KERN_ERR "Run a memory test tool.\n");
+#endif
+               }
+       }
 }
 #endif
 
index f1f5ec783781cfebcbd4f3c5efe79336eaedcfa1..a15def63f28f19e8e9d0e9f550177b80b033526e 100644 (file)
@@ -1723,13 +1723,14 @@ get_swap_info_struct(unsigned type)
  */
 int valid_swaphandles(swp_entry_t entry, unsigned long *offset)
 {
-       int ret = 0, i = 1 << page_cluster;
+       int our_page_cluster = page_cluster;
+       int ret = 0, i = 1 << our_page_cluster;
        unsigned long toff;
        struct swap_info_struct *swapdev = swp_type(entry) + swap_info;
 
-       if (!page_cluster)      /* no readahead */
+       if (!our_page_cluster)  /* no readahead */
                return 0;
-       toff = (swp_offset(entry) >> page_cluster) << page_cluster;
+       toff = (swp_offset(entry) >> our_page_cluster) << our_page_cluster;
        if (!toff)              /* first page is swap header */
                toff++, i--;
        *offset = toff;
index d7d8f40c4fed0d17d0113eceb92de3d821e723fc..829deb41ce81d436aad10567d03d35ca86532b58 100644 (file)
@@ -164,7 +164,7 @@ static int tr_rebuild_header(struct sk_buff *skb)
         */
         
        if(trllc->ethertype != htons(ETH_P_IP)) {
-               printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n",(unsigned int)htons(trllc->ethertype));
+               printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype));
                return 0;
        }
 
@@ -186,7 +186,7 @@ static int tr_rebuild_header(struct sk_buff *skb)
  *     it via SNAP.
  */
  
-unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev) 
+__be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
 
        struct trh_hdr *trh=(struct trh_hdr *)skb->data;
@@ -229,15 +229,15 @@ unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev)
         */
 
        if (trllc->dsap == EXTENDED_SAP &&
-           (trllc->ethertype == ntohs(ETH_P_IP) ||
-            trllc->ethertype == ntohs(ETH_P_IPV6) ||
-            trllc->ethertype == ntohs(ETH_P_ARP)))
+           (trllc->ethertype == htons(ETH_P_IP) ||
+            trllc->ethertype == htons(ETH_P_IPV6) ||
+            trllc->ethertype == htons(ETH_P_ARP)))
        {
                skb_pull(skb, sizeof(struct trllc));
                return trllc->ethertype;
        }
 
-       return ntohs(ETH_P_TR_802_2);
+       return htons(ETH_P_TR_802_2);
 }
 
 /*
index 6528a935622cc61ca2269a250ada0181932c61ff..a81aca43932f975ed912e1f00482e24b5a6d7102 100644 (file)
@@ -231,7 +231,7 @@ config NET_TCPPROBE
        TCP congestion avoidance modules. If you don't understand
        what was just said, you don't need it: say N.
 
-       Documentation on how to use the packet generator can be found
+       Documentation on how to use TCP connection probing can be found
        at http://linux-net.osdl.org/index.php/TcpProbe
 
        To compile this code as a module, choose M here: the
index 96dc6bb52d14aecd00cff0e8f37bed950d6b557f..708e2e0371aff2ae8be46529c112be0078e58686 100644 (file)
@@ -1002,7 +1002,7 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
        return sum;
 }
 
-static unsigned short atalk_checksum(const struct sk_buff *skb, int len)
+static __be16 atalk_checksum(const struct sk_buff *skb, int len)
 {
        unsigned long sum;
 
@@ -1010,7 +1010,7 @@ static unsigned short atalk_checksum(const struct sk_buff *skb, int len)
        sum = atalk_sum_skb(skb, 4, len-4, 0);
 
        /* Use 0xFFFF for 0. 0 itself means none */
-       return sum ? htons((unsigned short)sum) : 0xFFFF;
+       return sum ? htons((unsigned short)sum) : htons(0xFFFF);
 }
 
 static struct proto ddp_proto = {
@@ -1289,7 +1289,7 @@ static int handle_ip_over_ddp(struct sk_buff *skb)
 #endif
 
 static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
-                              struct ddpehdr *ddp, struct ddpebits *ddphv,
+                              struct ddpehdr *ddp, __u16 len_hops,
                               int origlen)
 {
        struct atalk_route *rt;
@@ -1317,10 +1317,12 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
 
        /* Route the packet */
        rt = atrtr_find(&ta);
-       if (!rt || ddphv->deh_hops == DDP_MAXHOPS)
+       /* increment hops count */
+       len_hops += 1 << 10;
+       if (!rt || !(len_hops & (15 << 10)))
                goto free_it;
+
        /* FIXME: use skb->cb to be able to use shared skbs */
-       ddphv->deh_hops++;
 
        /*
         * Route goes through another gateway, so set the target to the
@@ -1335,11 +1337,10 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
         /* Fix up skb->len field */
         skb_trim(skb, min_t(unsigned int, origlen,
                            (rt->dev->hard_header_len +
-                            ddp_dl->header_length + ddphv->deh_len)));
+                            ddp_dl->header_length + (len_hops & 1023))));
 
-       /* Mend the byte order */
        /* FIXME: use skb->cb to be able to use shared skbs */
-       *((__u16 *)ddp) = ntohs(*((__u16 *)ddphv));
+       ddp->deh_len_hops = htons(len_hops);
 
        /*
         * Send the buffer onwards
@@ -1394,7 +1395,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
        struct atalk_iface *atif;
        struct sockaddr_at tosat;
         int origlen;
-        struct ddpebits ddphv;
+       __u16 len_hops;
 
        /* Don't mangle buffer if shared */
        if (!(skb = skb_share_check(skb, GFP_ATOMIC))) 
@@ -1406,16 +1407,11 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 
        ddp = ddp_hdr(skb);
 
-       /*
-        *      Fix up the length field [Ok this is horrible but otherwise
-        *      I end up with unions of bit fields and messy bit field order
-        *      compiler/endian dependencies..]
-        */
-       *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp));
+       len_hops = ntohs(ddp->deh_len_hops);
 
        /* Trim buffer in case of stray trailing data */
        origlen = skb->len;
-       skb_trim(skb, min_t(unsigned int, skb->len, ddphv.deh_len));
+       skb_trim(skb, min_t(unsigned int, skb->len, len_hops & 1023));
 
        /*
         * Size check to see if ddp->deh_len was crap
@@ -1430,7 +1426,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
         * valid for net byte orders all over the networking code...
         */
        if (ddp->deh_sum &&
-           atalk_checksum(skb, ddphv.deh_len) != ddp->deh_sum)
+           atalk_checksum(skb, len_hops & 1023) != ddp->deh_sum)
                /* Not a valid AppleTalk frame - dustbin time */
                goto freeit;
 
@@ -1444,7 +1440,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
                /* Not ours, so we route the packet via the correct
                 * AppleTalk iface
                 */
-               atalk_route_packet(skb, dev, ddp, &ddphv, origlen);
+               atalk_route_packet(skb, dev, ddp, len_hops, origlen);
                goto out;
        }
 
@@ -1489,7 +1485,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
                /* Find our address */
                struct atalk_addr *ap = atalk_find_dev_addr(dev);
 
-               if (!ap || skb->len < sizeof(struct ddpshdr))
+               if (!ap || skb->len < sizeof(__be16) || skb->len > 1023)
                        goto freeit;
 
                /* Don't mangle buffer if shared */
@@ -1519,11 +1515,8 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
                /*
                 * Not sure about this bit...
                 */
-               ddp->deh_len   = skb->len;
-               ddp->deh_hops  = DDP_MAXHOPS;   /* Non routable, so force a drop
-                                                  if we slip up later */
-               /* Mend the byte order */
-               *((__u16 *)ddp) = htons(*((__u16 *)ddp));
+               /* Non routable, so force a drop if we slip up later */
+               ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10));
        }
        skb->h.raw = skb->data;
 
@@ -1622,16 +1615,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
        SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk);
 
        ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr));
-       ddp->deh_pad  = 0;
-       ddp->deh_hops = 0;
-       ddp->deh_len  = len + sizeof(*ddp);
-       /*
-        * Fix up the length field [Ok this is horrible but otherwise
-        * I end up with unions of bit fields and messy bit field order
-        * compiler/endian dependencies..
-        */
-       *((__u16 *)ddp) = ntohs(*((__u16 *)ddp));
-
+       ddp->deh_len_hops  = htons(len + sizeof(*ddp));
        ddp->deh_dnet  = usat->sat_addr.s_net;
        ddp->deh_snet  = at->src_net;
        ddp->deh_dnode = usat->sat_addr.s_node;
@@ -1712,8 +1696,8 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
        struct sockaddr_at *sat = (struct sockaddr_at *)msg->msg_name;
        struct ddpehdr *ddp;
        int copied = 0;
+       int offset = 0;
        int err = 0;
-        struct ddpebits ddphv;
        struct sk_buff *skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
                                                flags & MSG_DONTWAIT, &err);
        if (!skb)
@@ -1721,25 +1705,18 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
 
        /* FIXME: use skb->cb to be able to use shared skbs */
        ddp = ddp_hdr(skb);
-       *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp));
+       copied = ntohs(ddp->deh_len_hops) & 1023;
 
-       if (sk->sk_type == SOCK_RAW) {
-               copied = ddphv.deh_len;
-               if (copied > size) {
-                       copied = size;
-                       msg->msg_flags |= MSG_TRUNC;
-               }
+       if (sk->sk_type != SOCK_RAW) {
+               offset = sizeof(*ddp);
+               copied -= offset;
+       }
 
-               err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
-       } else {
-               copied = ddphv.deh_len - sizeof(*ddp);
-               if (copied > size) {
-                       copied = size;
-                       msg->msg_flags |= MSG_TRUNC;
-               }
-               err = skb_copy_datagram_iovec(skb, sizeof(*ddp),
-                                             msg->msg_iov, copied);
+       if (copied > size) {
+               copied = size;
+               msg->msg_flags |= MSG_TRUNC;
        }
+       err = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copied);
 
        if (!err) {
                if (sat) {
index b87c2a88bdce40c63fdc136cac99e4ec7463eabb..0d2b994af5115931e419d3696b8e36e70fdaf493 100644 (file)
@@ -560,7 +560,6 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
        struct atmmpc_ioc ioc_data;
        in_cache_entry *in_entry;
        uint32_t  ipaddr;
-       unsigned char *ip;
 
        bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
        if (bytes_left != 0) {
@@ -583,9 +582,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
                        if (in_entry != NULL) mpc->in_ops->put(in_entry);
                        return -EINVAL;
                }
-               ip = (unsigned char*)&in_entry->ctrl_info.in_dst_ip;
                printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n",
-                      mpc->dev->name, ip[0], ip[1], ip[2], ip[3]);
+                      mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
                in_entry->shortcut = vcc;
                mpc->in_ops->put(in_entry);
        } else {
@@ -616,10 +614,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
        dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name);
        in_entry = mpc->in_ops->get_by_vcc(vcc, mpc);
        if (in_entry) {
-               unsigned char *ip __attribute__ ((unused)) =
-                   (unsigned char *)&in_entry->ctrl_info.in_dst_ip;
                dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n",
-                      mpc->dev->name, ip[0], ip[1], ip[2], ip[3]);
+                      mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
                in_entry->shortcut = NULL;
                mpc->in_ops->put(in_entry);
        }
@@ -1154,18 +1150,17 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
 {
        uint32_t dst_ip = msg->content.in_info.in_dst_ip;
        uint32_t mask = msg->ip_mask;
-       unsigned char *ip = (unsigned char *)&dst_ip;
        in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask);
 
        if(entry == NULL){
                printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name);
-               printk("ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]);
+               printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
                return;
        }
 
        do {
                dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" ,
-                       mpc->dev->name, ip[0], ip[1], ip[2], ip[3]);
+                       mpc->dev->name, NIPQUAD(dst_ip));
                write_lock_bh(&mpc->ingress_lock);
                mpc->in_ops->remove_entry(entry, mpc);
                write_unlock_bh(&mpc->ingress_lock);
index 781ed1b9329d32f4308b734081f2ccd1ebd2466b..fbf13cdcf46ed2af4edfa2f1bf085af201e0ed6f 100644 (file)
@@ -87,7 +87,6 @@ static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc,
 static in_cache_entry *in_cache_add_entry(uint32_t dst_ip,
                                          struct mpoa_client *client)
 {
-       unsigned char *ip __attribute__ ((unused)) = (unsigned char *)&dst_ip;
        in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL);
 
        if (entry == NULL) {
@@ -95,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(uint32_t dst_ip,
                return NULL;
        }
 
-       dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]);
+       dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
        memset(entry,0,sizeof(in_cache_entry));
 
        atomic_set(&entry->use, 1);
@@ -152,10 +151,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)
 
        if( entry->count > mpc->parameters.mpc_p1 &&
            entry->entry_state == INGRESS_INVALID){
-               unsigned char *ip __attribute__ ((unused)) =
-                   (unsigned char *)&entry->ctrl_info.in_dst_ip;
-
-               dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, ip[0], ip[1], ip[2], ip[3]);
+               dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip));
                entry->entry_state = INGRESS_RESOLVING;
                msg.type =  SND_MPOA_RES_RQST;
                memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN );
@@ -187,11 +183,9 @@ static void in_cache_remove_entry(in_cache_entry *entry,
 {
        struct atm_vcc *vcc;
        struct k_message msg;
-       unsigned char *ip;
 
        vcc = entry->shortcut;
-       ip = (unsigned char *)&entry->ctrl_info.in_dst_ip;
-       dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",ip[0], ip[1], ip[2], ip[3]);
+       dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip));
 
        if (entry->prev != NULL)
                entry->prev->next = entry->next;
index 788ea7a2b74498c10534501e62c3e91fd17c117e..305a099b7477eb8fd0e4a7a7b487b7bd435e6677 100644 (file)
@@ -276,7 +276,7 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo)
                set_current_state(TASK_INTERRUPTIBLE);
 
                if (!timeo) {
-                       err = -EAGAIN;
+                       err = -EINPROGRESS;
                        break;
                }
 
index e620061fb50fd83cd530167d863b1745f3f7a3fd..2312d050eeedfb66ed382108f0703f6d2dfc5b9d 100644 (file)
@@ -51,6 +51,7 @@
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
 #include <net/bluetooth/l2cap.h>
 
 #include "bnep.h"
@@ -515,6 +516,26 @@ static int bnep_session(void *arg)
        return 0;
 }
 
+static struct device *bnep_get_device(struct bnep_session *session)
+{
+       bdaddr_t *src = &bt_sk(session->sock->sk)->src;
+       bdaddr_t *dst = &bt_sk(session->sock->sk)->dst;
+       struct hci_dev *hdev;
+       struct hci_conn *conn;
+
+       hdev = hci_get_route(dst, src);
+       if (!hdev)
+               return NULL;
+
+       conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
+       if (!conn)
+               return NULL;
+
+       hci_dev_put(hdev);
+
+       return &conn->dev;
+}
+
 int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
 {
        struct net_device *dev;
@@ -534,7 +555,6 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
        if (!dev)
                return -ENOMEM;
 
-
        down_write(&bnep_session_sem);
 
        ss = __bnep_get_session(dst);
@@ -551,7 +571,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
        memcpy(s->eh.h_source, &dst, ETH_ALEN);
        memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN);
 
-       s->dev = dev;
+       s->dev   = dev;
        s->sock  = sock;
        s->role  = req->role;
        s->state = BT_CONNECTED;
@@ -568,6 +588,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
        bnep_set_default_proto_filter(s);
 #endif
 
+       SET_NETDEV_DEV(dev, bnep_get_device(s));
+
        err = register_netdev(dev);
        if (err) {
                goto failed;
index 420ed4d7e57e98e44615196248e7afb94d36498e..90e3a285a17eaf9a4bde198879748d8a4da680a7 100644 (file)
@@ -84,6 +84,20 @@ static void hci_acl_connect(struct hci_conn *conn)
        hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp);
 }
 
+static void hci_acl_connect_cancel(struct hci_conn *conn)
+{
+       struct hci_cp_create_conn_cancel cp;
+
+       BT_DBG("%p", conn);
+
+       if (conn->hdev->hci_ver < 2)
+               return;
+
+       bacpy(&cp.bdaddr, &conn->dst);
+       hci_send_cmd(conn->hdev, OGF_LINK_CTL,
+                               OCF_CREATE_CONN_CANCEL, sizeof(cp), &cp);
+}
+
 void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
 {
        struct hci_cp_disconnect cp;
@@ -94,7 +108,8 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
 
        cp.handle = __cpu_to_le16(conn->handle);
        cp.reason = reason;
-       hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_DISCONNECT, sizeof(cp), &cp);
+       hci_send_cmd(conn->hdev, OGF_LINK_CTL,
+                               OCF_DISCONNECT, sizeof(cp), &cp);
 }
 
 void hci_add_sco(struct hci_conn *conn, __u16 handle)
@@ -124,12 +139,20 @@ static void hci_conn_timeout(unsigned long arg)
                return;
 
        hci_dev_lock(hdev);
-       if (conn->state == BT_CONNECTED)
+
+       switch (conn->state) {
+       case BT_CONNECT:
+               hci_acl_connect_cancel(conn);
+               break;
+       case BT_CONNECTED:
                hci_acl_disconn(conn, 0x13);
-       else
+               break;
+       default:
                conn->state = BT_CLOSED;
+               break;
+       }
+
        hci_dev_unlock(hdev);
-       return;
 }
 
 static void hci_conn_idle(unsigned long arg)
@@ -179,6 +202,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
 
+       hci_conn_add_sysfs(conn);
+
        tasklet_enable(&hdev->tx_task);
 
        return conn;
@@ -211,6 +236,8 @@ int hci_conn_del(struct hci_conn *conn)
 
        tasklet_disable(&hdev->tx_task);
 
+       hci_conn_del_sysfs(conn);
+
        hci_conn_hash_del(hdev, conn);
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
@@ -221,7 +248,9 @@ int hci_conn_del(struct hci_conn *conn)
 
        hci_dev_put(hdev);
 
-       kfree(conn);
+       /* will free via device release */
+       put_device(&conn->dev);
+
        return 0;
 }
 
index 5ed47427790385fc335168857d02082deb2ab498..338ae977a31b2209fb39e1a97d644db185d4597a 100644 (file)
@@ -206,6 +206,9 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
        /* Read Local Supported Features */
        hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_FEATURES, 0, NULL);
 
+       /* Read Local Version */
+       hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_VERSION, 0, NULL);
+
        /* Read Buffer Size (ACL mtu, max pkt, etc.) */
        hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_BUFFER_SIZE, 0, NULL);
 
index 3896dabab11da70898640581f9c3e5b2195f7678..d43d0c8909752564796b540a61cb58389cc8cb0d 100644 (file)
@@ -62,6 +62,7 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
 
        switch (ocf) {
        case OCF_INQUIRY_CANCEL:
+       case OCF_EXIT_PERIODIC_INQ:
                status = *((__u8 *) skb->data);
 
                if (status) {
@@ -297,6 +298,7 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
 /* Command Complete OGF INFO_PARAM  */
 static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb)
 {
+       struct hci_rp_read_loc_version *lv;
        struct hci_rp_read_local_features *lf;
        struct hci_rp_read_buffer_size *bs;
        struct hci_rp_read_bd_addr *ba;
@@ -304,6 +306,23 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
        BT_DBG("%s ocf 0x%x", hdev->name, ocf);
 
        switch (ocf) {
+       case OCF_READ_LOCAL_VERSION:
+               lv = (struct hci_rp_read_loc_version *) skb->data;
+
+               if (lv->status) {
+                       BT_DBG("%s READ_LOCAL_VERSION failed %d", hdev->name, lf->status);
+                       break;
+               }
+
+               hdev->hci_ver = lv->hci_ver;
+               hdev->hci_rev = btohs(lv->hci_rev);
+               hdev->manufacturer = btohs(lv->manufacturer);
+
+               BT_DBG("%s: manufacturer %d hci_ver %d hci_rev %d", hdev->name,
+                               hdev->manufacturer, hdev->hci_ver, hdev->hci_rev);
+
+               break;
+
        case OCF_READ_LOCAL_FEATURES:
                lf = (struct hci_rp_read_local_features *) skb->data;
 
@@ -328,7 +347,8 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
                if (hdev->features[1] & LMP_HV3)
                        hdev->pkt_type |= (HCI_HV3);
 
-               BT_DBG("%s: features 0x%x 0x%x 0x%x", hdev->name, lf->features[0], lf->features[1], lf->features[2]);
+               BT_DBG("%s: features 0x%x 0x%x 0x%x", hdev->name,
+                               lf->features[0], lf->features[1], lf->features[2]);
 
                break;
 
@@ -757,6 +777,10 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
 
                        hci_send_cmd(hdev, OGF_LINK_CTL,
                                OCF_CHANGE_CONN_PTYPE, sizeof(cp), &cp);
+               } else {
+                       /* Update disconnect timer */
+                       hci_conn_hold(conn);
+                       hci_conn_put(conn);
                }
        } else
                conn->state = BT_CLOSED;
index 3987d167f04e73225ea98556bd1f583c899e9223..989b22d9042e92f929435d9f0290d2d429e7fd75 100644 (file)
 #define BT_DBG(D...)
 #endif
 
-static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
+static inline char *typetostr(int type)
 {
-       struct hci_dev *hdev = dev_get_drvdata(dev);
-       return sprintf(buf, "%s\n", hdev->name);
+       switch (type) {
+       case HCI_VIRTUAL:
+               return "VIRTUAL";
+       case HCI_USB:
+               return "USB";
+       case HCI_PCCARD:
+               return "PCCARD";
+       case HCI_UART:
+               return "UART";
+       case HCI_RS232:
+               return "RS232";
+       case HCI_PCI:
+               return "PCI";
+       case HCI_SDIO:
+               return "SDIO";
+       default:
+               return "UNKNOWN";
+       }
 }
 
 static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct hci_dev *hdev = dev_get_drvdata(dev);
-       return sprintf(buf, "%d\n", hdev->type);
+       return sprintf(buf, "%s\n", typetostr(hdev->type));
 }
 
 static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf)
@@ -33,10 +49,22 @@ static ssize_t show_address(struct device *dev, struct device_attribute *attr, c
        return sprintf(buf, "%s\n", batostr(&bdaddr));
 }
 
-static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_manufacturer(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct hci_dev *hdev = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", hdev->manufacturer);
+}
+
+static ssize_t show_hci_version(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct hci_dev *hdev = dev_get_drvdata(dev);
-       return sprintf(buf, "0x%lx\n", hdev->flags);
+       return sprintf(buf, "%d\n", hdev->hci_ver);
+}
+
+static ssize_t show_hci_revision(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct hci_dev *hdev = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", hdev->hci_rev);
 }
 
 static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf)
@@ -141,10 +169,11 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib
        return count;
 }
 
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
-static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL);
+static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL);
+static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL);
+static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL);
 static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL);
 
 static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR,
@@ -155,10 +184,11 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
                                show_sniff_min_interval, store_sniff_min_interval);
 
 static struct device_attribute *bt_attrs[] = {
-       &dev_attr_name,
        &dev_attr_type,
        &dev_attr_address,
-       &dev_attr_flags,
+       &dev_attr_manufacturer,
+       &dev_attr_hci_version,
+       &dev_attr_hci_revision,
        &dev_attr_inquiry_cache,
        &dev_attr_idle_timeout,
        &dev_attr_sniff_max_interval,
@@ -166,6 +196,32 @@ static struct device_attribute *bt_attrs[] = {
        NULL
 };
 
+static ssize_t show_conn_type(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct hci_conn *conn = dev_get_drvdata(dev);
+       return sprintf(buf, "%s\n", conn->type == ACL_LINK ? "ACL" : "SCO");
+}
+
+static ssize_t show_conn_address(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct hci_conn *conn = dev_get_drvdata(dev);
+       bdaddr_t bdaddr;
+       baswap(&bdaddr, &conn->dst);
+       return sprintf(buf, "%s\n", batostr(&bdaddr));
+}
+
+#define CONN_ATTR(_name,_mode,_show,_store) \
+struct device_attribute conn_attr_##_name = __ATTR(_name,_mode,_show,_store)
+
+static CONN_ATTR(type, S_IRUGO, show_conn_type, NULL);
+static CONN_ATTR(address, S_IRUGO, show_conn_address, NULL);
+
+static struct device_attribute *conn_attrs[] = {
+       &conn_attr_type,
+       &conn_attr_address,
+       NULL
+};
+
 struct class *bt_class = NULL;
 EXPORT_SYMBOL_GPL(bt_class);
 
@@ -177,8 +233,57 @@ static struct platform_device *bt_platform;
 
 static void bt_release(struct device *dev)
 {
-       struct hci_dev *hdev = dev_get_drvdata(dev);
-       kfree(hdev);
+       void *data = dev_get_drvdata(dev);
+       kfree(data);
+}
+
+static void add_conn(void *data)
+{
+       struct hci_conn *conn = data;
+       int i;
+
+       device_register(&conn->dev);
+
+       for (i = 0; conn_attrs[i]; i++)
+               device_create_file(&conn->dev, conn_attrs[i]);
+}
+
+void hci_conn_add_sysfs(struct hci_conn *conn)
+{
+       struct hci_dev *hdev = conn->hdev;
+       bdaddr_t *ba = &conn->dst;
+
+       BT_DBG("conn %p", conn);
+
+       conn->dev.parent  = &hdev->dev;
+       conn->dev.release = bt_release;
+
+       snprintf(conn->dev.bus_id, BUS_ID_SIZE,
+                       "%s%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
+                       conn->type == ACL_LINK ? "acl" : "sco",
+                       ba->b[5], ba->b[4], ba->b[3],
+                       ba->b[2], ba->b[1], ba->b[0]);
+
+       dev_set_drvdata(&conn->dev, conn);
+
+       INIT_WORK(&conn->work, add_conn, (void *) conn);
+
+       schedule_work(&conn->work);
+}
+
+static void del_conn(void *data)
+{
+       struct hci_conn *conn = data;
+       device_del(&conn->dev);
+}
+
+void hci_conn_del_sysfs(struct hci_conn *conn)
+{
+       BT_DBG("conn %p", conn);
+
+       INIT_WORK(&conn->work, del_conn, (void *) conn);
+
+       schedule_work(&conn->work);
 }
 
 int hci_register_sysfs(struct hci_dev *hdev)
@@ -214,11 +319,9 @@ int hci_register_sysfs(struct hci_dev *hdev)
 
 void hci_unregister_sysfs(struct hci_dev *hdev)
 {
-       struct device *dev = &hdev->dev;
-
        BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
 
-       device_del(dev);
+       device_del(&hdev->dev);
 }
 
 int __init bt_sysfs_init(void)
@@ -245,7 +348,7 @@ int __init bt_sysfs_init(void)
        return 0;
 }
 
-void __exit bt_sysfs_cleanup(void)
+void bt_sysfs_cleanup(void)
 {
        class_destroy(bt_class);
 
index c6e3a2c27c6ecc864dfa85153b1b42f557957f69..03b5dadb49511f90b0c57ee6d9d677d580c5ef18 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/input.h>
 
 #include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
 #include <net/bluetooth/l2cap.h>
 
 #include "hidp.h"
@@ -528,6 +529,26 @@ static int hidp_session(void *arg)
        return 0;
 }
 
+static struct device *hidp_get_device(struct hidp_session *session)
+{
+       bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src;
+       bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst;
+       struct hci_dev *hdev;
+       struct hci_conn *conn;
+
+       hdev = hci_get_route(dst, src);
+       if (!hdev)
+               return NULL;
+
+       conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
+       if (!conn)
+               return NULL;
+
+       hci_dev_put(hdev);
+
+       return &conn->dev;
+}
+
 static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
 {
        struct input_dev *input = session->input;
@@ -566,6 +587,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co
                input->relbit[0] |= BIT(REL_WHEEL);
        }
 
+       input->cdev.dev = hidp_get_device(session);
+
        input->event = hidp_input_event;
 
        input_register_device(input);
index 332dd8f436ea0a2957df07db7d7b4aedcffa888f..468df3b953f6d3c615169a0939e50ec924eb1af8 100644 (file)
@@ -644,7 +644,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
        addr.l2_family = AF_BLUETOOTH;
        addr.l2_psm    = htobs(RFCOMM_PSM);
        *err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK);
-       if (*err == 0 || *err == -EAGAIN)
+       if (*err == 0 || *err == -EINPROGRESS)
                return s;
 
        rfcomm_session_del(s);
index bd8d671a0ba6f1622ee54e463c2d393b0a6a8943..26f322737db0c83702267b25190dca8fa925c324 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/skbuff.h>
 
 #include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
 #include <net/bluetooth/rfcomm.h>
 
 #ifndef CONFIG_BT_RFCOMM_DEBUG
@@ -161,6 +162,24 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id)
        return dev;
 }
 
+static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
+{
+       struct hci_dev *hdev;
+       struct hci_conn *conn;
+
+       hdev = hci_get_route(&dev->dst, &dev->src);
+       if (!hdev)
+               return NULL;
+
+       conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst);
+       if (!conn)
+               return NULL;
+
+       hci_dev_put(hdev);
+
+       return &conn->dev;
+}
+
 static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
 {
        struct rfcomm_dev *dev;
@@ -244,7 +263,7 @@ out:
                return err;
        }
 
-       tty_register_device(rfcomm_tty_driver, dev->id, NULL);
+       tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev));
 
        return dev->id;
 }
index d19fc4b328dcfa481f9d982a830172c1e3cd1582..0aa7b9910a86159a66043ba819298a02f6b917f1 100644 (file)
@@ -20,7 +20,7 @@ static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr,
    const void *data, unsigned int datalen)
 {
        struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data;
-       u32 _sip, *siptr, _dip, *diptr;
+       __be32 _sip, *siptr, _dip, *diptr;
        struct arphdr _ah, *ap;
        unsigned char _sha[ETH_ALEN], *shp;
        struct sk_buff *skb = *pskb;
index 14de297d024d1e8771180dde2e07aec624b90e1c..4d891beab13899cd96c74b8a6a88b5ef5d6aba43 100644 (file)
@@ -1480,14 +1480,16 @@ gso:
        if (q->enqueue) {
                /* Grab device queue */
                spin_lock(&dev->queue_lock);
+               q = dev->qdisc;
+               if (q->enqueue) {
+                       rc = q->enqueue(skb, q);
+                       qdisc_run(dev);
+                       spin_unlock(&dev->queue_lock);
 
-               rc = q->enqueue(skb, q);
-
-               qdisc_run(dev);
-
+                       rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
+                       goto out;
+               }
                spin_unlock(&dev->queue_lock);
-               rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
-               goto out;
        }
 
        /* The device has no queue. Common case for software devices:
index e0ca04f38cef3d7058e4ffe548e9b2aa85f92f47..87dc556fd9d6c694f65e33c6868aebdeef8325cc 100644 (file)
@@ -806,13 +806,6 @@ int dev_ethtool(struct ifreq *ifr)
        int rc;
        unsigned long old_features;
 
-       /*
-        * XXX: This can be pushed down into the ethtool_* handlers that
-        * need it.  Keep existing behaviour for the moment.
-        */
-       if (!capable(CAP_NET_ADMIN))
-               return -EPERM;
-
        if (!dev || !netif_device_present(dev))
                return -ENODEV;
 
@@ -822,6 +815,27 @@ int dev_ethtool(struct ifreq *ifr)
        if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
                return -EFAULT;
 
+       /* Allow some commands to be done by anyone */
+       switch(ethcmd) {
+       case ETHTOOL_GDRVINFO:
+       case ETHTOOL_GMSGLVL:
+       case ETHTOOL_GCOALESCE:
+       case ETHTOOL_GRINGPARAM:
+       case ETHTOOL_GPAUSEPARAM:
+       case ETHTOOL_GRXCSUM:
+       case ETHTOOL_GTXCSUM:
+       case ETHTOOL_GSG:
+       case ETHTOOL_GSTRINGS:
+       case ETHTOOL_GTSO:
+       case ETHTOOL_GPERMADDR:
+       case ETHTOOL_GUFO:
+       case ETHTOOL_GGSO:
+               break;
+       default:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EPERM;
+       }
+
        if(dev->ethtool_ops->begin)
                if ((rc = dev->ethtool_ops->begin(dev)) < 0)
                        return rc;
@@ -947,6 +961,10 @@ int dev_ethtool(struct ifreq *ifr)
        return rc;
 
  ioctl:
+       /* Keep existing behaviour for the moment.       */
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
        if (dev->do_ioctl)
                return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
        return -EOPNOTSUPP;
index b6c69e1463e87f0dc756022ade88e52e4062dea0..8ce8c471d8687427ad2b88acf5d33a17a874bbbc 100644 (file)
@@ -1079,7 +1079,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
 }
 
 static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
-                         u16 protocol)
+                         __be16 protocol)
 {
        struct hh_cache *hh;
        struct net_device *dev = dst->dev;
index 72145d4a260082fc6e798522e95052a36f1643c6..dd023fd2830409475f42b8cd8ccb7fb16cd03aa2 100644 (file)
  *
  * MPLS support by Steven Whitehouse <steve@chygwyn.com>
  *
+ * 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com>
+ *
  */
 #include <linux/sys.h>
 #include <linux/types.h>
 #include <linux/inetdevice.h>
 #include <linux/rtnetlink.h>
 #include <linux/if_arp.h>
+#include <linux/if_vlan.h>
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <asm/div64.h>         /* do_div */
 #include <asm/timex.h>
 
-#define VERSION  "pktgen v2.67: Packet Generator for packet performance testing.\n"
+#define VERSION  "pktgen v2.68: Packet Generator for packet performance testing.\n"
 
 /* #define PG_DEBUG(a) a */
 #define PG_DEBUG(a)
 #define F_TXSIZE_RND  (1<<6)   /* Transmit size is random */
 #define F_IPV6        (1<<7)   /* Interface in IPV6 Mode */
 #define F_MPLS_RND    (1<<8)   /* Random MPLS labels */
+#define F_VID_RND     (1<<9)   /* Random VLAN ID */
+#define F_SVID_RND    (1<<10)  /* Random SVLAN ID */
 
 /* Thread control flag bits */
 #define T_TERMINATE   (1<<0)
@@ -198,6 +203,9 @@ static struct proc_dir_entry *pg_proc_dir = NULL;
 
 #define MAX_CFLOWS  65536
 
+#define VLAN_TAG_SIZE(x) ((x)->vlan_id == 0xffff ? 0 : 4)
+#define SVLAN_TAG_SIZE(x) ((x)->svlan_id == 0xffff ? 0 : 4)
+
 struct flow_state {
        __u32 cur_daddr;
        int count;
@@ -284,10 +292,23 @@ struct pktgen_dev {
        __u16 udp_dst_min;      /* inclusive, dest UDP port */
        __u16 udp_dst_max;      /* exclusive, dest UDP port */
 
+       /* DSCP + ECN */
+       __u8 tos;            /* six most significant bits of (former) IPv4 TOS are for dscp codepoint */
+       __u8 traffic_class;  /* ditto for the (former) Traffic Class in IPv6 (see RFC 3260, sec. 4) */
+
        /* MPLS */
        unsigned nr_labels;     /* Depth of stack, 0 = no MPLS */
        __be32 labels[MAX_MPLS_LABELS];
 
+       /* VLAN/SVLAN (802.1Q/Q-in-Q) */
+       __u8  vlan_p;
+       __u8  vlan_cfi;
+       __u16 vlan_id;  /* 0xffff means no vlan tag */
+
+       __u8  svlan_p;
+       __u8  svlan_cfi;
+       __u16 svlan_id; /* 0xffff means no svlan tag */
+
        __u32 src_mac_count;    /* How many MACs to iterate through */
        __u32 dst_mac_count;    /* How many MACs to iterate through */
 
@@ -644,6 +665,24 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
                                   i == pkt_dev->nr_labels-1 ? "\n" : ", ");
        }
 
+       if (pkt_dev->vlan_id != 0xffff) {
+               seq_printf(seq, "     vlan_id: %u  vlan_p: %u  vlan_cfi: %u\n",
+                          pkt_dev->vlan_id, pkt_dev->vlan_p, pkt_dev->vlan_cfi);
+       }
+
+       if (pkt_dev->svlan_id != 0xffff) {
+               seq_printf(seq, "     svlan_id: %u  vlan_p: %u  vlan_cfi: %u\n",
+                          pkt_dev->svlan_id, pkt_dev->svlan_p, pkt_dev->svlan_cfi);
+       }
+
+       if (pkt_dev->tos) {
+               seq_printf(seq, "     tos: 0x%02x\n", pkt_dev->tos);
+       }
+
+       if (pkt_dev->traffic_class) {
+               seq_printf(seq, "     traffic_class: 0x%02x\n", pkt_dev->traffic_class);
+       }
+
        seq_printf(seq, "     Flags: ");
 
        if (pkt_dev->flags & F_IPV6)
@@ -673,6 +712,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
        if (pkt_dev->flags & F_MACDST_RND)
                seq_printf(seq, "MACDST_RND  ");
 
+       if (pkt_dev->flags & F_VID_RND)
+               seq_printf(seq, "VID_RND  ");
+
+       if (pkt_dev->flags & F_SVID_RND)
+               seq_printf(seq, "SVID_RND  ");
+
        seq_puts(seq, "\n");
 
        sa = pkt_dev->started_at;
@@ -715,12 +760,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
 }
 
 
-static int hex32_arg(const char __user *user_buffer, __u32 *num)
+static int hex32_arg(const char __user *user_buffer, unsigned long maxlen, __u32 *num)
 {
        int i = 0;
        *num = 0;
 
-       for(; i < 8; i++) {
+       for(; i < maxlen; i++) {
                char c;
                *num <<= 4;
                if (get_user(c, &user_buffer[i]))
@@ -815,7 +860,7 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev)
        pkt_dev->nr_labels = 0;
        do {
                __u32 tmp;
-               len = hex32_arg(&buffer[i], &tmp);
+               len = hex32_arg(&buffer[i], 8, &tmp);
                if (len <= 0)
                        return len;
                pkt_dev->labels[n] = htonl(tmp);
@@ -1140,11 +1185,27 @@ static ssize_t pktgen_if_write(struct file *file,
                else if (strcmp(f, "!MPLS_RND") == 0)
                        pkt_dev->flags &= ~F_MPLS_RND;
 
+               else if (strcmp(f, "VID_RND") == 0)
+                       pkt_dev->flags |= F_VID_RND;
+
+               else if (strcmp(f, "!VID_RND") == 0)
+                       pkt_dev->flags &= ~F_VID_RND;
+
+               else if (strcmp(f, "SVID_RND") == 0)
+                       pkt_dev->flags |= F_SVID_RND;
+
+               else if (strcmp(f, "!SVID_RND") == 0)
+                       pkt_dev->flags &= ~F_SVID_RND;
+
+               else if (strcmp(f, "!IPV6") == 0)
+                       pkt_dev->flags &= ~F_IPV6;
+
                else {
                        sprintf(pg_result,
                                "Flag -:%s:- unknown\nAvailable flags, (prepend ! to un-set flag):\n%s",
                                f,
-                               "IPSRC_RND, IPDST_RND, TXSIZE_RND, UDPSRC_RND, UDPDST_RND, MACSRC_RND, MACDST_RND\n");
+                               "IPSRC_RND, IPDST_RND, UDPSRC_RND, UDPDST_RND, "
+                               "MACSRC_RND, MACDST_RND, TXSIZE_RND, IPV6, MPLS_RND, VID_RND, SVID_RND\n");
                        return count;
                }
                sprintf(pg_result, "OK: flags=0x%x", pkt_dev->flags);
@@ -1445,6 +1506,160 @@ static ssize_t pktgen_if_write(struct file *file,
                        offset += sprintf(pg_result + offset,
                                          "%08x%s", ntohl(pkt_dev->labels[n]),
                                          n == pkt_dev->nr_labels-1 ? "" : ",");
+
+               if (pkt_dev->nr_labels && pkt_dev->vlan_id != 0xffff) {
+                       pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
+                       pkt_dev->svlan_id = 0xffff;
+
+                       if (debug)
+                               printk("pktgen: VLAN/SVLAN auto turned off\n");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "vlan_id")) {
+               len = num_arg(&user_buffer[i], 4, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if (value <= 4095) {
+                       pkt_dev->vlan_id = value;  /* turn on VLAN */
+
+                       if (debug)
+                               printk("pktgen: VLAN turned on\n");
+
+                       if (debug && pkt_dev->nr_labels)
+                               printk("pktgen: MPLS auto turned off\n");
+
+                       pkt_dev->nr_labels = 0;    /* turn off MPLS */
+                       sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id);
+               } else {
+                       pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
+                       pkt_dev->svlan_id = 0xffff;
+
+                       if (debug)
+                               printk("pktgen: VLAN/SVLAN turned off\n");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "vlan_p")) {
+               len = num_arg(&user_buffer[i], 1, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if ((value <= 7) && (pkt_dev->vlan_id != 0xffff)) {
+                       pkt_dev->vlan_p = value;
+                       sprintf(pg_result, "OK: vlan_p=%u", pkt_dev->vlan_p);
+               } else {
+                       sprintf(pg_result, "ERROR: vlan_p must be 0-7");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "vlan_cfi")) {
+               len = num_arg(&user_buffer[i], 1, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if ((value <= 1) && (pkt_dev->vlan_id != 0xffff)) {
+                       pkt_dev->vlan_cfi = value;
+                       sprintf(pg_result, "OK: vlan_cfi=%u", pkt_dev->vlan_cfi);
+               } else {
+                       sprintf(pg_result, "ERROR: vlan_cfi must be 0-1");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "svlan_id")) {
+               len = num_arg(&user_buffer[i], 4, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if ((value <= 4095) && ((pkt_dev->vlan_id != 0xffff))) {
+                       pkt_dev->svlan_id = value;  /* turn on SVLAN */
+
+                       if (debug)
+                               printk("pktgen: SVLAN turned on\n");
+
+                       if (debug && pkt_dev->nr_labels)
+                               printk("pktgen: MPLS auto turned off\n");
+
+                       pkt_dev->nr_labels = 0;    /* turn off MPLS */
+                       sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id);
+               } else {
+                       pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
+                       pkt_dev->svlan_id = 0xffff;
+
+                       if (debug)
+                               printk("pktgen: VLAN/SVLAN turned off\n");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "svlan_p")) {
+               len = num_arg(&user_buffer[i], 1, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if ((value <= 7) && (pkt_dev->svlan_id != 0xffff)) {
+                       pkt_dev->svlan_p = value;
+                       sprintf(pg_result, "OK: svlan_p=%u", pkt_dev->svlan_p);
+               } else {
+                       sprintf(pg_result, "ERROR: svlan_p must be 0-7");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "svlan_cfi")) {
+               len = num_arg(&user_buffer[i], 1, &value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if ((value <= 1) && (pkt_dev->svlan_id != 0xffff)) {
+                       pkt_dev->svlan_cfi = value;
+                       sprintf(pg_result, "OK: svlan_cfi=%u", pkt_dev->svlan_cfi);
+               } else {
+                       sprintf(pg_result, "ERROR: svlan_cfi must be 0-1");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "tos")) {
+               __u32 tmp_value = 0;
+               len = hex32_arg(&user_buffer[i], 2, &tmp_value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if (len == 2) {
+                       pkt_dev->tos = tmp_value;
+                       sprintf(pg_result, "OK: tos=0x%02x", pkt_dev->tos);
+               } else {
+                       sprintf(pg_result, "ERROR: tos must be 00-ff");
+               }
+               return count;
+       }
+
+       if (!strcmp(name, "traffic_class")) {
+               __u32 tmp_value = 0;
+               len = hex32_arg(&user_buffer[i], 2, &tmp_value);
+               if (len < 0) {
+                       return len;
+               }
+               i += len;
+               if (len == 2) {
+                       pkt_dev->traffic_class = tmp_value;
+                       sprintf(pg_result, "OK: traffic_class=0x%02x", pkt_dev->traffic_class);
+               } else {
+                       sprintf(pg_result, "ERROR: traffic_class must be 00-ff");
+               }
                return count;
        }
 
@@ -1949,6 +2164,14 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
                                                      htonl(0x000fffff));
        }
 
+       if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) {
+               pkt_dev->vlan_id = pktgen_random() % 4096;
+       }
+
+       if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) {
+               pkt_dev->svlan_id = pktgen_random() % 4096;
+       }
+
        if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) {
                if (pkt_dev->flags & F_UDPSRC_RND)
                        pkt_dev->cur_udp_src =
@@ -2092,10 +2315,18 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
        struct pktgen_hdr *pgh = NULL;
        __be16 protocol = __constant_htons(ETH_P_IP);
        __be32 *mpls;
+       __be16 *vlan_tci = NULL;                 /* Encapsulates priority and VLAN ID */
+       __be16 *vlan_encapsulated_proto = NULL;  /* packet type ID field (or len) for VLAN tag */
+       __be16 *svlan_tci = NULL;                /* Encapsulates priority and SVLAN ID */
+       __be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */
+
 
        if (pkt_dev->nr_labels)
                protocol = __constant_htons(ETH_P_MPLS_UC);
 
+       if (pkt_dev->vlan_id != 0xffff)
+               protocol = __constant_htons(ETH_P_8021Q);
+
        /* Update any of the values, used when we're incrementing various
         * fields.
         */
@@ -2103,7 +2334,9 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 
        datalen = (odev->hard_header_len + 16) & ~0xf;
        skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen +
-                       pkt_dev->nr_labels*sizeof(u32), GFP_ATOMIC);
+                       pkt_dev->nr_labels*sizeof(u32) +
+                       VLAN_TAG_SIZE(pkt_dev) + SVLAN_TAG_SIZE(pkt_dev),
+                       GFP_ATOMIC);
        if (!skb) {
                sprintf(pkt_dev->result, "No memory");
                return NULL;
@@ -2116,6 +2349,24 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
        mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32));
        if (pkt_dev->nr_labels)
                mpls_push(mpls, pkt_dev);
+
+       if (pkt_dev->vlan_id != 0xffff) {
+               if(pkt_dev->svlan_id != 0xffff) {
+                       svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
+                       *svlan_tci = htons(pkt_dev->svlan_id);
+                       *svlan_tci |= pkt_dev->svlan_p << 5;
+                       *svlan_tci |= pkt_dev->svlan_cfi << 4;
+                       svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
+                       *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
+               }
+               vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
+               *vlan_tci = htons(pkt_dev->vlan_id);
+               *vlan_tci |= pkt_dev->vlan_p << 5;
+               *vlan_tci |= pkt_dev->vlan_cfi << 4;
+               vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
+               *vlan_encapsulated_proto = __constant_htons(ETH_P_IP);
+       }
+
        iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr));
        udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr));
 
@@ -2124,7 +2375,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 
        /* Eth + IPh + UDPh + mpls */
        datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 -
-                 pkt_dev->nr_labels*sizeof(u32);
+                 pkt_dev->nr_labels*sizeof(u32) - VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev);
        if (datalen < sizeof(struct pktgen_hdr))
                datalen = sizeof(struct pktgen_hdr);
 
@@ -2136,7 +2387,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
        iph->ihl = 5;
        iph->version = 4;
        iph->ttl = 32;
-       iph->tos = 0;
+       iph->tos = pkt_dev->tos;
        iph->protocol = IPPROTO_UDP;    /* UDP */
        iph->saddr = pkt_dev->cur_saddr;
        iph->daddr = pkt_dev->cur_daddr;
@@ -2146,7 +2397,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
        iph->check = 0;
        iph->check = ip_fast_csum((void *)iph, iph->ihl);
        skb->protocol = protocol;
-       skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32);
+       skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) -
+               VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev);
        skb->dev = odev;
        skb->pkt_type = PACKET_HOST;
        skb->nh.iph = iph;
@@ -2218,7 +2470,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
                pgh->tv_sec = htonl(timestamp.tv_sec);
                pgh->tv_usec = htonl(timestamp.tv_usec);
        }
-       pkt_dev->seq_num++;
 
        return skb;
 }
@@ -2402,17 +2653,26 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
        struct pktgen_hdr *pgh = NULL;
        __be16 protocol = __constant_htons(ETH_P_IPV6);
        __be32 *mpls;
+       __be16 *vlan_tci = NULL;                 /* Encapsulates priority and VLAN ID */
+       __be16 *vlan_encapsulated_proto = NULL;  /* packet type ID field (or len) for VLAN tag */
+       __be16 *svlan_tci = NULL;                /* Encapsulates priority and SVLAN ID */
+       __be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */
 
        if (pkt_dev->nr_labels)
                protocol = __constant_htons(ETH_P_MPLS_UC);
 
+       if (pkt_dev->vlan_id != 0xffff)
+               protocol = __constant_htons(ETH_P_8021Q);
+
        /* Update any of the values, used when we're incrementing various
         * fields.
         */
        mod_cur_headers(pkt_dev);
 
        skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16 +
-                       pkt_dev->nr_labels*sizeof(u32), GFP_ATOMIC);
+                       pkt_dev->nr_labels*sizeof(u32) +
+                       VLAN_TAG_SIZE(pkt_dev) + SVLAN_TAG_SIZE(pkt_dev),
+                       GFP_ATOMIC);
        if (!skb) {
                sprintf(pkt_dev->result, "No memory");
                return NULL;
@@ -2425,16 +2685,34 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
        mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32));
        if (pkt_dev->nr_labels)
                mpls_push(mpls, pkt_dev);
+
+       if (pkt_dev->vlan_id != 0xffff) {
+               if(pkt_dev->svlan_id != 0xffff) {
+                       svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
+                       *svlan_tci = htons(pkt_dev->svlan_id);
+                       *svlan_tci |= pkt_dev->svlan_p << 5;
+                       *svlan_tci |= pkt_dev->svlan_cfi << 4;
+                       svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
+                       *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
+               }
+               vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
+               *vlan_tci = htons(pkt_dev->vlan_id);
+               *vlan_tci |= pkt_dev->vlan_p << 5;
+               *vlan_tci |= pkt_dev->vlan_cfi << 4;
+               vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
+               *vlan_encapsulated_proto = __constant_htons(ETH_P_IPV6);
+       }
+
        iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr));
        udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr));
 
        memcpy(eth, pkt_dev->hh, 12);
-       *(u16 *) & eth[12] = __constant_htons(ETH_P_IPV6);
+       *(u16 *) & eth[12] = protocol;
 
        /* Eth + IPh + UDPh + mpls */
        datalen = pkt_dev->cur_pkt_size - 14 -
                  sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
-                 pkt_dev->nr_labels*sizeof(u32);
+                 pkt_dev->nr_labels*sizeof(u32) - VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev);
 
        if (datalen < sizeof(struct pktgen_hdr)) {
                datalen = sizeof(struct pktgen_hdr);
@@ -2450,6 +2728,11 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 
        *(u32 *) iph = __constant_htonl(0x60000000);    /* Version + flow */
 
+       if (pkt_dev->traffic_class) {
+               /* Version + traffic class + flow (0) */
+               *(u32 *)iph |= htonl(0x60000000 | (pkt_dev->traffic_class << 20));
+       }
+
        iph->hop_limit = 32;
 
        iph->payload_len = htons(sizeof(struct udphdr) + datalen);
@@ -2458,7 +2741,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
        ipv6_addr_copy(&iph->daddr, &pkt_dev->cur_in6_daddr);
        ipv6_addr_copy(&iph->saddr, &pkt_dev->cur_in6_saddr);
 
-       skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32);
+       skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) -
+               VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev);
        skb->protocol = protocol;
        skb->dev = odev;
        skb->pkt_type = PACKET_HOST;
@@ -2531,7 +2815,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
                pgh->tv_sec = htonl(timestamp.tv_sec);
                pgh->tv_usec = htonl(timestamp.tv_usec);
        }
-       pkt_dev->seq_num++;
+       /* pkt_dev->seq_num++; FF: you really mean this? */
 
        return skb;
 }
@@ -3177,6 +3461,13 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
        pkt_dev->udp_dst_min = 9;
        pkt_dev->udp_dst_max = 9;
 
+       pkt_dev->vlan_p = 0;
+       pkt_dev->vlan_cfi = 0;
+       pkt_dev->vlan_id = 0xffff;
+       pkt_dev->svlan_p = 0;
+       pkt_dev->svlan_cfi = 0;
+       pkt_dev->svlan_id = 0xffff;
+
        strncpy(pkt_dev->ifname, ifname, IFNAMSIZ);
 
        if (!pktgen_setup_dev(pkt_dev)) {
index d8e25e08cb7e7b725b3cc5cfb6e34cdf67a11532..221e4038216b8da1e61a67b32087eb146b02af3c 100644 (file)
@@ -562,7 +562,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
        if (err < 0)
-               goto errout;
+               return err;
 
        ifm = nlmsg_data(nlh);
        if (ifm->ifi_index >= 0) {
index 2682490777dec6ceea515596d11f6c7117910147..94c5d761c830e3a156501b9e0320ec16929d5564 100644 (file)
@@ -3,7 +3,7 @@
  *
  *     Authors:
  *     net_random Alan Cox
- *     net_ratelimit Andy Kleen
+ *     net_ratelimit Andi Kleen
  *     in{4,6}_pton YOSHIFUJI Hideaki, Copyright (C)2006 USAGI/WIDE Project
  *
  *     Created by Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
index 66be29b6f508484b180fecf63356d09667bc90c1..bf692c1c116f69a1384d7124c03212ee2d504ebb 100644 (file)
@@ -50,7 +50,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        struct dccp_sock *dp = dccp_sk(sk);
        const struct sockaddr_in *usin = (struct sockaddr_in *)uaddr;
        struct rtable *rt;
-       u32 daddr, nexthop;
+       __be32 daddr, nexthop;
        int tmp;
        int err;
 
index 43863933f27f92dc0c6f09556dfee953fab08704..4bd78c8cfb26fe9f229813613a14b0548de3a4d1 100644 (file)
@@ -223,7 +223,7 @@ static int eth_header_parse(struct sk_buff *skb, unsigned char *haddr)
  */
 int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh)
 {
-       unsigned short type = hh->hh_type;
+       __be16 type = hh->hh_type;
        struct ethhdr *eth;
        struct net_device *dev = neigh->dev;
 
index fdd89e37b9aaccfd17532352822b3140a6b61578..edcf0932ac6de06a96c0dc9699d662cf5539a140 100644 (file)
@@ -996,7 +996,7 @@ static int inet_sk_reselect_saddr(struct sock *sk)
        struct rtable *rt;
        __u32 old_saddr = inet->saddr;
        __u32 new_saddr;
-       __u32 daddr = inet->daddr;
+       __be32 daddr = inet->daddr;
 
        if (inet->opt && inet->opt->srr)
                daddr = inet->opt->faddr;
@@ -1043,7 +1043,7 @@ int inet_sk_rebuild_header(struct sock *sk)
 {
        struct inet_sock *inet = inet_sk(sk);
        struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0);
-       u32 daddr;
+       __be32 daddr;
        int err;
 
        /* Route is OK, nothing to do. */
@@ -1342,10 +1342,10 @@ static int __init inet_init(void)
        rc = 0;
 out:
        return rc;
-out_unregister_tcp_proto:
-       proto_unregister(&tcp_prot);
 out_unregister_udp_proto:
        proto_unregister(&udp_prot);
+out_unregister_tcp_proto:
+       proto_unregister(&tcp_prot);
        goto out;
 }
 
index c8a3723bc001b0a744d382a4a353c2c902a28ddd..cfe5c84742865c56c0e6b40702bdf54b14f4f752 100644 (file)
@@ -234,7 +234,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev)
 
 static int arp_constructor(struct neighbour *neigh)
 {
-       u32 addr = *(u32*)neigh->primary_key;
+       __be32 addr = *(__be32*)neigh->primary_key;
        struct net_device *dev = neigh->dev;
        struct in_device *in_dev;
        struct neigh_parms *parms;
@@ -330,10 +330,10 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
 
 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 {
-       u32 saddr = 0;
+       __be32 saddr = 0;
        u8  *dst_ha = NULL;
        struct net_device *dev = neigh->dev;
-       u32 target = *(u32*)neigh->primary_key;
+       __be32 target = *(__be32*)neigh->primary_key;
        int probes = atomic_read(&neigh->probes);
        struct in_device *in_dev = in_dev_get(dev);
 
@@ -385,7 +385,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 }
 
 static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
-                     u32 sip, u32 tip)
+                     __be32 sip, __be32 tip)
 {
        int scope;
 
@@ -420,7 +420,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
        return !inet_confirm_addr(dev, sip, tip, scope);
 }
 
-static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev)
+static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
 {
        struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip,
                                                 .saddr = tip } } };
@@ -449,7 +449,7 @@ static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev)
  *     is allowed to use this function, it is scheduled to be removed. --ANK
  */
 
-static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, struct net_device * dev)
+static int arp_set_predefined(int addr_hint, unsigned char * haddr, __be32 paddr, struct net_device * dev)
 {
        switch (addr_hint) {
        case RTN_LOCAL:
@@ -470,7 +470,7 @@ static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, s
 int arp_find(unsigned char *haddr, struct sk_buff *skb)
 {
        struct net_device *dev = skb->dev;
-       u32 paddr;
+       __be32 paddr;
        struct neighbour *n;
 
        if (!skb->dst) {
@@ -511,7 +511,7 @@ int arp_bind_neighbour(struct dst_entry *dst)
        if (dev == NULL)
                return -EINVAL;
        if (n == NULL) {
-               u32 nexthop = ((struct rtable*)dst)->rt_gateway;
+               __be32 nexthop = ((struct rtable*)dst)->rt_gateway;
                if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT))
                        nexthop = 0;
                n = __neigh_lookup_errno(
@@ -560,8 +560,8 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt)
  *     Create an arp packet. If (dest_hw == NULL), we create a broadcast
  *     message.
  */
-struct sk_buff *arp_create(int type, int ptype, u32 dest_ip,
-                          struct net_device *dev, u32 src_ip,
+struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
+                          struct net_device *dev, __be32 src_ip,
                           unsigned char *dest_hw, unsigned char *src_hw,
                           unsigned char *target_hw)
 {
@@ -675,8 +675,8 @@ void arp_xmit(struct sk_buff *skb)
 /*
  *     Create and send an arp packet.
  */
-void arp_send(int type, int ptype, u32 dest_ip, 
-             struct net_device *dev, u32 src_ip, 
+void arp_send(int type, int ptype, __be32 dest_ip,
+             struct net_device *dev, __be32 src_ip,
              unsigned char *dest_hw, unsigned char *src_hw,
              unsigned char *target_hw)
 {
@@ -710,7 +710,7 @@ static int arp_process(struct sk_buff *skb)
        unsigned char *arp_ptr;
        struct rtable *rt;
        unsigned char *sha, *tha;
-       u32 sip, tip;
+       __be32 sip, tip;
        u16 dev_type = dev->type;
        int addr_type;
        struct neighbour *n;
@@ -969,13 +969,13 @@ out_of_mem:
 
 static int arp_req_set(struct arpreq *r, struct net_device * dev)
 {
-       u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
+       __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
        struct neighbour *neigh;
        int err;
 
        if (r->arp_flags&ATF_PUBL) {
-               u32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr;
-               if (mask && mask != 0xFFFFFFFF)
+               __be32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr;
+               if (mask && mask != htonl(0xFFFFFFFF))
                        return -EINVAL;
                if (!dev && (r->arp_flags & ATF_COM)) {
                        dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data);
@@ -1063,7 +1063,7 @@ static unsigned arp_state_to_flags(struct neighbour *neigh)
 
 static int arp_req_get(struct arpreq *r, struct net_device *dev)
 {
-       u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
+       __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
        struct neighbour *neigh;
        int err = -ENXIO;
 
@@ -1084,13 +1084,13 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
 static int arp_req_delete(struct arpreq *r, struct net_device * dev)
 {
        int err;
-       u32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
+       __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
        struct neighbour *neigh;
 
        if (r->arp_flags & ATF_PUBL) {
-               u32 mask =
+               __be32 mask =
                       ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
-               if (mask == 0xFFFFFFFF)
+               if (mask == htonl(0xFFFFFFFF))
                        return pneigh_delete(&arp_tbl, &ip, dev);
                if (mask == 0) {
                        if (dev == NULL) {
index e6ce0b3ba62a49ed8aef7ae0c6f4541a67a3d53d..c4e469ff842d46ca0c0eb367fcb52d69d752c976 100644 (file)
@@ -474,6 +474,7 @@ doi_add_failure_rlock:
 /**
  * cipso_v4_doi_remove - Remove an existing DOI from the CIPSO protocol engine
  * @doi: the DOI value
+ * @audit_secid: the LSM secid to use in the audit message
  * @callback: the DOI cleanup/free callback
  *
  * Description:
@@ -483,7 +484,9 @@ doi_add_failure_rlock:
  * success and negative values on failure.
  *
  */
-int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head))
+int cipso_v4_doi_remove(u32 doi,
+                       u32 audit_secid,
+                       void (*callback) (struct rcu_head * head))
 {
        struct cipso_v4_doi *doi_def;
        struct cipso_v4_domhsh_entry *dom_iter;
@@ -502,7 +505,8 @@ int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head))
                spin_unlock(&cipso_v4_doi_list_lock);
                list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list)
                        if (dom_iter->valid)
-                               netlbl_domhsh_remove(dom_iter->domain);
+                               netlbl_domhsh_remove(dom_iter->domain,
+                                                    audit_secid);
                cipso_v4_cache_invalidate();
                rcu_read_unlock();
 
index ec5da4fbd9f43d84fd961de6e855455591e49311..7b068a891953aae4d9e377438319815c3439259b 100644 (file)
@@ -25,7 +25,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        struct inet_sock *inet = inet_sk(sk);
        struct sockaddr_in *usin = (struct sockaddr_in *) uaddr;
        struct rtable *rt;
-       u32 saddr;
+       __be32 saddr;
        int oif;
        int err;
 
index 8e8d1f17d77a7c29009fbcbc760a290259d5afc2..7602c79a389bece923dc5dfd8b00b524690d8d85 100644 (file)
@@ -224,7 +224,7 @@ static void inetdev_destroy(struct in_device *in_dev)
        call_rcu(&in_dev->rcu_head, in_dev_rcu_put);
 }
 
-int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b)
+int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b)
 {
        rcu_read_lock();
        for_primary_ifa(in_dev) {
@@ -429,8 +429,8 @@ struct in_device *inetdev_by_index(int ifindex)
 
 /* Called only from RTNL semaphored context. No locks. */
 
-struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix,
-                                   u32 mask)
+struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
+                                   __be32 mask)
 {
        ASSERT_RTNL();
 
@@ -467,7 +467,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
        for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
             ifap = &ifa->ifa_next) {
                if (tb[IFA_LOCAL] &&
-                   ifa->ifa_local != nla_get_u32(tb[IFA_LOCAL]))
+                   ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL]))
                        continue;
 
                if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label))
@@ -475,7 +475,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
 
                if (tb[IFA_ADDRESS] &&
                    (ifm->ifa_prefixlen != ifa->ifa_prefixlen ||
-                   !inet_ifa_match(nla_get_u32(tb[IFA_ADDRESS]), ifa)))
+                   !inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa)))
                        continue;
 
                __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).pid);
@@ -540,14 +540,14 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
        ifa->ifa_scope = ifm->ifa_scope;
        ifa->ifa_dev = in_dev;
 
-       ifa->ifa_local = nla_get_u32(tb[IFA_LOCAL]);
-       ifa->ifa_address = nla_get_u32(tb[IFA_ADDRESS]);
+       ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]);
+       ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]);
 
        if (tb[IFA_BROADCAST])
-               ifa->ifa_broadcast = nla_get_u32(tb[IFA_BROADCAST]);
+               ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]);
 
        if (tb[IFA_ANYCAST])
-               ifa->ifa_anycast = nla_get_u32(tb[IFA_ANYCAST]);
+               ifa->ifa_anycast = nla_get_be32(tb[IFA_ANYCAST]);
 
        if (tb[IFA_LABEL])
                nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
@@ -805,7 +805,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
                        break;
                ret = 0;
                if (ifa->ifa_mask != sin->sin_addr.s_addr) {
-                       u32 old_mask = ifa->ifa_mask;
+                       __be32 old_mask = ifa->ifa_mask;
                        inet_del_ifa(in_dev, ifap, 0);
                        ifa->ifa_mask = sin->sin_addr.s_addr;
                        ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask);
@@ -876,9 +876,9 @@ out:
        return done;
 }
 
-u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope)
+__be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)
 {
-       u32 addr = 0;
+       __be32 addr = 0;
        struct in_device *in_dev;
 
        rcu_read_lock();
@@ -927,11 +927,11 @@ out:
        return addr;
 }
 
-static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst,
-                             u32 local, int scope)
+static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst,
+                             __be32 local, int scope)
 {
        int same = 0;
-       u32 addr = 0;
+       __be32 addr = 0;
 
        for_ifa(in_dev) {
                if (!addr &&
@@ -971,9 +971,9 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst,
  * - local: address, 0=autoselect the local address
  * - scope: maximum allowed scope value for the local address
  */
-u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope)
+__be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope)
 {
-       u32 addr = 0;
+       __be32 addr = 0;
        struct in_device *in_dev;
 
        if (dev) {
@@ -1138,16 +1138,16 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
        ifm->ifa_index = ifa->ifa_dev->dev->ifindex;
 
        if (ifa->ifa_address)
-               NLA_PUT_U32(skb, IFA_ADDRESS, ifa->ifa_address);
+               NLA_PUT_BE32(skb, IFA_ADDRESS, ifa->ifa_address);
 
        if (ifa->ifa_local)
-               NLA_PUT_U32(skb, IFA_LOCAL, ifa->ifa_local);
+               NLA_PUT_BE32(skb, IFA_LOCAL, ifa->ifa_local);
 
        if (ifa->ifa_broadcast)
-               NLA_PUT_U32(skb, IFA_BROADCAST, ifa->ifa_broadcast);
+               NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast);
 
        if (ifa->ifa_anycast)
-               NLA_PUT_U32(skb, IFA_ANYCAST, ifa->ifa_anycast);
+               NLA_PUT_BE32(skb, IFA_ANYCAST, ifa->ifa_anycast);
 
        if (ifa->ifa_label[0])
                NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label);
index cfb527c060e48e4235063591a349ae91e7bb263a..9c399a70dd5d5962f3e47ad9e82cae0ae8b46c7b 100644 (file)
@@ -122,7 +122,7 @@ static void fib_flush(void)
  *     Find the first device with a given source address.
  */
 
-struct net_device * ip_dev_find(u32 addr)
+struct net_device * ip_dev_find(__be32 addr)
 {
        struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
        struct fib_result res;
@@ -146,7 +146,7 @@ out:
        return dev;
 }
 
-unsigned inet_addr_type(u32 addr)
+unsigned inet_addr_type(__be32 addr)
 {
        struct flowi            fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
        struct fib_result       res;
@@ -180,8 +180,8 @@ unsigned inet_addr_type(u32 addr)
    - check, that packet arrived from expected physical interface.
  */
 
-int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
-                       struct net_device *dev, u32 *spec_dst, u32 *itag)
+int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
+                       struct net_device *dev, __be32 *spec_dst, u32 *itag)
 {
        struct in_device *in_dev;
        struct flowi fl = { .nl_u = { .ip4_u =
@@ -253,7 +253,7 @@ e_inval:
 
 #ifndef CONFIG_IP_NOSIOCRT
 
-static inline u32 sk_extract_addr(struct sockaddr *addr)
+static inline __be32 sk_extract_addr(struct sockaddr *addr)
 {
        return ((struct sockaddr_in *) addr)->sin_addr.s_addr;
 }
@@ -273,7 +273,7 @@ static int put_rtax(struct nlattr *mx, int len, int type, u32 value)
 static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
                                 struct fib_config *cfg)
 {
-       u32 addr;
+       __be32 addr;
        int plen;
 
        memset(cfg, 0, sizeof(*cfg));
@@ -292,7 +292,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
        plen = 32;
        addr = sk_extract_addr(&rt->rt_dst);
        if (!(rt->rt_flags & RTF_HOST)) {
-               u32 mask = sk_extract_addr(&rt->rt_genmask);
+               __be32 mask = sk_extract_addr(&rt->rt_genmask);
 
                if (rt->rt_genmask.sa_family != AF_INET) {
                        if (mask || rt->rt_genmask.sa_family)
@@ -499,22 +499,22 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) {
                switch (attr->nla_type) {
                case RTA_DST:
-                       cfg->fc_dst = nla_get_u32(attr);
+                       cfg->fc_dst = nla_get_be32(attr);
                        break;
                case RTA_SRC:
-                       cfg->fc_src = nla_get_u32(attr);
+                       cfg->fc_src = nla_get_be32(attr);
                        break;
                case RTA_OIF:
                        cfg->fc_oif = nla_get_u32(attr);
                        break;
                case RTA_GATEWAY:
-                       cfg->fc_gw = nla_get_u32(attr);
+                       cfg->fc_gw = nla_get_be32(attr);
                        break;
                case RTA_PRIORITY:
                        cfg->fc_priority = nla_get_u32(attr);
                        break;
                case RTA_PREFSRC:
-                       cfg->fc_prefsrc = nla_get_u32(attr);
+                       cfg->fc_prefsrc = nla_get_be32(attr);
                        break;
                case RTA_METRICS:
                        cfg->fc_mx = nla_data(attr);
@@ -627,8 +627,7 @@ out:
    only when netlink is already locked.
  */
 
-static void fib_magic(int cmd, int type, u32 dst, int dst_len,
-                     struct in_ifaddr *ifa)
+static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa)
 {
        struct fib_table *tb;
        struct fib_config cfg = {
@@ -667,9 +666,9 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
        struct in_device *in_dev = ifa->ifa_dev;
        struct net_device *dev = in_dev->dev;
        struct in_ifaddr *prim = ifa;
-       u32 mask = ifa->ifa_mask;
-       u32 addr = ifa->ifa_local;
-       u32 prefix = ifa->ifa_address&mask;
+       __be32 mask = ifa->ifa_mask;
+       __be32 addr = ifa->ifa_local;
+       __be32 prefix = ifa->ifa_address&mask;
 
        if (ifa->ifa_flags&IFA_F_SECONDARY) {
                prim = inet_ifa_byprefix(in_dev, prefix, mask);
@@ -685,7 +684,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
                return;
 
        /* Add broadcast address, if it is explicitly assigned. */
-       if (ifa->ifa_broadcast && ifa->ifa_broadcast != 0xFFFFFFFF)
+       if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF))
                fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim);
 
        if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) &&
@@ -707,8 +706,8 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
        struct net_device *dev = in_dev->dev;
        struct in_ifaddr *ifa1;
        struct in_ifaddr *prim = ifa;
-       u32 brd = ifa->ifa_address|~ifa->ifa_mask;
-       u32 any = ifa->ifa_address&ifa->ifa_mask;
+       __be32 brd = ifa->ifa_address|~ifa->ifa_mask;
+       __be32 any = ifa->ifa_address&ifa->ifa_mask;
 #define LOCAL_OK       1
 #define BRD_OK         2
 #define BRD0_OK                4
index 88133b383dc586cc95ee0c482cc019f8db4730b4..107bb6cbb0b370be0f8e10b0d434a432fbc3ebdd 100644 (file)
@@ -51,7 +51,7 @@ static kmem_cache_t *fn_alias_kmem __read_mostly;
 struct fib_node {
        struct hlist_node       fn_hash;
        struct list_head        fn_alias;
-       u32                     fn_key;
+       __be32                  fn_key;
 };
 
 struct fn_zone {
@@ -64,7 +64,7 @@ struct fn_zone {
 #define FZ_HASHMASK(fz)                ((fz)->fz_hashmask)
 
        int                     fz_order;       /* Zone order           */
-       u32                     fz_mask;
+       __be32                  fz_mask;
 #define FZ_MASK(fz)            ((fz)->fz_mask)
 };
 
@@ -77,7 +77,7 @@ struct fn_hash {
        struct fn_zone  *fn_zone_list;
 };
 
-static inline u32 fn_hash(u32 key, struct fn_zone *fz)
+static inline u32 fn_hash(__be32 key, struct fn_zone *fz)
 {
        u32 h = ntohl(key)>>(32 - fz->fz_order);
        h ^= (h>>20);
@@ -87,7 +87,7 @@ static inline u32 fn_hash(u32 key, struct fn_zone *fz)
        return h;
 }
 
-static inline u32 fz_key(u32 dst, struct fn_zone *fz)
+static inline __be32 fz_key(__be32 dst, struct fn_zone *fz)
 {
        return dst & FZ_MASK(fz);
 }
@@ -254,7 +254,7 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
                struct hlist_head *head;
                struct hlist_node *node;
                struct fib_node *f;
-               u32 k = fz_key(flp->fl4_dst, fz);
+               __be32 k = fz_key(flp->fl4_dst, fz);
 
                head = &fz->fz_hash[fn_hash(k, fz)];
                hlist_for_each_entry(f, node, head, fn_hash) {
@@ -365,7 +365,7 @@ static inline void fib_insert_node(struct fn_zone *fz, struct fib_node *f)
 }
 
 /* Return the node in FZ matching KEY. */
-static struct fib_node *fib_find_node(struct fn_zone *fz, u32 key)
+static struct fib_node *fib_find_node(struct fn_zone *fz, __be32 key)
 {
        struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)];
        struct hlist_node *node;
@@ -387,7 +387,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
        struct fn_zone *fz;
        struct fib_info *fi;
        u8 tos = cfg->fc_tos;
-       u32 key;
+       __be32 key;
        int err;
 
        if (cfg->fc_dst_len > 32)
@@ -541,7 +541,7 @@ static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg)
        struct fib_node *f;
        struct fib_alias *fa, *fa_to_delete;
        struct fn_zone *fz;
-       u32 key;
+       __be32 key;
 
        if (cfg->fc_dst_len > 32)
                return -EINVAL;
@@ -966,7 +966,7 @@ static void fib_seq_stop(struct seq_file *seq, void *v)
        read_unlock(&fib_hash_lock);
 }
 
-static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi)
+static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi)
 {
        static const unsigned type2flags[RTN_MAX + 1] = {
                [7] = RTF_REJECT, [8] = RTF_REJECT,
@@ -975,7 +975,7 @@ static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi)
 
        if (fi && fi->fib_nh->nh_gw)
                flags |= RTF_GATEWAY;
-       if (mask == 0xFFFFFFFF)
+       if (mask == htonl(0xFFFFFFFF))
                flags |= RTF_HOST;
        flags |= RTF_UP;
        return flags;
@@ -991,7 +991,7 @@ static int fib_seq_show(struct seq_file *seq, void *v)
 {
        struct fib_iter_state *iter;
        char bf[128];
-       u32 prefix, mask;
+       __be32 prefix, mask;
        unsigned flags;
        struct fib_node *f;
        struct fib_alias *fa;
index fd6f7769f8ab7fd0278fe1f65b02a677db44b688..0e8b70bad4e194b6f4a3968acb127b2387b6c2fe 100644 (file)
@@ -20,16 +20,16 @@ struct fib_alias {
 /* Exported by fib_semantics.c */
 extern int fib_semantic_match(struct list_head *head,
                              const struct flowi *flp,
-                             struct fib_result *res, __u32 zone, __u32 mask,
+                             struct fib_result *res, __be32 zone, __be32 mask,
                                int prefixlen);
 extern void fib_release_info(struct fib_info *);
 extern struct fib_info *fib_create_info(struct fib_config *cfg);
 extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi);
 extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
-                        u32 tb_id, u8 type, u8 scope, u32 dst,
+                        u32 tb_id, u8 type, u8 scope, __be32 dst,
                         int dst_len, u8 tos, struct fib_info *fi,
                         unsigned int);
-extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa,
+extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
                      int dst_len, u32 tb_id, struct nl_info *info);
 extern struct fib_alias *fib_find_alias(struct list_head *fah,
                                        u8 tos, u32 prio);
index 52b2adae4f2230ae2af02f7a51efab6ab9516615..0852b9cd065a27bad02c3759c2262fcebf08405e 100644 (file)
@@ -40,10 +40,10 @@ struct fib4_rule
        u8                      dst_len;
        u8                      src_len;
        u8                      tos;
-       u32                     src;
-       u32                     srcmask;
-       u32                     dst;
-       u32                     dstmask;
+       __be32                  src;
+       __be32                  srcmask;
+       __be32                  dst;
+       __be32                  dstmask;
 #ifdef CONFIG_IP_ROUTE_FWMARK
        u32                     fwmark;
        u32                     fwmask;
@@ -150,8 +150,8 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res)
 static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 {
        struct fib4_rule *r = (struct fib4_rule *) rule;
-       u32 daddr = fl->fl4_dst;
-       u32 saddr = fl->fl4_src;
+       __be32 daddr = fl->fl4_dst;
+       __be32 saddr = fl->fl4_src;
 
        if (((saddr ^ r->src) & r->srcmask) ||
            ((daddr ^ r->dst) & r->dstmask))
@@ -215,10 +215,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        }
 
        if (tb[FRA_SRC])
-               rule4->src = nla_get_u32(tb[FRA_SRC]);
+               rule4->src = nla_get_be32(tb[FRA_SRC]);
 
        if (tb[FRA_DST])
-               rule4->dst = nla_get_u32(tb[FRA_DST]);
+               rule4->dst = nla_get_be32(tb[FRA_DST]);
 
 #ifdef CONFIG_IP_ROUTE_FWMARK
        if (tb[FRA_FWMARK]) {
@@ -277,10 +277,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
                return 0;
 #endif
 
-       if (tb[FRA_SRC] && (rule4->src != nla_get_u32(tb[FRA_SRC])))
+       if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC])))
                return 0;
 
-       if (tb[FRA_DST] && (rule4->dst != nla_get_u32(tb[FRA_DST])))
+       if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST])))
                return 0;
 
        return 1;
@@ -305,10 +305,10 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
 #endif
 
        if (rule4->dst_len)
-               NLA_PUT_U32(skb, FRA_DST, rule4->dst);
+               NLA_PUT_BE32(skb, FRA_DST, rule4->dst);
 
        if (rule4->src_len)
-               NLA_PUT_U32(skb, FRA_SRC, rule4->src);
+               NLA_PUT_BE32(skb, FRA_SRC, rule4->src);
 
 #ifdef CONFIG_NET_CLS_ROUTE
        if (rule4->tclassid)
index 2ead09543f68899bef4ef584fd2c029d9e8b7df9..884d176e0082f3a230b9fa360ba4dc37518f2cb9 100644 (file)
@@ -203,7 +203,7 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi)
        unsigned int val = fi->fib_nhs;
 
        val ^= fi->fib_protocol;
-       val ^= fi->fib_prefsrc;
+       val ^= (__force u32)fi->fib_prefsrc;
        val ^= fi->fib_priority;
 
        return (val ^ (val >> 7) ^ (val >> 12)) & mask;
@@ -248,7 +248,7 @@ static inline unsigned int fib_devindex_hashfn(unsigned int val)
    Used only by redirect accept routine.
  */
 
-int ip_fib_check_default(u32 gw, struct net_device *dev)
+int ip_fib_check_default(__be32 gw, struct net_device *dev)
 {
        struct hlist_head *head;
        struct hlist_node *node;
@@ -273,7 +273,7 @@ int ip_fib_check_default(u32 gw, struct net_device *dev)
        return -1;
 }
 
-void rtmsg_fib(int event, u32 key, struct fib_alias *fa,
+void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
               int dst_len, u32 tb_id, struct nl_info *info)
 {
        struct sk_buff *skb;
@@ -374,7 +374,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
                        struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
 
                        nla = nla_find(attrs, attrlen, RTA_GATEWAY);
-                       nh->nh_gw = nla ? nla_get_u32(nla) : 0;
+                       nh->nh_gw = nla ? nla_get_be32(nla) : 0;
 #ifdef CONFIG_NET_CLS_ROUTE
                        nla = nla_find(attrs, attrlen, RTA_FLOW);
                        nh->nh_tclassid = nla ? nla_get_u32(nla) : 0;
@@ -427,7 +427,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
                        struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
 
                        nla = nla_find(attrs, attrlen, RTA_GATEWAY);
-                       if (nla && nla_get_u32(nla) != nh->nh_gw)
+                       if (nla && nla_get_be32(nla) != nh->nh_gw)
                                return 1;
 #ifdef CONFIG_NET_CLS_ROUTE
                        nla = nla_find(attrs, attrlen, RTA_FLOW);
@@ -568,11 +568,11 @@ out:
        return 0;
 }
 
-static inline unsigned int fib_laddr_hashfn(u32 val)
+static inline unsigned int fib_laddr_hashfn(__be32 val)
 {
        unsigned int mask = (fib_hash_size - 1);
 
-       return (val ^ (val >> 7) ^ (val >> 14)) & mask;
+       return ((__force u32)val ^ ((__force u32)val >> 7) ^ ((__force u32)val >> 14)) & mask;
 }
 
 static struct hlist_head *fib_hash_alloc(int bytes)
@@ -847,7 +847,7 @@ failure:
 
 /* Note! fib_semantic_match intentionally uses  RCU list functions. */
 int fib_semantic_match(struct list_head *head, const struct flowi *flp,
-                      struct fib_result *res, __u32 zone, __u32 mask, 
+                      struct fib_result *res, __be32 zone, __be32 mask,
                        int prefixlen)
 {
        struct fib_alias *fa;
@@ -914,8 +914,7 @@ out_fill_res:
        res->fi = fa->fa_info;
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
        res->netmask = mask;
-       res->network = zone &
-               (0xFFFFFFFF >> (32 - prefixlen));
+       res->network = zone & inet_make_mask(prefixlen);
 #endif
        atomic_inc(&res->fi->fib_clntref);
        return 0;
@@ -923,13 +922,13 @@ out_fill_res:
 
 /* Find appropriate source address to this destination */
 
-u32 __fib_res_prefsrc(struct fib_result *res)
+__be32 __fib_res_prefsrc(struct fib_result *res)
 {
        return inet_select_addr(FIB_RES_DEV(*res), FIB_RES_GW(*res), res->scope);
 }
 
 int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
-                 u32 tb_id, u8 type, u8 scope, u32 dst, int dst_len, u8 tos,
+                 u32 tb_id, u8 type, u8 scope, __be32 dst, int dst_len, u8 tos,
                  struct fib_info *fi, unsigned int flags)
 {
        struct nlmsghdr *nlh;
@@ -952,7 +951,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
        rtm->rtm_protocol = fi->fib_protocol;
 
        if (rtm->rtm_dst_len)
-               NLA_PUT_U32(skb, RTA_DST, dst);
+               NLA_PUT_BE32(skb, RTA_DST, dst);
 
        if (fi->fib_priority)
                NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority);
@@ -961,11 +960,11 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                goto nla_put_failure;
 
        if (fi->fib_prefsrc)
-               NLA_PUT_U32(skb, RTA_PREFSRC, fi->fib_prefsrc);
+               NLA_PUT_BE32(skb, RTA_PREFSRC, fi->fib_prefsrc);
 
        if (fi->fib_nhs == 1) {
                if (fi->fib_nh->nh_gw)
-                       NLA_PUT_U32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw);
+                       NLA_PUT_BE32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw);
 
                if (fi->fib_nh->nh_oif)
                        NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif);
@@ -993,7 +992,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                        rtnh->rtnh_ifindex = nh->nh_oif;
 
                        if (nh->nh_gw)
-                               NLA_PUT_U32(skb, RTA_GATEWAY, nh->nh_gw);
+                               NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw);
 #ifdef CONFIG_NET_CLS_ROUTE
                        if (nh->nh_tclassid)
                                NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid);
@@ -1018,7 +1017,7 @@ nla_put_failure:
    - device went down -> we must shutdown all nexthops going via it.
  */
 
-int fib_sync_down(u32 local, struct net_device *dev, int force)
+int fib_sync_down(__be32 local, struct net_device *dev, int force)
 {
        int ret = 0;
        int scope = RT_SCOPE_NOWHERE;
index 9c3ff6ba6e218e45c351c22f1eb8ff188442a509..d17990ec724f68d30fa6987e8c61fd7dc21fdd5d 100644 (file)
@@ -1834,7 +1834,7 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi
        int i, s_i;
        struct fib_alias *fa;
 
-       u32 xkey = htonl(key);
+       __be32 xkey = htonl(key);
 
        s_i = cb->args[4];
        i = 0;
@@ -2281,7 +2281,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
 
        if (IS_TNODE(n)) {
                struct tnode *tn = (struct tnode *) n;
-               t_key prf = ntohl(MASK_PFX(tn->key, tn->pos));
+               __be32 prf = htonl(MASK_PFX(tn->key, tn->pos));
 
                if (!NODE_PARENT(n)) {
                        if (iter->trie == trie_local)
@@ -2297,7 +2297,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
        } else {
                struct leaf *l = (struct leaf *) n;
                int i;
-               u32 val = ntohl(l->key);
+               __be32 val = htonl(l->key);
 
                seq_indent(seq, iter->depth);
                seq_printf(seq, "  |-- %d.%d.%d.%d\n", NIPQUAD(val));
@@ -2360,7 +2360,7 @@ static struct file_operations fib_trie_fops = {
        .release = seq_release_private,
 };
 
-static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi)
+static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi)
 {
        static unsigned type2flags[RTN_MAX + 1] = {
                [7] = RTF_REJECT, [8] = RTF_REJECT,
@@ -2369,7 +2369,7 @@ static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi)
 
        if (fi && fi->fib_nh->nh_gw)
                flags |= RTF_GATEWAY;
-       if (mask == 0xFFFFFFFF)
+       if (mask == htonl(0xFFFFFFFF))
                flags |= RTF_HOST;
        flags |= RTF_UP;
        return flags;
@@ -2403,7 +2403,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
        for (i=32; i>=0; i--) {
                struct leaf_info *li = find_leaf_info(l, i);
                struct fib_alias *fa;
-               u32 mask, prefix;
+               __be32 mask, prefix;
 
                if (!li)
                        continue;
index c2ad07e48ab4f97ad77af0a99fbd7202b7f048e4..b39a37a4754506c436b17a0be5bf3c2a6165f26e 100644 (file)
@@ -104,7 +104,7 @@ struct icmp_bxm {
 
        struct {
                struct icmphdr icmph;
-               __u32          times[3];
+               __be32         times[3];
        } data;
        int head_len;
        struct ip_options replyopts;
@@ -381,7 +381,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
        struct inet_sock *inet = inet_sk(sk);
        struct ipcm_cookie ipc;
        struct rtable *rt = (struct rtable *)skb->dst;
-       u32 daddr;
+       __be32 daddr;
 
        if (ip_options_echo(&icmp_param->replyopts, skb))
                return;
@@ -430,14 +430,14 @@ out_unlock:
  *                     MUST reply to only the first fragment.
  */
 
-void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
+void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
 {
        struct iphdr *iph;
        int room;
        struct icmp_bxm icmp_param;
        struct rtable *rt = (struct rtable *)skb_in->dst;
        struct ipcm_cookie ipc;
-       u32 saddr;
+       __be32 saddr;
        u8  tos;
 
        if (!rt)
@@ -895,7 +895,7 @@ static void icmp_address_reply(struct sk_buff *skb)
        if (in_dev->ifa_list &&
            IN_DEV_LOG_MARTIANS(in_dev) &&
            IN_DEV_FORWARD(in_dev)) {
-               u32 _mask, *mp;
+               __be32 _mask, *mp;
 
                mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
                BUG_ON(mp == NULL);
index 58be8227b0cb95975ef5eae527b4de88e352dd08..6eee71647b7c92f5fdcb69f43c68ce37c3b59cee 100644 (file)
                time_before(jiffies, (in_dev)->mr_v2_seen)))
 
 static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
-static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr);
+static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr);
 static void igmpv3_clear_delrec(struct in_device *in_dev);
 static int sf_setstate(struct ip_mc_list *pmc);
 static void sf_markstate(struct ip_mc_list *pmc);
 #endif
 static void ip_mc_clear_src(struct ip_mc_list *pmc);
-static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
-                        int sfcount, __u32 *psfsrc, int delta);
+static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
+                        int sfcount, __be32 *psfsrc, int delta);
 
 static void ip_ma_put(struct ip_mc_list *im)
 {
@@ -426,7 +426,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
        first = 1;
        psf_prev = NULL;
        for (psf=*psf_list; psf; psf=psf_next) {
-               u32 *psrc;
+               __be32 *psrc;
 
                psf_next = psf->sf_next;
 
@@ -439,7 +439,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
                if (isquery)
                        psf->sf_gsresp = 0;
 
-               if (AVAILABLE(skb) < sizeof(u32) +
+               if (AVAILABLE(skb) < sizeof(__be32) +
                    first*sizeof(struct igmpv3_grec)) {
                        if (truncate && !first)
                                break;   /* truncate these */
@@ -455,7 +455,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
                        skb = add_grhead(skb, pmc, type, &pgr);
                        first = 0;
                }
-               psrc = (u32 *)skb_put(skb, sizeof(u32));
+               psrc = (__be32 *)skb_put(skb, sizeof(__be32));
                *psrc = psf->sf_inaddr;
                scount++; stotal++;
                if ((type == IGMPV3_ALLOW_NEW_SOURCES ||
@@ -630,8 +630,8 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
        struct igmphdr *ih;
        struct rtable *rt;
        struct net_device *dev = in_dev->dev;
-       u32     group = pmc ? pmc->multiaddr : 0;
-       u32     dst;
+       __be32  group = pmc ? pmc->multiaddr : 0;
+       __be32  dst;
 
        if (type == IGMPV3_HOST_MEMBERSHIP_REPORT)
                return igmpv3_send_report(in_dev, pmc);
@@ -748,7 +748,7 @@ static void igmp_timer_expire(unsigned long data)
 }
 
 /* mark EXCLUDE-mode sources */
-static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
+static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs)
 {
        struct ip_sf_list *psf;
        int i, scount;
@@ -775,7 +775,7 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
        return 1;
 }
 
-static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
+static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs)
 {
        struct ip_sf_list *psf;
        int i, scount;
@@ -803,7 +803,7 @@ static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
        return 1;
 }
 
-static void igmp_heard_report(struct in_device *in_dev, u32 group)
+static void igmp_heard_report(struct in_device *in_dev, __be32 group)
 {
        struct ip_mc_list *im;
 
@@ -828,7 +828,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
        struct igmphdr          *ih = skb->h.igmph;
        struct igmpv3_query *ih3 = (struct igmpv3_query *)ih;
        struct ip_mc_list       *im;
-       u32                     group = ih->group;
+       __be32                  group = ih->group;
        int                     max_delay;
        int                     mark = 0;
 
@@ -862,7 +862,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
                ih3 = (struct igmpv3_query *) skb->h.raw;
                if (ih3->nsrcs) {
                        if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) 
-                                          + ntohs(ih3->nsrcs)*sizeof(__u32)))
+                                          + ntohs(ih3->nsrcs)*sizeof(__be32)))
                                return;
                        ih3 = (struct igmpv3_query *) skb->h.raw;
                }
@@ -985,7 +985,7 @@ drop:
  *     Add a filter to a device
  */
 
-static void ip_mc_filter_add(struct in_device *in_dev, u32 addr)
+static void ip_mc_filter_add(struct in_device *in_dev, __be32 addr)
 {
        char buf[MAX_ADDR_LEN];
        struct net_device *dev = in_dev->dev;
@@ -1005,7 +1005,7 @@ static void ip_mc_filter_add(struct in_device *in_dev, u32 addr)
  *     Remove a filter from a device
  */
 
-static void ip_mc_filter_del(struct in_device *in_dev, u32 addr)
+static void ip_mc_filter_del(struct in_device *in_dev, __be32 addr)
 {
        char buf[MAX_ADDR_LEN];
        struct net_device *dev = in_dev->dev;
@@ -1055,7 +1055,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im)
        spin_unlock_bh(&in_dev->mc_tomb_lock);
 }
 
-static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr)
+static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr)
 {
        struct ip_mc_list *pmc, *pmc_prev;
        struct ip_sf_list *psf, *psf_next;
@@ -1193,7 +1193,7 @@ static void igmp_group_added(struct ip_mc_list *im)
  *     A socket has joined a multicast group on device dev.
  */
 
-void ip_mc_inc_group(struct in_device *in_dev, u32 addr)
+void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
 {
        struct ip_mc_list *im;
 
@@ -1252,7 +1252,7 @@ out:
  *     A socket has left a multicast group on device dev
  */
 
-void ip_mc_dec_group(struct in_device *in_dev, u32 addr)
+void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
 {
        struct ip_mc_list *i, **ip;
        
@@ -1402,7 +1402,7 @@ int sysctl_igmp_max_msf __read_mostly = IP_MAX_MSF;
 
 
 static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
-       __u32 *psfsrc)
+       __be32 *psfsrc)
 {
        struct ip_sf_list *psf, *psf_prev;
        int rv = 0;
@@ -1450,8 +1450,8 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
 #define igmp_ifc_event(x)      do { } while (0)
 #endif
 
-static int ip_mc_del_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
-                        int sfcount, __u32 *psfsrc, int delta)
+static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
+                        int sfcount, __be32 *psfsrc, int delta)
 {
        struct ip_mc_list *pmc;
        int     changerec = 0;
@@ -1517,7 +1517,7 @@ out_unlock:
  * Add multicast single-source filter to the interface list
  */
 static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode,
-       __u32 *psfsrc, int delta)
+       __be32 *psfsrc, int delta)
 {
        struct ip_sf_list *psf, *psf_prev;
 
@@ -1623,8 +1623,8 @@ static int sf_setstate(struct ip_mc_list *pmc)
 /*
  * Add multicast source filter list to the interface list
  */
-static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
-                        int sfcount, __u32 *psfsrc, int delta)
+static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
+                        int sfcount, __be32 *psfsrc, int delta)
 {
        struct ip_mc_list *pmc;
        int     isexclude;
@@ -1717,7 +1717,7 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc)
 int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
 {
        int err;
-       u32 addr = imr->imr_multiaddr.s_addr;
+       __be32 addr = imr->imr_multiaddr.s_addr;
        struct ip_mc_socklist *iml=NULL, *i;
        struct in_device *in_dev;
        struct inet_sock *inet = inet_sk(sk);
@@ -1791,7 +1791,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
        struct inet_sock *inet = inet_sk(sk);
        struct ip_mc_socklist *iml, **imlp;
        struct in_device *in_dev;
-       u32 group = imr->imr_multiaddr.s_addr;
+       __be32 group = imr->imr_multiaddr.s_addr;
        u32 ifindex;
        int ret = -EADDRNOTAVAIL;
 
@@ -1829,7 +1829,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
 {
        int err;
        struct ip_mreqn imr;
-       u32 addr = mreqs->imr_multiaddr;
+       __be32 addr = mreqs->imr_multiaddr;
        struct ip_mc_socklist *pmc;
        struct in_device *in_dev = NULL;
        struct inet_sock *inet = inet_sk(sk);
@@ -1883,7 +1883,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
                rv = !0;
                for (i=0; i<psl->sl_count; i++) {
                        rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr,
-                               sizeof(__u32));
+                               sizeof(__be32));
                        if (rv == 0)
                                break;
                }
@@ -1935,7 +1935,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
        rv = 1; /* > 0 for insert logic below if sl_count is 0 */
        for (i=0; i<psl->sl_count; i++) {
                rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr,
-                       sizeof(__u32));
+                       sizeof(__be32));
                if (rv == 0)
                        break;
        }
@@ -1960,7 +1960,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
 {
        int err = 0;
        struct ip_mreqn imr;
-       u32 addr = msf->imsf_multiaddr;
+       __be32 addr = msf->imsf_multiaddr;
        struct ip_mc_socklist *pmc;
        struct in_device *in_dev;
        struct inet_sock *inet = inet_sk(sk);
@@ -2044,7 +2044,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
 {
        int err, len, count, copycount;
        struct ip_mreqn imr;
-       u32 addr = msf->imsf_multiaddr;
+       __be32 addr = msf->imsf_multiaddr;
        struct ip_mc_socklist *pmc;
        struct in_device *in_dev;
        struct inet_sock *inet = inet_sk(sk);
@@ -2103,7 +2103,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
 {
        int err, i, count, copycount;
        struct sockaddr_in *psin;
-       u32 addr;
+       __be32 addr;
        struct ip_mc_socklist *pmc;
        struct inet_sock *inet = inet_sk(sk);
        struct ip_sf_socklist *psl;
@@ -2156,7 +2156,7 @@ done:
 /*
  * check if a multicast source filter allows delivery for a given <src,dst,intf>
  */
-int ip_mc_sf_allow(struct sock *sk, u32 loc_addr, u32 rmt_addr, int dif)
+int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif)
 {
        struct inet_sock *inet = inet_sk(sk);
        struct ip_mc_socklist *pmc;
@@ -2216,7 +2216,7 @@ void ip_mc_drop_socket(struct sock *sk)
        rtnl_unlock();
 }
 
-int ip_check_mc(struct in_device *in_dev, u32 mc_addr, u32 src_addr, u16 proto)
+int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto)
 {
        struct ip_mc_list *im;
        struct ip_sf_list *psf;
index 07204391d083bb11fb12d6f09576a8102e9cfbbd..96bbe2a0aa1b05e41fcd144e3b11a61b17d854ba 100644 (file)
@@ -39,7 +39,7 @@ int sysctl_local_port_range[2] = { 1024, 4999 };
 int inet_csk_bind_conflict(const struct sock *sk,
                           const struct inet_bind_bucket *tb)
 {
-       const u32 sk_rcv_saddr = inet_rcv_saddr(sk);
+       const __be32 sk_rcv_saddr = inet_rcv_saddr(sk);
        struct sock *sk2;
        struct hlist_node *node;
        int reuse = sk->sk_reuse;
@@ -52,7 +52,7 @@ int inet_csk_bind_conflict(const struct sock *sk,
                     sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
                        if (!reuse || !sk2->sk_reuse ||
                            sk2->sk_state == TCP_LISTEN) {
-                               const u32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
+                               const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
                                if (!sk2_rcv_saddr || !sk_rcv_saddr ||
                                    sk2_rcv_saddr == sk_rcv_saddr)
                                        break;
@@ -342,10 +342,10 @@ struct dst_entry* inet_csk_route_req(struct sock *sk,
 
 EXPORT_SYMBOL_GPL(inet_csk_route_req);
 
-static inline u32 inet_synq_hash(const u32 raddr, const u16 rport,
+static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport,
                                 const u32 rnd, const u16 synq_hsize)
 {
-       return jhash_2words(raddr, (u32)rport, rnd) & (synq_hsize - 1);
+       return jhash_2words((__force u32)raddr, (__force u32)rport, rnd) & (synq_hsize - 1);
 }
 
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -356,8 +356,8 @@ static inline u32 inet_synq_hash(const u32 raddr, const u16 rport,
 
 struct request_sock *inet_csk_search_req(const struct sock *sk,
                                         struct request_sock ***prevp,
-                                        const __u16 rport, const __u32 raddr,
-                                        const __u32 laddr)
+                                        const __be16 rport, const __be32 raddr,
+                                        const __be32 laddr)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt;
index 492858e6faf0140fee625d8f966093c57c141773..77761ac4f7bb0589bc22d89127e3d64abb14c65a 100644 (file)
@@ -36,8 +36,8 @@
 static const struct inet_diag_handler **inet_diag_table;
 
 struct inet_diag_entry {
-       u32 *saddr;
-       u32 *daddr;
+       __be32 *saddr;
+       __be32 *daddr;
        u16 sport;
        u16 dport;
        u16 family;
@@ -294,7 +294,7 @@ out:
        return err;
 }
 
-static int bitstring_match(const u32 *a1, const u32 *a2, int bits)
+static int bitstring_match(const __be32 *a1, const __be32 *a2, int bits)
 {
        int words = bits >> 5;
 
@@ -305,8 +305,8 @@ static int bitstring_match(const u32 *a1, const u32 *a2, int bits)
                        return 0;
        }
        if (bits) {
-               __u32 w1, w2;
-               __u32 mask;
+               __be32 w1, w2;
+               __be32 mask;
 
                w1 = a1[words];
                w2 = a2[words];
@@ -352,7 +352,7 @@ static int inet_diag_bc_run(const void *bc, int len,
                case INET_DIAG_BC_S_COND:
                case INET_DIAG_BC_D_COND: {
                        struct inet_diag_hostcond *cond;
-                       u32 *addr;
+                       __be32 *addr;
 
                        cond = (struct inet_diag_hostcond *)(op + 1);
                        if (cond->port != -1 &&
index fb296c9a7f3fe385aeebbf5d5cc521360335fa8d..244c4f445c7d55779a99fe301152c2241bbcacd7 100644 (file)
@@ -125,7 +125,7 @@ EXPORT_SYMBOL(inet_listen_wlock);
  * wildcarded during the search since they can never be otherwise.
  */
 static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
-                                             const u32 daddr,
+                                             const __be32 daddr,
                                              const unsigned short hnum,
                                              const int dif)
 {
@@ -137,7 +137,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
                const struct inet_sock *inet = inet_sk(sk);
 
                if (inet->num == hnum && !ipv6_only_sock(sk)) {
-                       const __u32 rcv_saddr = inet->rcv_saddr;
+                       const __be32 rcv_saddr = inet->rcv_saddr;
                        int score = sk->sk_family == PF_INET ? 1 : 0;
 
                        if (rcv_saddr) {
@@ -163,7 +163,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
 
 /* Optimize the common listener case. */
 struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
-                                   const u32 daddr, const unsigned short hnum,
+                                   const __be32 daddr, const unsigned short hnum,
                                    const int dif)
 {
        struct sock *sk = NULL;
@@ -197,11 +197,11 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
 {
        struct inet_hashinfo *hinfo = death_row->hashinfo;
        struct inet_sock *inet = inet_sk(sk);
-       u32 daddr = inet->rcv_saddr;
-       u32 saddr = inet->daddr;
+       __be32 daddr = inet->rcv_saddr;
+       __be32 saddr = inet->daddr;
        int dif = sk->sk_bound_dev_if;
        INET_ADDR_COOKIE(acookie, saddr, daddr)
-       const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
+       const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport);
        unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport);
        struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
        struct sock *sk2;
index a675602ef2953acf12d33096657c8bb09689a4af..2b1a54b59c48c4f2a65d6f8838bbcfd567a71183 100644 (file)
@@ -163,7 +163,7 @@ static void unlink_from_unused(struct inet_peer *p)
        for (u = peer_root; u != peer_avl_empty; ) {            \
                if (daddr == u->v4daddr)                        \
                        break;                                  \
-               if (daddr < u->v4daddr)                         \
+               if ((__force __u32)daddr < (__force __u32)u->v4daddr)   \
                        v = &u->avl_left;                       \
                else                                            \
                        v = &u->avl_right;                      \
@@ -368,7 +368,7 @@ static int cleanup_once(unsigned long ttl)
 }
 
 /* Called with or without local BH being disabled. */
-struct inet_peer *inet_getpeer(__u32 daddr, int create)
+struct inet_peer *inet_getpeer(__be32 daddr, int create)
 {
        struct inet_peer *p, *n;
        struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr;
index 165d72859ddf4cbe7d49bb49ecafb739b0001806..74046efdf875804ee4bd60f20636b2aa1d09e7bf 100644 (file)
@@ -77,9 +77,9 @@ struct ipq {
        struct hlist_node list;
        struct list_head lru_list;      /* lru list member                      */
        u32             user;
-       u32             saddr;
-       u32             daddr;
-       u16             id;
+       __be32          saddr;
+       __be32          daddr;
+       __be16          id;
        u8              protocol;
        u8              last_in;
 #define COMPLETE               4
@@ -123,9 +123,10 @@ static __inline__ void ipq_unlink(struct ipq *ipq)
        write_unlock(&ipfrag_lock);
 }
 
-static unsigned int ipqhashfn(u16 id, u32 saddr, u32 daddr, u8 prot)
+static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot)
 {
-       return jhash_3words((u32)id << 16 | prot, saddr, daddr,
+       return jhash_3words((__force u32)id << 16 | prot,
+                           (__force u32)saddr, (__force u32)daddr,
                            ipfrag_hash_rnd) & (IPQ_HASHSZ - 1);
 }
 
@@ -387,8 +388,8 @@ out_nomem:
 static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
 {
        __be16 id = iph->id;
-       __u32 saddr = iph->saddr;
-       __u32 daddr = iph->daddr;
+       __be32 saddr = iph->saddr;
+       __be32 daddr = iph->daddr;
        __u8 protocol = iph->protocol;
        unsigned int hash;
        struct ipq *qp;
index e7437c0913266cf5431e83bce781ebd22e2bb044..8dabbfc312674bd574df7f69f2a5646146723c18 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 void ip_options_build(struct sk_buff * skb, struct ip_options * opt,
-                           u32 daddr, struct rtable *rt, int is_frag) 
+                           __be32 daddr, struct rtable *rt, int is_frag)
 {
        unsigned char * iph = skb->nh.raw;
 
@@ -57,7 +57,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt,
                        ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt);
                if (opt->ts_needtime) {
                        struct timeval tv;
-                       __u32 midtime;
+                       __be32 midtime;
                        do_gettimeofday(&tv);
                        midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000);
                        memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
@@ -91,7 +91,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
        unsigned char *sptr, *dptr;
        int soffset, doffset;
        int     optlen;
-       u32     daddr;
+       __be32  daddr;
 
        memset(dopt, 0, sizeof(struct ip_options));
 
@@ -148,7 +148,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
                                        dopt->ts_needtime = 0;
 
                                        if (soffset + 8 <= optlen) {
-                                               __u32 addr;
+                                               __be32 addr;
 
                                                memcpy(&addr, sptr+soffset-1, 4);
                                                if (inet_addr_type(addr) != RTN_LOCAL) {
@@ -165,7 +165,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
        }
        if (sopt->srr) {
                unsigned char * start = sptr+sopt->srr;
-               u32 faddr;
+               __be32 faddr;
 
                optlen  = start[1];
                soffset = start[2];
@@ -362,7 +362,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                goto error;
                        }
                        if (optptr[2] <= optlen) {
-                               __u32 * timeptr = NULL;
+                               __be32 *timeptr = NULL;
                                if (optptr[2]+3 > optptr[1]) {
                                        pp_ptr = optptr + 2;
                                        goto error;
@@ -371,7 +371,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                      case IPOPT_TS_TSONLY:
                                        opt->ts = optptr - iph;
                                        if (skb) 
-                                               timeptr = (__u32*)&optptr[optptr[2]-1];
+                                               timeptr = (__be32*)&optptr[optptr[2]-1];
                                        opt->ts_needtime = 1;
                                        optptr[2] += 4;
                                        break;
@@ -383,7 +383,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                        opt->ts = optptr - iph;
                                        if (skb) {
                                                memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
-                                               timeptr = (__u32*)&optptr[optptr[2]+3];
+                                               timeptr = (__be32*)&optptr[optptr[2]+3];
                                        }
                                        opt->ts_needaddr = 1;
                                        opt->ts_needtime = 1;
@@ -396,12 +396,12 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                        }
                                        opt->ts = optptr - iph;
                                        {
-                                               u32 addr;
+                                               __be32 addr;
                                                memcpy(&addr, &optptr[optptr[2]-1], 4);
                                                if (inet_addr_type(addr) == RTN_UNICAST)
                                                        break;
                                                if (skb)
-                                                       timeptr = (__u32*)&optptr[optptr[2]+3];
+                                                       timeptr = (__be32*)&optptr[optptr[2]+3];
                                        }
                                        opt->ts_needtime = 1;
                                        optptr[2] += 8;
@@ -415,10 +415,10 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                }
                                if (timeptr) {
                                        struct timeval tv;
-                                       __u32  midtime;
+                                       __be32  midtime;
                                        do_gettimeofday(&tv);
                                        midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000);
-                                       memcpy(timeptr, &midtime, sizeof(__u32));
+                                       memcpy(timeptr, &midtime, sizeof(__be32));
                                        opt->is_changed = 1;
                                }
                        } else {
@@ -607,7 +607,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
 {
        struct ip_options *opt = &(IPCB(skb)->opt);
        int srrspace, srrptr;
-       u32 nexthop;
+       __be32 nexthop;
        struct iphdr *iph = skb->nh.iph;
        unsigned char * optptr = skb->nh.raw + opt->srr;
        struct rtable *rt = (struct rtable*)skb->dst;
index 97aee76fb7463d41bdaac364907b37cf4f6b25dd..fc195a44fc2e1800d0ba5e32fedc9019d29562f2 100644 (file)
@@ -118,7 +118,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst)
  *
  */
 int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
-                         u32 saddr, u32 daddr, struct ip_options *opt)
+                         __be32 saddr, __be32 daddr, struct ip_options *opt)
 {
        struct inet_sock *inet = inet_sk(sk);
        struct rtable *rt = (struct rtable *)skb->dst;
@@ -306,7 +306,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
        /* Make sure we can route this packet. */
        rt = (struct rtable *)__sk_dst_check(sk, 0);
        if (rt == NULL) {
-               u32 daddr;
+               __be32 daddr;
 
                /* Use correct destination address if we have options. */
                daddr = inet->daddr;
@@ -1340,7 +1340,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
                char                    data[40];
        } replyopts;
        struct ipcm_cookie ipc;
-       u32 daddr;
+       __be32 daddr;
        struct rtable *rt = (struct rtable*)skb->dst;
 
        if (ip_options_echo(&replyopts.opt, skb))
index 2d05c4133d3e350b7940c737ecf4055b4f197a24..4b132953bcc2a7ceb3a00d6232f9069d2baf98b5 100644 (file)
@@ -254,7 +254,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s
 }
 
 void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 
-                  u16 port, u32 info, u8 *payload)
+                  __be16 port, u32 info, u8 *payload)
 {
        struct inet_sock *inet = inet_sk(sk);
        struct sock_exterr_skb *serr;
@@ -283,7 +283,7 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
                kfree_skb(skb);
 }
 
-void ip_local_error(struct sock *sk, int err, u32 daddr, u16 port, u32 info)
+void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 info)
 {
        struct inet_sock *inet = inet_sk(sk);
        struct sock_exterr_skb *serr;
index 17342430a843bc20781590c79f210564221905b4..2017d36024d48d61816bd52e82bf67f4c196479d 100644 (file)
@@ -183,7 +183,7 @@ out_ok:
 
 static void ipcomp4_err(struct sk_buff *skb, u32 info)
 {
-       u32 spi;
+       __be32 spi;
        struct iphdr *iph = (struct iphdr *)skb->data;
        struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2));
        struct xfrm_state *x;
index ba49588da2424f70e4d6fa483839db279b30890e..97cfa97c8abbfe8fba81b8bbcbc2ff3960ce3db4 100644 (file)
@@ -462,7 +462,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
        return 0;
 }
 
-static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp)
+static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
 {
        int line=MFC_HASH(mcastgrp,origin);
        struct mfc_cache *c;
@@ -1097,7 +1097,7 @@ static struct notifier_block ip_mr_notifier={
  *     important for multicast video.
  */
  
-static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr)
+static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
 {
        struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
 
index 87b83813cf2c2f12f4a43fba75385c7e979c16d5..8832eb517d5200355356eb0281b4f4cc6be8cb61 100644 (file)
@@ -115,9 +115,9 @@ static inline void ct_write_unlock_bh(unsigned key)
 /*
  *     Returns hash value for IPVS connection entry
  */
-static unsigned int ip_vs_conn_hashkey(unsigned proto, __u32 addr, __u16 port)
+static unsigned int ip_vs_conn_hashkey(unsigned proto, __be32 addr, __be16 port)
 {
-       return jhash_3words(addr, port, proto, ip_vs_conn_rnd)
+       return jhash_3words((__force u32)addr, (__force u32)port, proto, ip_vs_conn_rnd)
                & IP_VS_CONN_TAB_MASK;
 }
 
@@ -188,7 +188,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp)
  *     d_addr, d_port: pkt dest address (load balancer)
  */
 static inline struct ip_vs_conn *__ip_vs_conn_in_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
 {
        unsigned hash;
        struct ip_vs_conn *cp;
@@ -215,7 +215,7 @@ static inline struct ip_vs_conn *__ip_vs_conn_in_get
 }
 
 struct ip_vs_conn *ip_vs_conn_in_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
 {
        struct ip_vs_conn *cp;
 
@@ -234,7 +234,7 @@ struct ip_vs_conn *ip_vs_conn_in_get
 
 /* Get reference to connection template */
 struct ip_vs_conn *ip_vs_ct_in_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
 {
        unsigned hash;
        struct ip_vs_conn *cp;
@@ -274,7 +274,7 @@ struct ip_vs_conn *ip_vs_ct_in_get
  *     d_addr, d_port: pkt dest address (foreign host)
  */
 struct ip_vs_conn *ip_vs_conn_out_get
-(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
+(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
 {
        unsigned hash;
        struct ip_vs_conn *cp, *ret=NULL;
@@ -324,7 +324,7 @@ void ip_vs_conn_put(struct ip_vs_conn *cp)
 /*
  *     Fill a no_client_port connection with a client port number
  */
-void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport)
+void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport)
 {
        if (ip_vs_conn_unhash(cp)) {
                spin_lock(&cp->lock);
@@ -508,10 +508,10 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
                /*
                 * Invalidate the connection template
                 */
-               if (ct->vport != 65535) {
+               if (ct->vport != htons(0xffff)) {
                        if (ip_vs_conn_unhash(ct)) {
-                               ct->dport = 65535;
-                               ct->vport = 65535;
+                               ct->dport = htons(0xffff);
+                               ct->vport = htons(0xffff);
                                ct->cport = 0;
                                ip_vs_conn_hash(ct);
                        }
@@ -596,8 +596,8 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp)
  *     Create a new connection entry and hash it into the ip_vs_conn_tab
  */
 struct ip_vs_conn *
-ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport,
-              __u32 daddr, __u16 dport, unsigned flags,
+ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport,
+              __be32 daddr, __be16 dport, unsigned flags,
               struct ip_vs_dest *dest)
 {
        struct ip_vs_conn *cp;
index 3f47ad8e1cad1c7f8165b6e5c003a3f919711e4a..6dee03935f786076448f7f1573abc2c806ff12f0 100644 (file)
@@ -209,14 +209,14 @@ int ip_vs_make_skb_writable(struct sk_buff **pskb, int writable_len)
 static struct ip_vs_conn *
 ip_vs_sched_persist(struct ip_vs_service *svc,
                    const struct sk_buff *skb,
-                   __u16 ports[2])
+                   __be16 ports[2])
 {
        struct ip_vs_conn *cp = NULL;
        struct iphdr *iph = skb->nh.iph;
        struct ip_vs_dest *dest;
        struct ip_vs_conn *ct;
-       __u16  dport;    /* destination port to forward */
-       __u32  snet;     /* source network of the client, after masking */
+       __be16  dport;   /* destination port to forward */
+       __be32  snet;    /* source network of the client, after masking */
 
        /* Mask saddr with the netmask to adjust template granularity */
        snet = iph->saddr & svc->netmask;
@@ -383,7 +383,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
        struct ip_vs_conn *cp = NULL;
        struct iphdr *iph = skb->nh.iph;
        struct ip_vs_dest *dest;
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
 
        pptr = skb_header_pointer(skb, iph->ihl*4,
                                  sizeof(_ports), _ports);
@@ -446,7 +446,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
 int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
                struct ip_vs_protocol *pp)
 {
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
        struct iphdr *iph = skb->nh.iph;
 
        pptr = skb_header_pointer(skb, iph->ihl*4,
@@ -576,7 +576,7 @@ void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
 
        /* the TCP/UDP port */
        if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) {
-               __u16 *ports = (void *)ciph + ciph->ihl*4;
+               __be16 *ports = (void *)ciph + ciph->ihl*4;
 
                if (inout)
                        ports[1] = cp->vport;
@@ -775,7 +775,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
                if (sysctl_ip_vs_nat_icmp_send &&
                    (pp->protocol == IPPROTO_TCP ||
                     pp->protocol == IPPROTO_UDP)) {
-                       __u16 _ports[2], *pptr;
+                       __be16 _ports[2], *pptr;
 
                        pptr = skb_header_pointer(skb, ihl,
                                                  sizeof(_ports), _ports);
index 6a28fafe910c2a6ef858a900e688c682d9c470d5..f261616e460218b5379340ba77ba6f4b6ce48506 100644 (file)
@@ -283,7 +283,7 @@ static atomic_t ip_vs_nullsvc_counter = ATOMIC_INIT(0);
  *     Returns hash value for virtual service
  */
 static __inline__ unsigned
-ip_vs_svc_hashkey(unsigned proto, __u32 addr, __u16 port)
+ip_vs_svc_hashkey(unsigned proto, __be32 addr, __be16 port)
 {
        register unsigned porth = ntohs(port);
 
@@ -365,7 +365,7 @@ static int ip_vs_svc_unhash(struct ip_vs_service *svc)
  *     Get service by {proto,addr,port} in the service table.
  */
 static __inline__ struct ip_vs_service *
-__ip_vs_service_get(__u16 protocol, __u32 vaddr, __u16 vport)
+__ip_vs_service_get(__u16 protocol, __be32 vaddr, __be16 vport)
 {
        unsigned hash;
        struct ip_vs_service *svc;
@@ -410,7 +410,7 @@ static __inline__ struct ip_vs_service *__ip_vs_svc_fwm_get(__u32 fwmark)
 }
 
 struct ip_vs_service *
-ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport)
+ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport)
 {
        struct ip_vs_service *svc;
 
@@ -480,7 +480,7 @@ __ip_vs_unbind_svc(struct ip_vs_dest *dest)
 /*
  *     Returns hash value for real service
  */
-static __inline__ unsigned ip_vs_rs_hashkey(__u32 addr, __u16 port)
+static __inline__ unsigned ip_vs_rs_hashkey(__be32 addr, __be16 port)
 {
        register unsigned porth = ntohs(port);
 
@@ -531,7 +531,7 @@ static int ip_vs_rs_unhash(struct ip_vs_dest *dest)
  *     Lookup real service by <proto,addr,port> in the real service table.
  */
 struct ip_vs_dest *
-ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport)
+ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport)
 {
        unsigned hash;
        struct ip_vs_dest *dest;
@@ -562,7 +562,7 @@ ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport)
  *     Lookup destination by {addr,port} in the given service
  */
 static struct ip_vs_dest *
-ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
+ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
 {
        struct ip_vs_dest *dest;
 
@@ -591,7 +591,7 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
  *  scheduling.
  */
 static struct ip_vs_dest *
-ip_vs_trash_get_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
+ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
 {
        struct ip_vs_dest *dest, *nxt;
 
@@ -773,8 +773,8 @@ static int
 ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
 {
        struct ip_vs_dest *dest;
-       __u32 daddr = udest->addr;
-       __u16 dport = udest->port;
+       __be32 daddr = udest->addr;
+       __be16 dport = udest->port;
        int ret;
 
        EnterFunction(2);
@@ -879,8 +879,8 @@ static int
 ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
 {
        struct ip_vs_dest *dest;
-       __u32 daddr = udest->addr;
-       __u16 dport = udest->port;
+       __be32 daddr = udest->addr;
+       __be16 dport = udest->port;
 
        EnterFunction(2);
 
@@ -991,8 +991,8 @@ static int
 ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest)
 {
        struct ip_vs_dest *dest;
-       __u32 daddr = udest->addr;
-       __u16 dport = udest->port;
+       __be32 daddr = udest->addr;
+       __be16 dport = udest->port;
 
        EnterFunction(2);
 
index 9fee19c4c6179958f5ea5eb39c4a550e67b314ee..502111fba87284ae6fe11ab944d3720a0b6b8a02 100644 (file)
@@ -66,7 +66,7 @@ struct ip_vs_dh_bucket {
 /*
  *     Returns hash value for IPVS DH entry
  */
-static inline unsigned ip_vs_dh_hashkey(__u32 addr)
+static inline unsigned ip_vs_dh_hashkey(__be32 addr)
 {
        return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK;
 }
@@ -76,7 +76,7 @@ static inline unsigned ip_vs_dh_hashkey(__u32 addr)
  *      Get ip_vs_dest associated with supplied parameters.
  */
 static inline struct ip_vs_dest *
-ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __u32 addr)
+ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr)
 {
        return (tbl[ip_vs_dh_hashkey(addr)]).dest;
 }
index 37fafb1fbcff378b09c0b67449bada0bb5fddc0c..e433cb0ff894b19899f30788ea824b14fa237873 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/ip.h>
 #include <net/protocol.h>
 #include <net/tcp.h>
+#include <asm/unaligned.h>
 
 #include <net/ip_vs.h>
 
@@ -44,8 +45,8 @@
  * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
  * First port is set to the default port.
  */
-static int ports[IP_VS_APP_MAX_PORTS] = {21, 0};
-module_param_array(ports, int, NULL, 0);
+static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
+module_param_array(ports, ushort, NULL, 0);
 MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
 
 
@@ -74,7 +75,7 @@ ip_vs_ftp_done_conn(struct ip_vs_app *app, struct ip_vs_conn *cp)
  */
 static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
                                  const char *pattern, size_t plen, char term,
-                                 __u32 *addr, __u16 *port,
+                                 __be32 *addr, __be16 *port,
                                  char **start, char **end)
 {
        unsigned char p[6];
@@ -114,8 +115,8 @@ static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
        if (i != 5)
                return -1;
 
-       *addr = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0];
-       *port = (p[5]<<8) | p[4];
+       *addr = get_unaligned((__be32 *)p);
+       *port = get_unaligned((__be16 *)(p + 4));
        return 1;
 }
 
@@ -140,8 +141,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
        struct tcphdr *th;
        char *data, *data_limit;
        char *start, *end;
-       __u32 from;
-       __u16 port;
+       __be32 from;
+       __be16 port;
        struct ip_vs_conn *n_cp;
        char buf[24];           /* xxx.xxx.xxx.xxx,ppp,ppp\000 */
        unsigned buf_len;
@@ -199,7 +200,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
                from = n_cp->vaddr;
                port = n_cp->vport;
                sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from),
-                       port&255, (port>>8)&255);
+                       ntohs(port)&255, (ntohs(port)>>8)&255);
                buf_len = strlen(buf);
 
                /*
@@ -243,8 +244,8 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
        struct tcphdr *th;
        char *data, *data_start, *data_limit;
        char *start, *end;
-       __u32 to;
-       __u16 port;
+       __be32 to;
+       __be16 port;
        struct ip_vs_conn *n_cp;
 
        /* no diff required for incoming packets */
@@ -365,12 +366,6 @@ static int __init ip_vs_ftp_init(void)
        for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
                if (!ports[i])
                        continue;
-               if (ports[i] < 0 || ports[i] > 0xffff) {
-                       IP_VS_WARNING("ip_vs_ftp: Ignoring invalid "
-                                     "configuration port[%d] = %d\n",
-                                     i, ports[i]);
-                       continue;
-               }
                ret = register_ip_vs_app_inc(app, app->protocol, ports[i]);
                if (ret)
                        break;
index 6e5cb92a5c83b114d4751093f13e6691c323a15f..524751e031de5203c12735d0aaa3c588dce675cd 100644 (file)
@@ -87,7 +87,7 @@ static int sysctl_ip_vs_lblc_expiration = 24*60*60*HZ;
  */
 struct ip_vs_lblc_entry {
        struct list_head        list;
-       __u32                   addr;           /* destination IP address */
+       __be32                  addr;           /* destination IP address */
        struct ip_vs_dest       *dest;          /* real server (cache) */
        unsigned long           lastuse;        /* last used time */
 };
@@ -160,7 +160,7 @@ static struct ctl_table_header * sysctl_header;
  *      IP address to a server.
  */
 static inline struct ip_vs_lblc_entry *
-ip_vs_lblc_new(__u32 daddr, struct ip_vs_dest *dest)
+ip_vs_lblc_new(__be32 daddr, struct ip_vs_dest *dest)
 {
        struct ip_vs_lblc_entry *en;
 
@@ -195,7 +195,7 @@ static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en)
 /*
  *     Returns hash value for IPVS LBLC entry
  */
-static inline unsigned ip_vs_lblc_hashkey(__u32 addr)
+static inline unsigned ip_vs_lblc_hashkey(__be32 addr)
 {
        return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK;
 }
@@ -234,7 +234,7 @@ ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en)
  *  Get ip_vs_lblc_entry associated with supplied parameters.
  */
 static inline struct ip_vs_lblc_entry *
-ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __u32 addr)
+ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr)
 {
        unsigned hash;
        struct ip_vs_lblc_entry *en;
index 32ba37ba72d855cadbd92979df7edf1734f388ca..08990192b6eccbd5ec9e0abc06ac161b1491432c 100644 (file)
@@ -276,7 +276,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set)
  */
 struct ip_vs_lblcr_entry {
        struct list_head        list;
-       __u32                   addr;           /* destination IP address */
+       __be32                   addr;           /* destination IP address */
        struct ip_vs_dest_set   set;            /* destination server set */
        unsigned long           lastuse;        /* last used time */
 };
@@ -348,7 +348,7 @@ static struct ctl_table_header * sysctl_header;
  *      new/free a ip_vs_lblcr_entry, which is a mapping of a destination
  *      IP address to a server.
  */
-static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__u32 daddr)
+static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__be32 daddr)
 {
        struct ip_vs_lblcr_entry *en;
 
@@ -381,7 +381,7 @@ static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en)
 /*
  *     Returns hash value for IPVS LBLCR entry
  */
-static inline unsigned ip_vs_lblcr_hashkey(__u32 addr)
+static inline unsigned ip_vs_lblcr_hashkey(__be32 addr)
 {
        return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK;
 }
@@ -420,7 +420,7 @@ ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en)
  *  Get ip_vs_lblcr_entry associated with supplied parameters.
  */
 static inline struct ip_vs_lblcr_entry *
-ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __u32 addr)
+ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __be32 addr)
 {
        unsigned hash;
        struct ip_vs_lblcr_entry *en;
index 867d4e9c6594c3a62eb70475d6b2c26cfe74c2ca..c4528b5c800d04a257f2d806ed6414378b98ea31 100644 (file)
@@ -176,7 +176,7 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp,
                        pp->name, NIPQUAD(ih->saddr),
                        NIPQUAD(ih->daddr));
        else {
-               __u16 _ports[2], *pptr
+               __be16 _ports[2], *pptr
 ;
                pptr = skb_header_pointer(skb, offset + ih->ihl*4,
                                          sizeof(_ports), _ports);
index 820e8318d10df06be7412054814838b41e6ad17d..bfe779e74590e14be21af29fa35c6a54551ec231 100644 (file)
@@ -29,7 +29,7 @@ static struct ip_vs_conn *
 tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
                const struct iphdr *iph, unsigned int proto_off, int inverse)
 {
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
 
        pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports);
        if (pptr == NULL)
@@ -50,7 +50,7 @@ static struct ip_vs_conn *
 tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
                 const struct iphdr *iph, unsigned int proto_off, int inverse)
 {
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
 
        pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports);
        if (pptr == NULL)
@@ -112,12 +112,12 @@ tcp_conn_schedule(struct sk_buff *skb,
 
 
 static inline void
-tcp_fast_csum_update(struct tcphdr *tcph, u32 oldip, u32 newip,
-                    u16 oldport, u16 newport)
+tcp_fast_csum_update(struct tcphdr *tcph, __be32 oldip, __be32 newip,
+                    __be16 oldport, __be16 newport)
 {
        tcph->check =
                ip_vs_check_diff(~oldip, newip,
-                                ip_vs_check_diff(oldport ^ 0xFFFF,
+                                ip_vs_check_diff(oldport ^ htonl(0xFFFF),
                                                  newport, tcph->check));
 }
 
index 90c8166c0ec129a5c84aa449876ef4139bab9e48..54aa7603591f5c3e9091cb341d6ae4aab4bcd96f 100644 (file)
@@ -29,7 +29,7 @@ udp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
                const struct iphdr *iph, unsigned int proto_off, int inverse)
 {
        struct ip_vs_conn *cp;
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
 
        pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports);
        if (pptr == NULL)
@@ -54,7 +54,7 @@ udp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
                 const struct iphdr *iph, unsigned int proto_off, int inverse)
 {
        struct ip_vs_conn *cp;
-       __u16 _ports[2], *pptr;
+       __be16 _ports[2], *pptr;
 
        pptr = skb_header_pointer(skb, skb->nh.iph->ihl*4,
                                  sizeof(_ports), _ports);
@@ -117,15 +117,15 @@ udp_conn_schedule(struct sk_buff *skb, struct ip_vs_protocol *pp,
 
 
 static inline void
-udp_fast_csum_update(struct udphdr *uhdr, u32 oldip, u32 newip,
-                    u16 oldport, u16 newport)
+udp_fast_csum_update(struct udphdr *uhdr, __be32 oldip, __be32 newip,
+                    __be16 oldport, __be16 newport)
 {
        uhdr->check =
                ip_vs_check_diff(~oldip, newip,
-                                ip_vs_check_diff(oldport ^ 0xFFFF,
+                                ip_vs_check_diff(oldport ^ htonl(0xFFFF),
                                                  newport, uhdr->check));
        if (!uhdr->check)
-               uhdr->check = 0xFFFF;
+               uhdr->check = htonl(0xFFFF);
 }
 
 static int
@@ -173,7 +173,7 @@ udp_snat_handler(struct sk_buff **pskb,
                                                cp->protocol,
                                                (*pskb)->csum);
                if (udph->check == 0)
-                       udph->check = 0xFFFF;
+                       udph->check = htonl(0xFFFF);
                IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n",
                          pp->name, udph->check,
                          (char*)&(udph->check) - (char*)udph);
index 7775e6cc68be3a4597dc94b4d5ab0fc5e928a614..338668f88fe286a9b9c3cfaa05e32c7c334b01ea 100644 (file)
@@ -63,7 +63,7 @@ struct ip_vs_sh_bucket {
 /*
  *     Returns hash value for IPVS SH entry
  */
-static inline unsigned ip_vs_sh_hashkey(__u32 addr)
+static inline unsigned ip_vs_sh_hashkey(__be32 addr)
 {
        return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK;
 }
@@ -73,7 +73,7 @@ static inline unsigned ip_vs_sh_hashkey(__u32 addr)
  *      Get ip_vs_dest associated with supplied parameters.
  */
 static inline struct ip_vs_dest *
-ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __u32 addr)
+ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __be32 addr)
 {
        return (tbl[ip_vs_sh_hashkey(addr)]).dest;
 }
index 1bca714bda3d63c244afea44b39a9d26bb0814a9..6ab57d72b615b32ff875a52c0b5ad7a58db3c2d4 100644 (file)
@@ -48,16 +48,16 @@ struct ip_vs_sync_conn {
 
        /* Protocol, addresses and port numbers */
        __u8                    protocol;       /* Which protocol (TCP/UDP) */
-       __u16                   cport;
-       __u16                   vport;
-       __u16                   dport;
-       __u32                   caddr;          /* client address */
-       __u32                   vaddr;          /* virtual address */
-       __u32                   daddr;          /* destination address */
+       __be16                  cport;
+       __be16                  vport;
+       __be16                  dport;
+       __be32                  caddr;          /* client address */
+       __be32                  vaddr;          /* virtual address */
+       __be32                  daddr;          /* destination address */
 
        /* Flags and state transition */
-       __u16                   flags;          /* status flags */
-       __u16                   state;          /* state info */
+       __be16                  flags;          /* status flags */
+       __be16                  state;          /* state info */
 
        /* The sequence options start here */
 };
@@ -464,7 +464,7 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname)
 static int bind_mcastif_addr(struct socket *sock, char *ifname)
 {
        struct net_device *dev;
-       u32 addr;
+       __be32 addr;
        struct sockaddr_in sin;
 
        if ((dev = __dev_get_by_name(ifname)) == NULL)
index 52c12e9edbbc48a2d6d5bb47f76585a976709ef9..e1f77bd7c9a52a940036c4b8a633c29a74d3e8e2 100644 (file)
@@ -232,7 +232,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 
        /* check if it is a connection of no-client-port */
        if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) {
-               __u16 _pt, *p;
+               __be16 _pt, *p;
                p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt);
                if (p == NULL)
                        goto tx_error;
index d25ec4ae09e55ca2d9e0eb6d8dbc38de10b7849c..92b04823e034292328be4cf92c2891ce8e05b9fd 100644 (file)
@@ -60,8 +60,8 @@ struct multipath_dest {
        struct list_head        list;
 
        const struct fib_nh     *nh_info;
-       __u32                   netmask;
-       __u32                   network;
+       __be32                  netmask;
+       __be32                  network;
        unsigned char           prefixlen;
 
        struct rcu_head         rcu;
@@ -76,7 +76,7 @@ struct multipath_route {
        struct list_head        list;
 
        int                     oif;
-       __u32                   gw;
+       __be32                  gw;
        struct list_head        dests;
 
        struct rcu_head         rcu;
@@ -128,8 +128,8 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl,
 
        /* find state entry for destination */
        list_for_each_entry_rcu(d, &target_route->dests, list) {
-               __u32 targetnetwork = fl->fl4_dst & 
-                       (0xFFFFFFFF >> (32 - d->prefixlen));
+               __be32 targetnetwork = fl->fl4_dst &
+                       inet_make_mask(d->prefixlen);
 
                if ((targetnetwork & d->netmask) == d->network) {
                        weight = d->nh_info->nh_weight;
@@ -217,8 +217,8 @@ static void wrandom_select_route(const struct flowi *flp,
        *rp = decision;
 }
 
-static void wrandom_set_nhinfo(__u32 network,
-                              __u32 netmask,
+static void wrandom_set_nhinfo(__be32 network,
+                              __be32 netmask,
                               unsigned char prefixlen,
                               const struct fib_nh *nh)
 {
index f88347de21a9927a2877b11b0cf31d39979b6763..5ac15379a0cfd15d76c0f7c06145d8da58ba6049 100644 (file)
@@ -128,8 +128,8 @@ EXPORT_SYMBOL(ip_nat_decode_session);
  */
 
 struct ip_rt_info {
-       u_int32_t daddr;
-       u_int32_t saddr;
+       __be32 daddr;
+       __be32 saddr;
        u_int8_t tos;
 };
 
index 85f0d73ebfb4cd19fccfea105819b95dcf7e42f0..17e1a687ab4553e76f53a40029c4f87599d49df9 100644 (file)
@@ -80,7 +80,7 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
 {
        char *arpptr = (char *)(arphdr + 1);
        char *src_devaddr, *tgt_devaddr;
-       u32 src_ipaddr, tgt_ipaddr;
+       __be32 src_ipaddr, tgt_ipaddr;
        int i, ret;
 
 #define FWINV(bool,invflg) ((bool) ^ !!(arpinfo->invflags & invflg))
index 0a7bd7f04061f89b55f1e2b7a596f5b0b17ca15f..6c7383a8e42b940c355005091876de8b6396c6c7 100644 (file)
@@ -155,11 +155,11 @@ static int help(struct sk_buff **pskb,
                exp->tuple.dst.protonum = IPPROTO_TCP;
                exp->tuple.dst.u.tcp.port = htons(port);
 
-               exp->mask.src.ip = 0xFFFFFFFF;
+               exp->mask.src.ip = htonl(0xFFFFFFFF);
                exp->mask.src.u.tcp.port = 0;
-               exp->mask.dst.ip = 0xFFFFFFFF;
+               exp->mask.dst.ip = htonl(0xFFFFFFFF);
                exp->mask.dst.protonum = 0xFF;
-               exp->mask.dst.u.tcp.port = 0xFFFF;
+               exp->mask.dst.u.tcp.port = htons(0xFFFF);
 
                if (ip_nat_amanda_hook)
                        ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff,
index c432b31636091133650ebfea5a04241443e3b59c..143c4668538b40203063e2c6c741b395a0bf3fef 100644 (file)
@@ -149,8 +149,8 @@ static unsigned int ip_conntrack_hash_rnd;
 static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple,
                            unsigned int size, unsigned int rnd)
 {
-       return (jhash_3words(tuple->src.ip,
-                            (tuple->dst.ip ^ tuple->dst.protonum),
+       return (jhash_3words((__force u32)tuple->src.ip,
+                            ((__force u32)tuple->dst.ip ^ tuple->dst.protonum),
                             (tuple->src.u.all | (tuple->dst.u.all << 16)),
                             rnd) % size);
 }
@@ -1169,9 +1169,9 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
 int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb,
                               const struct ip_conntrack_tuple *tuple)
 {
-       NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(u_int16_t),
+       NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(__be16),
                &tuple->src.u.tcp.port);
-       NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(u_int16_t),
+       NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(__be16),
                &tuple->dst.u.tcp.port);
        return 0;
 
@@ -1186,9 +1186,9 @@ int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
                return -EINVAL;
 
        t->src.u.tcp.port =
-               *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]);
+               *(__be16 *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]);
        t->dst.u.tcp.port =
-               *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]);
+               *(__be16 *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]);
 
        return 0;
 }
index 1d18c863f064d67fbba87db04c01020327c2025c..93dcf960662f66232fbbce45f7131f76fe1a5e34 100644 (file)
@@ -425,8 +425,8 @@ static int help(struct sk_buff **pskb,
        exp->tuple.src.u.tcp.port = 0; /* Don't care. */
        exp->tuple.dst.protonum = IPPROTO_TCP;
        exp->mask = ((struct ip_conntrack_tuple)
-               { { 0xFFFFFFFF, { 0 } },
-                 { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }});
+               { { htonl(0xFFFFFFFF), { 0 } },
+                 { htonl(0xFFFFFFFF), { .tcp = { htons(0xFFFF) } }, 0xFF }});
 
        exp->expectfn = NULL;
        exp->flags = 0;
@@ -488,7 +488,7 @@ static int __init ip_conntrack_ftp_init(void)
        for (i = 0; i < ports_c; i++) {
                ftp[i].tuple.src.u.tcp.port = htons(ports[i]);
                ftp[i].tuple.dst.protonum = IPPROTO_TCP;
-               ftp[i].mask.src.u.tcp.port = 0xFFFF;
+               ftp[i].mask.src.u.tcp.port = htons(0xFFFF);
                ftp[i].mask.dst.protonum = 0xFF;
                ftp[i].max_expected = 1;
                ftp[i].timeout = 5 * 60; /* 5 minutes */
index 9a39e2969712701d0ab45b9bb0dcd1d3c6ccf0e6..7b7441202bfd6e14505142a6b0d270c77f73042f 100644 (file)
@@ -49,11 +49,11 @@ MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
 int (*set_h245_addr_hook) (struct sk_buff ** pskb,
                           unsigned char **data, int dataoff,
                           H245_TransportAddress * addr,
-                          u_int32_t ip, u_int16_t port);
+                          __be32 ip, u_int16_t port);
 int (*set_h225_addr_hook) (struct sk_buff ** pskb,
                           unsigned char **data, int dataoff,
                           TransportAddress * addr,
-                          u_int32_t ip, u_int16_t port);
+                          __be32 ip, u_int16_t port);
 int (*set_sig_addr_hook) (struct sk_buff ** pskb,
                          struct ip_conntrack * ct,
                          enum ip_conntrack_info ctinfo,
@@ -209,7 +209,7 @@ static int get_tpkt_data(struct sk_buff **pskb, struct ip_conntrack *ct,
 
 /****************************************************************************/
 static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr,
-                        u_int32_t * ip, u_int16_t * port)
+                        __be32 * ip, u_int16_t * port)
 {
        unsigned char *p;
 
@@ -232,7 +232,7 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        u_int16_t rtp_port;
        struct ip_conntrack_expect *rtp_exp;
@@ -254,10 +254,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct,
        rtp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
        rtp_exp->tuple.dst.u.udp.port = htons(rtp_port);
        rtp_exp->tuple.dst.protonum = IPPROTO_UDP;
-       rtp_exp->mask.src.ip = 0xFFFFFFFF;
+       rtp_exp->mask.src.ip = htonl(0xFFFFFFFF);
        rtp_exp->mask.src.u.udp.port = 0;
-       rtp_exp->mask.dst.ip = 0xFFFFFFFF;
-       rtp_exp->mask.dst.u.udp.port = 0xFFFF;
+       rtp_exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       rtp_exp->mask.dst.u.udp.port = htons(0xFFFF);
        rtp_exp->mask.dst.protonum = 0xFF;
        rtp_exp->flags = 0;
 
@@ -271,10 +271,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct,
        rtcp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
        rtcp_exp->tuple.dst.u.udp.port = htons(rtp_port + 1);
        rtcp_exp->tuple.dst.protonum = IPPROTO_UDP;
-       rtcp_exp->mask.src.ip = 0xFFFFFFFF;
+       rtcp_exp->mask.src.ip = htonl(0xFFFFFFFF);
        rtcp_exp->mask.src.u.udp.port = 0;
-       rtcp_exp->mask.dst.ip = 0xFFFFFFFF;
-       rtcp_exp->mask.dst.u.udp.port = 0xFFFF;
+       rtcp_exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       rtcp_exp->mask.dst.u.udp.port = htons(0xFFFF);
        rtcp_exp->mask.dst.protonum = 0xFF;
        rtcp_exp->flags = 0;
 
@@ -325,7 +325,7 @@ static int expect_t120(struct sk_buff **pskb,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp = NULL;
 
@@ -342,10 +342,10 @@ static int expect_t120(struct sk_buff **pskb,
        exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = IP_CT_EXPECT_PERMANENT;    /* Accept multiple channels */
 
@@ -626,7 +626,7 @@ void ip_conntrack_h245_expect(struct ip_conntrack *new,
 
 /****************************************************************************/
 int get_h225_addr(unsigned char *data, TransportAddress * addr,
-                 u_int32_t * ip, u_int16_t * port)
+                 __be32 * ip, u_int16_t * port)
 {
        unsigned char *p;
 
@@ -648,7 +648,7 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp = NULL;
 
@@ -665,10 +665,10 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct,
        exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = 0;
 
@@ -709,7 +709,7 @@ static int expect_callforwarding(struct sk_buff **pskb,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp = NULL;
 
@@ -751,10 +751,10 @@ static int expect_callforwarding(struct sk_buff **pskb,
        exp->tuple.dst.ip = ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = 0;
 
@@ -791,7 +791,7 @@ static int process_setup(struct sk_buff **pskb, struct ip_conntrack *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret;
        int i;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
 
        DEBUGP("ip_ct_q931: Setup\n");
@@ -1188,7 +1188,7 @@ static unsigned char *get_udp_data(struct sk_buff **pskb, int *datalen)
 
 /****************************************************************************/
 static struct ip_conntrack_expect *find_expect(struct ip_conntrack *ct,
-                                              u_int32_t ip, u_int16_t port)
+                                              __be32 ip, u_int16_t port)
 {
        struct ip_conntrack_expect *exp;
        struct ip_conntrack_tuple tuple;
@@ -1228,7 +1228,7 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        int i;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp;
 
@@ -1251,10 +1251,10 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct,
        exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = gkrouted_only ? 0xFFFFFFFF : 0;
+       exp->mask.src.ip = gkrouted_only ? htonl(0xFFFFFFFF) : 0;
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = IP_CT_EXPECT_PERMANENT;    /* Accept multiple calls */
 
@@ -1307,7 +1307,7 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp;
 
@@ -1333,10 +1333,10 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct,
        exp->tuple.dst.ip = ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_UDP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = 0;
        exp->expectfn = ip_conntrack_ras_expect;
@@ -1477,7 +1477,7 @@ static int process_arq(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        struct ip_ct_h323_master *info = &ct->help.ct_h323_info;
        int dir = CTINFO2DIR(ctinfo);
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
 
        DEBUGP("ip_ct_ras: ARQ\n");
@@ -1513,7 +1513,7 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp;
 
@@ -1538,10 +1538,10 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct,
        exp->tuple.dst.ip = ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = IP_CT_EXPECT_PERMANENT;
        exp->expectfn = ip_conntrack_q931_expect;
@@ -1581,7 +1581,7 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
        struct ip_conntrack_expect *exp = NULL;
 
@@ -1598,10 +1598,10 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct,
        exp->tuple.dst.ip = ip;
        exp->tuple.dst.u.tcp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_TCP;
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.tcp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.tcp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.tcp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
        exp->flags = IP_CT_EXPECT_PERMANENT;
        exp->expectfn = ip_conntrack_q931_expect;
index fb0aee691721444ddb8551ca0460d8fcd8cbec1e..a2af5e0c7f9938b25f91618478fd8081220909a6 100644 (file)
@@ -242,10 +242,10 @@ exp_gre(struct ip_conntrack *ct,
        exp_orig->tuple.dst.u.gre.key = callid;
        exp_orig->tuple.dst.protonum = IPPROTO_GRE;
 
-       exp_orig->mask.src.ip = 0xffffffff;
+       exp_orig->mask.src.ip = htonl(0xffffffff);
        exp_orig->mask.src.u.all = 0;
        exp_orig->mask.dst.u.gre.key = htons(0xffff);
-       exp_orig->mask.dst.ip = 0xffffffff;
+       exp_orig->mask.dst.ip = htonl(0xffffffff);
        exp_orig->mask.dst.protonum = 0xff;
 
        exp_orig->master = ct;
index 44889075f3b2df3ed85807fb87cd5bc536e679aa..75f7c3db16196d3fbdd585defabca1771067fe9b 100644 (file)
@@ -218,7 +218,8 @@ static int help(struct sk_buff **pskb,
                                    IPPROTO_TCP }});
                        exp->mask = ((struct ip_conntrack_tuple)
                                { { 0, { 0 } },
-                                 { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }});
+                                 { htonl(0xFFFFFFFF),
+                                       { .tcp = { htons(0xFFFF) } }, 0xFF }});
                        exp->expectfn = NULL;
                        exp->flags = 0;
                        if (ip_nat_irc_hook)
@@ -266,7 +267,7 @@ static int __init ip_conntrack_irc_init(void)
                hlpr = &irc_helpers[i];
                hlpr->tuple.src.u.tcp.port = htons(ports[i]);
                hlpr->tuple.dst.protonum = IPPROTO_TCP;
-               hlpr->mask.src.u.tcp.port = 0xFFFF;
+               hlpr->mask.src.u.tcp.port = htons(0xFFFF);
                hlpr->mask.dst.protonum = 0xFF;
                hlpr->max_expected = max_dcc_channels;
                hlpr->timeout = dcc_timeout;
index 3d0b438783db0a71787a87a6815d182025e9f535..a1d6a89f64aa44b140eaa46473562f89508ec7c9 100644 (file)
@@ -48,7 +48,7 @@ static int help(struct sk_buff **pskb,
        struct iphdr *iph = (*pskb)->nh.iph;
        struct rtable *rt = (struct rtable *)(*pskb)->dst;
        struct in_device *in_dev;
-       u_int32_t mask = 0;
+       __be32 mask = 0;
 
        /* we're only interested in locally generated packets */
        if ((*pskb)->sk == NULL)
@@ -78,12 +78,12 @@ static int help(struct sk_buff **pskb,
                goto out;
 
        exp->tuple                = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
-       exp->tuple.src.u.udp.port = ntohs(NMBD_PORT);
+       exp->tuple.src.u.udp.port = htons(NMBD_PORT);
 
        exp->mask.src.ip          = mask;
-       exp->mask.src.u.udp.port  = 0xFFFF;
-       exp->mask.dst.ip          = 0xFFFFFFFF;
-       exp->mask.dst.u.udp.port  = 0xFFFF;
+       exp->mask.src.u.udp.port  = htons(0xFFFF);
+       exp->mask.dst.ip          = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.udp.port  = htons(0xFFFF);
        exp->mask.dst.protonum    = 0xFF;
 
        exp->expectfn             = NULL;
@@ -115,7 +115,7 @@ static struct ip_conntrack_helper helper = {
                .src = {
                        .u = {
                                .udp = {
-                                       .port   = 0xFFFF,
+                                       .port   = __constant_htons(0xFFFF),
                                }
                        }
                },
index 52eddea27e93706b2cca87c1923fd901b6146276..53b6dffea6c2174fcf49f30e7844010c015a3772 100644 (file)
@@ -78,8 +78,8 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb,
 {
        struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP);
        
-       NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t), &tuple->src.ip);
-       NFA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t), &tuple->dst.ip);
+       NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip);
+       NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip);
 
        NFA_NEST_END(skb, nest_parms);
 
@@ -110,7 +110,7 @@ ctnetlink_dump_tuples(struct sk_buff *skb,
 static inline int
 ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct)
 {
-       u_int32_t status = htonl((u_int32_t) ct->status);
+       __be32 status = htonl((u_int32_t) ct->status);
        NFA_PUT(skb, CTA_STATUS, sizeof(status), &status);
        return 0;
 
@@ -122,7 +122,7 @@ static inline int
 ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct)
 {
        long timeout_l = ct->timeout.expires - jiffies;
-       u_int32_t timeout;
+       __be32 timeout;
 
        if (timeout_l < 0)
                timeout = 0;
@@ -192,13 +192,13 @@ ctnetlink_dump_counters(struct sk_buff *skb, const struct ip_conntrack *ct,
 {
        enum ctattr_type type = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG;
        struct nfattr *nest_count = NFA_NEST(skb, type);
-       u_int32_t tmp;
+       __be32 tmp;
 
        tmp = htonl(ct->counters[dir].packets);
-       NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(u_int32_t), &tmp);
+       NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(__be32), &tmp);
 
        tmp = htonl(ct->counters[dir].bytes);
-       NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(u_int32_t), &tmp);
+       NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(__be32), &tmp);
 
        NFA_NEST_END(skb, nest_count);
 
@@ -215,9 +215,9 @@ nfattr_failure:
 static inline int
 ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct)
 {
-       u_int32_t mark = htonl(ct->mark);
+       __be32 mark = htonl(ct->mark);
 
-       NFA_PUT(skb, CTA_MARK, sizeof(u_int32_t), &mark);
+       NFA_PUT(skb, CTA_MARK, sizeof(__be32), &mark);
        return 0;
 
 nfattr_failure:
@@ -230,8 +230,8 @@ nfattr_failure:
 static inline int
 ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct)
 {
-       u_int32_t id = htonl(ct->id);
-       NFA_PUT(skb, CTA_ID, sizeof(u_int32_t), &id);
+       __be32 id = htonl(ct->id);
+       NFA_PUT(skb, CTA_ID, sizeof(__be32), &id);
        return 0;
 
 nfattr_failure:
@@ -241,9 +241,9 @@ nfattr_failure:
 static inline int
 ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct)
 {
-       u_int32_t use = htonl(atomic_read(&ct->ct_general.use));
+       __be32 use = htonl(atomic_read(&ct->ct_general.use));
        
-       NFA_PUT(skb, CTA_USE, sizeof(u_int32_t), &use);
+       NFA_PUT(skb, CTA_USE, sizeof(__be32), &use);
        return 0;
 
 nfattr_failure:
@@ -457,8 +457,8 @@ out:
 }
 
 static const size_t cta_min_ip[CTA_IP_MAX] = {
-       [CTA_IP_V4_SRC-1]       = sizeof(u_int32_t),
-       [CTA_IP_V4_DST-1]       = sizeof(u_int32_t),
+       [CTA_IP_V4_SRC-1]       = sizeof(__be32),
+       [CTA_IP_V4_DST-1]       = sizeof(__be32),
 };
 
 static inline int
@@ -475,11 +475,11 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
 
        if (!tb[CTA_IP_V4_SRC-1])
                return -EINVAL;
-       tuple->src.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
+       tuple->src.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
 
        if (!tb[CTA_IP_V4_DST-1])
                return -EINVAL;
-       tuple->dst.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
+       tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
 
        DEBUGP("leaving\n");
 
@@ -602,8 +602,8 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
 }
 
 static const size_t cta_min_nat[CTA_NAT_MAX] = {
-       [CTA_NAT_MINIP-1]       = sizeof(u_int32_t),
-       [CTA_NAT_MAXIP-1]       = sizeof(u_int32_t),
+       [CTA_NAT_MINIP-1]       = sizeof(__be32),
+       [CTA_NAT_MAXIP-1]       = sizeof(__be32),
 };
 
 static inline int
@@ -623,12 +623,12 @@ ctnetlink_parse_nat(struct nfattr *nat,
                return -EINVAL;
 
        if (tb[CTA_NAT_MINIP-1])
-               range->min_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MINIP-1]);
+               range->min_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MINIP-1]);
 
        if (!tb[CTA_NAT_MAXIP-1])
                range->max_ip = range->min_ip;
        else
-               range->max_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MAXIP-1]);
+               range->max_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MAXIP-1]);
 
        if (range->min_ip)
                range->flags |= IP_NAT_RANGE_MAP_IPS;
@@ -663,11 +663,11 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
 }
 
 static const size_t cta_min[CTA_MAX] = {
-       [CTA_STATUS-1]          = sizeof(u_int32_t),
-       [CTA_TIMEOUT-1]         = sizeof(u_int32_t),
-       [CTA_MARK-1]            = sizeof(u_int32_t),
-       [CTA_USE-1]             = sizeof(u_int32_t),
-       [CTA_ID-1]              = sizeof(u_int32_t)
+       [CTA_STATUS-1]          = sizeof(__be32),
+       [CTA_TIMEOUT-1]         = sizeof(__be32),
+       [CTA_MARK-1]            = sizeof(__be32),
+       [CTA_USE-1]             = sizeof(__be32),
+       [CTA_ID-1]              = sizeof(__be32)
 };
 
 static int
@@ -706,7 +706,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
        ct = tuplehash_to_ctrack(h);
        
        if (cda[CTA_ID-1]) {
-               u_int32_t id = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_ID-1]));
+               u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1]));
                if (ct->id != id) {
                        ip_conntrack_put(ct);
                        return -ENOENT;
@@ -808,7 +808,7 @@ static inline int
 ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
 {
        unsigned long d;
-       unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]));
+       unsigned status = ntohl(*(__be32 *)NFA_DATA(cda[CTA_STATUS-1]));
        d = ct->status ^ status;
 
        if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING))
@@ -903,7 +903,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[])
 static inline int
 ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[])
 {
-       u_int32_t timeout = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1]));
+       u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1]));
        
        if (!del_timer(&ct->timeout))
                return -ETIME;
@@ -966,7 +966,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
 
 #if defined(CONFIG_IP_NF_CONNTRACK_MARK)
        if (cda[CTA_MARK-1])
-               ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
+               ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
 #endif
 
        DEBUGP("all done\n");
@@ -989,7 +989,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
 
        if (!cda[CTA_TIMEOUT-1])
                goto err;
-       ct->timeout.expires = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1]));
+       ct->timeout.expires = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1]));
 
        ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
        ct->status |= IPS_CONFIRMED;
@@ -1006,7 +1006,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
 
 #if defined(CONFIG_IP_NF_CONNTRACK_MARK)
        if (cda[CTA_MARK-1])
-               ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
+               ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
 #endif
 
        ct->helper = ip_conntrack_helper_find_get(rtuple);
@@ -1138,8 +1138,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
                           const struct ip_conntrack_expect *exp)
 {
        struct ip_conntrack *master = exp->master;
-       u_int32_t timeout = htonl((exp->timeout.expires - jiffies) / HZ);
-       u_int32_t id = htonl(exp->id);
+       __be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ);
+       __be32 id = htonl(exp->id);
 
        if (ctnetlink_exp_dump_tuple(skb, &exp->tuple, CTA_EXPECT_TUPLE) < 0)
                goto nfattr_failure;
@@ -1150,8 +1150,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
                                 CTA_EXPECT_MASTER) < 0)
                goto nfattr_failure;
        
-       NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(timeout), &timeout);
-       NFA_PUT(skb, CTA_EXPECT_ID, sizeof(u_int32_t), &id);
+       NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout);
+       NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id);
 
        return 0;
        
@@ -1272,8 +1272,8 @@ out:
 }
 
 static const size_t cta_min_exp[CTA_EXPECT_MAX] = {
-       [CTA_EXPECT_TIMEOUT-1]          = sizeof(u_int32_t),
-       [CTA_EXPECT_ID-1]               = sizeof(u_int32_t)
+       [CTA_EXPECT_TIMEOUT-1]          = sizeof(__be32),
+       [CTA_EXPECT_ID-1]               = sizeof(__be32)
 };
 
 static int
@@ -1321,7 +1321,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
                return -ENOENT;
 
        if (cda[CTA_EXPECT_ID-1]) {
-               u_int32_t id = *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
+               __be32 id = *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
                if (exp->id != ntohl(id)) {
                        ip_conntrack_expect_put(exp);
                        return -ENOENT;
@@ -1375,8 +1375,8 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
                        return -ENOENT;
 
                if (cda[CTA_EXPECT_ID-1]) {
-                       u_int32_t id = 
-                               *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
+                       __be32 id =
+                               *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
                        if (exp->id != ntohl(id)) {
                                ip_conntrack_expect_put(exp);
                                return -ENOENT;
index 09c40ebe3345f0221d0c32934004a9dc6316706a..295b6fa340dbc021e440c77cd92de51c03291164 100644 (file)
@@ -261,7 +261,7 @@ icmp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
 static int icmp_tuple_to_nfattr(struct sk_buff *skb,
                                const struct ip_conntrack_tuple *t)
 {
-       NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t),
+       NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(__be16),
                &t->src.u.icmp.id);
        NFA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t),
                &t->dst.u.icmp.type);
@@ -287,7 +287,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[],
        tuple->dst.u.icmp.code =
                        *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]);
        tuple->src.u.icmp.id =
-                       *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]);
+                       *(__be16 *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]);
 
        if (tuple->dst.u.icmp.type >= sizeof(invmap)
            || !invmap[tuple->dst.u.icmp.type])
index b908a4842e186d3cf192dd500bc49e9a509db602..2443322e4128ac3f054fabd442cc80713b71dbc5 100644 (file)
@@ -210,7 +210,7 @@ static int sctp_print_conntrack(struct seq_file *s,
 for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0;        \
        offset < skb->len &&                                            \
        (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch));   \
-       offset += (htons(sch->length) + 3) & ~3, count++)
+       offset += (ntohs(sch->length) + 3) & ~3, count++)
 
 /* Some validity checks to make sure the chunks are fine */
 static int do_basic_checks(struct ip_conntrack *conntrack,
index 03ae9a04cb37c39351735394222f5de4b5b967a8..06e4e8a6dd9f88db85452c556d51058025db3dde 100644 (file)
@@ -519,8 +519,8 @@ static void tcp_sack(const struct sk_buff *skb,
 
        /* Fast path for timestamp-only option */
        if (length == TCPOLEN_TSTAMP_ALIGNED*4
-           && *(__u32 *)ptr ==
-               __constant_ntohl((TCPOPT_NOP << 24) 
+           && *(__be32 *)ptr ==
+               __constant_htonl((TCPOPT_NOP << 24)
                                 | (TCPOPT_NOP << 16)
                                 | (TCPOPT_TIMESTAMP << 8)
                                 | TCPOLEN_TIMESTAMP))
@@ -551,7 +551,7 @@ static void tcp_sack(const struct sk_buff *skb,
                                for (i = 0;
                                     i < (opsize - TCPOLEN_SACK_BASE);
                                     i += TCPOLEN_SACK_PERBLOCK) {
-                                       tmp = ntohl(*((u_int32_t *)(ptr+i)+1));
+                                       tmp = ntohl(*((__be32 *)(ptr+i)+1));
                                        
                                        if (after(tmp, *sack))
                                                *sack = tmp;
index 2893e9c748506627f9abce8cec1a32fb576bdd1a..f4f75995a9e4cb9c4941d5ff06b0bed6a017a4da 100644 (file)
@@ -193,7 +193,7 @@ static int skp_digits_len(const char *dptr, const char *limit, int *shift)
 
 /* Simple ipaddr parser.. */
 static int parse_ipaddr(const char *cp,        const char **endp,
-                       u_int32_t *ipaddr, const char *limit)
+                       __be32 *ipaddr, const char *limit)
 {
        unsigned long int val;
        int i, digit = 0;
@@ -227,7 +227,7 @@ static int parse_ipaddr(const char *cp,     const char **endp,
 static int epaddr_len(const char *dptr, const char *limit, int *shift)
 {
        const char *aux = dptr;
-       u_int32_t ip;
+       __be32 ip;
 
        if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) {
                DEBUGP("ip: %s parse failed.!\n", dptr);
@@ -302,7 +302,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
 static int set_expected_rtp(struct sk_buff **pskb,
                            struct ip_conntrack *ct,
                            enum ip_conntrack_info ctinfo,
-                           u_int32_t ipaddr, u_int16_t port,
+                           __be32 ipaddr, u_int16_t port,
                            const char *dptr)
 {
        struct ip_conntrack_expect *exp;
@@ -319,10 +319,10 @@ static int set_expected_rtp(struct sk_buff **pskb,
        exp->tuple.dst.u.udp.port = htons(port);
        exp->tuple.dst.protonum = IPPROTO_UDP;
 
-       exp->mask.src.ip = 0xFFFFFFFF;
+       exp->mask.src.ip = htonl(0xFFFFFFFF);
        exp->mask.src.u.udp.port = 0;
-       exp->mask.dst.ip = 0xFFFFFFFF;
-       exp->mask.dst.u.udp.port = 0xFFFF;
+       exp->mask.dst.ip = htonl(0xFFFFFFFF);
+       exp->mask.dst.u.udp.port = htons(0xFFFF);
        exp->mask.dst.protonum = 0xFF;
 
        exp->expectfn = NULL;
@@ -349,7 +349,7 @@ static int sip_help(struct sk_buff **pskb,
        const char *dptr;
        int ret = NF_ACCEPT;
        int matchoff, matchlen;
-       u_int32_t ipaddr;
+       __be32 ipaddr;
        u_int16_t port;
 
        /* No Data ? */
@@ -439,7 +439,7 @@ static int __init init(void)
 
                sip[i].tuple.dst.protonum = IPPROTO_UDP;
                sip[i].tuple.src.u.udp.port = htons(ports[i]);
-               sip[i].mask.src.u.udp.port = 0xFFFF;
+               sip[i].mask.src.u.udp.port = htons(0xFFFF);
                sip[i].mask.dst.protonum = 0xFF;
                sip[i].max_expected = 2;
                sip[i].timeout = 3 * 60; /* 3 minutes */
index 7e33d3bed5e3831e8b0a57ed06de304e3144b707..fe0b634dd37761fd15d341698cf45c0158485631 100644 (file)
@@ -70,10 +70,10 @@ static int tftp_help(struct sk_buff **pskb,
                        return NF_DROP;
 
                exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
-               exp->mask.src.ip = 0xffffffff;
+               exp->mask.src.ip = htonl(0xffffffff);
                exp->mask.src.u.udp.port = 0;
-               exp->mask.dst.ip = 0xffffffff;
-               exp->mask.dst.u.udp.port = 0xffff;
+               exp->mask.dst.ip = htonl(0xffffffff);
+               exp->mask.dst.u.udp.port = htons(0xffff);
                exp->mask.dst.protonum = 0xff;
                exp->expectfn = NULL;
                exp->flags = 0;
@@ -129,7 +129,7 @@ static int __init ip_conntrack_tftp_init(void)
                tftp[i].tuple.dst.protonum = IPPROTO_UDP;
                tftp[i].tuple.src.u.udp.port = htons(ports[i]);
                tftp[i].mask.dst.protonum = 0xFF;
-               tftp[i].mask.src.u.udp.port = 0xFFFF;
+               tftp[i].mask.src.u.udp.port = htons(0xFFFF);
                tftp[i].max_expected = 1;
                tftp[i].timeout = 5 * 60; /* 5 minutes */
                tftp[i].me = THIS_MODULE;
index 71f3e09cbc84b456f5488d9f7a49b1ba7a7fa819..4b6260a974085f754278d3a727f76f821ac92b7a 100644 (file)
@@ -82,7 +82,7 @@ static inline unsigned int
 hash_by_src(const struct ip_conntrack_tuple *tuple)
 {
        /* Original src, to ensure we map it consistently if poss. */
-       return jhash_3words(tuple->src.ip, tuple->src.u.all,
+       return jhash_3words((__force u32)tuple->src.ip, tuple->src.u.all,
                            tuple->dst.protonum, 0) % ip_nat_htable_size;
 }
 
@@ -190,7 +190,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple,
                    const struct ip_conntrack *conntrack,
                    enum ip_nat_manip_type maniptype)
 {
-       u_int32_t *var_ipp;
+       __be32 *var_ipp;
        /* Host order */
        u_int32_t minip, maxip, j;
 
@@ -217,7 +217,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple,
         * like this), even across reboots. */
        minip = ntohl(range->min_ip);
        maxip = ntohl(range->max_ip);
-       j = jhash_2words(tuple->src.ip, tuple->dst.ip, 0);
+       j = jhash_2words((__force u32)tuple->src.ip, (__force u32)tuple->dst.ip, 0);
        *var_ipp = htonl(minip + j % (maxip - minip + 1));
 }
 
@@ -534,9 +534,9 @@ int
 ip_nat_port_range_to_nfattr(struct sk_buff *skb, 
                            const struct ip_nat_range *range)
 {
-       NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(u_int16_t),
+       NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16),
                &range->min.tcp.port);
-       NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(u_int16_t),
+       NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16),
                &range->max.tcp.port);
 
        return 0;
@@ -555,7 +555,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range)
        if (tb[CTA_PROTONAT_PORT_MIN-1]) {
                ret = 1;
                range->min.tcp.port = 
-                       *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]);
+                       *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]);
        }
        
        if (!tb[CTA_PROTONAT_PORT_MAX-1]) {
@@ -564,7 +564,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range)
        } else {
                ret = 1;
                range->max.tcp.port = 
-                       *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]);
+                       *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]);
        }
 
        return ret;
index 3328fc5c5f500e381daa205f111e9319b686b71f..a71c233d8112b9cb9888ab3e3cff4d71ed9061a3 100644 (file)
@@ -34,7 +34,7 @@ MODULE_DESCRIPTION("ftp NAT helper");
 
 static int
 mangle_rfc959_packet(struct sk_buff **pskb,
-                    u_int32_t newip,
+                    __be32 newip,
                     u_int16_t port,
                     unsigned int matchoff,
                     unsigned int matchlen,
@@ -57,7 +57,7 @@ mangle_rfc959_packet(struct sk_buff **pskb,
 /* |1|132.235.1.2|6275| */
 static int
 mangle_eprt_packet(struct sk_buff **pskb,
-                  u_int32_t newip,
+                  __be32 newip,
                   u_int16_t port,
                   unsigned int matchoff,
                   unsigned int matchlen,
@@ -79,7 +79,7 @@ mangle_eprt_packet(struct sk_buff **pskb,
 /* |1|132.235.1.2|6275| */
 static int
 mangle_epsv_packet(struct sk_buff **pskb,
-                  u_int32_t newip,
+                  __be32 newip,
                   u_int16_t port,
                   unsigned int matchoff,
                   unsigned int matchlen,
@@ -98,7 +98,7 @@ mangle_epsv_packet(struct sk_buff **pskb,
                                        matchlen, buffer, strlen(buffer));
 }
 
-static int (*mangle[])(struct sk_buff **, u_int32_t, u_int16_t,
+static int (*mangle[])(struct sk_buff **, __be32, u_int16_t,
                     unsigned int,
                     unsigned int,
                     struct ip_conntrack *,
@@ -120,7 +120,7 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb,
                               struct ip_conntrack_expect *exp,
                               u32 *seq)
 {
-       u_int32_t newip;
+       __be32 newip;
        u_int16_t port;
        int dir = CTINFO2DIR(ctinfo);
        struct ip_conntrack *ct = exp->master;
index 7f6a75984f6c7830ea7a4382869a65a1607d035c..3bf858480558fe26b4c93ef515ebcd9721340e65 100644 (file)
@@ -189,7 +189,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb,
                                                        datalen, 0));
        } else
                tcph->check = nf_proto_csum_update(*pskb,
-                                                  htons(oldlen) ^ 0xFFFF,
+                                                  htons(oldlen) ^ htons(0xFFFF),
                                                   htons(datalen),
                                                   tcph->check, 1);
 
@@ -267,7 +267,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb,
                        udph->check = -1;
        } else
                udph->check = nf_proto_csum_update(*pskb,
-                                                  htons(oldlen) ^ 0xFFFF,
+                                                  htons(oldlen) ^ htons(0xFFFF),
                                                   htons(datalen),
                                                   udph->check, 1);
        return 1;
@@ -283,27 +283,25 @@ sack_adjust(struct sk_buff *skb,
            struct ip_nat_seq *natseq)
 {
        while (sackoff < sackend) {
-               struct tcp_sack_block *sack;
-               u_int32_t new_start_seq, new_end_seq;
+               struct tcp_sack_block_wire *sack;
+               __be32 new_start_seq, new_end_seq;
 
                sack = (void *)skb->data + sackoff;
                if (after(ntohl(sack->start_seq) - natseq->offset_before,
                          natseq->correction_pos))
-                       new_start_seq = ntohl(sack->start_seq) 
-                                       - natseq->offset_after;
+                       new_start_seq = htonl(ntohl(sack->start_seq)
+                                       - natseq->offset_after);
                else
-                       new_start_seq = ntohl(sack->start_seq) 
-                                       - natseq->offset_before;
-               new_start_seq = htonl(new_start_seq);
+                       new_start_seq = htonl(ntohl(sack->start_seq)
+                                       - natseq->offset_before);
 
                if (after(ntohl(sack->end_seq) - natseq->offset_before,
                          natseq->correction_pos))
-                       new_end_seq = ntohl(sack->end_seq)
-                                     - natseq->offset_after;
+                       new_end_seq = htonl(ntohl(sack->end_seq)
+                                     - natseq->offset_after);
                else
-                       new_end_seq = ntohl(sack->end_seq)
-                                     - natseq->offset_before;
-               new_end_seq = htonl(new_end_seq);
+                       new_end_seq = htonl(ntohl(sack->end_seq)
+                                     - natseq->offset_before);
 
                DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n",
                        ntohl(sack->start_seq), new_start_seq,
@@ -375,7 +373,8 @@ ip_nat_seq_adjust(struct sk_buff **pskb,
                  enum ip_conntrack_info ctinfo)
 {
        struct tcphdr *tcph;
-       int dir, newseq, newack;
+       int dir;
+       __be32 newseq, newack;
        struct ip_nat_seq *this_way, *other_way;        
 
        dir = CTINFO2DIR(ctinfo);
@@ -388,17 +387,15 @@ ip_nat_seq_adjust(struct sk_buff **pskb,
 
        tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4;
        if (after(ntohl(tcph->seq), this_way->correction_pos))
-               newseq = ntohl(tcph->seq) + this_way->offset_after;
+               newseq = htonl(ntohl(tcph->seq) + this_way->offset_after);
        else
-               newseq = ntohl(tcph->seq) + this_way->offset_before;
-       newseq = htonl(newseq);
+               newseq = htonl(ntohl(tcph->seq) + this_way->offset_before);
 
        if (after(ntohl(tcph->ack_seq) - other_way->offset_before,
                  other_way->correction_pos))
-               newack = ntohl(tcph->ack_seq) - other_way->offset_after;
+               newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after);
        else
-               newack = ntohl(tcph->ack_seq) - other_way->offset_before;
-       newack = htonl(newack);
+               newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
 
        tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq,
                                           tcph->check, 0);
index 419b878fb467276ac3f885fdae6f1228118591a3..4a7d34466ee2a9485a6ad3082af4b5eb5a6ad618 100644 (file)
 /****************************************************************************/
 static int set_addr(struct sk_buff **pskb,
                    unsigned char **data, int dataoff,
-                   unsigned int addroff, u_int32_t ip, u_int16_t port)
+                   unsigned int addroff, __be32 ip, u_int16_t port)
 {
        enum ip_conntrack_info ctinfo;
        struct ip_conntrack *ct = ip_conntrack_get(*pskb, &ctinfo);
        struct {
-               u_int32_t ip;
-               u_int16_t port;
+               __be32 ip;
+               __be16 port;
        } __attribute__ ((__packed__)) buf;
        struct tcphdr _tcph, *th;
 
@@ -86,7 +86,7 @@ static int set_addr(struct sk_buff **pskb,
 static int set_h225_addr(struct sk_buff **pskb,
                         unsigned char **data, int dataoff,
                         TransportAddress * addr,
-                        u_int32_t ip, u_int16_t port)
+                        __be32 ip, u_int16_t port)
 {
        return set_addr(pskb, data, dataoff, addr->ipAddress.ip, ip, port);
 }
@@ -95,7 +95,7 @@ static int set_h225_addr(struct sk_buff **pskb,
 static int set_h245_addr(struct sk_buff **pskb,
                         unsigned char **data, int dataoff,
                         H245_TransportAddress * addr,
-                        u_int32_t ip, u_int16_t port)
+                        __be32 ip, u_int16_t port)
 {
        return set_addr(pskb, data, dataoff,
                        addr->unicastAddress.iPAddress.network, ip, port);
@@ -110,7 +110,7 @@ static int set_sig_addr(struct sk_buff **pskb, struct ip_conntrack *ct,
        struct ip_ct_h323_master *info = &ct->help.ct_h323_info;
        int dir = CTINFO2DIR(ctinfo);
        int i;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
 
        for (i = 0; i < count; i++) {
@@ -164,7 +164,7 @@ static int set_ras_addr(struct sk_buff **pskb, struct ip_conntrack *ct,
 {
        int dir = CTINFO2DIR(ctinfo);
        int i;
-       u_int32_t ip;
+       __be32 ip;
        u_int16_t port;
 
        for (i = 0; i < count; i++) {
@@ -433,7 +433,7 @@ static int nat_q931(struct sk_buff **pskb, struct ip_conntrack *ct,
        struct ip_ct_h323_master *info = &ct->help.ct_h323_info;
        int dir = CTINFO2DIR(ctinfo);
        u_int16_t nated_port = port;
-       u_int32_t ip;
+       __be32 ip;
 
        /* Set expectations for NAT */
        exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
index 2ff5788071237fa968a74dd1d45c7da512472d1e..329fdcd7d7029aa9724930e94416b2431ff1e669 100644 (file)
@@ -51,7 +51,7 @@
 
 #define IP_NAT_PPTP_VERSION "3.0"
 
-#define REQ_CID(req, off)              (*(u_int16_t *)((char *)(req) + (off)))
+#define REQ_CID(req, off)              (*(__be16 *)((char *)(req) + (off)))
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
index ec50cc295317feac7527e22ba21c5d1972492265..3f6efc13ac74e7a20f9a9ecd9bbd9a1d99e5a2c7 100644 (file)
@@ -67,7 +67,7 @@ icmp_manip_pkt(struct sk_buff **pskb,
 
        hdr = (struct icmphdr *)((*pskb)->data + hdroff);
        hdr->checksum = nf_proto_csum_update(*pskb,
-                                            hdr->un.echo.id ^ 0xFFFF,
+                                            hdr->un.echo.id ^ htons(0xFFFF),
                                             tuple->src.u.icmp.id,
                                             hdr->checksum, 0);
        hdr->un.echo.id = tuple->src.u.icmp.id;
index 72a6307bd2db90dde126cabb647cf738b1b1bf0b..12deb13b93b12aee127377cf316c729cd100f8d8 100644 (file)
@@ -24,7 +24,7 @@ tcp_in_range(const struct ip_conntrack_tuple *tuple,
             const union ip_conntrack_manip_proto *min,
             const union ip_conntrack_manip_proto *max)
 {
-       u_int16_t port;
+       __be16 port;
 
        if (maniptype == IP_NAT_MANIP_SRC)
                port = tuple->src.u.tcp.port;
@@ -42,7 +42,7 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple,
                 const struct ip_conntrack *conntrack)
 {
        static u_int16_t port;
-       u_int16_t *portptr;
+       __be16 *portptr;
        unsigned int range_size, min, i;
 
        if (maniptype == IP_NAT_MANIP_SRC)
@@ -93,8 +93,8 @@ tcp_manip_pkt(struct sk_buff **pskb,
        struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff);
        struct tcphdr *hdr;
        unsigned int hdroff = iphdroff + iph->ihl*4;
-       u32 oldip, newip;
-       u16 *portptr, newport, oldport;
+       __be32 oldip, newip;
+       __be16 *portptr, newport, oldport;
        int hdrsize = 8; /* TCP connection tracking guarantees this much */
 
        /* this could be a inner header returned in icmp packet; in such
@@ -130,7 +130,7 @@ tcp_manip_pkt(struct sk_buff **pskb,
                return 1;
 
        hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, hdr->check, 1);
-       hdr->check = nf_proto_csum_update(*pskb, oldport ^ 0xFFFF, newport,
+       hdr->check = nf_proto_csum_update(*pskb, oldport ^ htons(0xFFFF), newport,
                                          hdr->check, 0);
        return 1;
 }
index 5da196ae758cf07e6cb09b8ef2629789ec0c8bb0..4bbec7730d18b3fbbec444aee353bf0b07dc41dd 100644 (file)
@@ -24,7 +24,7 @@ udp_in_range(const struct ip_conntrack_tuple *tuple,
             const union ip_conntrack_manip_proto *min,
             const union ip_conntrack_manip_proto *max)
 {
-       u_int16_t port;
+       __be16 port;
 
        if (maniptype == IP_NAT_MANIP_SRC)
                port = tuple->src.u.udp.port;
@@ -42,7 +42,7 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple,
                 const struct ip_conntrack *conntrack)
 {
        static u_int16_t port;
-       u_int16_t *portptr;
+       __be16 *portptr;
        unsigned int range_size, min, i;
 
        if (maniptype == IP_NAT_MANIP_SRC)
@@ -91,8 +91,8 @@ udp_manip_pkt(struct sk_buff **pskb,
        struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff);
        struct udphdr *hdr;
        unsigned int hdroff = iphdroff + iph->ihl*4;
-       u32 oldip, newip;
-       u16 *portptr, newport;
+       __be32 oldip, newip;
+       __be16 *portptr, newport;
 
        if (!skb_make_writable(pskb, hdroff + sizeof(*hdr)))
                return 0;
@@ -118,7 +118,7 @@ udp_manip_pkt(struct sk_buff **pskb,
                hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip,
                                                  hdr->check, 1);
                hdr->check = nf_proto_csum_update(*pskb,
-                                                 *portptr ^ 0xFFFF, newport,
+                                                 *portptr ^ htons(0xFFFF), newport,
                                                  hdr->check, 0);
                if (!hdr->check)
                        hdr->check = -1;
index 7b703839aa58ca78d4b2a73d40f2516198d714b1..a176aa3031e0f37557d100975e6e9ba92f0df4f0 100644 (file)
@@ -119,7 +119,7 @@ static unsigned int ipt_snat_target(struct sk_buff **pskb,
 }
 
 /* Before 2.6.11 we did implicit source NAT if required. Warn about change. */
-static void warn_if_extra_mangle(u32 dstip, u32 srcip)
+static void warn_if_extra_mangle(__be32 dstip, __be32 srcip)
 {
        static int warned = 0;
        struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } };
@@ -205,7 +205,7 @@ alloc_null_binding(struct ip_conntrack *conntrack,
           per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).
           Use reply in case it's already been mangled (eg local packet).
        */
-       u_int32_t ip
+       __be32 ip
                = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
                   ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip
                   : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip);
@@ -222,7 +222,7 @@ alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
                              struct ip_nat_info *info,
                              unsigned int hooknum)
 {
-       u_int32_t ip
+       __be32 ip
                = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
                   ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip
                   : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip);
index 6ffba63adca230e17ed1345838e49240879a857a..71fc2730a007d5ccdd9f4069c763d4b8bb8f748c 100644 (file)
@@ -60,8 +60,8 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb,
        enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
        char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")];
        unsigned int bufflen, dataoff;
-       u_int32_t ip;
-       u_int16_t port;
+       __be32 ip;
+       __be16 port;
 
        dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
 
@@ -159,7 +159,7 @@ static int mangle_content_len(struct sk_buff **pskb,
 static unsigned int mangle_sdp(struct sk_buff **pskb,
                               enum ip_conntrack_info ctinfo,
                               struct ip_conntrack *ct,
-                              u_int32_t newip, u_int16_t port,
+                              __be32 newip, u_int16_t port,
                               const char *dptr)
 {
        char buffer[sizeof("nnn.nnn.nnn.nnn")];
@@ -195,7 +195,7 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb,
 {
        struct ip_conntrack *ct = exp->master;
        enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
-       u_int32_t newip;
+       __be32 newip;
        u_int16_t port;
 
        DEBUGP("ip_nat_sdp():\n");
index 18b7fbdccb6126684f67478fa6a7ba1580445b23..168f45fa1898d2ce1094ed2782916e2b67d88c50 100644 (file)
@@ -1211,7 +1211,7 @@ static int snmp_translate(struct ip_conntrack *ct,
                           struct sk_buff **pskb)
 {
        struct iphdr *iph = (*pskb)->nh.iph;
-       struct udphdr *udph = (struct udphdr *)((u_int32_t *)iph + iph->ihl);
+       struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl);
        u_int16_t udplen = ntohs(udph->len);
        u_int16_t paylen = udplen - sizeof(struct udphdr);
        int dir = CTINFO2DIR(ctinfo);
index 9c577db62047a7255c4ebed0c317050319290865..021395b674639b19f65975732239321a2fd34750 100644 (file)
@@ -191,7 +191,7 @@ ip_nat_in(unsigned int hooknum,
           int (*okfn)(struct sk_buff *))
 {
        unsigned int ret;
-       u_int32_t daddr = (*pskb)->nh.iph->daddr;
+       __be32 daddr = (*pskb)->nh.iph->daddr;
 
        ret = ip_nat_fn(hooknum, pskb, in, out, okfn);
        if (ret != NF_DROP && ret != NF_STOLEN
index 41589665fc5ddabc128690199ac266bc98494537..7a29d6e7baa7db35c4d71da25889e0e0b83f3a66 100644 (file)
@@ -52,7 +52,7 @@ struct clusterip_config {
        atomic_t entries;                       /* number of entries/rules
                                                 * referencing us */
 
-       u_int32_t clusterip;                    /* the IP address */
+       __be32 clusterip;                       /* the IP address */
        u_int8_t clustermac[ETH_ALEN];          /* the MAC address */
        struct net_device *dev;                 /* device */
        u_int16_t num_total_nodes;              /* total number of nodes */
@@ -119,7 +119,7 @@ clusterip_config_entry_put(struct clusterip_config *c)
 }
 
 static struct clusterip_config *
-__clusterip_config_find(u_int32_t clusterip)
+__clusterip_config_find(__be32 clusterip)
 {
        struct list_head *pos;
 
@@ -136,7 +136,7 @@ __clusterip_config_find(u_int32_t clusterip)
 }
 
 static inline struct clusterip_config *
-clusterip_config_find_get(u_int32_t clusterip, int entry)
+clusterip_config_find_get(__be32 clusterip, int entry)
 {
        struct clusterip_config *c;
 
@@ -166,7 +166,7 @@ clusterip_config_init_nodelist(struct clusterip_config *c,
 }
 
 static struct clusterip_config *
-clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip,
+clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
                        struct net_device *dev)
 {
        struct clusterip_config *c;
@@ -387,7 +387,7 @@ checkentry(const char *tablename,
                return 0;
 
        }
-       if (e->ip.dmsk.s_addr != 0xffffffff
+       if (e->ip.dmsk.s_addr != htonl(0xffffffff)
            || e->ip.dst.s_addr == 0) {
                printk(KERN_ERR "CLUSTERIP: Please specify destination IP\n");
                return 0;
@@ -476,9 +476,9 @@ static struct ipt_target clusterip_tgt = {
 /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */
 struct arp_payload {
        u_int8_t src_hw[ETH_ALEN];
-       u_int32_t src_ip;
+       __be32 src_ip;
        u_int8_t dst_hw[ETH_ALEN];
-       u_int32_t dst_ip;
+       __be32 dst_ip;
 } __attribute__ ((packed));
 
 #ifdef CLUSTERIP_DEBUG
index 23f9c7ebe7ebb5992e57dbc9877b36c068ad9262..12a818a2462f2a8caf9f8fea514d401fd1d7311b 100644 (file)
@@ -28,7 +28,7 @@ static inline int
 set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
 {
        struct iphdr *iph = (*pskb)->nh.iph;
-       u_int16_t oldtos;
+       __be16 oldtos;
 
        if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
                if (!skb_make_writable(pskb, sizeof(struct iphdr)))
@@ -37,7 +37,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
                oldtos = iph->tos;
                iph->tos &= ~IPT_ECN_IP_MASK;
                iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK);
-               iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos,
+               iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos,
                                            iph->check);
        } 
        return 1;
@@ -48,7 +48,7 @@ static inline int
 set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
 {
        struct tcphdr _tcph, *tcph;
-       u_int16_t oldval;
+       __be16 oldval;
 
        /* Not enought header? */
        tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
@@ -66,15 +66,15 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
                return 0;
        tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4;
 
-       oldval = ((u_int16_t *)tcph)[6];
+       oldval = ((__be16 *)tcph)[6];
        if (einfo->operation & IPT_ECN_OP_SET_ECE)
                tcph->ece = einfo->proto.tcp.ece;
        if (einfo->operation & IPT_ECN_OP_SET_CWR)
                tcph->cwr = einfo->proto.tcp.cwr;
 
        tcph->check = nf_proto_csum_update((*pskb),
-                                          oldval ^ 0xFFFF,
-                                          ((u_int16_t *)tcph)[6],
+                                          oldval ^ htons(0xFFFF),
+                                          ((__be16 *)tcph)[6],
                                           tcph->check, 0);
        return 1;
 }
index bc65168a3437d7793cf4cfed31daa02e8a5dee9f..3dbfcfac8a84db1b46543ebec8ba58865d12edf0 100644 (file)
@@ -70,7 +70,7 @@ masquerade_target(struct sk_buff **pskb,
        const struct ip_nat_multi_range_compat *mr;
        struct ip_nat_range newrange;
        struct rtable *rt;
-       u_int32_t newsrc;
+       __be32 newsrc;
 
        IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING);
 
index beb2914225ff6e4db3c64a800678a7f6ed4b35a8..58a88f2271081383c81b25c6c2dca4ff3d7ac010 100644 (file)
@@ -58,7 +58,7 @@ target(struct sk_buff **pskb,
 {
        struct ip_conntrack *ct;
        enum ip_conntrack_info ctinfo;
-       u_int32_t new_ip, netmask;
+       __be32 new_ip, netmask;
        const struct ip_nat_multi_range_compat *mr = targinfo;
        struct ip_nat_range newrange;
 
index f03d43671c6d1e5278bcd263971aac630abef9bf..c0dcfe9d610cd35baa4df884de2b3a0aed8398a7 100644 (file)
@@ -61,7 +61,7 @@ redirect_target(struct sk_buff **pskb,
 {
        struct ip_conntrack *ct;
        enum ip_conntrack_info ctinfo;
-       u_int32_t newdst;
+       __be32 newdst;
        const struct ip_nat_multi_range_compat *mr = targinfo;
        struct ip_nat_range newrange;
 
index b81821edd893382a20ca9d996a47209fc90f97ec..fd0c05efed8a088ead0dc29ca1e08a05147a9e22 100644 (file)
@@ -104,8 +104,8 @@ static void send_reset(struct sk_buff *oldskb, int hook)
        struct iphdr *iph = oldskb->nh.iph;
        struct tcphdr _otcph, *oth, *tcph;
        struct rtable *rt;
-       u_int16_t tmp_port;
-       u_int32_t tmp_addr;
+       __be16 tmp_port;
+       __be32 tmp_addr;
        int needs_ack;
        int hh_len;
 
index efbcb119883244bc3273d9a5f31f263ad232a400..b38b13328d739fce3b3fc3a54d312f772501cffc 100644 (file)
@@ -135,7 +135,8 @@ same_target(struct sk_buff **pskb,
 {
        struct ip_conntrack *ct;
        enum ip_conntrack_info ctinfo;
-       u_int32_t tmpip, aindex, new_ip;
+       u_int32_t tmpip, aindex;
+       __be32 new_ip;
        const struct ipt_same_info *same = targinfo;
        struct ip_nat_range newrange;
        const struct ip_conntrack_tuple *t;
index 4246c4321e5bb74333bc9a1ed1a3fde6929b6510..108b6b76311fea42b48312a217bdf07e42137191 100644 (file)
@@ -42,7 +42,8 @@ ipt_tcpmss_target(struct sk_buff **pskb,
        const struct ipt_tcpmss_info *tcpmssinfo = targinfo;
        struct tcphdr *tcph;
        struct iphdr *iph;
-       u_int16_t tcplen, newtotlen, oldval, newmss;
+       u_int16_t tcplen, newmss;
+       __be16 newtotlen, oldval;
        unsigned int i;
        u_int8_t *opt;
 
@@ -97,7 +98,7 @@ ipt_tcpmss_target(struct sk_buff **pskb,
                        opt[i+3] = (newmss & 0x00ff);
 
                        tcph->check = nf_proto_csum_update(*pskb,
-                                                          htons(oldmss)^0xFFFF,
+                                                          htons(oldmss)^htons(0xFFFF),
                                                           htons(newmss),
                                                           tcph->check, 0);
                        return IPT_CONTINUE;
@@ -126,7 +127,7 @@ ipt_tcpmss_target(struct sk_buff **pskb,
        memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
 
        tcph->check = nf_proto_csum_update(*pskb,
-                                          htons(tcplen) ^ 0xFFFF,
+                                          htons(tcplen) ^ htons(0xFFFF),
                                           htons(tcplen + TCPOLEN_MSS),
                                           tcph->check, 1);
        opt[0] = TCPOPT_MSS;
@@ -134,18 +135,18 @@ ipt_tcpmss_target(struct sk_buff **pskb,
        opt[2] = (newmss & 0xff00) >> 8;
        opt[3] = (newmss & 0x00ff);
 
-       tcph->check = nf_proto_csum_update(*pskb, ~0, *((u_int32_t *)opt),
+       tcph->check = nf_proto_csum_update(*pskb, htonl(~0), *((__be32 *)opt),
                                           tcph->check, 0);
 
-       oldval = ((u_int16_t *)tcph)[6];
+       oldval = ((__be16 *)tcph)[6];
        tcph->doff += TCPOLEN_MSS/4;
        tcph->check = nf_proto_csum_update(*pskb,
-                                          oldval ^ 0xFFFF,
-                                          ((u_int16_t *)tcph)[6],
+                                          oldval ^ htons(0xFFFF),
+                                          ((__be16 *)tcph)[6],
                                           tcph->check, 0);
 
        newtotlen = htons(ntohs(iph->tot_len) + TCPOLEN_MSS);
-       iph->check = nf_csum_update(iph->tot_len ^ 0xFFFF,
+       iph->check = nf_csum_update(iph->tot_len ^ htons(0xFFFF),
                                    newtotlen, iph->check);
        iph->tot_len = newtotlen;
        return IPT_CONTINUE;
index 471a4c438b0af123ec174e8e51bcae9b27be7695..6b8b14ccc3d3ff9a0fa0610a0e08df6d274cf2ef 100644 (file)
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb,
 {
        const struct ipt_tos_target_info *tosinfo = targinfo;
        struct iphdr *iph = (*pskb)->nh.iph;
-       u_int16_t oldtos;
+       __be16 oldtos;
 
        if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
                if (!skb_make_writable(pskb, sizeof(struct iphdr)))
@@ -38,7 +38,7 @@ target(struct sk_buff **pskb,
                iph = (*pskb)->nh.iph;
                oldtos = iph->tos;
                iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
-               iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos,
+               iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos,
                                            iph->check);
        }
        return IPT_CONTINUE;
index 96e79cc6d0f233dd20cb95b4ffc76336a72d2a7d..ac9517d62af0e1d79a3e81da2142e26578d7e269 100644 (file)
@@ -54,8 +54,8 @@ ipt_ttl_target(struct sk_buff **pskb,
        }
 
        if (new_ttl != iph->ttl) {
-               iph->check = nf_csum_update(ntohs((iph->ttl << 8)) ^ 0xFFFF,
-                                           ntohs(new_ttl << 8),
+               iph->check = nf_csum_update(htons((iph->ttl << 8)) ^ htons(0xFFFF),
+                                           htons(new_ttl << 8),
                                            iph->check);
                iph->ttl = new_ttl;
        }
index 893dae210b0482b324329fffc834974c6e61ec32..7b60eb74788b6671617425cd2c2602ffe79fe956 100644 (file)
@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
 MODULE_DESCRIPTION("iptables addrtype match");
 
-static inline int match_type(u_int32_t addr, u_int16_t mask)
+static inline int match_type(__be32 addr, u_int16_t mask)
 {
        return !!(mask & (1 << inet_addr_type(addr)));
 }
index 4f73a61aa3dd48e6b2bedb2bd9f851819837842d..33ccdbf8e7940b0f37d6d0fe0557b7e633530554 100644 (file)
@@ -50,11 +50,11 @@ static struct file_operations dl_file_ops;
 /* hash table crap */
 
 struct dsthash_dst {
-       u_int32_t src_ip;
-       u_int32_t dst_ip;
+       __be32 src_ip;
+       __be32 dst_ip;
        /* ports have to be consecutive !!! */
-       u_int16_t src_port;
-       u_int16_t dst_port;
+       __be16 src_port;
+       __be16 dst_port;
 };
 
 struct dsthash_ent {
@@ -106,8 +106,10 @@ static inline int dst_cmp(const struct dsthash_ent *ent, struct dsthash_dst *b)
 static inline u_int32_t
 hash_dst(const struct ipt_hashlimit_htable *ht, const struct dsthash_dst *dst)
 {
-       return (jhash_3words(dst->dst_ip, (dst->dst_port<<16 | dst->src_port), 
-                            dst->src_ip, ht->rnd) % ht->cfg.size);
+       return (jhash_3words((__force u32)dst->dst_ip,
+                           ((__force u32)dst->dst_port<<16 |
+                            (__force u32)dst->src_port),
+                            (__force u32)dst->src_ip, ht->rnd) % ht->cfg.size);
 }
 
 static inline struct dsthash_ent *
@@ -406,7 +408,7 @@ hashlimit_match(const struct sk_buff *skb,
                dst.src_ip = skb->nh.iph->saddr;
        if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT
            ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) {
-               u_int16_t _ports[2], *ports;
+               __be16 _ports[2], *ports;
 
                switch (skb->nh.iph->protocol) {
                case IPPROTO_TCP:
index 32ae8d7ac50654c41ff3288d4be4a996e3ce4a79..126db44e71a8eaa3fd91fa5ba36f8bbd27db46fe 100644 (file)
@@ -50,11 +50,10 @@ MODULE_PARM_DESC(ip_list_perms, "permissions on /proc/net/ipt_recent/* files");
 MODULE_PARM_DESC(ip_list_uid,"owner of /proc/net/ipt_recent/* files");
 MODULE_PARM_DESC(ip_list_gid,"owning group of /proc/net/ipt_recent/* files");
 
-
 struct recent_entry {
        struct list_head        list;
        struct list_head        lru_list;
-       u_int32_t               addr;
+       __be32                  addr;
        u_int8_t                ttl;
        u_int8_t                index;
        u_int16_t               nstamps;
@@ -85,17 +84,17 @@ static struct file_operations       recent_fops;
 static u_int32_t hash_rnd;
 static int hash_rnd_initted;
 
-static unsigned int recent_entry_hash(u_int32_t addr)
+static unsigned int recent_entry_hash(__be32 addr)
 {
        if (!hash_rnd_initted) {
                get_random_bytes(&hash_rnd, 4);
                hash_rnd_initted = 1;
        }
-       return jhash_1word(addr, hash_rnd) & (ip_list_hash_size - 1);
+       return jhash_1word((__force u32)addr, hash_rnd) & (ip_list_hash_size - 1);
 }
 
 static struct recent_entry *
-recent_entry_lookup(const struct recent_table *table, u_int32_t addr, u_int8_t ttl)
+recent_entry_lookup(const struct recent_table *table, __be32 addr, u_int8_t ttl)
 {
        struct recent_entry *e;
        unsigned int h;
@@ -116,7 +115,7 @@ static void recent_entry_remove(struct recent_table *t, struct recent_entry *e)
 }
 
 static struct recent_entry *
-recent_entry_init(struct recent_table *t, u_int32_t addr, u_int8_t ttl)
+recent_entry_init(struct recent_table *t, __be32 addr, u_int8_t ttl)
 {
        struct recent_entry *e;
 
@@ -178,7 +177,7 @@ ipt_recent_match(const struct sk_buff *skb,
        const struct ipt_recent_info *info = matchinfo;
        struct recent_table *t;
        struct recent_entry *e;
-       u_int32_t addr;
+       __be32 addr;
        u_int8_t ttl;
        int ret = info->invert;
 
@@ -406,7 +405,7 @@ static ssize_t recent_proc_write(struct file *file, const char __user *input,
        struct recent_table *t = pde->data;
        struct recent_entry *e;
        char buf[sizeof("+255.255.255.255")], *c = buf;
-       u_int32_t addr;
+       __be32 addr;
        int add;
 
        if (size > sizeof(buf))
index 79336cb42527387d9708fcdb9c4bd4105ea66767..e62ea2bb9c0ac422f7c77e39aa7f99eba5fa6e3b 100644 (file)
@@ -131,7 +131,7 @@ ipt_local_hook(unsigned int hook,
 {
        unsigned int ret;
        u_int8_t tos;
-       u_int32_t saddr, daddr;
+       __be32 saddr, daddr;
        unsigned long nfmark;
 
        /* root is playing with raw sockets. */
index 0e935b4c87411ab9e697a5255fe0d8b58f9e8eb3..b430cf2a4f6609db27f6ea137e3f18b0281bd442 100644 (file)
@@ -381,8 +381,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        struct ipcm_cookie ipc;
        struct rtable *rt = NULL;
        int free = 0;
-       u32 daddr;
-       u32 saddr;
+       __be32 daddr;
+       __be32 saddr;
        u8  tos;
        int err;
 
index 20ffe8e88c0f0809d28418743fb81fd5cc43bc02..c41ddba02e9d3553dac0f4aca6d7c5c8b9975584 100644 (file)
@@ -261,6 +261,10 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr)
                & rt_hash_mask);
 }
 
+#define rt_hash(daddr, saddr, idx) \
+       rt_hash_code((__force u32)(__be32)(daddr),\
+                    (__force u32)(__be32)(saddr) ^ ((idx) << 5))
+
 #ifdef CONFIG_PROC_FS
 struct rt_cache_iter_state {
        int bucket;
@@ -1074,7 +1078,7 @@ static void ip_select_fb_ident(struct iphdr *iph)
        u32 salt;
 
        spin_lock_bh(&ip_fb_id_lock);
-       salt = secure_ip_id(ip_fallback_id ^ iph->daddr);
+       salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr);
        iph->id = htons(salt & 0xFFFF);
        ip_fallback_id = salt;
        spin_unlock_bh(&ip_fb_id_lock);
@@ -1118,13 +1122,13 @@ static void rt_del(unsigned hash, struct rtable *rt)
        spin_unlock_bh(rt_hash_lock_addr(hash));
 }
 
-void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
-                   u32 saddr, struct net_device *dev)
+void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
+                   __be32 saddr, struct net_device *dev)
 {
        int i, k;
        struct in_device *in_dev = in_dev_get(dev);
        struct rtable *rth, **rthp;
-       u32  skeys[2] = { saddr, 0 };
+       __be32  skeys[2] = { saddr, 0 };
        int  ikeys[2] = { dev->ifindex, 0 };
        struct netevent_redirect netevent;
 
@@ -1147,8 +1151,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
 
        for (i = 0; i < 2; i++) {
                for (k = 0; k < 2; k++) {
-                       unsigned hash = rt_hash_code(daddr,
-                                                    skeys[i] ^ (ikeys[k] << 5));
+                       unsigned hash = rt_hash(daddr, skeys[i], ikeys[k]);
 
                        rthp=&rt_hash_table[hash].chain;
 
@@ -1260,9 +1263,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
                        ret = NULL;
                } else if ((rt->rt_flags & RTCF_REDIRECTED) ||
                           rt->u.dst.expires) {
-                       unsigned hash = rt_hash_code(rt->fl.fl4_dst,
-                                                    rt->fl.fl4_src ^
-                                                       (rt->fl.oif << 5));
+                       unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
+                                               rt->fl.oif);
 #if RT_CACHE_DEBUG >= 1
                        printk(KERN_DEBUG "ip_rt_advice: redirect to "
                                          "%u.%u.%u.%u/%02x dropped\n",
@@ -1397,15 +1399,15 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
        int i;
        unsigned short old_mtu = ntohs(iph->tot_len);
        struct rtable *rth;
-       u32  skeys[2] = { iph->saddr, 0, };
-       u32  daddr = iph->daddr;
+       __be32  skeys[2] = { iph->saddr, 0, };
+       __be32  daddr = iph->daddr;
        unsigned short est_mtu = 0;
 
        if (ipv4_config.no_pmtu_disc)
                return 0;
 
        for (i = 0; i < 2; i++) {
-               unsigned hash = rt_hash_code(daddr, skeys[i]);
+               unsigned hash = rt_hash(daddr, skeys[i], 0);
 
                rcu_read_lock();
                for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
@@ -1530,7 +1532,7 @@ static int ip_rt_bug(struct sk_buff *skb)
 
 void ip_rt_get_source(u8 *addr, struct rtable *rt)
 {
-       u32 src;
+       __be32 src;
        struct fib_result res;
 
        if (rt->fl.iif == 0)
@@ -1596,12 +1598,12 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
         rt->rt_type = res->type;
 }
 
-static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr,
+static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                                u8 tos, struct net_device *dev, int our)
 {
        unsigned hash;
        struct rtable *rth;
-       u32 spec_dst;
+       __be32 spec_dst;
        struct in_device *in_dev = in_dev_get(dev);
        u32 itag = 0;
 
@@ -1665,7 +1667,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr,
        RT_CACHE_STAT_INC(in_slow_mc);
 
        in_dev_put(in_dev);
-       hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5));
+       hash = rt_hash(daddr, saddr, dev->ifindex);
        return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst);
 
 e_nobufs:
@@ -1681,8 +1683,8 @@ e_inval:
 static void ip_handle_martian_source(struct net_device *dev,
                                     struct in_device *in_dev,
                                     struct sk_buff *skb,
-                                    u32 daddr,
-                                    u32 saddr) 
+                                    __be32 daddr,
+                                    __be32 saddr)
 {
        RT_CACHE_STAT_INC(in_martian_src);
 #ifdef CONFIG_IP_ROUTE_VERBOSE
@@ -1712,7 +1714,7 @@ static void ip_handle_martian_source(struct net_device *dev,
 static inline int __mkroute_input(struct sk_buff *skb, 
                                  struct fib_result* res, 
                                  struct in_device *in_dev, 
-                                 u32 daddr, u32 saddr, u32 tos, 
+                                 __be32 daddr, __be32 saddr, u32 tos,
                                  struct rtable **result) 
 {
 
@@ -1720,7 +1722,8 @@ static inline int __mkroute_input(struct sk_buff *skb,
        int err;
        struct in_device *out_dev;
        unsigned flags = 0;
-       u32 spec_dst, itag;
+       __be32 spec_dst;
+       u32 itag;
 
        /* get a working reference to the output device */
        out_dev = in_dev_get(FIB_RES_DEV(*res));
@@ -1813,7 +1816,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb,
                                       struct fib_result* res, 
                                       const struct flowi *fl,
                                       struct in_device *in_dev,
-                                      u32 daddr, u32 saddr, u32 tos)
+                                      __be32 daddr, __be32 saddr, u32 tos)
 {
        struct rtable* rth = NULL;
        int err;
@@ -1830,7 +1833,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb,
                return err;
 
        /* put it into the cache */
-       hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5));
+       hash = rt_hash(daddr, saddr, fl->iif);
        return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);   
 }
 
@@ -1838,7 +1841,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
                                   struct fib_result* res, 
                                   const struct flowi *fl,
                                   struct in_device *in_dev,
-                                  u32 daddr, u32 saddr, u32 tos)
+                                  __be32 daddr, __be32 saddr, u32 tos)
 {
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
        struct rtable* rth = NULL, *rtres;
@@ -1871,7 +1874,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
                        return err;
 
                /* put it into the cache */
-               hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5));
+               hash = rt_hash(daddr, saddr, fl->iif);
                err = rt_intern_hash(hash, rth, &rtres);
                if (err)
                        return err;
@@ -1901,7 +1904,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
  *     2. IP spoofing attempts are filtered with 100% of guarantee.
  */
 
-static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
+static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                               u8 tos, struct net_device *dev)
 {
        struct fib_result res;
@@ -1920,7 +1923,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
        u32             itag = 0;
        struct rtable * rth;
        unsigned        hash;
-       u32             spec_dst;
+       __be32          spec_dst;
        int             err = -EINVAL;
        int             free_res = 0;
 
@@ -1936,7 +1939,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
        if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr))
                goto martian_source;
 
-       if (daddr == 0xFFFFFFFF || (saddr == 0 && daddr == 0))
+       if (daddr == htonl(0xFFFFFFFF) || (saddr == 0 && daddr == 0))
                goto brd_input;
 
        /* Accept zero addresses only to limited broadcast;
@@ -2048,7 +2051,7 @@ local_input:
                rth->rt_flags   &= ~RTCF_LOCAL;
        }
        rth->rt_type    = res.type;
-       hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5));
+       hash = rt_hash(daddr, saddr, fl.iif);
        err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
        goto done;
 
@@ -2087,7 +2090,7 @@ martian_source:
        goto e_inval;
 }
 
-int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
+int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                   u8 tos, struct net_device *dev)
 {
        struct rtable * rth;
@@ -2095,7 +2098,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
        int iif = dev->ifindex;
 
        tos &= IPTOS_RT_MASK;
-       hash = rt_hash_code(daddr, saddr ^ (iif << 5));
+       hash = rt_hash(daddr, saddr, iif);
 
        rcu_read_lock();
        for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
@@ -2169,7 +2172,7 @@ static inline int __mkroute_output(struct rtable **result,
        if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK))
                return -EINVAL;
 
-       if (fl->fl4_dst == 0xFFFFFFFF)
+       if (fl->fl4_dst == htonl(0xFFFFFFFF))
                res->type = RTN_BROADCAST;
        else if (MULTICAST(fl->fl4_dst))
                res->type = RTN_MULTICAST;
@@ -2293,8 +2296,7 @@ static inline int ip_mkroute_output_def(struct rtable **rp,
        int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags);
        unsigned hash;
        if (err == 0) {
-               hash = rt_hash_code(oldflp->fl4_dst, 
-                                   oldflp->fl4_src ^ (oldflp->oif << 5));
+               hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif);
                err = rt_intern_hash(hash, rth, rp);
        }
        
@@ -2336,9 +2338,8 @@ static inline int ip_mkroute_output(struct rtable** rp,
                        if (err != 0)
                                goto cleanup;
 
-                       hash = rt_hash_code(oldflp->fl4_dst, 
-                                           oldflp->fl4_src ^
-                                           (oldflp->oif << 5));
+                       hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src,
+                                       oldflp->oif);
                        err = rt_intern_hash(hash, rth, rp);
 
                        /* forward hop information to multipath impl. */
@@ -2417,7 +2418,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
                 */
 
                if (oldflp->oif == 0
-                   && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF)) {
+                   && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) {
                        /* Special hack: user can direct multicasts
                           and limited broadcast via necessary interface
                           without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
@@ -2454,7 +2455,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
                        goto out;       /* Wrong error code */
                }
 
-               if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF) {
+               if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF)) {
                        if (!fl.fl4_src)
                                fl.fl4_src = inet_select_addr(dev_out, 0,
                                                              RT_SCOPE_LINK);
@@ -2567,7 +2568,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
        unsigned hash;
        struct rtable *rth;
 
-       hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5));
+       hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif);
 
        rcu_read_lock_bh();
        for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
@@ -2660,11 +2661,11 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
        if (rt->rt_flags & RTCF_NOTIFY)
                r->rtm_flags |= RTM_F_NOTIFY;
 
-       NLA_PUT_U32(skb, RTA_DST, rt->rt_dst);
+       NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst);
 
        if (rt->fl.fl4_src) {
                r->rtm_src_len = 32;
-               NLA_PUT_U32(skb, RTA_SRC, rt->fl.fl4_src);
+               NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src);
        }
        if (rt->u.dst.dev)
                NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex);
@@ -2677,12 +2678,12 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg);
 #endif
        if (rt->fl.iif)
-               NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_spec_dst);
+               NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst);
        else if (rt->rt_src != rt->fl.fl4_src)
-               NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_src);
+               NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src);
 
        if (rt->rt_dst != rt->rt_gateway)
-               NLA_PUT_U32(skb, RTA_GATEWAY, rt->rt_gateway);
+               NLA_PUT_BE32(skb, RTA_GATEWAY, rt->rt_gateway);
 
        if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0)
                goto nla_put_failure;
@@ -2706,7 +2707,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
 
        if (rt->fl.iif) {
 #ifdef CONFIG_IP_MROUTE
-               u32 dst = rt->rt_dst;
+               __be32 dst = rt->rt_dst;
 
                if (MULTICAST(dst) && !LOCAL_MCAST(dst) &&
                    ipv4_devconf.mc_forwarding) {
@@ -2740,7 +2741,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
        struct rtmsg *rtm;
        struct nlattr *tb[RTA_MAX+1];
        struct rtable *rt = NULL;
-       u32 dst, src, iif;
+       __be32 dst = 0;
+       __be32 src = 0;
+       u32 iif;
        int err;
        struct sk_buff *skb;
 
@@ -2765,8 +2768,8 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
        skb->nh.iph->protocol = IPPROTO_ICMP;
        skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
 
-       src = tb[RTA_SRC] ? nla_get_u32(tb[RTA_SRC]) : 0;
-       dst = tb[RTA_DST] ? nla_get_u32(tb[RTA_DST]) : 0;
+       src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;
+       dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0;
        iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;
 
        if (iif) {
index b3def0df14fb81df0057ca9b5c61839f5e432601..3f884cea14ff439651b876ffce4f351289640681 100644 (file)
@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
        const struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
        unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked;
-       struct tcp_sack_block *sp = (struct tcp_sack_block *)(ptr+2);
+       struct tcp_sack_block_wire *sp = (struct tcp_sack_block_wire *)(ptr+2);
        int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3;
        int reord = tp->packets_out;
        int prior_fackets;
@@ -2239,13 +2239,12 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb,
        return acked;
 }
 
-static u32 tcp_usrtt(const struct sk_buff *skb)
+static u32 tcp_usrtt(struct timeval *tv)
 {
-       struct timeval tv, now;
+       struct timeval now;
 
        do_gettimeofday(&now);
-       skb_get_timestamp(skb, &tv);
-       return (now.tv_sec - tv.tv_sec) * 1000000 + (now.tv_usec - tv.tv_usec);
+       return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - tv->tv_usec);
 }
 
 /* Remove acknowledged frames from the retransmission queue. */
@@ -2260,6 +2259,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
        u32 pkts_acked = 0;
        void (*rtt_sample)(struct sock *sk, u32 usrtt)
                = icsk->icsk_ca_ops->rtt_sample;
+       struct timeval tv;
 
        while ((skb = skb_peek(&sk->sk_write_queue)) &&
               skb != sk->sk_send_head) {
@@ -2308,8 +2308,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
                                seq_rtt = -1;
                        } else if (seq_rtt < 0) {
                                seq_rtt = now - scb->when;
-                               if (rtt_sample)
-                                       (*rtt_sample)(sk, tcp_usrtt(skb));
+                               skb_get_timestamp(skb, &tv);
                        }
                        if (sacked & TCPCB_SACKED_ACKED)
                                tp->sacked_out -= tcp_skb_pcount(skb);
@@ -2322,8 +2321,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
                        }
                } else if (seq_rtt < 0) {
                        seq_rtt = now - scb->when;
-                       if (rtt_sample)
-                               (*rtt_sample)(sk, tcp_usrtt(skb));
+                       skb_get_timestamp(skb, &tv);
                }
                tcp_dec_pcount_approx(&tp->fackets_out, skb);
                tcp_packets_out_dec(tp, skb);
@@ -2335,6 +2333,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
        if (acked&FLAG_ACKED) {
                tcp_ack_update_rtt(sk, acked, seq_rtt);
                tcp_ack_packets_out(sk, tp);
+               if (rtt_sample && !(acked & FLAG_RETRANS_DATA_ACKED))
+                       (*rtt_sample)(sk, tcp_usrtt(&tv));
 
                if (icsk->icsk_ca_ops->pkts_acked)
                        icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked);
@@ -2629,7 +2629,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
                                switch(opcode) {
                                case TCPOPT_MSS:
                                        if(opsize==TCPOLEN_MSS && th->syn && !estab) {
-                                               u16 in_mss = ntohs(get_unaligned((__u16 *)ptr));
+                                               u16 in_mss = ntohs(get_unaligned((__be16 *)ptr));
                                                if (in_mss) {
                                                        if (opt_rx->user_mss && opt_rx->user_mss < in_mss)
                                                                in_mss = opt_rx->user_mss;
@@ -2657,8 +2657,8 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
                                                if ((estab && opt_rx->tstamp_ok) ||
                                                    (!estab && sysctl_tcp_timestamps)) {
                                                        opt_rx->saw_tstamp = 1;
-                                                       opt_rx->rcv_tsval = ntohl(get_unaligned((__u32 *)ptr));
-                                                       opt_rx->rcv_tsecr = ntohl(get_unaligned((__u32 *)(ptr+4)));
+                                                       opt_rx->rcv_tsval = ntohl(get_unaligned((__be32 *)ptr));
+                                                       opt_rx->rcv_tsecr = ntohl(get_unaligned((__be32 *)(ptr+4)));
                                                }
                                        }
                                        break;
@@ -2695,8 +2695,8 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
                return 0;
        } else if (tp->rx_opt.tstamp_ok &&
                   th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) {
-               __u32 *ptr = (__u32 *)(th + 1);
-               if (*ptr == ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
+               __be32 *ptr = (__be32 *)(th + 1);
+               if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
                                  | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
                        tp->rx_opt.saw_tstamp = 1;
                        ++ptr;
@@ -3911,10 +3911,10 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 
                /* Check timestamp */
                if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) {
-                       __u32 *ptr = (__u32 *)(th + 1);
+                       __be32 *ptr = (__be32 *)(th + 1);
 
                        /* No? Slow path! */
-                       if (*ptr != ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
+                       if (*ptr != htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
                                          | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP))
                                goto slow_path;
 
index 39b1798560824e3ba85dfae375a0a22ca37f135b..c83938b8fcb1201ddf403c6423cd83790397595b 100644 (file)
@@ -159,7 +159,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        struct tcp_sock *tp = tcp_sk(sk);
        struct sockaddr_in *usin = (struct sockaddr_in *)uaddr;
        struct rtable *rt;
-       u32 daddr, nexthop;
+       __be32 daddr, nexthop;
        int tmp;
        int err;
 
@@ -734,8 +734,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
        struct inet_request_sock *ireq;
        struct tcp_options_received tmp_opt;
        struct request_sock *req;
-       __u32 saddr = skb->nh.iph->saddr;
-       __u32 daddr = skb->nh.iph->daddr;
+       __be32 saddr = skb->nh.iph->saddr;
+       __be32 daddr = skb->nh.iph->daddr;
        __u32 isn = TCP_SKB_CB(skb)->when;
        struct dst_entry *dst = NULL;
 #ifdef CONFIG_SYN_COOKIES
@@ -1763,7 +1763,7 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i)
 
 static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i)
 {
-       unsigned int dest, src;
+       __be32 dest, src;
        __u16 destp, srcp;
        int ttd = tw->tw_ttd - jiffies;
 
index 308fb7e071c56faaebbf742e6fc07cc0ecbabdc8..f0ebaf0e21cbf7276119f8c3886e0d2c1971e139 100644 (file)
@@ -31,8 +31,6 @@
  *   Hung Hing Lun, Mike <hlhung3i@gmail.com>
  * SourceForge project page:
  *   http://tcp-lp-mod.sourceforge.net/
- *
- * Version: $Id: tcp_lp.c,v 1.24 2006/09/05 20:22:53 hswong3i Exp $
  */
 
 #include <linux/module.h>
@@ -164,7 +162,7 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk)
 
  out:
        /* record time for successful remote HZ calc */
-       if (rhz > 0)
+       if ((rhz >> 6) > 0)
                lp->flag |= LP_VALID_RHZ;
        else
                lp->flag &= ~LP_VALID_RHZ;
index 061edfae0c29df44ada4e1aec6d055a21eaf7f38..9a253faefc81c9c2f95d82e9cbb7878d677b25a1 100644 (file)
@@ -269,7 +269,7 @@ static u16 tcp_select_window(struct sock *sk)
        return new_win;
 }
 
-static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp,
+static void tcp_build_and_update_options(__be32 *ptr, struct tcp_sock *tp,
                                         __u32 tstamp)
 {
        if (tp->rx_opt.tstamp_ok) {
@@ -305,7 +305,7 @@ static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp,
  * MAX_SYN_SIZE to match the new maximum number of options that you
  * can generate.
  */
-static void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack,
+static void tcp_syn_build_options(__be32 *ptr, int mss, int ts, int sack,
                                  int offer_wscale, int wscale, __u32 tstamp,
                                  __u32 ts_recent)
 {
@@ -424,7 +424,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        th->dest                = inet->dport;
        th->seq                 = htonl(tcb->seq);
        th->ack_seq             = htonl(tp->rcv_nxt);
-       *(((__u16 *)th) + 6)    = htons(((tcp_header_size >> 2) << 12) |
+       *(((__be16 *)th) + 6)   = htons(((tcp_header_size >> 2) << 12) |
                                        tcb->flags);
 
        if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) {
@@ -445,7 +445,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        }
 
        if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) {
-               tcp_syn_build_options((__u32 *)(th + 1),
+               tcp_syn_build_options((__be32 *)(th + 1),
                                      tcp_advertise_mss(sk),
                                      (sysctl_flags & SYSCTL_FLAG_TSTAMPS),
                                      (sysctl_flags & SYSCTL_FLAG_SACK),
@@ -454,7 +454,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
                                      tcb->when,
                                      tp->rx_opt.ts_recent);
        } else {
-               tcp_build_and_update_options((__u32 *)(th + 1),
+               tcp_build_and_update_options((__be32 *)(th + 1),
                                             tp, tcb->when);
                TCP_ECN_send(sk, tp, skb, tcp_header_size);
        }
@@ -2070,7 +2070,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
        th->window = htons(req->rcv_wnd);
 
        TCP_SKB_CB(skb)->when = tcp_time_stamp;
-       tcp_syn_build_options((__u32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok,
+       tcp_syn_build_options((__be32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok,
                              ireq->sack_ok, ireq->wscale_ok, ireq->rcv_wscale,
                              TCP_SKB_CB(skb)->when,
                              req->ts_recent);
index 77e265d7bb8f8a7a795e552aef4214570a40a7da..6d6142f9c478baa8c85dcf1d174a5a88f66d783a 100644 (file)
@@ -243,8 +243,8 @@ static void udp_v4_unhash(struct sock *sk)
 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
  * harder than this. -DaveM
  */
-static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport,
-                                         u32 daddr, u16 dport, int dif)
+static struct sock *udp_v4_lookup_longway(__be32 saddr, __be16 sport,
+                                         __be32 daddr, __be16 dport, int dif)
 {
        struct sock *sk, *result = NULL;
        struct hlist_node *node;
@@ -288,8 +288,8 @@ static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport,
        return result;
 }
 
-static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport,
-                                            u32 daddr, u16 dport, int dif)
+static __inline__ struct sock *udp_v4_lookup(__be32 saddr, __be16 sport,
+                                            __be32 daddr, __be16 dport, int dif)
 {
        struct sock *sk;
 
@@ -302,8 +302,8 @@ static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport,
 }
 
 static inline struct sock *udp_v4_mcast_next(struct sock *sk,
-                                            u16 loc_port, u32 loc_addr,
-                                            u16 rmt_port, u32 rmt_addr,
+                                            __be16 loc_port, __be32 loc_addr,
+                                            __be16 rmt_port, __be32 rmt_addr,
                                             int dif)
 {
        struct hlist_node *node;
@@ -498,7 +498,7 @@ out:
 }
 
 
-static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr, unsigned long daddr, unsigned long base)
+static unsigned short udp_check(struct udphdr *uh, int len, __be32 saddr, __be32 daddr, unsigned long base)
 {
        return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base));
 }
@@ -513,8 +513,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        struct rtable *rt = NULL;
        int free = 0;
        int connected = 0;
-       u32 daddr, faddr, saddr;
-       u16 dport;
+       __be32 daddr, faddr, saddr;
+       __be16 dport;
        u8  tos;
        int err;
        int corkreq = up->corkflag || msg->msg_flags&MSG_MORE;
@@ -931,7 +931,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
        int iphlen, len;
   
        __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr);
-       __u32 *udpdata32 = (__u32 *)udpdata;
+       __be32 *udpdata32 = (__be32 *)udpdata;
        __u16 encap_type = up->encap_type;
 
        /* if we're overly short, let UDP handle it */
@@ -1080,7 +1080,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
  *     so we don't need to lock the hashes.
  */
 static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh,
-                                u32 saddr, u32 daddr)
+                                __be32 saddr, __be32 daddr)
 {
        struct sock *sk;
        int dif;
@@ -1121,7 +1121,7 @@ static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh,
  * including udp header and folding it to skb->csum.
  */
 static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh,
-                            unsigned short ulen, u32 saddr, u32 daddr)
+                            unsigned short ulen, __be32 saddr, __be32 daddr)
 {
        if (uh->check == 0) {
                skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1146,8 +1146,8 @@ int udp_rcv(struct sk_buff *skb)
        struct udphdr *uh;
        unsigned short ulen;
        struct rtable *rt = (struct rtable*)skb->dst;
-       u32 saddr = skb->nh.iph->saddr;
-       u32 daddr = skb->nh.iph->daddr;
+       __be32 saddr = skb->nh.iph->saddr;
+       __be32 daddr = skb->nh.iph->daddr;
        int len = skb->len;
 
        /*
@@ -1563,8 +1563,8 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo)
 static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket)
 {
        struct inet_sock *inet = inet_sk(sp);
-       unsigned int dest = inet->daddr;
-       unsigned int src  = inet->rcv_saddr;
+       __be32 dest = inet->daddr;
+       __be32 src  = inet->rcv_saddr;
        __u16 destp       = ntohs(inet->dport);
        __u16 srcp        = ntohs(inet->sport);
 
index 040e8475f295c1cefcb3350099f57feb08308d56..8655d038364cba364880f8cb9595e94708fe14db 100644 (file)
@@ -23,7 +23,7 @@ int xfrm4_rcv(struct sk_buff *skb)
 
 EXPORT_SYMBOL(xfrm4_rcv);
 
-static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
+static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
 {
        switch (nexthdr) {
        case IPPROTO_IPIP:
@@ -55,7 +55,7 @@ drop:
 int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
 {
        int err;
-       u32 spi, seq;
+       __be32 spi, seq;
        struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
        struct xfrm_state *x;
        int xfrm_nr = 0;
index eabcd27b176730d83e42ce599e28c7a7e3407e0f..7a7a00147e55c7d63758d2d3bad84884d3b1a4c6 100644 (file)
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
 
                case IPPROTO_ESP:
                        if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
-                               u32 *ehdr = (u32 *)xprth;
+                               __be32 *ehdr = (__be32 *)xprth;
 
                                fl->fl_ipsec_spi = ehdr[0];
                        }
@@ -229,7 +229,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
 
                case IPPROTO_AH:
                        if (pskb_may_pull(skb, xprth + 8 - skb->data)) {
-                               u32 *ah_hdr = (u32*)xprth;
+                               __be32 *ah_hdr = (__be32*)xprth;
 
                                fl->fl_ipsec_spi = ah_hdr[1];
                        }
@@ -237,7 +237,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
 
                case IPPROTO_COMP:
                        if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
-                               u16 *ipcomp_hdr = (u16 *)xprth;
+                               __be16 *ipcomp_hdr = (__be16 *)xprth;
 
                                fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
                        }
index fe2034494d0854e7f22d9e40147c4dc16b76bdc4..3cc3df0c6ece97420f79c2a84efca31e1b8cbcd1 100644 (file)
@@ -29,9 +29,9 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
        x->sel.daddr.a4 = fl->fl4_dst;
        x->sel.saddr.a4 = fl->fl4_src;
        x->sel.dport = xfrm_flowi_dport(fl);
-       x->sel.dport_mask = ~0;
+       x->sel.dport_mask = htons(0xffff);
        x->sel.sport = xfrm_flowi_sport(fl);
-       x->sel.sport_mask = ~0;
+       x->sel.sport_mask = htons(0xffff);
        x->sel.prefixlen_d = 32;
        x->sel.prefixlen_s = 32;
        x->sel.proto = fl->proto;
index c18676352397cc11a7adc0961262117681b79ab8..e03c33b2465bc72415c8e27dce382db233959a69 100644 (file)
@@ -1258,8 +1258,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
 {
        const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
        const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
-       u32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr;
-       u32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
+       __be32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr;
+       __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
        int sk_ipv6only = ipv6_only_sock(sk);
        int sk2_ipv6only = inet_v6_ipv6only(sk2);
        int addr_type = ipv6_addr_type(sk_rcv_saddr6);
index bf6e8aff19d4f2fa62a5e18641548bd0a4e2a60b..e94eccb99707991c80409ebce8a157e1beaba3e7 100644 (file)
@@ -246,7 +246,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
        struct sock *sk = sock->sk;
        struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
-       __u32 v4addr = 0;
+       __be32 v4addr = 0;
        unsigned short snum;
        int addr_type = 0;
        int err = 0;
index d2f3fc990bfaa2a535bf4cbf2f6a4590b66abb71..8accd1fbeeda96d9201d7cbd1f71cd85344c8b51 100644 (file)
@@ -64,7 +64,7 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
 {
        struct sock *sk;
        const struct hlist_node *node;
-       const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
+       const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
        /* Optimize here for direct hit, only listening connections can
         * have wildcards anyways.
         */
@@ -82,7 +82,7 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
        sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
                const struct inet_timewait_sock *tw = inet_twsk(sk);
 
-               if(*((__u32 *)&(tw->tw_dport))  == ports        &&
+               if(*((__portpair *)&(tw->tw_dport))     == ports        &&
                   sk->sk_family                == PF_INET6) {
                        const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
 
@@ -171,7 +171,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
        const struct in6_addr *daddr = &np->rcv_saddr;
        const struct in6_addr *saddr = &np->daddr;
        const int dif = sk->sk_bound_dev_if;
-       const u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
+       const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport);
        const unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr,
                                                inet->dport);
        struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
@@ -188,7 +188,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
 
                tw = inet_twsk(sk2);
 
-               if(*((__u32 *)&(tw->tw_dport)) == ports          &&
+               if(*((__portpair *)&(tw->tw_dport)) == ports             &&
                   sk2->sk_family              == PF_INET6       &&
                   ipv6_addr_equal(&tw6->tw_v6_daddr, saddr)     &&
                   ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
index ad9c6e824e629e02c8c37a4e17c94ea5dab50b35..a2860e35efd7d68ee67d3839e4b064aa6f3a574e 100644 (file)
@@ -178,7 +178,7 @@ out_ok:
 static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                                int type, int code, int offset, __u32 info)
 {
-       u32 spi;
+       __be32 spi;
        struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
        struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset);
        struct xfrm_state *x;
@@ -234,7 +234,7 @@ static int ipcomp6_tunnel_attach(struct xfrm_state *x)
 {
        int err = 0;
        struct xfrm_state *t = NULL;
-       u32 spi;
+       __be32 spi;
 
        spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&x->props.saddr);
        if (spi)
index 4f3bb7fcc8b509ac71615e7a8c0f543d95349854..de6b91981b30611b0cd63ea8d14a304b34387c27 100644 (file)
@@ -123,6 +123,9 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
        struct ipv6hdr *ipv6h;
        struct inet6_protocol *ops;
 
+       if (!(features & NETIF_F_HW_CSUM))
+               features &= ~NETIF_F_SG;
+
        if (unlikely(skb_shinfo(skb)->gso_type &
                     ~(SKB_GSO_UDP |
                       SKB_GSO_DODGY |
index 2546fc9f0a78b14559fc380b365665ad02afaed6..3b6575478fcc381aae64ee2c0d7b2b791d5f1846 100644 (file)
@@ -1237,7 +1237,7 @@ process:
 
        skb->dev = NULL;
 
-       bh_lock_sock(sk);
+       bh_lock_sock_nested(sk);
        ret = 0;
        if (!sock_owned_by_user(sk)) {
 #ifdef CONFIG_NET_DMA
index a40a057890133b13fec3d16fa66d80021f174c96..5c8b7a5688003dcf7c21ca0923be689b42d7cd40 100644 (file)
 #include <net/ipv6.h>
 #include <net/xfrm.h>
 
-int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
+int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
 {
        int err;
-       u32 seq;
+       __be32 seq;
        struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
        struct xfrm_state *x;
        int xfrm_nr = 0;
index 711bfafb2472dfd5fda8dc04c19a7f536355e64c..9ddaa9d41539fe23ec7df3d5cc9059749348e4ec 100644 (file)
@@ -29,9 +29,9 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
        ipv6_addr_copy((struct in6_addr *)&x->sel.daddr, &fl->fl6_dst);
        ipv6_addr_copy((struct in6_addr *)&x->sel.saddr, &fl->fl6_src);
        x->sel.dport = xfrm_flowi_dport(fl);
-       x->sel.dport_mask = ~0;
+       x->sel.dport_mask = htons(0xffff);
        x->sel.sport = xfrm_flowi_sport(fl);
-       x->sel.sport_mask = ~0;
+       x->sel.sport_mask = htons(0xffff);
        x->sel.prefixlen_d = 128;
        x->sel.prefixlen_s = 128;
        x->sel.proto = fl->proto;
index 59685ee8f700d9690180560180320064912ceda8..7af227bb1551477730b13097e3490241bebc154b 100644 (file)
@@ -258,7 +258,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 static int xfrm6_tunnel_rcv(struct sk_buff *skb)
 {
        struct ipv6hdr *iph = skb->nh.ipv6h;
-       u32 spi;
+       __be32 spi;
 
        spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
        return xfrm6_rcv_spi(skb, spi);
index 17699eeb64d78274481bca74888dfc41313fb548..7e1aea89ef05b60709fcb37e1f5ec531303f0359 100644 (file)
@@ -132,13 +132,14 @@ static void irda_disconnect_indication(void *instance, void *sap,
 
        /* Prevent race conditions with irda_release() and irda_shutdown() */
        if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) {
+               lock_sock(sk);
                sk->sk_state     = TCP_CLOSE;
                sk->sk_err       = ECONNRESET;
                sk->sk_shutdown |= SEND_SHUTDOWN;
 
                sk->sk_state_change(sk);
-               /* Uh-oh... Should use sock_orphan ? */
-                sock_set_flag(sk, SOCK_DEAD);
+                sock_orphan(sk);
+               release_sock(sk);
 
                /* Close our TSAP.
                 * If we leave it open, IrLMP put it back into the list of
@@ -308,7 +309,8 @@ static void irda_connect_response(struct irda_sock *self)
 
        IRDA_ASSERT(self != NULL, return;);
 
-       skb = alloc_skb(64, GFP_ATOMIC);
+       skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+                       GFP_ATOMIC);
        if (skb == NULL) {
                IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n",
                           __FUNCTION__);
@@ -1212,6 +1214,7 @@ static int irda_release(struct socket *sock)
         if (sk == NULL)
                return 0;
 
+       lock_sock(sk);
        sk->sk_state       = TCP_CLOSE;
        sk->sk_shutdown   |= SEND_SHUTDOWN;
        sk->sk_state_change(sk);
@@ -1221,6 +1224,7 @@ static int irda_release(struct socket *sock)
 
        sock_orphan(sk);
        sock->sk   = NULL;
+       release_sock(sk);
 
        /* Purge queues (see sock_init_data()) */
        skb_queue_purge(&sk->sk_receive_queue);
@@ -1353,6 +1357,7 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
        IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
 
        IRDA_ASSERT(self != NULL, return -1;);
+       IRDA_ASSERT(!sock_error(sk), return -1;);
 
        skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
                                flags & MSG_DONTWAIT, &err);
@@ -1405,6 +1410,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock,
        IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
 
        IRDA_ASSERT(self != NULL, return -1;);
+       IRDA_ASSERT(!sock_error(sk), return -1;);
 
        if (sock->flags & __SO_ACCEPTCON)
                return(-EINVAL);
index 959874b6451f00cf9edf4ad23343a1cd07e73b5b..c8e0d89ee11fd3e9443767fd875d05372453bcc5 100644 (file)
@@ -81,7 +81,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
        
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -115,7 +115,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
        IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
 
         if (!userdata) {
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
                
index 61128aa05b4015c9fb85027bd1cc870b34a9beec..415cf4eec23b8e86ac69597dd0ffae6e3f953f44 100644 (file)
@@ -345,10 +345,11 @@ static void iriap_disconnect_request(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
        if (tx_skb == NULL) {
-               IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 
-                       __FUNCTION__, 64);
+               IRDA_DEBUG(0,
+                          "%s(), Could not allocate an sk_buff of length %d\n",
+                          __FUNCTION__, LMP_MAX_HEADER);
                return;
        }
 
@@ -701,7 +702,7 @@ void iriap_send_ack(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(LMP_MAX_HEADER + 1, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
index da17395df05adab0dab896b9e64f59ff1d4f62ab..99b18dc7a0b7e3b26f8fcd52d7c30bebee14d69d 100644 (file)
@@ -365,7 +365,7 @@ static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
 
        switch (event) {
        case IAP_LM_CONNECT_INDICATION:
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
                if (tx_skb == NULL) {
                        IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__);
                        return;
index 7dd0a2fe1d20dfac9a51b60fc4724c64e8c38b84..9b962f247714f5ec71c02f4b1e9822cd1531955e 100644 (file)
@@ -636,7 +636,8 @@ void irlan_get_provider_info(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = alloc_skb(64, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER,
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -668,7 +669,10 @@ void irlan_open_data_channel(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = alloc_skb(64, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") +
+                       IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -704,7 +708,9 @@ void irlan_close_data_channel(struct irlan_cb *self)
        if (self->client.tsap_ctrl == NULL)
                return;
 
-       skb = alloc_skb(64, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -715,7 +721,7 @@ void irlan_close_data_channel(struct irlan_cb *self)
        
        /* Build frame */
        frame[0] = CMD_CLOSE_DATA_CHAN;
-       frame[1] = 0x01; /* Two parameters */
+       frame[1] = 0x01; /* One parameter */
 
        irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
 
@@ -739,7 +745,11 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);       
        
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -777,7 +787,12 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") +
+                       /* We may waste one byte here...*/
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -816,7 +831,12 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
+                       /* We may waste one byte here...*/
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "NONE"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
        
@@ -856,7 +876,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_OPERATION",
+                                                  "DYNAMIC"),
+                       GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -891,7 +916,10 @@ void irlan_get_media_char(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = alloc_skb(64, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"),
+                       GFP_ATOMIC);
+
        if (!skb)
                return;
 
index 9c0df86044d7d4aaeabe71c0be10667dda723a10..58efde919667fb1a18c7ee0436aa53c6c1185f09 100644 (file)
@@ -296,7 +296,14 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+                       /* Bigger param length comes from CMD_GET_MEDIA_CHAR */
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BORADCAST") +
+                       IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
+                       IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "HOSTED"),
+                       GFP_ATOMIC);
+
        if (!skb)
                return;
 
@@ -354,8 +361,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
                } else
                        skb->data[1] = 0x02; /* 2 parameters */
                irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data);
-               irlan_insert_array_param(skb, "RECONNECT_KEY", "LINUX RULES!",
-                                        12);
+               irlan_insert_string_param(skb, "RECONNECT_KEY", "LINUX RULES!");
                break;
        case CMD_FILTER_OPERATION:
                irlan_filter_request(self, skb);
index ccb983bf0f4a222a8f848a0a8162b327c5d01d8e..dba349c832d02454b8451bbd02aa1935e23d9e15 100644 (file)
@@ -117,7 +117,9 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
        /* Allocate frame */
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct snrm_frame) +
+                          IRLAP_NEGOCIATION_PARAMS_LEN,
+                          GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -136,7 +138,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
         *  If we are establishing a connection then insert QoS paramerters
         */
        if (qos) {
-               skb_put(tx_skb, 9); /* 21 left */
+               skb_put(tx_skb, 9); /* 25 left */
                frame->saddr = cpu_to_le32(self->saddr);
                frame->daddr = cpu_to_le32(self->daddr);
 
@@ -210,7 +212,9 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
        /* Allocate frame */
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct ua_frame) +
+                          IRLAP_NEGOCIATION_PARAMS_LEN,
+                          GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -245,23 +249,23 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
 void irlap_send_dm_frame( struct irlap_cb *self)
 {
        struct sk_buff *tx_skb = NULL;
-       __u8 *frame;
+       struct dm_frame *frame;
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
-       tx_skb = alloc_skb(32, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct dm_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
-       frame = skb_put(tx_skb, 2);
+       frame = (struct dm_frame *)skb_put(tx_skb, 2);
 
        if (self->state == LAP_NDM)
-               frame[0] = CBROADCAST;
+               frame->caddr = CBROADCAST;
        else
-               frame[0] = self->caddr;
+               frame->caddr = self->caddr;
 
-       frame[1] = DM_RSP | PF_BIT;
+       frame->control = DM_RSP | PF_BIT;
 
        irlap_queue_xmit(self, tx_skb);
 }
@@ -275,21 +279,21 @@ void irlap_send_dm_frame( struct irlap_cb *self)
 void irlap_send_disc_frame(struct irlap_cb *self)
 {
        struct sk_buff *tx_skb = NULL;
-       __u8 *frame;
+       struct disc_frame *frame;
 
        IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
-       tx_skb = alloc_skb(16, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct disc_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
-       frame = skb_put(tx_skb, 2);
+       frame = (struct disc_frame *)skb_put(tx_skb, 2);
 
-       frame[0] = self->caddr | CMD_FRAME;
-       frame[1] = DISC_CMD | PF_BIT;
+       frame->caddr = self->caddr | CMD_FRAME;
+       frame->control = DISC_CMD | PF_BIT;
 
        irlap_queue_xmit(self, tx_skb);
 }
@@ -315,7 +319,8 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
        IRDA_ASSERT(discovery != NULL, return;);
 
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct xid_frame) + IRLAP_DISCOVERY_INFO_LEN,
+                          GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -573,18 +578,18 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
 void irlap_send_rr_frame(struct irlap_cb *self, int command)
 {
        struct sk_buff *tx_skb;
-       __u8 *frame;
+       struct rr_frame *frame;
 
-       tx_skb = alloc_skb(16, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct rr_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
-       frame = skb_put(tx_skb, 2);
+       frame = (struct rr_frame *)skb_put(tx_skb, 2);
 
-       frame[0] = self->caddr;
-       frame[0] |= (command) ? CMD_FRAME : 0;
+       frame->caddr = self->caddr;
+       frame->caddr |= (command) ? CMD_FRAME : 0;
 
-       frame[1] = RR | PF_BIT | (self->vr << 5);
+       frame->control = RR | PF_BIT | (self->vr << 5);
 
        irlap_queue_xmit(self, tx_skb);
 }
@@ -598,16 +603,16 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command)
 void irlap_send_rd_frame(struct irlap_cb *self)
 {
        struct sk_buff *tx_skb;
-       __u8 *frame;
+       struct rd_frame *frame;
 
-       tx_skb = alloc_skb(16, GFP_ATOMIC);
+       tx_skb = alloc_skb(sizeof(struct rd_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
-       frame = skb_put(tx_skb, 2);
+       frame = (struct rd_frame *)skb_put(tx_skb, 2);
 
-       frame[0] = self->caddr;
-       frame[1] = RD_RSP | PF_BIT;
+       frame->caddr = self->caddr;
+       frame->caddr = RD_RSP | PF_BIT;
 
        irlap_queue_xmit(self, tx_skb);
 }
@@ -1214,7 +1219,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
        struct test_frame *frame;
        __u8 *info;
 
-       tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC);
+       tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
index c440913dee1468358e76cdef1fef6eeaad3d22a5..5073261b9d0c875d7884cf280866f6b324bb36ba 100644 (file)
@@ -392,7 +392,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
 
        /* Any userdata? */
        if (tx_skb == NULL) {
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
index 42acf1cde737d4e0b992df9a6d469311385db410..3c2e70b77df16375952f1c0bc889f298a588e8a9 100644 (file)
@@ -804,12 +804,12 @@ static inline void irttp_give_credit(struct tsap_cb *self)
                   self->send_credit, self->avail_credit, self->remote_credit);
 
        /* Give credit to peer */
-       tx_skb = alloc_skb(64, GFP_ATOMIC);
+       tx_skb = alloc_skb(TTP_MAX_HEADER, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
        /* Reserve space for LMP, and LAP header */
-       skb_reserve(tx_skb, self->max_header_size);
+       skb_reserve(tx_skb, LMP_MAX_HEADER);
 
        /*
         *  Since we can transmit and receive frames concurrently,
@@ -1093,7 +1093,8 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
 
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+                                  GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -1341,7 +1342,8 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
 
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+                                  GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -1540,14 +1542,14 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
 
        if (!userdata) {
                struct sk_buff *tx_skb;
-               tx_skb = alloc_skb(64, GFP_ATOMIC);
+               tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
                /*
                 *  Reserve space for MUX and LAP header
                 */
-               skb_reserve(tx_skb, TTP_MAX_HEADER);
+               skb_reserve(tx_skb, LMP_MAX_HEADER);
 
                userdata = tx_skb;
        }
index 83b443ddc72f57c044e7f00f961f7e41d83fc148..ff98e70b0931f8e74cfc14c3d9b9337b50c12e41 100644 (file)
@@ -2140,7 +2140,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
        xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
        xp->selector.sport = ((struct sockaddr_in *)(sa+1))->sin_port;
        if (xp->selector.sport)
-               xp->selector.sport_mask = ~0;
+               xp->selector.sport_mask = htons(0xffff);
 
        sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], 
        pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr);
@@ -2153,7 +2153,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
 
        xp->selector.dport = ((struct sockaddr_in *)(sa+1))->sin_port;
        if (xp->selector.dport)
-               xp->selector.dport_mask = ~0;
+               xp->selector.dport_mask = htons(0xffff);
 
        sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1];
        if (sec_ctx != NULL) {
@@ -2243,7 +2243,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
        sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
        sel.sport = ((struct sockaddr_in *)(sa+1))->sin_port;
        if (sel.sport)
-               sel.sport_mask = ~0;
+               sel.sport_mask = htons(0xffff);
 
        sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], 
        pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr);
@@ -2251,7 +2251,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
        sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
        sel.dport = ((struct sockaddr_in *)(sa+1))->sin_port;
        if (sel.dport)
-               sel.dport_mask = ~0;
+               sel.dport_mask = htons(0xffff);
 
        sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1];
        memset(&tmp, 0, sizeof(struct xfrm_policy));
index 4125a55f469f197051963a3f0c3e1f8057084c95..09986ca962a6d6d086733ee8ccf09daade35eb64 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/socket.h>
 #include <linux/string.h>
 #include <linux/skbuff.h>
+#include <linux/audit.h>
 #include <net/sock.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
@@ -162,8 +163,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info)
        int nla_a_rem;
        int nla_b_rem;
 
-       if (!info->attrs[NLBL_CIPSOV4_A_DOI] ||
-           !info->attrs[NLBL_CIPSOV4_A_TAGLST] ||
+       if (!info->attrs[NLBL_CIPSOV4_A_TAGLST] ||
            !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST])
                return -EINVAL;
 
@@ -344,8 +344,7 @@ static int netlbl_cipsov4_add_pass(struct genl_info *info)
        int ret_val;
        struct cipso_v4_doi *doi_def = NULL;
 
-       if (!info->attrs[NLBL_CIPSOV4_A_DOI] ||
-           !info->attrs[NLBL_CIPSOV4_A_TAGLST])
+       if (!info->attrs[NLBL_CIPSOV4_A_TAGLST])
                return -EINVAL;
 
        doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL);
@@ -381,21 +380,35 @@ static int netlbl_cipsov4_add(struct sk_buff *skb, struct genl_info *info)
 
 {
        int ret_val = -EINVAL;
-       u32 map_type;
+       u32 type;
+       u32 doi;
+       const char *type_str = "(unknown)";
+       struct audit_buffer *audit_buf;
 
-       if (!info->attrs[NLBL_CIPSOV4_A_MTYPE])
+       if (!info->attrs[NLBL_CIPSOV4_A_DOI] ||
+           !info->attrs[NLBL_CIPSOV4_A_MTYPE])
                return -EINVAL;
 
-       map_type = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_MTYPE]);
-       switch (map_type) {
+       type = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_MTYPE]);
+       switch (type) {
        case CIPSO_V4_MAP_STD:
+               type_str = "std";
                ret_val = netlbl_cipsov4_add_std(info);
                break;
        case CIPSO_V4_MAP_PASS:
+               type_str = "pass";
                ret_val = netlbl_cipsov4_add_pass(info);
                break;
        }
 
+       if (ret_val == 0) {
+               doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
+               audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_ADD,
+                                                     NETLINK_CB(skb).sid);
+               audit_log_format(audit_buf, " doi=%u type=%s", doi, type_str);
+               audit_log_end(audit_buf);
+       }
+
        return ret_val;
 }
 
@@ -653,11 +666,21 @@ static int netlbl_cipsov4_listall(struct sk_buff *skb,
 static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info)
 {
        int ret_val = -EINVAL;
-       u32 doi;
+       u32 doi = 0;
+       struct audit_buffer *audit_buf;
 
        if (info->attrs[NLBL_CIPSOV4_A_DOI]) {
                doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
-               ret_val = cipso_v4_doi_remove(doi, netlbl_cipsov4_doi_free);
+               ret_val = cipso_v4_doi_remove(doi,
+                                             NETLINK_CB(skb).sid,
+                                             netlbl_cipsov4_doi_free);
+       }
+
+       if (ret_val == 0) {
+               audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_DEL,
+                                                     NETLINK_CB(skb).sid);
+               audit_log_format(audit_buf, " doi=%u", doi);
+               audit_log_end(audit_buf);
        }
 
        return ret_val;
index f56d7a8ac7b758dacd86f83442569263b2df9253..d64e2ae3b12998529a034556085e9aa35753d4d2 100644 (file)
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
+#include <linux/audit.h>
 #include <net/netlabel.h>
 #include <net/cipso_ipv4.h>
 #include <asm/bug.h>
 
 #include "netlabel_mgmt.h"
 #include "netlabel_domainhash.h"
+#include "netlabel_user.h"
 
 struct netlbl_domhsh_tbl {
        struct list_head *tbl;
@@ -186,6 +188,7 @@ int netlbl_domhsh_init(u32 size)
 /**
  * netlbl_domhsh_add - Adds a entry to the domain hash table
  * @entry: the entry to add
+ * @audit_secid: the LSM secid to use in the audit message
  *
  * Description:
  * Adds a new entry to the domain hash table and handles any updates to the
@@ -193,10 +196,12 @@ int netlbl_domhsh_init(u32 size)
  * negative on failure.
  *
  */
-int netlbl_domhsh_add(struct netlbl_dom_map *entry)
+int netlbl_domhsh_add(struct netlbl_dom_map *entry, u32 audit_secid)
 {
        int ret_val;
        u32 bkt;
+       struct audit_buffer *audit_buf;
+       char *audit_domain;
 
        switch (entry->type) {
        case NETLBL_NLTYPE_UNLABELED:
@@ -236,6 +241,26 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry)
                spin_unlock(&netlbl_domhsh_def_lock);
        } else
                ret_val = -EINVAL;
+       if (ret_val == 0) {
+               if (entry->domain != NULL)
+                       audit_domain = entry->domain;
+               else
+                       audit_domain = "(default)";
+               audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_ADD,
+                                                     audit_secid);
+               audit_log_format(audit_buf, " domain=%s", audit_domain);
+               switch (entry->type) {
+               case NETLBL_NLTYPE_UNLABELED:
+                       audit_log_format(audit_buf, " protocol=unlbl");
+                       break;
+               case NETLBL_NLTYPE_CIPSOV4:
+                       audit_log_format(audit_buf,
+                                        " protocol=cipsov4 doi=%u",
+                                        entry->type_def.cipsov4->doi);
+                       break;
+               }
+               audit_log_end(audit_buf);
+       }
        rcu_read_unlock();
 
        if (ret_val != 0) {
@@ -254,6 +279,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry)
 /**
  * netlbl_domhsh_add_default - Adds the default entry to the domain hash table
  * @entry: the entry to add
+ * @audit_secid: the LSM secid to use in the audit message
  *
  * Description:
  * Adds a new default entry to the domain hash table and handles any updates
@@ -261,14 +287,15 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry)
  * negative on failure.
  *
  */
-int netlbl_domhsh_add_default(struct netlbl_dom_map *entry)
+int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, u32 audit_secid)
 {
-       return netlbl_domhsh_add(entry);
+       return netlbl_domhsh_add(entry, audit_secid);
 }
 
 /**
  * netlbl_domhsh_remove - Removes an entry from the domain hash table
  * @domain: the domain to remove
+ * @audit_secid: the LSM secid to use in the audit message
  *
  * Description:
  * Removes an entry from the domain hash table and handles any updates to the
@@ -276,10 +303,12 @@ int netlbl_domhsh_add_default(struct netlbl_dom_map *entry)
  * negative on failure.
  *
  */
-int netlbl_domhsh_remove(const char *domain)
+int netlbl_domhsh_remove(const char *domain, u32 audit_secid)
 {
        int ret_val = -ENOENT;
        struct netlbl_dom_map *entry;
+       struct audit_buffer *audit_buf;
+       char *audit_domain;
 
        rcu_read_lock();
        if (domain != NULL)
@@ -316,8 +345,18 @@ int netlbl_domhsh_remove(const char *domain)
                        ret_val = -ENOENT;
                spin_unlock(&netlbl_domhsh_def_lock);
        }
-       if (ret_val == 0)
+       if (ret_val == 0) {
+               if (entry->domain != NULL)
+                       audit_domain = entry->domain;
+               else
+                       audit_domain = "(default)";
+               audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL,
+                                                     audit_secid);
+               audit_log_format(audit_buf, " domain=%s", audit_domain);
+               audit_log_end(audit_buf);
+
                call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
+       }
 
 remove_return:
        rcu_read_unlock();
@@ -326,6 +365,7 @@ remove_return:
 
 /**
  * netlbl_domhsh_remove_default - Removes the default entry from the table
+ * @audit_secid: the LSM secid to use in the audit message
  *
  * Description:
  * Removes/resets the default entry for the domain hash table and handles any
@@ -333,9 +373,9 @@ remove_return:
  * success, non-zero on failure.
  *
  */
-int netlbl_domhsh_remove_default(void)
+int netlbl_domhsh_remove_default(u32 audit_secid)
 {
-       return netlbl_domhsh_remove(NULL);
+       return netlbl_domhsh_remove(NULL, audit_secid);
 }
 
 /**
index 02af72a7877cb94d553a39998356d6a69d12d156..d50f13cacdcadd966dc9d81ba5cad07027a87a88 100644 (file)
@@ -57,9 +57,9 @@ struct netlbl_dom_map {
 int netlbl_domhsh_init(u32 size);
 
 /* Manipulate the domain hash table */
-int netlbl_domhsh_add(struct netlbl_dom_map *entry);
-int netlbl_domhsh_add_default(struct netlbl_dom_map *entry);
-int netlbl_domhsh_remove_default(void);
+int netlbl_domhsh_add(struct netlbl_dom_map *entry, u32 audit_secid);
+int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, u32 audit_secid);
+int netlbl_domhsh_remove_default(u32 audit_secid);
 struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain);
 int netlbl_domhsh_walk(u32 *skip_bkt,
                     u32 *skip_chain,
index 8626c9f678ebbb3434bed1c3e2977e5c28d18824..0ac314f18ad146296b713da535202b54563e36ca 100644 (file)
@@ -108,7 +108,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
 
        switch (entry->type) {
        case NETLBL_NLTYPE_UNLABELED:
-               ret_val = netlbl_domhsh_add(entry);
+               ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid);
                break;
        case NETLBL_NLTYPE_CIPSOV4:
                if (!info->attrs[NLBL_MGMT_A_CV4DOI])
@@ -125,7 +125,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
                        rcu_read_unlock();
                        goto add_failure;
                }
-               ret_val = netlbl_domhsh_add(entry);
+               ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid);
                rcu_read_unlock();
                break;
        default:
@@ -161,7 +161,7 @@ static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info)
                return -EINVAL;
 
        domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]);
-       return netlbl_domhsh_remove(domain);
+       return netlbl_domhsh_remove(domain, NETLINK_CB(skb).sid);
 }
 
 /**
@@ -277,7 +277,8 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
 
        switch (entry->type) {
        case NETLBL_NLTYPE_UNLABELED:
-               ret_val = netlbl_domhsh_add_default(entry);
+               ret_val = netlbl_domhsh_add_default(entry,
+                                                   NETLINK_CB(skb).sid);
                break;
        case NETLBL_NLTYPE_CIPSOV4:
                if (!info->attrs[NLBL_MGMT_A_CV4DOI])
@@ -294,7 +295,8 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
                        rcu_read_unlock();
                        goto adddef_failure;
                }
-               ret_val = netlbl_domhsh_add_default(entry);
+               ret_val = netlbl_domhsh_add_default(entry,
+                                                   NETLINK_CB(skb).sid);
                rcu_read_unlock();
                break;
        default:
@@ -322,7 +324,7 @@ adddef_failure:
  */
 static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info)
 {
-       return netlbl_domhsh_remove_default();
+       return netlbl_domhsh_remove_default(NETLINK_CB(skb).sid);
 }
 
 /**
index 440f5c4e1e2d1c636a1ca125da78467b6db6583d..ab36675fee8cffd9fcb2e8cde8d278ac3bc2f054 100644 (file)
@@ -63,6 +63,27 @@ static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
        [NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 },
 };
 
+/*
+ * Helper Functions
+ */
+
+/**
+ * netlbl_unlabel_acceptflg_set - Set the unlabeled accept flag
+ * @value: desired value
+ * @audit_secid: the LSM secid to use in the audit message
+ *
+ * Description:
+ * Set the value of the unlabeled accept flag to @value.
+ *
+ */
+static void netlbl_unlabel_acceptflg_set(u8 value, u32 audit_secid)
+{
+       atomic_set(&netlabel_unlabel_accept_flg, value);
+       netlbl_audit_nomsg((value ?
+                           AUDIT_MAC_UNLBL_ACCEPT : AUDIT_MAC_UNLBL_DENY),
+                          audit_secid);
+}
+
 /*
  * NetLabel Command Handlers
  */
@@ -79,18 +100,18 @@ static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
  */
 static int netlbl_unlabel_accept(struct sk_buff *skb, struct genl_info *info)
 {
-       int ret_val = -EINVAL;
        u8 value;
 
        if (info->attrs[NLBL_UNLABEL_A_ACPTFLG]) {
                value = nla_get_u8(info->attrs[NLBL_UNLABEL_A_ACPTFLG]);
                if (value == 1 || value == 0) {
-                       atomic_set(&netlabel_unlabel_accept_flg, value);
-                       ret_val = 0;
+                       netlbl_unlabel_acceptflg_set(value,
+                                                    NETLINK_CB(skb).sid);
+                       return 0;
                }
        }
 
-       return ret_val;
+       return -EINVAL;
 }
 
 /**
@@ -229,16 +250,19 @@ int netlbl_unlabel_defconf(void)
 {
        int ret_val;
        struct netlbl_dom_map *entry;
+       u32 secid;
+
+       security_task_getsecid(current, &secid);
 
        entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (entry == NULL)
                return -ENOMEM;
        entry->type = NETLBL_NLTYPE_UNLABELED;
-       ret_val = netlbl_domhsh_add_default(entry);
+       ret_val = netlbl_domhsh_add_default(entry, secid);
        if (ret_val != 0)
                return ret_val;
 
-       atomic_set(&netlabel_unlabel_accept_flg, 1);
+       netlbl_unlabel_acceptflg_set(1, secid);
 
        return 0;
 }
index eeb7d768d2bb558c7c963f372ec4b7b585d6b675..c2343af584cbebc13f51a974d42e38b9ae9f1c50 100644 (file)
@@ -32,6 +32,9 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/socket.h>
+#include <linux/audit.h>
+#include <linux/tty.h>
+#include <linux/security.h>
 #include <net/sock.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
@@ -74,3 +77,91 @@ int netlbl_netlink_init(void)
 
        return 0;
 }
+
+/*
+ * NetLabel Audit Functions
+ */
+
+/**
+ * netlbl_audit_start_common - Start an audit message
+ * @type: audit message type
+ * @secid: LSM context ID
+ *
+ * Description:
+ * Start an audit message using the type specified in @type and fill the audit
+ * message with some fields common to all NetLabel audit messages.  Returns
+ * a pointer to the audit buffer on success, NULL on failure.
+ *
+ */
+struct audit_buffer *netlbl_audit_start_common(int type, u32 secid)
+{
+       struct audit_context *audit_ctx = current->audit_context;
+       struct audit_buffer *audit_buf;
+       uid_t audit_loginuid;
+       const char *audit_tty;
+       char audit_comm[sizeof(current->comm)];
+       struct vm_area_struct *vma;
+       char *secctx;
+       u32 secctx_len;
+
+       audit_buf = audit_log_start(audit_ctx, GFP_ATOMIC, type);
+       if (audit_buf == NULL)
+               return NULL;
+
+       audit_loginuid = audit_get_loginuid(audit_ctx);
+       if (current->signal &&
+           current->signal->tty &&
+           current->signal->tty->name)
+               audit_tty = current->signal->tty->name;
+       else
+               audit_tty = "(none)";
+       get_task_comm(audit_comm, current);
+
+       audit_log_format(audit_buf,
+                        "netlabel: auid=%u uid=%u tty=%s pid=%d",
+                        audit_loginuid,
+                        current->uid,
+                        audit_tty,
+                        current->pid);
+       audit_log_format(audit_buf, " comm=");
+       audit_log_untrustedstring(audit_buf, audit_comm);
+       if (current->mm) {
+               down_read(&current->mm->mmap_sem);
+               vma = current->mm->mmap;
+               while (vma) {
+                       if ((vma->vm_flags & VM_EXECUTABLE) &&
+                           vma->vm_file) {
+                               audit_log_d_path(audit_buf,
+                                                " exe=",
+                                                vma->vm_file->f_dentry,
+                                                vma->vm_file->f_vfsmnt);
+                               break;
+                       }
+                       vma = vma->vm_next;
+               }
+               up_read(&current->mm->mmap_sem);
+       }
+
+       if (secid != 0 &&
+           security_secid_to_secctx(secid, &secctx, &secctx_len) == 0)
+               audit_log_format(audit_buf, " subj=%s", secctx);
+
+       return audit_buf;
+}
+
+/**
+ * netlbl_audit_nomsg - Send an audit message without additional text
+ * @type: audit message type
+ * @secid: LSM context ID
+ *
+ * Description:
+ * Send an audit message with only the common NetLabel audit fields.
+ *
+ */
+void netlbl_audit_nomsg(int type, u32 secid)
+{
+       struct audit_buffer *audit_buf;
+
+       audit_buf = netlbl_audit_start_common(type, secid);
+       audit_log_end(audit_buf);
+}
index 3f9386b917df4bfdf6bb354ac681588dab728b0b..ab840acfc9646ee308bfc2ffcf52d11bbcf13b12 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/types.h>
 #include <linux/skbuff.h>
 #include <linux/capability.h>
+#include <linux/audit.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
 #include <net/netlabel.h>
@@ -75,4 +76,9 @@ static inline void *netlbl_netlink_hdr_put(struct sk_buff *skb,
 
 int netlbl_netlink_init(void);
 
+/* NetLabel Audit Functions */
+
+struct audit_buffer *netlbl_audit_start_common(int type, u32 secid);
+void netlbl_audit_nomsg(int type, u32 secid);
+
 #endif
index 7e14f14058e991393ca1a75aacc669a516e1906c..37a1840216474d77c2ad534903059bbeb1a840ea 100644 (file)
@@ -401,7 +401,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
        if ((dev = dev_get_by_index(tcm->tcm_ifindex)) == NULL)
                return skb->len;
 
-       read_lock_bh(&qdisc_tree_lock);
+       read_lock(&qdisc_tree_lock);
        if (!tcm->tcm_parent)
                q = dev->qdisc_sleeping;
        else
@@ -458,7 +458,7 @@ errout:
        if (cl)
                cops->put(q, cl);
 out:
-       read_unlock_bh(&qdisc_tree_lock);
+       read_unlock(&qdisc_tree_lock);
        dev_put(dev);
        return skb->len;
 }
index 86cac49a0531476d716c31c9a195571063bb9117..09fda68c8b39f494f6b5802a99efc34a39cdc030 100644 (file)
@@ -194,7 +194,7 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        if (handle)
                f->handle = handle;
        else {
-               int i = 0x80000000;
+               unsigned int i = 0x80000000;
                do {
                        if (++head->hgenerator == 0x7FFFFFFF)
                                head->hgenerator = 1;
index a19eff12cf78b9013d66f070153c869f8242b151..0b6489291140f0324c73e8a8ddb0aad716c03593 100644 (file)
@@ -195,14 +195,14 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
 {
        struct Qdisc *q;
 
-       read_lock_bh(&qdisc_tree_lock);
+       read_lock(&qdisc_tree_lock);
        list_for_each_entry(q, &dev->qdisc_list, list) {
                if (q->handle == handle) {
-                       read_unlock_bh(&qdisc_tree_lock);
+                       read_unlock(&qdisc_tree_lock);
                        return q;
                }
        }
-       read_unlock_bh(&qdisc_tree_lock);
+       read_unlock(&qdisc_tree_lock);
        return NULL;
 }
 
@@ -837,7 +837,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
                        continue;
                if (idx > s_idx)
                        s_q_idx = 0;
-               read_lock_bh(&qdisc_tree_lock);
+               read_lock(&qdisc_tree_lock);
                q_idx = 0;
                list_for_each_entry(q, &dev->qdisc_list, list) {
                        if (q_idx < s_q_idx) {
@@ -846,12 +846,12 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
                        }
                        if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid,
                                          cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
-                               read_unlock_bh(&qdisc_tree_lock);
+                               read_unlock(&qdisc_tree_lock);
                                goto done;
                        }
                        q_idx++;
                }
-               read_unlock_bh(&qdisc_tree_lock);
+               read_unlock(&qdisc_tree_lock);
        }
 
 done:
@@ -1074,7 +1074,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
        s_t = cb->args[0];
        t = 0;
 
-       read_lock_bh(&qdisc_tree_lock);
+       read_lock(&qdisc_tree_lock);
        list_for_each_entry(q, &dev->qdisc_list, list) {
                if (t < s_t || !q->ops->cl_ops ||
                    (tcm->tcm_parent &&
@@ -1096,7 +1096,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
                        break;
                t++;
        }
-       read_unlock_bh(&qdisc_tree_lock);
+       read_unlock(&qdisc_tree_lock);
 
        cb->args[0] = t;
 
index 6f91518997951cbd13056373f36a98c0f87136b2..88c6a99ce53cfb675c9fb1198ca7f5328be3577e 100644 (file)
    The idea is the following:
    - enqueue, dequeue are serialized via top level device
      spinlock dev->queue_lock.
-   - tree walking is protected by read_lock_bh(qdisc_tree_lock)
+   - tree walking is protected by read_lock(qdisc_tree_lock)
      and this lock is used only in process context.
-   - updates to tree are made under rtnl semaphore or
-     from softirq context (__qdisc_destroy rcu-callback)
-     hence this lock needs local bh disabling.
+   - updates to tree are made only under rtnl semaphore,
+     hence this lock may be made without local bh disabling.
 
    qdisc_tree_lock must be grabbed BEFORE dev->queue_lock!
  */
@@ -57,14 +56,14 @@ DEFINE_RWLOCK(qdisc_tree_lock);
 
 void qdisc_lock_tree(struct net_device *dev)
 {
-       write_lock_bh(&qdisc_tree_lock);
+       write_lock(&qdisc_tree_lock);
        spin_lock_bh(&dev->queue_lock);
 }
 
 void qdisc_unlock_tree(struct net_device *dev)
 {
        spin_unlock_bh(&dev->queue_lock);
-       write_unlock_bh(&qdisc_tree_lock);
+       write_unlock(&qdisc_tree_lock);
 }
 
 /* 
@@ -483,20 +482,6 @@ void qdisc_reset(struct Qdisc *qdisc)
 static void __qdisc_destroy(struct rcu_head *head)
 {
        struct Qdisc *qdisc = container_of(head, struct Qdisc, q_rcu);
-       struct Qdisc_ops  *ops = qdisc->ops;
-
-#ifdef CONFIG_NET_ESTIMATOR
-       gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est);
-#endif
-       write_lock(&qdisc_tree_lock);
-       if (ops->reset)
-               ops->reset(qdisc);
-       if (ops->destroy)
-               ops->destroy(qdisc);
-       write_unlock(&qdisc_tree_lock);
-       module_put(ops->owner);
-
-       dev_put(qdisc->dev);
        kfree((char *) qdisc - qdisc->padded);
 }
 
@@ -504,32 +489,23 @@ static void __qdisc_destroy(struct rcu_head *head)
 
 void qdisc_destroy(struct Qdisc *qdisc)
 {
-       struct list_head cql = LIST_HEAD_INIT(cql);
-       struct Qdisc *cq, *q, *n;
+       struct Qdisc_ops  *ops = qdisc->ops;
 
        if (qdisc->flags & TCQ_F_BUILTIN ||
-               !atomic_dec_and_test(&qdisc->refcnt))
+           !atomic_dec_and_test(&qdisc->refcnt))
                return;
 
-       if (!list_empty(&qdisc->list)) {
-               if (qdisc->ops->cl_ops == NULL)
-                       list_del(&qdisc->list);
-               else
-                       list_move(&qdisc->list, &cql);
-       }
-
-       /* unlink inner qdiscs from dev->qdisc_list immediately */
-       list_for_each_entry(cq, &cql, list)
-               list_for_each_entry_safe(q, n, &qdisc->dev->qdisc_list, list)
-                       if (TC_H_MAJ(q->parent) == TC_H_MAJ(cq->handle)) {
-                               if (q->ops->cl_ops == NULL)
-                                       list_del_init(&q->list);
-                               else
-                                       list_move_tail(&q->list, &cql);
-                       }
-       list_for_each_entry_safe(cq, n, &cql, list)
-               list_del_init(&cq->list);
+       list_del(&qdisc->list);
+#ifdef CONFIG_NET_ESTIMATOR
+       gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est);
+#endif
+       if (ops->reset)
+               ops->reset(qdisc);
+       if (ops->destroy)
+               ops->destroy(qdisc);
 
+       module_put(ops->owner);
+       dev_put(qdisc->dev);
        call_rcu(&qdisc->q_rcu, __qdisc_destroy);
 }
 
@@ -549,15 +525,15 @@ void dev_activate(struct net_device *dev)
                                printk(KERN_INFO "%s: activation failed\n", dev->name);
                                return;
                        }
-                       write_lock_bh(&qdisc_tree_lock);
+                       write_lock(&qdisc_tree_lock);
                        list_add_tail(&qdisc->list, &dev->qdisc_list);
-                       write_unlock_bh(&qdisc_tree_lock);
+                       write_unlock(&qdisc_tree_lock);
                } else {
                        qdisc =  &noqueue_qdisc;
                }
-               write_lock_bh(&qdisc_tree_lock);
+               write_lock(&qdisc_tree_lock);
                dev->qdisc_sleeping = qdisc;
-               write_unlock_bh(&qdisc_tree_lock);
+               write_unlock(&qdisc_tree_lock);
        }
 
        if (!netif_carrier_ok(dev))
index bb3ddd4784b1cebfd4668dc15df844b484b36267..6c058e3660c0c28ec9e6d85cd79f92c94c391539 100644 (file)
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(struct htb_sched *q,
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-       if (RB_EMPTY_NODE(rb)) {
+       if (!RB_EMPTY_NODE(rb)) {
                WARN_ON(1);
        } else {
                rb_erase(rb, root);
index 55163af3dcaf2cdb4f195fccb39c94442373c624..993ff1a5d945687883c51ffc4a8662c87aa7704a 100644 (file)
@@ -331,8 +331,8 @@ rpcauth_unbindcred(struct rpc_task *task)
        task->tk_msg.rpc_cred = NULL;
 }
 
-u32 *
-rpcauth_marshcred(struct rpc_task *task, u32 *p)
+__be32 *
+rpcauth_marshcred(struct rpc_task *task, __be32 *p)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
@@ -342,8 +342,8 @@ rpcauth_marshcred(struct rpc_task *task, u32 *p)
        return cred->cr_ops->crmarshal(task, p);
 }
 
-u32 *
-rpcauth_checkverf(struct rpc_task *task, u32 *p)
+__be32 *
+rpcauth_checkverf(struct rpc_task *task, __be32 *p)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
@@ -355,7 +355,7 @@ rpcauth_checkverf(struct rpc_task *task, u32 *p)
 
 int
 rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
-               u32 *data, void *obj)
+               __be32 *data, void *obj)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
@@ -369,7 +369,7 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
 
 int
 rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
-               u32 *data, void *obj)
+               __be32 *data, void *obj)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
index 6eed3e166ba33ab083c6d831a6b5c33d63b2fede..a6ed2d22a6e6e8017bcd6e1f9816ee2d2fcbbf64 100644 (file)
@@ -826,14 +826,14 @@ out:
 * Marshal credentials.
 * Maybe we should keep a cached credential for performance reasons.
 */
-static u32 *
-gss_marshal(struct rpc_task *task, u32 *p)
+static __be32 *
+gss_marshal(struct rpc_task *task, __be32 *p)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
        struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
                                                 gc_base);
        struct gss_cl_ctx       *ctx = gss_cred_get_ctx(cred);
-       u32             *cred_len;
+       __be32          *cred_len;
        struct rpc_rqst *req = task->tk_rqstp;
        u32             maj_stat = 0;
        struct xdr_netobj mic;
@@ -894,12 +894,12 @@ gss_refresh(struct rpc_task *task)
        return 0;
 }
 
-static u32 *
-gss_validate(struct rpc_task *task, u32 *p)
+static __be32 *
+gss_validate(struct rpc_task *task, __be32 *p)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
        struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
-       u32             seq;
+       __be32          seq;
        struct kvec     iov;
        struct xdr_buf  verf_buf;
        struct xdr_netobj mic;
@@ -940,13 +940,14 @@ out_bad:
 
 static inline int
 gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
-               kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj)
+               kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj)
 {
        struct xdr_buf  *snd_buf = &rqstp->rq_snd_buf;
        struct xdr_buf  integ_buf;
-       u32             *integ_len = NULL;
+       __be32          *integ_len = NULL;
        struct xdr_netobj mic;
-       u32             offset, *q;
+       u32             offset;
+       __be32          *q;
        struct kvec     *iov;
        u32             maj_stat = 0;
        int             status = -EIO;
@@ -1032,13 +1033,13 @@ out:
 
 static inline int
 gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
-               kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj)
+               kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj)
 {
        struct xdr_buf  *snd_buf = &rqstp->rq_snd_buf;
        u32             offset;
        u32             maj_stat;
        int             status;
-       u32             *opaque_len;
+       __be32          *opaque_len;
        struct page     **inpages;
        int             first;
        int             pad;
@@ -1095,7 +1096,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
 
 static int
 gss_wrap_req(struct rpc_task *task,
-            kxdrproc_t encode, void *rqstp, u32 *p, void *obj)
+            kxdrproc_t encode, void *rqstp, __be32 *p, void *obj)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
        struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
@@ -1132,7 +1133,7 @@ out:
 
 static inline int
 gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
-               struct rpc_rqst *rqstp, u32 **p)
+               struct rpc_rqst *rqstp, __be32 **p)
 {
        struct xdr_buf  *rcv_buf = &rqstp->rq_rcv_buf;
        struct xdr_buf integ_buf;
@@ -1169,7 +1170,7 @@ gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
 
 static inline int
 gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
-               struct rpc_rqst *rqstp, u32 **p)
+               struct rpc_rqst *rqstp, __be32 **p)
 {
        struct xdr_buf  *rcv_buf = &rqstp->rq_rcv_buf;
        u32 offset;
@@ -1198,13 +1199,13 @@ gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
 
 static int
 gss_unwrap_resp(struct rpc_task *task,
-               kxdrproc_t decode, void *rqstp, u32 *p, void *obj)
+               kxdrproc_t decode, void *rqstp, __be32 *p, void *obj)
 {
        struct rpc_cred *cred = task->tk_msg.rpc_cred;
        struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
                        gc_base);
        struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
-       u32             *savedp = p;
+       __be32          *savedp = p;
        struct kvec     *head = ((struct rpc_rqst *)rqstp)->rq_rcv_buf.head;
        int             savedlen = head->iov_len;
        int             status = -EIO;
index 2f312164d6d5611559aabab099e37ef8e55f7459..08601ee4cd7311d45c4a1146386ce22a0d96be76 100644 (file)
@@ -115,7 +115,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
        krb5_hdr = ptr - 2;
        msg_start = krb5_hdr + 24;
 
-       *(u16 *)(krb5_hdr + 2) = htons(ctx->signalg);
+       *(__be16 *)(krb5_hdr + 2) = htons(ctx->signalg);
        memset(krb5_hdr + 4, 0xff, 4);
 
        if (make_checksum(checksum_type, krb5_hdr, 8, text, 0, &md5cksum))
index f179415d0c38e2bf4efe0e0cf345b51d009522d7..cc45c1605f80eb7bbc6f2382bb2c3952f0446ec9 100644 (file)
@@ -177,9 +177,9 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
        msg_start = krb5_hdr + 24;
        /* XXXJBF: */ BUG_ON(buf->head[0].iov_base + offset + headlen != msg_start + blocksize);
 
-       *(u16 *)(krb5_hdr + 2) = htons(kctx->signalg);
+       *(__be16 *)(krb5_hdr + 2) = htons(kctx->signalg);
        memset(krb5_hdr + 4, 0xff, 4);
-       *(u16 *)(krb5_hdr + 4) = htons(kctx->sealalg);
+       *(__be16 *)(krb5_hdr + 4) = htons(kctx->sealalg);
 
        make_confounder(msg_start, blocksize);
 
index 94217ec9e2dd5427a1b12cc559a46e114172e192..638c0b576203bab4fac5c0037cf1881e2c1c32e3 100644 (file)
@@ -607,7 +607,7 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o)
 
        if (argv->iov_len < 4)
                return -1;
-       o->len = ntohl(svc_getu32(argv));
+       o->len = svc_getnl(argv);
        l = round_up_to_quad(o->len);
        if (argv->iov_len < l)
                return -1;
@@ -620,17 +620,17 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o)
 static inline int
 svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o)
 {
-       u32 *p;
+       u8 *p;
 
        if (resv->iov_len + 4 > PAGE_SIZE)
                return -1;
-       svc_putu32(resv, htonl(o->len));
+       svc_putnl(resv, o->len);
        p = resv->iov_base + resv->iov_len;
        resv->iov_len += round_up_to_quad(o->len);
        if (resv->iov_len > PAGE_SIZE)
                return -1;
        memcpy(p, o->data, o->len);
-       memset((u8 *)p + o->len, 0, round_up_to_quad(o->len) - o->len);
+       memset(p + o->len, 0, round_up_to_quad(o->len) - o->len);
        return 0;
 }
 
@@ -640,7 +640,7 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o)
  */
 static int
 gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci,
-                 u32 *rpcstart, struct rpc_gss_wire_cred *gc, u32 *authp)
+                 __be32 *rpcstart, struct rpc_gss_wire_cred *gc, __be32 *authp)
 {
        struct gss_ctx          *ctx_id = rsci->mechctx;
        struct xdr_buf          rpchdr;
@@ -657,7 +657,7 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci,
        *authp = rpc_autherr_badverf;
        if (argv->iov_len < 4)
                return SVC_DENIED;
-       flavor = ntohl(svc_getu32(argv));
+       flavor = svc_getnl(argv);
        if (flavor != RPC_AUTH_GSS)
                return SVC_DENIED;
        if (svc_safe_getnetobj(argv, &checksum))
@@ -687,9 +687,9 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci,
 static int
 gss_write_null_verf(struct svc_rqst *rqstp)
 {
-       u32     *p;
+       __be32     *p;
 
-       svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_NULL));
+       svc_putnl(rqstp->rq_res.head, RPC_AUTH_NULL);
        p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len;
        /* don't really need to check if head->iov_len > PAGE_SIZE ... */
        *p++ = 0;
@@ -701,14 +701,14 @@ gss_write_null_verf(struct svc_rqst *rqstp)
 static int
 gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq)
 {
-       u32                     xdr_seq;
+       __be32                  xdr_seq;
        u32                     maj_stat;
        struct xdr_buf          verf_data;
        struct xdr_netobj       mic;
-       u32                     *p;
+       __be32                  *p;
        struct kvec             iov;
 
-       svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_GSS));
+       svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS);
        xdr_seq = htonl(seq);
 
        iov.iov_base = &xdr_seq;
@@ -782,7 +782,7 @@ EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor);
 static inline int
 read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj)
 {
-       u32     raw;
+       __be32  raw;
        int     status;
 
        status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj));
@@ -805,7 +805,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx)
        struct xdr_netobj mic;
        struct xdr_buf integ_buf;
 
-       integ_len = ntohl(svc_getu32(&buf->head[0]));
+       integ_len = svc_getnl(&buf->head[0]);
        if (integ_len & 3)
                goto out;
        if (integ_len > buf->len)
@@ -825,7 +825,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx)
        maj_stat = gss_verify_mic(ctx, &integ_buf, &mic);
        if (maj_stat != GSS_S_COMPLETE)
                goto out;
-       if (ntohl(svc_getu32(&buf->head[0])) != seq)
+       if (svc_getnl(&buf->head[0]) != seq)
                goto out;
        stat = 0;
 out:
@@ -857,7 +857,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
 
        rqstp->rq_sendfile_ok = 0;
 
-       priv_len = ntohl(svc_getu32(&buf->head[0]));
+       priv_len = svc_getnl(&buf->head[0]);
        if (rqstp->rq_deferred) {
                /* Already decrypted last time through! The sequence number
                 * check at out_seq is unnecessary but harmless: */
@@ -895,7 +895,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
        if (maj_stat != GSS_S_COMPLETE)
                return -EINVAL;
 out_seq:
-       if (ntohl(svc_getu32(&buf->head[0])) != seq)
+       if (svc_getnl(&buf->head[0]) != seq)
                return -EINVAL;
        return 0;
 }
@@ -905,7 +905,7 @@ struct gss_svc_data {
        struct rpc_gss_wire_cred        clcred;
        /* pointer to the beginning of the procedure-specific results,
         * which may be encrypted/checksummed in svcauth_gss_release: */
-       u32                             *body_start;
+       __be32                          *body_start;
        struct rsc                      *rsci;
 };
 
@@ -946,7 +946,7 @@ gss_write_init_verf(struct svc_rqst *rqstp, struct rsi *rsip)
  * response here and return SVC_COMPLETE.
  */
 static int
-svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
+svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
 {
        struct kvec     *argv = &rqstp->rq_arg.head[0];
        struct kvec     *resv = &rqstp->rq_res.head[0];
@@ -956,8 +956,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
        struct rpc_gss_wire_cred *gc;
        struct rsc      *rsci = NULL;
        struct rsi      *rsip, rsikey;
-       u32             *rpcstart;
-       u32             *reject_stat = resv->iov_base + resv->iov_len;
+       __be32          *rpcstart;
+       __be32          *reject_stat = resv->iov_base + resv->iov_len;
        int             ret;
 
        dprintk("RPC:      svcauth_gss: argv->iov_len = %zd\n",argv->iov_len);
@@ -985,12 +985,12 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
 
        if (argv->iov_len < 5 * 4)
                goto auth_err;
-       crlen = ntohl(svc_getu32(argv));
-       if (ntohl(svc_getu32(argv)) != RPC_GSS_VERSION)
+       crlen = svc_getnl(argv);
+       if (svc_getnl(argv) != RPC_GSS_VERSION)
                goto auth_err;
-       gc->gc_proc = ntohl(svc_getu32(argv));
-       gc->gc_seq = ntohl(svc_getu32(argv));
-       gc->gc_svc = ntohl(svc_getu32(argv));
+       gc->gc_proc = svc_getnl(argv);
+       gc->gc_seq = svc_getnl(argv);
+       gc->gc_svc = svc_getnl(argv);
        if (svc_safe_getnetobj(argv, &gc->gc_ctx))
                goto auth_err;
        if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4)
@@ -1016,9 +1016,9 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
        case RPC_GSS_PROC_CONTINUE_INIT:
                if (argv->iov_len < 2 * 4)
                        goto auth_err;
-               if (ntohl(svc_getu32(argv)) != RPC_AUTH_NULL)
+               if (svc_getnl(argv) != RPC_AUTH_NULL)
                        goto auth_err;
-               if (ntohl(svc_getu32(argv)) != 0)
+               if (svc_getnl(argv) != 0)
                        goto auth_err;
                break;
        case RPC_GSS_PROC_DATA:
@@ -1076,14 +1076,14 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
                                goto drop;
                        if (resv->iov_len + 4 > PAGE_SIZE)
                                goto drop;
-                       svc_putu32(resv, rpc_success);
+                       svc_putnl(resv, RPC_SUCCESS);
                        if (svc_safe_putnetobj(resv, &rsip->out_handle))
                                goto drop;
                        if (resv->iov_len + 3 * 4 > PAGE_SIZE)
                                goto drop;
-                       svc_putu32(resv, htonl(rsip->major_status));
-                       svc_putu32(resv, htonl(rsip->minor_status));
-                       svc_putu32(resv, htonl(GSS_SEQ_WIN));
+                       svc_putnl(resv, rsip->major_status);
+                       svc_putnl(resv, rsip->minor_status);
+                       svc_putnl(resv, GSS_SEQ_WIN);
                        if (svc_safe_putnetobj(resv, &rsip->out_token))
                                goto drop;
                        rqstp->rq_client = NULL;
@@ -1093,7 +1093,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
                set_bit(CACHE_NEGATIVE, &rsci->h.flags);
                if (resv->iov_len + 4 > PAGE_SIZE)
                        goto drop;
-               svc_putu32(resv, rpc_success);
+               svc_putnl(resv, RPC_SUCCESS);
                goto complete;
        case RPC_GSS_PROC_DATA:
                *authp = rpcsec_gsserr_ctxproblem;
@@ -1111,8 +1111,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
                                goto auth_err;
                        /* placeholders for length and seq. number: */
                        svcdata->body_start = resv->iov_base + resv->iov_len;
-                       svc_putu32(resv, 0);
-                       svc_putu32(resv, 0);
+                       svc_putnl(resv, 0);
+                       svc_putnl(resv, 0);
                        break;
                case RPC_GSS_SVC_PRIVACY:
                        if (unwrap_priv_data(rqstp, &rqstp->rq_arg,
@@ -1120,8 +1120,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
                                goto auth_err;
                        /* placeholders for length and seq. number: */
                        svcdata->body_start = resv->iov_base + resv->iov_len;
-                       svc_putu32(resv, 0);
-                       svc_putu32(resv, 0);
+                       svc_putnl(resv, 0);
+                       svc_putnl(resv, 0);
                        break;
                default:
                        goto auth_err;
@@ -1156,7 +1156,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
        struct xdr_buf integ_buf;
        struct xdr_netobj mic;
        struct kvec *resv;
-       u32 *p;
+       __be32 *p;
        int integ_offset, integ_len;
        int stat = -EINVAL;
 
@@ -1199,7 +1199,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
        mic.data = (u8 *)resv->iov_base + resv->iov_len + 4;
        if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic))
                goto out_err;
-       svc_putu32(resv, htonl(mic.len));
+       svc_putnl(resv, mic.len);
        memset(mic.data + mic.len, 0,
                        round_up_to_quad(mic.len) - mic.len);
        resv->iov_len += XDR_QUADLEN(mic.len) << 2;
@@ -1219,8 +1219,8 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
        struct rpc_gss_wire_cred *gc = &gsd->clcred;
        struct xdr_buf *resbuf = &rqstp->rq_res;
        struct page **inpages = NULL;
-       u32 *p;
-       int offset, *len;
+       __be32 *p, *len;
+       int offset;
        int pad;
 
        p = gsd->body_start;
@@ -1264,7 +1264,7 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
                return -ENOMEM;
        *len = htonl(resbuf->len - offset);
        pad = 3 - ((resbuf->len - offset - 1)&3);
-       p = (u32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len);
+       p = (__be32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len);
        memset(p, 0, pad);
        resbuf->tail[0].iov_len += pad;
        resbuf->len += pad;
index 2eccffa96ba1a016208c73de79cebc77a482f94e..3be257dc32b2af4e26a5f1028ac8dc30586b7e28 100644 (file)
@@ -60,8 +60,8 @@ nul_match(struct auth_cred *acred, struct rpc_cred *cred, int taskflags)
 /*
  * Marshal credential.
  */
-static u32 *
-nul_marshal(struct rpc_task *task, u32 *p)
+static __be32 *
+nul_marshal(struct rpc_task *task, __be32 *p)
 {
        *p++ = htonl(RPC_AUTH_NULL);
        *p++ = 0;
@@ -81,8 +81,8 @@ nul_refresh(struct rpc_task *task)
        return 0;
 }
 
-static u32 *
-nul_validate(struct rpc_task *task, u32 *p)
+static __be32 *
+nul_validate(struct rpc_task *task, __be32 *p)
 {
        rpc_authflavor_t        flavor;
        u32                     size;
index 74c7406a10549d4a747e376f5b30ae41b0764290..f7f990c9afe2ef805b2ea75e1d9b23dbb7f2d2fc 100644 (file)
@@ -137,12 +137,12 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
  * Marshal credentials.
  * Maybe we should keep a cached credential for performance reasons.
  */
-static u32 *
-unx_marshal(struct rpc_task *task, u32 *p)
+static __be32 *
+unx_marshal(struct rpc_task *task, __be32 *p)
 {
        struct rpc_clnt *clnt = task->tk_client;
        struct unx_cred *cred = (struct unx_cred *) task->tk_msg.rpc_cred;
-       u32             *base, *hold;
+       __be32          *base, *hold;
        int             i;
 
        *p++ = htonl(RPC_AUTH_UNIX);
@@ -178,8 +178,8 @@ unx_refresh(struct rpc_task *task)
        return 0;
 }
 
-static u32 *
-unx_validate(struct rpc_task *task, u32 *p)
+static __be32 *
+unx_validate(struct rpc_task *task, __be32 *p)
 {
        rpc_authflavor_t        flavor;
        u32                     size;
index 084a0ad5c64ea0752893f7ddefb95be18384a467..124ff0ceb55b2ee20ce47d6f3358a966de37ddb5 100644 (file)
@@ -60,8 +60,8 @@ static void   call_refreshresult(struct rpc_task *task);
 static void    call_timeout(struct rpc_task *task);
 static void    call_connect(struct rpc_task *task);
 static void    call_connect_status(struct rpc_task *task);
-static u32 *   call_header(struct rpc_task *task);
-static u32 *   call_verify(struct rpc_task *task);
+static __be32 *        call_header(struct rpc_task *task);
+static __be32 *        call_verify(struct rpc_task *task);
 
 
 static int
@@ -782,7 +782,7 @@ call_encode(struct rpc_task *task)
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
        unsigned int    bufsiz;
        kxdrproc_t      encode;
-       u32             *p;
+       __be32          *p;
 
        dprintk("RPC: %4d call_encode (status %d)\n", 
                                task->tk_pid, task->tk_status);
@@ -1100,7 +1100,7 @@ call_decode(struct rpc_task *task)
        struct rpc_clnt *clnt = task->tk_client;
        struct rpc_rqst *req = task->tk_rqstp;
        kxdrproc_t      decode = task->tk_msg.rpc_proc->p_decode;
-       u32             *p;
+       __be32          *p;
 
        dprintk("RPC: %4d call_decode (status %d)\n", 
                                task->tk_pid, task->tk_status);
@@ -1197,12 +1197,12 @@ call_refreshresult(struct rpc_task *task)
 /*
  * Call header serialization
  */
-static u32 *
+static __be32 *
 call_header(struct rpc_task *task)
 {
        struct rpc_clnt *clnt = task->tk_client;
        struct rpc_rqst *req = task->tk_rqstp;
-       u32             *p = req->rq_svec[0].iov_base;
+       __be32          *p = req->rq_svec[0].iov_base;
 
        /* FIXME: check buffer size? */
 
@@ -1221,12 +1221,13 @@ call_header(struct rpc_task *task)
 /*
  * Reply header verification
  */
-static u32 *
+static __be32 *
 call_verify(struct rpc_task *task)
 {
        struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0];
        int len = task->tk_rqstp->rq_rcv_buf.len >> 2;
-       u32     *p = iov->iov_base, n;
+       __be32  *p = iov->iov_base;
+       u32 n;
        int error = -EACCES;
 
        if ((task->tk_rqstp->rq_rcv_buf.len & 3) != 0) {
@@ -1303,7 +1304,7 @@ call_verify(struct rpc_task *task)
                printk(KERN_WARNING "call_verify: auth check failed\n");
                goto out_garbage;               /* bad verifier, retry */
        }
-       len = p - (u32 *)iov->iov_base - 1;
+       len = p - (__be32 *)iov->iov_base - 1;
        if (len < 0)
                goto out_overflow;
        switch ((n = ntohl(*p++))) {
@@ -1358,12 +1359,12 @@ out_overflow:
        goto out_garbage;
 }
 
-static int rpcproc_encode_null(void *rqstp, u32 *data, void *obj)
+static int rpcproc_encode_null(void *rqstp, __be32 *data, void *obj)
 {
        return 0;
 }
 
-static int rpcproc_decode_null(void *rqstp, u32 *data, void *obj)
+static int rpcproc_decode_null(void *rqstp, __be32 *data, void *obj)
 {
        return 0;
 }
index c04609d3476a986e630097998a6eeecb76551870..919d5ba7ca0a206cb40aff51e67ac90bbc4f67b3 100644 (file)
@@ -300,7 +300,7 @@ static struct rpc_clnt *pmap_create(char *hostname, struct sockaddr_in *srvaddr,
 /*
  * XDR encode/decode functions for PMAP
  */
-static int xdr_encode_mapping(struct rpc_rqst *req, u32 *p, struct portmap_args *map)
+static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map)
 {
        dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n",
                map->pm_prog, map->pm_vers, map->pm_prot, map->pm_port);
@@ -313,13 +313,13 @@ static int xdr_encode_mapping(struct rpc_rqst *req, u32 *p, struct portmap_args
        return 0;
 }
 
-static int xdr_decode_port(struct rpc_rqst *req, u32 *p, unsigned short *portp)
+static int xdr_decode_port(struct rpc_rqst *req, __be32 *p, unsigned short *portp)
 {
        *portp = (unsigned short) ntohl(*p++);
        return 0;
 }
 
-static int xdr_decode_bool(struct rpc_rqst *req, u32 *p, unsigned int *boolp)
+static int xdr_decode_bool(struct rpc_rqst *req, __be32 *p, unsigned int *boolp)
 {
        *boolp = (unsigned int) ntohl(*p++);
        return 0;
index b76a227dd3ad9aac842f988874bc66cbb27e4a7b..44b8d9d4c18a7d09e5929688e45eab41cdc60ef8 100644 (file)
@@ -256,11 +256,11 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp)
        struct kvec *           argv = &rqstp->rq_arg.head[0];
        struct kvec *           resv = &rqstp->rq_res.head[0];
        kxdrproc_t              xdr;
-       u32                     *statp;
-       u32                     dir, prog, vers, proc,
-                               auth_stat, rpc_stat;
+       __be32                  *statp;
+       u32                     dir, prog, vers, proc;
+       __be32                  auth_stat, rpc_stat;
        int                     auth_res;
-       u32                     *accept_statp;
+       __be32                  *accept_statp;
 
        rpc_stat = rpc_success;
 
@@ -284,16 +284,16 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp)
        rqstp->rq_sendfile_ok = 1;
        /* tcp needs a space for the record length... */
        if (rqstp->rq_prot == IPPROTO_TCP)
-               svc_putu32(resv, 0);
+               svc_putnl(resv, 0);
 
        rqstp->rq_xid = svc_getu32(argv);
        svc_putu32(resv, rqstp->rq_xid);
 
-       dir  = ntohl(svc_getu32(argv));
-       vers = ntohl(svc_getu32(argv));
+       dir  = svc_getnl(argv);
+       vers = svc_getnl(argv);
 
        /* First words of reply: */
-       svc_putu32(resv, xdr_one);              /* REPLY */
+       svc_putnl(resv, 1);             /* REPLY */
 
        if (dir != 0)           /* direction != CALL */
                goto err_bad_dir;
@@ -303,11 +303,11 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp)
        /* Save position in case we later decide to reject: */
        accept_statp = resv->iov_base + resv->iov_len;
 
-       svc_putu32(resv, xdr_zero);             /* ACCEPT */
+       svc_putnl(resv, 0);             /* ACCEPT */
 
-       rqstp->rq_prog = prog = ntohl(svc_getu32(argv));        /* program number */
-       rqstp->rq_vers = vers = ntohl(svc_getu32(argv));        /* version number */
-       rqstp->rq_proc = proc = ntohl(svc_getu32(argv));        /* procedure number */
+       rqstp->rq_prog = prog = svc_getnl(argv);        /* program number */
+       rqstp->rq_vers = vers = svc_getnl(argv);        /* version number */
+       rqstp->rq_proc = proc = svc_getnl(argv);        /* procedure number */
 
        progp = serv->sv_program;
 
@@ -361,7 +361,7 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp)
 
        /* Build the reply header. */
        statp = resv->iov_base +resv->iov_len;
-       svc_putu32(resv, rpc_success);          /* RPC_SUCCESS */
+       svc_putnl(resv, RPC_SUCCESS);
 
        /* Bump per-procedure stats counter */
        procp->pc_count++;
@@ -439,10 +439,10 @@ err_bad_dir:
 
 err_bad_rpc:
        serv->sv_stats->rpcbadfmt++;
-       svc_putu32(resv, xdr_one);      /* REJECT */
-       svc_putu32(resv, xdr_zero);     /* RPC_MISMATCH */
-       svc_putu32(resv, xdr_two);      /* Only RPCv2 supported */
-       svc_putu32(resv, xdr_two);
+       svc_putnl(resv, 1);     /* REJECT */
+       svc_putnl(resv, 0);     /* RPC_MISMATCH */
+       svc_putnl(resv, 2);     /* Only RPCv2 supported */
+       svc_putnl(resv, 2);
        goto sendit;
 
 err_bad_auth:
@@ -450,15 +450,15 @@ err_bad_auth:
        serv->sv_stats->rpcbadauth++;
        /* Restore write pointer to location of accept status: */
        xdr_ressize_check(rqstp, accept_statp);
-       svc_putu32(resv, xdr_one);      /* REJECT */
-       svc_putu32(resv, xdr_one);      /* AUTH_ERROR */
-       svc_putu32(resv, auth_stat);    /* status */
+       svc_putnl(resv, 1);     /* REJECT */
+       svc_putnl(resv, 1);     /* AUTH_ERROR */
+       svc_putnl(resv, ntohl(auth_stat));      /* status */
        goto sendit;
 
 err_bad_prog:
        dprintk("svc: unknown program %d\n", prog);
        serv->sv_stats->rpcbadfmt++;
-       svc_putu32(resv, rpc_prog_unavail);
+       svc_putnl(resv, RPC_PROG_UNAVAIL);
        goto sendit;
 
 err_bad_vers:
@@ -466,9 +466,9 @@ err_bad_vers:
        printk("svc: unknown version (%d)\n", vers);
 #endif
        serv->sv_stats->rpcbadfmt++;
-       svc_putu32(resv, rpc_prog_mismatch);
-       svc_putu32(resv, htonl(progp->pg_lovers));
-       svc_putu32(resv, htonl(progp->pg_hivers));
+       svc_putnl(resv, RPC_PROG_MISMATCH);
+       svc_putnl(resv, progp->pg_lovers);
+       svc_putnl(resv, progp->pg_hivers);
        goto sendit;
 
 err_bad_proc:
@@ -476,7 +476,7 @@ err_bad_proc:
        printk("svc: unknown procedure (%d)\n", proc);
 #endif
        serv->sv_stats->rpcbadfmt++;
-       svc_putu32(resv, rpc_proc_unavail);
+       svc_putnl(resv, RPC_PROC_UNAVAIL);
        goto sendit;
 
 err_garbage:
@@ -486,6 +486,6 @@ err_garbage:
        rpc_stat = rpc_garbage_args;
 err_bad:
        serv->sv_stats->rpcbadfmt++;
-       svc_putu32(resv, rpc_stat);
+       svc_putnl(resv, ntohl(rpc_stat));
        goto sendit;
 }
index 5b28c6176806321af56ff3edfe464c7fea297e7d..8f2320aded5c42f645b406cf51539d10228ef055 100644 (file)
@@ -35,14 +35,14 @@ static struct auth_ops      *authtab[RPC_AUTH_MAXFLAVOR] = {
 };
 
 int
-svc_authenticate(struct svc_rqst *rqstp, u32 *authp)
+svc_authenticate(struct svc_rqst *rqstp, __be32 *authp)
 {
        rpc_authflavor_t        flavor;
        struct auth_ops         *aops;
 
        *authp = rpc_auth_ok;
 
-       flavor = ntohl(svc_getu32(&rqstp->rq_arg.head[0]));
+       flavor = svc_getnl(&rqstp->rq_arg.head[0]);
 
        dprintk("svc: svc_authenticate (%d)\n", flavor);
 
index 7e5707e2d6b678fcd00cdb439cceb3b71fee0220..1020d54b01d074a7fd8c1d25976a7d9fe800935c 100644 (file)
@@ -145,7 +145,7 @@ static void ip_map_request(struct cache_detail *cd,
 {
        char text_addr[20];
        struct ip_map *im = container_of(h, struct ip_map, h);
-       __u32 addr = im->m_addr.s_addr;
+       __be32 addr = im->m_addr.s_addr;
        
        snprintf(text_addr, 20, "%u.%u.%u.%u",
                 ntohl(addr) >> 24 & 0xff,
@@ -249,10 +249,10 @@ static int ip_map_show(struct seq_file *m,
 
        seq_printf(m, "%s %d.%d.%d.%d %s\n",
                   im->m_class,
-                  htonl(addr.s_addr) >> 24 & 0xff,
-                  htonl(addr.s_addr) >> 16 & 0xff,
-                  htonl(addr.s_addr) >>  8 & 0xff,
-                  htonl(addr.s_addr) >>  0 & 0xff,
+                  ntohl(addr.s_addr) >> 24 & 0xff,
+                  ntohl(addr.s_addr) >> 16 & 0xff,
+                  ntohl(addr.s_addr) >>  8 & 0xff,
+                  ntohl(addr.s_addr) >>  0 & 0xff,
                   dom
                   );
        return 0;
@@ -410,7 +410,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
 }
 
 static int
-svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
+svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
 {
        struct kvec     *argv = &rqstp->rq_arg.head[0];
        struct kvec     *resv = &rqstp->rq_res.head[0];
@@ -427,7 +427,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
                *authp = rpc_autherr_badcred;
                return SVC_DENIED;
        }
-       if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) {
+       if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {
                dprintk("svc: bad null verf\n");
                *authp = rpc_autherr_badverf;
                return SVC_DENIED;
@@ -441,8 +441,8 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
                return SVC_DROP; /* kmalloc failure - client must retry */
 
        /* Put NULL verifier */
-       svc_putu32(resv, RPC_AUTH_NULL);
-       svc_putu32(resv, 0);
+       svc_putnl(resv, RPC_AUTH_NULL);
+       svc_putnl(resv, 0);
 
        return SVC_OK;
 }
@@ -472,7 +472,7 @@ struct auth_ops svcauth_null = {
 
 
 static int
-svcauth_unix_accept(struct svc_rqst *rqstp, u32 *authp)
+svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
 {
        struct kvec     *argv = &rqstp->rq_arg.head[0];
        struct kvec     *resv = &rqstp->rq_res.head[0];
@@ -488,31 +488,31 @@ svcauth_unix_accept(struct svc_rqst *rqstp, u32 *authp)
 
        svc_getu32(argv);                       /* length */
        svc_getu32(argv);                       /* time stamp */
-       slen = XDR_QUADLEN(ntohl(svc_getu32(argv)));    /* machname length */
+       slen = XDR_QUADLEN(svc_getnl(argv));    /* machname length */
        if (slen > 64 || (len -= (slen + 3)*4) < 0)
                goto badcred;
-       argv->iov_base = (void*)((u32*)argv->iov_base + slen);  /* skip machname */
+       argv->iov_base = (void*)((__be32*)argv->iov_base + slen);       /* skip machname */
        argv->iov_len -= slen*4;
 
-       cred->cr_uid = ntohl(svc_getu32(argv));         /* uid */
-       cred->cr_gid = ntohl(svc_getu32(argv));         /* gid */
-       slen = ntohl(svc_getu32(argv));                 /* gids length */
+       cred->cr_uid = svc_getnl(argv);         /* uid */
+       cred->cr_gid = svc_getnl(argv);         /* gid */
+       slen = svc_getnl(argv);                 /* gids length */
        if (slen > 16 || (len -= (slen + 2)*4) < 0)
                goto badcred;
        cred->cr_group_info = groups_alloc(slen);
        if (cred->cr_group_info == NULL)
                return SVC_DROP;
        for (i = 0; i < slen; i++)
-               GROUP_AT(cred->cr_group_info, i) = ntohl(svc_getu32(argv));
+               GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv);
 
-       if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) {
+       if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {
                *authp = rpc_autherr_badverf;
                return SVC_DENIED;
        }
 
        /* Put NULL verifier */
-       svc_putu32(resv, RPC_AUTH_NULL);
-       svc_putu32(resv, 0);
+       svc_putnl(resv, RPC_AUTH_NULL);
+       svc_putnl(resv, 0);
 
        return SVC_OK;
 
index 953aff89bcac1cf3399e28cd7b9e6f401070123d..5b0fe1b66a23d5fbed578179268bedc15eae52c2 100644 (file)
@@ -1030,7 +1030,7 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
 {
        struct xdr_buf  *xbufp = &rqstp->rq_res;
        int sent;
-       u32 reclen;
+       __be32 reclen;
 
        /* Set up the first element of the reply kvec.
         * Any other kvecs that may be in use have been taken
@@ -1393,14 +1393,12 @@ svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin)
        if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0)
                return error;
 
-       if (sin != NULL) {
-               if (type == SOCK_STREAM)
-                       sock->sk->sk_reuse = 1; /* allow address reuse */
-               error = kernel_bind(sock, (struct sockaddr *) sin,
-                                               sizeof(*sin));
-               if (error < 0)
-                       goto bummer;
-       }
+       if (type == SOCK_STREAM)
+               sock->sk->sk_reuse = 1; /* allow address reuse */
+       error = kernel_bind(sock, (struct sockaddr *) sin,
+                                       sizeof(*sin));
+       if (error < 0)
+               goto bummer;
 
        if (protocol == IPPROTO_TCP) {
                if ((error = kernel_listen(sock, 64)) < 0)
index 6ac45103a272343a885a234cdda576dc6b655088..9022eb8b37ed9d05ea2e1bd983747b49b4c0ff7b 100644 (file)
@@ -18,8 +18,8 @@
 /*
  * XDR functions for basic NFS types
  */
-u32 *
-xdr_encode_netobj(u32 *p, const struct xdr_netobj *obj)
+__be32 *
+xdr_encode_netobj(__be32 *p, const struct xdr_netobj *obj)
 {
        unsigned int    quadlen = XDR_QUADLEN(obj->len);
 
@@ -29,8 +29,8 @@ xdr_encode_netobj(u32 *p, const struct xdr_netobj *obj)
        return p + XDR_QUADLEN(obj->len);
 }
 
-u32 *
-xdr_decode_netobj(u32 *p, struct xdr_netobj *obj)
+__be32 *
+xdr_decode_netobj(__be32 *p, struct xdr_netobj *obj)
 {
        unsigned int    len;
 
@@ -55,7 +55,7 @@ xdr_decode_netobj(u32 *p, struct xdr_netobj *obj)
  * Returns the updated current XDR buffer position
  *
  */
-u32 *xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int nbytes)
+__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int nbytes)
 {
        if (likely(nbytes != 0)) {
                unsigned int quadlen = XDR_QUADLEN(nbytes);
@@ -79,21 +79,21 @@ EXPORT_SYMBOL(xdr_encode_opaque_fixed);
  *
  * Returns the updated current XDR buffer position
  */
-u32 *xdr_encode_opaque(u32 *p, const void *ptr, unsigned int nbytes)
+__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int nbytes)
 {
        *p++ = htonl(nbytes);
        return xdr_encode_opaque_fixed(p, ptr, nbytes);
 }
 EXPORT_SYMBOL(xdr_encode_opaque);
 
-u32 *
-xdr_encode_string(u32 *p, const char *string)
+__be32 *
+xdr_encode_string(__be32 *p, const char *string)
 {
        return xdr_encode_array(p, string, strlen(string));
 }
 
-u32 *
-xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen)
+__be32 *
+xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen)
 {
        unsigned int    len;
 
@@ -432,7 +432,7 @@ xdr_shift_buf(struct xdr_buf *buf, size_t len)
  *      of the buffer length, and takes care of adjusting the kvec
  *      length for us.
  */
-void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p)
+void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
 {
        struct kvec *iov = buf->head;
        int scratch_len = buf->buflen - buf->page_len - buf->tail[0].iov_len;
@@ -440,8 +440,8 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p)
        BUG_ON(scratch_len < 0);
        xdr->buf = buf;
        xdr->iov = iov;
-       xdr->p = (uint32_t *)((char *)iov->iov_base + iov->iov_len);
-       xdr->end = (uint32_t *)((char *)iov->iov_base + scratch_len);
+       xdr->p = (__be32 *)((char *)iov->iov_base + iov->iov_len);
+       xdr->end = (__be32 *)((char *)iov->iov_base + scratch_len);
        BUG_ON(iov->iov_len > scratch_len);
 
        if (p != xdr->p && p != NULL) {
@@ -465,10 +465,10 @@ EXPORT_SYMBOL(xdr_init_encode);
  * bytes of data. If so, update the total xdr_buf length, and
  * adjust the length of the current kvec.
  */
-uint32_t * xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes)
+__be32 * xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes)
 {
-       uint32_t *p = xdr->p;
-       uint32_t *q;
+       __be32 *p = xdr->p;
+       __be32 *q;
 
        /* align nbytes on the next 32-bit boundary */
        nbytes += 3;
@@ -524,7 +524,7 @@ EXPORT_SYMBOL(xdr_write_pages);
  * @buf: pointer to XDR buffer from which to decode data
  * @p: current pointer inside XDR buffer
  */
-void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p)
+void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
 {
        struct kvec *iov = buf->head;
        unsigned int len = iov->iov_len;
@@ -534,7 +534,7 @@ void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p)
        xdr->buf = buf;
        xdr->iov = iov;
        xdr->p = p;
-       xdr->end = (uint32_t *)((char *)iov->iov_base + len);
+       xdr->end = (__be32 *)((char *)iov->iov_base + len);
 }
 EXPORT_SYMBOL(xdr_init_decode);
 
@@ -548,10 +548,10 @@ EXPORT_SYMBOL(xdr_init_decode);
  * If so return the current pointer, then update the current
  * pointer position.
  */
-uint32_t * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes)
+__be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes)
 {
-       uint32_t *p = xdr->p;
-       uint32_t *q = p + XDR_QUADLEN(nbytes);
+       __be32 *p = xdr->p;
+       __be32 *q = p + XDR_QUADLEN(nbytes);
 
        if (unlikely(q > xdr->end || q < p))
                return NULL;
@@ -599,8 +599,8 @@ void xdr_read_pages(struct xdr_stream *xdr, unsigned int len)
         * Position current pointer at beginning of tail, and
         * set remaining message length.
         */
-       xdr->p = (uint32_t *)((char *)iov->iov_base + padding);
-       xdr->end = (uint32_t *)((char *)iov->iov_base + end);
+       xdr->p = (__be32 *)((char *)iov->iov_base + padding);
+       xdr->end = (__be32 *)((char *)iov->iov_base + end);
 }
 EXPORT_SYMBOL(xdr_read_pages);
 
@@ -624,8 +624,8 @@ void xdr_enter_page(struct xdr_stream *xdr, unsigned int len)
         */
        if (len > PAGE_CACHE_SIZE - xdr->buf->page_base)
                len = PAGE_CACHE_SIZE - xdr->buf->page_base;
-       xdr->p = (uint32_t *)(kaddr + xdr->buf->page_base);
-       xdr->end = (uint32_t *)((char *)xdr->p + len);
+       xdr->p = (__be32 *)(kaddr + xdr->buf->page_base);
+       xdr->end = (__be32 *)((char *)xdr->p + len);
 }
 EXPORT_SYMBOL(xdr_enter_page);
 
@@ -743,7 +743,7 @@ out:
 int
 xdr_decode_word(struct xdr_buf *buf, int base, u32 *obj)
 {
-       u32     raw;
+       __be32  raw;
        int     status;
 
        status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj));
@@ -756,7 +756,7 @@ xdr_decode_word(struct xdr_buf *buf, int base, u32 *obj)
 int
 xdr_encode_word(struct xdr_buf *buf, int base, u32 obj)
 {
-       u32     raw = htonl(obj);
+       __be32  raw = htonl(obj);
 
        return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj));
 }
index 1f786f68729d465c8bc7f3fb51b45465a4c89aa2..80857470dc112f15fe18bbd91510e6147243e5e3 100644 (file)
@@ -594,7 +594,7 @@ static void xprt_connect_status(struct rpc_task *task)
  * @xid: RPC XID of incoming reply
  *
  */
-struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid)
+struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid)
 {
        struct list_head *pos;
 
@@ -801,7 +801,7 @@ void xprt_reserve(struct rpc_task *task)
        spin_unlock(&xprt->reserve_lock);
 }
 
-static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt)
+static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
 {
        return xprt->xid++;
 }
index 9b62923a9c0689fd75569fb494e66604f06ce4e7..28100e01922516045b9530f46df41fadb8738729 100644 (file)
@@ -548,7 +548,8 @@ static void xs_udp_data_ready(struct sock *sk, int len)
        struct rpc_rqst *rovr;
        struct sk_buff *skb;
        int err, repsize, copied;
-       u32 _xid, *xp;
+       u32 _xid;
+       __be32 *xp;
 
        read_lock(&sk->sk_callback_lock);
        dprintk("RPC:      xs_udp_data_ready...\n");
index d3abb0b7dc62190259c941fb28cdfc068d32c1df..6ac4e4f033aca67e1d7178efb4347c98a672aa1b 100644 (file)
@@ -58,10 +58,10 @@ static inline unsigned __xfrm_src_hash(xfrm_address_t *saddr,
 }
 
 static inline unsigned int
-__xfrm_spi_hash(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family,
+__xfrm_spi_hash(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family,
                unsigned int hmask)
 {
-       unsigned int h = spi ^ proto;
+       unsigned int h = (__force u32)spi ^ proto;
        switch (family) {
        case AF_INET:
                h ^= __xfrm4_addr_hash(daddr);
index dfc90bb1cf1f53d054c2fc7f15e0b72ed3013f2a..e8198a2c785df7416143c0781bd042f8aba995d2 100644 (file)
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(secpath_dup);
 
 /* Fetch spi and seq from ipsec header */
 
-int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
+int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
 {
        int offset, offset_seq;
 
@@ -62,7 +62,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
        case IPPROTO_COMP:
                if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr)))
                        return -EINVAL;
-               *spi = htonl(ntohs(*(u16*)(skb->h.raw + 2)));
+               *spi = htonl(ntohs(*(__be16*)(skb->h.raw + 2)));
                *seq = 0;
                return 0;
        default:
@@ -72,8 +72,8 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
        if (!pskb_may_pull(skb, 16))
                return -EINVAL;
 
-       *spi = *(u32*)(skb->h.raw + offset);
-       *seq = *(u32*)(skb->h.raw + offset_seq);
+       *spi = *(__be32*)(skb->h.raw + offset);
+       *seq = *(__be32*)(skb->h.raw + offset_seq);
        return 0;
 }
 EXPORT_SYMBOL(xfrm_parse_spi);
index 9f63edd39346538252f07a40b5925850e61f1511..f927b7330f025cca4c05ed0dd7157edd2723924e 100644 (file)
@@ -70,7 +70,7 @@ static inline unsigned int xfrm_src_hash(xfrm_address_t *addr,
 }
 
 static inline unsigned int
-xfrm_spi_hash(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family)
+xfrm_spi_hash(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family)
 {
        return __xfrm_spi_hash(daddr, spi, proto, family, xfrm_state_hmask);
 }
@@ -96,9 +96,12 @@ static void xfrm_hash_transfer(struct hlist_head *list,
                                    nhashmask);
                hlist_add_head(&x->bysrc, nsrctable+h);
 
-               h = __xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto,
-                                   x->props.family, nhashmask);
-               hlist_add_head(&x->byspi, nspitable+h);
+               if (x->id.spi) {
+                       h = __xfrm_spi_hash(&x->id.daddr, x->id.spi,
+                                           x->id.proto, x->props.family,
+                                           nhashmask);
+                       hlist_add_head(&x->byspi, nspitable+h);
+               }
        }
 }
 
@@ -421,7 +424,7 @@ xfrm_init_tempsel(struct xfrm_state *x, struct flowi *fl,
        return 0;
 }
 
-static struct xfrm_state *__xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family)
+static struct xfrm_state *__xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family)
 {
        unsigned int h = xfrm_spi_hash(daddr, spi, proto, family);
        struct xfrm_state *x;
@@ -622,7 +625,7 @@ static void __xfrm_state_insert(struct xfrm_state *x)
        h = xfrm_src_hash(&x->props.saddr, x->props.family);
        hlist_add_head(&x->bysrc, xfrm_state_bysrc+h);
 
-       if (xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY)) {
+       if (x->id.spi) {
                h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto,
                                  x->props.family);
 
@@ -916,7 +919,7 @@ err:
 EXPORT_SYMBOL(xfrm_state_check);
 
 struct xfrm_state *
-xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto,
+xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto,
                  unsigned short family)
 {
        struct xfrm_state *x;
@@ -1040,7 +1043,7 @@ u32 xfrm_get_acqseq(void)
 EXPORT_SYMBOL(xfrm_get_acqseq);
 
 void
-xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
+xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi)
 {
        unsigned int h;
        struct xfrm_state *x0;
@@ -1057,10 +1060,10 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
                x->id.spi = minspi;
        } else {
                u32 spi = 0;
-               minspi = ntohl(minspi);
-               maxspi = ntohl(maxspi);
-               for (h=0; h<maxspi-minspi+1; h++) {
-                       spi = minspi + net_random()%(maxspi-minspi+1);
+               u32 low = ntohl(minspi);
+               u32 high = ntohl(maxspi);
+               for (h=0; h<high-low+1; h++) {
+                       spi = low + net_random()%(high-low+1);
                        x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family);
                        if (x0 == NULL) {
                                x->id.spi = htonl(spi);
@@ -1180,11 +1183,10 @@ static void xfrm_replay_timer_handler(unsigned long data)
        spin_unlock(&x->lock);
 }
 
-int xfrm_replay_check(struct xfrm_state *x, u32 seq)
+int xfrm_replay_check(struct xfrm_state *x, __be32 net_seq)
 {
        u32 diff;
-
-       seq = ntohl(seq);
+       u32 seq = ntohl(net_seq);
 
        if (unlikely(seq == 0))
                return -EINVAL;
@@ -1206,11 +1208,10 @@ int xfrm_replay_check(struct xfrm_state *x, u32 seq)
 }
 EXPORT_SYMBOL(xfrm_replay_check);
 
-void xfrm_replay_advance(struct xfrm_state *x, u32 seq)
+void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq)
 {
        u32 diff;
-
-       seq = ntohl(seq);
+       u32 seq = ntohl(net_seq);
 
        if (seq > x->replay.seq) {
                diff = seq - x->replay.seq;
index cb02baa63256ba691501ac65ddea70cadb1112c4..4ab6cbf092256bad17214ae86529de37c93efd95 100644 (file)
@@ -177,6 +177,7 @@ void find_export_symbols(char * filename)
                {
                        fprintf(stderr, "docproc: ");
                        perror(real_filename);
+                       exit(1);
                }
                while(fgets(line, MAXLINESZ, fp)) {
                        char *p;
index 67785df264e511c83550455240f633dc99cc3483..460e5c9cf496c725b830d8f34bc8dcf0bd8bff56 100644 (file)
@@ -93,18 +93,6 @@ config SECURITY_ROOTPLUG
          
          If you are unsure how to answer this question, answer N.
 
-config SECURITY_SECLVL
-       tristate "BSD Secure Levels"
-       depends on SECURITY
-       select CRYPTO
-       select CRYPTO_SHA1
-       help
-         Implements BSD Secure Levels as an LSM.  See
-         <file:Documentation/seclvl.txt> for instructions on how to use this
-         module.
-
-         If you are unsure how to answer this question, answer N.
-
 source security/selinux/Kconfig
 
 endmenu
index 8cbbf2f3670987d47e823b11b27be3b487735698..ef87df2f50a454ac0f9c5aedeb235b347a2706b4 100644 (file)
@@ -16,4 +16,3 @@ obj-$(CONFIG_SECURITY)                        += security.o dummy.o inode.o
 obj-$(CONFIG_SECURITY_SELINUX)         += selinux/built-in.o
 obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o
 obj-$(CONFIG_SECURITY_ROOTPLUG)                += commoncap.o root_plug.o
-obj-$(CONFIG_SECURITY_SECLVL)          += seclvl.o
index f50fc298cf801991879bee1de094dd56671562c3..5a5ef5ca7ea97eb9a2ef3901e3faff71fcaefcc6 100644 (file)
@@ -169,7 +169,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
        /* For init, we want to retain the capabilities set
         * in the init_task struct. Thus we skip the usual
         * capability rules */
-       if (current->pid != 1) {
+       if (!is_init(current)) {
                current->cap_permitted = new_permitted;
                current->cap_effective =
                    cap_intersect (new_permitted, bprm->cap_effective);
diff --git a/security/seclvl.c b/security/seclvl.c
deleted file mode 100644 (file)
index 8f62919..0000000
+++ /dev/null
@@ -1,671 +0,0 @@
-/**
- * BSD Secure Levels LSM
- *
- * Maintainers:
- *     Michael A. Halcrow <mike@halcrow.us>
- *     Serge Hallyn <hallyn@cs.wm.edu>
- *
- * Copyright (c) 2001 WireX Communications, Inc <chris@wirex.com>
- * Copyright (c) 2001 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (c) 2002 International Business Machines <robb@austin.ibm.com>
- * Copyright (c) 2006 Davi E. M. Arnaut <davi.arnaut@gmail.com>
- *
- *     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.
- */
-
-#include <linux/err.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/security.h>
-#include <linux/netlink.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/mount.h>
-#include <linux/capability.h>
-#include <linux/time.h>
-#include <linux/proc_fs.h>
-#include <linux/kobject.h>
-#include <linux/crypto.h>
-#include <asm/scatterlist.h>
-#include <linux/scatterlist.h>
-#include <linux/gfp.h>
-#include <linux/sysfs.h>
-
-#define SHA1_DIGEST_SIZE 20
-
-/**
- * Module parameter that defines the initial secure level.
- *
- * When built as a module, it defaults to seclvl 1, which is the
- * behavior of BSD secure levels.  Note that this default behavior
- * wrecks havoc on a machine when the seclvl module is compiled into
- * the kernel. In that case, we default to seclvl 0.
- */
-#ifdef CONFIG_SECURITY_SECLVL_MODULE
-static int initlvl = 1;
-#else
-static int initlvl;
-#endif
-module_param(initlvl, int, 0);
-MODULE_PARM_DESC(initlvl, "Initial secure level (defaults to 1)");
-
-/* Module parameter that defines the verbosity level */
-static int verbosity;
-module_param(verbosity, int, 0);
-MODULE_PARM_DESC(verbosity, "Initial verbosity level (0 or 1; defaults to "
-                "0, which is Quiet)");
-
-/**
- * Optional password which can be passed in to bring seclvl to 0
- * (i.e., for halt/reboot).  Defaults to NULL (the passwd attribute
- * file will not be registered in sysfs).
- *
- * This gets converted to its SHA1 hash when stored.  It's probably
- * not a good idea to use this parameter when loading seclvl from a
- * script; use sha1_passwd instead.
- */
-
-#define MAX_PASSWD_SIZE        32
-static char passwd[MAX_PASSWD_SIZE];
-module_param_string(passwd, passwd, sizeof(passwd), 0);
-MODULE_PARM_DESC(passwd,
-                "Plaintext of password that sets seclvl=0 when written to "
-                "(sysfs mount point)/seclvl/passwd\n");
-
-/**
- * SHA1 hashed version of the optional password which can be passed in
- * to bring seclvl to 0 (i.e., for halt/reboot).  Must be in
- * hexadecimal format (40 characters). Defaults to NULL (the passwd
- * attribute file will not be registered in sysfs).
- *
- * Use the sha1sum utility to generate the SHA1 hash of a password:
- *
- * echo -n "secret" | sha1sum
- */
-#define MAX_SHA1_PASSWD        41
-static char sha1_passwd[MAX_SHA1_PASSWD];
-module_param_string(sha1_passwd, sha1_passwd, sizeof(sha1_passwd), 0);
-MODULE_PARM_DESC(sha1_passwd,
-                "SHA1 hash (40 hexadecimal characters) of password that "
-                "sets seclvl=0 when plaintext password is written to "
-                "(sysfs mount point)/seclvl/passwd\n");
-
-static int hideHash = 1;
-module_param(hideHash, int, 0);
-MODULE_PARM_DESC(hideHash, "When set to 0, reading seclvl/passwd from sysfs "
-                "will return the SHA1-hashed value of the password that "
-                "lowers the secure level to 0.\n");
-
-#define MY_NAME "seclvl"
-
-/**
- * This time-limits log writes to one per second.
- */
-#define seclvl_printk(verb, type, fmt, arg...)                 \
-       do {                                                    \
-               if (verbosity >= verb) {                        \
-                       static unsigned long _prior;            \
-                       unsigned long _now = jiffies;           \
-                       if ((_now - _prior) > HZ) {             \
-                               printk(type "%s: %s: " fmt,     \
-                                       MY_NAME, __FUNCTION__ , \
-                                       ## arg);                \
-                               _prior = _now;                  \
-                       }                                       \
-               }                                               \
-       } while (0)
-
-/**
- * The actual security level.  Ranges between -1 and 2 inclusive.
- */
-static int seclvl;
-
-/**
- * flag to keep track of how we were registered
- */
-static int secondary;
-
-/**
- * Verifies that the requested secure level is valid, given the current
- * secure level.
- */
-static int seclvl_sanity(int reqlvl)
-{
-       if ((reqlvl < -1) || (reqlvl > 2)) {
-               seclvl_printk(1, KERN_WARNING, "Attempt to set seclvl out of "
-                             "range: [%d]\n", reqlvl);
-               return -EINVAL;
-       }
-       if ((seclvl == 0) && (reqlvl == -1))
-               return 0;
-       if (reqlvl < seclvl) {
-               seclvl_printk(1, KERN_WARNING, "Attempt to lower seclvl to "
-                             "[%d]\n", reqlvl);
-               return -EPERM;
-       }
-       return 0;
-}
-
-/**
- * security level advancement rules:
- *   Valid levels are -1 through 2, inclusive.
- *   From -1, stuck.  [ in case compiled into kernel ]
- *   From 0 or above, can only increment.
- */
-static void do_seclvl_advance(void *data, u64 val)
-{
-       int ret;
-       int newlvl = (int)val;
-
-       ret = seclvl_sanity(newlvl);
-       if (ret)
-               return;
-
-       if (newlvl > 2) {
-               seclvl_printk(1, KERN_WARNING, "Cannot advance to seclvl "
-                             "[%d]\n", newlvl);
-               return;
-       }
-       if (seclvl == -1) {
-               seclvl_printk(1, KERN_WARNING, "Not allowed to advance to "
-                             "seclvl [%d]\n", seclvl);
-               return;
-       }
-       seclvl = newlvl;  /* would it be more "correct" to set *data? */
-       return;
-}
-
-static u64 seclvl_int_get(void *data)
-{
-       return *(int *)data;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(seclvl_file_ops, seclvl_int_get, do_seclvl_advance, "%lld\n");
-
-static unsigned char hashedPassword[SHA1_DIGEST_SIZE];
-
-/**
- * Converts a block of plaintext of into its SHA1 hashed value.
- *
- * It would be nice if crypto had a wrapper to do this for us linear
- * people...
- */
-static int
-plaintext_to_sha1(unsigned char *hash, const char *plaintext, unsigned int len)
-{
-       struct hash_desc desc;
-       struct scatterlist sg;
-       int err;
-
-       if (len > PAGE_SIZE) {
-               seclvl_printk(0, KERN_ERR, "Plaintext password too large (%d "
-                             "characters).  Largest possible is %lu "
-                             "bytes.\n", len, PAGE_SIZE);
-               return -EINVAL;
-       }
-       desc.tfm = crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC);
-       if (IS_ERR(desc.tfm)) {
-               seclvl_printk(0, KERN_ERR,
-                             "Failed to load transform for SHA1\n");
-               return -EINVAL;
-       }
-       sg_init_one(&sg, (u8 *)plaintext, len);
-       desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
-       err = crypto_hash_digest(&desc, &sg, len, hash);
-       crypto_free_hash(desc.tfm);
-       return err;
-}
-
-/**
- * Called whenever the user writes to the sysfs passwd handle to this kernel
- * object.  It hashes the password and compares the hashed results.
- */
-static ssize_t
-passwd_write_file(struct file * file, const char __user * buf,
-                               size_t count, loff_t *ppos)
-{
-       char *p;
-       int len;
-       unsigned char tmp[SHA1_DIGEST_SIZE];
-
-       if (!*passwd && !*sha1_passwd) {
-               seclvl_printk(0, KERN_ERR, "Attempt to password-unlock the "
-                             "seclvl module, but neither a plain text "
-                             "password nor a SHA1 hashed password was "
-                             "passed in as a module parameter!  This is a "
-                             "bug, since it should not be possible to be in "
-                             "this part of the module; please tell a "
-                             "maintainer about this event.\n");
-               return -EINVAL;
-       }
-
-       if (count >= PAGE_SIZE)
-               return -EINVAL;
-       if (*ppos != 0)
-               return -EINVAL;
-       p = kmalloc(count, GFP_KERNEL);
-       if (!p)
-               return -ENOMEM;
-       len = -EFAULT;
-       if (copy_from_user(p, buf, count))
-               goto out;
-       
-       len = count;
-       /* ``echo "secret" > seclvl/passwd'' includes a newline */
-       if (p[len - 1] == '\n')
-               len--;
-       /* Hash the password, then compare the hashed values */
-       if ((len = plaintext_to_sha1(tmp, p, len))) {
-               seclvl_printk(0, KERN_ERR, "Error hashing password: rc = "
-                             "[%d]\n", len);
-               goto out;
-       }
-
-       len = -EPERM;
-       if (memcmp(hashedPassword, tmp, SHA1_DIGEST_SIZE))
-               goto out;
-
-       seclvl_printk(0, KERN_INFO,
-                     "Password accepted; seclvl reduced to 0.\n");
-       seclvl = 0;
-       len = count;
-
-out:
-       kfree (p);
-       return len;
-}
-
-static struct file_operations passwd_file_ops = {
-       .write = passwd_write_file,
-};
-
-/**
- * Explicitely disallow ptrace'ing the init process.
- */
-static int seclvl_ptrace(struct task_struct *parent, struct task_struct *child)
-{
-       if (seclvl >= 0 && child->pid == 1) {
-               seclvl_printk(1, KERN_WARNING, "Attempt to ptrace "
-                             "the init process dissallowed in "
-                             "secure level %d\n", seclvl);
-               return -EPERM;
-       }
-       return 0;
-}
-
-/**
- * Capability checks for seclvl.  The majority of the policy
- * enforcement for seclvl takes place here.
- */
-static int seclvl_capable(struct task_struct *tsk, int cap)
-{
-       int rc = 0;
-
-       /* init can do anything it wants */
-       if (tsk->pid == 1)
-               return 0;
-
-       if (seclvl > 0) {
-               rc = -EPERM;
-
-               if (cap == CAP_LINUX_IMMUTABLE)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to modify "
-                                     "the IMMUTABLE and/or APPEND extended "
-                                     "attribute on a file with the IMMUTABLE "
-                                     "and/or APPEND extended attribute set "
-                                     "denied in seclvl [%d]\n", seclvl);
-               else if (cap == CAP_SYS_RAWIO)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to perform "
-                                     "raw I/O while in secure level [%d] "
-                                     "denied\n", seclvl);
-               else if (cap == CAP_NET_ADMIN)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to perform "
-                                     "network administrative task while "
-                                     "in secure level [%d] denied\n", seclvl);
-               else if (cap == CAP_SETUID)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to setuid "
-                                     "while in secure level [%d] denied\n",
-                                     seclvl);
-               else if (cap == CAP_SETGID)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to setgid "
-                                     "while in secure level [%d] denied\n",
-                                     seclvl);
-               else if (cap == CAP_SYS_MODULE)
-                       seclvl_printk(1, KERN_WARNING, "Attempt to perform "
-                                     "a module operation while in secure "
-                                     "level [%d] denied\n", seclvl);
-               else
-                       rc = 0;
-       }
-
-       if (!rc) {
-               if (!(cap_is_fs_cap(cap) ? tsk->fsuid == 0 : tsk->euid == 0))
-                       rc = -EPERM;
-       }
-
-       if (rc)
-               seclvl_printk(1, KERN_WARNING, "Capability denied\n");
-
-       return rc;
-}
-
-/**
- * Disallow reversing the clock in seclvl > 1
- */
-static int seclvl_settime(struct timespec *tv, struct timezone *tz)
-{
-       if (tv && seclvl > 1) {
-               struct timespec now;
-               now = current_kernel_time();
-               if (tv->tv_sec < now.tv_sec ||
-                   (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {
-                       seclvl_printk(1, KERN_WARNING, "Attempt to decrement "
-                                     "time in secure level %d denied: "
-                                     "current->pid = [%d], "
-                                     "current->group_leader->pid = [%d]\n",
-                                     seclvl, current->pid,
-                                     current->group_leader->pid);
-                       return -EPERM;
-               }               /* if attempt to decrement time */
-       }                       /* if seclvl > 1 */
-       return 0;
-}
-
-/* claim the blockdev to exclude mounters, release on file close */
-static int seclvl_bd_claim(struct inode *inode)
-{
-       int holder;
-       struct block_device *bdev = NULL;
-       dev_t dev = inode->i_rdev;
-       bdev = open_by_devnum(dev, FMODE_WRITE);
-       if (bdev) {
-               if (bd_claim(bdev, &holder)) {
-                       blkdev_put(bdev);
-                       return -EPERM;
-               }
-               /* claimed, mark it to release on close */
-               inode->i_security = current;
-       }
-       return 0;
-}
-
-/* release the blockdev if you claimed it */
-static void seclvl_bd_release(struct inode *inode)
-{
-       if (inode && S_ISBLK(inode->i_mode) && inode->i_security == current) {
-               struct block_device *bdev = inode->i_bdev;
-               if (bdev) {
-                       bd_release(bdev);
-                       blkdev_put(bdev);
-                       inode->i_security = NULL;
-               }
-       }
-}
-
-/**
- * Security for writes to block devices is regulated by this seclvl
- * function.  Deny all writes to block devices in seclvl 2.  In
- * seclvl 1, we only deny writes to *mounted* block devices.
- */
-static int
-seclvl_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
-{
-       if (current->pid != 1 && S_ISBLK(inode->i_mode) && (mask & MAY_WRITE)) {
-               switch (seclvl) {
-               case 2:
-                       seclvl_printk(1, KERN_WARNING, "Write to block device "
-                                     "denied in secure level [%d]\n", seclvl);
-                       return -EPERM;
-               case 1:
-                       if (seclvl_bd_claim(inode)) {
-                               seclvl_printk(1, KERN_WARNING,
-                                             "Write to mounted block device "
-                                             "denied in secure level [%d]\n",
-                                             seclvl);
-                               return -EPERM;
-                       }
-               }
-       }
-       return 0;
-}
-
-/**
- * The SUID and SGID bits cannot be set in seclvl >= 1
- */
-static int seclvl_inode_setattr(struct dentry *dentry, struct iattr *iattr)
-{
-       if (seclvl > 0) {
-               if (iattr->ia_valid & ATTR_MODE)
-                       if (iattr->ia_mode & S_ISUID ||
-                           iattr->ia_mode & S_ISGID) {
-                               seclvl_printk(1, KERN_WARNING, "Attempt to "
-                                             "modify SUID or SGID bit "
-                                             "denied in seclvl [%d]\n",
-                                             seclvl);
-                               return -EPERM;
-                       }
-       }
-       return 0;
-}
-
-/* release busied block devices */
-static void seclvl_file_free_security(struct file *filp)
-{
-       struct dentry *dentry = filp->f_dentry;
-
-       if (dentry)
-               seclvl_bd_release(dentry->d_inode);
-}
-
-/**
- * Cannot unmount in secure level 2
- */
-static int seclvl_umount(struct vfsmount *mnt, int flags)
-{
-       if (current->pid != 1 && seclvl == 2) {
-               seclvl_printk(1, KERN_WARNING, "Attempt to unmount in secure "
-                             "level %d\n", seclvl);
-               return -EPERM;
-       }
-       return 0;
-}
-
-static struct security_operations seclvl_ops = {
-       .ptrace = seclvl_ptrace,
-       .capable = seclvl_capable,
-       .inode_permission = seclvl_inode_permission,
-       .inode_setattr = seclvl_inode_setattr,
-       .file_free_security = seclvl_file_free_security,
-       .settime = seclvl_settime,
-       .sb_umount = seclvl_umount,
-};
-
-/**
- * Process the password-related module parameters
- */
-static int processPassword(void)
-{
-       int rc = 0;
-       if (*passwd) {
-               char *p;
-
-               if (*sha1_passwd) {
-                       seclvl_printk(0, KERN_ERR, "Error: Both "
-                                     "passwd and sha1_passwd "
-                                     "were set, but they are mutually "
-                                     "exclusive.\n");
-                       return -EINVAL;
-               }
-
-               p = kstrdup(passwd, GFP_KERNEL);
-               if (p == NULL)
-                       return -ENOMEM;
-
-               if ((rc = plaintext_to_sha1(hashedPassword, p, strlen(p))))
-                       seclvl_printk(0, KERN_ERR, "Error: SHA1 support not "
-                                     "in kernel\n");
-
-               kfree (p);
-               /* All static data goes to the BSS, which zero's the
-                * plaintext password out for us. */
-       } else if (*sha1_passwd) {      // Base 16
-               int i;
-               i = strlen(sha1_passwd);
-               if (i != (SHA1_DIGEST_SIZE * 2)) {
-                       seclvl_printk(0, KERN_ERR, "Received [%d] bytes; "
-                                     "expected [%d] for the hexadecimal "
-                                     "representation of the SHA1 hash of "
-                                     "the password.\n",
-                                     i, (SHA1_DIGEST_SIZE * 2));
-                       return -EINVAL;
-               }
-               while ((i -= 2) + 2) {
-                       unsigned char tmp;
-                       tmp = sha1_passwd[i + 2];
-                       sha1_passwd[i + 2] = '\0';
-                       hashedPassword[i / 2] = (unsigned char)
-                           simple_strtol(&sha1_passwd[i], NULL, 16);
-                       sha1_passwd[i + 2] = tmp;
-               }
-       }
-       return rc;
-}
-
-/**
- * securityfs registrations
- */
-struct dentry *dir_ino, *seclvl_ino, *passwd_ino;
-
-static int seclvlfs_register(void)
-{
-       int rc = 0;
-
-       dir_ino = securityfs_create_dir("seclvl", NULL);
-
-       if (IS_ERR(dir_ino))
-               return PTR_ERR(dir_ino);
-
-       seclvl_ino = securityfs_create_file("seclvl", S_IRUGO | S_IWUSR,
-                               dir_ino, &seclvl, &seclvl_file_ops);
-       if (IS_ERR(seclvl_ino)) {
-               rc = PTR_ERR(seclvl_ino);
-               goto out_deldir;
-       }
-       if (*passwd || *sha1_passwd) {
-               passwd_ino = securityfs_create_file("passwd", S_IRUGO | S_IWUSR,
-                               dir_ino, NULL, &passwd_file_ops);
-               if (IS_ERR(passwd_ino)) {
-                       rc = PTR_ERR(passwd_ino);
-                       goto out_delf;
-               }
-       }
-       return rc;
-
-out_delf:
-       securityfs_remove(seclvl_ino);
-
-out_deldir:
-       securityfs_remove(dir_ino);
-
-       return rc;
-}
-
-static void seclvlfs_unregister(void)
-{
-       securityfs_remove(seclvl_ino);
-
-       if (*passwd || *sha1_passwd)
-               securityfs_remove(passwd_ino);
-
-       securityfs_remove(dir_ino);
-}
-
-/**
- * Initialize the seclvl module.
- */
-static int __init seclvl_init(void)
-{
-       int rc = 0;
-       static char once;
-
-       if (verbosity < 0 || verbosity > 1) {
-               printk(KERN_ERR "Error: bad verbosity [%d]; only 0 or 1 "
-                      "are valid values\n", verbosity);
-               rc = -EINVAL;
-               goto exit;
-       }
-       if (initlvl < -1 || initlvl > 2) {
-               seclvl_printk(0, KERN_ERR, "Error: bad initial securelevel "
-                             "[%d].\n", initlvl);
-               rc = -EINVAL;
-               goto exit;
-       }
-       seclvl = initlvl;
-       if ((rc = processPassword())) {
-               seclvl_printk(0, KERN_ERR, "Error processing the password "
-                             "module parameter(s): rc = [%d]\n", rc);
-               goto exit;
-       }
-
-       if ((rc = seclvlfs_register())) {
-               seclvl_printk(0, KERN_ERR, "Error registering with sysfs\n");
-               goto exit;
-       }
-       /* register ourselves with the security framework */
-       if (register_security(&seclvl_ops)) {
-               seclvl_printk(0, KERN_ERR,
-                             "seclvl: Failure registering with the "
-                             "kernel.\n");
-               /* try registering with primary module */
-               rc = mod_reg_security(MY_NAME, &seclvl_ops);
-               if (rc) {
-                       seclvl_printk(0, KERN_ERR, "seclvl: Failure "
-                                     "registering with primary security "
-                                     "module.\n");
-                       seclvlfs_unregister();
-                       goto exit;
-               }               /* if primary module registered */
-               secondary = 1;
-       }                       /* if we registered ourselves with the security framework */
-
-       seclvl_printk(0, KERN_INFO, "seclvl: Successfully initialized.\n");
-
-       if (once) {
-               once = 1;
-               seclvl_printk(0, KERN_INFO, "seclvl is going away. It has been "
-                               "buggy for ages. Also, be warned that "
-                               "Securelevels are useless.");
-       }
- exit:
-       if (rc)
-               printk(KERN_ERR "seclvl: Error during initialization: rc = "
-                      "[%d]\n", rc);
-       return rc;
-}
-
-/**
- * Remove the seclvl module.
- */
-static void __exit seclvl_exit(void)
-{
-       seclvlfs_unregister();
-
-       if (secondary)
-               mod_unreg_security(MY_NAME, &seclvl_ops);
-       else if (unregister_security(&seclvl_ops))
-               seclvl_printk(0, KERN_INFO,
-                             "seclvl: Failure unregistering with the "
-                             "kernel\n");
-}
-
-module_init(seclvl_init);
-module_exit(seclvl_exit);
-
-MODULE_AUTHOR("Michael A. Halcrow <mike@halcrow.us>");
-MODULE_DESCRIPTION("LSM implementation of the BSD Secure Levels");
-MODULE_LICENSE("GPL");
index e4d81a42fca4205f9faa8962caca88af01d9245d..cac0273ec447930d281074f5cd06985ff118e385 100644 (file)
@@ -398,7 +398,7 @@ static int try_context_mount(struct super_block *sb, void *data)
                /* Standard string-based options. */
                char *p, *options = data;
 
-               while ((p = strsep(&options, ",")) != NULL) {
+               while ((p = strsep(&options, "|")) != NULL) {
                        int token;
                        substring_t args[MAX_OPT_ARGS];
 
@@ -1923,18 +1923,40 @@ static inline void take_option(char **to, char *from, int *first, int len)
        if (!*first) {
                **to = ',';
                *to += 1;
-       }
-       else
+       } else
                *first = 0;
        memcpy(*to, from, len);
        *to += len;
 }
 
+static inline void take_selinux_option(char **to, char *from, int *first, 
+                                      int len)
+{
+       int current_size = 0;
+
+       if (!*first) {
+               **to = '|';
+               *to += 1;
+       }
+       else
+               *first = 0;
+
+       while (current_size < len) {
+               if (*from != '"') {
+                       **to = *from;
+                       *to += 1;
+               }
+               from += 1;
+               current_size += 1;
+       }
+}
+
 static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void *copy)
 {
        int fnosec, fsec, rc = 0;
        char *in_save, *in_curr, *in_end;
        char *sec_curr, *nosec_save, *nosec;
+       int open_quote = 0;
 
        in_curr = orig;
        sec_curr = copy;
@@ -1956,11 +1978,14 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void
        in_save = in_end = orig;
 
        do {
-               if (*in_end == ',' || *in_end == '\0') {
+               if (*in_end == '"')
+                       open_quote = !open_quote;
+               if ((*in_end == ',' && open_quote == 0) ||
+                               *in_end == '\0') {
                        int len = in_end - in_curr;
 
                        if (selinux_option(in_curr, len))
-                               take_option(&sec_curr, in_curr, &fsec, len);
+                               take_selinux_option(&sec_curr, in_curr, &fsec, len);
                        else
                                take_option(&nosec, in_curr, &fnosec, len);
 
index 1f60797afa8a42afa0a52ffdd8506d0a796cf75c..5f6bef57e825023dea13901a119d38bcd1a88c95 100644 (file)
@@ -2,6 +2,7 @@
 #
 
 obj-$(CONFIG_SOUND) += soundcore.o
+obj-$(CONFIG_SOUND_PRIME) += sound_firmware.o
 obj-$(CONFIG_SOUND_PRIME) += oss/
 obj-$(CONFIG_DMASOUND) += oss/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/
@@ -11,4 +12,4 @@ ifeq ($(CONFIG_SND),y)
   obj-y += last.o
 endif
 
-soundcore-objs  := sound_core.o sound_firmware.o
+soundcore-objs  := sound_core.o
index c31b38659221c4bfd4e141f60a6b85f5b89f1b8a..ff6e6fc198a18a2f20cd9276bcee6ce84e66102d 100644 (file)
@@ -258,7 +258,7 @@ au1000_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
 static unsigned int rates[] = {8000, 11025, 16000, 22050};
 static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
-       .count  =  sizeof(rates) / sizeof(rates[0]),
+       .count  = ARRAY_SIZE(rates),
        .list   = rates,
        .mask   = 0,
 };
diff --git a/sound/oss/COPYING b/sound/oss/COPYING
deleted file mode 100644 (file)
index 916d1f0..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-\f
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-\f
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-\f
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-\f
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-\f
-       Appendix: How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    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
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
index 5195bf933cb893dffb481ae646329cc11ce9a46c..3f81b79afbaaa23145d429ce482b39a09ffbed94 100644 (file)
@@ -96,7 +96,7 @@
 #include <asm/dma.h>
 #include <asm/uaccess.h>
 
-#include "cs46xxpm-24.h"
+#include "cs46xxpm.h"
 #include "cs46xx_wrapper-24.h"
 #include "cs461x.h"
 
@@ -389,8 +389,10 @@ static int cs_hardware_init(struct cs_card *card);
 static int cs46xx_powerup(struct cs_card *card, unsigned int type);
 static int cs461x_powerdown(struct cs_card *card, unsigned int type, int suspendflag);
 static void cs461x_clear_serial_FIFOs(struct cs_card *card, int type);
+#ifdef CONFIG_PM
 static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state);
 static int cs46xx_resume_tbl(struct pci_dev *pcidev);
+#endif
 
 #if CSDEBUG
 
@@ -5389,8 +5391,10 @@ static struct pci_driver cs46xx_pci_driver = {
        .id_table = cs46xx_pci_tbl,
        .probe    = cs46xx_probe,
        .remove   = __devexit_p(cs46xx_remove),
-       .suspend  = CS46XX_SUSPEND_TBL,
-       .resume   = CS46XX_RESUME_TBL,
+#ifdef CONFIG_PM
+       .suspend  = cs46xx_suspend_tbl,
+       .resume   = cs46xx_resume_tbl,
+#endif
 };
 
 static int __init cs46xx_init_module(void)
@@ -5420,7 +5424,7 @@ static void __exit cs46xx_cleanup_module(void)
 module_init(cs46xx_init_module);
 module_exit(cs46xx_cleanup_module);
 
-#if CS46XX_ACPI_SUPPORT
+#ifdef CONFIG_PM
 static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state)
 {
        struct cs_card *s = PCI_GET_DRIVER_DATA(pcidev);
diff --git a/sound/oss/cs46xxpm-24.h b/sound/oss/cs46xxpm-24.h
deleted file mode 100644 (file)
index ad82db8..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
-*
-*      "cs46xxpm-24.h" --  Cirrus Logic-Crystal CS46XX linux audio driver.
-*
-*      Copyright (C) 2000,2001  Cirrus Logic Corp.  
-*            -- tom woller (twoller@crystal.cirrus.com) or
-*               (pcaudio@crystal.cirrus.com).
-*
-*      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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*
-* 12/22/00 trw - new file. 
-*
-*******************************************************************************/
-#ifndef __CS46XXPM24_H
-#define __CS46XXPM24_H
-
-#include <linux/pm.h>
-#include "cs46xxpm.h"
-
-
-#define CS46XX_ACPI_SUPPORT 1
-#ifdef CS46XX_ACPI_SUPPORT
-/* 
-* for now (12/22/00) only enable the pm_register PM support.
-* allow these table entries to be null.
-*/
-static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state);
-static int cs46xx_resume_tbl(struct pci_dev *pcidev);
-#define CS46XX_SUSPEND_TBL cs46xx_suspend_tbl
-#define CS46XX_RESUME_TBL cs46xx_resume_tbl
-#else
-#define CS46XX_SUSPEND_TBL cs46xx_null
-#define CS46XX_RESUME_TBL cs46xx_null
-#endif
-
-#endif
index 2813e4c8e365aafb6bc6b364b671c8d2e4720b10..d4844de0c3b7200aa74cb3cab286c083c80e8d63 100644 (file)
@@ -488,10 +488,6 @@ static void ali_set_spdif_out_rate(struct trident_card *card, unsigned int rate)
 static void ali_enable_special_channel(struct trident_state *stat);
 static struct trident_channel *ali_alloc_rec_pcm_channel(struct trident_card *card);
 static struct trident_channel *ali_alloc_pcm_channel(struct trident_card *card);
-static void ali_restore_regs(struct trident_card *card);
-static void ali_save_regs(struct trident_card *card);
-static int trident_suspend(struct pci_dev *dev, pm_message_t unused);
-static int trident_resume(struct pci_dev *dev);
 static void ali_free_pcm_channel(struct trident_card *card, unsigned int channel);
 static int ali_setup_multi_channels(struct trident_card *card, int chan_nums);
 static unsigned int ali_get_spdif_in_rate(struct trident_card *card);
@@ -507,13 +503,6 @@ static int ali_allocate_other_states_resources(struct trident_state *state,
                                               int chan_nums);
 static void ali_free_other_states_resources(struct trident_state *state);
 
-/* save registers for ALi Power Management */
-static struct ali_saved_registers {
-       unsigned long global_regs[ALI_GLOBAL_REGS];
-       unsigned long channel_regs[ALI_CHANNELS][ALI_CHANNEL_REGS];
-       unsigned mixer_regs[ALI_MIXER_REGS];
-} ali_registers;
-
 #define seek_offset(dma_ptr, buffer, cnt, offset, copy_count)  do { \
         (dma_ptr) += (offset);   \
        (buffer) += (offset);     \
@@ -3653,6 +3642,14 @@ ali_allocate_other_states_resources(struct trident_state *state, int chan_nums)
        return 0;
 }
 
+#ifdef CONFIG_PM
+/* save registers for ALi Power Management */
+static struct ali_saved_registers {
+       unsigned long global_regs[ALI_GLOBAL_REGS];
+       unsigned long channel_regs[ALI_CHANNELS][ALI_CHANNEL_REGS];
+       unsigned mixer_regs[ALI_MIXER_REGS];
+} ali_registers;
+
 static void
 ali_save_regs(struct trident_card *card)
 {
@@ -3746,6 +3743,7 @@ trident_resume(struct pci_dev *dev)
        }
        return 0;
 }
+#endif
 
 static struct trident_channel *
 ali_alloc_pcm_channel(struct trident_card *card)
@@ -4616,8 +4614,10 @@ static struct pci_driver trident_pci_driver = {
        .id_table = trident_pci_tbl,
        .probe = trident_probe,
        .remove = __devexit_p(trident_remove),
+#ifdef CONFIG_PM
        .suspend = trident_suspend,
        .resume = trident_resume
+#endif
 };
 
 static int __init
index 62d4d0c812611e22227e064cfd43eb36583f70a4..0b0a016ca6d691563eac593634bc9dbdb3a39a7f 100644 (file)
@@ -551,10 +551,6 @@ int soundcore_open(struct inode *inode, struct file *file)
        return -ENODEV;
 }
 
-extern int mod_firmware_load(const char *, char **);
-EXPORT_SYMBOL(mod_firmware_load);
-
-
 MODULE_DESCRIPTION("Core sound module");
 MODULE_AUTHOR("Alan Cox");
 MODULE_LICENSE("GPL");
index 6ddadfac35adf0fc192a3627d659009456b14898..3a181d4c0dc6d3764f7da6ffdc878bb2023fe440 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
+#include "oss/sound_firmware.h"
 
 static int do_mod_firmware_load(const char *fn, char **fp)
 {
@@ -59,8 +60,7 @@ static int do_mod_firmware_load(const char *fn, char **fp)
  *     value zero on a failure.
  *
  *     Caution: This API is not recommended. Firmware should be loaded via
- *     an ioctl call and a setup application. This function may disappear
- *     in future.
+ *     request_firmware.
  */
  
 int mod_firmware_load(const char *fn, char **fp)
@@ -73,4 +73,6 @@ int mod_firmware_load(const char *fn, char **fp)
        set_fs(fs);
        return r;
 }
+EXPORT_SYMBOL(mod_firmware_load);
 
+MODULE_LICENSE("GPL");
index 8016541ec16d7d766a1e035b061a7038dd95cd87..5a97be689b401b11d057e45ac1d59f2d4b9ad9e4 100644 (file)
@@ -2412,8 +2412,6 @@ static struct snd_kcontrol_new dbri_controls[] __devinitdata = {
        CS4215_SINGLE("Mic boost", 4, 4, 1, 1)
 };
 
-#define NUM_CS4215_CONTROLS (sizeof(dbri_controls)/sizeof(struct snd_kcontrol_new))
-
 static int __init snd_dbri_mixer(struct snd_dbri * dbri)
 {
        struct snd_card *card;
@@ -2424,7 +2422,7 @@ static int __init snd_dbri_mixer(struct snd_dbri * dbri)
        card = dbri->card;
        strcpy(card->mixername, card->shortname);
 
-       for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(dbri_controls); idx++) {
                if ((err = snd_ctl_add(card,
                                snd_ctl_new1(&dbri_controls[idx], dbri))) < 0)
                        return err;