0x637c777b

Claude Code LLM for porting ancient Linux drivers?

LLMs are all the rage now, Markov chains are just about one (1) glued on Agent short of becoming self-aware.

Let me quote Arnold for a second: "The Skynet Funding Bill is passed. The system goes online August 4th, 1997. Human decisions are removed from strategic defense. Skynet begins to learn at a geometric rate. It becomes self-aware at 2:14 a.m. Eastern time, August 29th. In a panic, they try to pull the plug."

This is just like in the movies! 500 Billion Dollars Stargate Project by OpenAI! Announced on January 21, 2025 will inevitably lead to AGI and global, thermonuclear war.

Every day there is a new LLM, company, blog that evangelizes "statistics" in a borderline hysterical tone by people selling shovels in a goldrush. 50.000 words long blogposts are written about the newest canned benchmarks but where is the actual code?

Well, now I've seen a blogpost with actual code for a change - even low-level Linux kernel C code! It's a popular post on Hacker News, 300 comments, 900 points, Top 3 News of the Day, with a lot of comments about feelings about LLMs but not a single one about the actual code. commies

https://news.ycombinator.com/item?id=45163362

https://dmitrybrant.com/2025/09/07/using-claude-code-to-modernize-a-25-year-old-kernel-driver

Porting a floppy driver from 2000 to 2025 - how hard could it be... :P

So I took the time and looked at the code. Downloaded the two branches and compared them in Beyond Compare and at first glance it looks overwhelming. So many touched files. filez

Checking out the biggest file, something becomes quickly obvious: the vast majority of changes are the removal of preprocessor directives checking for older Kernel version and the code belonging to them! I highlighted the only change that required thinking. The current variable became a function and the question is - did Claude actually create this change?

This pattern repeats itself across the whole repo. I have not gone over every change but the following categories stood out:

1 removal of #if checks for kernel version < 2.x.y and code for older versions

2 removal of #includes config.h asm/system.h

3 removal of #defines #includes used for tracing

4 modifying macros, eg for logging KERN_INFO or FUNCTION

5 variable/function rename, eg current to get_current_state() or idle to waiting

6 function definition moves, like fdc_probe() to fdc-io.c

7 wrapper for eg zft_ioctl() and parport

Below is the HTML diff report generated by Beyond Compare. It only contains the line diffs and no context around them but still the only code worth looking at is in zftape-init.c for loading and unloading the module. The author says that he already has experience with kernel modules and you can see that he has a lot of experience with C due to his other software. So I don't really believe the quote below:

"Use these tools as a massive force multiplier of your own skills. I’m sure that if I really wanted to, I could have done this modernization effort on my own. But that would have required me to learn kernel development as it was done 25 years ago. This would have probably taken me several weeks of nonstop poring over documentation that would be completely useless knowledge today. Instead of all that, I spent a couple of days chatting with an agent and having it explain to me all the things it did."

To be honest, I don't buy it. Several weeks of reading docs to remove preprocessor directives? Kernel dev from 25 years ago? But the ported code is identical. To put in "module_put(THIS_MODULE); /* unlock module in memory */"? Where is the multiplier? What did Claude actually do? Parsed and removed the #ifdefs?

Below is the author actually saying what sound realistic.

"As a giant caveat, I should note that I have a small bit of prior experience working with kernel modules, and a good amount of experience with C in general, so I don’t want to overstate Claude’s success in this scenario. As in, it wasn’t literally three prompts to get Claude to poop out a working kernel module, but rather several back-and-forth conversations and, yes, several manual fixups of the code. It would absolutely not be possible to perform this modernization without a baseline knowledge of the internals of a kernel module."

But if you went through a tutorial on creating, loading, unloading your first kernel module and know C to a good degree, how is Claude helping here? Is it not just a transformative formatter? What were the manual fixes?

Anyway, the point here is that Hacker News comments are amusing. Don't swallow the hype wholesale lest you start selling shovels.



   
Mode:  Differences, Ignoring Unimportant  
Left base folder: C:\Users\Test\Downloads\ftapecmp\ftape-master  
Right base folder: C:\Users\Test\Downloads\ftapecmp\ftape-centos35  

   
File: ftape\lowlevel\fdc-io.c  
    -+ 31 #include <linux/config.h>
 
39 /* #include <asm/system.h> - removed in modern kernels */ <> 40 #include <asm/system.h>
 
    -+ 53 #define FDC_TRACING
 
59 void fdc_set_drive_specs(fdc_info_t *fdc); +-    
60 int fdc_probe(fdc_info_t *fdc);      
 
    -+ 106 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 110 #else
      111     if (intr_count) {
      112         return;
      113     }
      114 #endif
 
109         printk("%s : negativ irq_level: %d\n", __func__, <> 117         printk(__FUNCTION__ " : negativ irq_level: %d\n",
 
    -+ 131 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 135 #else
      136     if (intr_count) {
      137         return;
      138     }
      139 #endif
 
342                     "hide: %d\n" <> 357                     KERN_INFO "hide: %d\n"
343                     "seek: %x",   358                     KERN_INFO "seek: %x",
 
    -+ 377 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 381 #else
      382     if (!intr_count && fdc_seek_check(fdc)) {
      383         goto out;
      384     }
      385 #endif
 
    -+ 407 #if LINUX_VERSION_CODE >= KERNEL_VER(2,3,0)
 
    -+ 409 #else
      410     struct wait_queue wait = {current, NULL};
      411 #endif
 
392               "Geeh! Calling %s() with irq's off %d", __func__, <> 417               "Geeh! Calling "__FUNCTION__"() with irq's off %d",
 
397               "Geeh! Calling %s() with irq's on %d", __func__, <> 422               "Geeh! Calling "__FUNCTION__"() with irq's on %d",
 
    -+ 426 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,16)
 
    -+ 431 #else
      432     if (fdc->wait_intr) {
      433         fdc_enable_irq(fdc);
      434         TRACE_ABORT(-EIO, ft_t_err, "error: nested call");
      435     }
      436 #endif
 
    <> 439 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      440     current->timeout = jiffies + timeout;
407     441 #endif
 
411     while (!fdc->interrupt_seen && get_current_state() != TASK_RUNNING) { <> 445     while (!fdc->interrupt_seen && current->state != TASK_RUNNING) {
      446 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      447         schedule(); /* sets TASK_RUNNING on timeout */
      448 #else
 
    -+ 450 #endif
 
    -+ 466 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      467         current->timeout = 0;     /* interrupt hasn't cleared this */
      468 #endif
 
    -+ 1254 #define SEL_TRACING
      1255 #include "ftape-real-tracing.h"
 
    -+ 1290 #if LINUX_VERSION_CODE >= KERNEL_VER(2,3,0)
 
    -+ 1292 #else
      1293     info->wait_intr = NULL;
      1294 #endif
 
    -+ 1297 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 1300 #endif
 
    -+ 1353 #define GLOBAL_TRACING
      1354 #include "ftape-real-tracing.h"
 
    -+ 1482 #define GLOBAL_TRACING
      1483 #include "ftape-real-tracing.h"
 
    -+ 1546 #define SEL_TRACING
      1547 #include "ftape-real-tracing.h"
 
    -+ 1626 #define FTAPE_TRACING
      1627 #include "ftape-real-tracing.h"

   
File: ftape\lowlevel\fdc-isr.c  
    -+ 37 #define FDC_TRACING
 
48 void pause_tape(fdc_info_t *fdc); +-    
 
228           "hard map: 0x%08lx\n" <> 225           KERN_INFO "hard map: 0x%08lx\n"
229           "soft map: 0x%08lx",   226           KERN_INFO "soft map: 0x%08lx",
 
354               "error       : %s\n" <> 351               KERN_INFO "error       : %s\n"
355               "fdc count   : %d\n"   352               KERN_INFO "fdc count   : %d\n"
356               "dma residue : %d\n"   353               KERN_INFO "dma residue : %d\n"
357               "sector count: %d\n"   354               KERN_INFO "sector count: %d\n"
358               "IRQ: C: %d, R: %d\n"   355               KERN_INFO "IRQ: C: %d, R: %d\n"
359               "BUF: C: %d, R: %d/%d",   356               KERN_INFO "BUF: C: %d, R: %d/%d",
 
373               "segment     : %d\n" <> 370               KERN_INFO "segment     : %d\n"
374               "error       : %s\n"   371               KERN_INFO "error       : %s\n"
375               "fdc count   : %d\n"   372               KERN_INFO "fdc count   : %d\n"
376               "dma residue : %d\n"   373               KERN_INFO "dma residue : %d\n"
377               "sector count: %d\n"   374               KERN_INFO "sector count: %d\n"
378               "IRQ: C: %d, R: %d\n"   375               KERN_INFO "IRQ: C: %d, R: %d\n"
379               "BUF: C: %d, R: %d/%d",   376               KERN_INFO "BUF: C: %d, R: %d/%d",
 
529 #if 0 || defined(HACK) <> 526 #if 0 || HACK
 
545                   "count : %d\n" <> 542                   KERN_INFO "count : %d\n"
546                   "offset: %d\n",   543                   KERN_INFO "offset: %d\n",
 
828             buff->status = waiting; <> 825             buff->status = idle;
 
923               "drive may hang until (power on) reset :-("); <> 920               KERN_INFO "drive may hang until (power on) reset :-(");
 
    -+ 1357 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,16)
 
    -+ 1359 #else
      1360     if (fdc->wait_intr)
      1361 #endif
 
    -+ 1450 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,16)
 
    -+ 1454 #else
      1455         if ((fdc->wait_intr)) {
      1456             wake_up_interruptible(&fdc->wait_intr);
      1457         }
      1458 #endif
 
    -+ 1460 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,16)
 
    -+ 1463 #else
      1464         TRACE(ft_t_flow, "hiding interrupt while %s", 
      1465               fdc->wait_intr ? "waiting" : "active");
      1466 #endif

   
File: ftape\lowlevel\ftape-io.c  
    <> 80 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      81         current->timeout = jiffies + timeout;
80     82 #endif
 
    <> 88                 printk(__FUNCTION__
86                 printk("%s: awoken by non-blocked signal :-(\n", __func__);   89                        ": awoken by non-blocked signal :-(\n");
 
