17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0616fd7fSPavel Filipensky * Common Development and Distribution License (the "License"). 6*0616fd7fSPavel Filipensky * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*0616fd7fSPavel Filipensky * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate #ifndef _NFS4_IDMAP_IMPL_H 267c478bd9Sstevel@tonic-gate #define _NFS4_IDMAP_IMPL_H 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #include <sys/list.h> 297c478bd9Sstevel@tonic-gate #include <sys/door.h> 30*0616fd7fSPavel Filipensky #include <sys/pkp_hash.h> 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * This is a private header file. Applications should not directly include 347c478bd9Sstevel@tonic-gate * this file. 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Cache Entry Definitions 437c478bd9Sstevel@tonic-gate */ 44*0616fd7fSPavel Filipensky #define NFSID_CACHE_ANCHORS PKP_HASH_SIZE 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate typedef struct nfsidmap { 477c478bd9Sstevel@tonic-gate struct nfsidmap *id_chain[2]; /* must be first */ 487c478bd9Sstevel@tonic-gate time_t id_time; /* time stamp */ 497c478bd9Sstevel@tonic-gate uid_t id_no; /* uid/gid */ 507c478bd9Sstevel@tonic-gate utf8string id_str; /* user@domain string */ 517c478bd9Sstevel@tonic-gate } nfsidmap_t; 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define id_forw id_chain[0] 547c478bd9Sstevel@tonic-gate #define id_back id_chain[1] 557c478bd9Sstevel@tonic-gate #define id_len id_str.utf8string_len 567c478bd9Sstevel@tonic-gate #define id_val id_str.utf8string_val 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate typedef struct nfsidhq { 597c478bd9Sstevel@tonic-gate union { 607c478bd9Sstevel@tonic-gate struct nfsidhq *hq_head[2]; /* for empty queue */ 617c478bd9Sstevel@tonic-gate struct nfsidmap *hq_chain[2]; /* for LRU list */ 627c478bd9Sstevel@tonic-gate } hq_link; 637c478bd9Sstevel@tonic-gate kmutex_t hq_lock; /* protects hash queue */ 647c478bd9Sstevel@tonic-gate } nfsidhq_t; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #define hq_que_forw hq_link.hq_head[0] 677c478bd9Sstevel@tonic-gate #define hq_que_back hq_link.hq_head[1] 687c478bd9Sstevel@tonic-gate #define hq_lru_forw hq_link.hq_chain[0] 697c478bd9Sstevel@tonic-gate #define hq_lru_back hq_link.hq_chain[1] 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate typedef struct { 727c478bd9Sstevel@tonic-gate const char *name; /* cache name */ 737c478bd9Sstevel@tonic-gate nfsidhq_t *table; /* hash table */ 747c478bd9Sstevel@tonic-gate /* 757c478bd9Sstevel@tonic-gate * Since we need to know the status of nfsmapid from random functions 767c478bd9Sstevel@tonic-gate * that deal with idmap caches, we keep a pointer to the relevant fields 777c478bd9Sstevel@tonic-gate * in the zone's globals so we don't have to keep passing them around. 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate door_handle_t *nfsidmap_daemon_dh; 807c478bd9Sstevel@tonic-gate } idmap_cache_info_t; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate typedef enum hash_stat { HQ_HASH_HINT, HQ_HASH_FIND } hash_stat; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Per-zone modular globals 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate struct nfsidmap_globals { 887c478bd9Sstevel@tonic-gate list_node_t nig_link; /* linkage into global list */ 897c478bd9Sstevel@tonic-gate enum clnt_stat nig_last_stat; /* status of last RPC call */ 907c478bd9Sstevel@tonic-gate int nig_msg_done; /* have we printed a message? */ 917c478bd9Sstevel@tonic-gate idmap_cache_info_t u2s_ci; /* table mapping uid-to-string */ 927c478bd9Sstevel@tonic-gate idmap_cache_info_t s2u_ci; /* table mapping string-to-uid */ 937c478bd9Sstevel@tonic-gate idmap_cache_info_t g2s_ci; /* table mapping groupid-to-string */ 947c478bd9Sstevel@tonic-gate idmap_cache_info_t s2g_ci; /* table mapping string-to-groupid */ 957c478bd9Sstevel@tonic-gate pid_t nfsidmap_pid; 967c478bd9Sstevel@tonic-gate kmutex_t nfsidmap_daemon_lock; 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * nfsidmap_daemon_lock protects the following: 997c478bd9Sstevel@tonic-gate * nfsidmap_daemon_dh 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate door_handle_t nfsidmap_daemon_dh; 1027c478bd9Sstevel@tonic-gate }; 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1057c478bd9Sstevel@tonic-gate } 1067c478bd9Sstevel@tonic-gate #endif 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #endif /* _NFS4_IDMAP_IMPL_H */ 109