]> git.pld-linux.org Git - packages/lin_tape.git/blob - linux-3.13.patch
- fix building with linux 4.10
[packages/lin_tape.git] / linux-3.13.patch
1 diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c
2 --- lin_tape-3.0.8.orig/stmp.c  2016-03-17 03:52:34.000000000 +0100
3 +++ lin_tape-3.0.8/stmp.c       2016-06-19 13:10:40.664509607 +0200
4 @@ -121,7 +121,12 @@
5  
6  #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
7  static struct class st_sysfs_class;
8 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
9 +static const struct attribute_group *st_dev_groups[];
10 +static const struct attribute_group *st_drv_groups[];
11 +#else
12  static struct device_attribute st_dev_attrs[];
13 +#endif
14  /* Paths are protected by st_index_lock */
15  static struct device *old_active_path;
16  static struct device *new_active_path;
17 @@ -245,8 +250,10 @@
18  static int st_probe(struct device *);
19  static int st_remove(struct device *);
20  
21 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
22  static int do_create_sysfs_files(void);
23  static void do_remove_sysfs_files(void);
24 +#endif
25  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
26  static int do_create_class_files(struct scsi_tape *, int, int);
27  #endif
28 @@ -255,6 +262,9 @@
29         .owner                  = THIS_MODULE,
30         .gendrv = {
31                 .name           = "st",
32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
33 +               .groups         = st_drv_groups,
34 +#endif
35                 .probe          = st_probe,
36                 .remove         = st_remove,
37         },
38 @@ -4806,7 +4816,11 @@
39  #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
40  static struct class st_sysfs_class = {
41         .name = "scsi_tape",
42 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
43 +       .dev_groups = st_dev_groups,
44 +#else
45         .dev_attrs = st_dev_attrs,
46 +#endif
47  };
48  #endif
49  
50 @@ -4845,9 +4859,11 @@
51         if (err)
52                 goto err_chrdev;
53  
54 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0)
55         err = do_create_sysfs_files();
56         if (err)
57                 goto err_scsidrv;
58 +#endif
59  
60         return 0;
61  
62 @@ -4867,7 +4883,9 @@
63  
64  static void __exit exit_st(void)
65  {
66 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0)
67         do_remove_sysfs_files();
68 +#endif
69         pfo_unregister_st(&st_template.gendrv);
70         unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
71                                  ST_MAX_TAPE_ENTRIES);
72 @@ -4884,6 +4902,7 @@
73  module_exit(exit_st);
74  
75  
76 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
77  /* The sysfs driver interface. Read-only at the moment */
78  static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf)
79  {
80 @@ -4947,10 +4966,48 @@
81         driver_remove_file(sysfs, &driver_attr_fixed_buffer_size);
82         driver_remove_file(sysfs, &driver_attr_try_direct_io);
83  }
84 +#else
85 +/* The sysfs driver interface. Read-only at the moment */
86 +static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf)
87 +{
88 +       return scnprintf(buf, PAGE_SIZE, "%d\n", try_direct_io);
89 +}
90 +static DRIVER_ATTR_RO(try_direct_io);
91  
92 +static ssize_t fixed_buffer_size_show(struct device_driver *ddp, char *buf)
93 +{
94 +       return scnprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size);
95 +}
96 +static DRIVER_ATTR_RO(fixed_buffer_size);
97 +
98 +static ssize_t max_sg_segs_show(struct device_driver *ddp, char *buf)
99 +{
100 +       return scnprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs);
101 +}
102 +static DRIVER_ATTR_RO(max_sg_segs);
103 +
104 +static ssize_t version_show(struct device_driver *ddd, char *buf)
105 +{
106 +       return scnprintf(buf, PAGE_SIZE, "[%s]\n", verstr);
107 +}
108 +static DRIVER_ATTR_RO(version);
109 +
110 +static struct attribute *st_drv_attrs[] = {
111 +       &driver_attr_try_direct_io.attr,
112 +       &driver_attr_fixed_buffer_size.attr,
113 +       &driver_attr_max_sg_segs.attr,
114 +       &driver_attr_version.attr,
115 +       NULL,
116 +};
117 +ATTRIBUTE_GROUPS(st_drv);
118 +#endif
119  
120  /* The sysfs simple class interface */
121 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
122 +static ssize_t lasterror_show(struct device *dev,
123 +#else
124  static ssize_t st_lasterror_show(struct device *dev,
125 +#endif
126                 struct device_attribute *attr, char *buf)
127  {
128         struct st_modedef *STm = dev_get_drvdata(dev);
129 @@ -4981,12 +5038,19 @@
130                 STp->last_checkcondition[2]);
131         return l;
132  }
133 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
134 +static DEVICE_ATTR_RO(lasterror);
135 +#endif
136  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
137  DEVICE_ATTR(lasterror, S_IRUGO, st_lasterror_show, NULL);
138  #endif
139  
140  static ssize_t
141 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
142 +defined_show(struct device *dev, struct device_attribute *attr, char *buf)
143 +#else
144  st_defined_show(struct device *dev, struct device_attribute *attr, char *buf)
145 +#endif
146  {
147         struct st_modedef *STm = dev_get_drvdata(dev);
148         ssize_t l = 0;
149 @@ -4994,13 +5058,20 @@
150         l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
151         return l;
152  }
153 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
154 +static DEVICE_ATTR_RO(defined);
155 +#endif
156  
157  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
158  DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL);
159  #endif
160  
161  static ssize_t
162 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
163 +default_blksize_show(struct device *dev, struct device_attribute *attr, char *buf)
164 +#else
165  st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf)
166 +#endif
167  {
168         struct st_modedef *STm = dev_get_drvdata(dev);
169         ssize_t l = 0;
170 @@ -5008,13 +5079,20 @@
171         l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
172         return l;
173  }
174 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
175 +static DEVICE_ATTR_RO(default_blksize);
176 +#endif
177  
178  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
179  DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL);
180  #endif
181  
182  static ssize_t
183 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
184 +default_density_show(struct device *dev, struct device_attribute *attr, char *buf)
185 +#else
186  st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf)
187 +#endif
188  {
189         struct st_modedef *STm = dev_get_drvdata(dev);
190         ssize_t l = 0;
191 @@ -5024,13 +5102,20 @@
192         l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density);
193         return l;
194  }
195 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
196 +static DEVICE_ATTR_RO(default_density);
197 +#endif
198  
199  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
200  DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL);
201  #endif
202  
203  static ssize_t
204 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
205 +default_compression_show(struct device *dev, struct device_attribute *attr,
206 +#else
207  st_defcompression_show(struct device *dev, struct device_attribute *attr,
208 +#endif
209                        char *buf)
210  {
211         struct st_modedef *STm = dev_get_drvdata(dev);
212 @@ -5039,13 +5124,20 @@
213         l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
214         return l;
215  }
216 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
217 +static DEVICE_ATTR_RO(default_compression);
218 +#endif
219  
220  #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
221  DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL);
222  #endif
223  
224  static ssize_t
225 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
226 +options_show(struct device *dev, struct device_attribute *attr, char *buf)
227 +#else
228  st_options_show(struct device *dev, struct device_attribute *attr, char *buf)
229 +#endif
230  {
231         struct st_modedef *STm = dev_get_drvdata(dev);
232         int options;
233 @@ -5090,7 +5182,30 @@
234         l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
235         return l;
236  }
237 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
238 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
239 +static DEVICE_ATTR_RO(options);
240 +#endif
241 +
242 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
243 +static struct attribute *st_dev_attrs[] = {
244 +       &dev_attr_defined.attr,
245 +       &dev_attr_default_blksize.attr,
246 +       &dev_attr_default_density.attr,
247 +       &dev_attr_default_compression.attr,
248 +       &dev_attr_options.attr,
249 +       &dev_attr_lasterror.attr,
250 +       NULL,
251 +};
252 +
253 +static struct attribute_group st_group = {
254 +       .attrs = st_dev_attrs,
255 +};
256 +
257 +static const struct attribute_group *st_dev_groups[] = {
258 +       &st_group,
259 +       NULL,
260 +};
261 +#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
262  static struct device_attribute st_dev_attrs[] = {
263         __ATTR_RO(st_defined),
264         __ATTR_RO(st_defblk),
This page took 0.085713 seconds and 3 git commands to generate.