- Timestamp:
- 07/16/2017 12:10:45 PM (7 years ago)
- Branches:
- master
- Children:
- 1c4f9be
- Parents:
- 0c06bc5
- Location:
- libcio
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
libcio/filesys.c
r0c06bc5 rf261cc8 783 783 ============================================================================= 784 784 _inifcb(fcp, name, ext, mode) -- initialize FCB pointed to by 'fcp' 785 for file named 'name'.'ext' in mode 'mode'.785 for file named 'name'.'ext'. 786 786 Returns SUCCESS (0) if ok, FAILURE (-1) if not. 787 787 ============================================================================= 788 788 */ 789 789 790 int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t mode)790 int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t flags) 791 791 { 792 792 int16_t fl; … … 800 800 /* check for valid flags */ 801 801 802 if ( mode& ~(O_WRONLY|O_RDWR|O_NDELAY|O_APPEND|O_CREAT|O_TRUNC|O_EXCL|O_RAW))802 if (flags & ~(O_WRONLY|O_RDWR|O_NDELAY|O_APPEND|O_CREAT|O_TRUNC|O_EXCL|O_RAW)) 803 803 return(FAILURE); 804 804 … … 871 871 /* set the flags in the FCB and exit */ 872 872 873 if ( mode& O_RDONLY)873 if (flags & O_RDONLY) 874 874 fcp->modefl |= FC_RD; 875 875 876 if ( mode& O_WRONLY)876 if (flags & O_WRONLY) 877 877 fcp->modefl |= FC_WR; 878 878 879 if ( mode& O_RDWR)879 if (flags & O_RDWR) 880 880 fcp->modefl |= FC_RW; 881 881 882 if ( mode& O_NDELAY)882 if (flags & O_NDELAY) 883 883 fcp->modefl |= FC_NB; 884 884 885 if ( mode& O_APPEND)885 if (flags & O_APPEND) 886 886 fcp->modefl |= FC_AP; 887 887 888 if ( mode& O_CREAT)888 if (flags & O_CREAT) 889 889 fcp->modefl |= FC_CR; 890 890 891 if ( mode& O_TRUNC)891 if (flags & O_TRUNC) 892 892 fcp->modefl |= FC_TR; 893 893 894 if ( mode& O_EXCL)894 if (flags & O_EXCL) 895 895 fcp->modefl |= FC_EX; 896 896 897 if ( mode& O_RAW)897 if (flags & O_RAW) 898 898 fcp->modefl |= FC_BF; 899 899 -
libcio/fopen.c
r0c06bc5 rf261cc8 8 8 #include "ram.h" 9 9 10 FILE *_opener(int8_t *name, int8_t *mode, uint16_t raw flg)10 FILE *_opener(int8_t *name, int8_t *mode, uint16_t raw) 11 11 { 12 12 register FILE *fp; … … 26 26 27 27 case 'r': /* read mode */ 28 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY) | raw flg)) EQ -1)28 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY) | raw)) EQ -1) 29 29 return(NULL); 30 30 break; 31 31 32 32 case 'w': /* write mode */ 33 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC|raw flg)) EQ -1)33 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC|raw)) EQ -1) 34 34 return(NULL); 35 35 … … 37 37 38 38 case 'a': /* append mode */ 39 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|raw flg)) EQ -1)39 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|raw)) EQ -1) 40 40 return(NULL); 41 41 -
libcio/fopen.x
r0c06bc5 rf261cc8 16 16 */ 17 17 18 extern FILE *_opener(int8_t *name, int8_t *mode, uint16_t aflag);18 extern FILE *_opener(int8_t *name, int8_t *mode, uint16_t raw); 19 19 extern FILE *fopen(int8_t *name, int8_t *mode); 20 20 extern FILE *fopena(int8_t *name, int8_t *mode); -
libcio/fsinit.c
r0c06bc5 rf261cc8 69 69 */ 70 70 71 int16_t _nopo(int8_t *name, uint16_t flag , struct channel *chp, struct devtabl *dp)71 int16_t _nopo(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp) 72 72 { 73 73 (void)name; 74 (void)flag ;74 (void)flags; 75 75 (void)chp; 76 76 (void)dp; -
libcio/fsinit.x
r0c06bc5 rf261cc8 46 46 extern int16_t _badfio(io_arg arg, void *buff, int16_t len); 47 47 extern int16_t _nopc(io_arg arg); 48 extern int16_t _nopo(int8_t *name, uint16_t flag , struct channel *chp, struct devtabl *dp);48 extern int16_t _nopo(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp); -
libcio/open.c
r0c06bc5 rf261cc8 34 34 */ 35 35 36 int16_t open(int8_t *name, uint16_t flag )36 int16_t open(int8_t *name, uint16_t flags) 37 37 { 38 38 register struct devtabl *dp; … … 58 58 59 59 dev = dp->d_dev; 60 mdmask = (flag & 3) + 1;60 mdmask = (flags & 3) + 1; 61 61 62 62 if (mdmask & 1) { /* see if device is readable */ … … 85 85 chp->c_close = _nopc; 86 86 87 if ((*dev->d_open)(name, flag , chp, dp) < 0) { /* open */87 if ((*dev->d_open)(name, flags, chp, dp) < 0) { /* open */ 88 88 89 89 chp->c_close = _badfc; /* couldn't open for some reason */ … … 96 96 /* 97 97 ============================================================================= 98 opena(name, flag, mode) -- Opens ASCII file 'name' with flags 'flag '99 and access mode 'mode'.Newline translation will be done.100 Returns a file descriptor (small positive integer) if successful, or 101 FAILURE (-1) if an error occurred. 102 ============================================================================= 103 */ 104 105 int16_t opena(int8_t *name, uint16_t flag )106 { 107 return(open(name, flag ));108 } 109 110 /* 111 ============================================================================= 112 openb(name, flag, mode) -- Opens binary file 'name' with flags 'flag '113 and access mode 'mode'.No newline translation is done.114 Returns a file descriptor (small positive integer) if successful, or 115 FAILURE (-1) if an error occurred. 116 ============================================================================= 117 */ 118 119 int16_t openb(int8_t *name, uint16_t flag )120 { 121 return(open(name, flag |O_RAW));122 } 123 124 /* 125 ============================================================================= 126 creat(name, mode) -- Creates file 'name' with access mode 'mode'.98 opena(name, flag, mode) -- Opens ASCII file 'name' with flags 'flags' 99 Newline translation will be done. 100 Returns a file descriptor (small positive integer) if successful, or 101 FAILURE (-1) if an error occurred. 102 ============================================================================= 103 */ 104 105 int16_t opena(int8_t *name, uint16_t flags) 106 { 107 return(open(name, flags)); 108 } 109 110 /* 111 ============================================================================= 112 openb(name, flag, mode) -- Opens binary file 'name' with flags 'flags'. 113 No newline translation is done. 114 Returns a file descriptor (small positive integer) if successful, or 115 FAILURE (-1) if an error occurred. 116 ============================================================================= 117 */ 118 119 int16_t openb(int8_t *name, uint16_t flags) 120 { 121 return(open(name, flags|O_RAW)); 122 } 123 124 /* 125 ============================================================================= 126 creat(name, mode) -- Creates file 'name'. 127 127 The created file is initially open for writing only. The file 128 will be ASCII unless mode contains O_RAW.128 will be ASCII. 129 129 Returns a file descriptor (small positive integer) if successful, or 130 130 FAILURE (-1) if an error occurred. … … 139 139 /* 140 140 ============================================================================= 141 creata(name, mode) -- Creates ASCII file 'name' with access mode 'mode'.141 creata(name, mode) -- Creates ASCII file 'name'. 142 142 The created file is initially open for writing only. 143 143 Files created with creata() do newline translations. … … 154 154 /* 155 155 ============================================================================= 156 creatb(name, mode) -- create binary file 'name' with access mode 'mode'.156 creatb(name, mode) -- create binary file 'name'. 157 157 The created file is initially open for writing only. 158 158 Files created with creatb don't do newline translations. … … 175 175 */ 176 176 177 int16_t _fileop(int8_t *name, uint16_t flag , struct channel *chp, struct devtabl *dp)177 int16_t _fileop(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp) 178 178 { 179 179 register struct fcb *fp; … … 195 195 /* setup the initial fcb */ 196 196 197 if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flag )) {197 if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flags)) { 198 198 199 199 errno = EINVAL; /* bad file name or flags */ -
libcio/open.x
r0c06bc5 rf261cc8 16 16 */ 17 17 18 extern int16_t _fileop(int8_t *name, uint16_t flag , struct channel *chp, struct devtabl *dp);18 extern int16_t _fileop(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp); 19 19 extern int16_t creat(int8_t *name); 20 20 extern int16_t creata(int8_t *name); 21 21 extern int16_t creatb(int8_t *name); 22 extern int16_t open(int8_t *name, uint16_t flag );23 extern int16_t opena(int8_t *name, uint16_t flag );24 extern int16_t openb(int8_t *name, uint16_t flag );22 extern int16_t open(int8_t *name, uint16_t flags); 23 extern int16_t opena(int8_t *name, uint16_t flags); 24 extern int16_t openb(int8_t *name, uint16_t flags); -
libcio/putl.c
r0c06bc5 rf261cc8 21 21 return; 22 22 23 putc(( w & 0xFF), stream);23 putc((int16_t)(w & 0xFF), stream); 24 24 } 25 25 -
libcio/putw.c
r0c06bc5 rf261cc8 12 12 void putw(int32_t w, FILE *stream) 13 13 { 14 if (putc(( (w >> 8) & 0xFF), stream) < 0 )14 if (putc((int16_t)((w >> 8) & 0xFF), stream) < 0 ) 15 15 return; 16 16 17 putc(( w & 0xFF), stream);17 putc((int16_t)(w & 0xFF), stream); 18 18 } 19 19
Note:
See TracChangeset
for help on using the changeset viewer.