4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
29 * University Copyright- Copyright (c) 1982, 1986, 1988
30 * The Regents of the University of California
33 * University Acknowledgment- Portions of this document are derived from
34 * software developed by the University of California, Berkeley, and its
43 #include <sys/param.h>
44 #include <sys/types.h>
51 #include <sys/resource.h>
55 #include <nfs/nfs_acl.h>
56 #include <nfs/nfssys.h>
58 #include <stdio_ext.h>
61 #include <netconfig.h>
67 #include <sys/tihdr.h>
70 #include <priv_utils.h>
71 #include <sys/tiuser.h>
72 #include <netinet/tcp.h>
74 #include <rpcsvc/daemon_utils.h>
75 #include <rpcsvc/nfs4_prot.h>
76 #include <libnvpair.h>
79 #include "nfs_tbind.h"
83 /* quiesce requests will be ignored if nfs_server_vers_max < QUIESCE_VERSMIN */
84 #define QUIESCE_VERSMIN 4
85 /* DSS: distributed stable storage */
88 static int nfssvc(int, struct netbuf
, struct netconfig
*);
89 static int nfssvcpool(int maxservers
);
90 static int dss_init(uint_t npaths
, char **pathnames
);
91 static void dss_mkleafdirs(uint_t npaths
, char **pathnames
);
92 static void dss_mkleafdir(char *dir
, char *leaf
, char *path
);
93 static void usage(void);
94 int qstrcmp(const void *s1
, const void *s2
);
96 extern int _nfssys(int, void *);
98 extern int daemonize_init(void);
99 extern void daemonize_fini(int fd
);
101 /* signal handlers */
102 static void sigflush(int);
103 static void quiesce(int);
106 static NETSELDECL(defaultproviders
)[] = { "/dev/tcp6", "/dev/tcp", "/dev/udp",
108 /* static NETSELDECL(defaultprotos)[] = { NC_UDP, NC_TCP, NULL }; */
110 * The following are all globals used by routines in nfs_tbind.c.
112 size_t end_listen_fds
; /* used by conn_close_oldest() */
113 size_t num_fds
= 0; /* used by multiple routines */
114 int listen_backlog
= 32; /* used by bind_to_{provider,proto}() */
115 int num_servers
; /* used by cots_listen_event() */
116 int (*Mysvc
)(int, struct netbuf
, struct netconfig
*) = nfssvc
;
117 /* used by cots_listen_event() */
118 int max_conns_allowed
= -1; /* used by cots_listen_event() */
121 * Keep track of min/max versions of NFS protocol to be started.
122 * Start with the defaults (min == 2, max == 3). We have the
123 * capability of starting vers=4 but only if the user requests it.
125 int nfs_server_vers_min
= NFS_VERSMIN_DEFAULT
;
126 int nfs_server_vers_max
= NFS_VERSMAX_DEFAULT
;
129 * Set the default for server delegation enablement and set per
130 * /etc/default/nfs configuration (if present).
132 int nfs_server_delegation
= NFS_SERVER_DELEGATION_DEFAULT
;
135 main(int ac
, char *av
[])
141 int maxservers
= 1024; /* zero allows inifinte number of threads */
142 int maxservers_set
= 0;
143 int logmaxservers
= 0;
146 char *provider
= NULL
;
147 char *df_provider
= NULL
;
148 struct protob
*protobp0
, *protobp
;
149 NETSELDECL(proto
) = NULL
;
150 NETSELDECL(df_proto
) = NULL
;
151 NETSELPDECL(providerp
);
153 uint_t dss_npaths
= 0;
154 char **dss_pathnames
= NULL
;
156 char name
[PATH_MAX
], value
[PATH_MAX
];
164 * Initializations that require more privileges than we need to run.
166 (void) _create_daemon_lock(NFSD
, DAEMON_UID
, DAEMON_GID
);
169 if (__init_daemon_priv(PU_RESETGROUPS
|PU_CLEARLIMITSET
,
170 DAEMON_UID
, DAEMON_GID
, PRIV_SYS_NFS
, NULL
) == -1) {
171 (void) fprintf(stderr
, "%s should be run with"
172 " sufficient privileges\n", av
[0]);
176 (void) enable_extended_FILE_stdio(-1, -1);
179 * Read in the values from SMF first before we check
180 * command line options so the options override SMF values.
183 ret
= nfs_smf_get_prop("max_connections", value
, DEFAULT_INSTANCE
,
184 SCF_TYPE_INTEGER
, NFSD
, &bufsz
);
187 max_conns_allowed
= strtol(value
, (char **)NULL
, 10);
189 max_conns_allowed
= -1;
193 ret
= nfs_smf_get_prop("listen_backlog", value
, DEFAULT_INSTANCE
,
194 SCF_TYPE_INTEGER
, NFSD
, &bufsz
);
197 listen_backlog
= strtol(value
, (char **)NULL
, 10);
204 ret
= nfs_smf_get_prop("protocol", value
, DEFAULT_INSTANCE
,
205 SCF_TYPE_ASTRING
, NFSD
, &bufsz
);
206 if ((ret
== SA_OK
) && strlen(value
) > 0) {
207 df_proto
= strdup(value
);
209 if (strncasecmp("ALL", value
, 3) == 0) {
217 ret
= nfs_smf_get_prop("device", value
, DEFAULT_INSTANCE
,
218 SCF_TYPE_ASTRING
, NFSD
, &bufsz
);
219 if ((ret
== SA_OK
) && strlen(value
) > 0) {
220 df_provider
= strdup(value
);
225 ret
= nfs_smf_get_prop("servers", value
, DEFAULT_INSTANCE
,
226 SCF_TYPE_INTEGER
, NFSD
, &bufsz
);
229 maxservers
= strtol(value
, (char **)NULL
, 10);
237 ret
= nfs_smf_get_prop("server_versmin", value
, DEFAULT_INSTANCE
,
238 SCF_TYPE_INTEGER
, NFSD
, &bufsz
);
240 nfs_server_vers_min
= strtol(value
, (char **)NULL
, 10);
243 ret
= nfs_smf_get_prop("server_versmax", value
, DEFAULT_INSTANCE
,
244 SCF_TYPE_INTEGER
, NFSD
, &bufsz
);
246 nfs_server_vers_max
= strtol(value
, (char **)NULL
, 10);
249 ret
= nfs_smf_get_prop("server_delegation", value
, DEFAULT_INSTANCE
,
250 SCF_TYPE_ASTRING
, NFSD
, &bufsz
);
252 if (strncasecmp(value
, "off", 3) == 0)
253 nfs_server_delegation
= FALSE
;
256 * Conflict options error messages.
259 (void) fprintf(stderr
, "\nConflicting options, only one of "
260 "the following options can be specified\n"
263 "\tprotocol=protocol\n"
264 "\tdevice=devicename\n\n");
269 while ((i
= getopt(ac
, av
, "ac:p:s:t:l:")) != EOF
) {
282 max_conns_allowed
= atoi(optarg
);
292 * DSS: NFSv4 distributed stable storage.
294 * This is a Contracted Project Private interface, for
295 * the sole use of Sun Cluster HA-NFS. See PSARC/2006/313.
298 if (strlen(optarg
) < MAXPATHLEN
) {
299 /* first "-s" option encountered? */
300 if (dss_pathnames
== NULL
) {
302 * Allocate maximum possible space
303 * required given cmdline arg count;
304 * "-s <path>" consumes two args.
306 size_t sz
= (ac
/ 2) * sizeof (char *);
307 dss_pathnames
= (char **)malloc(sz
);
308 if (dss_pathnames
== NULL
) {
309 (void) fprintf(stderr
, "%s: "
310 "dss paths malloc failed\n",
314 (void) memset(dss_pathnames
, 0, sz
);
316 dss_pathnames
[dss_npaths
] = optarg
;
319 (void) fprintf(stderr
,
320 "%s: -s pathname too long.\n", av
[0]);
331 listen_backlog
= atoi(optarg
);
340 allflag
= df_allflag
;
343 if (provider
== NULL
)
344 provider
= df_provider
;
347 * Conflict options error messages.
350 (void) fprintf(stderr
, "\nConflicting options, only one of "
351 "the following options can be specified\n"
352 "on the command line:\n"
355 "\t-t transport\n\n");
360 strncasecmp(proto
, NC_UDP
, strlen(NC_UDP
)) == 0) {
361 if (nfs_server_vers_max
== NFS_V4
) {
362 if (nfs_server_vers_min
== NFS_V4
) {
364 "NFS version 4 is not supported "
365 "with the UDP protocol. Exiting\n");
369 "NFS version 4 is not supported "
370 "with the UDP protocol.\n");
376 * If there is exactly one more argument, it is the number of
379 if (optind
== ac
- 1) {
380 maxservers
= atoi(av
[optind
]);
384 * If there are two or more arguments, then this is a usage error.
386 else if (optind
< ac
- 1)
389 * Check the ranges for min/max version specified
391 else if ((nfs_server_vers_min
> nfs_server_vers_max
) ||
392 (nfs_server_vers_min
< NFS_VERSMIN
) ||
393 (nfs_server_vers_max
> NFS_VERSMAX
))
396 * There are no additional arguments, and we haven't set maxservers
397 * explicitly via the config file, we use a default number of
398 * servers. We will log this.
400 else if (maxservers_set
== 0)
404 * Basic Sanity checks on options
406 * max_conns_allowed must be positive, except for the special
407 * value of -1 which is used internally to mean unlimited, -1 isn't
408 * documented but we allow it anyway.
410 * maxservers must be positive
411 * listen_backlog must be positive or zero
413 if (((max_conns_allowed
!= -1) && (max_conns_allowed
<= 0)) ||
414 (listen_backlog
< 0) || (maxservers
<= 0)) {
419 * Set current dir to server root
421 if (chdir(dir
) < 0) {
422 (void) fprintf(stderr
, "%s: ", MyName
);
428 pipe_fd
= daemonize_init();
431 openlog(MyName
, LOG_PID
| LOG_NDELAY
, LOG_DAEMON
);
434 * establish our lock on the lock file and write our pid to it.
435 * exit if some other process holds the lock, or if there's any
436 * error in writing/locking the file.
438 pid
= _enter_daemon_lock(NFSD
);
443 fprintf(stderr
, "error locking for %s: %s\n", NFSD
,
447 /* daemon was already running */
452 * If we've been given a list of paths to be used for distributed
453 * stable storage, and provided we're going to run a version
454 * that supports it, setup the DSS paths.
456 if (dss_pathnames
!= NULL
&& nfs_server_vers_max
>= DSS_VERSMIN
) {
457 if (dss_init(dss_npaths
, dss_pathnames
) != 0) {
458 fprintf(stderr
, "%s", "dss_init failed. Exiting.\n");
464 * Block all signals till we spawn other
467 (void) sigfillset(&sgset
);
468 (void) thr_sigsetmask(SIG_BLOCK
, &sgset
, NULL
);
472 "Number of servers not specified. Using default of %d.\n",
477 * Make sure to unregister any previous versions in case the
478 * user is reconfiguring the server in interesting ways.
480 svc_unreg(NFS_PROGRAM
, NFS_VERSION
);
481 svc_unreg(NFS_PROGRAM
, NFS_V3
);
482 svc_unreg(NFS_PROGRAM
, NFS_V4
);
483 svc_unreg(NFS_ACL_PROGRAM
, NFS_ACL_V2
);
484 svc_unreg(NFS_ACL_PROGRAM
, NFS_ACL_V3
);
487 * Set up kernel RPC thread pool for the NFS server.
489 if (nfssvcpool(maxservers
)) {
490 fprintf(stderr
, "Can't set up kernel NFS service: %s. "
491 "Exiting.\n", strerror(errno
));
496 * Set up blocked thread to do LWP creation on behalf of the kernel.
498 if (svcwait(NFS_SVCPOOL_ID
)) {
499 fprintf(stderr
, "Can't set up NFS pool creator: %s. Exiting.\n",
505 * RDMA start and stop thread.
506 * Per pool RDMA listener creation and
509 * start rdma services and block in the kernel.
510 * (only if proto or provider is not set to TCP or UDP)
512 if ((proto
== NULL
) && (provider
== NULL
)) {
513 if (svcrdma(NFS_SVCPOOL_ID
, nfs_server_vers_min
,
514 nfs_server_vers_max
, nfs_server_delegation
)) {
516 "Can't set up RDMA creator thread : %s\n",
522 * Now open up for signal delivery
525 (void) thr_sigsetmask(SIG_UNBLOCK
, &sgset
, NULL
);
526 sigset(SIGTERM
, sigflush
);
527 sigset(SIGUSR1
, quiesce
);
530 * Build a protocol block list for registration.
532 protobp0
= protobp
= (struct protob
*)malloc(sizeof (struct protob
));
533 protobp
->serv
= "NFS";
534 protobp
->versmin
= nfs_server_vers_min
;
535 protobp
->versmax
= nfs_server_vers_max
;
536 protobp
->program
= NFS_PROGRAM
;
538 protobp
->next
= (struct protob
*)malloc(sizeof (struct protob
));
539 protobp
= protobp
->next
;
540 protobp
->serv
= "NFS_ACL"; /* not used */
541 protobp
->versmin
= nfs_server_vers_min
;
542 /* XXX - this needs work to get the version just right */
543 protobp
->versmax
= (nfs_server_vers_max
> NFS_ACL_V3
) ?
544 NFS_ACL_V3
: nfs_server_vers_max
;
545 protobp
->program
= NFS_ACL_PROGRAM
;
546 protobp
->next
= NULL
;
549 if (do_all(protobp0
, nfssvc
) == -1) {
550 fprintf(stderr
, "setnetconfig failed : %s\n",
555 /* there's more than one match for the same protocol */
556 struct netconfig
*nconf
;
558 bool_t protoFound
= FALSE
;
559 if ((nc
= setnetconfig()) == (NCONF_HANDLE
*) NULL
) {
560 fprintf(stderr
, "setnetconfig failed : %s\n",
564 while (nconf
= getnetconfig(nc
)) {
565 if (strcmp(nconf
->nc_proto
, proto
) == 0) {
567 do_one(nconf
->nc_device
, NULL
,
571 (void) endnetconfig(nc
);
572 if (protoFound
== FALSE
) {
574 "couldn't find netconfig entry for protocol %s\n",
578 do_one(provider
, proto
, protobp0
, nfssvc
);
580 for (providerp
= defaultproviders
;
581 *providerp
!= NULL
; providerp
++) {
582 provider
= *providerp
;
583 do_one(provider
, NULL
, protobp0
, nfssvc
);
592 fprintf(stderr
, "Could not start NFS service for any protocol."
597 end_listen_fds
= num_fds
;
600 * nfsd is up and running as far as we are concerned.
602 daemonize_fini(pipe_fd
);
605 * Get rid of unneeded privileges.
607 __fini_daemon_priv(PRIV_PROC_FORK
, PRIV_PROC_EXEC
, PRIV_PROC_SESSION
,
608 PRIV_FILE_LINK_ANY
, PRIV_PROC_INFO
, NULL
);
611 * Poll for non-data control events on the transport descriptors.
616 * If we get here, something failed in poll_for_action().
622 nfssvcpool(int maxservers
)
624 struct svcpool_args npa
;
626 npa
.id
= NFS_SVCPOOL_ID
;
627 npa
.maxthreads
= maxservers
;
632 npa
.max_same_xprt
= 0;
633 return (_nfssys(SVCPOOL_CREATE
, &npa
));
637 * Establish NFS service thread.
640 nfssvc(int fd
, struct netbuf addrmask
, struct netconfig
*nconf
)
642 struct nfs_svc_args nsa
;
645 nsa
.netid
= nconf
->nc_netid
;
646 nsa
.addrmask
= addrmask
;
647 if (strncasecmp(nconf
->nc_proto
, NC_UDP
, strlen(NC_UDP
)) == 0) {
648 nsa
.versmax
= (nfs_server_vers_max
> NFS_V3
) ?
649 NFS_V3
: nfs_server_vers_max
;
650 nsa
.versmin
= nfs_server_vers_min
;
652 * If no version left, silently do nothing, previous
653 * checks will have assured at least TCP is available.
655 if (nsa
.versmin
> nsa
.versmax
)
658 nsa
.versmax
= nfs_server_vers_max
;
659 nsa
.versmin
= nfs_server_vers_min
;
661 nsa
.delegation
= nfs_server_delegation
;
662 return (_nfssys(NFS_SVC
, &nsa
));
668 (void) fprintf(stderr
,
669 "usage: %s [ -a ] [ -c max_conns ] [ -p protocol ] [ -t transport ] ", MyName
);
670 (void) fprintf(stderr
, "\n[ -l listen_backlog ] [ nservers ]\n");
671 (void) fprintf(stderr
,
672 "\twhere -a causes <nservers> to be started on each appropriate transport,\n");
673 (void) fprintf(stderr
,
674 "\tmax_conns is the maximum number of concurrent connections allowed,\n");
675 (void) fprintf(stderr
, "\t\tand max_conns must be a decimal number");
676 (void) fprintf(stderr
, "> zero,\n");
677 (void) fprintf(stderr
, "\tprotocol is a protocol identifier,\n");
678 (void) fprintf(stderr
,
679 "\ttransport is a transport provider name (i.e. device),\n");
680 (void) fprintf(stderr
,
681 "\tlisten_backlog is the TCP listen backlog,\n");
682 (void) fprintf(stderr
,
683 "\tand <nservers> must be a decimal number > zero.\n");
688 * Issue nfssys system call to flush all logging buffers asynchronously.
690 * NOTICE: It is extremely important to flush NFS logging buffers when
691 * nfsd exits. When the system is halted or rebooted nfslogd
692 * may not have an opportunity to flush the buffers.
697 struct nfsl_flush_args nfa
;
699 memset(&nfa
, 0, sizeof (nfa
));
700 nfa
.version
= NFSL_FLUSH_ARGS_VERS
;
701 nfa
.directive
= NFSL_ALL
; /* flush all asynchronously */
703 if (_nfssys(LOG_FLUSH
, &nfa
) < 0)
704 syslog(LOG_ERR
, "_nfssys(LOG_FLUSH) failed: %s\n",
710 * Flush logging buffers and exit.
722 * Request that server quiesce, then (nfsd) exit. For subsequent warm start.
724 * This is a Contracted Project Private interface, for the sole use
725 * of Sun Cluster HA-NFS. See PSARC/2004/497.
727 * Equivalent to SIGTERM handler if nfs_server_vers_max < QUIESCE_VERSMIN.
733 int id
= NFS_SVCPOOL_ID
;
735 if (nfs_server_vers_max
>= QUIESCE_VERSMIN
) {
736 /* Request server quiesce at next shutdown */
737 error
= _nfssys(NFS4_SVC_REQUEST_QUIESCE
, &id
);
740 * ENOENT is returned if there is no matching SVC pool
741 * for the id. Possibly because the pool is not yet setup.
742 * In this case, just exit as if no error. For all other errors,
743 * just return and allow caller to retry.
745 if (error
&& errno
!= ENOENT
) {
747 "_nfssys(NFS4_SVC_REQUEST_QUIESCE) failed: %s",
753 /* Flush logging buffers */
760 * DSS: distributed stable storage.
761 * Create leaf directories as required, keeping an eye on path
762 * lengths. Calls exit(1) on failure.
763 * The pathnames passed in must already exist, and must be writeable by nfsd.
764 * Note: the leaf directories under NFS4_VAR_DIR are not created here;
765 * they're created at pkg install.
768 dss_mkleafdirs(uint_t npaths
, char **pathnames
)
771 char *tmppath
= NULL
;
774 * Create the temporary storage used by dss_mkleafdir() here,
775 * rather than in that function, so that it only needs to be
776 * done once, rather than once for each call. Too big to put
777 * on the function's stack.
779 tmppath
= (char *)malloc(MAXPATHLEN
);
780 if (tmppath
== NULL
) {
781 syslog(LOG_ERR
, "tmppath malloc failed. Exiting");
785 for (i
= 0; i
< npaths
; i
++) {
786 char *p
= pathnames
[i
];
788 dss_mkleafdir(p
, NFS4_DSS_STATE_LEAF
, tmppath
);
789 dss_mkleafdir(p
, NFS4_DSS_OLDSTATE_LEAF
, tmppath
);
796 * Create "leaf" in "dir" (which must already exist).
797 * leaf: should start with a '/'
800 dss_mkleafdir(char *dir
, char *leaf
, char *tmppath
)
802 /* MAXPATHLEN includes the terminating NUL */
803 if (strlen(dir
) + strlen(leaf
) > MAXPATHLEN
- 1) {
804 fprintf(stderr
, "stable storage path too long: %s%s. "
805 "Exiting.\n", dir
, leaf
);
809 (void) snprintf(tmppath
, MAXPATHLEN
, "%s/%s", dir
, leaf
);
811 /* the directory may already exist: that's OK */
812 if (mkdir(tmppath
, NFS4_DSS_DIR_MODE
) == -1 && errno
!= EEXIST
) {
813 fprintf(stderr
, "error creating stable storage directory: "
814 "%s: %s. Exiting.\n", strerror(errno
), tmppath
);
820 * Create the storage dirs, and pass the path list to the kernel.
821 * This requires the nfssrv module to be loaded; the _nfssys() syscall
822 * will fail ENOTSUP if it is not.
823 * Use libnvpair(3LIB) to pass the data to the kernel.
826 dss_init(uint_t npaths
, char **pathnames
)
828 int i
, j
, nskipped
, error
;
836 * We need to remove duplicate paths; this might be user error
837 * in the general case, but HA-NFSv4 can also cause this.
838 * Sort the pathnames array, and NULL out duplicates,
839 * then write the non-NULL entries to a new array.
840 * Sorting will also allow the kernel to optimise its searches.
843 qsort(pathnames
, npaths
, sizeof (char *), qstrcmp
);
845 /* now NULL out any duplicates */
846 i
= 0; j
= 1; nskipped
= 0;
848 if (strcmp(pathnames
[i
], pathnames
[j
]) == 0) {
855 /* skip i over any of its NULLed duplicates */
859 /* finally, write the non-NULL entries to a new array */
863 char **tmp_pathnames
;
865 nreal
= npaths
- nskipped
;
867 sz
= nreal
* sizeof (char *);
868 tmp_pathnames
= (char **)malloc(sz
);
869 if (tmp_pathnames
== NULL
) {
870 fprintf(stderr
, "tmp_pathnames malloc "
875 for (i
= 0, j
= 0; i
< npaths
; i
++)
876 if (pathnames
[i
] != NULL
)
877 tmp_pathnames
[j
++] = pathnames
[i
];
879 pathnames
= tmp_pathnames
;
885 /* Create directories to store the distributed state files */
886 dss_mkleafdirs(npaths
, pathnames
);
888 /* Create the name-value pair list */
889 error
= nvlist_alloc(&nvl
, NV_UNIQUE_NAME
, 0);
891 fprintf(stderr
, "nvlist_alloc failed: %s\n", strerror(errno
));
895 /* Add the pathnames array as a single name-value pair */
896 error
= nvlist_add_string_array(nvl
, NFS4_DSS_NVPAIR_NAME
,
899 fprintf(stderr
, "nvlist_add_string_array failed: %s\n",
906 * Pack list into contiguous memory, for passing to kernel.
907 * nvlist_pack() will allocate the memory for the buffer,
908 * which we should free() when no longer needed.
909 * NV_ENCODE_XDR for safety across ILP32/LP64 kernel boundary.
912 error
= nvlist_pack(nvl
, &bufp
, &buflen
, NV_ENCODE_XDR
, 0);
914 fprintf(stderr
, "nvlist_pack failed: %s\n", strerror(errno
));
919 /* Now we have the packed buffer, we no longer need the list */
923 * Let the kernel know in advance how big the buffer is.
924 * NOTE: we cannot just pass buflen, since size_t is a long, and
925 * thus a different size between ILP32 userland and LP64 kernel.
926 * Use an int for the transfer, since that should be big enough;
927 * this is a no-op at the moment, here, since nfsd is 32-bit, but
930 bufsize
= (uint32_t)buflen
;
931 error
= _nfssys(NFS4_DSS_SETPATHS_SIZE
, &bufsize
);
934 "_nfssys(NFS4_DSS_SETPATHS_SIZE) failed: %s\n",
940 /* Pass the packed buffer to the kernel */
941 error
= _nfssys(NFS4_DSS_SETPATHS
, bufp
);
944 "_nfssys(NFS4_DSS_SETPATHS) failed: %s\n", strerror(errno
));
950 * The kernel has now unpacked the buffer and extracted the
951 * pathnames array, we no longer need the buffer.
959 * Quick sort string compare routine, for qsort.
960 * Needed to make arg types correct.
963 qstrcmp(const void *p1
, const void *p2
)
965 char *s1
= *((char **)p1
);
966 char *s2
= *((char **)p2
);
968 return (strcmp(s1
, s2
));