Changeset 7258c6a in buchla-68k for libcio/filesys.c


Ignore:
Timestamp:
07/09/2017 04:45:34 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
8618599
Parents:
0292fbb
Message:

Use standard integer types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcio/filesys.c

    r0292fbb r7258c6a  
    2929#define DE_NULL         ((struct dirent *)0L)
    3030
    31 extern  short   micons(short wi);
    32 extern  long    miconl(long wi);
    33 extern  void    _ptcl12(unsigned *fat, unsigned cl, unsigned val);
    34 extern  char    *FilName(char *s, char *p);
    35 extern  char    *FilExt(char *s, char *p);
     31extern  int16_t micons(int16_t wi);
     32extern  int32_t miconl(int32_t wi);
     33extern  void    _ptcl12(uint16_t *fat, uint16_t cl, uint16_t val);
     34extern  int8_t  *FilName(int8_t *s, int8_t *p);
     35extern  int8_t  *FilExt(int8_t *s, int8_t *p);
    3636
    3737#if DEBUGIT
     
    4444struct  dirent  *_dptr;                 /* internal directory pointer */
    4545
    46 unsigned _thefat[MAXFAT * WDPSEC];      /* file allocation table */
    47 
    48 int     _fatin;                         /* FAT has been read */
    49 int     _dirin;                         /* directory has been read */
    50 int     _bpbin;                         /* BPB has been read */
    51 int     _fatmod;                        /* FAT modified flag */
    52 int     _dirmod;                        /* directory modified flag */
    53 
    54 long    _berrno;                        /* BIOS error number */
     46uint16_t _thefat[MAXFAT * WDPSEC];      /* file allocation table */
     47
     48int16_t _fatin;                         /* FAT has been read */
     49int16_t _dirin;                         /* directory has been read */
     50int16_t _bpbin;                         /* BPB has been read */
     51int16_t _fatmod;                        /* FAT modified flag */
     52int16_t _dirmod;                        /* directory modified flag */
     53
     54int32_t _berrno;                        /* BIOS error number */
    5555
    5656/*
     
    6666*/
    6767
    68 unsigned _cl2lsn(struct bpb *bpp, unsigned clnum)
     68uint16_t _cl2lsn(struct bpb *bpp, uint16_t clnum)
    6969{
    7070        return(bpp->datrec + (bpp->clsiz * (clnum - 2)) );
     
    7878*/
    7979
    80 unsigned _gtcl12(char *fat, unsigned cl)
    81 {
    82         register unsigned cla, clt;
     80uint16_t _gtcl12(int8_t *fat, uint16_t cl)
     81{
     82        register uint16_t cla, clt;
    8383
    8484        cla = cl + (cl >> 1);
    85         clt = ((unsigned)0xFF00 & (fat[cla+1] << 8))
    86                 | ((unsigned)0x00FF & fat[cla]);
     85        clt = ((uint16_t)0xFF00 & (fat[cla+1] << 8))
     86                | ((uint16_t)0x00FF & fat[cla]);
    8787
    8888        if (cl & 1)
    8989                clt >>= 4;
    9090
    91         clt &= (unsigned)0x0FFF;
     91        clt &= (uint16_t)0x0FFF;
    9292        return(clt);
    9393}
     
    104104*/
    105105
    106 unsigned _getfat(unsigned *bufad, unsigned nfat, struct bpb *bpp)
    107 {
    108         unsigned fatsec;
     106uint16_t _getfat(uint16_t *bufad, uint16_t nfat, struct bpb *bpp)
     107{
     108        uint16_t fatsec;
    109109
    110110        fatsec = nfat ? bpp->fatrec : (bpp->fatrec - bpp->fsiz);
    111         return(BIOS(B_RDWR, 0, (char *)bufad, bpp->fsiz, fatsec, 0));
     111        return(BIOS(B_RDWR, 0, (int8_t *)bufad, bpp->fsiz, fatsec, 0));
    112112}
    113113
     
    123123*/
    124124
    125 int _rdfat(unsigned *bufad, struct bpb *bpp)
     125int16_t _rdfat(uint16_t *bufad, struct bpb *bpp)
    126126{
    127127        if (_getfat(bufad, bpp, 0)) {
     
    143143*/
    144144
    145 int _rdroot(unsigned *buf, struct bpb *bpp)
    146 {
    147         return(BIOS(B_RDWR, 0, (char *)buf, bpp->rdlen,
     145int16_t _rdroot(uint16_t *buf, struct bpb *bpp)
     146{
     147        return(BIOS(B_RDWR, 0, (int8_t *)buf, bpp->rdlen,
    148148                (bpp->fatrec + bpp->fsiz), 0));
    149149}
     
    162162*/
    163163
    164 int _nsic(struct fcb *fcp, struct bpb *bpp, char *fp)
    165 {
    166         register unsigned tfe;
     164int16_t _nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp)
     165{
     166        register uint16_t tfe;
    167167
    168168        /* check the FCB flags */
     
    261261struct dirent *_dsrch(struct dirent *de)
    262262{
    263         unsigned i, dl;
     263        uint16_t i, dl;
    264264        register struct dirent *dp;
    265265
     
    298298struct dirent *_dsnew(void)
    299299{
    300         unsigned i, dl;
     300        uint16_t i, dl;
    301301        register struct dirent *dp;
    302302
     
    332332*/
    333333
    334 void _deadio(struct fcb *fcp, int err)
     334void _deadio(struct fcb *fcp, int16_t err)
    335335{
    336336        fcp->clsec = 0;
     
    355355*/
    356356
    357 int _seek(struct fcb *fcp)
    358 {
    359         register unsigned acls, rcls, nc;
    360         unsigned sic, spc;
     357int16_t _seek(struct fcb *fcp)
     358{
     359        register uint16_t acls, rcls, nc;
     360        uint16_t sic, spc;
    361361
    362362        if (!(fcp->modefl & FC_OPN)) {          /* file must be open */
     
    461461*/
    462462
    463 int _ftrnc(struct dirent *dp)
    464 {
    465         register unsigned acls, ncls;
     463int16_t _ftrnc(struct dirent *dp)
     464{
     465        register uint16_t acls, ncls;
    466466
    467467#if     DEBUGIT
     
    525525*/
    526526
    527 int _newcls(void)
    528 {
    529         register int tc, i;
     527int16_t _newcls(void)
     528{
     529        register int16_t tc, i;
    530530
    531531        tc = _thebpb->numcl;
     
    548548*/
    549549
    550 int _alcnew(struct fcb *fcp)
    551 {
    552         register int ac, nc, pc;
     550int16_t _alcnew(struct fcb *fcp)
     551{
     552        register int16_t ac, nc, pc;
    553553
    554554#if     DEBUGIT
     
    639639*/
    640640
    641 int _fmake(struct fcb *fcp)
     641int16_t _fmake(struct fcb *fcp)
    642642{
    643643        register struct dirent *dp;
     
    664664*/
    665665
    666 int _opnvol(void)
    667 {
    668         register long drc;
     666int16_t _opnvol(void)
     667{
     668        register int32_t drc;
    669669
    670670        /* check for media change if we already have a BPB */
     
    750750*/
    751751
    752 int _opfcb(struct fcb *fcp)
    753 {
    754         int     rc;
     752int16_t _opfcb(struct fcb *fcp)
     753{
     754        int16_t rc;
    755755
    756756        /* check for an already open FCB */
     
    892892*/
    893893
    894 int _inifcb(struct fcb *fcp, char *name, char *ext, int mode)
    895 {
    896         int     fl;
    897         register int    i;
    898         register char *s1, *s2, c;
     894int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode)
     895{
     896        int16_t fl;
     897        register int16_t        i;
     898        register int8_t *s1, *s2, c;
    899899
    900900        /* clear the FCB */
    901901
    902         memset((char *)fcp, 0, sizeof (struct fcb));
     902        memset((int8_t *)fcp, 0, sizeof (struct fcb));
    903903
    904904        /* check for valid flags */
     
    10241024*/
    10251025
    1026 int ClsFile(struct fcb *fcp)
     1026int16_t ClsFile(struct fcb *fcp)
    10271027{
    10281028        register struct dirent *dp;
     
    11361136*/
    11371137
    1138 short fcbinit(char *name, struct fcb *fcp)
    1139 {
    1140         char    tmpname[9], tmpext[4];
     1138int16_t fcbinit(int8_t *name, struct fcb *fcp)
     1139{
     1140        int8_t  tmpname[9], tmpext[4];
    11411141
    11421142        return(_inifcb(fcp, FilName(name, tmpname), FilExt(name, tmpext), 0));
     
    11531153*/
    11541154
    1155 int DelFile(struct fcb *fcp)
     1155int16_t DelFile(struct fcb *fcp)
    11561156{
    11571157#if     DEBUGIT
Note: See TracChangeset for help on using the changeset viewer.