summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2010-06-15 23:35:05 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2010-06-15 23:35:05 +0000
commit54cad054fd1946cf4e7f13f0b02b8d4deaca9fd0 (patch)
tree1b5787ee7e7e4f1c04494a78277a27d877e8f514 /cpukit/libfs
parent2010-06-15 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-54cad054fd1946cf4e7f13f0b02b8d4deaca9fd0.tar.bz2
2010-06-15 Ralf Corsépius <ralf.corsepius@rtems.org>
* libfs/src/rfs/rtems-rfs-dir.c: Various 64bit compatibility fixes. Add PRIdoff_t. Remove stray "\"s. * libfs/src/rfs/rtems-rfs-link.c: Various 64bit compatibility fixes.
Diffstat (limited to 'cpukit/libfs')
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-dir.c96
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-link.c14
2 files changed, 61 insertions, 49 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-dir.c b/cpukit/libfs/src/rfs/rtems-rfs-dir.c
index 3b628ff0b2..3ed394609b 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-dir.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-dir.c
@@ -29,6 +29,16 @@
#include "config.h"
#endif
+#include <inttypes.h>
+
+#if SIZEOF_OFF_T == 8
+#define PRIdoff_t PRIo64
+#elif SIZEOF_OFF_T == 4
+#define PRIdoff_t PRIo32
+#else
+#error "unsupported size of off_t"
+#endif
+
#include <rtems/rfs/rtems-rfs-block.h>
#include <rtems/rfs/rtems-rfs-buffer.h>
#include <rtems/rfs/rtems-rfs-file-system.h>
@@ -58,7 +68,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
{
int c;
- printf ("rtems-rfs: dir-lookup-ino: lookup ino: root=%ld, path=",
+ printf ("rtems-rfs: dir-lookup-ino: lookup ino: root=%" PRId32 ", path=",
inode->ino);
for (c = 0; c < length; c++)
printf ("%c", name[c]);
@@ -72,7 +82,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: map open failed for ino %lu: %d: %s",
+ printf ("rtems-rfs: dir-lookup-ino: map open failed for ino %" PRIu32 ": %d: %s",
rtems_rfs_inode_ino (inode), rc, strerror (rc));
return rc;
}
@@ -81,7 +91,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: handle open failed for ino %lu: %d: %s",
+ printf ("rtems-rfs: dir-lookup-ino: handle open failed for ino %" PRIu32 ": %d: %s",
rtems_rfs_inode_ino (inode), rc, strerror (rc));
rtems_rfs_block_map_close (fs, &map);
return rc;
@@ -121,7 +131,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: block read, ino=%lu block=%ld: %d: %s\n",
+ printf ("rtems-rfs: dir-lookup-ino: block read, ino=%" PRIu32 " block=%" PRId32 ": %d: %s\n",
rtems_rfs_inode_ino (inode), block, rc, strerror (rc));
break;
}
@@ -150,8 +160,8 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (rtems_rfs_dir_entry_valid (fs, elength, *ino))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: " \
- "bad length or ino for ino %lu: %u/%ld @ %04lx\n",
+ printf ("rtems-rfs: dir-lookup-ino: "
+ "bad length or ino for ino %" PRIu32 ": %u/%" PRId32 " @ %04" PRIx32 "\n",
rtems_rfs_inode_ino (inode), elength, *ino, map.bpos.boff);
rc = EIO;
break;
@@ -160,8 +170,8 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if (ehash == hash)
{
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:%ld\n",
+ printf ("rtems-rfs: dir-lookup-ino: "
+ "checking entry for ino %" PRId32 ": off=%04" PRIx32 " length:%d ino:%" PRId32 "\n",
rtems_rfs_inode_ino (inode), map.bpos.boff,
elength, rtems_rfs_dir_entry_ino (entry));
@@ -170,8 +180,8 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
*offset = rtems_rfs_block_map_pos (fs, &map);
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO_FOUND))
- printf ("rtems-rfs: dir-lookup-ino: " \
- "entry found in ino %lu, ino=%lu offset=%lu\n",
+ printf ("rtems-rfs: dir-lookup-ino: "
+ "entry found in ino %" PRIu32 ", ino=%" PRIu32 " offset=%" PRIu32 "\n",
rtems_rfs_inode_ino (inode), *ino, *offset);
rtems_rfs_buffer_handle_close (fs, &entries);
@@ -190,8 +200,8 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
if ((rc > 0) && (rc != ENXIO))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: " \
- "block map next block failed in ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-lookup-ino: "
+ "block map next block failed in ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (inode), rc, strerror (rc));
}
if (rc == ENXIO)
@@ -203,7 +213,7 @@ rtems_rfs_dir_lookup_ino (rtems_rfs_file_system* fs,
{
rc = EIO;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_LOOKUP_INO))
- printf ("rtems-rfs: dir-lookup-ino: block is 0 in ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-lookup-ino: block is 0 in ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (inode), rc, strerror (rc));
}
}
@@ -228,7 +238,7 @@ rtems_rfs_dir_add_entry (rtems_rfs_file_system* fs,
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_ADD_ENTRY))
{
int c;
- printf ("rtems-rfs: dir-add-entry: dir=%ld, name=",
+ printf ("rtems-rfs: dir-add-entry: dir=%" PRId32 ", name=",
rtems_rfs_inode_ino (dir));
for (c = 0; c < length; c++)
printf ("%c", name[c]);
@@ -269,8 +279,8 @@ rtems_rfs_dir_add_entry (rtems_rfs_file_system* fs,
if (rc != ENXIO)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_ADD_ENTRY))
- printf ("rtems-rfs: dir-add-entry: " \
- "block map find failed for ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-add-entry: "
+ "block map find failed for ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (dir), rc, strerror (rc));
break;
}
@@ -282,8 +292,8 @@ rtems_rfs_dir_add_entry (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_ADD_ENTRY))
- printf ("rtems-rfs: dir-add-entry: " \
- "block map grow failed for ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-add-entry: "
+ "block map grow failed for ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (dir), rc, strerror (rc));
break;
}
@@ -297,8 +307,8 @@ rtems_rfs_dir_add_entry (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_ADD_ENTRY))
- printf ("rtems-rfs: dir-add-entry: " \
- "block buffer req failed for ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-add-entry: "
+ "block buffer req failed for ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (dir), rc, strerror (rc));
break;
}
@@ -342,8 +352,8 @@ rtems_rfs_dir_add_entry (rtems_rfs_file_system* fs,
if (rtems_rfs_dir_entry_valid (fs, elength, eino))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_ADD_ENTRY))
- printf ("rtems-rfs: dir-add-entry: " \
- "bad length or ino for ino %lu: %u/%ld @ %04x\n",
+ printf ("rtems-rfs: dir-add-entry: "
+ "bad length or ino for ino %" PRIu32 ": %u/%" PRId32 " @ %04x\n",
rtems_rfs_inode_ino (dir), elength, eino, offset);
rtems_rfs_buffer_handle_close (fs, &buffer);
rtems_rfs_block_map_close (fs, &map);
@@ -373,9 +383,9 @@ rtems_rfs_dir_del_entry (rtems_rfs_file_system* fs,
int rc;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_DEL_ENTRY))
- printf ("rtems-rfs: dir-del-entry: dir=%ld, entry=%ld offset=%lu\n",
+ printf ("rtems-rfs: dir-del-entry: dir=%" PRId32 ", entry=%" PRId32 " offset=%" PRIu32 "\n",
rtems_rfs_inode_ino (dir), ino, offset);
-
+
rc = rtems_rfs_block_map_open (fs, dir, &map);
if (rc > 0)
return rc;
@@ -410,8 +420,8 @@ rtems_rfs_dir_del_entry (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_DEL_ENTRY))
- printf ("rtems-rfs: dir-del-entry: " \
- "block buffer req failed for ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-del-entry: "
+ "block buffer req failed for ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (dir), rc, strerror (rc));
break;
}
@@ -433,13 +443,13 @@ rtems_rfs_dir_del_entry (rtems_rfs_file_system* fs,
if (rtems_rfs_dir_entry_valid (fs, elength, eino))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_DEL_ENTRY))
- printf ("rtems-rfs: dir-del-entry: " \
- "bad length or ino for ino %lu: %u/%ld @ %04x\n",
+ printf ("rtems-rfs: dir-del-entry: "
+ "bad length or ino for ino %" PRIu32 ": %u/%" PRId32 " @ %04x\n",
rtems_rfs_inode_ino (dir), elength, eino, offset);
rc = EIO;
break;
}
-
+
if (ino == rtems_rfs_dir_entry_ino (entry))
{
uint32_t remaining;
@@ -457,8 +467,8 @@ rtems_rfs_dir_del_entry (rtems_rfs_file_system* fs,
elength = rtems_rfs_dir_entry_length (entry);
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_DEL_ENTRY))
- printf ("rtems-rfs: dir-del-entry: " \
- "last block free for ino %lu: elength=%i offset=%d last=%s\n",
+ printf ("rtems-rfs: dir-del-entry: "
+ "last block free for ino %" PRIu32 ": elength=%i offset=%d last=%s\n",
ino, elength, offset,
rtems_rfs_block_map_last (&map) ? "yes" : "no");
@@ -469,8 +479,8 @@ rtems_rfs_dir_del_entry (rtems_rfs_file_system* fs,
if (rc > 0)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_DEL_ENTRY))
- printf ("rtems-rfs: dir-del-entry: " \
- "block map shrink failed for ino %lu: %d: %s\n",
+ printf ("rtems-rfs: dir-del-entry: "
+ "block map shrink failed for ino %" PRIu32 ": %d: %s\n",
rtems_rfs_inode_ino (dir), rc, strerror (rc));
}
}
@@ -517,7 +527,7 @@ rtems_rfs_dir_read (rtems_rfs_file_system* fs,
int rc;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
- printf ("rtems-rfs: dir-read: dir=%ld offset=%Ld\n",
+ printf ("rtems-rfs: dir-read: dir=%" PRId32 " offset=%" PRId64 "\n",
rtems_rfs_inode_ino (dir), offset);
*length = 0;
@@ -577,8 +587,8 @@ rtems_rfs_dir_read (rtems_rfs_file_system* fs,
if (rtems_rfs_dir_entry_valid (fs, elength, eino))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
- printf ("rtems-rfs: dir-read: " \
- "bad length or ino for ino %lu: %u/%ld @ %04lx\n",
+ printf ("rtems-rfs: dir-read: "
+ "bad length or ino for ino %" PRIu32 ": %u/%" PRId32 " @ %04" PRIx32 "\n",
rtems_rfs_inode_ino (dir), elength, eino, map.bpos.boff);
rc = EIO;
break;
@@ -608,16 +618,16 @@ rtems_rfs_dir_read (rtems_rfs_file_system* fs,
dirent->d_namlen = elength;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
- printf ("rtems-rfs: dir-read: found off:%Ld ino:%ld name=%s\n",
- (uint64_t) dirent->d_off, dirent->d_ino, dirent->d_name);
+ printf ("rtems-rfs: dir-read: found off:%" PRIdoff_t " ino:%ld name=%s\n",
+ dirent->d_off, dirent->d_ino, dirent->d_name);
break;
}
*length += rtems_rfs_fs_block_size (fs) - map.bpos.boff;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
- printf ("rtems-rfs: dir-read: next block: off:%ld length:%zd\n",
- (uint32_t) offset, *length);
+ printf ("rtems-rfs: dir-read: next block: off:%" PRId64 " length:%zd\n",
+ offset, *length);
rc = rtems_rfs_block_map_next_block (fs, &map, &block);
if (rc == ENXIO)
@@ -640,7 +650,7 @@ rtems_rfs_dir_empty (rtems_rfs_file_system* fs,
int rc;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
- printf ("rtems-rfs: dir-empty: dir=%ld\n", rtems_rfs_inode_ino (dir));
+ printf ("rtems-rfs: dir-empty: dir=%" PRId32 "\n", rtems_rfs_inode_ino (dir));
empty = true;
@@ -692,8 +702,8 @@ rtems_rfs_dir_empty (rtems_rfs_file_system* fs,
if (rtems_rfs_dir_entry_valid (fs, elength, eino))
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_EMPTY))
- printf ("rtems-rfs: dir-empty: " \
- "bad length or ino for ino %lu: %u/%ld @ %04x\n",
+ printf ("rtems-rfs: dir-empty: "
+ "bad length or ino for ino %" PRIu32 ": %u/%" PRIu32 " @ %04x\n",
rtems_rfs_inode_ino (dir), elength, eino, offset);
rc = EIO;
break;
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-link.c b/cpukit/libfs/src/rfs/rtems-rfs-link.c
index 88615988f8..27a08153b9 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-link.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-link.c
@@ -22,6 +22,8 @@
#include "config.h"
#endif
+#include <inttypes.h>
+
#include <rtems/rfs/rtems-rfs-block.h>
#include <rtems/rfs/rtems-rfs-buffer.h>
#include <rtems/rfs/rtems-rfs-file-system.h>
@@ -46,10 +48,10 @@ rtems_rfs_link (rtems_rfs_file_system* fs,
if (rtems_rfs_trace (RTEMS_RFS_TRACE_LINK))
{
int c;
- printf ("rtems-rfs: link: parent(%lu) -> ", parent);
+ printf ("rtems-rfs: link: parent(%" PRIu32 ") -> ", parent);
for (c = 0; c < length; c++)
printf ("%c", name[c]);
- printf ("(%lu)\n", target);
+ printf ("(%" PRIu32 ")\n", target);
}
rc = rtems_rfs_inode_open (fs, target, &target_inode, true);
@@ -118,7 +120,7 @@ rtems_rfs_unlink (rtems_rfs_file_system* fs,
int rc;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_UNLINK))
- printf ("rtems-rfs: unlink: parent(%lu) -X-> (%lu)\n", parent, target);
+ printf ("rtems-rfs: unlink: parent(%" PRIu32 ") -X-> (%" PRIu32 ")\n", parent, target);
rc = rtems_rfs_inode_open (fs, target, &target_inode, true);
if (rc)
@@ -179,7 +181,7 @@ rtems_rfs_unlink (rtems_rfs_file_system* fs,
links = rtems_rfs_inode_get_links (&target_inode);
if (rtems_rfs_trace (RTEMS_RFS_TRACE_UNLINK))
- printf ("rtems-rfs: unlink: target:%lu links:%u\n", target, links);
+ printf ("rtems-rfs: unlink: target:%" PRIu32 " links:%u\n", target, links);
if (links > 1)
{
@@ -258,7 +260,7 @@ rtems_rfs_symlink (rtems_rfs_file_system* fs,
if (rtems_rfs_trace (RTEMS_RFS_TRACE_SYMLINK))
{
int c;
- printf ("rtems-rfs: symlink: parent:%lu name:", parent);
+ printf ("rtems-rfs: symlink: parent:%" PRIu32 " name:", parent);
for (c = 0; c < length; c++)
printf ("%c", name[c]);
printf (" link:");
@@ -367,7 +369,7 @@ rtems_rfs_symlink_read (rtems_rfs_file_system* fs,
int rc;
if (rtems_rfs_trace (RTEMS_RFS_TRACE_SYMLINK_READ))
- printf ("rtems-rfs: symlink-read: link:%lu\n", link);
+ printf ("rtems-rfs: symlink-read: link:%" PRIu32 "\n", link);
rc = rtems_rfs_inode_open (fs, link, &inode, true);
if (rc)