~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to install/unix/systems/AIX/libsrc/os/unix/iodev.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
.TYPE        Module
 
4
.NAME        iodev
 
5
.LANGUAGE    C
 
6
.AUTHOR      IPG-ESO Garching
 
7
.CATEGORY    Host operating system interfaces. Tape management.
 
8
.COMMENTS    Tape management. 
 
9
             The functions of this module perform basic i/o to
 
10
             magnetic tapes on AIX enviroments
 
11
.VERSION     [1.1] mhl obs lyon mars 1991
 
12
 
 
13
.ENVIRONMENT  System V
 
14
------------------------------------------------------------*/
 
15
#include <sys/types.h>
 
16
#include <sys/stat.h>
 
17
#include <fcntl.h>
 
18
#include <string.h>
 
19
#include <errno.h>
 
20
 
 
21
#include <sys/ioctl.h>
 
22
#include <sys/devinfo.h>  /* 3 include IBM  rs6000 */
 
23
#include <sys/scsi.h>
 
24
#include <sys/tape.h>
 
25
 
 
26
 
 
27
#include <osparms.h>
 
28
#include <osudef.h>
 
29
/*----------------------------------------------------------
 
30
fichier sys/tape.h , contient:
 
31
SCSI Tape Ioctls
 
32
#define STIOCTOP        0x01              * tape commands *
 
33
#define STIOCMD         0x02              * diagnostic commands *
 
34
 
 
35
* Structures and definitions for magnetic tape io control commands
 
36
 structure for STIOCTOP - streaming tape op command :
 
37
struct  stop    {
 
38
         short   st_op;          * operations defined below *
 
39
         daddr_t st_count;       * how many of them *
 
40
                 };
 
41
 
 
42
* operations *
 
43
#define STREW   6       * rewind *
 
44
#define STERASE 7       * erase tape, leave at load point *
 
45
#define STRETEN 8       * retension tape, leave at load point *
 
46
#define STWEOF  10      * write an end-of-file record *
 
47
#define STFSF   11      * forward space file *
 
48
#define STRSF   12      * reverse space file *
 
49
#define STFSR   13      * forward space record *
 
50
#define STRSR   14      * reverse space record *
 
51
 
 
52
------------------------------------------------------------*/
 
53
 
 
54
/* ----------- pour interfac avec les codes operations habituels sur bande --*/
 
55
#define MTIOREW STREW
 
56
#define MTIOWEOF STWEOF
 
57
#define MTIOFSF STFSF
 
58
#define MTIOBSF STRSF
 
59
#define MTIOFSR STFSR
 
60
#define MTIOBSR STRSR
 
61
 
 
62
 
 
63
/*#define TAPE_BLK 10240 */
 
64
#define TAPE_BLK 20480
 
65
/*#define DEBUG  */
 
66
 
 
67
static char class_name[] = "mt";        /* MAgnetic Tape Class */
 
68
 
 
69
extern int errno;
 
70
extern int oserror;
 
71
extern char *oserrmsg;
 
72
 
 
73
#define M_ST_SUCC 0x00
 
74
/*  #define M_ST_DATA 0x34   */
 
75
#define M_ST_DATA 110
 
76
#define M_ST_BOT  20
 
77
/* #define M_ST_TAPEM 0x1C */
 
78
 
 
79
        /* For debbuging */
 
80
/*char inv[] = "Invalid tape status\n"; */
 
81
/*char *tape_msg[M_ST_MASK] = {         */
 
82
/*      "Success\n",                    */ /* 001 */
 
83
/*      "Invalid command\n",            */ /* 002 */
 
84
/*      "Command aborted\n",            */ /* 003 */
 
85
/*      "Unit offline\n",               */ /* 004 */
 
86
/*      "Unit available\n",             */ /* 005 */
 
87
/*      "Write protected\n",            */ /* 006 */
 
88
/*      "Compare error\n",              */ /* 007 */
 
89
/*      "Data error\n",                 */ /* 010 */
 
90
/*      "Host buffer access error\n",   */ /* 011 */
 
91
/*      "Controller error\n",           */ /* 012 */
 
92
/*      "Drive error\n",                */ /* 013 */
 
93
/*      "Formatter error\n",            */ /* 014 */
 
94
/*      "BOT encountered\n",            */ /* 015 */
 
