mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Add a "-m" option to nfsstat, which dumps out the
actual options used by all NFS mounts. Works for the new/default NFS client only. Reviewed by: alfred MFC after: 2 weeks
This commit is contained in:
parent
99d2727d67
commit
a6c903b8d4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243783
@ -107,14 +107,36 @@ main(int argc, char **argv)
|
|||||||
int ch;
|
int ch;
|
||||||
char *memf, *nlistf;
|
char *memf, *nlistf;
|
||||||
char errbuf[_POSIX2_LINE_MAX];
|
char errbuf[_POSIX2_LINE_MAX];
|
||||||
|
int mntlen, i;
|
||||||
|
char buf[1024];
|
||||||
|
struct statfs *mntbuf;
|
||||||
|
struct nfscl_dumpmntopts dumpmntopts;
|
||||||
|
|
||||||
interval = 0;
|
interval = 0;
|
||||||
memf = nlistf = NULL;
|
memf = nlistf = NULL;
|
||||||
while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1)
|
while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'M':
|
case 'M':
|
||||||
memf = optarg;
|
memf = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
/* Display mount options for NFS mount points. */
|
||||||
|
mntlen = getmntinfo(&mntbuf, MNT_NOWAIT);
|
||||||
|
for (i = 0; i < mntlen; i++) {
|
||||||
|
if (strcmp(mntbuf->f_fstypename, "nfs") == 0) {
|
||||||
|
dumpmntopts.ndmnt_fname =
|
||||||
|
mntbuf->f_mntonname;
|
||||||
|
dumpmntopts.ndmnt_buf = buf;
|
||||||
|
dumpmntopts.ndmnt_blen = sizeof(buf);
|
||||||
|
if (nfssvc(NFSSVC_DUMPMNTOPTS,
|
||||||
|
&dumpmntopts) >= 0)
|
||||||
|
printf("%s on %s\n%s\n",
|
||||||
|
mntbuf->f_mntfromname,
|
||||||
|
mntbuf->f_mntonname, buf);
|
||||||
|
}
|
||||||
|
mntbuf++;
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
case 'N':
|
case 'N':
|
||||||
nlistf = optarg;
|
nlistf = optarg;
|
||||||
break;
|
break;
|
||||||
@ -646,7 +668,7 @@ void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n");
|
"usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user