89             while (get_current_state() != TASK_RUNNING) { <> 92             while (current->state != TASK_RUNNING) {
      93 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      94                 schedule();
      95 #else
 
    -+ 97 #endif
 
    -+ 99 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      100             timeout = current->timeout;
      101 #endif
 
914 #if 0 || defined(HACK) <> 924 #if 0 || HACK
 
943 #if 0 || defined(HACK) <> 953 #if 0 || HACK

   
File: ftape\lowlevel\ftape-rw.c  
47 extern int ft_soft_retries; <> 47 /* rien */
48 extern int ft_ignore_ecc_err;      
 
50 int last_segment_skipped = -1; +-    
 
188             if (ft_ignore_ecc_err && (buff->skip > 1) && (buff->skip < (FT_SECTORS_PER_SEGMENT - 1)) +-    
189                 && (last_segment_skipped != segment_id)) {      
190                     last_segment_skipped = segment_id;      
191                 TRACE(ft_t_flow, ">>> FAST FAIL: force skipping to last sector in segment.");      
192                 buff->skip = FT_SECTORS_PER_SEGMENT - 1;      
193             }      
 
993                   "segment  : %d\n" <> 982                   KERN_INFO "segment  : %d\n"
994                   "last     : %d\n"   983                   KERN_INFO "last     : %d\n"
995                   "history  : %d\n"   984                   KERN_INFO "history  : %d\n"
996                   "offset   : %d\n"   985                   KERN_INFO "offset   : %d\n"
997                   "tolerance: %d\n",   986                   KERN_INFO "tolerance: %d\n",
 
1045            retry++ <= ft_soft_retries   && <> 1034            retry++ <= 5   &&
 
1077                       "segment_id        : %d\n" <> 1066                       KERN_INFO "segment_id        : %d\n"
1078                       "segments_per_track: %d\n"   1067                       KERN_INFO "segments_per_track: %d\n"
1079                       "start_offset      : %d",   1068                       KERN_INFO "start_offset      : %d",
 
1095                 result= skip_reverse(ftape, segment_id - ftape->start_offset, &status); <> 1084                 result= skip_reverse(ftape, segment_id - ftape->start_offset,
      1085                              &status);
 
1115                 result = seek_forward(ftape, segment_id, retry <= (ft_soft_retries / 2)); <> 1105                 result = seek_forward(ftape, segment_id,
      1106                               retry <= 3);
 
1117                 result = seek_forward(ftape, segment_id - 1, retry <= (ft_soft_retries / 2)); <> 1108                 result = seek_forward(ftape, segment_id - 1,
      1109                               retry <= 3);

   
File: ftape\lowlevel\ftape-ctl.c  
29   <> 29 #include <linux/config.h>
 
35   <> 35 #include <linux/wrapper.h>
 
    -+ 39 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6)
 
    -+ 41 #else
 
    -+ 43 #endif
 
152 #if 0 || defined(HACK) <> 155 #if 0 || HACK
 
159     ftape_set_state(ftape, waiting); <> 162     ftape_set_state(ftape, idle);
 
336               "============ unknown vendor id ===========\n" <> 339               KERN_INFO "============ unknown vendor id ===========\n"
337               "A new, yet unsupported tape drive is found\n"   340               KERN_INFO "A new, yet unsupported tape drive is found\n"
338               "Please report the following values:\n"   341               KERN_INFO "Please report the following values:\n"
339               "   Vendor id     : 0x%04x\n"   342               KERN_INFO "   Vendor id     : 0x%04x\n"
340               "   Wakeup method : %s\n"   343               KERN_INFO "   Wakeup method : %s\n"
341               "And a description of your tape drive\n"   344               KERN_INFO "And a description of your tape drive\n"
342               "to "THE_FTAPE_MAINTAINER"\n"   345               KERN_INFO "to "THE_FTAPE_MAINTAINER"\n"
343               "==========================================",   346               KERN_INFO "==========================================",
 
365              "==========================================\n" <> 368              KERN_INFO "==========================================\n"
366              "wakeup type mismatch:\n"   369              KERN_INFO "wakeup type mismatch:\n"
367              "found: %s, expected: %s\n"   370              KERN_INFO "found: %s, expected: %s\n"
368              "please report this to "THE_FTAPE_MAINTAINER"\n"   371              KERN_INFO "please report this to "THE_FTAPE_MAINTAINER"\n"
369              "==========================================",   372              KERN_INFO "==========================================",
 
452              "==========================================\n" <> 455              KERN_INFO "==========================================\n"
453              "drive type: %s\n"   456              KERN_INFO "drive type: %s\n"
454              "delta time = %d ms, length = %d ft\n"   457              KERN_INFO "delta time = %d ms, length = %d ft\n"
455              "has a maximum tape speed of %d ips\n"   458              KERN_INFO "has a maximum tape speed of %d ips\n"
456              "please report this to "THE_FTAPE_MAINTAINER"\n"   459              KERN_INFO "please report this to "THE_FTAPE_MAINTAINER"\n"
457              "==========================================",   460              KERN_INFO "==========================================",
 
486           "seek timeout  : %d sec\n" <> 489           KERN_INFO "seek timeout  : %d sec\n"
487           "rewind timeout: %d sec\n"   490           KERN_INFO "rewind timeout: %d sec\n"
488           "reset timeout : %d sec",   491           KERN_INFO "reset timeout : %d sec",
 
617                   "The famous Colorado T3000 bug:\n" <> 620     KERN_INFO "The famous Colorado T3000 bug:\n"
618                   "%s drives can't write QIC40 and QIC80\n"   621     KERN_INFO "%s drives can't write QIC40 and QIC80\n"
619                   "cartridges but don't set the write-protect flag!",   622     KERN_INFO "cartridges but don't set the write-protect flag!",
 
    -+ 654 #define SEL_TRACING
      655 #include "ftape-real-tracing.h"
 
    -+ 699 #define FTAPE_TRACING
      700 #include "ftape-real-tracing.h"
 
701               " id_am_errors     : %3d\n" <> 709               KERN_INFO " id_am_errors     : %3d\n"
702               " id_crc_errors    : %3d\n"   710               KERN_INFO " id_crc_errors    : %3d\n"
703               " data_am_errors   : %3d\n"   711               KERN_INFO " data_am_errors   : %3d\n"
704               " data_crc_errors  : %3d\n"   712               KERN_INFO " data_crc_errors  : %3d\n"
705               " overrun_errors   : %3d\n"   713               KERN_INFO " overrun_errors   : %3d\n"
706               " no_data_errors   : %3d\n"   714               KERN_INFO " no_data_errors   : %3d\n"
707               " retries          : %3d",   715               KERN_INFO " retries          : %3d",
 
717                   " crc_errors       : %3d\n" <> 725                   KERN_INFO " crc_errors       : %3d\n"
718                   " crc_failures     : %3d\n"   726                   KERN_INFO " crc_failures     : %3d\n"
719                   " ecc_failures     : %3d\n"   727                   KERN_INFO " ecc_failures     : %3d\n"
720                   " sectors corrected: %3d",   728                   KERN_INFO " sectors corrected: %3d",
 
731             TRACE(ft_t_info, "tape motion statistics:\nrepositions       : %3d", <> 739             TRACE(ft_t_info, "tape motion statistics:\n"
      740                   KERN_INFO "repositions       : %3d",
 
746     ftape_set_state(ftape, waiting); <> 755     ftape_set_state(ftape, idle);
 
787     ftape->driver_state = waiting; <> 796     ftape->driver_state = idle;
 
    -+ 828 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 831 #endif

   
File: ftape\lowlevel\ftape-read.c  
51 extern int ft_soft_retries; +-    
 
    <> 126         ft_trace_t level;
      127 #if 0
      128         if ((read_bad ^ mseg.corrected) & mseg.corrected) {
      129             level = ft_t_info;
      130         } else {
      131             level = ft_t_noise;
      132         }
      133 #else
      134         level = ft_t_info;
      135 #endif
127         TRACE(ft_t_info, "crc error map: 0x%08lx", (unsigned long)read_bad);   136         TRACE(level, "crc error map: 0x%08lx",
      137               (unsigned long)read_bad);
128         TRACE(ft_t_info, "corrected map: 0x%08lx", (unsigned long)mseg.corrected);   138         TRACE(level, "corrected map: 0x%08lx",
      139               (unsigned long)mseg.corrected);
 
    -+ 145     if (ft_ignore_ecc_err) {
      146         if (result == ECC_CORRECTED || result == ECC_OK) {
 
    -+ 148         } else {
      149             TRACE(ft_t_info, ">>> Ignoring ECC failure at segment: %d", buff->segment_id);
      150         }
      151         TRACE_EXIT (mseg.blocks - 3) * FT_SECTOR_SIZE;
      152     }
 
134             TRACE(ft_t_info, "ecc corrected segment: %d", buff->segment_id); <> 158             TRACE(ft_t_info, "ecc corrected segment: %d",
      159                   buff->segment_id);
 
140         TRACE_EXIT (mseg.blocks - 3) * FT_SECTOR_SIZE; +-    
141     } else if (ft_ignore_ecc_err) {      
142         TRACE(ft_t_info, ">>> Ignoring ECC failure at segment: %d", buff->segment_id);      
143         ftape->history.crc_failures++;      
 
    <> 291                 ftape->history.defects += 
270                 ftape->history.defects += count_ones(ftape->HEAD->hard_error_map);   292                     count_ones(ftape->HEAD->hard_error_map);
 
296         if (retry > ft_soft_retries) { <> 317         if (retry > FT_RETRIES_ON_ECC_ERROR) {
 
713 #ifdef TESTING <> 734 #if TESTING

   
File: ftape\lowlevel\ftape-write.c  
196     ftape_set_state(ftape, waiting); <> 196     ftape_set_state(ftape, idle);
 
250 #if 0 || defined(HACK) <> 250 #if 0 || HACK
 
358               "not running: %s\n" <> 358               KERN_INFO "not running: %s\n"
359               "tail waiting: %s\n"   359               KERN_INFO "tail waiting: %s\n"
360               "head %p == tail %p\n"   360               KERN_INFO "head %p == tail %p\n"
361               "write_mode %d != FT_WR_ASYNC: %s",   361               KERN_INFO "write_mode %d != FT_WR_ASYNC: %s",

   
File: ftape\lowlevel\fdc-io.h  
    -+ 301 #if LINUX_VERSION_CODE >= KERNEL_VER(2,3,0)
 
    -+ 303 #else
      304     struct wait_queue *wait_intr;
      305 #endif
 
    -+ 319 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 322 #endif

   
File: ftape\lowlevel\ftape-proc.c  
27   <> 27 #include <linux/config.h>
 
    -+ 54 #if LINUX_VERSION_CODE <= KERNEL_VER(2,3,0) /* bail out */
      55 #error This file is for Linux version 2.3.0 or newer
      56 #endif
 
418 int ftape_proc_init(void) <> 421 int __init ftape_proc_init(void)
 
422     if ((proc_ftape = proc_mkdir("ftape", NULL)) == NULL) { <> 425     if ((proc_ftape = proc_mkdir("ftape", &proc_root)) == NULL) {
 
    -+ 431     proc_ftape->owner = THIS_MODULE;

   
File: ftape\lowlevel\ftape-bsm.c  
223         { <> 223 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0)
224             __u16 *u16_ptr = (__u16*)ptr;      
225             while ((sector = get_unaligned(u16_ptr)) != 0) {   224         while ((sector = get_unaligned(((__u16*)ptr)++)) != 0) {
226                 u16_ptr++;      
 
228                       sector, get_unaligned(u16_ptr)); <> 226                   sector, get_unaligned(((__u16*)ptr)++));
229                 u16_ptr++;      
 
    -+ 228 #else
      229         while ((sector = *((__u16*)ptr)++) != 0) {
      230             TRACE(ft_t_noise, "Old ftape eof mark: %4d/%2d",
      231                   sector, *((__u16*)ptr)++);
 
    -+ 233 #endif          

   
File: ftape\lowlevel\ftape-init.c  
    -+ 24 #include <linux/config.h>
 
    -+ 33 #if defined(CONFIG_MODVERSIONS) && ! defined(MODVERSIONS)
      34   #include <linux/modversions.h>
      35   #define MODVERSIONS
      36 #endif
 
53 char ft_src[] = "$RCSfile: ftape-init.c,v $"; <> 58 char ft_src[] __initdata = "$RCSfile: ftape-init.c,v $";
54 char ft_rev[] = "$Revision: 1.28 $";   59 char ft_rev[] __initdata = "$Revision: 1.28 $";
55 char ft_dat[] = "$Date: 2000/06/30 12:02:37 $";   60 char ft_dat[] __initdata = "$Date: 2000/06/30 12:02:37 $";
 
57 int ft_ignore_ecc_err = 0; <> 62 static int ft_ignore_ecc_err = 0;
58 int ft_soft_retries = FT_SOFT_RETRIES;   63 static int ft_soft_retries = FT_SOFT_RETRIES;
 
    -+ 71 #define GLOBAL_TRACING
      72 #include "ftape-real-tracing.h"
 
    -+ 74 #ifdef FT_TRACE_ATTR
      75 # undef FT_TRACE_ATTR
      76 #endif
      77 #define FT_TRACE_ATTR __initlocaldata
 
66 static void ftape_build_driver_list(void) <> 79 static void __init ftape_build_driver_list(void)
 
100 extern int fdc_internal_register(void); <> 113 extern int fdc_internal_register(void) __init;
101 extern void ftape_parport_init(void);   114 extern void ftape_parport_init(void) __init;
 
106 int ftape_init(void) <> 119 int __init ftape_init(void)
 
113     printk(KERN_INFO FTAPE_VERSION " for Linux " UTS_RELEASE); <> 126     printk(KERN_INFO FTAPE_VERSION " for Linux " UTS_RELEASE "\n");
 
115     printk("installing QIC-117 floppy tape driver..."); <> 128     printk("installing QIC-117 floppy tape driver ... \n");
 
    -+ 133 #if (LINUX_VERSION_CODE >= KERNEL_VER(1,2,0) && \
      134      LINUX_VERSION_CODE < KERNEL_VER(2,1,18))
      135     register_symtab(&ftape_symbol_table); /* add global ftape symbols */
      136 #endif
 
    -+ 162 #undef FT_TRACE_ATTR
      163 #define FT_TRACE_ATTR /**/
 
    -+ 165 #ifdef MODULE
 
    -+ 167 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 171 #endif
 
149 module_param_array(ft_fdc_driver, charp, NULL, 0644); <> 173 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
      174 #define FT_MOD_PARM(var,type,desc) \
      175     MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc)
 
    <> 177 FT_MOD_PARM(ft_fdc_driver,     "1-4s",
150 MODULE_PARM_DESC(ft_fdc_driver, "Colon separated list of FDC low level drivers");   178         "Colon separated list of FDC low level drivers");
151     179 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
152 module_param_array(ft_tracings, int, NULL, 0644);   180 FT_MOD_PARM(ft_tracings,        "1-5i",
153 MODULE_PARM_DESC(ft_tracings, "Amount of debugging output, 0 <= tracing <= 8, default 3.");   181         "Amount of debugging output, 0 <= tracing <= 8, default 3.");
      182 #endif
 
156 module_param(ft_ignore_ecc_err, int, 0644); <>    
157 MODULE_PARM_DESC(ft_ignore_ecc_err, "Whether to ignore ECC errors and proceed to the next segment (0 or 1).");   186 FT_MOD_PARM(ft_ignore_ecc_err, "i", "Whether to ignore ECC errors and proceed to the next segment (0 or 1).");
 
159 module_param(ft_soft_retries, int, 0644); <>    
160 MODULE_PARM_DESC(ft_soft_retries, "Number of low-level soft retries (Default=6, set to 1 to skip over bad segments faster.).");   187 FT_MOD_PARM(ft_soft_retries, "i", "Number of low-level soft retries (Default=6, set to 1 to skip over bad segments faster.).");
 
    -+ 198 #endif
 
    -+ 200 #if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13)
      201 char kernel_version[] = UTS_RELEASE;
      202 #endif
 
173 static int ftape_module_init(void) <> 206 int init_module(void)
 
    -+ 208 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 210 #endif
 
178 module_init(ftape_module_init); +-    
 
182 static void __exit ftape_module_exit(void) <> 216 void cleanup_module(void)
 
191         printk(KERN_INFO "ftape: unloaded."); <> 225         printk(KERN_INFO "ftape: unloaded.\n");
 
193 module_exit(ftape_module_exit); <> 227 #endif /* MODULE */
 
    -+ 231 #ifdef FT_TRACE_ATTR
      232 # undef FT_TRACE_ATTR
      233 #endif
      234 #define FT_TRACE_ATTR __initlocaldata
 
197 int ftape_lowlevel_setup(char *str) <> 236 int __init ftape_lowlevel_setup(char *str)
 
199     static int ints[6] = { 0, }; <> 238     static __initlocaldata int ints[6] = { 0, };
 
    -+ 272 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 283 #endif

   
File: ftape\lowlevel\ftape-buffer.c  
    -+ 33 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 35 #endif
 
    -+ 37 #define SEL_TRACING
 
72             "allocated buffer @ %p, %ld bytes", *(void **)new, size); <> 75             "allocated buffer @ %p, %d bytes", *(void **)new, size);
 
81         TRACE(ft_t_noise, "released buffer @ %p, %ld bytes", <> 84         TRACE(ft_t_noise, "released buffer @ %p, %d bytes",
 
    -+ 105 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,127)
      106         current->timeout = HZ/10;
      107         schedule();
      108 #else
 
    -+ 110 #endif
 
113             "allocated buffer @ %p, %ld bytes", new, size); <> 121             "allocated buffer @ %p, %d bytes", new, size);
 
122         TRACE(ft_t_noise, "released buffer @ %p, %ld bytes", <> 130         TRACE(ft_t_noise, "released buffer @ %p, %d bytes",
 
    -+ 137 #define FDC_TRACING
      138 #include "ftape-real-tracing.h"

   
File: ftape\lowlevel\ftape-ctl.h  
    -+ 65 #if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13)
      66 #define _IOC_SIZE(cmd) (((cmd) & IOCSIZE_MASK) >> IOCSIZE_SHIFT)
      67 #define _IOC_DIR(cmd)  (cmd)
      68 #define _IOC_WRITE IOC_IN
      69 #define _IOC_READ  IOC_OUT
      70 #endif
 
    -+ 163 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 169 #endif

   
File: ftape\lowlevel\ftape-real-tracing.h  
    -+ 33 #ifndef  CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 35 #undef FT_TRACE_TOP_LEVEL
 
46 #ifdef FDC_TRACING <> 45 #ifdef FDC_TRACING
47 # define TRACE_SEL fdc->unit   46 # define TRACE_SEL fdc->unit
48 # undef FDC_TRACING   47 # undef FDC_TRACING
49 #elif defined(ZFTAPE_TRACING)   48 #elif defined(ZFTAPE_TRACING)
50 # define TRACE_SEL FTAPE_SEL(zftape->unit)   49 # define TRACE_SEL FTAPE_SEL(zftape->unit)
51 # undef ZFTAPE_TRACING   50 # undef ZFTAPE_TRACING
52 #elif defined(GLOBAL_TRACING)   51 #elif defined(GLOBAL_TRACING)
53 # define TRACE_SEL 4   52 # define TRACE_SEL 4
54 # undef GLOBAL_TRACING   53 # undef GLOBAL_TRACING
55 #elif defined(SEL_TRACING)   54 #elif defined(SEL_TRACING)
56 # define TRACE_SEL sel   55 # define TRACE_SEL sel
57 # undef SEL_TRACING   56 # undef SEL_TRACING
58 #elif defined(ZFTC_TRACING)   57 #elif defined(ZFTC_TRACING)
59 # if defined(CONFIG_ZFT_COMPRESSOR) || defined(CONFIG_ZFT_COMPRESSOR_MODULE)   58 # if defined(CONFIG_ZFT_COMPRESSOR) || defined(CONFIG_ZFT_COMPRESSOR_MODULE)
60 #  define TRACE_SEL FTAPE_SEL(zftc->zftape->unit)   59 #  define TRACE_SEL FTAPE_SEL(zftc->zftape->unit)
61 #  undef ZFTC_TRACING   60 #  undef ZFTC_TRACING
62 # else   61 # else
63 #  error Not configured for reading compressed volumes   62 #  error Not configured for reading compressed volumes
64 # endif   63 # endif
65 #else   64 #else
66 # define TRACE_SEL ftape->drive_sel   65 # define TRACE_SEL ftape->drive_sel
67 #endif   66 #endif
 
    <> 69 #ifndef FT_TRACE_ATTR
69 # define TRACE_SEL 4   70 # define FT_TRACE_ATTR /**/
70     71 #endif
 
    -+ 82 #define FT_TRACE_TOP_LEVEL  ft_t_warn
 
    <> 87     static char ft_trace_msg[] FT_TRACE_ATTR = { m".\n" };  \
85     if (ftape_tracing >= (ft_trace_t)(l)) {     \   88     if (ftape_tracing >= (ft_trace_t)(l) &&         \
      89         (ft_trace_t)(l) <= FT_TRACE_TOP_LEVEL) {        \
 
87                 __FILE__, __func__,     \ <> 91                 __FILE__, __FUNCTION__,     \
 
89         printk(m , ##__VA_ARGS__ );         \ <> 93         printk(ft_trace_msg , ##__VA_ARGS__ );          \
 
    -+ 101 #if defined(CONFIG_FT_FULL_DEBUG)
      102 #define FT_TRACE_TOP_LEVEL ft_t_any
      103 #else
      104 #define FT_TRACE_TOP_LEVEL ft_t_flow
      105 #endif
 
97     static char ft_trace_file[] = __FILE_NAME__;          \ <> 109     static char ft_trace_file[] FT_TRACE_ATTR = {__FILE__};       \
      110     static char ft_trace_function[] FT_TRACE_ATTR = {__FUNCTION__}; \
98     if (ftape_tracing >= (ft_trace_t)(level))                 \   111     if (ftape_tracing >= (ft_trace_t)(level) &&               \
      112         (ft_trace_t)(level) <= FT_TRACE_TOP_LEVEL)                \
 
100                  ft_trace_file, __FUNCTION__,         \ <> 114                  ft_trace_file, ft_trace_function,        \
 
106     if (ftape_tracing >= (ft_trace_t)(_tracing))        \ <> 120     if (ftape_tracing >= (ft_trace_t)(_tracing) &&          \
      121         (ft_trace_t)(_tracing) <= FT_TRACE_TOP_LEVEL)       \
 
108                  ft_trace_file, __FUNCTION__,   \ <> 123                  ft_trace_file, ft_trace_function,  \
 
    <> 129     static char ft_trace_msg[] FT_TRACE_ATTR = { m".\n" };      \
114     if (ftape_tracing >= (ft_trace_t)(l)) {         \   130     if (ftape_tracing >= (ft_trace_t)(l) &&             \
      131         (ft_trace_t)(l) <= FT_TRACE_TOP_LEVEL) {            \
 
116                 ft_trace_file, __FUNCTION__,    \ <> 133                 ft_trace_file, ft_trace_function,   \
 
118         printk(KERN_CONT m, ##__VA_ARGS__ );            \ <> 135         printk(ft_trace_msg , ##__VA_ARGS__ );              \
 
    -+ 143     if ((ft_trace_t)(l) <= FT_TRACE_TOP_LEVEL) {    \
 
    -+ 145     } else {                    \
      146         ftape_tracing = FT_TRACE_TOP_LEVEL; \
      147     }                       \
 
128 #define TRACE_LEVEL                     ftape_tracing <> 149 #define TRACE_LEVEL                                  \
      150 ((ftape_tracing <= FT_TRACE_TOP_LEVEL) ? ftape_tracing : FT_TRACE_TOP_LEVEL)
 
    -+ 152 #endif /* CONFIG_FT_NO_TRACE_AT_ALL */

   
File: ftape\lowlevel\ftape-io.h  
127 extern int ftape_report_rom_version(struct ftape_info *ftape, int *version); +-    
128 extern int ftape_report_signature(struct ftape_info *ftape, int *signature);      

   
File: ftape\lowlevel\ftape-rw.h  
38 #include <linux/version.h> +-    
 
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) <> 39 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0)
 
42 #else +-    
43 #include <linux/unaligned.h>      
44 #endif      
 
    -+ 48 #else
      49 #define GET2(address, offset) *(__u16*)((__u8 *)address + offset)
      50 #define GET4(address, offset) *(__u32*)((__u8 *)address + offset)
      51 #define GET8(address, offset) *(__u64*)((__u8 *)address + offset)
      52 #define PUT2(address, offset , value) *(__u16*)((__u8 *)address + offset) = (__u16)(value)
      53 #define PUT4(address, offset , value) *(__u32*)((__u8 *)address + offset) = (__u32)(value)
      54 #define PUT8(address, offset , value) *(__u64*)((__u8 *)address + offset) = (__u32)(value)
      55 #endif

   
File: ftape\lowlevel\ftape-tracing.c  
68         printk(KERN_INFO "function nest level (%d) < 0", <> 68         printk(KERN_INFO "function nest level (%d) < 0\n",
 
79     printk(KERN_INFO "[%03d] %c%s+%s (%s)", <> 79     printk(KERN_INFO "[%03d] %c%s+%s (%s)\n",
 
95         printk(KERN_INFO "function nest level (%d) < 0", <> 95         printk(KERN_INFO "function nest level (%d) < 0\n",
 
106     printk(KERN_INFO "[%03d] %c%s-%s (%s)", <> 106     printk(KERN_INFO "[%03d] %c%s-%s (%s)\n",
 
122         printk(KERN_INFO "function nest level (%d) <= 0", <> 122         printk(KERN_INFO "function nest level (%d) <= 0\n",

   
File: ftape\lowlevel\ftape-init.h  
32 /* #include <linux/config.h> - not needed in modern kernels */ <> 32 #include <linux/config.h>
 
    -+ 36 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,16)
 
    -+ 38 #else
      39 #define __initdata
      40 #define __initlocaldata
      41 #define __initfunc(__arg) __arg
      42 #define __init
      43 #endif
 
    -+ 45 #if LINUX_VERSION_CODE < KERNEL_VER(2,3,16)
      46 #define set_current_state(newstate) current->state = (newstate)
      47 #endif
 
    -+ 49 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,68)
 
42 static inline void ft_sigblockall(sigset_t * oldmask) <> 53 extern inline void ft_sigblockall(sigset_t * oldmask)
 
44        sigset_t newmask; <> 55        spin_lock_irq(&current->sighand->siglock);
45        sigfillset(&newmask);      
46        sigdelset(&newmask, SIGKILL);      
47        sigdelset(&newmask, SIGSTOP);      
48        sigdelset(&newmask, SIGINT);      
 
50        current->blocked = newmask; <> 57        sigfillset(&current->blocked);
      58        sigdelset(&current->blocked, SIGKILL);
      59        sigdelset(&current->blocked, SIGSTOP);
      60        sigdelset(&current->blocked, SIGINT);
 
    -+ 62        spin_unlock_irq(&current->sighand->siglock);
 
53 static inline void ft_sigrestore(sigset_t* oldmask) <> 64 extern inline void ft_sigrestore(sigset_t* oldmask)
 
    -+ 66        spin_lock_irq(&current->sighand->siglock);
 
    -+ 69        spin_unlock_irq(&current->sighand->siglock);
 
58 static inline int ft_sigtest(unsigned long mask) <> 71 extern inline int ft_sigtest(unsigned long mask)
 
60     return signal_pending(current) ? 1 : 0; <> 73     return (current->sigpending & mask);
 
62 static inline int ft_killed(void) <> 75 extern inline int ft_killed(void)
 
    -+ 80 #else
 
    -+ 82 #define _FT_S(nr) (1<<((nr)-1))
      83 #define _NEVER_BLOCK    (_FT_S(SIGKILL)|_FT_S(SIGSTOP))
      84 #define _DONT_BLOCK     (_NEVER_BLOCK|_FT_S(SIGINT))
      85 #define _BLOCK_ALL      (0xffffffffL)
 
    -+ 87 extern inline void ft_sigblockall(sigset_t *oldset)
      88 {
      89     *oldset = current->blocked;
      90     current->blocked = _BLOCK_ALL;
      91 }
      92 extern inline void ft_sigrestore(sigset_t *oldset)
      93 {
      94     current->blocked = *oldset;
      95 }
      96 extern inline int ft_sigtest(unsigned long mask)
      97 {
      98     return (current->signal & mask) != 0;
      99 }
      100 extern inline int ft_killed(void)
      101 {
      102     return (current->signal & ~current->blocked) != 0;
      103 }
 
    -+ 105 #endif
 
    -+ 113 #if defined(MODULE) && LINUX_VERSION_CODE <= KERNEL_VER(1,2,13)
      114 extern char kernel_version[];
      115 #endif
 
    -+ 117 #ifdef CONFIG_SMP
      118 # define FT_SMP_STRING "SMP"
      119 #else
      120 # define FT_SMP_STRING "UP"
      121 #endif
 
79 "(c) 1996-2000 Claus-Justus Heine <heine@instmath.rwth-aachen.de)\n"         \ <> 127 "(c) 1996-2000 Claus-Justus Heine <heine@instmath.rwth-aachen.de)\n\n"       \
80 "(c) 2025 Dmitry Brant (me@dmitrybrant.com)\n\n"         \      
81 "QIC-117 driver for QIC-40/80/3010/3020/Ditto 2GB/MAX floppy tape drives.\n"   128 "QIC-117 driver for QIC-40/80/3010/3020/Ditto 2GB/MAX floppy tape drives.\n" \
      129 "Compiled for Linux version "UTS_RELEASE" ("FT_SMP_STRING").\n"

   
File: ftape\lowlevel\ftape_syms.c  
28   <> 28 #include <linux/config.h>
 
    -+ 104 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
109 /* from ftape-init.c */ <> 110 #endif
110 extern int ft_ignore_ecc_err;      
111 extern int ft_soft_retries;      
112 EXPORT_SYMBOL_GPL(ft_ignore_ecc_err);      
113 EXPORT_SYMBOL_GPL(ft_soft_retries);      

   
File: ftape\lowlevel\ftape-tracing.h  
31 /* #include <linux/config.h> - not needed in modern kernels */ <> 31 #include <linux/config.h>
 
    -+ 67 #ifdef  CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 71 #define FT_TRACE_TOP_LEVEL  ft_t_bug
      72 #include "../lowlevel/ftape-fake-tracing.h"
 
    -+ 74 #else
 
72 extern ft_trace_t ftape_tracings[5]; <> 81 ft_trace_t ftape_tracings[5];
      82 #if LINUX_VERSION_CODE < KERNEL_VER(2,0,0)
      83 typedef int atomic_t;
      84 #define atomic_inc(p) ++(*p)
      85 #define atomic_dec(p) (*p)--
      86 #endif
      87 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,0)
      88 #define atomic_read(p) *(p)
      89 #define atomic_set(p, val) *(p) = (val)
      90 #endif
73 extern atomic_t ftape_function_nest_levels[5];   91 atomic_t ftape_function_nest_levels[5];
 
80                  int sel); <> 98                  int sel) __attribute__ ((const));
 
84                  int sel); <> 102                  int sel) __attribute__ ((const));
 
    -+ 106                  int sel) __attribute__ ((const));
 
88                  int sel); <> 108 #endif /* !defined(CONFIG_FT_NO_TRACE_AT_ALL) */

   
File: ftape\lowlevel\ftape-bsm.h  
50 } __attribute__((packed)) SectorCount; <> 50 } SectorCount __attribute__((packed));

   
File: ftape\lowlevel\ftape-format.h  
33 } __attribute__((packed)) ft_format_sector; <> 33 } ft_format_sector __attribute__ ((packed));
 
37 } __attribute__((packed)) ft_format_segment; <> 37 } ft_format_segment __attribute__ ((packed));

   
File: ftape\lowlevel\ftape_syms.h  
    -+ 31 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      32 #include <linux/module.h>
 
    -+ 36 extern struct symbol_table ftape_symbol_table;
 
    -+ 39 #endif

   
File: ftape\lowlevel\ftape-proc.h  
32 extern int  ftape_proc_init(void); <> 32 extern int  ftape_proc_init(void) __init;

   
File: ftape\zftape\zftape-ctl.c  
27   <> 27 #include <linux/config.h>
 
    -+ 36 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6)
 
    -+ 38 #else
      39 #include <asm/segment.h>
      40 #endif
 
    -+ 42 #define ZFTAPE_TRACING
 
179         ftape_set_state(zftape->ftape, waiting); <> 184         ftape_set_state(zftape->ftape, idle);
 
425           "new_seg_pos : %d\n" <> 430           KERN_INFO "new_seg_pos : %d\n"
426           "new_tape_pos: " LL_X "\n"   431           KERN_INFO "new_tape_pos: " LL_X "\n"
427           "volume_pos  : " LL_X "\n"   432           KERN_INFO "volume_pos  : " LL_X "\n"
428           "vol_size    : " LL_X "\n"   433           KERN_INFO "vol_size    : " LL_X "\n"
429           "seg_byte_pos: %d\n"   434           KERN_INFO "seg_byte_pos: %d\n"
430           "blk_sz  : %d",    435           KERN_INFO "blk_sz  : %d", 
 
    -+ 894 #define SEL_TRACING
      895 #include "../lowlevel/ftape-real-tracing.h"
 
921             zftape->qic_mode = (dev_minor & ZFT_RAW_MODE) ? 0 : 1; <> 928             zftape->qic_mode = 1; /* default: use vtbl */
922             TRACE(ft_t_info, "Opening in qic_mode: %d", zftape->qic_mode);      
 
934             if (zftape->qic_mode == 0) { +-    
935                 zft_reset_position(zftape, &zftape->pos);      
936             }      
 
    -+ 949 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 952 #endif
 
    -+ 965 #if CONFIG_ZFT_OBSOLETE
      966         else if ((old_unit & ZFT_RAW_MODE)
      967              !=
      968              (dev_minor & ZFT_RAW_MODE)) {
      969             if (dev_minor & ZFT_RAW_MODE) {
      970                 zftape->qic_mode = 0;
      971             }
      972             zft_reset_position(zftape, &zftape->pos);
      973         }
      974 #endif
 
    -+ 1040 #define ZFTAPE_TRACING
      1041 #include "../lowlevel/ftape-real-tracing.h"
 
1092               "header segments need updating: %s\n" <> 1107               KERN_INFO "header segments need updating: %s\n"
1093               "tape not at BOT              : %s",   1108               KERN_INFO "tape not at BOT              : %s",
 
    -+ 1343 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 1347 #else
      1348     TRACE_CATCH(verify_area(VERIFY_WRITE, mtftseg->mt_data,
      1349                 mtftseg->mt_result),);
      1350     memcpy_tofs(mtftseg->mt_data, buffer, mtftseg->mt_result);
      1351 #endif
 
    -+ 1409 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 1415 #else
      1416         TRACE_CATCH(verify_area(VERIFY_READ, 
      1417                     mtftseg->mt_data, 
      1418                     FT_SEGMENT_SIZE),);
      1419         memcpy_fromfs(zftape->deblock_buf, mtftseg->mt_data,
      1420                   FT_SEGMENT_SIZE);
      1421 #endif
 
1466           "Mag tape ioctl command: MTIOC_ZTAPE_GETBLKSZ\n" <> 1495           KERN_INFO "Mag tape ioctl command: MTIOC_ZTAPE_GETBLKSZ\n"
1467           "This ioctl is here merely for compatibility.\n"   1496           KERN_INFO "This ioctl is here merely for compatibility.\n"
1468           "Please use MTIOCVOLINFO instead");   1497           KERN_INFO "Please use MTIOCVOLINFO instead");
 
    -+ 1860 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 1864 #else
      1865         TRACE_CATCH(verify_area(VERIFY_READ, arg, arg_size),);
      1866         memcpy_fromfs(&krnl_arg, arg, arg_size);
      1867 #endif
 
    -+ 1925 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 1929 #else
      1930         TRACE_CATCH(verify_area(VERIFY_WRITE, arg, arg_size),);
      1931         memcpy_tofs(arg, &krnl_arg, arg_size);
      1932 #endif

   
File: ftape\zftape\zftape-vtbl.c  
    -+ 36 #define ZFTAPE_TRACING
 
48 void zft_create_volume_headers(zftape_info_t *zftape, __u8 *buffer); +-    
 
406                   "QIC compression (Rev = K): %x\n" <> 403                   KERN_INFO "QIC compression (Rev = K): %x\n"
407                   "QIC compression (Rev > K): %x",   404                   KERN_INFO "QIC compression (Rev > K): %x",
 
714           "zftape->seg_pos     : %d\n" <> 711           KERN_INFO "zftape->seg_pos     : %d\n"
715           "zftape->seg_byte_pos: %d\n"   712           KERN_INFO "zftape->seg_byte_pos: %d\n"
716           "zftape->tape_pos    : " LL_X "\n"   713           KERN_INFO "zftape->tape_pos    : " LL_X "\n"
717           "zftape->volume_pos  : " LL_X "\n"   714           KERN_INFO "zftape->volume_pos  : " LL_X "\n"
718           "file number         : %d",   715           KERN_INFO "file number         : %d",

   
File: ftape\zftape\zftape-write.c  
27   <> 27 #include <linux/config.h>
 
    -+ 34 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6)
 
    -+ 36 #else
      37 #include <asm/segment.h>
      38 #endif
 
    -+ 40 #define ZFTAPE_TRACING
 
383           "hard_error_cnt: %d\n" <> 388           KERN_INFO "hard_error_cnt: %d\n"
384           "space_left    : %d\n"   389           KERN_INFO "space_left    : %d\n"
385           "seg_size      : %d\n"   390           KERN_INFO "seg_size      : %d\n"
386           "seg_byte_pos  : %d\n"   391           KERN_INFO "seg_byte_pos  : %d\n"
387           "pad_cnt       : %d",   392           KERN_INFO "pad_cnt       : %d",
 
485               "seg_pos  : %d\n" <> 490               KERN_INFO "seg_pos  : %d\n"
486               "byte pos : %d",   491               KERN_INFO "byte pos : %d",
 
597                   "This might be normal when using " <> 602                   KERN_INFO "This might be normal when using "
 
620           "remaining req_len: %d\n" <> 625           KERN_INFO "remaining req_len: %d\n"
621           "          buf_pos: %d",    626           KERN_INFO "          buf_pos: %d", 
 
    -+ 640 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 644 #else
      645     TRACE_CATCH(verify_area(VERIFY_READ, usr_buf, cnt),);
      646     memcpy_fromfs(dst_buf + pos->seg_byte_pos, usr_buf, cnt);
      647 #endif
 
642           "removed from user-buffer : %d bytes.\n" <> 652           KERN_INFO "removed from user-buffer : %d bytes.\n"
643           "zft_tape_pos             : " LL_X " bytes.",   653           KERN_INFO "zft_tape_pos             : " LL_X " bytes.",

   
File: ftape\zftape\zftape-init.c  
23   <> 23 #include <linux/config.h>
 
