glibc: switch to standard endian conversion macros
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 10 Jul 2025 20:27:09 +0000 (22:27 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 13 Jul 2025 18:55:43 +0000 (20:55 +0200)
Replace all uses of Linux kernel-style endian conversion macros/functions
(e.g., le32_to_cpu, cpu_to_le32, xlate32, xlate64, etc.) with the standard
POSIX/glibc macros (e.g., le32toh, htole32, htobe32, be32toh, etc.) from
<endian.h>.

- Update all code to use le16toh, le32toh, le64toh, htole16, htole32, htole64,
  htobe16, htobe32, htobe64, be16toh, be32toh, be64toh as appropriate.
- Provide fallback macro definitions in xlate.h for systems lacking these
  standard macros, ensuring backward compatibility with older glibc and non-glibc
  systems.
- Remove or replace all project-specific xlateXX and cpu_to_leXX/cpu_to_beXX
  macros.
- No functional change intended; this is a mechanical, treewide modernization
  for clarity, portability, and future maintainability.

20 files changed:
daemons/cmirrord/cluster.c
daemons/cmirrord/compat.c
daemons/lvmlockd/lvmlockd-dlm.c
daemons/lvmlockd/lvmlockd-idm.c
daemons/lvmlockd/lvmlockd-sanlock.c
device_mapper/raid/raid_parser.c
device_mapper/vdo/vdo_reader.c
lib/device/dev-cache.c
lib/device/dev-lvm1-pool.c
lib/device/dev-md.c
lib/device/dev-type.c
lib/device/nvme.c
lib/device/persist.c
lib/format_text/format-text.c
lib/format_text/text_label.c
lib/label/label.c
lib/metadata/mirror.c
lib/misc/crc.c
lib/mm/xlate.h
tools/pvck.c

index e2af10228e397dfd76e677d19d298a3b26288082..c8f0970b5c42954daa98e99041a66bd792faeecd 100644 (file)
@@ -197,7 +197,7 @@ int cluster_send(struct clog_request *rq)
        iov.iov_base = rq;
        iov.iov_len = sizeof(struct clog_request) + rq->u_rq.data_size;
 
-       rq->u.version[0] = xlate64(CLOG_TFR_VERSION);
+       rq->u.version[0] = htole64(CLOG_TFR_VERSION);
        rq->u.version[1] = CLOG_TFR_VERSION;
 
        r = clog_request_to_network(rq);
index c0dd7934ec5eb0af075962297ee58f041093ea3f..73b1e0d7ffe373717ba135f7c0d151aeb472e814 100644 (file)
@@ -52,19 +52,19 @@ static void v5_data_endian_switch(struct clog_request *rq, int to_network __attr
                case DM_ULOG_GET_REGION_SIZE:
                case DM_ULOG_GET_SYNC_COUNT:
                        pu64 = (uint64_t *)rq->u_rq.data;
-                       *pu64 = xlate64(*pu64);
+                       *pu64 = htole64(*pu64);
                        break;
                case DM_ULOG_IS_CLEAN:
                case DM_ULOG_IN_SYNC:
                        pi64 = (int64_t *)rq->u_rq.data;
-                       *pi64 = xlate64(*pi64);
+                       *pi64 = htole64(*pi64);
                        break;
                case DM_ULOG_GET_RESYNC_WORK:
                case DM_ULOG_IS_REMOTE_RECOVERING:
                        pi64 = (int64_t *)rq->u_rq.data;
                        pu64 = ((uint64_t *)rq->u_rq.data) + 1;
-                       *pi64 = xlate64(*pi64);
-                       *pu64 = xlate64(*pu64);
+                       *pi64 = htole64(*pi64);
+                       *pu64 = htole64(*pu64);
                        break;
                default:
                        LOG_ERROR("Unknown request type, %u", rq_type);
@@ -94,7 +94,7 @@ static void v5_data_endian_switch(struct clog_request *rq, int to_network __attr
                case DM_ULOG_IN_SYNC:
                case DM_ULOG_IS_REMOTE_RECOVERING:
                        pu64 = (uint64_t *)rq->u_rq.data;
-                       *pu64 = xlate64(*pu64);
+                       *pu64 = htole64(*pu64);
                        break;
                case DM_ULOG_MARK_REGION:
                case DM_ULOG_CLEAR_REGION:
@@ -102,13 +102,13 @@ static void v5_data_endian_switch(struct clog_request *rq, int to_network __attr
 
                        pu64 = (uint64_t *)rq->u_rq.data;
                        for (i = 0; i < end; i++)
-                               pu64[i] = xlate64(pu64[i]);
+                               pu64[i] = htole64(pu64[i]);
                        break;
                case DM_ULOG_SET_REGION_SYNC:
                        pu64 = (uint64_t *)rq->u_rq.data;
                        pi64 = ((int64_t *)rq->u_rq.data) + 1;
-                       *pu64 = xlate64(*pu64);
-                       *pi64 = xlate64(*pi64);
+                       *pu64 = htole64(*pu64);
+                       *pi64 = htole64(*pi64);
                        break;
                default:
                        LOG_ERROR("Unknown request type, %u", rq_type);
@@ -124,15 +124,15 @@ static int v5_endian_to_network(struct clog_request *rq)
 
        size = sizeof(*rq) + u_rq->data_size;
 
-       u_rq->error = xlate32(u_rq->error);
-       u_rq->seq = xlate32(u_rq->seq);
+       u_rq->error = htole32(u_rq->error);
+       u_rq->seq = htole32(u_rq->seq);
 
-       rq->originator = xlate32(rq->originator);
+       rq->originator = htole32(rq->originator);
 
        v5_data_endian_switch(rq, 1);
 
-       u_rq->request_type = xlate32(u_rq->request_type);
-       u_rq->data_size = xlate32(u_rq->data_size);
+       u_rq->request_type = htole32(u_rq->request_type);
+       u_rq->data_size = htole32(u_rq->data_size);
 
        return size;
 }
@@ -142,7 +142,7 @@ int clog_request_to_network(struct clog_request *rq)
        int r;
 
        /* FIXME: Remove this safety check */
-       if (rq->u.version[0] != xlate64(rq->u.version[1])) {
+       if (rq->u.version[0] != htole64(rq->u.version[1])) {
                LOG_ERROR("Programmer error:  version[0] must be LE");
                exit(EXIT_FAILURE);
        }
@@ -165,12 +165,12 @@ static int v5_endian_from_network(struct clog_request *rq)
        int size;
        struct dm_ulog_request *u_rq = &rq->u_rq;
 
-       u_rq->error = xlate32(u_rq->error);
-       u_rq->seq = xlate32(u_rq->seq);
-       u_rq->request_type = xlate32(u_rq->request_type);
-       u_rq->data_size = xlate32(u_rq->data_size);
+       u_rq->error = htole32(u_rq->error);
+       u_rq->seq = htole32(u_rq->seq);
+       u_rq->request_type = htole32(u_rq->request_type);
+       u_rq->data_size = htole32(u_rq->data_size);
 
-       rq->originator = xlate32(rq->originator);
+       rq->originator = htole32(rq->originator);
 
        size = sizeof(*rq) + u_rq->data_size;
 
@@ -182,7 +182,7 @@ static int v5_endian_from_network(struct clog_request *rq)
 int clog_request_from_network(void *data, size_t data_len)
 {
        uint64_t *vp = data;
-       uint64_t version = xlate64(vp[0]);
+       uint64_t version = htole64(vp[0]);
        struct clog_request *rq = data;
 
        switch (version) {
index 7529ad327b1a84b36eca9af639cb0ccefcef58f0..49877bb9fe511202f8bd042f43213ef6144dd71b 100644 (file)
@@ -584,9 +584,9 @@ int lm_lock_dlm(struct lockspace *ls, struct resource *r, int ld_mode,
 
        if (daemon_test) {
                if (rdd->vb) {
-                       vb_out->version = le16_to_cpu(rdd->vb->version);
-                       vb_out->flags = le16_to_cpu(rdd->vb->flags);
-                       vb_out->r_version = le32_to_cpu(rdd->vb->r_version);
+                       vb_out->version = le16toh(rdd->vb->version);
+                       vb_out->flags = le16toh(rdd->vb->flags);
+                       vb_out->r_version = le32toh(rdd->vb->r_version);
                }
                return 0;
        }
@@ -638,9 +638,9 @@ lockrv:
                memcpy(&vb, lksb->sb_lvbptr, sizeof(struct val_blk));
                memcpy(rdd->vb, &vb, sizeof(vb));
 
-               vb_out->version = le16_to_cpu(vb.version);
-               vb_out->flags = le16_to_cpu(vb.flags);
-               vb_out->r_version = le32_to_cpu(vb.r_version);
+               vb_out->version = le16toh(vb.version);
+               vb_out->flags = le16toh(vb.flags);
+               vb_out->r_version = le32toh(vb.r_version);
        }
 out:
        return 0;
@@ -665,9 +665,9 @@ int lm_convert_dlm(struct lockspace *ls, struct resource *r,
        if (rdd->vb && r_version && (r->mode == LD_LK_EX)) {
                if (!rdd->vb->version) {
                        /* first time vb has been written */
-                       rdd->vb->version = cpu_to_le16(VAL_BLK_VERSION);
+                       rdd->vb->version = htole16(VAL_BLK_VERSION);
                }
-               rdd->vb->r_version = cpu_to_le32(r_version);
+               rdd->vb->r_version = htole32(r_version);
                memcpy(lksb->sb_lvbptr, rdd->vb, sizeof(struct val_blk));
 
                log_debug("%s:%s convert_dlm set r_version %u",
@@ -724,17 +724,17 @@ int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
                memcpy(&vb_next, rdd->vb, sizeof(struct val_blk));
 
                if (!vb_prev.version) {
-                       vb_next.version = cpu_to_le16(VAL_BLK_VERSION);
+                       vb_next.version = htole16(VAL_BLK_VERSION);
                        new_vb = 1;
                }
 
                if ((lmu_flags & LMUF_FREE_VG) && (r->type == LD_RT_VG)) {
-                       vb_next.flags = cpu_to_le16(VBF_REMOVED);
+                       vb_next.flags = htole16(VBF_REMOVED);
                        new_vb = 1;
                }
 
                if (r_version) {
-                       vb_next.r_version = cpu_to_le32(r_version);
+                       vb_next.r_version = htole32(r_version);
                        new_vb = 1;
                }
 
@@ -744,12 +744,12 @@ int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
 
                        log_debug("%s:%s unlock_dlm vb old %x %x %u new %x %x %u",
                                  ls->name, r->name,
-                                 le16_to_cpu(vb_prev.version),
-                                 le16_to_cpu(vb_prev.flags),
-                                 le32_to_cpu(vb_prev.r_version),
-                                 le16_to_cpu(vb_next.version),
-                                 le16_to_cpu(vb_next.flags),
-                                 le32_to_cpu(vb_next.r_version));
+                                 le16toh(vb_prev.version),
+                                 le16toh(vb_prev.flags),
+                                 le32toh(vb_prev.r_version),
+                                 le16toh(vb_next.version),
+                                 le16toh(vb_next.flags),
+                                 le32toh(vb_next.r_version));
                } else {
                        log_debug("%s:%s unlock_dlm vb unchanged", ls->name, r->name);
                }
index bfba4f59ba3c1edccb9b425d84cb96334d2f49cb..e43cb0b3b4f9b87958d431b7d5647eb76f0ff4a5 100644 (file)
@@ -556,9 +556,9 @@ int lm_lock_idm(struct lockspace *ls, struct resource *r, int ld_mode,
 
        if (daemon_test) {
                if (rdi->vb) {
-                       vb_out->version = le16_to_cpu(rdi->vb->version);
-                       vb_out->flags = le16_to_cpu(rdi->vb->flags);
-                       vb_out->r_version = le32_to_cpu(rdi->vb->r_version);
+                       vb_out->version = le16toh(rdi->vb->version);
+                       vb_out->flags = le16toh(rdi->vb->flags);
+                       vb_out->r_version = le32toh(rdi->vb->r_version);
                }
                return 0;
        }
index aac47090f8dcee53d08d5d886ca54f12623258d1..58fe5461da9d1a304b22ead9a7afe27eb8b04b54 100644 (file)
@@ -2124,9 +2124,9 @@ int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
 
        if (daemon_test) {
                if (rds->vb) {
-                       vb_out->version = le16_to_cpu(rds->vb->version);
-                       vb_out->flags = le16_to_cpu(rds->vb->flags);
-                       vb_out->r_version = le32_to_cpu(rds->vb->r_version);
+                       vb_out->version = le16toh(rds->vb->version);
+                       vb_out->flags = le16toh(rds->vb->flags);
+                       vb_out->r_version = le32toh(rds->vb->r_version);
                }
                return 0;
        }
@@ -2348,9 +2348,9 @@ int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
 
                memcpy(rds->vb, &vb, sizeof(vb));
 
-               vb_out->version = le16_to_cpu(vb.version);
-               vb_out->flags = le16_to_cpu(vb.flags);
-               vb_out->r_version = le32_to_cpu(vb.r_version);
+               vb_out->version = le16toh(vb.version);
+               vb_out->flags = le16toh(vb.flags);
+               vb_out->r_version = le32toh(vb.r_version);
        }
 out:
        return rv;
@@ -2375,10 +2375,10 @@ int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
        if (rds->vb && r_version && (r->mode == LD_LK_EX)) {
                if (!rds->vb->version) {
                        /* first time vb has been written */
-                       rds->vb->version = cpu_to_le16(VAL_BLK_VERSION);
+                       rds->vb->version = htole16(VAL_BLK_VERSION);
                }
                if (r_version)
-                       rds->vb->r_version = cpu_to_le32(r_version);
+                       rds->vb->r_version = htole32(r_version);
                memcpy(&vb, rds->vb, sizeof(vb));
 
                log_debug("%s:%s convert_san set r_version %u",
@@ -2501,9 +2501,9 @@ int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
        if (daemon_test) {
                if (rds->vb && r_version && (r->mode == LD_LK_EX)) {
                        if (!rds->vb->version)
-                               rds->vb->version = cpu_to_le16(VAL_BLK_VERSION);
+                               rds->vb->version = htole16(VAL_BLK_VERSION);
                        if (r_version)
-                               rds->vb->r_version = cpu_to_le32(r_version);
+                               rds->vb->r_version = htole32(r_version);
                }
                return 0;
        }
@@ -2511,10 +2511,10 @@ int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
        if (rds->vb && r_version && (r->mode == LD_LK_EX)) {
                if (!rds->vb->version) {
                        /* first time vb has been written */
-                       rds->vb->version = cpu_to_le16(VAL_BLK_VERSION);
+                       rds->vb->version = htole16(VAL_BLK_VERSION);
                }
                if (r_version)
-                       rds->vb->r_version = cpu_to_le32(r_version);
+                       rds->vb->r_version = htole32(r_version);
                memcpy(&vb, rds->vb, sizeof(vb));
 
                log_debug("%s:%s unlock_san set r_version %u",
index 866435ea9eeb4abb4d23ba942ede20d4fe8f631d..a0728c25db15de4d4a1fc4369496d102bed07024 100644 (file)
@@ -58,7 +58,7 @@ struct dm_raid_superblock {
 
 static size_t _get_sb_size(const struct dm_raid_superblock *sb)
 {
-       return (FEATURE_FLAG_SUPPORTS_V190 & le32_to_cpu(sb->compat_features)) ?
+       return (FEATURE_FLAG_SUPPORTS_V190 & le32toh(sb->compat_features)) ?
               sizeof(*sb) : ((char *) &sb->flags - (char *) sb);
 }
 
@@ -120,7 +120,7 @@ static int _count_or_clear_failed_devices(const char *dev_path, bool clear, uint
        }
 
        /* FIXME: big endian??? */
-       if (sb->magic != cpu_to_be32(DM_RAID_SB_MAGIC)) {
+       if (sb->magic != htobe32(DM_RAID_SB_MAGIC)) {
                log_error("No RAID signature on %s.", dev_path);
                goto out;
        }
index c573358c1cc13d5bcc477b307e5aa228b9b2b3e8..ba6e80ee5e0b43aec8ba78370451650992ecec93 100644 (file)
 #include "target.h"
 
 #include "lib/mm/xlate.h"
-//#include "linux/byteorder/big_endian.h"
-//#include "linux/byteorder/little_endian.h"
-//#define le32_to_cpu __le32_to_cpu
-//#define le64_to_cpu __le64_to_cpu
-
 
 #include <errno.h>
 #include <fcntl.h>
@@ -140,36 +135,36 @@ struct vdo_volume_geometry_4 {
 
 static void _vdo_decode_version(struct vdo_version_number *v)
 {
-       v->major_version = le32_to_cpu(v->major_version);
-       v->minor_version = le32_to_cpu(v->minor_version);
+       v->major_version = le32toh(v->major_version);
+       v->minor_version = le32toh(v->minor_version);
 }
 
 static void _vdo_decode_header(struct vdo_header *h)
 {
-       h->id = le32_to_cpu(h->id);
+       h->id = le32toh(h->id);
        _vdo_decode_version(&h->version);
-       h->size = le64_to_cpu(h->size);
+       h->size = le64toh(h->size);
 }
 
 static void _vdo_decode_geometry_region(struct vdo_volume_region *vr)
 {
-       vr->id = (enum vdo_volume_region_id) le32_to_cpu(vr->id);
-       vr->start_block = le64_to_cpu(vr->start_block);
+       vr->id = (enum vdo_volume_region_id) le32toh(vr->id);
+       vr->start_block = le64toh(vr->start_block);
 }
 
 static void _vdo_decode_volume_geometry(struct vdo_volume_geometry *vg)
 {
-       vg->release_version = le32_to_cpu(vg->release_version);
-       vg->nonce = le64_to_cpu(vg->nonce);
-       vg->bio_offset = le64_to_cpu(vg->bio_offset);
+       vg->release_version = le32toh(vg->release_version);
+       vg->nonce = le64toh(vg->nonce);
+       vg->bio_offset = le64toh(vg->bio_offset);
        _vdo_decode_geometry_region(&vg->regions[VDO_DATA_REGION]);
 }
 
 static void _vdo_decode_volume_geometry_4(struct vdo_volume_geometry *vg,
                                          struct vdo_volume_geometry_4 *vg_4)
 {
-       vg->release_version = le32_to_cpu(vg_4->release_version);
-       vg->nonce = le64_to_cpu(vg_4->nonce);
+       vg->release_version = le32toh(vg_4->release_version);
+       vg->nonce = le64toh(vg_4->nonce);
        vg->bio_offset = 0;
        vg->regions[VDO_DATA_REGION] = vg_4->regions[VDO_DATA_REGION];
        _vdo_decode_geometry_region(&vg->regions[VDO_DATA_REGION]);
@@ -177,17 +172,17 @@ static void _vdo_decode_volume_geometry_4(struct vdo_volume_geometry *vg,
 
 static void _vdo_decode_config(struct vdo_config *vc)
 {
-       vc->logical_blocks = le64_to_cpu(vc->logical_blocks);
-       vc->physical_blocks = le64_to_cpu(vc->physical_blocks);
-       vc->slab_size = le64_to_cpu(vc->slab_size);
-       vc->recovery_journal_size = le64_to_cpu(vc->recovery_journal_size);
-       vc->slab_journal_blocks = le64_to_cpu(vc->slab_journal_blocks);
+       vc->logical_blocks = le64toh(vc->logical_blocks);
+       vc->physical_blocks = le64toh(vc->physical_blocks);
+       vc->slab_size = le64toh(vc->slab_size);
+       vc->recovery_journal_size = le64toh(vc->recovery_journal_size);
+       vc->slab_journal_blocks = le64toh(vc->slab_journal_blocks);
 }
 
 static void _vdo_decode_pvc(struct vdo_component_41_0 *pvc)
 {
        _vdo_decode_config(&pvc->config);
-       pvc->nonce = le64_to_cpu(pvc->nonce);
+       pvc->nonce = le64toh(pvc->nonce);
 }
 
 bool dm_vdo_parse_logical_size(const char *vdo_path, uint64_t *logical_blocks)
index 15cbc1d8477350e714b09d619ff698dc8bdf9a89..044fa15d051afa1b80f59324e287cbf2290ba4e5 100644 (file)
@@ -407,7 +407,7 @@ out:
 /* Change bit ordering for devno to generate more compact bTree */
 static inline uint32_t _shuffle_devno(dev_t d)
 {
-       return cpu_to_be32(d);
+       return htobe32(d);
        //return (d & 0xff) << 24 | (d & 0xff00) << 8 | (d & 0xff0000) >> 8 | (d & 0xff000000) >> 24;
        //return (d & 0xff000000) >> 24 | (d & 0xffff00) | ((d & 0xff) << 24);
        //return (uint32_t) d;
index b51aba5bf8f7358a41684abf78e9d9f079e745f4..e0f50dedd4d798017887662db21c6e41645a4452 100644 (file)
@@ -61,7 +61,7 @@ int dev_is_lvm1(struct device *dev, char *buf, int buflen)
        uint32_t version;
        int ret;
 
-       version = xlate16(pvd->version);
+       version = htole16(pvd->version);
 
        if (pvd->id[0] == 'H' && pvd->id[1] == 'M' &&
            (version == 1 || version == 2))
@@ -128,9 +128,9 @@ struct pool_disk {
 };
 
 #define CPIN_8(x, y, z) {memcpy((x), (y), (z));}
-#define CPIN_16(x, y) {(x) = xlate16_be((y));}
-#define CPIN_32(x, y) {(x) = xlate32_be((y));}
-#define CPIN_64(x, y) {(x) = xlate64_be((y));}
+#define CPIN_16(x, y) {(x) = htobe16((y));}
+#define CPIN_32(x, y) {(x) = htobe32((y));}
+#define CPIN_64(x, y) {(x) = htobe64((y));}
 
 static void pool_label_in(struct pool_disk *pl, void *buf)
 {
index 4c437af8c43f78bbe8895aa424b847e91e0601dc..536768ac7425d163b6c663313aba6886b62e5de9 100644 (file)
@@ -45,7 +45,7 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
 
        if ((md_magic == MD_SB_MAGIC) ||
            /* coverity[result_independent_of_operands] */
-            ((MD_SB_MAGIC != xlate32(MD_SB_MAGIC)) && (md_magic == xlate32(MD_SB_MAGIC))))
+            ((MD_SB_MAGIC != htole32(MD_SB_MAGIC)) && (md_magic == htole32(MD_SB_MAGIC))))
                return 1;
 
        return 0;
@@ -103,14 +103,14 @@ static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors, uint
        if (!dev_read_bytes(dev, off, 512, &hdr))
                return_0;
 
-       if ((hdr.magic == cpu_to_be32(DDF_MAGIC)) ||
-           (hdr.magic == cpu_to_le32(DDF_MAGIC))) {
+       if ((hdr.magic == htobe32(DDF_MAGIC)) ||
+           (hdr.magic == htole32(DDF_MAGIC))) {
                crc = hdr.crc;
                hdr.crc = 0xffffffff;
                our_crc = calc_crc(0, (const uint8_t *)&hdr, 512);
 
-               if ((cpu_to_be32(our_crc) == crc) ||
-                   (cpu_to_le32(our_crc) == crc)) {
+               if ((htobe32(our_crc) == crc) ||
+                   (htole32(our_crc) == crc)) {
                        *sb_offset = off;
                        return 1;
                } else {
@@ -126,14 +126,14 @@ static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors, uint
        if (!dev_read_bytes(dev, off, 512, &hdr))
                return_0;
 
-       if ((hdr.magic == cpu_to_be32(DDF_MAGIC)) ||
-           (hdr.magic == cpu_to_le32(DDF_MAGIC))) {
+       if ((hdr.magic == htobe32(DDF_MAGIC)) ||
+           (hdr.magic == htole32(DDF_MAGIC))) {
                crc = hdr.crc;
                hdr.crc = 0xffffffff;
                our_crc = calc_crc(0, (const uint8_t *)&hdr, 512);
 
-               if ((cpu_to_be32(our_crc) == crc) ||
-                   (cpu_to_le32(our_crc) == crc)) {
+               if ((htobe32(our_crc) == crc) ||
+                   (htole32(our_crc) == crc)) {
                        *sb_offset = off;
                        return 1;
                } else {
index 4d57a436d9a3681499ff1d0a6ec2d08a385f37c2..5b67528b8d9fca08216a583df6b294860ab931c6 100644 (file)
@@ -643,19 +643,19 @@ static int _has_gpt_partition_table(struct device *dev)
 
        /* the gpt table is always written using LE on disk */
 
-       if (le64_to_cpu(gpt_header.magic) != PART_GPT_MAGIC)
+       if (le64toh(gpt_header.magic) != PART_GPT_MAGIC)
                return 0;
 
-       entries_start = le64_to_cpu(gpt_header.part_entries_lba) * lbs;
-       nr_entries = le32_to_cpu(gpt_header.nr_part_entries);
-       sz_entry = le32_to_cpu(gpt_header.sz_part_entry);
+       entries_start = le64toh(gpt_header.part_entries_lba) * lbs;
+       nr_entries = le32toh(gpt_header.nr_part_entries);
+       sz_entry = le32toh(gpt_header.sz_part_entry);
 
        for (i = 0; i < nr_entries; i++) {
                if (!dev_read_bytes(dev, entries_start + (uint64_t)i * sz_entry,
                                    sizeof(gpt_part_entry), &gpt_part_entry))
                        return_0;
 
-               /* just check if the guid is nonzero, no need to call le64_to_cpu here */
+               /* just check if the guid is nonzero, no need to call le64toh here */
                if (gpt_part_entry.part_type_guid)
                        return 1;
        }
@@ -690,7 +690,7 @@ static int _has_partition_table(struct device *dev)
        /* FIXME Check for other types of partition table too */
 
        /* Check for msdos partition table */
-       if (buf.magic == xlate16(PART_MSDOS_MAGIC)) {
+       if (buf.magic == htole16(PART_MSDOS_MAGIC)) {
                for (p = 0; p < 4; ++p) {
                        /* Table is invalid if boot indicator not 0 or 0x80 */
                        if (buf.part[p].boot_ind & 0x7f) {
index f5837592e3cb001560520ed7d506dede2d4dd956..20fd98803e6d8ed7d2e026fe8a0552370c1bbd3b 100644 (file)
@@ -210,7 +210,7 @@ void dev_read_nvme_wwids(struct device *dev)
 
        /* Avoid using nvme_identify_ns_descs before ver 1.3. */
        if (!nvme_identify_ctrl(fd, ctrl_id)) {
-               if (le32_to_cpu(ctrl_id->ver) < 0x10300)
+               if (le32toh(ctrl_id->ver) < 0x10300)
                        goto_out;
        }
 
@@ -358,7 +358,7 @@ int dev_read_reservation_nvme(struct cmd_context *cmd, struct device *dev, uint6
 
        for (i = 0; i < regctl; i++) {
                if (status->regctl_eds[i].rcsts) {
-                       rkey = le64_to_cpu(status->regctl_eds[i].rkey);
+                       rkey = le64toh(status->regctl_eds[i].rkey);
                        *holder_ret = rkey;
                        break;
                }
@@ -466,7 +466,7 @@ int dev_find_key_nvme(struct cmd_context *cmd, struct device *dev, int may_fail,
        }
 
        for (i = 0; i < num_keys; i++) {
-               key = le64_to_cpu(status->regctl_eds[i].rkey);
+               key = le64toh(status->regctl_eds[i].rkey);
 
                log_debug("dev_find_key %s 0x%llx", devname, (unsigned long long)key);
 
index 266010204ecb29e0cda4c51300b1594a8b71ec34..13314d218af6d08e6b3f9033663745d7c8e90092 100644 (file)
@@ -313,15 +313,15 @@ static int dev_read_reservation_scsi(struct cmd_context *cmd, struct device *dev
 
        memcpy(&pr_gen_be, response_buf + 0, 4);
        memcpy(&add_len_be, response_buf + 4, 4);
-       pr_gen = be32_to_cpu(pr_gen_be);
-       add_len = be32_to_cpu(add_len_be);
+       pr_gen = be32toh(pr_gen_be);
+       add_len = be32toh(add_len_be);
        num = add_len / 16;
 
        log_debug("dev_read_reservation %s pr_gen %u add_len %u num %d", devname, pr_gen, add_len, num);
 
        if (num > 0) {
                memcpy(&key_be, response_buf + 8, 8);
-               key = be64_to_cpu(key_be);
+               key = be64toh(key_be);
 
                pr_type_byte = response_buf[21];
                pr_type_scsi = pr_type_byte & 0xf; /* top half of byte is scope */
@@ -440,8 +440,8 @@ static int dev_find_key_scsi(struct cmd_context *cmd, struct device *dev, int ma
 
        memcpy(&pr_gen_be, response_buf + 0, 4);
        memcpy(&add_len_be, response_buf + 4, 4);
-       pr_gen = be32_to_cpu(pr_gen_be);
-       add_len = be32_to_cpu(add_len_be);
+       pr_gen = be32toh(pr_gen_be);
+       add_len = be32toh(add_len_be);
        num_keys = add_len / 8;
 
        log_debug("dev_find_key %s pr_gen %u num %d", devname, pr_gen, num_keys);
@@ -472,7 +472,7 @@ static int dev_find_key_scsi(struct cmd_context *cmd, struct device *dev, int ma
                unsigned char *p = response_buf + 8 + (i * 8);
 
                memcpy(&key_be, p, 8);
-               key = be64_to_cpu(key_be);
+               key = be64toh(key_be);
 
                log_debug("dev_find_key %s 0x%llx", devname, (unsigned long long)key);
 
index fdc04daafa7a81fb4c3613026dcc27426fc28a7a..b494cef2cf8e1358a0626be80636d77abf251419 100644 (file)
@@ -177,15 +177,15 @@ static void _xlate_mdah(struct mda_header *mdah)
 {
        struct raw_locn *rl;
 
-       mdah->version = xlate32(mdah->version);
-       mdah->start = xlate64(mdah->start);
-       mdah->size = xlate64(mdah->size);
+       mdah->version = htole32(mdah->version);
+       mdah->start = htole64(mdah->start);
+       mdah->size = htole64(mdah->size);
 
        rl = &mdah->raw_locns[0];
        while (rl->offset) {
-               rl->checksum = xlate32(rl->checksum);
-               rl->offset = xlate64(rl->offset);
-               rl->size = xlate64(rl->size);
+               rl->checksum = htole32(rl->checksum);
+               rl->offset = htole64(rl->offset);
+               rl->size = htole64(rl->size);
                rl++;
        }
 }
@@ -203,7 +203,7 @@ static int _raw_read_mda_header(struct mda_header *mdah, struct device_area *dev
                return 0;
        }
 
-       if (mdah->checksum_xl != xlate32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
+       if (mdah->checksum_xl != htole32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
                                                  MDA_HEADER_SIZE -
                                                  sizeof(mdah->checksum_xl)))) {
                log_warn("WARNING: wrong checksum %x in mda header on %s at %llu",
@@ -271,7 +271,7 @@ static int _raw_write_mda_header(const struct format_type *fmt,
        mdah->start = start_byte;
 
        _xlate_mdah(mdah);
-       mdah->checksum_xl = xlate32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
+       mdah->checksum_xl = htole32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
                                             MDA_HEADER_SIZE -
                                             sizeof(mdah->checksum_xl)));
 
index 5aff197c16d010ef302c76e9914681f6390f79ea..a6446a557f0ff0df2ade34dce3c251bb80232525 100644 (file)
@@ -44,8 +44,8 @@ struct _dl_setup_baton {
 static int _da_setup(struct disk_locn *da, void *baton)
 {
        struct _dl_setup_baton *p = baton;
-       p->pvh_dlocn_xl->offset = xlate64(da->offset);
-       p->pvh_dlocn_xl->size = xlate64(da->size);
+       p->pvh_dlocn_xl->offset = htole64(da->offset);
+       p->pvh_dlocn_xl->size = htole64(da->size);
        p->pvh_dlocn_xl++;
        return 1;
 }
@@ -63,8 +63,8 @@ static int _mda_setup(struct metadata_area *mda, void *baton)
        if (mdac->area.dev != p->dev)
                return 1;
 
-       p->pvh_dlocn_xl->offset = xlate64(mdac->area.start);
-       p->pvh_dlocn_xl->size = xlate64(mdac->area.size);
+       p->pvh_dlocn_xl->offset = htole64(mdac->area.start);
+       p->pvh_dlocn_xl->size = htole64(mdac->area.size);
        p->pvh_dlocn_xl++;
 
        return 1;
@@ -74,8 +74,8 @@ static int _dl_null_termination(void *baton)
 {
        struct _dl_setup_baton *p = baton;
 
-       p->pvh_dlocn_xl->offset = xlate64(UINT64_C(0));
-       p->pvh_dlocn_xl->size = xlate64(UINT64_C(0));
+       p->pvh_dlocn_xl->offset = htole64(UINT64_C(0));
+       p->pvh_dlocn_xl->size = htole64(UINT64_C(0));
        p->pvh_dlocn_xl++;
 
        return 1;
@@ -99,9 +99,9 @@ static int _text_write(struct label *label, void *buf)
 
        memcpy(lh->type, LVM2_LABEL, sizeof(lh->type));
 
-       pvhdr = (struct pv_header *) ((char *) buf + xlate32(lh->offset_xl));
+       pvhdr = (struct pv_header *) ((char *) buf + htole32(lh->offset_xl));
        info = (struct lvmcache_info *) label->info;
-       pvhdr->device_size_xl = xlate64(lvmcache_device_size(info));
+       pvhdr->device_size_xl = htole64(lvmcache_device_size(info));
        memcpy(pvhdr->pv_uuid, &lvmcache_device(info)->pvid, sizeof(struct id));
        if (!id_write_format((const struct id *)pvhdr->pv_uuid, buffer,
                             sizeof(buffer))) {
@@ -124,8 +124,8 @@ static int _text_write(struct label *label, void *buf)
         * PV header extension
         */
        pvhdr_ext = (struct pv_header_extension *) ((char *) baton.pvh_dlocn_xl);
-       pvhdr_ext->version = xlate32(PV_HEADER_EXTENSION_VSN);
-       pvhdr_ext->flags = xlate32(lvmcache_ext_flags(info));
+       pvhdr_ext->version = htole32(PV_HEADER_EXTENSION_VSN);
+       pvhdr_ext->flags = htole32(lvmcache_ext_flags(info));
 
        /* List of bootloader area locations */
        baton.pvh_dlocn_xl = &pvhdr_ext->bootloader_areas_xl[0];
@@ -133,20 +133,20 @@ static int _text_write(struct label *label, void *buf)
        _dl_null_termination(&baton);
 
        /* Create debug message with ba, da and mda locations */
-       ba1 = (xlate64(pvhdr_ext->bootloader_areas_xl[0].offset) ||
-              xlate64(pvhdr_ext->bootloader_areas_xl[0].size)) ? 0 : -1;
+       ba1 = (htole64(pvhdr_ext->bootloader_areas_xl[0].offset) ||
+              htole64(pvhdr_ext->bootloader_areas_xl[0].size)) ? 0 : -1;
 
-       da1 = (xlate64(pvhdr->disk_areas_xl[0].offset) ||
-              xlate64(pvhdr->disk_areas_xl[0].size)) ? 0 : -1;
+       da1 = (htole64(pvhdr->disk_areas_xl[0].offset) ||
+              htole64(pvhdr->disk_areas_xl[0].size)) ? 0 : -1;
 
        mda1 = da1 + 2;
        mda2 = mda1 + 1;
        
-       if (!xlate64(pvhdr->disk_areas_xl[mda1].offset) &&
-           !xlate64(pvhdr->disk_areas_xl[mda1].size))
+       if (!htole64(pvhdr->disk_areas_xl[mda1].offset) &&
+           !htole64(pvhdr->disk_areas_xl[mda1].size))
                mda1 = mda2 = 0;
-       else if (!xlate64(pvhdr->disk_areas_xl[mda2].offset) &&
-                !xlate64(pvhdr->disk_areas_xl[mda2].size))
+       else if (!htole64(pvhdr->disk_areas_xl[mda2].offset) &&
+                !htole64(pvhdr->disk_areas_xl[mda2].size))
                mda2 = 0;
 
        log_debug_metadata("%s: Preparing PV label header %s size " FMTu64 " with"
@@ -157,31 +157,31 @@ static int _text_write(struct label *label, void *buf)
                           dev_name(lvmcache_device(info)), buffer, lvmcache_device_size(info),
                           (ba1 > -1) ? " ba1 (" : "",
                           (ba1 > -1) ? 1 : 0,
-                          (ba1 > -1) ? xlate64(pvhdr_ext->bootloader_areas_xl[ba1].offset) >> SECTOR_SHIFT : 0,
+                          (ba1 > -1) ? htole64(pvhdr_ext->bootloader_areas_xl[ba1].offset) >> SECTOR_SHIFT : 0,
                           (ba1 > -1) ? "s, " : "",
                           (ba1 > -1) ? 1 : 0,
-                          (ba1 > -1) ? xlate64(pvhdr_ext->bootloader_areas_xl[ba1].size) >> SECTOR_SHIFT : 0,
+                          (ba1 > -1) ? htole64(pvhdr_ext->bootloader_areas_xl[ba1].size) >> SECTOR_SHIFT : 0,
                           (ba1 > -1) ? "s)" : "",
                           (da1 > -1) ? " da1 (" : "",
                           (da1 > -1) ? 1 : 0,
-                          (da1 > -1) ? xlate64(pvhdr->disk_areas_xl[da1].offset) >> SECTOR_SHIFT : 0,
+                          (da1 > -1) ? htole64(pvhdr->disk_areas_xl[da1].offset) >> SECTOR_SHIFT : 0,
                           (da1 > -1) ? "s, " : "",
                           (da1 > -1) ? 1 : 0,
-                          (da1 > -1) ? xlate64(pvhdr->disk_areas_xl[da1].size) >> SECTOR_SHIFT : 0,
+                          (da1 > -1) ? htole64(pvhdr->disk_areas_xl[da1].size) >> SECTOR_SHIFT : 0,
                           (da1 > -1) ? "s)" : "",
                           mda1 ? " mda1 (" : "",
                           mda1 ? 1 : 0,
-                          mda1 ? xlate64(pvhdr->disk_areas_xl[mda1].offset) >> SECTOR_SHIFT : 0,
+                          mda1 ? htole64(pvhdr->disk_areas_xl[mda1].offset) >> SECTOR_SHIFT : 0,
                           mda1 ? "s, " : "",
                           mda1 ? 1 : 0,
-                          mda1 ? xlate64(pvhdr->disk_areas_xl[mda1].size) >> SECTOR_SHIFT : 0,
+                          mda1 ? htole64(pvhdr->disk_areas_xl[mda1].size) >> SECTOR_SHIFT : 0,
                           mda1 ? "s)" : "",
                           mda2 ? " mda2 (" : "",
                           mda2 ? 1 : 0,
-                          mda2 ? xlate64(pvhdr->disk_areas_xl[mda2].offset) >> SECTOR_SHIFT : 0,
+                          mda2 ? htole64(pvhdr->disk_areas_xl[mda2].offset) >> SECTOR_SHIFT : 0,
                           mda2 ? "s, " : "",
                           mda2 ? 1 : 0,
-                          mda2 ? xlate64(pvhdr->disk_areas_xl[mda2].size) >> SECTOR_SHIFT : 0,
+                          mda2 ? htole64(pvhdr->disk_areas_xl[mda2].size) >> SECTOR_SHIFT : 0,
                           mda2 ? "s)" : "");
 
        if (da1 < 0) {
@@ -431,7 +431,7 @@ static int _text_read(struct cmd_context *cmd, struct labeller *labeller, struct
        /*
         * PV header base
         */
-       pvhdr = (struct pv_header *) ((char *) label_buf + xlate32(lh->offset_xl));
+       pvhdr = (struct pv_header *) ((char *) label_buf + htole32(lh->offset_xl));
 
        memcpy(pvid, &pvhdr->pv_uuid, ID_LEN);
        strncpy(vgid, FMT_TEXT_ORPHAN_VG_NAME, ID_LEN);
@@ -455,7 +455,7 @@ static int _text_read(struct cmd_context *cmd, struct labeller *labeller, struct
                                  vgid, 0, is_duplicate)))
                return_0;
 
-       lvmcache_set_device_size(info, xlate64(pvhdr->device_size_xl));
+       lvmcache_set_device_size(info, htole64(pvhdr->device_size_xl));
 
        lvmcache_del_das(info);
        lvmcache_del_mdas(info);
@@ -463,20 +463,20 @@ static int _text_read(struct cmd_context *cmd, struct labeller *labeller, struct
 
        /* Data areas holding the PEs */
        dlocn_xl = pvhdr->disk_areas_xl;
-       while ((offset = xlate64(dlocn_xl->offset))) {
-               lvmcache_add_da(info, offset, xlate64(dlocn_xl->size));
+       while ((offset = htole64(dlocn_xl->offset))) {
+               lvmcache_add_da(info, offset, htole64(dlocn_xl->size));
                dlocn_xl++;
        }
 
        dlocn_xl++;
 
        /* Metadata areas */
-       while ((offset = xlate64(dlocn_xl->offset))) {
+       while ((offset = htole64(dlocn_xl->offset))) {
 
                /*
                 * This just calls add_mda() above, replacing info with info->mdas.
                 */
-               lvmcache_add_mda(info, dev, offset, xlate64(dlocn_xl->size), 0, &mda);
+               lvmcache_add_mda(info, dev, offset, htole64(dlocn_xl->size), 0, &mda);
 
                dlocn_xl++;
                mda_count++;
@@ -497,7 +497,7 @@ static int _text_read(struct cmd_context *cmd, struct labeller *labeller, struct
         * PV header extension
         */
        pvhdr_ext = (struct pv_header_extension *) ((char *) dlocn_xl);
-       if (!(ext_version = xlate32(pvhdr_ext->version)))
+       if (!(ext_version = htole32(pvhdr_ext->version)))
                goto scan_mdas;
 
        if (ext_version != PV_HEADER_EXTENSION_VSN)
@@ -505,15 +505,15 @@ static int _text_read(struct cmd_context *cmd, struct labeller *labeller, struct
                                   ext_version, dev_name(dev));
 
        /* Extension version */
-       lvmcache_set_ext_version(info, xlate32(pvhdr_ext->version));
+       lvmcache_set_ext_version(info, htole32(pvhdr_ext->version));
 
        /* Extension flags */
-       lvmcache_set_ext_flags(info, xlate32(pvhdr_ext->flags));
+       lvmcache_set_ext_flags(info, htole32(pvhdr_ext->flags));
 
        /* Bootloader areas */
        dlocn_xl = pvhdr_ext->bootloader_areas_xl;
-       while ((offset = xlate64(dlocn_xl->offset))) {
-               lvmcache_add_ba(info, offset, xlate64(dlocn_xl->size));
+       while ((offset = htole64(dlocn_xl->offset))) {
+               lvmcache_add_ba(info, offset, htole64(dlocn_xl->size));
                dlocn_xl++;
        }
 
index 91243494b1bae91aa79bbd6852cd90fac980396c..9fe188c606eb875895214e4c347e7062e1b9f058 100644 (file)
@@ -144,7 +144,7 @@ int label_remove(struct device *dev)
                wipe = 0;
 
                if (!memcmp(lh->id, LABEL_ID, sizeof(lh->id))) {
-                       if (xlate64(lh->sector_xl) == sector)
+                       if (htole64(lh->sector_xl) == sector)
                                wipe = 1;
                } else {
                        dm_list_iterate_items(li, &_labellers) {
@@ -197,18 +197,18 @@ int label_write(struct device *dev, struct label *label)
        memset(buf, 0, LABEL_SIZE);
 
        memcpy(lh->id, LABEL_ID, sizeof(lh->id));
-       lh->sector_xl = xlate64(label->sector);
-       lh->offset_xl = xlate32(sizeof(*lh));
+       lh->sector_xl = htole64(label->sector);
+       lh->offset_xl = htole32(sizeof(*lh));
 
        if (!(label->labeller->ops->write)(label, buf))
                return_0;
 
-       lh->crc_xl = xlate32(calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl, LABEL_SIZE -
+       lh->crc_xl = htole32(calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl, LABEL_SIZE -
                                      ((uint8_t *) &lh->offset_xl - (uint8_t *) lh)));
 
        log_very_verbose("%s: Writing label to sector %" PRIu64 " with stored offset %"
                         PRIu32 ".", dev_name(dev), label->sector,
-                        xlate32(lh->offset_xl));
+                        htole32(lh->offset_xl));
 
        if (!label_scan_open(dev)) {
                log_error("Failed to open device %s", dev_name(dev));
@@ -291,15 +291,15 @@ static struct labeller *_find_lvm_header(struct device *dev,
                                log_error("Ignoring additional label on %s at sector %llu",
                                          dev_name(dev), (unsigned long long)(block_sector + sector));
                        }
-                       if (xlate64(lh->sector_xl) != sector) {
+                       if (htole64(lh->sector_xl) != sector) {
                                log_warn("%s: Label for sector %llu found at sector %llu - ignoring.",
                                         dev_name(dev),
-                                        (unsigned long long)xlate64(lh->sector_xl),
+                                        (unsigned long long)htole64(lh->sector_xl),
                                         (unsigned long long)(block_sector + sector));
                                continue;
                        }
                        if (calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl,
-                                    LABEL_SIZE - ((uint8_t *) &lh->offset_xl - (uint8_t *) lh)) != xlate32(lh->crc_xl)) {
+                                    LABEL_SIZE - ((uint8_t *) &lh->offset_xl - (uint8_t *) lh)) != htole32(lh->crc_xl)) {
                                log_very_verbose("Label checksum incorrect on %s - ignoring", dev_name(dev));
                                continue;
                        }
index aee95a6bfec1d596cf36a259777e31935ee12c9a..8288c5eb124362f4b69b450db6b19699d762a6b5 100644 (file)
@@ -240,9 +240,9 @@ static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv)
                uint64_t nr_regions;
        } log_header;
 
-       log_header.magic = xlate32(MIRROR_MAGIC);
-       log_header.version = xlate32(MIRROR_DISK_VERSION);
-       log_header.nr_regions = xlate64((uint64_t)-1);
+       log_header.magic = htole32(MIRROR_MAGIC);
+       log_header.version = htole32(MIRROR_DISK_VERSION);
+       log_header.nr_regions = htole64((uint64_t)-1);
 
        if (dm_snprintf(name, sizeof(name), "%s%s/%s", cmd->dev_dir,
                        lv->vg->name, lv->name) < 0) {
index 8d2e2bdac33cb027e5f81363c3ef6205547a20ab..0af6106df6d6c98eac8b797b0432809830a658f4 100644 (file)
@@ -109,10 +109,10 @@ static uint32_t _calc_crc_new(uint32_t initial, const uint8_t *buf, uint32_t siz
        _initialise_crc32();
 
        for (;size >= 16; size -= 16) {
-               a = xlate32(*ptr++) ^ crc;
-               b = xlate32(*ptr++);
-               c = xlate32(*ptr++);
-               d = xlate32(*ptr++);
+               a = htole32(*ptr++) ^ crc;
+               b = htole32(*ptr++);
+               c = htole32(*ptr++);
+               d = htole32(*ptr++);
 
                crc = _crc32_lookup[ 0][(d >> 24) & 0xff] ^
                      _crc32_lookup[ 1][(d >> 16) & 0xff] ^
@@ -155,7 +155,7 @@ static uint32_t _calc_crc_new(uint32_t initial, const uint8_t *buf, uint32_t siz
 
        /* Process 4 bytes per iteration */
        while (start < end) {
-               crc = crc ^ xlate32(*start++);
+               crc = crc ^ htole32(*start++);
                crc = _crctab[crc & 0xff] ^ crc >> 8;
                crc = _crctab[crc & 0xff] ^ crc >> 8;
                crc = _crctab[crc & 0xff] ^ crc >> 8;
index 24f59498d9d072a70d36a2fff5b40ba7b40ae922..6c1a49cd53c1aab31f083c42854dca28813ca69d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
- * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2025 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+/*
+ * This header provides backward compatibility for endian conversion macros.
+ * Modern systems have these macros in <endian.h>, but this file ensures
+ * compatibility with older glibc versions (< 2.9) and non-glibc systems.
+ */
+
 #ifndef _LVM_XLATE_H
 #define _LVM_XLATE_H
 
                       ((x) & 0x000000ff00000000ULL) >> 8)
 #endif
 
-#if BYTE_ORDER == LITTLE_ENDIAN
-/* New clearer variants. */
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-#define be16_to_cpu(x) bswap_16(x)
-#define be32_to_cpu(x) bswap_32(x)
-#define be64_to_cpu(x) bswap_64(x)
-#define cpu_to_be16(x) bswap_16(x)
-#define cpu_to_be32(x) bswap_32(x)
-#define cpu_to_be64(x) bswap_64(x)
-/* Old alternative variants. */
-#define xlate16(x) (x)
-#define xlate32(x) (x)
-#define xlate64(x) (x)
-#define xlate16_be(x) bswap_16(x)
-#define xlate32_be(x) bswap_32(x)
-#define xlate64_be(x) bswap_64(x)
-
-#elif BYTE_ORDER == BIG_ENDIAN
-/* New clearer variants. */
-#define le16_to_cpu(x) bswap_16(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define le64_to_cpu(x) bswap_64(x)
-#define cpu_to_le16(x) bswap_16(x)
-#define cpu_to_le32(x) bswap_32(x)
-#define cpu_to_le64(x) bswap_64(x)
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-/* Old alternative variants. */
-#define xlate16(x) bswap_16(x)
-#define xlate32(x) bswap_32(x)
-#define xlate64(x) bswap_64(x)
-#define xlate16_be(x) (x)
-#define xlate32_be(x) (x)
-#define xlate64_be(x) (x)
+/*
+ * NOTE: This file may appear unused to static analysis tools like Coverity
+ * on modern systems, but it is essential for backward compatibility.
+ *
+ * So to make it look as 'used' header file, for Coverity scan
+ * lets redefine those macros.
+ *
+ * TODO: is there any better trick how to avoid HFA warnings and add
+ * annotation comment before every inclusion of this header file ??
+ */
+
+#ifdef __COVERITY__
+
+#  undef htobe16
+#  undef htole16
+#  undef be16toh
+#  undef le16toh
+
+#  undef htobe32
+#  undef htole32
+#  undef be32toh
+#  undef le32toh
+
+#  undef htobe64
+#  undef htole64
+#  undef be64toh
+#  undef le64toh
+
+#endif
+
+
+#ifndef htobe16
+
+# if BYTE_ORDER == LITTLE_ENDIAN
+
+#  define htobe16(x) bswap_16 (x)
+#  define htole16(x) (uint16_t) (x)
+#  define be16toh(x) bswap_16 (x)
+#  define le16toh(x) (uint16_t) (x)
+
+#  define htobe32(x) bswap_32 (x)
+#  define htole32(x) (uint32_t) (x)
+#  define be32toh(x) bswap_32 (x)
+#  define le32toh(x) (uint32_t) (x)
+
+#  define htobe64(x) bswap_64 (x)
+#  define htole64(x) (uint64_t) (x)
+#  define be64toh(x) bswap_64 (x)
+#  define le64toh(x) (uint64_t) (x)
+
+# else
+
+#  define htobe16(x) (uint16_t) (x)
+#  define htole16(x) bswap_16 (x)
+#  define be16toh(x) (uint16_t) (x)
+#  define le16toh(x) bswap_16 (x)
+
+#  define htobe32(x) (uint32_t) (x)
+#  define htole32(x) bswap_32 (x)
+#  define be32toh(x) (uint32_t) (x)
+#  define le32toh(x) bswap_32 (x)
+
+#  define htobe64(x) (uint64_t) (x)
+#  define htole64(x) bswap_64 (x)
+#  define be64toh(x) (uint64_t) (x)
+#  define le64toh(x) bswap_64 (x)
+
+# endif
 
-#else
-#include <asm/byteorder.h>
-/* New clearer variants. */
-#define le16_to_cpu(x) __le16_to_cpu(x)
-#define le32_to_cpu(x) __le32_to_cpu(x)
-#define le64_to_cpu(x) __le64_to_cpu(x)
-#define cpu_to_le16(x) __cpu_to_le16(x)
-#define cpu_to_le32(x) __cpu_to_le32(x)
-#define cpu_to_le64(x) __cpu_to_le64(x)
-#define be16_to_cpu(x) __be16_to_cpu(x)
-#define be32_to_cpu(x) __be32_to_cpu(x)
-#define be64_to_cpu(x) __be64_to_cpu(x)
-#define cpu_to_be16(x) __cpu_to_be16(x)
-#define cpu_to_be32(x) __cpu_to_be32(x)
-#define cpu_to_be64(x) __cpu_to_be64(x)
-/* Old alternative variants. */
-#define xlate16(x) __cpu_to_le16(x)
-#define xlate32(x) __cpu_to_le32(x)
-#define xlate64(x) __cpu_to_le64(x)
-#define xlate16_be(x) __cpu_to_be16(x)
-#define xlate32_be(x) __cpu_to_be32(x)
-#define xlate64_be(x) __cpu_to_be64(x)
 #endif
 
 #endif
index 71171092c01d7efb66a986025f5afca1bf651188..2d1f2526243f47fd15b122996dbad3347caa6f7c 100644 (file)
@@ -663,7 +663,7 @@ static int _check_label_header(struct label_header *lh, uint64_t labelsector,
                bad++;
        }
 
-       if (xlate64(lh->sector_xl) != labelsector) {
+       if (htole64(lh->sector_xl) != labelsector) {
                log_print("CHECK: label_header.sector expected %d", (int)labelsector);
                bad++;
        }
@@ -671,12 +671,12 @@ static int _check_label_header(struct label_header *lh, uint64_t labelsector,
        crc = calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl,
                       LABEL_SIZE - ((uint8_t *) &lh->offset_xl - (uint8_t *) lh));
 
-       if (crc != xlate32(lh->crc_xl)) {
+       if (crc != htole32(lh->crc_xl)) {
                log_print("CHECK: label_header.crc expected 0x%x", crc);
                bad++;
        }
 
-       if (xlate32(lh->offset_xl) != 32) {
+       if (htole32(lh->offset_xl) != 32) {
                log_print("CHECK: label_header.offset expected 32");
                bad++;
        }
@@ -727,7 +727,7 @@ static int _check_mda_header(struct mda_header *mh, int mda_num, uint64_t mda_of
        crc = calc_crc(INITIAL_CRC, (uint8_t *)mh->magic,
                       MDA_HEADER_SIZE - sizeof(mh->checksum_xl));
 
-       if (crc != xlate32(mh->checksum_xl)) {
+       if (crc != htole32(mh->checksum_xl)) {
                log_print("CHECK: mda_header_%d.checksum expected 0x%x", mda_num, crc);
                bad++;
        }
@@ -738,17 +738,17 @@ static int _check_mda_header(struct mda_header *mh, int mda_num, uint64_t mda_of
                bad++;
        }
 
-       if (xlate32(mh->version) != FMTT_VERSION) {
+       if (htole32(mh->version) != FMTT_VERSION) {
                log_print("CHECK: mda_header_%d.version expected %u", mda_num, FMTT_VERSION);
                bad++;
        }
 
-       if (xlate64(mh->start) != mda_offset) {
+       if (htole64(mh->start) != mda_offset) {
                log_print("CHECK: mda_header_%d.start does not match pv_header.disk_locn.offset %llu", mda_num, (unsigned long long)mda_offset);
                bad++;
        }
 
-       if (xlate64(mh->size) != mda_size) {
+       if (htole64(mh->size) != mda_size) {
                log_print("CHECK: mda_header_%d.size does not match pv_header.disk_locn.size %llu", mda_num, (unsigned long long)mda_size);
                bad++;
        }
@@ -786,10 +786,10 @@ static int _dump_raw_locn(struct device *dev, struct devicefile *def, int print_
        int ri = rlocn_index; /* 0 or 1 */
        int wrapped = 0;
 
-       meta_offset = xlate64(rlocn->offset);
-       meta_size = xlate64(rlocn->size);
-       meta_checksum = xlate32(rlocn->checksum);
-       meta_flags = xlate32(rlocn->flags);
+       meta_offset = htole64(rlocn->offset);
+       meta_size = htole64(rlocn->size);
+       meta_checksum = htole32(rlocn->checksum);
+       meta_flags = htole32(rlocn->flags);
 
        if (meta_offset + meta_size > mda_size)
                wrapped = 1;
@@ -1042,9 +1042,9 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
        if (print_fields) {
                log_print("label_header at %llu", (unsigned long long)lh_offset);
                log_print("label_header.id %s", _chars_to_str(lh->id, str, 8, 256, "label_header.id"));
-               log_print("label_header.sector %llu", (unsigned long long)xlate64(lh->sector_xl));
-               log_print("label_header.crc 0x%x", xlate32(lh->crc_xl));
-               log_print("label_header.offset %u", xlate32(lh->offset_xl));
+               log_print("label_header.sector %llu", (unsigned long long)htole64(lh->sector_xl));
+               log_print("label_header.crc 0x%x", htole32(lh->crc_xl));
+               log_print("label_header.offset %u", htole32(lh->offset_xl));
                log_print("label_header.type %s", _chars_to_str(lh->type, str, 8, 256, "label_header.type"));
        }
 
@@ -1068,7 +1068,7 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
        if (print_fields) {
                log_print("pv_header at %llu", (unsigned long long)pvh_offset);
                log_print("pv_header.pv_uuid %s", _chars_to_str(pvh->pv_uuid, str, ID_LEN, 256, "pv_header.pv_uuid"));
-               log_print("pv_header.device_size %llu", (unsigned long long)xlate64(pvh->device_size_xl));
+               log_print("pv_header.device_size %llu", (unsigned long long)htole64(pvh->device_size_xl));
        }
 
        if (!_check_pv_header(pvh))
@@ -1083,14 +1083,14 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
        dlocn = pvh->disk_areas_xl;
        dlocn_offset = pvh_offset + 40; /* from start of disk */
 
-       while (xlate64(dlocn->offset)) {
+       while (htole64(dlocn->offset)) {
                if (print_fields) {
                        log_print("pv_header.disk_locn[%d] at %llu # location of data area", di,
                                  (unsigned long long)dlocn_offset);
                        log_print("pv_header.disk_locn[%d].offset %llu", di,
-                                 (unsigned long long)xlate64(dlocn->offset));
+                                 (unsigned long long)htole64(dlocn->offset));
                        log_print("pv_header.disk_locn[%d].size %llu", di,
-                                 (unsigned long long)xlate64(dlocn->size));
+                                 (unsigned long long)htole64(dlocn->size));
                }
                di++;
                dlocn++;
@@ -1102,9 +1102,9 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
                log_print("pv_header.disk_locn[%d] at %llu # location list end", di,
                          (unsigned long long) dlocn_offset);
                log_print("pv_header.disk_locn[%d].offset %llu", di,
-                         (unsigned long long)xlate64(dlocn->offset));
+                         (unsigned long long)htole64(dlocn->offset));
                log_print("pv_header.disk_locn[%d].size %llu", di,
-                         (unsigned long long)xlate64(dlocn->size));
+                         (unsigned long long)htole64(dlocn->size));
        }
 
        /* advance past the all-zero dlocn struct */
@@ -1116,19 +1116,19 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
        if ((void *)dlocn != (void *)(buf + dlocn_offset - lh_offset))
                log_print("CHECK: problem with pv_header.disk_locn[%d] offset calculation", di);
 
-       while (xlate64(dlocn->offset)) {
+       while (htole64(dlocn->offset)) {
                if (print_fields) {
                        log_print("pv_header.disk_locn[%d] at %llu # location of metadata area", di,
                                  (unsigned long long)dlocn_offset);
                        log_print("pv_header.disk_locn[%d].offset %llu", di,
-                                 (unsigned long long)xlate64(dlocn->offset));
+                                 (unsigned long long)htole64(dlocn->offset));
                        log_print("pv_header.disk_locn[%d].size %llu", di,
-                                 (unsigned long long)xlate64(dlocn->size));
+                                 (unsigned long long)htole64(dlocn->size));
                }
 
                if (!mda_count) {
-                       *mda1_offset = xlate64(dlocn->offset);
-                       *mda1_size = xlate64(dlocn->size);
+                       *mda1_offset = htole64(dlocn->offset);
+                       *mda1_size = htole64(dlocn->size);
 
                        /*
                         * mda1 offset is page size from machine that created it,
@@ -1142,8 +1142,8 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
                                          di, (unsigned long long)*mda1_offset);
                        }
                } else {
-                       *mda2_offset = xlate64(dlocn->offset);
-                       *mda2_size = xlate64(dlocn->size);
+                       *mda2_offset = htole64(dlocn->offset);
+                       *mda2_size = htole64(dlocn->size);
 
                        /*
                         * No fixed location for second mda, so we have to look for
@@ -1164,9 +1164,9 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
                log_print("pv_header.disk_locn[%d] at %llu # location list end", di,
                          (unsigned long long) dlocn_offset);
                log_print("pv_header.disk_locn[%d].offset %llu", di,
-                         (unsigned long long)xlate64(dlocn->offset));
+                         (unsigned long long)htole64(dlocn->offset));
                log_print("pv_header.disk_locn[%d].size %llu", di,
-                         (unsigned long long)xlate64(dlocn->size));
+                         (unsigned long long)htole64(dlocn->size));
        }
 
        /* advance past the all-zero dlocn struct */
@@ -1189,8 +1189,8 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
 
        if (print_fields) {
                log_print("pv_header_extension at %llu", (unsigned long long)pvhe_offset);
-               log_print("pv_header_extension.version %u", xlate32(pvhe->version));
-               log_print("pv_header_extension.flags %u", xlate32(pvhe->flags));
+               log_print("pv_header_extension.version %u", htole32(pvhe->version));
+               log_print("pv_header_extension.flags %u", htole32(pvhe->flags));
        }
 
        /*
@@ -1202,14 +1202,14 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
        dlocn = pvhe->bootloader_areas_xl;
        dlocn_offset = pvhe_offset + 8;
 
-       while (xlate64(dlocn->offset)) {
+       while (htole64(dlocn->offset)) {
                if (print_fields) {
                        log_print("pv_header_extension.disk_locn[%d] at %llu # bootloader area", di,
                                  (unsigned long long)dlocn_offset);
                        log_print("pv_header_extension.disk_locn[%d].offset %llu", di,
-                                 (unsigned long long)xlate64(dlocn->offset));
+                                 (unsigned long long)htole64(dlocn->offset));
                        log_print("pv_header_extension.disk_locn[%d].size %llu", di,
-                                 (unsigned long long)xlate64(dlocn->size));
+                                 (unsigned long long)htole64(dlocn->size));
                }
 
                di++;
@@ -1222,9 +1222,9 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
                log_print("pv_header_extension.disk_locn[%d] at %llu # location list end", di,
                          (unsigned long long) dlocn_offset);
                log_print("pv_header_extension.disk_locn[%d].offset %llu", di,
-                         (unsigned long long)xlate64(dlocn->offset));
+                         (unsigned long long)htole64(dlocn->offset));
                log_print("pv_header_extension.disk_locn[%d].size %llu", di,
-                         (unsigned long long)xlate64(dlocn->size));
+                         (unsigned long long)htole64(dlocn->size));
        }
 
        if (bad)
@@ -1289,11 +1289,11 @@ static int _dump_mda_header(struct cmd_context *cmd, struct settings *set,
 
        if (print_fields) {
                log_print("mda_header_%d at %llu # metadata area", mda_num, (unsigned long long)mda_offset);
-               log_print("mda_header_%d.checksum 0x%x", mda_num, xlate32(mh->checksum_xl));
+               log_print("mda_header_%d.checksum 0x%x", mda_num, htole32(mh->checksum_xl));
                log_print("mda_header_%d.magic 0x%s", mda_num, _chars_to_hexstr(mh->magic, str, 16, 256, "mda_header.magic"));
-               log_print("mda_header_%d.version %u", mda_num, xlate32(mh->version));
-               log_print("mda_header_%d.start %llu", mda_num, (unsigned long long)xlate64(mh->start));
-               log_print("mda_header_%d.size %llu", mda_num, (unsigned long long)xlate64(mh->size));
+               log_print("mda_header_%d.version %u", mda_num, htole32(mh->version));
+               log_print("mda_header_%d.start %llu", mda_num, (unsigned long long)htole64(mh->start));
+               log_print("mda_header_%d.size %llu", mda_num, (unsigned long long)htole64(mh->size));
        }
 
        if (!_check_mda_header(mh, mda_num, mda_offset, mda_size, found_header))
@@ -1937,13 +1937,13 @@ static int _repair_label_header(struct cmd_context *cmd, const char *repair,
 
        memcpy(lh->id, LABEL_ID, sizeof(lh->id));
        memcpy(lh->type, LVM2_LABEL, sizeof(lh->type));
-       lh->sector_xl =  xlate64(labelsector);
-       lh->offset_xl = xlate32(32);
+       lh->sector_xl =  htole64(labelsector);
+       lh->offset_xl = htole32(32);
 
        crc = calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl,
                       LABEL_SIZE - ((uint8_t *) &lh->offset_xl - (uint8_t *) lh));
 
-       lh->crc_xl = xlate32(crc);
+       lh->crc_xl = htole32(crc);
        
        log_print("Writing label_header.crc 0x%08x", crc);
 
@@ -2133,12 +2133,12 @@ static int _check_for_mda2(struct cmd_context *cmd, struct device *dev,
        if (memcmp(mh->magic, FMTT_MAGIC, sizeof(mh->magic)))
                goto fail;
 
-       if (xlate32(mh->version) != FMTT_VERSION) {
+       if (htole32(mh->version) != FMTT_VERSION) {
                log_print("Skipping mda2 (wrong mda_header.version)");
                goto fail;
        }
 
-       if (xlate64(mh->start) != mda_offset) {
+       if (htole64(mh->start) != mda_offset) {
                log_print("Skipping mda2 (wrong mda_header.start)");
                goto fail;
        }
@@ -2403,16 +2403,16 @@ static int _repair_pv_header(struct cmd_context *cmd, const char *repair,
        /* set label_header (except crc) */
        memcpy(lh->id, LABEL_ID, sizeof(lh->id));
        memcpy(lh->type, LVM2_LABEL, sizeof(lh->type));
-       lh->sector_xl =  xlate64(labelsector);
-       lh->offset_xl = xlate32(32);
+       lh->sector_xl =  htole64(labelsector);
+       lh->offset_xl = htole32(32);
 
        /* set pv_header */
        memcpy(pvh->pv_uuid, &pvid, ID_LEN);
-       pvh->device_size_xl = xlate64(device_size);
+       pvh->device_size_xl = htole64(device_size);
 
        /* set data area location */
        data_offset = (pe_start_sectors << SECTOR_SHIFT);
-       pvh->disk_areas_xl[0].offset = xlate64(data_offset);
+       pvh->disk_areas_xl[0].offset = htole64(data_offset);
        pvh->disk_areas_xl[0].size = 0;
 
        /* set end of data areas */
@@ -2425,15 +2425,15 @@ static int _repair_pv_header(struct cmd_context *cmd, const char *repair,
        if (mda_count > 0) {
                mda1_offset = 4096;
                mda1_size = (pe_start_sectors << SECTOR_SHIFT) - 4096;
-               pvh->disk_areas_xl[di].offset = xlate64(mda1_offset);
-               pvh->disk_areas_xl[di].size = xlate64(mda1_size);
+               pvh->disk_areas_xl[di].offset = htole64(mda1_offset);
+               pvh->disk_areas_xl[di].size = htole64(mda1_size);
                di++;
        }
 
        /* set second metadata area location */
        if (mda_count > 1) {
-               pvh->disk_areas_xl[di].offset = xlate64(mda2_offset);
-               pvh->disk_areas_xl[di].size = xlate64(mda2_size);
+               pvh->disk_areas_xl[di].offset = htole64(mda2_offset);
+               pvh->disk_areas_xl[di].size = htole64(mda2_size);
                di++;
        }
 
@@ -2444,8 +2444,8 @@ static int _repair_pv_header(struct cmd_context *cmd, const char *repair,
 
        /* set pv_header_extension */
        pvhe = (struct pv_header_extension *)((char *)pvh + sizeof(struct pv_header) + (di * sizeof(struct disk_locn)));
-       pvhe->version = xlate32(PV_HEADER_EXTENSION_VSN);
-       pvhe->flags = xlate32(PV_EXT_USED);
+       pvhe->version = htole32(PV_HEADER_EXTENSION_VSN);
+       pvhe->flags = htole32(PV_EXT_USED);
        pvhe->bootloader_areas_xl[0].offset = 0;
        pvhe->bootloader_areas_xl[0].size = 0;
 
@@ -2453,7 +2453,7 @@ static int _repair_pv_header(struct cmd_context *cmd, const char *repair,
                            LABEL_SIZE - ((uint8_t *) &lh->offset_xl - (uint8_t *) lh));
 
        /* set label_header crc (last) */
-       lh->crc_xl = xlate32(head_crc);
+       lh->crc_xl = htole32(head_crc);
 
        /*
         * Write the updated header sector.
@@ -2519,15 +2519,15 @@ static int _update_mda(struct cmd_context *cmd, struct metadata_file *mf, struct
 
        mh = (struct mda_header *)buf;
        memcpy(mh->magic, FMTT_MAGIC, sizeof(mh->magic));
-       mh->version = xlate32(FMTT_VERSION);
-       mh->start = xlate64(mda_offset);
-       mh->size = xlate64(mda_size);
+       mh->version = htole32(FMTT_VERSION);
+       mh->start = htole64(mda_offset);
+       mh->size = htole64(mda_size);
 
        rlocn0 = mh->raw_locns;
        rlocn0->flags = 0;
-       rlocn0->offset = xlate64(512); /* text begins 512 from start of mda_header */
-       rlocn0->size = xlate64(mf->text_size);
-       rlocn0->checksum = xlate32(mf->text_crc);
+       rlocn0->offset = htole64(512); /* text begins 512 from start of mda_header */
+       rlocn0->size = htole64(mf->text_size);
+       rlocn0->checksum = htole32(mf->text_crc);
 
        rlocn1 = (struct raw_locn *)((char *)mh->raw_locns + 24);
        rlocn1->flags = 0;
@@ -2537,7 +2537,7 @@ static int _update_mda(struct cmd_context *cmd, struct metadata_file *mf, struct
 
        crc = calc_crc(INITIAL_CRC, (uint8_t *)mh->magic,
                       MDA_HEADER_SIZE - sizeof(mh->checksum_xl));
-       mh->checksum_xl = xlate32(crc);
+       mh->checksum_xl = htole32(crc);
 
        log_print("Writing metadata at %llu length %llu crc 0x%08x mda%d",
                  (unsigned long long)(mda_offset + 512),
This page took 0.153942 seconds and 5 git commands to generate.