some __le -> le issues

This commit is contained in:
Joe Thornber 2013-03-22 15:48:43 +00:00
parent a7081a4789
commit be7801f111
8 changed files with 102 additions and 102 deletions

View File

@ -93,10 +93,10 @@ test-programs: $(TEST_PROGRAMS)
.SUFFIXES: .d
%.d: %.cc
@echo " [dependencies] $<"
$(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\
sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \
$(RM) $@.$$$$
@echo " [DEP] $<"
$(V)$(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\
$(V)sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \
$(V)$(RM) $@.$$$$
%.o: %.cc
@echo " [CXX] $<"
@ -105,8 +105,8 @@ test-programs: $(TEST_PROGRAMS)
#----------------------------------------------------------------
# libpdata
lib/libpdata.a: $(PDATA_OBJECTS)
@echo " [AR] $<"
$(V)ar -rv $@ $(PDATA_OBJECTS) 2>&1 > /dev/null
@echo " [AR] $<"
$(V)ar -rv $@ $(PDATA_OBJECTS) > /dev/null 2>&1
#----------------------------------------------------------------
# Thin provisioning tools
@ -135,19 +135,19 @@ THIN_RESTORE_OBJECTS=$(subst .cc,.o,$(THIN_RESTORE_SOURCE))
THIN_CHECK_OBJECTS=$(subst .cc,.o,$(THIN_CHECK_SOURCE))
thin_debug: $(THIN_DEBUG_OBJECTS) thin-provisioning/thin_debug.o
@echo " [LD] $@"
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
thin_dump: $(THIN_DUMP_OBJECTS) thin-provisioning/thin_dump.o
@echo " [LD] $@"
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
thin_restore: $(THIN_RESTORE_OBJECTS) thin-provisioning/thin_restore.o
@echo " [LD] $@"
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
thin_check: $(THIN_CHECK_OBJECTS) thin-provisioning/thin_check.o
@echo " [LD] $@"
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
#----------------------------------------------------------------
@ -169,7 +169,7 @@ CACHE_CHECK_SOURCE=\
CACHE_CHECK_OBJECTS=$(subst .cc,.o,$(CACHE_CHECK_SOURCE))
cache_check: $(CACHE_CHECK_OBJECTS) cache/check.o
@echo " [LD] $@"
@echo " [LD] $@"
$(V) $(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
.PHONY: clean distclean

View File

@ -70,44 +70,44 @@ superblock_traits::unpack(superblock_disk const &disk, superblock &core)
void
superblock_traits::pack(superblock const &core, superblock_disk &disk)
{
disk.csum = to_disk<__le32>(core.csum);
disk.flags = to_disk<__le32>(core.flags);
disk.blocknr = to_disk<__le64>(core.blocknr);
disk.csum = to_disk<le32>(core.csum);
disk.flags = to_disk<le32>(core.flags);
disk.blocknr = to_disk<le64>(core.blocknr);
::memcpy(disk.uuid, core.uuid, sizeof(disk.uuid));
disk.magic = to_disk<__le64>(core.magic);
disk.version = to_disk<__le32>(core.version);
disk.magic = to_disk<le64>(core.magic);
disk.version = to_disk<le32>(core.version);
::memcpy(disk.policy_name, core.policy_name, sizeof(disk.policy_name));
for (unsigned i = 0; i < CACHE_POLICY_VERSION_SIZE; i++)
disk.policy_version[i] = to_disk<__le32>(core.policy_version[i]);
disk.policy_version[i] = to_disk<le32>(core.policy_version[i]);
disk.policy_hint_size = to_disk<__le32>(core.policy_hint_size);
disk.policy_hint_size = to_disk<le32>(core.policy_hint_size);
::memcpy(disk.metadata_space_map_root,
core.metadata_space_map_root,
sizeof(disk.metadata_space_map_root));
disk.mapping_root = to_disk<__le64>(core.mapping_root);
disk.hint_root = to_disk<__le64>(core.hint_root);
disk.mapping_root = to_disk<le64>(core.mapping_root);
disk.hint_root = to_disk<le64>(core.hint_root);
disk.discard_root = to_disk<__le64>(core.discard_root);
disk.discard_block_size = to_disk<__le64>(core.discard_block_size);
disk.discard_nr_blocks = to_disk<__le64>(core.discard_nr_blocks);
disk.discard_root = to_disk<le64>(core.discard_root);
disk.discard_block_size = to_disk<le64>(core.discard_block_size);
disk.discard_nr_blocks = to_disk<le64>(core.discard_nr_blocks);
disk.data_block_size = to_disk<__le32>(core.data_block_size);
disk.metadata_block_size = to_disk<__le32>(core.metadata_block_size);
disk.cache_blocks = to_disk<__le32>(core.cache_blocks);
disk.data_block_size = to_disk<le32>(core.data_block_size);
disk.metadata_block_size = to_disk<le32>(core.metadata_block_size);
disk.cache_blocks = to_disk<le32>(core.cache_blocks);
disk.compat_flags = to_disk<__le32>(core.compat_flags);
disk.compat_ro_flags = to_disk<__le32>(core.compat_ro_flags);
disk.incompat_flags = to_disk<__le32>(core.incompat_flags);
disk.compat_flags = to_disk<le32>(core.compat_flags);
disk.compat_ro_flags = to_disk<le32>(core.compat_ro_flags);
disk.incompat_flags = to_disk<le32>(core.incompat_flags);
disk.read_hits = to_disk<__le32>(core.read_hits);
disk.read_misses = to_disk<__le32>(core.read_misses);
disk.write_hits = to_disk<__le32>(core.write_hits);
disk.write_misses = to_disk<__le32>(core.write_misses);
disk.read_hits = to_disk<le32>(core.read_hits);
disk.read_misses = to_disk<le32>(core.read_misses);
disk.write_hits = to_disk<le32>(core.write_hits);
disk.write_misses = to_disk<le32>(core.write_misses);
}
//----------------------------------------------------------------

View File

@ -35,39 +35,39 @@ namespace cache_tools {
typedef unsigned char __u8;
struct superblock_disk {
__le32 csum;
__le32 flags;
__le64 blocknr;
le32 csum;
le32 flags;
le64 blocknr;
__u8 uuid[16];
__le64 magic;
__le32 version;
le64 magic;
le32 version;
__u8 policy_name[CACHE_POLICY_NAME_SIZE];
__le32 policy_version[CACHE_POLICY_VERSION_SIZE];
__le32 policy_hint_size;
le32 policy_version[CACHE_POLICY_VERSION_SIZE];
le32 policy_hint_size;
__u8 metadata_space_map_root[SPACE_MAP_ROOT_SIZE];
__le64 mapping_root;
__le64 hint_root;
le64 mapping_root;
le64 hint_root;
__le64 discard_root;
__le64 discard_block_size;
__le64 discard_nr_blocks;
le64 discard_root;
le64 discard_block_size;
le64 discard_nr_blocks;
__le32 data_block_size; /* in 512-byte sectors */
__le32 metadata_block_size; /* in 512-byte sectors */
__le32 cache_blocks;
le32 data_block_size; /* in 512-byte sectors */
le32 metadata_block_size; /* in 512-byte sectors */
le32 cache_blocks;
__le32 compat_flags;
__le32 compat_ro_flags;
__le32 incompat_flags;
le32 compat_flags;
le32 compat_ro_flags;
le32 incompat_flags;
__le32 read_hits;
__le32 read_misses;
__le32 write_hits;
__le32 write_misses;
le32 read_hits;
le32 read_misses;
le32 write_hits;
le32 write_misses;
} __attribute__ ((packed));
struct superblock {

View File

@ -52,7 +52,7 @@ namespace {
superblock_disk *sbd = reinterpret_cast<superblock_disk *>(&b);
crc32c sum(SUPERBLOCK_CSUM_SEED);
sum.append(&sbd->flags_, MD_BLOCK_SIZE - sizeof(uint32_t));
sbd->csum_ = to_disk<base::__le32>(sum.get_sum());
sbd->csum_ = to_disk<base::le32>(sum.get_sum());
}
};

View File

@ -83,7 +83,7 @@ namespace thin_provisioning {
};
struct block_traits {
typedef base::__le64 disk_type;
typedef base::le64 disk_type;
typedef block_time value_type;
typedef block_time_ref_counter ref_counter;
@ -95,7 +95,7 @@ namespace thin_provisioning {
static void pack(value_type const &value, disk_type &disk) {
uint64_t v = (value.block_ << 24) | value.time_;
disk = base::to_disk<base::__le64>(v);
disk = base::to_disk<base::le64>(v);
}
};
@ -118,7 +118,7 @@ namespace thin_provisioning {
};
struct mtree_traits {
typedef base::__le64 disk_type;
typedef base::le64 disk_type;
typedef uint64_t value_type;
typedef mtree_ref_counter ref_counter;
@ -127,7 +127,7 @@ namespace thin_provisioning {
}
static void pack(value_type const &value, disk_type &disk) {
disk = base::to_disk<base::__le64>(value);
disk = base::to_disk<base::le64>(value);
}
};

View File

@ -36,10 +36,10 @@ device_details_traits::unpack(device_details_disk const &disk, device_details &v
void
device_details_traits::pack(device_details const &value, device_details_disk &disk)
{
disk.mapped_blocks_ = to_disk<__le64>(value.mapped_blocks_);
disk.transaction_id_ = to_disk<__le64>(value.transaction_id_);
disk.creation_time_ = to_disk<__le32>(value.creation_time_);
disk.snapshotted_time_ = to_disk<__le32>(value.snapshotted_time_);
disk.mapped_blocks_ = to_disk<le64>(value.mapped_blocks_);
disk.transaction_id_ = to_disk<le64>(value.transaction_id_);
disk.creation_time_ = to_disk<le32>(value.creation_time_);
disk.snapshotted_time_ = to_disk<le32>(value.snapshotted_time_);
}
void
@ -78,17 +78,17 @@ superblock_traits::unpack(superblock_disk const &disk, superblock &value)
void
superblock_traits::pack(superblock const &value, superblock_disk &disk)
{
disk.csum_ = to_disk<__le32>(value.csum_);
disk.flags_ = to_disk<__le32>(value.flags_);
disk.blocknr_ = to_disk<__le64>(value.blocknr_);
disk.csum_ = to_disk<le32>(value.csum_);
disk.flags_ = to_disk<le32>(value.flags_);
disk.blocknr_ = to_disk<le64>(value.blocknr_);
::memcpy(disk.uuid_, value.uuid_, sizeof(disk.uuid_));
disk.magic_ = to_disk<__le64>(value.magic_);
disk.version_ = to_disk<__le32>(value.version_);
disk.time_ = to_disk<__le32>(value.time_);
disk.magic_ = to_disk<le64>(value.magic_);
disk.version_ = to_disk<le32>(value.version_);
disk.time_ = to_disk<le32>(value.time_);
disk.trans_id_ = to_disk<__le64>(value.trans_id_);
disk.metadata_snap_ = to_disk<__le64>(value.metadata_snap_);
disk.trans_id_ = to_disk<le64>(value.trans_id_);
disk.metadata_snap_ = to_disk<le64>(value.metadata_snap_);
::memcpy(disk.data_space_map_root_,
value.data_space_map_root_,
@ -97,15 +97,15 @@ superblock_traits::pack(superblock const &value, superblock_disk &disk)
value.metadata_space_map_root_,
sizeof(disk.metadata_space_map_root_));
disk.data_mapping_root_ = to_disk<__le64>(value.data_mapping_root_);
disk.device_details_root_ = to_disk<__le64>(value.device_details_root_);
disk.data_block_size_ = to_disk<__le32>(value.data_block_size_);
disk.data_mapping_root_ = to_disk<le64>(value.data_mapping_root_);
disk.device_details_root_ = to_disk<le64>(value.device_details_root_);
disk.data_block_size_ = to_disk<le32>(value.data_block_size_);
disk.metadata_block_size_ = to_disk<__le32>(value.metadata_block_size_);
disk.metadata_nr_blocks_ = to_disk<__le64>(value.metadata_nr_blocks_);
disk.metadata_block_size_ = to_disk<le32>(value.metadata_block_size_);
disk.metadata_nr_blocks_ = to_disk<le64>(value.metadata_nr_blocks_);
disk.compat_flags_ = to_disk<__le32>(value.compat_flags_);
disk.incompat_flags_ = to_disk<__le32>(value.incompat_flags_);
disk.compat_flags_ = to_disk<le32>(value.compat_flags_);
disk.incompat_flags_ = to_disk<le32>(value.incompat_flags_);
}
//----------------------------------------------------------------

View File

@ -28,10 +28,10 @@ namespace thin_provisioning {
using namespace base; // FIXME: don't use namespaces in headers.
struct device_details_disk {
__le64 mapped_blocks_;
__le64 transaction_id_; /* when created */
__le32 creation_time_;
__le32 snapshotted_time_;
le64 mapped_blocks_;
le64 transaction_id_; /* when created */
le32 creation_time_;
le32 snapshotted_time_;
} __attribute__ ((packed));
struct device_details {
@ -55,36 +55,36 @@ namespace thin_provisioning {
typedef unsigned char __u8;
struct superblock_disk {
__le32 csum_;
__le32 flags_;
__le64 blocknr_;
le32 csum_;
le32 flags_;
le64 blocknr_;
__u8 uuid_[16];
__le64 magic_;
__le32 version_;
__le32 time_;
le64 magic_;
le32 version_;
le32 time_;
__le64 trans_id_;
le64 trans_id_;
/* root for userspace's transaction (for migration and friends) */
__le64 metadata_snap_;
le64 metadata_snap_;
__u8 data_space_map_root_[SPACE_MAP_ROOT_SIZE];
__u8 metadata_space_map_root_[SPACE_MAP_ROOT_SIZE];
/* 2 level btree mapping (dev_id, (dev block, time)) -> data block */
__le64 data_mapping_root_;
le64 data_mapping_root_;
/* device detail root mapping dev_id -> device_details */
__le64 device_details_root_;
le64 device_details_root_;
__le32 data_block_size_; /* in 512-byte sectors */
le32 data_block_size_; /* in 512-byte sectors */
__le32 metadata_block_size_; /* in 512-byte sectors */
__le64 metadata_nr_blocks_;
le32 metadata_block_size_; /* in 512-byte sectors */
le64 metadata_nr_blocks_;
__le32 compat_flags_;
__le32 compat_ro_flags_;
__le32 incompat_flags_;
le32 compat_flags_;
le32 compat_ro_flags_;
le32 incompat_flags_;
} __attribute__ ((packed));
struct superblock {

View File

@ -35,8 +35,8 @@ lib/libgmock.a: $(GMOCK_DEPS)
$(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/gtest -c $(GMOCK_DIR)/gtest/src/gtest-all.cc
@echo " [CXX] gmock"
$(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR) -c $(GMOCK_DIR)/src/gmock-all.cc
@echo " [AR] $<"
$(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o 2>&1 > /dev/null
@echo " [AR] $<"
$(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o > /dev/null 2>&1
MOCK_SOURCE=\
unit-tests/gmock_main.cc \
@ -63,7 +63,7 @@ MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE))
$(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $<
unit-tests/unit_tests: $(MOCK_OBJECTS) lib/libgmock.a lib/libpdata.a
@echo " [LD] $<"
@echo " [LD] $<"
$(V)g++ $(CXXFLAGS) -o $@ $(MOCK_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
.PHONEY: unit-test