patch-2.1.68 linux/drivers/char/pcwd.c

Next file: linux/drivers/char/videodev.c
Previous file: linux/drivers/char/n_tty.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.67/linux/drivers/char/pcwd.c linux/drivers/char/pcwd.c
@@ -29,6 +29,7 @@
  * 961118	Changed some verbiage on some of the output, tidied up
  *		code bits, and added compatibility to 2.1.x.
  * 970912       Enabled board on open and disable on close.
+ * 971107	Took account of recent VFS changes (broke read).
  */
 
 #include <linux/module.h>
@@ -222,7 +223,7 @@
 }
 
 static int pcwd_ioctl(struct inode *inode, struct file *file,
-	unsigned int cmd, unsigned long arg)
+		      unsigned int cmd, unsigned long arg)
 {
 	int i, cdat, rv;
 	static struct watchdog_info ident=
@@ -359,8 +360,13 @@
 	return 0;
 }
 
-static long pcwd_write(struct inode *inode, struct file *file, const char *buf, unsigned long len)
+static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
+			  loff_t *ppos)
 {
+	/*  Can't seek (pwrite) on this device  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
+
 	if (len)
 	{
 		pcwd_send_heartbeat();
@@ -381,11 +387,15 @@
 	return(0);
 }
 
-static ssize_t pcwd_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+static ssize_t pcwd_read(struct file *file, char *buf, size_t count,
+			 loff_t *ppos)
 {
 	unsigned short c = inb(current_readport);
 	unsigned char cp;
 
+	/*  Can't seek (pread) on this device  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
 	switch(MINOR(file->f_dentry->d_inode->i_rdev)) 
 	{
 		case TEMP_MINOR:
@@ -488,11 +498,16 @@
 	pcwd_read,	/* Read */
 	pcwd_write,	/* Write */
 	NULL,		/* Readdir */
-	NULL,		/* Select */
+	NULL,		/* Poll */
 	pcwd_ioctl,	/* IOctl */
 	NULL,		/* MMAP */
 	pcwd_open,	/* Open */
-	pcwd_close	/* Close */
+	pcwd_close,	/* Release */
+	NULL,		/* Fsync */
+	NULL,		/* Fasync */
+	NULL,		/* CheckMediaChange */
+	NULL,		/* Revalidate */
+	NULL,		/* Lock */
 };
 
 static struct miscdevice pcwd_miscdev = {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov