fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / sunrpc / auth_unix.c
index 4f2ad4f..97b991c 100644 (file)
 #include <linux/module.h>
 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/auth.h>
-#include <linux/vserver/xid.h>
+#include <linux/vs_tag.h>
 
 #define NFS_NGROUPS    16
 
 struct unx_cred {
        struct rpc_cred         uc_base;
        gid_t                   uc_gid;
-       xid_t                   uc_xid;
+       tag_t                   uc_tag;
        gid_t                   uc_gids[NFS_NGROUPS];
 };
 #define uc_uid                 uc_base.cr_uid
@@ -80,7 +80,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
        if (flags & RPCAUTH_LOOKUP_ROOTCREDS) {
                cred->uc_uid = 0;
                cred->uc_gid = 0;
-               cred->uc_xid = vx_current_xid();
+               cred->uc_tag = dx_current_tag();
                cred->uc_gids[0] = NOGROUP;
        } else {
                int groups = acred->group_info->ngroups;
@@ -89,7 +89,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
 
                cred->uc_uid = acred->uid;
                cred->uc_gid = acred->gid;
-               cred->uc_xid = acred->xid;
+               cred->uc_tag = acred->tag;
                for (i = 0; i < groups; i++)
                        cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
                if (i < NFS_NGROUPS)
@@ -122,7 +122,7 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
 
                if (cred->uc_uid != acred->uid
                 || cred->uc_gid != acred->gid
-                || cred->uc_xid != acred->xid)
+                || cred->uc_tag != acred->tag)
                        return 0;
 
                groups = acred->group_info->ngroups;
@@ -142,13 +142,13 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
  * Marshal credentials.
  * Maybe we should keep a cached credential for performance reasons.
  */
-static u32 *
-unx_marshal(struct rpc_task *task, u32 *p)
+static __be32 *
+unx_marshal(struct rpc_task *task, __be32 *p)
 {
        struct rpc_clnt *clnt = task->tk_client;
        struct unx_cred *cred = (struct unx_cred *) task->tk_msg.rpc_cred;
-       u32             *base, *hold;
-       int             i, tagxid;
+       __be32          *base, *hold;
+       int             i, tag;
 
        *p++ = htonl(RPC_AUTH_UNIX);
        base = p++;
@@ -158,12 +158,12 @@ unx_marshal(struct rpc_task *task, u32 *p)
         * Copy the UTS nodename captured when the client was created.
         */
        p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);
-       tagxid = task->tk_client->cl_tagxid;
+       tag = task->tk_client->cl_tag;
 
-       *p++ = htonl((u32) XIDINO_UID(tagxid,
-               cred->uc_uid, cred->uc_xid));
-       *p++ = htonl((u32) XIDINO_GID(tagxid,
-               cred->uc_gid, cred->uc_xid));
+       *p++ = htonl((u32) TAGINO_UID(tag,
+               cred->uc_uid, cred->uc_tag));
+       *p++ = htonl((u32) TAGINO_GID(tag,
+               cred->uc_gid, cred->uc_tag));
        hold = p++;
        for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
                *p++ = htonl((u32) cred->uc_gids[i]);
@@ -186,8 +186,8 @@ unx_refresh(struct rpc_task *task)
        return 0;
 }
 
-static u32 *
-unx_validate(struct rpc_task *task, u32 *p)
+static __be32 *
+unx_validate(struct rpc_task *task, __be32 *p)
 {
        rpc_authflavor_t        flavor;
        u32                     size;
@@ -233,6 +233,7 @@ struct rpc_auth             unix_auth = {
        .au_cslack      = UNX_WRITESLACK,
        .au_rslack      = 2,                    /* assume AUTH_NULL verf */
        .au_ops         = &authunix_ops,
+       .au_flavor      = RPC_AUTH_UNIX,
        .au_count       = ATOMIC_INIT(0),
        .au_credcache   = &unix_cred_cache,
 };