diff options
Diffstat (limited to 'usr/src/cmd/fs.d/nfs')
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/etc/nfs.dfl | 92 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/nfslog_config.c | 19 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/smfcfg.c | 393 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/smfcfg.h | 109 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/mount/Makefile | 8 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/mount/mount.c | 136 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/Makefile | 11 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/mountd.c | 56 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/nfsd/Makefile | 16 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/nfsd/nfsd.c | 144 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_server.c | 5 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/svc/client.xml | 52 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/svc/mapid.xml | 56 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/svc/nfs-server | 5 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml | 18 | ||||
| -rw-r--r-- | usr/src/cmd/fs.d/nfs/svc/server.xml | 19 |
16 files changed, 804 insertions, 335 deletions
diff --git a/usr/src/cmd/fs.d/nfs/etc/nfs.dfl b/usr/src/cmd/fs.d/nfs/etc/nfs.dfl index 790ac32da1..13bdb75d68 100644 --- a/usr/src/cmd/fs.d/nfs/etc/nfs.dfl +++ b/usr/src/cmd/fs.d/nfs/etc/nfs.dfl @@ -1,14 +1,9 @@ -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. # # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -23,81 +18,10 @@ # # CDDL HEADER END # +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# -# Sets the maximum number of concurrent connection oriented connections. -# Default is unlimited and is obtained by not setting NFSD_MAX_CONNECTIONS. -# Equivalent to -c. -#NFSD_MAX_CONNECTIONS= - -# Set connection queue length for the NFS over a connection-oriented -# transport. The default value is 32 entries. -# Equivalent to -l. -NFSD_LISTEN_BACKLOG=32 - -# Start NFS daemon over the specified protocol only. -# Equivalent to -p, ALL is equivalent to -a on the nfsd command line. -# Mutually exclusive with NFSD_DEVICE. -NFSD_PROTOCOL=ALL - -# Start NFS daemon for the transport specified by the given device only. -# Equivalent to -t. -# Mutually exclusive with setting NFSD_PROTOCOL. -#NFSD_DEVICE= - -# Maximum number of concurrent NFS requests. -# Equivalent to last numeric argument on nfsd command line. -NFSD_SERVERS=16 - -# Set connection queue length for lockd over a connection-oriented transport. -# Default and minimum value is 32. -LOCKD_LISTEN_BACKLOG=32 - -# Maximum number of concurrent lockd requests. -# Default is 20. -LOCKD_SERVERS=20 - -# Retransmit Timeout before lockd tries again. -# Default is 5. -LOCKD_RETRANSMIT_TIMEOUT=5 - -# Grace period in seconds that all clients (both NLM & NFSv4) have to -# reclaim locks after a server reboot. Also controls the NFSv4 lease -# interval. -# Overrides the deprecated setting LOCKD_GRACE_PERIOD. -# Default is 90 seconds. -GRACE_PERIOD=90 - -# Deprecated. -# As for GRACE_PERIOD, above. -# Default is 90 seconds. -#LOCKD_GRACE_PERIOD=90 - -# Sets the minimum version of the NFS protocol that will be registered -# and offered by the server. The default is 2. -#NFS_SERVER_VERSMIN=2 - -# Sets the maximum version of the NFS protocol that will be registered -# and offered by the server. The default is 4. -#NFS_SERVER_VERSMAX=4 - -# Sets the minimum version of the NFS protocol that will be used by -# the NFS client. Can be overridden by the "vers=" NFS mount option. -# The default is 2. -#NFS_CLIENT_VERSMIN=2 - -# Sets the maximum version of the NFS protocol that will be used by -# the NFS client. Can be overridden by the "vers=" NFS mount option. -# If "vers=" is not specified for an NFS mount, this is the version -# that will be attempted first. The default is 4. -#NFS_CLIENT_VERSMAX=4 - -# Determines if the NFS version 4 delegation feature will be enabled -# for the server. If it is enabled, the server will attempt to -# provide delegations to the NFS version 4 client. The default is on. -#NFS_SERVER_DELEGATION=on - -# Specifies to nfsmapid daemon that it is to override its default -# behavior of using the DNS domain, and that it is to use 'domain' as -# the domain to append to outbound attribute strings, and that it is to -# use 'domain' to compare against inbound attribute strings. -#NFSMAPID_DOMAIN=domain +# +# Moved to SMF. Use sharectl(1M) to manage NFS properties. +# diff --git a/usr/src/cmd/fs.d/nfs/lib/nfslog_config.c b/usr/src/cmd/fs.d/nfs/lib/nfslog_config.c index 5b89c0b581..aff081912b 100644 --- a/usr/src/cmd/fs.d/nfs/lib/nfslog_config.c +++ b/usr/src/cmd/fs.d/nfs/lib/nfslog_config.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,11 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <ctype.h> #include <errno.h> #include <locale.h> @@ -90,7 +87,7 @@ static void complete_with_global(char **, char **, char **, char **, static void remove_config(nfsl_config_t **, nfsl_config_t *, nfsl_config_t **); void nfsl_printconfig(nfsl_config_t *); #endif /* DEBUG */ -static char *getline(FILE *, char *, char *, int); +static char *gataline(FILE *, char *, char *, int); static int get_info(char *, char **, char **, char **, char **, char **, char **, int *); static void free_config(nfsl_config_t *); @@ -286,7 +283,7 @@ getconfiglist(nfsl_config_t **listpp, boolean_t updating) assert (*listpp != NULL); tail = getlastconfig(*listpp); - while (getline(fp, NFSL_CONFIG_FILE_PATH, linebuf, sizeof (linebuf))) { + while (gataline(fp, NFSL_CONFIG_FILE_PATH, linebuf, sizeof (linebuf))) { if (linebuf[0] == '\0') { /* * ignore lines that exceed max size @@ -939,13 +936,13 @@ is_legal_tag(char *tag) } /* - * getline attempts to get a line from the configuration file, + * gataline attempts to get a line from the configuration file, * upto LINESZ. A line in the file is a concatenation of lines if the * continuation symbol '\' is used at the end of the line. Returns * line on success, a NULL on EOF, and an empty string on lines > linesz. */ static char * -getline(FILE *fp, char *path, char *line, int linesz) { +gataline(FILE *fp, char *path, char *line, int linesz) { register char *p = line; register int len; int excess = 0; diff --git a/usr/src/cmd/fs.d/nfs/lib/smfcfg.c b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c new file mode 100644 index 0000000000..78b34389a5 --- /dev/null +++ b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c @@ -0,0 +1,393 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ +#include <stdio.h> +#include <stdlib.h> +#include <syslog.h> +#include <stdarg.h> +#include "smfcfg.h" + +fs_smfhandle_t * +fs_smf_init(char *fmri, char *instance) +{ + fs_smfhandle_t *handle = NULL; + char *svcname, srv[MAXPATHLEN]; + + /* + * svc name is of the form svc://network/fs/server:instance1 + * FMRI portion is /network/fs/server + */ + snprintf(srv, MAXPATHLEN, "%s", fmri + strlen("svc:/")); + svcname = strrchr(srv, ':'); + if (svcname != NULL) + *svcname = '\0'; + svcname = srv; + + handle = calloc(1, sizeof (fs_smfhandle_t)); + if (handle != NULL) { + handle->fs_handle = scf_handle_create(SCF_VERSION); + if (handle->fs_handle == NULL) + goto out; + if (scf_handle_bind(handle->fs_handle) != 0) + goto out; + handle->fs_service = + scf_service_create(handle->fs_handle); + handle->fs_scope = + scf_scope_create(handle->fs_handle); + if (scf_handle_get_local_scope(handle->fs_handle, + handle->fs_scope) != 0) + goto out; + if (scf_scope_get_service(handle->fs_scope, + svcname, handle->fs_service) != SCF_SUCCESS) { + goto out; + } + handle->fs_pg = + scf_pg_create(handle->fs_handle); + handle->fs_instance = + scf_instance_create(handle->fs_handle); + handle->fs_property = + scf_property_create(handle->fs_handle); + handle->fs_value = + scf_value_create(handle->fs_handle); + } else { + fprintf(stderr, + gettext("Cannot access SMF repository: %s\n"), fmri); + } + return (handle); + +out: + fs_smf_fini(handle); + fprintf(stderr, gettext("SMF Initialization problems..%s\n"), fmri); + return (NULL); +} + + +void +fs_smf_fini(fs_smfhandle_t *handle) +{ + if (handle != NULL) { + scf_scope_destroy(handle->fs_scope); + scf_instance_destroy(handle->fs_instance); + scf_service_destroy(handle->fs_service); + scf_pg_destroy(handle->fs_pg); + scf_property_destroy(handle->fs_property); + scf_value_destroy(handle->fs_value); + if (handle->fs_handle != NULL) { + scf_handle_unbind(handle->fs_handle); + scf_handle_destroy(handle->fs_handle); + } + free(handle); + } +} + +int +fs_smf_set_prop(smf_fstype_t fstype, char *prop_name, char *valbuf, + char *instance, scf_type_t sctype, char *fmri) +{ + fs_smfhandle_t *phandle; + scf_handle_t *handle; + scf_propertygroup_t *pg; + scf_property_t *prop; + scf_transaction_t *tran; + scf_transaction_entry_t *entry; + scf_instance_t *inst; + scf_value_t *val; + int valint; + int index = 0; + int ret = 0; + char *p = NULL; + char *svcname, srv[MAXPATHLEN]; + const char *pgname; + + /* + * The SVC names we are using currently are already + * appended by default. Fix this for instances project. + */ + snprintf(srv, MAXPATHLEN, "%s", fmri); + p = strstr(fmri, ":default"); + if (p == NULL) { + strcat(srv, ":"); + if (instance == NULL) + instance = "default"; + if (strlen(srv) + strlen(instance) > MAXPATHLEN) + goto out; + strncat(srv, instance, strlen(instance)); + } + svcname = srv; + phandle = fs_smf_init(fmri, instance); + if (phandle == NULL) { + return (SMF_SYSTEM_ERR); + } + handle = phandle->fs_handle; + pg = phandle->fs_pg; + prop = phandle->fs_property; + inst = phandle->fs_instance; + val = phandle->fs_value; + tran = scf_transaction_create(handle); + entry = scf_entry_create(handle); + + if (handle == NULL || pg == NULL || prop == NULL || + val == NULL|| tran == NULL || entry == NULL || inst == NULL) { + ret = SMF_SYSTEM_ERR; + goto out; + } + + if (scf_handle_decode_fmri(handle, svcname, phandle->fs_scope, + phandle->fs_service, inst, NULL, NULL, 0) != 0) { + ret = scf_error(); + goto out; + } + if (fstype == AUTOFS_SMF) + pgname = AUTOFS_PROPS_PGNAME; + else + pgname = NFS_PROPS_PGNAME; + + if (scf_instance_get_pg(inst, pgname, + pg) != -1) { + uint8_t vint; + if (scf_transaction_start(tran, pg) == -1) { + ret = scf_error(); + goto out; + } + switch (sctype) { + case SCF_TYPE_INTEGER: + errno = 0; + valint = strtoul(valbuf, NULL, 0); + if (errno != 0) { + ret = SMF_SYSTEM_ERR; + goto out; + } + if (scf_transaction_property_change(tran, + entry, prop_name, SCF_TYPE_INTEGER) == 0) { + scf_value_set_integer(val, valint); + if (scf_entry_add_value(entry, val) < 0) { + ret = scf_error(); + goto out; + } + } + break; + case SCF_TYPE_ASTRING: + if (scf_transaction_property_change(tran, entry, + prop_name, SCF_TYPE_ASTRING) == 0) { + if (scf_value_set_astring(val, + valbuf) == 0) { + if (scf_entry_add_value(entry, + val) != 0) { + ret = scf_error(); + goto out; + } + } else + ret = SMF_SYSTEM_ERR; + } else + ret = SMF_SYSTEM_ERR; + break; + case SCF_TYPE_BOOLEAN: + if (strcmp(valbuf, "1") == 0) { + vint = 1; + } else if (strcmp(valbuf, "0") == 0) { + vint = 0; + } else { + ret = SMF_SYSTEM_ERR; + break; + } + if (scf_transaction_property_change(tran, entry, + prop_name, SCF_TYPE_BOOLEAN) == 0) { + scf_value_set_boolean(val, (uint8_t)vint); + if (scf_entry_add_value(entry, val) != 0) { + ret = scf_error(); + goto out; + } + } else { + ret = SMF_SYSTEM_ERR; + } + break; + } + if (ret != SMF_SYSTEM_ERR) + scf_transaction_commit(tran); + } +out: + if (tran != NULL) + scf_transaction_destroy(tran); + if (entry != NULL) + scf_entry_destroy(entry); + fs_smf_fini(phandle); + return (ret); +} + +int +fs_smf_get_prop(smf_fstype_t fstype, char *prop_name, char *cbuf, + char *instance, scf_type_t sctype, char *fmri, int *bufsz) +{ + fs_smfhandle_t *phandle; + scf_handle_t *handle; + scf_propertygroup_t *pg; + scf_property_t *prop; + scf_value_t *val; + scf_instance_t *inst; + int ret = 0, len = 0, length; + int64_t valint = 0; + char srv[MAXPATHLEN], *p, *svcname; + const char *pgname; + uint8_t bval; + + /* + * The SVC names we are using currently are already + * appended by default. Fix this for instances project. + */ + snprintf(srv, MAXPATHLEN, "%s", fmri); + p = strstr(fmri, ":default"); + if (p == NULL) { + strcat(srv, ":"); + if (instance == NULL) + instance = "default"; + if (strlen(srv) + strlen(instance) > MAXPATHLEN) + goto out; + strncat(srv, instance, strlen(instance)); + } + svcname = srv; + phandle = fs_smf_init(fmri, instance); + if (phandle == NULL) + return (SMF_SYSTEM_ERR); + handle = phandle->fs_handle; + pg = phandle->fs_pg; + inst = phandle->fs_instance; + prop = phandle->fs_property; + val = phandle->fs_value; + + if (handle == NULL || pg == NULL || prop == NULL || val == NULL || + inst == NULL) { + return (SMF_SYSTEM_ERR); + } + + + if (scf_handle_decode_fmri(handle, svcname, phandle->fs_scope, + phandle->fs_service, inst, NULL, NULL, 0) != 0) { + ret = scf_error(); + goto out; + } + + if (fstype == AUTOFS_SMF) + pgname = AUTOFS_PROPS_PGNAME; + else + pgname = NFS_PROPS_PGNAME; + + if (scf_instance_get_pg(inst, pgname, pg) != -1) { + if (scf_pg_get_property(pg, prop_name, + prop) != SCF_SUCCESS) { + ret = scf_error(); + goto out; + } + if (scf_property_get_value(prop, val) != SCF_SUCCESS) { + ret = scf_error(); + goto out; + } + switch (sctype) { + case SCF_TYPE_ASTRING: + len = scf_value_get_astring(val, cbuf, *bufsz); + if (len < 0 || len > *bufsz) { + ret = scf_error(); + goto out; + } + ret = 0; + *bufsz = len; + break; + case SCF_TYPE_INTEGER: + if (scf_value_get_integer(val, &valint) != 0) { + ret = scf_error(); + goto out; + } + length = snprintf(cbuf, *bufsz, "%lld", valint); + if (length < 0 || length > *bufsz) { + ret = SA_BAD_VALUE; + goto out; + } + ret = 0; + break; + case SCF_TYPE_BOOLEAN: + if (scf_value_get_boolean(val, &bval) != 0) { + ret = scf_error(); + goto out; + } + if (bval == 1) { + length = snprintf(cbuf, *bufsz, "%s", "true"); + } else { + length = snprintf(cbuf, *bufsz, "%s", "false"); + } + if (length < 0 || length > *bufsz) { + ret = SA_BAD_VALUE; + goto out; + } + break; + } + } else { + ret = scf_error(); + } + if ((ret != 0) && scf_error() != SCF_ERROR_NONE) + fprintf(stdout, gettext("%s\n"), scf_strerror(ret)); +out: + fs_smf_fini(phandle); + return (ret); +} + + +int +nfs_smf_get_prop(char *prop_name, char *propbuf, char *instance, + scf_type_t sctype, char *svc_name, int *bufsz) +{ + return (fs_smf_get_prop(NFS_SMF, prop_name, propbuf, + instance, sctype, svc_name, bufsz)); +} + +int +nfs_smf_set_prop(char *prop_name, char *value, char *instance, + scf_type_t type, char *svc_name) +{ + return (fs_smf_set_prop(NFS_SMF, prop_name, value, instance, + type, svc_name)); +} + +int +autofs_smf_set_prop(char *prop_name, char *value, char *instance, + scf_type_t type, char *svc_name) +{ + return (fs_smf_set_prop(AUTOFS_SMF, prop_name, value, instance, + type, svc_name)); +} + +int +autofs_smf_get_prop(char *prop_name, char *propbuf, char *instance, + scf_type_t sctype, char *svc_name, int *bufsz) +{ + return (fs_smf_get_prop(AUTOFS_SMF, prop_name, propbuf, + instance, sctype, svc_name, bufsz)); +} + +boolean_t +string_to_boolean(const char *str) +{ + if (strcasecmp(str, "true") == 0 || atoi(str) == 1 || + strcasecmp(str, "on") == 0 || strcasecmp(str, "yes") == 0) { + return (B_TRUE); + } else + return (B_FALSE); +} diff --git a/usr/src/cmd/fs.d/nfs/lib/smfcfg.h b/usr/src/cmd/fs.d/nfs/lib/smfcfg.h new file mode 100644 index 0000000000..46855ab8ed --- /dev/null +++ b/usr/src/cmd/fs.d/nfs/lib/smfcfg.h @@ -0,0 +1,109 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#ifndef _SMFCFG_H +#define _SMFCFG_H + +#include <stdio.h> +#include <stdlib.h> +#include <syslog.h> +#include <stdarg.h> +#include <rpc/rpc.h> +#include <synch.h> +#include <thread.h> +#include <libintl.h> +#include <strings.h> +#include <inttypes.h> +#include <limits.h> +#include <assert.h> +#include <libscf.h> +#include <libshare.h> +#include <locale.h> +#include <errno.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NFS_SMF = 1, + AUTOFS_SMF +} smf_fstype_t; + +typedef struct fs_smfhandle { + scf_handle_t *fs_handle; + scf_service_t *fs_service; + scf_scope_t *fs_scope; + scf_instance_t *fs_instance; + scf_propertygroup_t *fs_pg; + scf_property_t *fs_property; + scf_value_t *fs_value; +} fs_smfhandle_t; + +#define DEFAULT_INSTANCE "default" + +/* + * NFS Property Group names. + */ +#define SMF_PG_NFSPROPS ((const char *)"com.oracle.nfs,props") +#define NFS_PROPS_PGNAME ((const char *)"nfs-props") +#define SVC_NFS_CLIENT "svc:/network/nfs/client" + +/* + * AUTOFS Property Group Names. + */ +#define SMF_PG_AUTOFS ((const char *)"com.oracle.autofs,props") +#define AUTOFS_PROPS_PGNAME ((const char *)"autofs-props") + +#define AUTOFS_FMRI "svc:/system/filesystem/autofs" +#define AUTOFS_DEFAULT_FMRI "svc:/system/filesystem/autofs:default" +#define MAXDIGITS 32 + +/* + * ERRORS + */ +#define SMF_OK 0 +#define SMF_SYSTEM_ERR -1 +#define STATE_INITIALIZING 1 +#define SMF_NO_PERMISSION 2 +#define SMF_NO_PGTYPE 3 + +extern int nfs_smf_get_prop(char *, char *, char *, scf_type_t, char *, int *); +extern int fs_smf_get_prop(smf_fstype_t, char *, char *, char *, scf_type_t, + char *, int *); +extern int nfs_smf_set_prop(char *, char *, char *, scf_type_t, char *); +extern int fs_smf_set_prop(smf_fstype_t, char *, char *, + char *, scf_type_t, char *); +extern int autofs_smf_set_prop(char *, char *, char *, scf_type_t, char *); +extern int autofs_smf_get_prop(char *, char *, char *, scf_type_t, + char *, int *); +extern void fs_smf_fini(fs_smfhandle_t *); +extern boolean_t string_to_boolean(const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SMFCFG_H */ diff --git a/usr/src/cmd/fs.d/nfs/mount/Makefile b/usr/src/cmd/fs.d/nfs/mount/Makefile index 6de22ec2e6..4c6fb4686a 100644 --- a/usr/src/cmd/fs.d/nfs/mount/Makefile +++ b/usr/src/cmd/fs.d/nfs/mount/Makefile @@ -34,10 +34,11 @@ $(ROOTLIBFSTYPE)/%: $(ROOTLIBFSTYPE) % include ../../Makefile.fstype -COMMON= $(FSLIB) nfs_sec.o replica.o nfs_subr.o selfcheck.o +COMMON= $(FSLIB) nfs_sec.o replica.o nfs_subr.o selfcheck.o smfcfg.o OBJS= $(LIBPROG).o $(COMMON) webnfs_client.o webnfs_xdr.o SRCS= $(LIBPROG).c $(FSLIBSRC) ../lib/nfs_sec.c ../lib/replica.c \ - ../lib/nfs_subr.c webnfs_xdr.c webnfs_client.c ../lib/selfcheck.c + ../lib/nfs_subr.c webnfs_xdr.c webnfs_client.c ../lib/selfcheck.c \ + ../lib/smfcfg.c UNCHECKED_HDRS= webnfs.h @@ -78,6 +79,9 @@ selfcheck.o: ../lib/selfcheck.c nfs_tbind.o: ../lib/nfs_tbind.c $(COMPILE.c) ../lib/nfs_tbind.c +smfcfg.o: ../lib/smfcfg.c + $(COMPILE.c) ../lib/smfcfg.c + webnfs_xdr.c: webnfs.x $(RPCGEN) -M -C -c -o $@ webnfs.x diff --git a/usr/src/cmd/fs.d/nfs/mount/mount.c b/usr/src/cmd/fs.d/nfs/mount/mount.c index 7d47f4709e..e664fca769 100644 --- a/usr/src/cmd/fs.d/nfs/mount/mount.c +++ b/usr/src/cmd/fs.d/nfs/mount/mount.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -80,6 +79,10 @@ #include "nfs_subr.h" #include "webnfs.h" #include <rpcsvc/nfs4_prot.h> +#include <limits.h> +#include <libscf.h> +#include <libshare.h> +#include "smfcfg.h" #include <nfs/nfssys.h> extern int _nfssys(enum nfssys_op, void *); @@ -214,7 +217,7 @@ static rpcvers_t nfsretry_vers = 0; * There are the defaults (range) for the client when determining * which NFS version to use when probing the server (see above). * These will only be used when the vers mount option is not used and - * these may be reset if /etc/default/nfs is configured to do so. + * these may be reset if NFS SMF is configured to do so. */ static rpcvers_t vers_max_default = NFS_VERSMAX_DEFAULT; static rpcvers_t vers_min_default = NFS_VERSMIN_DEFAULT; @@ -317,7 +320,7 @@ main(int argc, char *argv[]) (void) setpflags(NET_MAC_AWARE, 1); /* - * Read the defaults file to see if the min/max versions have + * Read the NFS SMF defaults to see if the min/max versions have * been set and therefore would override the encoded defaults. * Then check to make sure that if they were set that the * values are reasonable. @@ -326,10 +329,9 @@ main(int argc, char *argv[]) if (vers_min_default > vers_max_default || vers_min_default < NFS_VERSMIN || vers_max_default > NFS_VERSMAX) { - pr_err("%s %s\n%s %s\n", + pr_err("%s\n%s %s\n", gettext("Incorrect configuration of client\'s"), - NFSADMIN, - gettext("NFS_CLIENT_VERSMIN or NFS_CLIENT_VERSMAX"), + gettext("client_versmin or client_versmax"), gettext("is either out of range or overlaps.")); } @@ -949,12 +951,27 @@ static char *optlist[] = { NULL }; -#define bad(val) (val == NULL || !isdigit(*val)) +static int +convert_int(int *val, char *str) +{ + long lval; + + if (str == NULL || !isdigit(*str)) + return (-1); + + lval = strtol(str, &str, 10); + if (*str != '\0' || lval > INT_MAX) + return (-2); + + *val = (int)lval; + return (0); +} static int set_args(int *mntflags, struct nfs_args *args, char *fshost, struct mnttab *mnt) { char *saveopt, *optstr, *opts, *newopts, *val; + int num; int largefiles = 0; int invalid = 0; int attrpref = 0; @@ -1030,9 +1047,9 @@ set_args(int *mntflags, struct nfs_args *args, char *fshost, struct mnttab *mnt) args->flags |= NFSMNT_NOAC; break; case OPT_PORT: - if (bad(val)) + if (convert_int(&num, val) != 0) goto badopt; - nfs_port = htons((ushort_t)atoi(val)); + nfs_port = htons((ushort_t)num); break; case OPT_SECURE: @@ -1049,62 +1066,54 @@ set_args(int *mntflags, struct nfs_args *args, char *fshost, struct mnttab *mnt) break; case OPT_RSIZE: - args->flags |= NFSMNT_RSIZE; - if (bad(val)) + if (convert_int(&args->rsize, val) != 0) goto badopt; - args->rsize = atoi(val); + args->flags |= NFSMNT_RSIZE; break; case OPT_WSIZE: - args->flags |= NFSMNT_WSIZE; - if (bad(val)) + if (convert_int(&args->wsize, val) != 0) goto badopt; - args->wsize = atoi(val); + args->flags |= NFSMNT_WSIZE; break; case OPT_TIMEO: - args->flags |= NFSMNT_TIMEO; - if (bad(val)) + if (convert_int(&args->timeo, val) != 0) goto badopt; - args->timeo = atoi(val); + args->flags |= NFSMNT_TIMEO; break; case OPT_RETRANS: - args->flags |= NFSMNT_RETRANS; - if (bad(val)) + if (convert_int(&args->retrans, val) != 0) goto badopt; - args->retrans = atoi(val); + args->flags |= NFSMNT_RETRANS; break; case OPT_ACTIMEO: + if (convert_int(&args->acregmax, val) != 0) + goto badopt; + args->acdirmin = args->acregmin = args->acdirmax + = args->acregmax; args->flags |= NFSMNT_ACDIRMAX; args->flags |= NFSMNT_ACREGMAX; args->flags |= NFSMNT_ACDIRMIN; args->flags |= NFSMNT_ACREGMIN; - if (bad(val)) - goto badopt; - args->acdirmin = args->acregmin = args->acdirmax - = args->acregmax = atoi(val); break; case OPT_ACREGMIN: - args->flags |= NFSMNT_ACREGMIN; - if (bad(val)) + if (convert_int(&args->acregmin, val) != 0) goto badopt; - args->acregmin = atoi(val); + args->flags |= NFSMNT_ACREGMIN; break; case OPT_ACREGMAX: - args->flags |= NFSMNT_ACREGMAX; - if (bad(val)) + if (convert_int(&args->acregmax, val) != 0) goto badopt; - args->acregmax = atoi(val); + args->flags |= NFSMNT_ACREGMAX; break; case OPT_ACDIRMIN: - args->flags |= NFSMNT_ACDIRMIN; - if (bad(val)) + if (convert_int(&args->acdirmin, val) != 0) goto badopt; - args->acdirmin = atoi(val); + args->flags |= NFSMNT_ACDIRMIN; break; case OPT_ACDIRMAX: - args->flags |= NFSMNT_ACDIRMAX; - if (bad(val)) + if (convert_int(&args->acdirmax, val) != 0) goto badopt; - args->acdirmax = atoi(val); + args->flags |= NFSMNT_ACDIRMAX; break; case OPT_BG: bg++; @@ -1113,9 +1122,8 @@ set_args(int *mntflags, struct nfs_args *args, char *fshost, struct mnttab *mnt) bg = 0; break; case OPT_RETRY: - if (bad(val)) + if (convert_int(&retries, val) != 0) goto badopt; - retries = atoi(val); break; case OPT_LLOCK: args->flags |= NFSMNT_LLOCK; @@ -1124,9 +1132,9 @@ set_args(int *mntflags, struct nfs_args *args, char *fshost, struct mnttab *mnt) posix = 1; break; case OPT_VERS: - if (bad(val)) + if (convert_int(&num, val) != 0) goto badopt; - nfsvers = (rpcvers_t)atoi(val); + nfsvers = (rpcvers_t)num; break; case OPT_PROTO: if (val == NULL) @@ -2602,35 +2610,39 @@ retry(struct mnttab *mntp, int ro) } /* - * Read the /etc/default/nfs configuration file to determine if the + * Read the NFS SMF Parameters to determine if the * client has been configured for a new min/max for the NFS version to * use. */ static void read_default(void) { - char *defval; + char value[4]; int errno; - int tmp; - - /* Fail silently if error in opening the default nfs config file */ - if ((defopen(NFSADMIN)) == 0) { - if ((defval = defread("NFS_CLIENT_VERSMIN=")) != NULL) { - errno = 0; - tmp = strtol(defval, (char **)NULL, 10); - if (errno == 0) { - vers_min_default = tmp; - } + int tmp = 0, bufsz = 0, ret = 0; + + /* Maximum number of bytes expected. */ + bufsz = 4; + ret = nfs_smf_get_prop("client_versmin", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, SVC_NFS_CLIENT, &bufsz); + if (ret == SA_OK) { + errno = 0; + tmp = strtol(value, (char **)NULL, 10); + if (errno == 0) { + vers_min_default = tmp; } - if ((defval = defread("NFS_CLIENT_VERSMAX=")) != NULL) { - errno = 0; - tmp = strtol(defval, (char **)NULL, 10); - if (errno == 0) { - vers_max_default = tmp; - } + } + + /* Maximum number of bytes expected. */ + bufsz = 4; + ret = nfs_smf_get_prop("client_versmax", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, SVC_NFS_CLIENT, &bufsz); + if (ret == SA_OK) { + errno = 0; + tmp = strtol(value, (char **)NULL, 10); + if (errno == 0) { + vers_max_default = tmp; } - /* close defaults file */ - defopen(NULL); } } diff --git a/usr/src/cmd/fs.d/nfs/mountd/Makefile b/usr/src/cmd/fs.d/nfs/mountd/Makefile index 90ec5ba6d6..b4271cc5f3 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/Makefile +++ b/usr/src/cmd/fs.d/nfs/mountd/Makefile @@ -28,16 +28,16 @@ ATTMK = $(TYPEPROG) include ../../Makefile.fstype -COMMON = $(FSLIB) nfs_sec.o sharetab.o daemon.o +COMMON = $(FSLIB) nfs_sec.o sharetab.o daemon.o smfcfg.o LOCAL = mountd.o netgroup.o rmtab.o nfsauth.o \ nfsauth_xdr.o exportlist.o hashset.o nfs_cmd.o OBJS = $(LOCAL) $(COMMON) SRCS = $(LOCAL:%.o=%.c) $(FSLIBSRC) ../lib/nfs_sec.c \ - ../lib/sharetab.c ../lib/daemon.c + ../lib/sharetab.c ../lib/daemon.c ../lib/smfcfg.c DSRC = mountd_dt.d DOBJ = $(DSRC:%.d=%.o) -LDLIBS += -lrpcsvc -lnsl -lbsm -lsocket -ltsnet -ltsol -lnvpair -CPPFLAGS += -D_REENTRANT +LDLIBS += -lrpcsvc -lnsl -lbsm -lsocket -ltsnet -ltsol -lnvpair -lscf +CPPFLAGS += -D_REENTRANT -I../lib $(TYPEPROG): $(OBJS) $(COMPILE.d) -s $(DSRC) -o $(DOBJ) $(OBJS) @@ -53,6 +53,9 @@ sharetab.o: ../lib/sharetab.c daemon.o: ../lib/daemon.c $(COMPILE.c) ../lib/daemon.c +smfcfg.o: ../lib/smfcfg.c + $(COMPILE.c) ../lib/smfcfg.c + lint: $(LINT.c) $(SRCS) $(LDLIBS) diff --git a/usr/src/cmd/fs.d/nfs/mountd/mountd.c b/usr/src/cmd/fs.d/nfs/mountd/mountd.c index a82a06c93c..8c8f9b5875 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/mountd.c +++ b/usr/src/cmd/fs.d/nfs/mountd/mountd.c @@ -76,8 +76,11 @@ #include <sys/tsol/label_macro.h> #include <libtsnet.h> #include <sys/sdt.h> +#include <libscf.h> +#include <limits.h> #include <sys/nvpair.h> #include <attr.h> +#include "smfcfg.h" extern int daemonize_init(void); extern void daemonize_fini(int fd); @@ -361,6 +364,8 @@ main(int argc, char *argv[]) bool_t exclbind = TRUE; bool_t can_do_mlp; long thr_flags = (THR_NEW_LWP|THR_DAEMON); + char defval[4]; + int defvers, ret, bufsz; int pipe_fd = -1; @@ -412,33 +417,32 @@ main(int argc, char *argv[]) /* * Read in the NFS version values from config file. */ - if ((defopen(NFSADMIN)) == 0) { - char *defval; - int defvers; - - if ((defval = defread("NFS_SERVER_VERSMIN=")) != NULL) { - errno = 0; - defvers = strtol(defval, (char **)NULL, 10); - if (errno == 0) { - mount_vers_min = defvers; - /* - * special because NFSv2 is - * supported by mount v1 & v2 - */ - if (defvers == NFS_VERSION) - mount_vers_min = MOUNTVERS; - } - } - if ((defval = defread("NFS_SERVER_VERSMAX=")) != NULL) { - errno = 0; - defvers = strtol(defval, (char **)NULL, 10); - if (errno == 0) { - mount_vers_max = defvers; - } + bufsz = 4; + ret = nfs_smf_get_prop("server_versmin", defval, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) { + errno = 0; + defvers = strtol(defval, (char **)NULL, 10); + if (errno == 0) { + mount_vers_min = defvers; + /* + * special because NFSv2 is + * supported by mount v1 & v2 + */ + if (defvers == NFS_VERSION) + mount_vers_min = MOUNTVERS; } + } - /* close defaults file */ - defopen(NULL); + bufsz = 4; + ret = nfs_smf_get_prop("server_versmax", defval, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) { + errno = 0; + defvers = strtol(defval, (char **)NULL, 10); + if (errno == 0) { + mount_vers_max = defvers; + } } /* @@ -447,7 +451,7 @@ main(int argc, char *argv[]) * to start nfsauth service, so continue on regardless of values. */ if (mount_vers_min > mount_vers_max) { - fprintf(stderr, "NFS_SERVER_VERSMIN > NFS_SERVER_VERSMAX"); + fprintf(stderr, "server_versmin > server_versmax"); mount_vers_max = mount_vers_min; } (void) setlocale(LC_ALL, ""); diff --git a/usr/src/cmd/fs.d/nfs/nfsd/Makefile b/usr/src/cmd/fs.d/nfs/nfsd/Makefile index f383662858..14cc63869b 100644 --- a/usr/src/cmd/fs.d/nfs/nfsd/Makefile +++ b/usr/src/cmd/fs.d/nfs/nfsd/Makefile @@ -19,10 +19,8 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. # -# ident "%Z%%M% %I% %E% SMI" # FSTYPE= nfs @@ -31,13 +29,16 @@ ATTMK= $(TYPEPROG) include ../../Makefile.fstype -LDLIBS += -lnsl -lnvpair +LDLIBS += -lnsl -lnvpair -lscf LOCAL= nfsd.o -OBJS= $(LOCAL) nfs_tbind.o thrpool.o daemon.o -SRCS= $(LOCAL:%.o=%.c) ../lib/nfs_tbind.c ../lib/thrpool.c ../lib/daemon.c +OBJS= $(LOCAL) nfs_tbind.o thrpool.o daemon.o smfcfg.o +SRCS= $(LOCAL:%.o=%.c) ../lib/nfs_tbind.c ../lib/thrpool.c ../lib/daemon.c \ + ../lib/smfcfg.c + CPPFLAGS += -I../lib + $(TYPEPROG): $(OBJS) $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) $(POST_PROCESS) @@ -51,6 +52,9 @@ thrpool.o: ../lib/thrpool.c daemon.o: ../lib/daemon.c $(COMPILE.c) ../lib/daemon.c +smfcfg.o: ../lib/smfcfg.c + $(COMPILE.c) ../lib/smfcfg.c + clean: $(RM) $(OBJS) diff --git a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c index 56b0eaf70a..6c0e0bda5e 100644 --- a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c +++ b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c @@ -62,6 +62,7 @@ #include <netdir.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include <stropts.h> #include <sys/tihdr.h> #include <sys/wait.h> @@ -73,8 +74,11 @@ #include <rpcsvc/daemon_utils.h> #include <rpcsvc/nfs4_prot.h> #include <libnvpair.h> +#include <libscf.h> +#include <libshare.h> #include "nfs_tbind.h" #include "thrpool.h" +#include "smfcfg.h" /* quiesce requests will be ignored if nfs_server_vers_max < QUIESCE_VERSMIN */ #define QUIESCE_VERSMIN 4 @@ -150,6 +154,8 @@ main(int ac, char *av[]) uint_t dss_npaths = 0; char **dss_pathnames = NULL; sigset_t sgset; + char name[PATH_MAX], value[PATH_MAX]; + int ret, bufsz; int pipe_fd = -1; @@ -173,82 +179,92 @@ main(int ac, char *av[]) (void) enable_extended_FILE_stdio(-1, -1); /* - * Read in the values from config file first before we check - * command line options so the options override the file. + * Read in the values from SMF first before we check + * command line options so the options override SMF values. */ - if ((defopen(NFSADMIN)) == 0) { - if ((defval = defread("NFSD_MAX_CONNECTIONS=")) != NULL) { - errno = 0; - max_conns_allowed = strtol(defval, (char **)NULL, 10); - if (errno != 0) { - max_conns_allowed = -1; - } - } - if ((defval = defread("NFSD_LISTEN_BACKLOG=")) != NULL) { - errno = 0; - listen_backlog = strtol(defval, (char **)NULL, 10); - if (errno != 0) { - listen_backlog = 32; - } - } - if ((defval = defread("NFSD_PROTOCOL=")) != NULL) { - df_proto = strdup(defval); - opt_cnt++; - if (strncasecmp("ALL", defval, 3) == 0) { - free(df_proto); - df_proto = NULL; - df_allflag = 1; - } - } - if ((defval = defread("NFSD_DEVICE=")) != NULL) { - df_provider = strdup(defval); - opt_cnt++; - } - if ((defval = defread("NFSD_SERVERS=")) != NULL) { - errno = 0; - maxservers = strtol(defval, (char **)NULL, 10); - if (errno != 0) { - maxservers = 1; - } else { - maxservers_set = 1; - } - } - if ((defval = defread("NFS_SERVER_VERSMIN=")) != NULL) { - errno = 0; - nfs_server_vers_min = - strtol(defval, (char **)NULL, 10); - if (errno != 0) { - nfs_server_vers_min = NFS_VERSMIN_DEFAULT; - } - } - if ((defval = defread("NFS_SERVER_VERSMAX=")) != NULL) { - errno = 0; - nfs_server_vers_max = - strtol(defval, (char **)NULL, 10); - if (errno != 0) { - nfs_server_vers_max = NFS_VERSMAX_DEFAULT; - } + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("max_connections", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) { + errno = 0; + max_conns_allowed = strtol(value, (char **)NULL, 10); + if (errno != 0) + max_conns_allowed = -1; + } + + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("listen_backlog", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) { + errno = 0; + listen_backlog = strtol(value, (char **)NULL, 10); + if (errno != 0) { + listen_backlog = 32; } - if ((defval = defread("NFS_SERVER_DELEGATION=")) != NULL) { - if (strcmp(defval, "off") == 0) { - nfs_server_delegation = FALSE; - } + } + + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("protocol", value, DEFAULT_INSTANCE, + SCF_TYPE_ASTRING, NFSD, &bufsz); + if ((ret == SA_OK) && strlen(value) > 0) { + df_proto = strdup(value); + opt_cnt++; + if (strncasecmp("ALL", value, 3) == 0) { + free(df_proto); + df_proto = NULL; + df_allflag = 1; } + } - /* close defaults file */ - defopen(NULL); + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("device", value, DEFAULT_INSTANCE, + SCF_TYPE_ASTRING, NFSD, &bufsz); + if ((ret == SA_OK) && strlen(value) > 0) { + df_provider = strdup(value); + opt_cnt++; } + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("servers", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) { + errno = 0; + maxservers = strtol(value, (char **)NULL, 10); + if (errno != 0) + maxservers = 1; + else + maxservers_set = 1; + } + + bufsz = 4; + ret = nfs_smf_get_prop("server_versmin", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) + nfs_server_vers_min = strtol(value, (char **)NULL, 10); + + bufsz = 4; + ret = nfs_smf_get_prop("server_versmax", value, DEFAULT_INSTANCE, + SCF_TYPE_INTEGER, NFSD, &bufsz); + if (ret == SA_OK) + nfs_server_vers_max = strtol(value, (char **)NULL, 10); + + bufsz = PATH_MAX; + ret = nfs_smf_get_prop("server_delegation", value, DEFAULT_INSTANCE, + SCF_TYPE_ASTRING, NFSD, &bufsz); + if (ret == SA_OK) + if (strncasecmp(value, "off", 3) == 0) + nfs_server_delegation = FALSE; + /* * Conflict options error messages. */ if (opt_cnt > 1) { (void) fprintf(stderr, "\nConflicting options, only one of " "the following options can be specified\n" - "in " NFSADMIN ":\n" - "\tNFSD_PROTOCOL=ALL\n" - "\tNFSD_PROTOCOL=protocol\n" - "\tNFSD_DEVICE=device\n\n"); + "in SMF:\n" + "\tprotocol=ALL\n" + "\tprotocol=protocol\n" + "\tdevice=devicename\n\n"); usage(); } opt_cnt = 0; diff --git a/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_server.c b/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_server.c index a80263cd51..3fde3ce099 100644 --- a/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_server.c +++ b/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_server.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -800,7 +799,7 @@ idmap_kcall(int door_id) /* * Get the current NFS domain. * - * If NFSMAPID_DOMAIN is set in /etc/default/nfs, then it is the NFS domain; + * If nfsmapid_domain is set in NFS SMF, then it is the NFS domain; * otherwise, the DNS domain is used. */ void diff --git a/usr/src/cmd/fs.d/nfs/svc/client.xml b/usr/src/cmd/fs.d/nfs/svc/client.xml index ef9c1a93aa..7ece2fae75 100644 --- a/usr/src/cmd/fs.d/nfs/svc/client.xml +++ b/usr/src/cmd/fs.d/nfs/svc/client.xml @@ -1,35 +1,31 @@ <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- - Copyright 2005 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. + CDDL HEADER START - CDDL HEADER START + The contents of this file are subject to the terms of the + Common Development and Distribution License (the "License"). + You may not use this file except in compliance with the License. - The contents of this file are subject to the terms of the - Common Development and Distribution License, Version 1.0 only - (the "License"). You may not use this file except in compliance - with the License. + You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + or http://www.opensolaris.org/os/licensing. + See the License for the specific language governing permissions + and limitations under the License. - You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - or http://www.opensolaris.org/os/licensing. - See the License for the specific language governing permissions - and limitations under the License. + When distributing Covered Code, include this CDDL HEADER in each + file and include the License file at usr/src/OPENSOLARIS.LICENSE. + If applicable, add the following below this CDDL HEADER, with the + fields enclosed by brackets "[]" replaced with your own identifying + information: Portions Copyright [yyyy] [name of copyright owner] - When distributing Covered Code, include this CDDL HEADER in each - file and include the License file at usr/src/OPENSOLARIS.LICENSE. - If applicable, add the following below this CDDL HEADER, with the - fields enclosed by brackets "[]" replaced with your own identifying - information: Portions Copyright [yyyy] [name of copyright owner] + CDDL HEADER END - CDDL HEADER END + Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - ident "%Z%%M% %I% %E% SMI" - - NOTE: This service manifest is not editable; its contents will - be overwritten by package or patch operations, including - operating system upgrade. Make customizations in a different - file. + NOTE: This service manifest is not editable; its contents will + be overwritten by package or patch operations, including + operating system upgrade. Make customizations in a different + file. --> <service_bundle type='manifest' name='SUNWnfscr:nfs-client'> @@ -39,10 +35,6 @@ type='service' version='1'> - <create_default_instance enabled='false' /> - - <single_instance /> - <dependency name='network' grouping='require_any' restart_on='error' @@ -129,6 +121,12 @@ <propval name='duration' type='astring' value='transient' /> </property_group> + <instance name='default' enabled='false'> + <property_group name='nfs-props' type='com.oracle.nfs,props'> + <propval name='client_versmax' type='integer' value='4'/> + <propval name='client_versmin' type='integer' value='2'/> + </property_group> + </instance> <stability value='Unstable' /> <template> diff --git a/usr/src/cmd/fs.d/nfs/svc/mapid.xml b/usr/src/cmd/fs.d/nfs/svc/mapid.xml index f9174b7973..69dda6fb57 100644 --- a/usr/src/cmd/fs.d/nfs/svc/mapid.xml +++ b/usr/src/cmd/fs.d/nfs/svc/mapid.xml @@ -1,38 +1,35 @@ <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- - Copyright 2007 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. + CDDL HEADER START - CDDL HEADER START + The contents of this file are subject to the terms of the + Common Development and Distribution License (the "License"). + You may not use this file except in compliance with the License. - The contents of this file are subject to the terms of the - Common Development and Distribution License (the "License"). - You may not use this file except in compliance with the License. + You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + or http://www.opensolaris.org/os/licensing. + See the License for the specific language governing permissions + and limitations under the License. - You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - or http://www.opensolaris.org/os/licensing. - See the License for the specific language governing permissions - and limitations under the License. + When distributing Covered Code, include this CDDL HEADER in each + file and include the License file at usr/src/OPENSOLARIS.LICENSE. + If applicable, add the following below this CDDL HEADER, with the + fields enclosed by brackets "[]" replaced with your own identifying + information: Portions Copyright [yyyy] [name of copyright owner] - When distributing Covered Code, include this CDDL HEADER in each - file and include the License file at usr/src/OPENSOLARIS.LICENSE. - If applicable, add the following below this CDDL HEADER, with the - fields enclosed by brackets "[]" replaced with your own identifying - information: Portions Copyright [yyyy] [name of copyright owner] + CDDL HEADER END - CDDL HEADER END + Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - ident "%Z%%M% %I% %E% SMI" + NOTE: This service manifest is not editable; its contents will + be overwritten by package or patch operations, including + operating system upgrade. Make customizations in a different + file. - NOTE: This service manifest is not editable; its contents will - be overwritten by package or patch operations, including - operating system upgrade. Make customizations in a different - file. - - Note: if this service is modified to consist of anything other - than a single instance named 'default', you must make changes to - $SRC/head/rpcsvc/daemon_utils.h and libnsl:open_daemon_lock(). + Note: if this service is modified to consist of anything other + than a single instance named 'default', you must make changes to + $SRC/head/rpcsvc/daemon_utils.h and libnsl:open_daemon_lock(). --> <service_bundle type='manifest' name='SUNWnfscr:nfs-mapid'> @@ -42,10 +39,6 @@ type='service' version='1'> - <create_default_instance enabled='false' /> - - <single_instance /> - <dependency name='network' grouping='require_any' restart_on='error' @@ -103,6 +96,11 @@ <stability value='Evolving' /> <propval name='auto_enable' type='boolean' value='true' /> </property_group> + <instance name='default' enabled='false'> + <property_group name='nfs-props' type='com.oracle.nfs,props'> + <propval name='nfsmapid_domain' type='astring' value=''/> + </property_group> + </instance> <stability value='Stable' /> diff --git a/usr/src/cmd/fs.d/nfs/svc/nfs-server b/usr/src/cmd/fs.d/nfs/svc/nfs-server index 35f78b4fa1..09bb057e43 100644 --- a/usr/src/cmd/fs.d/nfs/svc/nfs-server +++ b/usr/src/cmd/fs.d/nfs/svc/nfs-server @@ -20,8 +20,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # Start/stop processes required for server NFS @@ -93,7 +92,7 @@ case "$1" in startnfsd=1 fi - # Options for nfsd are now set in /etc/default/nfs + # Options for nfsd are now set in SMF if [ $startnfsd -ne 0 ]; then /usr/lib/nfs/mountd rc=$? diff --git a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml index 3f7309f31a..84cdfedee3 100644 --- a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml +++ b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml @@ -1,9 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- - Copyright 2009 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. - CDDL HEADER START The contents of this file are subject to the terms of the @@ -23,6 +20,8 @@ CDDL HEADER END + Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + NOTE: This service manifest is not editable; its contents will be overwritten by package or patch operations, including operating system upgrade. Make customizations in a different @@ -40,10 +39,6 @@ type='service' version='1'> - <create_default_instance enabled='false' /> - - <single_instance /> - <dependency name='network' grouping='require_any' restart_on='error' @@ -95,7 +90,14 @@ <stability value='Evolving' /> <propval name='auto_enable' type='boolean' value='true' /> </property_group> - + <instance name='default' enabled='false'> + <property_group name='nfs-props' type='com.oracle.nfs,props'> + <propval name='grace_period' type='integer' value='90'/> + <propval name='lockd_listen_backlog' type='integer' value='32'/> + <propval name='lockd_retransmit_timeout' type='integer' value='5'/> + <propval name='lockd_servers' type='integer' value='20'/> + </property_group> + </instance> <stability value='Stable' /> <template> diff --git a/usr/src/cmd/fs.d/nfs/svc/server.xml b/usr/src/cmd/fs.d/nfs/svc/server.xml index 4a8fac519c..90b98d8c86 100644 --- a/usr/src/cmd/fs.d/nfs/svc/server.xml +++ b/usr/src/cmd/fs.d/nfs/svc/server.xml @@ -21,8 +21,7 @@ CDDL HEADER END - Copyright 2009 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. + Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. NOTE: This service manifest is not editable; its contents will be overwritten by package or patch operations, including @@ -41,10 +40,6 @@ type='service' version='1'> - <create_default_instance enabled='false' /> - - <single_instance /> - <dependency name='network' grouping='require_any' restart_on='error' @@ -162,6 +157,18 @@ <propval name='value_authorization' type='astring' value='solaris.smf.value.firewall.config' /> </property_group> + <instance name='default' enabled='false'> + <property_group name='nfs-props' type='com.oracle.nfs,props'> + <propval name='device' type='astring' value=''/> + <propval name='listen_backlog' type='integer' value='32'/> + <propval name='max_connections' type='integer' value='-1'/> + <propval name='protocol' type='astring' value='ALL'/> + <propval name='server_delegation' type='astring' value='on'/> + <propval name='server_versmax' type='integer' value='4'/> + <propval name='server_versmin' type='integer' value='2'/> + <propval name='servers' type='integer' value='16'/> + </property_group> + </instance> <stability value='Stable' /> |