95
/*      "Tape mark encountered\n",      */ /* 016 */
 
96
/*      inv,                            */ /* 017 */
 
97
/*      "Record data truncated\n",      */ /* 020 */
 
98
/*      "Position lost\n",              */ /* 021 */
 
99
/*      "Serious exception\n",          */ /* 022 */
 
100
/*      "LEOT detected\n",              */ /* 023 */
 
101
/*      inv,inv,inv,inv,inv,inv,inv,inv,inv,inv,inv,    */ /* 024-036 */
 
102
/*      "Message from an internal diagnostic\n"         */ /* 037 */
 
103
/*      }; */
 
104
 
 
105
int ioctop(fd,op,count)
 
106
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
107
.PURPOSE Skip forward space file on a tape. 
 
108
.RETURNS 0 / -1 (error)
 
109
.REMARKS System dependencies:
 
110
 -- UNIX: open(2), ioctl(2)
 
111
------------------------------------------------------------*/
 
112
int fd;                 /* IN:  Tape device file descriptor */
 
113
int op;                 /* IN:  Operation */
 
114
int count;              /* IN:  How many of them */
 
115
{
 
116
        int stat, ret;
 
117
        struct stop mtoperation ; /* structure pour ioctl ibm */
 
118
 
 
119
 
 
120
#ifdef DEBUG
 
121
printf ("ioctop  ");
 
122
#endif
 
123
        oserror=0;stat=0;
 
124
        /*
 
125
        ** First try to execute the command.
 
126
        ** Even if fails, try to read the status
 
127
        */
 
128
        /* en cas de weof, l'argument est le nombre de tape marks a ecrire */
 
129
#ifdef DEBUG
 
130
printf ("mh ioctl:%d  count=%d  ",op,count);
 
131
#endif
 
132
 
 
133
/* initialisation de la structure */
 
134
 
 
135
mtoperation.st_op=op;
 
136
mtoperation.st_count=count;
 
137
 
 
138
switch (op) 
 
139
        {
 
140
        case MTIOWEOF :
 
141
#ifdef DEBUG
 
142
                printf (" ioctl-weof ");
 
143
#endif
 
144
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1) oserror = errno; break;
 
145
        case MTIOFSF :
 
146
#ifdef DEBUG
 
147
                printf (" ioctl-fsf ");
 
148
#endif
 
149
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1) oserror = errno; break;
 
150
        case MTIOBSF :
 
151
#ifdef DEBUG
 
152
                printf (" ioctl-bsf ");
 
153
#endif
 
154
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1) 
 
155
                        {
 
156
                        if (errno == EIO )       /* on doit etre en debut de bande */
 
157
                                {
 
158
                                stat = M_ST_BOT;
 
159
                                }
 
160
                        else oserror = errno;
 
161
                        } break;
 
162
        case MTIOFSR :
 
163
#ifdef DEBUG
 
164
                printf (" ioctl-fsr ");
 
165
#endif
 
166
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1) oserror = errno; break;
 
167
        case MTIOBSR :
 
168
#ifdef DEBUG
 
169
                printf (" ioctl-bsr ");
 
170
#endif
 
171
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1) oserror = errno; break;
 
172
        case MTIOREW :
 
173
#ifdef DEBUG
 
174
                printf (" ioctl-rewind  op=%d  ",op);
 
175
#endif
 
176
                if ((ret = ioctl(fd,STIOCTOP,&mtoperation)) == -1)
 
177
                        {
 
178
                        oserror = errno;
 
179
                        }
 
180
                        break;
 
181
        default :
 
182
#ifdef DEBUG
 
183
                printf (" ioctl-default  op=%d  ",op);
 
184
#endif
 
185
                printf ("code operation inconnu");
 
186
                break;
 
187
        }
 
188
 
 
189
        /*
 
190
        ** If there was an error,
 
191
        ** the error condition must be cleared before continue
 
192
        */
 
193
        if (ret == -1) 
 
194
                oserror = errno;
 
195
#ifdef DEBUG
 
196
        printf (" ret=%d oserror=%d\n",ret,oserror);
 
197
#endif
 
198
        return(oserror ? -1 : stat);            
 
199
}
 
200
 
 
201
static int ioinfo(fd, s, fileno, blkno)
 
202
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
203
.PURPOSE Retrieve Info concerning an opened device
 
204
.RETURNS 0 (success) / -1 (error)
 
205
------------------------------------------------------------*/
 
206
        int     fd;     /* IN: File Descriptor          */
 
207
        struct osustat  *s;     /* OUT: The filled components */
 
208
        int     *fileno;        /* OUT: Where we are    */
 
209
        long    *blkno;         /* OUT: Where we are    */
 
210
{
 
211
struct devinfo info_bande;
 
212
int ret;
 
213
 
 
214
#ifdef DEBUG
 
215
printf ("ioinfo\n");
 
216
#endif
 
217
if ((ret = ioctl(fd,IOCINFO,&info_bande)) == -1 ) oserror = errno;
 
218
if (ret != -1)
 
219
        {
 
220
        printf (" ioinfo , devtype %c \n",info_bande.devtype);
 
221
        printf ("ioinfo , scmt type %d blksize=%d\n",info_bande.un.scmt.type,info_bande.un.scmt.blksize);
 
222
 
 
223
        s->usize     = 0;
 
224
        s->blocksize = 0;
 
225
        s->density   = 0;
 
226
        s->isda = 0;        /* Not direct access */
 
227
        if ( info_bande.devtype == DD_SCTAPE ) s->istm = 1;
 
228
                else
 
229
                {
 
230
                s->istm = 0;
 
231
                oserror = -1;
 
232
                oserrmsg = "Device can't be a tape...";
 
233
                return(-1);
 
234
                }
 
235
    *fileno=-1;
 
236
        *blkno=-1;
 
237
        }
 
238
        return(ret);
 
239
}
 
240
 
 
241
static int ioopen(name,mode,den)
 
242
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
243
.PURPOSE Open a tape device
 
244
.RETURNS File descriptor / -1 (error)
 
245
.REMARKS System dependencies:
 
246
 -- UNIX: open(2), fstat(2)
 
247
------------------------------------------------------------*/
 
248
char *name;             /* IN:  Physical name of tape device */
 
249
int mode;               /* IN:  Open mode */
 
250
int den;                /* IN:  Density. Not used */
 
251
{
 
252
        struct stat buf;
 
253
        int fd;
 
254
        int t;
 
255
        
 
256
#ifdef DEBUG
 
257
printf ("ioopen\n");
 
258
#endif
 
259
        /* 
 
260
        ** First try to open device READ/WRITE.
 
261
        ** If fail, try READ_ONLY
 
262
        */
 
263
 
 
264
        switch(mode) {
 
265
                case READ       : t = O_RDONLY; break;
 
266
                case WRITE      : t = O_WRONLY; break;
 
267
                case READ_WRITE : t = O_RDWR; break;
 
268
                case APPEND     : t = O_RDWR; break;
 
269
                default         : oserror = EINVAL; return(-1);
 
270
        }
 
271
        
 
272
        if ( (fd = open(name,t)) == -1) {
 
273
#ifdef DEBUG
 
274
                printf (" mh  IOopen fd=%d errno=%d\n",fd,errno);
 
275
#endif
 
276
                oserror= errno;
 
277
                return(-1);
 
278
                }
 
279
 
 
280
        if ( fstat(fd,&buf) == -1) {
 
281
#ifdef DEBUG
 
282
                printf (" mh  IOopen  fstat=%d errno=%d\n",fstat,errno);
 
283
#endif
 
284
                oserror= errno;
 
285
                return(-1);
 
286
                }
 
287
 
 
288
        if ( (buf.st_mode & S_IFMT) != S_IFCHR) {
 
289
                oserror = -1;
 
290
                oserrmsg = "Osuopen: Not a character device";
 
291
                return(-1);
 
292
                }
 
293
        return(fd);
 
294
}
 
295
 
 
296
 
 
297
static int ioclose(fd)
 
298
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
299
.PURPOSE 
 
300
.RETURNS 
 
301
.REMARKS System dependencies:
 
302
 -- UNIX: close(2) 
 
303
------------------------------------------------------------*/
 
304
int fd;                 /* IN:  Tape file descriptor */
 
305
{
 
306
#ifdef DEBUG
 
307
printf ("ioclose\n");
 
308
#endif
 
309
        if (close(fd) == -1) {
 
310
                oserror = errno;
 
311
                return(-1);
 
312
                }
 
313
        return(0);
 
314
}
 
315
 
 
316
 
 
317
static int ioread(fd,buffer,size)
 
318
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
319
.PURPOSE Read a block from a magnetic tape.
 
320
.RETURNS Bytes read / -1 if error
 
321
.REMARKS 0 Bytes read, means a File Mark was detected.
 
322
.REMARKS System dependencies:
 
323
 -- UNIX: read(2), ioctl(2)
 
324
------------------------------------------------------------*/
 
325
int fd;                 /* IN:  Tape device file descriptor */
 
326
char *buffer;           /* IN:  Buffer for reading */
 
327
int size;               /* IN:  Length of bytes to be read */
 
328
{
 
329
        int length;
 
330
 
 
331
#ifdef DEBUG
 
332
        printf ("ioread  fd=%d size=%d  ",fd,size);
 
333
#endif
 
334
        if (size > TAPE_BLK ) size = TAPE_BLK;
 
335
        if ((length = read(fd,buffer,size)) == -1)      
 
336
                oserror = errno;
 
337
        return(length);
 
338
}
 
339
 
 
340
 
 
341
static int iowrite(fd,buffer,size)
 
342
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
343
.PURPOSE Write a block on a magnetic tape.
 
344
.RETURNS Bytes written / -1 (error)
 
345
.REMARKS System dependencies:
 
346
 -- UNIX: write(2), ioctl(2)
 
347
------------------------------------------------------------*/
 
348
int fd;                 /* IN:  Tape device file descriptor */
 
349
char *buffer;           /* IN:  Buffer for reading */
 
350
int size;               /* IN:  Length of bytes to be read */
 
351
{
 
352
        int length;
 
353
 
 
354
        oserror = 0;
 
355
 
 
356
        if ((length = write(fd,buffer,size)) == -1)
 
357
                oserror = errno;
 
358
#if DEBUG
 
359
        printf("iowrite %d to buffer of %d bytes\n", length, size);
 
360
#endif
 
361
        return(length);
 
362
}
 
363
 
 
364
static int ioweof(fd,ntm)
 
365
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
366
.PURPOSE Write end-of-file record (tape_mark) on the tape.
 
367
.RETURNS Tape marks written/ -1 (error)
 
368
.REMARKS System dependencies:
 
369
 -- UNIX: ioctl(2)
 
370
------------------------------------------------------------*/
 
371
int fd;                 /* IN:  Tape device file descriptor */
 
372
int ntm;                /* IN:  Number of tape marks */
 
373
{
 
374
 
 
375
#ifdef DEBUG
 
376
printf ("ioweof  ntm=%d\n",ntm);
 
377
#endif
 
378
        if (ioctop(fd,MTIOWEOF,ntm) == -1)
 
379
                return(-1);
 
380
        else 
 
381
                return(ntm);
 
382
}
 
383
 
 
384
 
 
385
static int iofsf(fd,ntm)
 
386
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
387
.PURPOSE Skip forward space file on a tape. 
 
388
.RETURNS Tape marks skipped/ -1 (error)
 
389
.REMARKS System dependencies:
 
390
 -- UNIX: ioctl(2)
 
391
------------------------------------------------------------*/
 
392
int fd;                 /* IN:  Tape device file descriptor */
 
393
int ntm;                /* IN:  Number of tape marks */
 
394
{
 
395
        int ret, stat;
 
396
 
 
397
#ifdef DEBUG
 
398
printf ("iofsf\n");
 
399
printf("lyon iofsf entered fd=%d ntm=%d\n",fd,ntm);
 
400
#endif
 
401
        stat = ioctop(fd,MTIOFSF,ntm);
 
402
#ifdef DEBUG
 
403
        printf("lyon iofsf stat = %d oserror=%d\n",stat,oserror);
 
404
#endif
 
405
 
 
406
        switch(stat) {
 
407
        case M_ST_SUCC:                 /* Command OK */
 
408
                /*oserror = 0; */ /* mh 9.8.90 */
 
409
                ret = ntm; 
 
410
                break;
 
411
        case M_ST_DATA:                 /* End of data */
 
412
                oserror = 0;
 
413
                ret = 0; 
 
414
                break;
 
415
        default: 
 
416
                ret = -1; 
 
417
                break;
 
418
        }
 
419
        return(ret);
 
420
 
 
421
}
 
422
 
 
423
 
 
424
static int iobsf(fd,ntm)
 
425
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
426
.PURPOSE Skip backward space file on a tape. 
 
427
.RETURNS Tape marks skipped/ -1 (error)
 
428
.REMARKS System dependencies:
 
429
 -- UNIX: ioctl(2)
 
430
------------------------------------------------------------*/
 
431
int fd;                 /* IN:  Tape device file descriptor */
 
432
int ntm;                /* IN:  Number of tape marks */
 
433
{
 
434
        int ret, stat;
 
435
 
 
436
#ifdef DEBUG
 
437
printf ("iobsf\n");
 
438
#endif
 
439
/* je recule de ntm+1 file mark et je re avance de 1 file mark, sauf si
 
440
en reculant j'ai atteint le debut de bande */
 
441
        stat = ioctop(fd,MTIOBSF,ntm+1);
 
442
 
 
443
        switch(stat) {
 
444
        case M_ST_SUCC:                 /* Command OK  je ravance de 1 file mark*/
 
445
                stat=ioctop(fd,MTIOFSF,1);
 
446
                 switch(stat) {
 
447
                 case M_ST_SUCC:   
 
448
                        ret = ntm;
 
449
                        break;
 
450
                 default:
 
451
                    ret = -1;
 
452
                    break;
 
453
                 }
 
454
                break;
 
455
        case M_ST_BOT:                  /* Beggining of tape */
 
456
                oserror = 0;
 
457
                ret = 0; 
 
458
                break;
 
459
 
 
460
        default: 
 
461
                ret = -1; 
 
462
                break;
 
463
        }
 
464
        return(ret);
 
465
 
 
466
}
 
467
 
 
468
 
 
469
static int iorew(fd)
 
470
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
471
.PURPOSE Rewind tape
 
472
.RETURNS 0 / -1 (error)
 
473
.REMARKS System dependencies:
 
474
 -- UNIX: ioctl(2)
 
475
------------------------------------------------------------*/
 
476
int fd;                 /* IN:  Tape device file descriptor */
 
477
{
 
478
#ifdef DEBUG
 
479
printf ("iorew\n");
 
480
#endif
 
481
        if (ioctop(fd,MTIOREW,1) == -1)
 
482
                return(-1);
 
483
        else 
 
484
                return(0);
 
485
}
 
486
 
 
487
 
 
488
static int iofsr(fd,count)
 
489
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
490
.PURPOSE Forward space record on tape
 
491
.RETURNS records skipped/ -1 (error)
 
492
.REMARKS System dependencies:
 
493
 -- UNIX: ioctl(2)
 
494
------------------------------------------------------------*/
 
495
int fd;                 /* IN:  Tape device file descriptor */
 
496
int count;              /* IN:  Number of records */
 
497
{
 
498
        int ret, stat;
 
499
 
 
500
#ifdef DEBUG
 
501
printf ("iofsr\n");
 
502
#endif
 
503
 
 
504
        stat = ioctop(fd,MTIOFSR,count);
 
505
 
 
506
        switch(stat) {
 
507
        case M_ST_SUCC:                 /* Command OK */
 
508
                ret = count; 
 
509
                break;
 
510
        case M_ST_DATA:                 /* End of records */
 
511
                oserror = 0;
 
512
                ret = 0; 
 
513
                break;
 
514
        default: 
 
515
                ret = -1; 
 
516
                break;
 
517
        }
 
518
        return(ret);
 
519
 
 
520
}
 
521
 
 
522
 
 
523
static int iobsr(fd,count)
 
524
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
525
.PURPOSE Backward space record on tape
 
526
.RETURNS records skipped/ -1 (error)
 
527
.REMARKS System dependencies:
 
528
 -- UNIX: ioctl(2)
 
529
------------------------------------------------------------*/
 
530
int fd;                 /* IN:  Tape device file descriptor */
 
531
int count;              /* IN:  Number of records */
 
532
{
 
533
        int ret, stat;
 
534
 
 
535
#ifdef DEBUG
 
536
printf ("iobsr\n");
 
537
#endif
 
538
        stat = ioctop(fd,MTIOBSR,count);
 
539
 
 
540
        switch(stat) {
 
541
        case M_ST_SUCC:                 /* Command OK */
 
542
                ret = count; 
 
543
                break;
 
544
/*      case M_ST_BOT:          
 
545
*               oserror = 0;
 
546
*               ret = 0; 
 
547
*               break;
 
548
*/
 
549
        default: 
 
550
                ret = -1; 
 
551
                break;
 
552
        }
 
553
        return(ret);
 
554
 
 
555
}
 
556
 
 
557
 
 
558
int iocse(fd)
 
559
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
560
.PURPOSE Clear a serious exception.
 
561
.RETURNS 0 / -1 (error)
 
562
.REMARKS System dependencies:
 
563
 -- UNIX: ioctl(2)
 
564
------------------------------------------------------------*/
 
565
int fd;                 /* IN:  Tape device file descriptor */
 
566
{
 
567
 
 
568
#ifdef DEBUG
 
569
printf("iocse\n");
 
570
#endif
 
571
        return(-1);     /* MTCSE does not exit */
 
572
}
 
573
 
 
574
static int ioeom(fd)
 
575
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
576
.PURPOSE Move to EOMedia
 
577
.RETURNS 0 (OK) / -1 (not done, error)
 
578
------------------------------------------------------------*/
 
579
int fd;                 /* IN:  Tape device file descriptor */
 
580
{
 
581
#ifdef DEBUG
 
582
        printf ("ioeom \n");
 
583
#endif
 
584
        return(-1);
 
585
}
 
586
 
 
587
static int iosread(fd, spos, ssize, buffer, size)
 
588
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
589
.PURPOSE Read a block from a unit
 
590
.RETURNS Bytes read / -1 if error
 
591
------------------------------------------------------------*/
 
592
int     fd;             /* IN:  File descriptor */
 
593
long    spos;           /* IN:  Sector Number */
 
594
int     ssize;          /* IN:  Size of one sector */
 
595
char    *buffer;        /* IN:  Buffer for reading */
 
596
int     size;           /* IN:  Length of bytes to be read */
 
597
{
 
598
#ifdef DEBUG
 
599
printf ("iosread\n");
 
600
#endif
 
601
        return(-1);
 
602
}
 
603
 
 
604
static int ioswrite(fd, spos, ssize, buffer, size)
 
605
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
606
.PURPOSE Read a block from a unit
 
607
.RETURNS Bytes read / -1 if error
 
608
------------------------------------------------------------*/
 
609
int     fd;             /* IN:  File descriptor */
 
610
long    spos;           /* IN:  Sector Number */
 
611
int     ssize;          /* IN:  Size of one sector */
 
612
char    *buffer;        /* IN:  Buffer for reading */
 
613
int     size;           /* IN:  Length of bytes to be read */
 
614
{       
 
615
#ifdef DEBUG
 
616
printf ("ioswrite\n");
 
617
#endif
 
618
        return(-1);
 
619
}
 
620
 
 
621
 
 
622
/*=====================================================================
 
623
 *              Definition of the structure returned to osu
 
624
 *=====================================================================*/
 
625
 
 
626
/*   struct iolist *iodev1();*/ /* Next iodev in List */
 
627
 
 
628
 
 
629
static OPITEM list_of_functions[] = {
 
630
        { U_INFO,       ioinfo},
 
631
        { U_OPEN,       ioopen},                        
 
632
        { U_CLOSE,      ioclose},                       
 
633
        { U_READ,       ioread},                        
 
634
        { U_WRITE,      iowrite},                       
 
635
        { U_REWIND,     iorew},                         
 
636
        { U_WEOF,       ioweof},                        
 
637
        { U_SREAD,      iosread},     
 
638
        { U_SWRITE,     ioswrite},    
 
639
        { U_FMF,        iofsf},
 
640
        { U_FMB,        iobsf},
 
641
        { U_BMF,        iofsr},
 
642
        { U_BMB,        iobsr}
 
643
 };
 
644
 
 
645
static struct iolist this_dev = {
 
646
        (IODEV)0,               /* No Next iodev in List */
 
647
        class_name,     /* How it's written in DEVCAPFILE */
 
648
        sizeof(list_of_functions)/sizeof(list_of_functions[0]),
 
649
        list_of_functions
 
650
 };
 
651
 
 
652
struct iolist *iodev()
 
653
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
654
.PURPOSE Get All definitions concerning this class of Devices
 
655
.RETURNS The iolist
 
656
.REMARKS Simply returns the local iolist address...
 
657
------------------------------------------------------------*/
 
658
{
 
659
        return(&this_dev);
 
660
}
 
661