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
This commit is contained in:
Chris Johns 2016-06-30 13:32:29 +10:00
parent 34f6271425
commit 761ae78e05
3 changed files with 21 additions and 16 deletions

View File

@ -132,7 +132,7 @@ rpcSetXIDs(uint32_t xid);
* @retval 0 on success, -1 on failure * @retval 0 on success, -1 on failure
*/ */
int int
rpcUdpInit(void); rpcUdpInit(bool verbose);
/** /**
* @brief RPC cleanup and stop. * @brief RPC cleanup and stop.
@ -167,7 +167,7 @@ rpcUdpCleanup(void);
* @retval -1 An error occurred. The errno is set to indicate the error. * @retval -1 An error occurred. The errno is set to indicate the error.
*/ */
int int
nfsInit(int smallPoolDepth, int bigPoolDepth); nfsInit(int smallPoolDepth, int bigPoolDepth, bool verbose);
/** /**
* @brief Driver cleanup code. * @brief Driver cleanup code.

View File

@ -1007,7 +1007,7 @@ NfsNode rval = nfsNodeCreate(node->nfs, 0);
* on the fly). * on the fly).
*/ */
int int
nfsInit(int smallPoolDepth, int bigPoolDepth) nfsInit(int smallPoolDepth, int bigPoolDepth, bool verbose)
{ {
static int initialised = 0; static int initialised = 0;
entry dummy; entry dummy;
@ -1018,10 +1018,11 @@ rtems_status_code status;
initialised = 1; initialised = 1;
if (verbose)
fprintf(stderr, fprintf(stderr,
"RTEMS-NFS $Release$, " \ "RTEMS-NFS, " \
"Till Straumann, Stanford/SLAC/SSRL 2002, " \ "Till Straumann, Stanford/SLAC/SSRL 2002, " \
"See LICENSE file for licensing info.\n"); "See LICENSE for licensing info.\n");
/* Get a major number */ /* Get a major number */
@ -1807,13 +1808,15 @@ NfsNode rootNode = 0;
RpcUdpServer nfsServer = 0; RpcUdpServer nfsServer = 0;
int e = -1; int e = -1;
char *path = mt_entry->dev; char *path = mt_entry->dev;
const char *options = (const char*) data;
bool verbose = strstr(options, "-v") != NULL;
if (rpcUdpInit () < 0) { if (rpcUdpInit (verbose) < 0) {
fprintf (stderr, "error: initialising RPC\n"); fprintf (stderr, "error: initialising RPC\n");
return -1; return -1;
} }
if (nfsInit(0, 0) != 0) { if (nfsInit(0, 0, verbose) != 0) {
fprintf (stderr, "error: initialising NFS\n"); fprintf (stderr, "error: initialising NFS\n");
return -1; return -1;
}; };

View File

@ -954,7 +954,7 @@ rpcSetXIDs(uint32_t xid)
} }
int int
rpcUdpInit(void) rpcUdpInit(bool verbose)
{ {
int s; int s;
rtems_status_code status; rtems_status_code status;
@ -962,9 +962,11 @@ int noblock = 1;
struct kevent change; struct kevent change;
if (ourSock < 0) { if (ourSock < 0) {
fprintf(stderr,"RTEMS-RPCIOD $Release$, " \
if (verbose)
fprintf(stderr,"RTEMS-RPCIOD, " \
"Till Straumann, Stanford/SLAC/SSRL 2002, " \ "Till Straumann, Stanford/SLAC/SSRL 2002, " \
"See LICENSE file for licensing info.\n"); "See LICENSE for licensing info.\n");
ourSock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ourSock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (ourSock>=0) { if (ourSock>=0) {