* Check endianness the FreeBSD way.

* Use LBOLT rather than lbolt to avoid a clash with a FreeBSD global
  variable.
This commit is contained in:
John Birrell 2007-11-28 22:16:00 +00:00
parent 9587fed572
commit b468fe2bce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174049
24 changed files with 86 additions and 60 deletions

View File

@ -1148,7 +1148,7 @@ arc_evict(arc_state_t *state, int64_t bytes, boolean_t recycle,
/* prefetch buffers have a minimum lifespan */
if (HDR_IO_IN_PROGRESS(ab) ||
(ab->b_flags & (ARC_PREFETCH|ARC_INDIRECT) &&
lbolt - ab->b_arc_access < arc_min_prefetch_lifespan)) {
LBOLT - ab->b_arc_access < arc_min_prefetch_lifespan)) {
skipped++;
continue;
}
@ -1525,7 +1525,7 @@ arc_reclaim_thread(void *dummy __unused)
}
/* reset the growth delay for every reclaim */
growtime = lbolt + (arc_grow_retry * hz);
growtime = LBOLT + (arc_grow_retry * hz);
ASSERT(growtime > 0);
if (zfs_needfree && last_reclaim == ARC_RECLAIM_CONS) {
@ -1538,7 +1538,7 @@ arc_reclaim_thread(void *dummy __unused)
last_reclaim = ARC_RECLAIM_AGGR;
}
arc_kmem_reap_now(last_reclaim);
} else if ((growtime > 0) && ((growtime - lbolt) <= 0)) {
} else if ((growtime > 0) && ((growtime - LBOLT) <= 0)) {
arc_no_grow = FALSE;
}
@ -1757,7 +1757,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
*/
ASSERT(buf->b_arc_access == 0);
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mru, arc_buf_hdr_t *, buf);
arc_change_state(arc_mru, buf, hash_lock);
@ -1781,7 +1781,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
buf->b_flags &= ~ARC_PREFETCH;
ARCSTAT_BUMP(arcstat_mru_hits);
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
return;
}
@ -1790,13 +1790,13 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
* but it is still in the cache. Move it to the MFU
* state.
*/
if (lbolt > buf->b_arc_access + ARC_MINTIME) {
if (LBOLT > buf->b_arc_access + ARC_MINTIME) {
/*
* More than 125ms have passed since we
* instantiated this buffer. Move it to the
* most frequently used state.
*/
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(arc_mfu, buf, hash_lock);
}
@ -1819,7 +1819,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
arc_change_state(new_state, buf, hash_lock);
ARCSTAT_BUMP(arcstat_mru_ghost_hits);
@ -1842,7 +1842,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
mutex_exit(&arc_mfu->arcs_mtx);
}
ARCSTAT_BUMP(arcstat_mfu_hits);
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
} else if (buf->b_state == arc_mfu_ghost) {
arc_state_t *new_state = arc_mfu;
/*
@ -1860,7 +1860,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
new_state = arc_mru;
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(new_state, buf, hash_lock);

View File

@ -295,7 +295,7 @@ typedef struct blkptr {
* Note: the byteorder is either 0 or -1, both of which are palindromes.
* This simplifies the endianness handling a bit.
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define ZFS_HOST_BYTEORDER (0ULL)
#else
#define ZFS_HOST_BYTEORDER (-1ULL)

View File

@ -128,7 +128,7 @@ vdev_cache_evict(vdev_cache_t *vc, vdev_cache_entry_t *ve)
ASSERT(ve->ve_data != NULL);
dprintf("evicting %p, off %llx, LRU %llu, age %lu, hits %u, stale %u\n",
vc, ve->ve_offset, ve->ve_lastused, lbolt - ve->ve_lastused,
vc, ve->ve_offset, ve->ve_lastused, LBOLT - ve->ve_lastused,
ve->ve_hits, ve->ve_missed_update);
avl_remove(&vc->vc_lastused_tree, ve);
@ -171,7 +171,7 @@ vdev_cache_allocate(zio_t *zio)
ve = kmem_zalloc(sizeof (vdev_cache_entry_t), KM_SLEEP);
ve->ve_offset = offset;
ve->ve_lastused = lbolt;
ve->ve_lastused = LBOLT;
ve->ve_data = zio_buf_alloc(VCBS);
avl_add(&vc->vc_offset_tree, ve);
@ -188,9 +188,9 @@ vdev_cache_hit(vdev_cache_t *vc, vdev_cache_entry_t *ve, zio_t *zio)
ASSERT(MUTEX_HELD(&vc->vc_lock));
ASSERT(ve->ve_fill_io == NULL);
if (ve->ve_lastused != lbolt) {
if (ve->ve_lastused != LBOLT) {
avl_remove(&vc->vc_lastused_tree, ve);
ve->ve_lastused = lbolt;
ve->ve_lastused = LBOLT;
avl_add(&vc->vc_lastused_tree, ve);
}

View File

@ -43,7 +43,7 @@
int zfs_vdev_max_pending = 35;
int zfs_vdev_min_pending = 4;
/* deadline = pri + (lbolt >> time_shift) */
/* deadline = pri + (LBOLT >> time_shift) */
int zfs_vdev_time_shift = 6;
/* exponential I/O issue ramp-up rate */

View File

@ -1553,7 +1553,7 @@ zil_replay(objset_t *os, void *arg, uint64_t *txgp,
txg_wait_synced(zilog->zl_dmu_pool, 0);
zilog->zl_stop_replay = 0;
zilog->zl_replay_time = lbolt;
zilog->zl_replay_time = LBOLT;
ASSERT(zilog->zl_replay_blks == 0);
(void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr,
zh->zh_claim_txg);

View File

@ -1299,7 +1299,7 @@ zio_write_allocate_gang_members(zio_t *zio)
bzero(gbh, gsize);
/* We need to test multi-level gang blocks */
if (maxalloc >= zio_gang_bang && (lbolt & 0x1) == 0)
if (maxalloc >= zio_gang_bang && (LBOLT & 0x1) == 0)
maxalloc = MAX(maxalloc >> 2, SPA_MINBLOCKSIZE);
for (loff = 0, i = 0; loff != zio->io_size;
@ -1375,7 +1375,7 @@ zio_dva_allocate(zio_t *zio)
ASSERT3U(zio->io_ndvas, <=, spa_max_replication(zio->io_spa));
/* For testing, make some blocks above a certain size be gang blocks */
if (zio->io_size >= zio_gang_bang && (lbolt & 0x3) == 0) {
if (zio->io_size >= zio_gang_bang && (LBOLT & 0x3) == 0) {
zio_write_allocate_gang_members(zio);
return;
}

View File

@ -54,11 +54,13 @@
#pragma weak xdr_int64_t = xdr_longlong_t
#pragma weak xdr_uint64_t = xdr_u_longlong_t
#if defined(sun)
#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined"
#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined"
#endif
#endif
/*
* constants specific to the xdr "protocol"
@ -174,12 +176,12 @@ bool_t
xdr_longlong_t(XDR *xdrs, longlong_t *hp)
{
if (xdrs->x_op == XDR_ENCODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -189,12 +191,12 @@ xdr_longlong_t(XDR *xdrs, longlong_t *hp)
}
if (xdrs->x_op == XDR_DECODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -213,12 +215,12 @@ xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp)
{
if (xdrs->x_op == XDR_ENCODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -228,12 +230,12 @@ xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp)
}
if (xdrs->x_op == XDR_DECODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));

View File

@ -365,7 +365,7 @@ struct xdr_discrim {
#endif
#ifndef _LITTLE_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define IXDR_GET_HYPER(buf, v) { \
*((int32_t *)(&v)) = ntohl(*(uint32_t *)buf++); \
*((int32_t *)(((char *)&v) + BYTES_PER_XDR_UNIT)) \

View File

@ -58,7 +58,7 @@ extern "C" {
* macros for conversion between host and (internet) network byte order
*/
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
#if BYTE_ORDER == _BIG_ENDIAN && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
@ -108,7 +108,7 @@ extern in_port_t ntohs(in_port_t);
/*
* Macros to convert from a specific byte order to/from native byte order
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define BE_8(x) BMASK_8(x)
#define BE_16(x) BMASK_16(x)
#define BE_32(x) BMASK_32(x)

View File

@ -229,7 +229,9 @@ extern "C" {
/*
* Define the appropriate "processor characteristics"
*/
#if defined(sun)
#define _LITTLE_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_LTOH
#define _BIT_FIELDS_LTOH
@ -293,7 +295,9 @@ extern "C" {
/*
* Define the appropriate "processor characteristics"
*/
#if defined(sun)
#define _LITTLE_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_LTOH
#define _BIT_FIELDS_LTOH
@ -378,7 +382,9 @@ extern "C" {
* Define the appropriate "processor characteristics" shared between
* all Solaris on SPARC systems.
*/
#if defined(sun)
#define _BIG_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_HTOL
#define _BIT_FIELDS_HTOL

View File

@ -139,6 +139,7 @@ typedef struct procset {
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#if defined(sun)
#ifdef _KERNEL
struct proc;
@ -152,6 +153,7 @@ extern boolean_t cur_inset_only(procset_t *);
extern id_t getmyid(idtype_t);
#endif /* _KERNEL */
#endif
#ifdef __cplusplus
}

View File

@ -111,6 +111,7 @@ extern unsigned char bcd_to_byte[256];
#define L_MAXMIN L_MAXMIN32
#endif
#if defined(sun)
#ifdef _KERNEL
/* major part of a device internal to the kernel */
@ -171,6 +172,8 @@ extern unsigned char bcd_to_byte[256];
NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ))
#define geteminor(x) (minor_t)((x) & L_MAXMIN)
#endif /* sun */
/*
* These are versions of the kernel routines for compressing and
* expanding long device numbers that don't return errors.

View File

@ -1148,7 +1148,7 @@ arc_evict(arc_state_t *state, int64_t bytes, boolean_t recycle,
/* prefetch buffers have a minimum lifespan */
if (HDR_IO_IN_PROGRESS(ab) ||
(ab->b_flags & (ARC_PREFETCH|ARC_INDIRECT) &&
lbolt - ab->b_arc_access < arc_min_prefetch_lifespan)) {
LBOLT - ab->b_arc_access < arc_min_prefetch_lifespan)) {
skipped++;
continue;
}
@ -1525,7 +1525,7 @@ arc_reclaim_thread(void *dummy __unused)
}
/* reset the growth delay for every reclaim */
growtime = lbolt + (arc_grow_retry * hz);
growtime = LBOLT + (arc_grow_retry * hz);
ASSERT(growtime > 0);
if (zfs_needfree && last_reclaim == ARC_RECLAIM_CONS) {
@ -1538,7 +1538,7 @@ arc_reclaim_thread(void *dummy __unused)
last_reclaim = ARC_RECLAIM_AGGR;
}
arc_kmem_reap_now(last_reclaim);
} else if ((growtime > 0) && ((growtime - lbolt) <= 0)) {
} else if ((growtime > 0) && ((growtime - LBOLT) <= 0)) {
arc_no_grow = FALSE;
}
@ -1757,7 +1757,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
*/
ASSERT(buf->b_arc_access == 0);
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mru, arc_buf_hdr_t *, buf);
arc_change_state(arc_mru, buf, hash_lock);
@ -1781,7 +1781,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
buf->b_flags &= ~ARC_PREFETCH;
ARCSTAT_BUMP(arcstat_mru_hits);
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
return;
}
@ -1790,13 +1790,13 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
* but it is still in the cache. Move it to the MFU
* state.
*/
if (lbolt > buf->b_arc_access + ARC_MINTIME) {
if (LBOLT > buf->b_arc_access + ARC_MINTIME) {
/*
* More than 125ms have passed since we
* instantiated this buffer. Move it to the
* most frequently used state.
*/
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(arc_mfu, buf, hash_lock);
}
@ -1819,7 +1819,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
arc_change_state(new_state, buf, hash_lock);
ARCSTAT_BUMP(arcstat_mru_ghost_hits);
@ -1842,7 +1842,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
mutex_exit(&arc_mfu->arcs_mtx);
}
ARCSTAT_BUMP(arcstat_mfu_hits);
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
} else if (buf->b_state == arc_mfu_ghost) {
arc_state_t *new_state = arc_mfu;
/*
@ -1860,7 +1860,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
new_state = arc_mru;
}
buf->b_arc_access = lbolt;
buf->b_arc_access = LBOLT;
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(new_state, buf, hash_lock);

View File

@ -295,7 +295,7 @@ typedef struct blkptr {
* Note: the byteorder is either 0 or -1, both of which are palindromes.
* This simplifies the endianness handling a bit.
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define ZFS_HOST_BYTEORDER (0ULL)
#else
#define ZFS_HOST_BYTEORDER (-1ULL)

View File

@ -128,7 +128,7 @@ vdev_cache_evict(vdev_cache_t *vc, vdev_cache_entry_t *ve)
ASSERT(ve->ve_data != NULL);
dprintf("evicting %p, off %llx, LRU %llu, age %lu, hits %u, stale %u\n",
vc, ve->ve_offset, ve->ve_lastused, lbolt - ve->ve_lastused,
vc, ve->ve_offset, ve->ve_lastused, LBOLT - ve->ve_lastused,
ve->ve_hits, ve->ve_missed_update);
avl_remove(&vc->vc_lastused_tree, ve);
@ -171,7 +171,7 @@ vdev_cache_allocate(zio_t *zio)
ve = kmem_zalloc(sizeof (vdev_cache_entry_t), KM_SLEEP);
ve->ve_offset = offset;
ve->ve_lastused = lbolt;
ve->ve_lastused = LBOLT;
ve->ve_data = zio_buf_alloc(VCBS);
avl_add(&vc->vc_offset_tree, ve);
@ -188,9 +188,9 @@ vdev_cache_hit(vdev_cache_t *vc, vdev_cache_entry_t *ve, zio_t *zio)
ASSERT(MUTEX_HELD(&vc->vc_lock));
ASSERT(ve->ve_fill_io == NULL);
if (ve->ve_lastused != lbolt) {
if (ve->ve_lastused != LBOLT) {
avl_remove(&vc->vc_lastused_tree, ve);
ve->ve_lastused = lbolt;
ve->ve_lastused = LBOLT;
avl_add(&vc->vc_lastused_tree, ve);
}

View File

@ -43,7 +43,7 @@
int zfs_vdev_max_pending = 35;
int zfs_vdev_min_pending = 4;
/* deadline = pri + (lbolt >> time_shift) */
/* deadline = pri + (LBOLT >> time_shift) */
int zfs_vdev_time_shift = 6;
/* exponential I/O issue ramp-up rate */

View File

@ -1553,7 +1553,7 @@ zil_replay(objset_t *os, void *arg, uint64_t *txgp,
txg_wait_synced(zilog->zl_dmu_pool, 0);
zilog->zl_stop_replay = 0;
zilog->zl_replay_time = lbolt;
zilog->zl_replay_time = LBOLT;
ASSERT(zilog->zl_replay_blks == 0);
(void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr,
zh->zh_claim_txg);

View File

@ -1299,7 +1299,7 @@ zio_write_allocate_gang_members(zio_t *zio)
bzero(gbh, gsize);
/* We need to test multi-level gang blocks */
if (maxalloc >= zio_gang_bang && (lbolt & 0x1) == 0)
if (maxalloc >= zio_gang_bang && (LBOLT & 0x1) == 0)
maxalloc = MAX(maxalloc >> 2, SPA_MINBLOCKSIZE);
for (loff = 0, i = 0; loff != zio->io_size;
@ -1375,7 +1375,7 @@ zio_dva_allocate(zio_t *zio)
ASSERT3U(zio->io_ndvas, <=, spa_max_replication(zio->io_spa));
/* For testing, make some blocks above a certain size be gang blocks */
if (zio->io_size >= zio_gang_bang && (lbolt & 0x3) == 0) {
if (zio->io_size >= zio_gang_bang && (LBOLT & 0x3) == 0) {
zio_write_allocate_gang_members(zio);
return;
}

View File

@ -54,11 +54,13 @@
#pragma weak xdr_int64_t = xdr_longlong_t
#pragma weak xdr_uint64_t = xdr_u_longlong_t
#if defined(sun)
#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined"
#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined"
#endif
#endif
/*
* constants specific to the xdr "protocol"
@ -174,12 +176,12 @@ bool_t
xdr_longlong_t(XDR *xdrs, longlong_t *hp)
{
if (xdrs->x_op == XDR_ENCODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -189,12 +191,12 @@ xdr_longlong_t(XDR *xdrs, longlong_t *hp)
}
if (xdrs->x_op == XDR_DECODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -213,12 +215,12 @@ xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp)
{
if (xdrs->x_op == XDR_ENCODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@ -228,12 +230,12 @@ xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp)
}
if (xdrs->x_op == XDR_DECODE) {
#if defined(_LITTLE_ENDIAN)
#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
#elif defined(_BIG_ENDIAN)
#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));

View File

@ -365,7 +365,7 @@ struct xdr_discrim {
#endif
#ifndef _LITTLE_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define IXDR_GET_HYPER(buf, v) { \
*((int32_t *)(&v)) = ntohl(*(uint32_t *)buf++); \
*((int32_t *)(((char *)&v) + BYTES_PER_XDR_UNIT)) \

View File

@ -58,7 +58,7 @@ extern "C" {
* macros for conversion between host and (internet) network byte order
*/
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
#if BYTE_ORDER == _BIG_ENDIAN && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
@ -108,7 +108,7 @@ extern in_port_t ntohs(in_port_t);
/*
* Macros to convert from a specific byte order to/from native byte order
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
#define BE_8(x) BMASK_8(x)
#define BE_16(x) BMASK_16(x)
#define BE_32(x) BMASK_32(x)

View File

@ -229,7 +229,9 @@ extern "C" {
/*
* Define the appropriate "processor characteristics"
*/
#if defined(sun)
#define _LITTLE_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_LTOH
#define _BIT_FIELDS_LTOH
@ -293,7 +295,9 @@ extern "C" {
/*
* Define the appropriate "processor characteristics"
*/
#if defined(sun)
#define _LITTLE_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_LTOH
#define _BIT_FIELDS_LTOH
@ -378,7 +382,9 @@ extern "C" {
* Define the appropriate "processor characteristics" shared between
* all Solaris on SPARC systems.
*/
#if defined(sun)
#define _BIG_ENDIAN
#endif
#define _STACK_GROWS_DOWNWARD
#define _LONG_LONG_HTOL
#define _BIT_FIELDS_HTOL

View File

@ -139,6 +139,7 @@ typedef struct procset {
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#if defined(sun)
#ifdef _KERNEL
struct proc;
@ -152,6 +153,7 @@ extern boolean_t cur_inset_only(procset_t *);
extern id_t getmyid(idtype_t);
#endif /* _KERNEL */
#endif
#ifdef __cplusplus
}

View File

@ -111,6 +111,7 @@ extern unsigned char bcd_to_byte[256];
#define L_MAXMIN L_MAXMIN32
#endif
#if defined(sun)
#ifdef _KERNEL
/* major part of a device internal to the kernel */
@ -171,6 +172,8 @@ extern unsigned char bcd_to_byte[256];
NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ))
#define geteminor(x) (minor_t)((x) & L_MAXMIN)
#endif /* sun */
/*
* These are versions of the kernel routines for compressing and
* expanding long device numbers that don't return errors.