xref: /titanic_41/usr/src/uts/common/nfs/nfs_cmd.h (revision b509e89b2befbaa42939abad9da1d7f5a8c6aaae)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 #ifndef	_NFS_CMD_H
30 #define	_NFS_CMD_H
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/param.h>
38 #include <sys/kiconv.h>
39 
40 #define	KICONV_MAX_CODENAME_LEN	63 /* copied from sys/kiconv.h */
41 
42 #define	NFSCMD_VERS_1	1
43 #define	NFSCMD_VERSION	NFSCMD_VERS_1
44 
45 typedef enum { NFSCMD_CHARMAP_LOOKUP, NFSCMD_ERROR } nfscmd_t;
46 typedef enum { NFSCMD_ERR_SUCCESS, NFSCMD_ERR_BADCMD, NFSCMD_ERR_NOTFOUND,
47     NFSCMD_ERR_FAIL, NFSCMD_ERR_DROP, NFSCMD_ERR_NOMEM } nfscmd_err_t;
48 #define	NFSCMD_ERR_RET	0x100000
49 
50 typedef struct nfscmd_arg {
51 	uint32_t	version;
52 	nfscmd_t	cmd;
53 	union {
54 		struct {
55 			char path[MAXPATHLEN];
56 			struct sockaddr addr;
57 		} charmap;
58 	} arg;
59 } nfscmd_arg_t;
60 
61 typedef struct nfscmd_res {
62 	uint32_t	version;
63 	uint32_t	cmd;
64 	nfscmd_err_t	error;
65 	union {
66 		struct {
67 		    char	codeset[KICONV_MAX_CODENAME_LEN + 1];
68 		    uint32_t	apply;
69 		} charmap;
70 	} result;
71 } nfscmd_res_t;
72 
73 #ifdef _KERNEL
74 
75 #define	NFSCMD_CONV_INBOUND	1
76 #define	NFSCMD_CONV_OUTBOUND	0
77 
78 extern int nfscmd_send(nfscmd_arg_t *, nfscmd_res_t *);
79 extern int nfscmd_charmap(struct exportinfo *, struct sockaddr *);
80 extern struct charset_cache *nfscmd_findmap(struct exportinfo *,
81     struct sockaddr *);
82 extern char *nfscmd_convname(struct sockaddr *, struct exportinfo *,
83     char *, int, size_t);
84 extern char *nfscmd_convdirent(struct sockaddr *, struct exportinfo *, char *,
85     size_t, enum nfsstat3 *);
86 extern size_t nfscmd_convdirplus(struct sockaddr *, struct exportinfo *, char *,
87     size_t, size_t, char **);
88 extern size_t nfscmd_countents(char *, size_t);
89 extern size_t nfscmd_dropped_entrysize(struct dirent64 *, size_t, size_t);
90 
91 #endif
92 
93 #ifdef	__cplusplus
94 }
95 #endif
96 
97 #endif	/* _NFS_CMD_H */
98