diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 3bab33d11413..df7ecb56ae13 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -178,12 +178,6 @@ void g_trace(int level, char *, ...); # define G_T_BIO 2 # define G_T_ACCESS 4 -/* geom_enc.c */ -uint32_t g_dec_be2(u_char *p); -uint32_t g_dec_be4(u_char *p); -uint32_t g_dec_le2(u_char *p); -uint32_t g_dec_le4(u_char *p); -void g_enc_le4(u_char *p, uint32_t u); /* geom_event.c */ void g_orphan_provider(struct g_provider *pp, int error); @@ -298,4 +292,13 @@ extern struct sx topology_lock; #define GEOMGETCONF _IOWR('G', 0, struct sbuf) +/* geom_enc.c */ +uint32_t g_dec_be2(u_char *p); +uint32_t g_dec_be4(u_char *p); +uint32_t g_dec_le2(u_char *p); +uint32_t g_dec_le4(u_char *p); +uint64_t g_dec_le8(u_char *p); +void g_enc_le4(u_char *p, uint32_t u); +void g_enc_le8(u_char *p, uint64_t u); + #endif /* _GEOM_GEOM_H_ */ diff --git a/sys/geom/geom_enc.c b/sys/geom/geom_enc.c index 657ac8cdbb5d..ebb1bd10ce76 100644 --- a/sys/geom/geom_enc.c +++ b/sys/geom/geom_enc.c @@ -101,3 +101,19 @@ g_enc_le4(u_char *p, uint32_t u) p[3] = (u >> 24) & 0xff; } +uint64_t +g_dec_le8(u_char *p) +{ + + return(g_dec_le4(p) | ((uint64_t)(g_dec_le4(p + 4)) << 32)); +} + + +void +g_enc_le8(u_char *p, uint64_t u) +{ + + g_enc_le4(p, u); + g_enc_le4(p + 4, u >> 32); +} +