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 2010 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
 
  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 struct charset_cache *nfscmd_findmap(struct exportinfo *,
  80     struct sockaddr *);
  81 extern char *nfscmd_convname(struct sockaddr *, struct exportinfo *,
  82     char *, int, size_t);
  83 extern char *nfscmd_convdirent(struct sockaddr *, struct exportinfo *, char *,
  84     size_t, enum nfsstat3 *);
  85 extern size_t nfscmd_convdirplus(struct sockaddr *, struct exportinfo *, char *,
  86     size_t, size_t, char **);
  87 extern size_t nfscmd_countents(char *, size_t);
  88 extern size_t nfscmd_dropped_entrysize(struct dirent64 *, size_t, size_t);
  89 
  90 #endif
  91 
  92 #ifdef  __cplusplus
  93 }
  94 #endif
  95 
  96 #endif  /* _NFS_CMD_H */
 | 
   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 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * Copyright 2018 Nexenta Systems, Inc.
  32  */
  33 
  34 #ifndef _NFS_CMD_H
  35 #define _NFS_CMD_H
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 #include <sys/types.h>
  42 #include <sys/param.h>
  43 #include <sys/kiconv.h>
  44 
  45 #define KICONV_MAX_CODENAME_LEN 63 /* copied from sys/kiconv.h */
  46 
  47 #define NFSCMD_VERS_1   1
  48 #define NFSCMD_VERSION  NFSCMD_VERS_1
  49 
  50 typedef enum { NFSCMD_CHARMAP_LOOKUP, NFSCMD_ERROR } nfscmd_t;
  51 typedef enum { NFSCMD_ERR_SUCCESS, NFSCMD_ERR_BADCMD, NFSCMD_ERR_NOTFOUND,
  52     NFSCMD_ERR_FAIL, NFSCMD_ERR_DROP, NFSCMD_ERR_NOMEM } nfscmd_err_t;
  53 #define NFSCMD_ERR_RET  0x100000
 
  68         uint32_t        cmd;
  69         nfscmd_err_t    error;
  70         union {
  71                 struct {
  72                     char        codeset[KICONV_MAX_CODENAME_LEN + 1];
  73                     uint32_t    apply;
  74                 } charmap;
  75         } result;
  76 } nfscmd_res_t;
  77 
  78 #ifdef _KERNEL
  79 
  80 #define NFSCMD_CONV_INBOUND     1
  81 #define NFSCMD_CONV_OUTBOUND    0
  82 
  83 extern int nfscmd_send(nfscmd_arg_t *, nfscmd_res_t *);
  84 extern struct charset_cache *nfscmd_findmap(struct exportinfo *,
  85     struct sockaddr *);
  86 extern char *nfscmd_convname(struct sockaddr *, struct exportinfo *,
  87     char *, int, size_t);
  88 
  89 extern char *nfscmd_convdirent(struct sockaddr *, struct exportinfo *, char *,
  90     size_t, enum nfsstat3 *);
  91 extern size_t nfscmd_convdirplus(struct sockaddr *, struct exportinfo *, char *,
  92     size_t, size_t, char **);
  93 extern size_t nfscmd_countents(char *, size_t);
  94 extern size_t nfscmd_dropped_entrysize(struct dirent64 *, size_t, size_t);
  95 
  96 extern void nfscmd_init(void);
  97 extern void nfscmd_fini(void);
  98 
  99 #endif
 100 
 101 #ifdef  __cplusplus
 102 }
 103 #endif
 104 
 105 #endif  /* _NFS_CMD_H */
 |