}
#endif /* !UKERNEL */
-int
-mainproc(struct cmd_syndesc *as, void *arock)
+/**
+ * Check the command line and cacheinfo options.
+ *
+ * @param[in] as parsed command line arguments
+ *
+ * @note Invokes the shutdown syscall and exits with 0 when
+ * -shutdown is given.
+ */
+static int
+CheckOptions(struct cmd_syndesc *as)
{
afs_int32 code; /*Result of fork() */
#ifdef AFS_SUN5_ENV
if (code > 0) {
if (enable_rxbind)
code = code | 0x80000000;
- afsd_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
+ afsd_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
} else
printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
reason);
if (afsd_debug)
printf("%s: Calling AFSOP_GO with cacheSetTime = %d\n", rn,
0);
- afsd_syscall(AFSOP_GO, 0);
+ afsd_syscall(AFSOP_GO, 0);
/*
* At this point, we have finished passing the kernel all the info
{
struct cmd_syndesc *ts;
- ts = cmd_CreateSyntax(NULL, mainproc, NULL, 0, "start AFS");
+ ts = cmd_CreateSyntax(NULL, NULL, NULL, 0, "start AFS");
/* 0 - 10 */
cmd_AddParmAtOffset(ts, OPT_blocks, "-blocks", CMD_SINGLE,
"Set inode number calculation method");
}
+/**
+ * Parse and check the command line options.
+ *
+ * @note The -shutdown command is handled in CheckOptions().
+ */
int
afsd_parse(int argc, char **argv)
{
- return cmd_Dispatch(argc, argv);
+ struct cmd_syndesc *ts = NULL;
+ int code;
+
+ code = cmd_Parse(argc, argv, &ts);
+ if (code) {
+ return code;
+ }
+ code = CheckOptions(ts);
+ cmd_FreeOptions(&ts);
+ return code;
}
/**