33   <> 33 #include <linux/wrapper.h>
 
37 /* Modern device node creation using device class */ <> 37 #if LINUX_VERSION_CODE >= KERNEL_VER(2,3,46)
38 #include <linux/device.h>   38 # include <linux/devfs_fs_kernel.h>
 
40 static struct class *ftape_class; <> 40 static devfs_handle_t ftape_devfs_handle;
      41 static devfs_handle_t devfs_handle[4];
 
    -+ 43 static devfs_handle_t devfs_q[4];
      44 static devfs_handle_t devfs_qn[4];
      45 # if defined(CONFIG_ZFT_COMPRESSOR) || defined(CONFIG_ZFT_COMPRESSOR_MODULE)
      46 static devfs_handle_t devfs_zq[4];
      47 static devfs_handle_t devfs_zqn[4];
      48 # endif 
      49 # if CONFIG_ZFT_OBSOLETE
      50 static devfs_handle_t devfs_raw[4];
      51 static devfs_handle_t devfs_rawn[4];
      52 # endif
 
    -+ 54 #endif
 
    -+ 56 #define SEL_TRACING
 
49 char zft_src[] = "$RCSfile: zftape-init.c,v $"; <> 64 char zft_src[] __initdata = "$RCSfile: zftape-init.c,v $";
50 char zft_rev[] = "$Revision: 1.38 $";   65 char zft_rev[] __initdata = "$Revision: 1.38 $";
51 char zft_dat[] = "$Date: 2000/07/20 13:18:05 $";   66 char zft_dat[] __initdata = "$Date: 2000/07/20 13:18:05 $";
 
    -+ 70 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
56     module_param(var, int, 0644); MODULE_PARM_DESC(var,desc) <> 72     MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc)
 
62 /* MODULE_SUPPORTED_DEVICE is deprecated - removed */ <> 78 MODULE_SUPPORTED_DEVICE("char-major-27");
 
65   <> 81 #endif
 
    -+ 104 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
 
    <> 106 #else
89 static long zft_ioctl(struct file *filep, unsigned int command, unsigned long arg);   107 static void zft_close(struct inode *ino, struct file *filep);
      108 #endif
      109 static int  zft_ioctl(struct inode *ino, struct file *filep,
      110               unsigned int command, unsigned long arg);
      111 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 
    -+ 116 #elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
      117 static long zft_read (struct inode *ino, struct file *fp, char *buff,
      118               unsigned long req_len);
      119 static long zft_write(struct inode *ino, struct file *fp, const char *buff,
      120               unsigned long req_len);
      121 #else
      122 static int  zft_read (struct inode *ino, struct file *fp, char *buff,
      123               int req_len); 
      124 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,0)
      125 static int  zft_write(struct inode *ino, struct file *fp, const char *buff,
      126               int req_len);
      127 #else
      128 static int  zft_write(struct inode *ino, struct file *fp, char *buff,
      129               int req_len);
      130 #endif
      131 #endif
      132 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 
    -+ 134 #else
      135 static int zft_seek(struct inode *, struct file *, off_t, int);
      136 #endif
 
96 static struct file_operations zft_cdev = { <> 138 static struct file_operations zft_cdev =
      139 {
      140 #if LINUX_VERSION_CODE >= KERNEL_VER(2,4,0)
97     .owner = THIS_MODULE,   141     owner:      THIS_MODULE,
      142 #endif
      143 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
98     .llseek = zft_seek,   144     llseek:     zft_seek,
      145 #else
      146     lseek:      zft_seek,
      147 #endif
99     .read = zft_read,   148     read:       zft_read,
100     .write = zft_write,   149     write:      zft_write,
101     .unlocked_ioctl = zft_ioctl,   150     ioctl:      zft_ioctl,
102     .open = zft_open,   151     open:       zft_open,
103     .release = zft_close,   152     release:    zft_close,
 
115     if (!try_module_get(THIS_MODULE)) <> 164     MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
116         return -ENODEV;   165                 *  locking is done with can_unload()
 
120         module_put(THIS_MODULE); <> 169         MOD_DEC_USE_COUNT;
 
129         module_put(THIS_MODULE); /* unlock module in memory */ <> 178         MOD_DEC_USE_COUNT; /* unlock module in memory */
 
138         module_put(THIS_MODULE); /* unlock module in memory */ <> 187         MOD_DEC_USE_COUNT; /* unlock module in memory */
 
    <> 192         MOD_DEC_USE_COUNT;
      193 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,50)
      194 #if 1 || ZFT_PARANOID
143         module_put(THIS_MODULE);   195         if (!MOD_IN_USE) {
      196             TRACE(ft_t_err, "Geeh! Use count is 0!: 0x%08x",
      197                   mod_use_count_);
 
    -+ 199         }
      200 #endif
      201 #endif
 
    -+ 208 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
 
    -+ 210 #else
      211 static void zft_close(struct inode *ino, struct file *filep)
      212 #endif
 
    -+ 222 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
 
    -+ 224 #else
      225         TRACE_EXIT; /* keep busy_flag !! */
      226 #endif
 
    -+ 234 #if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      235     if (!zft_dirty(zftape)) {
      236         MOD_DEC_USE_COUNT; /* unlock module in memory */
      237     }
      238 #endif
 
169     module_put(THIS_MODULE); <> 240 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
 
    -+ 242 #else
      243     TRACE_EXIT;
      244 #endif
 
