10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*12679SPavel.Filipensky@Sun.COM * Common Development and Distribution License (the "License"). 6*12679SPavel.Filipensky@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*12679SPavel.Filipensky@Sun.COM * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _NFS4_IDMAP_IMPL_H 260Sstevel@tonic-gate #define _NFS4_IDMAP_IMPL_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #include <sys/list.h> 290Sstevel@tonic-gate #include <sys/door.h> 30*12679SPavel.Filipensky@Sun.COM #include <sys/pkp_hash.h> 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * This is a private header file. Applications should not directly include 340Sstevel@tonic-gate * this file. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef __cplusplus 380Sstevel@tonic-gate extern "C" { 390Sstevel@tonic-gate #endif 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * Cache Entry Definitions 430Sstevel@tonic-gate */ 44*12679SPavel.Filipensky@Sun.COM #define NFSID_CACHE_ANCHORS PKP_HASH_SIZE 450Sstevel@tonic-gate 460Sstevel@tonic-gate typedef struct nfsidmap { 470Sstevel@tonic-gate struct nfsidmap *id_chain[2]; /* must be first */ 480Sstevel@tonic-gate time_t id_time; /* time stamp */ 490Sstevel@tonic-gate uid_t id_no; /* uid/gid */ 500Sstevel@tonic-gate utf8string id_str; /* user@domain string */ 510Sstevel@tonic-gate } nfsidmap_t; 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define id_forw id_chain[0] 540Sstevel@tonic-gate #define id_back id_chain[1] 550Sstevel@tonic-gate #define id_len id_str.utf8string_len 560Sstevel@tonic-gate #define id_val id_str.utf8string_val 570Sstevel@tonic-gate 580Sstevel@tonic-gate typedef struct nfsidhq { 590Sstevel@tonic-gate union { 600Sstevel@tonic-gate struct nfsidhq *hq_head[2]; /* for empty queue */ 610Sstevel@tonic-gate struct nfsidmap *hq_chain[2]; /* for LRU list */ 620Sstevel@tonic-gate } hq_link; 630Sstevel@tonic-gate kmutex_t hq_lock; /* protects hash queue */ 640Sstevel@tonic-gate } nfsidhq_t; 650Sstevel@tonic-gate 660Sstevel@tonic-gate #define hq_que_forw hq_link.hq_head[0] 670Sstevel@tonic-gate #define hq_que_back hq_link.hq_head[1] 680Sstevel@tonic-gate #define hq_lru_forw hq_link.hq_chain[0] 690Sstevel@tonic-gate #define hq_lru_back hq_link.hq_chain[1] 700Sstevel@tonic-gate 710Sstevel@tonic-gate typedef struct { 720Sstevel@tonic-gate const char *name; /* cache name */ 730Sstevel@tonic-gate nfsidhq_t *table; /* hash table */ 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Since we need to know the status of nfsmapid from random functions 760Sstevel@tonic-gate * that deal with idmap caches, we keep a pointer to the relevant fields 770Sstevel@tonic-gate * in the zone's globals so we don't have to keep passing them around. 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate door_handle_t *nfsidmap_daemon_dh; 800Sstevel@tonic-gate } idmap_cache_info_t; 810Sstevel@tonic-gate 820Sstevel@tonic-gate typedef enum hash_stat { HQ_HASH_HINT, HQ_HASH_FIND } hash_stat; 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* 850Sstevel@tonic-gate * Per-zone modular globals 860Sstevel@tonic-gate */ 870Sstevel@tonic-gate struct nfsidmap_globals { 880Sstevel@tonic-gate list_node_t nig_link; /* linkage into global list */ 890Sstevel@tonic-gate enum clnt_stat nig_last_stat; /* status of last RPC call */ 900Sstevel@tonic-gate int nig_msg_done; /* have we printed a message? */ 910Sstevel@tonic-gate idmap_cache_info_t u2s_ci; /* table mapping uid-to-string */ 920Sstevel@tonic-gate idmap_cache_info_t s2u_ci; /* table mapping string-to-uid */ 930Sstevel@tonic-gate idmap_cache_info_t g2s_ci; /* table mapping groupid-to-string */ 940Sstevel@tonic-gate idmap_cache_info_t s2g_ci; /* table mapping string-to-groupid */ 950Sstevel@tonic-gate pid_t nfsidmap_pid; 960Sstevel@tonic-gate kmutex_t nfsidmap_daemon_lock; 970Sstevel@tonic-gate /* 980Sstevel@tonic-gate * nfsidmap_daemon_lock protects the following: 990Sstevel@tonic-gate * nfsidmap_daemon_dh 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate door_handle_t nfsidmap_daemon_dh; 1020Sstevel@tonic-gate }; 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #ifdef __cplusplus 1050Sstevel@tonic-gate } 1060Sstevel@tonic-gate #endif 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #endif /* _NFS4_IDMAP_IMPL_H */ 109