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
This commit is contained in:
parent
72bb5dc656
commit
0adb6d7a49
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107940
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -178,7 +178,7 @@ void
|
||||
smb_strtouni(u_int16_t *dst, const char *src)
|
||||
{
|
||||
while (*src) {
|
||||
*dst++ = htoles(*src++);
|
||||
*dst++ = htole16(*src++);
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user