Changeset 8973acd in buchla-68k for libcio/write.c
- Timestamp:
- 07/15/2017 03:12:10 PM (7 years ago)
- Branches:
- master
- Children:
- ea232f9
- Parents:
- 7d0d347
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcio/write.c
r7d0d347 r8973acd 12 12 /* write routine dispatch table */ 13 13 14 static int16_t (*wr_tab[])(io_arg arg, int8_t*buff, int16_t len) = {14 static int16_t (*wr_tab[])(io_arg arg, void *buff, int16_t len) = { 15 15 16 16 _badfio, /* 0 - invalid entry */ … … 25 25 */ 26 26 27 int16_t _putsec(struct fcb *fp, int8_t *buf, uint16_t len)27 int16_t _putsec(struct fcb *fp, void *buf, int16_t len) 28 28 { 29 29 #if DEBUGIT … … 92 92 */ 93 93 94 int16_t _filewr( struct fcb *fp, int8_t *buffer, uint16_t len)94 int16_t _filewr(io_arg arg, void *buffer, int16_t len) 95 95 { 96 register uint16_t j, k, l; 96 struct fcb *fp; 97 int8_t *buffer8; 98 register int16_t j, k, l; 97 99 int16_t clustr; 98 register int32_t curpos; 99 100 curpos = fp->offset + (fp->curlsn << FILESHFT); /* get position */ 100 register int32_t cpos; 101 102 fp = (struct fcb *)arg; 103 buffer8 = buffer; 104 105 cpos = fp->offset + ((int32_t)fp->curlsn << FILESHFT); /* get position */ 101 106 102 107 if (fp->de.bclust EQ 0) { /* see if we need to allocate */ … … 104 109 #if DEBUGIT 105 110 if (fsdebug) 106 if (c urpos)111 if (cpos) 107 112 printf("_filewr(): ERROR - bclust EQ 0 and curpos (%ld) NE 0\n", 108 c urpos);113 cpos); 109 114 #endif 110 115 … … 115 120 } 116 121 117 fp->de.bclust = micon s(clustr);/* update FCB */122 fp->de.bclust = micon16((uint16_t)clustr); /* update FCB */ 118 123 _ptcl12(_thefat, clustr, 0x0FF8); /* update FAT */ 119 124 _fatmod = TRUE; … … 137 142 if (fsdebug) 138 143 printf("_filewr(): init pos=%ld, len=%u, curcls=%u, offset=%u\n", 139 c urpos, len, fp->curcls, fp->offset);144 cpos, len, fp->curcls, fp->offset); 140 145 #endif 141 146 … … 145 150 l = len; 146 151 147 if (_putsec(fp, buffer , l)) /* fill up the sector */152 if (_putsec(fp, buffer8, l)) /* fill up the sector */ 148 153 return(-1); 149 154 } 150 155 151 if ( k = (len - l) / BPSEC) { /* write out any full sectors */152 153 if ((j = blkwr(fp, buffer + l, k)) NE 0) {156 if ((k = (len - l) / BPSEC)) { /* write out any full sectors */ 157 158 if ((j = blkwr(fp, buffer8 + l, k)) NE 0) { 154 159 155 160 l += (k - j) * BPSEC; /* update amount written */ 156 161 157 if ((c urpos + l) > fp->curlen) /* udpate file length */158 fp->de.flen = micon l(fp->curlen = curpos + l);162 if ((cpos + l) > fp->curlen) /* udpate file length */ 163 fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + l)); 159 164 160 165 #if DEBUGIT … … 172 177 if (l < len) { /* write out partial sector at end */ 173 178 174 if (_putsec(fp, buffer + l, len - l)) {175 176 if ((c urpos + l) > fp->curlen) /* update file length */177 fp->de.flen = micon l(fp->curlen = curpos + l);179 if (_putsec(fp, buffer8 + l, len - l)) { 180 181 if ((cpos + l) > fp->curlen) /* update file length */ 182 fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + l)); 178 183 179 184 #if DEBUGIT … … 187 192 } 188 193 189 if ((c urpos + len) > fp->curlen) /* update file length */190 fp->de.flen = micon l(fp->curlen = curpos + len);194 if ((cpos + len) > fp->curlen) /* update file length */ 195 fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + len)); 191 196 192 197 #if DEBUGIT … … 205 210 */ 206 211 207 int16_t write(int16_t fd, int8_t *buff, uint16_t len)212 int16_t write(int16_t fd, void *buff, int16_t len) 208 213 { 209 214 register struct channel *chp;
Note:
See TracChangeset
for help on using the changeset viewer.