]> Pileus Git - ~andy/linux/blobdiff - fs/lockd/mon.c
Merge branch 'avr32-arch' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoe...
[~andy/linux] / fs / lockd / mon.c
index fafa0ea71938b08a46e04035906981cce8b703d2..6d5d4a4169e5ae472dcf2ad43e46e0495c20fb05 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/sunrpc/svc.h>
 #include <linux/lockd/lockd.h>
 
+#include <asm/unaligned.h>
+
 #define NLMDBG_FACILITY                NLMDBG_MONITOR
 #define NSM_PROGRAM            100024
 #define NSM_VERSION            1
@@ -44,8 +46,6 @@ struct nsm_res {
        u32                     state;
 };
 
-static struct rpc_clnt *       nsm_create(void);
-
 static struct rpc_program      nsm_program;
 static                         LIST_HEAD(nsm_handles);
 static                         DEFINE_SPINLOCK(nsm_lock);
@@ -98,11 +98,26 @@ static void nsm_display_address(const struct sockaddr *sap,
        }
 }
 
-/*
- * Common procedure for NSMPROC_MON/NSMPROC_UNMON calls
- */
-static int
-nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
+static struct rpc_clnt *nsm_create(void)
+{
+       struct sockaddr_in sin = {
+               .sin_family             = AF_INET,
+               .sin_addr.s_addr        = htonl(INADDR_LOOPBACK),
+       };
+       struct rpc_create_args args = {
+               .protocol               = XPRT_TRANSPORT_UDP,
+               .address                = (struct sockaddr *)&sin,
+               .addrsize               = sizeof(sin),
+               .servername             = "rpc.statd",
+               .program                = &nsm_program,
+               .version                = NSM_VERSION,
+               .authflavor             = RPC_AUTH_NULL,
+       };
+
+       return rpc_create(&args);
+}
+
+static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
 {
        struct rpc_clnt *clnt;
        int             status;
@@ -261,10 +276,12 @@ static void nsm_init_private(struct nsm_handle *nsm)
 {
        u64 *p = (u64 *)&nsm->sm_priv.data;
        struct timespec ts;
+       s64 ns;
 
        ktime_get_ts(&ts);
-       *p++ = timespec_to_ns(&ts);
-       *p = (unsigned long)nsm;
+       ns = timespec_to_ns(&ts);
+       put_unaligned(ns, p);
+       put_unaligned((unsigned long)nsm, p + 1);
 }
 
 static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
@@ -408,30 +425,6 @@ void nsm_release(struct nsm_handle *nsm)
        }
 }
 
-/*
- * Create NSM client for the local host
- */
-static struct rpc_clnt *
-nsm_create(void)
-{
-       struct sockaddr_in      sin = {
-               .sin_family     = AF_INET,
-               .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
-               .sin_port       = 0,
-       };
-       struct rpc_create_args args = {
-               .protocol       = XPRT_TRANSPORT_UDP,
-               .address        = (struct sockaddr *)&sin,
-               .addrsize       = sizeof(sin),
-               .servername     = "localhost",
-               .program        = &nsm_program,
-               .version        = NSM_VERSION,
-               .authflavor     = RPC_AUTH_NULL,
-       };
-
-       return rpc_create(&args);
-}
-
 /*
  * XDR functions for NSM.
  *