From owner-svn-src-projects@FreeBSD.ORG Sat Dec 29 02:32:23 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8AF08478; Sat, 29 Dec 2012 02:32:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 715608FC0A; Sat, 29 Dec 2012 02:32:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBT2WNFA054109; Sat, 29 Dec 2012 02:32:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBT2WNcx054106; Sat, 29 Dec 2012 02:32:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212290232.qBT2WNcx054106@svn.freebsd.org> From: Rick Macklem Date: Sat, 29 Dec 2012 02:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r244808 - projects/nfsv4-packrats/usr.sbin/nfscbd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Dec 2012 02:32:23 -0000 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) {