Date: Sat, 29 Dec 2012 02:32:23 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r244808 - projects/nfsv4-packrats/usr.sbin/nfscbd Message-ID: <201212290232.qBT2WNcx054106@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sat Dec 29 02:32:22 2012 New Revision: 244808 URL: http://svnweb.freebsd.org/changeset/base/244808 Log: Add the packrats patch to the nfscbd daemon. Modified: projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.8 projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.c Modified: projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.8 ============================================================================== --- projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.8 Sat Dec 29 02:14:32 2012 (r244807) +++ projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.8 Sat Dec 29 02:32:22 2012 (r244808) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2009 +.Dd December 28, 2012 .Dt NFSCBD 8 .Os .Sh NAME @@ -34,6 +34,7 @@ client side callback daemon .Sh SYNOPSIS .Nm nfscbd +.Op Fl C Ar packrat_dirpath .Op Fl p Ar port_number .Op Fl P Ar client_principal .Sh DESCRIPTION @@ -51,6 +52,16 @@ are always started. .Pp The following options are available: .Bl -tag -width Ds +.It Fl C Ar packrat_dirpath +If this option is specified, it enables the packrat kernel threads that +create local cache copies of files for which the client has delegations +in the directory specified by the absolute pathname +.Cm packrat_dirpath . +This directory must be on local non-volatile storage. +The packrat kernel +threads will make local cache copies of delegated files up to the size +specified by nfscl_packratmaxsize when the NFSv4 server issues a delegation +to the client for the file. .It Fl p Ar port_number Specifies what port# the callback server should use. .It Fl P Ar client_principal Modified: projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.c ============================================================================== --- projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.c Sat Dec 29 02:14:32 2012 (r244807) +++ projects/nfsv4-packrats/usr.sbin/nfscbd/nfscbd.c Sat Dec 29 02:32:22 2012 (r244808) @@ -105,6 +105,7 @@ main(int argc, char *argv[]) int nfssvc_flag, on, sock, tcpsock, ret, mustfreeai = 0; char *cp, princname[128]; char myname[MAXHOSTNAMELEN], *myfqdnname = NULL; + char packrat_path[MAXPATHLEN]; struct addrinfo *aip, hints; pid_t pid; short myport = NFSV4_CBPORT; @@ -147,10 +148,24 @@ main(int argc, char *argv[]) } princname[0] = '\0'; -#define GETOPT "p:P:" -#define USAGE "[ -p port_num ] [ -P client_principal ]" +#define GETOPT "C:p:P:" +#define USAGE "[ -C packrat_path ] [ -p port_num ] [ -P client_principal ]" while ((ch = getopt(argc, argv, GETOPT)) != -1) switch (ch) { + case 'C': + if (optarg[0] != '/') + errx(1, "bad packrat path %s", optarg); + strlcpy(packrat_path, optarg, MAXPATHLEN); + len = strlen(packrat_path); + if (packrat_path[len - 1] != '/') { + /* Append trailing '/', as required. */ + if (len >= MAXPATHLEN - 1) + errx(1, "packrat path too long"); + packrat_path[len] = '/'; + packrat_path[len + 1] = '\0'; + } + (void) nfssvc(NFSSVC_PACKRAT, packrat_path); + break; case 'p': myport = atoi(optarg); if (myport < 1) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212290232.qBT2WNcx054106>