Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

Ticket #1502: rfs-avr-16bit-clean.diff

File rfs-avr-16bit-clean.diff, 10.2 KB (added by Chris Johns, on 04/11/10 at 04:35:40)

RFS AVR 16bit Clean Patch

  • rtems-rfs-buffer-bdbuf.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c,v
    retrieving revision 1.2
    diff -p -u -u -r1.2 rtems-rfs-buffer-bdbuf.c
    rtems_rfs_buffer_bdbuf_release (rtems_rf 
    6767
    6868  if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_RELEASE))
    6969    printf ("rtems-rfs: bdbuf-release: block=%lu bdbuf=%lu %s\n",
    70             (rtems_rfs_buffer_block) buffer->user,
     70            (rtems_rfs_buffer_block) ((intptr_t) buffer->user),
    7171            buffer->block, modified ? "(modified)" : "");
    7272
    7373  if (modified)
  • rtems-rfs-buffer.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-buffer.c,v
    retrieving revision 1.4
    diff -p -u -u -r1.4 rtems-rfs-buffer.c
    rtems_rfs_scan_chain (rtems_chain_contro 
    5151    buffer = (rtems_rfs_buffer*) node;
    5252
    5353    if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS))
    54       printf ("%lu ", (rtems_rfs_buffer_block) buffer->user);
     54      printf ("%lu ", (rtems_rfs_buffer_block) ((intptr_t)(buffer->user)));
    5555
    56     if (((rtems_rfs_buffer_block) buffer->user) == block)
     56    if (((rtems_rfs_buffer_block) ((intptr_t)(buffer->user))) == block)
    5757    {
    5858      if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS))
    59         printf (": found block=%lu\n", (rtems_rfs_buffer_block) buffer->user);
     59        printf (": found block=%lu\n",
     60                (rtems_rfs_buffer_block) ((intptr_t)(buffer->user)));
    6061
    6162      (*count)--;
    6263      rtems_chain_extract (node);
    rtems_rfs_buffer_handle_request (rtems_r 
    182183  rtems_chain_append (&fs->buffers, rtems_rfs_buffer_link (handle));
    183184  fs->buffers_count++;
    184185 
    185   handle->buffer->user = (void*) block;
     186  handle->buffer->user = (void*) ((intptr_t) block);
    186187  handle->bnum = block;
    187188 
    188189  if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_HANDLE_REQUEST))
  • rtems-rfs-data.h

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-data.h,v
    retrieving revision 1.1
    diff -p -u -u -r1.1 rtems-rfs-data.h
     
    3131#define rtems_rfs_data_ptr(_d) ((uint8_t*)(_d))
    3232
    3333/**
     34 * Helper function to get the data shifted in the correctly sized type.
     35 */
     36#define rtems_rfs_data_get(_d, _t, _o, _s) \
     37  (((_t)(rtems_rfs_data_ptr (_d)[_o])) << (_s))
     38
     39/**
    3440 * RFS Read Unsigned 8bit Integer
    3541 */
    3642#define rtems_rfs_read_u8(_d) \
     
    4046 * RFS Read Unsigned 16bit Integer
    4147 */
    4248#define rtems_rfs_read_u16(_d) \
    43   ((rtems_rfs_data_ptr (_d)[0] << 8) | (rtems_rfs_data_ptr (_d)[1]))
     49  (rtems_rfs_data_get (_d, uint16_t, 0, 8) | \
     50   rtems_rfs_data_get (_d, uint16_t, 1, 0))
    4451
    4552/**
    4653 * RFS Read Unsigned 32bit Integer
    4754 */
    4855#define rtems_rfs_read_u32(_d) \
    49   ((rtems_rfs_data_ptr (_d)[0] << 24) | (rtems_rfs_data_ptr (_d)[1] << 16) | \
    50    (rtems_rfs_data_ptr (_d)[2] << 8) | (rtems_rfs_data_ptr (_d)[3]))
     56  (rtems_rfs_data_get (_d, uint32_t, 0, 24) | \
     57   rtems_rfs_data_get (_d, uint32_t, 1, 16) | \
     58   rtems_rfs_data_get (_d, uint32_t, 2, 8) | \
     59   rtems_rfs_data_get (_d, uint32_t, 3, 0))
    5160
    5261/**
    5362 * RFS Write Unsigned 8bit Integer
     
    6069 */
    6170#define rtems_rfs_write_u16(_d, _v) \
    6271  do { \
    63     rtems_rfs_data_ptr (_d)[0] = (uint8_t)((_v) >> 8); \
     72    rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint16_t)(_v)) >> 8); \
    6473    rtems_rfs_data_ptr (_d)[1] = (uint8_t)((_v)); \
    6574  } while (0)
    6675
     
    6978 */
    7079#define rtems_rfs_write_u32(_d, _v) \
    7180  do { \
    72     rtems_rfs_data_ptr (_d)[0] = (uint8_t)((_v) >> 24); \
    73     rtems_rfs_data_ptr (_d)[1] = (uint8_t)((_v) >> 16); \
    74     rtems_rfs_data_ptr (_d)[2] = (uint8_t)((_v) >> 8); \
    75     rtems_rfs_data_ptr (_d)[3] = (uint8_t)((_v)); \
     81    rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint32_t)(_v)) >> 24); \
     82    rtems_rfs_data_ptr (_d)[1] = (uint8_t)(((uint32_t)(_v)) >> 16); \
     83    rtems_rfs_data_ptr (_d)[2] = (uint8_t)(((uint32_t)(_v)) >> 8); \
     84    rtems_rfs_data_ptr (_d)[3] = (uint8_t)((uint32_t)(_v)); \
    7685  } while (0)
    7786
    7887#endif
  • rtems-rfs-dir.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-dir.c,v
    retrieving revision 1.5
    diff -p -u -u -r1.5 rtems-rfs-dir.c
    rtems_rfs_dir_lookup_ino (rtems_rfs_file 
    161161        {
    162162          if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO_CHECK))
    163163            printf ("rtems-rfs: dir-lookup-ino: " \
    164                     "checking entry for ino %ld: off=%04lx length:%d ino:%d\n",
     164                    "checking entry for ino %ld: off=%04lx length:%d ino:%ld\n",
    165165                    rtems_rfs_inode_ino (inode), map.bpos.boff,
    166166                    elength, rtems_rfs_dir_entry_ino (entry));
    167167
    rtems_rfs_dir_read (rtems_rfs_file_syste 
    609609     
    610610      if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
    611611        printf ("rtems-rfs: dir-read: found off:%Ld ino:%ld name=%s\n",
    612                 dirent->d_off, dirent->d_ino, dirent->d_name);
     612                (uint64_t) dirent->d_off, dirent->d_ino, dirent->d_name);
    613613      break;
    614614    }
    615615
  • rtems-rfs-file-system.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-file-system.c,v
    retrieving revision 1.3
    diff -p -u -u -r1.3 rtems-rfs-file-system.c
    rtems_rfs_fs_read_superblock (rtems_rfs_ 
    7979      (RTEMS_RFS_VERSION * RTEMS_RFS_VERSION_MASK))
    8080  {
    8181    if (rtems_rfs_trace (RTEMS_RFS_TRACE_OPEN))
    82       printf ("rtems-rfs: read-superblock: incompatible version: %08x (%08x)\n",
     82      printf ("rtems-rfs: read-superblock: incompatible version: %08lx (%08x)\n",
    8383              read_sb (RTEMS_RFS_SB_OFFSET_VERSION), RTEMS_RFS_VERSION_MASK);
    8484    rtems_rfs_buffer_handle_close (fs, &handle);
    8585    return EIO;
    rtems_rfs_fs_read_superblock (rtems_rfs_ 
    8888  if (read_sb (RTEMS_RFS_SB_OFFSET_INODE_SIZE) != RTEMS_RFS_INODE_SIZE)
    8989  {
    9090    if (rtems_rfs_trace (RTEMS_RFS_TRACE_OPEN))
    91       printf ("rtems-rfs: read-superblock: inode size mismatch: fs:%d target:%d\n",
     91      printf ("rtems-rfs: read-superblock: inode size mismatch: fs:%ld target:%d\n",
    9292              read_sb (RTEMS_RFS_SB_OFFSET_VERSION), RTEMS_RFS_VERSION_MASK);
    9393    rtems_rfs_buffer_handle_close (fs, &handle);
    9494    return EIO;
  • rtems-rfs-format.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-format.c,v
    retrieving revision 1.4
    diff -p -u -u -r1.4 rtems-rfs-format.c
     
    3333/**
    3434 * Return the number of gigabytes.
    3535 */
    36 #define GIGS(_g) ((_g) * 1024 * 1024)
     36#define GIGS(_g) (((uint64_t)(_g)) * 1024 * 1024)
    3737
    3838/**
    3939 * Return the number of bits that fit in the block size.
  • rtems-rfs-inode.h

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-inode.h,v
    retrieving revision 1.2
    diff -p -u -u -r1.2 rtems-rfs-inode.h
    static inline void 
    339339rtems_rfs_inode_set_uid_gid (rtems_rfs_inode_handle* handle,
    340340                             uint16_t uid, uint16_t gid)
    341341{
    342   rtems_rfs_write_u32 (&handle->node->owner, (gid << 16) | uid);
     342  rtems_rfs_write_u32 (&handle->node->owner, (((uint32_t) gid) << 16) | uid);
    343343  rtems_rfs_buffer_mark_dirty (&handle->buffer);
    344344}
    345345
  • rtems-rfs-rtems.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c,v
    retrieving revision 1.5
    diff -p -u -u -r1.5 rtems-rfs-rtems.c
    rtems_rfs_rtems_fchmod (rtems_filesystem 
    813813
    814814  if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD))
    815815    printf ("rtems-rfs-rtems: fchmod: in: ino:%ld mode:%06o\n",
    816             ino, mode);
     816            ino, (unsigned int) mode);
    817817 
    818818  rtems_rfs_rtems_lock (fs);
    819819 
  • rtems-rfs-rtems.h

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h,v
    retrieving revision 1.1
    diff -p -u -u -r1.1 rtems-rfs-rtems.h
    typedef struct rtems_rfs_rtems_private 
    158158 * @param _ino The ino to set in the path location.
    159159 */
    160160#define rtems_rfs_rtems_set_pathloc_ino(_loc, _ino) \
    161   (_loc)->node_access = (void*)(_ino)
     161  (_loc)->node_access = (void*)((intptr_t)(_ino))
    162162
    163163/**
    164164 * Get the inode number (ino) given a path location.
    typedef struct rtems_rfs_rtems_private 
    176176 * @param _doff The doff to set in the path location.
    177177 */
    178178#define rtems_rfs_rtems_set_pathloc_doff(_loc, _doff) \
    179   (_loc)->node_access_2 = (void*)(_doff)
     179  (_loc)->node_access_2 = (void*)((intptr_t)(_doff))
    180180
    181181/**
    182182 * Get the directory offset (doff) given a path location.
  • rtems-rfs-shell.c

    RCS file: /usr1/CVS/rtems/cpukit/libfs/src/rfs/rtems-rfs-shell.c,v
    retrieving revision 1.6
    diff -p -u -u -r1.6 rtems-rfs-shell.c
    rtems_rfs_shell_dir (rtems_rfs_file_syst 
    499499   
    500500    length = elength - RTEMS_RFS_DIR_ENTRY_SIZE;
    501501   
    502     printf (" %5d: %04x inode=%-6u hash=%08x name[%03u]=",
     502    printf (" %5d: %04x inode=%-6lu hash=%08lx name[%03u]=",
    503503            entry, b,
    504504            rtems_rfs_dir_entry_ino (data),
    505505            rtems_rfs_dir_entry_hash (data),