Example #1
0
/*
 *	struct nlm_testargs {
 *		netobj cookie;
 *		bool exclusive;
 *		struct nlm_lock alock;
 *	};
 */
static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
				 struct xdr_stream *xdr,
				 const struct nlm_args *args)
{
	const struct nlm_lock *lock = &args->lock;

	encode_cookie(xdr, &args->cookie);
	encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
	encode_nlm_lock(xdr, lock);
}
Example #2
0
/*
 *	struct nlm_holder {
 *		bool exclusive;
 *		int uppid;
 *		netobj oh;
 *		unsigned l_offset;
 *		unsigned l_len;
 *	};
 */
static void encode_nlm_holder(struct xdr_stream *xdr,
			      const struct nlm_res *result)
{
	const struct nlm_lock *lock = &result->lock;
	u32 l_offset, l_len;
	__be32 *p;

	encode_bool(xdr, lock->fl.fl_type == F_RDLCK);
	encode_int32(xdr, lock->svid);
	encode_netobj(xdr, lock->oh.data, lock->oh.len);

	p = xdr_reserve_space(xdr, 4 + 4);
	nlm_compute_offsets(lock, &l_offset, &l_len);
	*p++ = cpu_to_be32(l_offset);
	*p   = cpu_to_be32(l_len);
}
Example #3
0
#include <picobit.h>
#include <primitives.h>
#include <gc.h>

PRIMITIVE(eq?, eq_p, 2)
{
    arg1 = encode_bool (arg1 == arg2);
    arg2 = OBJ_FALSE;
}

PRIMITIVE(not, not, 1)
{
    arg1 = encode_bool (arg1 == OBJ_FALSE);
}

PRIMITIVE(symbol?, symbol_p, 1)
{
    if (IN_RAM(arg1)) {
        arg1 = encode_bool (RAM_SYMBOL_P(arg1));
    } else if (IN_ROM(arg1)) {
        arg1 = encode_bool (ROM_SYMBOL_P(arg1));
    } else {
        arg1 = OBJ_FALSE;
    }
}

PRIMITIVE(boolean?, boolean_p, 1)
{
    arg1 = encode_bool (arg1 < 2);
}