Changeset f261cc8 in buchla-68k for libcio/open.c


Ignore:
Timestamp:
07/16/2017 12:10:45 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
1c4f9be
Parents:
0c06bc5
Message:

Minor cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcio/open.c

    r0c06bc5 rf261cc8  
    3434*/
    3535
    36 int16_t open(int8_t *name, uint16_t flag)
     36int16_t open(int8_t *name, uint16_t flags)
    3737{
    3838        register struct devtabl *dp;
     
    5858
    5959        dev = dp->d_dev;
    60         mdmask = (flag & 3) + 1;
     60        mdmask = (flags & 3) + 1;
    6161
    6262        if (mdmask & 1) {       /* see if device is readable */
     
    8585        chp->c_close = _nopc;
    8686
    87         if ((*dev->d_open)(name, flag, chp, dp) < 0) {  /* open */
     87        if ((*dev->d_open)(name, flags, chp, dp) < 0) { /* open */
    8888
    8989                chp->c_close = _badfc;  /* couldn't open for some reason */
     
    9696/*
    9797   =============================================================================
    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
     105int16_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
     119int16_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'.
    127127        The created file is initially open for writing only.  The file
    128         will be ASCII unless mode contains O_RAW.
     128        will be ASCII.
    129129        Returns a file descriptor (small positive integer) if successful, or
    130130        FAILURE (-1) if an error occurred.
     
    139139/*
    140140   =============================================================================
    141         creata(name, mode) -- Creates ASCII file 'name' with access mode 'mode'.
     141        creata(name, mode) -- Creates ASCII file 'name'.
    142142        The created file is initially open for writing only.
    143143        Files created with creata() do newline translations.
     
    154154/*
    155155   =============================================================================
    156         creatb(name, mode) -- create binary file 'name' with access mode 'mode'.
     156        creatb(name, mode) -- create binary file 'name'.
    157157        The created file is initially open for writing only.
    158158        Files created with creatb don't do newline translations.
     
    175175*/
    176176
    177 int16_t _fileop(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp)
     177int16_t _fileop(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp)
    178178{
    179179        register struct fcb *fp;
     
    195195        /* setup the initial fcb */
    196196
    197         if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flag)) {
     197        if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flags)) {
    198198
    199199                errno = EINVAL;         /* bad file name or flags */
Note: See TracChangeset for help on using the changeset viewer.