175 static int _zft_ioctl_old(struct inode *ino, struct file *filep, <> 249 static int zft_ioctl(struct inode *ino, struct file *filep,
 
198 static long zft_ioctl(struct file *filep, unsigned int command, unsigned long arg) +-    
199 {      
200     return _zft_ioctl_old(file_inode(filep), filep, command, arg);      
201 }      
 
    -+ 273 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 
    -+ 276 #elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
      277 static long zft_read(struct inode *ino, struct file *fp, char *buff,
      278              unsigned long req_len)
      279 #else
      280 static int  zft_read(struct inode *ino, struct file *fp, char *buff,
      281              int req_len)
      282 #endif
 
    <> 286 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
210     struct inode *ino = file_inode(fp);   287     struct inode *ino = fp->f_dentry->d_inode;
      288 #endif
 
    <> 295 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
217     if (*ppos != fp->f_pos) {   296     if (ppos != &fp->f_pos) {
218         TRACE(ft_t_warn, "file offset different from device offset: %ld != %ld", (long)*ppos, (long)(fp->f_pos));   297         /* "A request was outside the capabilities of the device." */
219         // TRACE_EXIT -ENXIO;   298         TRACE_EXIT -ENXIO;
 
    -+ 300 #endif
 
    -+ 317 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 
    -+ 320 #elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
      321 static long zft_write(struct inode *ino, struct file *fp, const char *buff,
      322               unsigned long req_len)
      323 #elif LINUX_VERSION_CODE >= KERNEL_VER(1,3,0)
      324 static int  zft_write(struct inode *ino, struct file *fp, const char *buff,
      325               int req_len)
      326 #else
      327 static int  zft_write(struct inode *ino, struct file *fp, char *buff,
      328               int req_len)
      329 #endif
 
    <> 333 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
242     struct inode *ino = file_inode(fp);   334     struct inode *ino = fp->f_dentry->d_inode;
      335 #endif
 
248   <> 341 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
249     if (*ppos != fp->f_pos) {   342     if (ppos != &fp->f_pos) {
250         TRACE(ft_t_warn, "file offset different from device offset: %ld != %ld", (long)*ppos, (long)(fp->f_pos));   343         /* "A request was outside the capabilities of the device." */
251         // TRACE_EXIT -ENXIO;   344         TRACE_EXIT -ENXIO;
 
253   <> 346 #endif
 
    -+ 360 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 
    -+ 362 #else
      363 static int zft_seek(struct inode * inode, struct file * file, off_t offset, int origin)
      364 #endif
 
    -+ 378 #define GLOBAL_TRACING
      379 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 435 #ifdef FT_TRACE_ATTR
      436 # undef FT_TRACE_ATTR
      437 #endif
      438 #define FT_TRACE_ATTR __initlocaldata
 
335 static int zft_device_register(void) <> 440 static int __init zft_devfs_register(void)
 
    -+ 442 #if LINUX_VERSION_CODE < KERNEL_VER(2,3,46)
      443     TRACE_FUN(ft_t_flow);
 
    -+ 445     TRACE_CATCH(register_chrdev(ft_major_device_number,
      446                     "zft", &zft_cdev),);
      447 #else
 
340     TRACE_CATCH(register_chrdev(ft_major_device_number, "zft", &zft_cdev),); <> 451     TRACE_CATCH(devfs_register_chrdev(ft_major_device_number,
341       452                       "zft", &zft_cdev),);
342     ftape_class = class_create("ftape");      
343     if (IS_ERR(ftape_class)) {      
344         unregister_chrdev(ft_major_device_number, "zft");   453     ftape_devfs_handle = devfs_mk_dir(NULL, "ftape", NULL);
345         TRACE_ABORT(PTR_ERR(ftape_class), ft_t_err, "class_create failed");      
346     }      
 
349         /* Standard tape devices (rewind) */ <> 456         char tmpname[40];
350         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel),   457  
351                  NULL, "qft%d", sel);   458         sprintf(tmpname, "%d", sel);
      459         devfs_handle[sel] = devfs_mk_dir(ftape_devfs_handle,
      460                          tmpname, NULL);
 
353         /* No-rewind tape device */ <> 462         devfs_q[sel] = devfs_register(devfs_handle[sel], "mt",
354         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel|FTAPE_NO_REWIND),   463                           DEVFS_FL_DEFAULT,
355                  NULL, "nqft%d", sel);   464                           ft_major_device_number,
356     465                           sel,
357         /* Raw mode devices */   466                           S_IFCHR | S_IRUSR | S_IWUSR,
358         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel|ZFT_RAW_MODE),      
359                  NULL, "rawqft%d", sel);   467                           &zft_cdev, NULL);
360     468         devfs_qn[sel] = devfs_register(devfs_handle[sel], "mtn",
361         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel|ZFT_RAW_MODE|FTAPE_NO_REWIND),   469                            DEVFS_FL_DEFAULT,
      470                            ft_major_device_number,
      471                            sel|FTAPE_NO_REWIND ,
      472                            S_IFCHR | S_IRUSR | S_IWUSR,
362                  NULL, "nrawqft%d", sel);   473                            &zft_cdev, NULL);
 
365         /* Compressed tape devices */ <> 476         devfs_zq[sel] =
366         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel|ZFT_ZIP_MODE),   477             devfs_register(devfs_handle[sel], "mtz",
      478                        DEVFS_FL_DEFAULT,
      479                        ft_major_device_number,
      480                        sel|ZFT_ZIP_MODE,
      481                        S_IFCHR | S_IRUSR | S_IWUSR,
367                  NULL, "zftape%d", sel);   482                        &zft_cdev, NULL);
      483         devfs_zqn[sel] =
      484             devfs_register(devfs_handle[sel], "mtzn",
      485                        DEVFS_FL_DEFAULT,
      486                        ft_major_device_number,
      487                        sel|ZFT_ZIP_MODE|FTAPE_NO_REWIND,
      488                        S_IFCHR | S_IRUSR | S_IWUSR,
      489                        &zft_cdev, NULL);
368           490 # endif
369         device_create(ftape_class, NULL, MKDEV(ft_major_device_number, sel|ZFT_ZIP_MODE|FTAPE_NO_REWIND),   491 # if CONFIG_ZFT_OBSOLETE
      492         devfs_raw[sel] =
      493             devfs_register(devfs_handle[sel], "mtr",
      494                        DEVFS_FL_DEFAULT,
      495                        ft_major_device_number,
      496                        sel|ZFT_RAW_MODE,
      497                        S_IFCHR | S_IRUSR | S_IWUSR,
370                  NULL, "nzftape%d", sel);   498                        &zft_cdev, NULL);
      499         devfs_rawn[sel] =
      500             devfs_register(devfs_handle[sel], "mtrn",
      501                        DEVFS_FL_DEFAULT,
      502                        ft_major_device_number,
      503                        sel|ZFT_RAW_MODE|FTAPE_NO_REWIND,
      504                        S_IFCHR | S_IRUSR | S_IWUSR,
      505                        &zft_cdev, NULL);
 
    -+ 507         devfs_register_tape(devfs_q[sel]);
 
    -+ 509 #endif
 
379 int zft_init(void) <> 516 int __init zft_init(void)
 
384     printk(ZFTAPE_VERSION); <> 521     printk(KERN_INFO ZFTAPE_VERSION "\n");
 
    <> 523         printk(
      524 KERN_INFO
386         printk("(c) 1996-2000 Claus-Justus Heine <heine@instmath.rwth-aachen.de>");   525 "(c) 1996-2000 Claus-Justus Heine <heine@instmath.rwth-aachen.de>\n"
387         printk("(c) 2025 Dmitry Brant <me@dmitrybrant.com>");   526 KERN_INFO
388         printk("vfs interface for ftape floppy tape driver.");   527 "vfs interface for ftape floppy tape driver.\n"
      528 KERN_INFO
389         printk("Support for QIC-113 compatible volume table.");   529 "Support for QIC-113 compatible volume table.\n"
      530 KERN_INFO
      531 "Compiled for Linux version %s"
      532 #ifdef MODVERSIONS
      533                " with versioned symbols"
      534 #endif
      535                "\n", UTS_RELEASE);
 
393     printk(ZFTAPE_VERSION " for Linux"); <> 539     printk(KERN_INFO ZFTAPE_VERSION " for Linux " UTS_RELEASE "\n");
 
    <> 542     TRACE(ft_t_info,
396     TRACE(ft_t_info, "installing zftape VFS interface for ftape driver ...");   543           "installing zftape VFS interface for ftape driver ...");
 
398     TRACE_CATCH(zft_device_register(),); <> 544     TRACE_CATCH(zft_devfs_register(),);
 
403   <> 549 # if LINUX_VERSION_CODE >= KERNEL_VER(1,2,0) &&\
      550      LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      551     register_symtab(&zft_symbol_table); /* add global zftape symbols */
404 #endif /* CONFIG_ZFT_COMPRESSOR */   552 # endif
 
406     TRACE_EXIT 0; +-    
407 }      
 
409 static void zft_device_unregister(void) +-    
410 {      
411     int sel;      
412     TRACE_FUN(ft_t_flow);      
 
414     if (ftape_class) { <>    
415         for (sel = 0; sel < 4; sel++) {      
416             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel));      
417             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel|FTAPE_NO_REWIND));      
418             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel|ZFT_RAW_MODE));      
419             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel|ZFT_RAW_MODE|FTAPE_NO_REWIND));      
420 # if defined(CONFIG_ZFT_COMPRESSOR) || defined(CONFIG_ZFT_COMPRESSOR_MODULE)      
421             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel|ZFT_ZIP_MODE));      
422             device_destroy(ftape_class, MKDEV(ft_major_device_number, sel|ZFT_ZIP_MODE|FTAPE_NO_REWIND));      
423 # endif   553 #endif /* CONFIG_ZFT_COMPRESSOR */
424         }   554  
425         class_destroy(ftape_class);      
426         ftape_class = NULL;      
427     }      
428     unregister_chrdev(ft_major_device_number, "zft");      
429     TRACE_EXIT;   555     TRACE_EXIT 0;
 
    -+ 558 #undef FT_TRACE_ATTR
      559 #define FT_TRACE_ATTR /**/
 
    <> 562 # if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) && defined(MODULE)
      563 char kernel_version[] = UTS_RELEASE;
433     564 # endif
      565 # if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
449   <> 581 # endif
 
455     /* EXPORT_NO_SYMBOLS is deprecated - no global exports by default */ <> 587 #  if LINUX_VERSION_CODE >= KERNEL_VER(1,1,85) && \
      588      LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      589     register_symtab(0); /* remove global ftape symbols */
      590 #  else
      591     EXPORT_NO_SYMBOLS;
      592 #  endif
 
457 /* Module unloading API modernized - old can_unload interface removed */ <> 594 # if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
      595     if (!mod_member_present(&__this_module, can_unload)) {
      596         return -EBUSY;
      597     }
      598     __this_module.can_unload = can_unload;
      599 # endif
 
468     zft_device_unregister(); <> 610 # if LINUX_VERSION_CODE >= KERNEL_VER(2,3,46)
469     TRACE(ft_t_info, "unregistered character device and device nodes");   611     if (devfs_unregister_chrdev(ft_major_device_number, "zft") != 0) {
      612         TRACE(ft_t_warn, "failed");
      613     } else {
      614         TRACE(ft_t_info, "successful");
470     615     }
      616 # else
      617     if (unregister_chrdev(ft_major_device_number, "zft") != 0) {
      618         TRACE(ft_t_warn, "failed");
      619     } else {
      620         TRACE(ft_t_info, "successful");
      621     }
      622 # endif
 
    -+ 629 # if LINUX_VERSION_CODE >= KERNEL_VER(2,3,46)
      630         devfs_unregister (devfs_q[sel]);
      631         devfs_q[sel] = NULL;
      632         devfs_unregister (devfs_qn[sel]);
      633         devfs_qn[sel] = NULL;
      634 #  if defined(CONFIG_ZFT_COMPRESSOR) || defined(CONFIG_ZFT_COMPRESSOR_MODULE)
      635         devfs_unregister(devfs_zq[sel]);
      636         devfs_zq[sel] = NULL;
      637         devfs_unregister(devfs_zqn[sel]);
      638         devfs_zqn[sel] = NULL;
      639 #  endif
      640 #  ifdef CONFIG_ZFT_OBSOLETE
      641         devfs_unregister(devfs_raw[sel]);
      642         devfs_raw[sel] = NULL;
      643         devfs_unregister(devfs_rawn[sel]);
      644         devfs_rawn[sel] = NULL;
      645 #endif
      646         devfs_unregister(devfs_handle[sel]);
      647         devfs_handle[sel] = NULL;
      648 # endif
 
    <> 650 # if LINUX_VERSION_CODE >= KERNEL_VER(2,3,46)
      651     devfs_unregister(ftape_devfs_handle);
      652     ftape_devfs_handle = NULL;
      653 # endif
478         printk(KERN_INFO "zftape successfully unloaded.");   654         printk(KERN_INFO "zftape successfully unloaded.\n");
 
482 #endif /* MODULE */ +-    
 
    -+ 660 #endif /* MODULE */

   
File: ftape\zftape\zftape-read.c  
27   <> 27 #include <linux/config.h>
 
    -+ 33 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6)
 
    -+ 35 #else
      36 #include <asm/segment.h>
      37 #endif
 
    -+ 39 #define ZFTAPE_TRACING
 
    -+ 270 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 275 #else
      276         TRACE_CATCH(verify_area(VERIFY_WRITE, usr_buf, cnt),);
      277         memcpy_tofs(usr_buf, src_buf +  pos->seg_byte_pos, cnt);
      278 #endif

   
File: ftape\zftape\zftape-rw.c  
    -+ 31 #define ZFTAPE_TRACING
 
86               "Wrong combination of minor device bits.\n" <> 88               KERN_INFO "Wrong combination of minor device bits.\n"
87               "Bailing out.");   89               KERN_INFO "Bailing out.");
 
