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");
50 mt_com.mt_op = MTWEOF;
52 r1 = ioctl(fd, MTIOCTOP, &mt_com);
55 /* write a second file */
56 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
57 printf("write something\n");
63 r1 = ioctl(fd, MTIOCTOP, &mt_com);
66 /* read something with error */
70 printf("read c=%s len=%i errno=%i\n", c, r1, errno);
76 r1 = read(fd, c, 200);
78 printf("read c=%s len=%i\n", c, r1);
82 printf("write something\n");
83 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
89 r1 = ioctl(fd, MTIOCTOP, &mt_com);
90 r1 = read(fd, c, 200);
92 printf("read c=%s len=%i\n", c, r1);
93 r1 = read(fd, c, 200);
95 printf("read c=%s len=%i\n", c, r1);
99 mt_com.mt_op = MTWEOF;
101 r1 = ioctl(fd, MTIOCTOP, &mt_com);
105 mt_com.mt_op = MTFSF;
107 r1 = ioctl(fd, MTIOCTOP, &mt_com);
108 printf("fsf r=%i\n", r1);
111 /* write something */
112 printf("write something\n");
113 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
117 mt_com.mt_op = MTFSF;
119 r1 = ioctl(fd, MTIOCTOP, &mt_com);
120 printf("fsf r=%i\n", r1);
124 mt_com.mt_op = MTWEOF;
126 r1 = ioctl(fd, MTIOCTOP, &mt_com);
127 printf("weof 3 r=%i\n", r1);
132 mt_com.mt_op = MTREW;
133 r1 = ioctl(fd, MTIOCTOP, &mt_com);
138 mt_com.mt_op = MTFSR;
139 mt_com.mt_count = 10;
140 r1 = ioctl(fd, MTIOCTOP, &mt_com);
141 printf("fsr r=%i\n", r1);
146 mt_com.mt_op = MTEOM;
147 r1 = ioctl(fd, MTIOCTOP, &mt_com);
148 printf("goto eom\n");
151 /* write something */
152 printf("write something\n");
153 write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);