diff options
author | robert <robert@FreeBSD.org> | 2002-12-16 16:20:06 +0000 |
---|---|---|
committer | robert <robert@FreeBSD.org> | 2002-12-16 16:20:06 +0000 |
commit | efdf333c007d8509b5d43ea434612ec248827a0c (patch) | |
tree | 7523ad0415eff3b2ee2e3f1703fcfc0b0bfbc5ff | |
parent | 9c13a1ee5f744e6c21ae65cb3ed17e00d241a72f (diff) | |
download | FreeBSD-src-efdf333c007d8509b5d43ea434612ec248827a0c.zip FreeBSD-src-efdf333c007d8509b5d43ea434612ec248827a0c.tar.gz |
Remove the hto(be|le)[slq] and (be|le)toh[slq] macros defined in
_KERNEL scope from "src/sys/sys/mchain.h".
Replace each occurrence of the above in _KERNEL scope with the
appropriate macro from the set of hto(be|le)(16|32|64) and
(be|le)toh(16|32|64) from "src/sys/sys/endian.h".
Tested by: tjr
Requested by: comment marked with XXX
-rw-r--r-- | sys/kern/subr_mchain.c | 25 | ||||
-rw-r--r-- | sys/netsmb/smb.h | 2 | ||||
-rw-r--r-- | sys/netsmb/smb_iod.c | 4 | ||||
-rw-r--r-- | sys/netsmb/smb_rq.c | 2 | ||||
-rw-r--r-- | sys/netsmb/smb_subr.c | 2 | ||||
-rw-r--r-- | sys/sys/mchain.h | 23 |
6 files changed, 18 insertions, 40 deletions
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c index b63a12e..b0aef5c 100644 --- a/sys/kern/subr_mchain.c +++ b/sys/kern/subr_mchain.c @@ -32,7 +32,6 @@ * $FreeBSD$ */ - #include <sys/param.h> #include <sys/systm.h> #include <sys/endian.h> @@ -140,42 +139,42 @@ mb_put_uint8(struct mbchain *mbp, u_int8_t x) int mb_put_uint16be(struct mbchain *mbp, u_int16_t x) { - x = htobes(x); + x = htobe16(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } int mb_put_uint16le(struct mbchain *mbp, u_int16_t x) { - x = htoles(x); + x = htole16(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } int mb_put_uint32be(struct mbchain *mbp, u_int32_t x) { - x = htobel(x); + x = htobe32(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } int mb_put_uint32le(struct mbchain *mbp, u_int32_t x) { - x = htolel(x); + x = htole32(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } int mb_put_int64be(struct mbchain *mbp, int64_t x) { - x = htobeq(x); + x = htobe64(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } int mb_put_int64le(struct mbchain *mbp, int64_t x) { - x = htoleq(x); + x = htole64(x); return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); } @@ -377,7 +376,7 @@ md_get_uint16le(struct mdchain *mdp, u_int16_t *x) int error = md_get_uint16(mdp, &v); if (x != NULL) - *x = letohs(v); + *x = le16toh(v); return error; } @@ -387,7 +386,7 @@ md_get_uint16be(struct mdchain *mdp, u_int16_t *x) { int error = md_get_uint16(mdp, &v); if (x != NULL) - *x = betohs(v); + *x = be16toh(v); return error; } @@ -405,7 +404,7 @@ md_get_uint32be(struct mdchain *mdp, u_int32_t *x) error = md_get_uint32(mdp, &v); if (x != NULL) - *x = betohl(v); + *x = be32toh(v); return error; } @@ -417,7 +416,7 @@ md_get_uint32le(struct mdchain *mdp, u_int32_t *x) error = md_get_uint32(mdp, &v); if (x != NULL) - *x = letohl(v); + *x = le32toh(v); return error; } @@ -435,7 +434,7 @@ md_get_int64be(struct mdchain *mdp, int64_t *x) error = md_get_int64(mdp, &v); if (x != NULL) - *x = betohq(v); + *x = be64toh(v); return error; } @@ -447,7 +446,7 @@ md_get_int64le(struct mdchain *mdp, int64_t *x) error = md_get_int64(mdp, &v); if (x != NULL) - *x = letohq(v); + *x = le64toh(v); return error; } diff --git a/sys/netsmb/smb.h b/sys/netsmb/smb.h index 7dbe912..8ffd2ef 100644 --- a/sys/netsmb/smb.h +++ b/sys/netsmb/smb.h @@ -68,7 +68,7 @@ enum smb_dialects { */ #define SMB_SIGNATURE "\xFFSMB" #define SMB_SIGLEN 4 -#define SMB_HDRMID(p) (letohs(*(u_short*)((u_char*)(p) + 30))) +#define SMB_HDRMID(p) (le16toh(*(u_short*)((u_char*)(p) + 30))) #define SMB_HDRLEN 32 /* * bits in the smb_flags field diff --git a/sys/netsmb/smb_iod.c b/sys/netsmb/smb_iod.c index 7edbc1b..5ae5f14 100644 --- a/sys/netsmb/smb_iod.c +++ b/sys/netsmb/smb_iod.c @@ -233,8 +233,8 @@ smb_iod_sendrq(struct smbiod *iod, struct smb_rq *rqp) if (vcp->vc_maxmux != 0 && iod->iod_muxcnt >= vcp->vc_maxmux) return 0; #endif - *rqp->sr_rqtid = htoles(ssp ? ssp->ss_tid : SMB_TID_UNKNOWN); - *rqp->sr_rquid = htoles(vcp ? vcp->vc_smbuid : 0); + *rqp->sr_rqtid = htole16(ssp ? ssp->ss_tid : SMB_TID_UNKNOWN); + *rqp->sr_rquid = htole16(vcp ? vcp->vc_smbuid : 0); mb_fixhdr(&rqp->sr_rq); } if (rqp->sr_sendcnt++ > 5) { diff --git a/sys/netsmb/smb_rq.c b/sys/netsmb/smb_rq.c index 9eff2d5..5e0c7a8 100644 --- a/sys/netsmb/smb_rq.c +++ b/sys/netsmb/smb_rq.c @@ -242,7 +242,7 @@ smb_rq_bend(struct smb_rq *rqp) bcnt = rqp->sr_rq.mb_count; if (bcnt > 0xffff) SMBERROR("byte count too large (%d)\n", bcnt); - *rqp->sr_bcount = htoles(bcnt); + *rqp->sr_bcount = htole16(bcnt); } int diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c index f58d235..fe10a5c 100644 --- a/sys/netsmb/smb_subr.c +++ b/sys/netsmb/smb_subr.c @@ -178,7 +178,7 @@ void smb_strtouni(u_int16_t *dst, const char *src) { while (*src) { - *dst++ = htoles(*src++); + *dst++ = htole16(*src++); } *dst = 0; } diff --git a/sys/sys/mchain.h b/sys/sys/mchain.h index ce38465..4fbdfac 100644 --- a/sys/sys/mchain.h +++ b/sys/sys/mchain.h @@ -36,28 +36,7 @@ #include <machine/endian.h> -#ifdef _KERNEL - -/* - * XXX: remove these defines and change the function calls in the code. Use - * it unconditionally if (when) the extended byte order functions become - * available in user space. - */ -#define htoles(x) htole16((x)) -#define letohs(x) le16toh((x)) -#define htolel(x) htole32((x)) -#define letohl(x) le32toh((x)) -#define htoleq(x) htole64((int64_t)(x)) -#define letohq(x) le64toh((int64_t)(x)) - -#define htobes(x) htobe16((x)) -#define betohs(x) be16toh((x)) -#define htobel(x) htobe32((x)) -#define betohl(x) be32toh((x)) -#define htobeq(x) htobe64((int64_t)(x)) -#define betohq(x) be64toh((int64_t)(x)) - -#else +#ifndef _KERNEL /* * This macros probably belongs to the endian.h */ |