Commit c09d206b authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: ftape

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: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 00ca7784
......@@ -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.
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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 {
......
......@@ -1319,7 +1319,7 @@ static int mtiocftcmd(struct mtftcmd *ftcmd, int arg_size)
/* 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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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,
......
......@@ -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(char* buff, int req_len)
int _zft_read(char __user *buff, int req_len)
{
int req_clipped;
int result = 0;
......
......@@ -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(char* buff, int req_len);
extern int _zft_read(char __user *buff, int req_len);
#endif /* _ZFTAPE_READ_H */
......@@ -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 char* buff, int req_len)
int _zft_write(const char __user *buff, int req_len)
{
int result = 0;
int written = 0;
......
......@@ -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 */
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment