Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
authorLinus Torvalds <torvalds@g5.osdl.org>
Sat, 25 Mar 2006 16:37:36 +0000 (08:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 25 Mar 2006 16:37:36 +0000 (08:37 -0800)
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (33 commits)
  V4L/DVB (3604): V4l printk fix
  V4L/DVB (3599c): Whitespace cleanups under Documentation/video4linux
  V4L/DVB (3599b): Whitespace cleanups under drivers/media
  V4L/DVB (3599a): Move drivers/usb/media to drivers/media/video
  V4L/DVB (3599): Implement new routing commands for wm8775 and cs53l32a.
  V4L/DVB (3598): Add bit algorithm adapter for the Conexant CX2341X boards.
  V4L/DVB (3597): Vivi: fix warning: implicit declaration of function 'in_interrupt'
  V4L/DVB (3588): Remove VIDIOC_G/S_AUDOUT from msp3400
  V4L/DVB (3587): Always wake thread after routing change.
  V4L/DVB (3584): Implement V4L2_TUNER_MODE_LANG1_LANG2 audio mode
  V4L/DVB (3582): Implement correct msp3400 input/output routing
  V4L/DVB (3581): Add new media/msp3400.h header containing the routing macros
  V4L/DVB (3580): Last round of msp3400 cleanups before adding routing commands
  V4L/DVB (3579): Move msp_modus to msp3400-kthreads, add JP and KR std detection
  V4L/DVB (3578): Make scart definitions easier to handle
  V4L/DVB (3577): Cleanup audio input handling
  V4L/DVB (3575): Cxusb: fix i2c debug messages for bluebird devices
  V4L/DVB (3574): Cxusb: fix debug messages
  V4L/DVB (3573): Cxusb: remove FIXME: comment in bluebird_patch_dvico_firmware_download
  V4L/DVB (3572): Cxusb: conditionalize gpio write for the medion box
  ...

278 files changed:
CREDITS
Documentation/feature-removal-schedule.txt
Documentation/filesystems/9p.txt [new file with mode: 0644]
Documentation/filesystems/udf.txt
Documentation/filesystems/v9fs.txt [deleted file]
Documentation/filesystems/vfs.txt
Documentation/firmware_class/firmware_sample_driver.c
Documentation/firmware_class/firmware_sample_firmware_class.c
Documentation/kernel-parameters.txt
Documentation/networking/ray_cs.txt
Documentation/serial-console.txt
Documentation/sound/oss/Introduction
Documentation/sound/oss/cs46xx
MAINTAINERS
arch/arm/mach-sa1100/collie.c
arch/i386/Kconfig
arch/i386/Kconfig.debug
arch/i386/boot/edd.S
arch/i386/kernel/dmi_scan.c
arch/i386/kernel/smpboot.c
arch/ia64/ia32/sys_ia32.c
arch/m32r/Kconfig.debug
arch/mips/kernel/sysirix.c
arch/ppc/8xx_io/cs4218_tdm.c
arch/sparc64/Kconfig.debug
arch/x86_64/ia32/sys_ia32.c
drivers/base/cpu.c
drivers/block/Kconfig
drivers/block/ataflop.c
drivers/block/floppy.c
drivers/block/nbd.c
drivers/cdrom/cm206.c
drivers/cdrom/sbpcd.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/istallion.c
drivers/char/mem.c
drivers/char/mxser.c
drivers/char/ppdev.c
drivers/char/riscom8.c
drivers/char/sysrq.c
drivers/char/tpm/tpm.h
drivers/char/tty_io.c
drivers/char/watchdog/Kconfig
drivers/char/watchdog/Makefile
drivers/char/watchdog/ep93xx_wdt.c [new file with mode: 0644]
drivers/dio/dio-driver.c
drivers/eisa/.gitignore [new file with mode: 0644]
drivers/eisa/eisa-bus.c
drivers/ide/ide.c
drivers/input/touchscreen/ads7846.c
drivers/isdn/hardware/avm/b1dma.c
drivers/isdn/hardware/avm/b1isa.c
drivers/isdn/hardware/avm/c4.c
drivers/isdn/hardware/avm/t1isa.c
drivers/isdn/hysdn/boardergo.c
drivers/isdn/hysdn/boardergo.h
drivers/isdn/hysdn/hycapi.c
drivers/isdn/hysdn/hysdn_boot.c
drivers/isdn/hysdn/hysdn_defs.h
drivers/isdn/hysdn/hysdn_init.c
drivers/isdn/hysdn/hysdn_net.c
drivers/isdn/hysdn/hysdn_pof.h
drivers/isdn/hysdn/hysdn_procconf.c
drivers/isdn/hysdn/hysdn_proclog.c
drivers/isdn/hysdn/hysdn_sched.c
drivers/isdn/hysdn/ince1pc.h
drivers/isdn/i4l/isdn_ppp.c
drivers/isdn/i4l/isdn_tty.c
drivers/isdn/isdnloop/isdnloop.c
drivers/md/bitmap.c
drivers/media/video/zr36120.c
drivers/message/i2o/debug.c
drivers/mmc/au1xmmc.c
drivers/mtd/maps/pcmciamtd.c
drivers/net/3c59x.c
drivers/net/a2065.c
drivers/net/ariadne.c
drivers/net/atari_bionet.c
drivers/net/atari_pamsnet.c
drivers/net/atarilance.c
drivers/net/cassini.c
drivers/net/chelsio/cxgb2.c
drivers/net/dgrs.c
drivers/net/fec_8xx/fec_main.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/gt96100eth.c
drivers/net/hamradio/dmascc.c
drivers/net/hamradio/mkiss.c
drivers/net/hplance.c
drivers/net/hydra.c
drivers/net/irda/irport.c
drivers/net/lasi_82596.c
drivers/net/mac89x0.c
drivers/net/mace.c
drivers/net/meth.c
drivers/net/ne-h8300.c
drivers/net/ni5010.c
drivers/net/sun3lance.c
drivers/net/zorro8390.c
drivers/pnp/isapnp/core.c
drivers/s390/block/dasd.c
drivers/s390/block/dasd_devmap.c
drivers/scsi/arm/cumana_2.c
drivers/scsi/arm/eesox.c
drivers/scsi/arm/powertec.c
drivers/scsi/atari_scsi.c
drivers/scsi/sd.c
drivers/serial/8250_hp300.c
drivers/serial/ioc4_serial.c
drivers/serial/mpsc.c
drivers/serial/mpsc.h [deleted file]
drivers/video/backlight/locomolcd.c
drivers/video/cirrusfb.c
drivers/video/hpfb.c
drivers/video/pm3fb.c
drivers/zorro/zorro-driver.c
fs/9p/9p.c [deleted file]
fs/9p/9p.h
fs/9p/Makefile
fs/9p/conv.c
fs/9p/conv.h
fs/9p/debug.h
fs/9p/error.c
fs/9p/error.h
fs/9p/fcall.c [new file with mode: 0644]
fs/9p/fcprint.c [new file with mode: 0644]
fs/9p/fid.c
fs/9p/fid.h
fs/9p/mux.c
fs/9p/mux.h
fs/9p/trans_fd.c
fs/9p/trans_sock.c [deleted file]
fs/9p/transport.h
fs/9p/v9fs.c
fs/9p/v9fs.h
fs/9p/v9fs_vfs.h
fs/9p/vfs_addr.c
fs/9p/vfs_dentry.c
fs/9p/vfs_dir.c
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/9p/vfs_super.c
fs/aio.c
fs/binfmt_elf.c
fs/binfmt_flat.c
fs/bio.c
fs/buffer.c
fs/char_dev.c
fs/compat.c
fs/dcache.c
fs/direct-io.c
fs/eventpoll.c
fs/exec.c
fs/ext2/super.c
fs/ext3/bitmap.c
fs/fs-writeback.c
fs/inode.c
fs/inotify.c
fs/jbd/journal.c
fs/jbd/transaction.c
fs/minix/bitmap.c
fs/minix/inode.c
fs/minix/itree_v1.c
fs/minix/itree_v2.c
fs/namei.c
fs/open.c
fs/pipe.c
fs/proc/proc_misc.c
fs/read_write.c
fs/reiserfs/file.c
fs/reiserfs/fix_node.c
fs/reiserfs/item_ops.c
fs/reiserfs/journal.c
fs/reiserfs/stree.c
fs/reiserfs/super.c
fs/reiserfs/xattr_acl.c
fs/smbfs/inode.c
fs/super.c
fs/udf/inode.c
include/asm-alpha/poll.h
include/asm-arm/poll.h
include/asm-arm26/poll.h
include/asm-cris/poll.h
include/asm-frv/poll.h
include/asm-h8300/poll.h
include/asm-i386/poll.h
include/asm-ia64/poll.h
include/asm-m32r/poll.h
include/asm-m68k/poll.h
include/asm-mips/poll.h
include/asm-parisc/poll.h
include/asm-powerpc/poll.h
include/asm-s390/poll.h
include/asm-sh/poll.h
include/asm-sh64/poll.h
include/asm-sparc/poll.h
include/asm-sparc64/poll.h
include/asm-v850/poll.h
include/asm-x86_64/poll.h
include/asm-xtensa/poll.h
include/linux/bitops.h
include/linux/capability.h
include/linux/cpu.h
include/linux/cpumask.h
include/linux/dcache.h
include/linux/dio.h
include/linux/fs.h
include/linux/fsnotify.h
include/linux/init.h
include/linux/inotify.h
include/linux/irq.h
include/linux/jbd.h
include/linux/kernel.h
include/linux/major.h
include/linux/module.h
include/linux/moduleparam.h
include/linux/ppdev.h
include/linux/quota.h
include/linux/radix-tree.h
include/linux/reiserfs_fs.h
include/linux/reiserfs_xattr.h
include/linux/security.h
include/linux/slab.h
include/linux/time.h
include/linux/timex.h
include/linux/tty_flip.h
include/linux/udf_fs_i.h
include/linux/zorro.h
include/video/pm3fb.h
init/Kconfig
init/initramfs.c
init/main.c
kernel/capability.c
kernel/irq/Makefile
kernel/irq/manage.c
kernel/irq/migration.c [new file with mode: 0644]
kernel/itimer.c
kernel/kthread.c
kernel/module.c
kernel/params.c
kernel/power/smp.c
kernel/rcutorture.c
kernel/softlockup.c
kernel/sys.c
kernel/time.c
kernel/timer.c
lib/Kconfig.debug
lib/Makefile
lib/cpumask.c [new file with mode: 0644]
lib/radix-tree.c
mm/Kconfig
mm/mmap.c
mm/page_alloc.c
mm/slab.c
mm/slob.c
mm/util.c
mm/vmscan.c
net/bluetooth/af_bluetooth.c
net/core/datagram.c
net/core/skbuff.c
net/dccp/proto.c
net/ipv4/tcp.c
net/rxrpc/main.c
net/sctp/socket.c
net/unix/af_unix.c
scripts/kallsyms.c
security/commoncap.c
security/keys/key.c
security/security.c
sound/oss/au1000.c
sound/oss/au1550_ac97.c
sound/oss/awe_wave.c
sound/oss/dmasound/dmasound_core.c
sound/oss/ite8172.c
sound/oss/sb_mixer.c
sound/oss/sequencer.c
sound/oss/swarm_cs4297a.c
sound/oss/waveartist.c

diff --git a/CREDITS b/CREDITS
index af70678..c6d69bf 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -2007,13 +2007,14 @@ S: University of Stuttgart, Germany and
 S: Ecole Nationale Superieure des Telecommunications, Paris
 
 N: Jamie Lokier
-E: jamie@imbolc.ucc.ie
+E: jamie@shareable.org
+W: http://www.shareable.org/
 D: Reboot-through-BIOS for broken 486 motherboards
-D: Some parport fixes
-S: 11 Goodson Walk
-S: Marston
+D: Parport fixes, futex improvements
+D: First instruction of x86 sysenter path :)
+S: 51 Sunningwell Road
 S: Oxford
-S: OX3 0HX
+S: OX1 4SZ
 S: United Kingdom
 
 N: Mark Lord
index 21272e4..495858b 100644 (file)
@@ -176,6 +176,18 @@ Who:       Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@s
 
 ---------------------------
 
+What:  Usage of invalid timevals in setitimer
+When:  March 2007
+Why:   POSIX requires to validate timevals in the setitimer call. This
+       was never done by Linux. The invalid (e.g. negative timevals) were
+       silently converted to more or less random timeouts and intervals.
+       Until the removal a per boot limited number of warnings is printed
+       and the timevals are sanitized.
+
+Who:   Thomas Gleixner <tglx@linutronix.de>
+
+---------------------------
+
 What:  I2C interface of the it87 driver
 When:  January 2007
 Why:   The ISA interface is faster and should be always available. The I2C
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt
new file mode 100644 (file)
index 0000000..43b89c2
--- /dev/null
@@ -0,0 +1,100 @@
+                   v9fs: Plan 9 Resource Sharing for Linux
+                   =======================================
+
+ABOUT
+=====
+
+v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
+
+This software was originally developed by Ron Minnich <rminnich@lanl.gov>
+and Maya Gokhale <maya@lanl.gov>.  Additional development by Greg Watson
+<gwatson@lanl.gov> and most recently Eric Van Hensbergen
+<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox
+<rsc@swtch.com>.
+
+USAGE
+=====
+
+For remote file server:
+
+       mount -t 9p 10.10.1.2 /mnt/9
+
+For Plan 9 From User Space applications (http://swtch.com/plan9)
+
+       mount -t 9p `namespace`/acme /mnt/9 -o proto=unix,uname=$USER
+
+OPTIONS
+=======
+
+  proto=name   select an alternative transport.  Valid options are
+               currently:
+                       unix - specifying a named pipe mount point
+                       tcp  - specifying a normal TCP/IP connection
+                       fd   - used passed file descriptors for connection
+                                (see rfdno and wfdno)
+
+  uname=name   user name to attempt mount as on the remote server.  The
+               server may override or ignore this value.  Certain user
+               names may require authentication.
+
+  aname=name   aname specifies the file tree to access when the server is
+               offering several exported file systems.
+
+  debug=n      specifies debug level.  The debug level is a bitmask.
+                       0x01 = display verbose error messages
+                       0x02 = developer debug (DEBUG_CURRENT)
+                       0x04 = display 9p trace
+                       0x08 = display VFS trace
+                       0x10 = display Marshalling debug
+                       0x20 = display RPC debug
+                       0x40 = display transport debug
+                       0x80 = display allocation debug
+
+  rfdno=n      the file descriptor for reading with proto=fd
+
+  wfdno=n      the file descriptor for writing with proto=fd
+
+  maxdata=n    the number of bytes to use for 9p packet payload (msize)
+
+  port=n       port to connect to on the remote server
+
+  noextend     force legacy mode (no 9p2000.u semantics)
+
+  uid          attempt to mount as a particular uid
+
+  gid          attempt to mount with a particular gid
+
+  afid         security channel - used by Plan 9 authentication protocols
+
+  nodevmap     do not map special files - represent them as normal files.
+               This can be used to share devices/named pipes/sockets between
+               hosts.  This functionality will be expanded in later versions.
+
+RESOURCES
+=========
+
+The Linux version of the 9p server is now maintained under the npfs project
+on sourceforge (http://sourceforge.net/projects/npfs).
+
+There are user and developer mailing lists available through the v9fs project
+on sourceforge (http://sourceforge.net/projects/v9fs).
+
+News and other information is maintained on SWiK (http://swik.net/v9fs).
+
+Bug reports may be issued through the kernel.org bugzilla 
+(http://bugzilla.kernel.org)
+
+For more information on the Plan 9 Operating System check out
+http://plan9.bell-labs.com/plan9
+
+For information on Plan 9 from User Space (Plan 9 applications and libraries
+ported to Linux/BSD/OSX/etc) check out http://swtch.com/plan9
+
+
+STATUS
+======
+
+The 2.6 kernel support is working on PPC and x86.
+
+PLEASE USE THE SOURCEFORGE BUG-TRACKER TO REPORT PROBLEMS.
+
index e5213bc..511b423 100644 (file)
@@ -26,6 +26,20 @@ The following mount options are supported:
        nostrict        Unset strict conformance
        iocharset=      Set the NLS character set
 
+The uid= and gid= options need a bit more explaining.  They will accept a
+decimal numeric value which will be used as the default ID for that mount.
+They will also accept the string "ignore" and "forget".  For files on the disk
+that are owned by nobody ( -1 ), they will instead look as if they are owned
+by the default ID.  The ignore option causes the default ID to override all
+IDs on the disk, not just -1.  The forget option causes all IDs to be written
+to disk as -1, so when the media is later remounted, they will appear to be
+owned by whatever default ID it is mounted with at that time.
+
+For typical desktop use of removable media, you should set the ID to that
+of the interactively logged on user, and also specify both the forget and
+ignore options.  This way the interactive user will always see the files
+on the disk as belonging to him.
+
 The remaining are for debugging and disaster recovery:
 
        novrs           Skip volume sequence recognition 
diff --git a/Documentation/filesystems/v9fs.txt b/Documentation/filesystems/v9fs.txt
deleted file mode 100644 (file)
index 24c7a9c..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-                       V9FS: 9P2000 for Linux
-                       ======================
-
-ABOUT
-=====
-
-v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
-
-This software was originally developed by Ron Minnich <rminnich@lanl.gov>
-and Maya Gokhale <maya@lanl.gov>.  Additional development by Greg Watson
-<gwatson@lanl.gov> and most recently Eric Van Hensbergen
-<ericvh@gmail.com> and Latchesar Ionkov <lucho@ionkov.net>.
-
-USAGE
-=====
-
-For remote file server:
-
-       mount -t 9P 10.10.1.2 /mnt/9
-
-For Plan 9 From User Space applications (http://swtch.com/plan9)
-
-       mount -t 9P `namespace`/acme /mnt/9 -o proto=unix,name=$USER
-
-OPTIONS
-=======
-
-  proto=name   select an alternative transport.  Valid options are
-               currently:
-                       unix - specifying a named pipe mount point
-                       tcp  - specifying a normal TCP/IP connection
-                       fd   - used passed file descriptors for connection
-                                (see rfdno and wfdno)
-
-  name=name    user name to attempt mount as on the remote server.  The
-               server may override or ignore this value.  Certain user
-               names may require authentication.
-
-  aname=name   aname specifies the file tree to access when the server is
-               offering several exported file systems.
-
-  debug=n      specifies debug level.  The debug level is a bitmask.
-                       0x01 = display verbose error messages
-                       0x02 = developer debug (DEBUG_CURRENT)
-                       0x04 = display 9P trace
-                       0x08 = display VFS trace
-                       0x10 = display Marshalling debug
-                       0x20 = display RPC debug
-                       0x40 = display transport debug
-                       0x80 = display allocation debug
-
-  rfdno=n      the file descriptor for reading with proto=fd
-
-  wfdno=n      the file descriptor for writing with proto=fd
-
-  maxdata=n    the number of bytes to use for 9P packet payload (msize)
-
-  port=n       port to connect to on the remote server
-
-  noextend     force legacy mode (no 9P2000.u semantics)
-
-  uid          attempt to mount as a particular uid
-
-  gid          attempt to mount with a particular gid
-
-  afid         security channel - used by Plan 9 authentication protocols
-
-  nodevmap     do not map special files - represent them as normal files.
-               This can be used to share devices/named pipes/sockets between
-               hosts.  This functionality will be expanded in later versions.
-
-RESOURCES
-=========
-
-The Linux version of the 9P server is now maintained under the npfs project
-on sourceforge (http://sourceforge.net/projects/npfs).
-
-There are user and developer mailing lists available through the v9fs project
-on sourceforge (http://sourceforge.net/projects/v9fs).
-
-News and other information is maintained on SWiK (http://swik.net/v9fs).
-
-Bug reports may be issued through the kernel.org bugzilla 
-(http://bugzilla.kernel.org)
-
-For more information on the Plan 9 Operating System check out
-http://plan9.bell-labs.com/plan9
-
-For information on Plan 9 from User Space (Plan 9 applications and libraries
-ported to Linux/BSD/OSX/etc) check out http://swtch.com/plan9
-
-
-STATUS
-======
-
-The 2.6 kernel support is working on PPC and x86.
-
-PLEASE USE THE SOURCEFORGE BUG-TRACKER TO REPORT PROBLEMS.
-
index e56e842..adaa899 100644 (file)
@@ -230,10 +230,15 @@ only called from a process context (i.e. not from an interrupt handler
 or bottom half).
 
   alloc_inode: this method is called by inode_alloc() to allocate memory
-       for struct inode and initialize it.
+       for struct inode and initialize it.  If this function is not
+       defined, a simple 'struct inode' is allocated.  Normally
+       alloc_inode will be used to allocate a larger structure which
+       contains a 'struct inode' embedded within it.
 
   destroy_inode: this method is called by destroy_inode() to release
-       resources allocated for struct inode.
+       resources allocated for struct inode.  It is only required if
+       ->alloc_inode was defined and simply undoes anything done by
+       ->alloc_inode.
 
   read_inode: this method is called to read a specific inode from the
         mounted filesystem.  The i_ino member in the struct inode is
@@ -443,14 +448,81 @@ otherwise noted.
 The Address Space Object
 ========================
 
-The address space object is used to identify pages in the page cache.
-
+The address space object is used to group and manage pages in the page
+cache.  It can be used to keep track of the pages in a file (or
+anything else) and also track the mapping of sections of the file into
+process address spaces.
+
+There are a number of distinct yet related services that an
+address-space can provide.  These include communicating memory
+pressure, page lookup by address, and keeping track of pages tagged as
+Dirty or Writeback.
+
+The first can be used independently to the others.  The VM can try to
+either write dirty pages in order to clean them, or release clean
+pages in order to reuse them.  To do this it can call the ->writepage
+method on dirty pages, and ->releasepage on clean pages with
+PagePrivate set. Clean pages without PagePrivate and with no external
+references will be released without notice being given to the
+address_space.
+
+To achieve this functionality, pages need to be placed on an LRU with
+lru_cache_add and mark_page_active needs to be called whenever the
+page is used.
+
+Pages are normally kept in a radix tree index by ->index. This tree
+maintains information about the PG_Dirty and PG_Writeback status of
+each page, so that pages with either of these flags can be found
+quickly.
+
+The Dirty tag is primarily used by mpage_writepages - the default
+->writepages method.  It uses the tag to find dirty pages to call
+->writepage on.  If mpage_writepages is not used (i.e. the address
+provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is
+almost unused.  write_inode_now and sync_inode do use it (through
+__sync_single_inode) to check if ->writepages has been successful in
+writing out the whole address_space.
+
+The Writeback tag is used by filemap*wait* and sync_page* functions,
+via wait_on_page_writeback_range, to wait for all writeback to
+complete.  While waiting ->sync_page (if defined) will be called on
+each page that is found to require writeback.
+
+An address_space handler may attach extra information to a page,
+typically using the 'private' field in the 'struct page'.  If such
+information is attached, the PG_Private flag should be set.  This will
+cause various VM routines to make extra calls into the address_space
+handler to deal with that data.
+
+An address space acts as an intermediate between storage and
+application.  Data is read into the address space a whole page at a
+time, and provided to the application either by copying of the page,
+or by memory-mapping the page.
+Data is written into the address space by the application, and then
+written-back to storage typically in whole pages, however the
+address_space has finer control of write sizes.
+
+The read process essentially only requires 'readpage'.  The write
+process is more complicated and uses prepare_write/commit_write or
+set_page_dirty to write data into the address_space, and writepage,
+sync_page, and writepages to writeback data to storage.
+
+Adding and removing pages to/from an address_space is protected by the
+inode's i_mutex.
+
+When data is written to a page, the PG_Dirty flag should be set.  It
+typically remains set until writepage asks for it to be written.  This
+should clear PG_Dirty and set PG_Writeback.  It can be actually
+written at any point after PG_Dirty is clear.  Once it is known to be
+safe, PG_Writeback is cleared.
+
+Writeback makes use of a writeback_control structure...
 
 struct address_space_operations
 -------------------------------
 
 This describes how the VFS can manipulate mapping of a file to page cache in
-your filesystem. As of kernel 2.6.13, the following members are defined:
+your filesystem. As of kernel 2.6.16, the following members are defined:
 
 struct address_space_operations {
        int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -469,47 +541,148 @@ struct address_space_operations {
                        loff_t offset, unsigned long nr_segs);
        struct page* (*get_xip_page)(struct address_space *, sector_t,
                        int);
+       /* migrate the contents of a page to the specified target */
+       int (*migratepage) (struct page *, struct page *);
 };
 
-  writepage: called by the VM write a dirty page to backing store.
+  writepage: called by the VM to write a dirty page to backing store.
+      This may happen for data integrity reasons (i.e. 'sync'), or
+      to free up memory (flush).  The difference can be seen in
+      wbc->sync_mode.
+      The PG_Dirty flag has been cleared and PageLocked is true.
+      writepage should start writeout, should set PG_Writeback,
+      and should make sure the page is unlocked, either synchronously
+      or asynchronously when the write operation completes.
+
+      If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to
+      try too hard if there are problems, and may choose to write out
+      other pages from the mapping if that is easier (e.g. due to
+      internal dependencies).  If it chooses not to start writeout, it
+      should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep
+      calling ->writepage on that page.
+
+      See the file "Locking" for more details.
 
   readpage: called by the VM to read a page from backing store.
+       The page will be Locked when readpage is called, and should be
+       unlocked and marked uptodate once the read completes.
+       If ->readpage discovers that it needs to unlock the page for
+       some reason, it can do so, and then return AOP_TRUNCATED_PAGE.
+       In this case, the page will be relocated, relocked and if
+       that all succeeds, ->readpage will be called again.
 
   sync_page: called by the VM to notify the backing store to perform all
        queued I/O operations for a page. I/O operations for other pages
        associated with this address_space object may also be performed.
 
+       This function is optional and is called only for pages with
+       PG_Writeback set while waiting for the writeback to complete.
+
   writepages: called by the VM to write out pages associated with the
-       address_space object.
+       address_space object.  If wbc->sync_mode is WBC_SYNC_ALL, then
+       the writeback_control will specify a range of pages that must be
+       written out.  If it is WBC_SYNC_NONE, then a nr_to_write is given
+       and that many pages should be written if possible.
+       If no ->writepages is given, then mpage_writepages is used
+       instead.  This will choose pages from the address space that are
+       tagged as DIRTY and will pass them to ->writepage.
 
   set_page_dirty: called by the VM to set a page dirty.
+        This is particularly needed if an address space attaches
+        private data to a page, and that data needs to be updated when
+        a page is dirtied.  This is called, for example, when a memory
+       mapped page gets modified.
+       If defined, it should set the PageDirty flag, and the
+        PAGECACHE_TAG_DIRTY tag in the radix tree.
 
   readpages: called by the VM to read pages associated with the address_space
-       object.
+       object. This is essentially just a vector version of
+       readpage.  Instead of just one page, several pages are
+       requested.
+       readpages is only used for read-ahead, so read errors are
+       ignored.  If anything goes wrong, feel free to give up.
 
   prepare_write: called by the generic write path in VM to set up a write
-       request for a page.
-
-  commit_write: called by the generic write path in VM to write page to
-       its backing store.
+       request for a page.  This indicates to the address space that
+       the given range of bytes is about to be written.  The
+       address_space should check that the write will be able to
+       complete, by allocating space if necessary and doing any other
+       internal housekeeping.  If the write will update parts of
+       any basic-blocks on storage, then those blocks should be
+       pre-read (if they haven't been read already) so that the
+       updated blocks can be written out properly.
+       The page will be locked.  If prepare_write wants to unlock the
+       page it, like readpage, may do so and return
+       AOP_TRUNCATED_PAGE.
+       In this case the prepare_write will be retried one the lock is
+       regained.
+
+  commit_write: If prepare_write succeeds, new data will be copied
+        into the page and then commit_write will be called.  It will
+        typically update the size of the file (if appropriate) and
+        mark the inode as dirty, and do any other related housekeeping
+        operations.  It should avoid returning an error if possible -
+        errors should have been handled by prepare_write.
 
   bmap: called by the VFS to map a logical block offset within object to
-       physical block number. This method is use by for the legacy FIBMAP
-       ioctl. Other uses are discouraged.
-
-  invalidatepage: called by the VM on truncate to disassociate a page from its
-       address_space mapping.
-
-  releasepage: called by the VFS to release filesystem specific metadata from
-       a page.
-
-  direct_IO: called by the VM for direct I/O writes and reads.
+       physical block number. This method is used by the FIBMAP
+       ioctl and for working with swap-files.  To be able to swap to
+       a file, the file must have a stable mapping to a block
+       device.  The swap system does not go through the filesystem
+       but instead uses bmap to find out where the blocks in the file
+       are and uses those addresses directly.
+
+
+  invalidatepage: If a page has PagePrivate set, then invalidatepage
+        will be called when part or all of the page is to be removed
+       from the address space.  This generally corresponds to either a
+       truncation or a complete invalidation of the address space
+       (in the latter case 'offset' will always be 0).
+       Any private data associated with the page should be updated
+       to reflect this truncation.  If offset is 0, then
+       the private data should be released, because the page
+       must be able to be completely discarded.  This may be done by
+        calling the ->releasepage function, but in this case the
+        release MUST succeed.
+
+  releasepage: releasepage is called on PagePrivate pages to indicate
+        that the page should be freed if possible.  ->releasepage
+        should remove any private data from the page and clear the
+        PagePrivate flag.  It may also remove the page from the
+        address_space.  If this fails for some reason, it may indicate
+        failure with a 0 return value.
+       This is used in two distinct though related cases.  The first
+        is when the VM finds a clean page with no active users and
+        wants to make it a free page.  If ->releasepage succeeds, the
+        page will be removed from the address_space and become free.
+
+       The second case if when a request has been made to invalidate
+        some or all pages in an address_space.  This can happen
+        through the fadvice(POSIX_FADV_DONTNEED) system call or by the
+        filesystem explicitly requesting it as nfs and 9fs do (when
+        they believe the cache may be out of date with storage) by
+        calling invalidate_inode_pages2().
+       If the filesystem makes such a call, and needs to be certain
+        that all pages are invalidated, then its releasepage will
+        need to ensure this.  Possibly it can clear the PageUptodate
+        bit if it cannot free private data yet.
+
+  direct_IO: called by the generic read/write routines to perform
+        direct_IO - that is IO requests which bypass the page cache
+        and transfer data directly between the storage and the
+        application's address space.
 
   get_xip_page: called by the VM to translate a block number to a page.
        The page is valid until the corresponding filesystem is unmounted.
        Filesystems that want to use execute-in-place (XIP) need to implement
        it.  An example implementation can be found in fs/ext2/xip.c.
 
+  migrate_page:  This is used to compact the physical memory usage.
+        If the VM wants to relocate a page (maybe off a memory card
+        that is signalling imminent failure) it will pass a new page
+       and an old page to this function.  migrate_page should
+       transfer any private data across and update any references
+        that it has to the page.
 
 The File Object
 ===============
index d3ad2c2..ad3edab 100644 (file)
@@ -23,7 +23,6 @@ char __init inkernel_firmware[] = "let's say that this is firmware\n";
 #endif
 
 static struct device ghost_device = {
-       .name      = "Ghost Device",
        .bus_id    = "ghost0",
 };
 
@@ -92,7 +91,7 @@ static void sample_probe_async(void)
 {
        /* Let's say that I can't sleep */
        int error;
-       error = request_firmware_nowait (THIS_MODULE,
+       error = request_firmware_nowait (THIS_MODULE, FW_ACTION_NOHOTPLUG,
                                         "sample_driver_fw", &ghost_device,
                                         "my device pointer",
                                         sample_probe_async_cont);
index 57b956a..9e1b0e4 100644 (file)
@@ -172,7 +172,6 @@ static void fw_remove_class_device(struct class_device *class_dev)
 static struct class_device *class_dev;
 
 static struct device my_device = {
-       .name      = "Sample Device",
        .bus_id    = "my_dev0",
 };
 
index 44a25f3..f8cb55c 100644 (file)
@@ -367,12 +367,17 @@ running once the system is up.
                tty<n>  Use the virtual console device <n>.
 
                ttyS<n>[,options]
+               ttyUSB0[,options]
                        Use the specified serial port.  The options are of
-                       the form "bbbbpn", where "bbbb" is the baud rate,
-                       "p" is parity ("n", "o", or "e"), and "n" is bits.
-                       Default is "9600n8".
-
-                       See also Documentation/serial-console.txt.
+                       the form "bbbbpnf", where "bbbb" is the baud rate,
+                       "p" is parity ("n", "o", or "e"), "n" is number of
+                       bits, and "f" is flow control ("r" for RTS or
+                       omit it).  Default is "9600n8".
+
+                       See Documentation/serial-console.txt for more
+                       information.  See
+                       Documentation/networking/netconsole.txt for an
+                       alternative.
 
                uart,io,<addr>[,options]
                uart,mmio,<addr>[,options]
index 5427f8c..145d27a 100644 (file)
@@ -25,7 +25,7 @@ the essid= string parameter is available via the kernel command line.
 This will change after the method of sorting out parameters for all
 the PCMCIA drivers is agreed upon.  If you must have a built in driver
 with nondefault parameters, they can be edited in
-/usr/src/linux/drivers/net/pcmcia/ray_cs.c.  Searching for MODULE_PARM
+/usr/src/linux/drivers/net/pcmcia/ray_cs.c.  Searching for module_param
 will find them all.
 
 Information on card services is available at:
index 6c689b0..9a7bc8b 100644 (file)
@@ -17,11 +17,13 @@ The format of this option is:
                        ttyX for any other virtual console
                        ttySx for a serial port
                        lp0 for the first parallel port
+                       ttyUSB0 for the first USB serial device
 
        options:        depend on the driver. For the serial port this
-                       defines the baudrate/parity/bits of the port,
-                       in the format BBBBPN, where BBBB is the speed,
-                       P is parity (n/o/e), and N is bits. Default is
+                       defines the baudrate/parity/bits/flow control of
+                       the port, in the format BBBBPNF, where BBBB is the
+                       speed, P is parity (n/o/e), N is number of bits,
+                       and F is flow control ('r' for RTS). Default is
                        9600n8. The maximum baudrate is 115200.
 
 You can specify multiple console= options on the kernel command line.
@@ -45,6 +47,9 @@ become the console.
 You will need to create a new device to use /dev/console. The official
 /dev/console is now character device 5,1.
 
+(You can also use a network device as a console.  See
+Documentation/networking/netconsole.txt for information on that.)
+
 Here's an example that will use /dev/ttyS1 (COM2) as the console.
 Replace the sample values as needed.
 
index 15d4fb9..f04ba6b 100644 (file)
@@ -69,7 +69,7 @@ are available, for example IRQ, address, DMA.
 
 Warning, the options for different cards sometime use different names 
 for the same or a similar feature (dma1= versus dma16=).  As a last 
-resort, inspect the code (search for MODULE_PARM).
+resort, inspect the code (search for module_param).
 
 Notes:
 
index 88d6cf8..b544327 100644 (file)
@@ -88,7 +88,7 @@ parameters.  for a copy email: twoller@crystal.cirrus.com
 
 MODULE_PARMS definitions
 ------------------------
-MODULE_PARM(defaultorder, "i");
+module_param(defaultorder, ulong, 0);
 defaultorder=N
 where N is a value from 1 to 12
 The buffer order determines the size of the dma buffer for the driver.
@@ -98,18 +98,18 @@ to not underrun the dma buffer as easily.  As default, use 32k (order=3)
 rather than 64k as some of the games work more responsively.
 (2^N) * PAGE_SIZE = allocated buffer size
 
-MODULE_PARM(cs_debuglevel, "i");
-MODULE_PARM(cs_debugmask, "i");
+module_param(cs_debuglevel, ulong, 0644);
+module_param(cs_debugmask, ulong, 0644);
 cs_debuglevel=N
 cs_debugmask=0xMMMMMMMM
 where N is a value from 0 (no debug printfs), to 9 (maximum)
 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source).
 
-MODULE_PARM(hercules_egpio_disable, "i");
+module_param(hercules_egpio_disable, ulong, 0);
 hercules_egpio_disable=N
 where N is a 0 (enable egpio), or a 1 (disable egpio support)
 
-MODULE_PARM(initdelay, "i");
+module_param(initdelay, ulong, 0);
 initdelay=N
 This value is used to determine the millescond delay during the initialization
 code prior to powering up the PLL.  On laptops this value can be used to
@@ -118,19 +118,19 @@ system is booted under battery power then the mdelay()/udelay() functions fail t
 properly delay the required time.  Also, if the system is booted under AC power
 and then the power removed, the mdelay()/udelay() functions will not delay properly.
  
-MODULE_PARM(powerdown, "i");
+module_param(powerdown, ulong, 0);
 powerdown=N
 where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown)
 
 
-MODULE_PARM(external_amp, "i");
+module_param(external_amp, bool, 0);
 external_amp=1
 if N is set to 1, then force enabling the EAPD support in the primary AC97 codec.
 override the detection logic and force the external amp bit in the AC97 0x26 register
 to be reset (0).  EAPD should be 0 for powerup, and 1 for powerdown.  The VTB Santa Cruz
 card has inverted logic, so there is a special function for these cards.
 
-MODULE_PARM(thinkpad, "i");
+module_param(thinkpad, bool, 0);
 thinkpad=1
 if N is set to 1, then force enabling the clkrun functionality.
 Currently, when the part is being used, then clkrun is disabled for the entire system,
index 5b6a014..fa92d0d 100644 (file)
@@ -147,6 +147,18 @@ M: p_gortmaker@yahoo.com
 L:     netdev@vger.kernel.org
 S:     Maintained
 
+9P FILE SYSTEM
+P:      Eric Van Hensbergen
+M:      ericvh@gmail.com
+P:      Ron Minnich
+M:      rminnich@lanl.gov
+P:      Latchesar Ionkov
+M:      lucho@ionkov.net
+L:      v9fs-developer@lists.sourceforge.net
+W:      http://v9fs.sf.net
+T:      git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs.git
+S:      Maintained
+
 A2232 SERIAL BOARD DRIVER
 P:     Enver Haase
 M:     ehaase@inf.fu-berlin.de
@@ -2212,13 +2224,6 @@ S:       Maintained
 RISCOM8 DRIVER
 S:     Orphan
 
-RTLINUX  REALTIME  LINUX
-P:     Victor Yodaiken
-M:     yodaiken@fsmlabs.com
-L:     rtl@rtlinux.org
-W:     www.rtlinux.org
-S:     Maintained
-
 S3 SAVAGE FRAMEBUFFER DRIVER
 P:      Antonino Daplas
 M:      adaplas@pol.net
@@ -2531,7 +2536,6 @@ S:        Unsupported ?
 STRADIS MPEG-2 DECODER DRIVER
 P:     Nathan Laredo
 M:     laredo@gnu.org
-W:     http://mpeg.openprojects.net/
 W:     http://www.stradis.com/
 S:     Maintained
 
@@ -2650,7 +2654,7 @@ S:        Maintained
 
 TUN/TAP driver
 P:     Maxim Krasnyansky
-M:     maxk@qualcomm.com, max_mk@yahoo.com
+M:     maxk@qualcomm.com
 L:     vtun@office.satix.net
 W:     http://vtun.sourceforge.net/tun
 S:     Maintained
@@ -2979,18 +2983,6 @@ L:       rio500-users@lists.sourceforge.net
 W:     http://rio500.sourceforge.net
 S:     Maintained
 
-V9FS FILE SYSTEM
-P:      Eric Van Hensbergen
-M:      ericvh@gmail.com
-P:      Ron Minnich
-M:      rminnich@lanl.gov
-P:      Latchesar Ionkov
-M:      lucho@ionkov.net
-L:      v9fs-developer@lists.sourceforge.net
-W:      http://v9fs.sf.net
-T:      git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs-devel.git
-S:      Maintained
-
 VIDEO FOR LINUX
 P:     Mauro Carvalho Chehab
 M:     mchehab@infradead.org
index 6888816..1024540 100644 (file)
@@ -40,6 +40,7 @@
 #include <asm/hardware/scoop.h>
 #include <asm/mach/sharpsl_param.h>
 #include <asm/hardware/locomo.h>
+#include <asm/arch/mcp.h>
 
 #include "generic.h"
 
@@ -66,6 +67,32 @@ struct platform_device colliescoop_device = {
        .resource       = collie_scoop_resources,
 };
 
+static struct scoop_pcmcia_dev collie_pcmcia_scoop[] = {
+{
+       .dev        = &colliescoop_device.dev,
+       .irq        = COLLIE_IRQ_GPIO_CF_IRQ,
+       .cd_irq     = COLLIE_IRQ_GPIO_CF_CD,
+       .cd_irq_str = "PCMCIA0 CD",
+},
+};
+
+static struct scoop_pcmcia_config collie_pcmcia_config = {
+       .devs         = &collie_pcmcia_scoop[0],
+       .num_devs     = 1,
+};
+
+
+static struct mcp_plat_data collie_mcp_data = {
+       .mccr0          = MCCR0_ADM,
+       .sclk_rate      = 11981000,
+};
+
+
+static struct sa1100_port_fns collie_port_fns __initdata = {
+       .set_mctrl      = collie_uart_set_mctrl,
+       .get_mctrl      = collie_uart_get_mctrl,
+};
+
 
 static struct resource locomo_resources[] = {
        [0] = {
@@ -159,6 +186,8 @@ static void __init collie_init(void)
        GPDR |= GPIO_32_768kHz;
        TUCR  = TUCR_32_768kHz;
 
+       platform_scoop_config = &collie_pcmcia_config;
+
        ret = platform_add_devices(devices, ARRAY_SIZE(devices));
        if (ret) {
                printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
@@ -166,6 +195,7 @@ static void __init collie_init(void)
 
        sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources,
                              ARRAY_SIZE(collie_flash_resources));
+       sa11x0_set_mcp_data(&collie_mcp_data);
 
        sharpsl_save_param();
 }
index bfea1be..b008fb0 100644 (file)
@@ -737,7 +737,7 @@ config PHYSICAL_START
 
 config HOTPLUG_CPU
        bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
-       depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
+       depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER && !X86_PC
        ---help---
          Say Y here to experiment with turning CPUs off and on.  CPUs
          can be controlled through /sys/devices/system/cpu.
index 00108ba..6e97df6 100644 (file)
@@ -44,8 +44,8 @@ comment "Page alloc debug is incompatible with Software Suspend on i386"
        depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
 
 config DEBUG_PAGEALLOC
-       bool "Page alloc debugging"
-       depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+       bool "Debug page memory allocations"
+       depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
        help
          Unmap pages from the kernel linear mapping after free_pages().
          This results in a large slowdown, but helps to find certain types
index d8d69f2..4b84ea2 100644 (file)
@@ -76,6 +76,8 @@ edd_mbr_sig_read:
        popw    %es
        popw    %bx
        jc      edd_mbr_sig_done                # on failure, we're done.
+       cmpb    $0, %ah         # some BIOSes do not set CF
+       jne     edd_mbr_sig_done                # on failure, we're done.
        movl    (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR
        movl    %eax, (%bx)                     # store success
        incb    (EDD_MBR_SIG_NR_BUF)            # note that we stored something
index 6a93d75..ca2a0cb 100644 (file)
@@ -106,7 +106,7 @@ static void __init dmi_save_devices(struct dmi_header *dm)
        struct dmi_device *dev;
 
        for (i = 0; i < count; i++) {
-               char *d = ((char *) dm) + (i * 2);
+               char *d = (char *)(dm + 1) + (i * 2);
 
                /* Skip disabled device */
                if ((*d & 0x80) == 0)
index 4c470e9..82371d8 100644 (file)
@@ -1003,7 +1003,6 @@ void cpu_exit_clear(void)
 
        cpu_clear(cpu, cpu_callout_map);
        cpu_clear(cpu, cpu_callin_map);
-       cpu_clear(cpu, cpu_present_map);
 
        cpu_clear(cpu, smp_commenced_mask);
        unmap_cpu_to_logical_apicid(cpu);
@@ -1015,31 +1014,20 @@ struct warm_boot_cpu_info {
        int cpu;
 };
 
-static void __devinit do_warm_boot_cpu(void *p)
+static void __cpuinit do_warm_boot_cpu(void *p)
 {
        struct warm_boot_cpu_info *info = p;
        do_boot_cpu(info->apicid, info->cpu);
        complete(info->complete);
 }
 
-int __devinit smp_prepare_cpu(int cpu)
+static int __cpuinit __smp_prepare_cpu(int cpu)
 {
        DECLARE_COMPLETION(done);
        struct warm_boot_cpu_info info;
        struct work_struct task;
        int     apicid, ret;
 
-       lock_cpu_hotplug();
-
-       /*
-        * On x86, CPU0 is never offlined.  Trying to bring up an
-        * already-booted CPU will hang.  So check for that case.
-        */
-       if (cpu_online(cpu)) {
-               ret = -EINVAL;
-               goto exit;
-       }
-
        apicid = x86_cpu_to_apicid[cpu];
        if (apicid == BAD_APICID) {
                ret = -ENODEV;
@@ -1064,7 +1052,6 @@ int __devinit smp_prepare_cpu(int cpu)
        zap_low_mappings();
        ret = 0;
 exit:
-       unlock_cpu_hotplug();
        return ret;
 }
 #endif
@@ -1392,6 +1379,22 @@ void __cpu_die(unsigned int cpu)
 
 int __devinit __cpu_up(unsigned int cpu)
 {
+#ifdef CONFIG_HOTPLUG_CPU
+       int ret=0;
+
+       /*
+        * We do warm boot only on cpus that had booted earlier
+        * Otherwise cold boot is all handled from smp_boot_cpus().
+        * cpu_callin_map is set during AP kickstart process. Its reset
+        * when a cpu is taken offline from cpu_exit_clear().
+        */
+       if (!cpu_isset(cpu, cpu_callin_map))
+               ret = __smp_prepare_cpu(cpu);
+
+       if (ret)
+               return -EIO;
+#endif
+
        /* In case one didn't come up */
        if (!cpu_isset(cpu, cpu_callin_map)) {
                printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
index 70dba1f..13e739e 100644 (file)
@@ -1166,19 +1166,7 @@ put_tv32 (struct compat_timeval __user *o, struct timeval *i)
 asmlinkage unsigned long
 sys32_alarm (unsigned int seconds)
 {
-       struct itimerval it_new, it_old;
-       unsigned int oldalarm;
-
-       it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
-       it_new.it_value.tv_sec = seconds;
-       it_new.it_value.tv_usec = 0;
-       do_setitimer(ITIMER_REAL, &it_new, &it_old);
-       oldalarm = it_old.it_value.tv_sec;
-       /* ehhh.. We can't return 0 if we have an alarm pending.. */
-       /* And we'd better return too much than too little anyway */
-       if (it_old.it_value.tv_usec)
-               oldalarm++;
-       return oldalarm;
+       return alarm_setitimer(seconds);
 }
 
 /* Translations due to time_t size differences.  Which affects all
index bbf711b..2e1019d 100644 (file)
@@ -19,7 +19,7 @@ config DEBUG_STACK_USAGE
          This option will slow down process creation somewhat.
 
 config DEBUG_PAGEALLOC
-       bool "Page alloc debugging"
+       bool "Debug page memory allocations"
        depends on DEBUG_KERNEL && BROKEN
        help
          Unmap pages from the kernel linear mapping after free_pages().
index 0fc3730..5407b78 100644 (file)
@@ -645,27 +645,7 @@ static inline void getitimer_real(struct itimerval *value)
 
 asmlinkage unsigned int irix_alarm(unsigned int seconds)
 {
-       struct itimerval it_new, it_old;
-       unsigned int oldalarm;
-
-       if (!seconds) {
-               getitimer_real(&it_old);
-               del_timer(&current->real_timer);
-       } else {
-               it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
-               it_new.it_value.tv_sec = seconds;
-               it_new.it_value.tv_usec = 0;
-               do_setitimer(ITIMER_REAL, &it_new, &it_old);
-       }
-       oldalarm = it_old.it_value.tv_sec;
-       /*
-        * ehhh.. We can't return 0 if we have an alarm pending ...
-        * And we'd better return too much than too little anyway
-        */
-       if (it_old.it_value.tv_usec)
-               oldalarm++;
-
-       return oldalarm;
+       return alarm_setitimer(seconds);
 }
 
 asmlinkage int irix_pause(void)
index 49eb2a7..a892356 100644 (file)
@@ -126,11 +126,11 @@ static int numReadBufs = 4, readbufSize = 32;
 */
 static volatile cbd_t  *rx_base, *rx_cur, *tx_base, *tx_cur;
 
-MODULE_PARM(catchRadius, "i");
-MODULE_PARM(numBufs, "i");
-MODULE_PARM(bufSize, "i");
-MODULE_PARM(numreadBufs, "i");
-MODULE_PARM(readbufSize, "i");
+module_param(catchRadius, int, 0);
+module_param(numBufs, int, 0);
+module_param(bufSize, int, 0);
+module_param(numreadBufs, int, 0);
+module_param(readbufSize, int, 0);
 
 #define arraysize(x)   (sizeof(x)/sizeof(*(x)))
 #define le2be16(x)     (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
index 3e31be4..afe0a77 100644 (file)
@@ -24,7 +24,7 @@ config DEBUG_BOOTMEM
        bool "Debug BOOTMEM initialization"
 
 config DEBUG_PAGEALLOC
-       bool "Page alloc debugging"
+       bool "Debug page memory allocations"
        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
        help
          Unmap pages from the kernel linear mapping after free_pages().
index 2bc55af..2b2d029 100644 (file)
@@ -430,24 +430,12 @@ put_tv32(struct compat_timeval __user *o, struct timeval *i)
        return err; 
 }
 
-extern int do_setitimer(int which, struct itimerval *, struct itimerval *);
+extern unsigned int alarm_setitimer(unsigned int seconds);
 
 asmlinkage long
 sys32_alarm(unsigned int seconds)
 {
-       struct itimerval it_new, it_old;
-       unsigned int oldalarm;
-
-       it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
-       it_new.it_value.tv_sec = seconds;
-       it_new.it_value.tv_usec = 0;
-       do_setitimer(ITIMER_REAL, &it_new, &it_old);
-       oldalarm = it_old.it_value.tv_sec;
-       /* ehhh.. We can't return 0 if we have an alarm pending.. */
-       /* And we'd better return too much than too little anyway */
-       if (it_old.it_value.tv_usec)
-               oldalarm++;
-       return oldalarm;
+       return alarm_setitimer(seconds);
 }
 
 /* Translations due to time_t size differences.  Which affects all
index 29f3d75..dd712b2 100644 (file)
@@ -19,11 +19,6 @@ EXPORT_SYMBOL(cpu_sysdev_class);
 static struct sys_device *cpu_sys_devices[NR_CPUS];
 
 #ifdef CONFIG_HOTPLUG_CPU
-int __attribute__((weak)) smp_prepare_cpu (int cpu)
-{
-       return 0;
-}
-
 static ssize_t show_online(struct sys_device *dev, char *buf)
 {
        struct cpu *cpu = container_of(dev, struct cpu, sysdev);
@@ -44,9 +39,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf,
                        kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
                break;
        case '1':
-               ret = smp_prepare_cpu(cpu->sysdev.id);
-               if (!ret)
-                       ret = cpu_up(cpu->sysdev.id);
+               ret = cpu_up(cpu->sysdev.id);
                if (!ret)
                        kobject_uevent(&dev->kobj, KOBJ_ONLINE);
                break;
index 8b13316..e57ac5a 100644 (file)
@@ -401,7 +401,6 @@ config BLK_DEV_RAM_SIZE
 
 config BLK_DEV_INITRD
        bool "Initial RAM disk (initrd) support"
-       depends on BLK_DEV_RAM=y
        help
          The initial RAM disk is a RAM disk that is loaded by the boot loader
          (loadlin or lilo) and that is mounted as root before the normal boot
index f8ce235..c396509 100644 (file)
@@ -271,7 +271,7 @@ unsigned char *DMABuffer;                     /* buffer for writes */
 static unsigned long PhysDMABuffer;   /* physical address */
 
 static int UseTrackbuffer = -1;                  /* Do track buffering? */
-MODULE_PARM(UseTrackbuffer, "i");
+module_param(UseTrackbuffer, int, 0);
 
 unsigned char *TrackBuffer;                      /* buffer for reads */
 static unsigned long PhysTrackBuffer; /* physical address */
@@ -296,7 +296,7 @@ static int MotorOn = 0, MotorOffTrys;
 static int IsFormatting = 0, FormatError;
 
 static int UserSteprate[FD_MAX_UNITS] = { -1, -1 };
-MODULE_PARM(UserSteprate, "1-" __MODULE_STRING(FD_MAX_UNITS) "i");
+module_param_array(UserSteprate, int, NULL, 0);
 
 /* Synchronization of FDC access. */
 static volatile int fdc_busy = 0;
index fb2d0be..840919b 100644 (file)
@@ -4594,7 +4594,7 @@ static void __init parse_floppy_cfg_string(char *cfg)
        }
 }
 
-int init_module(void)
+int __init init_module(void)
 {
        if (floppy)
                parse_floppy_cfg_string(floppy);
index a9bde30..8bca490 100644 (file)
@@ -639,10 +639,7 @@ static int __init nbd_init(void)
        int err = -ENOMEM;
        int i;
 
-       if (sizeof(struct nbd_request) != 28) {
-               printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" );
-               return -EIO;
-       }
+       BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
        if (nbds_max > MAX_NBD) {
                printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,
index fad27a8..f43a988 100644 (file)
@@ -218,12 +218,12 @@ static int cm206_base = CM206_BASE;
 static int cm206_irq = CM206_IRQ;
 #ifdef MODULE
 static int cm206[2] = { 0, 0 };        /* for compatible `insmod' parameter passing */
+module_param_array(cm206, int, NULL, 0);       /* base,irq or irq,base */
 #endif
 
-MODULE_PARM(cm206_base, "i");  /* base */
-MODULE_PARM(cm206_irq, "i");   /* irq */
-MODULE_PARM(cm206, "1-2i");    /* base,irq or irq,base */
-MODULE_PARM(auto_probe, "i");  /* auto probe base and irq */
+module_param(cm206_base, int, 0);      /* base */
+module_param(cm206_irq, int, 0);       /* irq */
+module_param(auto_probe, bool, 0);     /* auto probe base and irq */
 MODULE_LICENSE("GPL");
 
 #define POLLOOP 100            /* milliseconds */
index 4760f51..05c9e86 100644 (file)
@@ -464,8 +464,13 @@ static int sbpcd[] =
 static  __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock);
 static struct request_queue *sbpcd_queue;
 
-MODULE_PARM(sbpcd, "2i");
-MODULE_PARM(max_drives, "i");
+/* You can only set the first pair, from old MODULE_PARM code.  */
+static int sbpcd_set(const char *val, struct kernel_param *kp)
+{
+       get_options((char *)val, 2, (int *)sbpcd);
+       return 0;
+}
+module_param_call(sbpcd, sbpcd_set, NULL, NULL, 0);
 
 #define NUM_PROBE  (sizeof(sbpcd) / sizeof(int))
 
@@ -553,6 +558,7 @@ static unsigned char msgnum;
 static char msgbuf[80];
 
 static int max_drives = MAX_DRIVES;
+module_param(max_drives, int, 0);
 #ifndef MODULE
 static unsigned char setup_done;
 static const char *str_sb_l = "soundblaster";
index d745004..abd4c51 100644 (file)
@@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int          if_num,
        intf = ipmi_interfaces[if_num];
        if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) {
                spin_unlock_irqrestore(&interfaces_lock, flags);
-               return -EINVAL;
+               rv = -EINVAL;
+               goto out_kfree;
        }
 
        /* Note that each existing user holds a refcount to the interface. */
@@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int          if_num,
 
        if (!try_module_get(intf->handlers->owner)) {
                rv = -ENODEV;
-               goto out_err;
+               goto out_kref;
        }
 
        if (intf->handlers->inc_usecount) {
                rv = intf->handlers->inc_usecount(intf->send_info);
                if (rv) {
                        module_put(intf->handlers->owner);
-                       goto out_err;
+                       goto out_kref;
                }
        }
 
@@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int          if_num,
        *user = new_user;
        return 0;
 
- out_err:
-       kfree(new_user);
+out_kref:
        kref_put(&intf->refcount, intf_free);
+out_kfree:
+       kfree(new_user);
        return rv;
 }
 
index ede1283..e5247f8 100644 (file)
@@ -378,13 +378,13 @@ MODULE_DESCRIPTION("Stallion Intelligent Multiport Serial Driver");
 MODULE_LICENSE("GPL");
 
 
-MODULE_PARM(board0, "1-3s");
+module_param_array(board0, charp, NULL, 0);
 MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]");
-MODULE_PARM(board1, "1-3s");
+module_param_array(board1, charp, NULL, 0);
 MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]");
-MODULE_PARM(board2, "1-3s");
+module_param_array(board2, charp, NULL, 0);
 MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]");
-MODULE_PARM(board3, "1-3s");
+module_param_array(board3, charp, NULL, 0);
 MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]");
 
 #endif
index 29c41f4..26d0116 100644 (file)
@@ -216,11 +216,9 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
 
                copied = copy_from_user(ptr, buf, sz);
                if (copied) {
-                       ssize_t ret;
-
-                       ret = written + (sz - copied);
-                       if (ret)
-                               return ret;
+                       written += sz - copied;
+                       if (written)
+                               break;
                        return -EFAULT;
                }
                buf += sz;
@@ -456,11 +454,9 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
 
                copied = copy_from_user(ptr, buf, sz);
                if (copied) {
-                       ssize_t ret;
-
-                       ret = written + (sz - copied);
-                       if (ret)
-                               return ret;
+                       written += sz - copied;
+                       if (written)
+                               break;
                        return -EFAULT;
                }
                buf += sz;
@@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
                        if (len) {
                                written = copy_from_user(kbuf, buf, len);
                                if (written) {
-                                       ssize_t ret;
-
+                                       if (wrote + virtr)
+                                               break;
                                        free_page((unsigned long)kbuf);
-                                       ret = wrote + virtr + (len - written);
-                                       return ret ? ret : -EFAULT;
+                                       return -EFAULT;
                                }
                        }
                        len = vwrite(kbuf, (char *)p, len);
@@ -563,8 +558,11 @@ static ssize_t write_port(struct file * file, const char __user * buf,
                return -EFAULT;
        while (count-- > 0 && i < 65536) {
                char c;
-               if (__get_user(c, tmp)) 
+               if (__get_user(c, tmp)) {
+                       if (tmp > buf)
+                               break;
                        return -EFAULT; 
+               }
                outb(c,i);
                i++;
                tmp++;
index ea725a9..0fb2fb9 100644 (file)
@@ -243,10 +243,10 @@ static int verbose = 0;
 
 MODULE_AUTHOR("Casper Yang");
 MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver");
-MODULE_PARM(ioaddr, "1-4i");
-MODULE_PARM(ttymajor, "i");
-MODULE_PARM(calloutmajor, "i");
-MODULE_PARM(verbose, "i");
+module_param_array(ioaddr, int, NULL, 0);
+module_param(ttymajor, int, 0);
+module_param(calloutmajor, int, 0);
+module_param(verbose, bool, 0);
 MODULE_LICENSE("GPL");
 
 struct mxser_log {
index 306ee0f..bee6c47 100644 (file)
 #include <linux/parport.h>
 #include <linux/ctype.h>
 #include <linux/poll.h>
-#include <asm/uaccess.h>
+#include <linux/major.h>
 #include <linux/ppdev.h>
 #include <linux/smp_lock.h>
 #include <linux/device.h>
+#include <asm/uaccess.h>
 
 #define PP_VERSION "ppdev: user-space parallel port driver"
 #define CHRDEV "ppdev"
index 119e629..657c0d8 100644 (file)
@@ -1743,10 +1743,10 @@ static int iobase;
 static int iobase1;
 static int iobase2;
 static int iobase3;
-MODULE_PARM(iobase, "i");
-MODULE_PARM(iobase1, "i");
-MODULE_PARM(iobase2, "i");
-MODULE_PARM(iobase3, "i");
+module_param(iobase, int, 0);
+module_param(iobase1, int, 0);
+module_param(iobase2, int, 0);
+module_param(iobase3, int, 0);
 
 MODULE_LICENSE("GPL");
 #endif /* MODULE */
index d58f823..35082dc 100644 (file)
 /* Whether we react on sysrq keys or just ignore them */
 int sysrq_enabled = 1;
 
-/* Loglevel sysrq handler */
 static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs,
-                                 struct tty_struct *tty) 
+                                 struct tty_struct *tty)
 {
        int i;
        i = key - '0';
        console_loglevel = 7;
        printk("Loglevel set to %d\n", i);
        console_loglevel = i;
-}      
+}
 static struct sysrq_key_op sysrq_loglevel_op = {
        .handler        = sysrq_handle_loglevel,
        .help_msg       = "loglevel0-8",
@@ -59,11 +58,9 @@ static struct sysrq_key_op sysrq_loglevel_op = {
        .enable_mask    = SYSRQ_ENABLE_LOG,
 };
 
-
-/* SAK sysrq handler */
 #ifdef CONFIG_VT
 static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs,
-                            struct tty_struct *tty) 
+                            struct tty_struct *tty)
 {
        if (tty)
                do_SAK(tty);
@@ -75,12 +72,13 @@ static struct sysrq_key_op sysrq_SAK_op = {
        .action_msg     = "SAK",
        .enable_mask    = SYSRQ_ENABLE_KEYBOARD,
 };
+#else
+#define sysrq_SAK_op (*(struct sysrq_key_op *)0)
 #endif
 
 #ifdef CONFIG_VT
-/* unraw sysrq handler */
 static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs,
-                              struct tty_struct *tty) 
+                              struct tty_struct *tty)
 {
        struct kbd_struct *kbd = &kbd_table[fg_console];
 
@@ -93,10 +91,11 @@ static struct sysrq_key_op sysrq_unraw_op = {
        .action_msg     = "Keyboard mode set to XLATE",
        .enable_mask    = SYSRQ_ENABLE_KEYBOARD,
 };
+#else
+#define sysrq_unraw_op (*(struct sysrq_key_op *)0)
 #endif /* CONFIG_VT */
 
 #ifdef CONFIG_KEXEC
-/* crashdump sysrq handler */
 static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs,
                                struct tty_struct *tty)
 {
@@ -108,16 +107,16 @@ static struct sysrq_key_op sysrq_crashdump_op = {
        .action_msg     = "Trigger a crashdump",
        .enable_mask    = SYSRQ_ENABLE_DUMP,
 };
+#else
+#define sysrq_crashdump_op (*(struct sysrq_key_op *)0)
 #endif
 
-/* reboot sysrq handler */
 static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs,
-                               struct tty_struct *tty) 
+                               struct tty_struct *tty)
 {
        local_irq_enable();
        emergency_restart();
 }
-
 static struct sysrq_key_op sysrq_reboot_op = {
        .handler        = sysrq_handle_reboot,
        .help_msg       = "reBoot",
@@ -126,11 +125,10 @@ static struct sysrq_key_op sysrq_reboot_op = {
 };
 
 static void sysrq_handle_sync(int key, struct pt_regs *pt_regs,
-                             struct tty_struct *tty) 
+                             struct tty_struct *tty)
 {
        emergency_sync();
 }
-
 static struct sysrq_key_op sysrq_sync_op = {
        .handler        = sysrq_handle_sync,
        .help_msg       = "Sync",
@@ -139,11 +137,10 @@ static struct sysrq_key_op sysrq_sync_op = {
 };
 
 static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs,
-                                struct tty_struct *tty) 
+                                struct tty_struct *tty)
 {
        emergency_remount();
 }
-
 static struct sysrq_key_op sysrq_mountro_op = {
        .handler        = sysrq_handle_mountro,
        .help_msg       = "Unmount",
@@ -151,28 +148,23 @@ static struct sysrq_key_op sysrq_mountro_op = {
        .enable_mask    = SYSRQ_ENABLE_REMOUNT,
 };
 
-/* END SYNC SYSRQ HANDLERS BLOCK */
-
 #ifdef CONFIG_DEBUG_MUTEXES
-
-static void
-sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
+static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs,
+                               struct tty_struct *tty)
 {
        mutex_debug_show_all_locks();
 }
-
 static struct sysrq_key_op sysrq_showlocks_op = {
        .handler        = sysrq_handle_showlocks,
        .help_msg       = "show-all-locks(D)",
        .action_msg     = "Show Locks Held",
 };
-
+#else
+#define sysrq_showlocks_op (*(struct sysrq_key_op *)0)
 #endif
 
-/* SHOW SYSRQ HANDLERS BLOCK */
-
 static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs,
-                                 struct tty_struct *tty) 
+                                 struct tty_struct *tty)
 {
        if (pt_regs)
                show_regs(pt_regs);
@@ -184,9 +176,8 @@ static struct sysrq_key_op sysrq_showregs_op = {
        .enable_mask    = SYSRQ_ENABLE_DUMP,
 };
 
-
 static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs,
-                                  struct tty_struct *tty) 
+                                  struct tty_struct *tty)
 {
        show_state();
 }
@@ -197,9 +188,8 @@ static struct sysrq_key_op sysrq_showstate_op = {
        .enable_mask    = SYSRQ_ENABLE_DUMP,
 };
 
-
 static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs,
-                                struct tty_struct *tty) 
+                                struct tty_struct *tty)
 {
        show_mem();
 }
@@ -210,13 +200,9 @@ static struct sysrq_key_op sysrq_showmem_op = {
        .enable_mask    = SYSRQ_ENABLE_DUMP,
 };
 
-/* SHOW SYSRQ HANDLERS BLOCK */
-
-
-/* SIGNAL SYSRQ HANDLERS BLOCK */
-
-/* signal sysrq helper function
- * Sends a signal to all user processes */
+/*
+ * Signal sysrq helper function.  Sends a signal to all user processes.
+ */
 static void send_sig_all(int sig)
 {
        struct task_struct *p;
@@ -229,7 +215,7 @@ static void send_sig_all(int sig)
 }
 
 static void sysrq_handle_term(int key, struct pt_regs *pt_regs,
-                             struct tty_struct *tty) 
+                             struct tty_struct *tty)
 {
        send_sig_all(SIGTERM);
        console_loglevel = 8;
@@ -243,7 +229,8 @@ static struct sysrq_key_op sysrq_term_op = {
 
 static void moom_callback(void *ignored)
 {
-       out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0);
+       out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL],
+                       GFP_KERNEL, 0);
 }
 
 static DECLARE_WORK(moom_work, moom_callback, NULL);
@@ -260,7 +247,7 @@ static struct sysrq_key_op sysrq_moom_op = {
 };
 
 static void sysrq_handle_kill(int key, struct pt_regs *pt_regs,
-                             struct tty_struct *tty) 
+                             struct tty_struct *tty)
 {
        send_sig_all(SIGKILL);
        console_loglevel = 8;
@@ -272,8 +259,6 @@ static struct sysrq_key_op sysrq_kill_op = {
        .enable_mask    = SYSRQ_ENABLE_SIGNAL,
 };
 
-/* END SIGNAL SYSRQ HANDLERS BLOCK */
-
 static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs,
                                struct tty_struct *tty)
 {
@@ -288,110 +273,99 @@ static struct sysrq_key_op sysrq_unrt_op = {
 
 /* Key Operations table and lock */
 static DEFINE_SPINLOCK(sysrq_key_table_lock);
-#define SYSRQ_KEY_TABLE_LENGTH 36
-static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
-/* 0 */        &sysrq_loglevel_op,
-/* 1 */        &sysrq_loglevel_op,
-/* 2 */        &sysrq_loglevel_op,
-/* 3 */        &sysrq_loglevel_op,
-/* 4 */        &sysrq_loglevel_op,
-/* 5 */        &sysrq_loglevel_op,
-/* 6 */        &sysrq_loglevel_op,
-/* 7 */        &sysrq_loglevel_op,
-/* 8 */        &sysrq_loglevel_op,
-/* 9 */        &sysrq_loglevel_op,
-/* a */        NULL, /* Don't use for system provided sysrqs,
-                it is handled specially on the sparc
-                and will never arrive */
-/* b */        &sysrq_reboot_op,
-#ifdef CONFIG_KEXEC
-/* c */ &sysrq_crashdump_op,
-#else
-/* c */        NULL,
-#endif
-#ifdef CONFIG_DEBUG_MUTEXES
-/* d */ &sysrq_showlocks_op,
-#else
-/* d */ NULL,
-#endif
-/* e */        &sysrq_term_op,
-/* f */        &sysrq_moom_op,
-/* g */        NULL,
-/* h */        NULL,
-/* i */        &sysrq_kill_op,
-/* j */        NULL,
-#ifdef CONFIG_VT
-/* k */        &sysrq_SAK_op,
-#else
-/* k */        NULL,
-#endif
-/* l */        NULL,
-/* m */        &sysrq_showmem_op,
-/* n */        &sysrq_unrt_op,
-/* o */        NULL, /* This will often be registered
-                as 'Off' at init time */
-/* p */        &sysrq_showregs_op,
-/* q */        NULL,
-#ifdef CONFIG_VT
-/* r */        &sysrq_unraw_op,
-#else
-/* r */ NULL,
-#endif
-/* s */        &sysrq_sync_op,
-/* t */        &sysrq_showstate_op,
-/* u */        &sysrq_mountro_op,
-/* v */        NULL, /* May be assigned at init time by SMP VOYAGER */
-/* w */        NULL,
-/* x */        NULL,
-/* y */        NULL,
-/* z */        NULL
+
+static struct sysrq_key_op *sysrq_key_table[36] = {
+       &sysrq_loglevel_op,             /* 0 */
+       &sysrq_loglevel_op,             /* 1 */
+       &sysrq_loglevel_op,             /* 2 */
+       &sysrq_loglevel_op,             /* 3 */
+       &sysrq_loglevel_op,             /* 4 */
+       &sysrq_loglevel_op,             /* 5 */
+       &sysrq_loglevel_op,             /* 6 */
+       &sysrq_loglevel_op,             /* 7 */
+       &sysrq_loglevel_op,             /* 8 */
+       &sysrq_loglevel_op,             /* 9 */
+
+       /*
+        * Don't use for system provided sysrqs, it is handled specially on
+        * sparc and will never arrive
+        */
+       NULL,                           /* a */
+       &sysrq_reboot_op,               /* b */
+       &sysrq_crashdump_op,            /* c */
+       &sysrq_showlocks_op,            /* d */
+       &sysrq_term_op,                 /* e */
+       &sysrq_moom_op,                 /* f */
+       NULL,                           /* g */
+       NULL,                           /* h */
+       &sysrq_kill_op,                 /* i */
+       NULL,                           /* j */
+       &sysrq_SAK_op,                  /* k */
+       NULL,                           /* l */
+       &sysrq_showmem_op,              /* m */
+       &sysrq_unrt_op,                 /* n */
+       /* This will often be registered as 'Off' at init time */
+       NULL,                           /* o */
+       &sysrq_showregs_op,             /* p */
+       NULL,                           /* q */
+       &sysrq_unraw_op,                        /* r */
+       &sysrq_sync_op,                 /* s */
+       &sysrq_showstate_op,            /* t */
+       &sysrq_mountro_op,              /* u */
+       /* May be assigned at init time by SMP VOYAGER */
+       NULL,                           /* v */
+       NULL,                           /* w */
+       NULL,                           /* x */
+       NULL,                           /* y */
+       NULL                            /* z */
 };
 
 /* key2index calculation, -1 on invalid index */
-static int sysrq_key_table_key2index(int key) {
+static int sysrq_key_table_key2index(int key)
+{
        int retval;
-       if ((key >= '0') && (key <= '9')) {
+
+       if ((key >= '0') && (key <= '9'))
                retval = key - '0';
-       } else if ((key >= 'a') && (key <= 'z')) {
+       else if ((key >= 'a') && (key <= 'z'))
                retval = key + 10 - 'a';
-       } else {
+       else
                retval = -1;
-       }
        return retval;
 }
 
 /*
  * get and put functions for the table, exposed to modules.
  */
-
-struct sysrq_key_op *__sysrq_get_key_op (int key) {
-        struct sysrq_key_op *op_p;
+struct sysrq_key_op *__sysrq_get_key_op(int key)
+{
+        struct sysrq_key_op *op_p = NULL;
         int i;
-       
+
        i = sysrq_key_table_key2index(key);
-        op_p = (i == -1) ? NULL : sysrq_key_table[i];
+       if (i != -1)
+               op_p = sysrq_key_table[i];
         return op_p;
 }
 
-static void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) {
-        int i;
+static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p)
+{
+        int i = sysrq_key_table_key2index(key);
 
-       i = sysrq_key_table_key2index(key);
         if (i != -1)
                 sysrq_key_table[i] = op_p;
 }
 
 /*
- * This is the non-locking version of handle_sysrq
- * It must/can only be called by sysrq key handlers,
- * as they are inside of the lock
+ * This is the non-locking version of handle_sysrq.  It must/can only be called
+ * by sysrq key handlers, as they are inside of the lock
  */
-
-void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, int check_mask)
+void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty,
+                       int check_mask)
 {
        struct sysrq_key_op *op_p;
        int orig_log_level;
-       int i, j;
+       int i;
        unsigned long flags;
 
        spin_lock_irqsave(&sysrq_key_table_lock, flags);
@@ -401,26 +375,34 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in
 
         op_p = __sysrq_get_key_op(key);
         if (op_p) {
-               /* Should we check for enabled operations (/proc/sysrq-trigger should not)
-                * and is the invoked operation enabled? */
+               /*
+                * Should we check for enabled operations (/proc/sysrq-trigger
+                * should not) and is the invoked operation enabled?
+                */
                if (!check_mask || sysrq_enabled == 1 ||
                    (sysrq_enabled & op_p->enable_mask)) {
-                       printk ("%s\n", op_p->action_msg);
+                       printk("%s\n", op_p->action_msg);
                        console_loglevel = orig_log_level;
                        op_p->handler(key, pt_regs, tty);
-               }
-               else
+               } else {
                        printk("This sysrq operation is disabled.\n");
+               }
        } else {
                printk("HELP : ");
                /* Only print the help msg once per handler */
-               for (i=0; i<SYSRQ_KEY_TABLE_LENGTH; i++) 
-               if (sysrq_key_table[i]) {
-                       for (j=0; sysrq_key_table[i] != sysrq_key_table[j]; j++);
-                       if (j == i)
-                               printk ("%s ", sysrq_key_table[i]->help_msg);
+               for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) {
+                       if (sysrq_key_table[i]) {
+                               int j;
+
+                               for (j = 0; sysrq_key_table[i] !=
+                                               sysrq_key_table[j]; j++)
+                                       ;
+                               if (j != i)
+                                       continue;
+                               printk("%s ", sysrq_key_table[i]->help_msg);
+                       }
                }
-               printk ("\n");
+               printk("\n");
                console_loglevel = orig_log_level;
        }
        spin_unlock_irqrestore(&sysrq_key_table_lock, flags);
@@ -430,16 +412,17 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in
  * This function is called by the keyboard handler when SysRq is pressed
  * and any other keycode arrives.
  */
-
 void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
 {
        if (!sysrq_enabled)
                return;
        __handle_sysrq(key, pt_regs, tty, 1);
 }
+EXPORT_SYMBOL(handle_sysrq);
 
 static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p,
-                                struct sysrq_key_op *remove_op_p) {
+                                struct sysrq_key_op *remove_op_p)
+{
 
        int retval;
        unsigned long flags;
@@ -452,7 +435,6 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p,
                retval = -1;
        }
        spin_unlock_irqrestore(&sysrq_key_table_lock, flags);
-
        return retval;
 }
 
@@ -460,12 +442,10 @@ int register_sysrq_key(int key, struct sysrq_key_op *op_p)
 {
        return __sysrq_swap_key_ops(key, op_p, NULL);
 }
+EXPORT_SYMBOL(register_sysrq_key);
 
 int unregister_sysrq_key(int key, struct sysrq_key_op *op_p)
 {
        return __sysrq_swap_key_ops(key, NULL, op_p);
 }
-
-EXPORT_SYMBOL(handle_sysrq);
-EXPORT_SYMBOL(register_sysrq_key);
 EXPORT_SYMBOL(unregister_sysrq_key);
index fd3a4be..dec0224 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <linux/platform_device.h>
+#include <linux/io.h>
 
 enum tpm_timeout {
        TPM_TIMEOUT = 5,        /* msecs */
index 76592ee..48d795b 100644 (file)
@@ -354,7 +354,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
 
 EXPORT_SYMBOL_GPL(tty_buffer_request_room);
 
-int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size)
+int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size)
 {
        int copied = 0;
        do {
@@ -378,7 +378,7 @@ int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t
 
 EXPORT_SYMBOL_GPL(tty_insert_flip_string);
 
-int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size)
+int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size)
 {
        int copied = 0;
        do {
index c0dfcf2..16e99db 100644 (file)
@@ -148,6 +148,16 @@ config MPCORE_WATCHDOG
          To compile this driver as a module, choose M here: the
          module will be called mpcore_wdt.
 
+config EP93XX_WATCHDOG
+       tristate "EP93xx Watchdog"
+       depends on WATCHDOG && ARCH_EP93XX
+       help
+         Say Y here if to include support for the watchdog timer
+         embedded in the Cirrus Logic EP93xx family of devices.
+
+         To compile this driver as a module, choose M here: the
+         module will be called ep93xx_wdt.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
index 36c0b28..d6f27fd 100644 (file)
@@ -30,6 +30,7 @@ obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
 obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
 obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
 obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
+obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o
 
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c
new file mode 100644 (file)
index 0000000..9021dbb
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ * Watchdog driver for Cirrus Logic EP93xx family of devices.
+ *
+ * Copyright (c) 2004 Ray Lehtiniemi
+ * Copyright (c) 2006 Tower Technologies
+ * Based on ep93xx driver, bits from alim7101_wdt.c
+ *
+ * Authors: Ray Lehtiniemi <rayl@mail.com>,
+ *     Alessandro Zummo <a.zummo@towertech.it>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ *
+ * This watchdog fires after 250msec, which is a too short interval
+ * for us to rely on the user space daemon alone. So we ping the
+ * wdt each ~200msec and eventually stop doing it if the user space
+ * daemon dies.
+ *
+ * TODO:
+ *
+ *     - Test last reset from watchdog status
+ *     - Add a few missing ioctls
+ */
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/timer.h>
+
+#include <asm/hardware.h>
+#include <asm/uaccess.h>
+
+#define WDT_VERSION    "0.3"
+#define PFX            "ep93xx_wdt: "
+
+/* default timeout (secs) */
+#define WDT_TIMEOUT 30
+
+static int nowayout = WATCHDOG_NOWAYOUT;
+static int timeout = WDT_TIMEOUT;
+
+static struct timer_list timer;
+static unsigned long next_heartbeat;
+static unsigned long wdt_status;
+static unsigned long boot_status;
+
+#define WDT_IN_USE             0
+#define WDT_OK_TO_CLOSE                1
+
+#define EP93XX_WDT_REG(x)      (EP93XX_WATCHDOG_BASE + (x))
+#define EP93XX_WDT_WATCHDOG    EP93XX_WDT_REG(0x00)
+#define EP93XX_WDT_WDSTATUS    EP93XX_WDT_REG(0x04)
+
+/* reset the wdt every ~200ms */
+#define WDT_INTERVAL (HZ/5)
+
+static void wdt_enable(void)
+{
+       __raw_writew(0xaaaa, EP93XX_WDT_WATCHDOG);
+}
+
+static void wdt_disable(void)
+{
+       __raw_writew(0xaa55, EP93XX_WDT_WATCHDOG);
+}
+
+static inline void wdt_ping(void)
+{
+       __raw_writew(0x5555, EP93XX_WDT_WATCHDOG);
+}
+
+static void wdt_startup(void)
+{
+       next_heartbeat = jiffies + (timeout * HZ);
+
+       wdt_enable();
+       mod_timer(&timer, jiffies + WDT_INTERVAL);
+}
+
+static void wdt_shutdown(void)
+{
+       del_timer_sync(&timer);
+       wdt_disable();
+}
+
+static void wdt_keepalive(void)
+{
+       /* user land ping */
+       next_heartbeat = jiffies + (timeout * HZ);
+}
+
+static int ep93xx_wdt_open(struct inode *inode, struct file *file)
+{
+       if (test_and_set_bit(WDT_IN_USE, &wdt_status))
+               return -EBUSY;
+
+       clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+       wdt_startup();
+
+       return nonseekable_open(inode, file);
+}
+
+static ssize_t
+ep93xx_wdt_write(struct file *file, const char __user *data, size_t len,
+                loff_t *ppos)
+{
+       /* Can't seek (pwrite) on this device */
+       if (*ppos != file->f_pos)
+               return -ESPIPE;
+
+       if (len) {
+               if (!nowayout) {
+                       size_t i;
+
+                       clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+                       for (i = 0; i != len; i++) {
+                               char c;
+
+                               if (get_user(c, data + i))
+                                       return -EFAULT;
+
+                               if (c == 'V')
+                                       set_bit(WDT_OK_TO_CLOSE, &wdt_status);
+                               else
+                                       clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+                       }
+               }
+               wdt_keepalive();
+       }
+
+       return len;
+}
+
+static struct watchdog_info ident = {
+       .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE,
+       .identity = "EP93xx Watchdog",
+};
+
+static int
+ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+                unsigned long arg)
+{
+       int ret = -ENOIOCTLCMD;
+
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               ret = copy_to_user((struct watchdog_info __user *)arg, &ident,
+                               sizeof(ident)) ? -EFAULT : 0;
+               break;
+
+       case WDIOC_GETSTATUS:
+               ret = put_user(0, (int __user *)arg);
+               break;
+
+       case WDIOC_GETBOOTSTATUS:
+               ret = put_user(boot_status, (int __user *)arg);
+               break;
+
+       case WDIOC_GETTIMEOUT:
+               /* actually, it is 0.250 seconds.... */
+               ret = put_user(1, (int __user *)arg);
+               break;
+
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               ret = 0;
+               break;
+       }
+       return ret;
+}
+
+static int ep93xx_wdt_release(struct inode *inode, struct file *file)
+{
+       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
+               wdt_shutdown();
+       else
+               printk(KERN_CRIT PFX "Device closed unexpectedly - "
+                       "timer will not stop\n");
+
+       clear_bit(WDT_IN_USE, &wdt_status);
+       clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+       return 0;
+}
+
+static struct file_operations ep93xx_wdt_fops = {
+       .owner          = THIS_MODULE,
+       .write          = ep93xx_wdt_write,
+       .ioctl          = ep93xx_wdt_ioctl,
+       .open           = ep93xx_wdt_open,
+       .release        = ep93xx_wdt_release,
+};
+
+static struct miscdevice ep93xx_wdt_miscdev = {
+       .minor          = WATCHDOG_MINOR,
+       .name           = "watchdog",
+       .fops           = &ep93xx_wdt_fops,
+};
+
+static void ep93xx_timer_ping(unsigned long data)
+{
+       if (time_before(jiffies, next_heartbeat))
+               wdt_ping();
+
+       /* Re-set the timer interval */
+       mod_timer(&timer, jiffies + WDT_INTERVAL);
+}
+
+static int __init ep93xx_wdt_init(void)
+{
+       int err;
+
+       err = misc_register(&ep93xx_wdt_miscdev);
+
+       boot_status = __raw_readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0;
+
+       printk(KERN_INFO PFX "EP93XX watchdog, driver version "
+               WDT_VERSION "%s\n",
+               (__raw_readl(EP93XX_WDT_WATCHDOG) & 0x08)
+               ? " (nCS1 disable detected)" : "");
+
+       if (timeout < 1 || timeout > 3600) {
+               timeout = WDT_TIMEOUT;
+               printk(KERN_INFO PFX
+                       "timeout value must be 1<=x<=3600, using %d\n",
+                       timeout);
+       }
+
+       setup_timer(&timer, ep93xx_timer_ping, 1);
+       return err;
+}
+
+static void __exit ep93xx_wdt_exit(void)
+{
+       wdt_shutdown();
+       misc_deregister(&ep93xx_wdt_miscdev);
+}
+
+module_init(ep93xx_wdt_init);
+module_exit(ep93xx_wdt_exit);
+
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
+
+module_param(timeout, int, 0);
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+
+MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>,"
+               "Alessandro Zummo <a.zummo@towertech.it>");
+MODULE_DESCRIPTION("EP93xx Watchdog");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(WDT_VERSION);
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
index ca8e69d..e4c48e3 100644 (file)
@@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev)
         *  @drv: the driver structure to register
         *
         *  Adds the driver structure to the list of registered drivers
-        *  Returns the number of DIO devices which were claimed by the driver
-        *  during registration.  The driver remains registered even if the
-        *  return value is zero.
+        *  Returns zero or a negative error value.
         */
 
 int dio_register_driver(struct dio_driver *drv)
 {
-       int count = 0;
-
        /* initialize common driver fields */
        drv->driver.name = drv->name;
        drv->driver.bus = &dio_bus_type;
 
        /* register with core */
-       count = driver_register(&drv->driver);
-       return count ? count : 1;
+       return driver_register(&drv->driver);
 }
 
 
diff --git a/drivers/eisa/.gitignore b/drivers/eisa/.gitignore
new file mode 100644 (file)
index 0000000..4b335c0
--- /dev/null
@@ -0,0 +1 @@
+devlist.h
index 4196137..6078e2f 100644 (file)
@@ -135,13 +135,8 @@ struct bus_type eisa_bus_type = {
 
 int eisa_driver_register (struct eisa_driver *edrv)
 {
-       int r;
-       
        edrv->driver.bus = &eisa_bus_type;
-       if ((r = driver_register (&edrv->driver)) < 0)
-               return r;
-
-       return 0;
+       return driver_register (&edrv->driver);
 }
 
 void eisa_driver_unregister (struct eisa_driver *edrv)
index b2cc437..3fdab56 100644 (file)
@@ -2058,7 +2058,7 @@ static void __init parse_options (char *line)
        }
 }
 
-int init_module (void)
+int __init init_module (void)
 {
        parse_options(options);
        return ide_init();
index 8c12a97..a81f987 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
+#include <linux/interrupt.h>
 
 #ifdef CONFIG_ARM
 #include <asm/mach-types.h>
index 91dd055..4d64e5c 100644 (file)
@@ -39,7 +39,7 @@ MODULE_AUTHOR("Carsten Paeth");
 MODULE_LICENSE("GPL");
 
 static int suppress_pollack = 0;
-MODULE_PARM(suppress_pollack, "0-1i");
+module_param(suppress_pollack, bool, 0);
 
 /* ------------------------------------------------------------- */
 
index 38bd4df..80fb488 100644 (file)
@@ -169,8 +169,8 @@ static struct pci_dev isa_dev[MAX_CARDS];
 static int io[MAX_CARDS];
 static int irq[MAX_CARDS];
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
 
index 724aac2..f7253b2 100644 (file)
@@ -50,7 +50,7 @@ MODULE_DEVICE_TABLE(pci, c4_pci_tbl);
 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards");
 MODULE_AUTHOR("Carsten Paeth");
 MODULE_LICENSE("GPL");
-MODULE_PARM(suppress_pollack, "0-1i");
+module_param(suppress_pollack, bool, 0);
 
 /* ------------------------------------------------------------- */
 
index 3b701d9..5a2f854 100644 (file)
@@ -519,9 +519,9 @@ static int io[MAX_CARDS];
 static int irq[MAX_CARDS];
 static int cardnr[MAX_CARDS];
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(cardnr, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
 MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
index e19a01a..48d134b 100644 (file)
@@ -38,8 +38,8 @@ ergo_interrupt(int intno, void *dev_id, struct pt_regs *regs)
 {
        hysdn_card *card = dev_id;      /* parameter from irq */
        tErgDpram *dpr;
-       ulong flags;
-       uchar volatile b;
+       unsigned long flags;
+       unsigned char volatile b;
 
        if (!card)
                return IRQ_NONE;                /* error -> spurious interrupt */
@@ -77,7 +77,7 @@ ergo_irq_bh(hysdn_card * card)
 {
        tErgDpram *dpr;
        int again;
-       ulong flags;
+       unsigned long flags;
 
        if (card->state != CARD_STATE_RUN)
                return;         /* invalid call */
@@ -131,8 +131,8 @@ ergo_irq_bh(hysdn_card * card)
 static void
 ergo_stopcard(hysdn_card * card)
 {
-       ulong flags;
-       uchar val;
+       unsigned long flags;
+       unsigned char val;
 
        hysdn_net_release(card);        /* first release the net device if existing */
 #ifdef CONFIG_HYSDN_CAPI
@@ -157,7 +157,7 @@ ergo_stopcard(hysdn_card * card)
 static void
 ergo_set_errlog_state(hysdn_card * card, int on)
 {
-       ulong flags;
+       unsigned long flags;
 
        if (card->state != CARD_STATE_RUN) {
                card->err_log_state = ERRLOG_STATE_OFF;         /* must be off */
@@ -217,9 +217,10 @@ ergo_testram(hysdn_card * card)
 /* Negative return values are interpreted as errors.                         */
 /*****************************************************************************/
 static int
-ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs)
+ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf,
+                       unsigned long offs)
 {
-       uchar *dst;
+       unsigned char *dst;
        tErgDpram *dpram;
        int cnt = (BOOT_IMG_SIZE >> 2);         /* number of words to move and swap (byte order!) */
        
@@ -264,14 +265,14 @@ ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs)
 /* case of errors a negative error value is returned.                           */
 /********************************************************************************/
 static int
-ergo_writebootseq(struct HYSDN_CARD *card, uchar * buf, int len)
+ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len)
 {
        tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram;
-       uchar *dst;
-       uchar buflen;
+       unsigned char *dst;
+       unsigned char buflen;
        int nr_write;
-       uchar tmp_rdptr;
-       uchar wr_mirror;
+       unsigned char tmp_rdptr;
+       unsigned char wr_mirror;
        int i;
 
        if (card->debug_flags & LOG_POF_CARD)
@@ -330,7 +331,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
 {
        tErgDpram *dpr = card->dpram;   /* pointer to DPRAM structure */
        int timecnt = 10000 / 50;       /* timeout is 10 secs max. */
-       ulong flags;
+       unsigned long flags;
        int msg_size;
        int i;
 
@@ -345,7 +346,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
                        if ((dpr->ToPcChannel != CHAN_SYSTEM) ||
                            (dpr->ToPcSize < MIN_RDY_MSG_SIZE) ||
                            (dpr->ToPcSize > MAX_RDY_MSG_SIZE) ||
-                           ((*(ulong *) dpr->ToPcBuf) != RDY_MAGIC))
+                           ((*(unsigned long *) dpr->ToPcBuf) != RDY_MAGIC))
                                break;  /* an error occurred */
 
                        /* Check for additional data delivered during SysReady */
index b56ff08..c59422a 100644 (file)
 
 /* following DPRAM layout copied from OS2-driver boarderg.h */
 typedef struct ErgDpram_tag {
-/*0000 */ uchar ToHyBuf[ERG_TO_HY_BUF_SIZE];
-/*0E00 */ uchar ToPcBuf[ERG_TO_PC_BUF_SIZE];
+/*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE];
+/*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE];
 
-       /*1C00 */ uchar bSoftUart[SIZE_RSV_SOFT_UART];
+       /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART];
        /* size 0x1B0 */
 
-       /*1DB0 *//* tErrLogEntry */ uchar volatile ErrLogMsg[64];
+       /*1DB0 *//* tErrLogEntry */ unsigned char volatile ErrLogMsg[64];
        /* size 64 bytes */
-       /*1DB0  ulong ulErrType;               */
-       /*1DB4  ulong ulErrSubtype;            */
-       /*1DB8  ulong ucTextSize;              */
-       /*1DB9  ulong ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */
+       /*1DB0  unsigned long ulErrType;               */
+       /*1DB4  unsigned long ulErrSubtype;            */
+       /*1DB8  unsigned long ucTextSize;              */
+       /*1DB9  unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */
        /*1DF0 */
 
-/*1DF0 */ word volatile ToHyChannel;
-/*1DF2 */ word volatile ToHySize;
-       /*1DF4 */ uchar volatile ToHyFlag;
+/*1DF0 */ unsigned short volatile ToHyChannel;
+/*1DF2 */ unsigned short volatile ToHySize;
+       /*1DF4 */ unsigned char volatile ToHyFlag;
        /* !=0: msg for Hy waiting */
-       /*1DF5 */ uchar volatile ToPcFlag;
+       /*1DF5 */ unsigned char volatile ToPcFlag;
        /* !=0: msg for PC waiting */
-/*1DF6 */ word volatile ToPcChannel;
-/*1DF8 */ word volatile ToPcSize;
-       /*1DFA */ uchar bRes1DBA[0x1E00 - 0x1DFA];
+/*1DF6 */ unsigned short volatile ToPcChannel;
+/*1DF8 */ unsigned short volatile ToPcSize;
+       /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA];
        /* 6 bytes */
 
-/*1E00 */ uchar bRestOfEntryTbl[0x1F00 - 0x1E00];
-/*1F00 */ ulong TrapTable[62];
-       /*1FF8 */ uchar bRes1FF8[0x1FFB - 0x1FF8];
+/*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00];
+/*1F00 */ unsigned long TrapTable[62];
+       /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8];
        /* low part of reset vetor */
-/*1FFB */ uchar ToPcIntMetro;
+/*1FFB */ unsigned char ToPcIntMetro;
        /* notes:
         * - metro has 32-bit boot ram - accessing
         *   ToPcInt and ToHyInt would be the same;
@@ -65,16 +65,16 @@ typedef struct ErgDpram_tag {
         *   so E1 side should NOT change this byte
         *   when writing!
         */
-/*1FFC */ uchar volatile ToHyNoDpramErrLog;
+/*1FFC */ unsigned char volatile ToHyNoDpramErrLog;
        /* note: ToHyNoDpramErrLog is used to inform
         *       boot loader, not to use DPRAM based
         *       ErrLog; when DOS driver is rewritten
         *       this becomes obsolete
         */
-/*1FFD */ uchar bRes1FFD;
-       /*1FFE */ uchar ToPcInt;
+/*1FFD */ unsigned char bRes1FFD;
+       /*1FFE */ unsigned char ToPcInt;
        /* E1_intclear; on CHAMP2: E1_intset   */
-       /*1FFF */ uchar ToHyInt;
+       /*1FFF */ unsigned char ToHyInt;
        /* E1_intset;   on CHAMP2: E1_intclear */
 } tErgDpram;
 
index acc1d3c..6bac43c 100644 (file)
@@ -31,7 +31,7 @@
 static char hycapi_revision[]="$Revision: 1.8.6.4 $";
 
 unsigned int hycapi_enable = 0xffffffff; 
-MODULE_PARM(hycapi_enable, "i");
+module_param(hycapi_enable, uint, 0);
 
 typedef struct _hycapi_appl {
        unsigned int ctrl_mask;
@@ -523,7 +523,7 @@ New nccis are created if necessary.
 *******************************************************************/
 
 void
-hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
+hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
 {
        struct sk_buff *skb;
        hycapictrl_info *cinfo = card->hyctrlinfo;
index 7bfba19..6d0eb0f 100644 (file)
 /* needed during boot and so allocated dynamically.         */
 /************************************************************/
 struct boot_data {
-       word Cryptor;           /* for use with Decrypt function */
-       word Nrecs;             /* records remaining in file */
-       uchar pof_state;        /* actual state of read handler */
-       uchar is_crypted;       /* card data is crypted */
+       unsigned short Cryptor; /* for use with Decrypt function */
+       unsigned short Nrecs;   /* records remaining in file */
+       unsigned char pof_state;/* actual state of read handler */
+       unsigned char is_crypted;/* card data is crypted */
        int BufSize;            /* actual number of bytes bufferd */
        int last_error;         /* last occurred error */
-       word pof_recid;         /* actual pof recid */
-       ulong pof_reclen;       /* total length of pof record data */
-       ulong pof_recoffset;    /* actual offset inside pof record */
+       unsigned short pof_recid;/* actual pof recid */
+       unsigned long pof_reclen;/* total length of pof record data */
+       unsigned long pof_recoffset;/* actual offset inside pof record */
        union {
-               uchar BootBuf[BOOT_BUF_SIZE];   /* buffer as byte count */
+               unsigned char BootBuf[BOOT_BUF_SIZE];/* buffer as byte count */
                tPofRecHdr PofRecHdr;   /* header for actual record/chunk */
                tPofFileHdr PofFileHdr;         /* header from POF file */
                tPofTimeStamp PofTime;  /* time information */
@@ -69,11 +69,11 @@ StartDecryption(struct boot_data *boot)
 static void
 DecryptBuf(struct boot_data *boot, int cnt)
 {
-       uchar *bufp = boot->buf.BootBuf;
+       unsigned char *bufp = boot->buf.BootBuf;
 
        while (cnt--) {
                boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0);
-               *bufp++ ^= (uchar) boot->Cryptor;
+               *bufp++ ^= (unsigned char)boot->Cryptor;
        }
 }                              /* DecryptBuf */
 
@@ -86,7 +86,7 @@ pof_handle_data(hysdn_card * card, int datlen)
 {
        struct boot_data *boot = card->boot;    /* pointer to boot specific data */
        long l;
-       uchar *imgp;
+       unsigned char *imgp;
        int img_len;
 
        /* handle the different record types */
@@ -197,7 +197,7 @@ pof_write_buffer(hysdn_card * card, int datlen)
                                break;
                        }
                        /* Setup the new state and vars */
-                       boot->Nrecs = (word) (boot->buf.PofFileHdr.N_PofRecs);  /* limited to 65535 */
+                       boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */
                        boot->pof_state = POF_READ_TAG_HEAD;    /* now start with single tags */
                        boot->last_error = sizeof(tPofRecHdr);  /* new length */
                        break;
@@ -268,7 +268,7 @@ pof_write_buffer(hysdn_card * card, int datlen)
 /* occurred. Additionally the pointer to the buffer data area is set on success */
 /*******************************************************************************/
 int
-pof_write_open(hysdn_card * card, uchar ** bufp)
+pof_write_open(hysdn_card * card, unsigned char **bufp)
 {
        struct boot_data *boot; /* pointer to boot specific data */
 
@@ -335,7 +335,7 @@ pof_write_close(hysdn_card * card)
 /* when POF has been booted. A return value of 0 is used if no error occurred.    */
 /*********************************************************************************/
 int
-EvalSysrTokData(hysdn_card * card, uchar * cp, int len)
+EvalSysrTokData(hysdn_card *card, unsigned char *cp, int len)
 {
        u_char *p;
        u_char crc;
index 432f6f9..3a9b29b 100644 (file)
 #include <linux/workqueue.h>
 #include <linux/skbuff.h>
 
-/****************************/
-/* storage type definitions */
-/****************************/
-#define uchar unsigned char
-#define uint unsigned int
-#define ulong unsigned long
-#define word unsigned short
-
 #include "ince1pc.h"
 
 #ifdef CONFIG_HYSDN_CAPI
@@ -147,18 +139,18 @@ typedef struct HYSDN_CARD {
 
        /* general variables for the cards */
        int myid;               /* own driver card id */
-       uchar bus;              /* pci bus the card is connected to */
-       uchar devfn;            /* slot+function bit encoded */
-       word subsysid;          /* PCI subsystem id */
-       uchar brdtype;          /* type of card */
-       uint bchans;            /* number of available B-channels */
-       uint faxchans;          /* number of available fax-channels */
-       uchar mac_addr[6];      /* MAC Address read from card */
-       uint irq;               /* interrupt number */
-       uint iobase;            /* IO-port base address */
-       ulong plxbase;          /* PLX memory base */
-       ulong membase;          /* DPRAM memory base */
-       ulong memend;           /* DPRAM memory end */
+       unsigned char bus;      /* pci bus the card is connected to */
+       unsigned char devfn;    /* slot+function bit encoded */
+       unsigned short subsysid;/* PCI subsystem id */
+       unsigned char brdtype;  /* type of card */
+       unsigned int bchans;    /* number of available B-channels */
+       unsigned int faxchans;  /* number of available fax-channels */
+       unsigned char mac_addr[6];/* MAC Address read from card */
+       unsigned int irq;       /* interrupt number */
+       unsigned int iobase;    /* IO-port base address */
+       unsigned long plxbase;  /* PLX memory base */
+       unsigned long membase;  /* DPRAM memory base */
+       unsigned long memend;   /* DPRAM memory end */
        void *dpram;            /* mapped dpram */
        int state;              /* actual state of card -> CARD_STATE_** */
        struct HYSDN_CARD *next;        /* pointer to next card */
@@ -168,26 +160,26 @@ typedef struct HYSDN_CARD {
        void *procconf;         /* pointer to procconf filesystem specific data */
 
        /* debugging and logging */
-       uchar err_log_state;    /* actual error log state of the card */
-       ulong debug_flags;      /* tells what should be debugged and where */
+       unsigned char err_log_state;/* actual error log state of the card */
+       unsigned long debug_flags;/* tells what should be debugged and where */
        void (*set_errlog_state) (struct HYSDN_CARD *, int);
 
        /* interrupt handler + interrupt synchronisation */
        struct work_struct irq_queue;   /* interrupt task queue */
-       uchar volatile irq_enabled;     /* interrupt enabled if != 0 */
-       uchar volatile hw_lock; /* hardware is currently locked -> no access */
+       unsigned char volatile irq_enabled;/* interrupt enabled if != 0 */
+       unsigned char volatile hw_lock;/* hardware is currently locked -> no access */
 
        /* boot process */
        void *boot;             /* pointer to boot private data */
-       int (*writebootimg) (struct HYSDN_CARD *, uchar *, ulong);
-       int (*writebootseq) (struct HYSDN_CARD *, uchar *, int);
+       int (*writebootimg) (struct HYSDN_CARD *, unsigned char *, unsigned long);
+       int (*writebootseq) (struct HYSDN_CARD *, unsigned char *, int);
        int (*waitpofready) (struct HYSDN_CARD *);
        int (*testram) (struct HYSDN_CARD *);
 
        /* scheduler for data transfer (only async parts) */
-       uchar async_data[256];  /* async data to be sent (normally for config) */
-       word volatile async_len;        /* length of data to sent */
-       word volatile async_channel;    /* channel number for async transfer */
+       unsigned char async_data[256];/* async data to be sent (normally for config) */
+       unsigned short volatile async_len;/* length of data to sent */
+       unsigned short volatile async_channel;/* channel number for async transfer */
        int volatile async_busy;        /* flag != 0 sending in progress */
        int volatile net_tx_busy;       /* a network packet tx is in progress */
 
@@ -251,15 +243,18 @@ extern int ergo_inithardware(hysdn_card * card);  /* get hardware -> module init
 
 /* hysdn_boot.c */
 extern int pof_write_close(hysdn_card *);      /* close proc file after writing pof */
-extern int pof_write_open(hysdn_card *, uchar **);     /* open proc file for writing pof */
+extern int pof_write_open(hysdn_card *, unsigned char **);     /* open proc file for writing pof */
 extern int pof_write_buffer(hysdn_card *, int);                /* write boot data to card */
-extern int EvalSysrTokData(hysdn_card *, uchar *, int);                /* Check Sysready Token Data */
+extern int EvalSysrTokData(hysdn_card *, unsigned char *, int);                /* Check Sysready Token Data */
 
 /* hysdn_sched.c */
-extern int hysdn_sched_tx(hysdn_card *, uchar *, word volatile *, word volatile *,
-                         word);
-extern int hysdn_sched_rx(hysdn_card *, uchar *, word, word);
-extern int hysdn_tx_cfgline(hysdn_card *, uchar *, word);      /* send one cfg line */
+extern int hysdn_sched_tx(hysdn_card *, unsigned char *,
+                       unsigned short volatile *, unsigned short volatile *,
+                       unsigned short);
+extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short,
+                       unsigned short);
+extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *,
+                       unsigned short);        /* send one cfg line */
 
 /* hysdn_net.c */
 extern unsigned int hynet_enable; 
@@ -269,14 +264,16 @@ extern int hysdn_net_release(hysdn_card *);       /* delete the device */
 extern char *hysdn_net_getname(hysdn_card *);  /* get name of net interface */
 extern void hysdn_tx_netack(hysdn_card *);     /* acknowledge a packet tx */
 extern struct sk_buff *hysdn_tx_netget(hysdn_card *);  /* get next network packet */
-extern void hysdn_rx_netpkt(hysdn_card *, uchar *, word);      /* rxed packet from network */
+extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *,
+                       unsigned short);        /* rxed packet from network */
 
 #ifdef CONFIG_HYSDN_CAPI
 extern unsigned int hycapi_enable; 
 extern int hycapi_capi_create(hysdn_card *);   /* create a new capi device */
 extern int hycapi_capi_release(hysdn_card *);  /* delete the device */
 extern int hycapi_capi_stop(hysdn_card *card);   /* suspend */
-extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len);
+extern void hycapi_rx_capipkt(hysdn_card * card, unsigned char * buf,
+                               unsigned short len);
 extern void hycapi_tx_capiack(hysdn_card * card);
 extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card);
 extern int hycapi_init(void);
index cb791f8..b75ac5a 100644 (file)
@@ -41,8 +41,8 @@ hysdn_card *card_root = NULL; /* pointer to first card */
 /* the last entry contains all 0              */
 /**********************************************/
 static struct {
-       word subid;             /* PCI sub id */
-       uchar cardtyp;          /* card type assigned */
+       unsigned short subid;           /* PCI sub id */
+       unsigned char cardtyp;          /* card type assigned */
 } pci_subid_map[] = {
 
        {
index aa01628..d205249 100644 (file)
@@ -24,7 +24,7 @@
 #include "hysdn_defs.h"
 
 unsigned int hynet_enable = 0xffffffff; 
-MODULE_PARM(hynet_enable, "i");
+module_param(hynet_enable, uint, 0);
 
 /* store the actual version for log reporting */
 char *hysdn_net_revision = "$Revision: 1.8.6.4 $";
@@ -83,12 +83,12 @@ net_open(struct net_device *dev)
 
        /* Fill in the MAC-level header (if not already set) */
        if (!card->mac_addr[0]) {
-               for (i = 0; i < ETH_ALEN - sizeof(ulong); i++)
+               for (i = 0; i < ETH_ALEN - sizeof(unsigned long); i++)
                        dev->dev_addr[i] = 0xfc;
                if ((in_dev = dev->ip_ptr) != NULL) {
                        struct in_ifaddr *ifa = in_dev->ifa_list;
                        if (ifa != NULL)
-                               memcpy(dev->dev_addr + (ETH_ALEN - sizeof(ulong)), &ifa->ifa_local, sizeof(ulong));
+                               memcpy(dev->dev_addr + (ETH_ALEN - sizeof(unsigned long)), &ifa->ifa_local, sizeof(unsigned long));
                }
        } else
                memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN);
@@ -197,7 +197,7 @@ hysdn_tx_netack(hysdn_card * card)
 /* we got a packet from the network, go and queue it */
 /*****************************************************/
 void
-hysdn_rx_netpkt(hysdn_card * card, uchar * buf, word len)
+hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
 {
        struct net_local *lp = card->netif;
        struct sk_buff *skb;
index 6cd81b9..a368d6c 100644 (file)
 
 /*--------------------------------------POF file record structs------------*/
 typedef struct PofFileHdr_tag {        /* Pof file header */
-/*00 */ ulong Magic __attribute__((packed));
-/*04 */ ulong N_PofRecs __attribute__((packed));
+/*00 */ unsigned long Magic __attribute__((packed));
+/*04 */ unsigned long N_PofRecs __attribute__((packed));
 /*08 */
 } tPofFileHdr;
 
 typedef struct PofRecHdr_tag { /* Pof record header */
-/*00 */ word PofRecId __attribute__((packed));
-/*02 */ ulong PofRecDataLen __attribute__((packed));
+/*00 */ unsigned short PofRecId __attribute__((packed));
+/*02 */ unsigned long PofRecDataLen __attribute__((packed));
 /*06 */
 } tPofRecHdr;
 
 typedef struct PofTimeStamp_tag {
-/*00 */ ulong UnixTime __attribute__((packed));
-       /*04 */ uchar DateTimeText[0x28] __attribute__((packed));
+/*00 */ unsigned long UnixTime __attribute__((packed));
+       /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed));
        /* =40 */
 /*2C */
 } tPofTimeStamp;
index 40e5614..8e2b038 100644 (file)
@@ -36,9 +36,9 @@ struct conf_writedata {
        int buf_size;           /* actual number of bytes in the buffer */
        int needed_size;        /* needed size when reading pof */
        int state;              /* actual interface states from above constants */
-       uchar conf_line[CONF_LINE_LEN];         /* buffered conf line */
-       word channel;           /* active channel number */
-       uchar *pof_buffer;      /* buffer when writing pof */
+       unsigned char conf_line[CONF_LINE_LEN]; /* buffered conf line */
+       unsigned short channel;         /* active channel number */
+       unsigned char *pof_buffer;      /* buffer when writing pof */
 };
 
 /***********************************************************************/
@@ -49,7 +49,7 @@ struct conf_writedata {
 static int
 process_line(struct conf_writedata *cnf)
 {
-       uchar *cp = cnf->conf_line;
+       unsigned char *cp = cnf->conf_line;
        int i;
 
        if (cnf->card->debug_flags & LOG_CNF_LINE)
@@ -92,7 +92,7 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t
 {
        struct conf_writedata *cnf;
        int i;
-       uchar ch, *cp;
+       unsigned char ch, *cp;
 
        if (!count)
                return (0);     /* nothing to handle */
@@ -390,7 +390,7 @@ int
 hysdn_procconf_init(void)
 {
        hysdn_card *card;
-       uchar conf_name[20];
+       unsigned char conf_name[20];
 
        hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net);
        if (!hysdn_proc_entry) {
@@ -423,7 +423,7 @@ void
 hysdn_procconf_release(void)
 {
        hysdn_card *card;
-       uchar conf_name[20];
+       unsigned char conf_name[20];
 
        card = card_root;       /* start with first card */
        while (card) {
index 6c26f1e..c4301e8 100644 (file)
@@ -28,7 +28,7 @@ static void put_log_buffer(hysdn_card * card, char *cp);
 /*************************************************/
 struct log_data {
        struct log_data *next;
-       ulong usage_cnt;        /* number of files still to work */
+       unsigned long usage_cnt;/* number of files still to work */
        void *proc_ctrl;        /* pointer to own control procdata structure */
        char log_start[2];      /* log string start (final len aligned by size) */
 };
@@ -42,7 +42,7 @@ struct procdata {
        struct log_data *log_head, *log_tail;   /* head and tail for queue */
        int if_used;            /* open count for interface */
        int volatile del_lock;  /* lock for delete operations */
-       uchar logtmp[LOG_MAX_LINELEN];
+       unsigned char logtmp[LOG_MAX_LINELEN];
        wait_queue_head_t rd_queue;
 };
 
@@ -153,9 +153,9 @@ put_log_buffer(hysdn_card * card, char *cp)
 static ssize_t
 hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
 {
-       ulong u = 0;
+       unsigned long u = 0;
        int found = 0;
-       uchar *cp, valbuf[128];
+       unsigned char *cp, valbuf[128];
        long base = 10;
        hysdn_card *card = (hysdn_card *) file->private_data;
 
@@ -249,7 +249,7 @@ hysdn_log_open(struct inode *ino, struct file *filep)
 {
        hysdn_card *card;
        struct procdata *pd = NULL;
-       ulong flags;
+       unsigned long flags;
 
        lock_kernel();
        card = card_root;
index 4fa3b01..1330329 100644 (file)
@@ -30,7 +30,8 @@
 /* to keep the data until later.                                             */
 /*****************************************************************************/
 int
-hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan)
+hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len,
+                       unsigned short chan)
 {
 
        switch (chan) {
@@ -72,7 +73,9 @@ hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan)
 /* sending.                                                                  */
 /*****************************************************************************/
 int
-hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile *chan, word maxlen)
+hysdn_sched_tx(hysdn_card *card, unsigned char *buf,
+               unsigned short volatile *len, unsigned short volatile *chan,
+               unsigned short maxlen)
 {
        struct sk_buff *skb;
 
@@ -145,10 +148,10 @@ hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile
 /* are to be sent and this happens very seldom.                              */
 /*****************************************************************************/
 int
-hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan)
+hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan)
 {
        int cnt = 50;           /* timeout intervalls */
-       ulong flags;
+       unsigned long flags;
 
        if (card->debug_flags & LOG_SCHED_ASYN)
                hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1);
index 4a115a8..7a36694 100644 (file)
@@ -62,7 +62,7 @@
  *                     s. RotlCRC algorithm
  *
  *  RotlCRC algorithm:
- *      ucSum= 0                        1 uchar
+ *      ucSum= 0                        1 unsigned char
  *      for all NonEndTokenChunk bytes:
  *          ROTL(ucSum,1)               rotate left by 1
  *          ucSum += Char;              add current byte with swap around
 
 typedef struct ErrLogEntry_tag {
        
-/*00 */ ulong ulErrType;
+/*00 */ unsigned long ulErrType;
        
-/*04 */ ulong ulErrSubtype;
+/*04 */ unsigned long ulErrSubtype;
        
-/*08 */ uchar ucTextSize;
+/*08 */ unsigned char ucTextSize;
        
-       /*09 */ uchar ucText[ERRLOG_TEXT_SIZE];
+       /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE];
        /* ASCIIZ of len ucTextSize-1 */
        
 /*40 */ 
@@ -111,13 +111,13 @@ typedef struct ErrLogEntry_tag {
 #define DPRAM_SPOOLER_DATA_SIZE 0x20
 typedef struct DpramBootSpooler_tag {
        
-/*00 */ uchar Len;
+/*00 */ unsigned char Len;
        
-/*01 */ volatile uchar RdPtr;
+/*01 */ volatile unsigned char RdPtr;
        
-/*02 */ uchar WrPtr;
+/*02 */ unsigned char WrPtr;
        
-/*03 */ uchar Data[DPRAM_SPOOLER_DATA_SIZE];
+/*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
        
 /*23 */ 
 } tDpramBootSpooler;
index 1a19a0f..b9fed8a 100644 (file)
@@ -782,7 +782,8 @@ isdn_ppp_read(int min, struct file *file, char __user *buf, int count)
        is->first = b;
 
        spin_unlock_irqrestore(&is->buflock, flags);
-       copy_to_user(buf, save_buf, count);
+       if (copy_to_user(buf, save_buf, count))
+               count = -EFAULT;
        kfree(save_buf);
 
        return count;
index aeaa1db..3585fb1 100644 (file)
@@ -2345,12 +2345,15 @@ isdn_tty_at_cout(char *msg, modem_info * info)
        u_long flags;
        struct sk_buff *skb = NULL;
        char *sp = NULL;
-       int l = strlen(msg);
+       int l;
 
        if (!msg) {
                printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n");
                return;
        }
+
+       l = strlen(msg);
+
        spin_lock_irqsave(&info->readlock, flags);
        tty = info->tty;
        if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) {
index 33d3397..a67d31a 100644 (file)
@@ -22,7 +22,7 @@ static char *isdnloop_id = "loop0";
 MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
 MODULE_AUTHOR("Fritz Elfert");
 MODULE_LICENSE("GPL");
-MODULE_PARM(isdnloop_id, "s");
+module_param(isdnloop_id, charp, 0);
 MODULE_PARM_DESC(isdnloop_id, "ID-String of first card");
 
 static int isdnloop_addcard(char *);
index eae4473..670eb01 100644 (file)
@@ -556,7 +556,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
        unsigned long flags;
 
        spin_lock_irqsave(&bitmap->lock, flags);
-       if (!bitmap || !bitmap->sb_page) { /* can't set the state */
+       if (!bitmap->sb_page) { /* can't set the state */
                spin_unlock_irqrestore(&bitmap->lock, flags);
                return;
        }
index 9d340aa..6ac3b67 100644 (file)
@@ -70,10 +70,10 @@ MODULE_AUTHOR("Pauline Middelink <middelin@polyware.nl>");
 MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(triton1,"i");
-MODULE_PARM(cardtype,"1-" __MODULE_STRING(ZORAN_MAX) "i");
-MODULE_PARM(video_nr,"i");
-MODULE_PARM(vbi_nr,"i");
+module_param(triton1, uint, 0);
+module_param_array(cardtype, uint, NULL, 0);
+module_param(video_nr, int, 0);
+module_param(vbi_nr, int, 0);
 
 static int zoran_cards;
 static struct zoran zorans[ZORAN_MAX];
index 40d4ea8..5a6cca8 100644 (file)
@@ -419,58 +419,53 @@ void i2o_dump_hrt(struct i2o_controller *c)
                d = (u8 *) (rows + 2);
                state = p[1] << 8 | p[0];
 
-               printk(KERN_DEBUG "TID %04X:[", state & 0xFFF);
+               printk("TID %04X:[", state & 0xFFF);
                state >>= 12;
                if (state & (1 << 0))
-                       printk(KERN_DEBUG "H"); /* Hidden */
+                       printk("H");    /* Hidden */
                if (state & (1 << 2)) {
-                       printk(KERN_DEBUG "P"); /* Present */
+                       printk("P");    /* Present */
                        if (state & (1 << 1))
-                               printk(KERN_DEBUG "C"); /* Controlled */
+                               printk("C");    /* Controlled */
                }
                if (state > 9)
-                       printk(KERN_DEBUG "*"); /* Hard */
+                       printk("*");    /* Hard */
 
-               printk(KERN_DEBUG "]:");
+               printk("]:");
 
                switch (p[3] & 0xFFFF) {
                case 0:
                        /* Adapter private bus - easy */
-                       printk(KERN_DEBUG
-                              "Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2],
+                       printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2],
                               d[1] << 8 | d[0], *(u32 *) (d + 4));
                        break;
                case 1:
                        /* ISA bus */
-                       printk(KERN_DEBUG
-                              "ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2],
+                       printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2],
                               d[2], d[1] << 8 | d[0], *(u32 *) (d + 4));
                        break;
 
                case 2: /* EISA bus */
-                       printk(KERN_DEBUG
-                              "EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X",
+                       printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X",
                               p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4));
                        break;
 
                case 3: /* MCA bus */
-                       printk(KERN_DEBUG
-                              "MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2],
+                       printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2],
                               d[3], d[1] << 8 | d[0], *(u32 *) (d + 4));
                        break;
 
                case 4: /* PCI bus */
-                       printk(KERN_DEBUG
-                              "PCI %d: Bus %d Device %d Function %d", p[2],
+                       printk("PCI %d: Bus %d Device %d Function %d", p[2],
                               d[2], d[1], d[0]);
                        break;
 
                case 0x80:      /* Other */
                default:
-                       printk(KERN_DEBUG "Unsupported bus type.");
+                       printk("Unsupported bus type.");
                        break;
                }
-               printk(KERN_DEBUG "\n");
+               printk("\n");
                rows += length;
        }
 }
index 8d84b04..85e89c7 100644 (file)
@@ -87,7 +87,7 @@ struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
 static int dma = 1;
 
 #ifdef MODULE
-MODULE_PARM(dma, "i");
+module_param(dma, bool, 0);
 MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)");
 #endif
 
index f0f8916..f988c81 100644 (file)
@@ -28,7 +28,7 @@
 
 #ifdef CONFIG_MTD_DEBUG
 static int debug = CONFIG_MTD_DEBUG_VERBOSE;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy");
 #undef DEBUG
 #define DEBUG(n, format, arg...) \
@@ -89,17 +89,17 @@ static int mem_type;
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
 MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_PARM(bankwidth, "i");
+module_param(bankwidth, int, 0);
 MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)");
-MODULE_PARM(mem_speed, "i");
+module_param(mem_speed, int, 0);
 MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns");
-MODULE_PARM(force_size, "i");
+module_param(force_size, int, 0);
 MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)");
-MODULE_PARM(setvpp, "i");
+module_param(setvpp, int, 0);
 MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)");
-MODULE_PARM(vpp, "i");
+module_param(vpp, int, 0);
 MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)");
-MODULE_PARM(mem_type, "i");
+module_param(mem_type, int, 0);
 MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)");
 
 
index 5d11a06..d339308 100644 (file)
@@ -1096,14 +1096,18 @@ static int __init vortex_eisa_init (void)
        int orig_cards_found = vortex_cards_found;
 
 #ifdef CONFIG_EISA
-       if (eisa_driver_register (&vortex_eisa_driver) >= 0) {
-                       /* Because of the way EISA bus is probed, we cannot assume
-                        * any device have been found when we exit from
-                        * eisa_driver_register (the bus root driver may not be
-                        * initialized yet). So we blindly assume something was
-                        * found, and let the sysfs magic happend... */
-                       
-                       eisa_found = 1;
+       int err;
+
+       err = eisa_driver_register (&vortex_eisa_driver);
+       if (!err) {
+               /*
+                * Because of the way EISA bus is probed, we cannot assume
+                * any device have been found when we exit from
+                * eisa_driver_register (the bus root driver may not be
+                * initialized yet). So we blindly assume something was
+                * found, and let the sysfs magic happend...
+                */
+               eisa_found = 1;
        }
 #endif
        
index 8e538a6..79bb56b 100644 (file)
@@ -829,7 +829,7 @@ static void __devexit a2065_remove_one(struct zorro_dev *z)
 
 static int __init a2065_init_module(void)
 {
-       return zorro_module_init(&a2065_driver);
+       return zorro_register_driver(&a2065_driver);
 }
 
 static void __exit a2065_cleanup_module(void)
index 9fe93ac..d1b6b1f 100644 (file)
@@ -864,7 +864,7 @@ static void __devexit ariadne_remove_one(struct zorro_dev *z)
 
 static int __init ariadne_init_module(void)
 {
-    return zorro_module_init(&ariadne_driver);
+    return zorro_register_driver(&ariadne_driver);
 }
 
 static void __exit ariadne_cleanup_module(void)
index 0095384..5e5f80b 100644 (file)
@@ -123,7 +123,7 @@ static char version[] =
  * Global variable 'bionet_debug'. Can be set at load time by 'insmod'
  */
 unsigned int bionet_debug = NET_DEBUG;
-MODULE_PARM(bionet_debug, "i");
+module_param(bionet_debug, int, 0);
 MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)");
 MODULE_LICENSE("GPL");
 
index 8b99780..d6039e6 100644 (file)
@@ -119,7 +119,7 @@ static char *version =
  * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod'
  */
 unsigned int pamsnet_debug = NET_DEBUG;
-MODULE_PARM(pamsnet_debug, "i");
+module_param(pamsnet_debug, int, 0);
 MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)");
 MODULE_LICENSE("GPL");
 
index e01b6a7..442b2cb 100644 (file)
@@ -78,7 +78,7 @@ static int lance_debug = LANCE_DEBUG;
 #else
 static int lance_debug = 1;
 #endif
-MODULE_PARM(lance_debug, "i");
+module_param(lance_debug, int, 0);
 MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)");
 MODULE_LICENSE("GPL");
 
index 8f1573e..ac48f75 100644 (file)
 static char version[] __devinitdata =
        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
 
+static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */
+static int link_mode;
+
 MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)");
 MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver");
 MODULE_LICENSE("GPL");
-MODULE_PARM(cassini_debug, "i");
+module_param(cassini_debug, int, 0);
 MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value");
-MODULE_PARM(link_mode, "i");
+module_param(link_mode, int, 0);
 MODULE_PARM_DESC(link_mode, "default link mode");
 
 /*
@@ -209,7 +212,7 @@ MODULE_PARM_DESC(link_mode, "default link mode");
  * Value in seconds, for user input.
  */
 static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT;
-MODULE_PARM(linkdown_timeout, "i");
+module_param(linkdown_timeout, int, 0);
 MODULE_PARM_DESC(linkdown_timeout,
 "min reset interval in sec. for PCS linkdown issue; disabled if not positive");
 
@@ -221,8 +224,6 @@ MODULE_PARM_DESC(linkdown_timeout,
 static int link_transition_timeout;
 
 
-static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */
-static int link_mode;
 
 static u16 link_modes[] __devinitdata = {
        BMCR_ANENABLE,                   /* 0 : autoneg */
index 349ebe7..7fe2638 100644 (file)
@@ -124,7 +124,7 @@ MODULE_LICENSE("GPL");
 
 static int dflt_msg_enable = DFLT_MSG_ENABLE;
 
-MODULE_PARM(dflt_msg_enable, "i");
+module_param(dflt_msg_enable, int, 0);
 MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap");
 
 
index 32d1316..e175d48 100644 (file)
@@ -1551,7 +1551,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi-
 static int __init dgrs_init_module (void)
 {
        int     i;
-       int     cardcount = 0;
+       int     err;
 
        /*
         *      Command line variable overrides
@@ -1593,13 +1593,13 @@ static int __init dgrs_init_module (void)
         *      Find and configure all the cards
         */
 #ifdef CONFIG_EISA
-       cardcount = eisa_driver_register(&dgrs_eisa_driver);
-       if (cardcount < 0)
-               return cardcount;
+       err = eisa_driver_register(&dgrs_eisa_driver);
+       if (err)
+               return err;
 #endif
-       cardcount = pci_register_driver(&dgrs_pci_driver);
-       if (cardcount)
-               return cardcount;
+       err = pci_register_driver(&dgrs_pci_driver);
+       if (err)
+               return err;
        return 0;
 }
 
index b4f3a9f..7e43380 100644 (file)
@@ -55,11 +55,11 @@ MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>");
 MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(fec_8xx_debug, "i");
+int fec_8xx_debug = -1;                /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */
+module_param(fec_8xx_debug, int, 0);
 MODULE_PARM_DESC(fec_8xx_debug,
                 "FEC 8xx bitmapped debugging message enable value");
 
-int fec_8xx_debug = -1;                /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */
 
 /*************************************************/
 
index f5d49a1..196298f 100644 (file)
@@ -58,11 +58,11 @@ MODULE_DESCRIPTION("Freescale Ethernet Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_MODULE_VERSION);
 
-MODULE_PARM(fs_enet_debug, "i");
+int fs_enet_debug = -1;                /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */
+module_param(fs_enet_debug, int, 0);
 MODULE_PARM_DESC(fs_enet_debug,
                 "Freescale bitmapped debugging message enable value");
 
-int fs_enet_debug = -1;                /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */
 
 static void fs_set_multicast_list(struct net_device *dev)
 {
index 5958a63..2d24354 100644 (file)
@@ -114,8 +114,8 @@ static int max_interrupt_work = 32;
 
 static char mac0[18] = "00.02.03.04.05.06";
 static char mac1[18] = "00.01.02.03.04.05";
-MODULE_PARM(mac0, "c18");
-MODULE_PARM(mac1, "c18");
+module_param_string(mac0, mac0, 18, 0);
+module_param_string(mac1, mac0, 18, 0);
 MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0");
 MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1");
 
index c8dc402..79a8fbc 100644 (file)
@@ -280,7 +280,7 @@ static unsigned long rand;
 
 MODULE_AUTHOR("Klaus Kudielka");
 MODULE_DESCRIPTION("Driver for high-speed SCC boards");
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i");
+module_param_array(io, int, NULL, 0);
 MODULE_LICENSE("GPL");
 
 static void __exit dmascc_exit(void)
index dc5e9d5..d81a8e1 100644 (file)
@@ -1012,7 +1012,7 @@ static void __exit mkiss_exit_driver(void)
 
 MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>");
 MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs");
-MODULE_PARM(crc_force, "i");
+module_param(crc_force, int, 0);
 MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_LDISC(N_AX25);
index d841063..6856934 100644 (file)
@@ -217,7 +217,7 @@ static int hplance_close(struct net_device *dev)
 
 int __init hplance_init_module(void)
 {
-       return dio_module_init(&hplance_driver);
+       return dio_register_driver(&hplance_driver);
 }
 
 void __exit hplance_cleanup_module(void)
index 6e0ca73..d9fb8e7 100644 (file)
@@ -242,7 +242,7 @@ static void __devexit hydra_remove_one(struct zorro_dev *z)
 
 static int __init hydra_init_module(void)
 {
-    return zorro_module_init(&hydra_driver);
+    return zorro_register_driver(&hydra_driver);
 }
 
 static void __exit hydra_cleanup_module(void)
index 6070195..98fa531 100644 (file)
@@ -1118,9 +1118,9 @@ static void __exit irport_cleanup(void)
        }
 }
 
-MODULE_PARM(io, "1-4i");
+module_param_array(io, int, NULL, 0);
 MODULE_PARM_DESC(io, "Base I/O addresses");
-MODULE_PARM(irq, "1-4i");
+module_param_array(irq, int, NULL, 0);
 MODULE_PARM_DESC(irq, "IRQ lines");
 
 MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
index f7b7238..957888d 100644 (file)
@@ -177,7 +177,7 @@ static int i596_debug = (DEB_SERIOUS|DEB_PROBE);
 MODULE_AUTHOR("Richard Hirst");
 MODULE_DESCRIPTION("i82596 driver");
 MODULE_LICENSE("GPL");
-MODULE_PARM(i596_debug, "i");
+module_param(i596_debug, int, 0);
 MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask");
 
 /* Copy frames shorter than rx_copybreak, otherwise pass on up in
@@ -1520,9 +1520,9 @@ static void set_multicast_list(struct net_device *dev)
        }
 }
 
-MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug, "lasi_82596 debug mask");
 static int debug = -1;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, "lasi_82596 debug mask");
 
 static int num_drivers;
 static struct net_device *netdevs[MAX_DRIVERS];
index f65b0db..cd3c9a5 100644 (file)
@@ -629,7 +629,7 @@ static int set_mac_address(struct net_device *dev, void *addr)
 static struct net_device *dev_cs89x0;
 static int debug;
 
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)");
 MODULE_LICENSE("GPL");
 
index 2a5add2..77792b2 100644 (file)
@@ -1042,7 +1042,7 @@ static void __exit mace_cleanup(void)
 
 MODULE_AUTHOR("Paul Mackerras");
 MODULE_DESCRIPTION("PowerMac MACE driver.");
-MODULE_PARM(port_aaui, "i");
+module_param(port_aaui, int, 0);
 MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)");
 MODULE_LICENSE("GPL");
 
index e23655f..d644bf3 100644 (file)
@@ -62,7 +62,7 @@ MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
 
 #ifdef HAVE_TX_TIMEOUT
 static int timeout = TX_TIMEOUT;
-MODULE_PARM(timeout, "i");
+module_param(timeout, int, 0);
 #endif
 
 /*
index aaebd28..7ea3d59 100644 (file)
@@ -601,9 +601,9 @@ static int io[MAX_NE_CARDS];
 static int irq[MAX_NE_CARDS];
 static int bad[MAX_NE_CARDS];  /* 0xbad = bad sig or no reset ack */
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(bad, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver");
index 2ab01a5..a68bf47 100644 (file)
@@ -766,8 +766,8 @@ static void ni5010_show_registers(struct net_device *dev)
 #ifdef MODULE
 static struct net_device *dev_ni5010;
 
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
+module_param(io, int, 0);
+module_param(irq, int, 0);
 MODULE_PARM_DESC(io, "ni5010 I/O base address");
 MODULE_PARM_DESC(irq, "ni5010 IRQ number");
 
index 01bdb23..d4c0002 100644 (file)
@@ -71,7 +71,7 @@ static int lance_debug = LANCE_DEBUG;
 #else
 static int lance_debug = 1;
 #endif
-MODULE_PARM(lance_debug, "i");
+module_param(lance_debug, int, 0);
 MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)");
 MODULE_LICENSE("GPL");
 
index 7610216..8037e58 100644 (file)
@@ -426,7 +426,7 @@ static void __devexit zorro8390_remove_one(struct zorro_dev *z)
 
 static int __init zorro8390_init_module(void)
 {
-    return zorro_module_init(&zorro8390_driver);
+    return zorro_register_driver(&zorro8390_driver);
 }
 
 static void __exit zorro8390_cleanup_module(void)
index 57fd603..b1b4b68 100644 (file)
@@ -646,8 +646,10 @@ static int __init isapnp_create_device(struct pnp_card *card,
                                size = 0;
                                skip = 0;
                                option = pnp_register_independent_option(dev);
-                               if (!option)
+                               if (!option) {
+                                       kfree(dev);
                                        return 1;
+                               }
                                pnp_add_card_device(card,dev);
                        } else {
                                skip = 1;
index dfe542b..7967916 100644 (file)
@@ -43,7 +43,6 @@ MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>");
 MODULE_DESCRIPTION("Linux on S/390 DASD device driver,"
                   " Copyright 2000 IBM Corporation");
 MODULE_SUPPORTED_DEVICE("dasd");
-MODULE_PARM(dasd, "1-" __MODULE_STRING(256) "s");
 MODULE_LICENSE("GPL");
 
 /*
index f576f24..2f72010 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/config.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
+#include <linux/module.h>
 
 #include <asm/debug.h>
 #include <asm/uaccess.h>
@@ -69,6 +70,8 @@ int dasd_autodetect = 0;      /* is true, when autodetection is active */
  * strings when running as a module.
  */
 static char *dasd[256];
+module_param_array(dasd, charp, NULL, 0);
+
 /*
  * Single spinlock to protect devmap structures and lists.
  */
index 583d2d8..fad2109 100644 (file)
@@ -550,6 +550,6 @@ module_exit(cumanascsi2_exit);
 
 MODULE_AUTHOR("Russell King");
 MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines");
-MODULE_PARM(term, "1-8i");
+module_param_array(term, int, NULL, 0);
 MODULE_PARM_DESC(term, "SCSI bus termination");
 MODULE_LICENSE("GPL");
index 3ffec7e..dcbb4b2 100644 (file)
@@ -674,6 +674,6 @@ module_exit(eesox_exit);
 
 MODULE_AUTHOR("Russell King");
 MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines");
-MODULE_PARM(term, "1-8i");
+module_param_array(term, int, NULL, 0);
 MODULE_PARM_DESC(term, "SCSI bus termination");
 MODULE_LICENSE("GPL");
index 3113bdc..3d69f6c 100644 (file)
@@ -466,6 +466,6 @@ module_exit(powertecscsi_exit);
 
 MODULE_AUTHOR("Russell King");
 MODULE_DESCRIPTION("Powertec SCSI driver");
-MODULE_PARM(term, "1-8i");
+module_param_array(term, int, NULL, 0);
 MODULE_PARM_DESC(term, "SCSI bus termination");
 MODULE_LICENSE("GPL");
index f4c1ca7..f677c5a 100644 (file)
@@ -239,17 +239,17 @@ static int atari_read_overruns = 0;
 #endif
 
 static int setup_can_queue = -1;
-MODULE_PARM(setup_can_queue, "i");
+module_param(setup_can_queue, int, 0);
 static int setup_cmd_per_lun = -1;
-MODULE_PARM(setup_cmd_per_lun, "i");
+module_param(setup_cmd_per_lun, int, 0);
 static int setup_sg_tablesize = -1;
-MODULE_PARM(setup_sg_tablesize, "i");
+module_param(setup_sg_tablesize, int, 0);
 #ifdef SUPPORT_TAGS
 static int setup_use_tagged_queuing = -1;
-MODULE_PARM(setup_use_tagged_queuing, "i");
+module_param(setup_use_tagged_queuing, int, 0);
 #endif
 static int setup_hostid = -1;
-MODULE_PARM(setup_hostid, "i");
+module_param(setup_hostid, int, 0);
 
 
 #if defined(CONFIG_TT_DMA_EMUL)
index 024ef86..c647d85 100644 (file)
@@ -190,7 +190,7 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf,
        if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT,
                            SD_MAX_RETRIES, &data, NULL))
                return -EINVAL;
-       len = min(sizeof(buffer), data.length - data.header_length -
+       len = min_t(size_t, sizeof(buffer), data.length - data.header_length -
                  data.block_descriptor_length);
        buffer_data = buffer + data.header_length +
                data.block_descriptor_length;
index 4315afe..53e81a4 100644 (file)
@@ -55,6 +55,8 @@ static struct dio_driver hpdca_driver = {
 
 #endif
 
+static unsigned int num_ports;
+
 extern int hp300_uart_scode;
 
 /* Offset to UART registers from base of DCA */
@@ -199,6 +201,8 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
        out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff);
        udelay(100);
 
+       num_ports++;
+
        return 0;
 }
 #endif
@@ -206,7 +210,6 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
 static int __init hp300_8250_init(void)
 {
        static int called = 0;
-       int num_ports;
 #ifdef CONFIG_HPAPCI
        int line;
        unsigned long base;
@@ -221,11 +224,8 @@ static int __init hp300_8250_init(void)
        if (!MACH_IS_HP300)
                return -ENODEV;
 
-       num_ports = 0;
-
 #ifdef CONFIG_HPDCA
-       if (dio_module_init(&hpdca_driver) == 0)
-               num_ports++;
+       dio_register_driver(&hpdca_driver);
 #endif
 #ifdef CONFIG_HPAPCI
        if (hp300_model < HP_400) {
index a37579c..c620209 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2003-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (C) 2003-2006 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
@@ -323,9 +323,12 @@ static unsigned int Num_of_ioc4_cards;
 #define IOC4_FIFO_CHARS        255
 
 /* Device name we're using */
-#define DEVICE_NAME    "ttyIOC"
-#define DEVICE_MAJOR 204
-#define DEVICE_MINOR 50
+#define DEVICE_NAME_RS232  "ttyIOC"
+#define DEVICE_NAME_RS422  "ttyAIOC"
+#define DEVICE_MAJOR      204
+#define DEVICE_MINOR_RS232 50
+#define DEVICE_MINOR_RS422 84
+
 
 /* register offsets */
 #define IOC4_SERIAL_OFFSET     0x300
@@ -341,10 +344,8 @@ static unsigned int Num_of_ioc4_cards;
 #define MAX_BAUD_SUPPORTED     115200
 
 /* protocol types supported */
-enum sio_proto {
-       PROTO_RS232,
-       PROTO_RS422
-};
+#define PROTO_RS232    3
+#define PROTO_RS422    7
 
 /* Notification types */
 #define N_DATA_READY   0x01
@@ -395,11 +396,17 @@ enum sio_proto {
 /*
  * This is the entry saved by the driver - one per card
  */
+
+#define UART_PORT_MIN          0
+#define UART_PORT_RS232                UART_PORT_MIN
+#define UART_PORT_RS422                1
+#define UART_PORT_COUNT                2       /* one for each mode */
+
 struct ioc4_control {
        int ic_irq;
        struct {
-               /* uart ports are allocated here */
-               struct uart_port icp_uart_port;
+               /* uart ports are allocated here - 1 for rs232, 1 for rs422 */
+               struct uart_port icp_uart_port[UART_PORT_COUNT];
                /* Handy reference material */
                struct ioc4_port *icp_port;
        } ic_port[IOC4_NUM_SERIAL_PORTS];
@@ -443,7 +450,9 @@ struct ioc4_soft {
 
 /* Local port info for each IOC4 serial ports */
 struct ioc4_port {
-       struct uart_port *ip_port;
+       struct uart_port *ip_port;      /* current active port ptr */
+       /* Ptrs for all ports */
+       struct uart_port *ip_all_ports[UART_PORT_COUNT];
        /* Back ptrs for this port */
        struct ioc4_control *ip_control;
        struct pci_dev *ip_pdev;
@@ -502,6 +511,9 @@ struct ioc4_port {
 #define DCD_ON         0x02
 #define LOWAT_WRITTEN  0x04
 #define READ_ABORTED   0x08
+#define PORT_ACTIVE    0x10
+#define PORT_INACTIVE  0       /* This is the value when "off" */
+
 
 /* Since each port has different register offsets and bitmasks
  * for everything, we'll store those that we need in tables so we
@@ -623,6 +635,23 @@ struct ring_buffer {
 static void receive_chars(struct uart_port *);
 static void handle_intr(void *arg, uint32_t sio_ir);
 
+/*
+ * port_is_active - determines if this port is currently active
+ * @port: ptr to soft struct for this port
+ * @uart_port: uart port to test for
+ */
+static inline int port_is_active(struct ioc4_port *port,
+               struct uart_port *uart_port)
+{
+       if (port) {
+               if ((port->ip_flags & PORT_ACTIVE)
+                                       && (port->ip_port == uart_port))
+                       return 1;
+       }
+       return 0;
+}
+
+
 /**
  * write_ireg - write the interrupt regs
  * @ioc4_soft: ptr to soft struct for this port
@@ -708,19 +737,33 @@ static int set_baud(struct ioc4_port *port, int baud)
 /**
  * get_ioc4_port - given a uart port, return the control structure
  * @port: uart port
+ * @set: set this port as current
  */
-static struct ioc4_port *get_ioc4_port(struct uart_port *the_port)
+static struct ioc4_port *get_ioc4_port(struct uart_port *the_port, int set)
 {
        struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev);
        struct ioc4_control *control = idd->idd_serial_data;
-       int ii;
+       struct ioc4_port *port;
+       int port_num, port_type;
 
        if (control) {
-               for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ ) {
-                       if (!control->ic_port[ii].icp_port)
+               for ( port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS;
+                                                       port_num++ ) {
+                       port = control->ic_port[port_num].icp_port;
+                       if (!port)
                                continue;
-                       if (the_port == control->ic_port[ii].icp_port->ip_port)
-                               return control->ic_port[ii].icp_port;
+                       for (port_type = UART_PORT_MIN;
+                                               port_type < UART_PORT_COUNT;
+                                               port_type++) {
+                               if (the_port == port->ip_all_ports
+                                                       [port_type]) {
+                                       /* set local copy */
+                                       if (set) {
+                                               port->ip_port = the_port;
+                                       }
+                                       return port;
+                               }
+                       }
                }
        }
        return NULL;
@@ -946,6 +989,7 @@ intr_connect(struct ioc4_soft *soft, int type,
  * @arg: handler arg
  * @regs: registers
  */
+
 static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
 {
        struct ioc4_soft *soft;
@@ -953,7 +997,7 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
        int xx, num_intrs = 0;
        int intr_type;
        int handled = 0;
-       struct ioc4_intr_info *ii;
+       struct ioc4_intr_info *intr_info;
 
        soft = arg;
        for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) {
@@ -966,13 +1010,13 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
                 * which interrupt bits are set.
                 */
                for (xx = 0; xx < num_intrs; xx++) {
-                       ii = &soft->is_intr_type[intr_type].is_intr_info[xx];
-                       if ((this_mir = this_ir & ii->sd_bits)) {
+                       intr_info = &soft->is_intr_type[intr_type].is_intr_info[xx];
+                       if ((this_mir = this_ir & intr_info->sd_bits)) {
                                /* Disable owned interrupts, call handler */
                                handled++;
-                               write_ireg(soft, ii->sd_bits, IOC4_W_IEC,
+                               write_ireg(soft, intr_info->sd_bits, IOC4_W_IEC,
                                                                intr_type);
-                               ii->sd_intr(ii->sd_info, this_mir);
+                               intr_info->sd_intr(intr_info->sd_info, this_mir);
                                this_ir &= ~this_mir;
                        }
                }
@@ -980,7 +1024,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
 #ifdef DEBUG_INTERRUPTS
        {
                struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr;
-               spinlock_t *lp = &soft->is_ir_lock;
                unsigned long flag;
 
                spin_lock_irqsave(&soft->is_ir_lock, flag);
@@ -1177,7 +1220,7 @@ static inline int local_open(struct ioc4_port *port)
 {
        int spiniter = 0;
 
-       port->ip_flags = 0;
+       port->ip_flags = PORT_ACTIVE;
 
        /* Pause the DMA interface if necessary */
        if (port->ip_sscr & IOC4_SSCR_DMA_EN) {
@@ -1187,6 +1230,7 @@ static inline int local_open(struct ioc4_port *port)
                                & IOC4_SSCR_PAUSE_STATE) == 0) {
                        spiniter++;
                        if (spiniter > MAXITER) {
+                               port->ip_flags = PORT_INACTIVE;
                                return -1;
                        }
                }
@@ -1506,14 +1550,13 @@ static int set_notification(struct ioc4_port *port, int mask, int set_on)
 /**
  * set_mcr - set the master control reg
  * @the_port: port to use
- * @set: set ?
  * @mask1: mcr mask
  * @mask2: shadow mask
  */
-static inline int set_mcr(struct uart_port *the_port, int set,
+static inline int set_mcr(struct uart_port *the_port,
                int mask1, int mask2)
 {
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
        uint32_t shadow;
        int spiniter = 0;
        char mcr;
@@ -1536,13 +1579,9 @@ static inline int set_mcr(struct uart_port *the_port, int set,
        mcr = (shadow & 0xff000000) >> 24;
 
        /* Set new value */
-       if (set) {
-               mcr |= mask1;
-               shadow |= mask2;
-       } else {
-               mcr &= ~mask1;
-               shadow &= ~mask2;
-       }
+       mcr |= mask1;
+       shadow |= mask2;
+
        writeb(mcr, &port->ip_uart_regs->i4u_mcr);
        writel(shadow, &port->ip_serial_regs->shadow);
 
@@ -1558,7 +1597,7 @@ static inline int set_mcr(struct uart_port *the_port, int set,
  * @port: port to use
  * @proto: protocol to use
  */
-static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto)
+static int ioc4_set_proto(struct ioc4_port *port, int proto)
 {
        struct hooks *hooks = port->ip_hooks;
 
@@ -1589,7 +1628,7 @@ static void transmit_chars(struct uart_port *the_port)
        int result;
        char *start;
        struct tty_struct *tty;
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
        struct uart_info *info;
 
        if (!the_port)
@@ -1645,7 +1684,7 @@ static void
 ioc4_change_speed(struct uart_port *the_port,
                  struct termios *new_termios, struct termios *old_termios)
 {
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
        int baud, bits;
        unsigned cflag;
        int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
@@ -1752,7 +1791,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
        if (!the_port)
                return -1;
 
-       port = get_ioc4_port(the_port);
+       port = get_ioc4_port(the_port, 0);
        if (!port)
                return -1;
 
@@ -1760,6 +1799,9 @@ static inline int ic4_startup_local(struct uart_port *the_port)
 
        local_open(port);
 
+       /* set the protocol - mapbase has the port type */
+       ioc4_set_proto(port, the_port->mapbase);
+
        /* set the speed of the serial port */
        ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0);
 
@@ -1768,17 +1810,17 @@ static inline int ic4_startup_local(struct uart_port *the_port)
 
 /*
  * ioc4_cb_output_lowat - called when the output low water mark is hit
- * @port: port to output
+ * @the_port: port to output
  */
-static void ioc4_cb_output_lowat(struct ioc4_port *port)
+static void ioc4_cb_output_lowat(struct uart_port *the_port)
 {
        unsigned long pflags;
 
        /* ip_lock is set on the call here */
-       if (port->ip_port) {
-               spin_lock_irqsave(&port->ip_port->lock, pflags);
-               transmit_chars(port->ip_port);
-               spin_unlock_irqrestore(&port->ip_port->lock, pflags);
+       if (the_port) {
+               spin_lock_irqsave(&the_port->lock, pflags);
+               transmit_chars(the_port);
+               spin_unlock_irqrestore(&the_port->lock, pflags);
        }
 }
 
@@ -1923,7 +1965,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
                                        &port->ip_mem->sio_ir.raw);
 
                        if (port->ip_notify & N_OUTPUT_LOWAT)
-                               ioc4_cb_output_lowat(port);
+                               ioc4_cb_output_lowat(port->ip_port);
                }
 
                /* Handle tx_mt.  Must come after tx_explicit.  */
@@ -1936,7 +1978,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
                         * So send the notification now.
                         */
                        if (port->ip_notify & N_OUTPUT_LOWAT) {
-                               ioc4_cb_output_lowat(port);
+                               ioc4_cb_output_lowat(port->ip_port);
 
                                /* We need to reload the sio_ir since the lowat
                                 * call may have caused another write to occur,
@@ -2023,7 +2065,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
                                int len)
 {
        int prod_ptr, cons_ptr, total;
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
        struct ring *inring;
        struct ring_entry *entry;
        struct hooks *hooks = port->ip_hooks;
@@ -2335,17 +2377,27 @@ static void receive_chars(struct uart_port *the_port)
  */
 static const char *ic4_type(struct uart_port *the_port)
 {
-       return "SGI IOC4 Serial";
+       if (the_port->mapbase == PROTO_RS232)
+               return "SGI IOC4 Serial [rs232]";
+       else
+               return "SGI IOC4 Serial [rs422]";
 }
 
 /**
- * ic4_tx_empty - Is the transmitter empty?  We pretend we're always empty
- * @port: Port to operate on (we ignore since we always return 1)
+ * ic4_tx_empty - Is the transmitter empty?
+ * @port: Port to operate on
  *
  */
 static unsigned int ic4_tx_empty(struct uart_port *the_port)
 {
-       return 1;
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
+       unsigned int ret = 0;
+
+       if (port_is_active(port, the_port)) {
+               if (readl(&port->ip_serial_regs->shadow) & IOC4_SHADOW_TEMT)
+                       ret = TIOCSER_TEMT;
+       }
+       return ret;
 }
 
 /**
@@ -2355,6 +2407,10 @@ static unsigned int ic4_tx_empty(struct uart_port *the_port)
  */
 static void ic4_stop_tx(struct uart_port *the_port)
 {
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
+
+       if (port_is_active(port, the_port))
+               set_notification(port, N_OUTPUT_LOWAT, 0);
 }
 
 /**
@@ -2377,11 +2433,12 @@ static void ic4_shutdown(struct uart_port *the_port)
        struct ioc4_port *port;
        struct uart_info *info;
 
-       port = get_ioc4_port(the_port);
+       port = get_ioc4_port(the_port, 0);
        if (!port)
                return;
 
        info = the_port->info;
+       port->ip_port = NULL;
 
        wake_up_interruptible(&info->delta_msr_wait);
 
@@ -2390,6 +2447,7 @@ static void ic4_shutdown(struct uart_port *the_port)
 
        spin_lock_irqsave(&the_port->lock, port_flags);
        set_notification(port, N_ALL, 0);
+       port->ip_flags = PORT_INACTIVE;
        spin_unlock_irqrestore(&the_port->lock, port_flags);
 }
 
@@ -2402,6 +2460,11 @@ static void ic4_shutdown(struct uart_port *the_port)
 static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl)
 {
        unsigned char mcr = 0;
+       struct ioc4_port *port;
+
+       port = get_ioc4_port(the_port, 0);
+       if (!port_is_active(port, the_port))
+               return;
 
        if (mctrl & TIOCM_RTS)
                mcr |= UART_MCR_RTS;
@@ -2414,7 +2477,7 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl)
        if (mctrl & TIOCM_LOOP)
                mcr |= UART_MCR_LOOP;
 
-       set_mcr(the_port, 1, mcr, IOC4_SHADOW_DTR);
+       set_mcr(the_port, mcr, IOC4_SHADOW_DTR);
 }
 
 /**
@@ -2424,11 +2487,11 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl)
  */
 static unsigned int ic4_get_mctrl(struct uart_port *the_port)
 {
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
        uint32_t shadow;
        unsigned int ret = 0;
 
-       if (!port)
+       if (!port_is_active(port, the_port))
                return 0;
 
        shadow = readl(&port->ip_serial_regs->shadow);
@@ -2448,9 +2511,9 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port)
  */
 static void ic4_start_tx(struct uart_port *the_port)
 {
-       struct ioc4_port *port = get_ioc4_port(the_port);
+       struct ioc4_port *port = get_ioc4_port(the_port, 0);
 
-       if (port) {
+       if (port_is_active(port, the_port)) {
                set_notification(port, N_OUTPUT_LOWAT, 1);
                enable_intrs(port, port->ip_hooks->intr_tx_mt);
        }
@@ -2467,7 +2530,7 @@ static void ic4_break_ctl(struct uart_port *the_port, int break_state)
 }
 
 /**
- * ic4_startup - Start up the serial port - always return 0 (We're always on)
+ * ic4_startup - Start up the serial port
  * @port: Port to operate on
  *
  */
@@ -2479,17 +2542,16 @@ static int ic4_startup(struct uart_port *the_port)
        struct uart_info *info;
        unsigned long port_flags;
 
-       if (!the_port) {
+       if (!the_port)
                return -ENODEV;
-       }
-       port = get_ioc4_port(the_port);
-       if (!port) {
+       port = get_ioc4_port(the_port, 1);
+       if (!port)
                return -ENODEV;
-       }
        info = the_port->info;
 
        control = port->ip_control;
        if (!control) {
+               port->ip_port = NULL;
                return -ENODEV;
        }
 
@@ -2551,28 +2613,104 @@ static struct uart_ops ioc4_ops = {
  * Boot-time initialization code
  */
 
-static struct uart_driver ioc4_uart = {
+static struct uart_driver ioc4_uart_rs232 = {
        .owner          = THIS_MODULE,
-       .driver_name    = "ioc4_serial",
-       .dev_name       = DEVICE_NAME,
+       .driver_name    = "ioc4_serial_rs232",
+       .dev_name       = DEVICE_NAME_RS232,
        .major          = DEVICE_MAJOR,
-       .minor          = DEVICE_MINOR,
+       .minor          = DEVICE_MINOR_RS232,
        .nr             = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS,
 };
 
+static struct uart_driver ioc4_uart_rs422 = {
+       .owner          = THIS_MODULE,
+       .driver_name    = "ioc4_serial_rs422",
+       .dev_name       = DEVICE_NAME_RS422,
+       .major          = DEVICE_MAJOR,
+       .minor          = DEVICE_MINOR_RS422,
+       .nr             = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS,
+};
+
+
 /**
- * ioc4_serial_core_attach - register with serial core
+ * ioc4_serial_remove_one - detach function
+ *
+ * @idd: IOC4 master module data for this IOC4
+ */
+
+static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
+{
+       int port_num, port_type;
+       struct ioc4_control *control;
+       struct uart_port *the_port;
+       struct ioc4_port *port;
+       struct ioc4_soft *soft;
+
+       control = idd->idd_serial_data;
+
+       for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) {
+               for (port_type = UART_PORT_MIN;
+                                       port_type < UART_PORT_COUNT;
+                                       port_type++) {
+                       the_port = &control->ic_port[port_num].icp_uart_port
+                                                       [port_type];
+                       if (the_port) {
+                               switch (port_type) {
+                               case UART_PORT_RS422:
+                                       uart_remove_one_port(&ioc4_uart_rs422,
+                                                       the_port);
+                                       break;
+                               default:
+                               case UART_PORT_RS232:
+                                       uart_remove_one_port(&ioc4_uart_rs232,
+                                                       the_port);
+                                       break;
+                               }
+                       }
+               }
+               port = control->ic_port[port_num].icp_port;
+               /* we allocate in pairs */
+               if (!(port_num & 1) && port) {
+                       pci_free_consistent(port->ip_pdev,
+                                       TOTAL_RING_BUF_SIZE,
+                                       port->ip_cpu_ringbuf,
+                                       port->ip_dma_ringbuf);
+                       kfree(port);
+               }
+       }
+       soft = control->ic_soft;
+       if (soft) {
+               free_irq(control->ic_irq, soft);
+               if (soft->is_ioc4_serial_addr) {
+                       release_region((unsigned long)
+                            soft->is_ioc4_serial_addr,
+                               sizeof(struct ioc4_serial));
+               }
+               kfree(soft);
+       }
+       kfree(control);
+       idd->idd_serial_data = NULL;
+
+       return 0;
+}
+
+
+/**
+ * ioc4_serial_core_attach_rs232 - register with serial core
  *             This is done during pci probing
  * @pdev: handle for this card
  */
 static inline int
-ioc4_serial_core_attach(struct pci_dev *pdev)
+ioc4_serial_core_attach(struct pci_dev *pdev, int port_type)
 {
        struct ioc4_port *port;
        struct uart_port *the_port;
        struct ioc4_driver_data *idd = pci_get_drvdata(pdev);
        struct ioc4_control *control = idd->idd_serial_data;
-       int ii;
+       int port_num;
+       int port_type_idx;
+       struct uart_driver *u_driver;
+
 
        DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n",
                        __FUNCTION__, pdev, (void *)control));
@@ -2580,28 +2718,36 @@ ioc4_serial_core_attach(struct pci_dev *pdev)
        if (!control)
                return -ENODEV;
 
+       port_type_idx = (port_type == PROTO_RS232) ? UART_PORT_RS232
+                                               : UART_PORT_RS422;
+
+       u_driver = (port_type == PROTO_RS232)   ? &ioc4_uart_rs232
+                                               : &ioc4_uart_rs422;
+
        /* once around for each port on this card */
-       for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) {
-               the_port = &control->ic_port[ii].icp_uart_port;
-               port = control->ic_port[ii].icp_port;
-               port->ip_port = the_port;
+       for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) {
+               the_port = &control->ic_port[port_num].icp_uart_port
+                                                       [port_type_idx];
+               port = control->ic_port[port_num].icp_port;
+               port->ip_all_ports[port_type_idx] = the_port;
 
-               DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p\n",
+               DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p : type %s\n",
                                __FUNCTION__, (void *)the_port,
-                               (void *)port));
+                               (void *)port,
+                               port_type == PROTO_RS232 ? "rs232" : "rs422"));
 
                /* membase, iobase and mapbase just need to be non-0 */
                the_port->membase = (unsigned char __iomem *)1;
-               the_port->iobase = (pdev->bus->number << 16) |  ii;
-               the_port->line = (Num_of_ioc4_cards << 2) | ii;
-               the_port->mapbase = 1;
+               the_port->iobase = (pdev->bus->number << 16) |  port_num;
+               the_port->line = (Num_of_ioc4_cards << 2) | port_num;
+               the_port->mapbase = port_type;
                the_port->type = PORT_16550A;
                the_port->fifosize = IOC4_FIFO_CHARS;
                the_port->ops = &ioc4_ops;
                the_port->irq = control->ic_irq;
                the_port->dev = &pdev->dev;
                spin_lock_init(&the_port->lock);
-               if (uart_add_one_port(&ioc4_uart, the_port) < 0) {
+               if (uart_add_one_port(u_driver, the_port) < 0) {
                        printk(KERN_WARNING
                           "%s: unable to add port %d bus %d\n",
                               __FUNCTION__, the_port->line, pdev->bus->number);
@@ -2610,8 +2756,6 @@ ioc4_serial_core_attach(struct pci_dev *pdev)
                            ("IOC4 serial port %d irq = %d, bus %d\n",
                               the_port->line, the_port->irq, pdev->bus->number));
                }
-               /* all ports are rs232 for now */
-               ioc4_set_proto(port, PROTO_RS232);
        }
        return 0;
 }
@@ -2631,7 +2775,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
        int ret = 0;
 
 
-       DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id));
+       DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev,
+                                                       idd->idd_pci_id));
 
        /* request serial registers */
        tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET;
@@ -2653,11 +2798,11 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
                goto out2;
        }
        DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n",
-                               __FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial));
+                               __FUNCTION__, (void *)idd->idd_misc_regs,
+                               (void *)serial));
 
        /* Get memory for the new card */
-       control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS,
-                                               GFP_KERNEL);
+       control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL);
 
        if (!control) {
                printk(KERN_WARNING "ioc4_attach_one"
@@ -2702,7 +2847,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
 
        /* Hook up interrupt handler */
        if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ,
-                               "sgi-ioc4serial", (void *)soft)) {
+                               "sgi-ioc4serial", soft)) {
                control->ic_irq = idd->idd_pdev->irq;
        } else {
                printk(KERN_WARNING
@@ -2713,16 +2858,21 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
        if (ret)
                goto out4;
 
-       /* register port with the serial core */
+       /* register port with the serial core - 1 rs232, 1 rs422 */
 
-       if ((ret = ioc4_serial_core_attach(idd->idd_pdev)))
+       if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS232)))
                goto out4;
 
+       if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS422)))
+               goto out5;
+
        Num_of_ioc4_cards++;
 
        return ret;
 
        /* error exits that give back resources */
+out5:
+       ioc4_serial_remove_one(idd);
 out4:
        kfree(soft);
 out3:
@@ -2735,52 +2885,6 @@ out1:
 }
 
 
-/**
- * ioc4_serial_remove_one - detach function
- *
- * @idd: IOC4 master module data for this IOC4
- */
-
-int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
-{
-       int ii;
-       struct ioc4_control *control;
-       struct uart_port *the_port;
-       struct ioc4_port *port;
-       struct ioc4_soft *soft;
-
-       control = idd->idd_serial_data;
-
-       for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) {
-               the_port = &control->ic_port[ii].icp_uart_port;
-               if (the_port) {
-                       uart_remove_one_port(&ioc4_uart, the_port);
-               }
-               port = control->ic_port[ii].icp_port;
-               if (!(ii & 1) && port) {
-                       pci_free_consistent(port->ip_pdev,
-                                       TOTAL_RING_BUF_SIZE,
-                                       (void *)port->ip_cpu_ringbuf,
-                                       port->ip_dma_ringbuf);
-                       kfree(port);
-               }
-       }
-       soft = control->ic_soft;
-       if (soft) {
-               free_irq(control->ic_irq, (void *)soft);
-               if (soft->is_ioc4_serial_addr) {
-                       release_region((unsigned long)
-                            soft->is_ioc4_serial_addr,
-                               sizeof(struct ioc4_serial));
-               }
-               kfree(soft);
-       }
-       kfree(control);
-       idd->idd_serial_data = NULL;
-
-       return 0;
-}
-
 static struct ioc4_submodule ioc4_serial_submodule = {
        .is_name = "IOC4_serial",
        .is_owner = THIS_MODULE,
@@ -2796,9 +2900,15 @@ int ioc4_serial_init(void)
        int ret;
 
        /* register with serial core */
-       if ((ret = uart_register_driver(&ioc4_uart)) < 0) {
+       if ((ret = uart_register_driver(&ioc4_uart_rs232)) < 0) {
+               printk(KERN_WARNING
+                       "%s: Couldn't register rs232 IOC4 serial driver\n",
+                       __FUNCTION__);
+               return ret;
+       }
+       if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) {
                printk(KERN_WARNING
-                       "%s: Couldn't register IOC4 serial driver\n",
+                       "%s: Couldn't register rs422 IOC4 serial driver\n",
                        __FUNCTION__);
                return ret;
        }
@@ -2810,7 +2920,8 @@ int ioc4_serial_init(void)
 static void __devexit ioc4_serial_exit(void)
 {
        ioc4_unregister_submodule(&ioc4_serial_submodule);
-       uart_unregister_driver(&ioc4_uart);
+       uart_unregister_driver(&ioc4_uart_rs232);
+       uart_unregister_driver(&ioc4_uart_rs422);
 }
 
 module_init(ioc4_serial_init);
index 0ca83ac..9468192 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * drivers/serial/mpsc.c
- *
  * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240,
  * GT64260, MV64340, MV64360, GT96100, ... ).
  *
  * 4) AFAICT, hardware flow control isn't supported by the controller --MAG.
  */
 
+#include <linux/config.h>
+
+#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
+#include <linux/ioport.h>
+#include <linux/init.h>
+#include <linux/console.h>
+#include <linux/sysrq.h>
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/mv643xx.h>
 #include <linux/platform_device.h>
 
-#include "mpsc.h"
+#include <asm/io.h>
+#include <asm/irq.h>
+
+#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#define        MPSC_NUM_CTLRS          2
+
+/*
+ * Descriptors and buffers must be cache line aligned.
+ * Buffers lengths must be multiple of cache line size.
+ * Number of Tx & Rx descriptors must be powers of 2.
+ */
+#define        MPSC_RXR_ENTRIES        32
+#define        MPSC_RXRE_SIZE          dma_get_cache_alignment()
+#define        MPSC_RXR_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE)
+#define        MPSC_RXBE_SIZE          dma_get_cache_alignment()
+#define        MPSC_RXB_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE)
+
+#define        MPSC_TXR_ENTRIES        32
+#define        MPSC_TXRE_SIZE          dma_get_cache_alignment()
+#define        MPSC_TXR_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE)
+#define        MPSC_TXBE_SIZE          dma_get_cache_alignment()
+#define        MPSC_TXB_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE)
+
+#define        MPSC_DMA_ALLOC_SIZE     (MPSC_RXR_SIZE + MPSC_RXB_SIZE +        \
+                               MPSC_TXR_SIZE + MPSC_TXB_SIZE +         \
+                               dma_get_cache_alignment() /* for alignment */)
+
+/* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */
+struct mpsc_rx_desc {
+       u16 bufsize;
+       u16 bytecnt;
+       u32 cmdstat;
+       u32 link;
+       u32 buf_ptr;
+} __attribute((packed));
+
+struct mpsc_tx_desc {
+       u16 bytecnt;
+       u16 shadow;
+       u32 cmdstat;
+       u32 link;
+       u32 buf_ptr;
+} __attribute((packed));
+
+/*
+ * Some regs that have the erratum that you can't read them are are shared
+ * between the two MPSC controllers.  This struct contains those shared regs.
+ */
+struct mpsc_shared_regs {
+       phys_addr_t mpsc_routing_base_p;
+       phys_addr_t sdma_intr_base_p;
+
+       void __iomem *mpsc_routing_base;
+       void __iomem *sdma_intr_base;
+
+       u32 MPSC_MRR_m;
+       u32 MPSC_RCRR_m;
+       u32 MPSC_TCRR_m;
+       u32 SDMA_INTR_CAUSE_m;
+       u32 SDMA_INTR_MASK_m;
+};
+
+/* The main driver data structure */
+struct mpsc_port_info {
+       struct uart_port port;  /* Overlay uart_port structure */
+
+       /* Internal driver state for this ctlr */
+       u8 ready;
+       u8 rcv_data;
+       tcflag_t c_iflag;       /* save termios->c_iflag */
+       tcflag_t c_cflag;       /* save termios->c_cflag */
+
+       /* Info passed in from platform */
+       u8 mirror_regs;         /* Need to mirror regs? */
+       u8 cache_mgmt;          /* Need manual cache mgmt? */
+       u8 brg_can_tune;        /* BRG has baud tuning? */
+       u32 brg_clk_src;
+       u16 mpsc_max_idle;
+       int default_baud;
+       int default_bits;
+       int default_parity;
+       int default_flow;
+
+       /* Physical addresses of various blocks of registers (from platform) */
+       phys_addr_t mpsc_base_p;
+       phys_addr_t sdma_base_p;
+       phys_addr_t brg_base_p;
+
+       /* Virtual addresses of various blocks of registers (from platform) */
+       void __iomem *mpsc_base;
+       void __iomem *sdma_base;
+       void __iomem *brg_base;
+
+       /* Descriptor ring and buffer allocations */
+       void *dma_region;
+       dma_addr_t dma_region_p;
+
+       dma_addr_t rxr;         /* Rx descriptor ring */
+       dma_addr_t rxr_p;       /* Phys addr of rxr */
+       u8 *rxb;                /* Rx Ring I/O buf */
+       u8 *rxb_p;              /* Phys addr of rxb */
+       u32 rxr_posn;           /* First desc w/ Rx data */
+
+       dma_addr_t txr;         /* Tx descriptor ring */
+       dma_addr_t txr_p;       /* Phys addr of txr */
+       u8 *txb;                /* Tx Ring I/O buf */
+       u8 *txb_p;              /* Phys addr of txb */
+       int txr_head;           /* Where new data goes */
+       int txr_tail;           /* Where sent data comes off */
+
+       /* Mirrored values of regs we can't read (if 'mirror_regs' set) */
+       u32 MPSC_MPCR_m;
+       u32 MPSC_CHR_1_m;
+       u32 MPSC_CHR_2_m;
+       u32 MPSC_CHR_10_m;
+       u32 BRG_BCR_m;
+       struct mpsc_shared_regs *shared_regs;
+};
+
+/* Hooks to platform-specific code */
+int mpsc_platform_register_driver(void);
+void mpsc_platform_unregister_driver(void);
+
+/* Hooks back in to mpsc common to be called by platform-specific code */
+struct mpsc_port_info *mpsc_device_probe(int index);
+struct mpsc_port_info *mpsc_device_remove(int index);
+
+/* Main MPSC Configuration Register Offsets */
+#define        MPSC_MMCRL                      0x0000
+#define        MPSC_MMCRH                      0x0004
+#define        MPSC_MPCR                       0x0008
+#define        MPSC_CHR_1                      0x000c
+#define        MPSC_CHR_2                      0x0010
+#define        MPSC_CHR_3                      0x0014
+#define        MPSC_CHR_4                      0x0018
+#define        MPSC_CHR_5                      0x001c
+#define        MPSC_CHR_6                      0x0020
+#define        MPSC_CHR_7                      0x0024
+#define        MPSC_CHR_8                      0x0028
+#define        MPSC_CHR_9                      0x002c
+#define        MPSC_CHR_10                     0x0030
+#define        MPSC_CHR_11                     0x0034
+
+#define        MPSC_MPCR_FRZ                   (1 << 9)
+#define        MPSC_MPCR_CL_5                  0
+#define        MPSC_MPCR_CL_6                  1
+#define        MPSC_MPCR_CL_7                  2
+#define        MPSC_MPCR_CL_8                  3
+#define        MPSC_MPCR_SBL_1                 0
+#define        MPSC_MPCR_SBL_2                 1
+
+#define        MPSC_CHR_2_TEV                  (1<<1)
+#define        MPSC_CHR_2_TA                   (1<<7)
+#define        MPSC_CHR_2_TTCS                 (1<<9)
+#define        MPSC_CHR_2_REV                  (1<<17)
+#define        MPSC_CHR_2_RA                   (1<<23)
+#define        MPSC_CHR_2_CRD                  (1<<25)
+#define        MPSC_CHR_2_EH                   (1<<31)
+#define        MPSC_CHR_2_PAR_ODD              0
+#define        MPSC_CHR_2_PAR_SPACE            1
+#define        MPSC_CHR_2_PAR_EVEN             2
+#define        MPSC_CHR_2_PAR_MARK             3
+
+/* MPSC Signal Routing */
+#define        MPSC_MRR                        0x0000
+#define        MPSC_RCRR                       0x0004
+#define        MPSC_TCRR                       0x0008
+
+/* Serial DMA Controller Interface Registers */
+#define        SDMA_SDC                        0x0000
+#define        SDMA_SDCM                       0x0008
+#define        SDMA_RX_DESC                    0x0800
+#define        SDMA_RX_BUF_PTR                 0x0808
+#define        SDMA_SCRDP                      0x0810
+#define        SDMA_TX_DESC                    0x0c00
+#define        SDMA_SCTDP                      0x0c10
+#define        SDMA_SFTDP                      0x0c14
+
+#define        SDMA_DESC_CMDSTAT_PE            (1<<0)
+#define        SDMA_DESC_CMDSTAT_CDL           (1<<1)
+#define        SDMA_DESC_CMDSTAT_FR            (1<<3)
+#define        SDMA_DESC_CMDSTAT_OR            (1<<6)
+#define        SDMA_DESC_CMDSTAT_BR            (1<<9)
+#define        SDMA_DESC_CMDSTAT_MI            (1<<10)
+#define        SDMA_DESC_CMDSTAT_A             (1<<11)
+#define        SDMA_DESC_CMDSTAT_AM            (1<<12)
+#define        SDMA_DESC_CMDSTAT_CT            (1<<13)
+#define        SDMA_DESC_CMDSTAT_C             (1<<14)
+#define        SDMA_DESC_CMDSTAT_ES            (1<<15)
+#define        SDMA_DESC_CMDSTAT_L             (1<<16)
+#define        SDMA_DESC_CMDSTAT_F             (1<<17)
+#define        SDMA_DESC_CMDSTAT_P             (1<<18)
+#define        SDMA_DESC_CMDSTAT_EI            (1<<23)
+#define        SDMA_DESC_CMDSTAT_O             (1<<31)
+
+#define SDMA_DESC_DFLT                 (SDMA_DESC_CMDSTAT_O |  \
+                                       SDMA_DESC_CMDSTAT_EI)
+
+#define        SDMA_SDC_RFT                    (1<<0)
+#define        SDMA_SDC_SFM                    (1<<1)
+#define        SDMA_SDC_BLMR                   (1<<6)
+#define        SDMA_SDC_BLMT                   (1<<7)
+#define        SDMA_SDC_POVR                   (1<<8)
+#define        SDMA_SDC_RIFB                   (1<<9)
+
+#define        SDMA_SDCM_ERD                   (1<<7)
+#define        SDMA_SDCM_AR                    (1<<15)
+#define        SDMA_SDCM_STD                   (1<<16)
+#define        SDMA_SDCM_TXD                   (1<<23)
+#define        SDMA_SDCM_AT                    (1<<31)
+
+#define        SDMA_0_CAUSE_RXBUF              (1<<0)
+#define        SDMA_0_CAUSE_RXERR              (1<<1)
+#define        SDMA_0_CAUSE_TXBUF              (1<<2)
+#define        SDMA_0_CAUSE_TXEND              (1<<3)
+#define        SDMA_1_CAUSE_RXBUF              (1<<8)
+#define        SDMA_1_CAUSE_RXERR              (1<<9)
+#define        SDMA_1_CAUSE_TXBUF              (1<<10)
+#define        SDMA_1_CAUSE_TXEND              (1<<11)
+
+#define        SDMA_CAUSE_RX_MASK      (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \
+       SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
+#define        SDMA_CAUSE_TX_MASK      (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \
+       SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
+
+/* SDMA Interrupt registers */
+#define        SDMA_INTR_CAUSE                 0x0000
+#define        SDMA_INTR_MASK                  0x0080
+
+/* Baud Rate Generator Interface Registers */
+#define        BRG_BCR                         0x0000
+#define        BRG_BTR                         0x0004
 
 /*
  * Define how this driver is known to the outside (we've been assigned a
@@ -1165,7 +1417,7 @@ mpsc_startup(struct uart_port *port)
                        flag = SA_SHIRQ;
 
                if (request_irq(pi->port.irq, mpsc_sdma_intr, flag,
-                               "mpsc/sdma", pi))
+                               "mpsc-sdma", pi))
                        printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n",
                               pi->port.irq);
 
diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h
deleted file mode 100644 (file)
index 678dbcf..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * drivers/serial/mpsc.h
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-#ifndef        __MPSC_H__
-#define        __MPSC_H__
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/sysrq.h>
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-#include <linux/delay.h>
-#include <linux/device.h>
-#include <linux/dma-mapping.h>
-#include <linux/mv643xx.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-
-#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
-#define        MPSC_NUM_CTLRS          2
-
-/*
- * Descriptors and buffers must be cache line aligned.
- * Buffers lengths must be multiple of cache line size.
- * Number of Tx & Rx descriptors must be powers of 2.
- */
-#define        MPSC_RXR_ENTRIES        32
-#define        MPSC_RXRE_SIZE          dma_get_cache_alignment()
-#define        MPSC_RXR_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE)
-#define        MPSC_RXBE_SIZE          dma_get_cache_alignment()
-#define        MPSC_RXB_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE)
-
-#define        MPSC_TXR_ENTRIES        32
-#define        MPSC_TXRE_SIZE          dma_get_cache_alignment()
-#define        MPSC_TXR_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE)
-#define        MPSC_TXBE_SIZE          dma_get_cache_alignment()
-#define        MPSC_TXB_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE)
-
-#define        MPSC_DMA_ALLOC_SIZE     (MPSC_RXR_SIZE + MPSC_RXB_SIZE +        \
-                               MPSC_TXR_SIZE + MPSC_TXB_SIZE +         \
-                               dma_get_cache_alignment() /* for alignment */)
-
-/* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */
-struct mpsc_rx_desc {
-       u16 bufsize;
-       u16 bytecnt;
-       u32 cmdstat;
-       u32 link;
-       u32 buf_ptr;
-} __attribute((packed));
-
-struct mpsc_tx_desc {
-       u16 bytecnt;
-       u16 shadow;
-       u32 cmdstat;
-       u32 link;
-       u32 buf_ptr;
-} __attribute((packed));
-
-/*
- * Some regs that have the erratum that you can't read them are are shared
- * between the two MPSC controllers.  This struct contains those shared regs.
- */
-struct mpsc_shared_regs {
-       phys_addr_t mpsc_routing_base_p;
-       phys_addr_t sdma_intr_base_p;
-
-       void __iomem *mpsc_routing_base;
-       void __iomem *sdma_intr_base;
-
-       u32 MPSC_MRR_m;
-       u32 MPSC_RCRR_m;
-       u32 MPSC_TCRR_m;
-       u32 SDMA_INTR_CAUSE_m;
-       u32 SDMA_INTR_MASK_m;
-};
-
-/* The main driver data structure */
-struct mpsc_port_info {
-       struct uart_port port;  /* Overlay uart_port structure */
-
-       /* Internal driver state for this ctlr */
-       u8 ready;
-       u8 rcv_data;
-       tcflag_t c_iflag;       /* save termios->c_iflag */
-       tcflag_t c_cflag;       /* save termios->c_cflag */
-
-       /* Info passed in from platform */
-       u8 mirror_regs;         /* Need to mirror regs? */
-       u8 cache_mgmt;          /* Need manual cache mgmt? */
-       u8 brg_can_tune;        /* BRG has baud tuning? */
-       u32 brg_clk_src;
-       u16 mpsc_max_idle;
-       int default_baud;
-       int default_bits;
-       int default_parity;
-       int default_flow;
-
-       /* Physical addresses of various blocks of registers (from platform) */
-       phys_addr_t mpsc_base_p;
-       phys_addr_t sdma_base_p;
-       phys_addr_t brg_base_p;
-
-       /* Virtual addresses of various blocks of registers (from platform) */
-       void __iomem *mpsc_base;
-       void __iomem *sdma_base;
-       void __iomem *brg_base;
-
-       /* Descriptor ring and buffer allocations */
-       void *dma_region;
-       dma_addr_t dma_region_p;
-
-       dma_addr_t rxr;         /* Rx descriptor ring */
-       dma_addr_t rxr_p;       /* Phys addr of rxr */
-       u8 *rxb;                /* Rx Ring I/O buf */
-       u8 *rxb_p;              /* Phys addr of rxb */
-       u32 rxr_posn;           /* First desc w/ Rx data */
-
-       dma_addr_t txr;         /* Tx descriptor ring */
-       dma_addr_t txr_p;       /* Phys addr of txr */
-       u8 *txb;                /* Tx Ring I/O buf */
-       u8 *txb_p;              /* Phys addr of txb */
-       int txr_head;           /* Where new data goes */
-       int txr_tail;           /* Where sent data comes off */
-
-       /* Mirrored values of regs we can't read (if 'mirror_regs' set) */
-       u32 MPSC_MPCR_m;
-       u32 MPSC_CHR_1_m;
-       u32 MPSC_CHR_2_m;
-       u32 MPSC_CHR_10_m;
-       u32 BRG_BCR_m;
-       struct mpsc_shared_regs *shared_regs;
-};
-
-/* Hooks to platform-specific code */
-int mpsc_platform_register_driver(void);
-void mpsc_platform_unregister_driver(void);
-
-/* Hooks back in to mpsc common to be called by platform-specific code */
-struct mpsc_port_info *mpsc_device_probe(int index);
-struct mpsc_port_info *mpsc_device_remove(int index);
-
-/*
- *****************************************************************************
- *
- *     Multi-Protocol Serial Controller Interface Registers
- *
- *****************************************************************************
- */
-
-/* Main Configuratino Register Offsets */
-#define        MPSC_MMCRL                      0x0000
-#define        MPSC_MMCRH                      0x0004
-#define        MPSC_MPCR                       0x0008
-#define        MPSC_CHR_1                      0x000c
-#define        MPSC_CHR_2                      0x0010
-#define        MPSC_CHR_3                      0x0014
-#define        MPSC_CHR_4                      0x0018
-#define        MPSC_CHR_5                      0x001c
-#define        MPSC_CHR_6                      0x0020
-#define        MPSC_CHR_7                      0x0024
-#define        MPSC_CHR_8                      0x0028
-#define        MPSC_CHR_9                      0x002c
-#define        MPSC_CHR_10                     0x0030
-#define        MPSC_CHR_11                     0x0034
-
-#define        MPSC_MPCR_FRZ                   (1 << 9)
-#define        MPSC_MPCR_CL_5                  0
-#define        MPSC_MPCR_CL_6                  1
-#define        MPSC_MPCR_CL_7                  2
-#define        MPSC_MPCR_CL_8                  3
-#define        MPSC_MPCR_SBL_1                 0
-#define        MPSC_MPCR_SBL_2                 1
-
-#define        MPSC_CHR_2_TEV                  (1<<1)
-#define        MPSC_CHR_2_TA                   (1<<7)
-#define        MPSC_CHR_2_TTCS                 (1<<9)
-#define        MPSC_CHR_2_REV                  (1<<17)
-#define        MPSC_CHR_2_RA                   (1<<23)
-#define        MPSC_CHR_2_CRD                  (1<<25)
-#define        MPSC_CHR_2_EH                   (1<<31)
-#define        MPSC_CHR_2_PAR_ODD              0
-#define        MPSC_CHR_2_PAR_SPACE            1
-#define        MPSC_CHR_2_PAR_EVEN             2
-#define        MPSC_CHR_2_PAR_MARK             3
-
-/* MPSC Signal Routing */
-#define        MPSC_MRR                        0x0000
-#define        MPSC_RCRR                       0x0004
-#define        MPSC_TCRR                       0x0008
-
-/*
- *****************************************************************************
- *
- *     Serial DMA Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        SDMA_SDC                        0x0000
-#define        SDMA_SDCM                       0x0008
-#define        SDMA_RX_DESC                    0x0800
-#define        SDMA_RX_BUF_PTR                 0x0808
-#define        SDMA_SCRDP                      0x0810
-#define        SDMA_TX_DESC                    0x0c00
-#define        SDMA_SCTDP                      0x0c10
-#define        SDMA_SFTDP                      0x0c14
-
-#define        SDMA_DESC_CMDSTAT_PE            (1<<0)
-#define        SDMA_DESC_CMDSTAT_CDL           (1<<1)
-#define        SDMA_DESC_CMDSTAT_FR            (1<<3)
-#define        SDMA_DESC_CMDSTAT_OR            (1<<6)
-#define        SDMA_DESC_CMDSTAT_BR            (1<<9)
-#define        SDMA_DESC_CMDSTAT_MI            (1<<10)
-#define        SDMA_DESC_CMDSTAT_A             (1<<11)
-#define        SDMA_DESC_CMDSTAT_AM            (1<<12)
-#define        SDMA_DESC_CMDSTAT_CT            (1<<13)
-#define        SDMA_DESC_CMDSTAT_C             (1<<14)
-#define        SDMA_DESC_CMDSTAT_ES            (1<<15)
-#define        SDMA_DESC_CMDSTAT_L             (1<<16)
-#define        SDMA_DESC_CMDSTAT_F             (1<<17)
-#define        SDMA_DESC_CMDSTAT_P             (1<<18)
-#define        SDMA_DESC_CMDSTAT_EI            (1<<23)
-#define        SDMA_DESC_CMDSTAT_O             (1<<31)
-
-#define SDMA_DESC_DFLT                 (SDMA_DESC_CMDSTAT_O |  \
-                                       SDMA_DESC_CMDSTAT_EI)
-
-#define        SDMA_SDC_RFT                    (1<<0)
-#define        SDMA_SDC_SFM                    (1<<1)
-#define        SDMA_SDC_BLMR                   (1<<6)
-#define        SDMA_SDC_BLMT                   (1<<7)
-#define        SDMA_SDC_POVR                   (1<<8)
-#define        SDMA_SDC_RIFB                   (1<<9)
-
-#define        SDMA_SDCM_ERD                   (1<<7)
-#define        SDMA_SDCM_AR                    (1<<15)
-#define        SDMA_SDCM_STD                   (1<<16)
-#define        SDMA_SDCM_TXD                   (1<<23)
-#define        SDMA_SDCM_AT                    (1<<31)
-
-#define        SDMA_0_CAUSE_RXBUF              (1<<0)
-#define        SDMA_0_CAUSE_RXERR              (1<<1)
-#define        SDMA_0_CAUSE_TXBUF              (1<<2)
-#define        SDMA_0_CAUSE_TXEND              (1<<3)
-#define        SDMA_1_CAUSE_RXBUF              (1<<8)
-#define        SDMA_1_CAUSE_RXERR              (1<<9)
-#define        SDMA_1_CAUSE_TXBUF              (1<<10)
-#define        SDMA_1_CAUSE_TXEND              (1<<11)
-
-#define        SDMA_CAUSE_RX_MASK      (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \
-       SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
-#define        SDMA_CAUSE_TX_MASK      (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \
-       SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
-
-/* SDMA Interrupt registers */
-#define        SDMA_INTR_CAUSE                 0x0000
-#define        SDMA_INTR_MASK                  0x0080
-
-/*
- *****************************************************************************
- *
- *     Baud Rate Generator Interface Registers
- *
- *****************************************************************************
- */
-
-#define        BRG_BCR                         0x0000
-#define        BRG_BTR                         0x0004
-
-#endif                         /* __MPSC_H__ */
index ada6e75..60831bb 100644 (file)
 
 #include <asm/hardware/locomo.h>
 #include <asm/irq.h>
+#include <asm/mach/sharpsl_param.h>
+#include <asm/mach-types.h>
 
-#ifdef CONFIG_SA1100_COLLIE
-#include <asm/arch/collie.h>
-#else
-#include <asm/arch/poodle.h>
-#endif
-
-extern void (*sa1100fb_lcd_power)(int on);
+#include "../../../arch/arm/mach-sa1100/generic.h"
 
 static struct locomo_dev *locomolcd_dev;
 
@@ -82,7 +78,7 @@ static void locomolcd_off(int comadj)
 
 void locomolcd_power(int on)
 {
-       int comadj = 118;
+       int comadj = sharpsl_param.comadj;
        unsigned long flags;
 
        local_irq_save(flags);
@@ -93,11 +89,12 @@ void locomolcd_power(int on)
        }
 
        /* read comadj */
-#ifdef CONFIG_MACH_POODLE
-       comadj = 118;
-#else
-       comadj = 128;
-#endif
+       if (comadj == -1) {
+               if (machine_is_poodle())
+                       comadj = 118;
+               if (machine_is_collie())
+                       comadj = 128;
+       }
 
        if (on)
                locomolcd_on(comadj);
index e0dbdfc..66d6f2f 100644 (file)
@@ -2622,7 +2622,7 @@ static int __init cirrusfb_init(void)
 #endif
 
 #ifdef CONFIG_ZORRO
-       error |= zorro_module_init(&cirrusfb_zorro_driver);
+       error |= zorro_register_driver(&cirrusfb_zorro_driver);
 #endif
 #ifdef CONFIG_PCI
        error |= pci_register_driver(&cirrusfb_pci_driver);
index bebdac5..abd920a 100644 (file)
@@ -386,7 +386,9 @@ int __init hpfb_init(void)
        if (fb_get_options("hpfb", NULL))
                return -ENODEV;
 
-       dio_module_init(&hpfb_driver);
+       err = dio_register_driver(&hpfb_driver);
+       if (err)
+               return err;
 
        fs = get_fs();
        set_fs(KERNEL_DS);
index 0e78ddc..52c18a3 100644 (file)
@@ -3532,26 +3532,26 @@ int __init pm3fb_init(void)
 MODULE_AUTHOR("Romain Dolbeau");
 MODULE_DESCRIPTION("Permedia3 framebuffer device driver");
 static char *mode[PM3_MAX_BOARD];
-MODULE_PARM(mode,PM3_MAX_BOARD_MODULE_ARRAY_STRING);
+module_param_array(mode, charp, NULL, 0);
 MODULE_PARM_DESC(mode,"video mode");
-MODULE_PARM(disable,PM3_MAX_BOARD_MODULE_ARRAY_SHORT);
+module_param_array(disable, short, NULL, 0);
 MODULE_PARM_DESC(disable,"disable board");
 static short off[PM3_MAX_BOARD];
-MODULE_PARM(off,PM3_MAX_BOARD_MODULE_ARRAY_SHORT);
+module_param_array(off, short, NULL, 0);
 MODULE_PARM_DESC(off,"disable board");
 static char *pciid[PM3_MAX_BOARD];
-MODULE_PARM(pciid,PM3_MAX_BOARD_MODULE_ARRAY_STRING);
+module_param_array(pciid, charp, NULL, 0);
 MODULE_PARM_DESC(pciid,"board PCI Id");
-MODULE_PARM(noaccel,PM3_MAX_BOARD_MODULE_ARRAY_SHORT);
+module_param_array(noaccel, short, NULL, 0);
 MODULE_PARM_DESC(noaccel,"disable accel");
 static char *font[PM3_MAX_BOARD];
-MODULE_PARM(font,PM3_MAX_BOARD_MODULE_ARRAY_STRING);
+module_param_array(font, charp, NULL, 0);
 MODULE_PARM_DESC(font,"choose font");
-MODULE_PARM(depth,PM3_MAX_BOARD_MODULE_ARRAY_SHORT);
+module_param(depth, short, NULL, 0);
 MODULE_PARM_DESC(depth,"boot-time depth");
-MODULE_PARM(printtimings, "h");
+module_param(printtimings, short, NULL, 0);
 MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)");
-MODULE_PARM(forcesize, PM3_MAX_BOARD_MODULE_ARRAY_SHORT);
+module_param(forcesize, short, NULL, 0);
 MODULE_PARM_DESC(forcesize, "force specified memory size");
 /*
 MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards")
index fcbee74..067c07b 100644 (file)
@@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev)
      *  @drv: the driver structure to register
      *
      *  Adds the driver structure to the list of registered drivers
-     *  Returns the number of Zorro devices which were claimed by the driver
-     *  during registration.  The driver remains registered even if the
-     *  return value is zero.
+     *  Returns zero or a negative error value.
      */
 
 int zorro_register_driver(struct zorro_driver *drv)
 {
-       int count = 0;
-
        /* initialize common driver fields */
        drv->driver.name = drv->name;
        drv->driver.bus = &zorro_bus_type;
 
        /* register with core */
-       count = driver_register(&drv->driver);
-       return count ? count : 1;
+       return driver_register(&drv->driver);
 }
 
 
diff --git a/fs/9p/9p.c b/fs/9p/9p.c
deleted file mode 100644 (file)
index c148e6b..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- *  linux/fs/9p/9p.c
- *
- *  This file contains functions to perform synchronous 9P calls
- *
- *  Copyright (C) 2004 by Latchesar Ionkov <lucho@ionkov.net>
- *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
- *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to:
- *  Free Software Foundation
- *  51 Franklin Street, Fifth Floor
- *  Boston, MA  02111-1301  USA
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/idr.h>
-
-#include "debug.h"
-#include "v9fs.h"
-#include "9p.h"
-#include "conv.h"
-#include "mux.h"
-
-/**
- * v9fs_t_version - negotiate protocol parameters with sever
- * @v9ses: 9P2000 session information
- * @msize: requested max size packet
- * @version: requested version.extension string
- * @fcall: pointer to response fcall pointer
- *
- */
-
-int
-v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize,
-              char *version, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "msize: %d version: %s\n", msize, version);
-       tc = v9fs_create_tversion(msize, version);
-
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_attach - mount the server
- * @v9ses: 9P2000 session information
- * @uname: user name doing the attach
- * @aname: remote name being attached to
- * @fid: mount fid to attatch to root node
- * @afid: authentication fid (in this case result key)
- * @fcall: pointer to response fcall pointer
- *
- */
-
-int
-v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
-             u32 fid, u32 afid, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall* tc;
-
-       dprintk(DEBUG_9P, "uname '%s' aname '%s' fid %d afid %d\n", uname,
-               aname, fid, afid);
-
-       tc = v9fs_create_tattach(fid, afid, uname, aname);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
-       struct v9fs_fcall *rc, int err)
-{
-       int fid;
-       struct v9fs_session_info *v9ses;
-
-       if (err)
-               return;
-
-       fid = tc->params.tclunk.fid;
-       kfree(tc);
-
-       if (!rc)
-               return;
-
-       v9ses = a;
-       if (rc->id == RCLUNK)
-               v9fs_put_idpool(fid, &v9ses->fidpool);
-
-       kfree(rc);
-}
-
-/**
- * v9fs_t_clunk - release a fid (finish a transaction)
- * @v9ses: 9P2000 session information
- * @fid: fid to release
- * @fcall: pointer to response fcall pointer
- *
- */
-
-int
-v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid)
-{
-       int ret;
-       struct v9fs_fcall *tc, *rc;
-
-       dprintk(DEBUG_9P, "fid %d\n", fid);
-
-       rc = NULL;
-       tc = v9fs_create_tclunk(fid);
-       if (!IS_ERR(tc))
-               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
-       else
-               ret = PTR_ERR(tc);
-
-       if (ret)
-               dprintk(DEBUG_ERROR, "failed fid %d err %d\n", fid, ret);
-
-       v9fs_t_clunk_cb(v9ses, tc, rc, ret);
-       return ret;
-}
-
-#if 0
-/**
- * v9fs_v9fs_t_flush - flush a pending transaction
- * @v9ses: 9P2000 session information
- * @tag: tid to release
- *
- */
-
-int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "oldtag %d\n", oldtag);
-
-       tc = v9fs_create_tflush(oldtag);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, NULL);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-#endif  /*  0  */
-
-/**
- * v9fs_t_stat - read a file's meta-data
- * @v9ses: 9P2000 session information
- * @fid: fid pointing to file or directory to get info about
- * @fcall: pointer to response fcall
- *
- */
-
-int
-v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "fid %d\n", fid);
-
-       ret = -ENOMEM;
-       tc = v9fs_create_tstat(fid);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_wstat - write a file's meta-data
- * @v9ses: 9P2000 session information
- * @fid: fid pointing to file or directory to write info about
- * @stat: metadata
- * @fcall: pointer to response fcall
- *
- */
-
-int
-v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid,
-            struct v9fs_wstat *wstat, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "fid %d\n", fid);
-
-       tc = v9fs_create_twstat(fid, wstat, v9ses->extended);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_walk - walk a fid to a new file or directory
- * @v9ses: 9P2000 session information
- * @fid: fid to walk
- * @newfid: new fid (for clone operations)
- * @name: path to walk fid to
- * @fcall: pointer to response fcall
- *
- */
-
-/* TODO: support multiple walk */
-
-int
-v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid,
-           char *name, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-       int nwname;
-
-       dprintk(DEBUG_9P, "fid %d newfid %d wname '%s'\n", fid, newfid, name);
-
-       if (name)
-               nwname = 1;
-       else
-               nwname = 0;
-
-       tc = v9fs_create_twalk(fid, newfid, nwname, &name);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_open - open a file
- *
- * @v9ses - 9P2000 session information
- * @fid - fid to open
- * @mode - mode to open file (R, RW, etc)
- * @fcall - pointer to response fcall
- *
- */
-
-int
-v9fs_t_open(struct v9fs_session_info *v9ses, u32 fid, u8 mode,
-           struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode);
-
-       tc = v9fs_create_topen(fid, mode);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_remove - remove a file or directory
- * @v9ses: 9P2000 session information
- * @fid: fid to remove
- * @fcall: pointer to response fcall
- *
- */
-
-int
-v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
-             struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "fid %d\n", fid);
-
-       tc = v9fs_create_tremove(fid);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_create - create a file or directory
- * @v9ses: 9P2000 session information
- * @fid: fid to create
- * @name: name of the file or directory to create
- * @perm: permissions to create with
- * @mode: mode to open file (R, RW, etc)
- * @fcall: pointer to response fcall
- *
- */
-
-int
-v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
-             u32 perm, u8 mode, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc;
-
-       dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n",
-               fid, name, perm, mode);
-
-       tc = v9fs_create_tcreate(fid, name, perm, mode);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_read - read data
- * @v9ses: 9P2000 session information
- * @fid: fid to read from
- * @offset: offset to start read at
- * @count: how many bytes to read
- * @fcall: pointer to response fcall (with data)
- *
- */
-
-int
-v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
-           u32 count, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc, *rc;
-
-       dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid,
-               (long long unsigned) offset, count);
-
-       tc = v9fs_create_tread(fid, offset, count);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
-               if (!ret)
-                       ret = rc->params.rread.count;
-               if (rcp)
-                       *rcp = rc;
-               else
-                       kfree(rc);
-
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
-/**
- * v9fs_t_write - write data
- * @v9ses: 9P2000 session information
- * @fid: fid to write to
- * @offset: offset to start write at
- * @count: how many bytes to write
- * @fcall: pointer to response fcall
- *
- */
-
-int
-v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, u32 count,
-       const char __user *data, struct v9fs_fcall **rcp)
-{
-       int ret;
-       struct v9fs_fcall *tc, *rc;
-
-       dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid,
-               (long long unsigned) offset, count);
-
-       tc = v9fs_create_twrite(fid, offset, count, data);
-       if (!IS_ERR(tc)) {
-               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
-
-               if (!ret)
-                       ret = rc->params.rwrite.count;
-               if (rcp)
-                       *rcp = rc;
-               else
-                       kfree(rc);
-
-               kfree(tc);
-       } else
-               ret = PTR_ERR(tc);
-
-       return ret;
-}
-
index 95d72ae..94e2f92 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -235,6 +234,7 @@ struct Tcreate {
        struct v9fs_str name;
        u32 perm;
        u8 mode;
+       struct v9fs_str extension;
 };
 
 struct Rcreate {
@@ -364,7 +364,7 @@ int v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
                  struct v9fs_fcall **rcall);
 
 int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
-                 u32 perm, u8 mode, struct v9fs_fcall **rcall);
+       u32 perm, u8 mode, char *extension, struct v9fs_fcall **rcall);
 
 int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid,
                u64 offset, u32 count, struct v9fs_fcall **rcall);
@@ -372,3 +372,4 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid,
 int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
                 u32 count, const char __user * data,
                 struct v9fs_fcall **rcall);
+int v9fs_printfcall(char *, int, struct v9fs_fcall *, int);
index 2f4ce43..87897f8 100644 (file)
@@ -1,10 +1,9 @@
-obj-$(CONFIG_9P_FS) := 9p2000.o
+obj-$(CONFIG_9P_FS) := 9p.o
 
-9p2000-objs := \
+9p-objs := \
        trans_fd.o \
-       trans_sock.o \
        mux.o \
-       9p.o \
+       fcall.o \
        conv.o \
        vfs_super.o \
        vfs_inode.o \
@@ -14,5 +13,6 @@ obj-$(CONFIG_9P_FS) := 9p2000.o
        vfs_dentry.o \
        error.o \
        v9fs.o \
-       fid.o
+       fid.o \
+       fcprint.o
 
index bba8171..a767e05 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -666,7 +665,8 @@ struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode)
        return fc;
 }
 
-struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
+struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
+       char *extension, int extended)
 {
        int size;
        struct v9fs_fcall *fc;
@@ -674,6 +674,9 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
        struct cbuf *bufp = &buffer;
 
        size = 4 + 2 + strlen(name) + 4 + 1;    /* fid[4] name[s] perm[4] mode[1] */
+       if (extended && extension!=NULL)
+               size += 2 + strlen(extension);  /* extension[s] */
+
        fc = v9fs_create_common(bufp, size, TCREATE);
        if (IS_ERR(fc))
                goto error;
@@ -682,6 +685,8 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
        v9fs_put_str(bufp, name, &fc->params.tcreate.name);
        v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm);
        v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode);
+       if (extended)
+               v9fs_put_str(bufp, extension, &fc->params.tcreate.extension);
 
        if (buf_check_overflow(bufp)) {
                kfree(fc);
index f589662..dd5b6b1 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -39,7 +38,8 @@ struct v9fs_fcall *v9fs_create_tflush(u16 oldtag);
 struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname,
        char **wnames);
 struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode);
-struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode);
+struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
+       char *extension, int extended);
 struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count);
 struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count,
        const char __user *data);
index fe55103..4228c0b 100644 (file)
@@ -5,9 +5,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -30,6 +29,7 @@
 #define DEBUG_MUX              (1<<5)
 #define DEBUG_TRANS            (1<<6)
 #define DEBUG_SLABS            (1<<7)
+#define DEBUG_FCALL            (1<<8)
 
 #define DEBUG_DUMP_PKT         0
 
index e4b6f8f..981fe8e 100644 (file)
@@ -11,9 +11,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index a9794e8..5f3ca52 100644 (file)
@@ -12,9 +12,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
new file mode 100644 (file)
index 0000000..71742ba
--- /dev/null
@@ -0,0 +1,430 @@
+/*
+ *  linux/fs/9p/fcall.c
+ *
+ *  This file contains functions to perform synchronous 9P calls
+ *
+ *  Copyright (C) 2004 by Latchesar Ionkov <lucho@ionkov.net>
+ *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
+ *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to:
+ *  Free Software Foundation
+ *  51 Franklin Street, Fifth Floor
+ *  Boston, MA  02111-1301  USA
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/idr.h>
+
+#include "debug.h"
+#include "v9fs.h"
+#include "9p.h"
+#include "conv.h"
+#include "mux.h"
+
+/**
+ * v9fs_t_version - negotiate protocol parameters with sever
+ * @v9ses: 9P2000 session information
+ * @msize: requested max size packet
+ * @version: requested version.extension string
+ * @fcall: pointer to response fcall pointer
+ *
+ */
+
+int
+v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize,
+              char *version, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "msize: %d version: %s\n", msize, version);
+       tc = v9fs_create_tversion(msize, version);
+
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_attach - mount the server
+ * @v9ses: 9P2000 session information
+ * @uname: user name doing the attach
+ * @aname: remote name being attached to
+ * @fid: mount fid to attatch to root node
+ * @afid: authentication fid (in this case result key)
+ * @fcall: pointer to response fcall pointer
+ *
+ */
+
+int
+v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
+             u32 fid, u32 afid, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall* tc;
+
+       dprintk(DEBUG_9P, "uname '%s' aname '%s' fid %d afid %d\n", uname,
+               aname, fid, afid);
+
+       tc = v9fs_create_tattach(fid, afid, uname, aname);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
+       struct v9fs_fcall *rc, int err)
+{
+       int fid;
+       struct v9fs_session_info *v9ses;
+
+       if (err)
+               return;
+
+       fid = tc->params.tclunk.fid;
+       kfree(tc);
+
+       if (!rc)
+               return;
+
+       v9ses = a;
+       if (rc->id == RCLUNK)
+               v9fs_put_idpool(fid, &v9ses->fidpool);
+
+       kfree(rc);
+}
+
+/**
+ * v9fs_t_clunk - release a fid (finish a transaction)
+ * @v9ses: 9P2000 session information
+ * @fid: fid to release
+ * @fcall: pointer to response fcall pointer
+ *
+ */
+
+int
+v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid)
+{
+       int ret;
+       struct v9fs_fcall *tc, *rc;
+
+       dprintk(DEBUG_9P, "fid %d\n", fid);
+
+       rc = NULL;
+       tc = v9fs_create_tclunk(fid);
+       if (!IS_ERR(tc))
+               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
+       else
+               ret = PTR_ERR(tc);
+
+       if (ret)
+               dprintk(DEBUG_ERROR, "failed fid %d err %d\n", fid, ret);
+
+       v9fs_t_clunk_cb(v9ses, tc, rc, ret);
+       return ret;
+}
+
+#if 0
+/**
+ * v9fs_v9fs_t_flush - flush a pending transaction
+ * @v9ses: 9P2000 session information
+ * @tag: tag to release
+ *
+ */
+int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "oldtag %d\n", oldtag);
+
+       tc = v9fs_create_tflush(oldtag);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, NULL);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+#endif
+
+/**
+ * v9fs_t_stat - read a file's meta-data
+ * @v9ses: 9P2000 session information
+ * @fid: fid pointing to file or directory to get info about
+ * @fcall: pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "fid %d\n", fid);
+
+       ret = -ENOMEM;
+       tc = v9fs_create_tstat(fid);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_wstat - write a file's meta-data
+ * @v9ses: 9P2000 session information
+ * @fid: fid pointing to file or directory to write info about
+ * @stat: metadata
+ * @fcall: pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid,
+            struct v9fs_wstat *wstat, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "fid %d\n", fid);
+
+       tc = v9fs_create_twstat(fid, wstat, v9ses->extended);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_walk - walk a fid to a new file or directory
+ * @v9ses: 9P2000 session information
+ * @fid: fid to walk
+ * @newfid: new fid (for clone operations)
+ * @name: path to walk fid to
+ * @fcall: pointer to response fcall
+ *
+ */
+
+/* TODO: support multiple walk */
+
+int
+v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid,
+           char *name, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+       int nwname;
+
+       dprintk(DEBUG_9P, "fid %d newfid %d wname '%s'\n", fid, newfid, name);
+
+       if (name)
+               nwname = 1;
+       else
+               nwname = 0;
+
+       tc = v9fs_create_twalk(fid, newfid, nwname, &name);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_open - open a file
+ *
+ * @v9ses - 9P2000 session information
+ * @fid - fid to open
+ * @mode - mode to open file (R, RW, etc)
+ * @fcall - pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_open(struct v9fs_session_info *v9ses, u32 fid, u8 mode,
+           struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode);
+
+       tc = v9fs_create_topen(fid, mode);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_remove - remove a file or directory
+ * @v9ses: 9P2000 session information
+ * @fid: fid to remove
+ * @fcall: pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
+             struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "fid %d\n", fid);
+
+       tc = v9fs_create_tremove(fid);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_create - create a file or directory
+ * @v9ses: 9P2000 session information
+ * @fid: fid to create
+ * @name: name of the file or directory to create
+ * @perm: permissions to create with
+ * @mode: mode to open file (R, RW, etc)
+ * @fcall: pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, u32 perm,
+       u8 mode, char *extension, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc;
+
+       dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n",
+               fid, name, perm, mode);
+
+       tc = v9fs_create_tcreate(fid, name, perm, mode, extension,
+               v9ses->extended);
+
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_read - read data
+ * @v9ses: 9P2000 session information
+ * @fid: fid to read from
+ * @offset: offset to start read at
+ * @count: how many bytes to read
+ * @fcall: pointer to response fcall (with data)
+ *
+ */
+
+int
+v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
+           u32 count, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc, *rc;
+
+       dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid,
+               (long long unsigned) offset, count);
+
+       tc = v9fs_create_tread(fid, offset, count);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
+               if (!ret)
+                       ret = rc->params.rread.count;
+               if (rcp)
+                       *rcp = rc;
+               else
+                       kfree(rc);
+
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
+/**
+ * v9fs_t_write - write data
+ * @v9ses: 9P2000 session information
+ * @fid: fid to write to
+ * @offset: offset to start write at
+ * @count: how many bytes to write
+ * @fcall: pointer to response fcall
+ *
+ */
+
+int
+v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, u32 count,
+       const char __user *data, struct v9fs_fcall **rcp)
+{
+       int ret;
+       struct v9fs_fcall *tc, *rc;
+
+       dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid,
+               (long long unsigned) offset, count);
+
+       tc = v9fs_create_twrite(fid, offset, count, data);
+       if (!IS_ERR(tc)) {
+               ret = v9fs_mux_rpc(v9ses->mux, tc, &rc);
+
+               if (!ret)
+                       ret = rc->params.rwrite.count;
+               if (rcp)
+                       *rcp = rc;
+               else
+                       kfree(rc);
+
+               kfree(tc);
+       } else
+               ret = PTR_ERR(tc);
+
+       return ret;
+}
+
diff --git a/fs/9p/fcprint.c b/fs/9p/fcprint.c
new file mode 100644 (file)
index 0000000..583e827
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ *  linux/fs/9p/fcprint.c
+ *
+ *  Print 9P call.
+ *
+ *  Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to:
+ *  Free Software Foundation
+ *  51 Franklin Street, Fifth Floor
+ *  Boston, MA  02111-1301  USA
+ *
+ */
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/idr.h>
+
+#include "debug.h"
+#include "v9fs.h"
+#include "9p.h"
+#include "mux.h"
+
+static int
+v9fs_printqid(char *buf, int buflen, struct v9fs_qid *q)
+{
+       int n;
+       char b[10];
+
+       n = 0;
+       if (q->type & V9FS_QTDIR)
+               b[n++] = 'd';
+       if (q->type & V9FS_QTAPPEND)
+               b[n++] = 'a';
+       if (q->type & V9FS_QTAUTH)
+               b[n++] = 'A';
+       if (q->type & V9FS_QTEXCL)
+               b[n++] = 'l';
+       if (q->type & V9FS_QTTMP)
+               b[n++] = 't';
+       if (q->type & V9FS_QTSYMLINK)
+               b[n++] = 'L';
+       b[n] = '\0';
+
+       return scnprintf(buf, buflen, "(%.16llx %x %s)", (long long int) q->path,
+               q->version, b);
+}
+
+static int
+v9fs_printperm(char *buf, int buflen, int perm)
+{
+       int n;
+       char b[15];
+
+       n = 0;
+       if (perm & V9FS_DMDIR)
+               b[n++] = 'd';
+       if (perm & V9FS_DMAPPEND)
+               b[n++] = 'a';
+       if (perm & V9FS_DMAUTH)
+               b[n++] = 'A';
+       if (perm & V9FS_DMEXCL)
+               b[n++] = 'l';
+       if (perm & V9FS_DMTMP)
+               b[n++] = 't';
+       if (perm & V9FS_DMDEVICE)
+               b[n++] = 'D';
+       if (perm & V9FS_DMSOCKET)
+               b[n++] = 'S';
+       if (perm & V9FS_DMNAMEDPIPE)
+               b[n++] = 'P';
+       if (perm & V9FS_DMSYMLINK)
+               b[n++] = 'L';
+       b[n] = '\0';
+
+       return scnprintf(buf, buflen, "%s%03o", b, perm&077);
+}
+
+static int
+v9fs_printstat(char *buf, int buflen, struct v9fs_stat *st, int extended)
+{
+       int n;
+
+       n = scnprintf(buf, buflen, "'%.*s' '%.*s'", st->name.len,
+               st->name.str, st->uid.len, st->uid.str);
+       if (extended)
+               n += scnprintf(buf+n, buflen-n, "(%d)", st->n_uid);
+
+       n += scnprintf(buf+n, buflen-n, " '%.*s'", st->gid.len, st->gid.str);
+       if (extended)
+               n += scnprintf(buf+n, buflen-n, "(%d)", st->n_gid);
+
+       n += scnprintf(buf+n, buflen-n, " '%.*s'", st->muid.len, st->muid.str);
+       if (extended)
+               n += scnprintf(buf+n, buflen-n, "(%d)", st->n_muid);
+
+       n += scnprintf(buf+n, buflen-n, " q ");
+       n += v9fs_printqid(buf+n, buflen-n, &st->qid);
+       n += scnprintf(buf+n, buflen-n, " m ");
+       n += v9fs_printperm(buf+n, buflen-n, st->mode);
+       n += scnprintf(buf+n, buflen-n, " at %d mt %d l %lld",
+               st->atime, st->mtime, (long long int) st->length);
+
+       if (extended)
+               n += scnprintf(buf+n, buflen-n, " ext '%.*s'",
+                       st->extension.len, st->extension.str);
+
+       return n;
+}
+
+static int
+v9fs_dumpdata(char *buf, int buflen, u8 *data, int datalen)
+{
+       int i, n;
+
+       i = n = 0;
+       while (i < datalen) {
+               n += scnprintf(buf + n, buflen - n, "%02x", data[i]);
+               if (i%4 == 3)
+                       n += scnprintf(buf + n, buflen - n, " ");
+               if (i%32 == 31)
+                       n += scnprintf(buf + n, buflen - n, "\n");
+
+               i++;
+       }
+       n += scnprintf(buf + n, buflen - n, "\n");
+
+       return n;
+}
+
+static int
+v9fs_printdata(char *buf, int buflen, u8 *data, int datalen)
+{
+       return v9fs_dumpdata(buf, buflen, data, datalen<16?datalen:16);
+}
+
+int
+v9fs_printfcall(char *buf, int buflen, struct v9fs_fcall *fc, int extended)
+{
+       int i, ret, type, tag;
+
+       if (!fc)
+               return scnprintf(buf, buflen, "<NULL>");
+
+       type = fc->id;
+       tag = fc->tag;
+
+       ret = 0;
+       switch (type) {
+       case TVERSION:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Tversion tag %u msize %u version '%.*s'", tag,
+                       fc->params.tversion.msize, fc->params.tversion.version.len,
+                       fc->params.tversion.version.str);
+               break;
+
+       case RVERSION:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Rversion tag %u msize %u version '%.*s'", tag,
+                       fc->params.rversion.msize, fc->params.rversion.version.len,
+                       fc->params.rversion.version.str);
+               break;
+
+       case TAUTH:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Tauth tag %u afid %d uname '%.*s' aname '%.*s'", tag,
+                       fc->params.tauth.afid, fc->params.tauth.uname.len,
+                       fc->params.tauth.uname.str, fc->params.tauth.aname.len,
+                       fc->params.tauth.aname.str);
+               break;
+
+       case RAUTH:
+               ret += scnprintf(buf+ret, buflen-ret, "Rauth tag %u qid ", tag);
+               v9fs_printqid(buf+ret, buflen-ret, &fc->params.rauth.qid);
+               break;
+
+       case TATTACH:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Tattach tag %u fid %d afid %d uname '%.*s' aname '%.*s'",
+                       tag, fc->params.tattach.fid, fc->params.tattach.afid,
+                       fc->params.tattach.uname.len, fc->params.tattach.uname.str,
+                       fc->params.tattach.aname.len, fc->params.tattach.aname.str);
+               break;
+
+       case RATTACH:
+               ret += scnprintf(buf+ret, buflen-ret, "Rattach tag %u qid ", tag);
+               v9fs_printqid(buf+ret, buflen-ret, &fc->params.rattach.qid);
+               break;
+
+       case RERROR:
+               ret += scnprintf(buf+ret, buflen-ret, "Rerror tag %u ename '%.*s'",
+                       tag, fc->params.rerror.error.len,
+                       fc->params.rerror.error.str);
+               if (extended)
+                       ret += scnprintf(buf+ret, buflen-ret, " ecode %d\n",
+                               fc->params.rerror.errno);
+               break;
+
+       case TFLUSH:
+               ret += scnprintf(buf+ret, buflen-ret, "Tflush tag %u oldtag %u",
+                       tag, fc->params.tflush.oldtag);
+               break;
+
+       case RFLUSH:
+               ret += scnprintf(buf+ret, buflen-ret, "Rflush tag %u", tag);
+               break;
+
+       case TWALK:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Twalk tag %u fid %d newfid %d nwname %d", tag,
+                       fc->params.twalk.fid, fc->params.twalk.newfid,
+                       fc->params.twalk.nwname);
+               for(i = 0; i < fc->params.twalk.nwname; i++)
+                       ret += scnprintf(buf+ret, buflen-ret," '%.*s'",
+                               fc->params.twalk.wnames[i].len,
+                               fc->params.twalk.wnames[i].str);
+               break;
+
+       case RWALK:
+               ret += scnprintf(buf+ret, buflen-ret, "Rwalk tag %u nwqid %d",
+                       tag, fc->params.rwalk.nwqid);
+               for(i = 0; i < fc->params.rwalk.nwqid; i++)
+                       ret += v9fs_printqid(buf+ret, buflen-ret,
+                               &fc->params.rwalk.wqids[i]);
+               break;
+
+       case TOPEN:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Topen tag %u fid %d mode %d", tag,
+                       fc->params.topen.fid, fc->params.topen.mode);
+               break;
+
+       case ROPEN:
+               ret += scnprintf(buf+ret, buflen-ret, "Ropen tag %u", tag);
+               ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.ropen.qid);
+               ret += scnprintf(buf+ret, buflen-ret," iounit %d",
+                       fc->params.ropen.iounit);
+               break;
+
+       case TCREATE:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Tcreate tag %u fid %d name '%.*s' perm ", tag,
+                       fc->params.tcreate.fid, fc->params.tcreate.name.len,
+                       fc->params.tcreate.name.str);
+
+               ret += v9fs_printperm(buf+ret, buflen-ret, fc->params.tcreate.perm);
+               ret += scnprintf(buf+ret, buflen-ret, " mode %d",
+                       fc->params.tcreate.mode);
+               break;
+
+       case RCREATE:
+               ret += scnprintf(buf+ret, buflen-ret, "Rcreate tag %u", tag);
+               ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.rcreate.qid);
+               ret += scnprintf(buf+ret, buflen-ret, " iounit %d",
+                       fc->params.rcreate.iounit);
+               break;
+
+       case TREAD:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Tread tag %u fid %d offset %lld count %u", tag,
+                       fc->params.tread.fid,
+                       (long long int) fc->params.tread.offset,
+                       fc->params.tread.count);
+               break;
+
+       case RREAD:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Rread tag %u count %u data ", tag,
+                       fc->params.rread.count);
+               ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.rread.data,
+                       fc->params.rread.count);
+               break;
+
+       case TWRITE:
+               ret += scnprintf(buf+ret, buflen-ret,
+                       "Twrite tag %u fid %d offset %lld count %u data ",
+                       tag, fc->params.twrite.fid,
+                       (long long int) fc->params.twrite.offset,
+                       fc->params.twrite.count);
+               ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.twrite.data,
+                       fc->params.twrite.count);
+               break;
+
+       case RWRITE:
+               ret += scnprintf(buf+ret, buflen-ret, "Rwrite tag %u count %u",
+                       tag, fc->params.rwrite.count);
+               break;
+
+       case TCLUNK:
+               ret += scnprintf(buf+ret, buflen-ret, "Tclunk tag %u fid %d",
+                       tag, fc->params.tclunk.fid);
+               break;
+
+       case RCLUNK:
+               ret += scnprintf(buf+ret, buflen-ret, "Rclunk tag %u", tag);
+               break;
+
+       case TREMOVE:
+               ret += scnprintf(buf+ret, buflen-ret, "Tremove tag %u fid %d",
+                       tag, fc->params.tremove.fid);
+               break;
+
+       case RREMOVE:
+               ret += scnprintf(buf+ret, buflen-ret, "Rremove tag %u", tag);
+               break;
+
+       case TSTAT:
+               ret += scnprintf(buf+ret, buflen-ret, "Tstat tag %u fid %d",
+                       tag, fc->params.tstat.fid);
+               break;
+
+       case RSTAT:
+               ret += scnprintf(buf+ret, buflen-ret, "Rstat tag %u ", tag);
+               ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.rstat.stat,
+                       extended);
+               break;
+
+       case TWSTAT:
+               ret += scnprintf(buf+ret, buflen-ret, "Twstat tag %u fid %d ",
+                       tag, fc->params.twstat.fid);
+               ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.twstat.stat,
+                       extended);
+               break;
+
+       case RWSTAT:
+               ret += scnprintf(buf+ret, buflen-ret, "Rwstat tag %u", tag);
+               break;
+
+       default:
+               ret += scnprintf(buf+ret, buflen-ret, "unknown type %d", type);
+               break;
+       }
+
+       return ret;
+}
index c4d13bf..b7608af 100644 (file)
@@ -4,9 +4,8 @@
  *  Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index 1fc2dd0..aa974d6 100644 (file)
@@ -4,9 +4,8 @@
  *  Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index e2ae60a..3e5b124 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -70,7 +69,7 @@ struct v9fs_mux_data {
        int msize;
        unsigned char *extended;
        struct v9fs_transport *trans;
-       struct v9fs_idpool tidpool;
+       struct v9fs_idpool tagpool;
        int err;
        wait_queue_head_t equeue;
        struct list_head req_list;
@@ -280,8 +279,8 @@ struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize,
        m->msize = msize;
        m->extended = extended;
        m->trans = trans;
-       idr_init(&m->tidpool.pool);
-       init_MUTEX(&m->tidpool.lock);
+       idr_init(&m->tagpool.pool);
+       init_MUTEX(&m->tagpool.lock);
        m->err = 0;
        init_waitqueue_head(&m->equeue);
        INIT_LIST_HEAD(&m->req_list);
@@ -635,6 +634,14 @@ static void v9fs_read_work(void *a)
                        goto error;
                }
 
+               if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
+                       char buf[150];
+
+                       v9fs_printfcall(buf, sizeof(buf), m->rcall,
+                               *m->extended);
+                       printk(KERN_NOTICE ">>> %p %s\n", m, buf);
+               }
+
                rcall = m->rcall;
                rbuf = m->rbuf;
                if (m->rpos > n) {
@@ -740,6 +747,13 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
 
        v9fs_set_tag(tc, n);
 
+       if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
+               char buf[150];
+
+               v9fs_printfcall(buf, sizeof(buf), tc, *m->extended);
+               printk(KERN_NOTICE "<<< %p %s\n", m, buf);
+       }
+
        req->tag = n;
        req->tcall = tc;
        req->rcall = NULL;
@@ -965,7 +979,7 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m)
 {
        int tag;
 
-       tag = v9fs_get_idpool(&m->tidpool);
+       tag = v9fs_get_idpool(&m->tagpool);
        if (tag < 0)
                return V9FS_NOTAG;
        else
@@ -974,6 +988,6 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m)
 
 static void v9fs_mux_put_tag(struct v9fs_mux_data *m, u16 tag)
 {
-       if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tidpool))
-               v9fs_put_idpool(tag, &m->tidpool);
+       if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tagpool))
+               v9fs_put_idpool(tag, &m->tagpool);
 }
index 17144fd..e90bfd3 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index 5b2ce21..94e0a7f 100644 (file)
@@ -1,15 +1,16 @@
 /*
  * linux/fs/9p/trans_fd.c
  *
- * File Descriptor Transport Layer
+ * Fd transport layer.  Includes deprecated socket layer.
  *
- *  Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
- *  Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
+ *  Copyright (C) 2006 by Russ Cox <rsc@swtch.com>
+ *  Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net>
+ *  Copyright (C) 2004-2005 by Eric Van Hensbergen <ericvh@gmail.com>
+ *  Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,6 +26,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/in.h>
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/ipv6.h>
 #include "v9fs.h"
 #include "transport.h"
 
+#define V9FS_PORT 564
+
 struct v9fs_trans_fd {
-       struct file *in_file;
-       struct file *out_file;
+       struct file *rd;
+       struct file *wr;
 };
 
 /**
- * v9fs_fd_recv - receive from a socket
+ * v9fs_fd_read- read from a fd
  * @v9ses: session information
  * @v: buffer to receive data into
  * @len: size of receive buffer
  *
  */
-
-static int v9fs_fd_recv(struct v9fs_transport *trans, void *v, int len)
+static int v9fs_fd_read(struct v9fs_transport *trans, void *v, int len)
 {
-       struct v9fs_trans_fd *ts = trans ? trans->priv : NULL;
+       int ret;
+       struct v9fs_trans_fd *ts;
 
-       if (!trans || trans->status != Connected || !ts)
-               return -EIO;
+       if (!trans || trans->status == Disconnected || !(ts = trans->priv))
+               return -EREMOTEIO;
 
-       return kernel_read(ts->in_file, ts->in_file->f_pos, v, len);
+       if (!(ts->rd->f_flags & O_NONBLOCK))
+               dprintk(DEBUG_ERROR, "blocking read ...\n");
+
+       ret = kernel_read(ts->rd, ts->rd->f_pos, v, len);
+       if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN)
+               trans->status = Disconnected;
+       return ret;
 }
 
 /**
- * v9fs_fd_send - send to a socket
+ * v9fs_fd_write - write to a socket
  * @v9ses: session information
  * @v: buffer to send data from
  * @len: size of send buffer
  *
  */
-
-static int v9fs_fd_send(struct v9fs_transport *trans, void *v, int len)
+static int v9fs_fd_write(struct v9fs_transport *trans, void *v, int len)
 {
-       struct v9fs_trans_fd *ts = trans ? trans->priv : NULL;
-       mm_segment_t oldfs = get_fs();
-       int ret = 0;
+       int ret;
+       mm_segment_t oldfs;
+       struct v9fs_trans_fd *ts;
 
-       if (!trans || trans->status != Connected || !ts)
-               return -EIO;
+       if (!trans || trans->status == Disconnected || !(ts = trans->priv))
+               return -EREMOTEIO;
+
+       if (!(ts->wr->f_flags & O_NONBLOCK))
+               dprintk(DEBUG_ERROR, "blocking write ...\n");
 
        oldfs = get_fs();
        set_fs(get_ds());
        /* The cast to a user pointer is valid due to the set_fs() */
-       ret = vfs_write(ts->out_file, (void __user *)v, len, &ts->out_file->f_pos);
+       ret = vfs_write(ts->wr, (void __user *)v, len, &ts->wr->f_pos);
        set_fs(oldfs);
 
+       if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN)
+               trans->status = Disconnected;
        return ret;
 }
 
-/**
- * v9fs_fd_init - initialize file descriptor transport
- * @v9ses: session information
- * @addr: address of server to mount
- * @data: mount options
- *
- */
-
-static int
-v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data)
+static unsigned int
+v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt)
 {
-       struct v9fs_trans_fd *ts = NULL;
-       struct v9fs_transport *trans = v9ses->transport;
+       int ret, n;
+       struct v9fs_trans_fd *ts;
+       mm_segment_t oldfs;
 
-       if((v9ses->wfdno == ~0) || (v9ses->rfdno == ~0)) {
-               printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n");
-               return -ENOPROTOOPT;
-       }
+       if (!trans || trans->status != Connected || !(ts = trans->priv))
+               return -EREMOTEIO;
 
-       ts = kmalloc(sizeof(struct v9fs_trans_fd), GFP_KERNEL);
+       if (!ts->rd->f_op || !ts->rd->f_op->poll)
+               return -EIO;
 
-       if (!ts)
-               return -ENOMEM;
+       if (!ts->wr->f_op || !ts->wr->f_op->poll)
+               return -EIO;
 
-       ts->in_file = fget( v9ses->rfdno );
-       ts->out_file = fget( v9ses->wfdno );
+       oldfs = get_fs();
+       set_fs(get_ds());
 
-       if (!ts->in_file || !ts->out_file) {
-               if (ts->in_file)
-                       fput(ts->in_file);
+       ret = ts->rd->f_op->poll(ts->rd, pt);
+       if (ret < 0)
+               goto end;
 
-               if (ts->out_file)
-                       fput(ts->out_file);
+       if (ts->rd != ts->wr) {
+               n = ts->wr->f_op->poll(ts->wr, pt);
+               if (n < 0) {
+                       ret = n;
+                       goto end;
+               }
+               ret = (ret & ~POLLOUT) | (n & ~POLLIN);
+       }
 
+      end:
+       set_fs(oldfs);
+       return ret;
+}
+
+static int v9fs_fd_open(struct v9fs_session_info *v9ses, int rfd, int wfd)
+{
+       struct v9fs_transport *trans = v9ses->transport;
+       struct v9fs_trans_fd *ts = kmalloc(sizeof(struct v9fs_trans_fd),
+                                          GFP_KERNEL);
+       if (!ts)
+               return -ENOMEM;
+
+       ts->rd = fget(rfd);
+       ts->wr = fget(wfd);
+       if (!ts->rd || !ts->wr) {
+               if (ts->rd)
+                       fput(ts->rd);
+               if (ts->wr)
+                       fput(ts->wr);
                kfree(ts);
                return -EIO;
        }
@@ -133,84 +165,145 @@ v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data)
        return 0;
 }
 
-
-/**
- * v9fs_fd_close - shutdown file descriptor
- * @trans: private socket structure
- *
- */
-
-static void v9fs_fd_close(struct v9fs_transport *trans)
+static int v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr,
+                       char *data)
 {
-       struct v9fs_trans_fd *ts;
-
-       if (!trans)
-               return;
-
-       ts = xchg(&trans->priv, NULL);
+       if (v9ses->rfdno == ~0 || v9ses->wfdno == ~0) {
+               printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n");
+               return -ENOPROTOOPT;
+       }
 
-       if (!ts)
-               return;
+       return v9fs_fd_open(v9ses, v9ses->rfdno, v9ses->wfdno);
+}
 
-       trans->status = Disconnected;
-       if (ts->in_file)
-               fput(ts->in_file);
+static int v9fs_socket_open(struct v9fs_session_info *v9ses,
+                           struct socket *csocket)
+{
+       int fd, ret;
+
+       csocket->sk->sk_allocation = GFP_NOIO;
+       if ((fd = sock_map_fd(csocket)) < 0) {
+               eprintk(KERN_ERR, "v9fs_socket_open: failed to map fd\n");
+               ret = fd;
+             release_csocket:
+               sock_release(csocket);
+               return ret;
+       }
 
-       if (ts->out_file)
-               fput(ts->out_file);
+       if ((ret = v9fs_fd_open(v9ses, fd, fd)) < 0) {
+               sockfd_put(csocket);
+               eprintk(KERN_ERR, "v9fs_socket_open: failed to open fd\n");
+               goto release_csocket;
+       }
 
-       kfree(ts);
+       ((struct v9fs_trans_fd *)v9ses->transport->priv)->rd->f_flags |=
+           O_NONBLOCK;
+       return 0;
 }
 
-static unsigned int
-v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt)
+static int v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr,
+                        char *data)
 {
-       int ret, n;
-       struct v9fs_trans_fd *ts;
-       mm_segment_t oldfs;
+       int ret;
+       struct socket *csocket = NULL;
+       struct sockaddr_in sin_server;
+
+       sin_server.sin_family = AF_INET;
+       sin_server.sin_addr.s_addr = in_aton(addr);
+       sin_server.sin_port = htons(v9ses->port);
+       sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket);
+
+       if (!csocket) {
+               eprintk(KERN_ERR, "v9fs_trans_tcp: problem creating socket\n");
+               return -1;
+       }
 
-       if (!trans)
-               return -EIO;
+       ret = csocket->ops->connect(csocket,
+                                   (struct sockaddr *)&sin_server,
+                                   sizeof(struct sockaddr_in), 0);
+       if (ret < 0) {
+               eprintk(KERN_ERR,
+                       "v9fs_trans_tcp: problem connecting socket to %s\n",
+                       addr);
+               return ret;
+       }
 
-       ts = trans->priv;
-       if (trans->status != Connected || !ts)
-               return -EIO;
+       return v9fs_socket_open(v9ses, csocket);
+}
 
-       oldfs = get_fs();
-       set_fs(get_ds());
+static int
+v9fs_unix_init(struct v9fs_session_info *v9ses, const char *addr, char *data)
+{
+       int ret;
+       struct socket *csocket;
+       struct sockaddr_un sun_server;
+
+       if (strlen(addr) > UNIX_PATH_MAX) {
+               eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n",
+                       addr);
+               return -ENAMETOOLONG;
+       }
 
-       if (!ts->in_file->f_op || !ts->in_file->f_op->poll) {
-               ret = -EIO;
-               goto end;
+       sun_server.sun_family = PF_UNIX;
+       strcpy(sun_server.sun_path, addr);
+       sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket);
+       ret = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server,
+                       sizeof(struct sockaddr_un) - 1, 0);
+       if (ret < 0) {
+               eprintk(KERN_ERR,
+                       "v9fs_trans_unix: problem connecting socket: %s: %d\n",
+                       addr, ret);
+               return ret;
        }
 
-       ret = ts->in_file->f_op->poll(ts->in_file, pt);
+       return v9fs_socket_open(v9ses, csocket);
+}
 
-       if (ts->out_file != ts->in_file) {
-               if (!ts->out_file->f_op || !ts->out_file->f_op->poll) {
-                       ret = -EIO;
-                       goto end;
-               }
+/**
+ * v9fs_sock_close - shutdown socket
+ * @trans: private socket structure
+ *
+ */
+static void v9fs_fd_close(struct v9fs_transport *trans)
+{
+       struct v9fs_trans_fd *ts;
 
-               n = ts->out_file->f_op->poll(ts->out_file, pt);
+       if (!trans)
+               return;
 
-               ret &= ~POLLOUT;
-               n &= ~POLLIN;
+       ts = xchg(&trans->priv, NULL);
 
-               ret |= n;
-       }
+       if (!ts)
+               return;
 
-end:
-       set_fs(oldfs);
-       return ret;
+       trans->status = Disconnected;
+       if (ts->rd)
+               fput(ts->rd);
+       if (ts->wr)
+               fput(ts->wr);
+       kfree(ts);
 }
 
-
 struct v9fs_transport v9fs_trans_fd = {
        .init = v9fs_fd_init,
-       .write = v9fs_fd_send,
-       .read = v9fs_fd_recv,
+       .write = v9fs_fd_write,
+       .read = v9fs_fd_read,
        .close = v9fs_fd_close,
        .poll = v9fs_fd_poll,
 };
 
+struct v9fs_transport v9fs_trans_tcp = {
+       .init = v9fs_tcp_init,
+       .write = v9fs_fd_write,
+       .read = v9fs_fd_read,
+       .close = v9fs_fd_close,
+       .poll = v9fs_fd_poll,
+};
+
+struct v9fs_transport v9fs_trans_unix = {
+       .init = v9fs_unix_init,
+       .write = v9fs_fd_write,
+       .read = v9fs_fd_read,
+       .close = v9fs_fd_close,
+       .poll = v9fs_fd_poll,
+};
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c
deleted file mode 100644 (file)
index 44e8306..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * linux/fs/9p/trans_socket.c
- *
- * Socket Transport Layer
- *
- *  Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net>
- *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
- *  Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com>
- *  Copyright (C) 1995, 1996 by Olaf Kirch <okir@monad.swb.de>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to:
- *  Free Software Foundation
- *  51 Franklin Street, Fifth Floor
- *  Boston, MA  02111-1301  USA
- *
- */
-
-#include <linux/config.h>
-#include <linux/in.h>
-#include <linux/module.h>
-#include <linux/net.h>
-#include <linux/ipv6.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/un.h>
-#include <asm/uaccess.h>
-#include <linux/inet.h>
-#include <linux/idr.h>
-#include <linux/file.h>
-
-#include "debug.h"
-#include "v9fs.h"
-#include "transport.h"
-
-#define V9FS_PORT 564
-
-struct v9fs_trans_sock {
-       struct socket *s;
-       struct file *filp;
-};
-
-/**
- * v9fs_sock_recv - receive from a socket
- * @v9ses: session information
- * @v: buffer to receive data into
- * @len: size of receive buffer
- *
- */
-
-static int v9fs_sock_recv(struct v9fs_transport *trans, void *v, int len)
-{
-       int ret;
-       struct v9fs_trans_sock *ts;
-
-       if (!trans || trans->status == Disconnected) {
-               dprintk(DEBUG_ERROR, "disconnected ...\n");
-               return -EREMOTEIO;
-       }
-
-       ts = trans->priv;
-
-       if (!(ts->filp->f_flags & O_NONBLOCK))
-               dprintk(DEBUG_ERROR, "blocking read ...\n");
-
-       ret = kernel_read(ts->filp, ts->filp->f_pos, v, len);
-       if (ret <= 0) {
-               if (ret != -ERESTARTSYS && ret != -EAGAIN)
-                       trans->status = Disconnected;
-       }
-
-       return ret;
-}
-
-/**
- * v9fs_sock_send - send to a socket
- * @v9ses: session information
- * @v: buffer to send data from
- * @len: size of send buffer
- *
- */
-
-static int v9fs_sock_send(struct v9fs_transport *trans, void *v, int len)
-{
-       int ret;
-       mm_segment_t oldfs;
-       struct v9fs_trans_sock *ts;
-
-       if (!trans || trans->status == Disconnected) {
-               dprintk(DEBUG_ERROR, "disconnected ...\n");
-               return -EREMOTEIO;
-       }
-
-       ts = trans->priv;
-       if (!ts) {
-               dprintk(DEBUG_ERROR, "no transport ...\n");
-               return -EREMOTEIO;
-       }
-
-       if (!(ts->filp->f_flags & O_NONBLOCK))
-               dprintk(DEBUG_ERROR, "blocking write ...\n");
-
-       oldfs = get_fs();
-       set_fs(get_ds());
-       ret = vfs_write(ts->filp, (void __user *)v, len, &ts->filp->f_pos);
-       set_fs(oldfs);
-
-       if (ret < 0) {
-               if (ret != -ERESTARTSYS)
-                       trans->status = Disconnected;
-       }
-
-       return ret;
-}
-
-static unsigned int v9fs_sock_poll(struct v9fs_transport *trans,
-       struct poll_table_struct *pt) {
-
-       int ret;
-       struct v9fs_trans_sock *ts;
-       mm_segment_t oldfs;
-
-       if (!trans) {
-               dprintk(DEBUG_ERROR, "no transport\n");
-               return -EIO;
-       }
-
-       ts = trans->priv;
-       if (trans->status != Connected || !ts) {
-               dprintk(DEBUG_ERROR, "transport disconnected: %d\n", trans->status);
-               return -EIO;
-       }
-
-       oldfs = get_fs();
-       set_fs(get_ds());
-
-       if (!ts->filp->f_op || !ts->filp->f_op->poll) {
-               dprintk(DEBUG_ERROR, "no poll operation\n");
-               ret = -EIO;
-               goto end;
-       }
-
-       ret = ts->filp->f_op->poll(ts->filp, pt);
-
-end:
-       set_fs(oldfs);
-       return ret;
-}
-
-
-/**
- * v9fs_tcp_init - initialize TCP socket
- * @v9ses: session information
- * @addr: address of server to mount
- * @data: mount options
- *
- */
-
-static int
-v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, char *data)
-{
-       struct socket *csocket = NULL;
-       struct sockaddr_in sin_server;
-       int rc = 0;
-       struct v9fs_trans_sock *ts = NULL;
-       struct v9fs_transport *trans = v9ses->transport;
-       int fd;
-
-       trans->status = Disconnected;
-
-       ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL);
-
-       if (!ts)
-               return -ENOMEM;
-
-       trans->priv = ts;
-       ts->s = NULL;
-       ts->filp = NULL;
-
-       if (!addr)
-               return -EINVAL;
-
-       dprintk(DEBUG_TRANS, "Connecting to %s\n", addr);
-
-       sin_server.sin_family = AF_INET;
-       sin_server.sin_addr.s_addr = in_aton(addr);
-       sin_server.sin_port = htons(v9ses->port);
-       sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket);
-       rc = csocket->ops->connect(csocket,
-                                  (struct sockaddr *)&sin_server,
-                                  sizeof(struct sockaddr_in), 0);
-       if (rc < 0) {
-               eprintk(KERN_ERR,
-                       "v9fs_trans_tcp: problem connecting socket to %s\n",
-                       addr);
-               return rc;
-       }
-       csocket->sk->sk_allocation = GFP_NOIO;
-
-       fd = sock_map_fd(csocket);
-       if (fd < 0) {
-               sock_release(csocket);
-               kfree(ts);
-               trans->priv = NULL;
-               return fd;
-       }
-
-       ts->s = csocket;
-       ts->filp = fget(fd);
-       ts->filp->f_flags |= O_NONBLOCK;
-       trans->status = Connected;
-
-       return 0;
-}
-
-/**
- * v9fs_unix_init - initialize UNIX domain socket
- * @v9ses: session information
- * @dev_name: path to named pipe
- * @data: mount options
- *
- */
-
-static int
-v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name,
-              char *data)
-{
-       int rc, fd;
-       struct socket *csocket;
-       struct sockaddr_un sun_server;
-       struct v9fs_transport *trans;
-       struct v9fs_trans_sock *ts;
-
-       rc = 0;
-       csocket = NULL;
-       trans = v9ses->transport;
-
-       trans->status = Disconnected;
-
-       if (strlen(dev_name) > UNIX_PATH_MAX) {
-               eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n",
-                       dev_name);
-               return -ENOMEM;
-       }
-
-       ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL);
-       if (!ts)
-               return -ENOMEM;
-
-       trans->priv = ts;
-       ts->s = NULL;
-       ts->filp = NULL;
-
-       sun_server.sun_family = PF_UNIX;
-       strcpy(sun_server.sun_path, dev_name);
-       sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket);
-       rc = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server,
-               sizeof(struct sockaddr_un) - 1, 0);     /* -1 *is* important */
-       if (rc < 0) {
-               eprintk(KERN_ERR,
-                       "v9fs_trans_unix: problem connecting socket: %s: %d\n",
-                       dev_name, rc);
-               return rc;
-       }
-       csocket->sk->sk_allocation = GFP_NOIO;
-
-       fd = sock_map_fd(csocket);
-       if (fd < 0) {
-               sock_release(csocket);
-               kfree(ts);
-               trans->priv = NULL;
-               return fd;
-       }
-
-       ts->s = csocket;
-       ts->filp = fget(fd);
-       ts->filp->f_flags |= O_NONBLOCK;
-       trans->status = Connected;
-
-       return 0;
-}
-
-/**
- * v9fs_sock_close - shutdown socket
- * @trans: private socket structure
- *
- */
-
-static void v9fs_sock_close(struct v9fs_transport *trans)
-{
-       struct v9fs_trans_sock *ts;
-
-       if (!trans)
-               return;
-
-       ts = trans->priv;
-
-       if ((ts) && (ts->filp)) {
-               fput(ts->filp);
-               ts->filp = NULL;
-               ts->s = NULL;
-               trans->status = Disconnected;
-       }
-
-       kfree(ts);
-
-       trans->priv = NULL;
-}
-
-struct v9fs_transport v9fs_trans_tcp = {
-       .init = v9fs_tcp_init,
-       .write = v9fs_sock_send,
-       .read = v9fs_sock_recv,
-       .close = v9fs_sock_close,
-       .poll = v9fs_sock_poll,
-};
-
-struct v9fs_transport v9fs_trans_unix = {
-       .init = v9fs_unix_init,
-       .write = v9fs_sock_send,
-       .read = v9fs_sock_recv,
-       .close = v9fs_sock_close,
-       .poll = v9fs_sock_poll,
-};
index 91fcdb9..b38a4b8 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index 6135249..d37416e 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -51,7 +50,7 @@ enum {
        Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug,
        Opt_rfdno, Opt_wfdno,
        /* String options */
-       Opt_name, Opt_remotename,
+       Opt_uname, Opt_remotename,
        /* Options that take no arguments */
        Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd,
        /* Error token */
@@ -67,7 +66,7 @@ static match_table_t tokens = {
        {Opt_rfdno, "rfdno=%u"},
        {Opt_wfdno, "wfdno=%u"},
        {Opt_debug, "debug=%x"},
-       {Opt_name, "name=%s"},
+       {Opt_uname, "uname=%s"},
        {Opt_remotename, "aname=%s"},
        {Opt_unix, "proto=unix"},
        {Opt_tcp, "proto=tcp"},
@@ -116,7 +115,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses)
                if (!*p)
                        continue;
                token = match_token(p, tokens, args);
-               if (token < Opt_name) {
+               if (token < Opt_uname) {
                        if ((ret = match_int(&args[0], &option)) < 0) {
                                dprintk(DEBUG_ERROR,
                                        "integer field, but no integer?\n");
@@ -158,7 +157,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses)
                case Opt_fd:
                        v9ses->proto = PROTO_FD;
                        break;
-               case Opt_name:
+               case Opt_uname:
                        match_strcpy(v9ses->name, &args[0]);
                        break;
                case Opt_remotename:
@@ -289,7 +288,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
        /* set global debug level */
        v9fs_debug_level = v9ses->debug;
 
-       /* id pools that are session-dependent: FIDs and TIDs */
+       /* id pools that are session-dependent: fids and tags */
        idr_init(&v9ses->fidpool.pool);
        init_MUTEX(&v9ses->fidpool.lock);
 
index f337da7..c134d10 100644 (file)
@@ -5,9 +5,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -91,6 +90,3 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses);
 #define V9FS_DEFUSER   "nobody"
 #define V9FS_DEFANAME  ""
 
-/* inital pool sizes for fids and tags */
-#define V9FS_START_FIDS 8192
-#define V9FS_START_TIDS 256
index a759278..43c9f7d 100644 (file)
@@ -5,9 +5,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index 8100fb5..efda46f 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index 12c9cc9..062daa6 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -51,7 +50,7 @@
  *
  */
 
-int v9fs_dentry_delete(struct dentry *dentry)
+static int v9fs_dentry_delete(struct dentry *dentry)
 {
        dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry);
        return 1;
index cd5eeb0..766f11f 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
index de3a129..59e7441 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -69,29 +68,30 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 
        fid = v9fs_get_idpool(&v9ses->fidpool);
        if (fid < 0) {
-                       eprintk(KERN_WARNING, "newfid fails!\n");
-                       return -ENOSPC;
-               }
+               eprintk(KERN_WARNING, "newfid fails!\n");
+               return -ENOSPC;
+       }
 
        err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
        if (err < 0) {
-                       dprintk(DEBUG_ERROR, "rewalk didn't work\n");
+               dprintk(DEBUG_ERROR, "rewalk didn't work\n");
                goto put_fid;
        }
 
-       vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
-       if (vfid == NULL) {
-               dprintk(DEBUG_ERROR, "out of memory\n");
-               goto clunk_fid;
-               }
-
-               /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
-               /* translate open mode appropriately */
+       /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
+       /* translate open mode appropriately */
        omode = v9fs_uflags2omode(file->f_flags);
        err = v9fs_t_open(v9ses, fid, omode, &fcall);
        if (err < 0) {
                PRINT_FCALL_ERROR("open failed", fcall);
-               goto destroy_vfid;
+               goto clunk_fid;
+       }
+
+       vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
+       if (vfid == NULL) {
+               dprintk(DEBUG_ERROR, "out of memory\n");
+               err = -ENOMEM;
+               goto clunk_fid;
        }
 
        file->private_data = vfid;
@@ -106,15 +106,12 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 
        return 0;
 
-destroy_vfid:
-       v9fs_fid_destroy(vfid);
-
 clunk_fid:
        v9fs_t_clunk(v9ses, fid);
 
 put_fid:
        v9fs_put_idpool(fid, &v9ses->fidpool);
-               kfree(fcall);
+       kfree(fcall);
 
        return err;
 }
index 651a9e1..133db36 100644 (file)
@@ -7,9 +7,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -255,8 +254,8 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
 }
 
 static int
-v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
-       u32 perm, u8 mode, u32 *fidp, struct v9fs_qid *qid, u32 *iounit)
+v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm,
+       u8 mode, char *extension, u32 *fidp, struct v9fs_qid *qid, u32 *iounit)
 {
        u32 fid;
        int err;
@@ -271,14 +270,14 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
        err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
        if (err < 0) {
                PRINT_FCALL_ERROR("clone error", fcall);
-               goto error;
+               goto put_fid;
        }
        kfree(fcall);
 
-       err = v9fs_t_create(v9ses, fid, name, perm, mode, &fcall);
+       err = v9fs_t_create(v9ses, fid, name, perm, mode, extension, &fcall);
        if (err < 0) {
                PRINT_FCALL_ERROR("create fails", fcall);
-               goto error;
+               goto clunk_fid;
        }
 
        if (iounit)
@@ -293,7 +292,11 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
        kfree(fcall);
        return 0;
 
-error:
+clunk_fid:
+       v9fs_t_clunk(v9ses, fid);
+       fid = V9FS_NOFID;
+
+put_fid:
        if (fid >= 0)
                v9fs_put_idpool(fid, &v9ses->fidpool);
 
@@ -348,7 +351,7 @@ error:
        return ERR_PTR(err);
 }
 
-struct inode *
+static struct inode *
 v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid,
        struct super_block *sb)
 {
@@ -474,7 +477,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
                flags = O_RDWR;
 
        err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
-               perm, v9fs_uflags2omode(flags), &fid, &qid, &iounit);
+               perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit);
 
        if (err)
                goto error;
@@ -550,7 +553,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
 
        err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
-               perm, V9FS_OREAD, &fid, NULL, NULL);
+               perm, V9FS_OREAD, NULL, &fid, NULL, NULL);
 
        if (err) {
                dprintk(DEBUG_ERROR, "create error %d\n", err);
@@ -1008,11 +1011,13 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
 
        /* copy extension buffer into buffer */
        if (fcall->params.rstat.stat.extension.len < buflen)
-               buflen = fcall->params.rstat.stat.extension.len;
+               buflen = fcall->params.rstat.stat.extension.len + 1;
 
-       memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
+       memmove(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
        buffer[buflen-1] = 0;
 
+       dprintk(DEBUG_ERROR, "%s -> %.*s (%s)\n", dentry->d_name.name, fcall->params.rstat.stat.extension.len,
+               fcall->params.rstat.stat.extension.str, buffer);
        retval = buflen;
 
       FreeFcall:
@@ -1072,7 +1077,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
        if (!link)
                link = ERR_PTR(-ENOMEM);
        else {
-               len = v9fs_readlink(dentry, link, strlen(link));
+               len = v9fs_readlink(dentry, link, PATH_MAX);
 
                if (len < 0) {
                        __putname(link);
@@ -1109,10 +1114,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
        struct v9fs_session_info *v9ses;
        struct v9fs_fid *dfid, *vfid;
        struct inode *inode;
-       struct v9fs_fcall *fcall;
-       struct v9fs_wstat wstat;
 
-       fcall = NULL;
        inode = NULL;
        vfid = NULL;
        v9ses = v9fs_inode2v9ses(dir);
@@ -1125,7 +1127,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
        }
 
        err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
-               perm, V9FS_OREAD, &fid, NULL, NULL);
+               perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL);
 
        if (err)
                goto error;
@@ -1148,23 +1150,11 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
                goto error;
        }
 
-       /* issue a Twstat */
-       v9fs_blank_wstat(&wstat);
-       wstat.muid = v9ses->name;
-       wstat.extension = (char *) extension;
-       err = v9fs_t_wstat(v9ses, vfid->fid, &wstat, &fcall);
-       if (err < 0) {
-               PRINT_FCALL_ERROR("wstat error", fcall);
-               goto error;
-       }
-
-       kfree(fcall);
        dentry->d_op = &v9fs_dentry_operations;
        d_instantiate(dentry, inode);
        return 0;
 
 error:
-       kfree(fcall);
        if (vfid)
                v9fs_fid_destroy(vfid);
 
@@ -1224,7 +1214,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
        }
 
        name = __getname();
-       sprintf(name, "hardlink(%d)\n", oldfid->fid);
+       sprintf(name, "%d\n", oldfid->fid);
        retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
        __putname(name);
 
@@ -1253,6 +1243,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
                return -EINVAL;
 
        name = __getname();
+       if (!name)
+               return -ENOMEM;
        /* build extension */
        if (S_ISBLK(mode))
                sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev));
index d05318f..b0a0ae5 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -262,7 +261,7 @@ static struct super_operations v9fs_super_ops = {
 };
 
 struct file_system_type v9fs_fs_type = {
-       .name = "9P",
+       .name = "9p",
        .get_sb = v9fs_get_sb,
        .kill_sb = v9fs_kill_super,
        .owner = THIS_MODULE,
index aec2b19..e41e932 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -122,10 +122,9 @@ static int aio_setup_ring(struct kioctx *ctx)
        info->nr = 0;
        info->ring_pages = info->internal_pages;
        if (nr_pages > AIO_RING_PAGES) {
-               info->ring_pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL);
+               info->ring_pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
                if (!info->ring_pages)
                        return -ENOMEM;
-               memset(info->ring_pages, 0, sizeof(struct page *) * nr_pages);
        }
 
        info->mmap_size = nr_pages * PAGE_SIZE;
index c2eac2a..4349113 100644 (file)
@@ -1334,7 +1334,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
 
        i = p->state ? ffz(~p->state) + 1 : 0;
        psinfo->pr_state = i;
-       psinfo->pr_sname = (i < 0 || i > 5) ? '.' : "RSDTZW"[i];
+       psinfo->pr_sname = (i > 5) ? '.' : "RSDTZW"[i];
        psinfo->pr_zomb = psinfo->pr_sname == 'Z';
        psinfo->pr_nice = task_nice(p);
        psinfo->pr_flag = p->flags;
@@ -1465,12 +1465,11 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file)
                read_lock(&tasklist_lock);
                do_each_thread(g,p)
                        if (current->mm == p->mm && current != p) {
-                               tmp = kmalloc(sizeof(*tmp), GFP_ATOMIC);
+                               tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
                                if (!tmp) {
                                        read_unlock(&tasklist_lock);
                                        goto cleanup;
                                }
-                               memset(tmp, 0, sizeof(*tmp));
                                INIT_LIST_HEAD(&tmp->list);
                                tmp->thread = p;
                                list_add(&tmp->list, &thread_list);
index 108d56b..69f44dc 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/personality.h>
 #include <linux/init.h>
 #include <linux/flat.h>
+#include <linux/syscalls.h>
 
 #include <asm/byteorder.h>
 #include <asm/system.h>
@@ -426,6 +427,8 @@ static int load_flat_file(struct linux_binprm * bprm,
        int i, rev, relocs = 0;
        loff_t fpos;
        unsigned long start_code, end_code;
+       int ret;
+       int exec_fileno;
 
        hdr = ((struct flat_hdr *) bprm->buf);          /* exec-header */
        inode = bprm->file->f_dentry->d_inode;
@@ -450,7 +453,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                 */
                if (strncmp(hdr->magic, "#!", 2))
                        printk("BINFMT_FLAT: bad header magic\n");
-               return -ENOEXEC;
+               ret = -ENOEXEC;
+               goto err;
        }
 
        if (flags & FLAT_FLAG_KTRACE)
@@ -458,14 +462,16 @@ static int load_flat_file(struct linux_binprm * bprm,
 
        if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
                printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION);
-               return -ENOEXEC;
+               ret = -ENOEXEC;
+               goto err;
        }
        
        /* Don't allow old format executables to use shared libraries */
        if (rev == OLD_FLAT_VERSION && id != 0) {
                printk("BINFMT_FLAT: shared libraries are not available before rev 0x%x\n",
                                (int) FLAT_VERSION);
-               return -ENOEXEC;
+               ret = -ENOEXEC;
+               goto err;
        }
 
        /*
@@ -478,7 +484,8 @@ static int load_flat_file(struct linux_binprm * bprm,
 #ifndef CONFIG_BINFMT_ZFLAT
        if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) {
                printk("Support for ZFLAT executables is not enabled.\n");
-               return -ENOEXEC;
+               ret = -ENOEXEC;
+               goto err;
        }
 #endif
 
@@ -490,14 +497,27 @@ static int load_flat_file(struct linux_binprm * bprm,
        rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
        if (rlim >= RLIM_INFINITY)
                rlim = ~0;
-       if (data_len + bss_len > rlim)
-               return -ENOMEM;
+       if (data_len + bss_len > rlim) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       /* check file descriptor */
+       exec_fileno = get_unused_fd();
+       if (exec_fileno < 0) {
+               ret = -EMFILE;
+               goto err;
+       }
+       get_file(bprm->file);
+       fd_install(exec_fileno, bprm->file);
 
        /* Flush all traces of the currently running executable */
        if (id == 0) {
                result = flush_old_exec(bprm);
-               if (result)
-                       return result;
+               if (result) {
+                       ret = result;
+                       goto err_close;
+               }
 
                /* OK, This is the point of no return */
                set_personality(PER_LINUX);
@@ -527,7 +547,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                        if (!textpos)
                                textpos = (unsigned long) -ENOMEM;
                        printk("Unable to mmap process text, errno %d\n", (int)-textpos);
-                       return(textpos);
+                       ret = textpos;
+                       goto err_close;
                }
 
                down_write(&current->mm->mmap_sem);
@@ -542,7 +563,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                        printk("Unable to allocate RAM for process data, errno %d\n",
                                        (int)-datapos);
                        do_munmap(current->mm, textpos, text_len);
-                       return realdatastart;
+                       ret = realdatastart;
+                       goto err_close;
                }
                datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long);
 
@@ -564,7 +586,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                        printk("Unable to read data+bss, errno %d\n", (int)-result);
                        do_munmap(current->mm, textpos, text_len);
                        do_munmap(current->mm, realdatastart, data_len + extra);
-                       return result;
+                       ret = result;
+                       goto err_close;
                }
 
                reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len));
@@ -582,7 +605,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                                textpos = (unsigned long) -ENOMEM;
                        printk("Unable to allocate RAM for process text/data, errno %d\n",
                                        (int)-textpos);
-                       return(textpos);
+                       ret = textpos;
+                       goto err_close;
                }
 
                realdatastart = textpos + ntohl(hdr->data_start);
@@ -627,7 +651,8 @@ static int load_flat_file(struct linux_binprm * bprm,
                        printk("Unable to read code+data+bss, errno %d\n",(int)-result);
                        do_munmap(current->mm, textpos, text_len + data_len + extra +
                                MAX_SHARED_LIBS * sizeof(unsigned long));
-                       return result;
+                       ret = result;
+                       goto err_close;
                }
        }
 
@@ -690,8 +715,10 @@ static int load_flat_file(struct linux_binprm * bprm,
                        unsigned long addr;
                        if (*rp) {
                                addr = calc_reloc(*rp, libinfo, id, 0);
-                               if (addr == RELOC_FAILED)
-                                       return -ENOEXEC;
+                               if (addr == RELOC_FAILED) {
+                                       ret = -ENOEXEC;
+                                       goto err_close;
+                               }
                                *rp = addr;
                        }
                }
@@ -718,8 +745,10 @@ static int load_flat_file(struct linux_binprm * bprm,
                        relval = ntohl(reloc[i]);
                        addr = flat_get_relocate_addr(relval);
                        rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1);
-                       if (rp == (unsigned long *)RELOC_FAILED)
-                               return -ENOEXEC;
+                       if (rp == (unsigned long *)RELOC_FAILED) {
+                               ret = -ENOEXEC;
+                               goto err_close;
+                       }
 
                        /* Get the pointer's value.  */
                        addr = flat_get_addr_from_rp(rp, relval, flags);
@@ -731,8 +760,10 @@ static int load_flat_file(struct linux_binprm * bprm,
                                if ((flags & FLAT_FLAG_GOTPIC) == 0)
                                        addr = ntohl(addr);
                                addr = calc_reloc(addr, libinfo, id, 0);
-                               if (addr == RELOC_FAILED)
-                                       return -ENOEXEC;
+                               if (addr == RELOC_FAILED) {
+                                       ret = -ENOEXEC;
+                                       goto err_close;
+                               }
 
                                /* Write back the relocated pointer.  */
                                flat_put_addr_at_rp(rp, addr, relval);
@@ -752,6 +783,10 @@ static int load_flat_file(struct linux_binprm * bprm,
                        stack_len);
 
        return 0;
+err_close:
+       sys_close(exec_fileno);
+err:
+       return ret;
 }
 
 
index 0a8c59c..73e664c 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -636,12 +636,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
                return ERR_PTR(-ENOMEM);
 
        ret = -ENOMEM;
-       pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
+       pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
        if (!pages)
                goto out;
 
-       memset(pages, 0, nr_pages * sizeof(struct page *));
-
        for (i = 0; i < iov_count; i++) {
                unsigned long uaddr = (unsigned long)iov[i].iov_base;
                unsigned long len = iov[i].iov_len;
@@ -1186,12 +1184,11 @@ void bioset_free(struct bio_set *bs)
 
 struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale)
 {
-       struct bio_set *bs = kmalloc(sizeof(*bs), GFP_KERNEL);
+       struct bio_set *bs = kzalloc(sizeof(*bs), GFP_KERNEL);
 
        if (!bs)
                return NULL;
 
-       memset(bs, 0, sizeof(*bs));
        bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab,
                        mempool_free_slab, bio_slab);
 
index 6d77ce9..3b3ab52 100644 (file)
@@ -160,12 +160,7 @@ int sync_blockdev(struct block_device *bdev)
 }
 EXPORT_SYMBOL(sync_blockdev);
 
-/*
- * Write out and wait upon all dirty data associated with this
- * superblock.  Filesystem data as well as the underlying block
- * device.  Takes the superblock lock.
- */
-int fsync_super(struct super_block *sb)
+static void __fsync_super(struct super_block *sb)
 {
        sync_inodes_sb(sb, 0);
        DQUOT_SYNC(sb);
@@ -177,7 +172,16 @@ int fsync_super(struct super_block *sb)
                sb->s_op->sync_fs(sb, 1);
        sync_blockdev(sb->s_bdev);
        sync_inodes_sb(sb, 1);
+}
 
+/*
+ * Write out and wait upon all dirty data associated with this
+ * superblock.  Filesystem data as well as the underlying block
+ * device.  Takes the superblock lock.
+ */
+int fsync_super(struct super_block *sb)
+{
+       __fsync_super(sb);
        return sync_blockdev(sb->s_bdev);
 }
 
@@ -216,19 +220,7 @@ struct super_block *freeze_bdev(struct block_device *bdev)
                sb->s_frozen = SB_FREEZE_WRITE;
                smp_wmb();
 
-               sync_inodes_sb(sb, 0);
-               DQUOT_SYNC(sb);
-
-               lock_super(sb);
-               if (sb->s_dirt && sb->s_op->write_super)
-                       sb->s_op->write_super(sb);
-               unlock_super(sb);
-
-               if (sb->s_op->sync_fs)
-                       sb->s_op->sync_fs(sb, 1);
-
-               sync_blockdev(sb->s_bdev);
-               sync_inodes_sb(sb, 1);
+               __fsync_super(sb);
 
                sb->s_frozen = SB_FREEZE_TRANS;
                smp_wmb();
index 5c36345..8c6eb04 100644 (file)
@@ -146,12 +146,10 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
        int ret = 0;
        int i;
 
-       cd = kmalloc(sizeof(struct char_device_struct), GFP_KERNEL);
+       cd = kzalloc(sizeof(struct char_device_struct), GFP_KERNEL);
        if (cd == NULL)
                return ERR_PTR(-ENOMEM);
 
-       memset(cd, 0, sizeof(struct char_device_struct));
-
        mutex_lock(&chrdevs_lock);
 
        /* temporary */
@@ -466,9 +464,8 @@ static struct kobj_type ktype_cdev_dynamic = {
 
 struct cdev *cdev_alloc(void)
 {
-       struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL);
+       struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL);
        if (p) {
-               memset(p, 0, sizeof(struct cdev));
                p->kobj.ktype = &ktype_cdev_dynamic;
                INIT_LIST_HEAD(&p->list);
                kobject_init(&p->kobj);
index 2a88477..ef5a077 100644 (file)
@@ -1476,10 +1476,9 @@ int compat_do_execve(char * filename,
        int i;
 
        retval = -ENOMEM;
-       bprm = kmalloc(sizeof(*bprm), GFP_KERNEL);
+       bprm = kzalloc(sizeof(*bprm), GFP_KERNEL);
        if (!bprm)
                goto out_ret;
-       memset(bprm, 0, sizeof(*bprm));
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
@@ -2170,9 +2169,12 @@ asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user *
 
        default:
                err = -EINVAL;
-               goto done;
+               break;
        }
 
+       if (err)
+               goto done;
+
        oldfs = get_fs();
        set_fs(KERNEL_DS);
        /* The __user pointer casts are valid because of the set_fs() */
index 653f64c..9395846 100644 (file)
@@ -325,10 +325,13 @@ static struct dentry * __d_find_alias(struct inode *inode, int want_discon)
 
 struct dentry * d_find_alias(struct inode *inode)
 {
-       struct dentry *de;
-       spin_lock(&dcache_lock);
-       de = __d_find_alias(inode, 0);
-       spin_unlock(&dcache_lock);
+       struct dentry *de = NULL;
+
+       if (!list_empty(&inode->i_dentry)) {
+               spin_lock(&dcache_lock);
+               de = __d_find_alias(inode, 0);
+               spin_unlock(&dcache_lock);
+       }
        return de;
 }
 
@@ -486,6 +489,7 @@ repeat:
                        continue;
                }
                prune_one_dentry(dentry);
+               cond_resched_lock(&dcache_lock);
                goto repeat;
        }
        spin_unlock(&dcache_lock);
@@ -799,6 +803,7 @@ void d_instantiate(struct dentry *entry, struct inode * inode)
        if (inode)
                list_add(&entry->d_alias, &inode->i_dentry);
        entry->d_inode = inode;
+       fsnotify_d_instantiate(entry, inode);
        spin_unlock(&dcache_lock);
        security_d_instantiate(entry, inode);
 }
@@ -850,6 +855,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
        list_add(&entry->d_alias, &inode->i_dentry);
 do_negative:
        entry->d_inode = inode;
+       fsnotify_d_instantiate(entry, inode);
        spin_unlock(&dcache_lock);
        security_d_instantiate(entry, inode);
        return NULL;
@@ -980,6 +986,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
                new = __d_find_alias(inode, 1);
                if (new) {
                        BUG_ON(!(new->d_flags & DCACHE_DISCONNECTED));
+                       fsnotify_d_instantiate(new, inode);
                        spin_unlock(&dcache_lock);
                        security_d_instantiate(new, inode);
                        d_rehash(dentry);
@@ -989,6 +996,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
                        /* d_instantiate takes dcache_lock, so we do it by hand */
                        list_add(&dentry->d_alias, &inode->i_dentry);
                        dentry->d_inode = inode;
+                       fsnotify_d_instantiate(dentry, inode);
                        spin_unlock(&dcache_lock);
                        security_d_instantiate(dentry, inode);
                        d_rehash(dentry);
@@ -1173,6 +1181,9 @@ void d_delete(struct dentry * dentry)
        spin_lock(&dentry->d_lock);
        isdir = S_ISDIR(dentry->d_inode->i_mode);
        if (atomic_read(&dentry->d_count) == 1) {
+               /* remove this and other inotify debug checks after 2.6.18 */
+               dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
+
                dentry_iput(dentry);
                fsnotify_nameremove(dentry, isdir);
                return;
@@ -1339,6 +1350,7 @@ already_unhashed:
 
        list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
        spin_unlock(&target->d_lock);
+       fsnotify_d_move(dentry);
        spin_unlock(&dentry->d_lock);
        write_sequnlock(&rename_lock);
        spin_unlock(&dcache_lock);
index 27f3e78..235ed8d 100644 (file)
@@ -129,6 +129,7 @@ struct dio {
        /* AIO related stuff */
        struct kiocb *iocb;             /* kiocb */
        int is_async;                   /* is IO async ? */
+       int io_error;                   /* IO error in completion path */
        ssize_t result;                 /* IO result */
 };
 
@@ -250,6 +251,10 @@ static void finished_one_bio(struct dio *dio)
                            ((offset + transferred) > dio->i_size))
                                transferred = dio->i_size - offset;
 
+                       /* check for error in completion path */
+                       if (dio->io_error)
+                               transferred = dio->io_error;
+
                        dio_complete(dio, offset, transferred);
 
                        /* Complete AIO later if falling back to buffered i/o */
@@ -406,7 +411,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
        int page_no;
 
        if (!uptodate)
-               dio->result = -EIO;
+               dio->io_error = -EIO;
 
        if (dio->is_async && dio->rw == READ) {
                bio_check_pages_dirty(bio);     /* transfers ownership */
@@ -971,6 +976,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
        dio->next_block_for_io = -1;
 
        dio->page_errors = 0;
+       dio->io_error = 0;
        dio->result = 0;
        dio->iocb = iocb;
        dio->i_size = i_size_read(inode);
index 1c2b16f..a0f682c 100644 (file)
@@ -599,7 +599,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
        switch (op) {
        case EPOLL_CTL_ADD:
                if (!epi) {
-                       epds.events |= POLLERR | POLLHUP;
+                       epds.events |= POLLERR | POLLHUP | POLLRDHUP;
 
                        error = ep_insert(ep, &epds, tfile, fd);
                } else
@@ -613,7 +613,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
                break;
        case EPOLL_CTL_MOD:
                if (epi) {
-                       epds.events |= POLLERR | POLLHUP;
+                       epds.events |= POLLERR | POLLHUP | POLLRDHUP;
                        error = ep_modify(ep, epi, &epds);
                } else
                        error = -ENOENT;
index 0b515ac..995cba3 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -127,7 +127,7 @@ asmlinkage long sys_uselib(const char __user * library)
        struct nameidata nd;
        int error;
 
-       error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ);
+       error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
        if (error)
                goto out;
 
@@ -477,7 +477,7 @@ struct file *open_exec(const char *name)
        int err;
        struct file *file;
 
-       err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ);
+       err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
        file = ERR_PTR(err);
 
        if (!err) {
@@ -1143,10 +1143,9 @@ int do_execve(char * filename,
        int i;
 
        retval = -ENOMEM;
-       bprm = kmalloc(sizeof(*bprm), GFP_KERNEL);
+       bprm = kzalloc(sizeof(*bprm), GFP_KERNEL);
        if (!bprm)
                goto out_ret;
-       memset(bprm, 0, sizeof(*bprm));
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
index 268b73f..7e30bae 100644 (file)
@@ -211,8 +211,6 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
 
        if (sbi->s_mount_opt & EXT2_MOUNT_GRPID)
                seq_puts(seq, ",grpid");
-       else
-               seq_puts(seq, ",nogrpid");
 
 #if defined(CONFIG_QUOTA)
        if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
index cb16b4c..ce4f82b 100644 (file)
@@ -7,11 +7,11 @@
  * Universite Pierre et Marie Curie (Paris VI)
  */
 
-#ifdef EXT3FS_DEBUG
-
 #include <linux/buffer_head.h>
+#include <linux/jbd.h>
+#include <linux/ext3_fs.h>
 
-#include "ext3_fs.h"
+#ifdef EXT3FS_DEBUG
 
 static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
index 785c721..f3fbe2d 100644 (file)
@@ -381,8 +381,8 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                        list_move(&inode->i_list, &sb->s_dirty);
                }
                spin_unlock(&inode_lock);
-               cond_resched();
                iput(inode);
+               cond_resched();
                spin_lock(&inode_lock);
                if (wbc->nr_to_write <= 0)
                        break;
index a51c671..85da110 100644 (file)
@@ -91,7 +91,7 @@ DEFINE_SPINLOCK(inode_lock);
  * from its final dispose_list, the struct super_block they refer to
  * (for inode->i_sb->s_op) may already have been freed and reused.
  */
-DEFINE_MUTEX(iprune_mutex);
+static DEFINE_MUTEX(iprune_mutex);
 
 /*
  * Statistics gathering..
index 0ee39ef..a61e93e 100644 (file)
@@ -38,7 +38,6 @@
 #include <asm/ioctls.h>
 
 static atomic_t inotify_cookie;
-static atomic_t inotify_watches;
 
 static kmem_cache_t *watch_cachep;
 static kmem_cache_t *event_cachep;
@@ -380,6 +379,48 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
        return error;
 }
 
+/*
+ * inotify_inode_watched - returns nonzero if there are watches on this inode
+ * and zero otherwise.  We call this lockless, we do not care if we race.
+ */
+static inline int inotify_inode_watched(struct inode *inode)
+{
+       return !list_empty(&inode->inotify_watches);
+}
+
+/*
+ * Get child dentry flag into synch with parent inode.
+ * Flag should always be clear for negative dentrys.
+ */
+static void set_dentry_child_flags(struct inode *inode, int watched)
+{
+       struct dentry *alias;
+
+       spin_lock(&dcache_lock);
+       list_for_each_entry(alias, &inode->i_dentry, d_alias) {
+               struct dentry *child;
+
+               list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) {
+                       if (!child->d_inode) {
+                               WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
+                               continue;
+                       }
+                       spin_lock(&child->d_lock);
+                       if (watched) {
+                               WARN_ON(child->d_flags &
+                                               DCACHE_INOTIFY_PARENT_WATCHED);
+                               child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
+                       } else {
+                               WARN_ON(!(child->d_flags &
+                                       DCACHE_INOTIFY_PARENT_WATCHED));
+                               child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED;
+                       }
+                       spin_unlock(&child->d_lock);
+               }
+       }
+       spin_unlock(&dcache_lock);
+}
+
 /*
  * create_watch - creates a watch on the given device.
  *
@@ -426,7 +467,6 @@ static struct inotify_watch *create_watch(struct inotify_device *dev,
        get_inotify_watch(watch);
 
        atomic_inc(&dev->user->inotify_watches);
-       atomic_inc(&inotify_watches);
 
        return watch;
 }
@@ -458,8 +498,10 @@ static void remove_watch_no_event(struct inotify_watch *watch,
        list_del(&watch->i_list);
        list_del(&watch->d_list);
 
+       if (!inotify_inode_watched(watch->inode))
+               set_dentry_child_flags(watch->inode, 0);
+
        atomic_dec(&dev->user->inotify_watches);
-       atomic_dec(&inotify_watches);
        idr_remove(&dev->idr, watch->wd);
        put_inotify_watch(watch);
 }
@@ -481,16 +523,39 @@ static void remove_watch(struct inotify_watch *watch,struct inotify_device *dev)
        remove_watch_no_event(watch, dev);
 }
 
+/* Kernel API */
+
 /*
- * inotify_inode_watched - returns nonzero if there are watches on this inode
- * and zero otherwise.  We call this lockless, we do not care if we race.
+ * inotify_d_instantiate - instantiate dcache entry for inode
  */
-static inline int inotify_inode_watched(struct inode *inode)
+void inotify_d_instantiate(struct dentry *entry, struct inode *inode)
 {
-       return !list_empty(&inode->inotify_watches);
+       struct dentry *parent;
+
+       if (!inode)
+               return;
+
+       WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
+       spin_lock(&entry->d_lock);
+       parent = entry->d_parent;
+       if (inotify_inode_watched(parent->d_inode))
+               entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
+       spin_unlock(&entry->d_lock);
 }
 
-/* Kernel API */
+/*
+ * inotify_d_move - dcache entry has been moved
+ */
+void inotify_d_move(struct dentry *entry)
+{
+       struct dentry *parent;
+
+       parent = entry->d_parent;
+       if (inotify_inode_watched(parent->d_inode))
+               entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
+       else
+               entry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
+}
 
 /**
  * inotify_inode_queue_event - queue an event to all watches on this inode
@@ -538,7 +603,7 @@ void inotify_dentry_parent_queue_event(struct dentry *dentry, u32 mask,
        struct dentry *parent;
        struct inode *inode;
 
-       if (!atomic_read (&inotify_watches))
+       if (!(dentry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED))
                return;
 
        spin_lock(&dentry->d_lock);
@@ -993,6 +1058,9 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
                goto out;
        }
 
+       if (!inotify_inode_watched(inode))
+               set_dentry_child_flags(inode, 1);
+
        /* Add the watch to the device's and the inode's list */
        list_add(&watch->d_list, &dev->watches);
        list_add(&watch->i_list, &inode->inotify_watches);
@@ -1065,7 +1133,6 @@ static int __init inotify_setup(void)
        inotify_max_user_watches = 8192;
 
        atomic_set(&inotify_cookie, 0);
-       atomic_set(&inotify_watches, 0);
 
        watch_cachep = kmem_cache_create("inotify_watch_cache",
                                         sizeof(struct inotify_watch),
index 95a628d..7f96b5c 100644 (file)
 #include <linux/mm.h>
 #include <linux/suspend.h>
 #include <linux/pagemap.h>
+#include <linux/kthread.h>
+#include <linux/proc_fs.h>
+
 #include <asm/uaccess.h>
 #include <asm/page.h>
-#include <linux/proc_fs.h>
 
 EXPORT_SYMBOL(journal_start);
 EXPORT_SYMBOL(journal_restart);
@@ -111,18 +113,15 @@ static void commit_timeout(unsigned long __data)
 
 static int kjournald(void *arg)
 {
-       journal_t *journal = (journal_t *) arg;
+       journal_t *journal = arg;
        transaction_t *transaction;
-       struct timer_list timer;
 
-       daemonize("kjournald");
-
-       /* Set up an interval timer which can be used to trigger a
-           commit wakeup after the commit interval expires */
-       init_timer(&timer);
-       timer.data = (unsigned long) current;
-       timer.function = commit_timeout;
-       journal->j_commit_timer = &timer;
+       /*
+        * Set up an interval timer which can be used to trigger a commit wakeup
+        * after the commit interval expires
+        */
+       setup_timer(&journal->j_commit_timer, commit_timeout,
+                       (unsigned long)current);
 
        /* Record that the journal thread is running */
        journal->j_task = current;
@@ -146,7 +145,7 @@ loop:
        if (journal->j_commit_sequence != journal->j_commit_request) {
                jbd_debug(1, "OK, requests differ\n");
                spin_unlock(&journal->j_state_lock);
-               del_timer_sync(journal->j_commit_timer);
+               del_timer_sync(&journal->j_commit_timer);
                journal_commit_transaction(journal);
                spin_lock(&journal->j_state_lock);
                goto loop;
@@ -203,7 +202,7 @@ loop:
 
 end_loop:
        spin_unlock(&journal->j_state_lock);
-       del_timer_sync(journal->j_commit_timer);
+       del_timer_sync(&journal->j_commit_timer);
        journal->j_task = NULL;
        wake_up(&journal->j_wait_done_commit);
        jbd_debug(1, "Journal thread exiting.\n");
@@ -212,7 +211,7 @@ end_loop:
 
 static void journal_start_thread(journal_t *journal)
 {
-       kernel_thread(kjournald, journal, CLONE_VM|CLONE_FS|CLONE_FILES);
+       kthread_run(kjournald, journal, "kjournald");
        wait_event(journal->j_wait_done_commit, journal->j_task != 0);
 }
 
index 5fc4088..ada31fa 100644 (file)
@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction)
        spin_lock_init(&transaction->t_handle_lock);
 
        /* Set up the commit timer for the new transaction. */
-       journal->j_commit_timer->expires = transaction->t_expires;
-       add_timer(journal->j_commit_timer);
+       journal->j_commit_timer.expires = transaction->t_expires;
+       add_timer(&journal->j_commit_timer);
 
        J_ASSERT(journal->j_running_transaction == NULL);
        journal->j_running_transaction = transaction;
index dc6a4e4..4a6abc4 100644 (file)
@@ -56,7 +56,7 @@ void minix_free_block(struct inode * inode, int block)
        unsigned int bit,zone;
 
        if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
-               printk("trying to free block not in datazone\n");
+               printk("Trying to free block not in datazone\n");
                return;
        }
        zone = block - sbi->s_firstdatazone + 1;
@@ -124,7 +124,7 @@ minix_V1_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh)
                 ino / MINIX_INODES_PER_BLOCK;
        *bh = sb_bread(sb, block);
        if (!*bh) {
-               printk("unable to read i-node block\n");
+               printk("Unable to read inode block\n");
                return NULL;
        }
        p = (void *)(*bh)->b_data;
@@ -149,7 +149,7 @@ minix_V2_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh)
                 ino / MINIX2_INODES_PER_BLOCK;
        *bh = sb_bread(sb, block);
        if (!*bh) {
-               printk("unable to read i-node block\n");
+               printk("Unable to read inode block\n");
                return NULL;
        }
        p = (void *)(*bh)->b_data;
@@ -204,7 +204,7 @@ void minix_free_inode(struct inode * inode)
        bh = sbi->s_imap[ino >> 13];
        lock_kernel();
        if (!minix_test_and_clear_bit(ino & 8191, bh->b_data))
-               printk("minix_free_inode: bit %lu already cleared.\n", ino);
+               printk("minix_free_inode: bit %lu already cleared\n", ino);
        unlock_kernel();
        mark_buffer_dirty(bh);
  out:
@@ -238,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
                return NULL;
        }
        if (minix_test_and_set_bit(j,bh->b_data)) {     /* shouldn't happen */
-               printk("new_inode: bit already set");
+               printk("new_inode: bit already set\n");
                unlock_kernel();
                iput(inode);
                return NULL;
index d9ffc43..2dcccf1 100644 (file)
@@ -127,11 +127,11 @@ static int minix_remount (struct super_block * sb, int * flags, char * data)
                mark_buffer_dirty(sbi->s_sbh);
 
                if (!(sbi->s_mount_state & MINIX_VALID_FS))
-                       printk ("MINIX-fs warning: remounting unchecked fs, "
-                               "running fsck is recommended.\n");
+                       printk("MINIX-fs warning: remounting unchecked fs, "
+                               "running fsck is recommended\n");
                else if ((sbi->s_mount_state & MINIX_ERROR_FS))
-                       printk ("MINIX-fs warning: remounting fs with errors, "
-                               "running fsck is recommended.\n");
+                       printk("MINIX-fs warning: remounting fs with errors, "
+                               "running fsck is recommended\n");
        }
        return 0;
 }
@@ -245,11 +245,11 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
                mark_buffer_dirty(bh);
        }
        if (!(sbi->s_mount_state & MINIX_VALID_FS))
-               printk ("MINIX-fs: mounting unchecked file system, "
-                       "running fsck is recommended.\n");
+               printk("MINIX-fs: mounting unchecked file system, "
+                       "running fsck is recommended\n");
        else if (sbi->s_mount_state & MINIX_ERROR_FS)
-               printk ("MINIX-fs: mounting file system with errors, "
-                       "running fsck is recommended.\n");
+               printk("MINIX-fs: mounting file system with errors, "
+                       "running fsck is recommended\n");
        return 0;
 
 out_iput:
@@ -273,19 +273,19 @@ out_no_bitmap:
 
 out_no_map:
        if (!silent)
-               printk ("MINIX-fs: can't allocate map\n");
+               printk("MINIX-fs: can't allocate map\n");
        goto out_release;
 
 out_no_fs:
        if (!silent)
-               printk("VFS: Can't find a Minix or Minix V2 filesystem on device "
-                      "%s.\n", s->s_id);
+               printk("VFS: Can't find a Minix or Minix V2 filesystem "
+                       "on device %s\n", s->s_id);
     out_release:
        brelse(bh);
        goto out;
 
 out_bad_hblock:
-       printk("MINIX-fs: blocksize too small for device.\n");
+       printk("MINIX-fs: blocksize too small for device\n");
        goto out;
 
 out_bad_sb:
@@ -524,7 +524,7 @@ int minix_sync_inode(struct inode * inode)
                sync_dirty_buffer(bh);
                if (buffer_req(bh) && !buffer_uptodate(bh))
                {
-                       printk ("IO error syncing minix inode [%s:%08lx]\n",
+                       printk("IO error syncing minix inode [%s:%08lx]\n",
                                inode->i_sb->s_id, inode->i_ino);
                        err = -1;
                }
index ba06aef..656b134 100644 (file)
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
        int n = 0;
 
        if (block < 0) {
-               printk("minix_bmap: block<0");
+               printk("minix_bmap: block<0\n");
        } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
-               printk("minix_bmap: block>big");
+               printk("minix_bmap: block>big\n");
        } else if (block < 7) {
                offsets[n++] = block;
        } else if ((block -= 7) < 512) {
index 3adc767..9adcdc7 100644 (file)
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
        int n = 0;
 
        if (block < 0) {
-               printk("minix_bmap: block<0");
+               printk("minix_bmap: block<0\n");
        } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
-               printk("minix_bmap: block>big");
+               printk("minix_bmap: block>big\n");
        } else if (block < 7) {
                offsets[n++] = block;
        } else if ((block -= 7) < 256) {
index c72b940..712dfc7 100644 (file)
@@ -1628,6 +1628,12 @@ do_last:
                goto exit;
        }
 
+       if (IS_ERR(nd->intent.open.file)) {
+               mutex_unlock(&dir->d_inode->i_mutex);
+               error = PTR_ERR(nd->intent.open.file);
+               goto exit_dput;
+       }
+
        /* Negative dentry, just create the file */
        if (!path.dentry->d_inode) {
                if (!IS_POSIXACL(dir->d_inode))
@@ -2621,16 +2627,27 @@ int __page_symlink(struct inode *inode, const char *symname, int len,
        int err = -ENOMEM;
        char *kaddr;
 
+retry:
        page = find_or_create_page(mapping, 0, gfp_mask);
        if (!page)
                goto fail;
        err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
+       if (err == AOP_TRUNCATED_PAGE) {
+               page_cache_release(page);
+               goto retry;
+       }
        if (err)
                goto fail_map;
        kaddr = kmap_atomic(page, KM_USER0);
        memcpy(kaddr, symname, len-1);
        kunmap_atomic(kaddr, KM_USER0);
-       mapping->a_ops->commit_write(NULL, page, 0, len-1);
+       err = mapping->a_ops->commit_write(NULL, page, 0, len-1);
+       if (err == AOP_TRUNCATED_PAGE) {
+               page_cache_release(page);
+               goto retry;
+       }
+       if (err)
+               goto fail_map;
        /*
         * Notice that we are _not_ going to block here - end of page is
         * unmapped, so this will only try to map the rest of page, see
@@ -2640,7 +2657,8 @@ int __page_symlink(struct inode *inode, const char *symname, int len,
         */
        if (!PageUptodate(page)) {
                err = mapping->a_ops->readpage(NULL, page);
-               wait_on_page_locked(page);
+               if (err != AOP_TRUNCATED_PAGE)
+                       wait_on_page_locked(page);
        } else {
                unlock_page(page);
        }
index 1091dad..7d02d19 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open);
  * a fully instantiated struct file to the caller.
  * This function is meant to be called from within a filesystem's
  * lookup method.
+ * Beware of calling it for non-regular files! Those ->open methods might block
+ * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo,
+ * leading to a deadlock, as nobody can open that fifo anymore, because
+ * another process to open fifo will block on locked parent when doing lookup).
  * Note that in case of error, nd->intent.open.file is destroyed, but the
  * path information remains valid.
  * If the open callback is set to NULL, then the standard f_op->open()
index 8aada8e..d976866 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -662,10 +662,9 @@ struct inode* pipe_new(struct inode* inode)
 {
        struct pipe_inode_info *info;
 
-       info = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
+       info = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL);
        if (!info)
                goto fail_page;
-       memset(info, 0, sizeof(*info));
        inode->i_pipe = info;
 
        init_waitqueue_head(PIPE_WAIT(*inode));
index 826c131..1e9ea37 100644 (file)
@@ -485,6 +485,40 @@ static struct file_operations proc_slabinfo_operations = {
        .llseek         = seq_lseek,
        .release        = seq_release,
 };
+
+#ifdef CONFIG_DEBUG_SLAB_LEAK
+extern struct seq_operations slabstats_op;
+static int slabstats_open(struct inode *inode, struct file *file)
+{
+       unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       int ret = -ENOMEM;
+       if (n) {
+               ret = seq_open(file, &slabstats_op);
+               if (!ret) {
+                       struct seq_file *m = file->private_data;
+                       *n = PAGE_SIZE / (2 * sizeof(unsigned long));
+                       m->private = n;
+                       n = NULL;
+               }
+               kfree(n);
+       }
+       return ret;
+}
+
+static int slabstats_release(struct inode *inode, struct file *file)
+{
+       struct seq_file *m = file->private_data;
+       kfree(m->private);
+       return seq_release(inode, file);
+}
+
+static struct file_operations proc_slabstats_operations = {
+       .open           = slabstats_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = slabstats_release,
+};
+#endif
 #endif
 
 static int show_stat(struct seq_file *p, void *v)
@@ -744,6 +778,9 @@ void __init proc_misc_init(void)
        create_seq_entry("interrupts", 0, &proc_interrupts_operations);
 #ifdef CONFIG_SLAB
        create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
+#ifdef CONFIG_DEBUG_SLAB_LEAK
+       create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
+#endif
 #endif
        create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
        create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
index 3f7a1a6..34b1bf2 100644 (file)
@@ -470,7 +470,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
         * verify all the pointers
         */
        ret = -EINVAL;
-       if ((nr_segs > UIO_MAXIOV) || (nr_segs <= 0))
+       if (nr_segs > UIO_MAXIOV)
                goto out;
        if (!file->f_op)
                goto out;
index be12879..d0c1e86 100644 (file)
@@ -1532,7 +1532,7 @@ static ssize_t reiserfs_file_write(struct file *file,     /* the file we are going t
                buf += write_bytes;
                *ppos = pos += write_bytes;
                count -= write_bytes;
-               balance_dirty_pages_ratelimited(inode->i_mapping);
+               balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages);
        }
 
        /* this is only true on error */
@@ -1546,10 +1546,10 @@ static ssize_t reiserfs_file_write(struct file *file,   /* the file we are going t
                }
        }
 
-       if ((file->f_flags & O_SYNC) || IS_SYNC(inode))
-               res =
-                   generic_osync_inode(inode, file->f_mapping,
-                                       OSYNC_METADATA | OSYNC_DATA);
+       if (likely(res >= 0) &&
+           (unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode))))
+               res = generic_osync_inode(inode, file->f_mapping,
+                                         OSYNC_METADATA | OSYNC_DATA);
 
        mutex_unlock(&inode->i_mutex);
        reiserfs_async_progress_wait(inode->i_sb);
index aa22588..5600d3d 100644 (file)
@@ -191,9 +191,7 @@ static void create_virtual_node(struct tree_balance *tb, int h)
                                               "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c",
                                               key, vn->vn_affected_item_num,
                                               vn->vn_mode, M_DELETE);
-                       } else
-                               /* we can delete directory item, that has only one directory entry in it */
-                               ;
+                       }
                }
 #endif
 
index e237cd6..7a88adb 100644 (file)
@@ -275,7 +275,7 @@ static void indirect_print_item(struct item_head *ih, char *item)
        int j;
        __le32 *unp;
        __u32 prev = INT_MAX;
-       int num;
+       int num = 0;
 
        unp = (__le32 *) item;
 
index 5a9d272..1b73529 100644 (file)
@@ -2227,6 +2227,9 @@ static int journal_read_transaction(struct super_block *p_s_sb,
        journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb);
        journal->j_last_flush_trans_id = trans_id;
        journal->j_trans_id = trans_id + 1;
+       /* check for trans_id overflow */
+       if (journal->j_trans_id == 0)
+               journal->j_trans_id = 10;
        brelse(c_bh);
        brelse(d_bh);
        kfree(log_blocks);
@@ -2450,6 +2453,9 @@ static int journal_read(struct super_block *p_s_sb)
                journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset);
                journal->j_trans_id =
                    le32_to_cpu(jh->j_last_flush_trans_id) + 1;
+               /* check for trans_id overflow */
+               if (journal->j_trans_id == 0)
+                       journal->j_trans_id = 10;
                journal->j_last_flush_trans_id =
                    le32_to_cpu(jh->j_last_flush_trans_id);
                journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1;
@@ -3873,8 +3879,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
        int cur_write_start = 0;        /* start index of current log write */
        int old_start;
        int i;
-       int flush = flags & FLUSH_ALL;
-       int wait_on_commit = flags & WAIT;
+       int flush;
+       int wait_on_commit;
        struct reiserfs_journal_list *jl, *temp_jl;
        struct list_head *entry, *safe;
        unsigned long jindex;
@@ -3884,6 +3890,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
        BUG_ON(th->t_refcount > 1);
        BUG_ON(!th->t_trans_id);
 
+       /* protect flush_older_commits from doing mistakes if the
+           transaction ID counter gets overflowed.  */
+       if (th->t_trans_id == ~0UL)
+               flags |= FLUSH_ALL | COMMIT_NOW | WAIT;
+       flush = flags & FLUSH_ALL;
+       wait_on_commit = flags & WAIT;
+
        put_fs_excl();
        current->journal_info = th->t_handle_save;
        reiserfs_check_lock_depth(p_s_sb, "journal end");
@@ -4105,7 +4118,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
        journal->j_first = NULL;
        journal->j_len = 0;
        journal->j_trans_start_time = 0;
-       journal->j_trans_id++;
+       /* check for trans_id overflow */
+       if (++journal->j_trans_id == 0)
+               journal->j_trans_id = 10;
        journal->j_current_jl->j_trans_id = journal->j_trans_id;
        journal->j_must_wait = 0;
        journal->j_len_alloc = 0;
index e2d08d7..d2b25e1 100644 (file)
@@ -981,6 +981,8 @@ static inline int prepare_for_direntry_item(struct path *path,
        return M_CUT;
 }
 
+#define JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD (2 * JOURNAL_PER_BALANCE_CNT + 1)
+
 /*  If the path points to a directory or direct item, calculate mode and the size cut, for balance.
     If the path points to an indirect item, remove some number of its unformatted nodes.
     In case of file truncate calculate whether this item must be deleted/truncated or last
@@ -1020,148 +1022,79 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
 
        /* Case of an indirect item. */
        {
-               int n_unfm_number,      /* Number of the item unformatted nodes. */
-                n_counter, n_blk_size;
-               __le32 *p_n_unfm_pointer;       /* Pointer to the unformatted node number. */
-               __u32 tmp;
-               struct item_head s_ih;  /* Item header. */
-               char c_mode;    /* Returned mode of the balance. */
-               int need_research;
-
-               n_blk_size = p_s_sb->s_blocksize;
-
-               /* Search for the needed object indirect item until there are no unformatted nodes to be removed. */
-               do {
-                       need_research = 0;
-                       p_s_bh = PATH_PLAST_BUFFER(p_s_path);
-                       /* Copy indirect item header to a temp variable. */
-                       copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
-                       /* Calculate number of unformatted nodes in this item. */
-                       n_unfm_number = I_UNFM_NUM(&s_ih);
-
-                       RFALSE(!is_indirect_le_ih(&s_ih) || !n_unfm_number ||
-                              pos_in_item(p_s_path) + 1 != n_unfm_number,
-                              "PAP-5240: invalid item %h "
-                              "n_unfm_number = %d *p_n_pos_in_item = %d",
-                              &s_ih, n_unfm_number, pos_in_item(p_s_path));
-
-                       /* Calculate balance mode and position in the item to remove unformatted nodes. */
-                       if (n_new_file_length == max_reiserfs_offset(inode)) {  /* Case of delete. */
-                               pos_in_item(p_s_path) = 0;
-                               *p_n_cut_size = -(IH_SIZE + ih_item_len(&s_ih));
-                               c_mode = M_DELETE;
-                       } else {        /* Case of truncate. */
-                               if (n_new_file_length < le_ih_k_offset(&s_ih)) {
-                                       pos_in_item(p_s_path) = 0;
-                                       *p_n_cut_size =
-                                           -(IH_SIZE + ih_item_len(&s_ih));
-                                       c_mode = M_DELETE;      /* Delete this item. */
-                               } else {
-                                       /* indirect item must be truncated starting from *p_n_pos_in_item-th position */
-                                       pos_in_item(p_s_path) =
-                                           (n_new_file_length + n_blk_size -
-                                            le_ih_k_offset(&s_ih)) >> p_s_sb->
-                                           s_blocksize_bits;
-
-                                       RFALSE(pos_in_item(p_s_path) >
-                                              n_unfm_number,
-                                              "PAP-5250: invalid position in the item");
-
-                                       /* Either convert last unformatted node of indirect item to direct item or increase
-                                          its free space.  */
-                                       if (pos_in_item(p_s_path) ==
-                                           n_unfm_number) {
-                                               *p_n_cut_size = 0;      /* Nothing to cut. */
-                                               return M_CONVERT;       /* Maybe convert last unformatted node to the direct item. */
-                                       }
-                                       /* Calculate size to cut. */
-                                       *p_n_cut_size =
-                                           -(ih_item_len(&s_ih) -
-                                             pos_in_item(p_s_path) *
-                                             UNFM_P_SIZE);
-
-                                       c_mode = M_CUT; /* Cut from this indirect item. */
-                               }
-                       }
+           int blk_size = p_s_sb->s_blocksize;
+           struct item_head s_ih;
+           int need_re_search;
+           int delete = 0;
+           int result = M_CUT;
+           int pos = 0;
+
+           if ( n_new_file_length == max_reiserfs_offset (inode) ) {
+               /* prepare_for_delete_or_cut() is called by
+                * reiserfs_delete_item() */
+               n_new_file_length = 0;
+               delete = 1;
+           }
+
+           do {
+               need_re_search = 0;
+               *p_n_cut_size = 0;
+               p_s_bh = PATH_PLAST_BUFFER(p_s_path);
+               copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
+               pos = I_UNFM_NUM(&s_ih);
 
-                       RFALSE(n_unfm_number <= pos_in_item(p_s_path),
-                              "PAP-5260: invalid position in the indirect item");
-
-                       /* pointers to be cut */
-                       n_unfm_number -= pos_in_item(p_s_path);
-                       /* Set pointer to the last unformatted node pointer that is to be cut. */
-                       p_n_unfm_pointer =
-                           (__le32 *) B_I_PITEM(p_s_bh,
-                                                &s_ih) + I_UNFM_NUM(&s_ih) -
-                           1 - *p_n_removed;
-
-                       /* We go through the unformatted nodes pointers of the indirect
-                          item and look for the unformatted nodes in the cache. If we
-                          found some of them we free it, zero corresponding indirect item
-                          entry and log buffer containing that indirect item. For this we
-                          need to prepare last path element for logging. If some
-                          unformatted node has b_count > 1 we must not free this
-                          unformatted node since it is in use. */
-                       reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1);
-                       // note: path could be changed, first line in for loop takes care
-                       // of it
+               while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) {
+                   __u32 *unfm, block;
 
-                       for (n_counter = *p_n_removed;
-                            n_counter < n_unfm_number;
-                            n_counter++, p_n_unfm_pointer--) {
+                   /* Each unformatted block deletion may involve one additional
+                    * bitmap block into the transaction, thereby the initial
+                    * journal space reservation might not be enough. */
+                   if (!delete && (*p_n_cut_size) != 0 &&
+                       reiserfs_transaction_free_space(th) < JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) {
+                       break;
+                   }
 
-                               cond_resched();
-                               if (item_moved(&s_ih, p_s_path)) {
-                                       need_research = 1;
-                                       break;
-                               }
-                               RFALSE(p_n_unfm_pointer <
-                                      (__le32 *) B_I_PITEM(p_s_bh, &s_ih)
-                                      || p_n_unfm_pointer >
-                                      (__le32 *) B_I_PITEM(p_s_bh,
-                                                           &s_ih) +
-                                      I_UNFM_NUM(&s_ih) - 1,
-                                      "vs-5265: pointer out of range");
-
-                               /* Hole, nothing to remove. */
-                               if (!get_block_num(p_n_unfm_pointer, 0)) {
-                                       (*p_n_removed)++;
-                                       continue;
-                               }
+                   unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
+                   block = get_block_num(unfm, 0);
 
-                               (*p_n_removed)++;
+                   if (block != 0) {
+                       reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1);
+                       put_block_num(unfm, 0, 0);
+                       journal_mark_dirty (th, p_s_sb, p_s_bh);
+                       reiserfs_free_block(th, inode, block, 1);
+                   }
 
-                               tmp = get_block_num(p_n_unfm_pointer, 0);
-                               put_block_num(p_n_unfm_pointer, 0, 0);
-                               journal_mark_dirty(th, p_s_sb, p_s_bh);
-                               reiserfs_free_block(th, inode, tmp, 1);
-                               if (item_moved(&s_ih, p_s_path)) {
-                                       need_research = 1;
-                                       break;
-                               }
-                       }
+                   cond_resched();
 
-                       /* a trick.  If the buffer has been logged, this
-                        ** will do nothing.  If we've broken the loop without
-                        ** logging it, it will restore the buffer
-                        **
-                        */
-                       reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh);
-
-                       /* This loop can be optimized. */
-               } while ((*p_n_removed < n_unfm_number || need_research) &&
-                        search_for_position_by_key(p_s_sb, p_s_item_key,
-                                                   p_s_path) ==
-                        POSITION_FOUND);
-
-               RFALSE(*p_n_removed < n_unfm_number,
-                      "PAP-5310: indirect item is not found");
-               RFALSE(item_moved(&s_ih, p_s_path),
-                      "after while, comp failed, retry");
-
-               if (c_mode == M_CUT)
-                       pos_in_item(p_s_path) *= UNFM_P_SIZE;
-               return c_mode;
+                   if (item_moved (&s_ih, p_s_path))  {
+                       need_re_search = 1;
+                       break;
+                   }
+
+                   pos --;
+                   (*p_n_removed) ++;
+                   (*p_n_cut_size) -= UNFM_P_SIZE;
+
+                   if (pos == 0) {
+                       (*p_n_cut_size) -= IH_SIZE;
+                       result = M_DELETE;
+                       break;
+                   }
+               }
+               /* a trick.  If the buffer has been logged, this will do nothing.  If
+               ** we've broken the loop without logging it, it will restore the
+               ** buffer */
+               reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh);
+           } while (need_re_search &&
+                    search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND);
+           pos_in_item(p_s_path) = pos * UNFM_P_SIZE;
+
+           if (*p_n_cut_size == 0) {
+               /* Nothing were cut. maybe convert last unformatted node to the
+                * direct item? */
+               result = M_CONVERT;
+           }
+           return result;
        }
 }
 
@@ -1948,7 +1881,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p
                 ** sure the file is consistent before ending the current trans
                 ** and starting a new one
                 */
-               if (journal_transaction_should_end(th, th->t_blocks_allocated)) {
+               if (journal_transaction_should_end(th, 0) ||
+                   reiserfs_transaction_free_space(th) <= JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) {
                        int orig_len_alloc = th->t_blocks_allocated;
                        decrement_counters_in_path(&s_search_path);
 
@@ -1962,7 +1896,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p
                        if (err)
                                goto out;
                        err = journal_begin(th, p_s_inode->i_sb,
-                                           JOURNAL_PER_BALANCE_CNT * 6);
+                                           JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ;
                        if (err)
                                goto out;
                        reiserfs_update_inode_transaction(p_s_inode);
index 93e6ef9..cae2abb 100644 (file)
@@ -685,14 +685,14 @@ static const arg_desc_t logging_mode[] = {
         (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)},
        {"writeback", 1 << REISERFS_DATA_WRITEBACK,
         (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)},
-       {NULL, 0}
+       {.value = NULL}
 };
 
 /* possible values for -o barrier= */
 static const arg_desc_t barrier_mode[] = {
        {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH},
        {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE},
-       {NULL, 0}
+       {.value = NULL}
 };
 
 /* possible values for "-o block-allocator=" and bits which are to be set in
@@ -890,7 +890,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options,     /* strin
                {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
                {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
 #endif
-               {"nolog",},     /* This is unsupported */
+               {.option_name = "nolog"},
                {"replayonly",.setmask = 1 << REPLAYONLY},
                {"block-allocator",.arg_required = 'a',.values = balloc},
                {"data",.arg_required = 'd',.values = logging_mode},
@@ -908,7 +908,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options,     /* strin
                {"grpjquota",.arg_required =
                 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL},
                {"jqfmt",.arg_required = 'f',.values = NULL},
-               {NULL,}
+               {.option_name = NULL}
        };
 
        *blocks = 0;
index ab8894c..58c418f 100644 (file)
@@ -182,7 +182,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 {
        char *name, *value;
        struct posix_acl *acl, **p_acl;
-       size_t size;
+       int size;
        int retval;
        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
 
@@ -206,7 +206,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
                return posix_acl_dup(*p_acl);
 
        size = reiserfs_xattr_get(inode, name, NULL, 0);
-       if ((int)size < 0) {
+       if (size < 0) {
                if (size == -ENODATA || size == -ENOSYS) {
                        *p_acl = ERR_PTR(-ENODATA);
                        return NULL;
index 44ed1d4..fdeabc0 100644 (file)
@@ -217,7 +217,7 @@ smb_set_inode_attr(struct inode *inode, struct smb_fattr *fattr)
        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,
+                       (long) last_time, (long) inode->i_mtime.tv_sec,
                        (long) last_sz, (long) inode->i_size);
 
                if (!S_ISDIR(inode->i_mode))
index 37554b8..8743e9b 100644 (file)
@@ -55,11 +55,10 @@ DEFINE_SPINLOCK(sb_lock);
  */
 static struct super_block *alloc_super(void)
 {
-       struct super_block *s = kmalloc(sizeof(struct super_block),  GFP_USER);
+       struct super_block *s = kzalloc(sizeof(struct super_block),  GFP_USER);
        static struct super_operations default_op;
 
        if (s) {
-               memset(s, 0, sizeof(struct super_block));
                if (security_sb_alloc(s)) {
                        kfree(s);
                        s = NULL;
index d04cff2..81e0e84 100644 (file)
@@ -1341,13 +1341,11 @@ udf_update_inode(struct inode *inode, int do_sync)
 
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
                fe->uid = cpu_to_le32(-1);
-       else if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
-               fe->uid = cpu_to_le32(inode->i_uid);
+       else fe->uid = cpu_to_le32(inode->i_uid);
 
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
                fe->gid = cpu_to_le32(-1);
-       else if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid)
-               fe->gid = cpu_to_le32(inode->i_gid);
+       else fe->gid = cpu_to_le32(inode->i_gid);
 
        udfperms =      ((inode->i_mode & S_IRWXO)     ) |
                        ((inode->i_mode & S_IRWXG) << 2) |
index 34f333b..9570718 100644 (file)
@@ -13,6 +13,8 @@
 #define POLLWRBAND     (1 << 9)
 #define POLLMSG                (1 << 10)
 #define POLLREMOVE     (1 << 11)
+#define POLLRDHUP       (1 << 12)
+
 
 struct pollfd {
        int fd;
index 2744ca8..5030b2b 100644 (file)
@@ -16,6 +16,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index fdfdab0..9ccb7f4 100644 (file)
@@ -15,6 +15,7 @@
 #define POLLWRNORM     0x0100
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 1c0efc3..1b25d4c 100644 (file)
@@ -15,6 +15,7 @@
 #define POLLWRBAND     512
 #define POLLMSG                1024
 #define POLLREMOVE     4096
+#define POLLRDHUP       8192
 
 struct pollfd {
        int fd;
index 8cbcd60..c8fe880 100644 (file)
@@ -12,6 +12,7 @@
 #define POLLRDBAND     128
 #define POLLWRBAND     256
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index bf49ab8..fc52103 100644 (file)
@@ -12,6 +12,7 @@
 #define POLLRDBAND     128
 #define POLLWRBAND     256
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index aecc80a..2cd4929 100644 (file)
@@ -16,6 +16,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 160258a..bcaf9f1 100644 (file)
@@ -21,6 +21,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 43b7acf..9e0e700 100644 (file)
@@ -21,6 +21,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index c4b69c4..0fb8843 100644 (file)
@@ -13,6 +13,7 @@
 #define POLLWRBAND     256
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index a000f1f..70881f8 100644 (file)
@@ -17,6 +17,7 @@
 /* These seem to be more or less nonstandard ...  */
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 1c1da86..20e4d03 100644 (file)
@@ -16,6 +16,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index edd2054..9c7d126 100644 (file)
@@ -13,6 +13,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index e90a5ca..6f7f65a 100644 (file)
@@ -24,6 +24,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 52f95b9..dbca9b3 100644 (file)
@@ -16,6 +16,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index a420d14..3a6cbad 100644 (file)
@@ -26,6 +26,7 @@
 #define POLLWRNORM     0x0100
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 3ddcc64..26f13fb 100644 (file)
@@ -13,6 +13,7 @@
 #define POLLWRBAND     256
 #define POLLMSG                512
 #define POLLREMOVE     1024
+#define POLLRDHUP       2048
 
 struct pollfd {
        int fd;
index 31b611a..ab6b0d1 100644 (file)
@@ -13,6 +13,7 @@
 #define POLLWRBAND     256
 #define POLLMSG                512
 #define POLLREMOVE     1024
+#define POLLRDHUP       2048
 
 struct pollfd {
        int fd;
index 0369562..c10176c 100644 (file)
@@ -13,6 +13,7 @@
 #define POLLWRBAND     0x0100
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index c43cbba..c0475a9 100644 (file)
@@ -16,6 +16,7 @@
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x1000
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index dffe447..6fd9477 100644 (file)
@@ -27,6 +27,7 @@
 
 #define POLLMSG                0x0400
 #define POLLREMOVE     0x0800
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 208650b..f17525a 100644 (file)
@@ -175,4 +175,11 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
        return (word >> shift) | (word << (32 - shift));
 }
 
+static inline unsigned fls_long(unsigned long l)
+{
+       if (sizeof(l) == 4)
+               return fls(l);
+       return fls64(l);
+}
+
 #endif
index 5a23ce7..6548b35 100644 (file)
@@ -357,7 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
 
 #define cap_is_fs_cap(c)     (CAP_TO_MASK(c) & CAP_FS_MASK)
 
-extern int capable(int cap);
+int capable(int cap);
+int __capable(struct task_struct *t, int cap);
 
 #endif /* __KERNEL__ */
 
index d612b89..08d50c5 100644 (file)
@@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void);
        register_cpu_notifier(&fn##_nb);                        \
 }
 int cpu_down(unsigned int cpu);
-extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
 #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
 #else
 #define lock_cpu_hotplug()     do { } while (0)
index 60e56c6..99e6115 100644 (file)
@@ -212,17 +212,15 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
        bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
 }
 
-#define first_cpu(src) __first_cpu(&(src), NR_CPUS)
-static inline int __first_cpu(const cpumask_t *srcp, int nbits)
-{
-       return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
-}
-
-#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS)
-static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
-{
-       return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
-}
+#ifdef CONFIG_SMP
+int __first_cpu(const cpumask_t *srcp);
+#define first_cpu(src) __first_cpu(&(src))
+int __next_cpu(int n, const cpumask_t *srcp);
+#define next_cpu(n, src) __next_cpu((n), &(src))
+#else
+#define first_cpu(src)         0
+#define next_cpu(n, src)       1
+#endif
 
 #define cpumask_of_cpu(cpu)                                            \
 ({                                                                     \
@@ -398,27 +396,17 @@ extern cpumask_t cpu_present_map;
 #define cpu_present(cpu)       ((cpu) == 0)
 #endif
 
-#define any_online_cpu(mask)                   \
-({                                             \
-       int cpu;                                \
-       for_each_cpu_mask(cpu, (mask))          \
-               if (cpu_online(cpu))            \
-                       break;                  \
-       cpu;                                    \
-})
+#ifdef CONFIG_SMP
+int highest_possible_processor_id(void);
+#define any_online_cpu(mask) __any_online_cpu(&(mask))
+int __any_online_cpu(const cpumask_t *mask);
+#else
+#define highest_possible_processor_id()        0
+#define any_online_cpu(mask)           0
+#endif
 
 #define for_each_cpu(cpu)        for_each_cpu_mask((cpu), cpu_possible_map)
 #define for_each_online_cpu(cpu)  for_each_cpu_mask((cpu), cpu_online_map)
 #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
 
-/* Find the highest possible smp_processor_id() */
-#define highest_possible_processor_id() \
-({ \
-       unsigned int cpu, highest = 0; \
-       for_each_cpu_mask(cpu, cpu_possible_map) \
-               highest = cpu; \
-       highest; \
-})
-
-
 #endif /* __LINUX_CPUMASK_H */
index 4361f37..d10bd30 100644 (file)
@@ -162,6 +162,8 @@ d_iput:             no              no              no       yes
 #define DCACHE_REFERENCED      0x0008  /* Recently used, don't discard. */
 #define DCACHE_UNHASHED                0x0010  
 
+#define DCACHE_INOTIFY_PARENT_WATCHED  0x0020 /* Parent inode is watched */
+
 extern spinlock_t dcache_lock;
 
 /**
index fae9395..1e65ebc 100644 (file)
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data)
        dev_set_drvdata(&d->dev, data);
 }
 
-/*
- * A helper function which helps ensure correct dio_driver
- * setup and cleanup for commonly-encountered hotplug/modular cases
- *
- * This MUST stay in a header, as it checks for -DMODULE
- */
-static inline int dio_module_init(struct dio_driver *drv)
-{
-       int rc = dio_register_driver(drv);
-
-       if (rc > 0)
-               return 0;
-
-       /* iff CONFIG_HOTPLUG and built into kernel, we should
-        * leave the driver around for future hotplug events.
-        * For the module case, a hotplug daemon of some sort
-        * should load a module in response to an insert event. */
-#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
-       if (rc == 0)
-               return 0;
-#else
-       if (rc == 0)
-               rc = -ENODEV;
-#endif
-
-       /* if we get here, we need to clean up DIO driver instance
-        * and return some sort of error */
-       dio_unregister_driver(drv);
-
-       return rc;
-}
-
 #endif /* __KERNEL__ */
 #endif /* ndef _LINUX_DIO_H */
index 215696a..21e8cf7 100644 (file)
@@ -65,6 +65,11 @@ extern int dir_notify_enable;
 #define FMODE_PREAD    8
 #define FMODE_PWRITE   FMODE_PREAD     /* These go hand in hand */
 
+/* File is being opened for execution. Primary users of this flag are
+   distributed filesystems that can use it to achieve correct ETXTBUSY
+   behavior for cross-node execution/opening_for_writing of files */
+#define FMODE_EXEC     16
+
 #define RW_MASK                1
 #define RWA_MASK       2
 #define READ 0
@@ -1558,7 +1563,6 @@ extern void destroy_inode(struct inode *);
 extern struct inode *new_inode(struct super_block *);
 extern int remove_suid(struct dentry *);
 extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
-extern struct mutex iprune_mutex;
 
 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
 extern void remove_inode_hash(struct inode *);
index 03b8e79..f7e517c 100644 (file)
 #include <linux/dnotify.h>
 #include <linux/inotify.h>
 
+/*
+ * fsnotify_d_instantiate - instantiate a dentry for inode
+ * Called with dcache_lock held.
+ */
+static inline void fsnotify_d_instantiate(struct dentry *entry,
+                                               struct inode *inode)
+{
+       inotify_d_instantiate(entry, inode);
+}
+
+/*
+ * fsnotify_d_move - entry has been moved
+ * Called with dcache_lock and entry->d_lock held.
+ */
+static inline void fsnotify_d_move(struct dentry *entry)
+{
+       inotify_d_move(entry);
+}
+
 /*
  * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
  */
index ff8d8b8..ed0ac7c 100644 (file)
@@ -69,6 +69,10 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
 
 /* Defined in init/main.c */
 extern char saved_command_line[];
+
+/* used by init/main.c */
+extern void setup_arch(char **);
+
 #endif
   
 #ifndef MODULE
index 267c88b..09e0043 100644 (file)
@@ -71,6 +71,8 @@ struct inotify_event {
 
 #ifdef CONFIG_INOTIFY
 
+extern void inotify_d_instantiate(struct dentry *, struct inode *);
+extern void inotify_d_move(struct dentry *);
 extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
                                      const char *);
 extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
@@ -81,6 +83,15 @@ extern u32 inotify_get_cookie(void);
 
 #else
 
+static inline void inotify_d_instantiate(struct dentry *dentry,
+                                       struct inode *inode)
+{
+}
+
+static inline void inotify_d_move(struct dentry *dentry)
+{
+}
+
 static inline void inotify_inode_queue_event(struct inode *inode,
                                             __u32 mask, __u32 cookie,
                                             const char *filename)
index 6c5d4c8..ee2a82a 100644 (file)
@@ -114,53 +114,8 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
 #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
 extern cpumask_t pending_irq_cpumask[NR_IRQS];
 
-static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
-{
-       irq_desc_t *desc = irq_desc + irq;
-       unsigned long flags;
-
-       spin_lock_irqsave(&desc->lock, flags);
-       desc->move_irq = 1;
-       pending_irq_cpumask[irq] = mask;
-       spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-static inline void
-move_native_irq(int irq)
-{
-       cpumask_t tmp;
-       irq_desc_t *desc = irq_descp(irq);
-
-       if (likely (!desc->move_irq))
-               return;
-
-       desc->move_irq = 0;
-
-       if (likely(cpus_empty(pending_irq_cpumask[irq])))
-               return;
-
-       if (!desc->handler->set_affinity)
-               return;
-
-       /* note - we hold the desc->lock */
-       cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
-
-       /*
-        * If there was a valid mask to work with, please
-        * do the disable, re-program, enable sequence.
-        * This is *not* particularly important for level triggered
-        * but in a edge trigger case, we might be setting rte
-        * when an active trigger is comming in. This could
-        * cause some ioapics to mal-function.
-        * Being paranoid i guess!
-        */
-       if (unlikely(!cpus_empty(tmp))) {
-               desc->handler->disable(irq);
-               desc->handler->set_affinity(irq,tmp);
-               desc->handler->enable(irq);
-       }
-       cpus_clear(pending_irq_cpumask[irq]);
-}
+void set_pending_irq(unsigned int irq, cpumask_t mask);
+void move_native_irq(int irq);
 
 #ifdef CONFIG_PCI_MSI
 /*
index 2ccbfb6..4fc7dff 100644 (file)
@@ -29,6 +29,8 @@
 #include <linux/stddef.h>
 #include <linux/bit_spinlock.h>
 #include <linux/mutex.h>
+#include <linux/timer.h>
+
 #include <asm/semaphore.h>
 #endif
 
@@ -787,7 +789,7 @@ struct journal_s
        unsigned long           j_commit_interval;
 
        /* The timer used to wakeup the commit thread: */
-       struct timer_list       *j_commit_timer;
+       struct timer_list       j_commit_timer;
 
        /*
         * The revoke table: maintains the list of revoked blocks in the
index bb6e7dd..03d6cfa 100644 (file)
@@ -154,9 +154,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x)
        return r;
 }
 
-static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x)
+static inline unsigned long
+__attribute_const__ roundup_pow_of_two(unsigned long x)
 {
-       return (1UL << fls(x - 1));
+       return 1UL << fls_long(x - 1);
 }
 
 extern int printk_ratelimit(void);
index e36a467..0a74c52 100644 (file)
 
 #define UBD_MAJOR              98
 
+#define PP_MAJOR               99
 #define JSFD_MAJOR             99
 
 #define PHONE_MAJOR            100
index 70bd843..e144309 100644 (file)
@@ -554,25 +554,6 @@ static inline void module_remove_driver(struct device_driver *driver)
 
 /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
 
-struct obsolete_modparm {
-       char name[64];
-       char type[64-sizeof(void *)];
-       void *addr;
-};
-
-static inline void MODULE_PARM_(void) { }
-#ifdef MODULE
-/* DEPRECATED: Do not use. */
-#define MODULE_PARM(var,type)                                              \
-extern struct obsolete_modparm __parm_##var \
-__attribute__((section("__obsparm"))); \
-struct obsolete_modparm __parm_##var = \
-{ __stringify(var), type, &MODULE_PARM_ }; \
-__MODULE_PARM_TYPE(var, type);
-#else
-#define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_;
-#endif
-
 #define __MODULE_STRING(x) __stringify(x)
 
 /* Use symbol_get and symbol_put instead.  You'll thank me. */
index b5c98c4..7c0c2c1 100644 (file)
@@ -162,13 +162,6 @@ extern int param_array_get(char *buffer, struct kernel_param *kp);
 extern int param_set_copystring(const char *val, struct kernel_param *kp);
 extern int param_get_string(char *buffer, struct kernel_param *kp);
 
-int param_array(const char *name,
-               const char *val,
-               unsigned int min, unsigned int max,
-               void *elem, int elemsize,
-               int (*set)(const char *, struct kernel_param *kp),
-               int *num);
-
 /* for exporting parameters in /sys/parameters */
 
 struct module;
index 141c965..f376a75 100644 (file)
@@ -14,8 +14,6 @@
  * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001
  */
 
-#define PP_MAJOR       99
-
 #define PP_IOCTL       'p'
 
 /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
index 8dc2d04..2dab71e 100644 (file)
@@ -209,7 +209,6 @@ extern struct dqstats dqstats;
 #define DQ_FAKE_B      3       /* no limits only usage */
 #define DQ_READ_B      4       /* dquot was read into memory */
 #define DQ_ACTIVE_B    5       /* dquot is active (dquot_release not called) */
-#define DQ_WAITFREE_B  6       /* dquot being waited (by invalidate_dquots) */
 
 struct dquot {
        struct hlist_node dq_hash;      /* Hash list in memory */
index c57ff2f..dd83cca 100644 (file)
@@ -45,6 +45,8 @@ do {                                                                  \
        (root)->rnode = NULL;                                           \
 } while (0)
 
+#define RADIX_TREE_MAX_TAGS 2
+
 int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
 void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
 void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
@@ -55,15 +57,16 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
 int radix_tree_preload(gfp_t gfp_mask);
 void radix_tree_init(void);
 void *radix_tree_tag_set(struct radix_tree_root *root,
-                       unsigned long index, int tag);
+                       unsigned long index, unsigned int tag);
 void *radix_tree_tag_clear(struct radix_tree_root *root,
-                       unsigned long index, int tag);
+                       unsigned long index, unsigned int tag);
 int radix_tree_tag_get(struct radix_tree_root *root,
-                       unsigned long index, int tag);
+                       unsigned long index, unsigned int tag);
 unsigned int
 radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
-               unsigned long first_index, unsigned int max_items, int tag);
-int radix_tree_tagged(struct radix_tree_root *root, int tag);
+               unsigned long first_index, unsigned int max_items,
+               unsigned int tag);
+int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
 
 static inline void radix_tree_preload_end(void)
 {
index dad78ce..912f1b7 100644 (file)
@@ -1704,6 +1704,11 @@ static inline int reiserfs_transaction_running(struct super_block *s)
        return 0;
 }
 
+static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th)
+{
+       return th->t_blocks_allocated - th->t_blocks_logged;
+}
+
 int reiserfs_async_progress_wait(struct super_block *s);
 
 struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
index 87280eb..5353afb 100644 (file)
@@ -101,13 +101,13 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
 #else
 
 #define is_reiserfs_priv_object(inode) 0
-#define reiserfs_mark_inode_private(inode)
+#define reiserfs_mark_inode_private(inode) do {;} while(0)
 #define reiserfs_getxattr NULL
 #define reiserfs_setxattr NULL
 #define reiserfs_listxattr NULL
 #define reiserfs_removexattr NULL
-#define reiserfs_write_lock_xattrs(sb)
-#define reiserfs_write_unlock_xattrs(sb)
+#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
+#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
 #define reiserfs_read_lock_xattrs(sb)
 #define reiserfs_read_unlock_xattrs(sb)
 
index b18eb8c..3c19be3 100644 (file)
@@ -1040,6 +1040,11 @@ struct swap_info_struct;
  *     @effective contains the effective capability set.
  *     @inheritable contains the inheritable capability set.
  *     @permitted contains the permitted capability set.
+ * @capable:
+ *     Check whether the @tsk process has the @cap capability.
+ *     @tsk contains the task_struct for the process.
+ *     @cap contains the capability <include/linux/capability.h>.
+ *     Return 0 if the capability is granted for @tsk.
  * @acct:
  *     Check permission before enabling or disabling process accounting.  If
  *     accounting is being enabled, then @file refers to the open file used to
@@ -1053,11 +1058,6 @@ struct swap_info_struct;
  *     @table contains the ctl_table structure for the sysctl variable.
  *     @op contains the operation (001 = search, 002 = write, 004 = read).
  *     Return 0 if permission is granted.
- * @capable:
- *     Check whether the @tsk process has the @cap capability.
- *     @tsk contains the task_struct for the process.
- *     @cap contains the capability <include/linux/capability.h>.
- *     Return 0 if the capability is granted for @tsk.
  * @syslog:
  *     Check permission before accessing the kernel message ring or changing
  *     logging to the console.
@@ -1099,9 +1099,9 @@ struct security_operations {
                            kernel_cap_t * effective,
                            kernel_cap_t * inheritable,
                            kernel_cap_t * permitted);
+       int (*capable) (struct task_struct * tsk, int cap);
        int (*acct) (struct file * file);
        int (*sysctl) (struct ctl_table * table, int op);
-       int (*capable) (struct task_struct * tsk, int cap);
        int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
        int (*quota_on) (struct dentry * dentry);
        int (*syslog) (int type);
@@ -1347,6 +1347,11 @@ static inline void security_capset_set (struct task_struct *target,
        security_ops->capset_set (target, effective, inheritable, permitted);
 }
 
+static inline int security_capable(struct task_struct *tsk, int cap)
+{
+       return security_ops->capable(tsk, cap);
+}
+
 static inline int security_acct (struct file *file)
 {
        return security_ops->acct (file);
@@ -2050,6 +2055,11 @@ static inline void security_capset_set (struct task_struct *target,
        cap_capset_set (target, effective, inheritable, permitted);
 }
 
+static inline int security_capable(struct task_struct *tsk, int cap)
+{
+       return cap_capable(tsk, cap);
+}
+
 static inline int security_acct (struct file *file)
 {
        return 0;
index e2ee5b2..15e1d97 100644 (file)
@@ -64,6 +64,7 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo
 extern int kmem_cache_destroy(kmem_cache_t *);
 extern int kmem_cache_shrink(kmem_cache_t *);
 extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
+extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
 extern void kmem_cache_free(kmem_cache_t *, void *);
 extern unsigned int kmem_cache_size(kmem_cache_t *);
 extern const char *kmem_cache_name(kmem_cache_t *);
@@ -77,11 +78,12 @@ struct cache_sizes {
 };
 extern struct cache_sizes malloc_sizes[];
 
-#ifndef CONFIG_DEBUG_SLAB
 extern void *__kmalloc(size_t, gfp_t);
+#ifndef CONFIG_DEBUG_SLAB
+#define ____kmalloc(size, flags) __kmalloc(size, flags)
 #else
 extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
-#define __kmalloc(size, flags) \
+#define ____kmalloc(size, flags) \
     __kmalloc_track_caller(size, flags, __builtin_return_address(0))
 #endif
 
@@ -108,7 +110,30 @@ found:
        return __kmalloc(size, flags);
 }
 
-extern void *kzalloc(size_t, gfp_t);
+extern void *__kzalloc(size_t, gfp_t);
+
+static inline void *kzalloc(size_t size, gfp_t flags)
+{
+       if (__builtin_constant_p(size)) {
+               int i = 0;
+#define CACHE(x) \
+               if (size <= x) \
+                       goto found; \
+               else \
+                       i++;
+#include "kmalloc_sizes.h"
+#undef CACHE
+               {
+                       extern void __you_cannot_kzalloc_that_much(void);
+                       __you_cannot_kzalloc_that_much();
+               }
+found:
+               return kmem_cache_zalloc((flags & GFP_DMA) ?
+                       malloc_sizes[i].cs_dmacachep :
+                       malloc_sizes[i].cs_cachep, flags);
+       }
+       return __kzalloc(size, flags);
+}
 
 /**
  * kcalloc - allocate memory for an array. The memory is set to zero.
@@ -155,17 +180,18 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
        void (*)(void *, struct kmem_cache *, unsigned long));
 int kmem_cache_destroy(struct kmem_cache *c);
 void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
+void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
 void kmem_cache_free(struct kmem_cache *c, void *b);
 const char *kmem_cache_name(struct kmem_cache *);
 void *kmalloc(size_t size, gfp_t flags);
-void *kzalloc(size_t size, gfp_t flags);
+void *__kzalloc(size_t size, gfp_t flags);
 void kfree(const void *m);
 unsigned int ksize(const void *m);
 unsigned int kmem_cache_size(struct kmem_cache *c);
 
 static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 {
-       return kzalloc(n * size, flags);
+       return __kzalloc(n * size, flags);
 }
 
 #define kmem_cache_shrink(d) (0)
@@ -173,6 +199,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 #define kmem_ptr_validate(a, b) (0)
 #define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
 #define kmalloc_node(s, f, n) kmalloc(s, f)
+#define kzalloc(s, f) __kzalloc(s, f)
+#define ____kmalloc kmalloc
 
 #endif /* CONFIG_SLOB */
 
index d9cdba5..bf0e785 100644 (file)
@@ -101,6 +101,7 @@ extern long do_utimes(int dfd, char __user *filename, struct timeval *times);
 struct itimerval;
 extern int do_setitimer(int which, struct itimerval *value,
                        struct itimerval *ovalue);
+extern unsigned int alarm_setitimer(unsigned int seconds);
 extern int do_getitimer(int which, struct itimerval *value);
 extern void getnstimeofday(struct timespec *tv);
 
index b7ca120..82dc9ae 100644 (file)
 
 #define MAXPHASE 512000L        /* max phase error (us) */
 #define MAXFREQ (512L << SHIFT_USEC)  /* max frequency error (ppm) */
-#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */
 #define MINSEC 16L              /* min interval between updates (s) */
 #define MAXSEC 1200L            /* max interval between updates (s) */
 #define        NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */
 
-/*
- * The following defines are used only if a pulse-per-second (PPS)
- * signal is available and connected via a modem control lead, such as
- * produced by the optional ppsclock feature incorporated in the Sun
- * asynch driver. They establish the design parameters of the frequency-
- * lock loop used to discipline the CPU clock oscillator to the PPS
- * signal.
- *
- * PPS_AVG is the averaging factor for the frequency loop, as well as
- * the time and frequency dispersion.
- *
- * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum
- * calibration intervals, respectively, in seconds as a power of two.
- *
- * PPS_VALID is the maximum interval before the PPS signal is considered
- * invalid and protocol updates used directly instead.
- *
- * MAXGLITCH is the maximum interval before a time offset of more than
- * MAXTIME is believed.
- */
-#define PPS_AVG 2              /* pps averaging constant (shift) */
-#define PPS_SHIFT 2            /* min interval duration (s) (shift) */
-#define PPS_SHIFTMAX 8         /* max interval duration (s) (shift) */
-#define PPS_VALID 120          /* pps signal watchdog max (s) */
-#define MAXGLITCH 30           /* pps signal glitch max (s) */
-
 /*
  * syscall interface - used (mainly by NTP daemon)
  * to discipline kernel clock oscillator
@@ -246,20 +219,6 @@ extern long time_reftime;  /* time at last adjustment (s) */
 extern long time_adjust;       /* The amount of adjtime left */
 extern long time_next_adjust;  /* Value for time_adjust at next tick */
 
-/* interface variables pps->timer interrupt */
-extern long pps_offset;                /* pps time offset (us) */
-extern long pps_jitter;                /* time dispersion (jitter) (us) */
-extern long pps_freq;          /* frequency offset (scaled ppm) */
-extern long pps_stabil;                /* frequency dispersion (scaled ppm) */
-extern long pps_valid;         /* pps signal watchdog counter */
-
-/* interface variables pps->adjtimex */
-extern int pps_shift;          /* interval duration (s) (shift) */
-extern long pps_jitcnt;                /* jitter limit exceeded */
-extern long pps_calcnt;                /* calibration intervals */
-extern long pps_errcnt;                /* calibration errors */
-extern long pps_stbcnt;                /* stability limit exceeded */
-
 /**
  * ntp_clear - Clears the NTP state variables
  *
index 0c6169f..0976a16 100644 (file)
@@ -2,8 +2,8 @@
 #define _LINUX_TTY_FLIP_H
 
 extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
-extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size);
-extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size);
+extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size);
+extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
 extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
 extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
 
index 1e75084..ffaf056 100644 (file)
 
 #ifdef __KERNEL__
 
-#ifndef _ECMA_167_H
-typedef struct
-{
-       __u32                   logicalBlockNum;
-       __u16                   partitionReferenceNum;
-} __attribute__ ((packed)) lb_addr;
-
-typedef struct
-{
-       __u32                   extLength;
-       __u32                   extPosition;
-} __attribute__ ((packed)) short_ad;
-
-typedef struct
-{
-       __u32                   extLength;
-       lb_addr                 extLocation;
-       __u8                    impUse[6];
-} __attribute__ ((packed)) long_ad;
-#endif
-
 struct udf_inode_info
 {
        struct timespec         i_crtime;
index ba5b727..2f135cf 100644 (file)
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
 }
 
 
-/*
- * A helper function which helps ensure correct zorro_driver
- * setup and cleanup for commonly-encountered hotplug/modular cases
- *
- * This MUST stay in a header, as it checks for -DMODULE
- */
-static inline int zorro_module_init(struct zorro_driver *drv)
-{
-       int rc = zorro_register_driver(drv);
-
-       if (rc > 0)
-               return 0;
-
-       /* iff CONFIG_HOTPLUG and built into kernel, we should
-        * leave the driver around for future hotplug events.
-        * For the module case, a hotplug daemon of some sort
-        * should load a module in response to an insert event. */
-#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
-       if (rc == 0)
-               return 0;
-#else
-       if (rc == 0)
-               rc = -ENODEV;
-#endif
-
-       /* if we get here, we need to clean up Zorro driver instance
-        * and return some sort of error */
-       zorro_unregister_driver(drv);
-
-       return rc;
-}
-
-
     /*
      *  Bitmask indicating portions of available Zorro II RAM that are unused
      *  by the system. Every bit represents a 64K chunk, for a maximum of 8MB
index 6f4ea80..ac02137 100644 (file)
 #endif
 
 /* max number of simultaneous board */
-/* warning : make sure module array def's are coherent with PM3_MAX_BOARD */
 #define PM3_MAX_BOARD 4
-#define PM3_MAX_BOARD_MODULE_ARRAY_SHORT "1-4h"
-#define PM3_MAX_BOARD_MODULE_ARRAY_STRING "1-4s"
 
 /* max size of options */
 #define PM3_OPTIONS_SIZE 256
index 1d19fd2..05951c1 100644 (file)
@@ -470,15 +470,6 @@ config MODULE_FORCE_UNLOAD
          rmmod).  This is mainly for kernel developers and desperate users.
          If unsure, say N.
 
-config OBSOLETE_MODPARM
-       bool
-       default y
-       depends on MODULES
-       help
-         You need this option to use module parameters on modules which
-         have not been converted to the new module parameter system yet.
-         If unsure, say Y.
-
 config MODVERSIONS
        bool "Module versioning support"
        depends on MODULES
index 637344b..77b934c 100644 (file)
@@ -506,6 +506,7 @@ void __init populate_rootfs(void)
                panic(err);
 #ifdef CONFIG_BLK_DEV_INITRD
        if (initrd_start) {
+#ifdef CONFIG_BLK_DEV_RAM
                int fd;
                printk(KERN_INFO "checking if image is initramfs...");
                err = unpack_to_rootfs((char *)initrd_start,
@@ -525,6 +526,15 @@ void __init populate_rootfs(void)
                        sys_close(fd);
                        free_initrd();
                }
+#else
+               printk(KERN_INFO "Unpacking initramfs...");
+               err = unpack_to_rootfs((char *)initrd_start,
+                       initrd_end - initrd_start, 0);
+               if (err)
+                       panic(err);
+               printk(" done\n");
+               free_initrd();
+#endif
        }
 #endif
 }
index 2714e0e..006dcd5 100644 (file)
@@ -306,8 +306,6 @@ static int __init rdinit_setup(char *str)
 }
 __setup("rdinit=", rdinit_setup);
 
-extern void setup_arch(char **);
-
 #ifndef CONFIG_SMP
 
 #ifdef CONFIG_X86_LOCAL_APIC
@@ -571,17 +569,23 @@ static void __init do_initcalls(void)
        int count = preempt_count();
 
        for (call = __initcall_start; call < __initcall_end; call++) {
-               char *msg;
+               char *msg = NULL;
+               char msgbuf[40];
+               int result;
 
                if (initcall_debug) {
-                       printk(KERN_DEBUG "Calling initcall 0x%p", *call);
-                       print_fn_descriptor_symbol(": %s()", (unsigned long) *call);
+                       printk("Calling initcall 0x%p", *call);
+                       print_fn_descriptor_symbol(": %s()",
+                                       (unsigned long) *call);
                        printk("\n");
                }
 
-               (*call)();
+               result = (*call)();
 
-               msg = NULL;
+               if (result && (result != -ENODEV || initcall_debug)) {
+                       sprintf(msgbuf, "error code %d", result);
+                       msg = msgbuf;
+               }
                if (preempt_count() != count) {
                        msg = "preemption imbalance";
                        preempt_count() = count;
@@ -591,8 +595,10 @@ static void __init do_initcalls(void)
                        local_irq_enable();
                }
                if (msg) {
-                       printk(KERN_WARNING "error in initcall at 0x%p: "
-                               "returned with %s\n", *call, msg);
+                       printk(KERN_WARNING "initcall at 0x%p", *call);
+                       print_fn_descriptor_symbol(": %s()",
+                                       (unsigned long) *call);
+                       printk(": returned with %s\n", msg);
                }
        }
 
index bfa3c92..1a4d8a4 100644 (file)
@@ -233,3 +233,19 @@ out:
 
      return ret;
 }
+
+int __capable(struct task_struct *t, int cap)
+{
+       if (security_capable(t, cap) == 0) {
+               t->flags |= PF_SUPERPRIV;
+               return 1;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(__capable);
+
+int capable(int cap)
+{
+       return __capable(current, cap);
+}
+EXPORT_SYMBOL(capable);
index 4937873..2b33f85 100644 (file)
@@ -1,5 +1,4 @@
 
-obj-y := handle.o manage.o spurious.o
+obj-y := handle.o manage.o spurious.o migration.o
 obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
 obj-$(CONFIG_PROC_FS) += proc.o
-
index 97d5559..6edfcef 100644 (file)
@@ -204,10 +204,14 @@ int setup_irq(unsigned int irq, struct irqaction * new)
        p = &desc->action;
        if ((old = *p) != NULL) {
                /* Can't share interrupts unless both agree to */
-               if (!(old->flags & new->flags & SA_SHIRQ)) {
-                       spin_unlock_irqrestore(&desc->lock,flags);
-                       return -EBUSY;
-               }
+               if (!(old->flags & new->flags & SA_SHIRQ))
+                       goto mismatch;
+
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+               /* All handlers must agree on per-cpuness */
+               if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU))
+                       goto mismatch;
+#endif
 
                /* add new interrupt at end of irq queue */
                do {
@@ -218,7 +222,10 @@ int setup_irq(unsigned int irq, struct irqaction * new)
        }
 
        *p = new;
-
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+       if (new->flags & SA_PERCPU_IRQ)
+               desc->status |= IRQ_PER_CPU;
+#endif
        if (!shared) {
                desc->depth = 0;
                desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT |
@@ -236,6 +243,12 @@ int setup_irq(unsigned int irq, struct irqaction * new)
        register_handler_proc(irq, new);
 
        return 0;
+
+mismatch:
+       spin_unlock_irqrestore(&desc->lock, flags);
+       printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__);
+       dump_stack();
+       return -EBUSY;
 }
 
 /**
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
new file mode 100644 (file)
index 0000000..52a8655
--- /dev/null
@@ -0,0 +1,65 @@
+#include <linux/irq.h>
+
+#if defined(CONFIG_GENERIC_PENDING_IRQ)
+
+void set_pending_irq(unsigned int irq, cpumask_t mask)
+{
+       irq_desc_t *desc = irq_desc + irq;
+       unsigned long flags;
+
+       spin_lock_irqsave(&desc->lock, flags);
+       desc->move_irq = 1;
+       pending_irq_cpumask[irq] = mask;
+       spin_unlock_irqrestore(&desc->lock, flags);
+}
+
+void move_native_irq(int irq)
+{
+       cpumask_t tmp;
+       irq_desc_t *desc = irq_descp(irq);
+
+       if (likely(!desc->move_irq))
+               return;
+
+       /*
+        * Paranoia: cpu-local interrupts shouldn't be calling in here anyway.
+        */
+       if (CHECK_IRQ_PER_CPU(desc->status)) {
+               WARN_ON(1);
+               return;
+       }
+
+       desc->move_irq = 0;
+
+       if (likely(cpus_empty(pending_irq_cpumask[irq])))
+               return;
+
+       if (!desc->handler->set_affinity)
+               return;
+
+       assert_spin_locked(&desc->lock);
+
+       cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
+
+       /*
+        * If there was a valid mask to work with, please
+        * do the disable, re-program, enable sequence.
+        * This is *not* particularly important for level triggered
+        * but in a edge trigger case, we might be setting rte
+        * when an active trigger is comming in. This could
+        * cause some ioapics to mal-function.
+        * Being paranoid i guess!
+        */
+       if (unlikely(!cpus_empty(tmp))) {
+               if (likely(!(desc->status & IRQ_DISABLED)))
+                       desc->handler->disable(irq);
+
+               desc->handler->set_affinity(irq,tmp);
+
+               if (likely(!(desc->status & IRQ_DISABLED)))
+                       desc->handler->enable(irq);
+       }
+       cpus_clear(pending_irq_cpumask[irq]);
+}
+
+#endif
index 379be2f..680e6b7 100644 (file)
@@ -143,6 +143,60 @@ int it_real_fn(void *data)
        return HRTIMER_NORESTART;
 }
 
+/*
+ * We do not care about correctness. We just sanitize the values so
+ * the ktime_t operations which expect normalized values do not
+ * break. This converts negative values to long timeouts similar to
+ * the code in kernel versions < 2.6.16
+ *
+ * Print a limited number of warning messages when an invalid timeval
+ * is detected.
+ */
+static void fixup_timeval(struct timeval *tv, int interval)
+{
+       static int warnlimit = 10;
+       unsigned long tmp;
+
+       if (warnlimit > 0) {
+               warnlimit--;
+               printk(KERN_WARNING
+                      "setitimer: %s (pid = %d) provided "
+                      "invalid timeval %s: tv_sec = %ld tv_usec = %ld\n",
+                      current->comm, current->pid,
+                      interval ? "it_interval" : "it_value",
+                      tv->tv_sec, (long) tv->tv_usec);
+       }
+
+       tmp = tv->tv_usec;
+       if (tmp >= USEC_PER_SEC) {
+               tv->tv_usec = tmp % USEC_PER_SEC;
+               tv->tv_sec += tmp / USEC_PER_SEC;
+       }
+
+       tmp = tv->tv_sec;
+       if (tmp > LONG_MAX)
+               tv->tv_sec = LONG_MAX;
+}
+
+/*
+ * Returns true if the timeval is in canonical form
+ */
+#define timeval_valid(t) \
+       (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC))
+
+/*
+ * Check for invalid timevals, sanitize them and print a limited
+ * number of warnings.
+ */
+static void check_itimerval(struct itimerval *value) {
+
+       if (unlikely(!timeval_valid(&value->it_value)))
+               fixup_timeval(&value->it_value, 0);
+
+       if (unlikely(!timeval_valid(&value->it_interval)))
+               fixup_timeval(&value->it_interval, 1);
+}
+
 int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
 {
        struct task_struct *tsk = current;
@@ -150,6 +204,18 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
        ktime_t expires;
        cputime_t cval, cinterval, nval, ninterval;
 
+       /*
+        * Validate the timevals in value.
+        *
+        * Note: Although the spec requires that invalid values shall
+        * return -EINVAL, we just fixup the value and print a limited
+        * number of warnings in order not to break users of this
+        * historical misfeature.
+        *
+        * Scheduled for replacement in March 2007
+        */
+       check_itimerval(value);
+
        switch (which) {
        case ITIMER_REAL:
 again:
@@ -226,6 +292,43 @@ again:
        return 0;
 }
 
+/**
+ * alarm_setitimer - set alarm in seconds
+ *
+ * @seconds:   number of seconds until alarm
+ *             0 disables the alarm
+ *
+ * Returns the remaining time in seconds of a pending timer or 0 when
+ * the timer is not active.
+ *
+ * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid
+ * negative timeval settings which would cause immediate expiry.
+ */
+unsigned int alarm_setitimer(unsigned int seconds)
+{
+       struct itimerval it_new, it_old;
+
+#if BITS_PER_LONG < 64
+       if (seconds > INT_MAX)
+               seconds = INT_MAX;
+#endif
+       it_new.it_value.tv_sec = seconds;
+       it_new.it_value.tv_usec = 0;
+       it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
+
+       do_setitimer(ITIMER_REAL, &it_new, &it_old);
+
+       /*
+        * We can't return 0 if we have an alarm pending ...  And we'd
+        * better return too much than too little anyway
+        */
+       if ((!it_old.it_value.tv_sec && it_old.it_value.tv_usec) ||
+             it_old.it_value.tv_usec >= 500000)
+               it_old.it_value.tv_sec++;
+
+       return it_old.it_value.tv_sec;
+}
+
 asmlinkage long sys_setitimer(int which,
                              struct itimerval __user *value,
                              struct itimerval __user *ovalue)
index 6a53738..c5f3c66 100644 (file)
@@ -115,7 +115,9 @@ static void keventd_create_kthread(void *_create)
                create->result = ERR_PTR(pid);
        } else {
                wait_for_completion(&create->started);
+               read_lock(&tasklist_lock);
                create->result = find_task_by_pid(pid);
+               read_unlock(&tasklist_lock);
        }
        complete(&create->done);
 }
index 54623c7..ddfe45a 100644 (file)
@@ -233,24 +233,6 @@ static unsigned long __find_symbol(const char *name,
        return 0;
 }
 
-/* Find a symbol in this elf symbol table */
-static unsigned long find_local_symbol(Elf_Shdr *sechdrs,
-                                      unsigned int symindex,
-                                      const char *strtab,
-                                      const char *name)
-{
-       unsigned int i;
-       Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
-
-       /* Search (defined) internal symbols first. */
-       for (i = 1; i < sechdrs[symindex].sh_size/sizeof(*sym); i++) {
-               if (sym[i].st_shndx != SHN_UNDEF
-                   && strcmp(name, strtab + sym[i].st_name) == 0)
-                       return sym[i].st_value;
-       }
-       return 0;
-}
-
 /* Search for module by name: must hold module_mutex. */
 static struct module *find_module(const char *name)
 {
@@ -785,139 +767,6 @@ static struct module_attribute *modinfo_attrs[] = {
        NULL,
 };
 
-#ifdef CONFIG_OBSOLETE_MODPARM
-/* Bounds checking done below */
-static int obsparm_copy_string(const char *val, struct kernel_param *kp)
-{
-       strcpy(kp->arg, val);
-       return 0;
-}
-
-static int set_obsolete(const char *val, struct kernel_param *kp)
-{
-       unsigned int min, max;
-       unsigned int size, maxsize;
-       int dummy;
-       char *endp;
-       const char *p;
-       struct obsolete_modparm *obsparm = kp->arg;
-
-       if (!val) {
-               printk(KERN_ERR "Parameter %s needs an argument\n", kp->name);
-               return -EINVAL;
-       }
-
-       /* type is: [min[-max]]{b,h,i,l,s} */
-       p = obsparm->type;
-       min = simple_strtol(p, &endp, 10);
-       if (endp == obsparm->type)
-               min = max = 1;
-       else if (*endp == '-') {
-               p = endp+1;
-               max = simple_strtol(p, &endp, 10);
-       } else
-               max = min;
-       switch (*endp) {
-       case 'b':
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  1, param_set_byte, &dummy);
-       case 'h':
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  sizeof(short), param_set_short, &dummy);
-       case 'i':
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  sizeof(int), param_set_int, &dummy);
-       case 'l':
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  sizeof(long), param_set_long, &dummy);
-       case 's':
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  sizeof(char *), param_set_charp, &dummy);
-
-       case 'c':
-               /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars,
-                  and the decl is "char xxx[5][50];" */
-               p = endp+1;
-               maxsize = simple_strtol(p, &endp, 10);
-               /* We check lengths here (yes, this is a hack). */
-               p = val;
-               while (p[size = strcspn(p, ",")]) {
-                       if (size >= maxsize) 
-                               goto oversize;
-                       p += size+1;
-               }
-               if (size >= maxsize) 
-                       goto oversize;
-               return param_array(kp->name, val, min, max, obsparm->addr,
-                                  maxsize, obsparm_copy_string, &dummy);
-       }
-       printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
-       return -EINVAL;
- oversize:
-       printk(KERN_ERR
-              "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize);
-       return -EINVAL;
-}
-
-static int obsolete_params(const char *name,
-                          char *args,
-                          struct obsolete_modparm obsparm[],
-                          unsigned int num,
-                          Elf_Shdr *sechdrs,
-                          unsigned int symindex,
-                          const char *strtab)
-{
-       struct kernel_param *kp;
-       unsigned int i;
-       int ret;
-
-       kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL);
-       if (!kp)
-               return -ENOMEM;
-
-       for (i = 0; i < num; i++) {
-               char sym_name[128 + sizeof(MODULE_SYMBOL_PREFIX)];
-
-               snprintf(sym_name, sizeof(sym_name), "%s%s",
-                        MODULE_SYMBOL_PREFIX, obsparm[i].name);
-
-               kp[i].name = obsparm[i].name;
-               kp[i].perm = 000;
-               kp[i].set = set_obsolete;
-               kp[i].get = NULL;
-               obsparm[i].addr
-                       = (void *)find_local_symbol(sechdrs, symindex, strtab,
-                                                   sym_name);
-               if (!obsparm[i].addr) {
-                       printk("%s: falsely claims to have parameter %s\n",
-                              name, obsparm[i].name);
-                       ret = -EINVAL;
-                       goto out;
-               }
-               kp[i].arg = &obsparm[i];
-       }
-
-       ret = parse_args(name, args, kp, num, NULL);
- out:
-       kfree(kp);
-       return ret;
-}
-#else
-static int obsolete_params(const char *name,
-                          char *args,
-                          struct obsolete_modparm obsparm[],
-                          unsigned int num,
-                          Elf_Shdr *sechdrs,
-                          unsigned int symindex,
-                          const char *strtab)
-{
-       if (num != 0)
-               printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
-                      name);
-       return 0;
-}
-#endif /* CONFIG_OBSOLETE_MODPARM */
-
 static const char vermagic[] = VERMAGIC_STRING;
 
 #ifdef CONFIG_MODVERSIONS
@@ -1874,27 +1723,17 @@ static struct module *load_module(void __user *umod,
        set_fs(old_fs);
 
        mod->args = args;
-       if (obsparmindex) {
-               err = obsolete_params(mod->name, mod->args,
-                                     (struct obsolete_modparm *)
-                                     sechdrs[obsparmindex].sh_addr,
-                                     sechdrs[obsparmindex].sh_size
-                                     / sizeof(struct obsolete_modparm),
-                                     sechdrs, symindex,
-                                     (char *)sechdrs[strindex].sh_addr);
-               if (setupindex)
-                       printk(KERN_WARNING "%s: Ignoring new-style "
-                              "parameters in presence of obsolete ones\n",
-                              mod->name);
-       } else {
-               /* Size of section 0 is 0, so this works well if no params */
-               err = parse_args(mod->name, mod->args,
-                                (struct kernel_param *)
-                                sechdrs[setupindex].sh_addr,
-                                sechdrs[setupindex].sh_size
-                                / sizeof(struct kernel_param),
-                                NULL);
-       }
+       if (obsparmindex)
+               printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
+                      mod->name);
+
+       /* Size of section 0 is 0, so this works well if no params */
+       err = parse_args(mod->name, mod->args,
+                        (struct kernel_param *)
+                        sechdrs[setupindex].sh_addr,
+                        sechdrs[setupindex].sh_size
+                        / sizeof(struct kernel_param),
+                        NULL);
        if (err < 0)
                goto arch_cleanup;
 
index a291505..9de637a 100644 (file)
@@ -265,12 +265,12 @@ int param_get_invbool(char *buffer, struct kernel_param *kp)
 }
 
 /* We cheat here and temporarily mangle the string. */
-int param_array(const char *name,
-               const char *val,
-               unsigned int min, unsigned int max,
-               void *elem, int elemsize,
-               int (*set)(const char *, struct kernel_param *kp),
-               int *num)
+static int param_array(const char *name,
+                      const char *val,
+                      unsigned int min, unsigned int max,
+                      void *elem, int elemsize,
+                      int (*set)(const char *, struct kernel_param *kp),
+                      int *num)
 {
        int ret;
        struct kernel_param kp;
index 911fc62..5957312 100644 (file)
@@ -49,9 +49,7 @@ void enable_nonboot_cpus(void)
 
        printk("Thawing cpus ...\n");
        for_each_cpu_mask(cpu, frozen_cpus) {
-               error = smp_prepare_cpu(cpu);
-               if (!error)
-                       error = cpu_up(cpu);
+               error = cpu_up(cpu);
                if (!error) {
                        printk("CPU%d is up\n", cpu);
                        continue;
index 9a1fa88..b4b362b 100644 (file)
@@ -54,15 +54,15 @@ static int verbose;         /* Print more debug info. */
 static int test_no_idle_hz;    /* Test RCU's support for tickless idle CPUs. */
 static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/
 
-MODULE_PARM(nreaders, "i");
+module_param(nreaders, int, 0);
 MODULE_PARM_DESC(nreaders, "Number of RCU reader threads");
-MODULE_PARM(stat_interval, "i");
+module_param(stat_interval, int, 0);
 MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s");
-MODULE_PARM(verbose, "i");
+module_param(verbose, bool, 0);
 MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s");
-MODULE_PARM(test_no_idle_hz, "i");
+module_param(test_no_idle_hz, bool, 0);
 MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs");
-MODULE_PARM(shuffle_interval, "i");
+module_param(shuffle_interval, int, 0);
 MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
 #define TORTURE_FLAG "rcutorture: "
 #define PRINTK_STRING(s) \
index dd9524f..d9b3d58 100644 (file)
@@ -118,6 +118,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
                        printk("watchdog for %i failed\n", hotcpu);
                        return NOTIFY_BAD;
                }
+               per_cpu(touch_timestamp, hotcpu) = jiffies;
                per_cpu(watchdog_task, hotcpu) = p;
                kthread_bind(p, hotcpu);
                break;
index 19d058b..38bc73e 100644 (file)
@@ -224,18 +224,6 @@ int unregister_reboot_notifier(struct notifier_block * nb)
 
 EXPORT_SYMBOL(unregister_reboot_notifier);
 
-#ifndef CONFIG_SECURITY
-int capable(int cap)
-{
-        if (cap_raised(current->cap_effective, cap)) {
-              current->flags |= PF_SUPERPRIV;
-              return 1;
-        }
-        return 0;
-}
-EXPORT_SYMBOL(capable);
-#endif
-
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
        int no_nice;
@@ -1375,7 +1363,7 @@ static void groups_sort(struct group_info *group_info)
 /* a simple bsearch */
 int groups_search(struct group_info *group_info, gid_t grp)
 {
-       int left, right;
+       unsigned int left, right;
 
        if (!group_info)
                return 0;
@@ -1383,7 +1371,7 @@ int groups_search(struct group_info *group_info, gid_t grp)
        left = 0;
        right = group_info->ngroups;
        while (left < right) {
-               int mid = (left+right)/2;
+               unsigned int mid = (left+right)/2;
                int cmp = grp - GROUP_AT(group_info, mid);
                if (cmp > 0)
                        left = mid + 1;
@@ -1433,7 +1421,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)
                return -EINVAL;
 
        /* no need to grab task_lock here; it cannot change */
-       get_group_info(current->group_info);
        i = current->group_info->ngroups;
        if (gidsetsize) {
                if (i > gidsetsize) {
@@ -1446,7 +1433,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)
                }
        }
 out:
-       put_group_info(current->group_info);
        return i;
 }
 
@@ -1487,9 +1473,7 @@ int in_group_p(gid_t grp)
 {
        int retval = 1;
        if (grp != current->fsgid) {
-               get_group_info(current->group_info);
                retval = groups_search(current->group_info, grp);
-               put_group_info(current->group_info);
        }
        return retval;
 }
@@ -1500,9 +1484,7 @@ int in_egroup_p(gid_t grp)
 {
        int retval = 1;
        if (grp != current->egid) {
-               get_group_info(current->group_info);
                retval = groups_search(current->group_info, grp);
-               put_group_info(current->group_info);
        }
        return retval;
 }
index 8045391..e00a97b 100644 (file)
@@ -202,24 +202,6 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv,
        return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
 }
 
-long pps_offset;               /* pps time offset (us) */
-long pps_jitter = MAXTIME;     /* time dispersion (jitter) (us) */
-
-long pps_freq;                 /* frequency offset (scaled ppm) */
-long pps_stabil = MAXFREQ;     /* frequency dispersion (scaled ppm) */
-
-long pps_valid = PPS_VALID;    /* pps signal watchdog counter */
-
-int pps_shift = PPS_SHIFT;     /* interval duration (s) (shift) */
-
-long pps_jitcnt;               /* jitter limit exceeded */
-long pps_calcnt;               /* calibration intervals */
-long pps_errcnt;               /* calibration errors */
-long pps_stbcnt;               /* stability limit exceeded */
-
-/* hook for a loadable hardpps kernel module */
-void (*hardpps_ptr)(struct timeval *);
-
 /* we call this to notify the arch when the clock is being
  * controlled.  If no such arch routine, do nothing.
  */
@@ -279,7 +261,7 @@ int do_adjtimex(struct timex *txc)
                    result = -EINVAL;
                    goto leave;
                }
-               time_freq = txc->freq - pps_freq;
+               time_freq = txc->freq;
            }
 
            if (txc->modes & ADJ_MAXERROR) {
@@ -312,10 +294,8 @@ int do_adjtimex(struct timex *txc)
                    if ((time_next_adjust = txc->offset) == 0)
                         time_adjust = 0;
                }
-               else if ( time_status & (STA_PLL | STA_PPSTIME) ) {
-                   ltemp = (time_status & (STA_PPSTIME | STA_PPSSIGNAL)) ==
-                           (STA_PPSTIME | STA_PPSSIGNAL) ?
-                           pps_offset : txc->offset;
+               else if (time_status & STA_PLL) {
+                   ltemp = txc->offset;
 
                    /*
                     * Scale the phase adjustment and
@@ -356,23 +336,14 @@ int do_adjtimex(struct timex *txc)
                    }
                    time_freq = min(time_freq, time_tolerance);
                    time_freq = max(time_freq, -time_tolerance);
-               } /* STA_PLL || STA_PPSTIME */
+               } /* STA_PLL */
            } /* txc->modes & ADJ_OFFSET */
            if (txc->modes & ADJ_TICK) {
                tick_usec = txc->tick;
                tick_nsec = TICK_USEC_TO_NSEC(tick_usec);
            }
        } /* txc->modes */
-leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0
-           || ((time_status & (STA_PPSFREQ|STA_PPSTIME)) != 0
-               && (time_status & STA_PPSSIGNAL) == 0)
-           /* p. 24, (b) */
-           || ((time_status & (STA_PPSTIME|STA_PPSJITTER))
-               == (STA_PPSTIME|STA_PPSJITTER))
-           /* p. 24, (c) */
-           || ((time_status & STA_PPSFREQ) != 0
-               && (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0))
-           /* p. 24, (d) */
+leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
                result = TIME_ERROR;
        
        if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
@@ -380,7 +351,7 @@ leave:      if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0
        else {
            txc->offset = shift_right(time_offset, SHIFT_UPDATE);
        }
-       txc->freq          = time_freq + pps_freq;
+       txc->freq          = time_freq;
        txc->maxerror      = time_maxerror;
        txc->esterror      = time_esterror;
        txc->status        = time_status;
@@ -388,14 +359,16 @@ leave:    if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0
        txc->precision     = time_precision;
        txc->tolerance     = time_tolerance;
        txc->tick          = tick_usec;
-       txc->ppsfreq       = pps_freq;
-       txc->jitter        = pps_jitter >> PPS_AVG;
-       txc->shift         = pps_shift;
-       txc->stabil        = pps_stabil;
-       txc->jitcnt        = pps_jitcnt;
-       txc->calcnt        = pps_calcnt;
-       txc->errcnt        = pps_errcnt;
-       txc->stbcnt        = pps_stbcnt;
+
+       /* PPS is not implemented, so these are zero */
+       txc->ppsfreq       = 0;
+       txc->jitter        = 0;
+       txc->shift         = 0;
+       txc->stabil        = 0;
+       txc->jitcnt        = 0;
+       txc->calcnt        = 0;
+       txc->errcnt        = 0;
+       txc->stbcnt        = 0;
        write_sequnlock_irq(&xtime_lock);
        do_gettimeofday(&txc->time);
        notify_arch_cmos_timer();
index 17d956c..ab189dd 100644 (file)
@@ -697,18 +697,9 @@ static void second_overflow(void)
 
        /*
         * Compute the frequency estimate and additional phase adjustment due
-        * to frequency error for the next second. When the PPS signal is
-        * engaged, gnaw on the watchdog counter and update the frequency
-        * computed by the pll and the PPS signal.
+        * to frequency error for the next second.
         */
-       pps_valid++;
-       if (pps_valid == PPS_VALID) {   /* PPS signal lost */
-               pps_jitter = MAXTIME;
-               pps_stabil = MAXFREQ;
-               time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER |
-                               STA_PPSWANDER | STA_PPSERROR);
-       }
-       ltemp = time_freq + pps_freq;
+       ltemp = time_freq;
        time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE));
 
 #if HZ == 100
@@ -956,19 +947,7 @@ void do_timer(struct pt_regs *regs)
  */
 asmlinkage unsigned long sys_alarm(unsigned int seconds)
 {
-       struct itimerval it_new, it_old;
-       unsigned int oldalarm;
-
-       it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
-       it_new.it_value.tv_sec = seconds;
-       it_new.it_value.tv_usec = 0;
-       do_setitimer(ITIMER_REAL, &it_new, &it_old);
-       oldalarm = it_old.it_value.tv_sec;
-       /* ehhh.. We can't return 0 if we have an alarm pending.. */
-       /* And we'd better return too much than too little anyway */
-       if ((!oldalarm && it_old.it_value.tv_usec) || it_old.it_value.tv_usec >= 500000)
-               oldalarm++;
-       return oldalarm;
+       return alarm_setitimer(seconds);
 }
 
 #endif
index f2618e1..0bda3c5 100644 (file)
@@ -78,13 +78,17 @@ config SCHEDSTATS
          this adds.
 
 config DEBUG_SLAB
-       bool "Debug memory allocations"
+       bool "Debug slab memory allocations"
        depends on DEBUG_KERNEL && SLAB
        help
          Say Y here to have the kernel do limited verification on memory
          allocation as well as poisoning memory on free to catch use of freed
          memory. This can make kmalloc/kfree-intensive workloads much slower.
 
+config DEBUG_SLAB_LEAK
+       bool "Memory leak debugging"
+       depends on DEBUG_SLAB
+
 config DEBUG_PREEMPT
        bool "Debug preemptible kernel"
        depends on DEBUG_KERNEL && PREEMPT
index 648b2c1..f827e3c 100644 (file)
@@ -7,6 +7,8 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
         idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
         sha1.o
 
+lib-$(CONFIG_SMP) += cpumask.o
+
 lib-y  += kobject.o kref.o kobject_uevent.o klist.o
 
 obj-y += sort.o parser.o halfmd4.o iomap_copy.o
diff --git a/lib/cpumask.c b/lib/cpumask.c
new file mode 100644 (file)
index 0000000..3a67dc5
--- /dev/null
@@ -0,0 +1,45 @@
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/cpumask.h>
+#include <linux/module.h>
+
+int __first_cpu(const cpumask_t *srcp)
+{
+       return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
+}
+EXPORT_SYMBOL(__first_cpu);
+
+int __next_cpu(int n, const cpumask_t *srcp)
+{
+       return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
+}
+EXPORT_SYMBOL(__next_cpu);
+
+/*
+ * Find the highest possible smp_processor_id()
+ *
+ * Note: if we're prepared to assume that cpu_possible_map never changes
+ * (reasonable) then this function should cache its return value.
+ */
+int highest_possible_processor_id(void)
+{
+       unsigned int cpu;
+       unsigned highest = 0;
+
+       for_each_cpu_mask(cpu, cpu_possible_map)
+               highest = cpu;
+       return highest;
+}
+EXPORT_SYMBOL(highest_possible_processor_id);
+
+int __any_online_cpu(const cpumask_t *mask)
+{
+       int cpu;
+
+       for_each_cpu_mask(cpu, *mask) {
+               if (cpu_online(cpu))
+                       break;
+       }
+       return cpu;
+}
+EXPORT_SYMBOL(__any_online_cpu);
index 1e5b17d..7097bb2 100644 (file)
@@ -37,7 +37,6 @@
 #else
 #define RADIX_TREE_MAP_SHIFT   3       /* For more stressful testing */
 #endif
-#define RADIX_TREE_TAGS                2
 
 #define RADIX_TREE_MAP_SIZE    (1UL << RADIX_TREE_MAP_SHIFT)
 #define RADIX_TREE_MAP_MASK    (RADIX_TREE_MAP_SIZE-1)
@@ -48,7 +47,7 @@
 struct radix_tree_node {
        unsigned int    count;
        void            *slots[RADIX_TREE_MAP_SIZE];
-       unsigned long   tags[RADIX_TREE_TAGS][RADIX_TREE_TAG_LONGS];
+       unsigned long   tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS];
 };
 
 struct radix_tree_path {
@@ -135,17 +134,20 @@ out:
        return ret;
 }
 
-static inline void tag_set(struct radix_tree_node *node, int tag, int offset)
+static inline void tag_set(struct radix_tree_node *node, unsigned int tag,
+               int offset)
 {
        __set_bit(offset, node->tags[tag]);
 }
 
-static inline void tag_clear(struct radix_tree_node *node, int tag, int offset)
+static inline void tag_clear(struct radix_tree_node *node, unsigned int tag,
+               int offset)
 {
        __clear_bit(offset, node->tags[tag]);
 }
 
-static inline int tag_get(struct radix_tree_node *node, int tag, int offset)
+static inline int tag_get(struct radix_tree_node *node, unsigned int tag,
+               int offset)
 {
        return test_bit(offset, node->tags[tag]);
 }
@@ -154,7 +156,7 @@ static inline int tag_get(struct radix_tree_node *node, int tag, int offset)
  * Returns 1 if any slot in the node has this tag set.
  * Otherwise returns 0.
  */
-static inline int any_tag_set(struct radix_tree_node *node, int tag)
+static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
 {
        int idx;
        for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
@@ -180,7 +182,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index)
 {
        struct radix_tree_node *node;
        unsigned int height;
-       char tags[RADIX_TREE_TAGS];
+       char tags[RADIX_TREE_MAX_TAGS];
        int tag;
 
        /* Figure out what the height should be.  */
@@ -197,7 +199,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index)
         * Prepare the tag status of the top-level node for propagation
         * into the newly-pushed top-level node(s)
         */
-       for (tag = 0; tag < RADIX_TREE_TAGS; tag++) {
+       for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
                tags[tag] = 0;
                if (any_tag_set(root->rnode, tag))
                        tags[tag] = 1;
@@ -211,7 +213,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index)
                node->slots[0] = root->rnode;
 
                /* Propagate the aggregated tag info into the new root */
-               for (tag = 0; tag < RADIX_TREE_TAGS; tag++) {
+               for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
                        if (tags[tag])
                                tag_set(node, tag, 0);
                }
@@ -349,14 +351,15 @@ EXPORT_SYMBOL(radix_tree_lookup);
  *     @index:         index key
  *     @tag:           tag index
  *
- *     Set the search tag corresponging to @index in the radix tree.  From
+ *     Set the search tag (which must be < RADIX_TREE_MAX_TAGS)
+ *     corresponding to @index in the radix tree.  From
  *     the root all the way down to the leaf node.
  *
  *     Returns the address of the tagged item.   Setting a tag on a not-present
  *     item is a bug.
  */
 void *radix_tree_tag_set(struct radix_tree_root *root,
-                       unsigned long index, int tag)
+                       unsigned long index, unsigned int tag)
 {
        unsigned int height, shift;
        struct radix_tree_node *slot;
@@ -390,7 +393,8 @@ EXPORT_SYMBOL(radix_tree_tag_set);
  *     @index:         index key
  *     @tag:           tag index
  *
- *     Clear the search tag corresponging to @index in the radix tree.  If
+ *     Clear the search tag (which must be < RADIX_TREE_MAX_TAGS)
+ *     corresponding to @index in the radix tree.  If
  *     this causes the leaf node to have no tags set then clear the tag in the
  *     next-to-leaf node, etc.
  *
@@ -398,7 +402,7 @@ EXPORT_SYMBOL(radix_tree_tag_set);
  *     has the same return value and semantics as radix_tree_lookup().
  */
 void *radix_tree_tag_clear(struct radix_tree_root *root,
-                       unsigned long index, int tag)
+                       unsigned long index, unsigned int tag)
 {
        struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path;
        struct radix_tree_node *slot;
@@ -450,7 +454,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear);
  * radix_tree_tag_get - get a tag on a radix tree node
  * @root:              radix tree root
  * @index:             index key
- * @tag:               tag index
+ * @tag:               tag index (< RADIX_TREE_MAX_TAGS)
  *
  * Return values:
  *
@@ -459,7 +463,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear);
  * -1: tag present, unset
  */
 int radix_tree_tag_get(struct radix_tree_root *root,
-                       unsigned long index, int tag)
+                       unsigned long index, unsigned int tag)
 {
        unsigned int height, shift;
        struct radix_tree_node *slot;
@@ -592,7 +596,7 @@ EXPORT_SYMBOL(radix_tree_gang_lookup);
  */
 static unsigned int
 __lookup_tag(struct radix_tree_root *root, void **results, unsigned long index,
-       unsigned int max_items, unsigned long *next_index, int tag)
+       unsigned int max_items, unsigned long *next_index, unsigned int tag)
 {
        unsigned int nr_found = 0;
        unsigned int shift;
@@ -646,7 +650,7 @@ out:
  *     @results:       where the results of the lookup are placed
  *     @first_index:   start the lookup from this key
  *     @max_items:     place up to this many items at *results
- *     @tag:           the tag index
+ *     @tag:           the tag index (< RADIX_TREE_MAX_TAGS)
  *
  *     Performs an index-ascending scan of the tree for present items which
  *     have the tag indexed by @tag set.  Places the items at *@results and
@@ -654,7 +658,8 @@ out:
  */
 unsigned int
 radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
-               unsigned long first_index, unsigned int max_items, int tag)
+               unsigned long first_index, unsigned int max_items,
+               unsigned int tag)
 {
        const unsigned long max_index = radix_tree_maxindex(root->height);
        unsigned long cur_index = first_index;
@@ -716,7 +721,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
        struct radix_tree_node *slot;
        unsigned int height, shift;
        void *ret = NULL;
-       char tags[RADIX_TREE_TAGS];
+       char tags[RADIX_TREE_MAX_TAGS];
        int nr_cleared_tags;
        int tag;
        int offset;
@@ -751,7 +756,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
         * Clear all tags associated with the just-deleted item
         */
        nr_cleared_tags = 0;
-       for (tag = 0; tag < RADIX_TREE_TAGS; tag++) {
+       for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
                tags[tag] = 1;
                if (tag_get(pathp->node, tag, pathp->offset)) {
                        tag_clear(pathp->node, tag, pathp->offset);
@@ -763,7 +768,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
        }
 
        for (pathp--; nr_cleared_tags && pathp->node; pathp--) {
-               for (tag = 0; tag < RADIX_TREE_TAGS; tag++) {
+               for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
                        if (tags[tag])
                                continue;
 
@@ -801,7 +806,7 @@ EXPORT_SYMBOL(radix_tree_delete);
  *     @root:          radix tree root
  *     @tag:           tag to test
  */
-int radix_tree_tagged(struct radix_tree_root *root, int tag)
+int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag)
 {
        struct radix_tree_node *rnode;
        rnode = root->rnode;
index bd80460..332f5c2 100644 (file)
@@ -138,8 +138,8 @@ config SPLIT_PTLOCK_CPUS
 #
 config MIGRATION
        bool "Page migration"
-       def_bool y if NUMA || SPARSEMEM || DISCONTIGMEM
-       depends on SWAP
+       def_bool y if NUMA
+       depends on SWAP && NUMA
        help
          Allows the migration of the physical location of pages of processes
          while the virtual addresses are not changed. This is useful for
index 0eb9894..4f5b570 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1040,12 +1040,11 @@ munmap_back:
         * specific mapper. the address has already been validated, but
         * not unmapped, but the maps are removed from the list.
         */
-       vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
+       vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
        if (!vma) {
                error = -ENOMEM;
                goto unacct_error;
        }
-       memset(vma, 0, sizeof(*vma));
 
        vma->vm_mm = mm;
        vma->vm_start = addr;
@@ -1896,12 +1895,11 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
        /*
         * create a vma struct for an anonymous mapping
         */
-       vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
+       vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
        if (!vma) {
                vm_unacct_memory(len >> PAGE_SHIFT);
                return -ENOMEM;
        }
-       memset(vma, 0, sizeof(*vma));
 
        vma->vm_mm = mm;
        vma->vm_start = addr;
index a5c3f8b..338a02b 100644 (file)
@@ -2029,8 +2029,9 @@ static __meminit void zone_pcp_init(struct zone *zone)
                setup_pageset(zone_pcp(zone,cpu), batch);
 #endif
        }
-       printk(KERN_DEBUG "  %s zone: %lu pages, LIFO batch:%lu\n",
-               zone->name, zone->present_pages, batch);
+       if (zone->present_pages)
+               printk(KERN_DEBUG "  %s zone: %lu pages, LIFO batch:%lu\n",
+                       zone->name, zone->present_pages, batch);
 }
 
 static __meminit void init_currently_empty_zone(struct zone *zone,
@@ -2701,8 +2702,7 @@ void *__init alloc_large_system_hash(const char *tablename,
                else
                        numentries <<= (PAGE_SHIFT - scale);
        }
-       /* rounded up to nearest power of 2 in size */
-       numentries = 1UL << (long_log2(numentries) + 1);
+       numentries = roundup_pow_of_two(numentries);
 
        /* limit allocation size to 1/16 total memory by default */
        if (max == 0) {
index 26138c9..6818374 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
 typedef unsigned int kmem_bufctl_t;
 #define BUFCTL_END     (((kmem_bufctl_t)(~0U))-0)
 #define BUFCTL_FREE    (((kmem_bufctl_t)(~0U))-1)
-#define        SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-2)
+#define        BUFCTL_ACTIVE   (((kmem_bufctl_t)(~0U))-2)
+#define        SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-3)
 
 /* Max number of objs-per-slab for caches which use off-slab slabs.
  * Needed to avoid a possible looping condition in cache_grow().
@@ -897,6 +898,30 @@ static struct array_cache *alloc_arraycache(int node, int entries,
        return nc;
 }
 
+/*
+ * Transfer objects in one arraycache to another.
+ * Locking must be handled by the caller.
+ *
+ * Return the number of entries transferred.
+ */
+static int transfer_objects(struct array_cache *to,
+               struct array_cache *from, unsigned int max)
+{
+       /* Figure out how many entries to transfer */
+       int nr = min(min(from->avail, max), to->limit - to->avail);
+
+       if (!nr)
+               return 0;
+
+       memcpy(to->entry + to->avail, from->entry + from->avail -nr,
+                       sizeof(void *) *nr);
+
+       from->avail -= nr;
+       to->avail += nr;
+       to->touched = 1;
+       return nr;
+}
+
 #ifdef CONFIG_NUMA
 static void *__cache_alloc_node(struct kmem_cache *, gfp_t, int);
 static void *alternate_node_alloc(struct kmem_cache *, gfp_t);
@@ -946,6 +971,13 @@ static void __drain_alien_cache(struct kmem_cache *cachep,
 
        if (ac->avail) {
                spin_lock(&rl3->list_lock);
+               /*
+                * Stuff objects into the remote nodes shared array first.
+                * That way we could avoid the overhead of putting the objects
+                * into the free lists and getting them back later.
+                */
+               transfer_objects(rl3->shared, ac, ac->limit);
+
                free_block(cachep, ac->entry, ac->avail, node);
                ac->avail = 0;
                spin_unlock(&rl3->list_lock);
@@ -961,8 +993,8 @@ static void reap_alien(struct kmem_cache *cachep, struct kmem_list3 *l3)
 
        if (l3->alien) {
                struct array_cache *ac = l3->alien[node];
-               if (ac && ac->avail) {
-                       spin_lock_irq(&ac->lock);
+
+               if (ac && ac->avail && spin_trylock_irq(&ac->lock)) {
                        __drain_alien_cache(cachep, ac, node);
                        spin_unlock_irq(&ac->lock);
                }
@@ -1989,10 +2021,9 @@ kmem_cache_create (const char *name, size_t size, size_t align,
        align = ralign;
 
        /* Get cache's description obj. */
-       cachep = kmem_cache_alloc(&cache_cache, SLAB_KERNEL);
+       cachep = kmem_cache_zalloc(&cache_cache, SLAB_KERNEL);
        if (!cachep)
                goto oops;
-       memset(cachep, 0, sizeof(struct kmem_cache));
 
 #if DEBUG
        cachep->obj_size = size;
@@ -2399,7 +2430,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp,
        /* Verify that the slab belongs to the intended node */
        WARN_ON(slabp->nodeid != nodeid);
 
-       if (slab_bufctl(slabp)[objnr] != BUFCTL_FREE) {
+       if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) {
                printk(KERN_ERR "slab: double free detected in cache "
                                "'%s', objp %p\n", cachep->name, objp);
                BUG();
@@ -2605,6 +2636,9 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
                 */
                cachep->dtor(objp + obj_offset(cachep), cachep, 0);
        }
+#ifdef CONFIG_DEBUG_SLAB_LEAK
+       slab_bufctl(slabp)[objnr] = BUFCTL_FREE;
+#endif
        if (cachep->flags & SLAB_POISON) {
 #ifdef CONFIG_DEBUG_PAGEALLOC
                if ((cachep->buffer_size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) {
@@ -2677,20 +2711,10 @@ retry:
        BUG_ON(ac->avail > 0 || !l3);
        spin_lock(&l3->list_lock);
 
-       if (l3->shared) {
-               struct array_cache *shared_array = l3->shared;
-               if (shared_array->avail) {
-                       if (batchcount > shared_array->avail)
-                               batchcount = shared_array->avail;
-                       shared_array->avail -= batchcount;
-                       ac->avail = batchcount;
-                       memcpy(ac->entry,
-                              &(shared_array->entry[shared_array->avail]),
-                              sizeof(void *) * batchcount);
-                       shared_array->touched = 1;
-                       goto alloc_done;
-               }
-       }
+       /* See if we can refill from the shared array */
+       if (l3->shared && transfer_objects(ac, l3->shared, batchcount))
+               goto alloc_done;
+
        while (batchcount > 0) {
                struct list_head *entry;
                struct slab *slabp;
@@ -2788,6 +2812,16 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
                *dbg_redzone1(cachep, objp) = RED_ACTIVE;
                *dbg_redzone2(cachep, objp) = RED_ACTIVE;
        }
+#ifdef CONFIG_DEBUG_SLAB_LEAK
+       {
+               struct slab *slabp;
+               unsigned objnr;
+
+               slabp = page_get_slab(virt_to_page(objp));
+               objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size;
+               slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE;
+       }
+#endif
        objp += obj_offset(cachep);
        if (cachep->ctor && cachep->flags & SLAB_POISON) {
                unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR;
@@ -3093,6 +3127,23 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
 }
 EXPORT_SYMBOL(kmem_cache_alloc);
 
+/**
+ * kmem_cache_alloc - Allocate an object. The memory is set to zero.
+ * @cache: The cache to allocate from.
+ * @flags: See kmalloc().
+ *
+ * Allocate an object from this cache and set the allocated memory to zero.
+ * The flags are only relevant if the cache has no available objects.
+ */
+void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags)
+{
+       void *ret = __cache_alloc(cache, flags, __builtin_return_address(0));
+       if (ret)
+               memset(ret, 0, obj_size(cache));
+       return ret;
+}
+EXPORT_SYMBOL(kmem_cache_zalloc);
+
 /**
  * kmem_ptr_validate - check if an untrusted pointer might
  *     be a slab entry.
@@ -3220,22 +3271,23 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
        return __cache_alloc(cachep, flags, caller);
 }
 
-#ifndef CONFIG_DEBUG_SLAB
 
 void *__kmalloc(size_t size, gfp_t flags)
 {
+#ifndef CONFIG_DEBUG_SLAB
        return __do_kmalloc(size, flags, NULL);
+#else
+       return __do_kmalloc(size, flags, __builtin_return_address(0));
+#endif
 }
 EXPORT_SYMBOL(__kmalloc);
 
-#else
-
+#ifdef CONFIG_DEBUG_SLAB
 void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller)
 {
        return __do_kmalloc(size, flags, caller);
 }
 EXPORT_SYMBOL(__kmalloc_track_caller);
-
 #endif
 
 #ifdef CONFIG_SMP
@@ -3366,63 +3418,86 @@ const char *kmem_cache_name(struct kmem_cache *cachep)
 EXPORT_SYMBOL_GPL(kmem_cache_name);
 
 /*
- * This initializes kmem_list3 for all nodes.
+ * This initializes kmem_list3 or resizes varioius caches for all nodes.
  */
 static int alloc_kmemlist(struct kmem_cache *cachep)
 {
        int node;
        struct kmem_list3 *l3;
-       int err = 0;
+       struct array_cache *new_shared;
+       struct array_cache **new_alien;
 
        for_each_online_node(node) {
-               struct array_cache *nc = NULL, *new;
-               struct array_cache **new_alien = NULL;
-#ifdef CONFIG_NUMA
+
                new_alien = alloc_alien_cache(node, cachep->limit);
                if (!new_alien)
                        goto fail;
-#endif
-               new = alloc_arraycache(node, cachep->shared*cachep->batchcount,
+
+               new_shared = alloc_arraycache(node,
+                               cachep->shared*cachep->batchcount,
                                        0xbaadf00d);
-               if (!new)
+               if (!new_shared) {
+                       free_alien_cache(new_alien);
                        goto fail;
+               }
+
                l3 = cachep->nodelists[node];
                if (l3) {
+                       struct array_cache *shared = l3->shared;
+
                        spin_lock_irq(&l3->list_lock);
 
-                       nc = cachep->nodelists[node]->shared;
-                       if (nc)
-                               free_block(cachep, nc->entry, nc->avail, node);
+                       if (shared)
+                               free_block(cachep, shared->entry,
+                                               shared->avail, node);
 
-                       l3->shared = new;
-                       if (!cachep->nodelists[node]->alien) {
+                       l3->shared = new_shared;
+                       if (!l3->alien) {
                                l3->alien = new_alien;
                                new_alien = NULL;
                        }
                        l3->free_limit = (1 + nr_cpus_node(node)) *
                                        cachep->batchcount + cachep->num;
                        spin_unlock_irq(&l3->list_lock);
-                       kfree(nc);
+                       kfree(shared);
                        free_alien_cache(new_alien);
                        continue;
                }
                l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node);
-               if (!l3)
+               if (!l3) {
+                       free_alien_cache(new_alien);
+                       kfree(new_shared);
                        goto fail;
+               }
 
                kmem_list3_init(l3);
                l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
                                ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
-               l3->shared = new;
+               l3->shared = new_shared;
                l3->alien = new_alien;
                l3->free_limit = (1 + nr_cpus_node(node)) *
                                        cachep->batchcount + cachep->num;
                cachep->nodelists[node] = l3;
        }
-       return err;
+       return 0;
+
 fail:
-       err = -ENOMEM;
-       return err;
+       if (!cachep->next.next) {
+               /* Cache is not active yet. Roll back what we did */
+               node--;
+               while (node >= 0) {
+                       if (cachep->nodelists[node]) {
+                               l3 = cachep->nodelists[node];
+
+                               kfree(l3->shared);
+                               free_alien_cache(l3->alien);
+                               kfree(l3);
+                               cachep->nodelists[node] = NULL;
+                       }
+                       node--;
+               }
+       }
+       return -ENOMEM;
 }
 
 struct ccupdate_struct {
@@ -3899,6 +3974,159 @@ ssize_t slabinfo_write(struct file *file, const char __user * buffer,
                res = count;
        return res;
 }
+
+#ifdef CONFIG_DEBUG_SLAB_LEAK
+
+static void *leaks_start(struct seq_file *m, loff_t *pos)
+{
+       loff_t n = *pos;
+       struct list_head *p;
+
+       mutex_lock(&cache_chain_mutex);
+       p = cache_chain.next;
+       while (n--) {
+               p = p->next;
+               if (p == &cache_chain)
+                       return NULL;
+       }
+       return list_entry(p, struct kmem_cache, next);
+}
+
+static inline int add_caller(unsigned long *n, unsigned long v)
+{
+       unsigned long *p;
+       int l;
+       if (!v)
+               return 1;
+       l = n[1];
+       p = n + 2;
+       while (l) {
+               int i = l/2;
+               unsigned long *q = p + 2 * i;
+               if (*q == v) {
+                       q[1]++;
+                       return 1;
+               }
+               if (*q > v) {
+                       l = i;
+               } else {
+                       p = q + 2;
+                       l -= i + 1;
+               }
+       }
+       if (++n[1] == n[0])
+               return 0;
+       memmove(p + 2, p, n[1] * 2 * sizeof(unsigned long) - ((void *)p - (void *)n));
+       p[0] = v;
+       p[1] = 1;
+       return 1;
+}
+
+static void handle_slab(unsigned long *n, struct kmem_cache *c, struct slab *s)
+{
+       void *p;
+       int i;
+       if (n[0] == n[1])
+               return;
+       for (i = 0, p = s->s_mem; i < c->num; i++, p += c->buffer_size) {
+               if (slab_bufctl(s)[i] != BUFCTL_ACTIVE)
+                       continue;
+               if (!add_caller(n, (unsigned long)*dbg_userword(c, p)))
+                       return;
+       }
+}
+
+static void show_symbol(struct seq_file *m, unsigned long address)
+{
+#ifdef CONFIG_KALLSYMS
+       char *modname;
+       const char *name;
+       unsigned long offset, size;
+       char namebuf[KSYM_NAME_LEN+1];
+
+       name = kallsyms_lookup(address, &size, &offset, &modname, namebuf);
+
+       if (name) {
+               seq_printf(m, "%s+%#lx/%#lx", name, offset, size);
+               if (modname)
+                       seq_printf(m, " [%s]", modname);
+               return;
+       }
+#endif
+       seq_printf(m, "%p", (void *)address);
+}
+
+static int leaks_show(struct seq_file *m, void *p)
+{
+       struct kmem_cache *cachep = p;
+       struct list_head *q;
+       struct slab *slabp;
+       struct kmem_list3 *l3;
+       const char *name;
+       unsigned long *n = m->private;
+       int node;
+       int i;
+
+       if (!(cachep->flags & SLAB_STORE_USER))
+               return 0;
+       if (!(cachep->flags & SLAB_RED_ZONE))
+               return 0;
+
+       /* OK, we can do it */
+
+       n[1] = 0;
+
+       for_each_online_node(node) {
+               l3 = cachep->nodelists[node];
+               if (!l3)
+                       continue;
+
+               check_irq_on();
+               spin_lock_irq(&l3->list_lock);
+
+               list_for_each(q, &l3->slabs_full) {
+                       slabp = list_entry(q, struct slab, list);
+                       handle_slab(n, cachep, slabp);
+               }
+               list_for_each(q, &l3->slabs_partial) {
+                       slabp = list_entry(q, struct slab, list);
+                       handle_slab(n, cachep, slabp);
+               }
+               spin_unlock_irq(&l3->list_lock);
+       }
+       name = cachep->name;
+       if (n[0] == n[1]) {
+               /* Increase the buffer size */
+               mutex_unlock(&cache_chain_mutex);
+               m->private = kzalloc(n[0] * 4 * sizeof(unsigned long), GFP_KERNEL);
+               if (!m->private) {
+                       /* Too bad, we are really out */
+                       m->private = n;
+                       mutex_lock(&cache_chain_mutex);
+                       return -ENOMEM;
+               }
+               *(unsigned long *)m->private = n[0] * 2;
+               kfree(n);
+               mutex_lock(&cache_chain_mutex);
+               /* Now make sure this entry will be retried */
+               m->count = m->size;
+               return 0;
+       }
+       for (i = 0; i < n[1]; i++) {
+               seq_printf(m, "%s: %lu ", name, n[2*i+3]);
+               show_symbol(m, n[2*i+2]);
+               seq_putc(m, '\n');
+       }
+       return 0;
+}
+
+struct seq_operations slabstats_op = {
+       .start = leaks_start,
+       .next = s_next,
+       .stop = s_stop,
+       .show = leaks_show,
+};
+#endif
 #endif
 
 /**
index a1f42bd..9bcc7e2 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -294,6 +294,16 @@ void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags)
 }
 EXPORT_SYMBOL(kmem_cache_alloc);
 
+void *kmem_cache_zalloc(struct kmem_cache *c, gfp_t flags)
+{
+       void *ret = kmem_cache_alloc(c, flags);
+       if (ret)
+               memset(ret, 0, c->size);
+
+       return ret;
+}
+EXPORT_SYMBOL(kmem_cache_zalloc);
+
 void kmem_cache_free(struct kmem_cache *c, void *b)
 {
        if (c->dtor)
index 49e29f7..7368479 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -5,18 +5,18 @@
 #include <asm/uaccess.h>
 
 /**
- * kzalloc - allocate memory. The memory is set to zero.
+ * __kzalloc - allocate memory. The memory is set to zero.
  * @size: how many bytes of memory are required.
  * @flags: the type of memory to allocate.
  */
-void *kzalloc(size_t size, gfp_t flags)
+void *__kzalloc(size_t size, gfp_t flags)
 {
-       void *ret = kmalloc(size, flags);
+       void *ret = ____kmalloc(size, flags);
        if (ret)
                memset(ret, 0, size);
        return ret;
 }
-EXPORT_SYMBOL(kzalloc);
+EXPORT_SYMBOL(__kzalloc);
 
 /*
  * kstrdup - allocate space for and copy an existing string
@@ -33,7 +33,7 @@ char *kstrdup(const char *s, gfp_t gfp)
                return NULL;
 
        len = strlen(s) + 1;
-       buf = kmalloc(len, gfp);
+       buf = ____kmalloc(len, gfp);
        if (buf)
                memcpy(buf, s, len);
        return buf;
index fd572bb..78865c8 100644 (file)
@@ -1356,7 +1356,9 @@ static int __init kswapd_init(void)
 
                pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL);
                BUG_ON(pid < 0);
+               read_lock(&tasklist_lock);
                pgdat->kswapd = find_task_by_pid(pid);
+               read_unlock(&tasklist_lock);
        }
        total_memory = nr_free_pagecache_pages();
        hotcpu_notifier(cpu_callback, 0);
index fb031fe..469eda0 100644 (file)
@@ -238,6 +238,9 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w
        if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
                mask |= POLLERR;
 
+       if (sk->sk_shutdown & RCV_SHUTDOWN)
+               mask |= POLLRDHUP;
+
        if (sk->sk_shutdown == SHUTDOWN_MASK)
                mask |= POLLHUP;
 
index b8ce6bf..aecddcc 100644 (file)
@@ -500,6 +500,8 @@ unsigned int datagram_poll(struct file *file, struct socket *sock,
        /* exceptional events? */
        if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
                mask |= POLLERR;
+       if (sk->sk_shutdown & RCV_SHUTDOWN)
+               mask |= POLLRDHUP;
        if (sk->sk_shutdown == SHUTDOWN_MASK)
                mask |= POLLHUP;
 
index c9f8784..09464fa 100644 (file)
@@ -149,7 +149,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
 
        /* Get the DATA. Size must match skb_add_mtu(). */
        size = SKB_DATA_ALIGN(size);
-       data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
+       data = ____kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
        if (!data)
                goto nodata;
 
index d4b293e..1ff7328 100644 (file)
@@ -350,7 +350,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock,
        if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED)
                mask |= POLLHUP;
        if (sk->sk_shutdown & RCV_SHUTDOWN)
-               mask |= POLLIN | POLLRDNORM;
+               mask |= POLLIN | POLLRDNORM | POLLRDHUP;
 
        /* Connected? */
        if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) {
index 4b0272c..19ea5c0 100644 (file)
@@ -365,7 +365,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
        if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
                mask |= POLLHUP;
        if (sk->sk_shutdown & RCV_SHUTDOWN)
-               mask |= POLLIN | POLLRDNORM;
+               mask |= POLLIN | POLLRDNORM | POLLRDHUP;
 
        /* Connected? */
        if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) {
index 36fdcbc..48cbd06 100644 (file)
@@ -79,8 +79,8 @@ static int __init rxrpc_initialise(void)
  error_sysctl:
 #ifdef CONFIG_SYSCTL
        rxrpc_sysctl_cleanup();
-#endif
  error_proc:
+#endif
 #ifdef CONFIG_PROC_FS
        rxrpc_proc_cleanup();
 #endif
index 0ea947e..b6e4b89 100644 (file)
@@ -4894,6 +4894,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait)
        /* Is there any exceptional events?  */
        if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
                mask |= POLLERR;
+       if (sk->sk_shutdown & RCV_SHUTDOWN)
+               mask |= POLLRDHUP;
        if (sk->sk_shutdown == SHUTDOWN_MASK)
                mask |= POLLHUP;
 
index 2b4cc2e..d901465 100644 (file)
@@ -1878,6 +1878,8 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
                mask |= POLLERR;
        if (sk->sk_shutdown == SHUTDOWN_MASK)
                mask |= POLLHUP;
+       if (sk->sk_shutdown & RCV_SHUTDOWN)
+               mask |= POLLRDHUP;
 
        /* readable? */
        if (!skb_queue_empty(&sk->sk_receive_queue) ||
index d591578..22d281c 100644 (file)
@@ -124,6 +124,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
         * compressed together */
        s->len = strlen(str) + 1;
        s->sym = malloc(s->len + 1);
+       if (!s->sym) {
+               fprintf(stderr, "kallsyms failure: "
+                       "unable to allocate required amount of memory\n");
+               exit(EXIT_FAILURE);
+       }
        strcpy((char *)s->sym + 1, str);
        s->sym[0] = stype;
 
@@ -272,7 +277,12 @@ static void write_src(void)
 
        /* table of offset markers, that give the offset in the compressed stream
         * every 256 symbols */
-       markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+       markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+       if (!markers) {
+               fprintf(stderr, "kallsyms failure: "
+                       "unable to allocate required memory\n");
+               exit(EXIT_FAILURE);
+       }
 
        output_label("kallsyms_names");
        off = 0;
index 8a6e097..841eb4e 100644 (file)
@@ -60,8 +60,8 @@ int cap_settime(struct timespec *ts, struct timezone *tz)
 int cap_ptrace (struct task_struct *parent, struct task_struct *child)
 {
        /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */
-       if (!cap_issubset (child->cap_permitted, current->cap_permitted) &&
-           !capable(CAP_SYS_PTRACE))
+       if (!cap_issubset(child->cap_permitted, parent->cap_permitted) &&
+           !__capable(parent, CAP_SYS_PTRACE))
                return -EPERM;
        return 0;
 }
index 99781b7..a057e33 100644 (file)
@@ -1,6 +1,6 @@
 /* key.c: basic authentication token and access key management
  *
- * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  *
  * This program is free software; you can redistribute it and/or
@@ -271,7 +271,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
         * its description */
        if (!not_in_quota) {
                spin_lock(&user->lock);
-               if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS &&
+               if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS ||
                    user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES
                    )
                        goto no_quota;
@@ -795,12 +795,16 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
                goto error_3;
        }
 
-       /* search for an existing key of the same type and description in the
-        * destination keyring
+       /* if it's possible to update this type of key, search for an existing
+        * key of the same type and description in the destination keyring and
+        * update that instead if possible
         */
-       key_ref = __keyring_search_one(keyring_ref, ktype, description, 0);
-       if (!IS_ERR(key_ref))
-               goto found_matching_key;
+       if (ktype->update) {
+               key_ref = __keyring_search_one(keyring_ref, ktype, description,
+                                              0);
+               if (!IS_ERR(key_ref))
+                       goto found_matching_key;
+       }
 
        /* decide on the permissions we want */
        perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR;
index f693e1f..51ef509 100644 (file)
@@ -174,31 +174,8 @@ int mod_unreg_security(const char *name, struct security_operations *ops)
        return security_ops->unregister_security(name, ops);
 }
 
-/**
- * capable - calls the currently loaded security module's capable() function with the specified capability
- * @cap: the requested capability level.
- *
- * This function calls the currently loaded security module's capable()
- * function with a pointer to the current task and the specified @cap value.
- *
- * This allows the security module to implement the capable function call
- * however it chooses to.
- */
-int capable(int cap)
-{
-       if (security_ops->capable(current, cap)) {
-               /* capability denied */
-               return 0;
-       }
-
-       /* capability granted */
-       current->flags |= PF_SUPERPRIV;
-       return 1;
-}
-
 EXPORT_SYMBOL_GPL(register_security);
 EXPORT_SYMBOL_GPL(unregister_security);
 EXPORT_SYMBOL_GPL(mod_reg_security);
 EXPORT_SYMBOL_GPL(mod_unreg_security);
-EXPORT_SYMBOL(capable);
 EXPORT_SYMBOL(security_ops);
index fe54de2..eacb0ae 100644 (file)
 
 /* Boot options */
 static int      vra = 0;       // 0 = no VRA, 1 = use VRA if codec supports it
-MODULE_PARM(vra, "i");
+module_param(vra, bool, 0);
 MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it");
 
 
index 6a4956b..c1168fa 100644 (file)
@@ -79,7 +79,7 @@
  * 0 = no VRA, 1 = use VRA if codec supports it
  */
 static int      vra = 1;
-MODULE_PARM(vra, "i");
+module_param(vra, bool, 0);
 MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it");
 
 static struct au1550_state {
index b3ea719..d1a0eb2 100644 (file)
@@ -2944,7 +2944,7 @@ alloc_new_info(void)
 {
        awe_voice_list *newlist;
        
-       newlist = (awe_voice_list *)kmalloc(sizeof(*newlist), GFP_KERNEL);
+       newlist = kmalloc(sizeof(*newlist), GFP_KERNEL);
        if (newlist == NULL) {
                printk(KERN_ERR "AWE32: can't alloc info table\n");
                return NULL;
@@ -3547,8 +3547,10 @@ awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag)
        smp->checksum_flag = 0;
        smp->checksum = 0;
 
-       if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0)
+       if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) {
+               kfree(vrec);
                return rc;
+       }
        sf->mem_ptr += rc;
        add_sf_sample(sf, smprec);
 
index c9302a1..87bd310 100644 (file)
      */
 
 int dmasound_catchRadius = 0;
-MODULE_PARM(dmasound_catchRadius, "i");
+module_param(dmasound_catchRadius, int, 0);
 
 static unsigned int numWriteBufs = DEFAULT_N_BUFFERS;
-MODULE_PARM(numWriteBufs, "i");
+module_param(numWriteBufs, int, 0);
 static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */
-MODULE_PARM(writeBufSize, "i");
+module_param(writeBufSize, int, 0);
 
 #ifdef HAS_RECORD
 static unsigned int numReadBufs = DEFAULT_N_BUFFERS;
-MODULE_PARM(numReadBufs, "i");
+module_param(numReadBufs, int, 0);
 static unsigned int readBufSize = DEFAULT_BUFF_SIZE;   /* in bytes */
-MODULE_PARM(readBufSize, "i");
+module_param(readBufSize, int, 0);
 #endif
 
 MODULE_LICENSE("GPL");
index ffcb910..00ac1c9 100644 (file)
@@ -1968,9 +1968,9 @@ static int i2s_fmt[NR_DEVICE];
 
 static unsigned int devindex;
 
-MODULE_PARM(spdif, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(spdif, int, NULL, 0);
 MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled");
-MODULE_PARM(i2s_fmt, "1-" __MODULE_STRING(NR_DEVICE) "i");
+module_param_array(i2s_fmt, int, NULL, 0);
 MODULE_PARM_DESC(i2s_fmt, "the format of I2S");
 
 MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com");
index f56898c..ccb21d4 100644 (file)
@@ -273,14 +273,14 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right)
        int regoffs;
        unsigned char val;
 
+       if ((dev < 0) || (dev >= devc->iomap_sz))
+               return -EINVAL;
+
        regoffs = (*devc->iomap)[dev][LEFT_CHN].regno;
 
        if (regoffs == 0)
                return -EINVAL;
 
-       if ((dev < 0) || (dev >= devc->iomap_sz))
-           return -EINVAL;
-
        val = sb_getmixer(devc, regoffs);
        change_bits(devc, &val, dev, LEFT_CHN, left);
 
index 6986142..347cd79 100644 (file)
@@ -709,11 +709,11 @@ static void seq_local_event(unsigned char *event_rec)
 
 static void seq_sysex_message(unsigned char *event_rec)
 {
-       int dev = event_rec[1];
+       unsigned int dev = event_rec[1];
        int i, l = 0;
        unsigned char  *buf = &event_rec[2];
 
-       if ((int) dev > max_synthdev)
+       if (dev > max_synthdev)
                return;
        if (!(synth_open_mask & (1 << dev)))
                return;
index dce9016..eb5ea32 100644 (file)
@@ -154,8 +154,8 @@ static void start_adc(struct cs4297a_state *s);
 #if CSDEBUG
 static unsigned long cs_debuglevel = 4;        // levels range from 1-9
 static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/;
-MODULE_PARM(cs_debuglevel, "i");
-MODULE_PARM(cs_debugmask, "i");
+module_param(cs_debuglevel, int, 0);
+module_param(cs_debugmask, int, 0);
 #endif
 #define CS_TRUE        1
 #define CS_FALSE       0
index 99d04ad..afcb524 100644 (file)
@@ -2028,8 +2028,8 @@ __setup("waveartist=", setup_waveartist);
 #endif
 
 MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver");
-MODULE_PARM(io, "i");          /* IO base */
-MODULE_PARM(irq, "i");         /* IRQ */
-MODULE_PARM(dma, "i");         /* DMA */
-MODULE_PARM(dma2, "i");                /* DMA2 */
+module_param(io, int, 0);              /* IO base */
+module_param(irq, int, 0);             /* IRQ */
+module_param(dma, int, 0);             /* DMA */
+module_param(dma2, int, 0);            /* DMA2 */
 MODULE_LICENSE("GPL");