Changeset f261cc8 in buchla-68k for libcio/open.c
- Timestamp:
- 07/16/2017 12:10:45 PM (7 years ago)
- Branches:
- master
- Children:
- 1c4f9be
- Parents:
- 0c06bc5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 */
Note:
See TracChangeset
for help on using the changeset viewer.