]> git.pld-linux.org Git - packages/lin_tape.git/blame - linux-3.10.patch
- updated kernel module build system
[packages/lin_tape.git] / linux-3.10.patch
CommitLineData
dbbe8553
JR
1diff -ur lin_tape-2.1.0/lin_tape_scsi_config.c lin_tape-2.1.0-3.10/lin_tape_scsi_config.c
2--- lin_tape-2.1.0/lin_tape_scsi_config.c 2013-06-12 23:07:31.000000000 +0200
3+++ lin_tape-2.1.0-3.10/lin_tape_scsi_config.c 2013-08-25 14:24:13.053537972 +0200
6970de81 4@@ -3150,6 +3150,31 @@
dbbe8553
JR
5 return;
6 } /* lin_tape_delete_tsm_pseudo() */
7
6970de81 8+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
dbbe8553
JR
9+static int tape_proc_open(struct inode *inode, struct file *file)
10+{
11+ return single_open(file, tape_read_proc, PDE_DATA(inode));
12+}
13+
14+static int changer_proc_open(struct inode *inode, struct file *file)
15+{
16+ return single_open(file, changer_read_proc, PDE_DATA(inode));
17+}
18+
19+static const struct file_operations tape_proc_fops = {
20+ .open = tape_proc_open,
21+ .read = seq_read,
22+ .llseek = seq_lseek,
23+ .release = single_release,
24+};
25+
26+static const struct file_operations changer_proc_fops = {
27+ .open = changer_proc_open,
28+ .read = seq_read,
29+ .llseek = seq_lseek,
30+ .release = single_release,
31+};
6970de81 32+#endif
dbbe8553
JR
33 /*******************************************************************************
34 * *
35 * NAME: lin_tape_create_proc *
6970de81 36@@ -3167,42 +3191,56 @@
dbbe8553
JR
37 DbgPrint(("lin_tape: lin_tape_create_proc entry\n"));
38
39 WRITE_LOCK(&lin_tape_lock);
6970de81
JR
40+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
41 if(!tape_proc_entry) {
42 tape_proc_entry =
43 create_proc_entry("scsi/IBMtape", 0, NULL);
44
45 if(!tape_proc_entry) {
46 DbgPrint(("lin_tape: cannot initialize "\
47 "/proc/scsi/IBMtape\n"));
48 goto EXIT_LABEL;
49 } /* if */
50
51 tape_proc_entry->read_proc = tape_read_proc;
52 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
53 tape_proc_entry->owner = THIS_MODULE;
54 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
55 tape_proc_entry->get_info = NULL;
56 #endif
57 #endif
58+#else
dbbe8553
JR
59+ if (!proc_create("scsi/IBMtape", 0, NULL, &tape_proc_fops)) {
60+ DbgPrint(("lin_tape: cannot initialize "\
61+ "/proc/scsi/IBMtape\n"));
62+ goto EXIT_LABEL;
6970de81 63+#endif
dbbe8553
JR
64 } /* if */
65
6970de81
JR
66+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
67 if(!changer_proc_entry) {
68 changer_proc_entry =
69 create_proc_entry("scsi/IBMchanger", 0, NULL);
70
71 if(!changer_proc_entry) {
72 DbgPrint(("lin_tape: cannot initialize "\
73 "/proc/scsi/IBMchanger\n"));
74 goto EXIT_LABEL;
75 } /* if */
76
77 changer_proc_entry->read_proc = changer_read_proc;
78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
79 changer_proc_entry->owner = THIS_MODULE;
80 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
81 changer_proc_entry->get_info = NULL;
82 #endif
83 #endif
84+#else
dbbe8553
JR
85+ if (!proc_create("scsi/IBMchanger", 0, NULL, &changer_proc_fops)) {
86+ DbgPrint(("lin_tape: cannot initialize "\
87+ "/proc/scsi/IBMchanger\n"));
88+ goto EXIT_LABEL;
6970de81 89+#endif
dbbe8553
JR
90 } /* if */
91
92 EXIT_LABEL:
6970de81 93@@ -3229,15 +3227,20 @@
dbbe8553
JR
94 {
95 WRITE_LOCK(&lin_tape_lock);
96
6970de81
JR
97+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
98 if(tape_proc_entry) {
99 remove_proc_entry("scsi/IBMtape", NULL);
100 tape_proc_entry = NULL;
101 } /* if */
102
103 if(changer_proc_entry) {
104 remove_proc_entry("scsi/IBMchanger", NULL);
105 changer_proc_entry = NULL;
106 } /* if */
107+#else
dbbe8553
JR
108+ remove_proc_entry("scsi/IBMtape", NULL);
109+ remove_proc_entry("scsi/IBMchanger", NULL);
6970de81 110+#endif
dbbe8553
JR
111
112 WRITE_UNLOCK(&lin_tape_lock);
113
6970de81 114@@ -3262,51 +3253,80 @@
dbbe8553
JR
115 * *
116 *******************************************************************************/
6970de81
JR
117
118+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
119 static int tape_read_proc(char* buffer, char** start, off_t offset, int length,
120 int* eof, void* data)
121+#else
dbbe8553 122+static int tape_read_proc(struct seq_file *m, void* data)
6970de81 123+#endif
dbbe8553 124 {
6970de81
JR
125+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
126 int buf_offset = 0, i = 0, start_dev = 0, found = 0, linelen = 0;
127 unchar* model = NULL, * pre_buf = NULL;
128 unchar temp_buf[96];
129+#else
dbbe8553
JR
130+ int i = 0, found = 0;
131+ unchar* model = NULL;
6970de81 132+#endif
dbbe8553
JR
133 char* sn = NULL;
134 boolean tape_des_locked = False;
135
136 DbgPrint(("lin_tape: tape_read_proc entry\n"));
137
138 model = kmalloc(12, GFP_KERNEL);
6970de81
JR
139+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
140 pre_buf = kmalloc(ONE_K / 4, GFP_KERNEL);
141+#endif
dbbe8553 142 sn = kmalloc(MaxSerialNumberSize + 1, GFP_KERNEL);
6970de81
JR
143+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
144 if(!model || !pre_buf || !sn || !buffer || !start || !eof) {
145 if(start) *start = buffer;
146 if(eof) *eof = True;
147+#else
dbbe8553 148+ if(!model || !sn) {
6970de81 149+#endif
dbbe8553
JR
150 goto EXIT_LABEL;
151 } /* if */
152
6970de81
JR
153+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
154 memset(temp_buf, '\0', 96);
155+#endif
dbbe8553 156 memset(model, '\0', 12);
6970de81
JR
157+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
158 memset(pre_buf, '\0', ONE_K / 4);
159+#endif
dbbe8553
JR
160 memset(sn, '\0', MaxSerialNumberSize + 1);
161
162 i = 0;
163
6970de81
JR
164+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
165 if(!offset && rd_pc_initial(buffer, &buf_offset, length, start, False))
166 goto EXIT_LABEL;
167
168 if(rd_pc_start_dev(&start_dev, eof, offset, buffer, &buf_offset, False))
169 goto EXIT_LABEL;
170+#else
dbbe8553 171+ rd_pc_initial(m, False);
6970de81 172+#endif
dbbe8553
JR
173
174 READ_LOCK(&tape_des_lock);
175 tape_des_locked = True;
176
177 if(!tape_devs) {
6970de81
JR
178+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
179 *eof = True;
180 if(buf_offset == length) buf_offset--;
181 buf_offset += sprintf(&buffer[buf_offset], "\n");
182 *start = buffer;
183+#endif
dbbe8553
JR
184 goto EXIT_LABEL;
185 } /* if */
186
6970de81
JR
187+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
188 for(i = start_dev; i < MaxLinTapeDevices; i++) {
189+#else
dbbe8553 190+ for(i = 0; i < MaxLinTapeDevices; i++) {
6970de81 191+#endif
dbbe8553
JR
192 if(!tape_devs[i] || !tape_devs[i]->dev_obj) continue;
193
194 found = False;
6970de81 195@@ -3326,8 +3301,12 @@
dbbe8553
JR
196 sn[strlen(sn) - 1] == '\t'))
197 sn[strlen(sn) - 1] = '\0';
198
6970de81
JR
199+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
200 linelen = snprintf(pre_buf, ONE_K / 4,
201 "\n%-8d%-12s%-18s%-16s%-16s%-10s",
202+#else
dbbe8553 203+ seq_printf(m, "%-8d%-12s%-18s%-16s",
6970de81 204+#endif
dbbe8553
JR
205 i,
206 model,
207
6970de81 208@@ -3335,12 +3309,22 @@
dbbe8553
JR
209 tape_devs[i]->serial_num_len ? sn : "NA",
210
211 tape_devs[i]->ghost_device ? "" :
6970de81
JR
212+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
213 found ? tape_devs[i]->pname : "NA",
214+#else
dbbe8553 215+ found ? tape_devs[i]->pname : "NA");
6970de81 216+#endif
dbbe8553 217
6970de81
JR
218+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
219 tape_devs[i]->ghost_device ? "" :
220 scsi_addr_str(tape_devs[i], temp_buf,
221 False),
222+#else
dbbe8553
JR
223+ if (!tape_devs[i]->ghost_device)
224+ scsi_addr_str(tape_devs[i], m, False);
225
226+ seq_printf(m, "%-10s\n",
6970de81 227+#endif
dbbe8553
JR
228 tape_devs[i]->ghost_device ? "" :
229 !found ? "NA" :
230 !tape_devs[i]->serial_num_len ? "NA" :
6970de81 231@@ -3349,45 +3323,59 @@
dbbe8553
JR
232 tape_devs[i]->isPrimary ? "Primary" :
233 "Alternate");
234
6970de81
JR
235+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
236 if(buf_offset > length) {
237 buf_offset = length;
238 break;
239 } else if(buf_offset + linelen >= length) {
240 memset(&buffer[buf_offset], ' ', length - buf_offset);
241 buf_offset = length;
242 break;
243 } /* if */
244
245 buf_offset += sprintf(&buffer[buf_offset], "%s", pre_buf);
246+#endif
dbbe8553
JR
247 tape_devs[i]->proc_read = True;
248 } /* for */
249
250 tape_des_locked = False;
251 READ_UNLOCK(&tape_des_lock);
252
6970de81
JR
253+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
254 if(i == start_dev || i >= MaxLinTapeDevices) {
255 if(buf_offset == length) buf_offset--;
256 buf_offset += sprintf(&buffer[buf_offset], "\n");
257 *eof = True;
258 if(i >= MaxLinTapeDevices) *start = buffer;
259 goto EXIT_LABEL;
260 } /* if */
261
262 *start = buffer;
263+#endif
264
dbbe8553
JR
265 EXIT_LABEL:
266
6970de81
JR
267+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
268 if(pre_buf) kfree(pre_buf);
269+#endif
dbbe8553
JR
270 if(model) kfree(model);
271 if(sn) kfree(sn);
272
273 if(tape_des_locked) READ_UNLOCK(&tape_des_lock);
274 tape_des_locked = False;
275
6970de81
JR
276+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
277 if(buf_offset == 1 && *eof) buf_offset = 0;
278 DbgPrint(("tape_read_proc exit: %d\n", buf_offset));
279+#else
dbbe8553 280+ DbgPrint(("tape_read_proc exit:\n"));
6970de81 281+#endif
dbbe8553 282
6970de81
JR
283+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
284 return buf_offset;
285+#else
dbbe8553 286+ return 0;
6970de81 287+#endif
dbbe8553
JR
288 } /* tape_read_proc() */
289
290 /*******************************************************************************
6970de81 291@@ -3409,12 +3361,21 @@
dbbe8553
JR
292 * *
293 *******************************************************************************/
294
6970de81
JR
295+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
296 static int changer_read_proc(char* buffer, char** start, off_t offset,
297 int length, int* eof, void* data)
298+#else
dbbe8553 299+static int changer_read_proc(struct seq_file *m, void* data)
6970de81 300+#endif
dbbe8553 301 {
6970de81
JR
302+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
303 int buf_offset = 0, i = 0, start_dev = 0, found = 0, linelen = 0;
304 unchar* model = NULL, * pre_buf = NULL;
305 unchar temp_buf[96];
306+#else
dbbe8553
JR
307+ int i = 0, found = 0;
308+ unchar* model = NULL;
6970de81 309+#endif
dbbe8553
JR
310 char* sn = NULL;
311 boolean changer_des_locked = False;
312
6970de81 313@@ -3423,37 +3373,57 @@
dbbe8553
JR
314 i = 0;
315
316 model = kmalloc(12, GFP_KERNEL);
6970de81
JR
317+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
318 pre_buf = kmalloc(ONE_K / 4, GFP_KERNEL);
319+#endif
dbbe8553 320 sn = kmalloc(MaxSerialNumberSize + 1, GFP_KERNEL);
6970de81
JR
321+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
322 if(!model || !pre_buf || !sn || !buffer || !start || !eof) {
323 if(start) *start = buffer;
324 if(eof) *eof = True;
325+#else
dbbe8553 326+ if(!model || !sn) {
6970de81 327+#endif
dbbe8553
JR
328 goto EXIT_LABEL;
329 } /* if */
330
6970de81
JR
331+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
332 memset(temp_buf, '\0', 96);
333+#endif
dbbe8553 334 memset(model, '\0', 12);
6970de81
JR
335+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
336 memset(pre_buf, '\0', ONE_K / 4);
337+#endif
dbbe8553
JR
338 memset(sn, '\0', MaxSerialNumberSize + 1);
339
6970de81
JR
340+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
341 if(!offset && rd_pc_initial(buffer, &buf_offset, length, start, True))
342 goto EXIT_LABEL;
343
344 if(rd_pc_start_dev(&start_dev, eof, offset, buffer, &buf_offset, True))
345 goto EXIT_LABEL;
346+#else
dbbe8553 347+ rd_pc_initial(m, True);
6970de81 348+#endif
dbbe8553
JR
349
350 READ_LOCK(&changer_des_lock);
351 changer_des_locked = True;
352
353 if(!changer_devs) {
6970de81
JR
354+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
355 *eof = True;
356 if(buf_offset == length) buf_offset--;
357 buf_offset += sprintf(&buffer[buf_offset], "\n");
358 *start = buffer;
359+#endif
dbbe8553
JR
360 goto EXIT_LABEL;
361 } /* if */
362
6970de81
JR
363+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
364 for(i = start_dev; i < MaxLinTapeChangerDevices; i++) {
365+#else
dbbe8553 366+ for(i = 0; i < MaxLinTapeChangerDevices; i++) {
6970de81 367+#endif
dbbe8553
JR
368 if(!changer_devs[i] || !changer_devs[i]->dev_obj) continue;
369
370 found = False;
6970de81 371@@ -3472,8 +3409,12 @@
dbbe8553
JR
372 sn[strlen(sn) - 1] == '\t'))
373 sn[strlen(sn) - 1] = '\0';
374
6970de81
JR
375+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
376 linelen = snprintf(pre_buf, ONE_K / 4,
377 "\n%-8d%-12s%-18s%-16s%-16s%-10s",
378+#else
dbbe8553 379+ seq_printf(m, "%-8d%-12s%-18s%-16s",
6970de81 380+#endif
dbbe8553
JR
381 i,
382 model,
383
6970de81 384@@ -3481,14 +3417,24 @@
dbbe8553
JR
385 changer_devs[i]->serial_num_len ? sn : "NA",
386
387 changer_devs[i]->ghost_device ? "" :
6970de81
JR
388+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
389 found ? changer_devs[i]->pname : "NA",
390+#else
dbbe8553 391+ found ? changer_devs[i]->pname : "NA");
6970de81
JR
392+#endif
393
394+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
395 changer_devs[i]->ghost_device ? "" :
396 scsi_addr_str((struct tape_descriptor*)
397 changer_devs[i],
398 temp_buf,
399 True),
400+#else
dbbe8553
JR
401+ if (!changer_devs[i]->ghost_device)
402+ scsi_addr_str((struct tape_descriptor*)changer_devs[i], m, True);
403
404+ seq_printf(m, "%-10s\n",
6970de81 405+#endif
dbbe8553
JR
406 changer_devs[i]->ghost_device ? "" :
407 !found ? "NA" :
408 changer_devs[i]->chg_id == IBM_3590
6970de81 409@@ -3498,45 +3432,59 @@
dbbe8553
JR
410 changer_devs[i]->isPrimary ? "Primary" :
411 "Alternate");
412
6970de81
JR
413+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
414 if(buf_offset > length) {
415 buf_offset = length;
416 break;
417 } else if(buf_offset + linelen >= length) {
418 memset(&buffer[buf_offset], ' ', length - buf_offset);
419 buf_offset = length;
420 break;
421 } /* if */
422
423 buf_offset += sprintf(&buffer[buf_offset], "%s", pre_buf);
424+#endif
dbbe8553
JR
425 changer_devs[i]->proc_read = True;
426 } /* for */
427
428 changer_des_locked = False;
429 READ_UNLOCK(&changer_des_lock);
430
6970de81
JR
431+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
432 if(i == start_dev || i >= MaxLinTapeChangerDevices) {
433 if(buf_offset == length) buf_offset--;
434 buf_offset += sprintf(&buffer[buf_offset], "\n");
435 *eof = True;
436 if(i >= MaxLinTapeChangerDevices) *start = buffer;
437 goto EXIT_LABEL;
438 } /* if */
439
440 *start = buffer;
441+#endif
442
dbbe8553
JR
443 EXIT_LABEL:
444
445 if(model) kfree(model);
6970de81
JR
446+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
447 if(pre_buf) kfree(pre_buf);
448+#endif
dbbe8553
JR
449 if(sn) kfree(sn);
450
451 if(changer_des_locked) READ_UNLOCK(&changer_des_lock);
452 changer_des_locked = False;
453
6970de81
JR
454+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
455 if(buf_offset == 1 && *eof) buf_offset = 0;
456 DbgPrint(("changer_read_proc exit: %d\n", buf_offset));
457+#else
dbbe8553 458+ DbgPrint(("changer_read_proc exit\n"));
6970de81 459+#endif
dbbe8553 460
6970de81
JR
461+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
462 return buf_offset;
463+#else
dbbe8553 464+ return 0;
6970de81 465+#endif
dbbe8553
JR
466 } /* changer_read_proc() */
467
468 /*******************************************************************************
6970de81 469@@ -3557,15 +3469,25 @@
dbbe8553
JR
470 * *
471 *******************************************************************************/
472
6970de81
JR
473+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
474 int rd_pc_initial(char* buffer, int* buf_offset, int length, char** start,
475 boolean chg)
476+#else
dbbe8553 477+int rd_pc_initial(struct seq_file *m, boolean chg)
6970de81 478+#endif
dbbe8553 479 {
6970de81
JR
480+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
481 int rc = 1, count = 0, i = 0, max_devices = 0;
482 char tmp_buf[96];
483+#else
dbbe8553 484+ int i = 0, max_devices = 0;
6970de81 485+#endif
dbbe8553
JR
486
487 DbgPrint(("rd_pc_initial entry\n"));
488
6970de81
JR
489+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
490 memset(tmp_buf, '\0', 96);
491+#endif
dbbe8553
JR
492 max_devices = chg ? MaxLinTapeChangerDevices : MaxLinTapeDevices;
493
494 /* set proc_read flag for each logical device to false */
6970de81 495@@ -3580,47 +3489,59 @@
dbbe8553
JR
496 } /* if */
497 WRITE_UNLOCK(chg ? &changer_des_lock : &tape_des_lock);
498
6970de81
JR
499+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
500 count = sprintf(tmp_buf, "lin_tape version: %s", LIN_TAPE_VERSION);
501 if(count > length) goto EXIT_LABEL;
502
503 count = sprintf(buffer, "lin_tape version: %s", LIN_TAPE_VERSION);
504 *buf_offset = count;
505
506 count = sprintf(tmp_buf, "\nlin_tape major number: %d", lin_tape_major);
507 if(*buf_offset + count > length) goto EXIT_LABEL;
508
509 count = sprintf(buffer + *buf_offset,
510 "\nlin_tape major number: %d", lin_tape_major);
511 *buf_offset += count;
512
513 count = sprintf(tmp_buf, "\nAttached %s Devices:",
514 chg ? "Changer" : "Tape");
515 if(*buf_offset + count > length) goto EXIT_LABEL;
516
517 count = sprintf(buffer + *buf_offset, "\nAttached %s Devices:",
518 chg ? "Changer" : "Tape");
519 *buf_offset += count;
520
521 count = sprintf(tmp_buf, "\n%-8s%-12s%-18s%-16s%-16s%-10s",
522 "Number", "model", "SN", "HBA", "SCSI", "FO Path");
523 if(*buf_offset + count > length) goto EXIT_LABEL;
524
525 count = sprintf(buffer + *buf_offset, "\n%-8s%-12s%-18s%-16s%-16s%-10s",
526+#else
dbbe8553
JR
527+ seq_printf(m, "lin_tape version: %s\n", LIN_TAPE_VERSION);
528+ seq_printf(m, "lin_tape major number: %d\n", lin_tape_major);
529+ seq_printf(m, "Attached %s Devices:\n", chg ? "Changer" : "Tape");
530+ seq_printf(m, "%-8s%-12s%-18s%-16s%-16s%-10s\n",
6970de81 531+#endif
dbbe8553 532 "Number", "model", "SN", "HBA", "SCSI", "FO Path");
6970de81
JR
533+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
534 *buf_offset += count;
535
536 rc = 0;
537
538 EXIT_LABEL:
539
540 if(rc) {
541 memset(buffer + *buf_offset, ' ', length - *buf_offset);
542 *buf_offset = length;
543 *start = buffer;
544 } /* if */
545
546 DbgPrint(("rd_pc_initial exit: %d\n", rc));
547 return rc;
548+#else
dbbe8553
JR
549+ DbgPrint(("rd_pc_initial exit\n"));
550+ return 0;
6970de81 551+#endif
dbbe8553
JR
552 } /* rd_pc_initial() */
553
554 /*******************************************************************************
6970de81 555@@ -3642,8 +3518,13 @@
dbbe8553
JR
556 * *
557 *******************************************************************************/
558
6970de81
JR
559+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
560 int rd_pc_start_dev(int* start_dev, int* eof, off_t offset, char* buffer,
561 int* buf_offset, boolean chg)
562+#else
dbbe8553
JR
563+int rd_pc_start_dev(int* start_dev, int* eof, off_t offset, struct seq_file *m,
564+ boolean chg)
6970de81 565+#endif
dbbe8553
JR
566 {
567 int found = False, rc = 0, i = 0, max_devices = 0;
568
6970de81 569@@ -3678,7 +3554,11 @@
dbbe8553
JR
570
571 if(*start_dev >= max_devices) {
572 *eof = True;
6970de81
JR
573+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
574 *buf_offset += sprintf(&buffer[*buf_offset], "\n");
575+#else
dbbe8553 576+ seq_printf(m, "\n");
6970de81 577+#endif
dbbe8553
JR
578 rc = 1;
579 goto EXIT_LABEL;
580 } /* if */
6970de81 581@@ -3705,17 +3581,31 @@
dbbe8553
JR
582 * *
583 *******************************************************************************/
584
6970de81
JR
585+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
586 char* scsi_addr_str(struct tape_descriptor* drv, char* buffer, boolean cgr)
587+#else
dbbe8553 588+void scsi_addr_str(struct tape_descriptor* drv, struct seq_file *m, boolean cgr)
6970de81 589+#endif
dbbe8553
JR
590 {
591 struct changer_descriptor* chg = (struct changer_descriptor*)drv;
592
593 if(cgr)
6970de81
JR
594+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
595 sprintf(buffer, "%d:%d:%d:%d",
596+#else
dbbe8553 597+ seq_printf(m, "%d:%d:%d:%d",
6970de81 598+#endif
dbbe8553
JR
599 chg->host, chg->channel, chg->target, chg->lun);
600 else
6970de81
JR
601+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
602 sprintf(buffer, "%d:%d:%d:%d",
603+#else
dbbe8553 604+ seq_printf(m, "%d:%d:%d:%d",
6970de81 605+#endif
dbbe8553 606 drv->host, drv->channel, drv->target, drv->lun);
6970de81
JR
607+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
608 return buffer;
609+#endif
dbbe8553
JR
610 } /* scsi_addr_str() */
611
612 /*******************************************************************************
613diff -ur lin_tape-2.1.0/lin_tape_scsi_config.h lin_tape-2.1.0-3.10/lin_tape_scsi_config.h
614--- lin_tape-2.1.0/lin_tape_scsi_config.h 2013-06-12 23:07:31.000000000 +0200
615+++ lin_tape-2.1.0-3.10/lin_tape_scsi_config.h 2013-08-25 14:22:14.635373745 +0200
6970de81 616@@ -178,14 +178,24 @@
dbbe8553
JR
617 #endif
618 static void lin_tape_rescan(struct device *);
619
6970de81
JR
620+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
621 static int tape_read_proc(char *, char **, off_t, int, int *, void *);
622 int rd_pc_initial(char* buffer, int* buf_offset, int length, char** start,
623 boolean chg);
624 int rd_pc_start_dev(int* start_dev, int* eof, off_t offset, char* buffer,
625 int* buf_offset, boolean chg);
626 char* scsi_addr_str(struct tape_descriptor* drv, char* buffer, boolean cgr);
627+#else
dbbe8553
JR
628+static int tape_read_proc(struct seq_file *, void *);
629+int rd_pc_initial(struct seq_file *, boolean chg);
630+void scsi_addr_str(struct tape_descriptor* drv, struct seq_file *m, boolean cgr);
6970de81 631+#endif
dbbe8553 632
6970de81
JR
633+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
634 static int changer_read_proc(char *, char **, off_t, int, int *, void *);
635+#else
dbbe8553 636+static int changer_read_proc(struct seq_file *, void *);
6970de81 637+#endif
dbbe8553
JR
638
639 /* global variables */
640 static unchar lin_tape_cleanup_module = 0;
6970de81 641@@ -222,8 +219,10 @@
dbbe8553
JR
642 atomic_t tsm_tp_open = {0};
643 static unsigned int lin_tape_major;
644
6970de81
JR
645+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
646 static struct proc_dir_entry *tape_proc_entry = NULL;
647 static struct proc_dir_entry *changer_proc_entry = NULL;
648+#endif
649
dbbe8553
JR
650 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
651 rwlock_t hba_lock = RW_LOCK_UNLOCKED;
This page took 0.126464 seconds and 4 git commands to generate.