11 #define write faketape_write
12 #define open faketape_open
13 #define read faketape_read
14 #define close faketape_close
15 #define ioctl faketape_ioctl
22 ioctl(fd, MTIOCGET, &mt_get);
23 printf("file:block %i:%i\n", mt_get.mt_fileno, mt_get.mt_blkno);
32 fd = open("/dev/lto2", O_CREAT | O_RDWR, 0700);
37 r1 = ioctl(fd, MTIOCTOP, &mt_com);
42 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
43 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
44 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
45 printf("write something (3 writes)\n");
51 r1 = ioctl(fd, MTIOCTOP, &mt_com);
54 /* read something with error */
58 printf("read c=%s len=%i errno=%i\n", c, r1, errno);
64 r1 = read(fd, c, 200);
66 printf("read c=%s len=%i\n", c, r1);
70 printf("write something\n");
71 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
77 r1 = ioctl(fd, MTIOCTOP, &mt_com);
78 r1 = read(fd, c, 200);
80 printf("read c=%s len=%i\n", c, r1);
81 r1 = read(fd, c, 200);
83 printf("read c=%s len=%i\n", c, r1);
87 mt_com.mt_op = MTWEOF;
89 r1 = ioctl(fd, MTIOCTOP, &mt_com);
95 r1 = ioctl(fd, MTIOCTOP, &mt_com);
96 printf("fsf r=%i\n", r1);
100 printf("write something\n");
101 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
105 mt_com.mt_op = MTFSF;
107 r1 = ioctl(fd, MTIOCTOP, &mt_com);
108 printf("fsf r=%i\n", r1);
112 mt_com.mt_op = MTWEOF;
114 r1 = ioctl(fd, MTIOCTOP, &mt_com);
115 printf("weof 3 r=%i\n", r1);
120 mt_com.mt_op = MTREW;
121 r1 = ioctl(fd, MTIOCTOP, &mt_com);
126 mt_com.mt_op = MTFSR;
127 mt_com.mt_count = 10;
128 r1 = ioctl(fd, MTIOCTOP, &mt_com);
129 printf("fsr r=%i\n", r1);
134 mt_com.mt_op = MTEOM;
135 r1 = ioctl(fd, MTIOCTOP, &mt_com);
136 printf("goto eom\n");