This patch moves PROC_BLOCK_SIZE definition to proc_fs.h so there is no
need to define it in every proc function which does boundary checking.
Feel free to convert any overlooked places to use PROC_BLOCK_SIZE...

--- linux-2.4.0-test8/drivers/scsi/scsi_proc.c  Sat Jan  8 01:58:37 2000
+++ linux/drivers/scsi/scsi_proc.c              Thu Sep 14 23:56:00 2000
@@ -87,10 +87,6 @@
        return n;
 }
 
-#define PROC_BLOCK_SIZE (3*1024)     /* 4K page size, but our output routines 
-                                     * use some slack for overruns 
-                                     */
-
 static int proc_scsi_write(struct file * file, const char * buf,
                            unsigned long count, void *data)
 {
@@ -98,7 +94,7 @@
        ssize_t ret = 0;
        char * page;
        char *start;
-    
+
        if (count > PROC_BLOCK_SIZE)
                return -EOVERFLOW;
 
--- linux-2.4.0-test8/drivers/sound/soundcard.c Sat Aug 26 00:10:02 2000
+++ linux/drivers/sound/soundcard.c             Thu Sep 14 23:53:33 2000
@@ -136,13 +136,6 @@
        return 0;
 }
 
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-/* 4K page size but our output routines use some slack for overruns */
-#define PROC_BLOCK_SIZE (3*1024)
-
 static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos)
 {
        int dev = MINOR(file->f_dentry->d_inode->i_rdev);
--- linux-2.4.0-test8/fs/proc/base.c    Sat Aug 26 00:10:09 2000
+++ linux/fs/proc/base.c                Thu Sep 14 23:51:52 2000
@@ -265,8 +265,6 @@
        read:           pid_maps_read,
 };
 
-#define PROC_BLOCK_SIZE        (3*1024)                /* 4K page size but our output 
routines use some slack for overruns */
-
 static ssize_t proc_info_read(struct file * file, char * buf,
                          size_t count, loff_t *ppos)
 {
--- linux-2.4.0-test8/fs/proc/generic.c Sat Aug 26 00:10:09 2000
+++ linux/fs/proc/generic.c             Thu Sep 14 23:49:56 2000
@@ -43,9 +43,6 @@
 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
 #endif
 
-/* 4K page size but our output routines use some slack for overruns */
-#define PROC_BLOCK_SIZE        (PAGE_SIZE - 1024)
-
 static ssize_t
 proc_file_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
 {
--- linux-2.4.0-test8/include/linux/proc_fs.h   Wed Sep 13 19:28:37 2000
+++ linux/include/linux/proc_fs.h               Thu Sep 14 23:59:51 2000
@@ -74,6 +74,9 @@
 
 #define PROC_INODE_PROPER(inode) ((inode)->i_ino & ~0xffff)
 
+/* 4K page size but our output routines use some slack for overruns */
+#define PROC_BLOCK_SIZE (PAGE_SIZE - 1024)
+
 #ifdef CONFIG_PROC_FS
 
 extern struct proc_dir_entry proc_root;


--
Bartlomiej Zolnierkiewicz
<[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to