270         TRACE(ft_t_noise, "\nremaining: %d\nseg_sz   : %d\nsegment  : %d", <> 272         TRACE(ft_t_noise, "\n"
      273               KERN_INFO "remaining: %d\n"
      274               KERN_INFO "seg_sz   : %d\n"
      275               KERN_INFO "segment  : %d",
 
    <> 298             TRACE(ft_t_err, "Error: "
293             TRACE(ft_t_err, "Error: Couldn't write segment %d", seg_pos);   299                   "Couldn't write segment %d", seg_pos);
 
    <> 325             TRACE_ABORT(-EIO, ft_t_err,
319             TRACE_ABORT(-EIO, ft_t_err, "Failed to verify written segment %d", seg_pos);   326                     "Failed to verify written segment %d",
      327                     seg_pos);
 
322         TRACE(ft_t_noise, "verify successful:\nsegment  : %d\nsegsize  : %d\nremaining: %d", <> 330         TRACE(ft_t_noise, "verify successful:\n"
      331               KERN_INFO "segment  : %d\n"
      332               KERN_INFO "segsize  : %d\n"
      333               KERN_INFO "remaining: %d",

   
File: ftape\zftape\zftape-vtbl.h  
150           "description  : %s\n"             \ <> 150           KERN_INFO "description  : %s\n"               \
151           "first segment: %d\n"             \   151           KERN_INFO "first segment: %d\n"               \
152           "last  segment: %d\n"             \   152           KERN_INFO "last  segment: %d\n"               \
153           "size         : " LL_X "\n"           \   153           KERN_INFO "size         : " LL_X "\n"         \
154           "rawsize      : " LL_X "\n"           \   154           KERN_INFO "rawsize      : " LL_X "\n"         \
155           "block size   : %d\n"             \   155           KERN_INFO "block size   : %d\n"               \
156           "version      : %d\n"             \   156           KERN_INFO "version      : %d\n"               \
157           "offset       : %d\n"             \   157           KERN_INFO "offset       : %d\n"               \
158           "compression  : %d\n"             \   158           KERN_INFO "compression  : %d\n"               \
159           "zftape volume: %d\n"             \   159           KERN_INFO "zftape volume: %d\n"               \
160           "QIC-113 conf.: %d",              \   160           KERN_INFO "QIC-113 conf.: %d",                \

   
File: ftape\zftape\zftape-eof.c  
    -+ 35 #define ZFTAPE_TRACING
 
    -+ 117 #if LINUX_VERSION_CODE >= KERNEL_VER(2,0,0)
 
115             ptr += sizeof(__u32); <> 119             ++(__u32*)ptr;
 
    -+ 123 #else
      124         if (*(__u32*)ptr) {
      125             ++(__u32*)ptr;
      126         } else {
      127             return ptr;
      128         }
      129 #endif

   
File: ftape\zftape\zftape-ctl.h  
30 /* #include <linux/config.h> - not needed in modern kernels */ <> 30 #include <linux/config.h>
 
    -+ 112 #ifndef CONFIG_FT_NO_TRACE_AT_ALL
 
    -+ 115 #endif

   
File: ftape\zftape\zftape-buffers.c  
    -+ 33 #define ZFTAPE_TRACING

   
File: ftape\zftape\zftape_syms.c  
27   <> 27 #include <linux/config.h>

   
File: ftape\zftape\zftape_syms.h  
    -+ 31 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      32 #include <linux/module.h>
 
    -+ 36 extern struct symbol_table zft_symbol_table;
 
    -+ 39 #endif

   
File: ftape\parport\bpck-fdc.c  
25   <> 25 #include <linux/config.h>
 
    -+ 35 #include <asm/system.h>
 
37 #include <linux/uaccess.h> <> 38 #include <asm/segment.h>
 
    -+ 43 #define FDC_TRACING
 
62 int ecr_bits = 0x01; /* what to write to econtrol (changed to int for module_param) */ <> 64 __u8 ecr_bits = 0x01; /* what to write to econtrol */
 
64 int parport_proto = ft_bpck_none; /* parport protocol (changed to int for module_param) */ <> 66 ft_bpck_proto_t parport_proto = ft_bpck_none;
 
97   <> 99 #define GLOBAL_TRACING
98 int bpck_fdc_grab(fdc_info_t *fdc);   100 #include "../lowlevel/ftape-real-tracing.h"
99 int bpck_fdc_register(void);      
100 int bpck_fdc_unregister(void);      
 
    -+ 102 #define inline /**/
 
    <> 348               r,
347               r, *ov & 0xff, ov[1] & 0xff, ov[2] & 0xff, ov[3] & 0xff);   349               *ov++ & 0xff, ov[1] & 0xff, ov[2] & 0xff, ov[3] & 0xff);
 
612             *(__u16 *)data = r4w(); data += 2; <> 614             *((__u16 *)data)++ = r4w();
 
621             *(__u32 *)data = r4l(); data += 4; <> 623             *((__u32 *)data)++ = r4l();
 
    -+ 1116 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 1118 #else
      1119 static void bpck_fdc_interrupt(int irq, struct pt_regs *regs)
      1120 #endif
 
    -+ 1122 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 1124 #else
      1125     fdc_info_t *fdc = ft_find_fdc_by_irq(irq);
      1126 #endif
 
    -+ 1141 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    <> 1143         TRACE(ft_t_bug,
1132         TRACE(ft_t_warn, "BUG?: Wrong IRQ number: got %d, expected %d", irq, fdc->irq);   1144               "BUG: Wrong IRQ number (%d/%d)", irq, fdc->irq);
1133         // goto err_out;   1145         goto err_out;
 
    -+ 1147 #endif
 
1346 #ifdef TESTING <> 1359 #if TESTING
 
    -+ 1464 #define FDC_TRACING
      1465 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 1479     MOD_INC_USE_COUNT;
 
1467     TRACE_CATCH(ft_parport_claim(fdc, &bpck->parinfo), ); <> 1484     TRACE_CATCH(ft_parport_claim(fdc, &bpck->parinfo), MOD_DEC_USE_COUNT);
 
1479                 enable_irq(bpck->IRQ);); <> 1496                 enable_irq(bpck->IRQ);
      1497                 MOD_DEC_USE_COUNT);
 
    -+ 1536     MOD_DEC_USE_COUNT;
 
    -+ 1743 #define GLOBAL_TRACING
      1744 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 1763 #define FDC_TRACING
      1764 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 1881         MOD_INC_USE_COUNT;
 
    -+ 1900         MOD_DEC_USE_COUNT;
 
    -+ 2168 #define GLOBAL_TRACING
      2169 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 2171 #ifdef FT_TRACE_ATTR
      2172 # undef FT_TRACE_ATTR
      2173 #endif
      2174 #define FT_TRACE_ATTR __initlocaldata
 
2140 int bpck_fdc_register(void) <> 2176 int __init bpck_fdc_register(void)
 
2144     printk(__FILE__ ": %s @ 0x%p\n", __func__, bpck_fdc_register); <> 2180     printk(__FILE__ ": "__FUNCTION__" @ 0x%p\n", bpck_fdc_register);
 
    -+ 2187 #undef FT_TRACE_ATTR
      2188 #define FT_TRACE_ATTR /**/
 
    -+ 2200 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
2162 FT_MOD_PARM_INT(ecr_bits, "What to write to the econtrol ECR reg."); <> 2202 FT_MOD_PARM(ecr_bits,        "i", "What to write to the econtrol ECR reg.");
2163 FT_MOD_PARM_INT(parport_proto, "Parport protocol.");   2203 FT_MOD_PARM(parport_proto,   "i", "Parport protocol.");
 
2170 /* EXPORT_NO_SYMBOLS - deprecated, no longer needed */ <> 2210 EXPORT_NO_SYMBOLS;
      2211 #endif
 
2178     /* EXPORT_NO_SYMBOLS - deprecated, no longer needed */ <> 2219 #if LINUX_VERSION_CODE >= KERNEL_VER(1,1,85)
      2220 # if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      2221     register_symtab(0); /* remove global ftape symbols */
2179     2222 # else
      2223     EXPORT_NO_SYMBOLS;
      2224 # endif
      2225 #endif
 
2190         printk(KERN_INFO "bpck module successfully unloaded."); <> 2236         printk(KERN_INFO "bpck module successfully unloaded.\n");
 
