--- usr.sbin/nfscbd/nfscbd.c.sav 2010-06-08 18:55:56.000000000 -0400 +++ usr.sbin/nfscbd/nfscbd.c 2010-07-23 19:20:46.000000000 -0400 @@ -105,6 +105,7 @@ 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 @@ } 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) { @@ -170,9 +185,8 @@ else strlcpy(princname, cp, sizeof (princname)); - } else { + } else warnx("client princ invalid. ignored\n"); - } break; default: case '?': --- usr.sbin/nfscbd/nfscbd.8.sav 2010-06-27 22:32:37.000000000 -0400 +++ usr.sbin/nfscbd/nfscbd.8 2010-06-27 22:37:15.000000000 -0400 @@ -33,6 +33,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 @@ -50,6 +51,15 @@ .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