-#else /* !HAVE_SUNRPC_CACHE_V2 */
-
-static void rsc_put(struct cache_head *item, struct cache_detail *cd)
-{
- struct rsc *rsci = container_of(item, struct rsc, h);
-
- LASSERT(cfs_atomic_read(&item->refcnt) > 0);
-
- if (cache_put(item, cd)) {
- LASSERT(item->next == NULL);
- rsc_free(rsci);
- kfree(rsci); /* created by cache mgmt using kmalloc */
- }
-}
-
-static inline int rsc_match(struct rsc *new, struct rsc *tmp)
-{
- return __rsc_match(new, tmp);
-}
-
-static inline void rsc_init(struct rsc *new, struct rsc *tmp)
-{
- __rsc_init(new, tmp);
-}
-
-static inline void rsc_update(struct rsc *new, struct rsc *tmp)
-{
- __rsc_update(new, tmp);
-}
-
-static int rsc_parse(struct cache_detail *cd, char *mesg, int mlen)
-{
- char *buf = mesg;
- int len, rv, tmp_int;
- struct rsc rsci, *rscp = NULL;
- time_t expiry;
- int status = -EINVAL;
-
- memset(&rsci, 0, sizeof(rsci));
-
- /* context handle */
- len = qword_get(&mesg, buf, mlen);
- if (len < 0) goto out;
- status = -ENOMEM;
- if (rawobj_alloc(&rsci.handle, buf, len))
- goto out;
-
- rsci.h.flags = 0;
- /* expiry */
- expiry = get_expiry(&mesg);
- status = -EINVAL;
- if (expiry == 0)
- goto out;
-
- /* remote flag */
- rv = get_int(&mesg, &tmp_int);
- if (rv) {
- CERROR("fail to get remote flag\n");
- goto out;
- }
- rsci.ctx.gsc_remote = (tmp_int != 0);
-
- /* root user flag */
- rv = get_int(&mesg, &tmp_int);
- if (rv) {
- CERROR("fail to get oss user flag\n");
- goto out;
- }
- rsci.ctx.gsc_usr_root = (tmp_int != 0);
-
- /* mds user flag */
- rv = get_int(&mesg, &tmp_int);
- if (rv) {
- CERROR("fail to get mds user flag\n");
- goto out;
- }
- rsci.ctx.gsc_usr_mds = (tmp_int != 0);
-
- /* oss user flag */
- rv = get_int(&mesg, &tmp_int);
- if (rv) {
- CERROR("fail to get oss user flag\n");
- goto out;
- }
- rsci.ctx.gsc_usr_oss = (tmp_int != 0);
-
- /* mapped uid */
- rv = get_int(&mesg, (int *) &rsci.ctx.gsc_mapped_uid);
- if (rv) {
- CERROR("fail to get mapped uid\n");
- goto out;
- }
-
- /* uid, or NEGATIVE */
- rv = get_int(&mesg, (int *) &rsci.ctx.gsc_uid);
- if (rv == -EINVAL)
- goto out;
- if (rv == -ENOENT) {
- CERROR("NOENT? set rsc entry negative\n");
- cfs_set_bit(CACHE_NEGATIVE, &rsci.h.flags);
- } else {
- struct gss_api_mech *gm;
- rawobj_t tmp_buf;
- unsigned long ctx_expiry;
-
- /* gid */
- if (get_int(&mesg, (int *) &rsci.ctx.gsc_gid))
- goto out;
-
- /* mech name */
- len = qword_get(&mesg, buf, mlen);
- if (len < 0)
- goto out;
- gm = lgss_name_to_mech(buf);
- status = -EOPNOTSUPP;
- if (!gm)
- goto out;
-
- status = -EINVAL;
- /* mech-specific data: */
- len = qword_get(&mesg, buf, mlen);
- if (len < 0) {
- lgss_mech_put(gm);
- goto out;
- }
- tmp_buf.len = len;
- tmp_buf.data = (unsigned char *)buf;
- if (lgss_import_sec_context(&tmp_buf, gm,
- &rsci.ctx.gsc_mechctx)) {
- lgss_mech_put(gm);
- goto out;
- }
-
- /* currently the expiry time passed down from user-space
- * is invalid, here we retrive it from mech. */
- if (lgss_inquire_context(rsci.ctx.gsc_mechctx, &ctx_expiry)) {
- CERROR("unable to get expire time, drop it\n");
- lgss_mech_put(gm);
- goto out;
- }
- expiry = (time_t) ctx_expiry;
-
- lgss_mech_put(gm);
- }
-
- rsci.h.expiry_time = expiry;
- rscp = rsc_lookup(&rsci, 1);
- status = 0;
-out:
- rsc_free(&rsci);
- if (rscp)
- rsc_put(&rscp->h, &rsc_cache);
-
- if (status)
- CERROR("parse rsc error %d\n", status);
- return status;
-}
-
-#endif /* HAVE_SUNRPC_CACHE_V2 */
-
-