diff options
author | Chris Johns <chrisj@rtems.org> | 2010-04-12 05:29:25 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2010-04-12 05:29:25 +0000 |
commit | 1d539c05010b34013e49c5a8221702ebadae4406 (patch) | |
tree | 3fc3d5bdd8435cd565c336ba0aab2525e518af1d /cpukit | |
parent | 2010-04-11 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-1d539c05010b34013e49c5a8221702ebadae4406.tar.bz2 |
2010-04-12 Chris Johns <chrisj@rtems.org>
libfs/src/rfs/rtems-rfs-buffer-bdbuf.c,
libfs/src/rfs/rtems-rfs-buffer.c, libfs/src/rfs/rtems-rfs-data.h,
libfs/src/rfs/rtems-rfs-dir.c,
libfs/src/rfs/rtems-rfs-file-system.c,
libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-inode.h,
libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h,
libfs/src/rfs/rtems-rfs-shell.c: Fix for PR1502. Clean up problems
on 16bit targets.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 11 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-buffer.c | 9 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-data.h | 25 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-dir.c | 4 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-file-system.c | 4 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-format.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-inode.h | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-rtems.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-rtems.h | 4 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-shell.c | 2 |
11 files changed, 44 insertions, 23 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 0d2c03af94..883373bba1 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,14 @@ +2010-04-12 Chris Johns <chrisj@rtems.org> + + libfs/src/rfs/rtems-rfs-buffer-bdbuf.c, + libfs/src/rfs/rtems-rfs-buffer.c, libfs/src/rfs/rtems-rfs-data.h, + libfs/src/rfs/rtems-rfs-dir.c, + libfs/src/rfs/rtems-rfs-file-system.c, + libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-inode.h, + libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h, + libfs/src/rfs/rtems-rfs-shell.c: Fix for PR1502. Clean up problems + on 16bit targets. + 2010-04-10 Ralf Corsépius <ralf.corsepius@rtems.org> * libmisc/stackchk/check.c: Remove bogus casts. diff --git a/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c b/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c index 1c07fe32a9..b46bab8067 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-buffer-bdbuf.c @@ -67,7 +67,7 @@ rtems_rfs_buffer_bdbuf_release (rtems_rfs_buffer* buffer, if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_RELEASE)) printf ("rtems-rfs: bdbuf-release: block=%lu bdbuf=%lu %s\n", - (rtems_rfs_buffer_block) buffer->user, + (rtems_rfs_buffer_block) ((intptr_t) buffer->user), buffer->block, modified ? "(modified)" : ""); if (modified) diff --git a/cpukit/libfs/src/rfs/rtems-rfs-buffer.c b/cpukit/libfs/src/rfs/rtems-rfs-buffer.c index bc73c57f1c..eb83f4fbea 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-buffer.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-buffer.c @@ -51,12 +51,13 @@ rtems_rfs_scan_chain (rtems_chain_control* chain, buffer = (rtems_rfs_buffer*) node; if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS)) - printf ("%lu ", (rtems_rfs_buffer_block) buffer->user); + printf ("%lu ", (rtems_rfs_buffer_block) ((intptr_t)(buffer->user))); - if (((rtems_rfs_buffer_block) buffer->user) == block) + if (((rtems_rfs_buffer_block) ((intptr_t)(buffer->user))) == block) { if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS)) - printf (": found block=%lu\n", (rtems_rfs_buffer_block) buffer->user); + printf (": found block=%lu\n", + (rtems_rfs_buffer_block) ((intptr_t)(buffer->user))); (*count)--; rtems_chain_extract (node); @@ -182,7 +183,7 @@ rtems_rfs_buffer_handle_request (rtems_rfs_file_system* fs, rtems_chain_append (&fs->buffers, rtems_rfs_buffer_link (handle)); fs->buffers_count++; - handle->buffer->user = (void*) block; + handle->buffer->user = (void*) ((intptr_t) block); handle->bnum = block; if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_HANDLE_REQUEST)) diff --git a/cpukit/libfs/src/rfs/rtems-rfs-data.h b/cpukit/libfs/src/rfs/rtems-rfs-data.h index 67e820faac..343c0a9854 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-data.h +++ b/cpukit/libfs/src/rfs/rtems-rfs-data.h @@ -31,6 +31,12 @@ #define rtems_rfs_data_ptr(_d) ((uint8_t*)(_d)) /** + * Helper function to get the data shifted in the correctly sized type. + */ +#define rtems_rfs_data_get(_d, _t, _o, _s) \ + (((_t)(rtems_rfs_data_ptr (_d)[_o])) << (_s)) + +/** * RFS Read Unsigned 8bit Integer */ #define rtems_rfs_read_u8(_d) \ @@ -40,14 +46,17 @@ * RFS Read Unsigned 16bit Integer */ #define rtems_rfs_read_u16(_d) \ - ((rtems_rfs_data_ptr (_d)[0] << 8) | (rtems_rfs_data_ptr (_d)[1])) + (rtems_rfs_data_get (_d, uint16_t, 0, 8) | \ + rtems_rfs_data_get (_d, uint16_t, 1, 0)) /** * RFS Read Unsigned 32bit Integer */ #define rtems_rfs_read_u32(_d) \ - ((rtems_rfs_data_ptr (_d)[0] << 24) | (rtems_rfs_data_ptr (_d)[1] << 16) | \ - (rtems_rfs_data_ptr (_d)[2] << 8) | (rtems_rfs_data_ptr (_d)[3])) + (rtems_rfs_data_get (_d, uint32_t, 0, 24) | \ + rtems_rfs_data_get (_d, uint32_t, 1, 16) | \ + rtems_rfs_data_get (_d, uint32_t, 2, 8) | \ + rtems_rfs_data_get (_d, uint32_t, 3, 0)) /** * RFS Write Unsigned 8bit Integer @@ -60,7 +69,7 @@ */ #define rtems_rfs_write_u16(_d, _v) \ do { \ - rtems_rfs_data_ptr (_d)[0] = (uint8_t)((_v) >> 8); \ + rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint16_t)(_v)) >> 8); \ rtems_rfs_data_ptr (_d)[1] = (uint8_t)((_v)); \ } while (0) @@ -69,10 +78,10 @@ */ #define rtems_rfs_write_u32(_d, _v) \ do { \ - rtems_rfs_data_ptr (_d)[0] = (uint8_t)((_v) >> 24); \ - rtems_rfs_data_ptr (_d)[1] = (uint8_t)((_v) >> 16); \ - rtems_rfs_data_ptr (_d)[2] = (uint8_t)((_v) >> 8); \ - rtems_rfs_data_ptr (_d)[3] = (uint8_t)((_v)); \ + rtems_rfs_data_ptr (_d)[0] = (uint8_t)(((uint32_t)(_v)) >> 24); \ + rtems_rfs_data_ptr (_d)[1] = (uint8_t)(((uint32_t)(_v)) >> 16); \ + rtems_rfs_data_ptr (_d)[2] = (uint8_t)(((uint32_t)(_v)) >> 8); \ + rtems_rfs_data_ptr (_d)[3] = (uint8_t)((uint32_t)(_v)); \ } while (0) #endif diff --git a/cpukit/libfs/src/rfs/rtems-rfs-dir.c b/cpukit/libfs/src/rfs/rtems-rfs-dir.c index a104fc7da9..3b628ff0b2 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-dir.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-dir.c @@ -161,7 +161,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs, { if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO_CHECK)) printf ("rtems-rfs: dir-lookup-ino: " \ - "checking entry for ino %ld: off=%04lx length:%d ino:%d\n", + "checking entry for ino %ld: off=%04lx length:%d ino:%ld\n", rtems_rfs_inode_ino (inode), map.bpos.boff, elength, rtems_rfs_dir_entry_ino (entry)); @@ -609,7 +609,7 @@ rtems_rfs_dir_read (rtems_rfs_file_system* fs, if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ)) printf ("rtems-rfs: dir-read: found off:%Ld ino:%ld name=%s\n", - dirent->d_off, dirent->d_ino, dirent->d_name); + (uint64_t) dirent->d_off, dirent->d_ino, dirent->d_name); break; } diff --git a/cpukit/libfs/src/rfs/rtems-rfs-file-system.c b/cpukit/libfs/src/rfs/rtems-rfs-file-system.c index 08050dd76b..d56f62eb59 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-file-system.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-file-system.c @@ -79,7 +79,7 @@ rtems_rfs_fs_read_superblock (rtems_rfs_file_system* fs) (RTEMS_RFS_VERSION * RTEMS_RFS_VERSION_MASK)) { if (rtems_rfs_trace (RTEMS_RFS_TRACE_OPEN)) - printf ("rtems-rfs: read-superblock: incompatible version: %08x (%08x)\n", + printf ("rtems-rfs: read-superblock: incompatible version: %08lx (%08x)\n", read_sb (RTEMS_RFS_SB_OFFSET_VERSION), RTEMS_RFS_VERSION_MASK); rtems_rfs_buffer_handle_close (fs, &handle); return EIO; @@ -88,7 +88,7 @@ rtems_rfs_fs_read_superblock (rtems_rfs_file_system* fs) if (read_sb (RTEMS_RFS_SB_OFFSET_INODE_SIZE) != RTEMS_RFS_INODE_SIZE) { if (rtems_rfs_trace (RTEMS_RFS_TRACE_OPEN)) - printf ("rtems-rfs: read-superblock: inode size mismatch: fs:%d target:%d\n", + printf ("rtems-rfs: read-superblock: inode size mismatch: fs:%ld target:%d\n", read_sb (RTEMS_RFS_SB_OFFSET_VERSION), RTEMS_RFS_VERSION_MASK); rtems_rfs_buffer_handle_close (fs, &handle); return EIO; diff --git a/cpukit/libfs/src/rfs/rtems-rfs-format.c b/cpukit/libfs/src/rfs/rtems-rfs-format.c index 6820de4ec9..16f9b4de14 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-format.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-format.c @@ -33,7 +33,7 @@ /** * Return the number of gigabytes. */ -#define GIGS(_g) ((_g) * 1024 * 1024) +#define GIGS(_g) (((uint64_t)(_g)) * 1024 * 1024) /** * Return the number of bits that fit in the block size. diff --git a/cpukit/libfs/src/rfs/rtems-rfs-inode.h b/cpukit/libfs/src/rfs/rtems-rfs-inode.h index d5decd922a..663bed5ef7 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-inode.h +++ b/cpukit/libfs/src/rfs/rtems-rfs-inode.h @@ -339,7 +339,7 @@ static inline void rtems_rfs_inode_set_uid_gid (rtems_rfs_inode_handle* handle, uint16_t uid, uint16_t gid) { - rtems_rfs_write_u32 (&handle->node->owner, (gid << 16) | uid); + rtems_rfs_write_u32 (&handle->node->owner, (((uint32_t) gid) << 16) | uid); rtems_rfs_buffer_mark_dirty (&handle->buffer); } diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c index 916f752043..c0b2751893 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c @@ -813,7 +813,7 @@ rtems_rfs_rtems_fchmod (rtems_filesystem_location_info_t* pathloc, if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD)) printf ("rtems-rfs-rtems: fchmod: in: ino:%ld mode:%06o\n", - ino, mode); + ino, (unsigned int) mode); rtems_rfs_rtems_lock (fs); diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.h b/cpukit/libfs/src/rfs/rtems-rfs-rtems.h index 2c294aaebd..3415d0abfb 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.h +++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.h @@ -158,7 +158,7 @@ typedef struct rtems_rfs_rtems_private * @param _ino The ino to set in the path location. */ #define rtems_rfs_rtems_set_pathloc_ino(_loc, _ino) \ - (_loc)->node_access = (void*)(_ino) + (_loc)->node_access = (void*)((intptr_t)(_ino)) /** * Get the inode number (ino) given a path location. @@ -176,7 +176,7 @@ typedef struct rtems_rfs_rtems_private * @param _doff The doff to set in the path location. */ #define rtems_rfs_rtems_set_pathloc_doff(_loc, _doff) \ - (_loc)->node_access_2 = (void*)(_doff) + (_loc)->node_access_2 = (void*)((intptr_t)(_doff)) /** * Get the directory offset (doff) given a path location. diff --git a/cpukit/libfs/src/rfs/rtems-rfs-shell.c b/cpukit/libfs/src/rfs/rtems-rfs-shell.c index 7fedf6ad38..953f86d12d 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-shell.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-shell.c @@ -499,7 +499,7 @@ rtems_rfs_shell_dir (rtems_rfs_file_system* fs, int argc, char *argv[]) length = elength - RTEMS_RFS_DIR_ENTRY_SIZE; - printf (" %5d: %04x inode=%-6u hash=%08x name[%03u]=", + printf (" %5d: %04x inode=%-6lu hash=%08lx name[%03u]=", entry, b, rtems_rfs_dir_entry_ino (data), rtems_rfs_dir_entry_hash (data), |