]> git.pld-linux.org Git - packages/lin_tape.git/blob - kernel-5.6.patch
8bf8ce3c265f59dc0968808e4c1b0ab67c98d586
[packages/lin_tape.git] / kernel-5.6.patch
1 diff -urNp -x '*.orig' lin_tape-3.0.52.org/lin_tape_ioctl_tape.c lin_tape-3.0.52/lin_tape_ioctl_tape.c
2 --- lin_tape-3.0.52.org/lin_tape_ioctl_tape.c   2021-02-24 22:06:04.675258765 +0100
3 +++ lin_tape-3.0.52/lin_tape_ioctl_tape.c       2021-02-24 22:06:04.715258642 +0100
4 @@ -26,6 +26,16 @@
5  #include <linux/delay.h>
6  #include <linux/ktime.h>
7  
8 +
9 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
10 +struct lin_tape_timeval {
11 +  __kernel_long_t      tv_sec;
12 +  __kernel_suseconds_t tv_usec;
13 +};
14 +#else
15 +#define lin_tape_timeval timeval
16 +#endif
17 +
18  /*****************************************************************************
19   *                                                                           *
20   *              Tape Drive Ioctls                                            *
21 @@ -2795,7 +2805,7 @@ EXIT_LABEL:
22  
23  ssize_t tape_set_tod(struct tape_descriptor** drvp)
24  {
25 -       struct timeval* tv = NULL;
26 +       struct lin_tape_timeval* tv = NULL;
27         struct tod_control* buffer = NULL;
28         struct tape_descriptor *drv = *drvp;
29         int now = 0, rc = STATUS_SUCCESS;
30 @@ -2811,20 +2821,20 @@ ssize_t tape_set_tod(struct tape_descrip
31                 goto EXIT_LABEL;
32         } /* if */
33  
34 -       tv = kmalloc(sizeof(struct timeval), GFP_KERNEL);
35 +       tv = kmalloc(sizeof(struct lin_tape_timeval), GFP_KERNEL);
36         if(!tv) {
37                 rc = -ENOMEM;
38                 goto EXIT_LABEL;
39         } /* if */
40  
41         memset(buffer, '\0', sizeof(struct tod_control));
42 -       memset(tv, '\0', sizeof(struct timeval));
43 +       memset(tv, '\0', sizeof(struct lin_tape_timeval));
44  
45         rc = tape_modesense_page(&drv, TODControlPageNumber, (unchar*)buffer,
46                 sizeof(struct tod_control), True, True);
47         if(rc != STATUS_SUCCESS) goto EXIT_LABEL;
48  
49 -       memset(tv, '\0', sizeof(struct timeval));
50 +       memset(tv, '\0', sizeof(struct lin_tape_timeval));
51  #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
52         do_gettimeofday(tv);
53  #else
54 @@ -8940,7 +8950,7 @@ EXIT_LABEL:
55  
56  int erp_tod(struct tape_descriptor* drv, union cdb* tmp_cdb, char* sense_data)
57  {
58 -       struct timeval* tv = NULL;
59 +       struct lin_tape_timeval* tv = NULL;
60         struct tod_control* tod_buf = NULL;
61         int now = 0, rc = -EIO;
62  
63 @@ -8950,7 +8960,7 @@ int erp_tod(struct tape_descriptor* drv,
64                 goto EXIT_LABEL;
65         } /* if */
66  
67 -       tv = kmalloc(sizeof(struct timeval), GFP_KERNEL);
68 +       tv = kmalloc(sizeof(struct lin_tape_timeval), GFP_KERNEL);
69         if(!tv) {
70                 rc = -ENOMEM;
71                 goto EXIT_LABEL;
72 @@ -8961,7 +8971,7 @@ int erp_tod(struct tape_descriptor* drv,
73         if(rc != STATUS_SUCCESS) goto EXIT_LABEL;
74  
75         /* get time info to set TOD */
76 -       memset(tv, '\0', sizeof(struct timeval));
77 +       memset(tv, '\0', sizeof(struct lin_tape_timeval));
78  #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
79         do_gettimeofday(tv);
80  #else
81 diff -urNp -x '*.orig' lin_tape-3.0.52.org/lin_tape_scsi_config.h lin_tape-3.0.52/lin_tape_scsi_config.h
82 --- lin_tape-3.0.52.org/lin_tape_scsi_config.h  2021-02-24 22:06:04.671925441 +0100
83 +++ lin_tape-3.0.52/lin_tape_scsi_config.h      2021-02-24 22:06:04.715258642 +0100
84 @@ -220,6 +220,7 @@ static int tape_open_proc(struct inode *
85  {
86         return single_open(file, tape_read_proc, NULL);
87  }
88 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)
89  static struct file_operations tape_proc_ops = {
90      .owner   = THIS_MODULE,
91      .open    = tape_open_proc,
92 @@ -227,6 +228,14 @@ static struct file_operations tape_proc_
93      .llseek  = seq_lseek,
94      .release = single_release,
95  };
96 +#else
97 +static struct proc_ops tape_proc_ops = {
98 +    .proc_open    = tape_open_proc,
99 +    .proc_read    = seq_read,
100 +    .proc_lseek  = seq_lseek,
101 +    .proc_release = single_release,
102 +};
103 +#endif
104  #endif
105  
106  int rd_pc_initial
107 @@ -252,6 +261,7 @@ static int changer_open_proc(struct inod
108  {
109         return single_open(file, changer_read_proc, NULL);
110  }
111 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)
112  static struct file_operations changer_proc_ops = {
113      .owner   = THIS_MODULE,
114      .open    = changer_open_proc,
115 @@ -259,6 +269,14 @@ static struct file_operations changer_pr
116      .llseek  = seq_lseek,
117      .release = single_release,
118  };
119 +#else
120 +static struct proc_ops changer_proc_ops = {
121 +    .proc_open    = changer_open_proc,
122 +    .proc_read    = seq_read,
123 +    .proc_lseek  = seq_lseek,
124 +    .proc_release = single_release,
125 +};
126 +#endif
127  #endif
128  
129  static int status_read_proc
130 @@ -270,6 +288,7 @@ static int status_open_proc(struct inode
131  {
132         return single_open(file, status_read_proc, NULL);
133  }
134 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)
135  static struct file_operations status_proc_ops = {
136      .owner   = THIS_MODULE,
137      .open    = status_open_proc,
138 @@ -277,6 +296,14 @@ static struct file_operations status_pro
139      .llseek  = seq_lseek,
140      .release = single_release,
141  };
142 +#else
143 +static struct proc_ops status_proc_ops = {
144 +    .proc_open    = status_open_proc,
145 +    .proc_read    = seq_read,
146 +    .proc_lseek  = seq_lseek,
147 +    .proc_release = single_release,
148 +};
149 +#endif
150  #endif
151  
152  int rdstatus_pc_initial
This page took 0.075188 seconds and 2 git commands to generate.