From 761ae78e0528ac5c1f46df11e9bea453ac6c82dd Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 30 Jun 2016 13:32:29 +1000 Subject: Make the license message viewable with a verbose option. The license details can be viewed if you mount with a -v option: # mount -i nfs -o "-v" 1.2.3.4:/mnt /mnt --- rtemsbsd/include/librtemsNfs.h | 4 ++-- rtemsbsd/nfsclient/nfs.c | 23 +++++++++++++---------- rtemsbsd/nfsclient/rpcio.c | 10 ++++++---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/rtemsbsd/include/librtemsNfs.h b/rtemsbsd/include/librtemsNfs.h index 530eee21..01aac389 100644 --- a/rtemsbsd/include/librtemsNfs.h +++ b/rtemsbsd/include/librtemsNfs.h @@ -132,7 +132,7 @@ rpcSetXIDs(uint32_t xid); * @retval 0 on success, -1 on failure */ int -rpcUdpInit(void); +rpcUdpInit(bool verbose); /** * @brief RPC cleanup and stop. @@ -167,7 +167,7 @@ rpcUdpCleanup(void); * @retval -1 An error occurred. The errno is set to indicate the error. */ int -nfsInit(int smallPoolDepth, int bigPoolDepth); +nfsInit(int smallPoolDepth, int bigPoolDepth, bool verbose); /** * @brief Driver cleanup code. diff --git a/rtemsbsd/nfsclient/nfs.c b/rtemsbsd/nfsclient/nfs.c index fae79b86..b68bab31 100644 --- a/rtemsbsd/nfsclient/nfs.c +++ b/rtemsbsd/nfsclient/nfs.c @@ -1007,7 +1007,7 @@ NfsNode rval = nfsNodeCreate(node->nfs, 0); * on the fly). */ int -nfsInit(int smallPoolDepth, int bigPoolDepth) +nfsInit(int smallPoolDepth, int bigPoolDepth, bool verbose) { static int initialised = 0; entry dummy; @@ -1018,10 +1018,11 @@ rtems_status_code status; initialised = 1; - fprintf(stderr, - "RTEMS-NFS $Release$, " \ - "Till Straumann, Stanford/SLAC/SSRL 2002, " \ - "See LICENSE file for licensing info.\n"); + if (verbose) + fprintf(stderr, + "RTEMS-NFS, " \ + "Till Straumann, Stanford/SLAC/SSRL 2002, " \ + "See LICENSE for licensing info.\n"); /* Get a major number */ @@ -1807,13 +1808,15 @@ NfsNode rootNode = 0; RpcUdpServer nfsServer = 0; int e = -1; char *path = mt_entry->dev; +const char *options = (const char*) data; +bool verbose = strstr(options, "-v") != NULL; - if (rpcUdpInit () < 0) { - fprintf (stderr, "error: initialising RPC\n"); - return -1; - } + if (rpcUdpInit (verbose) < 0) { + fprintf (stderr, "error: initialising RPC\n"); + return -1; + } - if (nfsInit(0, 0) != 0) { + if (nfsInit(0, 0, verbose) != 0) { fprintf (stderr, "error: initialising NFS\n"); return -1; }; diff --git a/rtemsbsd/nfsclient/rpcio.c b/rtemsbsd/nfsclient/rpcio.c index 6bc1aada..cd04de33 100644 --- a/rtemsbsd/nfsclient/rpcio.c +++ b/rtemsbsd/nfsclient/rpcio.c @@ -954,7 +954,7 @@ rpcSetXIDs(uint32_t xid) } int -rpcUdpInit(void) +rpcUdpInit(bool verbose) { int s; rtems_status_code status; @@ -962,9 +962,11 @@ int noblock = 1; struct kevent change; if (ourSock < 0) { - fprintf(stderr,"RTEMS-RPCIOD $Release$, " \ - "Till Straumann, Stanford/SLAC/SSRL 2002, " \ - "See LICENSE file for licensing info.\n"); + + if (verbose) + fprintf(stderr,"RTEMS-RPCIOD, " \ + "Till Straumann, Stanford/SLAC/SSRL 2002, " \ + "See LICENSE for licensing info.\n"); ourSock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (ourSock>=0) { -- cgit v1.2.3