]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sparse: ftape
authorAlexander Viro <viro@www.linux.org.uk>
Fri, 30 Jul 2004 15:47:29 +0000 (08:47 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 30 Jul 2004 15:47:29 +0000 (08:47 -0700)
ftape got annotations and NULL noise removals.
Propagated the dependency on alpha/i386/amd64 to Kconfig (it's already
enforced by #error)

Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
drivers/char/Kconfig
drivers/char/ftape/compressor/lzrw3.c
drivers/char/ftape/compressor/zftape-compress.c
drivers/char/ftape/lowlevel/ftape-init.c
drivers/char/ftape/lowlevel/ftape-proc.c
drivers/char/ftape/zftape/zftape-ctl.c
drivers/char/ftape/zftape/zftape-ctl.h
drivers/char/ftape/zftape/zftape-init.c
drivers/char/ftape/zftape/zftape-init.h
drivers/char/ftape/zftape/zftape-read.c
drivers/char/ftape/zftape/zftape-read.h
drivers/char/ftape/zftape/zftape-write.c
drivers/char/ftape/zftape/zftape-write.h
include/linux/mtio.h

index 963986ae9aea1999f65be895ed12f7f7527c4316..60c50c2eb1af16b183caeacc128322b09aad4228 100644 (file)
@@ -867,7 +867,7 @@ menu "Ftape, the floppy tape device driver"
 
 config FTAPE
        tristate "Ftape (QIC-80/Travan) support"
-       depends on BROKEN_ON_SMP
+       depends on BROKEN_ON_SMP && (ALPHA || X86)
        ---help---
          If you have a tape drive that is connected to your floppy
          controller, say Y here.
index a45cd2ba5af3d31a58bb0c5916c4d9ae5b9cdff3..a032a0ee2a99a9d98158179c940a4e8ae9d0cf5d 100644 (file)
@@ -115,13 +115,14 @@ LOCAL void compress_decompress(UBYTE *,UBYTE *,LONG, UBYTE *, ULONG *);
 /* compress a block of memory, decompress a block of memory, or to identify   */
 /* itself. For more information, see the specification file "compress.h".     */
 
-EXPORT void lzrw3_compress(action,wrk_mem,src_adr,src_len,dst_adr,p_dst_len)
-UWORD     action;      /* Action to be performed.                             */
-UBYTE   *wrk_mem;      /* Address of working memory we can use.               */
-UBYTE   *src_adr;      /* Address of input data.                              */
-LONG     src_len;      /* Length  of input data.                              */
-UBYTE   *dst_adr;      /* Address to put output data.                         */
-void  *p_dst_len;      /* Address of longword for length of output data.      */
+EXPORT void lzrw3_compress(
+       UWORD     action,      /* Action to be performed.               */
+       UBYTE   *wrk_mem,       /* Address of working memory we can use.*/
+       UBYTE   *src_adr,       /* Address of input data.               */
+       LONG     src_len,       /* Length  of input data.               */
+       UBYTE   *dst_adr,       /* Address to put output data.          */
+       void  *p_dst_len        /* Address of longword for length of output data.*/
+)
 {
  switch (action)
    {
@@ -314,9 +315,7 @@ void  *p_dst_len;      /* Address of longword for length of output data.      */
    (((40543*(((*(PTR))<<8)^((*((PTR)+1))<<4)^(*((PTR)+2))))>>4) & 0xFFF)
 
 /******************************************************************************/
-                            
-LOCAL void compress_compress
-           (p_wrk_mem,p_src_first,src_len,p_dst_first,p_dst_len)
+
 /* Input  : Hand over the required amount of working memory in p_wrk_mem.     */
 /* Input  : Specify input block using p_src_first and src_len.                */
 /* Input  : Point p_dst_first to the start of the output zone (OZ).           */
@@ -326,11 +325,9 @@ LOCAL void compress_compress
 /* Output : Output block in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. May   */
 /* Output : write in OZ=Mem[p_dst_first..p_dst_first+src_len+MAX_CMP_GROUP-1].*/
 /* Output : Upon completion guaranteed *p_dst_len<=src_len+FLAG_BYTES.        */
-UBYTE *p_wrk_mem;
-UBYTE *p_src_first;
-ULONG  src_len;
-UBYTE *p_dst_first;
-LONG  *p_dst_len;
+LOCAL void compress_compress(UBYTE *p_wrk_mem,
+                            UBYTE *p_src_first, ULONG  src_len,
+                            UBYTE *p_dst_first, LONG  *p_dst_len)
 {
  /* p_src and p_dst step through the source and destination blocks.           */
  register UBYTE *p_src = p_src_first;
@@ -366,8 +363,8 @@ LONG  *p_dst_len;
  /* to the hash table entry corresponding to the second youngest literal.     */
  /* Note: p_h1=0=>p_h2=0 because zero values denote absence of a pending      */
  /* literal. The variables are initialized to zero meaning an empty "buffer". */
- UBYTE **p_h1=0;
- UBYTE **p_h2=0;
+ UBYTE **p_h1=NULL;
+ UBYTE **p_h2=NULL;
   
  /* To start, we write the flag bytes. Being optimistic, we set the flag to   */
  /* FLAG_COMPRESS. The remaining flag bytes are zeroed so as to keep the      */
@@ -488,9 +485,9 @@ LONG  *p_dst_len;
           /* upon the arrival of extra context bytes.                         */
           if (p_h1!=0)
             {
-             if (p_h2!=0)
-               {*p_h2=p_ziv-2; p_h2=0;}
-             *p_h1=p_ziv-1; p_h1=0;
+             if (p_h2)
+               {*p_h2=p_ziv-2; p_h2=NULL;}
+             *p_h1=p_ziv-1; p_h1=NULL;
             }
             
           /* In any case, we can update the hash table based on the current   */
@@ -564,8 +561,6 @@ LONG  *p_dst_len;
 
 /******************************************************************************/
 
-LOCAL void compress_decompress
-           (p_wrk_mem,p_src_first,src_len,p_dst_first,p_dst_len)
 /* Input  : Hand over the required amount of working memory in p_wrk_mem.     */
 /* Input  : Specify input block using p_src_first and src_len.                */
 /* Input  : Point p_dst_first to the start of the output zone.                */
@@ -576,11 +571,9 @@ LOCAL void compress_decompress
 /* Output : Length of output block written to *p_dst_len.                     */
 /* Output : Output block in Mem[p_dst_first..p_dst_first+*p_dst_len-1].       */
 /* Output : Writes only  in Mem[p_dst_first..p_dst_first+*p_dst_len-1].       */
-UBYTE *p_wrk_mem;
-UBYTE *p_src_first;
-LONG   src_len;
-UBYTE *p_dst_first;
-ULONG *p_dst_len;
+LOCAL void compress_decompress( UBYTE *p_wrk_mem,
+                               UBYTE *p_src_first, LONG   src_len,
+                               UBYTE *p_dst_first, ULONG *p_dst_len)
 {
  /* Byte pointers p_src and p_dst scan through the input and output blocks.   */
  register UBYTE *p_src = p_src_first+FLAG_BYTES;
index 430aa0db6b3df85ad530821b71b08b7fa96a908b..874627ab1e6283c070d0bf2674c6ff1894566dd6 100644 (file)
@@ -74,10 +74,10 @@ static unsigned int zftc_rd_compressed   = 0;
 /* forward */
 static int  zftc_write(int *write_cnt,
                       __u8 *dst_buf, const int seg_sz,
-                      const __u8 *src_buf, const int req_len,
+                      const __u8 __user *src_buf, const int req_len,
                       const zft_position *pos, const zft_volinfo *volume);
 static int  zftc_read(int *read_cnt,
-                     __u8  *dst_buf, const int to_do,
+                     __u8  __user *dst_buf, const int to_do,
                      const __u8 *src_buf, const int seg_sz,
                      const zft_position *pos, const zft_volinfo *volume);
 static int  zftc_seek(unsigned int new_block_pos, 
@@ -539,7 +539,7 @@ static int start_new_cseg(cmpr_info *cluster,
  */
 static int zftc_write(int *write_cnt,
                      __u8 *dst_buf, const int seg_sz,
-                     const __u8 *src_buf, const int req_len,
+                     const __u8 __user *src_buf, const int req_len,
                      const zft_position *pos, const zft_volinfo *volume)
 {
        int req_len_left = req_len;
@@ -656,7 +656,7 @@ static int zftc_write(int *write_cnt,
  * be set to 0 
  */
 static int zftc_read (int *read_cnt, 
-                     __u8  *dst_buf, const int to_do, 
+                     __u8  __user *dst_buf, const int to_do, 
                      const __u8 *src_buf, const int seg_sz, 
                      const zft_position *pos, const zft_volinfo *volume)
 {          
index 518e7042813213765362d6465d6825ee4e255755..17a7f0e0c148c445424091400e2293a024ea3811 100644 (file)
@@ -90,7 +90,7 @@ KERN_INFO "Compiled for Linux version %s\n", UTS_RELEASE);
        TRACE(ft_t_info, "ftape_init @ 0x%p", ftape_init);
        /*  Allocate the DMA buffers. They are deallocated at cleanup() time.
         */
-#if TESTING
+#ifdef TESTING
 #ifdef MODULE
        while (ftape_set_nr_buffers(CONFIG_FT_NR_BUFFERS) < 0) {
                ftape_sleep(FT_SECOND/20);
index 6b8844ff455c1fa232a202531095a85a291c66cd..1e27c908eeee35ba2d050a1dabb2421deec1ea49 100644 (file)
@@ -192,7 +192,7 @@ int ftape_read_proc(char *page, char **start, off_t off,
        ptr += get_history_info(ptr);
 
        len = strlen(page);
-       *start = 0;
+       *start = NULL;
        if (off+count >= len) {
                *eof = 1;
        } else {
index 93010ccaa85268deda503c50e6941ebc661c7b3a..6c7874e5c199ec32f5ae8297fb0e41d0d9cc2804 100644 (file)
@@ -1319,7 +1319,7 @@ ftmtcmd_error:
 
 /*  IOCTL routine called by kernel-interface code
  */
-int _zft_ioctl(unsigned int command, void * arg)
+int _zft_ioctl(unsigned int command, void __user * arg)
 {
        int result;
        union { struct mtop       mtop;
index 6c5a2532a3cc16d05387a102d893cb008b43a7af..4141598919906a3871a160b82f170d3fffc74ef2 100644 (file)
@@ -52,7 +52,7 @@ extern int  zft_def_idle_state(void);
  */
 extern int  _zft_open(unsigned int dev_minor, unsigned int access_mode);
 extern int  _zft_close(void);
-extern int  _zft_ioctl(unsigned int command, void *arg);
+extern int  _zft_ioctl(unsigned int command, void __user *arg);
 #endif
 
 
index 1fc5feaf99226286282b7c485f8520920cabc31c..95666a2ebe13ed5e912c0625906c7e02950903d6 100644 (file)
@@ -88,9 +88,9 @@ static int zft_close(struct inode *ino, struct file *filep);
 static int  zft_ioctl(struct inode *ino, struct file *filep,
                      unsigned int command, unsigned long arg);
 static int  zft_mmap(struct file *filep, struct vm_area_struct *vma);
-static ssize_t zft_read (struct file *fp, char *buff,
+static ssize_t zft_read (struct file *fp, char __user *buff,
                         size_t req_len, loff_t *ppos);
-static ssize_t zft_write(struct file *fp, const char *buff,
+static ssize_t zft_write(struct file *fp, const char __user *buff,
                         size_t req_len, loff_t *ppos);
 
 static struct file_operations zft_cdev =
@@ -177,7 +177,7 @@ static int zft_ioctl(struct inode *ino, struct file *filep,
        old_sigmask = current->blocked; /* save mask */
        sigfillset(&current->blocked);
        /* This will work as long as sizeof(void *) == sizeof(long) */
-       result = _zft_ioctl(command, (void *) arg);
+       result = _zft_ioctl(command, (void __user *) arg);
        current->blocked = old_sigmask; /* restore mask */
        TRACE_EXIT result;
 }
@@ -211,7 +211,7 @@ static int  zft_mmap(struct file *filep, struct vm_area_struct *vma)
 
 /*      Read from floppy tape device
  */
-static ssize_t zft_read(struct file *fp, char *buff,
+static ssize_t zft_read(struct file *fp, char __user *buff,
                        size_t req_len, loff_t *ppos)
 {
        int result = -EIO;
@@ -234,7 +234,7 @@ static ssize_t zft_read(struct file *fp, char *buff,
 
 /*      Write to tape device
  */
-static ssize_t zft_write(struct file *fp, const char *buff,
+static ssize_t zft_write(struct file *fp, const char __user *buff,
                         size_t req_len, loff_t *ppos)
 {
        int result = -EIO;
index 5f9ce2eef1ff8372c05fbd6350292550742fe388..2145892b9eea7b6d67bd76ae437e84def6031c99 100644 (file)
@@ -52,10 +52,10 @@ extern const  ftape_info *zft_status; /* needed for zftape-vtbl.h */
 struct zft_cmpr_ops {
        int (*write)(int *write_cnt,
                     __u8 *dst_buf, const int seg_sz,
-                    const __u8 *src_buf, const int req_len, 
+                    const __u8 __user *src_buf, const int req_len, 
                     const zft_position *pos, const zft_volinfo *volume);
        int (*read)(int *read_cnt,
-                   __u8 *dst_buf, const int req_len,
+                   __u8 __user *dst_buf, const int req_len,
                    const __u8 *src_buf, const int seg_sz,
                    const zft_position *pos, const zft_volinfo *volume);
        int (*seek)(unsigned int new_block_pos,
index 42de63254e53547c69911ea090023f007f5ea749..214bf03dce687b9d3abedd1a8a271354a1ee87ad 100644 (file)
@@ -154,7 +154,7 @@ int zft_fetch_segment_fraction(const unsigned int segment, void *buffer,
  * amount of data actually * copied to the user-buffer
  */
 static int zft_simple_read (int *read_cnt, 
-                           __u8  *dst_buf, 
+                           __u8  __user *dst_buf, 
                            const int to_do, 
                            const __u8 *src_buf, 
                            const int seg_sz, 
@@ -252,7 +252,7 @@ static int check_read_access(int *req_len,
  * req_len: how much data should be read at most.
  * volume: contains information on current volume (blk_sz etc.)
  */  
-static int empty_deblock_buf(__u8 *usr_buf, const int req_len,
+static int empty_deblock_buf(__u8 __user *usr_buf, const int req_len,
                             const __u8 *src_buf, const int seg_sz,
                             zft_position *pos,
                             const zft_volinfo *volume)
@@ -293,7 +293,7 @@ static int empty_deblock_buf(__u8 *usr_buf, const int req_len,
  * use small block-sizes. The block-size may be 1kb (SECTOR_SIZE). In
  * this case a MTFSR 28 maybe still inside the same segment.
  */
-int _zft_read(charbuff, int req_len)
+int _zft_read(char __user *buff, int req_len)
 {
        int req_clipped;
        int result     = 0;
index ad2e9dbc4f55488f598e0cf379b982b64a288b01..42941de0c23a9eb91d316cc1d8c9f5ef294bc37e 100644 (file)
@@ -48,6 +48,6 @@ extern int  zft_fetch_segment_fraction(const unsigned int segment,
                                   0, FT_SEGMENT_SIZE)
 /*   hook for the VFS interface
  */
-extern int  _zft_read(charbuff, int req_len);
+extern int  _zft_read(char __user *buff, int req_len);
 
 #endif /* _ZFTAPE_READ_H */
index 43129fdf0b0f008bec1bf79ea10935cdc4fa41e2..94327b8c97b948abd8babc6e53f898ba8ec96568 100644 (file)
@@ -303,7 +303,7 @@ int zft_flush_buffers(void)
  */
 static int zft_simple_write(int *cnt,
                            __u8 *dst_buf, const int seg_sz,
-                           const __u8 *src_buf, const int req_len, 
+                           const __u8 __user *src_buf, const int req_len, 
                            const zft_position *pos,const zft_volinfo *volume)
 {
        int space_left;
@@ -379,7 +379,7 @@ static int check_write_access(int req_len,
 
 static int fill_deblock_buf(__u8 *dst_buf, const int seg_sz,
                            zft_position *pos, const zft_volinfo *volume,
-                           const char *usr_buf, const int req_len)
+                           const char __user *usr_buf, const int req_len)
 {
        int cnt = 0;
        int result = 0;
@@ -420,7 +420,7 @@ static int fill_deblock_buf(__u8 *dst_buf, const int seg_sz,
 
 /*  called by the kernel-interface routine "zft_write()"
  */
-int _zft_write(const charbuff, int req_len)
+int _zft_write(const char __user *buff, int req_len)
 {
        int result = 0;
        int written = 0;
index 4a8d47687c3bee2c57acb954431b2bc601fb2c51..ea887015b493d90c3692df81332019fcd46087ff 100644 (file)
@@ -34,5 +34,5 @@ extern void zft_prevent_flush(void);
 
 /*  hook for the VFS interface 
  */
-extern int _zft_write(const char *buff, int req_len);
+extern int _zft_write(const char __user *buff, int req_len);
 #endif /* _ZFTAPE_WRITE_H */
index 692088c6361d842fadc594dcec796610ce76286a..4f2daa83d3ad0aaa74df51e5941bf5e222b7785a 100644 (file)
@@ -204,7 +204,7 @@ struct mtftseg
        unsigned mt_segno;   /* the segment to read or write */
        unsigned mt_mode;    /* modes for read/write (sync/async etc.) */
        int      mt_result;  /* result of r/w request, not of the ioctl */
-       void    *mt_data;    /* User space buffer: must be 29kb */
+       void    __user *mt_data;    /* User space buffer: must be 29kb */
 };
 
 /* get tape capacity (ftape/zftape)