Skip to contentSkip to conversation

lockd: refactor SM_MON my_id argument encoder

PATCH New Chuck Lever 1 participant 1 message Mar 14, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/6 lockd: refactor SM_MON my_id argument encoder

Clean up: introduce a new XDR encoder specifically for the my_id argument of SM_MON requests.

---

 fs/lockd/mon.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
fs/lockd/mon.c +19 -0
index 87bd4e4..06216d6 100644
@@ -183,6 +183,25 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
 	return xdr_encode_nsm_string(p, name);
 }
 
+/*
+ * The "my_id" argument specifies the hostname and RPC procedure
+ * to be called when the status manager receives notification
+ * (via the SM_NOTIFY call) that the state of host "mon_name"
+ * has changed.
+ */
+static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp)
+{
+	p = xdr_encode_nsm_string(p, utsname()->nodename);
+	if (!p)
+		return ERR_PTR(-EIO);
+
+	*p++ = htonl(argp->prog);
+	*p++ = htonl(argp->vers);
+	*p++ = htonl(argp->proc);
+
+	return p;
+}
+
 static __be32 *
 xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
 {