/*
* ncplib_kernel.c
*
* Copyright (C) 1995, 1996 by Volker Lendecke
* Modified for big endian by J.F. Chadima and David S. Miller
* Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
* Modified 1999 Wolfram Pienkoss for NLS
* Modified 2000 Ben Harris, University of Cambridge for NFS NS meta-info
*
*/
#include "ncplib_kernel.h"
static inline void assert_server_locked(struct ncp_server *server)
{
if (server->lock == 0) {
DPRINTK("ncpfs: server not locked!\n");
}
}
static void ncp_add_byte(struct ncp_server *server, __u8 x)
{
assert_server_locked(server);
*(__u8 *) (&(server->packet[server->current_size])) = x;
server->current_size += 1;
return;
}
static void ncp_add_word(struct ncp_server *server, __le16 x)
{
assert_server_locked(server);
put_unaligned(x, (__le16 *) (&(server->packet[server->current_size])));
server->current_size += 2;
return;
}
static void ncp_add_be16(struct ncp_server *server, __u16 x)
{
assert_server_locked(server);
put_unaligned(cpu_to_be16(x), (__be16 *) (&(server->packet[server->current_size])));
server->current_size += 2;
}
static void ncp_add_dword(struct ncp_server *server, __le32 x)
{
assert_server_locked(server);
put_unaligned(x, (__le32 *) (&(server->packet[server->current_size])));
server->current_size += 4;
return;
}
static void ncp_add_be32(struct ncp_server *server, __u32 x)
{
assert_server_locked(server);
put_unaligned(cpu_to_be32(x), (__be32 *)(&(server->packet[server->current_size])));
server->current_size += 4;
}
static inline void ncp_add_dword_lh(struct ncp_server *server, __u32 x) {
ncp_add_dword(server, cpu_to_le32(x));
}
static void ncp_add_mem(struct ncp_server *server, const void *source, int size)
{
assert_server_locked(server);
memcpy(&(server->packet[