diff options
40 files changed, 2348 insertions, 0 deletions
diff --git a/illumos-nfs/debian/README.source b/illumos-nfs/debian/README.source new file mode 100644 index 0000000..9988910 --- /dev/null +++ b/illumos-nfs/debian/README.source @@ -0,0 +1,10 @@ +Real sources are in the package illumos-source-X.Y, +where X and Y are numbers. Exact values of X and Y +are set in Build-Depends field of debian/control as +well as in the version string in debian/changelog, +in a form of X.Y-1. + +To add a patch you need first to unpack files from +illumos-source-X.Y using ./debian/rules unpack +and, desirably, ./debian/rules patch + diff --git a/illumos-nfs/debian/changelog b/illumos-nfs/debian/changelog new file mode 100644 index 0000000..28f0be5 --- /dev/null +++ b/illumos-nfs/debian/changelog @@ -0,0 +1,5 @@ +illumos-nfs (2.10+1) unstable; urgency=low + + * Initial release. + + -- Igor Pashev <pashev.igor@gmail.com> Sun, 29 Sep 2013 14:00:41 +0400 diff --git a/illumos-nfs/debian/compat b/illumos-nfs/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/illumos-nfs/debian/compat @@ -0,0 +1 @@ +9 diff --git a/illumos-nfs/debian/control b/illumos-nfs/debian/control new file mode 100644 index 0000000..fe13e91 --- /dev/null +++ b/illumos-nfs/debian/control @@ -0,0 +1,81 @@ +Source: illumos-nfs +Section: admin +Priority: standard +Maintainer: Igor Pashev <pashev.igor@gmail.com> +Build-Depends: + illumos-source-2.10, + dh-illumos, + dh-smf, + dtrace, + libbsm-dev, + libdtrace-dev, + libidmap-dev, + libkstat-dev, + libkvm-dev, + libmapid-dev, + libnvpair-dev, + libreparse-dev, + libscf-dev, + libtsnet-dev, + libtsol-dev, + libumem-dev, + quilt, + symlinks, +Standards-Version: 3.9.3 +Homepage: https://www.illumos.org + +Package: libreparse-nfs-basic1 +Section: net +Priority: optional +Multi-Arch: same +Architecture: illumos-any +Depends: ${shlibs:Depends}, ${misc:Depends}, +Description: NFS Basic plugin for libreparse + +Package: nfsref +Section: net +Architecture: illumos-any +Recommends: illumos-reparsed +Depends: ${shlibs:Depends}, ${misc:Depends}, + libreparse-nfs-basic1 +Description: NFS referral utility + The nfsref command manages NFS Version 4 referrals, which are + server-side pointers used to redirect clients to actual locations of file + systems. Referrals are based on reparse points + +Package: illumos-nfs-common +Section: net +Architecture: illumos-any +Provides: nfs-common, nfs-client +Depends: ${shlibs:Depends}, ${misc:Depends}, illumos-kernel (>= 2.10+7), + netbase (>= 5.0+dyson2) +Description: NFS support files common to client and server + +Package: illumos-nfs-server +Section: net +Architecture: illumos-any +Provides: nfs-server +Suggests: illumos-nfslogd +Depends: ${shlibs:Depends}, ${misc:Depends}, + sharemgr, libshare-nfs1, illumos-rpcbind | rpcbind, + illumos-nfs-common +Description: support for NFS kernel server + This package contains the user-space support needed to use the + NFS kernel server. Most administrators wishing to set up an NFS server + would want to install this package. + . + This packages include nfsd, mountd and lockd daemons and their SMF services. + +Package: illumos-nfslogd +Section: net +Architecture: illumos-any +Provides: nfslogd +Depends: ${shlibs:Depends}, ${misc:Depends}, illumos-nfs-server +Description: nfs logging daemon + The nfslogd daemon provides operational logging to the Illumos NFS server. It + is the nfslogd daemon's job to generate the activity log by analyzing the + RPC operations processed by the NFS server. The log will only be generated + for file systems exported with logging enabled. This is specified at file + system export time by means of the share_nfs(1M) command. + . + NFS server logging is not supported on Illumos machines that are using NFS Version 4. diff --git a/illumos-nfs/debian/copyright b/illumos-nfs/debian/copyright new file mode 100644 index 0000000..fca073e --- /dev/null +++ b/illumos-nfs/debian/copyright @@ -0,0 +1,26 @@ +Files: debian/* +Copyright: 2013, Igor Pashev <pashev.igor@gmail.com> +License: WTFPL-2 + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + . + Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> + . + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + . + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + . + 0. You just DO WHAT THE FUCK YOU WANT TO. + +Files: * +License: CDDL + Note that sources are not in this package but in the package + illumos-source-X.Y. Those sources are covered by Common Development + and Distribution License (CDDL). + . + On Dyson system, the full text of the CDDL license + can be found in the file `/usr/share/common-licenses/CDDL-1.0'. + diff --git a/illumos-nfs/debian/illumos-nfs-common.install b/illumos-nfs/debian/illumos-nfs-common.install new file mode 100644 index 0000000..277e621 --- /dev/null +++ b/illumos-nfs/debian/illumos-nfs-common.install @@ -0,0 +1,22 @@ +lib/svc/manifest/network/nfs/cbd.xml +lib/svc/manifest/network/nfs/client.xml +lib/svc/manifest/network/nfs/mapid.xml +lib/svc/manifest/network/nfs/nlockmgr.xml +lib/svc/manifest/network/nfs/status.xml +lib/svc/method/nfs-client + +# Yes, we need ipfilter rules here: +lib/svc/method/nfs-server + +lib/svc/method/nlockmgr +usr/bin/nfsstat +usr/lib/fs/nfs/dfmounts +usr/lib/fs/nfs/dfshares +usr/lib/fs/nfs/mount +usr/lib/fs/nfs/showmount +usr/lib/fs/nfs/umount +usr/lib/nfs/lockd +usr/lib/nfs/nfs4cbd +usr/lib/nfs/nfsmapid +usr/lib/nfs/statd +usr/sbin/showmount diff --git a/illumos-nfs/debian/illumos-nfs-server.install b/illumos-nfs/debian/illumos-nfs-server.install new file mode 100644 index 0000000..0d9cb6c --- /dev/null +++ b/illumos-nfs/debian/illumos-nfs-server.install @@ -0,0 +1,13 @@ +etc/nfssec.conf +lib/svc/manifest/network/nfs/server.xml + +# This one is in illumos-nfs-common, where we need +# ipfilter rules for other services; it is safe because +# illumos-nfs-server depends on illumos-nfs-common +#lib/svc/method/nfs-server + +usr/lib/fs/nfs/nfsfind +usr/lib/nfs/mountd +usr/lib/nfs/nfsd +usr/sbin/clear_locks +usr/sbin/exportfs diff --git a/illumos-nfs/debian/illumos-nfs-server.manpages b/illumos-nfs/debian/illumos-nfs-server.manpages new file mode 100644 index 0000000..33f5a77 --- /dev/null +++ b/illumos-nfs/debian/illumos-nfs-server.manpages @@ -0,0 +1,2 @@ +usr/src/man/man1m/mountd.1m +usr/src/man/man1m/nfsd.1m diff --git a/illumos-nfs/debian/illumos-nfslogd.install b/illumos-nfs/debian/illumos-nfslogd.install new file mode 100644 index 0000000..1deb628 --- /dev/null +++ b/illumos-nfs/debian/illumos-nfslogd.install @@ -0,0 +1,4 @@ +etc/default/nfslogd +etc/nfs/nfslog.conf +lib/svc/manifest/network/nfs/nfslogd.xml +usr/lib/nfs/nfslogd diff --git a/illumos-nfs/debian/illumos-nfslogd.manpages b/illumos-nfs/debian/illumos-nfslogd.manpages new file mode 100644 index 0000000..7834a21 --- /dev/null +++ b/illumos-nfs/debian/illumos-nfslogd.manpages @@ -0,0 +1 @@ +usr/src/man/man1m/nfslogd.1m diff --git a/illumos-nfs/debian/libreparse-nfs-basic1.install b/illumos-nfs/debian/libreparse-nfs-basic1.install new file mode 100644 index 0000000..1b95e2c --- /dev/null +++ b/illumos-nfs/debian/libreparse-nfs-basic1.install @@ -0,0 +1 @@ +usr/lib/*/reparse/libnfs_basic.so.1 diff --git a/illumos-nfs/debian/nfsref.install b/illumos-nfs/debian/nfsref.install new file mode 100644 index 0000000..cf69eeb --- /dev/null +++ b/illumos-nfs/debian/nfsref.install @@ -0,0 +1 @@ +usr/sbin/nfsref diff --git a/illumos-nfs/debian/patches/Makefile.fstype-install.patch b/illumos-nfs/debian/patches/Makefile.fstype-install.patch new file mode 100644 index 0000000..539515e --- /dev/null +++ b/illumos-nfs/debian/patches/Makefile.fstype-install.patch @@ -0,0 +1,29 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/Makefile.fstype +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/Makefile.fstype 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/Makefile.fstype 2013-09-27 17:21:53.175048725 +0400 +@@ -73,16 +73,20 @@ + $(FSTYPEDIRS): + $(INS.dir) + +-$(ROOTETCFSTYPE)/%: $(ROOTETCFSTYPE) % ++$(ROOTETCFSTYPE)/%: % ++ mkdir -p $(ROOTETCFSTYPE) + $(INS.file) + +-$(ROOTLIBFSTYPE)/%: $(ROOTLIBFSTYPE) % ++$(ROOTLIBFSTYPE)/%: % ++ mkdir -p $(ROOTLIBFSTYPE) + $(INS.file) + +-$(ROOTLIBTYPE)/%: $(ROOTLIBTYPE) % ++$(ROOTLIBTYPE)/%: % ++ mkdir -p $(ROOTLIBTYPE) + $(INS.file) + +-$(ROOTETCTYPE)/%: $(ROOTETCTYPE) % ++$(ROOTETCTYPE)/%: % ++ mkdir -p $(ROOTETCTYPE) + $(INS.file) + + # Prevent fslib.o from being build in the sub makefiles. diff --git a/illumos-nfs/debian/patches/illumos-195-lockd.patch b/illumos-nfs/debian/patches/illumos-195-lockd.patch new file mode 100644 index 0000000..39ead5a --- /dev/null +++ b/illumos-nfs/debian/patches/illumos-195-lockd.patch @@ -0,0 +1,1525 @@ +Description: Backport of 195 Need replacement for nfs/lockd+klm +Bug: https://www.illumos.org/issues/195 +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/Makefile 2013-09-29 01:56:45.005252731 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/Makefile 2013-09-29 01:57:22.457892184 +0400 +@@ -34,7 +34,7 @@ + SUBDIR1= exportfs nfsd rquotad \ + statd nfsstat mountd dfshares \ + nfsfind nfs4cbd +-SUBDIR2= clear_locks umount showmount \ ++SUBDIR2= clear_locks lockd umount showmount \ + mount dfmounts nfslog nfsmapid \ + nfsref rp_basic + +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lockd/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lockd/Makefile 2013-09-29 01:57:22.460514402 +0400 +@@ -0,0 +1,83 @@ ++# ++# 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) 1990, 2010, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2012 by Delphix. All rights reserved. ++# ++ ++FSTYPE = nfs ++TYPEPROG = lockd ++ATTMK = $(TYPEPROG) ++ ++include ../../Makefile.fstype ++ ++LOCAL = lockd.o ++OBJS = $(LOCAL) daemon.o nfs_tbind.o smfcfg.o thrpool.o ++ ++POFILE = lockd.po ++ ++SRCS = $(LOCAL:%.o=%.c) ../lib/daemon.c ../lib/nfs_tbind.c \ ++ ../lib/smfcfg.c ../lib/thrpool.c ++LDLIBS += -lnsl -lscf ++CPPFLAGS += -I../lib ++C99MODE = $(C99_ENABLE) ++ ++CERRWARN += -_gcc=-Wno-parentheses ++CERRWARN += -_gcc=-Wno-switch ++CERRWARN += -_gcc=-Wno-unused-variable ++CERRWARN += -_gcc=-Wno-uninitialized ++ ++$(TYPEPROG): $(OBJS) ++ $(LINK.c) -o $@ $(OBJS) $(LDLIBS) ++ $(POST_PROCESS) ++ ++lockd.o: lockd.c ++ $(COMPILE.c) lockd.c ++ ++nfs_tbind.o: ../lib/nfs_tbind.c ++ $(COMPILE.c) ../lib/nfs_tbind.c ++ ++thrpool.o: ../lib/thrpool.c ++ $(COMPILE.c) ../lib/thrpool.c ++ ++daemon.o: ../lib/daemon.c ++ $(COMPILE.c) ../lib/daemon.c ++ ++smfcfg.o: ../lib/smfcfg.c ++ $(COMPILE.c) ../lib/smfcfg.c ++ ++# ++# message catalog ++# ++catalog: $(POFILE) ++ ++$(POFILE): $(SRCS) ++ $(RM) $@ ++ $(COMPILE.cpp) $(SRCS) > $(POFILE).i ++ $(XGETTEXT) $(XGETFLAGS) $(POFILE).i ++ sed "/^domain/d" messages.po > $@ ++ $(RM) $(POFILE).i messages.po ++ ++lint: ++ $(LINT.c) $(SRCS) $(LDLIBS) ++ ++clean: ++ $(RM) $(OBJS) $(DOBJ) +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lockd/lockd.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lockd/lockd.c 2013-09-29 01:57:22.463068024 +0400 +@@ -0,0 +1,550 @@ ++/* ++ * 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) 1989, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. ++ * Copyright (c) 2012 by Delphix. All rights reserved. ++ */ ++ ++/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ ++/* All Rights Reserved */ ++ ++/* ++ * University Copyright- Copyright (c) 1982, 1986, 1988 ++ * The Regents of the University of California ++ * All Rights Reserved ++ * ++ * University Acknowledgment- Portions of this document are derived from ++ * software developed by the University of California, Berkeley, and its ++ * contributors. ++ */ ++ ++/* LINTLIBRARY */ ++/* PROTOLIB1 */ ++ ++/* ++ * NLM server ++ * ++ * Most of this copied from ../nfsd/nfsd.c ++ * and then s:NFS:NLM: applied, etc. ++ */ ++ ++#include <sys/param.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <syslog.h> ++#include <tiuser.h> ++#include <rpc/rpc.h> ++#include <errno.h> ++#include <thread.h> ++#include <sys/time.h> ++#include <sys/file.h> ++#include <nfs/nfs.h> ++#include <nfs/nfssys.h> ++#include <stdio.h> ++#include <stdio_ext.h> ++#include <stdlib.h> ++#include <signal.h> ++#include <netconfig.h> ++#include <netdir.h> ++#include <string.h> ++#include <unistd.h> ++#include <stropts.h> ++#include <sys/tihdr.h> ++#include <poll.h> ++#include <priv_utils.h> ++#include <sys/tiuser.h> ++#include <netinet/tcp.h> ++#include <deflt.h> ++#include <rpcsvc/daemon_utils.h> ++#include <rpcsvc/nlm_prot.h> ++#include <libintl.h> ++#include <libscf.h> ++#include <libshare.h> ++#include "nfs_tbind.h" ++#include "thrpool.h" ++#include "smfcfg.h" ++ ++/* Option defaults. See nfssys.h */ ++struct lm_svc_args lmargs = { ++ .version = LM_SVC_CUR_VERS, ++ /* fd, n_fmly, n_proto, n_rdev (below) */ ++ .debug = 0, ++ .timout = 5 * 60, ++ .grace = 60, ++ .retransmittimeout = 15 ++}; ++int max_servers = 20; ++ ++ ++#define RET_OK 0 /* return code for no error */ ++#define RET_ERR 33 /* return code for error(s) */ ++ ++static int nlmsvc(int fd, struct netbuf addrmask, ++ struct netconfig *nconf); ++static int nlmsvcpool(int max_servers); ++static void usage(void); ++ ++extern int _nfssys(int, void *); ++static void sigterm_handler(void); ++static void shutdown_lockd(void); ++ ++extern int daemonize_init(void); ++extern void daemonize_fini(int fd); ++ ++static char *MyName; ++ ++/* ++ * We want to bind to these TLI providers, and in this order, ++ * because the kernel NLM needs the loopback first for its ++ * initialization. (It uses it to talk to statd.) ++ */ ++static NETSELDECL(defaultproviders)[] = { ++ "/dev/ticotsord", ++ "/dev/tcp", ++ "/dev/udp", ++ "/dev/tcp6", ++ "/dev/udp6", ++ NULL ++}; ++ ++/* ++ * The following are all globals used by routines in nfs_tbind.c. ++ */ ++size_t end_listen_fds; /* used by conn_close_oldest() */ ++size_t num_fds = 0; /* used by multiple routines */ ++int listen_backlog = 32; /* used by bind_to_{provider,proto}() */ ++int (*Mysvc)(int, struct netbuf, struct netconfig *) = nlmsvc; ++ /* used by cots_listen_event() */ ++int max_conns_allowed = -1; /* used by cots_listen_event() */ ++ ++int ++main(int ac, char *av[]) ++{ ++ char *propname = NULL; ++ char *dir = "/"; ++ char *provider = (char *)NULL; ++ struct protob *protobp; ++ NETSELPDECL(providerp); ++ sigset_t sgset; ++ int i, c, pid, ret, val; ++ int pipe_fd = -1; ++ struct sigaction act; ++ ++ MyName = *av; ++ ++ /* ++ * Initializations that require more privileges than we need to run. ++ */ ++ (void) _create_daemon_lock(LOCKD, DAEMON_UID, DAEMON_GID); ++ svcsetprio(); ++ ++ if (__init_daemon_priv(PU_RESETGROUPS|PU_CLEARLIMITSET, ++ DAEMON_UID, DAEMON_GID, PRIV_SYS_NFS, NULL) == -1) { ++ (void) fprintf(stderr, "%s should be run with" ++ " sufficient privileges\n", av[0]); ++ exit(1); ++ } ++ ++ (void) enable_extended_FILE_stdio(-1, -1); ++ ++ /* ++ * Read in the values from SMF first before we check ++ * command line options so the options override SMF values. ++ */ ++ ++ /* How long to keep idle connections. */ ++ propname = "conn_idle_timeout"; /* also -t */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ lmargs.timout = val; ++ } ++ ++ /* Note: debug_level can only be set by args. */ ++ ++ /* How long to wait for clients to re-establish locks. */ ++ propname = "grace_period"; /* also -g */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ lmargs.grace = val; ++ } ++ ++ propname = "listen_backlog"; /* also -l */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ listen_backlog = val; ++ } ++ ++ propname = "max_connections"; /* also -c */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ max_conns_allowed = val; ++ } ++ ++ propname = "max_servers"; /* also argv[1] */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ max_servers = val; ++ } ++ ++ propname = "retrans_timeout"; /* also -r */ ++ ret = nfs_smf_get_iprop(propname, &val, ++ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, LOCKD); ++ if (ret == SA_OK) { ++ if (val <= 0) ++ fprintf(stderr, gettext( ++ "Invalid %s from SMF"), propname); ++ else ++ lmargs.retransmittimeout = val; ++ } ++ ++ ++ while ((c = getopt(ac, av, "c:d:g:l:r:t:")) != EOF) ++ switch (c) { ++ case 'c': /* max_connections */ ++ if ((val = atoi(optarg)) <= 0) ++ goto badval; ++ max_conns_allowed = val; ++ break; ++ ++ case 'd': /* debug */ ++ lmargs.debug = atoi(optarg); ++ break; ++ ++ case 'g': /* grace_period */ ++ if ((val = atoi(optarg)) <= 0) ++ goto badval; ++ lmargs.grace = val; ++ break; ++ ++ case 'l': /* listen_backlog */ ++ if ((val = atoi(optarg)) <= 0) ++ goto badval; ++ listen_backlog = val; ++ break; ++ ++ case 'r': /* retrans_timeout */ ++ if ((val = atoi(optarg)) <= 0) ++ goto badval; ++ lmargs.retransmittimeout = val; ++ break; ++ ++ case 't': /* conn_idle_timeout */ ++ if ((val = atoi(optarg)) <= 0) ++ goto badval; ++ lmargs.timout = val; ++ break; ++ ++ badval: ++ fprintf(stderr, gettext( ++ "Invalid -%c option value"), c); ++ /* FALLTHROUGH */ ++ default: ++ usage(); ++ /* NOTREACHED */ ++ } ++ ++ /* ++ * If there is exactly one more argument, it is the number of ++ * servers. ++ */ ++ if (optind < ac) { ++ val = atoi(av[optind]); ++ if (val <= 0) { ++ fprintf(stderr, gettext( ++ "Invalid max_servers argument")); ++ usage(); ++ } ++ max_servers = val; ++ optind++; ++ } ++ /* ++ * If there are two or more arguments, then this is a usage error. ++ */ ++ if (optind != ac) ++ usage(); ++ ++ if (lmargs.debug) { ++ printf("%s: debug= %d, conn_idle_timout= %d," ++ " grace_period= %d, listen_backlog= %d," ++ " max_connections= %d, max_servers= %d," ++ " retrans_timeout= %d\n", ++ MyName, lmargs.debug, lmargs.timout, ++ lmargs.grace, listen_backlog, ++ max_conns_allowed, max_servers, ++ lmargs.retransmittimeout); ++ } ++ ++ /* ++ * Set current dir to server root ++ */ ++ if (chdir(dir) < 0) { ++ (void) fprintf(stderr, "%s: ", MyName); ++ perror(dir); ++ exit(1); ++ } ++ ++ /* Daemonize, if not debug. */ ++ if (lmargs.debug == 0) ++ pipe_fd = daemonize_init(); ++ ++ openlog(MyName, LOG_PID | LOG_NDELAY, LOG_DAEMON); ++ ++ /* ++ * establish our lock on the lock file and write our pid to it. ++ * exit if some other process holds the lock, or if there's any ++ * error in writing/locking the file. ++ */ ++ pid = _enter_daemon_lock(LOCKD); ++ switch (pid) { ++ case 0: ++ break; ++ case -1: ++ fprintf(stderr, "error locking for %s: %s", LOCKD, ++ strerror(errno)); ++ exit(2); ++ default: ++ /* daemon was already running */ ++ exit(0); ++ } ++ ++ /* ++ * Block all signals till we spawn other ++ * threads. ++ */ ++ (void) sigfillset(&sgset); ++ (void) thr_sigsetmask(SIG_BLOCK, &sgset, NULL); ++ ++ /* Unregister any previous versions. */ ++ for (i = NLM_VERS; i < NLM4_VERS; i++) { ++ svc_unreg(NLM_PROG, i); ++ } ++ ++ /* ++ * Set up kernel RPC thread pool for the NLM server. ++ */ ++ if (nlmsvcpool(max_servers)) { ++ fprintf(stderr, "Can't set up kernel NLM service: %s. Exiting", ++ strerror(errno)); ++ exit(1); ++ } ++ ++ /* ++ * Set up blocked thread to do LWP creation on behalf of the kernel. ++ */ ++ if (svcwait(NLM_SVCPOOL_ID)) { ++ fprintf(stderr, "Can't set up NLM pool creator: %s. Exiting", ++ strerror(errno)); ++ exit(1); ++ } ++ ++ /* ++ * Install atexit and sigterm handlers ++ */ ++ act.sa_handler = sigterm_handler; ++ act.sa_flags = 0; ++ ++ (void) sigaction(SIGTERM, &act, NULL); ++ (void) atexit(shutdown_lockd); ++ ++ /* ++ * Now open up for signal delivery ++ */ ++ (void) thr_sigsetmask(SIG_UNBLOCK, &sgset, NULL); ++ ++ /* ++ * Build a protocol block list for registration. ++ */ ++ protobp = (struct protob *)malloc(sizeof (struct protob)); ++ protobp->serv = "NLM"; ++ protobp->versmin = NLM_VERS; ++ protobp->versmax = NLM4_VERS; ++ protobp->program = NLM_PROG; ++ protobp->next = (struct protob *)NULL; ++ ++ for (providerp = defaultproviders; ++ *providerp != NULL; providerp++) { ++ provider = *providerp; ++ do_one(provider, NULL, protobp, nlmsvc); ++ } ++ ++ free(protobp); ++ ++ if (num_fds == 0) { ++ fprintf(stderr, "Could not start NLM service for any protocol." ++ " Exiting"); ++ exit(1); ++ } ++ ++ end_listen_fds = num_fds; ++ ++ /* ++ * lockd is up and running as far as we are concerned. ++ */ ++ if (lmargs.debug == 0) ++ daemonize_fini(pipe_fd); ++ ++ /* ++ * Get rid of unneeded privileges. ++ */ ++ __fini_daemon_priv(PRIV_PROC_FORK, PRIV_PROC_EXEC, PRIV_PROC_SESSION, ++ PRIV_FILE_LINK_ANY, PRIV_PROC_INFO, (char *)NULL); ++ ++ /* ++ * Poll for non-data control events on the transport descriptors. ++ */ ++ poll_for_action(); ++ ++ /* ++ * If we get here, something failed in poll_for_action(). ++ */ ++ return (1); ++} ++ ++static int ++nlmsvcpool(int maxservers) ++{ ++ struct svcpool_args npa; ++ ++ npa.id = NLM_SVCPOOL_ID; ++ npa.maxthreads = maxservers; ++ npa.redline = 0; ++ npa.qsize = 0; ++ npa.timeout = 0; ++ npa.stksize = 0; ++ npa.max_same_xprt = 0; ++ return (_nfssys(SVCPOOL_CREATE, &npa)); ++} ++ ++static int ++ncfmly_to_lmfmly(const char *ncfmly) ++{ ++ if (0 == strcmp(ncfmly, NC_INET)) ++ return (LM_INET); ++ if (0 == strcmp(ncfmly, NC_INET6)) ++ return (LM_INET6); ++ if (0 == strcmp(ncfmly, NC_LOOPBACK)) ++ return (LM_LOOPBACK); ++ return (-1); ++} ++ ++static int ++nctype_to_lmprot(uint_t semantics) ++{ ++ switch (semantics) { ++ case NC_TPI_CLTS: ++ return (LM_UDP); ++ case NC_TPI_COTS_ORD: ++ return (LM_TCP); ++ } ++ return (-1); ++} ++ ++static dev_t ++ncdev_to_rdev(const char *ncdev) ++{ ++ struct stat st; ++ ++ if (stat(ncdev, &st) < 0) ++ return (NODEV); ++ return (st.st_rdev); ++} ++ ++static void ++sigterm_handler(void) ++{ ++ /* to call atexit handler */ ++ exit(0); ++} ++ ++static void ++shutdown_lockd(void) ++{ ++ (void) _nfssys(KILL_LOCKMGR, NULL); ++} ++ ++ ++/* ++ * Establish NLM service thread. ++ */ ++static int ++nlmsvc(int fd, struct netbuf addrmask, struct netconfig *nconf) ++{ ++ struct lm_svc_args lma; ++ ++ lma = lmargs; /* init by struct copy */ ++ ++ /* ++ * The kernel code needs to reconstruct a complete ++ * knetconfig from n_fmly, n_proto. We use these ++ * two fields to convey the family and semantics. ++ */ ++ lma.fd = fd; ++ lma.n_fmly = ncfmly_to_lmfmly(nconf->nc_protofmly); ++ lma.n_proto = nctype_to_lmprot(nconf->nc_semantics); ++ lma.n_rdev = ncdev_to_rdev(nconf->nc_device); ++ ++ return (_nfssys(LM_SVC, &lma)); ++} ++ ++static void ++usage(void) ++{ ++ (void) fprintf(stderr, gettext( ++ "usage: %s [options] [max_servers]\n"), MyName); ++ (void) fprintf(stderr, gettext( ++ "options: (see SMF property descriptions)\n")); ++ /* Note: don't translate these */ ++ (void) fprintf(stderr, "\t-c max_connections\n"); ++ (void) fprintf(stderr, "\t-d debug_level\n"); ++ (void) fprintf(stderr, "\t-g grace_period\n"); ++ (void) fprintf(stderr, "\t-l listen_backlog\n"); ++ (void) fprintf(stderr, "\t-r retrans_timeout\n"); ++ (void) fprintf(stderr, "\t-t conn_idle_timeout\n"); ++ ++ exit(1); ++} +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/smfcfg.c 2013-09-29 01:56:45.005216882 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.c 2013-09-29 01:57:22.465315730 +0400 +@@ -18,8 +18,10 @@ + * + * CDDL HEADER END + */ ++ + /* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ + #include <stdio.h> + #include <stdlib.h> +@@ -358,6 +360,27 @@ + instance, sctype, svc_name, bufsz)); + } + ++/* Get an integer (base 10) property */ ++int ++nfs_smf_get_iprop(char *prop_name, int *rvp, char *instance, ++ scf_type_t sctype, char *svc_name) ++{ ++ char propbuf[32]; ++ int bufsz, rc, val; ++ ++ bufsz = sizeof (propbuf); ++ rc = fs_smf_get_prop(NFS_SMF, prop_name, propbuf, ++ instance, sctype, svc_name, &bufsz); ++ if (rc != SA_OK) ++ return (rc); ++ errno = 0; ++ val = strtol(propbuf, NULL, 10); ++ if (errno != 0) ++ return (SA_BAD_VALUE); ++ *rvp = val; ++ return (SA_OK); ++} ++ + int + nfs_smf_set_prop(char *prop_name, char *value, char *instance, + scf_type_t type, char *svc_name) +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.h +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/smfcfg.h 2013-09-29 01:56:45.005235382 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.h 2013-09-29 01:57:22.466709689 +0400 +@@ -90,6 +90,7 @@ + #define SMF_NO_PERMISSION 2 + #define SMF_NO_PGTYPE 3 + ++extern int nfs_smf_get_iprop(char *, int *, char *, scf_type_t, char *); + 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 *); +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c 2013-09-29 01:56:45.005161501 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c 2013-09-29 01:57:22.469826183 +0400 +@@ -1699,6 +1699,7 @@ + */ + static int + set_addrmask(fd, nconf, mask) ++ int fd; + struct netconfig *nconf; + struct netbuf *mask; + { +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_proc.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_proc.c 2013-09-29 01:52:28.965509102 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_proc.c 2013-09-29 01:58:03.409753962 +0400 +@@ -24,6 +24,12 @@ + * Use is subject to license terms. + */ + ++/* ++ * Copyright 2013 Nexenta Systems, Inc. All rights reserved. ++ * Copyright (c) 2012 by Delphix. All rights reserved. ++ */ ++ ++ + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ + +@@ -58,6 +64,8 @@ + #include <netdir.h> + #include <synch.h> + #include <thread.h> ++#include <ifaddrs.h> ++#include <errno.h> + #include <assert.h> + #include "sm_statd.h" + +@@ -88,14 +96,12 @@ + + /* ARGSUSED */ + void +-sm_status(namep, resp) +- sm_name *namep; +- sm_stat_res *resp; ++sm_stat_svc(sm_name *namep, sm_stat_res *resp) + { + + if (debug) + (void) printf("proc sm_stat: mon_name = %s\n", +- namep->mon_name); ++ namep->mon_name); + + resp->res_stat = stat_succ; + resp->state = LOCAL_STATE; +@@ -103,9 +109,7 @@ + + /* ARGSUSED */ + void +-sm_mon(monp, resp) +- mon *monp; +- sm_stat_res *resp; ++sm_mon_svc(mon *monp, sm_stat_res *resp) + { + mon_id *monidp; + monidp = &monp->mon_id; +@@ -113,7 +117,7 @@ + rw_rdlock(&thr_rwlock); + if (debug) { + (void) printf("proc sm_mon: mon_name = %s, id = %d\n", +- monidp->mon_name, * ((int *)monp->priv)); ++ monidp->mon_name, * ((int *)monp->priv)); + pr_mon(monp->mon_id.mon_name); + } + +@@ -131,17 +135,15 @@ + + /* ARGSUSED */ + void +-sm_unmon(monidp, resp) +- mon_id *monidp; +- sm_stat *resp; ++sm_unmon_svc(mon_id *monidp, sm_stat *resp) + { + rw_rdlock(&thr_rwlock); + if (debug) { + (void) printf( +- "proc sm_unmon: mon_name = %s, [%s, %d, %d, %d]\n", +- monidp->mon_name, monidp->my_id.my_name, +- monidp->my_id.my_prog, monidp->my_id.my_vers, +- monidp->my_id.my_proc); ++ "proc sm_unmon: mon_name = %s, [%s, %d, %d, %d]\n", ++ monidp->mon_name, monidp->my_id.my_name, ++ monidp->my_id.my_prog, monidp->my_id.my_vers, ++ monidp->my_id.my_proc); + pr_mon(monidp->mon_name); + } + +@@ -153,16 +155,14 @@ + + /* ARGSUSED */ + void +-sm_unmon_all(myidp, resp) +- my_id *myidp; +- sm_stat *resp; ++sm_unmon_all_svc(my_id *myidp, sm_stat *resp) + { + rw_rdlock(&thr_rwlock); + if (debug) + (void) printf("proc sm_unmon_all: [%s, %d, %d, %d]\n", +- myidp->my_name, +- myidp->my_prog, myidp->my_vers, +- myidp->my_proc); ++ myidp->my_name, ++ myidp->my_prog, myidp->my_vers, ++ myidp->my_proc); + delete_mon((char *)NULL, myidp); + pr_mon(NULL); + resp->state = local_state; +@@ -173,21 +173,19 @@ + * Notifies lockd specified by name that state has changed for this server. + */ + void +-sm_notify(ntfp) +- stat_chge *ntfp; ++sm_notify_svc(stat_chge *ntfp) + { + rw_rdlock(&thr_rwlock); + if (debug) + (void) printf("sm_notify: %s state =%d\n", +- ntfp->mon_name, ntfp->state); ++ ntfp->mon_name, ntfp->state); + send_notice(ntfp->mon_name, ntfp->state); + rw_unlock(&thr_rwlock); + } + + /* ARGSUSED */ + void +-sm_simu_crash(myidp) +- void *myidp; ++sm_simu_crash_svc(void *myidp) + { + int i; + struct mon_entry *monitor_q; +@@ -726,7 +724,6 @@ + moninfo_t *minfop; + + minfop = (moninfo_t *)arg; +- + if (statd_call_lockd(&minfop->id, minfop->state) == -1) { + if (debug && minfop->id.mon_id.mon_name) + (void) printf( +@@ -760,7 +757,7 @@ + { + enum clnt_stat clnt_stat; + struct timeval tottimeout; +- struct status stat; ++ struct sm_status stat; + my_id *my_idp; + char *mon_name; + int i; +@@ -769,7 +766,7 @@ + + mon_name = monp->mon_id.mon_name; + my_idp = &monp->mon_id.my_id; +- (void) memset(&stat, 0, sizeof (struct status)); ++ (void) memset(&stat, 0, sizeof (stat)); + stat.mon_name = mon_name; + stat.state = state; + for (i = 0; i < 16; i++) { +@@ -782,12 +779,14 @@ + tottimeout.tv_sec = SM_RPC_TIMEOUT; + tottimeout.tv_usec = 0; + +- if ((clnt = create_client(my_idp->my_name, my_idp->my_prog, +- my_idp->my_vers, &tottimeout)) == (CLIENT *) NULL) { +- return (-1); ++ clnt = create_client(my_idp->my_name, my_idp->my_prog, my_idp->my_vers, ++ "ticotsord", &tottimeout); ++ if (clnt == NULL) { ++ return (-1); + } + +- clnt_stat = clnt_call(clnt, my_idp->my_proc, xdr_status, (char *)&stat, ++ clnt_stat = clnt_call(clnt, my_idp->my_proc, ++ xdr_sm_status, (char *)&stat, + xdr_void, NULL, tottimeout); + if (debug) { + (void) printf("clnt_stat=%s(%d)\n", +@@ -809,21 +808,35 @@ + * Client handle created. + */ + CLIENT * +-create_client(host, prognum, versnum, utimeout) +- char *host; +- int prognum; +- int versnum; +- struct timeval *utimeout; ++create_client(char *host, int prognum, int versnum, char *netid, ++ struct timeval *utimeout) + { + int fd; + struct timeval timeout; + CLIENT *client; + struct t_info tinfo; + +- if ((client = clnt_create_timed(host, prognum, versnum, +- "netpath", utimeout)) == NULL) { ++ if (netid == NULL) { ++ client = clnt_create_timed(host, prognum, versnum, ++ "netpath", utimeout); ++ } else { ++ struct netconfig *nconf; ++ ++ nconf = getnetconfigent(netid); ++ if (nconf == NULL) { ++ return (NULL); ++ } ++ ++ client = clnt_tp_create_timed(host, prognum, versnum, nconf, ++ utimeout); ++ ++ freenetconfigent(nconf); ++ } ++ ++ if (client == NULL) { + return (NULL); + } ++ + (void) CLNT_CONTROL(client, CLGET_FD, (caddr_t)&fd); + if (t_getinfo(fd, &tinfo) != -1) { + if (tinfo.servtype == T_CLTS) { +@@ -833,7 +846,7 @@ + timeout.tv_usec = 0; + timeout.tv_sec = SM_CLTS_TIMEOUT; + (void) CLNT_CONTROL(client, +- CLSET_RETRY_TIMEOUT, (caddr_t)&timeout); ++ CLSET_RETRY_TIMEOUT, (caddr_t)&timeout); + } + } else + return (NULL); +@@ -1300,3 +1313,72 @@ + } + return (1); + } ++ ++/* ++ * Add IP address strings to the host_name list. ++ */ ++void ++merge_ips(void) ++{ ++ struct ifaddrs *ifap, *cifap; ++ int error; ++ ++ error = getifaddrs(&ifap); ++ if (error) { ++ syslog(LOG_WARNING, "getifaddrs error: '%s'", ++ strerror(errno)); ++ return; ++ } ++ ++ for (cifap = ifap; cifap != NULL; cifap = cifap->ifa_next) { ++ struct sockaddr *sa = cifap->ifa_addr; ++ char addr_str[INET6_ADDRSTRLEN]; ++ void *addr = NULL; ++ ++ switch (sa->sa_family) { ++ case AF_INET: { ++ struct sockaddr_in *sin = (struct sockaddr_in *)sa; ++ ++ /* Skip loopback addresses. */ ++ if (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) { ++ continue; ++ } ++ ++ addr = &sin->sin_addr; ++ break; ++ } ++ ++ case AF_INET6: { ++ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; ++ ++ /* Skip loopback addresses. */ ++ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) { ++ continue; ++ } ++ ++ addr = &sin6->sin6_addr; ++ break; ++ } ++ ++ default: ++ syslog(LOG_WARNING, "Unknown address family %d for " ++ "interface %s", sa->sa_family, cifap->ifa_name); ++ continue; ++ } ++ ++ if (inet_ntop(sa->sa_family, addr, addr_str, sizeof (addr_str)) ++ == NULL) { ++ syslog(LOG_WARNING, "Failed to convert address into " ++ "string representation for interface '%s' " ++ "address family %d", cifap->ifa_name, ++ sa->sa_family); ++ continue; ++ } ++ ++ if (!in_host_array(addr_str)) { ++ add_to_host_array(addr_str); ++ } ++ } ++ ++ freeifaddrs(ifap); ++} +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_statd.c 2013-09-29 01:52:29.180427047 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.c 2013-09-29 01:57:22.477939864 +0400 +@@ -36,7 +36,9 @@ + * contributors. + */ + +-#pragma ident "%Z%%M% %I% %E% SMI" ++/* ++ * Copyright (c) 2012 by Delphix. All rights reserved. ++ */ + + /* + * sm_statd.c consists of routines used for the intermediate +@@ -130,20 +132,20 @@ + for (i = 0; i < pathix; i++) { + (void) sprintf(state_file, "%s/statmon/state", path_name[i]); + if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { +- if ((fp_tmp = fopen(state_file, "w+")) +- == (FILE *)NULL) { ++ if ((fp_tmp = fopen(state_file, "w+")) == ++ (FILE *)NULL) { + if (debug) +- syslog(LOG_ERR, +- "can't open %s: %m", +- state_file); ++ syslog(LOG_ERR, ++ "can't open %s: %m", ++ state_file); + continue; + } else + (void) chmod(state_file, 0644); + } + if ((fscanf(fp_tmp, "%d", &tmp_state)) == EOF) { + if (debug) +- syslog(LOG_ERR, +- "statd: %s: file empty\n", state_file); ++ syslog(LOG_ERR, ++ "statd: %s: file empty\n", state_file); + (void) fclose(fp_tmp); + continue; + } +@@ -151,7 +153,7 @@ + LOCAL_STATE = tmp_state; + if (debug) + (void) printf("Update LOCAL STATE: %d\n", +- tmp_state); ++ tmp_state); + } + (void) fclose(fp_tmp); + } +@@ -180,8 +182,8 @@ + for (i = 0; i < pathix; i++) { + (void) sprintf(state_file, "%s/statmon/state", path_name[i]); + if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { +- if ((fp_tmp = fopen(state_file, "w+")) +- == (FILE *)NULL) { ++ if ((fp_tmp = fopen(state_file, "w+")) == ++ (FILE *)NULL) { + syslog(LOG_ERR, + "can't open %s: %m", state_file); + continue; +@@ -223,8 +225,8 @@ + + while ((dirp = readdir(dp)) != NULL) { + if (strcmp(dirp->d_name, ".") != 0 && +- strcmp(dirp->d_name, "..") != 0) { +- /* rename all entries from CURRENT to BACKUP */ ++ strcmp(dirp->d_name, "..") != 0) { ++ /* rename all entries from CURRENT to BACKUP */ + (void) move_file(CURRENT, dirp->d_name, BACKUP); + } + } +@@ -297,17 +299,17 @@ + name = strdup(dirp->d_name); + if (name == (char *)NULL) { + syslog(LOG_ERR, +- "statd: unable to allocate space for name %s\n", +- dirp->d_name); ++ "statd: unable to allocate space for name %s\n", ++ dirp->d_name); + continue; + } + + /* Create a thread to do a statd_call_statd for name */ + if (thr_create(NULL, NULL, thr_call_statd, +- (void *) name, 0, 0)) { ++ (void *) name, 0, 0)) { + syslog(LOG_ERR, +- "statd: unable to create thr_call_statd() for name %s.\n", +- dirp->d_name); ++ "statd: unable to create thr_call_statd() " ++ "for name %s.\n", dirp->d_name); + free(name); + continue; + } +@@ -334,7 +336,7 @@ + num_threads = 0; + while ((dirp = readdir(dp)) != NULL) { + if (strcmp(dirp->d_name, ".") == 0 || +- strcmp(dirp->d_name, "..") == 0) { ++ strcmp(dirp->d_name, "..") == 0) { + continue; + } + +@@ -350,7 +352,7 @@ + + if (debug) { + (void) printf("thr_statd_init: legacy %s\n", +- dirp->d_name); ++ dirp->d_name); + } + + /* +@@ -372,17 +374,17 @@ + name = strdup(dirp->d_name); + if (name == (char *)NULL) { + syslog(LOG_ERR, +- "statd: unable to allocate space for name %s\n", +- dirp->d_name); ++ "statd: unable to allocate space for name %s\n", ++ dirp->d_name); + continue; + } + + /* Create a thread to do a statd_call_statd for name */ + if (thr_create(NULL, NULL, thr_call_statd, +- (void *) name, 0, 0)) { ++ (void *) name, 0, 0)) { + syslog(LOG_ERR, +- "statd: unable to create thr_call_statd() for name %s.\n", +- dirp->d_name); ++ "statd: unable to create thr_call_statd() " ++ "for name %s.\n", dirp->d_name); + free(name); + continue; + } +@@ -410,7 +412,7 @@ + if ((mkdir(buf, SM_DIRECTORY_MODE)) == -1) { + if (errno != EEXIST) + syslog(LOG_ERR, "statd: mkdir %s error %m\n", +- buf); ++ buf); + else + copydir_from_to(BACKUP, buf); + } else +@@ -434,7 +436,7 @@ + /* Continue to notify statd on hosts that were unreachable. */ + if (thr_create(NULL, NULL, sm_try, NULL, THR_DETACHED, 0)) + syslog(LOG_ERR, +- "statd: unable to create thread for sm_try().\n"); ++ "statd: unable to create thread for sm_try().\n"); + thr_exit((void *) 0); + #ifdef lint + return (0); +@@ -489,8 +491,8 @@ + if (n <= 0) { + if (debug >= 2) { + (void) printf( +- "thr_call_statd: can't read link %s\n", +- path); ++ "thr_call_statd: can't read " ++ "link %s\n", path); + } + } else { + rname[n] = '\0'; +@@ -581,8 +583,8 @@ + tottimeout.tv_sec = SM_RPC_TIMEOUT; + tottimeout.tv_usec = 0; + +- if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS, +- &tottimeout)) == (CLIENT *) NULL) { ++ if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS, NULL, ++ &tottimeout)) == NULL) { + return (-1); + } + +@@ -675,8 +677,8 @@ + */ + if (delay == 0) + syslog(LOG_WARNING, +- "statd: host %s is not responding\n", +- nl->name); ++ "statd: host %s is not " ++ "responding\n", nl->name); + } + } + /* +@@ -1035,16 +1037,16 @@ + char dirpath[MAXPATHLEN]; + char rname[MAXNAMELEN + 1]; /* +1 for NULL term */ + +- if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0) +- + 3 > MAXPATHLEN) { ++ if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0) + ++ 3 > MAXPATHLEN) { + if (dir2 != NULL) + syslog(LOG_ERR, +- "statd: pathname too long: %s/%s/%s\n", +- dir1, dir2, name); ++ "statd: pathname too long: %s/%s/%s\n", ++ dir1, dir2, name); + else + syslog(LOG_ERR, +- "statd: pathname too long: %s/%s\n", +- dir1, name); ++ "statd: pathname too long: %s/%s\n", ++ dir1, name); + + return; + } +@@ -1078,12 +1080,13 @@ + if (debug >= 2) { + if (error < 0) { + (void) printf( +- "remove_name: can't unlink %s\n", +- dirpath); ++ "remove_name: can't " ++ "unlink %s\n", ++ dirpath); + } else { + (void) printf( +- "remove_name: unlinked %s\n", +- dirpath); ++ "remove_name: unlinked ", ++ "%s\n", dirpath); + } + } + } +@@ -1093,7 +1096,7 @@ + * here for analysis by the system administrator. + */ + syslog(LOG_ERR, +- "statd: can't read link %s: %m\n", path); ++ "statd: can't read link %s: %m\n", path); + } + } + +@@ -1122,13 +1125,13 @@ + + if ((dp = opendir(dir)) == (DIR *)NULL) { + syslog(LOG_ERR, "count_symlinks: open %s dir, error %m\n", +- dir); ++ dir); + return (-1); + } + + while ((dirp = readdir(dp)) != NULL) { + if (strcmp(dirp->d_name, ".") == 0 || +- strcmp(dirp->d_name, "..") == 0) { ++ strcmp(dirp->d_name, "..") == 0) { + continue; + } + +@@ -1141,8 +1144,8 @@ + if (n <= 0) { + if (debug >= 2) { + (void) printf( +- "count_symlinks: can't read link %s\n", +- lpath); ++ "count_symlinks: can't read link " ++ "%s\n", lpath); + } + continue; + } +@@ -1329,15 +1332,15 @@ + (void) printf("record_addr: addr= %x\n", addr.s_addr); + else if (family == AF_INET6) + (void) printf("record_addr: addr= %x\n", \ +- ((struct in6_addr *)addr6)->s6_addr); ++ ((struct in6_addr *)addr6)->s6_addr); + } + + if (family == AF_INET) { + if (addr.s_addr == INADDR_ANY || + ((addr.s_addr && 0xff000000) == 0)) { + syslog(LOG_DEBUG, +- "record_addr: illegal IP address %x\n", +- addr.s_addr); ++ "record_addr: illegal IP address %x\n", ++ addr.s_addr); + return; + } + } +@@ -1346,28 +1349,27 @@ + famstr = family2string(family); + if (famstr == NULL) { + syslog(LOG_DEBUG, +- "record_addr: unsupported address family %d\n", +- family); ++ "record_addr: unsupported address family %d\n", ++ family); + return; + } + + switch (family) { + char abuf[INET6_ADDRSTRLEN]; +- case AF_INET: ++ case AF_INET: + (void) sprintf(ascii_addr, "%s.%s", famstr, inet_ntoa(addr)); + break; + +- case AF_INET6: ++ case AF_INET6: + (void) sprintf(ascii_addr, "%s.%s", famstr,\ + inet_ntop(family, addr6, abuf, sizeof (abuf))); + break; + +- default: ++ default: + if (debug) { + (void) printf( +- "record_addr: family2string supports unknown family %d (%s)\n", +- family, +- famstr); ++ "record_addr: family2string supports unknown " ++ "family %d (%s)\n", family, famstr); + } + free(famstr); + return; +@@ -1389,13 +1391,13 @@ + */ + for (i = 0; i < pathix; i++) { + path_len = strlen(path_name[i]) + +- strlen("/statmon/sm/") + +- strlen(name) + 1; ++ strlen("/statmon/sm/") + ++ strlen(name) + 1; + + if (path_len > MAXPATHLEN) { + syslog(LOG_ERR, +- "statd: pathname too long: %s/statmon/sm/%s\n", +- path_name[i], name); ++ "statd: pathname too long: %s/statmon/sm/%s\n", ++ path_name[i], name); + continue; + } + (void) strcpy(path, path_name[i]); +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.h +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_statd.h 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.h 2013-09-29 01:57:22.480418642 +0400 +@@ -37,11 +37,14 @@ + * contributors. + */ + ++/* ++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. ++ * Copyright (c) 2012 by Delphix. All rights reserved. ++ */ ++ + #ifndef _SM_STATD_H + #define _SM_STATD_H + +-#pragma ident "%Z%%M% %I% %E% SMI" +- + #ifdef __cplusplus + extern "C" { + #endif +@@ -182,20 +185,27 @@ + extern void delete_file(char *name); + extern void record_name(char *name, int op); + extern void sm_crash(void); +-extern void sm_notify(stat_chge *ntfp); + extern void statd_init(); + extern void merge_hosts(void); +-extern CLIENT *create_client(char *, int, int, struct timeval *); ++extern void merge_ips(void); ++extern CLIENT *create_client(char *, int, int, char *, struct timeval *); + extern char *xmalloc(unsigned); +-extern void sm_status(sm_name *namep, sm_stat_res *resp); +-extern void sm_mon(mon *monp, sm_stat_res *resp); +-extern void sm_unmon(mon_id *monidp, sm_stat *resp); +-extern void sm_unmon_all(my_id *myidp, sm_stat *resp); +-extern void sm_simu_crash(void *myidp); ++ ++/* ++ * RPC service functions, slightly different here than the ++ * generated ones in sm_inter.h ++ */ ++extern void nsmaddrproc1_reg(reg1args *, reg1res *); ++extern void sm_stat_svc(sm_name *namep, sm_stat_res *resp); ++extern void sm_mon_svc(mon *monp, sm_stat_res *resp); ++extern void sm_unmon_svc(mon_id *monidp, sm_stat *resp); ++extern void sm_unmon_all_svc(my_id *myidp, sm_stat *resp); ++extern void sm_simu_crash_svc(void *myidp); ++extern void sm_notify_svc(stat_chge *ntfp); ++ + extern void sm_inithash(); + extern void copydir_from_to(char *from_dir, char *to_dir); + extern int str_cmp_unqual_hostname(char *, char *); +-extern void nsmaddrproc1_reg(reg1args *, reg1res *); + extern void record_addr(char *name, sa_family_t family, struct netobj *ah); + extern int is_symlink(char *file); + extern int create_symlink(char *todir, char *rname, char *lname); +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_svc.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_svc.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_svc.c 2013-09-29 01:57:22.482410895 +0400 +@@ -20,6 +20,7 @@ + */ + /* + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ + + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +@@ -35,6 +36,10 @@ + * contributors. + */ + ++/* ++ * Copyright (c) 2012 by Delphix. All rights reserved. ++ */ ++ + #include <stdio.h> + #include <stdio_ext.h> + #include <stdlib.h> +@@ -219,11 +224,13 @@ + local = (char *(*)()) nsmaddrproc1_reg; + break; + ++ case NSMADDRPROC1_UNREG: /* Not impl. */ + default: + svcerr_noproc(transp); + return; + } + } else { ++ /* Must be SM_PROG */ + switch (rqstp->rq_proc) { + case NULLPROC: + svc_sendreply(transp, xdr_void, (caddr_t)NULL); +@@ -232,37 +239,37 @@ + case SM_STAT: + xdr_argument = xdr_sm_name; + xdr_result = xdr_sm_stat_res; +- local = (char *(*)()) sm_status; ++ local = (char *(*)()) sm_stat_svc; + break; + + case SM_MON: + xdr_argument = xdr_mon; + xdr_result = xdr_sm_stat_res; +- local = (char *(*)()) sm_mon; ++ local = (char *(*)()) sm_mon_svc; + break; + + case SM_UNMON: + xdr_argument = xdr_mon_id; + xdr_result = xdr_sm_stat; +- local = (char *(*)()) sm_unmon; ++ local = (char *(*)()) sm_unmon_svc; + break; + + case SM_UNMON_ALL: + xdr_argument = xdr_my_id; + xdr_result = xdr_sm_stat; +- local = (char *(*)()) sm_unmon_all; ++ local = (char *(*)()) sm_unmon_all_svc; + break; + + case SM_SIMU_CRASH: + xdr_argument = xdr_void; + xdr_result = xdr_void; +- local = (char *(*)()) sm_simu_crash; ++ local = (char *(*)()) sm_simu_crash_svc; + break; + + case SM_NOTIFY: + xdr_argument = xdr_stat_chge; + xdr_result = xdr_void; +- local = (char *(*)()) sm_notify; ++ local = (char *(*)()) sm_notify_svc; + break; + + default: +@@ -284,8 +291,8 @@ + } + + if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) { +- syslog(LOG_ERR, "statd: unable to free arguments\n"); +- } ++ syslog(LOG_ERR, "statd: unable to free arguments\n"); ++ } + } + + /* +@@ -584,6 +591,9 @@ + /* Get other aliases from each interface. */ + merge_hosts(); + ++ /* Get all of the configured IP addresses. */ ++ merge_ips(); ++ + /* + * Set to automatic mode such that threads are automatically + * created diff --git a/illumos-nfs/debian/patches/nfs-do-not-install-fstypes.patch b/illumos-nfs/debian/patches/nfs-do-not-install-fstypes.patch new file mode 100644 index 0000000..f98e35e --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-do-not-install-fstypes.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/Makefile 2013-09-28 00:18:33.590208659 +0400 +@@ -33,7 +33,7 @@ + + SUBDIR1= exportfs nfsd rquotad \ + statd nfsstat mountd dfshares \ +- nfsfind nfs4cbd share ++ nfsfind nfs4cbd + SUBDIR2= clear_locks umount showmount \ + mount dfmounts nfslog nfsmapid \ + nfsref rp_basic diff --git a/illumos-nfs/debian/patches/nfs-lib-smfcfg.c.patch b/illumos-nfs/debian/patches/nfs-lib-smfcfg.c.patch new file mode 100644 index 0000000..6bc40d4 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-lib-smfcfg.c.patch @@ -0,0 +1,29 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/smfcfg.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/smfcfg.c 2013-09-27 17:09:54.810230218 +0400 +@@ -104,12 +104,12 @@ + 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; ++ fs_smfhandle_t *phandle = NULL; + scf_handle_t *handle; + scf_propertygroup_t *pg; + scf_property_t *prop; +- scf_transaction_t *tran; +- scf_transaction_entry_t *entry; ++ scf_transaction_t *tran = NULL; ++ scf_transaction_entry_t *entry = NULL; + scf_instance_t *inst; + scf_value_t *val; + int valint; +@@ -238,7 +238,7 @@ + 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; ++ fs_smfhandle_t *phandle = NULL; + scf_handle_t *handle; + scf_propertygroup_t *pg; + scf_property_t *prop; diff --git a/illumos-nfs/debian/patches/nfs-lib-thrpool.c.patch b/illumos-nfs/debian/patches/nfs-lib-thrpool.c.patch new file mode 100644 index 0000000..a4f1547 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-lib-thrpool.c.patch @@ -0,0 +1,44 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/thrpool.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/thrpool.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/thrpool.c 2013-09-27 17:06:08.457613483 +0400 +@@ -44,7 +44,7 @@ + static void * + svcstart(void *arg) + { +- int id = (int)arg; ++ intptr_t id = (intptr_t)arg; + + /* + * Create a kernel worker thread to service +@@ -87,7 +87,7 @@ + static void * + svcblock(void *arg) + { +- int id = (int)arg; ++ intptr_t id = (intptr_t)arg; + + /* CONSTCOND */ + while (1) { +@@ -193,7 +193,7 @@ + } + + int +-svcwait(int id) ++svcwait(intptr_t id) + { + thread_t tid; + +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/thrpool.h +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/thrpool.h 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/thrpool.h 2013-09-27 17:06:38.767905158 +0400 +@@ -34,7 +34,7 @@ + #endif + + +-int svcwait(int id); ++int svcwait(intptr_t id); + void svcsetprio(void); + int svcrdma(int, int, int, int); + diff --git a/illumos-nfs/debian/patches/nfs-mount-compile-fslib.o.patch b/illumos-nfs/debian/patches/nfs-mount-compile-fslib.o.patch new file mode 100644 index 0000000..c87b9eb --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-mount-compile-fslib.o.patch @@ -0,0 +1,23 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/mount/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/mount/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/mount/Makefile 2013-09-28 00:32:07.472511030 +0400 +@@ -34,7 +34,7 @@ + + include ../../Makefile.fstype + +-COMMON= $(FSLIB) nfs_sec.o replica.o nfs_subr.o selfcheck.o smfcfg.o ++COMMON= fslib.o 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 \ +@@ -71,6 +71,9 @@ + $(LINK.c) -o $@ $(OBJS) $(LDLIBS) + $(POST_PROCESS) + ++fslib.o: ../../fslib.c ++ $(COMPILE.c) ../../fslib.c ++ + nfs_sec.o: ../lib/nfs_sec.c + $(COMPILE.c) ../lib/nfs_sec.c + diff --git a/illumos-nfs/debian/patches/nfs-mount-no-etc.patch b/illumos-nfs/debian/patches/nfs-mount-no-etc.patch new file mode 100644 index 0000000..cb0444e --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-mount-no-etc.patch @@ -0,0 +1,27 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/mount/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/mount/Makefile 2013-09-28 14:11:43.754055966 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/mount/Makefile 2013-09-28 14:19:25.318596229 +0400 +@@ -24,13 +24,6 @@ + + FSTYPE= nfs + LIBPROG= mount +-ROOTFS_PROG= $(LIBPROG) +- +-# duplicate ROOTLIBFSTYPE value needed for installation rule +-# we must define this before including Makefile.fstype +-ROOTLIBFSTYPE = $(ROOT)/usr/lib/fs/$(FSTYPE) +-$(ROOTLIBFSTYPE)/%: $(ROOTLIBFSTYPE) % +- $(RM) $@; $(SYMLINK) ../../../../etc/fs/$(FSTYPE)/$(LIBPROG) $@ + + include ../../Makefile.fstype + +@@ -117,8 +110,6 @@ + sed "/^domain/d" messages.po > $@ + $(RM) $(POFILE).i messages.po + +-install: $(ROOTETCPROG) +- + lint: webnfs.h webnfs_xdr.c webnfs_client.c lint_SRCS + + clean: diff --git a/illumos-nfs/debian/patches/nfs-mount.patch b/illumos-nfs/debian/patches/nfs-mount.patch new file mode 100644 index 0000000..fb45732 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-mount.patch @@ -0,0 +1,22 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/mount/mount.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/mount/mount.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/mount/mount.c 2013-09-28 00:30:31.291802650 +0400 +@@ -1390,7 +1390,7 @@ + * This is a potential routine to move to ../lib for common usage. + */ + static struct netbuf * +-get_the_addr(char *hostname, ulong_t prog, ulong_t vers, ++get_the_addr(char *hostname, rpcprog_t prog, rpcvers_t vers, + struct netconfig *nconf, ushort_t port, struct t_info *tinfo, + caddr_t *fhp, bool_t get_pubfh, char *fspath, err_ret_t *error) + { +@@ -1748,7 +1748,7 @@ + * + */ + static struct netbuf * +-get_addr(char *hostname, ulong_t prog, ulong_t vers, struct netconfig **nconfp, ++get_addr(char *hostname, rpcprog_t prog, rpcvers_t vers, struct netconfig **nconfp, + char *proto, ushort_t port, struct t_info *tinfo, caddr_t *fhp, + bool_t get_pubfh, char *fspath, err_ret_t *error) + { diff --git a/illumos-nfs/debian/patches/nfs-mountd-compile-fslib.o.patch b/illumos-nfs/debian/patches/nfs-mountd-compile-fslib.o.patch new file mode 100644 index 0000000..d022b1b --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-mountd-compile-fslib.o.patch @@ -0,0 +1,23 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/mountd/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/mountd/Makefile 2013-09-28 00:11:41.106109295 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/mountd/Makefile 2013-09-28 00:15:37.960605624 +0400 +@@ -28,7 +28,7 @@ + + include ../../Makefile.fstype + +-COMMON = $(FSLIB) nfs_sec.o sharetab.o daemon.o smfcfg.o ++COMMON = fslib.o 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) +@@ -65,6 +65,9 @@ + smfcfg.o: ../lib/smfcfg.c + $(COMPILE.c) ../lib/smfcfg.c + ++fslib.o: ../../fslib.c ++ $(COMPILE.c) ../../fslib.c ++ + lint: + $(LINT.c) $(SRCS) $(LDLIBS) + diff --git a/illumos-nfs/debian/patches/nfs-mountd-dtrace-bitness.patch b/illumos-nfs/debian/patches/nfs-mountd-dtrace-bitness.patch new file mode 100644 index 0000000..59e71a0 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-mountd-dtrace-bitness.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/mountd/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/mountd/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/mountd/Makefile 2013-09-28 00:11:41.106109295 +0400 +@@ -49,7 +49,7 @@ + CERRWARN += -_gcc=-Wno-unused-function + + $(TYPEPROG): $(OBJS) +- $(COMPILE.d) -s $(DSRC) -o $(DOBJ) $(OBJS) ++ /usr/sbin/dtrace -xnolibs -G -s $(DSRC) -o $(DOBJ) $(OBJS) + $(LINK.c) -o $@ $(DOBJ) $(OBJS) $(LDLIBS) + $(POST_PROCESS) + diff --git a/illumos-nfs/debian/patches/nfs-nfsmapid.c.patch b/illumos-nfs/debian/patches/nfs-nfsmapid.c.patch new file mode 100644 index 0000000..6f63615 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-nfsmapid.c.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid.c 2013-09-28 00:40:52.544743475 +0400 +@@ -173,7 +173,7 @@ + * signals from main thread so that any subsequent threads + * don't receive said signals. + */ +- (void) thr_sigsetmask(NULL, NULL, &sigset); ++ (void) thr_sigsetmask(0, NULL, &sigset); + (void) sigaddset(&sigset, SIGHUP); + (void) sigaddset(&sigset, SIGTERM); + #ifdef DEBUG diff --git a/illumos-nfs/debian/patches/nfs-reparse-plugin.patch b/illumos-nfs/debian/patches/nfs-reparse-plugin.patch new file mode 100644 index 0000000..23aebec --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-reparse-plugin.patch @@ -0,0 +1,33 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/rp_basic/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/rp_basic/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/rp_basic/Makefile 2013-09-28 14:04:46.423994050 +0400 +@@ -24,8 +24,11 @@ + + include $(SRC)/lib/Makefile.lib + ++ifeq ($(DEB_HOST_ARCH_BITS),32) + SUBDIRS = $(MACH) +-$(BUILD64)SUBDIRS += $(MACH64) ++else ++SUBDIRS = $(MACH64) ++endif + + MSGFILES = libnfs_basic.c + POFILE = rp_basic.po +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com 2013-09-28 14:06:04.812508171 +0400 +@@ -33,8 +33,9 @@ + + lintcheck := SRCS = ../libnfs_basic.c ../../lib/ref_subr.c + +-ROOTLIBDIR = $(ROOT)/usr/lib/reparse +-ROOTLIBDIR64 = $(ROOT)/usr/lib/reparse/$(MACH64) ++# We do not build multilibs: ++ROOTLIBDIR = $(ROOT)/usr/lib/$(DEB_HOST_MULTIARCH)/reparse ++ROOTLIBDIR64 = $(ROOTLIBDIR) + + LIBSRCS = $(LIBOBJS:%.o=$(SRCDIR)/%.c) + diff --git a/illumos-nfs/debian/patches/nfs-server-ipfilter-is-optional.patch b/illumos-nfs/debian/patches/nfs-server-ipfilter-is-optional.patch new file mode 100644 index 0000000..6784c7b --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-server-ipfilter-is-optional.patch @@ -0,0 +1,30 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/svc/nfs-server +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/svc/nfs-server 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/svc/nfs-server 2013-09-29 01:45:08.442369050 +0400 +@@ -27,7 +27,13 @@ + # Start/stop processes required for server NFS + + . /lib/svc/share/smf_include.sh +-. /lib/svc/share/ipf_include.sh ++ ++ipf=/lib/svc/share/ipf_include.sh ++ ++if [ -r $ipf ]; then ++ . $ipf ++fi ++ + zone=`smf_zonename` + + # +@@ -139,6 +145,10 @@ + ;; + + 'ipfilter') ++ if ! [ -r $ipf ]; then ++ echo "ipfilter is not installer" ++ exit $SMF_EXIT_OK ++ fi + # + # NFS related services are RPC. nfs/server has nfsd which has + # well-defined port number but mountd is an RPC daemon. diff --git a/illumos-nfs/debian/patches/nfs-showmount.c.patch b/illumos-nfs/debian/patches/nfs-showmount.c.patch new file mode 100644 index 0000000..4628511 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-showmount.c.patch @@ -0,0 +1,12 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/showmount/showmount.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/showmount/showmount.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/showmount/showmount.c 2013-09-28 00:27:43.921632822 +0400 +@@ -42,6 +42,7 @@ + /* + * showmount + */ ++#include <stdlib.h> + #include <stdio.h> + #include <stdarg.h> + #include <rpc/rpc.h> diff --git a/illumos-nfs/debian/patches/nfs-statd-sm_proc.c.patch b/illumos-nfs/debian/patches/nfs-statd-sm_proc.c.patch new file mode 100644 index 0000000..410bf0d --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-statd-sm_proc.c.patch @@ -0,0 +1,48 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_proc.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_proc.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_proc.c 2013-09-27 17:51:30.834803315 +0400 +@@ -451,8 +451,8 @@ + } + + if (debug) +- (void) printf("add_mon(%x) %s (id=%d)\n", +- (int)new, new->id.mon_id.mon_name, * ((int *)new->id.priv)); ++ (void) printf("add_mon(%p) %s (id=%d)\n", ++ new, new->id.mon_id.mon_name, * ((int *)new->id.priv)); + + /* + * Record the name, and all addresses which have been registered +@@ -616,8 +616,8 @@ + my_idp->my_proc == nl_idp->my_proc) { + /* found */ + if (debug) +- (void) printf("delete_mon(%x): %s\n", +- (int)nl, mon_name ? ++ (void) printf("delete_mon(%p): %s\n", ++ nl, mon_name ? + mon_name : "<NULL>"); + /* + * Remove the monitor name from the +@@ -871,8 +871,8 @@ + } + (void) printf("*****monitor_q:\n "); + while (nl != (mon_entry *)NULL) { +- (void) printf("%s:(%x), ", +- nl->id.mon_id.mon_name, (int)nl); ++ (void) printf("%s:(%p), ", ++ nl->id.mon_id.mon_name, nl); + nl = nl->nxt; + } + mutex_unlock(&mon_table[hash].lock); +@@ -887,8 +887,8 @@ + } else { + (void) printf("*****monitor_q:\n "); + while (nl != (mon_entry *)NULL) { +- (void) printf("%s:(%x), ", +- nl->id.mon_id.mon_name, (int)nl); ++ (void) printf("%s:(%p), ", ++ nl->id.mon_id.mon_name, nl); + nl = nl->nxt; + } + (void) printf("\n"); diff --git a/illumos-nfs/debian/patches/nfs-statd-sm_statd.c.patch b/illumos-nfs/debian/patches/nfs-statd-sm_statd.c.patch new file mode 100644 index 0000000..ea18dff --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-statd-sm_statd.c.patch @@ -0,0 +1,22 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/statd/sm_statd.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/statd/sm_statd.c 2013-09-27 17:54:09.235269143 +0400 +@@ -1535,7 +1535,7 @@ + mutex_lock(&record_table[hash].lock); + nl = record_table[hash].sm_rechdp; + while (nl != (name_entry *)NULL) { +- (void) printf("(%x), ", (int)nl); ++ (void) printf("(%p), ", nl); + nl = nl->nxt; + } + mutex_unlock(&record_table[hash].lock); +@@ -1544,7 +1544,7 @@ + mutex_lock(&recov_q.lock); + nl = recov_q.sm_recovhdp; + while (nl != (name_entry *)NULL) { +- (void) printf("(%x), ", (int)nl); ++ (void) printf("(%p), ", nl); + nl = nl->nxt; + } + mutex_unlock(&recov_q.lock); diff --git a/illumos-nfs/debian/patches/nfs-umount-compile-fslib.o.patch b/illumos-nfs/debian/patches/nfs-umount-compile-fslib.o.patch new file mode 100644 index 0000000..f36712b --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-umount-compile-fslib.o.patch @@ -0,0 +1,22 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/umount/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/umount/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/umount/Makefile 2013-09-28 00:21:53.964605415 +0400 +@@ -32,7 +32,7 @@ + + include ../../Makefile.fstype + +-COMMON= $(FSLIB) replica.o ++COMMON= fslib.o replica.o + OBJS= $(LIBPROG).o $(COMMON) + SRCS= $(LIBPROG).c $(FSLIBSRC) ../lib/replica.c + +@@ -58,6 +58,8 @@ + sed "/^domain/d" messages.po > $@ + $(RM) messages.po $(POFILE).i + ++fslib.o: ../../fslib.c ++ $(COMPILE.c) ../../fslib.c + + $(LIBPROG): $(OBJS) + $(LINK.c) -o $@ $(OBJS) $(LDLIBS) diff --git a/illumos-nfs/debian/patches/nfs-use-system-rquota.x.patch b/illumos-nfs/debian/patches/nfs-use-system-rquota.x.patch new file mode 100644 index 0000000..c89fe51 --- /dev/null +++ b/illumos-nfs/debian/patches/nfs-use-system-rquota.x.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/rquotad/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/rquotad/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/rquotad/Makefile 2013-09-27 17:23:45.490439075 +0400 +@@ -31,7 +31,7 @@ + + OBJS= rpc.rquotad.o rquota_xdr.o + SRCS= $(OBJS:%.o=%.c) +-XFILE= $(ROOT)/usr/include/rpcsvc/rquota.x ++XFILE= /usr/include/rpcsvc/rquota.x + + CPPFLAGS += -D_LARGEFILE64_SOURCE + CERRWARN += -_gcc=-Wno-implicit-function-declaration diff --git a/illumos-nfs/debian/patches/nfs_tbind.c-integer-overflow.patch b/illumos-nfs/debian/patches/nfs_tbind.c-integer-overflow.patch new file mode 100644 index 0000000..7cd85dd --- /dev/null +++ b/illumos-nfs/debian/patches/nfs_tbind.c-integer-overflow.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c 2013-09-27 17:02:45.729764495 +0400 +@@ -1743,7 +1743,7 @@ + */ + /* LINTED pointer alignment */ + ((struct sockaddr_in *)mask->buf)->sin_addr.s_addr = +- (ulong_t)~0; ++ (uint32_t)~0; + /* LINTED pointer alignment */ + ((struct sockaddr_in *)mask->buf)->sin_family = + (ushort_t)~0; diff --git a/illumos-nfs/debian/patches/nfsd.c.patch b/illumos-nfs/debian/patches/nfsd.c.patch new file mode 100644 index 0000000..633a883 --- /dev/null +++ b/illumos-nfs/debian/patches/nfsd.c.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c 2013-09-27 16:57:58.383948444 +0400 +@@ -848,7 +848,7 @@ + /* now NULL out any duplicates */ + i = 0; j = 1; nskipped = 0; + while (j < npaths) { +- if (strcmp(pathnames[i], pathnames[j]) == NULL) { ++ if (strcmp(pathnames[i], pathnames[j]) == 0) { + pathnames[j] = NULL; + j++; + nskipped++; diff --git a/illumos-nfs/debian/patches/nfsmapid-dtrace.patch b/illumos-nfs/debian/patches/nfsmapid-dtrace.patch new file mode 100644 index 0000000..b0d2c63 --- /dev/null +++ b/illumos-nfs/debian/patches/nfsmapid-dtrace.patch @@ -0,0 +1,14 @@ +Description: avoid -32 or -64 flags +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile 2013-09-28 11:36:23.961618976 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile 2013-09-28 11:39:33.890851141 +0400 +@@ -46,7 +46,7 @@ + all: $(TYPEPROG) $(TESTPROG) + + $(TYPEPROG): $(OBJS) $(DSRC) +- $(COMPILE.d) -s $(DSRC) -o $(DOBJ) $(OBJS) ++ /usr/sbin/dtrace -xnolibs -G -s $(DSRC) -o $(DOBJ) $(OBJS) + $(LINK.c) $(ZIGNORE) -o $@ $(DOBJ) $(OBJS) $(LDLIBS) + $(POST_PROCESS) + diff --git a/illumos-nfs/debian/patches/nfsmapid-libmapid.patch b/illumos-nfs/debian/patches/nfsmapid-libmapid.patch new file mode 100644 index 0000000..e3e42ad --- /dev/null +++ b/illumos-nfs/debian/patches/nfsmapid-libmapid.patch @@ -0,0 +1,12 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/nfsmapid/Makefile 2013-09-28 11:36:23.961618976 +0400 +@@ -30,7 +30,6 @@ + + include ../../Makefile.fstype + +-LDLIBS += -L$(ROOT)/usr/lib/nfs -R/usr/lib/nfs + LDLIBS += -lnsl -lmapid -ldtrace -lidmap + COMMON = nfs_resolve.o + SRCS = nfsmapid.c ../lib/nfs_resolve.c nfsmapid_server.c diff --git a/illumos-nfs/debian/patches/nfsmapid-nfs_resolve.c.patch b/illumos-nfs/debian/patches/nfsmapid-nfs_resolve.c.patch new file mode 100644 index 0000000..2f47a99 --- /dev/null +++ b/illumos-nfs/debian/patches/nfsmapid-nfs_resolve.c.patch @@ -0,0 +1,32 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_resolve.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/nfs_resolve.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/nfs_resolve.c 2013-09-28 11:38:21.573113540 +0400 +@@ -299,11 +299,11 @@ + netdir_free((void *)retaddrs, ND_ADDRLIST); + if (port) { + /* LINTED pointer alignment */ +- if (strcmp(nconf->nc_protofmly, NC_INET) == NULL) ++ if (strcmp(nconf->nc_protofmly, NC_INET) == 0) + ((struct sockaddr_in *) + tbind->addr.buf)->sin_port = + htons((ushort_t)port); +- else if (strcmp(nconf->nc_protofmly, NC_INET6) == NULL) ++ else if (strcmp(nconf->nc_protofmly, NC_INET6) == 0) + ((struct sockaddr_in6 *) + tbind->addr.buf)->sin6_port = + htons((ushort_t)port); +@@ -317,11 +317,11 @@ + } else if (!file_handle) { + if (port) { + /* LINTED pointer alignment */ +- if (strcmp(nconf->nc_protofmly, NC_INET) == NULL) ++ if (strcmp(nconf->nc_protofmly, NC_INET) == 0) + ((struct sockaddr_in *) + tbind->addr.buf)->sin_port = + htons((ushort_t)port); +- else if (strcmp(nconf->nc_protofmly, NC_INET6) == NULL) ++ else if (strcmp(nconf->nc_protofmly, NC_INET6) == 0) + ((struct sockaddr_in6 *) + tbind->addr.buf)->sin6_port = + htons((ushort_t)port); diff --git a/illumos-nfs/debian/patches/nfsref-ref_subr.c.patch b/illumos-nfs/debian/patches/nfsref-ref_subr.c.patch new file mode 100644 index 0000000..d1841a4 --- /dev/null +++ b/illumos-nfs/debian/patches/nfsref-ref_subr.c.patch @@ -0,0 +1,13 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/lib/ref_subr.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/lib/ref_subr.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/lib/ref_subr.c 2013-09-28 13:32:05.412509741 +0400 +@@ -191,7 +191,7 @@ + bcopy(path, buf, slen); + buf[slen] = '\0'; + if (str_to_utf8(buf, &comp4[ncomp]) == NULL) +- return (NULL); ++ return (0); + } + + ncomp++; /* 1 valid component */ diff --git a/illumos-nfs/debian/patches/nfsstat.c-MIN.patch b/illumos-nfs/debian/patches/nfsstat.c-MIN.patch new file mode 100644 index 0000000..cde8a6e --- /dev/null +++ b/illumos-nfs/debian/patches/nfsstat.c-MIN.patch @@ -0,0 +1,14 @@ +Index: illumos-nfs/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c +=================================================================== +--- illumos-nfs.orig/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c 2012-10-08 04:25:23.000000000 +0400 ++++ illumos-nfs/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c 2013-09-27 22:45:21.383487320 +0400 +@@ -762,7 +762,9 @@ + } + } + ++#ifndef MIN + #define MIN(a, b) ((a) < (b) ? (a) : (b)) ++#endif + + static void + req_print(kstat_t *req, kstat_t *req_old, int ver, int field_width, diff --git a/illumos-nfs/debian/patches/series b/illumos-nfs/debian/patches/series new file mode 100644 index 0000000..766edfb --- /dev/null +++ b/illumos-nfs/debian/patches/series @@ -0,0 +1,25 @@ +nfsd.c.patch +nfs_tbind.c-integer-overflow.patch +nfs-lib-thrpool.c.patch +nfs-lib-smfcfg.c.patch +Makefile.fstype-install.patch +nfs-use-system-rquota.x.patch +nfs-statd-sm_proc.c.patch +nfs-statd-sm_statd.c.patch +nfsstat.c-MIN.patch +nfs-mountd-dtrace-bitness.patch +nfs-mountd-compile-fslib.o.patch +nfs-do-not-install-fstypes.patch +nfs-umount-compile-fslib.o.patch +nfs-showmount.c.patch +nfs-mount.patch +nfs-mount-compile-fslib.o.patch +nfs-nfsmapid.c.patch +nfsmapid-libmapid.patch +nfsmapid-nfs_resolve.c.patch +nfsmapid-dtrace.patch +nfsref-ref_subr.c.patch +nfs-reparse-plugin.patch +nfs-mount-no-etc.patch +nfs-server-ipfilter-is-optional.patch +illumos-195-lockd.patch diff --git a/illumos-nfs/debian/rules b/illumos-nfs/debian/rules new file mode 100755 index 0000000..5f9cf0c --- /dev/null +++ b/illumos-nfs/debian/rules @@ -0,0 +1,103 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/architecture.mk +export DH_VERBOSE = 1 + +cmd := fs.d/nfs + +mans := \ +usr/src/man/man1m/dfmounts_nfs.1m \ +usr/src/man/man1m/dfshares_nfs.1m \ +usr/src/man/man1m/mount_nfs.1m \ +usr/src/man/man1m/mountd.1m \ +usr/src/man/man1m/nfs4cbd.1m \ +usr/src/man/man1m/nfsd.1m \ +usr/src/man/man1m/nfslogd.1m \ +usr/src/man/man1m/nfsmapid.1m \ +usr/src/man/man1m/nfsstat.1m \ +usr/src/man/man1m/unshare_nfs.1m \ +usr/src/man/man4/nfs.4 \ +usr/src/man/man4/nfslog.conf.4 \ +usr/src/man/man4/nfssec.conf.4 \ +usr/src/man/man5/nfssec.5 + + +unpack: unpack-stamp +unpack-stamp: + dh_testdir + dh_illumos_gate --build \ + $(cmd:%=usr/src/cmd/%) \ + usr/src/cmd/stat/common \ + usr/src/cmd/fs.d/fslib.\* \ + usr/src/cmd/fs.d/Makefile.fstype + + dh_illumos_gate \ + usr/src/lib/Makefile.lib \ + usr/src/lib/Makefile.lib.64 \ + usr/src/lib/Makefile.targ \ + $(mans) + + # Not used and buggy: + echo > usr/src/Makefile.msg.targ + touch $@ + +patch: patch-stamp +patch-stamp: unpack-stamp + dh_testdir + [ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2 + touch $@ + +unpatch: + dh_testdir + [ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt pop -a -f || test $$? = 2 + rm -f patch-stamp + +dirs-stamp: + . usr/env.sh; mkdir -p \ + debian/tmp/etc/default \ + debian/tmp/lib/svc/manifest/network/nfs \ + debian/tmp/lib/svc/method \ + debian/tmp/usr/lib/fs/nfs \ + debian/tmp/usr/sbin \ + debian/tmp/usr/bin + touch $@ + +install install install-arch install-indep: install-stamp +install-stamp: build-stamp + touch $@ + +build build-arch build-indep: build-stamp +build-stamp: patch-stamp dirs-stamp + dh_illumos_make --native $(cmd:%=usr/src/cmd/%) + touch $@ + +binary binary-arch binary-indep: binary-stamp +binary-stamp: install-stamp + dh_testdir + dh_testroot + dh_installdirs + find debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/reparse -type l -print -delete + rm -f debian/tmp/etc/default/nfs + dh_install --fail-missing -Xrquota + dh_smf + dh_installman + dh_installdocs + dh_installexamples + dh_installchangelogs + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_strip + dh_gencontrol + dh_md5sums + dh_builddeb + touch $@ + +clean: unpatch + dh_testdir + dh_testroot + dh_clean + rm -rf usr .pc + diff --git a/illumos-nfs/debian/source/format b/illumos-nfs/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/illumos-nfs/debian/source/format @@ -0,0 +1 @@ +3.0 (native) |