2200 static ftape_setup_t config_params[] = { <> 2246 static ftape_setup_t config_params[] __initdata = {
 
2211 int bpck_fdc_setup(char *str) <> 2257 int __init bpck_fdc_setup(char *str)
 
2213     static int ints[6] = { 0, }; <> 2259     static __initlocaldata int ints[6] = { 0, };

   
File: ftape\parport\trakker.c  
25   <> 25 #include <linux/config.h>
 
    -+ 35 #include <asm/system.h>
 
38 #include <linux/uaccess.h> <> 39 #include <asm/segment.h>
 
    -+ 42 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,16)
 
    -+ 44 #else
      45 #define __initdata
      46 #define __initfunc(__arg) __arg
      47 #endif
 
    -+ 49 #define FDC_TRACING
 
60 char trakker_src[] = "$RCSfile: trakker.c,v $"; <> 67 char trakker_src[] __initdata = "$RCSfile: trakker.c,v $";
61 char trakker_rev[] = "$Revision: 1.20 $";   68 char trakker_rev[] __initdata = "$Revision: 1.20 $";
62 char trakker_dat[] = "$Date: 2000/07/06 14:58:17 $";   69 char trakker_dat[] __initdata = "$Date: 2000/07/06 14:58:17 $";
 
72 void trakker_read(fdc_info_t *fdc, buffer_struct *buff); +-    
73 static void trakker_write(fdc_info_t *fdc, buffer_struct *buff);      
74 int trakker_release(fdc_info_t *fdc);      
75 int trakker_register(void);      
76 int trakker_unregister(void);      
77 int trakker_grab(fdc_info_t *fdc);      
 
    -+ 120 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 124 #else
      125     if (!intr_count && !fdc->irq_level++) {
      126         disable_irq(trakker->IRQ);
      127     }
      128 #endif
 
    -+ 132 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 136 #else
      137     if (!intr_count && !--fdc->irq_level) {
      138         enable_irq(trakker->IRQ);
      139     }
      140 #endif
 
    -+ 181 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 183 #else
      184     if (!intr_count && !fdc->irq_level++)
      185 #endif
 
    -+ 194 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
 
    -+ 196 #else
      197     if (!intr_count && !--fdc->irq_level)
      198 #endif
 
    -+ 428 #define GLOBAL_TRACING
      429 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 431 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 433 #else
      434 static void trakker_interrupt(int irq, struct pt_regs *regs)
      435 #endif
 
    -+ 437 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 439 #else
      440     fdc_info_t *fdc = ft_find_fdc_by_irq(irq);
      441 #endif
 
    -+ 455 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
427         TRACE(ft_t_warn, "BUG?: Wrong IRQ number: got %d, expected %d", irq, fdc->irq); <> 457         TRACE(ft_t_bug, "BUG: Wrong IRQ number (%d/%d)", irq, fdc->irq);
428         // goto err_out;   458         goto err_out;
 
    -+ 460 #endif
 
    -+ 539 #define FDC_TRACING
      540 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 552     MOD_INC_USE_COUNT;
 
522     TRACE_CATCH(ft_parport_claim(fdc, &trakker->parinfo), ); <> 557     TRACE_CATCH(ft_parport_claim(fdc, &trakker->parinfo),
      558             MOD_DEC_USE_COUNT);
 
    -+ 617     MOD_DEC_USE_COUNT;
 
    -+ 711         MOD_INC_USE_COUNT;
 
    -+ 730         MOD_DEC_USE_COUNT;
 
    -+ 898 #ifdef FT_TRACE_ATTR
      899 # undef FT_TRACE_ATTR
      900 #endif
      901 #define FT_TRACE_ATTR __initlocaldata
 
860 static int trakker_probe_irq(fdc_info_t *fdc) <> 903 static int __init trakker_probe_irq(fdc_info_t *fdc)
 
    -+ 925 #undef FT_TRACE_ATTR
      926 #define FT_TRACE_ATTR /**/
 
    -+ 1228 #define GLOBAL_TRACING
      1229 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 1231 #ifdef FT_TRACE_ATTR
      1232 # undef FT_TRACE_ATTR
      1233 #endif
      1234 #define FT_TRACE_ATTR __initlocaldata
 
1182 int trakker_register(void) <> 1236 int __init trakker_register(void)
 
1186     printk(__FILE__ ": %s @ 0x%p\n", __func__, trakker_register); <> 1240     printk(__FILE__ ": "__FUNCTION__" @ 0x%p\n", trakker_register);
 
    -+ 1247 #undef FT_TRACE_ATTR
      1248 #define FT_TRACE_ATTR /**/
 
1201 /* EXPORT_NO_SYMBOLS - deprecated, no longer needed */ <> 1258 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
    -+ 1260 EXPORT_NO_SYMBOLS;
 
    -+ 1268 #endif
 
    -+ 1274 #if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      1275     register_symtab(0); /* remove global ftape symbols */
      1276 #endif
 
1222     printk(KERN_INFO "trakker successfully unloaded."); <> 1286     printk(KERN_INFO "trakker successfully unloaded.\n");
 
1232 static ftape_setup_t config_params[] = { <> 1296 static ftape_setup_t config_params[] __initdata = {
 
1246 int trakker_setup(char *str) <> 1310 int __init trakker_setup(char *str)
 
1248     static int ints[6] = { 0, }; <> 1312     static __initlocaldata int ints[6] = { 0, };

   
File: ftape\parport\fdc-parport.h  
31 /* #include <linux/config.h> - not needed in modern kernels */ <> 31 #include <linux/config.h>
 
39 #if defined(MODULE) <> 39 #if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
41     module_param_array(var, int, NULL, 0644); MODULE_PARM_DESC(var,desc) <>    
42 # define FT_MOD_PARM_INT(var,desc) \      
43     module_param(var, int, 0644); MODULE_PARM_DESC(var,desc)   41     MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc)
 
46 # define FT_MOD_PARM_INT(var,desc) /**/ +-    
 
    <> 47 # if LINUX_VERSION_CODE < KERNEL_VER(2,1,47)
      48 #  if LINUX_VERSION_CODE < KERNEL_VER(2,1,0)
50 #include <linux/parport.h>   49 #   define port bus
      50 #  endif
      51 #  define pardevice ppd
      52 #  define PARPORT_MODE_PCPS2 PARPORT_MODE_PS2
      53 # endif
      54 # if LINUX_VERSION_CODE > KERNEL_VER(2,3,0)
 
52   <> 56 # endif
 
54 struct ft_parport_wrapper { <>    
55     void (*old_handler)(int, void *, struct pt_regs *);      
56     void *fdc;   57 #endif
57 };      
 
59 static void ft_parport_irq_wrapper(void *data) <> 59 #ifdef USE_PARPORT
60 {   60 # include <linux/parport.h>
61     struct ft_parport_wrapper *wrapper = (struct ft_parport_wrapper *)data;      
 
63     wrapper->old_handler(0, wrapper->fdc, NULL); +-    
64 }      
 
104     struct ft_parport_wrapper wrapper; /* IRQ handler wrapper for modern API */ +-    
 
    -+ 107 # if LINUX_VERSION_CODE < KERNEL_VER(2, 3, 0)
 
    -+ 109 #  define ft_w_dtr(p,b) ({parport_write_data((p).dev->port, b); ft_p(p);})
      110 #  define ft_r_dtr(p)   (ft_p(p), parport_read_data((p).dev->port))
      111 #  define ft_w_str(p,b) ({parport_write_status((p).dev->port, b); ft_p(p);})
      112 #  define ft_r_str(p)   (ft_p(p), parport_read_status((p).dev->port))
      113 #  define ft_w_ctr(p,b) ({parport_write_control((p).dev->port, b);ft_p(p);})
      114 #  define ft_r_ctr(p)   (ft_p(p), parport_read_control((p).dev->port))
 
    -+ 116 #  define ft_epp_w_adr(p,b) \
      117     ({parport_epp_write_addr((p).dev->port,b);ft_p(p);})
      118 #  define ft_epp_r_adr(p)   (ft_p(p), parport_epp_read_addr((p).dev->port))
      119 #  define ft_epp_w_dtr(p, b) \
      120     ({parport_epp_write_data((p).dev->port, b); ft_p(p);})
      121 #  define ft_epp_r_dtr(p)   (ft_p(p), parport_epp_read_data((p).dev->port))
 
    -+ 123 # else
 
    -+ 139 # endif
 
200 unsigned int ft_fdc_threshold[4] = { <> 214 static unsigned int ft_fdc_threshold[4] = {
 
206 unsigned int ft_fdc_rate_limit[4] = { <> 220 static unsigned int ft_fdc_rate_limit[4] = {
 
    -+ 296 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 299 #else
      300         if (request_irq(parinfo->irq, parinfo->handler, SA_INTERRUPT,
      301                 parinfo->id))
      302 #endif
 
329     int i; +-    
 
344     /* Modern parport API: iterate through available ports */ <> 362     for (port = parport_enumerate(); port; port = port->next) {
345     for (i = 0; i < 4; i++) {  /* Try first 4 parallel ports */      
346         port = parport_find_number(i);      
347         if (!port) continue;      
 
349         if (len && strncmp(buffer, port->name, len) != 0) { <> 363         if (strncmp(buffer, port->name, len) != 0) {
350             parport_put_port(port);      
 
355         parinfo->wrapper.old_handler = parinfo->handler; <> 367         parinfo->dev = parport_register_device(port, parinfo->id,
356         parinfo->wrapper.fdc = (void *)fdc;   368                                NULL, NULL,
 
358         { <>    
359             struct pardev_cb par_cb = {      
360                 .irq_func = ft_parport_irq_wrapper,      
361                 .private = &parinfo->wrapper,   369                                parinfo->handler,
362                 .flags = 0   370                                PARPORT_DEV_TRAN,
363             };   371                                (void *)fdc);
364             parinfo->dev = parport_register_dev_model(port, parinfo->id, &par_cb, i);      
365         }      
366         parport_put_port(port); /* Release reference */      
 
    -+ 397     MOD_INC_USE_COUNT; /* mark module as used */
      398     MOD_DEC_USE_COUNT;
 
416               "Configuration error, wrong rate limit (%d)." <> 423               KERN_INFO "Configuration error, wrong rate limit (%d)."
417               "Falling back to %d Kbps",    424               KERN_INFO "Falling back to %d Kbps", 
 
    -+ 447         MOD_INC_USE_COUNT; /* mark module as used */
      448         MOD_DEC_USE_COUNT;
 
    -+ 484     MOD_INC_USE_COUNT; /* mark module as used */
      485     MOD_DEC_USE_COUNT;
 
    -+ 497 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 499 #else
      500         free_irq(parinfo->irq);
      501 #endif

   
File: ftape\parport\trakker.h  
31 /* #include <linux/config.h> - not needed in modern kernels */ <> 31 #include <linux/config.h>

   
File: ftape\parport\fdc-parport.c  
27   <> 27 #include <linux/config.h>
 
29 #include <linux/module.h> +-    
 
31 void ftape_parport_init(void); +-    
32 void ftape_parport_setup(char *str);      
 
36 extern int trakker_setup(char *str); <> 31 extern int trakker_setup(char *str) __init;
37 extern int trakker_register(void);   32 extern int trakker_register(void) __init;
 
40 extern int bpck_fdc_setup(char *str); <> 35 extern int bpck_fdc_setup(char *str) __init;
41 extern int bpck_fdc_register(void);   36 extern int bpck_fdc_register(void) __init;
 
44 void ftape_parport_init(void) <> 39 void __init ftape_parport_init(void)
 
54 MODULE_LICENSE("GPL"); +-    
55 MODULE_AUTHOR("Claus-Justus Heine");      
56 MODULE_DESCRIPTION("Parallel port FDC interface for ftape");      
 
58 void ftape_parport_setup(char *str) <> 49 void __init ftape_parport_setup(char *str)

   
File: ftape\compressor\zftape-compress.c  
    -+ 34 #define ZFTC_TRACING
 
    -+ 36 #include <linux/config.h>
 
    -+ 44 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6)
 
    -+ 46 #else
      47 #include <asm/segment.h>
      48 #endif
 
109           "cmpr_pos   : %d\n"               \ <> 115           KERN_INFO "cmpr_pos   : %d\n"             \
110           "cmpr_sz    : %d\n"               \   116           KERN_INFO "cmpr_sz    : %d\n"             \
111           "first_block: %d\n"               \   117           KERN_INFO "first_block: %d\n"             \
112           "count      : %d\n"               \   118           KERN_INFO "count      : %d\n"             \
113           "offset     : %d\n"               \   119           KERN_INFO "offset     : %d\n"             \
114           "spans      : %d\n"               \   120           KERN_INFO "spans      : %d\n"             \
115           "uncmpr     : 0x%04x\n"               \   121           KERN_INFO "uncmpr     : 0x%04x\n"             \
116           "foffs      : " LL_X,             \   122           KERN_INFO "foffs      : " LL_X,               \
 
190                     "segment size: %d\n" <> 196                     KERN_INFO "segment size: %d\n"
191                     "first block : %d",   197                     KERN_INFO "first block : %d",
 
217                 "offset in current volume: %d\n" <> 223                 KERN_INFO "offset in current volume: %d\n"
218                 "size of current volume  : %d",   224                 KERN_INFO "size of current volume  : %d",
 
223                 "block size : %d\n" <> 229                 KERN_INFO "block size : %d\n"
224                 "data record: %d",   230                 KERN_INFO "data record: %d",
 
    -+ 282 #define ZFTAPE_TRACING
      283 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 294     MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
 
    -+ 304         MOD_DEC_USE_COUNT;
 
    -+ 315 #define ZFTC_TRACING
      316 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 332     MOD_DEC_USE_COUNT;
 
375               "before decompression: %d bytes\n" <> 392               KERN_INFO "before decompression: %d bytes\n"
376               "after decompression : %d bytes",    393               KERN_INFO "after decompression : %d bytes", 
 
399                   " compr./uncmpr.   : %3d %%", <> 416                   KERN_INFO " compr./uncmpr.   : %3d %%",
 
404                   " compr./uncmpr.   : %3d %%", <> 421                   KERN_INFO " compr./uncmpr.   : %3d %%",
 
    -+ 499 #if LINUX_VERSION_CODE > KERNEL_VER(2,1,3)
 
    -+ 505 #else
      506             memcpy_tofs(dst_buf + result, zftc->scratch_buf, 
      507                     uncompressed_sz);
      508 #endif
 
505               "compressed_sz: %d\n" <> 527               KERN_INFO "compressed_sz: %d\n"
506               "compos       : %d\n"   528               KERN_INFO "compos       : %d\n"
507               "*read_cnt    : %d",   529               KERN_INFO "*read_cnt    : %d",
 
515           "segment size   : %d\n" <> 537           KERN_INFO "segment size   : %d\n"
516           "read count     : %d\n"   538           KERN_INFO "read count     : %d\n"
517           "buf_pos_read   : %d\n"   539           KERN_INFO "buf_pos_read   : %d\n"
518           "remaining      : %d",   540           KERN_INFO "remaining      : %d",
 
586               "seg_dist: %d\n" <> 608               KERN_INFO "seg_dist: %d\n"
587               "distance: %d\n"   609               KERN_INFO "distance: %d\n"
588               "dest    : %d\n"   610               KERN_INFO "dest    : %d\n"
589               "vpos    : %d\n"   611               KERN_INFO "vpos    : %d\n"
590               "seg_pos : %d\n"   612               KERN_INFO "seg_pos : %d\n"
591               "trials  : %d",   613               KERN_INFO "trials  : %d",
 
611                    "fast seek failed too often: %s\n" <> 633                    KERN_INFO "fast seek failed too often: %s\n"
612                    "near target position      : %s\n"   634                    KERN_INFO "near target position      : %s\n"
613                    "looping between two segs  : %s",   635                    KERN_INFO "looping between two segs  : %s",
 
765          "segment size   : %d\n" <> 787           KERN_INFO "segment size   : %d\n"
766           "buf_pos_read   : %d\n"   788           KERN_INFO "buf_pos_read   : %d\n"
767           "remaining      : %d",   789           KERN_INFO "remaining      : %d",
 
810               "remaining:  %d\n" <> 832               KERN_INFO "remaining:  %d\n"
811               "seg_pos:    %d\n"   833               KERN_INFO "seg_pos:    %d\n"
812               "end_seg:    %d\n"   834               KERN_INFO "end_seg:    %d\n"
813               "result:     %d",   835               KERN_INFO "result:     %d",
 
847                         "zftc->cseg.foff: %d\n" <> 869                         KERN_INFO "zftc->cseg.foff: %d\n"
848                         "dest     : %d",   870                         KERN_INFO "dest     : %d",
 
    -+ 982 #define GLOBAL_TRACING
      983 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 985 #ifdef FT_TRACE_ATTR
      986 # undef FT_TRACE_ATTR
      987 #endif
      988 #define FT_TRACE_ATTR __initlocaldata
 
960 int zft_compressor_init(void) <> 990 int __init zft_compressor_init(void)
 
965     printk(KERN_INFO "zftape de-compressor for "FTAPE_VERSION); <> 995     printk(KERN_INFO "zftape de-compressor for "FTAPE_VERSION"\n");
 
    <> 997         printk(
967         printk(KERN_INFO "(c) 1994-1998 Claus-Justus Heine <heine@instmath.rwth-aachen.de>\n"   998 KERN_INFO "(c) 1994-1998 Claus-Justus Heine <heine@instmath.rwth-aachen.de>\n"
968 "De-compressor for zftape (lzrw3 algorithm)\n"   999 KERN_INFO "De-compressor for zftape (lzrw3 algorithm)\n"
969 "Compiled for kernel version %s"   1000 KERN_INFO "Compiled for kernel version %s"
 
977     printk("zftape de-compressor for "FTAPE_VERSION" for Linux " UTS_RELEASE); <> 1008     printk("zftape de-compressor for "FTAPE_VERSION
      1009            " for Linux " UTS_RELEASE "\n");
 
    -+ 1019 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
    -+ 1026 #endif
 
    -+ 1028 #if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13)
      1029 char kernel_version[] = UTS_RELEASE;
      1030 #endif
      1031 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
    -+ 1036 #endif
 
    -+ 1044 #if LINUX_VERSION_CODE >= KERNEL_VER(1,1,85)
      1045 # if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      1046     register_symtab(0); /* remove global ftape symbols */
      1047 # else
 
    -+ 1052 # endif
      1053 #endif
 
1033         printk(KERN_INFO "zft-compressor successfully unloaded."); <> 1078         printk(KERN_INFO "zft-compressor successfully unloaded.\n");

   
File: ftape\internal\fdc-internal.c  
    -+ 26 #include <linux/config.h>
 
    -+ 33 #include <linux/wrapper.h>
 
    -+ 42 #define FDC_TRACING
 
53 char fdc_int_internal_src[] = "$RCSfile: fdc-internal.c,v $"; <> 56 char fdc_int_internal_src[] __initdata = "$RCSfile: fdc-internal.c,v $";
54 char fdc_int_internal_rev[] = "$Revision: 1.40 $";   57 char fdc_int_internal_rev[] __initdata = "$Revision: 1.40 $";
55 char fdc_int_internal_dat[] = "$Date: 2000/07/25 10:36:40 $";   58 char fdc_int_internal_dat[] __initdata = "$Date: 2000/07/25 10:36:40 $";
 
75 static int ft_fdc_base[4] = { <> 78 static int ft_fdc_base[4] __initdata = {
 
81 static int ft_fdc_irq[4] = { <> 84 static int ft_fdc_irq[4] __initdata = {
 
87 static int ft_fdc_dma[4] = { <> 90 static int ft_fdc_dma[4] __initdata = {
 
94 static int ft_fdc_fc10[4] = { <> 97 static int ft_fdc_fc10[4] __initdata = {
 
101 static int ft_fdc_mach2[4] = { <> 104 static int ft_fdc_mach2[4] __initdata = {
 
108 unsigned int ft_fdc_threshold[4] = { <> 111 static unsigned int ft_fdc_threshold[4] __initdata = {
 
115 unsigned int ft_fdc_rate_limit[4] = { <> 118 static unsigned int ft_fdc_rate_limit[4] __initdata = {
 
208         buffer->dma_address = virt_to_phys(addr); <> 211         buffer->dma_address = virt_to_bus(addr);
 
228             module_put(THIS_MODULE); <> 231             MOD_DEC_USE_COUNT;
 
244         if (!try_module_get(THIS_MODULE)) { <>    
245             TRACE_EXIT NULL;   247         MOD_INC_USE_COUNT;
246         }      
 
265         module_put(THIS_MODULE); <> 266         MOD_DEC_USE_COUNT;
 
286         if (!request_region(fdc->sra, 8, "fdc (ft)")) { <> 287         if (check_region(fdc->sra, 8) < 0) {
 
296         if (!request_region(fdc->sra, 6, "fdc (ft)") ||  <> 297         if (check_region(fdc->sra, 6) < 0 || 
297             !request_region(fdc->dir, 1, "fdc DIR (ft)")) {   298             check_region(fdc->dir, 1) < 0) {
 
299             if (request_region(fdc->sra, 6, "fdc (ft)")) +-    
300                 release_region(fdc->sra, 6);      
 
310         if (!request_region(0x3f0, 6, "standard fdc (ft)") || <> 309         if (check_region(0x3f0, 6) < 0 ||
311             !request_region(0x3f0 + 7, 1, "standard fdc DIR (ft)")) {   310             check_region(0x3f0 + 7, 1) < 0) {
 
313             if (request_region(0x3f0, 6, "standard fdc (ft)")) +-    
314                 release_region(0x3f0, 6);      
 
316             if (fdc->dor2 != 0xffff) { +-    
317                 release_region(fdc->sra, 8);      
318             } else {      
319                 release_region(fdc->sra, 6);      
320                 release_region(fdc->dir, 1);      
321             }      
 
    -+ 319     }
      320     if (fdc->dor2 != 0xffff) {
      321         request_region(fdc->sra, 8, "fdc (ft)");
      322     } else {
      323         request_region(fdc->sra, 6, "fdc (ft)");
      324         request_region(fdc->sra + 7, 1, "fdc DIR (ft)");
      325     }
      326     if (fdc->sra != 0x3f0 && (fdc->dma == 2 || fdc->irq == 6)) {
      327         request_region(0x3f0, 6,"standard fdc (ft)");
      328         request_region(0x3f0 + 7, 1,"standard fdc DIR (ft)");
 
    -+ 350 #define GLOBAL_TRACING
      351 #include "../lowlevel/ftape-real-tracing.h"
 
    <> 353 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
350 static irqreturn_t ftape_interrupt(int irq, void *dev_id)   354 static void ftape_interrupt(int irq, void *dev_id, struct pt_regs *regs)
      355 #else
      356 static void ftape_interrupt(int irq, struct pt_regs *regs)
      357 #endif
 
    -+ 359 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 361 #else
      362     fdc_info_t *fdc = ft_find_fdc_by_irq(irq);
      363 #endif
 
357         TRACE_EXIT IRQ_NONE; <> 368         goto err_out;
 
362         TRACE_EXIT IRQ_NONE; <> 373         goto err_out;
 
    -+ 375 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
366         TRACE_EXIT IRQ_NONE; <> 378         goto err_out;
 
    -+ 380 #endif
 
375         TRACE_EXIT IRQ_NONE; +-    
 
    <> 389  err_out:
377     TRACE_EXIT IRQ_HANDLED;   390     TRACE_EXIT;
 
    -+ 393 #define FDC_TRACING
      394 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 406 #ifdef FT_TRACE_ATTR
      407 # undef FT_TRACE_ATTR
      408 #endif
      409 #define FT_TRACE_ATTR __initlocaldata
 
390 static void fdc_int_cause_reset(fdc_info_t *fdc) <> 411 static void __init fdc_int_cause_reset(fdc_info_t *fdc)
 
411 static int fdc_int_probe_irq(fdc_info_t *fdc) <> 432 static int __init fdc_int_probe_irq(fdc_info_t *fdc)
 
    -+ 454 #undef FT_TRACE_ATTR
      455 #define FT_TRACE_ATTR /**/
 
437     if (!try_module_get(THIS_MODULE)) { <> 461     MOD_INC_USE_COUNT;
438         return -ENODEV;      
439     }      
 
442     TRACE_CATCH(fdc_int_request_regions(fdc), module_put(THIS_MODULE)); <> 463     TRACE_CATCH(fdc_int_request_regions(fdc),
      464             MOD_DEC_USE_COUNT);
 
    -+ 467 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
446             0, ftape_id, fdc)) { <> 469             SA_INTERRUPT, ftape_id, fdc)) {
 
448         module_put(THIS_MODULE) <> 471         MOD_DEC_USE_COUNT
 
    <> 476 #else
      477     if (request_irq(fdc->irq, ftape_interrupt, SA_INTERRUPT,
      478             ftape_id)) {
      479         fdc_int_release_regions(fdc);
      480         MOD_DEC_USE_COUNT;
      481         TRACE_ABORT(-EBUSY, ft_t_bug,
      482                 "Unable to grab IRQ%d for ftape driver",
      483                 fdc->irq);
453     484     }
      485 #endif
 
    -+ 487 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 489 #else
      490         free_irq(fdc->irq);
      491 #endif
 
457         module_put(THIS_MODULE); <> 493         MOD_DEC_USE_COUNT;
 
    -+ 517 #if LINUX_VERSION_CODE >= KERNEL_VER(1,3,70)
 
    -+ 519 #else
      520     free_irq(fdc->irq);
      521 #endif
 
493     module_put(THIS_MODULE); <> 533     MOD_DEC_USE_COUNT;
 
546     buffer->dma_address     = virt_to_phys(buffer->virtual); <> 586     buffer->dma_address     = virt_to_bus(buffer->virtual);
 
579                 buffer->dma_address = virt_to_phys(buffer->virtual); <> 619                 buffer->dma_address = virt_to_bus(buffer->virtual);
 
596     buff->dma_address       = virt_to_phys(buff->virtual); <> 636     buff->dma_address       = virt_to_bus(buff->virtual);
 
    -+ 655 #ifdef FT_TRACE_ATTR
      656 # undef FT_TRACE_ATTR
      657 #endif
      658 #define FT_TRACE_ATTR __initlocaldata
 
615 static void fdc_int_config(fdc_info_t *fdc) <> 660 static void __init fdc_int_config(fdc_info_t *fdc)
 
637               "Configuration error, wrong rate limit (%d)." <> 681               KERN_INFO "Configuration error, wrong rate limit (%d)."
638               "Falling back to %d Kbps",    682               KERN_INFO "Falling back to %d Kbps", 
 
669 static int fdc_int_detect(fdc_info_t *fdc) <> 712 static int __init fdc_int_detect(fdc_info_t *fdc)
 
    -+ 815 #ifdef FT_TRACE_ATTR
      816 # undef FT_TRACE_ATTR
      817 #endif
      818 #define FT_TRACE_ATTR __initlocaldata
 
774 int fdc_internal_register(void) <> 820 int __init fdc_internal_register(void)
 
778     printk(KERN_INFO "ftape_internal: %s @ 0x%p", __func__, fdc_internal_register); <> 824     printk(__FILE__": "__FUNCTION__" @ 0x%p.\n", fdc_internal_register);
 
    -+ 840 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
796     module_param_array(var, int, NULL, 0644); MODULE_PARM_DESC(var,desc) <> 842     MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc)
 
    -+ 860 #endif
 
820     /* EXPORT_NO_SYMBOLS is deprecated - no global exports by default */ <> 867 #if LINUX_VERSION_CODE >= KERNEL_VER(1,1,85)
      868 # if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
      869     register_symtab(0); /* remove global ftape symbols */
821     870 # else
      871     EXPORT_NO_SYMBOLS;
      872 # endif
      873 #endif
 
833         printk(KERN_INFO "fdc_internal successfully unloaded."); <> 885         printk(KERN_INFO "fdc_internal successfully unloaded.\n");
 
841 static ftape_setup_t config_params[] = { <> 893 static ftape_setup_t config_params[] __initdata = {
 
857 int ftape_internal_setup(char *str) <> 909 int __init ftape_internal_setup(char *str)
 
859     static int ints[6] = { 0, }; <> 911     static __initlocaldata int ints[6] = { 0, };

   
File: ftape\internal\fdc-isapnp.c  
25   <> 25 #include <linux/config.h>
 
    -+ 33 #define FDC_TRACING
 
42 static unsigned short known_vendors[] = { <> 43 static unsigned short known_vendors[] __initdata = {
 
46 static unsigned short known_devices[] = { <> 47 static unsigned short known_devices[] __initdata = {
 
50 static unsigned short known_functions[] = { <> 51 static unsigned short known_functions[] __initdata = {
 
54 static unsigned short ft_fdc_pnp_ven[4] = { <> 55 static unsigned short ft_fdc_pnp_ven[4] __initdata = {
 
77 static unsigned short ft_fdc_pnp_dev[4] = { <> 78 static unsigned short ft_fdc_pnp_dev[4] __initdata = {
 
81 static unsigned short ft_fdc_pnp_fct[4] = { <> 82 static unsigned short ft_fdc_pnp_fct[4] __initdata = {
 
    -+ 90 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 
    -+ 97 #endif
 
96 static int find_isapnp_fdc(fdc_info_t *fdc, <> 99 static int __init find_isapnp_fdc(fdc_info_t *fdc,
 
195 int fdc_int_isapnp_init(fdc_info_t *fdc) <> 198 int __init fdc_int_isapnp_init(fdc_info_t *fdc)
 
    -+ 244 #define GLOBAL_TRACING
      245 #include "../lowlevel/ftape-real-tracing.h"
 
277 int fdc_int_isapnp_setup(char *str) <> 283 int __init fdc_int_isapnp_setup(char *str)

   
File: ftape\internal\fdc-internal.h  
29 /* #include <linux/config.h> - not needed in modern kernels */ <> 29 #include <linux/config.h>
 
254 int ftape_internal_setup(char *str); <> 254 int ftape_internal_setup(char *str) __init;
255 int fdc_internal_register(void);   255 int fdc_internal_register(void) __init;

   
File: ftape\internal\fc-10.c  
55   <> 55 #include <linux/config.h>
 
    -+ 63 #define FDC_TRACING
 
72 const __u16 inbs_magic[] = { <> 73 const __u16 inbs_magic[] __initdata = {
 
78 const __u16 fc10_ports[] = { <> 79 const __u16 fc10_ports[] __initdata = {
 
    -+ 83 #ifdef FT_TRACE_ATTR
      84 # undef FT_TRACE_ATTR
      85 #endif
      86 #define FT_TRACE_ATTR __initlocaldata
 
82 int fc10_enable(fdc_info_t *fdc) <> 88 int __init fc10_enable(fdc_info_t *fdc)
 
103 "Error: The FC-10/20 must be set to use IRQ levels 3 - 7, or 9!\n" <> 109  KERN_INFO "Error: The FC-10/20 must be set to use IRQ levels 3 - 7, or 9!\n"
104 "Note: IRQ 9 is the same as IRQ 2");   110  KERN_INFO "Note: IRQ 9 is the same as IRQ 2");

   
File: ftape\internal\fdc-isapnp.h  
29 /* #include <linux/config.h> - not needed in modern kernels */ <> 29 #include <linux/config.h>
 
37 int fdc_int_isapnp_setup(char *str); <> 37 int fdc_int_isapnp_setup(char *str) __init;
 
39 int fdc_int_isapnp_init(fdc_info_t *fdc); <> 39 int fdc_int_isapnp_init(fdc_info_t *fdc)  __init;

   
File: ftape\internal\fc-10.h  
39 extern int fc10_enable(fdc_info_t *info); <> 39 extern int fc10_enable(fdc_info_t *info) __init;

   
File: ftape\setup\ftape-setup.c  
28   <> 28 #include <linux/config.h>
 
    -+ 37 #if LINUX_VERSION_CODE < KERNEL_VER(2,4,0)
      38 # error unsupported
      39 #endif
 
40 int ftape_setup(char *str); +-    
 
55 /* extern int ftape_parport_setup(char *str); */ <> 54 extern int ftape_parport_setup(char *str);
 
    -+ 57 #define GLOBAL_TRACING
      58 #include "../lowlevel/ftape-real-tracing.h"
 
    -+ 60 #ifdef FT_TRACE_ATTR
      61 # undef FT_TRACE_ATTR
      62 #endif
      63 #define FT_TRACE_ATTR __initlocaldata
 
66 int ftape_setup(char *str) <> 73 int __init ftape_setup(char *str)
 
74     if (ftape_lowlevel_setup(str) <= 0) { <> 79     if (ftape_lowlevel_setup(str) <= 0) {
 
76         TRACE_EXIT 1; <> 81         TRACE_EXIT 1;
77     }   82     }
 
86     /* ftape_parport_setup(str); */ <> 89     ftape_parport_setup(str);
 
91 int ftape_setup_parse(char *str, int *ints, <> 96 int __init ftape_setup_parse(char *str, int *ints,

   
File: ftape\setup\ftape-setup.h  
40 extern int ftape_setup_parse(char *str, int *ints, <> 40 extern int __init ftape_setup_parse(char *str, int *ints,

   
File: include\linux\ftape.h  
    <> 32 #define __initlocaldata __initdata
32 #define FTAPE_VERSION "ftape v4.05 08/28/2025"   33 #define FTAPE_VERSION "ftape v4.04a 07/25/2000"
 
    -+ 41 #ifdef KERNEL_VERSION
      42 # define KERNEL_VER(major,minor,sublvl) KERNEL_VERSION(major,minor,sublevel)
      43 #else
      44 # define KERNEL_VER(major,minor,sublvl) (((major)<<16)+((minor)<<8)+(sublvl))
      45 #endif
      46 #include <linux/config.h>
      47 #if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) 
      48 typedef daddr_t __kernel_daddr_t; /* needed for mtio.h */
      49 #endif
 
    -+ 51 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,16)
 
42   <> 53 #else
      54 # define __initdata
      55 # define __initfunc(__arg) __arg
      56 #endif
      57 #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,90)
 
    <> 61 # endif
      62 #else
      63 # ifdef CONFIG_KERNELD
      64 #  include <linux/kerneld.h>
      65 #  define FT_MODULE_AUTOLOAD
      66 # endif
46 # endif   67 #endif
 
    <> 120 #ifdef TESTING
99 #ifndef FT_SOFT_RETRIES   121 #define FT_SOFT_RETRIES 1      /* number of low level retries */
      122 #define FT_RETRIES_ON_ECC_ERROR 3  /* ecc error when correcting segment */
      123 #else
 
    -+ 125 #define FT_RETRIES_ON_ECC_ERROR 3  /* ecc error when correcting segment */

   
File: include\linux\zftape.h  
41 # define ZFT_RAW_MODE       (1 << 5) <>    
42 # define ZFT_MINOR_OP_MASK  ZFT_RAW_MODE   40 # define ZFT_MINOR_OP_MASK 0