Changeset 662678d1 in rtems


Ignore:
Timestamp:
Aug 25, 2000, 1:13:57 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
1a3b281
Parents:
02fe6ab
Message:

2000-08-25 Joel Sherrill <joel.sherrill@…>

  • libc/isatty.c, libc/imfs_handlers_directory.c, libc/creat.c, libc/imfs_directory.c: Fixed style issues.
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/creat.c

    r02fe6ab r662678d1  
     1/*
     2 *  $Id$
     3 */
     4
    15/* creat() "system call" */
    26
  • c/src/exec/libcsupport/src/isatty.c

    r02fe6ab r662678d1  
    1 /* isatty.c */
    2 
    3 /* Dumb implementation so programs will at least run.  */
     1/*
     2 *  COPYRIGHT (c) 1989-1999.
     3 *  On-Line Applications Research Corporation (OAR).
     4 * 
     5 *  The license and distribution terms for this file may be
     6 *  found in the file LICENSE in this distribution or at
     7 *  http://www.OARcorp.com/rtems/license.html.
     8 *
     9 *  $Id$
     10 */
    411
    512#include <sys/stat.h>
    613
    7 int
    8 isatty (int fd)
     14int isatty(
     15  int fd
     16)
    917{
    1018  struct stat buf;
     
    1220  if (fstat (fd, &buf) < 0)
    1321    return 0;
     22
    1423  if (S_ISCHR (buf.st_mode))
    1524    return 1;
     25
    1626  return 0;
    1727}
  • c/src/exec/libfs/src/imfs/imfs_directory.c

    r02fe6ab r662678d1  
    11/*
    2  *  XXX
     2 *  IMFS Directory Access Routines
    33 *
    44 *  COPYRIGHT (c) 1989-1999.
     
    2626#include "libio_.h"
    2727
    28 /* -----------------------------------------------------------------------
    29  * This rountine will verify that the node being opened as a directory is
    30  * in fact a directory node. If it is then the offset into the directory
    31  * will be set to 0 to position to the first directory entry.
     28/*
     29 *  imfs_dir_open
     30 *
     31 *  This rountine will verify that the node being opened as a directory is
     32 *  in fact a directory node. If it is then the offset into the directory
     33 *  will be set to 0 to position to the first directory entry.
    3234 */
    3335
     
    4547
    4648  if ( the_jnode->type != IMFS_DIRECTORY )
    47      return -1;         /* It wasn't a directory --> return error */
     49     return -1;      /* It wasn't a directory --> return error */
    4850
    4951  iop->offset = 0;
     
    5153}
    5254
    53 
    54 
    55 /* -----------------------------------------------------------------------
    56  * This routine will read the next directory entry based on the directory
    57  * offset. The offset should be equal to -n- time the size of an individual
    58  * dirent structure. If n is not an integer multiple of the sizeof a
    59  * dirent structure, an integer division will be performed to determine
    60  * directory entry that will be returned in the buffer. Count should reflect
    61  * -m- times the sizeof dirent bytes to be placed in the buffer.
    62  * If there are not -m- dirent elements from the current directory position
    63  * to the end of the exisiting file, the remaining entries will be placed in
    64  * the buffer and the returned value will be equal to -m actual- times the
    65  * size of a directory entry.
     55/*
     56 *  imfs_dir_read
     57 *
     58 *  This routine will read the next directory entry based on the directory
     59 *  offset. The offset should be equal to -n- time the size of an individual
     60 *  dirent structure. If n is not an integer multiple of the sizeof a
     61 *  dirent structure, an integer division will be performed to determine
     62 *  directory entry that will be returned in the buffer. Count should reflect
     63 *  -m- times the sizeof dirent bytes to be placed in the buffer.
     64 *  If there are not -m- dirent elements from the current directory position
     65 *  to the end of the exisiting file, the remaining entries will be placed in
     66 *  the buffer and the returned value will be equal to -m actual- times the
     67 *  size of a directory entry.
    6668 */
    6769
     
    8082   IMFS_jnode_t      *the_jnode;
    8183   int                bytes_transferred;
    82    int                current_entry;
    83    int                first_entry;
    84    int                last_entry;
     84   int                current_entry;
     85   int                first_entry;
     86   int                last_entry;
    8587   struct dirent      tmp_dirent;
    8688
     
    101103
    102104   /* The directory was not empty so try to move to the desired entry in chain*/
    103    for(
     105   for (
    104106      current_entry = 0;
    105107      current_entry < last_entry;
     
    139141
    140142
    141 /* -----------------------------------------------------------------------
    142  * This routine will be called by the generic close routine to cleanup any
    143  * resources that have been allocated for the management of the file
     143/*
     144 *  imfs_dir_close
     145 *
     146 *  This routine will be called by the generic close routine to cleanup any
     147 *  resources that have been allocated for the management of the file
    144148 */
    145149
     
    148152)
    149153{
    150   /* The generic close routine handles the deallocation of the file control */
    151   /* and associated memory. At present the imfs_dir_close simply      */
    152   /* returns a successful completion status                                 */
     154  /*
     155   *  The generic close routine handles the deallocation of the file control
     156   *  and associated memory. At present the imfs_dir_close simply
     157   *  returns a successful completion status.
     158   */
    153159 
    154160  return 0;
     
    157163
    158164
    159 /* -----------------------------------------------------------------------
    160  * This routine will behave in one of three ways based on the state of
    161  * argument whence. Based on the state of its value the offset argument will
    162  * be interpreted using one of the following methods:
    163  *
    164  *      SEEK_SET - offset is the absolute byte offset from the start of the
    165  *                 logical start of the dirent sequence that represents the
    166  *                 directory
    167  *      SEEK_CUR - offset is used as the relative byte offset from the current
    168  *                 directory position index held in the iop structure
    169  *      SEEK_END - N/A --> This will cause an assert.
     165/*
     166 *  imfs_dir_lseek
     167 *
     168 *  This routine will behave in one of three ways based on the state of
     169 *  argument whence. Based on the state of its value the offset argument will
     170 *  be interpreted using one of the following methods:
     171 *
     172 *     SEEK_SET - offset is the absolute byte offset from the start of the
     173 *                logical start of the dirent sequence that represents the
     174 *                directory
     175 *     SEEK_CUR - offset is used as the relative byte offset from the current
     176 *                directory position index held in the iop structure
     177 *     SEEK_END - N/A --> This will cause an assert.
    170178 */
    171179
     
    181189
    182190
    183   switch( whence )
    184   {
    185      case SEEK_SET:     /* absolute move from the start of the file */
     191  switch( whence ) {
     192     case SEEK_SET:   /* absolute move from the start of the file */
    186193        iop->offset = normal_offset;
    187194        break;
    188195
    189      case SEEK_CUR:     /* relative move */
     196     case SEEK_CUR:   /* relative move */
    190197        iop->offset = iop->offset + normal_offset;
    191198        break;
    192199
    193      case SEEK_END:     /* Movement past the end of the directory via lseek */
    194                         /* is not a permitted operation                     */
     200     case SEEK_END:   /* Movement past the end of the directory via lseek */
     201                      /* is not a permitted operation                     */
    195202      default:
    196203        set_errno_and_return_minus_one( EINVAL );
     
    204211
    205212
    206 /* -----------------------------------------------------------------------
    207  * This routine will obtain the following information concerning the current
    208  * directory:
    209  *      st_dev          0ll
    210  *      st_ino          1
    211  *      st_mode         mode extracted from the jnode
    212  *      st_nlink        number of links to this node
    213  *      st_uid          uid extracted from the jnode
    214  *      st_gid          gid extracted from the jnode
    215  *      st_rdev         0ll
    216  *      st_size         the number of bytes in the directory
    217  *                      This is calculated by taking the number of entries
    218  *                      in the directory and multiplying by the size of a
    219  *                      dirent structure
    220  *      st_blksize      0
    221  *      st_blocks       0
    222  *      stat_atime      time of last access
    223  *      stat_mtime      time of last modification
    224  *      stat_ctime      time of the last change
    225  *
    226  * This information will be returned to the calling function in a -stat- struct
    227  *     
     213/*
     214 *  imfs_dir_fstat
     215 *
     216 *  This routine will obtain the following information concerning the current
     217 *  directory:
     218 *        st_dev      0ll
     219 *        st_ino      1
     220 *        st_mode     mode extracted from the jnode
     221 *        st_nlink    number of links to this node
     222 *        st_uid      uid extracted from the jnode
     223 *        st_gid      gid extracted from the jnode
     224 *        st_rdev     0ll
     225 *        st_size     the number of bytes in the directory
     226 *                    This is calculated by taking the number of entries
     227 *                    in the directory and multiplying by the size of a
     228 *                    dirent structure
     229 *        st_blksize  0
     230 *        st_blocks   0
     231 *        stat_atime  time of last access
     232 *        stat_mtime  time of last modification
     233 *        stat_ctime  time of the last change
     234 *
     235 *  This information will be returned to the calling function in a -stat- struct
     236 *
    228237 */
    229238
  • c/src/exec/libfs/src/imfs/imfs_handlers_directory.c

    r02fe6ab r662678d1  
    3737};
    3838
    39 
    40 
    41 
    42 
    43 
    44 
    45 
  • c/src/lib/ChangeLog

    r02fe6ab r662678d1  
     1
     22000-08-25      Joel Sherrill <joel.sherrill@OARcorp.com>
     3
     4        * libc/isatty.c, libc/imfs_handlers_directory.c, libc/creat.c,
     5        libc/imfs_directory.c: Fixed style issues.
    16
    272000-08-11  Chris Johns <ccj@acm.org>
  • c/src/lib/libc/creat.c

    r02fe6ab r662678d1  
     1/*
     2 *  $Id$
     3 */
     4
    15/* creat() "system call" */
    26
  • c/src/lib/libc/imfs_directory.c

    r02fe6ab r662678d1  
    11/*
    2  *  XXX
     2 *  IMFS Directory Access Routines
    33 *
    44 *  COPYRIGHT (c) 1989-1999.
     
    2626#include "libio_.h"
    2727
    28 /* -----------------------------------------------------------------------
    29  * This rountine will verify that the node being opened as a directory is
    30  * in fact a directory node. If it is then the offset into the directory
    31  * will be set to 0 to position to the first directory entry.
     28/*
     29 *  imfs_dir_open
     30 *
     31 *  This rountine will verify that the node being opened as a directory is
     32 *  in fact a directory node. If it is then the offset into the directory
     33 *  will be set to 0 to position to the first directory entry.
    3234 */
    3335
     
    4547
    4648  if ( the_jnode->type != IMFS_DIRECTORY )
    47      return -1;         /* It wasn't a directory --> return error */
     49     return -1;      /* It wasn't a directory --> return error */
    4850
    4951  iop->offset = 0;
     
    5153}
    5254
    53 
    54 
    55 /* -----------------------------------------------------------------------
    56  * This routine will read the next directory entry based on the directory
    57  * offset. The offset should be equal to -n- time the size of an individual
    58  * dirent structure. If n is not an integer multiple of the sizeof a
    59  * dirent structure, an integer division will be performed to determine
    60  * directory entry that will be returned in the buffer. Count should reflect
    61  * -m- times the sizeof dirent bytes to be placed in the buffer.
    62  * If there are not -m- dirent elements from the current directory position
    63  * to the end of the exisiting file, the remaining entries will be placed in
    64  * the buffer and the returned value will be equal to -m actual- times the
    65  * size of a directory entry.
     55/*
     56 *  imfs_dir_read
     57 *
     58 *  This routine will read the next directory entry based on the directory
     59 *  offset. The offset should be equal to -n- time the size of an individual
     60 *  dirent structure. If n is not an integer multiple of the sizeof a
     61 *  dirent structure, an integer division will be performed to determine
     62 *  directory entry that will be returned in the buffer. Count should reflect
     63 *  -m- times the sizeof dirent bytes to be placed in the buffer.
     64 *  If there are not -m- dirent elements from the current directory position
     65 *  to the end of the exisiting file, the remaining entries will be placed in
     66 *  the buffer and the returned value will be equal to -m actual- times the
     67 *  size of a directory entry.
    6668 */
    6769
     
    8082   IMFS_jnode_t      *the_jnode;
    8183   int                bytes_transferred;
    82    int                current_entry;
    83    int                first_entry;
    84    int                last_entry;
     84   int                current_entry;
     85   int                first_entry;
     86   int                last_entry;
    8587   struct dirent      tmp_dirent;
    8688
     
    101103
    102104   /* The directory was not empty so try to move to the desired entry in chain*/
    103    for(
     105   for (
    104106      current_entry = 0;
    105107      current_entry < last_entry;
     
    139141
    140142
    141 /* -----------------------------------------------------------------------
    142  * This routine will be called by the generic close routine to cleanup any
    143  * resources that have been allocated for the management of the file
     143/*
     144 *  imfs_dir_close
     145 *
     146 *  This routine will be called by the generic close routine to cleanup any
     147 *  resources that have been allocated for the management of the file
    144148 */
    145149
     
    148152)
    149153{
    150   /* The generic close routine handles the deallocation of the file control */
    151   /* and associated memory. At present the imfs_dir_close simply      */
    152   /* returns a successful completion status                                 */
     154  /*
     155   *  The generic close routine handles the deallocation of the file control
     156   *  and associated memory. At present the imfs_dir_close simply
     157   *  returns a successful completion status.
     158   */
    153159 
    154160  return 0;
     
    157163
    158164
    159 /* -----------------------------------------------------------------------
    160  * This routine will behave in one of three ways based on the state of
    161  * argument whence. Based on the state of its value the offset argument will
    162  * be interpreted using one of the following methods:
    163  *
    164  *      SEEK_SET - offset is the absolute byte offset from the start of the
    165  *                 logical start of the dirent sequence that represents the
    166  *                 directory
    167  *      SEEK_CUR - offset is used as the relative byte offset from the current
    168  *                 directory position index held in the iop structure
    169  *      SEEK_END - N/A --> This will cause an assert.
     165/*
     166 *  imfs_dir_lseek
     167 *
     168 *  This routine will behave in one of three ways based on the state of
     169 *  argument whence. Based on the state of its value the offset argument will
     170 *  be interpreted using one of the following methods:
     171 *
     172 *     SEEK_SET - offset is the absolute byte offset from the start of the
     173 *                logical start of the dirent sequence that represents the
     174 *                directory
     175 *     SEEK_CUR - offset is used as the relative byte offset from the current
     176 *                directory position index held in the iop structure
     177 *     SEEK_END - N/A --> This will cause an assert.
    170178 */
    171179
     
    181189
    182190
    183   switch( whence )
    184   {
    185      case SEEK_SET:     /* absolute move from the start of the file */
     191  switch( whence ) {
     192     case SEEK_SET:   /* absolute move from the start of the file */
    186193        iop->offset = normal_offset;
    187194        break;
    188195
    189      case SEEK_CUR:     /* relative move */
     196     case SEEK_CUR:   /* relative move */
    190197        iop->offset = iop->offset + normal_offset;
    191198        break;
    192199
    193      case SEEK_END:     /* Movement past the end of the directory via lseek */
    194                         /* is not a permitted operation                     */
     200     case SEEK_END:   /* Movement past the end of the directory via lseek */
     201                      /* is not a permitted operation                     */
    195202      default:
    196203        set_errno_and_return_minus_one( EINVAL );
     
    204211
    205212
    206 /* -----------------------------------------------------------------------
    207  * This routine will obtain the following information concerning the current
    208  * directory:
    209  *      st_dev          0ll
    210  *      st_ino          1
    211  *      st_mode         mode extracted from the jnode
    212  *      st_nlink        number of links to this node
    213  *      st_uid          uid extracted from the jnode
    214  *      st_gid          gid extracted from the jnode
    215  *      st_rdev         0ll
    216  *      st_size         the number of bytes in the directory
    217  *                      This is calculated by taking the number of entries
    218  *                      in the directory and multiplying by the size of a
    219  *                      dirent structure
    220  *      st_blksize      0
    221  *      st_blocks       0
    222  *      stat_atime      time of last access
    223  *      stat_mtime      time of last modification
    224  *      stat_ctime      time of the last change
    225  *
    226  * This information will be returned to the calling function in a -stat- struct
    227  *     
     213/*
     214 *  imfs_dir_fstat
     215 *
     216 *  This routine will obtain the following information concerning the current
     217 *  directory:
     218 *        st_dev      0ll
     219 *        st_ino      1
     220 *        st_mode     mode extracted from the jnode
     221 *        st_nlink    number of links to this node
     222 *        st_uid      uid extracted from the jnode
     223 *        st_gid      gid extracted from the jnode
     224 *        st_rdev     0ll
     225 *        st_size     the number of bytes in the directory
     226 *                    This is calculated by taking the number of entries
     227 *                    in the directory and multiplying by the size of a
     228 *                    dirent structure
     229 *        st_blksize  0
     230 *        st_blocks   0
     231 *        stat_atime  time of last access
     232 *        stat_mtime  time of last modification
     233 *        stat_ctime  time of the last change
     234 *
     235 *  This information will be returned to the calling function in a -stat- struct
     236 *
    228237 */
    229238
  • c/src/lib/libc/imfs_handlers_directory.c

    r02fe6ab r662678d1  
    3737};
    3838
    39 
    40 
    41 
    42 
    43 
    44 
    45 
  • c/src/lib/libc/isatty.c

    r02fe6ab r662678d1  
    1 /* isatty.c */
    2 
    3 /* Dumb implementation so programs will at least run.  */
     1/*
     2 *  COPYRIGHT (c) 1989-1999.
     3 *  On-Line Applications Research Corporation (OAR).
     4 * 
     5 *  The license and distribution terms for this file may be
     6 *  found in the file LICENSE in this distribution or at
     7 *  http://www.OARcorp.com/rtems/license.html.
     8 *
     9 *  $Id$
     10 */
    411
    512#include <sys/stat.h>
    613
    7 int
    8 isatty (int fd)
     14int isatty(
     15  int fd
     16)
    917{
    1018  struct stat buf;
     
    1220  if (fstat (fd, &buf) < 0)
    1321    return 0;
     22
    1423  if (S_ISCHR (buf.st_mode))
    1524    return 1;
     25
    1626  return 0;
    1727}
  • c/src/libfs/src/imfs/imfs_directory.c

    r02fe6ab r662678d1  
    11/*
    2  *  XXX
     2 *  IMFS Directory Access Routines
    33 *
    44 *  COPYRIGHT (c) 1989-1999.
     
    2626#include "libio_.h"
    2727
    28 /* -----------------------------------------------------------------------
    29  * This rountine will verify that the node being opened as a directory is
    30  * in fact a directory node. If it is then the offset into the directory
    31  * will be set to 0 to position to the first directory entry.
     28/*
     29 *  imfs_dir_open
     30 *
     31 *  This rountine will verify that the node being opened as a directory is
     32 *  in fact a directory node. If it is then the offset into the directory
     33 *  will be set to 0 to position to the first directory entry.
    3234 */
    3335
     
    4547
    4648  if ( the_jnode->type != IMFS_DIRECTORY )
    47      return -1;         /* It wasn't a directory --> return error */
     49     return -1;      /* It wasn't a directory --> return error */
    4850
    4951  iop->offset = 0;
     
    5153}
    5254
    53 
    54 
    55 /* -----------------------------------------------------------------------
    56  * This routine will read the next directory entry based on the directory
    57  * offset. The offset should be equal to -n- time the size of an individual
    58  * dirent structure. If n is not an integer multiple of the sizeof a
    59  * dirent structure, an integer division will be performed to determine
    60  * directory entry that will be returned in the buffer. Count should reflect
    61  * -m- times the sizeof dirent bytes to be placed in the buffer.
    62  * If there are not -m- dirent elements from the current directory position
    63  * to the end of the exisiting file, the remaining entries will be placed in
    64  * the buffer and the returned value will be equal to -m actual- times the
    65  * size of a directory entry.
     55/*
     56 *  imfs_dir_read
     57 *
     58 *  This routine will read the next directory entry based on the directory
     59 *  offset. The offset should be equal to -n- time the size of an individual
     60 *  dirent structure. If n is not an integer multiple of the sizeof a
     61 *  dirent structure, an integer division will be performed to determine
     62 *  directory entry that will be returned in the buffer. Count should reflect
     63 *  -m- times the sizeof dirent bytes to be placed in the buffer.
     64 *  If there are not -m- dirent elements from the current directory position
     65 *  to the end of the exisiting file, the remaining entries will be placed in
     66 *  the buffer and the returned value will be equal to -m actual- times the
     67 *  size of a directory entry.
    6668 */
    6769
     
    8082   IMFS_jnode_t      *the_jnode;
    8183   int                bytes_transferred;
    82    int                current_entry;
    83    int                first_entry;
    84    int                last_entry;
     84   int                current_entry;
     85   int                first_entry;
     86   int                last_entry;
    8587   struct dirent      tmp_dirent;
    8688
     
    101103
    102104   /* The directory was not empty so try to move to the desired entry in chain*/
    103    for(
     105   for (
    104106      current_entry = 0;
    105107      current_entry < last_entry;
     
    139141
    140142
    141 /* -----------------------------------------------------------------------
    142  * This routine will be called by the generic close routine to cleanup any
    143  * resources that have been allocated for the management of the file
     143/*
     144 *  imfs_dir_close
     145 *
     146 *  This routine will be called by the generic close routine to cleanup any
     147 *  resources that have been allocated for the management of the file
    144148 */
    145149
     
    148152)
    149153{
    150   /* The generic close routine handles the deallocation of the file control */
    151   /* and associated memory. At present the imfs_dir_close simply      */
    152   /* returns a successful completion status                                 */
     154  /*
     155   *  The generic close routine handles the deallocation of the file control
     156   *  and associated memory. At present the imfs_dir_close simply
     157   *  returns a successful completion status.
     158   */
    153159 
    154160  return 0;
     
    157163
    158164
    159 /* -----------------------------------------------------------------------
    160  * This routine will behave in one of three ways based on the state of
    161  * argument whence. Based on the state of its value the offset argument will
    162  * be interpreted using one of the following methods:
    163  *
    164  *      SEEK_SET - offset is the absolute byte offset from the start of the
    165  *                 logical start of the dirent sequence that represents the
    166  *                 directory
    167  *      SEEK_CUR - offset is used as the relative byte offset from the current
    168  *                 directory position index held in the iop structure
    169  *      SEEK_END - N/A --> This will cause an assert.
     165/*
     166 *  imfs_dir_lseek
     167 *
     168 *  This routine will behave in one of three ways based on the state of
     169 *  argument whence. Based on the state of its value the offset argument will
     170 *  be interpreted using one of the following methods:
     171 *
     172 *     SEEK_SET - offset is the absolute byte offset from the start of the
     173 *                logical start of the dirent sequence that represents the
     174 *                directory
     175 *     SEEK_CUR - offset is used as the relative byte offset from the current
     176 *                directory position index held in the iop structure
     177 *     SEEK_END - N/A --> This will cause an assert.
    170178 */
    171179
     
    181189
    182190
    183   switch( whence )
    184   {
    185      case SEEK_SET:     /* absolute move from the start of the file */
     191  switch( whence ) {
     192     case SEEK_SET:   /* absolute move from the start of the file */
    186193        iop->offset = normal_offset;
    187194        break;
    188195
    189      case SEEK_CUR:     /* relative move */
     196     case SEEK_CUR:   /* relative move */
    190197        iop->offset = iop->offset + normal_offset;
    191198        break;
    192199
    193      case SEEK_END:     /* Movement past the end of the directory via lseek */
    194                         /* is not a permitted operation                     */
     200     case SEEK_END:   /* Movement past the end of the directory via lseek */
     201                      /* is not a permitted operation                     */
    195202      default:
    196203        set_errno_and_return_minus_one( EINVAL );
     
    204211
    205212
    206 /* -----------------------------------------------------------------------
    207  * This routine will obtain the following information concerning the current
    208  * directory:
    209  *      st_dev          0ll
    210  *      st_ino          1
    211  *      st_mode         mode extracted from the jnode
    212  *      st_nlink        number of links to this node
    213  *      st_uid          uid extracted from the jnode
    214  *      st_gid          gid extracted from the jnode
    215  *      st_rdev         0ll
    216  *      st_size         the number of bytes in the directory
    217  *                      This is calculated by taking the number of entries
    218  *                      in the directory and multiplying by the size of a
    219  *                      dirent structure
    220  *      st_blksize      0
    221  *      st_blocks       0
    222  *      stat_atime      time of last access
    223  *      stat_mtime      time of last modification
    224  *      stat_ctime      time of the last change
    225  *
    226  * This information will be returned to the calling function in a -stat- struct
    227  *     
     213/*
     214 *  imfs_dir_fstat
     215 *
     216 *  This routine will obtain the following information concerning the current
     217 *  directory:
     218 *        st_dev      0ll
     219 *        st_ino      1
     220 *        st_mode     mode extracted from the jnode
     221 *        st_nlink    number of links to this node
     222 *        st_uid      uid extracted from the jnode
     223 *        st_gid      gid extracted from the jnode
     224 *        st_rdev     0ll
     225 *        st_size     the number of bytes in the directory
     226 *                    This is calculated by taking the number of entries
     227 *                    in the directory and multiplying by the size of a
     228 *                    dirent structure
     229 *        st_blksize  0
     230 *        st_blocks   0
     231 *        stat_atime  time of last access
     232 *        stat_mtime  time of last modification
     233 *        stat_ctime  time of the last change
     234 *
     235 *  This information will be returned to the calling function in a -stat- struct
     236 *
    228237 */
    229238
  • c/src/libfs/src/imfs/imfs_handlers_directory.c

    r02fe6ab r662678d1  
    3737};
    3838
    39 
    40 
    41 
    42 
    43 
    44 
    45 
  • cpukit/libcsupport/src/creat.c

    r02fe6ab r662678d1  
     1/*
     2 *  $Id$
     3 */
     4
    15/* creat() "system call" */
    26
  • cpukit/libcsupport/src/isatty.c

    r02fe6ab r662678d1  
    1 /* isatty.c */
    2 
    3 /* Dumb implementation so programs will at least run.  */
     1/*
     2 *  COPYRIGHT (c) 1989-1999.
     3 *  On-Line Applications Research Corporation (OAR).
     4 * 
     5 *  The license and distribution terms for this file may be
     6 *  found in the file LICENSE in this distribution or at
     7 *  http://www.OARcorp.com/rtems/license.html.
     8 *
     9 *  $Id$
     10 */
    411
    512#include <sys/stat.h>
    613
    7 int
    8 isatty (int fd)
     14int isatty(
     15  int fd
     16)
    917{
    1018  struct stat buf;
     
    1220  if (fstat (fd, &buf) < 0)
    1321    return 0;
     22
    1423  if (S_ISCHR (buf.st_mode))
    1524    return 1;
     25
    1626  return 0;
    1727}
  • cpukit/libfs/src/imfs/imfs_directory.c

    r02fe6ab r662678d1  
    11/*
    2  *  XXX
     2 *  IMFS Directory Access Routines
    33 *
    44 *  COPYRIGHT (c) 1989-1999.
     
    2626#include "libio_.h"
    2727
    28 /* -----------------------------------------------------------------------
    29  * This rountine will verify that the node being opened as a directory is
    30  * in fact a directory node. If it is then the offset into the directory
    31  * will be set to 0 to position to the first directory entry.
     28/*
     29 *  imfs_dir_open
     30 *
     31 *  This rountine will verify that the node being opened as a directory is
     32 *  in fact a directory node. If it is then the offset into the directory
     33 *  will be set to 0 to position to the first directory entry.
    3234 */
    3335
     
    4547
    4648  if ( the_jnode->type != IMFS_DIRECTORY )
    47      return -1;         /* It wasn't a directory --> return error */
     49     return -1;      /* It wasn't a directory --> return error */
    4850
    4951  iop->offset = 0;
     
    5153}
    5254
    53 
    54 
    55 /* -----------------------------------------------------------------------
    56  * This routine will read the next directory entry based on the directory
    57  * offset. The offset should be equal to -n- time the size of an individual
    58  * dirent structure. If n is not an integer multiple of the sizeof a
    59  * dirent structure, an integer division will be performed to determine
    60  * directory entry that will be returned in the buffer. Count should reflect
    61  * -m- times the sizeof dirent bytes to be placed in the buffer.
    62  * If there are not -m- dirent elements from the current directory position
    63  * to the end of the exisiting file, the remaining entries will be placed in
    64  * the buffer and the returned value will be equal to -m actual- times the
    65  * size of a directory entry.
     55/*
     56 *  imfs_dir_read
     57 *
     58 *  This routine will read the next directory entry based on the directory
     59 *  offset. The offset should be equal to -n- time the size of an individual
     60 *  dirent structure. If n is not an integer multiple of the sizeof a
     61 *  dirent structure, an integer division will be performed to determine
     62 *  directory entry that will be returned in the buffer. Count should reflect
     63 *  -m- times the sizeof dirent bytes to be placed in the buffer.
     64 *  If there are not -m- dirent elements from the current directory position
     65 *  to the end of the exisiting file, the remaining entries will be placed in
     66 *  the buffer and the returned value will be equal to -m actual- times the
     67 *  size of a directory entry.
    6668 */
    6769
     
    8082   IMFS_jnode_t      *the_jnode;
    8183   int                bytes_transferred;
    82    int                current_entry;
    83    int                first_entry;
    84    int                last_entry;
     84   int                current_entry;
     85   int                first_entry;
     86   int                last_entry;
    8587   struct dirent      tmp_dirent;
    8688
     
    101103
    102104   /* The directory was not empty so try to move to the desired entry in chain*/
    103    for(
     105   for (
    104106      current_entry = 0;
    105107      current_entry < last_entry;
     
    139141
    140142
    141 /* -----------------------------------------------------------------------
    142  * This routine will be called by the generic close routine to cleanup any
    143  * resources that have been allocated for the management of the file
     143/*
     144 *  imfs_dir_close
     145 *
     146 *  This routine will be called by the generic close routine to cleanup any
     147 *  resources that have been allocated for the management of the file
    144148 */
    145149
     
    148152)
    149153{
    150   /* The generic close routine handles the deallocation of the file control */
    151   /* and associated memory. At present the imfs_dir_close simply      */
    152   /* returns a successful completion status                                 */
     154  /*
     155   *  The generic close routine handles the deallocation of the file control
     156   *  and associated memory. At present the imfs_dir_close simply
     157   *  returns a successful completion status.
     158   */
    153159 
    154160  return 0;
     
    157163
    158164
    159 /* -----------------------------------------------------------------------
    160  * This routine will behave in one of three ways based on the state of
    161  * argument whence. Based on the state of its value the offset argument will
    162  * be interpreted using one of the following methods:
    163  *
    164  *      SEEK_SET - offset is the absolute byte offset from the start of the
    165  *                 logical start of the dirent sequence that represents the
    166  *                 directory
    167  *      SEEK_CUR - offset is used as the relative byte offset from the current
    168  *                 directory position index held in the iop structure
    169  *      SEEK_END - N/A --> This will cause an assert.
     165/*
     166 *  imfs_dir_lseek
     167 *
     168 *  This routine will behave in one of three ways based on the state of
     169 *  argument whence. Based on the state of its value the offset argument will
     170 *  be interpreted using one of the following methods:
     171 *
     172 *     SEEK_SET - offset is the absolute byte offset from the start of the
     173 *                logical start of the dirent sequence that represents the
     174 *                directory
     175 *     SEEK_CUR - offset is used as the relative byte offset from the current
     176 *                directory position index held in the iop structure
     177 *     SEEK_END - N/A --> This will cause an assert.
    170178 */
    171179
     
    181189
    182190
    183   switch( whence )
    184   {
    185      case SEEK_SET:     /* absolute move from the start of the file */
     191  switch( whence ) {
     192     case SEEK_SET:   /* absolute move from the start of the file */
    186193        iop->offset = normal_offset;
    187194        break;
    188195
    189      case SEEK_CUR:     /* relative move */
     196     case SEEK_CUR:   /* relative move */
    190197        iop->offset = iop->offset + normal_offset;
    191198        break;
    192199
    193      case SEEK_END:     /* Movement past the end of the directory via lseek */
    194                         /* is not a permitted operation                     */
     200     case SEEK_END:   /* Movement past the end of the directory via lseek */
     201                      /* is not a permitted operation                     */
    195202      default:
    196203        set_errno_and_return_minus_one( EINVAL );
     
    204211
    205212
    206 /* -----------------------------------------------------------------------
    207  * This routine will obtain the following information concerning the current
    208  * directory:
    209  *      st_dev          0ll
    210  *      st_ino          1
    211  *      st_mode         mode extracted from the jnode
    212  *      st_nlink        number of links to this node
    213  *      st_uid          uid extracted from the jnode
    214  *      st_gid          gid extracted from the jnode
    215  *      st_rdev         0ll
    216  *      st_size         the number of bytes in the directory
    217  *                      This is calculated by taking the number of entries
    218  *                      in the directory and multiplying by the size of a
    219  *                      dirent structure
    220  *      st_blksize      0
    221  *      st_blocks       0
    222  *      stat_atime      time of last access
    223  *      stat_mtime      time of last modification
    224  *      stat_ctime      time of the last change
    225  *
    226  * This information will be returned to the calling function in a -stat- struct
    227  *     
     213/*
     214 *  imfs_dir_fstat
     215 *
     216 *  This routine will obtain the following information concerning the current
     217 *  directory:
     218 *        st_dev      0ll
     219 *        st_ino      1
     220 *        st_mode     mode extracted from the jnode
     221 *        st_nlink    number of links to this node
     222 *        st_uid      uid extracted from the jnode
     223 *        st_gid      gid extracted from the jnode
     224 *        st_rdev     0ll
     225 *        st_size     the number of bytes in the directory
     226 *                    This is calculated by taking the number of entries
     227 *                    in the directory and multiplying by the size of a
     228 *                    dirent structure
     229 *        st_blksize  0
     230 *        st_blocks   0
     231 *        stat_atime  time of last access
     232 *        stat_mtime  time of last modification
     233 *        stat_ctime  time of the last change
     234 *
     235 *  This information will be returned to the calling function in a -stat- struct
     236 *
    228237 */
    229238
  • cpukit/libfs/src/imfs/imfs_handlers_directory.c

    r02fe6ab r662678d1  
    3737};
    3838
    39 
    40 
    41 
    42 
    43 
    44 
    45 
Note: See TracChangeset for help on using the changeset viewer.