int main(int argc, char **argv) { struct cmd_syndesc *ts; int err = 0; /* Initialize directory paths */ if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) { #ifdef AFS_NT40_ENV ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0); #endif fprintf(stderr, "%s: Unable to obtain AFS server directory.\n", argv[0]); exit(2); } ts = cmd_CreateSyntax("stats", OpStats, NULL, 0, "get salvageserver statistics (SALVSYNC_NOP opcode)"); COMMON_PARMS_DECL(ts); cmd_CreateAlias(ts, "nop"); ts = cmd_CreateSyntax("salvage", OpSalvage, NULL, 0, "schedule a salvage (SALVSYNC_SALVAGE opcode)"); SALV_PARMS_DECL(ts); ts = cmd_CreateSyntax("cancel", OpCancel, NULL, 0, "cancel a salvage (SALVSYNC_CANCEL opcode)"); SALV_PARMS_DECL(ts); ts = cmd_CreateSyntax("raiseprio", OpRaisePrio, NULL, 0, "raise a salvage priority (SALVSYNC_RAISEPRIO opcode)"); SALV_PARMS_DECL(ts); cmd_CreateAlias(ts, "rp"); ts = cmd_CreateSyntax("query", OpQuery, NULL, 0, "query salvage status (SALVSYNC_QUERY opcode)"); SALV_PARMS_DECL(ts); cmd_CreateAlias(ts, "qry"); ts = cmd_CreateSyntax("kill", OpCancelAll, NULL, 0, "cancel all scheduled salvages (SALVSYNC_CANCELALL opcode)"); COMMON_PARMS_DECL(ts); err = cmd_Dispatch(argc, argv); exit(err); }
int main(int argc, char **argv) { struct cmd_syndesc *ts; int err = 0; int i; extern char cml_version_number[]; /* Initialize directory paths */ if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) { #ifdef AFS_NT40_ENV ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0); #endif fprintf(stderr, "%s: Unable to obtain AFS server directory.\n", argv[0]); exit(2); } ts = cmd_CreateSyntax("online", VolOnline, NULL, "bring a volume online (FSYNC_VOL_ON opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("offline", VolOffline, NULL, "take a volume offline (FSYNC_VOL_OFF opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("mode", VolMode, NULL, "change volume attach mode (FSYNC_VOL_NEEDVOLUME opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "needvolume"); ts = cmd_CreateSyntax("detach", VolDetach, NULL, "detach a volume (FSYNC_VOL_DONE opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("callback", VolBreakCBKs, NULL, "break callbacks for volume (FSYNC_VOL_BREAKCBKS opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "cbk"); ts = cmd_CreateSyntax("move", VolMove, NULL, "set volume moved flag (FSYNC_VOL_MOVE opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("list", VolList, NULL, "sync local volume list (FSYNC_VOL_LISTVOLUMES opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "ls"); ts = cmd_CreateSyntax("leaveoff", VolLeaveOff, 0, "leave volume offline (FSYNC_VOL_LEAVE_OFF opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("attach", VolForceAttach, 0, "force full attachment (FSYNC_VOL_ATTACH opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("error", VolForceError, 0, "force into hard error state (FSYNC_VOL_FORCE_ERROR opcode)"); VOLOP_PARMS_DECL(ts); ts = cmd_CreateSyntax("query", VolQuery, NULL, "get volume structure (FSYNC_VOL_QUERY opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "qry"); ts = cmd_CreateSyntax("header", VolHdrQuery, NULL, "get volume disk data structure (FSYNC_VOL_QUERY_HDR opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "hdr"); ts = cmd_CreateSyntax("volop", VolOpQuery, NULL, "get pending volume operation info (FSYNC_VOL_QUERY_VOP opcode)"); VOLOP_PARMS_DECL(ts); cmd_CreateAlias(ts, "vop"); ts = cmd_CreateSyntax("vnode", VnQuery, NULL, "get vnode structure (FSYNC_VOL_QUERY_VNODE opcode)"); cmd_Seek(ts, CUSTOM_PARMS_OFFSET); cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id"); cmd_AddParm(ts, "-vnodeid", CMD_SINGLE, 0, "vnode id"); cmd_AddParm(ts, "-unique", CMD_SINGLE, 0, "uniquifier"); cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "paritition name"); COMMON_PARMS_DECL(ts); ts = cmd_CreateSyntax("stats", StatsQuery, NULL, "see 'stats help' for more information"); cmd_Seek(ts, CUSTOM_PARMS_OFFSET); cmd_AddParm(ts, "-cmd", CMD_SINGLE, 0, "subcommand"); cmd_AddParm(ts, "-arg1", CMD_SINGLE, CMD_OPTIONAL, "arg1"); cmd_AddParm(ts, "-arg2", CMD_SINGLE, CMD_OPTIONAL, "arg2"); COMMON_PARMS_DECL(ts); err = cmd_Dispatch(argc, argv); exit(err); }