Merge 'staging-next' to Linus's tree
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Oct 2010 16:44:56 +0000 (09:44 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Oct 2010 16:44:56 +0000 (09:44 -0700)
This merges the staging-next tree to Linus's tree and resolves
some conflicts that were present due to changes in other trees that were
affected by files here.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
40 files changed:
1  2 
MAINTAINERS
arch/arm/mach-omap2/Makefile
arch/arm/plat-omap/common.c
arch/arm/plat-omap/devices.c
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/autofs/Kconfig
drivers/staging/autofs/root.c
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/drivers/cb_pcimdas.c
drivers/staging/comedi/drivers/ni_labpc.c
drivers/staging/comedi/drivers/rtd520.c
drivers/staging/crystalhd/crystalhd_lnx.c
drivers/staging/dream/pmem.c
drivers/staging/frontier/alphatrack.c
drivers/staging/frontier/tranzport.c
drivers/staging/hv/blkvsc_drv.c
drivers/staging/hv/netvsc_drv.c
drivers/staging/hv/storvsc_drv.c
drivers/staging/iio/industrialio-core.c
drivers/staging/iio/industrialio-ring.c
drivers/staging/lirc/lirc_imon.c
drivers/staging/lirc/lirc_sasem.c
drivers/staging/quickstart/quickstart.c
drivers/staging/smbfs/Kconfig
drivers/staging/smbfs/dir.c
drivers/staging/smbfs/inode.c
drivers/staging/smbfs/proc.c
drivers/staging/spectra/Kconfig
drivers/staging/tidspbridge/rmgr/drv_interface.c
drivers/staging/wlags49_h2/wl_main.c
drivers/staging/zram/zram_drv.c
fs/Kconfig
fs/Makefile
fs/compat.c
fs/compat_ioctl.c
include/linux/Kbuild
include/linux/tty.h

diff --combined MAINTAINERS
index 1e6b6bdf63403950bc7cc573971f2399fe2c94ec,ee8b2b4c6b38cff81d8bf9839acfcf6932cf2c34..ba9480edf8fd2233ca88d1f0bc600a6d839971a1
@@@ -157,11 -157,9 +157,11 @@@ S:       Maintaine
  F:    drivers/net/r8169.c
  
  8250/16?50 (AND CLONE UARTS) SERIAL DRIVER
 +M:    Greg Kroah-Hartman <gregkh@suse.de>
  L:    linux-serial@vger.kernel.org
  W:    http://serial.sourceforge.net
 -S:    Orphan
 +S:    Maintained
 +T:    quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
  F:    drivers/serial/8250*
  F:    include/linux/serial_8250.h
  
@@@ -243,6 -241,21 +243,6 @@@ F:        drivers/pnp/pnpacpi
  F:    include/linux/acpi.h
  F:    include/acpi/
  
 -ACPI BATTERY DRIVERS
 -M:    Alexey Starikovskiy <astarikovskiy@suse.de>
 -L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 -S:    Supported
 -F:    drivers/acpi/battery.c
 -F:    drivers/acpi/*sbs*
 -
 -ACPI EC DRIVER
 -M:    Alexey Starikovskiy <astarikovskiy@suse.de>
 -L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 -S:    Supported
 -F:    drivers/acpi/ec.c
 -
  ACPI FAN DRIVER
  M:    Zhang Rui <rui.zhang@intel.com>
  L:    linux-acpi@vger.kernel.org
@@@ -642,7 -655,7 +642,7 @@@ ARM/FARADAY FA526 POR
  M:    Hans Ulli Kroll <ulli.kroll@googlemail.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -T:    git://git.berlios.de/gemini-board
 +T:    git git://git.berlios.de/gemini-board
  F:    arch/arm/mm/*-fa*
  
  ARM/FOOTBRIDGE ARCHITECTURE
@@@ -657,7 -670,7 +657,7 @@@ ARM/FREESCALE IMX / MXC ARM ARCHITECTUR
  M:    Sascha Hauer <kernel@pengutronix.de>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -T:    git://git.pengutronix.de/git/imx/linux-2.6.git
 +T:    git git://git.pengutronix.de/git/imx/linux-2.6.git
  F:    arch/arm/mach-mx*/
  F:    arch/arm/plat-mxc/
  
@@@ -695,7 -708,8 +695,7 @@@ ARM/INCOME PXA270 SUPPOR
  M:    Marek Vasut <marek.vasut@gmail.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    arch/arm/mach-pxa/income.c
 -F:    arch/arm/mach-pxa/include/mach-pxa/income.h
 +F:    arch/arm/mach-pxa/colibri-pxa270-income.c
  
  ARM/INTEL IOP32X ARM ARCHITECTURE
  M:    Lennert Buytenhek <kernel@wantstofly.org>
@@@ -742,7 -756,13 +742,7 @@@ L:        linux-arm-kernel@lists.infradead.or
  S:    Maintained
  F:    arch/arm/mach-ixp4xx/
  
 -ARM/INTEL RESEARCH IMOTE 2 MACHINE SUPPORT
 -M:    Jonathan Cameron <jic23@cam.ac.uk>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -S:    Maintained
 -F:    arch/arm/mach-pxa/imote2.c
 -
 -ARM/INTEL RESEARCH STARGATE 2 MACHINE SUPPORT
 +ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT
  M:    Jonathan Cameron <jic23@cam.ac.uk>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
@@@ -907,37 -927,40 +907,37 @@@ W:      http://www.fluff.org/ben/linux
  S:    Maintained
  F:    arch/arm/mach-s3c2410/
  
 -ARM/S3C2440 ARM ARCHITECTURE
 +ARM/S3C244x ARM ARCHITECTURE
  M:    Ben Dooks <ben-linux@fluff.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  W:    http://www.fluff.org/ben/linux/
  S:    Maintained
  F:    arch/arm/mach-s3c2440/
 +F:    arch/arm/mach-s3c2443/
  
 -ARM/S3C2442 ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 -S:    Maintained
 -F:    arch/arm/mach-s3c2442/
 -
 -ARM/S3C2443 ARM ARCHITECTURE
 +ARM/S3C64xx ARM ARCHITECTURE
  M:    Ben Dooks <ben-linux@fluff.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  W:    http://www.fluff.org/ben/linux/
  S:    Maintained
 -F:    arch/arm/mach-s3c2443/
 +F:    arch/arm/mach-s3c64xx/
  
 -ARM/S3C6400 ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 +ARM/S5P ARM ARCHITECTURES
 +M:    Kukjin Kim <kgene.kim@samsung.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 +L:    linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
  S:    Maintained
 -F:    arch/arm/mach-s3c6400/
 +F:    arch/arm/mach-s5p*/
  
 -ARM/S3C6410 ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 +ARM/SAMSUNG S5P SERIES FIMC SUPPORT
 +M:    Kyungmin Park <kyungmin.park@samsung.com>
 +M:    Sylwester Nawrocki <s.nawrocki@samsung.com>
 +L:    linux-arm-kernel@lists.infradead.org
 +L:    linux-media@vger.kernel.org
  S:    Maintained
 -F:    arch/arm/mach-s3c6410/
 +F:    arch/arm/plat-s5p/dev-fimc*
 +F:    arch/arm/plat-samsung/include/plat/*fimc*
 +F:    drivers/media/video/s5p-fimc/
  
  ARM/SHMOBILE ARM ARCHITECTURE
  M:    Paul Mundt <lethal@linux-sh.org>
@@@ -950,23 -973,11 +950,23 @@@ S:      Supporte
  F:    arch/arm/mach-shmobile/
  F:    drivers/sh/
  
 +ARM/TELECHIPS ARM ARCHITECTURE
 +M:    "Hans J. Koch" <hjk@linutronix.de>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +S:    Maintained
 +F:    arch/arm/plat-tcc/
 +F:    arch/arm/mach-tcc8k/
 +
  ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
  M:    Lennert Buytenhek <kernel@wantstofly.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  
 +ARM/TETON BGA MACHINE SUPPORT
 +M:    Mark F. Brown <mark.brown314@gmail.com>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +S:    Maintained
 +
  ARM/THECUS N2100 MACHINE SUPPORT
  M:    Lennert Buytenhek <kernel@wantstofly.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -1109,13 -1120,6 +1109,13 @@@ W:    http://wireless.kernel.org/en/users/
  S:    Maintained
  F:    drivers/net/wireless/ath/ar9170/
  
 +CARL9170 LINUX COMMUNITY WIRELESS DRIVER
 +M:    Christian Lamparter <chunkeey@googlemail.com>
 +L:    linux-wireless@vger.kernel.org
 +W:    http://wireless.kernel.org/en/users/Drivers/carl9170
 +S:    Maintained
 +F:    drivers/net/wireless/ath/carl9170/
 +
  ATK0110 HWMON DRIVER
  M:    Luca Tettamanti <kronos.it@gmail.com>
  L:    lm-sensors@lm-sensors.org
@@@ -1131,7 -1135,7 +1131,7 @@@ ATLX ETHERNET DRIVER
  M:    Jay Cliburn <jcliburn@gmail.com>
  M:    Chris Snook <chris.snook@gmail.com>
  M:    Jie Yang <jie.yang@atheros.com>
 -L:    atl1-devel@lists.sourceforge.net
 +L:    netdev@vger.kernel.org
  W:    http://sourceforge.net/projects/atl1
  W:    http://atl1.sourceforge.net
  S:    Maintained
@@@ -1216,7 -1220,7 +1216,7 @@@ F:      drivers/auxdisplay
  F:    include/linux/cfag12864b.h
  
  AVR32 ARCHITECTURE
 -M:    Haavard Skinnemoen <hskinnemoen@atmel.com>
 +M:    Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
  W:    http://www.atmel.com/products/AVR32/
  W:    http://avr32linux.org/
  W:    http://avrfreaks.net/
@@@ -1224,7 -1228,7 +1224,7 @@@ S:      Supporte
  F:    arch/avr32/
  
  AVR32/AT32AP MACHINE SUPPORT
 -M:    Haavard Skinnemoen <hskinnemoen@atmel.com>
 +M:    Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
  S:    Supported
  F:    arch/avr32/mach-at32ap/
  
@@@ -1340,19 -1344,16 +1340,19 @@@ F:   drivers/mtd/devices/block2mtd.
  
  BLUETOOTH DRIVERS
  M:    Marcel Holtmann <marcel@holtmann.org>
 +M:    Gustavo F. Padovan <padovan@profusion.mobi>
  L:    linux-bluetooth@vger.kernel.org
  W:    http://www.bluez.org/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-2.6.git
  S:    Maintained
  F:    drivers/bluetooth/
  
  BLUETOOTH SUBSYSTEM
  M:    Marcel Holtmann <marcel@holtmann.org>
 +M:    Gustavo F. Padovan <padovan@profusion.mobi>
  L:    linux-bluetooth@vger.kernel.org
  W:    http://www.bluez.org/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-2.6.git
  S:    Maintained
  F:    net/bluetooth/
  F:    include/net/bluetooth/
@@@ -1391,19 -1392,20 +1391,27 @@@ L:   netdev@vger.kernel.or
  S:    Supported
  F:    drivers/net/tg3.*
  
+ BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
+ M:    Brett Rudley <brudley@broadcom.com>
+ M:    Henry Ptasinski <henryp@broadcom.com>
+ M:    Nohee Ko <noheek@broadcom.com>
+ L:    linux-wireless@vger.kernel.org
+ S:    Supported
+ F:    drivers/staging/brcm80211/
  BROCADE BFA FC SCSI DRIVER
  M:    Jing Huang <huangj@brocade.com>
  L:    linux-scsi@vger.kernel.org
  S:    Supported
  F:    drivers/scsi/bfa/
  
 +BROCADE BNA 10 GIGABIT ETHERNET DRIVER
 +M:    Rasesh Mody <rmody@brocade.com>
 +M:    Debashis Dutt <ddutt@brocade.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    drivers/net/bna/
 +
  BSG (block layer generic sg v4 driver)
  M:    FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
  L:    linux-scsi@vger.kernel.org
@@@ -1451,16 -1453,6 +1459,16 @@@ S:    Maintaine
  F:    Documentation/video4linux/cafe_ccic
  F:    drivers/media/video/cafe_ccic*
  
 +CAIF NETWORK LAYER
 +M:    Sjur Braendeland <sjur.brandeland@stericsson.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    Documentation/networking/caif/
 +F:    drivers/net/caif/
 +F:    include/linux/caif/
 +F:    include/net/caif/
 +F:    net/caif/
 +
  CALGARY x86-64 IOMMU
  M:    Muli Ben-Yehuda <muli@il.ibm.com>
  M:    "Jon D. Mason" <jdmason@kudzu.us>
@@@ -1516,12 -1508,11 +1524,12 @@@ T:   git git://git.kernel.org/pub/scm/lin
  S:    Supported
  F:    Documentation/filesystems/ceph.txt
  F:    fs/ceph
 +F:    net/ceph
 +F:    include/linux/ceph
  
  CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM:
 -M:    David Vrabel <david.vrabel@csr.com>
  L:    linux-usb@vger.kernel.org
 -S:    Supported
 +S:    Orphan
  F:    Documentation/usb/WUSB-Design-overview.txt
  F:    Documentation/usb/wusb-cbaf
  F:    drivers/usb/host/hwa-hc.c
@@@ -1560,9 -1551,9 +1568,9 @@@ S:      Supporte
  F:    scripts/checkpatch.pl
  
  CISCO VIC ETHERNET NIC DRIVER
 -M:    Scott Feldman <scofeldm@cisco.com>
  M:    Vasanthy Kolluri <vkolluri@cisco.com>
  M:    Roopa Prabhu <roprabhu@cisco.com>
 +M:    David Wang <dwang2@cisco.com>
  S:    Supported
  F:    drivers/net/enic/
  
@@@ -2040,16 -2031,14 +2048,16 @@@ F:   drivers/block/drbd
  F:    lib/lru_cache.c
  F:    Documentation/blockdev/drbd/
  
 -DRIVER CORE, KOBJECTS, AND SYSFS
 +DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
  M:    Greg Kroah-Hartman <gregkh@suse.de>
  T:    quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
  S:    Supported
  F:    Documentation/kobject.txt
  F:    drivers/base/
  F:    fs/sysfs/
 +F:    fs/debugfs/
  F:    include/linux/kobj*
 +F:    include/linux/debugfs.h
  F:    lib/kobj*
  
  DRM DRIVERS
@@@ -2060,15 -2049,6 +2068,15 @@@ S:    Maintaine
  F:    drivers/gpu/drm/
  F:    include/drm/
  
 +INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
 +M:    Chris Wilson <chris@chris-wilson.co.uk>
 +L:    intel-gfx@lists.freedesktop.org
 +L:    dri-devel@lists.freedesktop.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git
 +S:    Supported
 +F:    drivers/gpu/drm/i915
 +F:    include/drm/i915*
 +
  DSCC4 DRIVER
  M:    Francois Romieu <romieu@fr.zoreil.com>
  L:    netdev@vger.kernel.org
@@@ -2178,13 -2158,6 +2186,13 @@@ W:    bluesmoke.sourceforge.ne
  S:    Maintained
  F:    drivers/edac/i5400_edac.c
  
 +EDAC-I7300
 +M:    Mauro Carvalho Chehab <mchehab@redhat.com>
 +L:    linux-edac@vger.kernel.org
 +W:    bluesmoke.sourceforge.net
 +S:    Maintained
 +F:    drivers/edac/i7300_edac.c
 +
  EDAC-I7CORE
  M:    Mauro Carvalho Chehab <mchehab@redhat.com>
  L:    linux-edac@vger.kernel.org
@@@ -2224,12 -2197,6 +2232,12 @@@ W:    http://acpi4asus.sf.ne
  S:    Maintained
  F:    drivers/platform/x86/eeepc-laptop.c
  
 +EFIFB FRAMEBUFFER DRIVER
 +L:    linux-fbdev@vger.kernel.org
 +M:    Peter Jones <pjones@redhat.com>
 +S:    Maintained
 +F:    drivers/video/efifb.c
 +
  EFS FILESYSTEM
  W:    http://aeschi.ch.eu.org/efs/
  S:    Orphan
@@@ -2242,12 -2209,6 +2250,12 @@@ L:    linux-rdma@vger.kernel.or
  S:    Supported
  F:    drivers/infiniband/hw/ehca/
  
 +EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER
 +M:    Breno Leitao <leitao@linux.vnet.ibm.com>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/ehea/
 +
  EMBEDDED LINUX
  M:    Paul Gortmaker <paul.gortmaker@windriver.com>
  M:    Matt Mackall <mpm@selenic.com>
@@@ -2553,7 -2514,7 +2561,7 @@@ S:      Supporte
  F:    drivers/scsi/gdt*
  
  GENERIC GPIO I2C DRIVER
 -M:    Haavard Skinnemoen <hskinnemoen@atmel.com>
 +M:    Haavard Skinnemoen <hskinnemoen@gmail.com>
  S:    Supported
  F:    drivers/i2c/busses/i2c-gpio.c
  F:    include/linux/i2c-gpio.h
@@@ -2612,10 -2573,10 +2620,10 @@@ F:   drivers/net/greth
  
  HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
  M:    Frank Seidel <frank@f-seidel.de>
 -L:    lm-sensors@lm-sensors.org
 +L:    platform-driver-x86@vger.kernel.org
  W:    http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
  S:    Maintained
 -F:    drivers/hwmon/hdaps.c
 +F:    drivers/platform/x86/hdaps.c
  
  HWPOISON MEMORY FAILURE HANDLING
  M:    Andi Kleen <andi@firstfloor.org>
@@@ -2688,14 -2649,9 +2696,14 @@@ S:    Maintaine
  F:    drivers/media/video/gspca/
  
  HARDWARE MONITORING
 +M:    Jean Delvare <khali@linux-fr.org>
 +M:    Guenter Roeck <guenter.roeck@ericsson.com>
  L:    lm-sensors@lm-sensors.org
  W:    http://www.lm-sensors.org/
 -S:    Orphan
 +T:    quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/
 +T:    quilt kernel.org/pub/linux/kernel/people/groeck/linux-staging/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
 +S:    Maintained
  F:    Documentation/hwmon/
  F:    drivers/hwmon/
  F:    include/linux/hwmon*.h
@@@ -2833,6 -2789,11 +2841,6 @@@ S:     Maintaine
  F:    arch/x86/kernel/hpet.c
  F:    arch/x86/include/asm/hpet.h
  
 -HPET: ACPI
 -M:    Bob Picco <bob.picco@hp.com>
 -S:    Maintained
 -F:    drivers/char/hpet.c
 -
  HPFS FILESYSTEM
  M:    Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
  W:    http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi
@@@ -2912,12 -2873,6 +2920,12 @@@ M:    Brian King <brking@us.ibm.com
  S:    Supported
  F:    drivers/scsi/ipr.*
  
 +IBM Power Virtual Ethernet Device Driver
 +M:    Santiago Leon <santil@linux.vnet.ibm.com>
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +F:    drivers/net/ibmveth.*
 +
  IBM ServeRAID RAID DRIVER
  P:    Jack Hammer
  M:    Dave Jeffery <ipslinux@adaptec.com>
@@@ -2982,7 -2937,7 +2990,7 @@@ M:      Roland Dreier <rolandd@cisco.com
  M:    Sean Hefty <sean.hefty@intel.com>
  M:    Hal Rosenstock <hal.rosenstock@gmail.com>
  L:    linux-rdma@vger.kernel.org
 -W:    http://www.openib.org/
 +W:    http://www.openfabrics.org/
  Q:    http://patchwork.kernel.org/project/linux-rdma/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git
  S:    Supported
@@@ -3087,27 -3042,16 +3095,27 @@@ L:   netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/ixp2000/
  
 -INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe)
 +INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe/ixgbevf)
  M:    Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  M:    Jesse Brandeburg <jesse.brandeburg@intel.com>
  M:    Bruce Allan <bruce.w.allan@intel.com>
 -M:    Alex Duyck <alexander.h.duyck@intel.com>
 +M:    Carolyn Wyborny <carolyn.wyborny@intel.com>
 +M:    Don Skidmore <donald.c.skidmore@intel.com>
 +M:    Greg Rose <gregory.v.rose@intel.com>
  M:    PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
 +M:    Alex Duyck <alexander.h.duyck@intel.com>
  M:    John Ronciak <john.ronciak@intel.com>
  L:    e1000-devel@lists.sourceforge.net
  W:    http://e1000.sourceforge.net/
  S:    Supported
 +F:    Documentation/networking/e100.txt
 +F:    Documentation/networking/e1000.txt
 +F:    Documentation/networking/e1000e.txt
 +F:    Documentation/networking/igb.txt
 +F:    Documentation/networking/igbvf.txt
 +F:    Documentation/networking/ixgb.txt
 +F:    Documentation/networking/ixgbe.txt
 +F:    Documentation/networking/ixgbevf.txt
  F:    drivers/net/e100.c
  F:    drivers/net/e1000/
  F:    drivers/net/e1000e/
@@@ -3115,7 -3059,6 +3123,7 @@@ F:      drivers/net/igb
  F:    drivers/net/igbvf/
  F:    drivers/net/ixgb/
  F:    drivers/net/ixgbe/
 +F:    drivers/net/ixgbevf/
  
  INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT
  L:    linux-wireless@vger.kernel.org
@@@ -3176,7 -3119,7 +3184,7 @@@ F:      drivers/net/ioc3-eth.
  
  IOC3 SERIAL DRIVER
  M:    Pat Gefre <pfg@sgi.com>
 -L:    linux-mips@linux-mips.org
 +L:    linux-serial@vger.kernel.org
  S:    Maintained
  F:    drivers/serial/ioc3_serial.c
  
@@@ -3253,12 -3196,6 +3261,12 @@@ F:    drivers/net/irda
  F:    include/net/irda/
  F:    net/irda/
  
 +IRQ SUBSYSTEM
 +M:    Thomas Gleixner <tglx@linutronix.de>
 +S:    Maintained
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq/core
 +F:    kernel/irq/
 +
  ISAPNP
  M:    Jaroslav Kysela <perex@perex.cz>
  S:    Maintained
@@@ -3351,12 -3288,6 +3359,12 @@@ F:    fs/jbd*
  F:    include/linux/ext*jbd*.h
  F:    include/linux/jbd*.h
  
 +JSM Neo PCI based serial card
 +M:    Breno Leitao <leitao@linux.vnet.ibm.com>
 +L:    linux-serial@vger.kernel.org
 +S:    Maintained
 +F:    drivers/serial/jsm/
 +
  K8TEMP HARDWARE MONITORING DRIVER
  M:    Rudolf Marek <r.marek@assembler.cz>
  L:    lm-sensors@lm-sensors.org
@@@ -3383,8 -3314,8 +3391,8 @@@ F:      Documentation/kdump
  KERNEL AUTOMOUNTER (AUTOFS)
  M:    "H. Peter Anvin" <hpa@zytor.com>
  L:    autofs@linux.kernel.org
- S:    Odd Fixes
- F:    fs/autofs/
+ S:    Obsolete
+ F:    drivers/staging/autofs/
  
  KERNEL AUTOMOUNTER v4 (AUTOFS4)
  M:    Ian Kent <raven@themaw.net>
@@@ -3407,7 -3338,7 +3415,7 @@@ F:      scripts/package
  
  KERNEL JANITORS
  L:    kernel-janitors@vger.kernel.org
 -W:    http://janitor.kernelnewbies.org/
 +W:    http://kernelnewbies.org/KernelJanitors
  S:    Odd Fixes
  
  KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
@@@ -3475,7 -3406,7 +3483,7 @@@ F:      drivers/s390/kvm
  
  KEXEC
  M:    Eric Biederman <ebiederm@xmission.com>
 -W:    http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
 +W:    http://kernel.org/pub/linux/utils/kernel/kexec/
  L:    kexec@lists.infradead.org
  S:    Maintained
  F:    include/linux/kexec.h
@@@ -3732,13 -3663,6 +3740,13 @@@ L:    linux-scsi@vger.kernel.or
  S:    Maintained
  F:    drivers/scsi/sym53c8xx_2/
  
 +LTC4261 HARDWARE MONITOR DRIVER
 +M:    Guenter Roeck <linux@roeck-us.net>
 +L:    lm-sensors@lm-sensors.org
 +S:    Maintained
 +F:    Documentation/hwmon/ltc4261
 +F:    drivers/hwmon/ltc4261.c
 +
  LTP (Linux Test Project)
  M:    Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
  M:    Garrett Cooper <yanegomi@gmail.com>
@@@ -3834,7 -3758,7 +3842,7 @@@ F:      drivers/net/wireless/mwl8k.
  MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER
  M:    Nicolas Pitre <nico@fluxnic.net>
  S:    Odd Fixes
 -F: drivers/mmc/host/mvsdio.*
 +F:    drivers/mmc/host/mvsdio.*
  
  MARVELL YUKON / SYSKONNECT DRIVER
  M:    Mirko Lindner <mlindner@syskonnect.de>
@@@ -3843,8 -3767,9 +3851,8 @@@ W:      http://www.syskonnect.co
  S:    Supported
  
  MATROX FRAMEBUFFER DRIVER
 -M:    Petr Vandrovec <vandrove@vc.cvut.cz>
  L:    linux-fbdev@vger.kernel.org
 -S:    Maintained
 +S:    Orphan
  F:    drivers/video/matrox/matroxfb_*
  F:    include/linux/matroxfb.h
  
@@@ -3968,8 -3893,10 +3976,8 @@@ F:     Documentation/serial/moxa-smarti
  F:    drivers/char/mxser.*
  
  MSI LAPTOP SUPPORT
 -M:    Lennart Poettering <mzxreary@0pointer.de>
 +M:    Lee, Chun-Yi <jlee@novell.com>
  L:    platform-driver-x86@vger.kernel.org
 -W:    https://tango.0pointer.de/mailman/listinfo/s270-linux
 -W:    http://0pointer.de/lennart/tchibo.html
  S:    Maintained
  F:    drivers/platform/x86/msi-laptop.c
  
@@@ -3986,10 -3913,8 +3994,10 @@@ S:    Supporte
  F:    drivers/mfd/
  
  MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
 -S:    Orphan
 +M:    Chris Ball <cjb@laptop.org>
  L:    linux-mmc@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git
 +S:    Maintained
  F:    drivers/mmc/
  F:    include/linux/mmc/
  
@@@ -4006,12 -3931,13 +4014,12 @@@ F:   Documentation/sound/oss/MultiSoun
  F:    sound/oss/msnd*
  
  MULTITECH MULTIPORT CARD (ISICOM)
 -M:    Jiri Slaby <jirislaby@gmail.com>
 -S:    Maintained
 +S:    Orphan
  F:    drivers/char/isicom.c
  F:    include/linux/isicom.h
  
  MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
 -M:    Felipe Balbi <felipe.balbi@nokia.com>
 +M:    Felipe Balbi <balbi@ti.com>
  L:    linux-usb@vger.kernel.org
  T:    git git://gitorious.org/usb/usb.git
  S:    Maintained
@@@ -4031,8 -3957,8 +4039,8 @@@ S:      Maintaine
  F:    drivers/net/natsemi.c
  
  NCP FILESYSTEM
 -M:    Petr Vandrovec <vandrove@vc.cvut.cz>
 -S:    Maintained
 +M:    Petr Vandrovec <petr@vandrovec.name>
 +S:    Odd Fixes
  F:    fs/ncpfs/
  
  NCR DUAL 700 SCSI DRIVER (MICROCHANNEL)
@@@ -4309,7 -4235,7 +4317,7 @@@ S:      Maintaine
  F:    drivers/char/hw_random/omap-rng.c
  
  OMAP USB SUPPORT
 -M:    Felipe Balbi <felipe.balbi@nokia.com>
 +M:    Felipe Balbi <balbi@ti.com>
  M:    David Brownell <dbrownell@users.sourceforge.net>
  L:    linux-usb@vger.kernel.org
  L:    linux-omap@vger.kernel.org
@@@ -4395,12 -4321,13 +4403,12 @@@ F:   Documentation/filesystems/dlmfs.tx
  F:    fs/ocfs2/
  
  ORINOCO DRIVER
 -M:    Pavel Roskin <proski@gnu.org>
 -M:    David Gibson <hermes@gibson.dropbear.id.au>
  L:    linux-wireless@vger.kernel.org
  L:    orinoco-users@lists.sourceforge.net
  L:    orinoco-devel@lists.sourceforge.net
 +W:    http://linuxwireless.org/en/users/Drivers/orinoco
  W:    http://www.nongnu.org/orinoco/
 -S:    Maintained
 +S:    Orphan
  F:    drivers/net/wireless/orinoco/
  
  OSD LIBRARY and FILESYSTEM
@@@ -4433,22 -4360,13 +4441,22 @@@ L:   linux-i2c@vger.kernel.or
  S:    Maintained
  F:    drivers/i2c/busses/i2c-pasemi.c
  
 +PADATA PARALLEL EXECUTION MECHANISM
 +M:    Steffen Klassert <steffen.klassert@secunet.com>
 +L:    linux-kernel@vger.kernel.org
 +L:    linux-crypto@vger.kernel.org
 +S:    Maintained
 +F:    kernel/padata.c
 +F:    include/linux/padata.h
 +F:    Documentation/padata.txt
 +
  PANASONIC LAPTOP ACPI EXTRAS DRIVER
  M:    Harald Welte <laforge@gnumonks.org>
  L:    platform-driver-x86@vger.kernel.org
  S:    Maintained
  F:    drivers/platform/x86/panasonic-laptop.c
  
 -PANASONIC MN10300/AM33 PORT
 +PANASONIC MN10300/AM33/AM34 PORT
  M:    David Howells <dhowells@redhat.com>
  M:    Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
  L:    linux-am33-list@redhat.com (moderated for non-subscribers)
@@@ -4521,12 -4439,6 +4529,12 @@@ S:    Maintaine
  F:    drivers/leds/leds-pca9532.c
  F:    include/linux/leds-pca9532.h
  
 +PCA9541 I2C BUS MASTER SELECTOR DRIVER
 +M:    Guenter Roeck <guenter.roeck@ericsson.com>
 +L:    linux-i2c@vger.kernel.org
 +S:    Maintained
 +F:    drivers/i2c/muxes/pca9541.c
 +
  PCA9564/PCA9665 I2C BUS DRIVER
  M:    Wolfram Sang <w.sang@pengutronix.de>
  L:    linux-i2c@vger.kernel.org
@@@ -4575,13 -4487,6 +4583,13 @@@ L:    netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/pcnet32.c
  
 +PCRYPT PARALLEL CRYPTO ENGINE
 +M:    Steffen Klassert <steffen.klassert@secunet.com>
 +L:    linux-crypto@vger.kernel.org
 +S:    Maintained
 +F:    crypto/pcrypt.c
 +F:    include/crypto/pcrypt.h
 +
  PER-TASK DELAY ACCOUNTING
  M:    Balbir Singh <balbir@linux.vnet.ibm.com>
  S:    Maintained
@@@ -4610,14 -4515,6 +4618,14 @@@ L:    linux-abi-devel@lists.sourceforge.ne
  S:    Maintained
  F:    include/linux/personality.h
  
 +PHONET PROTOCOL
 +M:    Remi Denis-Courmont <remi.denis-courmont@nokia.com>
 +S:    Supported
 +F:    Documentation/networking/phonet.txt
 +F:    include/linux/phonet.h
 +F:    include/net/phonet/
 +F:    net/phonet/
 +
  PHRAM MTD DRIVER
  M:    Joern Engel <joern@lazybastard.org>
  L:    linux-mtd@lists.infradead.org
@@@ -4715,7 -4612,7 +4723,7 @@@ F:      include/linux/preempt.
  PRISM54 WIRELESS DRIVER
  M:    "Luis R. Rodriguez" <mcgrof@gmail.com>
  L:    linux-wireless@vger.kernel.org
 -W:    http://prism54.org
 +W:    http://wireless.kernel.org/en/users/Drivers/p54
  S:    Obsolete
  F:    drivers/net/wireless/prism54/
  
@@@ -4867,15 -4764,6 +4875,15 @@@ F:    fs/qnx4
  F:    include/linux/qnx4_fs.h
  F:    include/linux/qnxtypes.h
  
 +RADOS BLOCK DEVICE (RBD)
 +F:    include/linux/qnxtypes.h
 +M:    Yehuda Sadeh <yehuda@hq.newdream.net>
 +M:    Sage Weil <sage@newdream.net>
 +M:    ceph-devel@vger.kernel.org
 +S:    Supported
 +F:    drivers/block/rbd.c
 +F:    drivers/block/rbd_types.h
 +
  RADEON FRAMEBUFFER DISPLAY DRIVER
  M:    Benjamin Herrenschmidt <benh@kernel.crashing.org>
  L:    linux-fbdev@vger.kernel.org
@@@ -4925,7 -4813,6 +4933,7 @@@ RCUTORTURE MODUL
  M:    Josh Triplett <josh@freedesktop.org>
  M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
  S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
  F:    Documentation/RCU/torture.txt
  F:    kernel/rcutorture.c
  
@@@ -4950,7 -4837,6 +4958,7 @@@ M:      Dipankar Sarma <dipankar@in.ibm.com
  M:    "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
  W:    http://www.rdrop.com/users/paulmck/rclock/
  S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
  F:    Documentation/RCU/
  F:    include/linux/rcu*
  F:    include/linux/srcu*
@@@ -4958,10 -4844,12 +4966,10 @@@ F:   kernel/rcu
  F:    kernel/srcu*
  X:    kernel/rcutorture.c
  
 -REAL TIME CLOCK DRIVER
 +REAL TIME CLOCK DRIVER (LEGACY)
  M:    Paul Gortmaker <p_gortmaker@yahoo.com>
  S:    Maintained
 -F:    Documentation/rtc.txt
 -F:    drivers/rtc/
 -F:    include/linux/rtc.h
 +F:    drivers/char/rtc.c
  
  REAL TIME CLOCK (RTC) SUBSYSTEM
  M:    Alessandro Zummo <a.zummo@towertech.it>
@@@ -5101,12 -4989,6 +5109,12 @@@ F:    drivers/media/common/saa7146
  F:    drivers/media/video/*7146*
  F:    include/media/*7146*
  
 +SAMSUNG AUDIO (ASoC) DRIVERS
 +M:    Jassi Brar <jassi.brar@samsung.com>
 +L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
 +S:    Supported
 +F:    sound/soc/s3c24xx
 +
  TLG2300 VIDEO4LINUX-2 DRIVER
  M:    Huang Shijie <shijie8@gmail.com>
  M:    Kang Yong <kangyong@telegent.com>
@@@ -5140,16 -5022,6 +5148,16 @@@ W:    http://www.kernel.d
  S:    Maintained
  F:    drivers/scsi/sr*
  
 +SCSI RDMA PROTOCOL (SRP) INITIATOR
 +M:    David Dillow <dillowda@ornl.gov>
 +L:    linux-rdma@vger.kernel.org
 +S:    Supported
 +W:    http://www.openfabrics.org
 +Q:    http://patchwork.kernel.org/project/linux-rdma/list/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/dad/srp-initiator.git
 +F:    drivers/infiniband/ulp/srp/
 +F:    include/scsi/srp.h
 +
  SCSI SG DRIVER
  M:    Doug Gilbert <dgilbert@interlog.com>
  L:    linux-scsi@vger.kernel.org
@@@ -5214,10 -5086,8 +5222,10 @@@ S:    Maintaine
  F:    drivers/mmc/host/sdricoh_cs.c
  
  SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER
 -S:    Orphan
 +M:    Chris Ball <cjb@laptop.org>
  L:    linux-mmc@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git
 +S:    Maintained
  F:    drivers/mmc/host/sdhci.*
  
  SECURE DIGITAL HOST CONTROLLER INTERFACE, OPEN FIRMWARE BINDINGS (SDHCI-OF)
@@@ -5372,8 -5242,8 +5380,8 @@@ F:      drivers/*/*s3c2410
  F:    drivers/*/*/*s3c2410*
  
  TI DAVINCI MACHINE SUPPORT
 -P:    Kevin Hilman
 -M:    davinci-linux-open-source@linux.davincidsp.com
 +M:    Kevin Hilman <khilman@deeprootsystems.com>
 +L:    davinci-linux-open-source@linux.davincidsp.com (subscribers-only)
  Q:    http://patchwork.kernel.org/project/linux-davinci/list/
  S:    Supported
  F:    arch/arm/mach-davinci
@@@ -5667,7 -5537,7 +5675,7 @@@ S:      Maintaine
  
  STAGING SUBSYSTEM
  M:    Greg Kroah-Hartman <gregkh@suse.de>
- T:    quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git
  L:    devel@driverdev.osuosl.org
  S:    Maintained
  F:    drivers/staging/
@@@ -5974,9 -5844,13 +5982,9 @@@ F:     Documentation/filesystems/ufs.tx
  F:    fs/ufs/
  
  ULTRA-WIDEBAND (UWB) SUBSYSTEM:
 -M:    David Vrabel <david.vrabel@csr.com>
  L:    linux-usb@vger.kernel.org
 -S:    Supported
 +S:    Orphan
  F:    drivers/uwb/
 -X:    drivers/uwb/wlp/
 -X:    drivers/uwb/i1480/i1480u-wlp/
 -X:    drivers/uwb/i1480/i1480-wlp.h
  F:    include/linux/uwb.h
  F:    include/linux/uwb/
  
@@@ -6011,14 -5885,6 +6019,14 @@@ S:    Maintaine
  F:    Documentation/usb/acm.txt
  F:    drivers/usb/class/cdc-acm.*
  
 +USB ATTACHED SCSI
 +M:    Matthew Wilcox <willy@linux.intel.com>
 +M:    Sarah Sharp <sarah.a.sharp@linux.intel.com>
 +L:    linux-usb@vger.kernel.org
 +L:    linux-scsi@vger.kernel.org
 +S:    Supported
 +F:    drivers/usb/storage/uas.c
 +
  USB BLOCK DRIVER (UB ub)
  M:    Pete Zaitcev <zaitcev@redhat.com>
  L:    linux-usb@vger.kernel.org
@@@ -6118,6 -5984,13 +6126,6 @@@ L:     linux-usb@vger.kernel.or
  S:    Maintained
  F:    drivers/usb/serial/option.c
  
 -USB OV511 DRIVER
 -M:    Mark McClelland <mmcclell@bigfoot.com>
 -L:    linux-usb@vger.kernel.org
 -W:    http://alpha.dyndns.org/ov511/
 -S:    Maintained
 -F:    drivers/media/video/ov511.*
 -
  USB PEGASUS DRIVER
  M:    Petko Manolov <petkan@users.sourceforge.net>
  L:    linux-usb@vger.kernel.org
@@@ -6278,6 -6151,16 +6286,6 @@@ S:     Supporte
  F:    drivers/usb/host/xhci*
  F:    drivers/usb/host/pci-quirks*
  
 -USB ZC0301 DRIVER
 -M:    Luca Risolia <luca.risolia@studio.unibo.it>
 -L:    linux-usb@vger.kernel.org
 -L:    linux-media@vger.kernel.org
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
 -W:    http://www.linux-projects.org
 -S:    Maintained
 -F:    Documentation/video4linux/zc0301.txt
 -F:    drivers/media/video/zc0301/
 -
  USB ZD1201 DRIVER
  L:    linux-wireless@vger.kernel.org
  W:    http://linux-lc100020.sourceforge.net
@@@ -6495,27 -6378,36 +6503,27 @@@ F:   include/linux/wimax/debug.
  F:    include/net/wimax.h
  F:    net/wimax/
  
 -WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM
 -M:    David Vrabel <david.vrabel@csr.com>
 -L:    netdev@vger.kernel.org
 -S:    Maintained
 -F:    include/linux/wlp.h
 -F:    drivers/uwb/wlp/
 -F:    drivers/uwb/i1480/i1480u-wlp/
 -F:    drivers/uwb/i1480/i1480-wlp.h
 -
  WISTRON LAPTOP BUTTON DRIVER
  M:    Miloslav Trmac <mitr@volny.cz>
  S:    Maintained
  F:    drivers/input/misc/wistron_btns.c
  
  WL1251 WIRELESS DRIVER
 -M:    Kalle Valo <kalle.valo@iki.fi>
 +M:    Kalle Valo <kvalo@adurom.com>
  L:    linux-wireless@vger.kernel.org
  W:    http://wireless.kernel.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  S:    Maintained
 -F:    drivers/net/wireless/wl12xx/*
 -X:    drivers/net/wireless/wl12xx/wl1271*
 +F:    drivers/net/wireless/wl1251/*
  
  WL1271 WIRELESS DRIVER
  M:    Luciano Coelho <luciano.coelho@nokia.com>
  L:    linux-wireless@vger.kernel.org
  W:    http://wireless.kernel.org
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git
  S:    Maintained
  F:    drivers/net/wireless/wl12xx/wl1271*
 +F:    include/linux/wl12xx.h
  
  WL3501 WIRELESS PCMCIA CARD DRIVER
  M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
@@@ -6537,10 -6429,8 +6545,10 @@@ F:    include/linux/wm97xx.
  WOLFSON MICROELECTRONICS DRIVERS
  M:    Mark Brown <broonie@opensource.wolfsonmicro.com>
  M:    Ian Lartey <ian@opensource.wolfsonmicro.com>
 +M:    Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
 +T:    git git://opensource.wolfsonmicro.com/linux-2.6-asoc
  T:    git git://opensource.wolfsonmicro.com/linux-2.6-audioplus
 -W:    http://opensource.wolfsonmicro.com/node/8
 +W:    http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
  S:    Supported
  F:    Documentation/hwmon/wm83??
  F:    drivers/leds/leds-wm83*.c
@@@ -6662,20 -6552,6 +6670,20 @@@ M:    "Maciej W. Rozycki" <macro@linux-mip
  S:    Maintained
  F:    drivers/serial/zs.*
  
 +GRE DEMULTIPLEXER DRIVER
 +M:    Dmitry Kozlov <xeb@mail.ru>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    net/ipv4/gre.c
 +F:    include/net/gre.h
 +
 +PPTP DRIVER
 +M:    Dmitry Kozlov <xeb@mail.ru>
 +L:    netdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/net/pptp.c
 +W:    http://sourceforge.net/projects/accel-pptp
 +
  THE REST
  M:    Linus Torvalds <torvalds@linux-foundation.org>
  L:    linux-kernel@vger.kernel.org
index 7352412e49170e5b98b56c69bbd1e2679ff42ace,58288a4771e10eb0db9481b9734cc379e224723b..60e51bcf53bd2e053a384826d45ac760eb30588d
@@@ -3,10 -3,9 +3,10 @@@
  #
  
  # Common support
 -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o
 +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
 +       common.o
  
 -omap-2-3-common                               = irq.o sdrc.o
 +omap-2-3-common                               = irq.o sdrc.o prm2xxx_3xxx.o
  hwmod-common                          = omap_hwmod.o \
                                          omap_hwmod_common_data.o
  prcm-common                           = prcm.o powerdomain.o
@@@ -16,7 -15,7 +16,7 @@@ clock-common                          = clock.o clock_common_
  
  obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(hwmod-common)
  obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(hwmod-common)
 -obj-$(CONFIG_ARCH_OMAP4) += $(prcm-common) $(hwmod-common)
 +obj-$(CONFIG_ARCH_OMAP4) += $(prcm-common) prm44xx.o $(hwmod-common)
  
  obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
  
@@@ -50,18 -49,14 +50,18 @@@ obj-$(CONFIG_ARCH_OMAP2)           += sdrc2xxx.
  # Power Management
  ifeq ($(CONFIG_PM),y)
  obj-$(CONFIG_ARCH_OMAP2)              += pm24xx.o
 -obj-$(CONFIG_ARCH_OMAP2)              += sleep24xx.o
 -obj-$(CONFIG_ARCH_OMAP3)              += pm34xx.o sleep34xx.o cpuidle34xx.o
 -obj-$(CONFIG_ARCH_OMAP4)              += pm44xx.o
 +obj-$(CONFIG_ARCH_OMAP2)              += sleep24xx.o pm_bus.o
 +obj-$(CONFIG_ARCH_OMAP3)              += pm34xx.o sleep34xx.o cpuidle34xx.o pm_bus.o
 +obj-$(CONFIG_ARCH_OMAP4)              += pm44xx.o pm_bus.o
  obj-$(CONFIG_PM_DEBUG)                        += pm-debug.o
  
  AFLAGS_sleep24xx.o                    :=-Wa,-march=armv6
  AFLAGS_sleep34xx.o                    :=-Wa,-march=armv7-a
  
 +ifeq ($(CONFIG_PM_VERBOSE),y)
 +CFLAGS_pm_bus.o                               += -DDEBUG
 +endif
 +
  endif
  
  # PRCM
@@@ -92,7 -87,6 +92,7 @@@ obj-$(CONFIG_ARCH_OMAP2430)           += opp2430
  obj-$(CONFIG_ARCH_OMAP2420)           += omap_hwmod_2420_data.o
  obj-$(CONFIG_ARCH_OMAP2430)           += omap_hwmod_2430_data.o
  obj-$(CONFIG_ARCH_OMAP3)              += omap_hwmod_3xxx_data.o
 +obj-$(CONFIG_ARCH_OMAP4)              += omap_hwmod_44xx_data.o
  
  # EMU peripherals
  obj-$(CONFIG_OMAP3_EMU)                       += emu.o
@@@ -108,6 -102,10 +108,10 @@@ obj-y                                    += $(iommu-m) $(iommu-y
  i2c-omap-$(CONFIG_I2C_OMAP)           := i2c.o
  obj-y                                 += $(i2c-omap-m) $(i2c-omap-y)
  
+ ifneq ($(CONFIG_TIDSPBRIDGE),)
+ obj-y                                 += dsp.o
+ endif
  # Specific board support
  obj-$(CONFIG_MACH_OMAP_GENERIC)               += board-generic.o
  obj-$(CONFIG_MACH_OMAP_H4)            += board-h4.o
@@@ -121,10 -119,6 +125,10 @@@ obj-$(CONFIG_MACH_DEVKIT8000)            += b
  obj-$(CONFIG_MACH_OMAP_LDP)           += board-ldp.o \
                                           board-flash.o \
                                           hsmmc.o
 +obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
 +                                         hsmmc.o
 +obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 +                                         hsmmc.o
  obj-$(CONFIG_MACH_OVERO)              += board-overo.o \
                                           hsmmc.o
  obj-$(CONFIG_MACH_OMAP3EVM)           += board-omap3evm.o \
@@@ -156,11 -150,8 +160,11 @@@ obj-$(CONFIG_MACH_OMAP_3630SDP)          += boa
                                           hsmmc.o
  obj-$(CONFIG_MACH_CM_T35)             += board-cm-t35.o \
                                           hsmmc.o
 +obj-$(CONFIG_MACH_CM_T3517)           += board-cm-t3517.o
  obj-$(CONFIG_MACH_IGEP0020)           += board-igep0020.o \
                                           hsmmc.o
 +obj-$(CONFIG_MACH_IGEP0030)           += board-igep0030.o \
 +                                         hsmmc.o
  obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK)    += board-omap3touchbook.o \
                                           hsmmc.o
  obj-$(CONFIG_MACH_OMAP_4430SDP)               += board-4430sdp.o \
@@@ -187,6 -178,3 +191,6 @@@ obj-y                                      += $(nand-m) $(nand-y
  
  smc91x-$(CONFIG_SMC91X)                       := gpmc-smc91x.o
  obj-y                                 += $(smc91x-m) $(smc91x-y)
 +
 +smsc911x-$(CONFIG_SMSC911X)           := gpmc-smsc911x.o
 +obj-y                                 += $(smsc911x-m) $(smsc911x-y)
index 221a675ebbaedb4b14d08d354103ced49a402e90,57205a49289e2ba6b441be7ca4379ed23b4af749..f04731820301c921f8d65c3d394f570ee543b34a
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -#include <linux/module.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
 -#include <linux/delay.h>
 -#include <linux/console.h>
 -#include <linux/serial.h>
 -#include <linux/tty.h>
 -#include <linux/serial_8250.h>
 -#include <linux/serial_reg.h>
 -#include <linux/clk.h>
  #include <linux/io.h>
  #include <linux/omapfb.h>
  
 -#include <mach/hardware.h>
 -#include <asm/system.h>
 -#include <asm/pgtable.h>
 -#include <asm/mach/map.h>
 -#include <asm/setup.h>
 -
  #include <plat/common.h>
  #include <plat/board.h>
 -#include <plat/control.h>
 -#include <plat/mux.h>
 -#include <plat/fpga.h>
 -#include <plat/serial.h>
  #include <plat/vram.h>
+ #include <plat/dsp.h>
  
 -#include <plat/clock.h>
 -
 -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 -# include "../mach-omap2/sdrc.h"
 -#endif
  
  #define NO_LENGTH_CHECK 0xffffffff
  
@@@ -64,4 -88,272 +65,5 @@@ void __init omap_reserve(void
  {
        omapfb_reserve_sdram_memblock();
        omap_vram_reserve_sdram_memblock();
+       omap_dsp_reserve_sdram_memblock();
  }
 -
 -/*
 - * 32KHz clocksource ... always available, on pretty most chips except
 - * OMAP 730 and 1510.  Other timers could be used as clocksources, with
 - * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
 - * but systems won't necessarily want to spend resources that way.
 - */
 -
 -#define OMAP16XX_TIMER_32K_SYNCHRONIZED               0xfffbc410
 -
 -#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
 -
 -#include <linux/clocksource.h>
 -
 -/*
 - * offset_32k holds the init time counter value. It is then subtracted
 - * from every counter read to achieve a counter that counts time from the
 - * kernel boot (needed for sched_clock()).
 - */
 -static u32 offset_32k __read_mostly;
 -
 -#ifdef CONFIG_ARCH_OMAP16XX
 -static cycle_t omap16xx_32k_read(struct clocksource *cs)
 -{
 -      return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
 -}
 -#else
 -#define omap16xx_32k_read     NULL
 -#endif
 -
 -#ifdef CONFIG_ARCH_OMAP2420
 -static cycle_t omap2420_32k_read(struct clocksource *cs)
 -{
 -      return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
 -}
 -#else
 -#define omap2420_32k_read     NULL
 -#endif
 -
 -#ifdef CONFIG_ARCH_OMAP2430
 -static cycle_t omap2430_32k_read(struct clocksource *cs)
 -{
 -      return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
 -}
 -#else
 -#define omap2430_32k_read     NULL
 -#endif
 -
 -#ifdef CONFIG_ARCH_OMAP3
 -static cycle_t omap34xx_32k_read(struct clocksource *cs)
 -{
 -      return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
 -}
 -#else
 -#define omap34xx_32k_read     NULL
 -#endif
 -
 -#ifdef CONFIG_ARCH_OMAP4
 -static cycle_t omap44xx_32k_read(struct clocksource *cs)
 -{
 -      return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
 -}
 -#else
 -#define omap44xx_32k_read     NULL
 -#endif
 -
 -/*
 - * Kernel assumes that sched_clock can be called early but may not have
 - * things ready yet.
 - */
 -static cycle_t omap_32k_read_dummy(struct clocksource *cs)
 -{
 -      return 0;
 -}
 -
 -static struct clocksource clocksource_32k = {
 -      .name           = "32k_counter",
 -      .rating         = 250,
 -      .read           = omap_32k_read_dummy,
 -      .mask           = CLOCKSOURCE_MASK(32),
 -      .shift          = 10,
 -      .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 -};
 -
 -/*
 - * Returns current time from boot in nsecs. It's OK for this to wrap
 - * around for now, as it's just a relative time stamp.
 - */
 -unsigned long long sched_clock(void)
 -{
 -      return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
 -                                clocksource_32k.mult, clocksource_32k.shift);
 -}
 -
 -/**
 - * read_persistent_clock -  Return time from a persistent clock.
 - *
 - * Reads the time from a source which isn't disabled during PM, the
 - * 32k sync timer.  Convert the cycles elapsed since last read into
 - * nsecs and adds to a monotonically increasing timespec.
 - */
 -static struct timespec persistent_ts;
 -static cycles_t cycles, last_cycles;
 -void read_persistent_clock(struct timespec *ts)
 -{
 -      unsigned long long nsecs;
 -      cycles_t delta;
 -      struct timespec *tsp = &persistent_ts;
 -
 -      last_cycles = cycles;
 -      cycles = clocksource_32k.read(&clocksource_32k);
 -      delta = cycles - last_cycles;
 -
 -      nsecs = clocksource_cyc2ns(delta,
 -                                 clocksource_32k.mult, clocksource_32k.shift);
 -
 -      timespec_add_ns(tsp, nsecs);
 -      *ts = *tsp;
 -}
 -
 -static int __init omap_init_clocksource_32k(void)
 -{
 -      static char err[] __initdata = KERN_ERR
 -                      "%s: can't register clocksource!\n";
 -
 -      if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
 -              struct clk *sync_32k_ick;
 -
 -              if (cpu_is_omap16xx())
 -                      clocksource_32k.read = omap16xx_32k_read;
 -              else if (cpu_is_omap2420())
 -                      clocksource_32k.read = omap2420_32k_read;
 -              else if (cpu_is_omap2430())
 -                      clocksource_32k.read = omap2430_32k_read;
 -              else if (cpu_is_omap34xx())
 -                      clocksource_32k.read = omap34xx_32k_read;
 -              else if (cpu_is_omap44xx())
 -                      clocksource_32k.read = omap44xx_32k_read;
 -              else
 -                      return -ENODEV;
 -
 -              sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
 -              if (sync_32k_ick)
 -                      clk_enable(sync_32k_ick);
 -
 -              clocksource_32k.mult = clocksource_hz2mult(32768,
 -                                          clocksource_32k.shift);
 -
 -              offset_32k = clocksource_32k.read(&clocksource_32k);
 -
 -              if (clocksource_register(&clocksource_32k))
 -                      printk(err, clocksource_32k.name);
 -      }
 -      return 0;
 -}
 -arch_initcall(omap_init_clocksource_32k);
 -
 -#endif        /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
 -
 -/* Global address base setup code */
 -
 -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 -
 -static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 -{
 -      omap2_set_globals_tap(omap2_globals);
 -      omap2_set_globals_sdrc(omap2_globals);
 -      omap2_set_globals_control(omap2_globals);
 -      omap2_set_globals_prcm(omap2_globals);
 -      omap2_set_globals_uart(omap2_globals);
 -}
 -
 -#endif
 -
 -#if defined(CONFIG_ARCH_OMAP2420)
 -
 -static struct omap_globals omap242x_globals = {
 -      .class  = OMAP242X_CLASS,
 -      .tap    = OMAP2_L4_IO_ADDRESS(0x48014000),
 -      .sdrc   = OMAP2420_SDRC_BASE,
 -      .sms    = OMAP2420_SMS_BASE,
 -      .ctrl   = OMAP2420_CTRL_BASE,
 -      .prm    = OMAP2420_PRM_BASE,
 -      .cm     = OMAP2420_CM_BASE,
 -      .uart1_phys     = OMAP2_UART1_BASE,
 -      .uart2_phys     = OMAP2_UART2_BASE,
 -      .uart3_phys     = OMAP2_UART3_BASE,
 -};
 -
 -void __init omap2_set_globals_242x(void)
 -{
 -      __omap2_set_globals(&omap242x_globals);
 -}
 -#endif
 -
 -#if defined(CONFIG_ARCH_OMAP2430)
 -
 -static struct omap_globals omap243x_globals = {
 -      .class  = OMAP243X_CLASS,
 -      .tap    = OMAP2_L4_IO_ADDRESS(0x4900a000),
 -      .sdrc   = OMAP243X_SDRC_BASE,
 -      .sms    = OMAP243X_SMS_BASE,
 -      .ctrl   = OMAP243X_CTRL_BASE,
 -      .prm    = OMAP2430_PRM_BASE,
 -      .cm     = OMAP2430_CM_BASE,
 -      .uart1_phys     = OMAP2_UART1_BASE,
 -      .uart2_phys     = OMAP2_UART2_BASE,
 -      .uart3_phys     = OMAP2_UART3_BASE,
 -};
 -
 -void __init omap2_set_globals_243x(void)
 -{
 -      __omap2_set_globals(&omap243x_globals);
 -}
 -#endif
 -
 -#if defined(CONFIG_ARCH_OMAP3)
 -
 -static struct omap_globals omap3_globals = {
 -      .class  = OMAP343X_CLASS,
 -      .tap    = OMAP2_L4_IO_ADDRESS(0x4830A000),
 -      .sdrc   = OMAP343X_SDRC_BASE,
 -      .sms    = OMAP343X_SMS_BASE,
 -      .ctrl   = OMAP343X_CTRL_BASE,
 -      .prm    = OMAP3430_PRM_BASE,
 -      .cm     = OMAP3430_CM_BASE,
 -      .uart1_phys     = OMAP3_UART1_BASE,
 -      .uart2_phys     = OMAP3_UART2_BASE,
 -      .uart3_phys     = OMAP3_UART3_BASE,
 -      .uart4_phys     = OMAP3_UART4_BASE,     /* Only on 3630 */
 -};
 -
 -void __init omap2_set_globals_3xxx(void)
 -{
 -      __omap2_set_globals(&omap3_globals);
 -}
 -
 -void __init omap3_map_io(void)
 -{
 -      omap2_set_globals_3xxx();
 -      omap34xx_map_common_io();
 -}
 -#endif
 -
 -#if defined(CONFIG_ARCH_OMAP4)
 -static struct omap_globals omap4_globals = {
 -      .class  = OMAP443X_CLASS,
 -      .tap    = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
 -      .ctrl   = OMAP443X_CTRL_BASE,
 -      .prm    = OMAP4430_PRM_BASE,
 -      .cm     = OMAP4430_CM_BASE,
 -      .cm2    = OMAP4430_CM2_BASE,
 -      .uart1_phys     = OMAP4_UART1_BASE,
 -      .uart2_phys     = OMAP4_UART2_BASE,
 -      .uart3_phys     = OMAP4_UART3_BASE,
 -      .uart4_phys     = OMAP4_UART4_BASE,
 -};
 -
 -void __init omap2_set_globals_443x(void)
 -{
 -      omap2_set_globals_tap(&omap4_globals);
 -      omap2_set_globals_control(&omap4_globals);
 -      omap2_set_globals_prcm(&omap4_globals);
 -      omap2_set_globals_uart(&omap4_globals);
 -}
 -#endif
 -
index 1e2383eae6383fd862dce6f5228763308c0cf30e,4c8f9b96aa6c938798b1016e3f08b10e6bfba474..6f42a18b8aa417abc5622bf9492d9a4587111738
  #include <linux/platform_device.h>
  #include <linux/io.h>
  #include <linux/slab.h>
+ #include <linux/memblock.h>
  
  #include <mach/hardware.h>
  #include <asm/mach-types.h>
  #include <asm/mach/map.h>
  
  #include <plat/tc.h>
 -#include <plat/control.h>
  #include <plat/board.h>
  #include <plat/mmc.h>
  #include <mach/gpio.h>
@@@ -231,6 -233,75 +232,75 @@@ static void omap_init_uwire(void
  static inline void omap_init_uwire(void) {}
  #endif
  
+ /*-------------------------------------------------------------------------*/
+ #if   defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
+ static struct resource wdt_resources[] = {
+       {
+               .flags          = IORESOURCE_MEM,
+       },
+ };
+ static struct platform_device omap_wdt_device = {
+       .name      = "omap_wdt",
+       .id          = -1,
+       .num_resources  = ARRAY_SIZE(wdt_resources),
+       .resource       = wdt_resources,
+ };
+ static void omap_init_wdt(void)
+ {
+       if (cpu_is_omap16xx())
+               wdt_resources[0].start = 0xfffeb000;
+       else if (cpu_is_omap2420())
+               wdt_resources[0].start = 0x48022000; /* WDT2 */
+       else if (cpu_is_omap2430())
+               wdt_resources[0].start = 0x49016000; /* WDT2 */
+       else if (cpu_is_omap343x())
+               wdt_resources[0].start = 0x48314000; /* WDT2 */
+       else if (cpu_is_omap44xx())
+               wdt_resources[0].start = 0x4a314000;
+       else
+               return;
+       wdt_resources[0].end = wdt_resources[0].start + 0x4f;
+       (void) platform_device_register(&omap_wdt_device);
+ }
+ #else
+ static inline void omap_init_wdt(void) {}
+ #endif
+ #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
+ static phys_addr_t omap_dsp_phys_mempool_base;
+ void __init omap_dsp_reserve_sdram_memblock(void)
+ {
+       phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
+       phys_addr_t paddr;
+       if (!size)
+               return;
+       paddr = __memblock_alloc_base(size, SZ_1M, MEMBLOCK_REAL_LIMIT);
+       if (!paddr) {
+               pr_err("%s: failed to reserve %x bytes\n",
+                               __func__, size);
+               return;
+       }
+       omap_dsp_phys_mempool_base = paddr;
+ }
+ phys_addr_t omap_dsp_get_mempool_base(void)
+ {
+       return omap_dsp_phys_mempool_base;
+ }
+ EXPORT_SYMBOL(omap_dsp_get_mempool_base);
+ #endif
  /*
   * This gets called after board-specific INIT_MACHINE, and initializes most
   * on-chip peripherals accessible on this board (except for few like USB):
@@@ -259,6 -330,7 +329,6 @@@ static int __init omap_init_devices(voi
        omap_init_rng();
        omap_init_mcpdm();
        omap_init_uwire();
 -      omap_init_wdt();
        return 0;
  }
  arch_initcall(omap_init_devices);
diff --combined drivers/misc/Kconfig
index 5a74db75f66f364daaf8b850893858731ed7e7da,c36ee95d3e5b9b9bbd9b751421627b881e450831..39a2173b4e6cd0e10216fa7f4736977ca2a02ef5
@@@ -4,6 -4,7 +4,6 @@@
  
  menuconfig MISC_DEVICES
        bool "Misc devices"
 -      default y
        ---help---
          Say Y here to get to see options for device drivers from various
          different categories. This option alone does not add any kernel code.
@@@ -23,8 -24,7 +23,8 @@@ config AD525X_DPO
          AD5260, AD5262, AD5263, AD5290, AD5291, AD5292, AD5293,
          AD7376, AD8400, AD8402, AD8403, ADN2850, AD5241, AD5242,
          AD5243, AD5245, AD5246, AD5247, AD5248, AD5280, AD5282,
 -        ADN2860, AD5273, AD5171, AD5170, AD5172, AD5173
 +        ADN2860, AD5273, AD5171, AD5170, AD5172, AD5173, AD5270,
 +        AD5271, AD5272, AD5274
          digital potentiometer chips.
  
          See Documentation/misc-devices/ad525x_dpot.txt for the
@@@ -112,8 -112,8 +112,8 @@@ config IBM_AS
  
          WARNING: This software may not be supported or function
          correctly on your IBM server. Please consult the IBM ServerProven
 -        website <http://www.pc.ibm.com/ww/eserver/xseries/serverproven> for
 -        information on the specific driver level and support statement
 +        website <http://www-03.ibm.com/systems/info/x86servers/serverproven/compat/us/>
 +        for information on the specific driver level and support statement
          for your IBM server.
  
  config PHANTOM
@@@ -248,15 -248,15 +248,15 @@@ config CS5535_CLOCK_EVENT_SR
          generic PIT, and are suitable for use as high-res timers.
  
  config HP_ILO
 -      tristate "Channel interface driver for HP iLO/iLO2 processor"
 +      tristate "Channel interface driver for the HP iLO processor"
        depends on PCI
        default n
        help
          The channel interface driver allows applications to communicate
 -        with iLO/iLO2 management processors present on HP ProLiant
 -        servers.  Upon loading, the driver creates /dev/hpilo/dXccbN files,
 -        which can be used to gather data from the management processor,
 -        via read and write system calls.
 +        with iLO management processors present on HP ProLiant servers.
 +        Upon loading, the driver creates /dev/hpilo/dXccbN files, which
 +        can be used to gather data from the management processor, via
 +        read and write system calls.
  
          To compile this driver as a module, choose M here: the
          module will be called hpilo.
@@@ -284,16 -284,6 +284,16 @@@ config SGI_GRU_DEBU
        This option enables addition debugging code for the SGI GRU driver. If
        you are unsure, say N.
  
 +config APDS9802ALS
 +      tristate "Medfield Avago APDS9802 ALS Sensor module"
 +      depends on I2C
 +      help
 +        If you say yes here you get support for the ALS APDS9802 ambient
 +        light sensor.
 +
 +        This driver can also be built as a module.  If so, the module
 +        will be called apds9802als.
 +
  config ISL29003
        tristate "Intersil ISL29003 ambient light sensor"
        depends on I2C && SYSFS
          This driver can also be built as a module.  If so, the module
          will be called isl29003.
  
 +config ISL29020
 +      tristate "Intersil ISL29020 ambient light sensor"
 +      depends on I2C
 +      help
 +        If you say yes here you get support for the Intersil ISL29020
 +        ambient light sensor.
 +
 +        This driver can also be built as a module.  If so, the module
 +        will be called isl29020.
 +
  config SENSORS_TSL2550
        tristate "Taos TSL2550 ambient light sensor"
        depends on I2C && SYSFS
@@@ -334,27 -314,6 +334,27 @@@ config SENSORS_BH178
          This driver can also be built as a module.  If so, the module
          will be called bh1780gli.
  
 +config SENSORS_BH1770
 +         tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor"
 +         depends on I2C
 +         ---help---
 +           Say Y here if you want to build a driver for BH1770GLC (ROHM) or
 +         SFH7770 (Osram) combined ambient light and proximity sensor chip.
 +
 +           To compile this driver as a module, choose M here: the
 +           module will be called bh1770glc. If unsure, say N here.
 +
 +config SENSORS_APDS990X
 +       tristate "APDS990X combined als and proximity sensors"
 +       depends on I2C
 +       default n
 +       ---help---
 +         Say Y here if you want to build a driver for Avago APDS990x
 +         combined ambient light and proximity sensor chip.
 +
 +         To compile this driver as a module, choose M here: the
 +         module will be called apds990x. If unsure, say N here.
 +
  config HMC6352
        tristate "Honeywell HMC6352 compass"
        depends on I2C
@@@ -409,7 -368,7 +409,7 @@@ config VMWARE_BALLOO
          If unsure, say N.
  
          To compile this driver as a module, choose M here: the
 -        module will be called vmware_balloon.
 +        module will be called vmw_balloon.
  
  config ARM_CHARLCD
        bool "ARM Ltd. Character LCD Driver"
@@@ -426,26 -385,15 +426,27 @@@ config BMP08
        depends on I2C && SYSFS
        help
          If you say yes here you get support for the Bosch Sensortec
 -        BMP086 digital pressure sensor.
 +        BMP085 digital pressure sensor.
  
          To compile this driver as a module, choose M here: the
          module will be called bmp085.
  
 +config PCH_PHUB
 +      tristate "PCH Packet Hub of Intel Topcliff"
 +      depends on PCI
 +      help
 +        This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
 +        Intel Topcliff which is an IOH(Input/Output Hub) for x86 embedded
 +        processor. The Topcliff has MAC address and Option ROM data in SROM.
 +        This driver can access MAC address and Option ROM data in SROM.
 +
 +        To compile this driver as a module, choose M here: the module will
 +        be called pch_phub.
 +
  source "drivers/misc/c2port/Kconfig"
  source "drivers/misc/eeprom/Kconfig"
  source "drivers/misc/cb710/Kconfig"
  source "drivers/misc/iwmc3200top/Kconfig"
+ source "drivers/misc/ti-st/Kconfig"
  
  endif # MISC_DEVICES
diff --combined drivers/misc/Makefile
index 4be5c6fc5ef4a47ae8a16c213492beba700321bb,ab3353a597d8165192ed650ab9382c6362601816..47af4cd08f01bd0447555ec4192efe3d2970b771
@@@ -16,8 -16,6 +16,8 @@@ obj-$(CONFIG_TIFM_CORE)               += tifm_
  obj-$(CONFIG_TIFM_7XX1)               += tifm_7xx1.o
  obj-$(CONFIG_PHANTOM)         += phantom.o
  obj-$(CONFIG_SENSORS_BH1780)  += bh1780gli.o
 +obj-$(CONFIG_SENSORS_BH1770)  += bh1770glc.o
 +obj-$(CONFIG_SENSORS_APDS990X)        += apds990x.o
  obj-$(CONFIG_SGI_IOC4)                += ioc4.o
  obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
  obj-$(CONFIG_KGDB_TESTS)      += kgdbts.o
@@@ -25,9 -23,7 +25,9 @@@ obj-$(CONFIG_SGI_XP)          += sgi-xp
  obj-$(CONFIG_SGI_GRU)         += sgi-gru/
  obj-$(CONFIG_CS5535_MFGPT)    += cs5535-mfgpt.o
  obj-$(CONFIG_HP_ILO)          += hpilo.o
 +obj-$(CONFIG_APDS9802ALS)     += apds9802als.o
  obj-$(CONFIG_ISL29003)                += isl29003.o
 +obj-$(CONFIG_ISL29020)                += isl29020.o
  obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
  obj-$(CONFIG_EP93XX_PWM)      += ep93xx_pwm.o
  obj-$(CONFIG_DS1682)          += ds1682.o
@@@ -37,6 -33,6 +37,7 @@@ obj-$(CONFIG_IWMC3200TOP)      += iwmc3
  obj-$(CONFIG_HMC6352)         += hmc6352.o
  obj-y                         += eeprom/
  obj-y                         += cb710/
 -obj-$(CONFIG_VMWARE_BALLOON)  += vmware_balloon.o
 +obj-$(CONFIG_VMWARE_BALLOON)  += vmw_balloon.o
  obj-$(CONFIG_ARM_CHARLCD)     += arm-charlcd.o
 +obj-$(CONFIG_PCH_PHUB)                += pch_phub.o
+ obj-y                         += ti-st/
diff --combined drivers/staging/Kconfig
index 8e03e76002393935ee1a600eac19a7824fde4f0d,809673b60a7b74b6f23298c8fc2378b12f83b977..7069eb66f888c7470be91e2604d38b9f9b74428e
@@@ -59,7 -59,7 +59,7 @@@ source "drivers/staging/wlan-ng/Kconfig
  
  source "drivers/staging/echo/Kconfig"
  
- source "drivers/staging/otus/Kconfig"
+ source "drivers/staging/brcm80211/Kconfig"
  
  source "drivers/staging/rt2860/Kconfig"
  
@@@ -67,24 -67,28 +67,28 @@@ source "drivers/staging/rt2870/Kconfig
  
  source "drivers/staging/comedi/Kconfig"
  
+ source "drivers/staging/olpc_dcon/Kconfig"
  source "drivers/staging/asus_oled/Kconfig"
  
  source "drivers/staging/panel/Kconfig"
  
  source "drivers/staging/rtl8187se/Kconfig"
  
- source "drivers/staging/rtl8192su/Kconfig"
  source "drivers/staging/rtl8192u/Kconfig"
  
  source "drivers/staging/rtl8192e/Kconfig"
  
+ source "drivers/staging/rtl8712/Kconfig"
  source "drivers/staging/frontier/Kconfig"
  
  source "drivers/staging/dream/Kconfig"
  
  source "drivers/staging/pohmelfs/Kconfig"
  
+ source "drivers/staging/autofs/Kconfig"
  source "drivers/staging/phison/Kconfig"
  
  source "drivers/staging/line6/Kconfig"
@@@ -139,10 -143,14 +143,12 @@@ source "drivers/staging/adis16255/Kconf
  
  source "drivers/staging/xgifb/Kconfig"
  
 -source "drivers/staging/mrst-touchscreen/Kconfig"
 -
  source "drivers/staging/msm/Kconfig"
  
  source "drivers/staging/lirc/Kconfig"
  
+ source "drivers/staging/smbfs/Kconfig"
  source "drivers/staging/easycap/Kconfig"
  
  source "drivers/staging/solo6x10/Kconfig"
@@@ -151,5 -159,21 +157,21 @@@ source "drivers/staging/tidspbridge/Kco
  
  source "drivers/staging/quickstart/Kconfig"
  
+ source "drivers/staging/westbridge/Kconfig"
+ source "drivers/staging/sbe-2t3e3/Kconfig"
+ source "drivers/staging/ath6kl/Kconfig"
+ source "drivers/staging/keucr/Kconfig"
+ source "drivers/staging/bcm/Kconfig"
+ source "drivers/staging/ft1000/Kconfig"
+ source "drivers/staging/intel_sst/Kconfig"
+ source "drivers/staging/speakup/Kconfig"
  endif # !STAGING_EXCLUDE_BUILD
  endif # STAGING
diff --combined drivers/staging/Makefile
index 0e7d7559d379890c9c5e509f5745c6fa3d68b15a,a81af6d4948e31a926bc095b48a48fa2e5480ed1..97d58b64381f5741547e9d9995e86c882fbb8085
@@@ -13,23 -13,26 +13,26 @@@ obj-$(CONFIG_USB_IP_COMMON)        += usbip
  obj-$(CONFIG_W35UND)          += winbond/
  obj-$(CONFIG_PRISM2_USB)      += wlan-ng/
  obj-$(CONFIG_ECHO)            += echo/
- obj-$(CONFIG_OTUS)            += otus/
+ obj-$(CONFIG_BRCM80211)               += brcm80211/
  obj-$(CONFIG_RT2860)          += rt2860/
  obj-$(CONFIG_RT2870)          += rt2870/
  obj-$(CONFIG_COMEDI)          += comedi/
+ obj-$(CONFIG_FB_OLPC_DCON)    += olpc_dcon/
  obj-$(CONFIG_ASUS_OLED)               += asus_oled/
  obj-$(CONFIG_PANEL)           += panel/
  obj-$(CONFIG_R8187SE)         += rtl8187se/
- obj-$(CONFIG_RTL8192SU)               += rtl8192su/
  obj-$(CONFIG_RTL8192U)                += rtl8192u/
  obj-$(CONFIG_RTL8192E)                += rtl8192e/
+ obj-$(CONFIG_R8712U)          += rtl8712/
  obj-$(CONFIG_SPECTRA)         += spectra/
  obj-$(CONFIG_TRANZPORT)               += frontier/
  obj-$(CONFIG_DREAM)           += dream/
  obj-$(CONFIG_POHMELFS)                += pohmelfs/
+ obj-$(CONFIG_AUTOFS_FS)               += autofs/
  obj-$(CONFIG_IDE_PHISON)      += phison/
  obj-$(CONFIG_LINE6_USB)               += line6/
  obj-$(CONFIG_USB_SERIAL_QUATECH2)     += serqt_usb2/
+ obj-$(CONFIG_SMB_FS)          += smbfs/
  obj-$(CONFIG_USB_SERIAL_QUATECH_USB2) += quatech_usb2/
  obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
  obj-$(CONFIG_VT6655)          += vt6655/
@@@ -51,8 -54,17 +54,16 @@@ obj-$(CONFIG_CXT1E1)                += cxt1e1
  obj-$(CONFIG_TI_ST)           += ti-st/
  obj-$(CONFIG_ADIS16255)               += adis16255/
  obj-$(CONFIG_FB_XGI)          += xgifb/
 -obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)   += mrst-touchscreen/
  obj-$(CONFIG_MSM_STAGING)     += msm/
  obj-$(CONFIG_EASYCAP)         += easycap/
  obj-$(CONFIG_SOLO6X10)                += solo6x10/
  obj-$(CONFIG_TIDSPBRIDGE)     += tidspbridge/
  obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
+ obj-$(CONFIG_WESTBRIDGE_ASTORIA)      += westbridge/astoria/
+ obj-$(CONFIG_SBE_2T3E3)       += sbe-2t3e3/
+ obj-$(CONFIG_ATH6K_LEGACY)    += ath6kl/
+ obj-$(CONFIG_USB_ENESTORAGE)  += keucr/
+ obj-$(CONFIG_BCM_WIMAX)       += bcm/
+ obj-$(CONFIG_FT1000)          += ft1000/
+ obj-$(CONFIG_SND_INTEL_SST)           += intel_sst/
+ obj-$(CONFIG_SPEAKUP) += speakup/
index 0000000000000000000000000000000000000000,5f3bea90911e5a81238bbee7765b6be54dddc996..480e210c83ab1f46ea9ee9a0b326d46132290c78
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,21 +1,22 @@@
+ config AUTOFS_FS
+       tristate "Kernel automounter support"
++      depends on BKL # unfixable, just use autofs4
+       help
+         The automounter is a tool to automatically mount remote file systems
+         on demand. This implementation is partially kernel-based to reduce
+         overhead in the already-mounted case; this is unlike the BSD
+         automounter (amd), which is a pure user space daemon.
+         To use the automounter you need the user-space tools from the autofs
+         package; you can find the location in <file:Documentation/Changes>.
+         You also want to answer Y to "NFS file system support", below.
+         If you want to use the newer version of the automounter with more
+         features, say N here and say Y to "Kernel automounter v4 support",
+         below.
+         To compile this support as a module, choose M here: the module will be
+         called autofs.
+         If you are not a part of a fairly large, distributed network, you
+         probably do not need an automounter, and can say N here.
index 0000000000000000000000000000000000000000,70210aa0692ac9d4ae8a5018b7e368ca72812966..0fdec4befd8400075ef8cb94a03fede184c0c5cb
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,643 +1,645 @@@
+ /* -*- linux-c -*- --------------------------------------------------------- *
+  *
+  * drivers/staging/autofs/root.c
+  *
+  *  Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
+  *
+  * This file is part of the Linux kernel and is made available under
+  * the terms of the GNU General Public License, version 2, or at your
+  * option, any later version, incorporated herein by reference.
+  *
+  * ------------------------------------------------------------------------- */
+ #include <linux/capability.h>
+ #include <linux/errno.h>
+ #include <linux/stat.h>
+ #include <linux/slab.h>
+ #include <linux/param.h>
+ #include <linux/time.h>
+ #include <linux/compat.h>
+ #include <linux/smp_lock.h>
+ #include "autofs_i.h"
+ static int autofs_root_readdir(struct file *,void *,filldir_t);
+ static struct dentry *autofs_root_lookup(struct inode *,struct dentry *, struct nameidata *);
+ static int autofs_root_symlink(struct inode *,struct dentry *,const char *);
+ static int autofs_root_unlink(struct inode *,struct dentry *);
+ static int autofs_root_rmdir(struct inode *,struct dentry *);
+ static int autofs_root_mkdir(struct inode *,struct dentry *,int);
+ static long autofs_root_ioctl(struct file *,unsigned int,unsigned long);
++#ifdef CONFIG_COMPAT
+ static long autofs_root_compat_ioctl(struct file *,unsigned int,unsigned long);
++#endif
+ const struct file_operations autofs_root_operations = {
+       .llseek         = generic_file_llseek,
+       .read           = generic_read_dir,
+       .readdir        = autofs_root_readdir,
+       .unlocked_ioctl = autofs_root_ioctl,
+ #ifdef CONFIG_COMPAT
+       .compat_ioctl   = autofs_root_compat_ioctl,
+ #endif
+ };
+ const struct inode_operations autofs_root_inode_operations = {
+         .lookup               = autofs_root_lookup,
+         .unlink               = autofs_root_unlink,
+         .symlink      = autofs_root_symlink,
+         .mkdir                = autofs_root_mkdir,
+         .rmdir                = autofs_root_rmdir,
+ };
+ static int autofs_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
+ {
+       struct autofs_dir_ent *ent = NULL;
+       struct autofs_dirhash *dirhash;
+       struct autofs_sb_info *sbi;
+       struct inode * inode = filp->f_path.dentry->d_inode;
+       off_t onr, nr;
+       lock_kernel();
+       sbi = autofs_sbi(inode->i_sb);
+       dirhash = &sbi->dirhash;
+       nr = filp->f_pos;
+       switch(nr)
+       {
+       case 0:
+               if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
+                       goto out;
+               filp->f_pos = ++nr;
+               /* fall through */
+       case 1:
+               if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
+                       goto out;
+               filp->f_pos = ++nr;
+               /* fall through */
+       default:
+               while (onr = nr, ent = autofs_hash_enum(dirhash,&nr,ent)) {
+                       if (!ent->dentry || d_mountpoint(ent->dentry)) {
+                               if (filldir(dirent,ent->name,ent->len,onr,ent->ino,DT_UNKNOWN) < 0)
+                                       goto out;
+                               filp->f_pos = nr;
+                       }
+               }
+               break;
+       }
+ out:
+       unlock_kernel();
+       return 0;
+ }
+ static int try_to_fill_dentry(struct dentry *dentry, struct super_block *sb, struct autofs_sb_info *sbi)
+ {
+       struct inode * inode;
+       struct autofs_dir_ent *ent;
+       int status = 0;
+       if (!(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name))) {
+               do {
+                       if (status && dentry->d_inode) {
+                               if (status != -ENOENT)
+                                       printk("autofs warning: lookup failure on positive dentry, status = %d, name = %s\n", status, dentry->d_name.name);
+                               return 0; /* Try to get the kernel to invalidate this dentry */
+                       }
+                       /* Turn this into a real negative dentry? */
+                       if (status == -ENOENT) {
+                               dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT;
+                               dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+                               return 1;
+                       } else if (status) {
+                               /* Return a negative dentry, but leave it "pending" */
+                               return 1;
+                       }
+                       status = autofs_wait(sbi, &dentry->d_name);
+               } while (!(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name)));
+       }
+       /* Abuse this field as a pointer to the directory entry, used to
+          find the expire list pointers */
+       dentry->d_time = (unsigned long) ent;
+       
+       if (!dentry->d_inode) {
+               inode = autofs_iget(sb, ent->ino);
+               if (IS_ERR(inode)) {
+                       /* Failed, but leave pending for next time */
+                       return 1;
+               }
+               dentry->d_inode = inode;
+       }
+       /* If this is a directory that isn't a mount point, bitch at the
+          daemon and fix it in user space */
+       if (S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry)) {
+               return !autofs_wait(sbi, &dentry->d_name);
+       }
+       /* We don't update the usages for the autofs daemon itself, this
+          is necessary for recursive autofs mounts */
+       if (!autofs_oz_mode(sbi)) {
+               autofs_update_usage(&sbi->dirhash,ent);
+       }
+       dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+       return 1;
+ }
+ /*
+  * Revalidate is called on every cache lookup.  Some of those
+  * cache lookups may actually happen while the dentry is not
+  * yet completely filled in, and revalidate has to delay such
+  * lookups..
+  */
+ static int autofs_revalidate(struct dentry * dentry, struct nameidata *nd)
+ {
+       struct inode * dir;
+       struct autofs_sb_info *sbi;
+       struct autofs_dir_ent *ent;
+       int res;
+       lock_kernel();
+       dir = dentry->d_parent->d_inode;
+       sbi = autofs_sbi(dir->i_sb);
+       /* Pending dentry */
+       if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
+               if (autofs_oz_mode(sbi))
+                       res = 1;
+               else
+                       res = try_to_fill_dentry(dentry, dir->i_sb, sbi);
+               unlock_kernel();
+               return res;
+       }
+       /* Negative dentry.. invalidate if "old" */
+       if (!dentry->d_inode) {
+               unlock_kernel();
+               return (dentry->d_time - jiffies <= AUTOFS_NEGATIVE_TIMEOUT);
+       }
+               
+       /* Check for a non-mountpoint directory */
+       if (S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry)) {
+               if (autofs_oz_mode(sbi))
+                       res = 1;
+               else
+                       res = try_to_fill_dentry(dentry, dir->i_sb, sbi);
+               unlock_kernel();
+               return res;
+       }
+       /* Update the usage list */
+       if (!autofs_oz_mode(sbi)) {
+               ent = (struct autofs_dir_ent *) dentry->d_time;
+               if (ent)
+                       autofs_update_usage(&sbi->dirhash,ent);
+       }
+       unlock_kernel();
+       return 1;
+ }
+ static const struct dentry_operations autofs_dentry_operations = {
+       .d_revalidate   = autofs_revalidate,
+ };
+ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
+ {
+       struct autofs_sb_info *sbi;
+       int oz_mode;
+       DPRINTK(("autofs_root_lookup: name = "));
+       lock_kernel();
+       autofs_say(dentry->d_name.name,dentry->d_name.len);
+       if (dentry->d_name.len > NAME_MAX) {
+               unlock_kernel();
+               return ERR_PTR(-ENAMETOOLONG);/* File name too long to exist */
+       }
+       sbi = autofs_sbi(dir->i_sb);
+       oz_mode = autofs_oz_mode(sbi);
+       DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
+                               "oz_mode = %d\n", task_pid_nr(current),
+                               task_pgrp_nr(current), sbi->catatonic,
+                               oz_mode));
+       /*
+        * Mark the dentry incomplete, but add it. This is needed so
+        * that the VFS layer knows about the dentry, and we can count
+        * on catching any lookups through the revalidate.
+        *
+        * Let all the hard work be done by the revalidate function that
+        * needs to be able to do this anyway..
+        *
+        * We need to do this before we release the directory semaphore.
+        */
+       dentry->d_op = &autofs_dentry_operations;
+       dentry->d_flags |= DCACHE_AUTOFS_PENDING;
+       d_add(dentry, NULL);
+       mutex_unlock(&dir->i_mutex);
+       autofs_revalidate(dentry, nd);
+       mutex_lock(&dir->i_mutex);
+       /*
+        * If we are still pending, check if we had to handle
+        * a signal. If so we can force a restart..
+        */
+       if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
+               /* See if we were interrupted */
+               if (signal_pending(current)) {
+                       sigset_t *sigset = &current->pending.signal;
+                       if (sigismember (sigset, SIGKILL) ||
+                           sigismember (sigset, SIGQUIT) ||
+                           sigismember (sigset, SIGINT)) {
+                               unlock_kernel();
+                               return ERR_PTR(-ERESTARTNOINTR);
+                       }
+               }
+       }
+       unlock_kernel();
+       /*
+        * If this dentry is unhashed, then we shouldn't honour this
+        * lookup even if the dentry is positive.  Returning ENOENT here
+        * doesn't do the right thing for all system calls, but it should
+        * be OK for the operations we permit from an autofs.
+        */
+       if (dentry->d_inode && d_unhashed(dentry))
+               return ERR_PTR(-ENOENT);
+       return NULL;
+ }
+ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
+ {
+       struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
+       struct autofs_dirhash *dh = &sbi->dirhash;
+       struct autofs_dir_ent *ent;
+       unsigned int n;
+       int slsize;
+       struct autofs_symlink *sl;
+       struct inode *inode;
+       DPRINTK(("autofs_root_symlink: %s <- ", symname));
+       autofs_say(dentry->d_name.name,dentry->d_name.len);
+       lock_kernel();
+       if (!autofs_oz_mode(sbi)) {
+               unlock_kernel();
+               return -EACCES;
+       }
+       if (autofs_hash_lookup(dh, &dentry->d_name)) {
+               unlock_kernel();
+               return -EEXIST;
+       }
+       n = find_first_zero_bit(sbi->symlink_bitmap,AUTOFS_MAX_SYMLINKS);
+       if (n >= AUTOFS_MAX_SYMLINKS) {
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       set_bit(n,sbi->symlink_bitmap);
+       sl = &sbi->symlink[n];
+       sl->len = strlen(symname);
+       sl->data = kmalloc(slsize = sl->len+1, GFP_KERNEL);
+       if (!sl->data) {
+               clear_bit(n,sbi->symlink_bitmap);
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL);
+       if (!ent) {
+               kfree(sl->data);
+               clear_bit(n,sbi->symlink_bitmap);
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL);
+       if (!ent->name) {
+               kfree(sl->data);
+               kfree(ent);
+               clear_bit(n,sbi->symlink_bitmap);
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       memcpy(sl->data,symname,slsize);
+       sl->mtime = get_seconds();
+       ent->ino = AUTOFS_FIRST_SYMLINK + n;
+       ent->hash = dentry->d_name.hash;
+       memcpy(ent->name, dentry->d_name.name, 1+(ent->len = dentry->d_name.len));
+       ent->dentry = NULL;     /* We don't keep the dentry for symlinks */
+       autofs_hash_insert(dh,ent);
+       inode = autofs_iget(dir->i_sb, ent->ino);
+       if (IS_ERR(inode))
+               return PTR_ERR(inode);
+       d_instantiate(dentry, inode);
+       unlock_kernel();
+       return 0;
+ }
+ /*
+  * NOTE!
+  *
+  * Normal filesystems would do a "d_delete()" to tell the VFS dcache
+  * that the file no longer exists. However, doing that means that the
+  * VFS layer can turn the dentry into a negative dentry, which we
+  * obviously do not want (we're dropping the entry not because it
+  * doesn't exist, but because it has timed out).
+  *
+  * Also see autofs_root_rmdir()..
+  */
+ static int autofs_root_unlink(struct inode *dir, struct dentry *dentry)
+ {
+       struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
+       struct autofs_dirhash *dh = &sbi->dirhash;
+       struct autofs_dir_ent *ent;
+       unsigned int n;
+       /* This allows root to remove symlinks */
+       lock_kernel();
+       if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) {
+               unlock_kernel();
+               return -EACCES;
+       }
+       ent = autofs_hash_lookup(dh, &dentry->d_name);
+       if (!ent) {
+               unlock_kernel();
+               return -ENOENT;
+       }
+       n = ent->ino - AUTOFS_FIRST_SYMLINK;
+       if (n >= AUTOFS_MAX_SYMLINKS) {
+               unlock_kernel();
+               return -EISDIR; /* It's a directory, dummy */
+       }
+       if (!test_bit(n,sbi->symlink_bitmap)) {
+               unlock_kernel();
+               return -EINVAL; /* Nonexistent symlink?  Shouldn't happen */
+       }
+       
+       dentry->d_time = (unsigned long)(struct autofs_dirhash *)NULL;
+       autofs_hash_delete(ent);
+       clear_bit(n,sbi->symlink_bitmap);
+       kfree(sbi->symlink[n].data);
+       d_drop(dentry);
+       
+       unlock_kernel();
+       return 0;
+ }
+ static int autofs_root_rmdir(struct inode *dir, struct dentry *dentry)
+ {
+       struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
+       struct autofs_dirhash *dh = &sbi->dirhash;
+       struct autofs_dir_ent *ent;
+       lock_kernel();
+       if (!autofs_oz_mode(sbi)) {
+               unlock_kernel();
+               return -EACCES;
+       }
+       ent = autofs_hash_lookup(dh, &dentry->d_name);
+       if (!ent) {
+               unlock_kernel();
+               return -ENOENT;
+       }
+       if ((unsigned int)ent->ino < AUTOFS_FIRST_DIR_INO) {
+               unlock_kernel();
+               return -ENOTDIR; /* Not a directory */
+       }
+       if (ent->dentry != dentry) {
+               printk("autofs_rmdir: odentry != dentry for entry %s\n", dentry->d_name.name);
+       }
+       dentry->d_time = (unsigned long)(struct autofs_dir_ent *)NULL;
+       autofs_hash_delete(ent);
+       drop_nlink(dir);
+       d_drop(dentry);
+       unlock_kernel();
+       return 0;
+ }
+ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+ {
+       struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
+       struct autofs_dirhash *dh = &sbi->dirhash;
+       struct autofs_dir_ent *ent;
+       struct inode *inode;
+       ino_t ino;
+       lock_kernel();
+       if (!autofs_oz_mode(sbi)) {
+               unlock_kernel();
+               return -EACCES;
+       }
+       ent = autofs_hash_lookup(dh, &dentry->d_name);
+       if (ent) {
+               unlock_kernel();
+               return -EEXIST;
+       }
+       if (sbi->next_dir_ino < AUTOFS_FIRST_DIR_INO) {
+               printk("autofs: Out of inode numbers -- what the heck did you do??\n");
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       ino = sbi->next_dir_ino++;
+       ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL);
+       if (!ent) {
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL);
+       if (!ent->name) {
+               kfree(ent);
+               unlock_kernel();
+               return -ENOSPC;
+       }
+       ent->hash = dentry->d_name.hash;
+       memcpy(ent->name, dentry->d_name.name, 1+(ent->len = dentry->d_name.len));
+       ent->ino = ino;
+       ent->dentry = dentry;
+       autofs_hash_insert(dh,ent);
+       inc_nlink(dir);
+       inode = autofs_iget(dir->i_sb, ino);
+       if (IS_ERR(inode)) {
+               drop_nlink(dir);
+               return PTR_ERR(inode);
+       }
+       d_instantiate(dentry, inode);
+       unlock_kernel();
+       return 0;
+ }
+ /* Get/set timeout ioctl() operation */
+ #ifdef CONFIG_COMPAT
+ static inline int autofs_compat_get_set_timeout(struct autofs_sb_info *sbi,
+                                        unsigned int __user *p)
+ {
+       unsigned long ntimeout;
+       if (get_user(ntimeout, p) ||
+           put_user(sbi->exp_timeout / HZ, p))
+               return -EFAULT;
+       if (ntimeout > UINT_MAX/HZ)
+               sbi->exp_timeout = 0;
+       else
+               sbi->exp_timeout = ntimeout * HZ;
+       return 0;
+ }
+ #endif
+ static inline int autofs_get_set_timeout(struct autofs_sb_info *sbi,
+                                        unsigned long __user *p)
+ {
+       unsigned long ntimeout;
+       if (get_user(ntimeout, p) ||
+           put_user(sbi->exp_timeout / HZ, p))
+               return -EFAULT;
+       if (ntimeout > ULONG_MAX/HZ)
+               sbi->exp_timeout = 0;
+       else
+               sbi->exp_timeout = ntimeout * HZ;
+       return 0;
+ }
+ /* Return protocol version */
+ static inline int autofs_get_protover(int __user *p)
+ {
+       return put_user(AUTOFS_PROTO_VERSION, p);
+ }
+ /* Perform an expiry operation */
+ static inline int autofs_expire_run(struct super_block *sb,
+                                   struct autofs_sb_info *sbi,
+                                   struct vfsmount *mnt,
+                                   struct autofs_packet_expire __user *pkt_p)
+ {
+       struct autofs_dir_ent *ent;
+       struct autofs_packet_expire pkt;
+       memset(&pkt,0,sizeof pkt);
+       pkt.hdr.proto_version = AUTOFS_PROTO_VERSION;
+       pkt.hdr.type = autofs_ptype_expire;
+       if (!sbi->exp_timeout || !(ent = autofs_expire(sb,sbi,mnt)))
+               return -EAGAIN;
+       pkt.len = ent->len;
+       memcpy(pkt.name, ent->name, pkt.len);
+       pkt.name[pkt.len] = '\0';
+       if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)))
+               return -EFAULT;
+       return 0;
+ }
+ /*
+  * ioctl()'s on the root directory is the chief method for the daemon to
+  * generate kernel reactions
+  */
+ static int autofs_do_root_ioctl(struct inode *inode, struct file *filp,
+                            unsigned int cmd, unsigned long arg)
+ {
+       struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb);
+       void __user *argp = (void __user *)arg;
+       DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,task_pgrp_nr(current)));
+       if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
+            _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
+               return -ENOTTY;
+       
+       if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
+               return -EPERM;
+       
+       switch(cmd) {
+       case AUTOFS_IOC_READY:  /* Wait queue: go ahead and retry */
+               return autofs_wait_release(sbi,(autofs_wqt_t)arg,0);
+       case AUTOFS_IOC_FAIL:   /* Wait queue: fail with ENOENT */
+               return autofs_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT);
+       case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
+               autofs_catatonic_mode(sbi);
+               return 0;
+       case AUTOFS_IOC_PROTOVER: /* Get protocol version */
+               return autofs_get_protover(argp);
+ #ifdef CONFIG_COMPAT
+       case AUTOFS_IOC_SETTIMEOUT32:
+               return autofs_compat_get_set_timeout(sbi, argp);
+ #endif
+       case AUTOFS_IOC_SETTIMEOUT:
+               return autofs_get_set_timeout(sbi, argp);
+       case AUTOFS_IOC_EXPIRE:
+               return autofs_expire_run(inode->i_sb, sbi, filp->f_path.mnt,
+                                        argp);
+       default:
+               return -ENOSYS;
+       }
+ }
+ static long autofs_root_ioctl(struct file *filp,
+                            unsigned int cmd, unsigned long arg)
+ {
+       int ret;
+       lock_kernel();
+       ret = autofs_do_root_ioctl(filp->f_path.dentry->d_inode,
+                                  filp, cmd, arg);
+       unlock_kernel();
+       return ret;
+ }
+ #ifdef CONFIG_COMPAT
+ static long autofs_root_compat_ioctl(struct file *filp,
+                            unsigned int cmd, unsigned long arg)
+ {
+       struct inode *inode = filp->f_path.dentry->d_inode;
+       int ret;
+       lock_kernel();
+       if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
+               ret = autofs_do_root_ioctl(inode, filp, cmd, arg);
+       else
+               ret = autofs_do_root_ioctl(inode, filp, cmd,
+                       (unsigned long)compat_ptr(arg));
+       unlock_kernel();
+       return ret;
+ }
+ #endif
index fecb89e8c66365dd00cd7ed14f9012f064cf3160,98fa255d862ef9f7e3257ad3eaadfd4fb1053374..093032ba521a2eb0499d51cdeae9d6dc7666870e
@@@ -537,7 -537,8 +537,8 @@@ static int do_chaninfo_ioctl(struct com
  
                        x = (dev->minor << 28) | (it.subdev << 24) | (i << 16) |
                            (s->range_table_list[i]->length);
-                       put_user(x, it.rangelist + i);
+                       if (put_user(x, it.rangelist + i))
+                               return -EFAULT;
                }
  #if 0
                if (copy_to_user(it.rangelist, s->range_type_list,
@@@ -1922,7 -1923,6 +1923,7 @@@ const struct file_operations comedi_fop
        .mmap = comedi_mmap,
        .poll = comedi_poll,
        .fasync = comedi_fasync,
 +      .llseek = noop_llseek,
  };
  
  struct class *comedi_class;
index 78b1410ba4f6868a75f94971156ba0b35dd669d5,16c322d040fd203f9b1405cc8023678067273910..3d53df000cf11ee4f77601b8b0695dc28dd4afcf
@@@ -37,7 -37,7 +37,7 @@@ Configuration Options
  Developed from cb_pcidas and skel by Richard Bytheway (mocelet@sucs.org).
  Only supports DIO, AO and simple AI in it's present form.
  No interrupts, multi channel or FIFO AI, although the card looks like it could support this.
 -See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more details.
 +See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details.
  */
  
  #include "../comedidev.h"
@@@ -126,10 -126,8 +126,8 @@@ static const struct cb_pcimdas_board cb
  /* This is used by modprobe to translate PCI IDs to drivers.  Should
   * only be used for PCI and ISA-PnP devices */
  static DEFINE_PCI_DEVICE_TABLE(cb_pcimdas_pci_table) = {
-       {
-       PCI_VENDOR_ID_COMPUTERBOARDS, 0x0056, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       {
-       0}
+       { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, 0x0056) },
+       { 0 }
  };
  
  MODULE_DEVICE_TABLE(pci, cb_pcimdas_pci_table);
index 1411dd8f4e7c21581f53ee91f9a2f0d8188c1000,91a43c3110b85c2a0e5009bd762b8553e9fa04fb..4d1868d04bac93a6ecb49c2a51f456b3d62b12bf
@@@ -37,7 -37,7 +37,7 @@@ boards has no
  yet been added to the driver, mainly due to the fact that
  I don't know the device id numbers.  If you have one
  of these boards,
 -please file a bug report at https://bugs.comedi.org/
 +please file a bug report at http://comedi.org/ 
  so I can get the necessary information from you.
  
  The 1200 series boards have onboard calibration dacs for correcting
@@@ -250,7 -250,7 +250,7 @@@ static unsigned int labpc_serial_in(str
  static unsigned int labpc_eeprom_read(struct comedi_device *dev,
                                      unsigned int address);
  static unsigned int labpc_eeprom_read_status(struct comedi_device *dev);
- static unsigned int labpc_eeprom_write(struct comedi_device *dev,
+ static int labpc_eeprom_write(struct comedi_device *dev,
                                       unsigned int address,
                                       unsigned int value);
  static void write_caldac(struct comedi_device *dev, unsigned int channel,
@@@ -345,6 -345,7 +345,7 @@@ const int labpc_1200_is_unipolar[NUM_LA
        1,
        1,
  };
+ EXPORT_SYMBOL_GPL(labpc_1200_is_unipolar);
  
  /* map range index to gain bits */
  const int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES] = {
        0x60,
        0x70,
  };
+ EXPORT_SYMBOL_GPL(labpc_1200_ai_gain_bits);
  
  const struct comedi_lrange range_labpc_1200_ai = {
        NUM_LABPC_1200_AI_RANGES,
         UNI_RANGE(0.1),
         }
  };
+ EXPORT_SYMBOL_GPL(range_labpc_1200_ai);
  
  /* analog output ranges */
  #define AO_RANGE_IS_UNIPOLAR 0x1
@@@ -701,6 -704,7 +704,7 @@@ int labpc_common_attach(struct comedi_d
  
        return 0;
  }
+ EXPORT_SYMBOL_GPL(labpc_common_attach);
  
  static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
  {
@@@ -807,6 -811,7 +811,7 @@@ int labpc_common_detach(struct comedi_d
  
        return 0;
  };
+ EXPORT_SYMBOL_GPL(labpc_common_detach);
  
  static void labpc_clear_adc_fifo(const struct comedi_device *dev)
  {
@@@ -1986,8 -1991,8 +1991,8 @@@ static unsigned int labpc_eeprom_read(s
        return value;
  }
  
- static unsigned int labpc_eeprom_write(struct comedi_device *dev,
-                                      unsigned int address, unsigned int value)
+ static int labpc_eeprom_write(struct comedi_device *dev,
+                               unsigned int address, unsigned int value)
  {
        const int write_enable_instruction = 0x6;
        const int write_instruction = 0x2;
@@@ -2152,11 -2157,6 +2157,6 @@@ module_init(driver_labpc_init_module)
  module_exit(driver_labpc_cleanup_module);
  #endif
  
- EXPORT_SYMBOL_GPL(labpc_common_attach);
- EXPORT_SYMBOL_GPL(labpc_common_detach);
- EXPORT_SYMBOL_GPL(range_labpc_1200_ai);
- EXPORT_SYMBOL_GPL(labpc_1200_ai_gain_bits);
- EXPORT_SYMBOL_GPL(labpc_1200_is_unipolar);
  
  MODULE_AUTHOR("Comedi http://www.comedi.org");
  MODULE_DESCRIPTION("Comedi low-level driver");
index a49a7c566d37387adbf1de473e82fda0584d7325,5858d97fcd059279278b4352da33dfae7f891b8d..60ebfc3c75fdb08aac1c22798d782d148006656d
@@@ -59,7 -59,7 +59,7 @@@ Configuration options
      Data sheet: http://www.rtdusa.com/pdf/dm7520.pdf
      Example source: http://www.rtdusa.com/examples/dm/dm7520.zip
      Call them and ask for the register level manual.
 -    PCI chip: http://www.plxtech.com/products/toolbox/9080.htm
 +    PCI chip: http://www.plxtech.com/products/io/pci9080 
  
      Notes:
      This board is memory mapped.  There is some IO stuff, but it isn't needed.
@@@ -329,10 -329,9 +329,9 @@@ static const struct rtdBoard rtd520Boar
  };
  
  static DEFINE_PCI_DEVICE_TABLE(rtd520_pci_table) = {
-       {
-       PCI_VENDOR_ID_RTD, 0x7520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-       PCI_VENDOR_ID_RTD, 0x4520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
-       0}
+       { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x7520) },
+       { PCI_DEVICE(PCI_VENDOR_ID_RTD, 0x4520) },
+       { 0 }
  };
  
  MODULE_DEVICE_TABLE(pci, rtd520_pci_table);
index af258991fe7fc8f653ecc5d862adb8fb59161257,115e79b8b4eb9c29a2d2e0ee7b8e46f7d207707f..28c6b8ced424cec2e2f3d54ac495f61fda6941da
@@@ -351,7 -351,6 +351,7 @@@ static const struct file_operations chd
        .unlocked_ioctl = chd_dec_ioctl,
        .open    = chd_dec_open,
        .release = chd_dec_close,
 +      .llseek = noop_llseek,
  };
  
  static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
@@@ -571,6 -570,7 +571,7 @@@ static int __devinit chd_dec_pci_probe(
        rc = chd_pci_reserve_mem(pinfo);
        if (rc) {
                BCMLOG_ERR("Failed to setup memory regions.\n");
+               pci_disable_device(pdev);
                return -ENOMEM;
        }
  
index 3640d1f2376d62cf4c7d57802675a7a27c8f40fd,7189725d8f2d709d96aef0819d6828af2681227f..4d3d300bb7361c23591d4911e5170cc0170bb6c1
@@@ -180,7 -180,6 +180,7 @@@ const struct file_operations pmem_fops 
        .mmap = pmem_mmap,
        .open = pmem_open,
        .unlocked_ioctl = pmem_ioctl,
 +      .llseek = noop_llseek,
  };
  
  static int get_id(struct file *file)
@@@ -1205,7 -1204,6 +1205,7 @@@ static ssize_t debug_read(struct file *
  static struct file_operations debug_fops = {
        .read = debug_read,
        .open = debug_open,
 +      .llseek = default_llseek,
  };
  #endif
  
@@@ -1233,7 -1231,7 +1233,7 @@@ int pmem_setup(struct android_pmem_plat
        pmem[id].ioctl = ioctl;
        pmem[id].release = release;
        init_rwsem(&pmem[id].bitmap_sem);
-       init_MUTEX(&pmem[id].data_list_sem);
+       sema_init(&pmem[id].data_list_sem, 1);
        INIT_LIST_HEAD(&pmem[id].data_list);
        pmem[id].dev.name = pdata->name;
        pmem[id].dev.minor = id;
index 689099b57fd2244ccd6d37798b87a203859013db,4b44d7cb5321a0380c61ece5fe4593f478c641e0..ef7fbf8b069a58dea52e0374be2afcb575c79983
@@@ -641,7 -641,6 +641,7 @@@ static const struct file_operations usb
        .open = usb_alphatrack_open,
        .release = usb_alphatrack_release,
        .poll = usb_alphatrack_poll,
 +      .llseek = no_llseek,
  };
  
  /*
@@@ -672,7 -671,7 +672,7 @@@ static int usb_alphatrack_probe(struct 
        int true_size;
        int retval = -ENOMEM;
  
-       /* allocate memory for our device state and intialize it */
+       /* allocate memory for our device state and initialize it */
  
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL) {
index 3d12c1737edce5e3d5c9e0971bf988cab6063c9e,cde02839258a723d5c520196c22b5df540a5ae30..a145a15cfdb39d865a62200a83298192f2670098
@@@ -174,37 -174,37 +174,37 @@@ static void usb_tranzport_abort_transfe
                        usb_kill_urb(dev->interrupt_out_urb);
  }
  
- #define show_int(value)                                                       \
-   static ssize_t show_##value(struct device *dev,                     \
+ #define show_int(value)       \
+       static ssize_t show_##value(struct device *dev, \
                              struct device_attribute *attr, char *buf) \
-   {                                                                   \
-     struct usb_interface *intf = to_usb_interface(dev);                       \
-     struct usb_tranzport *t = usb_get_intfdata(intf);                 \
-     return sprintf(buf, "%d\n", t->value);                            \
-   }                                                                   \
-   static DEVICE_ATTR(value, S_IRUGO, show_##value, NULL);
- #define show_set_int(value)                                           \
-   static ssize_t show_##value(struct device *dev,                     \
+       {       \
+               struct usb_interface *intf = to_usb_interface(dev);     \
+               struct usb_tranzport *t = usb_get_intfdata(intf);       \
+               return sprintf(buf, "%d\n", t->value);  \
+       }       \
+       static DEVICE_ATTR(value, S_IRUGO, show_##value, NULL);
+ #define show_set_int(value)   \
+       static ssize_t show_##value(struct device *dev, \
                              struct device_attribute *attr, char *buf) \
-   {                                                                   \
-     struct usb_interface *intf = to_usb_interface(dev);                       \
-     struct usb_tranzport *t = usb_get_intfdata(intf);                 \
-     return sprintf(buf, "%d\n", t->value);                            \
-   }                                                                   \
-   static ssize_t set_##value(struct device *dev,                      \
+       {       \
+               struct usb_interface *intf = to_usb_interface(dev);     \
+               struct usb_tranzport *t = usb_get_intfdata(intf);       \
+               return sprintf(buf, "%d\n", t->value);  \
+       }       \
+       static ssize_t set_##value(struct device *dev,  \
                             struct device_attribute *attr,             \
                             const char *buf, size_t count)             \
-   {                                                                   \
-     struct usb_interface *intf = to_usb_interface(dev);                       \
-     struct usb_tranzport *t = usb_get_intfdata(intf);                 \
-     unsigned long temp;                                                       \
-     if (strict_strtoul(buf, 10, &temp))                                       \
-       return -EINVAL;                                                 \
-     t->value = temp;                                                  \
-     return count;                                                     \
-   }                                                                   \
-   static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
+       {       \
+               struct usb_interface *intf = to_usb_interface(dev);     \
+               struct usb_tranzport *t = usb_get_intfdata(intf);       \
+               unsigned long temp;     \
+               if (strict_strtoul(buf, 10, &temp))     \
+                       return -EINVAL; \
+               t->value = temp;        \
+               return count;   \
+       }       \
+       static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
  
  show_int(enable);
  show_int(offline);
@@@ -767,7 -767,6 +767,7 @@@ static const struct file_operations usb
        .open = usb_tranzport_open,
        .release = usb_tranzport_release,
        .poll = usb_tranzport_poll,
 +      .llseek = no_llseek,
  };
  
  /*
@@@ -796,7 -795,7 +796,7 @@@ static int usb_tranzport_probe(struct u
        int true_size;
        int retval = -ENOMEM;
  
-       /* allocate memory for our device state and intialize it */
+       /* allocate memory for our device state and initialize it */
  
         dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL) {
index 8284297b30e9bbb4951ae71c53be5d5565677155,039f0e5b216252790ae1e3023b2b4ae50f2f2f88..3f81ca59106497841f7e45a5fb46b2d6d80b897b
@@@ -25,7 -25,7 +25,7 @@@
  #include <linux/major.h>
  #include <linux/delay.h>
  #include <linux/hdreg.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/slab.h>
  #include <scsi/scsi.h>
  #include <scsi/scsi_cmnd.h>
@@@ -124,7 -124,6 +124,7 @@@ struct blkvsc_driver_context 
  };
  
  /* Static decl */
 +static DEFINE_MUTEX(blkvsc_mutex);
  static int blkvsc_probe(struct device *dev);
  static int blkvsc_remove(struct device *device);
  static void blkvsc_shutdown(struct device *device);
@@@ -177,8 -176,6 +177,6 @@@ static int blkvsc_drv_init(int (*drv_in
        struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
        int ret;
  
-       vmbus_get_interface(&storvsc_drv_obj->Base.VmbusChannelInterface);
        storvsc_drv_obj->RingBufferSize = blkvsc_ringbuffer_size;
  
        /* Callback to client driver to complete the initialization */
@@@ -1310,7 -1307,7 +1308,7 @@@ static int blkvsc_open(struct block_dev
        DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users,
                   blkdev->gd->disk_name);
  
 -      lock_kernel();
 +      mutex_lock(&blkvsc_mutex);
        spin_lock(&blkdev->lock);
  
        if (!blkdev->users && blkdev->device_type == DVD_TYPE) {
        blkdev->users++;
  
        spin_unlock(&blkdev->lock);
 -      unlock_kernel();
 +      mutex_unlock(&blkvsc_mutex);
        return 0;
  }
  
@@@ -1333,7 -1330,7 +1331,7 @@@ static int blkvsc_release(struct gendis
        DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users,
                   blkdev->gd->disk_name);
  
 -      lock_kernel();
 +      mutex_lock(&blkvsc_mutex);
        spin_lock(&blkdev->lock);
        if (blkdev->users == 1) {
                spin_unlock(&blkdev->lock);
        blkdev->users--;
  
        spin_unlock(&blkdev->lock);
 -      unlock_kernel();
 +      mutex_unlock(&blkvsc_mutex);
        return 0;
  }
  
index 64a01147ecaeffc17863bd0002df415da56da8f2,d5d4d5de2f39dba5533ae1c10302ce9743f80b45..141535295a41020b7905767edad69d4156f2b143
@@@ -59,7 -59,7 +59,7 @@@ struct netvsc_driver_context 
  /* Need this many pages to handle worst case fragmented packet */
  #define PACKET_PAGES_HIWATER  (MAX_SKB_FRAGS + 2)
  
- static int ring_size = roundup_pow_of_two(2*MAX_SKB_FRAGS+1);
+ static int ring_size = 128;
  module_param(ring_size, int, S_IRUGO);
  MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
  
@@@ -327,9 -327,6 +327,9 @@@ static const struct net_device_ops devi
        .ndo_stop =                     netvsc_close,
        .ndo_start_xmit =               netvsc_start_xmit,
        .ndo_set_multicast_list =       netvsc_set_multicast_list,
 +      .ndo_change_mtu =               eth_change_mtu,
 +      .ndo_validate_addr =            eth_validate_addr,
 +      .ndo_set_mac_address =          eth_mac_addr,
  };
  
  static int netvsc_probe(struct device *device)
@@@ -495,8 -492,6 +495,6 @@@ static int netvsc_drv_init(int (*drv_in
        struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
        int ret;
  
-       vmbus_get_interface(&net_drv_obj->Base.VmbusChannelInterface);
        net_drv_obj->RingBufferSize = ring_size * PAGE_SIZE;
        net_drv_obj->OnReceiveCallback = netvsc_recv_callback;
        net_drv_obj->OnLinkStatusChanged = netvsc_linkstatus_callback;
index 62882a437aa45abb072fede360ffa3672dc37b9d,b267799ac0452eaf544c697b77ea70ec49b23acc..41d9acf4cd6119c1d52254df01faaf793e47e622
@@@ -141,8 -141,6 +141,6 @@@ static int storvsc_drv_init(int (*drv_i
        struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
        struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
  
-       vmbus_get_interface(&storvsc_drv_obj->Base.VmbusChannelInterface);
        storvsc_drv_obj->RingBufferSize = storvsc_ringbuffer_size;
  
        /* Callback to client driver to complete the initialization */
@@@ -495,7 -493,7 +493,7 @@@ static unsigned int copy_to_bounce_buff
  
                /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */
  
 -              if (j == 0)
 +              if (bounce_addr == 0)
                        bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
  
                while (srclen) {
@@@ -556,7 -554,7 +554,7 @@@ static unsigned int copy_from_bounce_bu
                destlen = orig_sgl[i].length;
                /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length <= PAGE_SIZE); */
  
 -              if (j == 0)
 +              if (bounce_addr == 0)
                        bounce_addr = (unsigned long)kmap_atomic(sg_page((&bounce_sgl[j])), KM_IRQ0);
  
                while (destlen) {
@@@ -615,7 -613,6 +613,7 @@@ static int storvsc_queuecommand(struct 
        unsigned int request_size = 0;
        int i;
        struct scatterlist *sgl;
 +      unsigned int sg_count = 0;
  
        DPRINT_DBG(STORVSC_DRV, "scmnd %p dir %d, use_sg %d buf %p len %d "
                   "queue depth %d tagged %d", scmnd, scmnd->sc_data_direction,
        request->DataBuffer.Length = scsi_bufflen(scmnd);
        if (scsi_sg_count(scmnd)) {
                sgl = (struct scatterlist *)scsi_sglist(scmnd);
 +              sg_count = scsi_sg_count(scmnd);
  
                /* check if we need to bounce the sgl */
                if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) {
                                              scsi_sg_count(scmnd));
  
                        sgl = cmd_request->bounce_sgl;
 +                      sg_count = cmd_request->bounce_sgl_count;
                }
  
                request->DataBuffer.Offset = sgl[0].offset;
  
 -              for (i = 0; i < scsi_sg_count(scmnd); i++) {
 +              for (i = 0; i < sg_count; i++) {
                        DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n",
                                   i, sgl[i].length, sgl[i].offset);
                        request->DataBuffer.PfnArray[i] =
 -                                      page_to_pfn(sg_page((&sgl[i])));
 +                              page_to_pfn(sg_page((&sgl[i])));
                }
        } else if (scsi_sglist(scmnd)) {
                /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
index 92a212f064bdfcfa319d5e4cfe030317b3684e17,cefeb647b81b1649fb8965b5def335272d9b1b27..f3bf111f354f592ce3592865bb2a85692a0a2d18
  #define IIO_ID_FORMAT IIO_ID_PREFIX "%d"
  
  /* IDR to assign each registered device a unique id*/
- static DEFINE_IDR(iio_idr);
+ static DEFINE_IDA(iio_ida);
  /* IDR to allocate character device minor numbers */
- static DEFINE_IDR(iio_chrdev_idr);
+ static DEFINE_IDA(iio_chrdev_ida);
  /* Lock used to protect both of the above */
- static DEFINE_SPINLOCK(iio_idr_lock);
+ static DEFINE_SPINLOCK(iio_ida_lock);
  
  dev_t iio_devt;
  EXPORT_SYMBOL(iio_devt);
@@@ -59,7 -59,7 +59,7 @@@ EXPORT_SYMBOL(__iio_change_event)
   * are queued. Hence a client MUST open the chrdev before the ring buffer is
   * switched on.
   */
 int __iio_push_event(struct iio_event_interface *ev_int,
+ int __iio_push_event(struct iio_event_interface *ev_int,
                     int ev_code,
                     s64 timestamp,
                     struct iio_shared_ev_pointer *
@@@ -125,19 -125,10 +125,10 @@@ static irqreturn_t iio_interrupt_handle
        }
  
        time_ns = iio_get_time_ns();
-       /* detect single element list*/
-       if (list_is_singular(&int_info->ev_list)) {
+       list_for_each_entry(p, &int_info->ev_list, list) {
                disable_irq_nosync(irq);
-               p = list_first_entry(&int_info->ev_list,
-                                    struct iio_event_handler_list,
-                                    list);
-               /* single event handler - maybe shared */
                p->handler(dev_info, 1, time_ns, !(p->refcount > 1));
-       } else
-               list_for_each_entry(p, &int_info->ev_list, list) {
-                       disable_irq_nosync(irq);
-                       p->handler(dev_info, 1, time_ns, 0);
-               }
+       }
        spin_unlock_irqrestore(&int_info->ev_list_lock, flags);
  
        return IRQ_HANDLED;
@@@ -349,7 -340,6 +340,7 @@@ static const struct file_operations iio
        .release = iio_event_chrdev_release,
        .open = iio_event_chrdev_open,
        .owner = THIS_MODULE,
 +      .llseek = noop_llseek,
  };
  
  static void iio_event_dev_release(struct device *dev)
@@@ -368,14 -358,14 +359,14 @@@ int iio_device_get_chrdev_minor(void
  {
        int ret, val;
  
- idr_again:
-       if (unlikely(idr_pre_get(&iio_chrdev_idr, GFP_KERNEL) == 0))
+ ida_again:
+       if (unlikely(ida_pre_get(&iio_chrdev_ida, GFP_KERNEL) == 0))
                return -ENOMEM;
-       spin_lock(&iio_idr_lock);
-       ret = idr_get_new(&iio_chrdev_idr, NULL, &val);
-       spin_unlock(&iio_idr_lock);
+       spin_lock(&iio_ida_lock);
+       ret = ida_get_new(&iio_chrdev_ida, &val);
+       spin_unlock(&iio_ida_lock);
        if (unlikely(ret == -EAGAIN))
-               goto idr_again;
+               goto ida_again;
        else if (unlikely(ret))
                return ret;
        if (val > IIO_DEV_MAX)
  
  void iio_device_free_chrdev_minor(int val)
  {
-       spin_lock(&iio_idr_lock);
-       idr_remove(&iio_chrdev_idr, val);
-       spin_unlock(&iio_idr_lock);
+       spin_lock(&iio_ida_lock);
+       ida_remove(&iio_chrdev_ida, val);
+       spin_unlock(&iio_ida_lock);
  }
  
  int iio_setup_ev_int(struct iio_event_interface *ev_int,
@@@ -508,62 -498,49 +499,49 @@@ static int iio_device_register_sysfs(st
                goto error_ret;
        }
  
-       if (dev_info->scan_el_attrs) {
-               ret = sysfs_create_group(&dev_info->dev.kobj,
-                                        dev_info->scan_el_attrs);
-               if (ret)
-                       dev_err(&dev_info->dev,
-                               "Failed to add sysfs scan els\n");
-       }
  error_ret:
        return ret;
  }
  
  static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
  {
-       if (dev_info->scan_el_attrs)
-               sysfs_remove_group(&dev_info->dev.kobj,
-                                  dev_info->scan_el_attrs);
        sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
  }
  
  /* Return a negative errno on failure */
- int iio_get_new_idr_val(struct idr *this_idr)
+ int iio_get_new_ida_val(struct ida *this_ida)
  {
        int ret;
        int val;
  
- idr_again:
-       if (unlikely(idr_pre_get(this_idr, GFP_KERNEL) == 0))
+ ida_again:
+       if (unlikely(ida_pre_get(this_ida, GFP_KERNEL) == 0))
                return -ENOMEM;
  
-       spin_lock(&iio_idr_lock);
-       ret = idr_get_new(this_idr, NULL, &val);
-       spin_unlock(&iio_idr_lock);
+       spin_lock(&iio_ida_lock);
+       ret = ida_get_new(this_ida, &val);
+       spin_unlock(&iio_ida_lock);
        if (unlikely(ret == -EAGAIN))
-               goto idr_again;
+               goto ida_again;
        else if (unlikely(ret))
                return ret;
  
        return val;
  }
- EXPORT_SYMBOL(iio_get_new_idr_val);
+ EXPORT_SYMBOL(iio_get_new_ida_val);
  
- void iio_free_idr_val(struct idr *this_idr, int id)
+ void iio_free_ida_val(struct ida *this_ida, int id)
  {
-       spin_lock(&iio_idr_lock);
-       idr_remove(this_idr, id);
-       spin_unlock(&iio_idr_lock);
+       spin_lock(&iio_ida_lock);
+       ida_remove(this_ida, id);
+       spin_unlock(&iio_ida_lock);
  }
- EXPORT_SYMBOL(iio_free_idr_val);
+ EXPORT_SYMBOL(iio_free_ida_val);
  
  static int iio_device_register_id(struct iio_dev *dev_info,
-                                 struct idr *this_idr)
+                                 struct ida *this_ida)
  {
-       dev_info->id = iio_get_new_idr_val(&iio_idr);
+       dev_info->id = iio_get_new_ida_val(&iio_ida);
        if (dev_info->id < 0)
                return dev_info->id;
        return 0;
  
  static void iio_device_unregister_id(struct iio_dev *dev_info)
  {
-       iio_free_idr_val(&iio_idr, dev_info->id);
+       iio_free_ida_val(&iio_ida, dev_info->id);
  }
  
  static inline int __iio_add_event_config_attrs(struct iio_dev *dev_info, int i)
@@@ -770,7 -747,7 +748,7 @@@ int iio_device_register(struct iio_dev 
  {
        int ret;
  
-       ret = iio_device_register_id(dev_info, &iio_idr);
+       ret = iio_device_register_id(dev_info, &iio_ida);
        if (ret) {
                dev_err(&dev_info->dev, "Failed to get id\n");
                goto error_ret;
  
        ret = device_add(&dev_info->dev);
        if (ret)
-               goto error_free_idr;
+               goto error_free_ida;
        ret = iio_device_register_sysfs(dev_info);
        if (ret) {
                dev_err(dev_info->dev.parent,
@@@ -801,7 -778,7 +779,7 @@@ error_free_sysfs
        iio_device_unregister_sysfs(dev_info);
  error_del_device:
        device_del(&dev_info->dev);
- error_free_idr:
+ error_free_ida:
        iio_device_unregister_id(dev_info);
  error_ret:
        return ret;
index 1c5f67253b823ba53291764d8e7dd7b757b317bb,d393ace0b41b88a6424994030608634962738a11..9a98fcdbe1096d1e3c7b31f6b71a6908cf1d95c5
   */
  #include <linux/kernel.h>
  #include <linux/device.h>
- #include <linux/interrupt.h>
  #include <linux/fs.h>
  #include <linux/poll.h>
- #include <linux/module.h>
  #include <linux/cdev.h>
  #include <linux/slab.h>
  
@@@ -53,7 -51,7 +51,7 @@@ int iio_push_or_escallate_ring_event(st
  EXPORT_SYMBOL(iio_push_or_escallate_ring_event);
  
  /**
-  * iio_ring_open() chrdev file open for ring buffer access
+  * iio_ring_open() chrdev file open for ring buffer access
   *
   * This function relies on all ring buffer implementations having an
   * iio_ring_buffer as their first element.
@@@ -72,7 -70,7 +70,7 @@@ static int iio_ring_open(struct inode *
  }
  
  /**
-  * iio_ring_release() -chrdev file close ring buffer access
+  * iio_ring_release() - chrdev file close ring buffer access
   *
   * This function relies on all ring buffer implementations having an
   * iio_ring_buffer as their first element.
@@@ -91,7 -89,7 +89,7 @@@ static int iio_ring_release(struct inod
  }
  
  /**
-  * iio_ring_rip_outer() chrdev read for ring buffer access
+  * iio_ring_rip_outer() chrdev read for ring buffer access
   *
   * This function relies on all ring buffer implementations having an
   * iio_ring _bufer as their first element.
@@@ -107,7 -105,7 +105,7 @@@ static ssize_t iio_ring_rip_outer(struc
                return -EINVAL;
        copied = rb->access.rip_lots(rb, count, &data, &dead_offset);
  
-       if (copied < 0) {
+       if (copied <= 0) {
                ret = copied;
                goto error_ret;
        }
@@@ -133,12 -131,12 +131,13 @@@ static const struct file_operations iio
        .release = iio_ring_release,
        .open = iio_ring_open,
        .owner = THIS_MODULE,
 +      .llseek = noop_llseek,
  };
  
  /**
-  * __iio_request_ring_buffer_event_chrdev() allocate ring event chrdev
+  * __iio_request_ring_buffer_event_chrdev() allocate ring event chrdev
   * @buf:      ring buffer whose event chrdev we are allocating
+  * @id:               id of this ring buffer (typically 0)
   * @owner:    the module who owns the ring buffer (for ref counting)
   * @dev:      device with which the chrdev is associated
   **/
@@@ -280,6 -278,16 +279,16 @@@ int iio_ring_buffer_register(struct iio
        if (ret)
                goto error_free_ring_buffer_event_chrdev;
  
+       if (ring->scan_el_attrs) {
+               ret = sysfs_create_group(&ring->dev.kobj,
+                                        ring->scan_el_attrs);
+               if (ret) {
+                       dev_err(&ring->dev,
+                               "Failed to add sysfs scan elements\n");
+                       goto error_free_ring_buffer_event_chrdev;
+               }
+       }
        return ret;
  error_free_ring_buffer_event_chrdev:
        __iio_free_ring_buffer_event_chrdev(ring);
@@@ -292,6 -300,10 +301,10 @@@ EXPORT_SYMBOL(iio_ring_buffer_register)
  
  void iio_ring_buffer_unregister(struct iio_ring_buffer *ring)
  {
+       if (ring->scan_el_attrs)
+               sysfs_remove_group(&ring->dev.kobj,
+                                  ring->scan_el_attrs);
        __iio_free_ring_buffer_access_chrdev(ring);
        __iio_free_ring_buffer_event_chrdev(ring);
        device_del(&ring->dev);
@@@ -313,7 -325,7 +326,7 @@@ ssize_t iio_read_ring_length(struct dev
  }
  EXPORT_SYMBOL(iio_read_ring_length);
  
 ssize_t iio_write_ring_length(struct device *dev,
+ ssize_t iio_write_ring_length(struct device *dev,
                               struct device_attribute *attr,
                               const char *buf,
                               size_t len)
  }
  EXPORT_SYMBOL(iio_write_ring_length);
  
- ssize_t iio_read_ring_bps(struct device *dev,
+ ssize_t iio_read_ring_bytes_per_datum(struct device *dev,
                          struct device_attribute *attr,
                          char *buf)
  {
        int len = 0;
        struct iio_ring_buffer *ring = dev_get_drvdata(dev);
  
-       if (ring->access.get_bpd)
+       if (ring->access.get_bytes_per_datum)
                len = sprintf(buf, "%d\n",
-                             ring->access.get_bpd(ring));
+                             ring->access.get_bytes_per_datum(ring));
  
        return len;
  }
- EXPORT_SYMBOL(iio_read_ring_bps);
+ EXPORT_SYMBOL(iio_read_ring_bytes_per_datum);
  
  ssize_t iio_store_ring_enable(struct device *dev,
                              struct device_attribute *attr,
@@@ -466,10 -478,10 +479,10 @@@ ssize_t iio_scan_el_show(struct device 
                         char *buf)
  {
        int ret;
-       struct iio_dev *indio_dev = dev_get_drvdata(dev);
+       struct iio_ring_buffer *ring = dev_get_drvdata(dev);
        struct iio_scan_el *this_el = to_iio_scan_el(attr);
  
-       ret = iio_scan_mask_query(indio_dev, this_el->number);
+       ret = iio_scan_mask_query(ring, this_el->number);
        if (ret < 0)
                return ret;
        return sprintf(buf, "%d\n", ret);
@@@ -483,7 -495,8 +496,8 @@@ ssize_t iio_scan_el_store(struct devic
  {
        int ret = 0;
        bool state;
-       struct iio_dev *indio_dev = dev_get_drvdata(dev);
+       struct iio_ring_buffer *ring = dev_get_drvdata(dev);
+       struct iio_dev *indio_dev = ring->indio_dev;
        struct iio_scan_el *this_el = to_iio_scan_el(attr);
  
        state = !(buf[0] == '0');
                ret = -EBUSY;
                goto error_ret;
        }
-       ret = iio_scan_mask_query(indio_dev, this_el->number);
+       ret = iio_scan_mask_query(ring, this_el->number);
        if (ret < 0)
                goto error_ret;
        if (!state && ret) {
-               ret = iio_scan_mask_clear(indio_dev, this_el->number);
+               ret = iio_scan_mask_clear(ring, this_el->number);
                if (ret)
                        goto error_ret;
-               indio_dev->scan_count--;
        } else if (state && !ret) {
-               ret = iio_scan_mask_set(indio_dev, this_el->number);
+               ret = iio_scan_mask_set(ring, this_el->number);
                if (ret)
                        goto error_ret;
-               indio_dev->scan_count++;
        }
        if (this_el->set_state)
                ret = this_el->set_state(this_el, indio_dev, state);
@@@ -520,8 -531,8 +532,8 @@@ ssize_t iio_scan_el_ts_show(struct devi
                            struct device_attribute *attr,
                            char *buf)
  {
-       struct iio_dev *indio_dev = dev_get_drvdata(dev);
-       return sprintf(buf, "%d\n", indio_dev->scan_timestamp);
+       struct iio_ring_buffer *ring = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", ring->scan_timestamp);
  }
  EXPORT_SYMBOL(iio_scan_el_ts_show);
  
@@@ -531,7 -542,8 +543,8 @@@ ssize_t iio_scan_el_ts_store(struct dev
                             size_t len)
  {
        int ret = 0;
-       struct iio_dev *indio_dev = dev_get_drvdata(dev);
+       struct iio_ring_buffer *ring = dev_get_drvdata(dev);
+       struct iio_dev *indio_dev = ring->indio_dev;
        bool state;
        state = !(buf[0] == '0');
        mutex_lock(&indio_dev->mlock);
                ret = -EBUSY;
                goto error_ret;
        }
-       indio_dev->scan_timestamp = state;
+       ring->scan_timestamp = state;
  error_ret:
        mutex_unlock(&indio_dev->mlock);
  
index ed5c5fe022c9f6a197e358059962f3d3bfc6b848,f763ec891ecb8391606e39f66669d2ba90fcc5b8..0da6b9518af9ea4e068051ca24706e97aa917faa
@@@ -115,8 -115,7 +115,8 @@@ static const struct file_operations dis
        .owner          = THIS_MODULE,
        .open           = &display_open,
        .write          = &vfd_write,
 -      .release        = &display_close
 +      .release        = &display_close,
 +      .llseek         = noop_llseek,
  };
  
  /*
@@@ -278,7 -277,7 +278,7 @@@ static int display_close(struct inode *
        struct imon_context *context = NULL;
        int retval = 0;
  
-       context = (struct imon_context *)file->private_data;
+       context = file->private_data;
  
        if (!context) {
                err("%s: no context for device", __func__);
@@@ -321,7 -320,6 +321,6 @@@ static int send_packet(struct imon_cont
        unsigned int pipe;
        int interval = 0;
        int retval = 0;
-       struct usb_ctrlrequest *control_req = NULL;
  
        /* Check if we need to use control or interrupt urb */
        pipe = usb_sndintpipe(context->usbdev,
                        err("%s: packet tx failed (%d)", __func__, retval);
        }
  
-       kfree(control_req);
        return retval;
  }
  
@@@ -384,7 -380,7 +381,7 @@@ static ssize_t vfd_write(struct file *f
                0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF };
        int *data_buf;
  
-       context = (struct imon_context *)file->private_data;
+       context = file->private_data;
        if (!context) {
                err("%s: no context for device", __func__);
                return -ENODEV;
@@@ -600,7 -596,7 +597,7 @@@ static void imon_incoming_packet(struc
        struct device *dev = context->driver->dev;
        int octet, bit;
        unsigned char mask;
-       int i, chunk_num;
+       int i;
  
        /*
         * just bail out if no listening IR client
                }
        }
  
-       if (chunk_num == 10) {
+       if (buf[7] == 10) {
                if (context->rx.count) {
                        submit_data(context);
                        context->rx.count = 0;
@@@ -877,7 -873,7 +874,7 @@@ static int imon_probe(struct usb_interf
        if (lirc_minor < 0) {
                err("%s: lirc_register_driver failed", __func__);
                alloc_status = 7;
-               goto alloc_status_switch;
+               goto unlock;
        } else
                dev_info(dev, "Registered iMON driver "
                         "(lirc minor: %d)\n", lirc_minor);
                 "usb<%d:%d> initialized\n", vendor, product, ifnum,
                 usbdev->bus->busnum, usbdev->devnum);
  
alloc_status_switch:
unlock:
        mutex_unlock(&context->ctx_lock);
+ alloc_status_switch:
  
        switch (alloc_status) {
        case 7:
index 8f72a84f34ec5ef0d98c330a2fb68d6206206626,2e681cf3e85da8a957624467ff7d8c25feb605d2..998485ebdbceb136c764449b3667872b32cc5090
@@@ -125,7 -125,6 +125,7 @@@ static const struct file_operations vfd
        .write          = &vfd_write,
        .unlocked_ioctl = &vfd_ioctl,
        .release        = &vfd_close,
 +      .llseek         = noop_llseek,
  };
  
  /* USB Device ID for Sasem USB Control Board */
@@@ -387,8 -386,10 +387,10 @@@ static ssize_t vfd_write(struct file *f
        }
  
        data_buf = memdup_user(buf, n_bytes);
-       if (PTR_ERR(data_buf))
-               return PTR_ERR(data_buf);
+       if (IS_ERR(data_buf)) {
+               retval = PTR_ERR(data_buf);
+               goto exit;
+       }
  
        memcpy(context->tx.data_buf, data_buf, n_bytes);
  
@@@ -513,7 -514,7 +515,7 @@@ exit
        mutex_unlock(&context->ctx_lock);
  
        mutex_unlock(&disconnect_lock);
-       return 0;
+       return retval;
  }
  
  /**
@@@ -804,7 -805,8 +806,8 @@@ static int sasem_probe(struct usb_inter
        if (lirc_minor < 0) {
                err("%s: lirc_register_driver failed", __func__);
                alloc_status = 7;
-               mutex_unlock(&context->ctx_lock);
+               retval = lirc_minor;
+               goto unlock;
        } else
                printk(KERN_INFO "%s: Registered Sasem driver (minor:%d)\n",
                        __func__, lirc_minor);
@@@ -829,7 -831,7 +832,7 @@@ alloc_status_switch
                context = NULL;
        case 1:
                retval = -ENOMEM;
-               goto exit;
+               goto unlock;
        }
  
        /* Needed while unregistering! */
  
        printk(KERN_INFO "%s: Sasem device on usb<%d:%d> initialized\n",
                        __func__, dev->bus->busnum, dev->devnum);
+ unlock:
        mutex_unlock(&context->ctx_lock);
  exit:
        return retval;
index ba8f670ec0a701200000d084987faa300f13faaa,33c09fad185699e08adea834672642e81c1b975c..d746715d3d894cbc10e02aa0e2c117442b30ddbf
@@@ -5,7 -5,8 +5,7 @@@
   *  Copyright (C) 2007-2010 Angelo Arrifano <miknix@gmail.com>
   *
   *  Information gathered from disassebled dsdt and from here:
 - *  "http://download.microsoft.com/download/9/c/5/
 - *  9c5b2167-8017-4bae-9fde-d599bac8184a/DirAppLaunch_Vista.doc"
 + *  <http://www.microsoft.com/whdc/system/platform/firmware/DirAppLaunch.mspx> 
   *
   *  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
@@@ -397,16 -398,15 +397,15 @@@ static int __init quickstart_init_input
  static int __init quickstart_init(void)
  {
        int ret;
-       acpi_status status = 0;
  
        /* ACPI Check */
        if (acpi_disabled)
                return -ENODEV;
  
        /* ACPI driver register */
-       status = acpi_bus_register_driver(&quickstart_acpi_driver);
-       if (status < 0)
-               return -ENODEV;
+       ret = acpi_bus_register_driver(&quickstart_acpi_driver);
+       if (ret)
+               return ret;
  
        /* If existing bus with no devices */
        if (!quickstart_data.btn_lst) {
index 0000000000000000000000000000000000000000,e668127c8b2e7bcd5fdab9aaab08ffc10ce6e163..2bc24a8c40390417d2537cd8518dc58ecd9eda2d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,55 +1,56 @@@
+ config SMB_FS
+       tristate "SMB file system support (OBSOLETE, please use CIFS)"
++      depends on BKL # probably unfixable
+       depends on INET
+       select NLS
+       help
+         SMB (Server Message Block) is the protocol Windows for Workgroups
+         (WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share
+         files and printers over local networks.  Saying Y here allows you to
+         mount their file systems (often called "shares" in this context) and
+         access them just like any other Unix directory.  Currently, this
+         works only if the Windows machines use TCP/IP as the underlying
+         transport protocol, and not NetBEUI.  For details, read
+         <file:Documentation/filesystems/smbfs.txt> and the SMB-HOWTO,
+         available from <http://www.tldp.org/docs.html#howto>.
+         Note: if you just want your box to act as an SMB *server* and make
+         files and printing services available to Windows clients (which need
+         to have a TCP/IP stack), you don't need to say Y here; you can use
+         the program SAMBA (available from <ftp://ftp.samba.org/pub/samba/>)
+         for that.
+         General information about how to connect Linux, Windows machines and
+         Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
+         To compile the SMB support as a module, choose M here:
+         the module will be called smbfs.  Most people say N, however.
+ config SMB_NLS_DEFAULT
+       bool "Use a default NLS"
+       depends on SMB_FS
+       help
+         Enabling this will make smbfs use nls translations by default. You
+         need to specify the local charset (CONFIG_NLS_DEFAULT) in the nls
+         settings and you need to give the default nls for the SMB server as
+         CONFIG_SMB_NLS_REMOTE.
+         The nls settings can be changed at mount time, if your smbmount
+         supports that, using the codepage and iocharset parameters.
+         smbmount from samba 2.2.0 or later supports this.
+ config SMB_NLS_REMOTE
+       string "Default Remote NLS Option"
+       depends on SMB_NLS_DEFAULT
+       default "cp437"
+       help
+         This setting allows you to specify a default value for which
+         codepage the server uses. If this field is left blank no
+         translations will be done by default. The local codepage/charset
+         default to CONFIG_NLS_DEFAULT.
+         The nls settings can be changed at mount time, if your smbmount
+         supports that, using the codepage and iocharset parameters.
+         smbmount from samba 2.2.0 or later supports this.
index 0000000000000000000000000000000000000000,936b3bb2099cf5879e6beca348a868011306d978..f088ea2f6ac9f27991d605b4093666d1a3d0843c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,702 +1,696 @@@
 -      spin_lock(&dentry->d_lock);
 -      for (;;) {
 -              struct dentry *parent;
+ /*
+  *  dir.c
+  *
+  *  Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
+  *  Copyright (C) 1997 by Volker Lendecke
+  *
+  *  Please add a note about your changes to smbfs in the ChangeLog file.
+  */
+ #include <linux/time.h>
+ #include <linux/errno.h>
+ #include <linux/kernel.h>
+ #include <linux/smp_lock.h>
+ #include <linux/ctype.h>
+ #include <linux/net.h>
+ #include <linux/sched.h>
+ #include "smb_fs.h"
+ #include "smb_mount.h"
+ #include "smbno.h"
+ #include "smb_debug.h"
+ #include "proto.h"
+ static int smb_readdir(struct file *, void *, filldir_t);
+ static int smb_dir_open(struct inode *, struct file *);
+ static struct dentry *smb_lookup(struct inode *, struct dentry *, struct nameidata *);
+ static int smb_create(struct inode *, struct dentry *, int, struct nameidata *);
+ static int smb_mkdir(struct inode *, struct dentry *, int);
+ static int smb_rmdir(struct inode *, struct dentry *);
+ static int smb_unlink(struct inode *, struct dentry *);
+ static int smb_rename(struct inode *, struct dentry *,
+                     struct inode *, struct dentry *);
+ static int smb_make_node(struct inode *,struct dentry *,int,dev_t);
+ static int smb_link(struct dentry *, struct inode *, struct dentry *);
+ const struct file_operations smb_dir_operations =
+ {
+       .llseek         = generic_file_llseek,
+       .read           = generic_read_dir,
+       .readdir        = smb_readdir,
+       .unlocked_ioctl = smb_ioctl,
+       .open           = smb_dir_open,
+ };
+ const struct inode_operations smb_dir_inode_operations =
+ {
+       .create         = smb_create,
+       .lookup         = smb_lookup,
+       .unlink         = smb_unlink,
+       .mkdir          = smb_mkdir,
+       .rmdir          = smb_rmdir,
+       .rename         = smb_rename,
+       .getattr        = smb_getattr,
+       .setattr        = smb_notify_change,
+ };
+ const struct inode_operations smb_dir_inode_operations_unix =
+ {
+       .create         = smb_create,
+       .lookup         = smb_lookup,
+       .unlink         = smb_unlink,
+       .mkdir          = smb_mkdir,
+       .rmdir          = smb_rmdir,
+       .rename         = smb_rename,
+       .getattr        = smb_getattr,
+       .setattr        = smb_notify_change,
+       .symlink        = smb_symlink,
+       .mknod          = smb_make_node,
+       .link           = smb_link,
+ };
+ /*
+  * Read a directory, using filldir to fill the dirent memory.
+  * smb_proc_readdir does the actual reading from the smb server.
+  *
+  * The cache code is almost directly taken from ncpfs
+  */
+ static int 
+ smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
+ {
+       struct dentry *dentry = filp->f_path.dentry;
+       struct inode *dir = dentry->d_inode;
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       union  smb_dir_cache *cache = NULL;
+       struct smb_cache_control ctl;
+       struct page *page = NULL;
+       int result;
+       ctl.page  = NULL;
+       ctl.cache = NULL;
+       VERBOSE("reading %s/%s, f_pos=%d\n",
+               DENTRY_PATH(dentry),  (int) filp->f_pos);
+       result = 0;
+       lock_kernel();
+       switch ((unsigned int) filp->f_pos) {
+       case 0:
+               if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
+                       goto out;
+               filp->f_pos = 1;
+               /* fallthrough */
+       case 1:
+               if (filldir(dirent, "..", 2, 1, parent_ino(dentry), DT_DIR) < 0)
+                       goto out;
+               filp->f_pos = 2;
+       }
+       /*
+        * Make sure our inode is up-to-date.
+        */
+       result = smb_revalidate_inode(dentry);
+       if (result)
+               goto out;
+       page = grab_cache_page(&dir->i_data, 0);
+       if (!page)
+               goto read_really;
+       ctl.cache = cache = kmap(page);
+       ctl.head  = cache->head;
+       if (!PageUptodate(page) || !ctl.head.eof) {
+               VERBOSE("%s/%s, page uptodate=%d, eof=%d\n",
+                        DENTRY_PATH(dentry), PageUptodate(page),ctl.head.eof);
+               goto init_cache;
+       }
+       if (filp->f_pos == 2) {
+               if (jiffies - ctl.head.time >= SMB_MAX_AGE(server))
+                       goto init_cache;
+               /*
+                * N.B. ncpfs checks mtime of dentry too here, we don't.
+                *   1. common smb servers do not update mtime on dir changes
+                *   2. it requires an extra smb request
+                *      (revalidate has the same timeout as ctl.head.time)
+                *
+                * Instead smbfs invalidates its own cache on local changes
+                * and remote changes are not seen until timeout.
+                */
+       }
+       if (filp->f_pos > ctl.head.end)
+               goto finished;
+       ctl.fpos = filp->f_pos + (SMB_DIRCACHE_START - 2);
+       ctl.ofs  = ctl.fpos / SMB_DIRCACHE_SIZE;
+       ctl.idx  = ctl.fpos % SMB_DIRCACHE_SIZE;
+       for (;;) {
+               if (ctl.ofs != 0) {
+                       ctl.page = find_lock_page(&dir->i_data, ctl.ofs);
+                       if (!ctl.page)
+                               goto invalid_cache;
+                       ctl.cache = kmap(ctl.page);
+                       if (!PageUptodate(ctl.page))
+                               goto invalid_cache;
+               }
+               while (ctl.idx < SMB_DIRCACHE_SIZE) {
+                       struct dentry *dent;
+                       int res;
+                       dent = smb_dget_fpos(ctl.cache->dentry[ctl.idx],
+                                            dentry, filp->f_pos);
+                       if (!dent)
+                               goto invalid_cache;
+                       res = filldir(dirent, dent->d_name.name,
+                                     dent->d_name.len, filp->f_pos,
+                                     dent->d_inode->i_ino, DT_UNKNOWN);
+                       dput(dent);
+                       if (res)
+                               goto finished;
+                       filp->f_pos += 1;
+                       ctl.idx += 1;
+                       if (filp->f_pos > ctl.head.end)
+                               goto finished;
+               }
+               if (ctl.page) {
+                       kunmap(ctl.page);
+                       SetPageUptodate(ctl.page);
+                       unlock_page(ctl.page);
+                       page_cache_release(ctl.page);
+                       ctl.page = NULL;
+               }
+               ctl.idx  = 0;
+               ctl.ofs += 1;
+       }
+ invalid_cache:
+       if (ctl.page) {
+               kunmap(ctl.page);
+               unlock_page(ctl.page);
+               page_cache_release(ctl.page);
+               ctl.page = NULL;
+       }
+       ctl.cache = cache;
+ init_cache:
+       smb_invalidate_dircache_entries(dentry);
+       ctl.head.time = jiffies;
+       ctl.head.eof = 0;
+       ctl.fpos = 2;
+       ctl.ofs = 0;
+       ctl.idx = SMB_DIRCACHE_START;
+       ctl.filled = 0;
+       ctl.valid  = 1;
+ read_really:
+       result = server->ops->readdir(filp, dirent, filldir, &ctl);
+       if (result == -ERESTARTSYS && page)
+               ClearPageUptodate(page);
+       if (ctl.idx == -1)
+               goto invalid_cache;     /* retry */
+       ctl.head.end = ctl.fpos - 1;
+       ctl.head.eof = ctl.valid;
+ finished:
+       if (page) {
+               cache->head = ctl.head;
+               kunmap(page);
+               if (result != -ERESTARTSYS)
+                       SetPageUptodate(page);
+               unlock_page(page);
+               page_cache_release(page);
+       }
+       if (ctl.page) {
+               kunmap(ctl.page);
+               SetPageUptodate(ctl.page);
+               unlock_page(ctl.page);
+               page_cache_release(ctl.page);
+       }
+ out:
+       unlock_kernel();
+       return result;
+ }
+ static int
+ smb_dir_open(struct inode *dir, struct file *file)
+ {
+       struct dentry *dentry = file->f_path.dentry;
+       struct smb_sb_info *server;
+       int error = 0;
+       VERBOSE("(%s/%s)\n", dentry->d_parent->d_name.name,
+               file->f_path.dentry->d_name.name);
+       /*
+        * Directory timestamps in the core protocol aren't updated
+        * when a file is added, so we give them a very short TTL.
+        */
+       lock_kernel();
+       server = server_from_dentry(dentry);
+       if (server->opt.protocol < SMB_PROTOCOL_LANMAN2) {
+               unsigned long age = jiffies - SMB_I(dir)->oldmtime;
+               if (age > 2*HZ)
+                       smb_invalid_dir_cache(dir);
+       }
+       /*
+        * Note: in order to allow the smbmount process to open the
+        * mount point, we only revalidate if the connection is valid or
+        * if the process is trying to access something other than the root.
+        */
+       if (server->state == CONN_VALID || !IS_ROOT(dentry))
+               error = smb_revalidate_inode(dentry);
+       unlock_kernel();
+       return error;
+ }
+ /*
+  * Dentry operations routines
+  */
+ static int smb_lookup_validate(struct dentry *, struct nameidata *);
+ static int smb_hash_dentry(struct dentry *, struct qstr *);
+ static int smb_compare_dentry(struct dentry *, struct qstr *, struct qstr *);
+ static int smb_delete_dentry(struct dentry *);
+ static const struct dentry_operations smbfs_dentry_operations =
+ {
+       .d_revalidate   = smb_lookup_validate,
+       .d_hash         = smb_hash_dentry,
+       .d_compare      = smb_compare_dentry,
+       .d_delete       = smb_delete_dentry,
+ };
+ static const struct dentry_operations smbfs_dentry_operations_case =
+ {
+       .d_revalidate   = smb_lookup_validate,
+       .d_delete       = smb_delete_dentry,
+ };
+ /*
+  * This is the callback when the dcache has a lookup hit.
+  */
+ static int
+ smb_lookup_validate(struct dentry * dentry, struct nameidata *nd)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       struct inode * inode = dentry->d_inode;
+       unsigned long age = jiffies - dentry->d_time;
+       int valid;
+       /*
+        * The default validation is based on dentry age:
+        * we believe in dentries for a few seconds.  (But each
+        * successful server lookup renews the timestamp.)
+        */
+       valid = (age <= SMB_MAX_AGE(server));
+ #ifdef SMBFS_DEBUG_VERBOSE
+       if (!valid)
+               VERBOSE("%s/%s not valid, age=%lu\n", 
+                       DENTRY_PATH(dentry), age);
+ #endif
+       if (inode) {
+               lock_kernel();
+               if (is_bad_inode(inode)) {
+                       PARANOIA("%s/%s has dud inode\n", DENTRY_PATH(dentry));
+                       valid = 0;
+               } else if (!valid)
+                       valid = (smb_revalidate_inode(dentry) == 0);
+               unlock_kernel();
+       } else {
+               /*
+                * What should we do for negative dentries?
+                */
+       }
+       return valid;
+ }
+ static int 
+ smb_hash_dentry(struct dentry *dir, struct qstr *this)
+ {
+       unsigned long hash;
+       int i;
+       hash = init_name_hash();
+       for (i=0; i < this->len ; i++)
+               hash = partial_name_hash(tolower(this->name[i]), hash);
+       this->hash = end_name_hash(hash);
+   
+       return 0;
+ }
+ static int
+ smb_compare_dentry(struct dentry *dir, struct qstr *a, struct qstr *b)
+ {
+       int i, result = 1;
+       if (a->len != b->len)
+               goto out;
+       for (i=0; i < a->len; i++) {
+               if (tolower(a->name[i]) != tolower(b->name[i]))
+                       goto out;
+       }
+       result = 0;
+ out:
+       return result;
+ }
+ /*
+  * This is the callback from dput() when d_count is going to 0.
+  * We use this to unhash dentries with bad inodes.
+  */
+ static int
+ smb_delete_dentry(struct dentry * dentry)
+ {
+       if (dentry->d_inode) {
+               if (is_bad_inode(dentry->d_inode)) {
+                       PARANOIA("bad inode, unhashing %s/%s\n",
+                                DENTRY_PATH(dentry));
+                       return 1;
+               }
+       } else {
+               /* N.B. Unhash negative dentries? */
+       }
+       return 0;
+ }
+ /*
+  * Initialize a new dentry
+  */
+ void
+ smb_new_dentry(struct dentry *dentry)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       if (server->mnt->flags & SMB_MOUNT_CASE)
+               dentry->d_op = &smbfs_dentry_operations_case;
+       else
+               dentry->d_op = &smbfs_dentry_operations;
+       dentry->d_time = jiffies;
+ }
+ /*
+  * Whenever a lookup succeeds, we know the parent directories
+  * are all valid, so we want to update the dentry timestamps.
+  * N.B. Move this to dcache?
+  */
+ void
+ smb_renew_times(struct dentry * dentry)
+ {
+       dget(dentry);
 -              dentry->d_time = jiffies;
 -              if (IS_ROOT(dentry))
 -                      break;
 -              parent = dentry->d_parent;
 -              dget(parent);
 -              spin_unlock(&dentry->d_lock);
++      dentry->d_time = jiffies;
 -              spin_lock(&dentry->d_lock);
++      while (!IS_ROOT(dentry)) {
++              struct dentry *parent = dget_parent(dentry);
+               dput(dentry);
+               dentry = parent;
 -      spin_unlock(&dentry->d_lock);
++
++              dentry->d_time = jiffies;
+       }
+       dput(dentry);
+ }
+ static struct dentry *
+ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
+ {
+       struct smb_fattr finfo;
+       struct inode *inode;
+       int error;
+       struct smb_sb_info *server;
+       error = -ENAMETOOLONG;
+       if (dentry->d_name.len > SMB_MAXNAMELEN)
+               goto out;
+       /* Do not allow lookup of names with backslashes in */
+       error = -EINVAL;
+       if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
+               goto out;
+       lock_kernel();
+       error = smb_proc_getattr(dentry, &finfo);
+ #ifdef SMBFS_PARANOIA
+       if (error && error != -ENOENT)
+               PARANOIA("find %s/%s failed, error=%d\n",
+                        DENTRY_PATH(dentry), error);
+ #endif
+       inode = NULL;
+       if (error == -ENOENT)
+               goto add_entry;
+       if (!error) {
+               error = -EACCES;
+               finfo.f_ino = iunique(dentry->d_sb, 2);
+               inode = smb_iget(dir->i_sb, &finfo);
+               if (inode) {
+       add_entry:
+                       server = server_from_dentry(dentry);
+                       if (server->mnt->flags & SMB_MOUNT_CASE)
+                               dentry->d_op = &smbfs_dentry_operations_case;
+                       else
+                               dentry->d_op = &smbfs_dentry_operations;
+                       d_add(dentry, inode);
+                       smb_renew_times(dentry);
+                       error = 0;
+               }
+       }
+       unlock_kernel();
+ out:
+       return ERR_PTR(error);
+ }
+ /*
+  * This code is common to all routines creating a new inode.
+  */
+ static int
+ smb_instantiate(struct dentry *dentry, __u16 fileid, int have_id)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       struct inode *inode;
+       int error;
+       struct smb_fattr fattr;
+       VERBOSE("file %s/%s, fileid=%u\n", DENTRY_PATH(dentry), fileid);
+       error = smb_proc_getattr(dentry, &fattr);
+       if (error)
+               goto out_close;
+       smb_renew_times(dentry);
+       fattr.f_ino = iunique(dentry->d_sb, 2);
+       inode = smb_iget(dentry->d_sb, &fattr);
+       if (!inode)
+               goto out_no_inode;
+       if (have_id) {
+               struct smb_inode_info *ei = SMB_I(inode);
+               ei->fileid = fileid;
+               ei->access = SMB_O_RDWR;
+               ei->open = server->generation;
+       }
+       d_instantiate(dentry, inode);
+ out:
+       return error;
+ out_no_inode:
+       error = -EACCES;
+ out_close:
+       if (have_id) {
+               PARANOIA("%s/%s failed, error=%d, closing %u\n",
+                        DENTRY_PATH(dentry), error, fileid);
+               smb_close_fileid(dentry, fileid);
+       }
+       goto out;
+ }
+ /* N.B. How should the mode argument be used? */
+ static int
+ smb_create(struct inode *dir, struct dentry *dentry, int mode,
+               struct nameidata *nd)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       __u16 fileid;
+       int error;
+       struct iattr attr;
+       VERBOSE("creating %s/%s, mode=%d\n", DENTRY_PATH(dentry), mode);
+       lock_kernel();
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_create(dentry, 0, get_seconds(), &fileid);
+       if (!error) {
+               if (server->opt.capabilities & SMB_CAP_UNIX) {
+                       /* Set attributes for new file */
+                       attr.ia_valid = ATTR_MODE;
+                       attr.ia_mode = mode;
+                       error = smb_proc_setattr_unix(dentry, &attr, 0, 0);
+               }
+               error = smb_instantiate(dentry, fileid, 1);
+       } else {
+               PARANOIA("%s/%s failed, error=%d\n",
+                        DENTRY_PATH(dentry), error);
+       }
+       unlock_kernel();
+       return error;
+ }
+ /* N.B. How should the mode argument be used? */
+ static int
+ smb_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       int error;
+       struct iattr attr;
+       lock_kernel();
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_mkdir(dentry);
+       if (!error) {
+               if (server->opt.capabilities & SMB_CAP_UNIX) {
+                       /* Set attributes for new directory */
+                       attr.ia_valid = ATTR_MODE;
+                       attr.ia_mode = mode;
+                       error = smb_proc_setattr_unix(dentry, &attr, 0, 0);
+               }
+               error = smb_instantiate(dentry, 0, 0);
+       }
+       unlock_kernel();
+       return error;
+ }
+ static int
+ smb_rmdir(struct inode *dir, struct dentry *dentry)
+ {
+       struct inode *inode = dentry->d_inode;
+       int error;
+       /*
+        * Close the directory if it's open.
+        */
+       lock_kernel();
+       smb_close(inode);
+       /*
+        * Check that nobody else is using the directory..
+        */
+       error = -EBUSY;
+       if (!d_unhashed(dentry))
+               goto out;
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_rmdir(dentry);
+ out:
+       unlock_kernel();
+       return error;
+ }
+ static int
+ smb_unlink(struct inode *dir, struct dentry *dentry)
+ {
+       int error;
+       /*
+        * Close the file if it's open.
+        */
+       lock_kernel();
+       smb_close(dentry->d_inode);
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_unlink(dentry);
+       if (!error)
+               smb_renew_times(dentry);
+       unlock_kernel();
+       return error;
+ }
+ static int
+ smb_rename(struct inode *old_dir, struct dentry *old_dentry,
+          struct inode *new_dir, struct dentry *new_dentry)
+ {
+       int error;
+       /*
+        * Close any open files, and check whether to delete the
+        * target before attempting the rename.
+        */
+       lock_kernel();
+       if (old_dentry->d_inode)
+               smb_close(old_dentry->d_inode);
+       if (new_dentry->d_inode) {
+               smb_close(new_dentry->d_inode);
+               error = smb_proc_unlink(new_dentry);
+               if (error) {
+                       VERBOSE("unlink %s/%s, error=%d\n",
+                               DENTRY_PATH(new_dentry), error);
+                       goto out;
+               }
+               /* FIXME */
+               d_delete(new_dentry);
+       }
+       smb_invalid_dir_cache(old_dir);
+       smb_invalid_dir_cache(new_dir);
+       error = smb_proc_mv(old_dentry, new_dentry);
+       if (!error) {
+               smb_renew_times(old_dentry);
+               smb_renew_times(new_dentry);
+       }
+ out:
+       unlock_kernel();
+       return error;
+ }
+ /*
+  * FIXME: samba servers won't let you create device nodes unless uid/gid
+  * matches the connection credentials (and we don't know which those are ...)
+  */
+ static int
+ smb_make_node(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+ {
+       int error;
+       struct iattr attr;
+       attr.ia_valid = ATTR_MODE | ATTR_UID | ATTR_GID;
+       attr.ia_mode = mode;
+       current_euid_egid(&attr.ia_uid, &attr.ia_gid);
+       if (!new_valid_dev(dev))
+               return -EINVAL;
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_setattr_unix(dentry, &attr, MAJOR(dev), MINOR(dev));
+       if (!error) {
+               error = smb_instantiate(dentry, 0, 0);
+       }
+       return error;
+ }
+ /*
+  * dentry = existing file
+  * new_dentry = new file
+  */
+ static int
+ smb_link(struct dentry *dentry, struct inode *dir, struct dentry *new_dentry)
+ {
+       int error;
+       DEBUG1("smb_link old=%s/%s new=%s/%s\n",
+              DENTRY_PATH(dentry), DENTRY_PATH(new_dentry));
+       smb_invalid_dir_cache(dir);
+       error = smb_proc_link(server_from_dentry(dentry), dentry, new_dentry);
+       if (!error) {
+               smb_renew_times(dentry);
+               error = smb_instantiate(new_dentry, 0, 0);
+       }
+       return error;
+ }
index 0000000000000000000000000000000000000000,9287599ddb5068a6a52428afe632d7592f605bb5..552951aa749834ebc9d61baa4368d066e9f858ef
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,839 +1,843 @@@
 -      invalidate_inodes(SB_of(server));
+ /*
+  *  inode.c
+  *
+  *  Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
+  *  Copyright (C) 1997 by Volker Lendecke
+  *
+  *  Please add a note about your changes to smbfs in the ChangeLog file.
+  */
+ #include <linux/module.h>
+ #include <linux/time.h>
+ #include <linux/kernel.h>
+ #include <linux/mm.h>
+ #include <linux/string.h>
+ #include <linux/stat.h>
+ #include <linux/errno.h>
+ #include <linux/slab.h>
+ #include <linux/init.h>
+ #include <linux/file.h>
+ #include <linux/dcache.h>
+ #include <linux/smp_lock.h>
+ #include <linux/nls.h>
+ #include <linux/seq_file.h>
+ #include <linux/mount.h>
+ #include <linux/net.h>
+ #include <linux/vfs.h>
+ #include <linux/highuid.h>
+ #include <linux/sched.h>
+ #include <asm/system.h>
+ #include <asm/uaccess.h>
+ #include "smb_fs.h"
+ #include "smbno.h"
+ #include "smb_mount.h"
+ #include "smb_debug.h"
+ #include "getopt.h"
+ #include "proto.h"
+ /* Always pick a default string */
+ #ifdef CONFIG_SMB_NLS_REMOTE
+ #define SMB_NLS_REMOTE CONFIG_SMB_NLS_REMOTE
+ #else
+ #define SMB_NLS_REMOTE ""
+ #endif
+ #define SMB_TTL_DEFAULT 1000
+ static void smb_evict_inode(struct inode *);
+ static void smb_put_super(struct super_block *);
+ static int  smb_statfs(struct dentry *, struct kstatfs *);
+ static int  smb_show_options(struct seq_file *, struct vfsmount *);
+ static struct kmem_cache *smb_inode_cachep;
+ static struct inode *smb_alloc_inode(struct super_block *sb)
+ {
+       struct smb_inode_info *ei;
+       ei = (struct smb_inode_info *)kmem_cache_alloc(smb_inode_cachep, GFP_KERNEL);
+       if (!ei)
+               return NULL;
+       return &ei->vfs_inode;
+ }
+ static void smb_destroy_inode(struct inode *inode)
+ {
+       kmem_cache_free(smb_inode_cachep, SMB_I(inode));
+ }
+ static void init_once(void *foo)
+ {
+       struct smb_inode_info *ei = (struct smb_inode_info *) foo;
+       inode_init_once(&ei->vfs_inode);
+ }
+ static int init_inodecache(void)
+ {
+       smb_inode_cachep = kmem_cache_create("smb_inode_cache",
+                                            sizeof(struct smb_inode_info),
+                                            0, (SLAB_RECLAIM_ACCOUNT|
+                                               SLAB_MEM_SPREAD),
+                                            init_once);
+       if (smb_inode_cachep == NULL)
+               return -ENOMEM;
+       return 0;
+ }
+ static void destroy_inodecache(void)
+ {
+       kmem_cache_destroy(smb_inode_cachep);
+ }
+ static int smb_remount(struct super_block *sb, int *flags, char *data)
+ {
+       *flags |= MS_NODIRATIME;
+       return 0;
+ }
+ static const struct super_operations smb_sops =
+ {
+       .alloc_inode    = smb_alloc_inode,
+       .destroy_inode  = smb_destroy_inode,
+       .drop_inode     = generic_delete_inode,
+       .evict_inode    = smb_evict_inode,
+       .put_super      = smb_put_super,
+       .statfs         = smb_statfs,
+       .show_options   = smb_show_options,
+       .remount_fs     = smb_remount,
+ };
+ /* We are always generating a new inode here */
+ struct inode *
+ smb_iget(struct super_block *sb, struct smb_fattr *fattr)
+ {
+       struct smb_sb_info *server = SMB_SB(sb);
+       struct inode *result;
+       DEBUG1("smb_iget: %p\n", fattr);
+       result = new_inode(sb);
+       if (!result)
+               return result;
+       result->i_ino = fattr->f_ino;
+       SMB_I(result)->open = 0;
+       SMB_I(result)->fileid = 0;
+       SMB_I(result)->access = 0;
+       SMB_I(result)->flags = 0;
+       SMB_I(result)->closed = 0;
+       SMB_I(result)->openers = 0;
+       smb_set_inode_attr(result, fattr);
+       if (S_ISREG(result->i_mode)) {
+               result->i_op = &smb_file_inode_operations;
+               result->i_fop = &smb_file_operations;
+               result->i_data.a_ops = &smb_file_aops;
+       } else if (S_ISDIR(result->i_mode)) {
+               if (server->opt.capabilities & SMB_CAP_UNIX)
+                       result->i_op = &smb_dir_inode_operations_unix;
+               else
+                       result->i_op = &smb_dir_inode_operations;
+               result->i_fop = &smb_dir_operations;
+       } else if (S_ISLNK(result->i_mode)) {
+               result->i_op = &smb_link_inode_operations;
+       } else {
+               init_special_inode(result, result->i_mode, fattr->f_rdev);
+       }
+       insert_inode_hash(result);
+       return result;
+ }
+ /*
+  * Copy the inode data to a smb_fattr structure.
+  */
+ void
+ smb_get_inode_attr(struct inode *inode, struct smb_fattr *fattr)
+ {
+       memset(fattr, 0, sizeof(struct smb_fattr));
+       fattr->f_mode   = inode->i_mode;
+       fattr->f_nlink  = inode->i_nlink;
+       fattr->f_ino    = inode->i_ino;
+       fattr->f_uid    = inode->i_uid;
+       fattr->f_gid    = inode->i_gid;
+       fattr->f_size   = inode->i_size;
+       fattr->f_mtime  = inode->i_mtime;
+       fattr->f_ctime  = inode->i_ctime;
+       fattr->f_atime  = inode->i_atime;
+       fattr->f_blocks = inode->i_blocks;
+       fattr->attr     = SMB_I(inode)->attr;
+       /*
+        * Keep the attributes in sync with the inode permissions.
+        */
+       if (fattr->f_mode & S_IWUSR)
+               fattr->attr &= ~aRONLY;
+       else
+               fattr->attr |= aRONLY;
+ }
+ /*
+  * Update the inode, possibly causing it to invalidate its pages if mtime/size
+  * is different from last time.
+  */
+ void
+ smb_set_inode_attr(struct inode *inode, struct smb_fattr *fattr)
+ {
+       struct smb_inode_info *ei = SMB_I(inode);
+       /*
+        * A size change should have a different mtime, or same mtime
+        * but different size.
+        */
+       time_t last_time = inode->i_mtime.tv_sec;
+       loff_t last_sz = inode->i_size;
+       inode->i_mode   = fattr->f_mode;
+       inode->i_nlink  = fattr->f_nlink;
+       inode->i_uid    = fattr->f_uid;
+       inode->i_gid    = fattr->f_gid;
+       inode->i_ctime  = fattr->f_ctime;
+       inode->i_blocks = fattr->f_blocks;
+       inode->i_size   = fattr->f_size;
+       inode->i_mtime  = fattr->f_mtime;
+       inode->i_atime  = fattr->f_atime;
+       ei->attr = fattr->attr;
+       /*
+        * Update the "last time refreshed" field for revalidation.
+        */
+       ei->oldmtime = jiffies;
+       if (inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz) {
+               VERBOSE("%ld changed, old=%ld, new=%ld, oz=%ld, nz=%ld\n",
+                       inode->i_ino,
+                       (long) last_time, (long) inode->i_mtime.tv_sec,
+                       (long) last_sz, (long) inode->i_size);
+               if (!S_ISDIR(inode->i_mode))
+                       invalidate_remote_inode(inode);
+       }
+ }
+ /*
+  * This is called if the connection has gone bad ...
+  * try to kill off all the current inodes.
+  */
+ void
+ smb_invalidate_inodes(struct smb_sb_info *server)
+ {
+       VERBOSE("\n");
+       shrink_dcache_sb(SB_of(server));
+ }
+ /*
+  * This is called to update the inode attributes after
+  * we've made changes to a file or directory.
+  */
+ static int
+ smb_refresh_inode(struct dentry *dentry)
+ {
+       struct inode *inode = dentry->d_inode;
+       int error;
+       struct smb_fattr fattr;
+       error = smb_proc_getattr(dentry, &fattr);
+       if (!error) {
+               smb_renew_times(dentry);
+               /*
+                * Check whether the type part of the mode changed,
+                * and don't update the attributes if it did.
+                *
+                * And don't dick with the root inode
+                */
+               if (inode->i_ino == 2)
+                       return error;
+               if (S_ISLNK(inode->i_mode))
+                       return error;   /* VFS will deal with it */
+               if ((inode->i_mode & S_IFMT) == (fattr.f_mode & S_IFMT)) {
+                       smb_set_inode_attr(inode, &fattr);
+               } else {
+                       /*
+                        * Big trouble! The inode has become a new object,
+                        * so any operations attempted on it are invalid.
+                        *
+                        * To limit damage, mark the inode as bad so that
+                        * subsequent lookup validations will fail.
+                        */
+                       PARANOIA("%s/%s changed mode, %07o to %07o\n",
+                                DENTRY_PATH(dentry),
+                                inode->i_mode, fattr.f_mode);
+                       fattr.f_mode = inode->i_mode; /* save mode */
+                       make_bad_inode(inode);
+                       inode->i_mode = fattr.f_mode; /* restore mode */
+                       /*
+                        * No need to worry about unhashing the dentry: the
+                        * lookup validation will see that the inode is bad.
+                        * But we do want to invalidate the caches ...
+                        */
+                       if (!S_ISDIR(inode->i_mode))
+                               invalidate_remote_inode(inode);
+                       else
+                               smb_invalid_dir_cache(inode);
+                       error = -EIO;
+               }
+       }
+       return error;
+ }
+ /*
+  * This is called when we want to check whether the inode
+  * has changed on the server.  If it has changed, we must
+  * invalidate our local caches.
+  */
+ int
+ smb_revalidate_inode(struct dentry *dentry)
+ {
+       struct smb_sb_info *s = server_from_dentry(dentry);
+       struct inode *inode = dentry->d_inode;
+       int error = 0;
+       DEBUG1("smb_revalidate_inode\n");
+       lock_kernel();
+       /*
+        * Check whether we've recently refreshed the inode.
+        */
+       if (time_before(jiffies, SMB_I(inode)->oldmtime + SMB_MAX_AGE(s))) {
+               VERBOSE("up-to-date, ino=%ld, jiffies=%lu, oldtime=%lu\n",
+                       inode->i_ino, jiffies, SMB_I(inode)->oldmtime);
+               goto out;
+       }
+       error = smb_refresh_inode(dentry);
+ out:
+       unlock_kernel();
+       return error;
+ }
+ /*
+  * This routine is called when i_nlink == 0 and i_count goes to 0.
+  * All blocking cleanup operations need to go here to avoid races.
+  */
+ static void
+ smb_evict_inode(struct inode *ino)
+ {
+       DEBUG1("ino=%ld\n", ino->i_ino);
+       truncate_inode_pages(&ino->i_data, 0);
+       end_writeback(ino);
+       lock_kernel();
+       if (smb_close(ino))
+               PARANOIA("could not close inode %ld\n", ino->i_ino);
+       unlock_kernel();
+ }
+ static struct option opts[] = {
+       { "version",    0, 'v' },
+       { "win95",      SMB_MOUNT_WIN95, 1 },
+       { "oldattr",    SMB_MOUNT_OLDATTR, 1 },
+       { "dirattr",    SMB_MOUNT_DIRATTR, 1 },
+       { "case",       SMB_MOUNT_CASE, 1 },
+       { "uid",        0, 'u' },
+       { "gid",        0, 'g' },
+       { "file_mode",  0, 'f' },
+       { "dir_mode",   0, 'd' },
+       { "iocharset",  0, 'i' },
+       { "codepage",   0, 'c' },
+       { "ttl",        0, 't' },
+       { NULL,         0, 0}
+ };
+ static int
+ parse_options(struct smb_mount_data_kernel *mnt, char *options)
+ {
+       int c;
+       unsigned long flags;
+       unsigned long value;
+       char *optarg;
+       char *optopt;
+       flags = 0;
+       while ( (c = smb_getopt("smbfs", &options, opts,
+                               &optopt, &optarg, &flags, &value)) > 0) {
+               VERBOSE("'%s' -> '%s'\n", optopt, optarg ? optarg : "<none>");
+               switch (c) {
+               case 1:
+                       /* got a "flag" option */
+                       break;
+               case 'v':
+                       if (value != SMB_MOUNT_VERSION) {
+                       printk ("smbfs: Bad mount version %ld, expected %d\n",
+                               value, SMB_MOUNT_VERSION);
+                               return 0;
+                       }
+                       mnt->version = value;
+                       break;
+               case 'u':
+                       mnt->uid = value;
+                       flags |= SMB_MOUNT_UID;
+                       break;
+               case 'g':
+                       mnt->gid = value;
+                       flags |= SMB_MOUNT_GID;
+                       break;
+               case 'f':
+                       mnt->file_mode = (value & S_IRWXUGO) | S_IFREG;
+                       flags |= SMB_MOUNT_FMODE;
+                       break;
+               case 'd':
+                       mnt->dir_mode = (value & S_IRWXUGO) | S_IFDIR;
+                       flags |= SMB_MOUNT_DMODE;
+                       break;
+               case 'i':
+                       strlcpy(mnt->codepage.local_name, optarg, 
+                               SMB_NLS_MAXNAMELEN);
+                       break;
+               case 'c':
+                       strlcpy(mnt->codepage.remote_name, optarg,
+                               SMB_NLS_MAXNAMELEN);
+                       break;
+               case 't':
+                       mnt->ttl = value;
+                       break;
+               default:
+                       printk ("smbfs: Unrecognized mount option %s\n",
+                               optopt);
+                       return -1;
+               }
+       }
+       mnt->flags = flags;
+       return c;
+ }
+ /*
+  * smb_show_options() is for displaying mount options in /proc/mounts.
+  * It tries to avoid showing settings that were not changed from their
+  * defaults.
+  */
+ static int
+ smb_show_options(struct seq_file *s, struct vfsmount *m)
+ {
+       struct smb_mount_data_kernel *mnt = SMB_SB(m->mnt_sb)->mnt;
+       int i;
+       for (i = 0; opts[i].name != NULL; i++)
+               if (mnt->flags & opts[i].flag)
+                       seq_printf(s, ",%s", opts[i].name);
+       if (mnt->flags & SMB_MOUNT_UID)
+               seq_printf(s, ",uid=%d", mnt->uid);
+       if (mnt->flags & SMB_MOUNT_GID)
+               seq_printf(s, ",gid=%d", mnt->gid);
+       if (mnt->mounted_uid != 0)
+               seq_printf(s, ",mounted_uid=%d", mnt->mounted_uid);
+       /* 
+        * Defaults for file_mode and dir_mode are unknown to us; they
+        * depend on the current umask of the user doing the mount.
+        */
+       if (mnt->flags & SMB_MOUNT_FMODE)
+               seq_printf(s, ",file_mode=%04o", mnt->file_mode & S_IRWXUGO);
+       if (mnt->flags & SMB_MOUNT_DMODE)
+               seq_printf(s, ",dir_mode=%04o", mnt->dir_mode & S_IRWXUGO);
+       if (strcmp(mnt->codepage.local_name, CONFIG_NLS_DEFAULT))
+               seq_printf(s, ",iocharset=%s", mnt->codepage.local_name);
+       if (strcmp(mnt->codepage.remote_name, SMB_NLS_REMOTE))
+               seq_printf(s, ",codepage=%s", mnt->codepage.remote_name);
+       if (mnt->ttl != SMB_TTL_DEFAULT)
+               seq_printf(s, ",ttl=%d", mnt->ttl);
+       return 0;
+ }
+ static void
+ smb_unload_nls(struct smb_sb_info *server)
+ {
+       unload_nls(server->remote_nls);
+       unload_nls(server->local_nls);
+ }
+ static void
+ smb_put_super(struct super_block *sb)
+ {
+       struct smb_sb_info *server = SMB_SB(sb);
+       lock_kernel();
+       smb_lock_server(server);
+       server->state = CONN_INVALID;
+       smbiod_unregister_server(server);
+       smb_close_socket(server);
+       if (server->conn_pid)
+               kill_pid(server->conn_pid, SIGTERM, 1);
+       bdi_destroy(&server->bdi);
+       kfree(server->ops);
+       smb_unload_nls(server);
+       sb->s_fs_info = NULL;
+       smb_unlock_server(server);
+       put_pid(server->conn_pid);
+       kfree(server);
+       unlock_kernel();
+ }
+ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
+ {
+       struct smb_sb_info *server;
+       struct smb_mount_data_kernel *mnt;
+       struct smb_mount_data *oldmnt;
+       struct inode *root_inode;
+       struct smb_fattr root;
+       int ver;
+       void *mem;
+       static int warn_count;
++      lock_kernel();
++
+       if (warn_count < 5) {
+               warn_count++;
+               printk(KERN_EMERG "smbfs is deprecated and will be removed"
+                       " from the 2.6.37 kernel. Please migrate to cifs\n");
+       }
+       if (!raw_data)
+               goto out_no_data;
+       oldmnt = (struct smb_mount_data *) raw_data;
+       ver = oldmnt->version;
+       if (ver != SMB_MOUNT_OLDVERSION && cpu_to_be32(ver) != SMB_MOUNT_ASCII)
+               goto out_wrong_data;
+       sb->s_flags |= MS_NODIRATIME;
+       sb->s_blocksize = 1024; /* Eh...  Is this correct? */
+       sb->s_blocksize_bits = 10;
+       sb->s_magic = SMB_SUPER_MAGIC;
+       sb->s_op = &smb_sops;
+       sb->s_time_gran = 100;
+       server = kzalloc(sizeof(struct smb_sb_info), GFP_KERNEL);
+       if (!server)
+               goto out_no_server;
+       sb->s_fs_info = server;
+       
+       if (bdi_setup_and_register(&server->bdi, "smbfs", BDI_CAP_MAP_COPY))
+               goto out_bdi;
+       sb->s_bdi = &server->bdi;
+       server->super_block = sb;
+       server->mnt = NULL;
+       server->sock_file = NULL;
+       init_waitqueue_head(&server->conn_wq);
+       init_MUTEX(&server->sem);
+       INIT_LIST_HEAD(&server->entry);
+       INIT_LIST_HEAD(&server->xmitq);
+       INIT_LIST_HEAD(&server->recvq);
+       server->conn_error = 0;
+       server->conn_pid = NULL;
+       server->state = CONN_INVALID; /* no connection yet */
+       server->generation = 0;
+       /* Allocate the global temp buffer and some superblock helper structs */
+       /* FIXME: move these to the smb_sb_info struct */
+       VERBOSE("alloc chunk = %lu\n", sizeof(struct smb_ops) +
+               sizeof(struct smb_mount_data_kernel));
+       mem = kmalloc(sizeof(struct smb_ops) +
+                     sizeof(struct smb_mount_data_kernel), GFP_KERNEL);
+       if (!mem)
+               goto out_no_mem;
+       server->ops = mem;
+       smb_install_null_ops(server->ops);
+       server->mnt = mem + sizeof(struct smb_ops);
+       /* Setup NLS stuff */
+       server->remote_nls = NULL;
+       server->local_nls = NULL;
+       mnt = server->mnt;
+       memset(mnt, 0, sizeof(struct smb_mount_data_kernel));
+       strlcpy(mnt->codepage.local_name, CONFIG_NLS_DEFAULT,
+               SMB_NLS_MAXNAMELEN);
+       strlcpy(mnt->codepage.remote_name, SMB_NLS_REMOTE,
+               SMB_NLS_MAXNAMELEN);
+       mnt->ttl = SMB_TTL_DEFAULT;
+       if (ver == SMB_MOUNT_OLDVERSION) {
+               mnt->version = oldmnt->version;
+               SET_UID(mnt->uid, oldmnt->uid);
+               SET_GID(mnt->gid, oldmnt->gid);
+               mnt->file_mode = (oldmnt->file_mode & S_IRWXUGO) | S_IFREG;
+               mnt->dir_mode = (oldmnt->dir_mode & S_IRWXUGO) | S_IFDIR;
+               mnt->flags = (oldmnt->file_mode >> 9) | SMB_MOUNT_UID |
+                       SMB_MOUNT_GID | SMB_MOUNT_FMODE | SMB_MOUNT_DMODE;
+       } else {
+               mnt->file_mode = S_IRWXU | S_IRGRP | S_IXGRP |
+                               S_IROTH | S_IXOTH | S_IFREG;
+               mnt->dir_mode = S_IRWXU | S_IRGRP | S_IXGRP |
+                               S_IROTH | S_IXOTH | S_IFDIR;
+               if (parse_options(mnt, raw_data))
+                       goto out_bad_option;
+       }
+       mnt->mounted_uid = current_uid();
+       smb_setcodepage(server, &mnt->codepage);
+       /*
+        * Display the enabled options
+        * Note: smb_proc_getattr uses these in 2.4 (but was changed in 2.2)
+        */
+       if (mnt->flags & SMB_MOUNT_OLDATTR)
+               printk("SMBFS: Using core getattr (Win 95 speedup)\n");
+       else if (mnt->flags & SMB_MOUNT_DIRATTR)
+               printk("SMBFS: Using dir ff getattr\n");
+       if (smbiod_register_server(server) < 0) {
+               printk(KERN_ERR "smbfs: failed to start smbiod\n");
+               goto out_no_smbiod;
+       }
+       /*
+        * Keep the super block locked while we get the root inode.
+        */
+       smb_init_root_dirent(server, &root, sb);
+       root_inode = smb_iget(sb, &root);
+       if (!root_inode)
+               goto out_no_root;
+       sb->s_root = d_alloc_root(root_inode);
+       if (!sb->s_root)
+               goto out_no_root;
+       smb_new_dentry(sb->s_root);
++      unlock_kernel();
+       return 0;
+ out_no_root:
+       iput(root_inode);
+ out_no_smbiod:
+       smb_unload_nls(server);
+ out_bad_option:
+       kfree(mem);
+ out_no_mem:
+       bdi_destroy(&server->bdi);
+ out_bdi:
+       if (!server->mnt)
+               printk(KERN_ERR "smb_fill_super: allocation failure\n");
+       sb->s_fs_info = NULL;
+       kfree(server);
+       goto out_fail;
+ out_wrong_data:
+       printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver);
+       goto out_fail;
+ out_no_data:
+       printk(KERN_ERR "smb_fill_super: missing data argument\n");
+ out_fail:
++      unlock_kernel();
+       return -EINVAL;
+ out_no_server:
+       printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n");
++      unlock_kernel();
+       return -ENOMEM;
+ }
+ static int
+ smb_statfs(struct dentry *dentry, struct kstatfs *buf)
+ {
+       int result;
+       
+       lock_kernel();
+       result = smb_proc_dskattr(dentry, buf);
+       unlock_kernel();
+       buf->f_type = SMB_SUPER_MAGIC;
+       buf->f_namelen = SMB_MAXPATHLEN;
+       return result;
+ }
+ int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
+ {
+       int err = smb_revalidate_inode(dentry);
+       if (!err)
+               generic_fillattr(dentry->d_inode, stat);
+       return err;
+ }
+ int
+ smb_notify_change(struct dentry *dentry, struct iattr *attr)
+ {
+       struct inode *inode = dentry->d_inode;
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       unsigned int mask = (S_IFREG | S_IFDIR | S_IRWXUGO);
+       int error, changed, refresh = 0;
+       struct smb_fattr fattr;
+       lock_kernel();
+       error = smb_revalidate_inode(dentry);
+       if (error)
+               goto out;
+       if ((error = inode_change_ok(inode, attr)) < 0)
+               goto out;
+       error = -EPERM;
+       if ((attr->ia_valid & ATTR_UID) && (attr->ia_uid != server->mnt->uid))
+               goto out;
+       if ((attr->ia_valid & ATTR_GID) && (attr->ia_uid != server->mnt->gid))
+               goto out;
+       if ((attr->ia_valid & ATTR_MODE) && (attr->ia_mode & ~mask))
+               goto out;
+       if ((attr->ia_valid & ATTR_SIZE) != 0) {
+               VERBOSE("changing %s/%s, old size=%ld, new size=%ld\n",
+                       DENTRY_PATH(dentry),
+                       (long) inode->i_size, (long) attr->ia_size);
+               filemap_write_and_wait(inode->i_mapping);
+               error = smb_open(dentry, O_WRONLY);
+               if (error)
+                       goto out;
+               error = server->ops->truncate(inode, attr->ia_size);
+               if (error)
+                       goto out;
+               truncate_setsize(inode, attr->ia_size);
+               refresh = 1;
+       }
+       if (server->opt.capabilities & SMB_CAP_UNIX) {
+               /* For now we don't want to set the size with setattr_unix */
+               attr->ia_valid &= ~ATTR_SIZE;
+               /* FIXME: only call if we actually want to set something? */
+               error = smb_proc_setattr_unix(dentry, attr, 0, 0);
+               if (!error)
+                       refresh = 1;
+               goto out;
+       }
+       /*
+        * Initialize the fattr and check for changed fields.
+        * Note: CTIME under SMB is creation time rather than
+        * change time, so we don't attempt to change it.
+        */
+       smb_get_inode_attr(inode, &fattr);
+       changed = 0;
+       if ((attr->ia_valid & ATTR_MTIME) != 0) {
+               fattr.f_mtime = attr->ia_mtime;
+               changed = 1;
+       }
+       if ((attr->ia_valid & ATTR_ATIME) != 0) {
+               fattr.f_atime = attr->ia_atime;
+               /* Earlier protocols don't have an access time */
+               if (server->opt.protocol >= SMB_PROTOCOL_LANMAN2)
+                       changed = 1;
+       }
+       if (changed) {
+               error = smb_proc_settime(dentry, &fattr);
+               if (error)
+                       goto out;
+               refresh = 1;
+       }
+       /*
+        * Check for mode changes ... we're extremely limited in
+        * what can be set for SMB servers: just the read-only bit.
+        */
+       if ((attr->ia_valid & ATTR_MODE) != 0) {
+               VERBOSE("%s/%s mode change, old=%x, new=%x\n",
+                       DENTRY_PATH(dentry), fattr.f_mode, attr->ia_mode);
+               changed = 0;
+               if (attr->ia_mode & S_IWUSR) {
+                       if (fattr.attr & aRONLY) {
+                               fattr.attr &= ~aRONLY;
+                               changed = 1;
+                       }
+               } else {
+                       if (!(fattr.attr & aRONLY)) {
+                               fattr.attr |= aRONLY;
+                               changed = 1;
+                       }
+               }
+               if (changed) {
+                       error = smb_proc_setattr(dentry, &fattr);
+                       if (error)
+                               goto out;
+                       refresh = 1;
+               }
+       }
+       error = 0;
+ out:
+       if (refresh)
+               smb_refresh_inode(dentry);
+       unlock_kernel();
+       return error;
+ }
+ static int smb_get_sb(struct file_system_type *fs_type,
+       int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+ {
+       return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt);
+ }
+ static struct file_system_type smb_fs_type = {
+       .owner          = THIS_MODULE,
+       .name           = "smbfs",
+       .get_sb         = smb_get_sb,
+       .kill_sb        = kill_anon_super,
+       .fs_flags       = FS_BINARY_MOUNTDATA,
+ };
+ static int __init init_smb_fs(void)
+ {
+       int err;
+       DEBUG1("registering ...\n");
+       err = init_inodecache();
+       if (err)
+               goto out_inode;
+       err = smb_init_request_cache();
+       if (err)
+               goto out_request;
+       err = register_filesystem(&smb_fs_type);
+       if (err)
+               goto out;
+       return 0;
+ out:
+       smb_destroy_request_cache();
+ out_request:
+       destroy_inodecache();
+ out_inode:
+       return err;
+ }
+ static void __exit exit_smb_fs(void)
+ {
+       DEBUG1("unregistering ...\n");
+       unregister_filesystem(&smb_fs_type);
+       smb_destroy_request_cache();
+       destroy_inodecache();
+ }
+ module_init(init_smb_fs)
+ module_exit(exit_smb_fs)
+ MODULE_LICENSE("GPL");
index 0000000000000000000000000000000000000000,2fb079c37f25a1d3528d6c6640673ee89ece833e..ba37b1fae182f08fa23e7891ee2efe08b35b3976
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,3506 +1,3502 @@@
 -      spin_lock(&entry->d_lock);
+ /*
+  *  proc.c
+  *
+  *  Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
+  *  Copyright (C) 1997 by Volker Lendecke
+  *
+  *  Please add a note about your changes to smbfs in the ChangeLog file.
+  */
+ #include <linux/types.h>
+ #include <linux/capability.h>
+ #include <linux/errno.h>
+ #include <linux/slab.h>
+ #include <linux/fs.h>
+ #include <linux/file.h>
+ #include <linux/stat.h>
+ #include <linux/fcntl.h>
+ #include <linux/dcache.h>
+ #include <linux/nls.h>
+ #include <linux/smp_lock.h>
+ #include <linux/net.h>
+ #include <linux/vfs.h>
+ #include <net/sock.h>
+ #include <asm/string.h>
+ #include <asm/div64.h>
+ #include "smb_fs.h"
+ #include "smbno.h"
+ #include "smb_mount.h"
+ #include "smb_debug.h"
+ #include "proto.h"
+ #include "request.h"
+ /* Features. Undefine if they cause problems, this should perhaps be a
+    config option. */
+ #define SMBFS_POSIX_UNLINK 1
+ /* Allow smb_retry to be interrupted. */
+ #define SMB_RETRY_INTR
+ #define SMB_VWV(packet)  ((packet) + SMB_HEADER_LEN)
+ #define SMB_CMD(packet)  (*(packet+8))
+ #define SMB_WCT(packet)  (*(packet+SMB_HEADER_LEN - 1))
+ #define SMB_DIRINFO_SIZE 43
+ #define SMB_STATUS_SIZE  21
+ #define SMB_ST_BLKSIZE        (PAGE_SIZE)
+ #define SMB_ST_BLKSHIFT       (PAGE_SHIFT)
+ static struct smb_ops smb_ops_core;
+ static struct smb_ops smb_ops_os2;
+ static struct smb_ops smb_ops_win95;
+ static struct smb_ops smb_ops_winNT;
+ static struct smb_ops smb_ops_unix;
+ static struct smb_ops smb_ops_null;
+ static void
+ smb_init_dirent(struct smb_sb_info *server, struct smb_fattr *fattr);
+ static void
+ smb_finish_dirent(struct smb_sb_info *server, struct smb_fattr *fattr);
+ static int
+ smb_proc_getattr_core(struct smb_sb_info *server, struct dentry *dir,
+                     struct smb_fattr *fattr);
+ static int
+ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
+                   struct smb_fattr *fattr);
+ static int
+ smb_proc_setattr_core(struct smb_sb_info *server, struct dentry *dentry,
+                     u16 attr);
+ static int
+ smb_proc_setattr_ext(struct smb_sb_info *server,
+                    struct inode *inode, struct smb_fattr *fattr);
+ static int
+ smb_proc_query_cifsunix(struct smb_sb_info *server);
+ static void
+ install_ops(struct smb_ops *dst, struct smb_ops *src);
+ static void
+ str_upper(char *name, int len)
+ {
+       while (len--)
+       {
+               if (*name >= 'a' && *name <= 'z')
+                       *name -= ('a' - 'A');
+               name++;
+       }
+ }
+ #if 0
+ static void
+ str_lower(char *name, int len)
+ {
+       while (len--)
+       {
+               if (*name >= 'A' && *name <= 'Z')
+                       *name += ('a' - 'A');
+               name++;
+       }
+ }
+ #endif
+ /* reverse a string inline. This is used by the dircache walking routines */
+ static void reverse_string(char *buf, int len)
+ {
+       char c;
+       char *end = buf+len-1;
+       while(buf < end) {
+               c = *buf;
+               *(buf++) = *end;
+               *(end--) = c;
+       }
+ }
+ /* no conversion, just a wrapper for memcpy. */
+ static int convert_memcpy(unsigned char *output, int olen,
+                         const unsigned char *input, int ilen,
+                         struct nls_table *nls_from,
+                         struct nls_table *nls_to)
+ {
+       if (olen < ilen)
+               return -ENAMETOOLONG;
+       memcpy(output, input, ilen);
+       return ilen;
+ }
+ static inline int write_char(unsigned char ch, char *output, int olen)
+ {
+       if (olen < 4)
+               return -ENAMETOOLONG;
+       sprintf(output, ":x%02x", ch);
+       return 4;
+ }
+ static inline int write_unichar(wchar_t ch, char *output, int olen)
+ {
+       if (olen < 5)
+               return -ENAMETOOLONG;
+       sprintf(output, ":%04x", ch);
+       return 5;
+ }
+ /* convert from one "codepage" to another (possibly being utf8). */
+ static int convert_cp(unsigned char *output, int olen,
+                     const unsigned char *input, int ilen,
+                     struct nls_table *nls_from,
+                     struct nls_table *nls_to)
+ {
+       int len = 0;
+       int n;
+       wchar_t ch;
+       while (ilen > 0) {
+               /* convert by changing to unicode and back to the new cp */
+               n = nls_from->char2uni(input, ilen, &ch);
+               if (n == -EINVAL) {
+                       ilen--;
+                       n = write_char(*input++, output, olen);
+                       if (n < 0)
+                               goto fail;
+                       output += n;
+                       olen -= n;
+                       len += n;
+                       continue;
+               } else if (n < 0)
+                       goto fail;
+               input += n;
+               ilen -= n;
+               n = nls_to->uni2char(ch, output, olen);
+               if (n == -EINVAL)
+                       n = write_unichar(ch, output, olen);
+               if (n < 0)
+                       goto fail;
+               output += n;
+               olen -= n;
+               len += n;
+       }
+       return len;
+ fail:
+       return n;
+ }
+ /* ----------------------------------------------------------- */
+ /*
+  * nls_unicode
+  *
+  * This encodes/decodes little endian unicode format
+  */
+ static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
+ {
+       if (boundlen < 2)
+               return -EINVAL;
+       *out++ = uni & 0xff;
+       *out++ = uni >> 8;
+       return 2;
+ }
+ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
+ {
+       if (boundlen < 2)
+               return -EINVAL;
+       *uni = (rawstring[1] << 8) | rawstring[0];
+       return 2;
+ }
+ static struct nls_table unicode_table = {
+       .charset        = "unicode",
+       .uni2char       = uni2char,
+       .char2uni       = char2uni,
+ };
+ /* ----------------------------------------------------------- */
+ static int setcodepage(struct nls_table **p, char *name)
+ {
+       struct nls_table *nls;
+       if (!name || !*name) {
+               nls = NULL;
+       } else if ( (nls = load_nls(name)) == NULL) {
+               printk (KERN_ERR "smbfs: failed to load nls '%s'\n", name);
+               return -EINVAL;
+       }
+       /* if already set, unload the previous one. */
+       if (*p && *p != &unicode_table)
+               unload_nls(*p);
+       *p = nls;
+       return 0;
+ }
+ /* Handles all changes to codepage settings. */
+ int smb_setcodepage(struct smb_sb_info *server, struct smb_nls_codepage *cp)
+ {
+       int n = 0;
+       smb_lock_server(server);
+       /* Don't load any nls_* at all, if no remote is requested */
+       if (!*cp->remote_name)
+               goto out;
+       /* local */
+       n = setcodepage(&server->local_nls, cp->local_name);
+       if (n != 0)
+               goto out;
+       /* remote */
+       if (!strcmp(cp->remote_name, "unicode")) {
+               server->remote_nls = &unicode_table;
+       } else {
+               n = setcodepage(&server->remote_nls, cp->remote_name);
+               if (n != 0)
+                       setcodepage(&server->local_nls, NULL);
+       }
+ out:
+       if (server->local_nls != NULL && server->remote_nls != NULL)
+               server->ops->convert = convert_cp;
+       else
+               server->ops->convert = convert_memcpy;
+       smb_unlock_server(server);
+       return n;
+ }
+ /*****************************************************************************/
+ /*                                                                           */
+ /*  Encoding/Decoding section                                                */
+ /*                                                                           */
+ /*****************************************************************************/
+ static __u8 *
+ smb_encode_smb_length(__u8 * p, __u32 len)
+ {
+       *p = 0;
+       *(p+1) = 0;
+       *(p+2) = (len & 0xFF00) >> 8;
+       *(p+3) = (len & 0xFF);
+       if (len > 0xFFFF)
+       {
+               *(p+1) = 1;
+       }
+       return p + 4;
+ }
+ /*
+  * smb_build_path: build the path to entry and name storing it in buf.
+  * The path returned will have the trailing '\0'.
+  */
+ static int smb_build_path(struct smb_sb_info *server, unsigned char *buf,
+                         int maxlen,
+                         struct dentry *entry, struct qstr *name)
+ {
+       unsigned char *path = buf;
+       int len;
+       int unicode = (server->mnt->flags & SMB_MOUNT_UNICODE) != 0;
+       if (maxlen < (2<<unicode))
+               return -ENAMETOOLONG;
+       if (maxlen > SMB_MAXPATHLEN + 1)
+               maxlen = SMB_MAXPATHLEN + 1;
+       if (entry == NULL)
+               goto test_name_and_out;
+       /*
+        * If IS_ROOT, we have to do no walking at all.
+        */
+       if (IS_ROOT(entry) && !name) {
+               *path++ = '\\';
+               if (unicode) *path++ = '\0';
+               *path++ = '\0';
+               if (unicode) *path++ = '\0';
+               return path-buf;
+       }
+       /*
+        * Build the path string walking the tree backward from end to ROOT
+        * and store it in reversed order [see reverse_string()]
+        */
+       dget(entry);
 -                      spin_unlock(&entry->d_lock);
+       while (!IS_ROOT(entry)) {
+               struct dentry *parent;
+               if (maxlen < (3<<unicode)) {
 -
 -              parent = entry->d_parent;
 -              dget(parent);
+                       dput(entry);
+                       return -ENAMETOOLONG;
+               }
++              spin_lock(&entry->d_lock);
+               len = server->ops->convert(path, maxlen-2, 
+                                     entry->d_name.name, entry->d_name.len,
+                                     server->local_nls, server->remote_nls);
+               if (len < 0) {
+                       spin_unlock(&entry->d_lock);
+                       dput(entry);
+                       return len;
+               }
+               reverse_string(path, len);
+               path += len;
+               if (unicode) {
+                       /* Note: reverse order */
+                       *path++ = '\0';
+                       maxlen--;
+               }
+               *path++ = '\\';
+               maxlen -= len+1;
 -              spin_lock(&entry->d_lock);
+               spin_unlock(&entry->d_lock);
++
++              parent = dget_parent(entry);
+               dput(entry);
+               entry = parent;
 -      spin_unlock(&entry->d_lock);
+       }
+       dput(entry);
+       reverse_string(buf, path-buf);
+       /* maxlen has space for at least one char */
+ test_name_and_out:
+       if (name) {
+               if (maxlen < (3<<unicode))
+                       return -ENAMETOOLONG;
+               *path++ = '\\';
+               if (unicode) {
+                       *path++ = '\0';
+                       maxlen--;
+               }
+               len = server->ops->convert(path, maxlen-2, 
+                                     name->name, name->len,
+                                     server->local_nls, server->remote_nls);
+               if (len < 0)
+                       return len;
+               path += len;
+               maxlen -= len+1;
+       }
+       /* maxlen has space for at least one char */
+       *path++ = '\0';
+       if (unicode) *path++ = '\0';
+       return path-buf;
+ }
+ static int smb_encode_path(struct smb_sb_info *server, char *buf, int maxlen,
+                          struct dentry *dir, struct qstr *name)
+ {
+       int result;
+       result = smb_build_path(server, buf, maxlen, dir, name);
+       if (result < 0)
+               goto out;
+       if (server->opt.protocol <= SMB_PROTOCOL_COREPLUS)
+               str_upper(buf, result);
+ out:
+       return result;
+ }
+ /* encode_path for non-trans2 request SMBs */
+ static int smb_simple_encode_path(struct smb_request *req, char **p,
+                                 struct dentry * entry, struct qstr * name)
+ {
+       struct smb_sb_info *server = req->rq_server;
+       char *s = *p;
+       int res;
+       int maxlen = ((char *)req->rq_buffer + req->rq_bufsize) - s;
+       int unicode = (server->mnt->flags & SMB_MOUNT_UNICODE);
+       if (!maxlen)
+               return -ENAMETOOLONG;
+       *s++ = 4;       /* ASCII data format */
+       /*
+        * SMB Unicode strings must be 16bit aligned relative the start of the
+        * packet. If they are not they must be padded with 0.
+        */
+       if (unicode) {
+               int align = s - (char *)req->rq_buffer;
+               if (!(align & 1)) {
+                       *s++ = '\0';
+                       maxlen--;
+               }
+       }
+       res = smb_encode_path(server, s, maxlen-1, entry, name);
+       if (res < 0)
+               return res;
+       *p = s + res;
+       return 0;
+ }
+ /* The following are taken directly from msdos-fs */
+ /* Linear day numbers of the respective 1sts in non-leap years. */
+ static int day_n[] =
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 0, 0, 0, 0};
+                 /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */
+ static time_t
+ utc2local(struct smb_sb_info *server, time_t time)
+ {
+       return time - server->opt.serverzone*60;
+ }
+ static time_t
+ local2utc(struct smb_sb_info *server, time_t time)
+ {
+       return time + server->opt.serverzone*60;
+ }
+ /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
+ static time_t
+ date_dos2unix(struct smb_sb_info *server, __u16 date, __u16 time)
+ {
+       int month, year;
+       time_t secs;
+       /* first subtract and mask after that... Otherwise, if
+          date == 0, bad things happen */
+       month = ((date >> 5) - 1) & 15;
+       year = date >> 9;
+       secs = (time & 31) * 2 + 60 * ((time >> 5) & 63) + (time >> 11) * 3600 + 86400 *
+           ((date & 31) - 1 + day_n[month] + (year / 4) + year * 365 - ((year & 3) == 0 &&
+                                                  month < 2 ? 1 : 0) + 3653);
+       /* days since 1.1.70 plus 80's leap day */
+       return local2utc(server, secs);
+ }
+ /* Convert linear UNIX date to a MS-DOS time/date pair. */
+ static void
+ date_unix2dos(struct smb_sb_info *server,
+             int unix_date, __u16 *date, __u16 *time)
+ {
+       int day, year, nl_day, month;
+       unix_date = utc2local(server, unix_date);
+       if (unix_date < 315532800)
+               unix_date = 315532800;
+       *time = (unix_date % 60) / 2 +
+               (((unix_date / 60) % 60) << 5) +
+               (((unix_date / 3600) % 24) << 11);
+       day = unix_date / 86400 - 3652;
+       year = day / 365;
+       if ((year + 3) / 4 + 365 * year > day)
+               year--;
+       day -= (year + 3) / 4 + 365 * year;
+       if (day == 59 && !(year & 3)) {
+               nl_day = day;
+               month = 2;
+       } else {
+               nl_day = (year & 3) || day <= 59 ? day : day - 1;
+               for (month = 1; month < 12; month++)
+                       if (day_n[month] > nl_day)
+                               break;
+       }
+       *date = nl_day - day_n[month - 1] + 1 + (month << 5) + (year << 9);
+ }
+ /* The following are taken from fs/ntfs/util.c */
+ #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000)
+ /*
+  * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units)
+  * into Unix UTC (based 1970-01-01, in seconds).
+  */
+ static struct timespec
+ smb_ntutc2unixutc(u64 ntutc)
+ {
+       struct timespec ts;
+       /* FIXME: what about the timezone difference? */
+       /* Subtract the NTFS time offset, then convert to 1s intervals. */
+       u64 t = ntutc - NTFS_TIME_OFFSET;
+       ts.tv_nsec = do_div(t, 10000000) * 100;
+       ts.tv_sec = t; 
+       return ts;
+ }
+ /* Convert the Unix UTC into NT time */
+ static u64
+ smb_unixutc2ntutc(struct timespec ts)
+ {
+       /* Note: timezone conversion is probably wrong. */
+       /* return ((u64)utc2local(server, t)) * 10000000 + NTFS_TIME_OFFSET; */
+       return ((u64)ts.tv_sec) * 10000000 + ts.tv_nsec/100 + NTFS_TIME_OFFSET;
+ }
+ #define MAX_FILE_MODE 6
+ static mode_t file_mode[] = {
+       S_IFREG, S_IFDIR, S_IFLNK, S_IFCHR, S_IFBLK, S_IFIFO, S_IFSOCK
+ };
+ static int smb_filetype_to_mode(u32 filetype)
+ {
+       if (filetype > MAX_FILE_MODE) {
+               PARANOIA("Filetype out of range: %d\n", filetype);
+               return S_IFREG;
+       }
+       return file_mode[filetype];
+ }
+ static u32 smb_filetype_from_mode(int mode)
+ {
+       if (S_ISREG(mode))
+               return UNIX_TYPE_FILE;
+       if (S_ISDIR(mode))
+               return UNIX_TYPE_DIR;
+       if (S_ISLNK(mode))
+               return UNIX_TYPE_SYMLINK;
+       if (S_ISCHR(mode))
+               return UNIX_TYPE_CHARDEV;
+       if (S_ISBLK(mode))
+               return UNIX_TYPE_BLKDEV;
+       if (S_ISFIFO(mode))
+               return UNIX_TYPE_FIFO;
+       if (S_ISSOCK(mode))
+               return UNIX_TYPE_SOCKET;
+       return UNIX_TYPE_UNKNOWN;
+ }
+ /*****************************************************************************/
+ /*                                                                           */
+ /*  Support section.                                                         */
+ /*                                                                           */
+ /*****************************************************************************/
+ __u32
+ smb_len(__u8 * p)
+ {
+       return ((*(p+1) & 0x1) << 16L) | (*(p+2) << 8L) | *(p+3);
+ }
+ static __u16
+ smb_bcc(__u8 * packet)
+ {
+       int pos = SMB_HEADER_LEN + SMB_WCT(packet) * sizeof(__u16);
+       return WVAL(packet, pos);
+ }
+ /* smb_valid_packet: We check if packet fulfills the basic
+    requirements of a smb packet */
+ static int
+ smb_valid_packet(__u8 * packet)
+ {
+       return (packet[4] == 0xff
+               && packet[5] == 'S'
+               && packet[6] == 'M'
+               && packet[7] == 'B'
+               && (smb_len(packet) + 4 == SMB_HEADER_LEN
+                   + SMB_WCT(packet) * 2 + smb_bcc(packet)));
+ }
+ /* smb_verify: We check if we got the answer we expected, and if we
+    got enough data. If bcc == -1, we don't care. */
+ static int
+ smb_verify(__u8 * packet, int command, int wct, int bcc)
+ {
+       if (SMB_CMD(packet) != command)
+               goto bad_command;
+       if (SMB_WCT(packet) < wct)
+               goto bad_wct;
+       if (bcc != -1 && smb_bcc(packet) < bcc)
+               goto bad_bcc;
+       return 0;
+ bad_command:
+       printk(KERN_ERR "smb_verify: command=%x, SMB_CMD=%x??\n",
+              command, SMB_CMD(packet));
+       goto fail;
+ bad_wct:
+       printk(KERN_ERR "smb_verify: command=%x, wct=%d, SMB_WCT=%d??\n",
+              command, wct, SMB_WCT(packet));
+       goto fail;
+ bad_bcc:
+       printk(KERN_ERR "smb_verify: command=%x, bcc=%d, SMB_BCC=%d??\n",
+              command, bcc, smb_bcc(packet));
+ fail:
+       return -EIO;
+ }
+ /*
+  * Returns the maximum read or write size for the "payload". Making all of the
+  * packet fit within the negotiated max_xmit size.
+  *
+  * N.B. Since this value is usually computed before locking the server,
+  * the server's packet size must never be decreased!
+  */
+ static inline int
+ smb_get_xmitsize(struct smb_sb_info *server, int overhead)
+ {
+       return server->opt.max_xmit - overhead;
+ }
+ /*
+  * Calculate the maximum read size
+  */
+ int
+ smb_get_rsize(struct smb_sb_info *server)
+ {
+       /* readX has 12 parameters, read has 5 */
+       int overhead = SMB_HEADER_LEN + 12 * sizeof(__u16) + 2 + 1 + 2;
+       int size = smb_get_xmitsize(server, overhead);
+       VERBOSE("xmit=%d, size=%d\n", server->opt.max_xmit, size);
+       return size;
+ }
+ /*
+  * Calculate the maximum write size
+  */
+ int
+ smb_get_wsize(struct smb_sb_info *server)
+ {
+       /* writeX has 14 parameters, write has 5 */
+       int overhead = SMB_HEADER_LEN + 14 * sizeof(__u16) + 2 + 1 + 2;
+       int size = smb_get_xmitsize(server, overhead);
+       VERBOSE("xmit=%d, size=%d\n", server->opt.max_xmit, size);
+       return size;
+ }
+ /*
+  * Convert SMB error codes to -E... errno values.
+  */
+ int
+ smb_errno(struct smb_request *req)
+ {
+       int errcls = req->rq_rcls;
+       int error  = req->rq_err;
+       char *class = "Unknown";
+       VERBOSE("errcls %d  code %d  from command 0x%x\n",
+               errcls, error, SMB_CMD(req->rq_header));
+       if (errcls == ERRDOS) {
+               switch (error) {
+               case ERRbadfunc:
+                       return -EINVAL;
+               case ERRbadfile:
+               case ERRbadpath:
+                       return -ENOENT;
+               case ERRnofids:
+                       return -EMFILE;
+               case ERRnoaccess:
+                       return -EACCES;
+               case ERRbadfid:
+                       return -EBADF;
+               case ERRbadmcb:
+                       return -EREMOTEIO;
+               case ERRnomem:
+                       return -ENOMEM;
+               case ERRbadmem:
+                       return -EFAULT;
+               case ERRbadenv:
+               case ERRbadformat:
+                       return -EREMOTEIO;
+               case ERRbadaccess:
+                       return -EACCES;
+               case ERRbaddata:
+                       return -E2BIG;
+               case ERRbaddrive:
+                       return -ENXIO;
+               case ERRremcd:
+                       return -EREMOTEIO;
+               case ERRdiffdevice:
+                       return -EXDEV;
+               case ERRnofiles:
+                       return -ENOENT;
+               case ERRbadshare:
+                       return -ETXTBSY;
+               case ERRlock:
+                       return -EDEADLK;
+               case ERRfilexists:
+                       return -EEXIST;
+               case ERROR_INVALID_PARAMETER:
+                       return -EINVAL;
+               case ERROR_DISK_FULL:
+                       return -ENOSPC;
+               case ERROR_INVALID_NAME:
+                       return -ENOENT;
+               case ERROR_DIR_NOT_EMPTY:
+                       return -ENOTEMPTY;
+               case ERROR_NOT_LOCKED:
+                        return -ENOLCK;
+               case ERROR_ALREADY_EXISTS:
+                       return -EEXIST;
+               default:
+                       class = "ERRDOS";
+                       goto err_unknown;
+               }
+       } else if (errcls == ERRSRV) {
+               switch (error) {
+               /* N.B. This is wrong ... EIO ? */
+               case ERRerror:
+                       return -ENFILE;
+               case ERRbadpw:
+                       return -EINVAL;
+               case ERRbadtype:
+               case ERRtimeout:
+                       return -EIO;
+               case ERRaccess:
+                       return -EACCES;
+               /*
+                * This is a fatal error, as it means the "tree ID"
+                * for this connection is no longer valid. We map
+                * to a special error code and get a new connection.
+                */
+               case ERRinvnid:
+                       return -EBADSLT;
+               default:
+                       class = "ERRSRV";
+                       goto err_unknown;
+               }
+       } else if (errcls == ERRHRD) {
+               switch (error) {
+               case ERRnowrite:
+                       return -EROFS;
+               case ERRbadunit:
+                       return -ENODEV;
+               case ERRnotready:
+                       return -EUCLEAN;
+               case ERRbadcmd:
+               case ERRdata:
+                       return -EIO;
+               case ERRbadreq:
+                       return -ERANGE;
+               case ERRbadshare:
+                       return -ETXTBSY;
+               case ERRlock:
+                       return -EDEADLK;
+               case ERRdiskfull:
+                       return -ENOSPC;
+               default:
+                       class = "ERRHRD";
+                       goto err_unknown;
+               }
+       } else if (errcls == ERRCMD) {
+               class = "ERRCMD";
+       } else if (errcls == SUCCESS) {
+               return 0;       /* This is the only valid 0 return */
+       }
+ err_unknown:
+       printk(KERN_ERR "smb_errno: class %s, code %d from command 0x%x\n",
+              class, error, SMB_CMD(req->rq_header));
+       return -EIO;
+ }
+ /* smb_request_ok: We expect the server to be locked. Then we do the
+    request and check the answer completely. When smb_request_ok
+    returns 0, you can be quite sure that everything went well. When
+    the answer is <=0, the returned number is a valid unix errno. */
+ static int
+ smb_request_ok(struct smb_request *req, int command, int wct, int bcc)
+ {
+       int result;
+       req->rq_resp_wct = wct;
+       req->rq_resp_bcc = bcc;
+       result = smb_add_request(req);
+       if (result != 0) {
+               DEBUG1("smb_request failed\n");
+               goto out;
+       }
+       if (smb_valid_packet(req->rq_header) != 0) {
+               PARANOIA("invalid packet!\n");
+               goto out;
+       }
+       result = smb_verify(req->rq_header, command, wct, bcc);
+ out:
+       return result;
+ }
+ /*
+  * This implements the NEWCONN ioctl. It installs the server pid,
+  * sets server->state to CONN_VALID, and wakes up the waiting process.
+  */
+ int
+ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
+ {
+       struct file *filp;
+       struct sock *sk;
+       int error;
+       VERBOSE("fd=%d, pid=%d\n", opt->fd, current->pid);
+       smb_lock_server(server);
+       /*
+        * Make sure we don't already have a valid connection ...
+        */
+       error = -EINVAL;
+       if (server->state == CONN_VALID)
+               goto out;
+       error = -EACCES;
+       if (current_uid() != server->mnt->mounted_uid &&
+           !capable(CAP_SYS_ADMIN))
+               goto out;
+       error = -EBADF;
+       filp = fget(opt->fd);
+       if (!filp)
+               goto out;
+       if (!smb_valid_socket(filp->f_path.dentry->d_inode))
+               goto out_putf;
+       server->sock_file = filp;
+       server->conn_pid = get_pid(task_pid(current));
+       server->opt = *opt;
+       server->generation += 1;
+       server->state = CONN_VALID;
+       error = 0;
+       if (server->conn_error) {
+               /*
+                * conn_error is the returncode we originally decided to
+                * drop the old connection on. This message should be positive
+                * and not make people ask questions on why smbfs is printing
+                * error messages ...
+                */
+               printk(KERN_INFO "SMB connection re-established (%d)\n",
+                      server->conn_error);
+               server->conn_error = 0;
+       }
+       /*
+        * Store the server in sock user_data (Only used by sunrpc)
+        */
+       sk = SOCKET_I(filp->f_path.dentry->d_inode)->sk;
+       sk->sk_user_data = server;
+       /* chain into the data_ready callback */
+       server->data_ready = xchg(&sk->sk_data_ready, smb_data_ready);
+       /* check if we have an old smbmount that uses seconds for the 
+          serverzone */
+       if (server->opt.serverzone > 12*60 || server->opt.serverzone < -12*60)
+               server->opt.serverzone /= 60;
+       /* now that we have an established connection we can detect the server
+          type and enable bug workarounds */
+       if (server->opt.protocol < SMB_PROTOCOL_LANMAN2)
+               install_ops(server->ops, &smb_ops_core);
+       else if (server->opt.protocol == SMB_PROTOCOL_LANMAN2)
+               install_ops(server->ops, &smb_ops_os2);
+       else if (server->opt.protocol == SMB_PROTOCOL_NT1 &&
+                (server->opt.max_xmit < 0x1000) &&
+                !(server->opt.capabilities & SMB_CAP_NT_SMBS)) {
+               /* FIXME: can we kill the WIN95 flag now? */
+               server->mnt->flags |= SMB_MOUNT_WIN95;
+               VERBOSE("detected WIN95 server\n");
+               install_ops(server->ops, &smb_ops_win95);
+       } else {
+               /*
+                * Samba has max_xmit 65535
+                * NT4spX has max_xmit 4536 (or something like that)
+                * win2k has ...
+                */
+               VERBOSE("detected NT1 (Samba, NT4/5) server\n");
+               install_ops(server->ops, &smb_ops_winNT);
+       }
+       /* FIXME: the win9x code wants to modify these ... (seek/trunc bug) */
+       if (server->mnt->flags & SMB_MOUNT_OLDATTR) {
+               server->ops->getattr = smb_proc_getattr_core;
+       } else if (server->mnt->flags & SMB_MOUNT_DIRATTR) {
+               server->ops->getattr = smb_proc_getattr_ff;
+       }
+       /* Decode server capabilities */
+       if (server->opt.capabilities & SMB_CAP_LARGE_FILES) {
+               /* Should be ok to set this now, as no one can access the
+                  mount until the connection has been established. */
+               SB_of(server)->s_maxbytes = ~0ULL >> 1;
+               VERBOSE("LFS enabled\n");
+       }
+       if (server->opt.capabilities & SMB_CAP_UNICODE) {
+               server->mnt->flags |= SMB_MOUNT_UNICODE;
+               VERBOSE("Unicode enabled\n");
+       } else {
+               server->mnt->flags &= ~SMB_MOUNT_UNICODE;
+       }
+ #if 0
+       /* flags we may test for other patches ... */
+       if (server->opt.capabilities & SMB_CAP_LARGE_READX) {
+               VERBOSE("Large reads enabled\n");
+       }
+       if (server->opt.capabilities & SMB_CAP_LARGE_WRITEX) {
+               VERBOSE("Large writes enabled\n");
+       }
+ #endif
+       if (server->opt.capabilities & SMB_CAP_UNIX) {
+               struct inode *inode;
+               VERBOSE("Using UNIX CIFS extensions\n");
+               install_ops(server->ops, &smb_ops_unix);
+               inode = SB_of(server)->s_root->d_inode;
+               if (inode)
+                       inode->i_op = &smb_dir_inode_operations_unix;
+       }
+       VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
+               server->opt.protocol, server->opt.max_xmit,
+               pid_nr(server->conn_pid), server->opt.capabilities);
+       /* FIXME: this really should be done by smbmount. */
+       if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
+               server->opt.max_xmit = SMB_MAX_PACKET_SIZE;
+       }
+       smb_unlock_server(server);
+       smbiod_wake_up();
+       if (server->opt.capabilities & SMB_CAP_UNIX)
+               smb_proc_query_cifsunix(server);
+       server->conn_complete++;
+       wake_up_interruptible_all(&server->conn_wq);
+       return error;
+ out:
+       smb_unlock_server(server);
+       smbiod_wake_up();
+       return error;
+ out_putf:
+       fput(filp);
+       goto out;
+ }
+ /* smb_setup_header: We completely set up the packet. You only have to
+    insert the command-specific fields */
+ __u8 *
+ smb_setup_header(struct smb_request *req, __u8 command, __u16 wct, __u16 bcc)
+ {
+       __u32 xmit_len = SMB_HEADER_LEN + wct * sizeof(__u16) + bcc + 2;
+       __u8 *p = req->rq_header;
+       struct smb_sb_info *server = req->rq_server;
+       p = smb_encode_smb_length(p, xmit_len - 4);
+       *p++ = 0xff;
+       *p++ = 'S';
+       *p++ = 'M';
+       *p++ = 'B';
+       *p++ = command;
+       memset(p, '\0', 19);
+       p += 19;
+       p += 8;
+       if (server->opt.protocol > SMB_PROTOCOL_CORE) {
+               int flags = SMB_FLAGS_CASELESS_PATHNAMES;
+               int flags2 = SMB_FLAGS2_LONG_PATH_COMPONENTS |
+                       SMB_FLAGS2_EXTENDED_ATTRIBUTES; /* EA? not really ... */
+               *(req->rq_header + smb_flg) = flags;
+               if (server->mnt->flags & SMB_MOUNT_UNICODE)
+                       flags2 |= SMB_FLAGS2_UNICODE_STRINGS;
+               WSET(req->rq_header, smb_flg2, flags2);
+       }
+       *p++ = wct;             /* wct */
+       p += 2 * wct;
+       WSET(p, 0, bcc);
+       /* Include the header in the data to send */
+       req->rq_iovlen = 1;
+       req->rq_iov[0].iov_base = req->rq_header;
+       req->rq_iov[0].iov_len  = xmit_len - bcc;
+       return req->rq_buffer;
+ }
+ static void
+ smb_setup_bcc(struct smb_request *req, __u8 *p)
+ {
+       u16 bcc = p - req->rq_buffer;
+       u8 *pbcc = req->rq_header + SMB_HEADER_LEN + 2*SMB_WCT(req->rq_header);
+       WSET(pbcc, 0, bcc);
+       smb_encode_smb_length(req->rq_header, SMB_HEADER_LEN + 
+                             2*SMB_WCT(req->rq_header) - 2 + bcc);
+       /* Include the "bytes" in the data to send */
+       req->rq_iovlen = 2;
+       req->rq_iov[1].iov_base = req->rq_buffer;
+       req->rq_iov[1].iov_len  = bcc;
+ }
+ static int
+ smb_proc_seek(struct smb_sb_info *server, __u16 fileid,
+             __u16 mode, off_t offset)
+ {
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBlseek, 4, 0);
+       WSET(req->rq_header, smb_vwv0, fileid);
+       WSET(req->rq_header, smb_vwv1, mode);
+       DSET(req->rq_header, smb_vwv2, offset);
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBlseek, 2, 0);
+       if (result < 0) {
+               result = 0;
+               goto out_free;
+       }
+       result = DVAL(req->rq_header, smb_vwv0);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_open(struct smb_sb_info *server, struct dentry *dentry, int wish)
+ {
+       struct inode *ino = dentry->d_inode;
+       struct smb_inode_info *ei = SMB_I(ino);
+       int mode, read_write = 0x42, read_only = 0x40;
+       int res;
+       char *p;
+       struct smb_request *req;
+       /*
+        * Attempt to open r/w, unless there are no write privileges.
+        */
+       mode = read_write;
+       if (!(ino->i_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
+               mode = read_only;
+ #if 0
+       /* FIXME: why is this code not in? below we fix it so that a caller
+          wanting RO doesn't get RW. smb_revalidate_inode does some 
+          optimization based on access mode. tail -f needs it to be correct.
+          We must open rw since we don't do the open if called a second time
+          with different 'wish'. Is that not supported by smb servers? */
+       if (!(wish & (O_WRONLY | O_RDWR)))
+               mode = read_only;
+ #endif
+       res = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       retry:
+       p = smb_setup_header(req, SMBopen, 2, 0);
+       WSET(req->rq_header, smb_vwv0, mode);
+       WSET(req->rq_header, smb_vwv1, aSYSTEM | aHIDDEN | aDIR);
+       res = smb_simple_encode_path(req, &p, dentry, NULL);
+       if (res < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       res = smb_request_ok(req, SMBopen, 7, 0);
+       if (res != 0) {
+               if (mode == read_write &&
+                   (res == -EACCES || res == -ETXTBSY || res == -EROFS))
+               {
+                       VERBOSE("%s/%s R/W failed, error=%d, retrying R/O\n",
+                               DENTRY_PATH(dentry), res);
+                       mode = read_only;
+                       req->rq_flags = 0;
+                       goto retry;
+               }
+               goto out_free;
+       }
+       /* We should now have data in vwv[0..6]. */
+       ei->fileid = WVAL(req->rq_header, smb_vwv0);
+       ei->attr   = WVAL(req->rq_header, smb_vwv1);
+       /* smb_vwv2 has mtime */
+       /* smb_vwv4 has size  */
+       ei->access = (WVAL(req->rq_header, smb_vwv6) & SMB_ACCMASK);
+       ei->open = server->generation;
+ out_free:
+       smb_rput(req);
+ out:
+       return res;
+ }
+ /*
+  * Make sure the file is open, and check that the access
+  * is compatible with the desired access.
+  */
+ int
+ smb_open(struct dentry *dentry, int wish)
+ {
+       struct inode *inode = dentry->d_inode;
+       int result;
+       __u16 access;
+       result = -ENOENT;
+       if (!inode) {
+               printk(KERN_ERR "smb_open: no inode for dentry %s/%s\n",
+                      DENTRY_PATH(dentry));
+               goto out;
+       }
+       if (!smb_is_open(inode)) {
+               struct smb_sb_info *server = server_from_inode(inode);
+               result = 0;
+               if (!smb_is_open(inode))
+                       result = smb_proc_open(server, dentry, wish);
+               if (result)
+                       goto out;
+               /*
+                * A successful open means the path is still valid ...
+                */
+               smb_renew_times(dentry);
+       }
+       /*
+        * Check whether the access is compatible with the desired mode.
+        */
+       result = 0;
+       access = SMB_I(inode)->access;
+       if (access != wish && access != SMB_O_RDWR) {
+               PARANOIA("%s/%s access denied, access=%x, wish=%x\n",
+                        DENTRY_PATH(dentry), access, wish);
+               result = -EACCES;
+       }
+ out:
+       return result;
+ }
+ static int 
+ smb_proc_close(struct smb_sb_info *server, __u16 fileid, __u32 mtime)
+ {
+       struct smb_request *req;
+       int result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBclose, 3, 0);
+       WSET(req->rq_header, smb_vwv0, fileid);
+       DSET(req->rq_header, smb_vwv1, utc2local(server, mtime));
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBclose, 0, 0);
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Win NT 4.0 has an apparent bug in that it fails to update the
+  * modify time when writing to a file. As a workaround, we update
+  * both modify and access time locally, and post the times to the
+  * server when closing the file.
+  */
+ static int 
+ smb_proc_close_inode(struct smb_sb_info *server, struct inode * ino)
+ {
+       struct smb_inode_info *ei = SMB_I(ino);
+       int result = 0;
+       if (smb_is_open(ino))
+       {
+               /*
+                * We clear the open flag in advance, in case another
+                * process observes the value while we block below.
+                */
+               ei->open = 0;
+               /*
+                * Kludge alert: SMB timestamps are accurate only to
+                * two seconds ... round the times to avoid needless
+                * cache invalidations!
+                */
+               if (ino->i_mtime.tv_sec & 1) { 
+                       ino->i_mtime.tv_sec--;
+                       ino->i_mtime.tv_nsec = 0; 
+               }
+               if (ino->i_atime.tv_sec & 1) {
+                       ino->i_atime.tv_sec--;
+                       ino->i_atime.tv_nsec = 0;
+               }
+               /*
+                * If the file is open with write permissions,
+                * update the time stamps to sync mtime and atime.
+                */
+               if ((server->opt.capabilities & SMB_CAP_UNIX) == 0 &&
+                   (server->opt.protocol >= SMB_PROTOCOL_LANMAN2) &&
+                   !(ei->access == SMB_O_RDONLY))
+               {
+                       struct smb_fattr fattr;
+                       smb_get_inode_attr(ino, &fattr);
+                       smb_proc_setattr_ext(server, ino, &fattr);
+               }
+               result = smb_proc_close(server, ei->fileid, ino->i_mtime.tv_sec);
+               /*
+                * Force a revalidation after closing ... some servers
+                * don't post the size until the file has been closed.
+                */
+               if (server->opt.protocol < SMB_PROTOCOL_NT1)
+                       ei->oldmtime = 0;
+               ei->closed = jiffies;
+       }
+       return result;
+ }
+ int
+ smb_close(struct inode *ino)
+ {
+       int result = 0;
+       if (smb_is_open(ino)) {
+               struct smb_sb_info *server = server_from_inode(ino);
+               result = smb_proc_close_inode(server, ino);
+       }
+       return result;
+ }
+ /*
+  * This is used to close a file following a failed instantiate.
+  * Since we don't have an inode, we can't use any of the above.
+  */
+ int
+ smb_close_fileid(struct dentry *dentry, __u16 fileid)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       int result;
+       result = smb_proc_close(server, fileid, get_seconds());
+       return result;
+ }
+ /* In smb_proc_read and smb_proc_write we do not retry, because the
+    file-id would not be valid after a reconnection. */
+ static void
+ smb_proc_read_data(struct smb_request *req)
+ {
+       req->rq_iov[0].iov_base = req->rq_buffer;
+       req->rq_iov[0].iov_len  = 3;
+       req->rq_iov[1].iov_base = req->rq_page;
+       req->rq_iov[1].iov_len  = req->rq_rsize;
+       req->rq_iovlen = 2;
+       req->rq_rlen = smb_len(req->rq_header) + 4 - req->rq_bytes_recvd;
+ }
+ static int
+ smb_proc_read(struct inode *inode, loff_t offset, int count, char *data)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       __u16 returned_count, data_len;
+       unsigned char *buf;
+       int result;
+       struct smb_request *req;
+       u8 rbuf[4];
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBread, 5, 0);
+       buf = req->rq_header;
+       WSET(buf, smb_vwv0, SMB_I(inode)->fileid);
+       WSET(buf, smb_vwv1, count);
+       DSET(buf, smb_vwv2, offset);
+       WSET(buf, smb_vwv4, 0);
+       req->rq_page = data;
+       req->rq_rsize = count;
+       req->rq_callback = smb_proc_read_data;
+       req->rq_buffer = rbuf;
+       req->rq_flags |= SMB_REQ_NORETRY | SMB_REQ_STATIC;
+       result = smb_request_ok(req, SMBread, 5, -1);
+       if (result < 0)
+               goto out_free;
+       returned_count = WVAL(req->rq_header, smb_vwv0);
+       data_len = WVAL(rbuf, 1);
+       if (returned_count != data_len) {
+               printk(KERN_NOTICE "smb_proc_read: returned != data_len\n");
+               printk(KERN_NOTICE "smb_proc_read: ret_c=%d, data_len=%d\n",
+                      returned_count, data_len);
+       }
+       result = data_len;
+ out_free:
+       smb_rput(req);
+ out:
+       VERBOSE("ino=%ld, fileid=%d, count=%d, result=%d\n",
+               inode->i_ino, SMB_I(inode)->fileid, count, result);
+       return result;
+ }
+ static int
+ smb_proc_write(struct inode *inode, loff_t offset, int count, const char *data)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       int result;
+       u16 fileid = SMB_I(inode)->fileid;
+       u8 buf[4];
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       VERBOSE("ino=%ld, fileid=%d, count=%d@%Ld\n",
+               inode->i_ino, fileid, count, offset);
+       smb_setup_header(req, SMBwrite, 5, count + 3);
+       WSET(req->rq_header, smb_vwv0, fileid);
+       WSET(req->rq_header, smb_vwv1, count);
+       DSET(req->rq_header, smb_vwv2, offset);
+       WSET(req->rq_header, smb_vwv4, 0);
+       buf[0] = 1;
+       WSET(buf, 1, count);    /* yes, again ... */
+       req->rq_iov[1].iov_base = buf;
+       req->rq_iov[1].iov_len = 3;
+       req->rq_iov[2].iov_base = (char *) data;
+       req->rq_iov[2].iov_len = count;
+       req->rq_iovlen = 3;
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBwrite, 1, 0);
+       if (result >= 0)
+               result = WVAL(req->rq_header, smb_vwv0);
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * In smb_proc_readX and smb_proc_writeX we do not retry, because the
+  * file-id would not be valid after a reconnection.
+  */
+ #define SMB_READX_MAX_PAD      64
+ static void
+ smb_proc_readX_data(struct smb_request *req)
+ {
+       /* header length, excluding the netbios length (-4) */
+       int hdrlen = SMB_HEADER_LEN + req->rq_resp_wct*2 - 2;
+       int data_off = WVAL(req->rq_header, smb_vwv6);
+       /*
+        * Some genius made the padding to the data bytes arbitrary.
+        * So we must first calculate the amount of padding used by the server.
+        */
+       data_off -= hdrlen;
+       if (data_off > SMB_READX_MAX_PAD || data_off < 0) {
+               PARANOIA("offset is larger than SMB_READX_MAX_PAD or negative!\n");
+               PARANOIA("%d > %d || %d < 0\n", data_off, SMB_READX_MAX_PAD, data_off);
+               req->rq_rlen = req->rq_bufsize + 1;
+               return;
+       }
+       req->rq_iov[0].iov_base = req->rq_buffer;
+       req->rq_iov[0].iov_len  = data_off;
+       req->rq_iov[1].iov_base = req->rq_page;
+       req->rq_iov[1].iov_len  = req->rq_rsize;
+       req->rq_iovlen = 2;
+       req->rq_rlen = smb_len(req->rq_header) + 4 - req->rq_bytes_recvd;
+ }
+ static int
+ smb_proc_readX(struct inode *inode, loff_t offset, int count, char *data)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       unsigned char *buf;
+       int result;
+       struct smb_request *req;
+       static char pad[SMB_READX_MAX_PAD];
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBreadX, 12, 0);
+       buf = req->rq_header;
+       WSET(buf, smb_vwv0, 0x00ff);
+       WSET(buf, smb_vwv1, 0);
+       WSET(buf, smb_vwv2, SMB_I(inode)->fileid);
+       DSET(buf, smb_vwv3, (u32)offset);               /* low 32 bits */
+       WSET(buf, smb_vwv5, count);
+       WSET(buf, smb_vwv6, 0);
+       DSET(buf, smb_vwv7, 0);
+       WSET(buf, smb_vwv9, 0);
+       DSET(buf, smb_vwv10, (u32)(offset >> 32));      /* high 32 bits */
+       WSET(buf, smb_vwv11, 0);
+       req->rq_page = data;
+       req->rq_rsize = count;
+       req->rq_callback = smb_proc_readX_data;
+       req->rq_buffer = pad;
+       req->rq_bufsize = SMB_READX_MAX_PAD;
+       req->rq_flags |= SMB_REQ_STATIC | SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBreadX, 12, -1);
+       if (result < 0)
+               goto out_free;
+       result = WVAL(req->rq_header, smb_vwv5);
+ out_free:
+       smb_rput(req);
+ out:
+       VERBOSE("ino=%ld, fileid=%d, count=%d, result=%d\n",
+               inode->i_ino, SMB_I(inode)->fileid, count, result);
+       return result;
+ }
+ static int
+ smb_proc_writeX(struct inode *inode, loff_t offset, int count, const char *data)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       int result;
+       u8 *p;
+       static u8 pad[4];
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       VERBOSE("ino=%ld, fileid=%d, count=%d@%Ld\n",
+               inode->i_ino, SMB_I(inode)->fileid, count, offset);
+       p = smb_setup_header(req, SMBwriteX, 14, count + 1);
+       WSET(req->rq_header, smb_vwv0, 0x00ff);
+       WSET(req->rq_header, smb_vwv1, 0);
+       WSET(req->rq_header, smb_vwv2, SMB_I(inode)->fileid);
+       DSET(req->rq_header, smb_vwv3, (u32)offset);    /* low 32 bits */
+       DSET(req->rq_header, smb_vwv5, 0);
+       WSET(req->rq_header, smb_vwv7, 0);              /* write mode */
+       WSET(req->rq_header, smb_vwv8, 0);
+       WSET(req->rq_header, smb_vwv9, 0);
+       WSET(req->rq_header, smb_vwv10, count);         /* data length */
+       WSET(req->rq_header, smb_vwv11, smb_vwv12 + 2 + 1);
+       DSET(req->rq_header, smb_vwv12, (u32)(offset >> 32));
+       req->rq_iov[1].iov_base = pad;
+       req->rq_iov[1].iov_len = 1;
+       req->rq_iov[2].iov_base = (char *) data;
+       req->rq_iov[2].iov_len = count;
+       req->rq_iovlen = 3;
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBwriteX, 6, 0);
+       if (result >= 0)
+               result = WVAL(req->rq_header, smb_vwv2);
+       smb_rput(req);
+ out:
+       return result;
+ }
+ int
+ smb_proc_create(struct dentry *dentry, __u16 attr, time_t ctime, __u16 *fileid)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       char *p;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       p = smb_setup_header(req, SMBcreate, 3, 0);
+       WSET(req->rq_header, smb_vwv0, attr);
+       DSET(req->rq_header, smb_vwv1, utc2local(server, ctime));
+       result = smb_simple_encode_path(req, &p, dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       result = smb_request_ok(req, SMBcreate, 1, 0);
+       if (result < 0)
+               goto out_free;
+       *fileid = WVAL(req->rq_header, smb_vwv0);
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ int
+ smb_proc_mv(struct dentry *old_dentry, struct dentry *new_dentry)
+ {
+       struct smb_sb_info *server = server_from_dentry(old_dentry);
+       char *p;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       p = smb_setup_header(req, SMBmv, 1, 0);
+       WSET(req->rq_header, smb_vwv0, aSYSTEM | aHIDDEN | aDIR);
+       result = smb_simple_encode_path(req, &p, old_dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       result = smb_simple_encode_path(req, &p, new_dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       if ((result = smb_request_ok(req, SMBmv, 0, 0)) < 0)
+               goto out_free;
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Code common to mkdir and rmdir.
+  */
+ static int
+ smb_proc_generic_command(struct dentry *dentry, __u8 command)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       char *p;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       p = smb_setup_header(req, command, 0, 0);
+       result = smb_simple_encode_path(req, &p, dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       result = smb_request_ok(req, command, 0, 0);
+       if (result < 0)
+               goto out_free;
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ int
+ smb_proc_mkdir(struct dentry *dentry)
+ {
+       return smb_proc_generic_command(dentry, SMBmkdir);
+ }
+ int
+ smb_proc_rmdir(struct dentry *dentry)
+ {
+       return smb_proc_generic_command(dentry, SMBrmdir);
+ }
+ #if SMBFS_POSIX_UNLINK
+ /*
+  * Removes readonly attribute from a file. Used by unlink to give posix
+  * semantics.
+  */
+ static int
+ smb_set_rw(struct dentry *dentry,struct smb_sb_info *server)
+ {
+       int result;
+       struct smb_fattr fattr;
+       /* FIXME: cifsUE should allow removing a readonly file. */
+       /* first get current attribute */
+       smb_init_dirent(server, &fattr);
+       result = server->ops->getattr(server, dentry, &fattr);
+       smb_finish_dirent(server, &fattr);
+       if (result < 0)
+               return result;
+       /* if RONLY attribute is set, remove it */
+       if (fattr.attr & aRONLY) {  /* read only attribute is set */
+               fattr.attr &= ~aRONLY;
+               result = smb_proc_setattr_core(server, dentry, fattr.attr);
+       }
+       return result;
+ }
+ #endif
+ int
+ smb_proc_unlink(struct dentry *dentry)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       int flag = 0;
+       char *p;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       retry:
+       p = smb_setup_header(req, SMBunlink, 1, 0);
+       WSET(req->rq_header, smb_vwv0, aSYSTEM | aHIDDEN);
+       result = smb_simple_encode_path(req, &p, dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       if ((result = smb_request_ok(req, SMBunlink, 0, 0)) < 0) {
+ #if SMBFS_POSIX_UNLINK
+               if (result == -EACCES && !flag) {
+                       /* Posix semantics is for the read-only state
+                          of a file to be ignored in unlink(). In the
+                          SMB world a unlink() is refused on a
+                          read-only file. To make things easier for
+                          unix users we try to override the files
+                          permission if the unlink fails with the
+                          right error.
+                          This introduces a race condition that could
+                          lead to a file being written by someone who
+                          shouldn't have access, but as far as I can
+                          tell that is unavoidable */
+                       /* remove RONLY attribute and try again */
+                       result = smb_set_rw(dentry,server);
+                       if (result == 0) {
+                               flag = 1;
+                               req->rq_flags = 0;
+                               goto retry;
+                       }
+               }
+ #endif
+               goto out_free;
+       }
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ int
+ smb_proc_flush(struct smb_sb_info *server, __u16 fileid)
+ {
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBflush, 1, 0);
+       WSET(req->rq_header, smb_vwv0, fileid);
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBflush, 0, 0);
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_trunc32(struct inode *inode, loff_t length)
+ {
+       /*
+        * Writing 0bytes is old-SMB magic for truncating files.
+        * MAX_NON_LFS should prevent this from being called with a too
+        * large offset.
+        */
+       return smb_proc_write(inode, length, 0, NULL);
+ }
+ static int
+ smb_proc_trunc64(struct inode *inode, loff_t length)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       int result;
+       char *param;
+       char *data;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 14)))
+               goto out;
+       param = req->rq_buffer;
+       data = req->rq_buffer + 6;
+       /* FIXME: must we also set allocation size? winNT seems to do that */
+       WSET(param, 0, SMB_I(inode)->fileid);
+       WSET(param, 2, SMB_SET_FILE_END_OF_FILE_INFO);
+       WSET(param, 4, 0);
+       LSET(data, 0, length);
+       req->rq_trans2_command = TRANSACT2_SETFILEINFO;
+       req->rq_ldata = 8;
+       req->rq_data  = data;
+       req->rq_lparm = 6;
+       req->rq_parm  = param;
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       result = 0;
+       if (req->rq_rcls != 0)
+               result = smb_errno(req);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_trunc95(struct inode *inode, loff_t length)
+ {
+       struct smb_sb_info *server = server_from_inode(inode);
+       int result = smb_proc_trunc32(inode, length);
+  
+       /*
+        * win9x doesn't appear to update the size immediately.
+        * It will return the old file size after the truncate,
+        * confusing smbfs. So we force an update.
+        *
+        * FIXME: is this still necessary?
+        */
+       smb_proc_flush(server, SMB_I(inode)->fileid);
+       return result;
+ }
+ static void
+ smb_init_dirent(struct smb_sb_info *server, struct smb_fattr *fattr)
+ {
+       memset(fattr, 0, sizeof(*fattr));
+       fattr->f_nlink = 1;
+       fattr->f_uid = server->mnt->uid;
+       fattr->f_gid = server->mnt->gid;
+       fattr->f_unix = 0;
+ }
+ static void
+ smb_finish_dirent(struct smb_sb_info *server, struct smb_fattr *fattr)
+ {
+       if (fattr->f_unix)
+               return;
+       fattr->f_mode = server->mnt->file_mode;
+       if (fattr->attr & aDIR) {
+               fattr->f_mode = server->mnt->dir_mode;
+               fattr->f_size = SMB_ST_BLKSIZE;
+       }
+       /* Check the read-only flag */
+       if (fattr->attr & aRONLY)
+               fattr->f_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
+       /* How many 512 byte blocks do we need for this file? */
+       fattr->f_blocks = 0;
+       if (fattr->f_size != 0)
+               fattr->f_blocks = 1 + ((fattr->f_size-1) >> 9);
+       return;
+ }
+ void
+ smb_init_root_dirent(struct smb_sb_info *server, struct smb_fattr *fattr,
+                    struct super_block *sb)
+ {
+       smb_init_dirent(server, fattr);
+       fattr->attr = aDIR;
+       fattr->f_ino = 2; /* traditional root inode number */
+       fattr->f_mtime = current_fs_time(sb);
+       smb_finish_dirent(server, fattr);
+ }
+ /*
+  * Decode a dirent for old protocols
+  *
+  * qname is filled with the decoded, and possibly translated, name.
+  * fattr receives decoded attributes
+  *
+  * Bugs Noted:
+  * (1) Pathworks servers may pad the name with extra spaces.
+  */
+ static char *
+ smb_decode_short_dirent(struct smb_sb_info *server, char *p,
+                       struct qstr *qname, struct smb_fattr *fattr,
+                       unsigned char *name_buf)
+ {
+       int len;
+       /*
+        * SMB doesn't have a concept of inode numbers ...
+        */
+       smb_init_dirent(server, fattr);
+       fattr->f_ino = 0;       /* FIXME: do we need this? */
+       p += SMB_STATUS_SIZE;   /* reserved (search_status) */
+       fattr->attr = *p;
+       fattr->f_mtime.tv_sec = date_dos2unix(server, WVAL(p, 3), WVAL(p, 1));
+       fattr->f_mtime.tv_nsec = 0;
+       fattr->f_size = DVAL(p, 5);
+       fattr->f_ctime = fattr->f_mtime;
+       fattr->f_atime = fattr->f_mtime;
+       qname->name = p + 9;
+       len = strnlen(qname->name, 12);
+       /*
+        * Trim trailing blanks for Pathworks servers
+        */
+       while (len > 2 && qname->name[len-1] == ' ')
+               len--;
+       smb_finish_dirent(server, fattr);
+ #if 0
+       /* FIXME: These only work for ascii chars, and recent smbmount doesn't
+          allow the flag to be set anyway. It kills const. Remove? */
+       switch (server->opt.case_handling) {
+       case SMB_CASE_UPPER:
+               str_upper(entry->name, len);
+               break;
+       case SMB_CASE_LOWER:
+               str_lower(entry->name, len);
+               break;
+       default:
+               break;
+       }
+ #endif
+       qname->len = 0;
+       len = server->ops->convert(name_buf, SMB_MAXNAMELEN,
+                                  qname->name, len,
+                                  server->remote_nls, server->local_nls);
+       if (len > 0) {
+               qname->len = len;
+               qname->name = name_buf;
+               DEBUG1("len=%d, name=%.*s\n",qname->len,qname->len,qname->name);
+       }
+       return p + 22;
+ }
+ /*
+  * This routine is used to read in directory entries from the network.
+  * Note that it is for short directory name seeks, i.e.: protocol <
+  * SMB_PROTOCOL_LANMAN2
+  */
+ static int
+ smb_proc_readdir_short(struct file *filp, void *dirent, filldir_t filldir,
+                      struct smb_cache_control *ctl)
+ {
+       struct dentry *dir = filp->f_path.dentry;
+       struct smb_sb_info *server = server_from_dentry(dir);
+       struct qstr qname;
+       struct smb_fattr fattr;
+       char *p;
+       int result;
+       int i, first, entries_seen, entries;
+       int entries_asked = (server->opt.max_xmit - 100) / SMB_DIRINFO_SIZE;
+       __u16 bcc;
+       __u16 count;
+       char status[SMB_STATUS_SIZE];
+       static struct qstr mask = {
+               .name   = "*.*",
+               .len    = 3,
+       };
+       unsigned char *last_status;
+       struct smb_request *req;
+       unsigned char *name_buf;
+       VERBOSE("%s/%s\n", DENTRY_PATH(dir));
+       lock_kernel();
+       result = -ENOMEM;
+       if (! (name_buf = kmalloc(SMB_MAXNAMELEN, GFP_KERNEL)))
+               goto out;
+       first = 1;
+       entries = 0;
+       entries_seen = 2; /* implicit . and .. */
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, server->opt.max_xmit)))
+               goto out_name;
+       while (1) {
+               p = smb_setup_header(req, SMBsearch, 2, 0);
+               WSET(req->rq_header, smb_vwv0, entries_asked);
+               WSET(req->rq_header, smb_vwv1, aDIR);
+               if (first == 1) {
+                       result = smb_simple_encode_path(req, &p, dir, &mask);
+                       if (result < 0)
+                               goto out_free;
+                       if (p + 3 > (char *)req->rq_buffer + req->rq_bufsize) {
+                               result = -ENAMETOOLONG;
+                               goto out_free;
+                       }
+                       *p++ = 5;
+                       WSET(p, 0, 0);
+                       p += 2;
+                       first = 0;
+               } else {
+                       if (p + 5 + SMB_STATUS_SIZE >
+                           (char *)req->rq_buffer + req->rq_bufsize) {
+                               result = -ENAMETOOLONG;
+                               goto out_free;
+                       }
+                               
+                       *p++ = 4;
+                       *p++ = 0;
+                       *p++ = 5;
+                       WSET(p, 0, SMB_STATUS_SIZE);
+                       p += 2;
+                       memcpy(p, status, SMB_STATUS_SIZE);
+                       p += SMB_STATUS_SIZE;
+               }
+               smb_setup_bcc(req, p);
+               result = smb_request_ok(req, SMBsearch, 1, -1);
+               if (result < 0) {
+                       if ((req->rq_rcls == ERRDOS) && 
+                           (req->rq_err  == ERRnofiles))
+                               break;
+                       goto out_free;
+               }
+               count = WVAL(req->rq_header, smb_vwv0);
+               if (count <= 0)
+                       break;
+               result = -EIO;
+               bcc = smb_bcc(req->rq_header);
+               if (bcc != count * SMB_DIRINFO_SIZE + 3)
+                       goto out_free;
+               p = req->rq_buffer + 3;
+               /* Make sure the response fits in the buffer. Fixed sized 
+                  entries means we don't have to check in the decode loop. */
+               last_status = req->rq_buffer + 3 + (count-1) * SMB_DIRINFO_SIZE;
+               if (last_status + SMB_DIRINFO_SIZE >=
+                   req->rq_buffer + req->rq_bufsize) {
+                       printk(KERN_ERR "smb_proc_readdir_short: "
+                              "last dir entry outside buffer! "
+                              "%d@%p  %d@%p\n", SMB_DIRINFO_SIZE, last_status,
+                              req->rq_bufsize, req->rq_buffer);
+                       goto out_free;
+               }
+               /* Read the last entry into the status field. */
+               memcpy(status, last_status, SMB_STATUS_SIZE);
+               /* Now we are ready to parse smb directory entries. */
+               for (i = 0; i < count; i++) {
+                       p = smb_decode_short_dirent(server, p, 
+                                                   &qname, &fattr, name_buf);
+                       if (qname.len == 0)
+                               continue;
+                       if (entries_seen == 2 && qname.name[0] == '.') {
+                               if (qname.len == 1)
+                                       continue;
+                               if (qname.name[1] == '.' && qname.len == 2)
+                                       continue;
+                       }
+                       if (!smb_fill_cache(filp, dirent, filldir, ctl, 
+                                           &qname, &fattr))
+                               ;       /* stop reading? */
+                       entries_seen++;
+               }
+       }
+       result = entries;
+ out_free:
+       smb_rput(req);
+ out_name:
+       kfree(name_buf);
+ out:
+       unlock_kernel();
+       return result;
+ }
+ static void smb_decode_unix_basic(struct smb_fattr *fattr, struct smb_sb_info *server, char *p)
+ {
+       u64 size, disk_bytes;
+       /* FIXME: verify nls support. all is sent as utf8? */
+       fattr->f_unix = 1;
+       fattr->f_mode = 0;
+       /* FIXME: use the uniqueID from the remote instead? */
+       /* 0 L file size in bytes */
+       /* 8 L file size on disk in bytes (block count) */
+       /* 40 L uid */
+       /* 48 L gid */
+       /* 56 W file type */
+       /* 60 L devmajor */
+       /* 68 L devminor */
+       /* 76 L unique ID (inode) */
+       /* 84 L permissions */
+       /* 92 L link count */
+       size = LVAL(p, 0);
+       disk_bytes = LVAL(p, 8);
+       /*
+        * Some samba versions round up on-disk byte usage
+        * to 1MB boundaries, making it useless. When seeing
+        * that, use the size instead.
+        */
+       if (!(disk_bytes & 0xfffff))
+               disk_bytes = size+511;
+       fattr->f_size = size;
+       fattr->f_blocks = disk_bytes >> 9;
+       fattr->f_ctime = smb_ntutc2unixutc(LVAL(p, 16));
+       fattr->f_atime = smb_ntutc2unixutc(LVAL(p, 24));
+       fattr->f_mtime = smb_ntutc2unixutc(LVAL(p, 32));
+       if (server->mnt->flags & SMB_MOUNT_UID)
+               fattr->f_uid = server->mnt->uid;
+       else
+               fattr->f_uid = LVAL(p, 40);
+       if (server->mnt->flags & SMB_MOUNT_GID)
+               fattr->f_gid = server->mnt->gid;
+       else
+               fattr->f_gid = LVAL(p, 48);
+       fattr->f_mode |= smb_filetype_to_mode(WVAL(p, 56));
+       if (S_ISBLK(fattr->f_mode) || S_ISCHR(fattr->f_mode)) {
+               __u64 major = LVAL(p, 60);
+               __u64 minor = LVAL(p, 68);
+               fattr->f_rdev = MKDEV(major & 0xffffffff, minor & 0xffffffff);
+               if (MAJOR(fattr->f_rdev) != (major & 0xffffffff) ||
+               MINOR(fattr->f_rdev) != (minor & 0xffffffff))
+                       fattr->f_rdev = 0;
+       }
+       fattr->f_mode |= LVAL(p, 84);
+       if ( (server->mnt->flags & SMB_MOUNT_DMODE) &&
+            (S_ISDIR(fattr->f_mode)) )
+               fattr->f_mode = (server->mnt->dir_mode & S_IRWXUGO) | S_IFDIR;
+       else if ( (server->mnt->flags & SMB_MOUNT_FMODE) &&
+                 !(S_ISDIR(fattr->f_mode)) )
+               fattr->f_mode = (server->mnt->file_mode & S_IRWXUGO) |
+                               (fattr->f_mode & S_IFMT);
+ }
+ /*
+  * Interpret a long filename structure using the specified info level:
+  *   level 1 for anything below NT1 protocol
+  *   level 260 for NT1 protocol
+  *
+  * qname is filled with the decoded, and possibly translated, name
+  * fattr receives decoded attributes.
+  *
+  * Bugs Noted:
+  * (1) Win NT 4.0 appends a null byte to names and counts it in the length!
+  */
+ static char *
+ smb_decode_long_dirent(struct smb_sb_info *server, char *p, int level,
+                      struct qstr *qname, struct smb_fattr *fattr,
+                      unsigned char *name_buf)
+ {
+       char *result;
+       unsigned int len = 0;
+       int n;
+       __u16 date, time;
+       int unicode = (server->mnt->flags & SMB_MOUNT_UNICODE);
+       /*
+        * SMB doesn't have a concept of inode numbers ...
+        */
+       smb_init_dirent(server, fattr);
+       fattr->f_ino = 0;       /* FIXME: do we need this? */
+       switch (level) {
+       case 1:
+               len = *((unsigned char *) p + 22);
+               qname->name = p + 23;
+               result = p + 24 + len;
+               date = WVAL(p, 0);
+               time = WVAL(p, 2);
+               fattr->f_ctime.tv_sec = date_dos2unix(server, date, time);
+               fattr->f_ctime.tv_nsec = 0;
+               date = WVAL(p, 4);
+               time = WVAL(p, 6);
+               fattr->f_atime.tv_sec = date_dos2unix(server, date, time);
+               fattr->f_atime.tv_nsec = 0;
+               date = WVAL(p, 8);
+               time = WVAL(p, 10);
+               fattr->f_mtime.tv_sec = date_dos2unix(server, date, time);
+               fattr->f_mtime.tv_nsec = 0;
+               fattr->f_size = DVAL(p, 12);
+               /* ULONG allocation size */
+               fattr->attr = WVAL(p, 20);
+               VERBOSE("info 1 at %p, len=%d, name=%.*s\n",
+                       p, len, len, qname->name);
+               break;
+       case 260:
+               result = p + WVAL(p, 0);
+               len = DVAL(p, 60);
+               if (len > 255) len = 255;
+               /* NT4 null terminates, unless we are using unicode ... */
+               qname->name = p + 94;
+               if (!unicode && len && qname->name[len-1] == '\0')
+                       len--;
+               fattr->f_ctime = smb_ntutc2unixutc(LVAL(p, 8));
+               fattr->f_atime = smb_ntutc2unixutc(LVAL(p, 16));
+               fattr->f_mtime = smb_ntutc2unixutc(LVAL(p, 24));
+               /* change time (32) */
+               fattr->f_size = LVAL(p, 40);
+               /* alloc size (48) */
+               fattr->attr = DVAL(p, 56);
+               VERBOSE("info 260 at %p, len=%d, name=%.*s\n",
+                       p, len, len, qname->name);
+               break;
+       case SMB_FIND_FILE_UNIX:
+               result = p + WVAL(p, 0);
+               qname->name = p + 108;
+               len = strlen(qname->name);
+               /* FIXME: should we check the length?? */
+               p += 8;
+               smb_decode_unix_basic(fattr, server, p);
+               VERBOSE("info SMB_FIND_FILE_UNIX at %p, len=%d, name=%.*s\n",
+                       p, len, len, qname->name);
+               break;
+       default:
+               PARANOIA("Unknown info level %d\n", level);
+               result = p + WVAL(p, 0);
+               goto out;
+       }
+       smb_finish_dirent(server, fattr);
+ #if 0
+       /* FIXME: These only work for ascii chars, and recent smbmount doesn't
+          allow the flag to be set anyway. Remove? */
+       switch (server->opt.case_handling) {
+       case SMB_CASE_UPPER:
+               str_upper(qname->name, len);
+               break;
+       case SMB_CASE_LOWER:
+               str_lower(qname->name, len);
+               break;
+       default:
+               break;
+       }
+ #endif
+       qname->len = 0;
+       n = server->ops->convert(name_buf, SMB_MAXNAMELEN,
+                                qname->name, len,
+                                server->remote_nls, server->local_nls);
+       if (n > 0) {
+               qname->len = n;
+               qname->name = name_buf;
+       }
+ out:
+       return result;
+ }
+ /* findfirst/findnext flags */
+ #define SMB_CLOSE_AFTER_FIRST (1<<0)
+ #define SMB_CLOSE_IF_END (1<<1)
+ #define SMB_REQUIRE_RESUME_KEY (1<<2)
+ #define SMB_CONTINUE_BIT (1<<3)
+ /*
+  * Note: samba-2.0.7 (at least) has a very similar routine, cli_list, in
+  * source/libsmb/clilist.c. When looking for smb bugs in the readdir code,
+  * go there for advise.
+  *
+  * Bugs Noted:
+  * (1) When using Info Level 1 Win NT 4.0 truncates directory listings 
+  * for certain patterns of names and/or lengths. The breakage pattern
+  * is completely reproducible and can be toggled by the creation of a
+  * single file. (E.g. echo hi >foo breaks, rm -f foo works.)
+  */
+ static int
+ smb_proc_readdir_long(struct file *filp, void *dirent, filldir_t filldir,
+                     struct smb_cache_control *ctl)
+ {
+       struct dentry *dir = filp->f_path.dentry;
+       struct smb_sb_info *server = server_from_dentry(dir);
+       struct qstr qname;
+       struct smb_fattr fattr;
+       unsigned char *p, *lastname;
+       char *mask, *param;
+       __u16 command;
+       int first, entries_seen;
+       /* Both NT and OS/2 accept info level 1 (but see note below). */
+       int info_level = 260;
+       const int max_matches = 512;
+       unsigned int ff_searchcount = 0;
+       unsigned int ff_eos = 0;
+       unsigned int ff_lastname = 0;
+       unsigned int ff_dir_handle = 0;
+       unsigned int loop_count = 0;
+       unsigned int mask_len, i;
+       int result;
+       struct smb_request *req;
+       unsigned char *name_buf;
+       static struct qstr star = {
+               .name   = "*",
+               .len    = 1,
+       };
+       lock_kernel();
+       /*
+        * We always prefer unix style. Use info level 1 for older
+        * servers that don't do 260.
+        */
+       if (server->opt.capabilities & SMB_CAP_UNIX)
+               info_level = SMB_FIND_FILE_UNIX;
+       else if (server->opt.protocol < SMB_PROTOCOL_NT1)
+               info_level = 1;
+       result = -ENOMEM;
+       if (! (name_buf = kmalloc(SMB_MAXNAMELEN+2, GFP_KERNEL)))
+               goto out;
+       if (! (req = smb_alloc_request(server, server->opt.max_xmit)))
+               goto out_name;
+       param = req->rq_buffer;
+       /*
+        * Encode the initial path
+        */
+       mask = param + 12;
+       result = smb_encode_path(server, mask, SMB_MAXPATHLEN+1, dir, &star);
+       if (result <= 0)
+               goto out_free;
+       mask_len = result - 1;  /* mask_len is strlen, not #bytes */
+       result = 0;
+       first = 1;
+       VERBOSE("starting mask_len=%d, mask=%s\n", mask_len, mask);
+       entries_seen = 2;
+       ff_eos = 0;
+       while (ff_eos == 0) {
+               loop_count += 1;
+               if (loop_count > 10) {
+                       printk(KERN_WARNING "smb_proc_readdir_long: "
+                              "Looping in FIND_NEXT??\n");
+                       result = -EIO;
+                       break;
+               }
+               if (first != 0) {
+                       command = TRANSACT2_FINDFIRST;
+                       WSET(param, 0, aSYSTEM | aHIDDEN | aDIR);
+                       WSET(param, 2, max_matches);    /* max count */
+                       WSET(param, 4, SMB_CLOSE_IF_END);
+                       WSET(param, 6, info_level);
+                       DSET(param, 8, 0);
+               } else {
+                       command = TRANSACT2_FINDNEXT;
+                       VERBOSE("handle=0x%X, lastname=%d, mask=%.*s\n",
+                               ff_dir_handle, ff_lastname, mask_len, mask);
+                       WSET(param, 0, ff_dir_handle);  /* search handle */
+                       WSET(param, 2, max_matches);    /* max count */
+                       WSET(param, 4, info_level);
+                       DSET(param, 6, 0);
+                       WSET(param, 10, SMB_CONTINUE_BIT|SMB_CLOSE_IF_END);
+               }
+               req->rq_trans2_command = command;
+               req->rq_ldata = 0;
+               req->rq_data  = NULL;
+               req->rq_lparm = 12 + mask_len + 1;
+               req->rq_parm  = param;
+               req->rq_flags = 0;
+               result = smb_add_request(req);
+               if (result < 0) {
+                       PARANOIA("error=%d, breaking\n", result);
+                       break;
+               }
+               if (req->rq_rcls == ERRSRV && req->rq_err == ERRerror) {
+                       /* a damn Win95 bug - sometimes it clags if you 
+                          ask it too fast */
+                       schedule_timeout_interruptible(msecs_to_jiffies(200));
+                       continue;
+                 }
+               if (req->rq_rcls != 0) {
+                       result = smb_errno(req);
+                       PARANOIA("name=%s, result=%d, rcls=%d, err=%d\n",
+                                mask, result, req->rq_rcls, req->rq_err);
+                       break;
+               }
+               /* parse out some important return info */
+               if (first != 0) {
+                       ff_dir_handle = WVAL(req->rq_parm, 0);
+                       ff_searchcount = WVAL(req->rq_parm, 2);
+                       ff_eos = WVAL(req->rq_parm, 4);
+                       ff_lastname = WVAL(req->rq_parm, 8);
+               } else {
+                       ff_searchcount = WVAL(req->rq_parm, 0);
+                       ff_eos = WVAL(req->rq_parm, 2);
+                       ff_lastname = WVAL(req->rq_parm, 6);
+               }
+               if (ff_searchcount == 0)
+                       break;
+               /* Now we are ready to parse smb directory entries. */
+               /* point to the data bytes */
+               p = req->rq_data;
+               for (i = 0; i < ff_searchcount; i++) {
+                       /* make sure we stay within the buffer */
+                       if (p >= req->rq_data + req->rq_ldata) {
+                               printk(KERN_ERR "smb_proc_readdir_long: "
+                                      "dirent pointer outside buffer! "
+                                      "%p  %d@%p\n",
+                                      p, req->rq_ldata, req->rq_data);
+                               result = -EIO; /* always a comm. error? */
+                               goto out_free;
+                       }
+                       p = smb_decode_long_dirent(server, p, info_level,
+                                                  &qname, &fattr, name_buf);
+                       /* ignore . and .. from the server */
+                       if (entries_seen == 2 && qname.name[0] == '.') {
+                               if (qname.len == 1)
+                                       continue;
+                               if (qname.name[1] == '.' && qname.len == 2)
+                                       continue;
+                       }
+                       if (!smb_fill_cache(filp, dirent, filldir, ctl, 
+                                           &qname, &fattr))
+                               ;       /* stop reading? */
+                       entries_seen++;
+               }
+               VERBOSE("received %d entries, eos=%d\n", ff_searchcount,ff_eos);
+               /*
+                * We might need the lastname for continuations.
+                *
+                * Note that some servers (win95?) point to the filename and
+                * others (NT4, Samba using NT1) to the dir entry. We assume
+                * here that those who do not point to a filename do not need
+                * this info to continue the listing.
+                *
+                * OS/2 needs this and talks infolevel 1.
+                * NetApps want lastname with infolevel 260.
+                * win2k want lastname with infolevel 260, and points to
+                *       the record not to the name.
+                * Samba+CifsUnixExt doesn't need lastname.
+                *
+                * Both are happy if we return the data they point to. So we do.
+                * (FIXME: above is not true with win2k)
+                */
+               mask_len = 0;
+               if (info_level != SMB_FIND_FILE_UNIX &&
+                   ff_lastname > 0 && ff_lastname < req->rq_ldata) {
+                       lastname = req->rq_data + ff_lastname;
+                       switch (info_level) {
+                       case 260:
+                               mask_len = req->rq_ldata - ff_lastname;
+                               break;
+                       case 1:
+                               /* lastname points to a length byte */
+                               mask_len = *lastname++;
+                               if (ff_lastname + 1 + mask_len > req->rq_ldata)
+                                       mask_len = req->rq_ldata - ff_lastname - 1;
+                               break;
+                       }
+                       /*
+                        * Update the mask string for the next message.
+                        */
+                       if (mask_len > 255)
+                               mask_len = 255;
+                       if (mask_len)
+                               strncpy(mask, lastname, mask_len);
+               }
+               mask_len = strnlen(mask, mask_len);
+               VERBOSE("new mask, len=%d@%d of %d, mask=%.*s\n",
+                       mask_len, ff_lastname, req->rq_ldata, mask_len, mask);
+               first = 0;
+               loop_count = 0;
+       }
+ out_free:
+       smb_rput(req);
+ out_name:
+       kfree(name_buf);
+ out:
+       unlock_kernel();
+       return result;
+ }
+ /*
+  * This version uses the trans2 TRANSACT2_FINDFIRST message 
+  * to get the attribute data.
+  *
+  * Bugs Noted:
+  */
+ static int
+ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
+                       struct smb_fattr *fattr)
+ {
+       char *param, *mask;
+       __u16 date, time;
+       int mask_len, result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       mask = param + 12;
+       mask_len = smb_encode_path(server, mask, SMB_MAXPATHLEN+1, dentry,NULL);
+       if (mask_len < 0) {
+               result = mask_len;
+               goto out_free;
+       }
+       VERBOSE("name=%s, len=%d\n", mask, mask_len);
+       WSET(param, 0, aSYSTEM | aHIDDEN | aDIR);
+       WSET(param, 2, 1);      /* max count */
+       WSET(param, 4, 1);      /* close after this call */
+       WSET(param, 6, 1);      /* info_level */
+       DSET(param, 8, 0);
+       req->rq_trans2_command = TRANSACT2_FINDFIRST;
+       req->rq_ldata = 0;
+       req->rq_data  = NULL;
+       req->rq_lparm = 12 + mask_len;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       if (req->rq_rcls != 0) {
+               result = smb_errno(req);
+ #ifdef SMBFS_PARANOIA
+               if (result != -ENOENT)
+                       PARANOIA("error for %s, rcls=%d, err=%d\n",
+                                mask, req->rq_rcls, req->rq_err);
+ #endif
+               goto out_free;
+       }
+       /* Make sure we got enough data ... */
+       result = -EINVAL;
+       if (req->rq_ldata < 22 || WVAL(req->rq_parm, 2) != 1) {
+               PARANOIA("bad result for %s, len=%d, count=%d\n",
+                        mask, req->rq_ldata, WVAL(req->rq_parm, 2));
+               goto out_free;
+       }
+       /*
+        * Decode the response into the fattr ...
+        */
+       date = WVAL(req->rq_data, 0);
+       time = WVAL(req->rq_data, 2);
+       fattr->f_ctime.tv_sec = date_dos2unix(server, date, time);
+       fattr->f_ctime.tv_nsec = 0;
+       date = WVAL(req->rq_data, 4);
+       time = WVAL(req->rq_data, 6);
+       fattr->f_atime.tv_sec = date_dos2unix(server, date, time);
+       fattr->f_atime.tv_nsec = 0;
+       date = WVAL(req->rq_data, 8);
+       time = WVAL(req->rq_data, 10);
+       fattr->f_mtime.tv_sec = date_dos2unix(server, date, time);
+       fattr->f_mtime.tv_nsec = 0;
+       VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n",
+               mask, date, time, fattr->f_mtime.tv_sec);
+       fattr->f_size = DVAL(req->rq_data, 12);
+       /* ULONG allocation size */
+       fattr->attr = WVAL(req->rq_data, 20);
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_getattr_core(struct smb_sb_info *server, struct dentry *dir,
+                     struct smb_fattr *fattr)
+ {
+       int result;
+       char *p;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       p = smb_setup_header(req, SMBgetatr, 0, 0);
+       result = smb_simple_encode_path(req, &p, dir, NULL);
+       if (result < 0)
+               goto out_free;
+       smb_setup_bcc(req, p);
+       if ((result = smb_request_ok(req, SMBgetatr, 10, 0)) < 0)
+               goto out_free;
+       fattr->attr    = WVAL(req->rq_header, smb_vwv0);
+       fattr->f_mtime.tv_sec = local2utc(server, DVAL(req->rq_header, smb_vwv1));
+       fattr->f_mtime.tv_nsec = 0;
+       fattr->f_size  = DVAL(req->rq_header, smb_vwv3);
+       fattr->f_ctime = fattr->f_mtime; 
+       fattr->f_atime = fattr->f_mtime; 
+ #ifdef SMBFS_DEBUG_TIMESTAMP
+       printk("getattr_core: %s/%s, mtime=%ld\n",
+              DENTRY_PATH(dir), fattr->f_mtime);
+ #endif
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Bugs Noted:
+  * (1) Win 95 swaps the date and time fields in the standard info level.
+  */
+ static int
+ smb_proc_getattr_trans2(struct smb_sb_info *server, struct dentry *dir,
+                       struct smb_request *req, int infolevel)
+ {
+       char *p, *param;
+       int result;
+       param = req->rq_buffer;
+       WSET(param, 0, infolevel);
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, dir, NULL);
+       if (result < 0)
+               goto out;
+       p = param + 6 + result;
+       req->rq_trans2_command = TRANSACT2_QPATHINFO;
+       req->rq_ldata = 0;
+       req->rq_data  = NULL;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out;
+       if (req->rq_rcls != 0) {
+               VERBOSE("for %s: result=%d, rcls=%d, err=%d\n",
+                       &param[6], result, req->rq_rcls, req->rq_err);
+               result = smb_errno(req);
+               goto out;
+       }
+       result = -ENOENT;
+       if (req->rq_ldata < 22) {
+               PARANOIA("not enough data for %s, len=%d\n",
+                        &param[6], req->rq_ldata);
+               goto out;
+       }
+       result = 0;
+ out:
+       return result;
+ }
+ static int
+ smb_proc_getattr_trans2_std(struct smb_sb_info *server, struct dentry *dir,
+                           struct smb_fattr *attr)
+ {
+       u16 date, time;
+       int off_date = 0, off_time = 2;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       result = smb_proc_getattr_trans2(server, dir, req, SMB_INFO_STANDARD);
+       if (result < 0)
+               goto out_free;
+       /*
+        * Kludge alert: Win 95 swaps the date and time field,
+        * contrary to the CIFS docs and Win NT practice.
+        */
+       if (server->mnt->flags & SMB_MOUNT_WIN95) {
+               off_date = 2;
+               off_time = 0;
+       }
+       date = WVAL(req->rq_data, off_date);
+       time = WVAL(req->rq_data, off_time);
+       attr->f_ctime.tv_sec = date_dos2unix(server, date, time);
+       attr->f_ctime.tv_nsec = 0;
+       date = WVAL(req->rq_data, 4 + off_date);
+       time = WVAL(req->rq_data, 4 + off_time);
+       attr->f_atime.tv_sec = date_dos2unix(server, date, time);
+       attr->f_atime.tv_nsec = 0;
+       date = WVAL(req->rq_data, 8 + off_date);
+       time = WVAL(req->rq_data, 8 + off_time);
+       attr->f_mtime.tv_sec = date_dos2unix(server, date, time);
+       attr->f_mtime.tv_nsec = 0;
+ #ifdef SMBFS_DEBUG_TIMESTAMP
+       printk(KERN_DEBUG "getattr_trans2: %s/%s, date=%x, time=%x, mtime=%ld\n",
+              DENTRY_PATH(dir), date, time, attr->f_mtime);
+ #endif
+       attr->f_size = DVAL(req->rq_data, 12);
+       attr->attr = WVAL(req->rq_data, 20);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_getattr_trans2_all(struct smb_sb_info *server, struct dentry *dir,
+                           struct smb_fattr *attr)
+ {
+       struct smb_request *req;
+       int result;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       result = smb_proc_getattr_trans2(server, dir, req,
+                                        SMB_QUERY_FILE_ALL_INFO);
+       if (result < 0)
+               goto out_free;
+       attr->f_ctime = smb_ntutc2unixutc(LVAL(req->rq_data, 0));
+       attr->f_atime = smb_ntutc2unixutc(LVAL(req->rq_data, 8));
+       attr->f_mtime = smb_ntutc2unixutc(LVAL(req->rq_data, 16));
+       /* change (24) */
+       attr->attr = WVAL(req->rq_data, 32);
+       /* pad? (34) */
+       /* allocated size (40) */
+       attr->f_size = LVAL(req->rq_data, 48);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_getattr_unix(struct smb_sb_info *server, struct dentry *dir,
+                     struct smb_fattr *attr)
+ {
+       struct smb_request *req;
+       int result;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       result = smb_proc_getattr_trans2(server, dir, req,
+                                        SMB_QUERY_FILE_UNIX_BASIC);
+       if (result < 0)
+               goto out_free;
+       smb_decode_unix_basic(attr, server, req->rq_data);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_getattr_95(struct smb_sb_info *server, struct dentry *dir,
+                   struct smb_fattr *attr)
+ {
+       struct inode *inode = dir->d_inode;
+       int result;
+       /* FIXME: why not use the "all" version? */
+       result = smb_proc_getattr_trans2_std(server, dir, attr);
+       if (result < 0)
+               goto out;
+       /*
+        * None of the getattr versions here can make win9x return the right
+        * filesize if there are changes made to an open file.
+        * A seek-to-end does return the right size, but we only need to do
+        * that on files we have written.
+        */
+       if (inode && SMB_I(inode)->flags & SMB_F_LOCALWRITE &&
+           smb_is_open(inode))
+       {
+               __u16 fileid = SMB_I(inode)->fileid;
+               attr->f_size = smb_proc_seek(server, fileid, 2, 0);
+       }
+ out:
+       return result;
+ }
+ static int
+ smb_proc_ops_wait(struct smb_sb_info *server)
+ {
+       int result;
+       result = wait_event_interruptible_timeout(server->conn_wq,
+                               server->conn_complete, 30*HZ);
+       if (!result || signal_pending(current))
+               return -EIO;
+       return 0;
+ }
+ static int
+ smb_proc_getattr_null(struct smb_sb_info *server, struct dentry *dir,
+                         struct smb_fattr *fattr)
+ {
+       int result;
+       if (smb_proc_ops_wait(server) < 0)
+               return -EIO;
+       smb_init_dirent(server, fattr);
+       result = server->ops->getattr(server, dir, fattr);
+       smb_finish_dirent(server, fattr);
+       return result;
+ }
+ static int
+ smb_proc_readdir_null(struct file *filp, void *dirent, filldir_t filldir,
+                     struct smb_cache_control *ctl)
+ {
+       struct smb_sb_info *server = server_from_dentry(filp->f_path.dentry);
+       if (smb_proc_ops_wait(server) < 0)
+               return -EIO;
+       return server->ops->readdir(filp, dirent, filldir, ctl);
+ }
+ int
+ smb_proc_getattr(struct dentry *dir, struct smb_fattr *fattr)
+ {
+       struct smb_sb_info *server = server_from_dentry(dir);
+       int result;
+       smb_init_dirent(server, fattr);
+       result = server->ops->getattr(server, dir, fattr);
+       smb_finish_dirent(server, fattr);
+       return result;
+ }
+ /*
+  * Because of bugs in the core protocol, we use this only to set
+  * attributes. See smb_proc_settime() below for timestamp handling.
+  *
+  * Bugs Noted:
+  * (1) If mtime is non-zero, both Win 3.1 and Win 95 fail
+  * with an undocumented error (ERRDOS code 50). Setting
+  * mtime to 0 allows the attributes to be set.
+  * (2) The extra parameters following the name string aren't
+  * in the CIFS docs, but seem to be necessary for operation.
+  */
+ static int
+ smb_proc_setattr_core(struct smb_sb_info *server, struct dentry *dentry,
+                     __u16 attr)
+ {
+       char *p;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       p = smb_setup_header(req, SMBsetatr, 8, 0);
+       WSET(req->rq_header, smb_vwv0, attr);
+       DSET(req->rq_header, smb_vwv1, 0); /* mtime */
+       WSET(req->rq_header, smb_vwv3, 0); /* reserved values */
+       WSET(req->rq_header, smb_vwv4, 0);
+       WSET(req->rq_header, smb_vwv5, 0);
+       WSET(req->rq_header, smb_vwv6, 0);
+       WSET(req->rq_header, smb_vwv7, 0);
+       result = smb_simple_encode_path(req, &p, dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       if (p + 2 > (char *)req->rq_buffer + req->rq_bufsize) {
+               result = -ENAMETOOLONG;
+               goto out_free;
+       }
+       *p++ = 4;
+       *p++ = 0;
+       smb_setup_bcc(req, p);
+       result = smb_request_ok(req, SMBsetatr, 0, 0);
+       if (result < 0)
+               goto out_free;
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Because of bugs in the trans2 setattr messages, we must set
+  * attributes and timestamps separately. The core SMBsetatr
+  * message seems to be the only reliable way to set attributes.
+  */
+ int
+ smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr)
+ {
+       struct smb_sb_info *server = server_from_dentry(dir);
+       int result;
+       VERBOSE("setting %s/%s, open=%d\n", 
+               DENTRY_PATH(dir), smb_is_open(dir->d_inode));
+       result = smb_proc_setattr_core(server, dir, fattr->attr);
+       return result;
+ }
+ /*
+  * Sets the timestamps for an file open with write permissions.
+  */
+ static int
+ smb_proc_setattr_ext(struct smb_sb_info *server,
+                     struct inode *inode, struct smb_fattr *fattr)
+ {
+       __u16 date, time;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBsetattrE, 7, 0);
+       WSET(req->rq_header, smb_vwv0, SMB_I(inode)->fileid);
+       /* We don't change the creation time */
+       WSET(req->rq_header, smb_vwv1, 0);
+       WSET(req->rq_header, smb_vwv2, 0);
+       date_unix2dos(server, fattr->f_atime.tv_sec, &date, &time);
+       WSET(req->rq_header, smb_vwv3, date);
+       WSET(req->rq_header, smb_vwv4, time);
+       date_unix2dos(server, fattr->f_mtime.tv_sec, &date, &time);
+       WSET(req->rq_header, smb_vwv5, date);
+       WSET(req->rq_header, smb_vwv6, time);
+ #ifdef SMBFS_DEBUG_TIMESTAMP
+       printk(KERN_DEBUG "smb_proc_setattr_ext: date=%d, time=%d, mtime=%ld\n",
+              date, time, fattr->f_mtime);
+ #endif
+       req->rq_flags |= SMB_REQ_NORETRY;
+       result = smb_request_ok(req, SMBsetattrE, 0, 0);
+       if (result < 0)
+               goto out_free;
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Bugs Noted:
+  * (1) The TRANSACT2_SETPATHINFO message under Win NT 4.0 doesn't
+  * set the file's attribute flags.
+  */
+ static int
+ smb_proc_setattr_trans2(struct smb_sb_info *server,
+                       struct dentry *dir, struct smb_fattr *fattr)
+ {
+       __u16 date, time;
+       char *p, *param;
+       int result;
+       char data[26];
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       WSET(param, 0, 1);      /* Info level SMB_INFO_STANDARD */
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, dir, NULL);
+       if (result < 0)
+               goto out_free;
+       p = param + 6 + result;
+       WSET(data, 0, 0); /* creation time */
+       WSET(data, 2, 0);
+       date_unix2dos(server, fattr->f_atime.tv_sec, &date, &time);
+       WSET(data, 4, date);
+       WSET(data, 6, time);
+       date_unix2dos(server, fattr->f_mtime.tv_sec, &date, &time);
+       WSET(data, 8, date);
+       WSET(data, 10, time);
+ #ifdef SMBFS_DEBUG_TIMESTAMP
+       printk(KERN_DEBUG "setattr_trans2: %s/%s, date=%x, time=%x, mtime=%ld\n", 
+              DENTRY_PATH(dir), date, time, fattr->f_mtime);
+ #endif
+       DSET(data, 12, 0); /* size */
+       DSET(data, 16, 0); /* blksize */
+       WSET(data, 20, 0); /* attr */
+       DSET(data, 22, 0); /* ULONG EA size */
+       req->rq_trans2_command = TRANSACT2_SETPATHINFO;
+       req->rq_ldata = 26;
+       req->rq_data  = data;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       result = 0;
+       if (req->rq_rcls != 0)
+               result = smb_errno(req);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * ATTR_MODE      0x001
+  * ATTR_UID       0x002
+  * ATTR_GID       0x004
+  * ATTR_SIZE      0x008
+  * ATTR_ATIME     0x010
+  * ATTR_MTIME     0x020
+  * ATTR_CTIME     0x040
+  * ATTR_ATIME_SET 0x080
+  * ATTR_MTIME_SET 0x100
+  * ATTR_FORCE     0x200       
+  * ATTR_ATTR_FLAG 0x400
+  *
+  * major/minor should only be set by mknod.
+  */
+ int
+ smb_proc_setattr_unix(struct dentry *d, struct iattr *attr,
+                     unsigned int major, unsigned int minor)
+ {
+       struct smb_sb_info *server = server_from_dentry(d);
+       u64 nttime;
+       char *p, *param;
+       int result;
+       char data[100];
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       DEBUG1("valid flags = 0x%04x\n", attr->ia_valid);
+       WSET(param, 0, SMB_SET_FILE_UNIX_BASIC);
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, d, NULL);
+       if (result < 0)
+               goto out_free;
+       p = param + 6 + result;
+       /* 0 L file size in bytes */
+       /* 8 L file size on disk in bytes (block count) */
+       /* 40 L uid */
+       /* 48 L gid */
+       /* 56 W file type enum */
+       /* 60 L devmajor */
+       /* 68 L devminor */
+       /* 76 L unique ID (inode) */
+       /* 84 L permissions */
+       /* 92 L link count */
+       LSET(data, 0, SMB_SIZE_NO_CHANGE);
+       LSET(data, 8, SMB_SIZE_NO_CHANGE);
+       LSET(data, 16, SMB_TIME_NO_CHANGE);
+       LSET(data, 24, SMB_TIME_NO_CHANGE);
+       LSET(data, 32, SMB_TIME_NO_CHANGE);
+       LSET(data, 40, SMB_UID_NO_CHANGE);
+       LSET(data, 48, SMB_GID_NO_CHANGE);
+       DSET(data, 56, smb_filetype_from_mode(attr->ia_mode));
+       LSET(data, 60, major);
+       LSET(data, 68, minor);
+       LSET(data, 76, 0);
+       LSET(data, 84, SMB_MODE_NO_CHANGE);
+       LSET(data, 92, 0);
+       if (attr->ia_valid & ATTR_SIZE) {
+               LSET(data, 0, attr->ia_size);
+               LSET(data, 8, 0); /* can't set anyway */
+       }
+       /*
+        * FIXME: check the conversion function it the correct one
+        *
+        * we can't set ctime but we might as well pass this to the server
+        * and let it ignore it.
+        */
+       if (attr->ia_valid & ATTR_CTIME) {
+               nttime = smb_unixutc2ntutc(attr->ia_ctime);
+               LSET(data, 16, nttime);
+       }
+       if (attr->ia_valid & ATTR_ATIME) {
+               nttime = smb_unixutc2ntutc(attr->ia_atime);
+               LSET(data, 24, nttime);
+       }
+       if (attr->ia_valid & ATTR_MTIME) {
+               nttime = smb_unixutc2ntutc(attr->ia_mtime);
+               LSET(data, 32, nttime);
+       }
+       
+       if (attr->ia_valid & ATTR_UID) {
+               LSET(data, 40, attr->ia_uid);
+       }
+       if (attr->ia_valid & ATTR_GID) {
+               LSET(data, 48, attr->ia_gid); 
+       }
+       
+       if (attr->ia_valid & ATTR_MODE) {
+               LSET(data, 84, attr->ia_mode);
+       }
+       req->rq_trans2_command = TRANSACT2_SETPATHINFO;
+       req->rq_ldata = 100;
+       req->rq_data  = data;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Set the modify and access timestamps for a file.
+  *
+  * Incredibly enough, in all of SMB there is no message to allow
+  * setting both attributes and timestamps at once. 
+  *
+  * Bugs Noted:
+  * (1) Win 95 doesn't support the TRANSACT2_SETFILEINFO message 
+  * with info level 1 (INFO_STANDARD).
+  * (2) Win 95 seems not to support setting directory timestamps.
+  * (3) Under the core protocol apparently the only way to set the
+  * timestamp is to open and close the file.
+  */
+ int
+ smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr)
+ {
+       struct smb_sb_info *server = server_from_dentry(dentry);
+       struct inode *inode = dentry->d_inode;
+       int result;
+       VERBOSE("setting %s/%s, open=%d\n",
+               DENTRY_PATH(dentry), smb_is_open(inode));
+       /* setting the time on a Win95 server fails (tridge) */
+       if (server->opt.protocol >= SMB_PROTOCOL_LANMAN2 && 
+           !(server->mnt->flags & SMB_MOUNT_WIN95)) {
+               if (smb_is_open(inode) && SMB_I(inode)->access != SMB_O_RDONLY)
+                       result = smb_proc_setattr_ext(server, inode, fattr);
+               else
+                       result = smb_proc_setattr_trans2(server, dentry, fattr);
+       } else {
+               /*
+                * Fail silently on directories ... timestamp can't be set?
+                */
+               result = 0;
+               if (S_ISREG(inode->i_mode)) {
+                       /*
+                        * Set the mtime by opening and closing the file.
+                        * Note that the file is opened read-only, but this
+                        * still allows us to set the date (tridge)
+                        */
+                       result = -EACCES;
+                       if (!smb_is_open(inode))
+                               smb_proc_open(server, dentry, SMB_O_RDONLY);
+                       if (smb_is_open(inode)) {
+                               inode->i_mtime = fattr->f_mtime;
+                               result = smb_proc_close_inode(server, inode);
+                       }
+               }
+       }
+       return result;
+ }
+ int
+ smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr)
+ {
+       struct smb_sb_info *server = SMB_SB(dentry->d_sb);
+       int result;
+       char *p;
+       long unit;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 0)))
+               goto out;
+       smb_setup_header(req, SMBdskattr, 0, 0);
+       if ((result = smb_request_ok(req, SMBdskattr, 5, 0)) < 0)
+               goto out_free;
+       p = SMB_VWV(req->rq_header);
+       unit = (WVAL(p, 2) * WVAL(p, 4)) >> SMB_ST_BLKSHIFT;
+       attr->f_blocks = WVAL(p, 0) * unit;
+       attr->f_bsize  = SMB_ST_BLKSIZE;
+       attr->f_bavail = attr->f_bfree = WVAL(p, 6) * unit;
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ int
+ smb_proc_read_link(struct smb_sb_info *server, struct dentry *d,
+                  char *buffer, int len)
+ {
+       char *p, *param;
+       int result;
+       struct smb_request *req;
+       DEBUG1("readlink of %s/%s\n", DENTRY_PATH(d));
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       WSET(param, 0, SMB_QUERY_FILE_UNIX_LINK);
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, d, NULL);
+       if (result < 0)
+               goto out_free;
+       p = param + 6 + result;
+       req->rq_trans2_command = TRANSACT2_QPATHINFO;
+       req->rq_ldata = 0;
+       req->rq_data  = NULL;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       DEBUG1("for %s: result=%d, rcls=%d, err=%d\n",
+               &param[6], result, req->rq_rcls, req->rq_err);
+       /* copy data up to the \0 or buffer length */
+       result = len;
+       if (req->rq_ldata < len)
+               result = req->rq_ldata;
+       strncpy(buffer, req->rq_data, result);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Create a symlink object called dentry which points to oldpath.
+  * Samba does not permit dangling links but returns a suitable error message.
+  */
+ int
+ smb_proc_symlink(struct smb_sb_info *server, struct dentry *d,
+                const char *oldpath)
+ {
+       char *p, *param;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       WSET(param, 0, SMB_SET_FILE_UNIX_LINK);
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param + 6, SMB_MAXPATHLEN+1, d, NULL);
+       if (result < 0)
+               goto out_free;
+       p = param + 6 + result;
+       req->rq_trans2_command = TRANSACT2_SETPATHINFO;
+       req->rq_ldata = strlen(oldpath) + 1;
+       req->rq_data  = (char *) oldpath;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       DEBUG1("for %s: result=%d, rcls=%d, err=%d\n",
+               &param[6], result, req->rq_rcls, req->rq_err);
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ /*
+  * Create a hard link object called new_dentry which points to dentry.
+  */
+ int
+ smb_proc_link(struct smb_sb_info *server, struct dentry *dentry,
+             struct dentry *new_dentry)
+ {
+       char *p, *param;
+       int result;
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, PAGE_SIZE)))
+               goto out;
+       param = req->rq_buffer;
+       WSET(param, 0, SMB_SET_FILE_UNIX_HLINK);
+       DSET(param, 2, 0);
+       result = smb_encode_path(server, param + 6, SMB_MAXPATHLEN+1,
+                                new_dentry, NULL);
+       if (result < 0)
+               goto out_free;
+       p = param + 6 + result;
+       /* Grr, pointless separation of parameters and data ... */
+       req->rq_data = p;
+       req->rq_ldata = smb_encode_path(server, p, SMB_MAXPATHLEN+1,
+                                       dentry, NULL);
+       req->rq_trans2_command = TRANSACT2_SETPATHINFO;
+       req->rq_lparm = p - param;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       DEBUG1("for %s: result=%d, rcls=%d, err=%d\n",
+              &param[6], result, req->rq_rcls, req->rq_err);
+       result = 0;
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static int
+ smb_proc_query_cifsunix(struct smb_sb_info *server)
+ {
+       int result;
+       int major, minor;
+       u64 caps;
+       char param[2];
+       struct smb_request *req;
+       result = -ENOMEM;
+       if (! (req = smb_alloc_request(server, 100)))
+               goto out;
+       WSET(param, 0, SMB_QUERY_CIFS_UNIX_INFO);
+       req->rq_trans2_command = TRANSACT2_QFSINFO;
+       req->rq_ldata = 0;
+       req->rq_data  = NULL;
+       req->rq_lparm = 2;
+       req->rq_parm  = param;
+       req->rq_flags = 0;
+       result = smb_add_request(req);
+       if (result < 0)
+               goto out_free;
+       if (req->rq_ldata < 12) {
+               PARANOIA("Not enough data\n");
+               goto out_free;
+       }
+       major = WVAL(req->rq_data, 0);
+       minor = WVAL(req->rq_data, 2);
+       DEBUG1("Server implements CIFS Extensions for UNIX systems v%d.%d\n",
+              major, minor);
+       /* FIXME: verify that we are ok with this major/minor? */
+       caps = LVAL(req->rq_data, 4);
+       DEBUG1("Server capabilities 0x%016llx\n", caps);
+ out_free:
+       smb_rput(req);
+ out:
+       return result;
+ }
+ static void
+ install_ops(struct smb_ops *dst, struct smb_ops *src)
+ {
+       memcpy(dst, src, sizeof(void *) * SMB_OPS_NUM_STATIC);
+ }
+ /* < LANMAN2 */
+ static struct smb_ops smb_ops_core =
+ {
+       .read           = smb_proc_read,
+       .write          = smb_proc_write,
+       .readdir        = smb_proc_readdir_short,
+       .getattr        = smb_proc_getattr_core,
+       .truncate       = smb_proc_trunc32,
+ };
+ /* LANMAN2, OS/2, others? */
+ static struct smb_ops smb_ops_os2 =
+ {
+       .read           = smb_proc_read,
+       .write          = smb_proc_write,
+       .readdir        = smb_proc_readdir_long,
+       .getattr        = smb_proc_getattr_trans2_std,
+       .truncate       = smb_proc_trunc32,
+ };
+ /* Win95, and possibly some NetApp versions too */
+ static struct smb_ops smb_ops_win95 =
+ {
+       .read           = smb_proc_read,    /* does not support 12word readX */
+       .write          = smb_proc_write,
+       .readdir        = smb_proc_readdir_long,
+       .getattr        = smb_proc_getattr_95,
+       .truncate       = smb_proc_trunc95,
+ };
+ /* Samba, NT4 and NT5 */
+ static struct smb_ops smb_ops_winNT =
+ {
+       .read           = smb_proc_readX,
+       .write          = smb_proc_writeX,
+       .readdir        = smb_proc_readdir_long,
+       .getattr        = smb_proc_getattr_trans2_all,
+       .truncate       = smb_proc_trunc64,
+ };
+ /* Samba w/ unix extensions. Others? */
+ static struct smb_ops smb_ops_unix =
+ {
+       .read           = smb_proc_readX,
+       .write          = smb_proc_writeX,
+       .readdir        = smb_proc_readdir_long,
+       .getattr        = smb_proc_getattr_unix,
+       /* FIXME: core/ext/time setattr needs to be cleaned up! */
+       /* .setattr     = smb_proc_setattr_unix, */
+       .truncate       = smb_proc_trunc64,
+ };
+ /* Place holder until real ops are in place */
+ static struct smb_ops smb_ops_null =
+ {
+       .readdir        = smb_proc_readdir_null,
+       .getattr        = smb_proc_getattr_null,
+ };
+ void smb_install_null_ops(struct smb_ops *ops)
+ {
+       install_ops(ops, &smb_ops_null);
+ }
index d231ae27299d42b796d7c9f1dec2a83ee2e1694c,67f7a3720ef2b30728c252890732a3082ba2c72d..4fc206484830d47bcc66eb45f5ee3d8f352f6eac
@@@ -2,11 -2,10 +2,11 @@@
  menuconfig SPECTRA
        tristate "Denali Spectra Flash Translation Layer"
        depends on BLOCK
 +      depends on X86_MRST
        default n
        ---help---
          Enable the FTL pseudo-filesystem used with the NAND Flash
-         controller on Intel Moorestown Platform to pretend to be a disk
+         controller on Intel Moorestown Platform to pretend to be a disk.
  
  choice
        prompt "Compile for"
index 7b3a7d04a1095adbcad1d6ec1470884f1ce027f5,1981e461edf4cd099100fd32a1af00bd41f00b37..34be43fec044da6ed15e3370c7c64963772f7454
@@@ -18,6 -18,8 +18,8 @@@
  
  /*  ----------------------------------- Host OS */
  
+ #include <plat/dsp.h>
  #include <dspbridge/host_os.h>
  #include <linux/types.h>
  #include <linux/platform_device.h>
@@@ -39,7 -41,6 +41,6 @@@
  #include <dspbridge/dbc.h>
  
  /*  ----------------------------------- OS Adaptation Layer */
- #include <dspbridge/services.h>
  #include <dspbridge/clk.h>
  #include <dspbridge/sync.h>
  
@@@ -54,7 -55,6 +55,6 @@@
  /*  ----------------------------------- This */
  #include <drv_interface.h>
  
- #include <dspbridge/cfg.h>
  #include <dspbridge/resourcecleanup.h>
  #include <dspbridge/chnl.h>
  #include <dspbridge/proc.h>
@@@ -66,7 -66,6 +66,6 @@@
  #include <mach-omap2/omap3-opp.h>
  #endif
  
- #define BRIDGE_NAME "C6410"
  /*  ----------------------------------- Globals */
  #define DRIVER_NAME  "DspBridge"
  #define DSPBRIDGE_VERSION     "0.3"
@@@ -144,7 -143,6 +143,7 @@@ static const struct file_operations bri
        .release = bridge_release,
        .unlocked_ioctl = bridge_ioctl,
        .mmap = bridge_mmap,
 +      .llseek = noop_llseek,
  };
  
  #ifdef CONFIG_PM
@@@ -172,7 -170,7 +171,7 @@@ const struct omap_opp vdd1_rate_table_b
  #endif
  #endif
  
- struct dspbridge_platform_data *omap_dspbridge_pdata;
+ struct omap_dsp_platform_data *omap_dspbridge_pdata;
  
  u32 vdd1_dsp_freq[6][4] = {
        {0, 0, 0, 0},
@@@ -219,8 -217,8 +218,8 @@@ void bridge_recover_schedule(void
  static int dspbridge_scale_notification(struct notifier_block *op,
                unsigned long val, void *ptr)
  {
-       struct dspbridge_platform_data *pdata =
-                                       omap_dspbridge_dev->dev.platform_data;
+       struct omap_dsp_platform_data *pdata =
+               omap_dspbridge_dev->dev.platform_data;
  
        if (CPUFREQ_POSTCHANGE == val && pdata->dsp_get_opp)
                pwr_pm_post_scale(PRCM_VDD1, pdata->dsp_get_opp());
@@@ -243,7 -241,7 +242,7 @@@ static struct notifier_block iva_clk_no
   */
  static int omap3_bridge_startup(struct platform_device *pdev)
  {
-       struct dspbridge_platform_data *pdata = pdev->dev.platform_data;
+       struct omap_dsp_platform_data *pdata = pdev->dev.platform_data;
        struct drv_data *drv_datap = NULL;
        u32 phys_membase, phys_memsize;
        int err;
  #endif
  
        dsp_clk_init();
-       services_init();
  
        drv_datap = kzalloc(sizeof(struct drv_data), GFP_KERNEL);
        if (!drv_datap) {
@@@ -329,7 -326,6 +327,6 @@@ err1
                                        CPUFREQ_TRANSITION_NOTIFIER);
  #endif
        dsp_clk_exit();
-       services_exit();
  
        return err;
  }
@@@ -395,11 -391,14 +392,14 @@@ static int __devexit omap34_xx_bridge_r
        dev_t devno;
        bool ret;
        int status = 0;
-       void *hdrv_obj = NULL;
+       struct drv_data *drv_datap = dev_get_drvdata(bridge);
  
-       status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
-       if (status)
+       /* Retrieve the Object handle from the driver data */
+       if (!drv_datap || !drv_datap->drv_object) {
+               status = -ENODATA;
+               pr_err("%s: Failed to retrieve the object handle\n", __func__);
                goto func_cont;
+       }
  
  #ifdef CONFIG_TIDSPBRIDGE_DVFS
        if (cpufreq_unregister_notifier(&iva_clk_notifier,
@@@ -419,7 -418,6 +419,6 @@@ func_cont
        mem_ext_phys_pool_release();
  
        dsp_clk_exit();
-       services_exit();
  
        devno = MKDEV(driver_major, 0);
        cdev_del(&bridge_cdev);
@@@ -466,7 -464,7 +465,7 @@@ static int BRIDGE_RESUME(struct platfor
  
  static struct platform_driver bridge_driver = {
        .driver = {
-                  .name = BRIDGE_NAME,
+                  .name = "omap-dsp",
                   },
        .probe = omap34_xx_bridge_probe,
        .remove = __devexit_p(omap34_xx_bridge_remove),
@@@ -510,8 -508,6 +509,6 @@@ static int bridge_open(struct inode *ip
                pr_ctxt->res_state = PROC_RES_ALLOCATED;
                spin_lock_init(&pr_ctxt->dmm_map_lock);
                INIT_LIST_HEAD(&pr_ctxt->dmm_map_list);
-               spin_lock_init(&pr_ctxt->dmm_rsv_lock);
-               INIT_LIST_HEAD(&pr_ctxt->dmm_rsv_list);
  
                pr_ctxt->node_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
                if (pr_ctxt->node_id) {
index 8e3536acbf46e1bac00327ff0f6baa0f05f7b916,00758aadb4ee79f2b88e651add0159b4c6625669..6d45ab3f027d88766d24cbba1969b610eb15ee8d
@@@ -414,6 -414,25 +414,6 @@@ extern memimage fw_image;            /
  #endif /* HCF_STA */
  
  
 -/*******************************************************************************
 - *    wl_insert()
 - *******************************************************************************
 - *
 - *  DESCRIPTION:
 - *
 - *      wl_insert() is scheduled to run after a CARD_INSERTION event is
 - *  received, to configure the PCMCIA socket, and to make the ethernet device
 - *  available to the system.
 - *
 - *  PARAMETERS:
 - *
 - *      dev - a pointer to the net_device struct of the wireless device
 - *
 - *  RETURNS:
 - *
 - *      TRUE or FALSE
 - *
 - ******************************************************************************/
  int wl_insert( struct net_device *dev )
  {
        int                     result = 0;
        /* Initialize the adapter parameters. */
        spin_lock_init( &( lp->slock ));
  
-       /* Intialize states */
+       /* Initialize states */
        //lp->lockcount = 0; //PE1DNN
          lp->is_handling_int = WL_NOT_HANDLING_INT;
        lp->firmware_present = WL_FRIMWARE_NOT_PRESENT;
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_CREATE_IBSS, "\"%s\"", PARM_CREATE_IBSS );
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_RX, "\"%s\"", PARM_MULTICAST_RX );
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_MAX_SLEEP, "%d", PARM_MAX_SLEEP );
- //;?        DBG_PARAM( DbgInfo, PARM_NAME_NETWORK_ADDR, "\"%s\"", DbgHwAddr( PARM_NETWORK_ADDR ));
+ /*
+       DBG_PARAM(DbgInfo, PARM_NAME_NETWORK_ADDR, "\"%pM\"",
+                       PARM_NETWORK_ADDR);
+  */
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_AUTHENTICATION, "%d", PARM_AUTHENTICATION );
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_OWN_ATIM_WINDOW, "%d", PARM_OWN_ATIM_WINDOW );
  //;?        DBG_PARAM( DbgInfo, PARM_NAME_PM_HOLDOVER_DURATION, "%d", PARM_PM_HOLDOVER_DURATION );
        DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE4, "%d", PARM_TX_RATE4 );
        DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE5, "%d", PARM_TX_RATE5 );
        DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE6, "%d", PARM_TX_RATE6 );
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS1, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS1 ));
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS2, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS2 ));
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS3, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS3 ));
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS4, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS4 ));
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS5, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS5 ));
-       DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS6, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS6 ));
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS1, "\"%pM\"",
+                       PARM_WDS_ADDRESS1);
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS2, "\"%pM\"",
+                       PARM_WDS_ADDRESS2);
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS3, "\"%pM\"",
+                       PARM_WDS_ADDRESS3);
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS4, "\"%pM\"",
+                       PARM_WDS_ADDRESS4);
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS5, "\"%pM\"",
+                       PARM_WDS_ADDRESS5);
+       DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS6, "\"%pM\"",
+                       PARM_WDS_ADDRESS6);
  #endif /* USE_WDS */
  #endif /* HCF_AP */
  
@@@ -1170,7 -1198,7 +1179,7 @@@ int                     rc
                return hcf_status;
        }
        memcpy( lp->MACAddress, &lp->ltvRecord.u.u8[0], ETH_ALEN );
-       DBG_TRACE( DbgInfo, "Card MAC Address: %s\n", DbgHwAddr( lp->MACAddress ));
+       DBG_TRACE(DbgInfo, "Card MAC Address: %pM\n", lp->MACAddress);
  
        /* Write out configuration to the device, enable, and reconnect. However,
           only reconnect if in AP mode. For STA mode, need to wait for passive scan
@@@ -1921,8 -1949,10 +1930,10 @@@ int wl_put_ltv( struct wl_private *lp 
        }
  
        /* Own MAC Address */
-       //DBG_TRACE( DbgInfo, "MAC Address                       : %s\n",
-       //           DbgHwAddr( lp->MACAddress ));
+ /*
+       DBG_TRACE(DbgInfo, "MAC Address                       : %pM\n",
+                       lp->MACAddress);
+  */
  
        if ( WVLAN_VALID_MAC_ADDRESS( lp->MACAddress )) {
                /* Make the MAC address valid by:
@@@ -3033,8 -3063,8 +3044,8 @@@ void wl_process_mailbox( struct wl_priv
                                                   aps[num_aps].capability );
                                DBG_TRACE( DbgInfo, "SSID Length     : 0x%04x\n",
                                                   aps[num_aps].ssid_len );
-                               DBG_TRACE( DbgInfo, "BSSID           : %s\n",
-                                                  DbgHwAddr( aps[num_aps].bssid ));
+                               DBG_TRACE(DbgInfo, "BSSID           : %pM\n",
+                                                  aps[num_aps].bssid);
  
                                if ( aps[num_aps].ssid_len != 0 ) {
                                        DBG_TRACE( DbgInfo, "SSID            : %s.\n",
                                DBG_TRACE( DbgInfo, "(%s) durID       : 0x%04x.\n",
                                                   lp->dev->name, probe_rsp->durID );
  
-                               DBG_TRACE( DbgInfo, "(%s) address1    : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->address1 ));
+                               DBG_TRACE(DbgInfo, "(%s) address1    : %pM\n",
+                                       lp->dev->name, probe_rsp->address1);
  
-                               DBG_TRACE( DbgInfo, "(%s) address2    : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->address2 ));
+                               DBG_TRACE(DbgInfo, "(%s) address2    : %pM\n",
+                                       lp->dev->name, probe_rsp->address2);
  
-                               DBG_TRACE( DbgInfo, "(%s) BSSID       : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->BSSID ));
+                               DBG_TRACE(DbgInfo, "(%s) BSSID       : %pM\n",
+                                       lp->dev->name, probe_rsp->BSSID);
  
                                DBG_TRACE( DbgInfo, "(%s) sequence    : 0x%04x.\n",
                                                   lp->dev->name, probe_rsp->sequence );
  
-                               DBG_TRACE( DbgInfo, "(%s) address4    : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->address4 ));
+                               DBG_TRACE(DbgInfo, "(%s) address4    : %pM\n",
+                                       lp->dev->name, probe_rsp->address4);
  
                                DBG_TRACE( DbgInfo, "(%s) datalength  : 0x%04x.\n",
                                                   lp->dev->name, probe_rsp->dataLength );
  
-                               DBG_TRACE( DbgInfo, "(%s) DA          : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->DA ));
+                               DBG_TRACE(DbgInfo, "(%s) DA          : %pM\n",
+                                       lp->dev->name, probe_rsp->DA);
  
-                               DBG_TRACE( DbgInfo, "(%s) SA          : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->SA ));
+                               DBG_TRACE(DbgInfo, "(%s) SA          : %pM\n",
+                                       lp->dev->name, probe_rsp->SA);
  
                                //DBG_TRACE( DbgInfo, "(%s) lenType     : 0x%04x.\n",
                                //           lp->dev->name, probe_rsp->lenType );
  
-                               DBG_TRACE( DbgInfo, "(%s) timeStamp   : %s\n",
-                                                  lp->dev->name, DbgHwAddr( probe_rsp->timeStamp ));
+                               DBG_TRACE(DbgInfo, "(%s) timeStamp   : "
+                                               "%d.%d.%d.%d.%d.%d.%d.%d\n",
+                                               lp->dev->name,
+                                               probe_rsp->timeStamp[0],
+                                               probe_rsp->timeStamp[1],
+                                               probe_rsp->timeStamp[2],
+                                               probe_rsp->timeStamp[3],
+                                               probe_rsp->timeStamp[4],
+                                               probe_rsp->timeStamp[5],
+                                               probe_rsp->timeStamp[6],
+                                               probe_rsp->timeStamp[7]);
  
                                DBG_TRACE( DbgInfo, "(%s) beaconInt   : 0x%04x.\n",
                                                   lp->dev->name, probe_rsp->beaconInterval );
                                break;
                        }
  
-                       DBG_TRACE( DbgInfo, "STA Address        : %s\n",
-                                          DbgHwAddr( as->staAddr ));
+                       DBG_TRACE(DbgInfo, "STA Address        : %pM\n",
+                                          as->staAddr);
  
                        if (( as->assocStatus == 2 )  && ( as->len == 8 )) {
-                               DBG_TRACE( DbgInfo, "Old AP Address     : %s\n",
-                                                  DbgHwAddr( as->oldApAddr ));
+                               DBG_TRACE(DbgInfo, "Old AP Address     : %pM\n",
+                                                  as->oldApAddr);
                        }
                }
  
                                break;
                        }
  
-                       DBG_TRACE( DbgInfo, "STA Address     : %s\n", DbgHwAddr( ss->staAddr ));
+                       DBG_TRACE(DbgInfo, "STA Address     : %pM\n",
+                                       ss->staAddr);
  
-                       DBG_TRACE( DbgInfo, "Reason          : 0x%04x \n", ss->reason );
+                       DBG_TRACE(DbgInfo, "Reason          : 0x%04x\n",
+                                       ss->reason);
                }
  
                break;
index 722c840ac6387456b5825feaf8375195c8bce5ac,72f1b9ce577b3948ff7c669834b725d83e6bc889..8c3c057aa8478fb2a436edfd571843513544ca71
  
  /* Globals */
  static int zram_major;
- static struct zram *devices;
+ struct zram *devices;
  
  /* Module params (documentation at end) */
- static unsigned int num_devices;
+ unsigned int num_devices;
+ static void zram_stat_inc(u32 *v)
+ {
+       *v = *v + 1;
+ }
+ static void zram_stat_dec(u32 *v)
+ {
+       *v = *v - 1;
+ }
+ static void zram_stat64_add(struct zram *zram, u64 *v, u64 inc)
+ {
+       spin_lock(&zram->stat64_lock);
+       *v = *v + inc;
+       spin_unlock(&zram->stat64_lock);
+ }
+ static void zram_stat64_sub(struct zram *zram, u64 *v, u64 dec)
+ {
+       spin_lock(&zram->stat64_lock);
+       *v = *v - dec;
+       spin_unlock(&zram->stat64_lock);
+ }
+ static void zram_stat64_inc(struct zram *zram, u64 *v)
+ {
+       zram_stat64_add(zram, v, 1);
+ }
  
  static int zram_test_flag(struct zram *zram, u32 index,
                        enum zram_pageflags flag)
@@@ -91,7 -120,7 +120,7 @@@ static void zram_set_disksize(struct zr
                "the disk when not in use so a huge zram is "
                "wasteful.\n"
                "\tMemory Size: %zu kB\n"
-               "\tSize you selected: %zu kB\n"
+               "\tSize you selected: %llu kB\n"
                "Continuing anyway ...\n",
                totalram_bytes >> 10, zram->disksize
                );
        zram->disksize &= PAGE_MASK;
  }
  
- static void zram_ioctl_get_stats(struct zram *zram,
-                       struct zram_ioctl_stats *s)
- {
-       s->disksize = zram->disksize;
- #if defined(CONFIG_ZRAM_STATS)
-       {
-       struct zram_stats *rs = &zram->stats;
-       size_t succ_writes, mem_used;
-       unsigned int good_compress_perc = 0, no_compress_perc = 0;
-       mem_used = xv_get_total_size_bytes(zram->mem_pool)
-                       + (rs->pages_expand << PAGE_SHIFT);
-       succ_writes = zram_stat64_read(zram, &rs->num_writes) -
-                       zram_stat64_read(zram, &rs->failed_writes);
-       if (succ_writes && rs->pages_stored) {
-               good_compress_perc = rs->good_compress * 100
-                                       / rs->pages_stored;
-               no_compress_perc = rs->pages_expand * 100
-                                       / rs->pages_stored;
-       }
-       s->num_reads = zram_stat64_read(zram, &rs->num_reads);
-       s->num_writes = zram_stat64_read(zram, &rs->num_writes);
-       s->failed_reads = zram_stat64_read(zram, &rs->failed_reads);
-       s->failed_writes = zram_stat64_read(zram, &rs->failed_writes);
-       s->invalid_io = zram_stat64_read(zram, &rs->invalid_io);
-       s->notify_free = zram_stat64_read(zram, &rs->notify_free);
-       s->pages_zero = rs->pages_zero;
-       s->good_compress_pct = good_compress_perc;
-       s->pages_expand_pct = no_compress_perc;
-       s->pages_stored = rs->pages_stored;
-       s->pages_used = mem_used >> PAGE_SHIFT;
-       s->orig_data_size = rs->pages_stored << PAGE_SHIFT;
-       s->compr_data_size = rs->compr_size;
-       s->mem_used_total = mem_used;
-       }
- #endif /* CONFIG_ZRAM_STATS */
- }
  static void zram_free_page(struct zram *zram, size_t index)
  {
        u32 clen;
                zram_stat_dec(&zram->stats.good_compress);
  
  out:
-       zram->stats.compr_size -= clen;
+       zram_stat64_sub(zram, &zram->stats.compr_size, clen);
        zram_stat_dec(&zram->stats.pages_stored);
  
        zram->table[index].page = NULL;
@@@ -221,9 -207,15 +207,15 @@@ static int zram_read(struct zram *zram
        u32 index;
        struct bio_vec *bvec;
  
-       zram_stat64_inc(zram, &zram->stats.num_reads);
+       if (unlikely(!zram->init_done)) {
+               set_bit(BIO_UPTODATE, &bio->bi_flags);
+               bio_endio(bio, 0);
+               return 0;
+       }
  
+       zram_stat64_inc(zram, &zram->stats.num_reads);
        index = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT;
        bio_for_each_segment(bvec, bio, i) {
                int ret;
                size_t clen;
@@@ -289,16 -281,20 +281,20 @@@ out
  
  static int zram_write(struct zram *zram, struct bio *bio)
  {
-       int i;
+       int i, ret;
        u32 index;
        struct bio_vec *bvec;
  
-       zram_stat64_inc(zram, &zram->stats.num_writes);
+       if (unlikely(!zram->init_done)) {
+               ret = zram_init_device(zram);
+               if (ret)
+                       goto out;
+       }
  
+       zram_stat64_inc(zram, &zram->stats.num_writes);
        index = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT;
  
        bio_for_each_segment(bvec, bio, i) {
-               int ret;
                u32 offset;
                size_t clen;
                struct zobj_header *zheader;
@@@ -396,7 -392,7 +392,7 @@@ memstore
                        kunmap_atomic(src, KM_USER0);
  
                /* Update stats */
-               zram->stats.compr_size += clen;
+               zram_stat64_add(zram, &zram->stats.compr_size, clen);
                zram_stat_inc(&zram->stats.pages_stored);
                if (clen <= PAGE_SIZE / 2)
                        zram_stat_inc(&zram->stats.good_compress);
@@@ -440,7 -436,8 +436,8 @@@ static int zram_make_request(struct req
        struct zram *zram = queue->queuedata;
  
        if (unlikely(!zram->init_done)) {
-               bio_io_error(bio);
+               set_bit(BIO_UPTODATE, &bio->bi_flags);
+               bio_endio(bio, 0);
                return 0;
        }
  
        return ret;
  }
  
static void reset_device(struct zram *zram)
void zram_reset_device(struct zram *zram)
  {
        size_t index;
  
-       /* Do not accept any new I/O request */
+       mutex_lock(&zram->init_lock);
        zram->init_done = 0;
  
        /* Free various per-device buffers */
        memset(&zram->stats, 0, sizeof(zram->stats));
  
        zram->disksize = 0;
+       mutex_unlock(&zram->init_lock);
  }
  
static int zram_ioctl_init_device(struct zram *zram)
int zram_init_device(struct zram *zram)
  {
        int ret;
        size_t num_pages;
  
+       mutex_lock(&zram->init_lock);
        if (zram->init_done) {
-               pr_info("Device already initialized!\n");
-               return -EBUSY;
+               mutex_unlock(&zram->init_lock);
+               return 0;
        }
  
        zram_set_disksize(zram, totalram_pages << PAGE_SHIFT);
        }
  
        zram->init_done = 1;
+       mutex_unlock(&zram->init_lock);
  
        pr_debug("Initialization done!\n");
        return 0;
  
  fail:
-       reset_device(zram);
+       mutex_unlock(&zram->init_lock);
+       zram_reset_device(zram);
  
        pr_err("Initialization failed: err=%d\n", ret);
        return ret;
  }
  
- static int zram_ioctl_reset_device(struct zram *zram)
- {
-       if (zram->init_done)
-               reset_device(zram);
-       return 0;
- }
- static int zram_ioctl(struct block_device *bdev, fmode_t mode,
-                       unsigned int cmd, unsigned long arg)
- {
-       int ret = 0;
-       size_t disksize_kb;
-       struct zram *zram = bdev->bd_disk->private_data;
-       switch (cmd) {
-       case ZRAMIO_SET_DISKSIZE_KB:
-               if (zram->init_done) {
-                       ret = -EBUSY;
-                       goto out;
-               }
-               if (copy_from_user(&disksize_kb, (void *)arg,
-                                               _IOC_SIZE(cmd))) {
-                       ret = -EFAULT;
-                       goto out;
-               }
-               zram->disksize = disksize_kb << 10;
-               pr_info("Disk size set to %zu kB\n", disksize_kb);
-               break;
-       case ZRAMIO_GET_STATS:
-       {
-               struct zram_ioctl_stats *stats;
-               if (!zram->init_done) {
-                       ret = -ENOTTY;
-                       goto out;
-               }
-               stats = kzalloc(sizeof(*stats), GFP_KERNEL);
-               if (!stats) {
-                       ret = -ENOMEM;
-                       goto out;
-               }
-               zram_ioctl_get_stats(zram, stats);
-               if (copy_to_user((void *)arg, stats, sizeof(*stats))) {
-                       kfree(stats);
-                       ret = -EFAULT;
-                       goto out;
-               }
-               kfree(stats);
-               break;
-       }
-       case ZRAMIO_INIT:
-               ret = zram_ioctl_init_device(zram);
-               break;
-       case ZRAMIO_RESET:
-               /* Do not reset an active device! */
-               if (bdev->bd_holders) {
-                       ret = -EBUSY;
-                       goto out;
-               }
-               /* Make sure all pending I/O is finished */
-               if (bdev)
-                       fsync_bdev(bdev);
-               ret = zram_ioctl_reset_device(zram);
-               break;
-       default:
-               pr_info("Invalid ioctl %u\n", cmd);
-               ret = -ENOTTY;
-       }
- out:
-       return ret;
- }
  void zram_slot_free_notify(struct block_device *bdev, unsigned long index)
  {
        struct zram *zram;
  }
  
  static const struct block_device_operations zram_devops = {
-       .ioctl = zram_ioctl,
        .swap_slot_free_notify = zram_slot_free_notify,
        .owner = THIS_MODULE
  };
@@@ -666,6 -588,7 +588,7 @@@ static int create_device(struct zram *z
        int ret = 0;
  
        mutex_init(&zram->lock);
+       mutex_init(&zram->init_lock);
        spin_lock_init(&zram->stat64_lock);
  
        zram->queue = blk_alloc_queue(GFP_KERNEL);
        zram->disk->private_data = zram;
        snprintf(zram->disk->disk_name, 16, "zram%d", device_id);
  
-       /* Actual capacity set using ZRAMIO_SET_DISKSIZE_KB ioctl */
+       /* Actual capacity set using syfs (/sys/block/zram<id>/disksize */
        set_capacity(zram->disk, 0);
  
        /*
  
        add_disk(zram->disk);
  
+ #ifdef CONFIG_SYSFS
+       ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
+                               &zram_disk_attr_group);
+       if (ret < 0) {
+               pr_warning("Error creating sysfs group");
+               goto out;
+       }
+ #endif
        zram->init_done = 0;
  
  out:
  
  static void destroy_device(struct zram *zram)
  {
+ #ifdef CONFIG_SYSFS
+       sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
+                       &zram_disk_attr_group);
+ #endif
        if (zram->disk) {
                del_gendisk(zram->disk);
                put_disk(zram->disk);
@@@ -769,7 -706,6 +706,7 @@@ static int __init zram_init(void
  free_devices:
        while (dev_id)
                destroy_device(&devices[--dev_id]);
 +      kfree(devices);
  unregister:
        unregister_blkdev(zram_major, "zram");
  out:
@@@ -786,7 -722,7 +723,7 @@@ static void __exit zram_exit(void
  
                destroy_device(zram);
                if (zram->init_done)
-                       reset_device(zram);
+                       zram_reset_device(zram);
        }
  
        unregister_blkdev(zram_major, "zram");
diff --combined fs/Kconfig
index 97673c955484463e4181d4e3f689742bbe558a06,25ce2dc1c6d42beb909c4f3aa0317c5fd96a5e2f..771f457402d4937c4ca29d448ab886b5d4959ae8
@@@ -47,9 -47,6 +47,9 @@@ source "fs/nilfs2/Kconfig
  
  endif # BLOCK
  
 +config EXPORTFS
 +      tristate
 +
  config FILE_LOCKING
        bool "Enable POSIX file locking API" if EMBEDDED
        default y
@@@ -62,7 -59,6 +62,6 @@@ source "fs/notify/Kconfig
  
  source "fs/quota/Kconfig"
  
- source "fs/autofs/Kconfig"
  source "fs/autofs4/Kconfig"
  source "fs/fuse/Kconfig"
  
@@@ -224,6 -220,9 +223,6 @@@ config LOCKD_V
        depends on FILE_LOCKING
        default y
  
 -config EXPORTFS
 -      tristate
 -
  config NFS_ACL_SUPPORT
        tristate
        select FS_POSIX_ACL
@@@ -234,7 -233,6 +233,6 @@@ config NFS_COMMO
        default y
  
  source "net/sunrpc/Kconfig"
- source "fs/smbfs/Kconfig"
  source "fs/ceph/Kconfig"
  source "fs/cifs/Kconfig"
  source "fs/ncpfs/Kconfig"
diff --combined fs/Makefile
index 26956fcec917f1792307e31d3b58bec32137d7ff,9284c74c2db9a226ef7eecce61bcded217c6e139..a7f7cef0c0c8343da03006fe39d5cce1a6bd225a
@@@ -29,7 -29,10 +29,7 @@@ obj-$(CONFIG_EVENTFD)                += eventfd.
  obj-$(CONFIG_AIO)               += aio.o
  obj-$(CONFIG_FILE_LOCKING)      += locks.o
  obj-$(CONFIG_COMPAT)          += compat.o compat_ioctl.o
 -
 -nfsd-$(CONFIG_NFSD)           := nfsctl.o
 -obj-y                         += $(nfsd-y) $(nfsd-m)
 -
 +obj-$(CONFIG_NFSD_DEPRECATED) += nfsctl.o
  obj-$(CONFIG_BINFMT_AOUT)     += binfmt_aout.o
  obj-$(CONFIG_BINFMT_EM86)     += binfmt_em86.o
  obj-$(CONFIG_BINFMT_MISC)     += binfmt_misc.o
@@@ -88,7 -91,6 +88,6 @@@ obj-$(CONFIG_NFSD)            += nfsd
  obj-$(CONFIG_LOCKD)           += lockd/
  obj-$(CONFIG_NLS)             += nls/
  obj-$(CONFIG_SYSV_FS)         += sysv/
- obj-$(CONFIG_SMB_FS)          += smbfs/
  obj-$(CONFIG_CIFS)            += cifs/
  obj-$(CONFIG_NCP_FS)          += ncpfs/
  obj-$(CONFIG_HPFS_FS)         += hpfs/
@@@ -101,7 -103,6 +100,6 @@@ obj-$(CONFIG_UBIFS_FS)             += ubifs
  obj-$(CONFIG_AFFS_FS)         += affs/
  obj-$(CONFIG_ROMFS_FS)                += romfs/
  obj-$(CONFIG_QNX4FS_FS)               += qnx4/
- obj-$(CONFIG_AUTOFS_FS)               += autofs/
  obj-$(CONFIG_AUTOFS4_FS)      += autofs4/
  obj-$(CONFIG_ADFS_FS)         += adfs/
  obj-$(CONFIG_FUSE_FS)         += fuse/
diff --combined fs/compat.c
index f03abdadc401d2266375dc3328cb977cecc41fdc,b42f29a44edbf3d29ff965af36f9f9a540cbc3fa..52cfeb61da77c14ce7d3838db7517b5b6f88b213
@@@ -29,8 -29,6 +29,6 @@@
  #include <linux/vfs.h>
  #include <linux/ioctl.h>
  #include <linux/init.h>
- #include <linux/smb.h>
- #include <linux/smb_mount.h>
  #include <linux/ncp_mount.h>
  #include <linux/nfs4_mount.h>
  #include <linux/syscalls.h>
@@@ -745,30 -743,6 +743,6 @@@ static void *do_ncp_super_data_conv(voi
        return raw_data;
  }
  
- struct compat_smb_mount_data {
-       compat_int_t version;
-       __compat_uid_t mounted_uid;
-       __compat_uid_t uid;
-       __compat_gid_t gid;
-       compat_mode_t file_mode;
-       compat_mode_t dir_mode;
- };
- static void *do_smb_super_data_conv(void *raw_data)
- {
-       struct smb_mount_data *s = raw_data;
-       struct compat_smb_mount_data *c_s = raw_data;
-       if (c_s->version != SMB_MOUNT_OLDVERSION)
-               goto out;
-       s->dir_mode = c_s->dir_mode;
-       s->file_mode = c_s->file_mode;
-       s->gid = c_s->gid;
-       s->uid = c_s->uid;
-       s->mounted_uid = c_s->mounted_uid;
-  out:
-       return raw_data;
- }
  
  struct compat_nfs_string {
        compat_uint_t len;
@@@ -835,7 -809,6 +809,6 @@@ static int do_nfs4_super_data_conv(voi
        return 0;
  }
  
- #define SMBFS_NAME      "smbfs"
  #define NCPFS_NAME      "ncpfs"
  #define NFS4_NAME     "nfs4"
  
@@@ -870,9 -843,7 +843,7 @@@ asmlinkage long compat_sys_mount(const 
        retval = -EINVAL;
  
        if (kernel_type && data_page) {
-               if (!strcmp(kernel_type, SMBFS_NAME)) {
-                       do_smb_super_data_conv((void *)data_page);
-               } else if (!strcmp(kernel_type, NCPFS_NAME)) {
+               if (!strcmp(kernel_type, NCPFS_NAME)) {
                        do_ncp_super_data_conv((void *)data_page);
                } else if (!strcmp(kernel_type, NFS4_NAME)) {
                        if (do_nfs4_super_data_conv((void *) data_page))
@@@ -1153,7 -1124,7 +1124,7 @@@ static ssize_t compat_do_readv_writev(i
  {
        compat_ssize_t tot_len;
        struct iovec iovstack[UIO_FASTIOV];
 -      struct iovec *iov;
 +      struct iovec *iov = iovstack;
        ssize_t ret;
        io_fn_t fn;
        iov_fn_t fnv;
@@@ -1963,7 -1934,7 +1934,7 @@@ asmlinkage long compat_sys_ppoll(struc
  }
  #endif /* HAVE_SET_RESTORE_SIGMASK */
  
 -#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
 +#if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && !defined(CONFIG_NFSD_DEPRECATED)
  /* Stuff for NFS server syscalls... */
  struct compat_nfsctl_svc {
        u16                     svc32_port;
diff --combined fs/compat_ioctl.c
index d0ad09d57789c2e72b4f6eeda2c09535651bfe8e,34cf03cd791f5a56912935b5cc60c5011266433e..410ed188faa1376b7b0b10ed5bff0c36aa9c8806
@@@ -46,7 -46,6 +46,6 @@@
  #include <linux/videodev.h>
  #include <linux/netdevice.h>
  #include <linux/raw.h>
- #include <linux/smb_fs.h>
  #include <linux/blkdev.h>
  #include <linux/elevator.h>
  #include <linux/rtc.h>
@@@ -558,25 -557,6 +557,6 @@@ static int mt_ioctl_trans(unsigned int 
  
  #endif /* CONFIG_BLOCK */
  
- static int do_smb_getmountuid(unsigned int fd, unsigned int cmd,
-                       compat_uid_t __user *argp)
- {
-       mm_segment_t old_fs = get_fs();
-       __kernel_uid_t kuid;
-       int err;
-       cmd = SMB_IOC_GETMOUNTUID;
-       set_fs(KERNEL_DS);
-       err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
-       set_fs(old_fs);
-       if (err >= 0)
-               err = put_user(kuid, argp);
-       return err;
- }
  /* Bluetooth ioctls */
  #define HCIUARTSETPROTO               _IOW('U', 200, int)
  #define HCIUARTGETPROTO               _IOR('U', 201, int)
  #define HIDPGETCONNLIST       _IOR('H', 210, int)
  #define HIDPGETCONNINFO       _IOR('H', 211, int)
  
 -#ifdef CONFIG_BLOCK
 -struct raw32_config_request
 -{
 -        compat_int_t    raw_minor;
 -        __u64   block_major;
 -        __u64   block_minor;
 -} __attribute__((packed));
 -
 -static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
 -{
 -        int ret;
 -
 -        if (!access_ok(VERIFY_READ, user_req, sizeof(struct raw32_config_request)))
 -                return -EFAULT;
 -
 -        ret = __get_user(req->raw_minor, &user_req->raw_minor);
 -        ret |= __get_user(req->block_major, &user_req->block_major);
 -        ret |= __get_user(req->block_minor, &user_req->block_minor);
 -
 -        return ret ? -EFAULT : 0;
 -}
 -
 -static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
 -{
 -      int ret;
 -
 -        if (!access_ok(VERIFY_WRITE, user_req, sizeof(struct raw32_config_request)))
 -                return -EFAULT;
 -
 -        ret = __put_user(req->raw_minor, &user_req->raw_minor);
 -        ret |= __put_user(req->block_major, &user_req->block_major);
 -        ret |= __put_user(req->block_minor, &user_req->block_minor);
 -
 -        return ret ? -EFAULT : 0;
 -}
 -
 -static int raw_ioctl(unsigned fd, unsigned cmd,
 -              struct raw32_config_request __user *user_req)
 -{
 -        int ret;
 -
 -        switch (cmd) {
 -        case RAW_SETBIND:
 -      default: {      /* RAW_GETBIND */
 -                struct raw_config_request req;
 -                mm_segment_t oldfs = get_fs();
 -
 -                if ((ret = get_raw32_request(&req, user_req)))
 -                        return ret;
 -
 -                set_fs(KERNEL_DS);
 -                ret = sys_ioctl(fd,cmd,(unsigned long)&req);
 -                set_fs(oldfs);
 -
 -                if ((!ret) && (cmd == RAW_GETBIND)) {
 -                        ret = set_raw32_request(&req, user_req);
 -                }
 -                break;
 -        }
 -        }
 -        return ret;
 -}
 -#endif /* CONFIG_BLOCK */
  
  struct serial_struct32 {
          compat_int_t    type;
@@@ -1199,8 -1242,9 +1179,9 @@@ COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5
  COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS)
  COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS)
  COMPATIBLE_IOCTL(OSS_GETVERSION)
- /* SMB ioctls which do not need any translations */
- COMPATIBLE_IOCTL(SMB_IOC_NEWCONN)
+ /* Raw devices */
+ COMPATIBLE_IOCTL(RAW_SETBIND)
+ COMPATIBLE_IOCTL(RAW_GETBIND)
  /* Watchdog */
  COMPATIBLE_IOCTL(WDIOC_GETSUPPORT)
  COMPATIBLE_IOCTL(WDIOC_GETSTATUS)
@@@ -1457,11 -1501,11 +1438,7 @@@ static long do_ioctl_trans(int fd, unsi
        case MTIOCGET32:
        case MTIOCPOS32:
                return mt_ioctl_trans(fd, cmd, argp);
 -      /* Raw devices */
 -      case RAW_SETBIND:
 -      case RAW_GETBIND:
 -              return raw_ioctl(fd, cmd, argp);
  #endif
-       /* One SMB ioctl needs translations. */
- #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
-       case SMB_IOC_GETMOUNTUID_32:
-               return do_smb_getmountuid(fd, cmd, argp);
        /* Serial */
        case TIOCGSERIAL:
        case TIOCSSERIAL:
diff --combined include/linux/Kbuild
index 831c4634162c6eb8db5dd72fe830a57c3c9a95fb,98d520d371ede4d88ce205b721c7860cba342f6a..9c1683e473cbdc634b6f60838b7ad65b299f391a
@@@ -118,6 -118,7 +118,6 @@@ header-y += eventpoll.
  header-y += ext2_fs.h
  header-y += fadvise.h
  header-y += falloc.h
 -header-y += fanotify.h
  header-y += fb.h
  header-y += fcntl.h
  header-y += fd.h
@@@ -301,7 -302,6 +301,7 @@@ header-y += quota.
  header-y += radeonfb.h
  header-y += random.h
  header-y += raw.h
 +header-y += rds.h
  header-y += reboot.h
  header-y += reiserfs_fs.h
  header-y += reiserfs_xattr.h
@@@ -326,10 -326,6 +326,6 @@@ header-y += serio.
  header-y += shm.h
  header-y += signal.h
  header-y += signalfd.h
- header-y += smb.h
- header-y += smb_fs.h
- header-y += smb_mount.h
- header-y += smbno.h
  header-y += snmp.h
  header-y += socket.h
  header-y += sockios.h
diff --combined include/linux/tty.h
index 86be0cdeb11b088ddbf5e842592a9b15fb5262c5,244bb8de2b921525f402689a8a20e9ca95cdbbc7..e500171c745f2e574a2f199fcdd5c92931e2095f
@@@ -50,6 -50,7 +50,7 @@@
  #define N_V253                19      /* Codec control over voice modem */
  #define N_CAIF                20      /* CAIF protocol for talking to modems */
  #define N_GSM0710     21      /* GSM 0710 Mux */
+ #define N_TI_WL       22      /* for TI's WL BT, FM, GPS combo chips */
  
  /*
   * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@@ -256,7 -257,6 +257,7 @@@ struct tty_operations
  struct tty_struct {
        int     magic;
        struct kref kref;
 +      struct device *dev;
        struct tty_driver *driver;
        const struct tty_operations *ops;
        int index;
@@@ -466,7 -466,7 +467,7 @@@ extern void proc_clear_tty(struct task_
  extern struct tty_struct *get_current_tty(void);
  extern void tty_default_fops(struct file_operations *fops);
  extern struct tty_struct *alloc_tty_struct(void);
 -extern void tty_add_file(struct tty_struct *tty, struct file *file);
 +extern int tty_add_file(struct tty_struct *tty, struct file *file);
  extern void free_tty_struct(struct tty_struct *tty);
  extern void initialize_tty_struct(struct tty_struct *tty,
                struct tty_driver *driver, int idx);