2 * Copyright 2006-2010, Sine Nomine Associates and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /* Main program file. Define globals. */
14 * fssync administration tool
18 #include <afsconfig.h>
19 #include <afs/param.h>
24 #include <WINNT/afsevent.h>
28 #include <afs/afsint.h>
31 #include <afs/osi_inode.h>
36 #include <afs/afsutil.h>
37 #include <afs/fileutil.h>
45 #include "volume_inline.h"
46 #include "partition.h"
47 #include "daemon_com.h"
48 #include "daemon_com_inline.h"
50 #include "fssync_inline.h"
56 int VolumeChanged; /* hack to make dir package happy */
68 struct volop_state * vop;
71 #ifndef AFS_DEMAND_ATTACH_FS
72 /* remember argv/argc for later, if we need to re-exec */
73 static char **fssd_argv;
77 static int common_prolog(struct cmd_syndesc *, struct fssync_state *);
78 static int common_volop_prolog(struct cmd_syndesc *, struct fssync_state *);
80 static int do_volop(struct fssync_state *, afs_int32 command,
83 static int VolOnline(struct cmd_syndesc * as, void * rock);
84 static int VolOffline(struct cmd_syndesc * as, void * rock);
85 static int VolMode(struct cmd_syndesc * as, void * rock);
86 static int VolDetach(struct cmd_syndesc * as, void * rock);
87 static int VolBreakCBKs(struct cmd_syndesc * as, void * rock);
88 static int VolMove(struct cmd_syndesc * as, void * rock);
89 static int VolList(struct cmd_syndesc * as, void * rock);
90 static int VolLeaveOff(struct cmd_syndesc * as, void * rock);
91 static int VolForceAttach(struct cmd_syndesc * as, void * rock);
92 static int VolForceError(struct cmd_syndesc * as, void * rock);
93 static int VolQuery(struct cmd_syndesc * as, void * rock);
94 static int VolHdrQuery(struct cmd_syndesc * as, void * rock);
95 static int VolOpQuery(struct cmd_syndesc * as, void * rock);
96 static int StatsQuery(struct cmd_syndesc * as, void * rock);
97 static int VnQuery(struct cmd_syndesc * as, void * rock);
99 static int VGCQuery(struct cmd_syndesc * as, void * rock);
100 static int VGCAdd(struct cmd_syndesc * as, void * rock);
101 static int VGCDel(struct cmd_syndesc * as, void * rock);
102 static int VGCScan(struct cmd_syndesc * as, void * rock);
103 static int VGCScanAll(struct cmd_syndesc * as, void * rock);
105 static void print_vol_stats_general(VolPkgStats * stats);
106 static void print_vol_stats_viceP(struct DiskPartitionStats64 * stats);
107 static void print_vol_stats_hash(struct VolumeHashChainStats * stats);
108 #ifdef AFS_DEMAND_ATTACH_FS
109 static void print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats);
113 #include "AFS_component_version_number.c"
117 #define COMMON_PARMS_OFFSET 12
118 #define COMMON_PARMS(ts) \
119 cmd_Seek(ts, COMMON_PARMS_OFFSET); \
120 cmd_AddParm(ts, "-reason", CMD_SINGLE, CMD_OPTIONAL, "sync protocol reason code"); \
121 cmd_AddParm(ts, "-programtype", CMD_SINGLE, CMD_OPTIONAL, "program type code")
123 #define COMMON_VOLOP_PARMS_OFFSET 10
124 #define COMMON_VOLOP_PARMS(ts) \
125 cmd_Seek(ts, COMMON_VOLOP_PARMS_OFFSET); \
126 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id"); \
127 cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL, "partition name")
129 #define CUSTOM_PARMS_OFFSET 1
132 #define VOLOP_PARMS_DECL(ts) \
133 COMMON_VOLOP_PARMS(ts); \
135 #define COMMON_PARMS_DECL(ts) \
139 main(int argc, char **argv)
141 struct cmd_syndesc *ts;
144 /* Initialize directory paths */
145 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
147 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
149 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
154 #ifndef AFS_DEMAND_ATTACH_FS
159 ts = cmd_CreateSyntax("online", VolOnline, NULL, "bring a volume online (FSYNC_VOL_ON opcode)");
160 VOLOP_PARMS_DECL(ts);
162 ts = cmd_CreateSyntax("offline", VolOffline, NULL, "take a volume offline (FSYNC_VOL_OFF opcode)");
163 VOLOP_PARMS_DECL(ts);
165 ts = cmd_CreateSyntax("mode", VolMode, NULL, "change volume attach mode (FSYNC_VOL_NEEDVOLUME opcode)");
166 VOLOP_PARMS_DECL(ts);
167 cmd_CreateAlias(ts, "needvolume");
169 ts = cmd_CreateSyntax("detach", VolDetach, NULL, "detach a volume (FSYNC_VOL_DONE opcode)");
170 VOLOP_PARMS_DECL(ts);
172 ts = cmd_CreateSyntax("callback", VolBreakCBKs, NULL, "break callbacks for volume (FSYNC_VOL_BREAKCBKS opcode)");
173 VOLOP_PARMS_DECL(ts);
174 cmd_CreateAlias(ts, "cbk");
176 ts = cmd_CreateSyntax("move", VolMove, NULL, "set volume moved flag (FSYNC_VOL_MOVE opcode)");
177 VOLOP_PARMS_DECL(ts);
179 ts = cmd_CreateSyntax("list", VolList, NULL, "sync local volume list (FSYNC_VOL_LISTVOLUMES opcode)");
180 VOLOP_PARMS_DECL(ts);
181 cmd_CreateAlias(ts, "ls");
183 ts = cmd_CreateSyntax("leaveoff", VolLeaveOff, 0, "leave volume offline (FSYNC_VOL_LEAVE_OFF opcode)");
184 VOLOP_PARMS_DECL(ts);
186 ts = cmd_CreateSyntax("attach", VolForceAttach, 0, "force full attachment (FSYNC_VOL_ATTACH opcode)");
187 VOLOP_PARMS_DECL(ts);
189 ts = cmd_CreateSyntax("error", VolForceError, 0, "force into hard error state (FSYNC_VOL_FORCE_ERROR opcode)");
190 VOLOP_PARMS_DECL(ts);
192 ts = cmd_CreateSyntax("query", VolQuery, NULL, "get volume structure (FSYNC_VOL_QUERY opcode)");
193 VOLOP_PARMS_DECL(ts);
194 cmd_CreateAlias(ts, "qry");
196 ts = cmd_CreateSyntax("header", VolHdrQuery, NULL, "get volume disk data structure (FSYNC_VOL_QUERY_HDR opcode)");
197 VOLOP_PARMS_DECL(ts);
198 cmd_CreateAlias(ts, "hdr");
200 ts = cmd_CreateSyntax("volop", VolOpQuery, NULL, "get pending volume operation info (FSYNC_VOL_QUERY_VOP opcode)");
201 VOLOP_PARMS_DECL(ts);
202 cmd_CreateAlias(ts, "vop");
204 ts = cmd_CreateSyntax("vnode", VnQuery, NULL, "get vnode structure (FSYNC_VOL_QUERY_VNODE opcode)");
205 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
206 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id");
207 cmd_AddParm(ts, "-vnodeid", CMD_SINGLE, 0, "vnode id");
208 cmd_AddParm(ts, "-unique", CMD_SINGLE, 0, "uniquifier");
209 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
210 COMMON_PARMS_DECL(ts);
212 ts = cmd_CreateSyntax("stats", StatsQuery, NULL, "see 'stats help' for more information");
213 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
214 cmd_AddParm(ts, "-cmd", CMD_SINGLE, 0, "subcommand");
215 cmd_AddParm(ts, "-arg1", CMD_SINGLE, CMD_OPTIONAL, "arg1");
216 cmd_AddParm(ts, "-arg2", CMD_SINGLE, CMD_OPTIONAL, "arg2");
217 COMMON_PARMS_DECL(ts);
219 ts = cmd_CreateSyntax("vgcquery", VGCQuery, 0, "query volume group cache (FSYNC_VG_QUERY opcode)");
220 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
221 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
222 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id");
223 COMMON_PARMS_DECL(ts);
224 cmd_CreateAlias(ts, "vgcqry");
226 ts = cmd_CreateSyntax("vgcadd", VGCAdd, 0, "add entry to volume group cache (FSYNC_VG_ADD opcode)");
227 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
228 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
229 cmd_AddParm(ts, "-parent", CMD_SINGLE, 0, "parent volume id");
230 cmd_AddParm(ts, "-child", CMD_SINGLE, 0, "child volume id");
231 COMMON_PARMS_DECL(ts);
233 ts = cmd_CreateSyntax("vgcdel", VGCDel, 0, "delete entry from volume group cache (FSYNC_VG_DEL opcode)");
234 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
235 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
236 cmd_AddParm(ts, "-parent", CMD_SINGLE, 0, "parent volume id");
237 cmd_AddParm(ts, "-child", CMD_SINGLE, 0, "child volume id");
238 COMMON_PARMS_DECL(ts);
240 ts = cmd_CreateSyntax("vgcscan", VGCScan, 0,
241 "start volume group cache re-scan"
242 " (FSYNC_VG_SCAN opcode)");
243 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
244 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
245 COMMON_PARMS_DECL(ts);
247 ts = cmd_CreateSyntax("vgcscanall", VGCScanAll, 0,
248 "start whole-server volume group cache re-scan"
249 " (FSYNC_VG_SCAN_ALL opcode)");
250 COMMON_PARMS_DECL(ts);
252 err = cmd_Dispatch(argc, argv);
256 #ifdef AFS_DEMAND_ATTACH_FS
257 # define dafs_prolog()
259 /* Try to detect if the fileserver is DAFS, and if so, re-exec as the
260 * DAFS-enabled fssync-debug (dafssync_debug). If we fail to detect or
261 * exec, just try to proceed anyway as if the server is not DAFS */
266 SYNC_PROTO_BUF_DECL(res_buf);
270 res.payload.len = SYNC_PROTO_MAX_LEN;
271 res.payload.buf = res_buf;
273 /* LISTVOLUMES is a no-op; we just want to get the response header flags
274 * to see if the server reports itself as DAFS or not */
275 code = FSYNC_VolOp(0, NULL, FSYNC_VOL_LISTVOLUMES, FSYNC_WHATEVER, &res);
277 /* probably failed to contact the fileserver; later code will provide
278 * some warning/error indication */
282 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
283 /* fileserver is not DAFS, so we don't need to do anything */
287 dfssd = afs_exec_alt(fssd_argc, fssd_argv, "da", NULL);
289 fprintf(stderr, "\n*** server asserted demand attach extensions, but we failed\n"
290 "*** to exec a DAFS-enabled fssync-debug '%s' (errno=%d);\n"
291 "*** attempting to proceed without it.\n\n", dfssd, errno);
295 #endif /* !AFS_DEMAND_ATTACH_FS */
298 common_prolog(struct cmd_syndesc * as, struct fssync_state * state)
301 VolumePackageOptions opts;
304 if (afs_winsockInit() < 0) {
309 VOptDefaults(debugUtility, &opts);
310 if (VInitVolumePackage2(debugUtility, &opts)) {
311 /* VInitVolumePackage2 can fail on e.g. partition attachment errors,
312 * but we don't really care, since all we're doing is trying to use
314 fprintf(stderr, "errors encountered initializing volume package, but "
315 "trying to continue anyway\n");
319 if ((ti = as->parms[COMMON_PARMS_OFFSET].items)) { /* -reason */
320 state->reason = atoi(ti->data);
322 state->reason = FSYNC_WHATEVER;
325 if ((ti = as->parms[COMMON_PARMS_OFFSET+1].items)) { /* -programtype */
326 if (!strcmp(ti->data, "fileServer")) {
327 programType = fileServer;
328 } else if (!strcmp(ti->data, "volumeUtility")) {
329 programType = volumeUtility;
330 } else if (!strcmp(ti->data, "salvager")) {
331 programType = salvager;
332 } else if (!strcmp(ti->data, "salvageServer")) {
333 programType = salvageServer;
334 } else if (!strcmp(ti->data, "volumeServer")) {
335 programType = volumeServer;
336 } else if (!strcmp(ti->data, "volumeSalvager")) {
337 programType = volumeSalvager;
339 programType = (ProgramType) atoi(ti->data);
349 common_volop_prolog(struct cmd_syndesc * as, struct fssync_state * state)
353 state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
354 osi_Assert(state->vop != NULL);
356 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET].items)) { /* -volumeid */
357 state->vop->volume = atoi(ti->data);
359 fprintf(stderr, "required argument -volumeid not given\n");
362 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET+1].items)) { /* -partition */
363 strlcpy(state->vop->partName, ti->data, sizeof(state->vop->partName));
365 memset(state->vop->partName, 0, sizeof(state->vop->partName));
372 debug_response(afs_int32 code, SYNC_response * res)
379 fprintf(stderr, "warning: response code indicates possible protocol error.\n");
382 fprintf(stderr, "FSSYNC service returned %d (%s)\n", code, SYNC_res2string(code));
385 fprintf(stderr, "protocol header response code was %d (%s)\n",
386 res->hdr.response, SYNC_res2string(res->hdr.response));
387 fprintf(stderr, "protocol reason code was %d (%s)\n",
388 res->hdr.reason, FSYNC_reason2string(res->hdr.reason));
395 do_volop(struct fssync_state * state, afs_int32 command, SYNC_response * res)
398 SYNC_PROTO_BUF_DECL(res_buf);
403 res->payload.len = SYNC_PROTO_MAX_LEN;
404 res->payload.buf = res_buf;
407 fprintf(stderr, "calling FSYNC_VolOp with command code %d (%s)\n",
408 command, FSYNC_com2string(command));
410 code = FSYNC_VolOp(state->vop->volume,
411 state->vop->partName,
416 debug_response(code, res);
425 #define ENUMTOSTRING(en) #en
426 #define ENUMCASE(en) \
427 case en: return ENUMTOSTRING(en)
429 #define FLAGTOSTRING(fl) #fl
430 #define FLAGCASE(bitstr, fl, str, count) \
432 if ((bitstr) & (fl)) { \
434 strlcat((str), " | ", sizeof(str)); \
435 strlcat((str), FLAGTOSTRING(fl), sizeof(str)); \
441 VolOnline(struct cmd_syndesc * as, void * rock)
443 struct fssync_state state;
445 common_prolog(as, &state);
446 common_volop_prolog(as, &state);
448 do_volop(&state, FSYNC_VOL_ON, NULL);
454 VolOffline(struct cmd_syndesc * as, void * rock)
456 struct fssync_state state;
458 common_prolog(as, &state);
459 common_volop_prolog(as, &state);
461 do_volop(&state, FSYNC_VOL_OFF, NULL);
467 VolMode(struct cmd_syndesc * as, void * rock)
469 struct fssync_state state;
471 common_prolog(as, &state);
472 common_volop_prolog(as, &state);
474 do_volop(&state, FSYNC_VOL_NEEDVOLUME, NULL);
480 VolDetach(struct cmd_syndesc * as, void * rock)
482 struct fssync_state state;
484 common_prolog(as, &state);
485 common_volop_prolog(as, &state);
487 do_volop(&state, FSYNC_VOL_DONE, NULL);
493 VolBreakCBKs(struct cmd_syndesc * as, void * rock)
495 struct fssync_state state;
497 common_prolog(as, &state);
498 common_volop_prolog(as, &state);
500 do_volop(&state, FSYNC_VOL_BREAKCBKS, NULL);
506 VolMove(struct cmd_syndesc * as, void * rock)
508 struct fssync_state state;
510 common_prolog(as, &state);
511 common_volop_prolog(as, &state);
513 do_volop(&state, FSYNC_VOL_MOVE, NULL);
519 VolList(struct cmd_syndesc * as, void * rock)
521 struct fssync_state state;
523 common_prolog(as, &state);
524 common_volop_prolog(as, &state);
526 do_volop(&state, FSYNC_VOL_LISTVOLUMES, NULL);
532 VolLeaveOff(struct cmd_syndesc * as, void * rock)
534 struct fssync_state state;
536 common_prolog(as, &state);
537 common_volop_prolog(as, &state);
539 do_volop(&state, FSYNC_VOL_LEAVE_OFF, NULL);
545 VolForceAttach(struct cmd_syndesc * as, void * rock)
547 struct fssync_state state;
549 common_prolog(as, &state);
550 common_volop_prolog(as, &state);
552 do_volop(&state, FSYNC_VOL_ATTACH, NULL);
558 VolForceError(struct cmd_syndesc * as, void * rock)
560 struct fssync_state state;
562 common_prolog(as, &state);
563 common_volop_prolog(as, &state);
565 do_volop(&state, FSYNC_VOL_FORCE_ERROR, NULL);
570 #ifdef AFS_DEMAND_ATTACH_FS
572 vol_state_to_string(VolState state)
575 ENUMCASE(VOL_STATE_UNATTACHED);
576 ENUMCASE(VOL_STATE_PREATTACHED);
577 ENUMCASE(VOL_STATE_ATTACHING);
578 ENUMCASE(VOL_STATE_ATTACHED);
579 ENUMCASE(VOL_STATE_UPDATING);
580 ENUMCASE(VOL_STATE_GET_BITMAP);
581 ENUMCASE(VOL_STATE_HDR_LOADING);
582 ENUMCASE(VOL_STATE_HDR_ATTACHING);
583 ENUMCASE(VOL_STATE_SHUTTING_DOWN);
584 ENUMCASE(VOL_STATE_GOING_OFFLINE);
585 ENUMCASE(VOL_STATE_OFFLINING);
586 ENUMCASE(VOL_STATE_DETACHING);
587 ENUMCASE(VOL_STATE_SALVSYNC_REQ);
588 ENUMCASE(VOL_STATE_SALVAGING);
589 ENUMCASE(VOL_STATE_ERROR);
590 ENUMCASE(VOL_STATE_VNODE_ALLOC);
591 ENUMCASE(VOL_STATE_VNODE_GET);
592 ENUMCASE(VOL_STATE_VNODE_CLOSE);
593 ENUMCASE(VOL_STATE_VNODE_RELEASE);
594 ENUMCASE(VOL_STATE_VLRU_ADD);
595 ENUMCASE(VOL_STATE_DELETED);
596 ENUMCASE(VOL_STATE_SALVAGE_REQ);
597 ENUMCASE(VOL_STATE_FREED);
599 return "**UNKNOWN**";
604 vol_flags_to_string(afs_uint16 flags)
606 static char str[256];
610 FLAGCASE(flags, VOL_HDR_ATTACHED, str, count);
611 FLAGCASE(flags, VOL_HDR_LOADED, str, count);
612 FLAGCASE(flags, VOL_HDR_IN_LRU, str, count);
613 FLAGCASE(flags, VOL_IN_HASH, str, count);
614 FLAGCASE(flags, VOL_ON_VBYP_LIST, str, count);
615 FLAGCASE(flags, VOL_IS_BUSY, str, count);
616 FLAGCASE(flags, VOL_ON_VLRU, str, count);
617 FLAGCASE(flags, VOL_HDR_DONTSALV, str, count);
618 FLAGCASE(flags, VOL_LOCKED, str, count);
624 vlru_idx_to_string(int idx)
627 ENUMCASE(VLRU_QUEUE_NEW);
628 ENUMCASE(VLRU_QUEUE_MID);
629 ENUMCASE(VLRU_QUEUE_OLD);
630 ENUMCASE(VLRU_QUEUE_CANDIDATE);
631 ENUMCASE(VLRU_QUEUE_HELD);
632 ENUMCASE(VLRU_QUEUE_INVALID);
634 return "**UNKNOWN**";
640 vn_state_to_string(VnState state)
643 ENUMCASE(VN_STATE_INVALID);
644 ENUMCASE(VN_STATE_RELEASING);
645 ENUMCASE(VN_STATE_CLOSING);
646 ENUMCASE(VN_STATE_ALLOC);
647 ENUMCASE(VN_STATE_ONLINE);
648 ENUMCASE(VN_STATE_LOAD);
649 ENUMCASE(VN_STATE_EXCLUSIVE);
650 ENUMCASE(VN_STATE_STORE);
651 ENUMCASE(VN_STATE_READ);
652 ENUMCASE(VN_STATE_ERROR);
654 return "**UNKNOWN**";
659 vn_flags_to_string(afs_uint32 flags)
661 static char str[128];
665 FLAGCASE(flags, VN_ON_HASH, str, count);
666 FLAGCASE(flags, VN_ON_LRU, str, count);
667 FLAGCASE(flags, VN_ON_VVN, str, count);
674 VolQuery(struct cmd_syndesc * as, void * rock)
676 struct fssync_state state;
677 SYNC_PROTO_BUF_DECL(res_buf);
683 res.hdr.response_len = sizeof(res.hdr);
684 res.payload.buf = res_buf;
685 res.payload.len = SYNC_PROTO_MAX_LEN;
687 common_prolog(as, &state);
688 common_volop_prolog(as, &state);
690 do_volop(&state, FSYNC_VOL_QUERY, &res);
692 if (res.hdr.response == SYNC_OK) {
693 memcpy(&v, res.payload.buf, sizeof(Volume));
695 printf("volume = {\n");
696 printf("\thashid = %u\n", v.hashid);
697 printf("\theader = %p\n", v.header);
698 printf("\tdevice = %d\n", v.device);
699 printf("\tpartition = %p\n", v.partition);
700 printf("\tlinkHandle = %p\n", v.linkHandle);
701 printf("\tnextVnodeUnique = %u\n", v.nextVnodeUnique);
702 printf("\tdiskDataHandle = %p\n", v.diskDataHandle);
703 printf("\tvnodeHashOffset = %u\n", v.vnodeHashOffset);
704 printf("\tshuttingDown = %d\n", v.shuttingDown);
705 printf("\tgoingOffline = %d\n", v.goingOffline);
706 printf("\tcacheCheck = %u\n", v.cacheCheck);
707 printf("\tnUsers = %d\n", v.nUsers);
708 printf("\tneedsPutBack = %d\n", v.needsPutBack);
709 printf("\tspecialStatus = %d\n", v.specialStatus);
710 printf("\tupdateTime = %u\n", v.updateTime);
712 printf("\tvnodeIndex[vSmall] = {\n");
713 printf("\t\thandle = %p\n", v.vnodeIndex[vSmall].handle);
714 printf("\t\tbitmap = %p\n", v.vnodeIndex[vSmall].bitmap);
715 printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vSmall].bitmapSize);
716 printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vSmall].bitmapOffset);
718 printf("\tvnodeIndex[vLarge] = {\n");
719 printf("\t\thandle = %p\n", v.vnodeIndex[vLarge].handle);
720 printf("\t\tbitmap = %p\n", v.vnodeIndex[vLarge].bitmap);
721 printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vLarge].bitmapSize);
722 printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vLarge].bitmapOffset);
724 #ifdef AFS_DEMAND_ATTACH_FS
725 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
726 printf("\tupdateTime = %u\n", v.updateTime);
727 printf("\tattach_state = %s\n", vol_state_to_string(v.attach_state));
728 printf("\tattach_flags = %s\n", vol_flags_to_string(v.attach_flags));
729 printf("\tnWaiters = %d\n", v.nWaiters);
730 printf("\tchainCacheCheck = %d\n", v.chainCacheCheck);
732 /* online salvage structure */
733 printf("\tsalvage = {\n");
734 printf("\t\tprio = %u\n", v.salvage.prio);
735 printf("\t\treason = %d\n", v.salvage.reason);
736 printf("\t\trequested = %d\n", v.salvage.requested);
737 printf("\t\tscheduled = %d\n", v.salvage.scheduled);
740 /* statistics structure */
741 printf("\tstats = {\n");
743 printf("\t\thash_lookups = %"AFS_INT64_FMT"\n",
744 v.stats.hash_lookups);
745 printf("\t\thash_short_circuits = %"AFS_INT64_FMT"\n",
746 v.stats.hash_short_circuits);
747 printf("\t\thdr_loads = %"AFS_INT64_FMT"\n",
749 printf("\t\thdr_gets = %"AFS_INT64_FMT"\n",
753 printf("\t\tattaches = %u\n", v.stats.attaches);
754 printf("\t\tsoft_detaches = %u\n", v.stats.soft_detaches);
755 printf("\t\tsalvages = %u\n", v.stats.salvages);
756 printf("\t\tvol_ops = %u\n", v.stats.vol_ops);
758 printf("\t\tlast_attach = %u\n", v.stats.last_attach);
759 printf("\t\tlast_get = %u\n", v.stats.last_get);
760 printf("\t\tlast_promote = %u\n", v.stats.last_promote);
761 printf("\t\tlast_hdr_get = %u\n", v.stats.last_hdr_get);
762 printf("\t\tlast_hdr_load = %u\n", v.stats.last_hdr_load);
763 printf("\t\tlast_salvage = %u\n", v.stats.last_salvage);
764 printf("\t\tlast_salvage_req = %u\n", v.stats.last_salvage_req);
765 printf("\t\tlast_vol_op = %u\n", v.stats.last_vol_op);
769 printf("\tvlru = {\n");
770 printf("\t\tidx = %d (%s)\n",
771 v.vlru.idx, vlru_idx_to_string(v.vlru.idx));
774 /* volume op state */
775 printf("\tpending_vol_op = %p\n", v.pending_vol_op);
777 #else /* !AFS_DEMAND_ATTACH_FS */
778 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
779 printf("*** server asserted demand attach extensions. this fssync-debug\n"
780 "*** is not built to recognize those extensions. please use an\n"
781 "*** fssync-debug with demand attach if you need to dump dafs\n"
782 "*** extended state.\n");
784 #endif /* !AFS_DEMAND_ATTACH_FS */
792 VolHdrQuery(struct cmd_syndesc * as, void * rock)
794 struct fssync_state state;
795 SYNC_PROTO_BUF_DECL(res_buf);
800 res.hdr.response_len = sizeof(res.hdr);
801 res.payload.buf = res_buf;
802 res.payload.len = SYNC_PROTO_MAX_LEN;
804 common_prolog(as, &state);
805 common_volop_prolog(as, &state);
807 do_volop(&state, FSYNC_VOL_QUERY_HDR, &res);
809 if (res.hdr.response == SYNC_OK) {
810 memcpy(&v, res.payload.buf, sizeof(VolumeDiskData));
812 printf("VolumeDiskData = {\n");
813 printf("\tstamp = {\n");
814 printf("\t\tmagic = 0x%x\n", v.stamp.magic);
815 printf("\t\tversion = %u\n", v.stamp.version);
818 printf("\tid = %u\n", v.id);
819 printf("\tname = '%s'\n", v.name);
821 printf("\tinUse = %d (%s)\n", v.inUse, VPTypeToString(v.inUse));
823 printf("\tinUse = %d (no)\n", v.inUse);
825 printf("\tinService = %d\n", v.inService);
826 printf("\tblessed = %d\n", v.blessed);
827 printf("\tneedsSalvaged = %d\n", v.needsSalvaged);
828 printf("\tuniquifier = %u\n", v.uniquifier);
829 printf("\ttype = %d\n", v.type);
830 printf("\tparentId = %u\n", v.parentId);
831 printf("\tcloneId = %u\n", v.cloneId);
832 printf("\tbackupId = %u\n", v.backupId);
833 printf("\trestoredFromId = %u\n", v.restoredFromId);
834 printf("\tneedsCallback = %d\n", v.needsCallback);
835 printf("\tdestroyMe = %d\n", v.destroyMe);
836 printf("\tdontSalvage = %d\n", v.dontSalvage);
837 printf("\tmaxquota = %d\n", v.maxquota);
838 printf("\tminquota = %d\n", v.minquota);
839 printf("\tmaxfiles = %d\n", v.maxfiles);
840 printf("\taccountNumber = %u\n", v.accountNumber);
841 printf("\towner = %u\n", v.owner);
842 printf("\tfilecount = %d\n", v.filecount);
843 printf("\tdiskused = %d\n", v.diskused);
844 printf("\tdayUse = %d\n", v.dayUse);
845 for (i = 0; i < 7; i++) {
846 printf("\tweekUse[%d] = %d\n", i, v.weekUse[i]);
848 printf("\tdayUseDate = %u\n", v.dayUseDate);
849 printf("\tcreationDate = %u\n", v.creationDate);
850 printf("\taccessDate = %u\n", v.accessDate);
851 printf("\tupdateDate = %u\n", v.updateDate);
852 printf("\texpirationDate = %u\n", v.expirationDate);
853 printf("\tbackupDate = %u\n", v.backupDate);
854 printf("\tcopyDate = %u\n", v.copyDate);
855 #ifdef OPENAFS_VOL_STATS
856 printf("\tstat_initialized = %d\n", v.stat_initialized);
858 printf("\tmtd = '%s'\n", v.motd);
867 VolOpQuery(struct cmd_syndesc * as, void * rock)
869 struct fssync_state state;
870 SYNC_PROTO_BUF_DECL(res_buf);
872 FSSYNC_VolOp_info vop;
874 res.hdr.response_len = sizeof(res.hdr);
875 res.payload.buf = res_buf;
876 res.payload.len = SYNC_PROTO_MAX_LEN;
878 common_prolog(as, &state);
879 common_volop_prolog(as, &state);
881 do_volop(&state, FSYNC_VOL_QUERY_VOP, &res);
883 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
884 printf("*** file server not compiled with demand attach extensions.\n");
885 printf("*** pending volume operation metadata not available.\n");
888 if (res.hdr.response == SYNC_OK) {
889 memcpy(&vop, res.payload.buf, sizeof(FSSYNC_VolOp_info));
891 printf("pending_vol_op = {\n");
893 printf("\tcom = {\n");
894 printf("\t\tproto_version = %u\n", vop.com.proto_version);
895 printf("\t\tpkt_seq = %u\n", vop.com.pkt_seq);
896 printf("\t\tcom_seq = %u\n", vop.com.com_seq);
897 printf("\t\tprogramType = %d (%s)\n",
898 vop.com.programType, VPTypeToString(vop.com.programType));
899 printf("\t\tpid = %d\n", vop.com.pid);
900 printf("\t\ttid = %d\n", vop.com.tid);
901 printf("\t\tcommand = %d (%s)\n",
902 vop.com.command, FSYNC_com2string(vop.com.command));
903 printf("\t\treason = %d (%s)\n",
904 vop.com.reason, FSYNC_reason2string(vop.com.reason));
905 printf("\t\tcommand_len = %u\n", vop.com.command_len);
906 printf("\t\tflags = 0x%lux\n", afs_printable_uint32_lu(vop.com.flags));
909 printf("\tvop = {\n");
910 printf("\t\tvolume = %u\n", vop.vop.volume);
911 if (strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
912 sizeof(vop.vop.partName)) {
913 printf("\t\tpartName = '%s'\n", vop.vop.partName);
915 printf("\t\tpartName = (illegal string)\n");
926 vn_prolog(struct cmd_syndesc * as, struct fssync_state * state)
930 state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
931 osi_Assert(state->vop != NULL);
933 if ((ti = as->parms[CUSTOM_PARMS_OFFSET].items)) { /* -volumeid */
934 state->vop->volume = atoi(ti->data);
936 fprintf(stderr, "required argument -volumeid not given\n");
939 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -vnodeid */
940 state->vop->vnode = atoi(ti->data);
942 fprintf(stderr, "required argument -vnodeid not given\n");
945 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -unique */
946 state->vop->unique = atoi(ti->data);
948 state->vop->unique = 0;
951 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET+3].items)) { /* -partition */
952 strlcpy(state->vop->partName, ti->data, sizeof(state->vop->partName));
954 memset(state->vop->partName, 0, sizeof(state->vop->partName));
961 do_vnqry(struct fssync_state * state, SYNC_response * res)
964 int command = FSYNC_VOL_QUERY_VNODE;
965 FSSYNC_VnQry_hdr qry;
967 qry.volume = state->vop->volume;
968 qry.vnode = state->vop->vnode;
969 qry.unique = state->vop->unique;
971 strlcpy(qry.partName, state->vop->partName, sizeof(qry.partName));
973 fprintf(stderr, "calling FSYNC_GenericOp with command code %d (%s)\n",
974 command, FSYNC_com2string(command));
976 code = FSYNC_GenericOp(&qry, sizeof(qry), command, FSYNC_OPERATOR, res);
978 debug_response(code, res);
986 VnQuery(struct cmd_syndesc * as, void * rock)
988 struct fssync_state state;
989 SYNC_PROTO_BUF_DECL(res_buf);
995 res.hdr.response_len = sizeof(res.hdr);
996 res.payload.buf = res_buf;
997 res.payload.len = SYNC_PROTO_MAX_LEN;
999 common_prolog(as, &state);
1000 vn_prolog(as, &state);
1002 do_vnqry(&state, &res);
1004 if (res.hdr.response == SYNC_OK) {
1005 memcpy(&v, res.payload.buf, sizeof(Vnode));
1007 printf("vnode = {\n");
1009 printf("\tvid_hash = {\n");
1010 printf("\t\tnext = %p\n", v.vid_hash.next);
1011 printf("\t\tprev = %p\n", v.vid_hash.prev);
1014 printf("\thashNext = %p\n", v.hashNext);
1015 printf("\tlruNext = %p\n", v.lruNext);
1016 printf("\tlruPrev = %p\n", v.lruPrev);
1017 printf("\thashIndex = %hu\n", v.hashIndex);
1018 printf("\tchanged_newTime = %u\n", (unsigned int) v.changed_newTime);
1019 printf("\tchanged_oldTime = %u\n", (unsigned int) v.changed_oldTime);
1020 printf("\tdelete = %u\n", (unsigned int) v.delete);
1021 printf("\tvnodeNumber = %u\n", v.vnodeNumber);
1022 printf("\tvolumePtr = %p\n", v.volumePtr);
1023 printf("\tnUsers = %u\n", v.nUsers);
1024 printf("\tcacheCheck = %u\n", v.cacheCheck);
1026 #ifdef AFS_DEMAND_ATTACH_FS
1027 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
1028 printf("*** this fssync-debug is built to expect demand attach extensions.\n"
1029 "*** server asserted that is was not compiled with demand attach.\n"
1030 "*** please use an fssync-debug without demand attach to match your\n"
1035 printf("\tnReaders = %u\n", v.nReaders);
1036 printf("\tvn_state_flags = %s\n", vn_flags_to_string(v.vn_state_flags));
1037 printf("\tvn_state = %s\n", vn_state_to_string(v.vn_state));
1039 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
1040 printf("*** server asserted demand attach extensions. this fssync-debug is not\n"
1041 "*** built to recognize those extensions. please use an fssync-debug\n"
1042 "*** with demand attach to match your server.\n");
1045 #endif /* !AFS_DEMAND_ATTACH_FS */
1047 printf("\tvcp = %p\n", v.vcp);
1048 printf("\thandle = %p\n", v.handle);
1050 printf("\tdisk = {\n");
1051 printf("\t\ttype = %u\n", v.disk.type);
1052 printf("\t\tcloned = %u\n", v.disk.cloned);
1053 printf("\t\tmodeBits = %u\n", v.disk.modeBits);
1054 printf("\t\tlinkCount = %d\n", v.disk.linkCount);
1055 printf("\t\tlength = %u\n", v.disk.length);
1056 printf("\t\tuniquifier = %u\n", v.disk.uniquifier);
1057 printf("\t\tdataVersion = %u\n", v.disk.dataVersion);
1058 printf("\t\tvn_ino_lo = %u\n", v.disk.vn_ino_lo);
1059 printf("\t\tunixModifyTime = %u\n", v.disk.unixModifyTime);
1060 printf("\t\tauthor = %u\n", v.disk.author);
1061 printf("\t\towner = %u\n", v.disk.owner);
1062 printf("\t\tparent = %u\n", v.disk.parent);
1063 printf("\t\tvnodeMagic = %u\n", v.disk.vnodeMagic);
1065 printf("\t\tlock = {\n");
1066 printf("\t\t\tlockCount = %d\n", v.disk.lock.lockCount);
1067 printf("\t\t\tlockTime = %d\n", v.disk.lock.lockTime);
1070 printf("\t\tserverModifyTime = %u\n", v.disk.serverModifyTime);
1071 printf("\t\tgroup = %d\n", v.disk.group);
1072 printf("\t\tvn_ino_hi = %d\n", v.disk.vn_ino_hi);
1073 printf("\t\tvn_length_hi = %u\n", v.disk.vn_length_hi);
1085 StatsQuery(struct cmd_syndesc * as, void * rock)
1089 struct cmd_item *ti;
1090 struct fssync_state state;
1091 SYNC_PROTO_BUF_DECL(res_buf);
1093 FSSYNC_StatsOp_hdr scom;
1095 res.hdr.response_len = sizeof(res.hdr);
1096 res.payload.buf = res_buf;
1097 res.payload.len = SYNC_PROTO_MAX_LEN;
1099 if ((ti = as->parms[CUSTOM_PARMS_OFFSET].items)) { /* -subcommand */
1100 if (!strcasecmp(ti->data, "vicep")) {
1101 command = FSYNC_VOL_STATS_VICEP;
1102 } else if (!strcasecmp(ti->data, "hash")) {
1103 command = FSYNC_VOL_STATS_HASH;
1104 #ifdef AFS_DEMAND_ATTACH_FS
1105 } else if (!strcasecmp(ti->data, "hdr")) {
1106 command = FSYNC_VOL_STATS_HDR;
1107 } else if (!strcasecmp(ti->data, "vlru")) {
1108 command = FSYNC_VOL_STATS_VLRU;
1110 } else if (!strcasecmp(ti->data, "pkg")) {
1111 command = FSYNC_VOL_STATS_GENERAL;
1112 } else if (!strcasecmp(ti->data, "help")) {
1113 fprintf(stderr, "fssync-debug stats subcommands:\n");
1114 fprintf(stderr, "\tpkg\tgeneral volume package stats\n");
1115 fprintf(stderr, "\tvicep\tvice partition stats\n");
1116 fprintf(stderr, "\thash\tvolume hash chain stats\n");
1117 #ifdef AFS_DEMAND_ATTACH_FS
1118 fprintf(stderr, "\thdr\tvolume header cache stats\n");
1119 fprintf(stderr, "\tvlru\tvlru generation stats\n");
1123 fprintf(stderr, "invalid stats subcommand");
1127 command = FSYNC_VOL_STATS_GENERAL;
1130 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -arg1 */
1132 case FSYNC_VOL_STATS_VICEP:
1133 strlcpy(scom.args.partName, ti->data, sizeof(state.vop->partName));
1135 case FSYNC_VOL_STATS_HASH:
1136 scom.args.hash_bucket = atoi(ti->data);
1138 case FSYNC_VOL_STATS_VLRU:
1139 scom.args.vlru_generation = atoi(ti->data);
1142 fprintf(stderr, "unrecognized arguments\n");
1147 case FSYNC_VOL_STATS_VICEP:
1148 case FSYNC_VOL_STATS_HASH:
1149 case FSYNC_VOL_STATS_VLRU:
1150 fprintf(stderr, "this subcommand requires more parameters\n");
1155 common_prolog(as, &state);
1157 fprintf(stderr, "calling FSYNC_askfs with command code %d (%s)\n",
1158 command, FSYNC_com2string(command));
1160 code = FSYNC_StatsOp(&scom, command, FSYNC_WHATEVER, &res);
1167 fprintf(stderr, "possible sync protocol error. return code was %d\n", code);
1170 fprintf(stderr, "FSYNC_VolOp returned %d (%s)\n", code, SYNC_res2string(code));
1171 fprintf(stderr, "protocol response code was %d (%s)\n",
1172 res.hdr.response, SYNC_res2string(res.hdr.response));
1173 fprintf(stderr, "protocol reason code was %d (%s)\n",
1174 res.hdr.reason, FSYNC_reason2string(res.hdr.reason));
1178 if (res.hdr.response == SYNC_OK) {
1180 case FSYNC_VOL_STATS_GENERAL:
1182 struct VolPkgStats vol_stats;
1183 memcpy(&vol_stats, res_buf, sizeof(vol_stats));
1184 print_vol_stats_general(&vol_stats);
1187 case FSYNC_VOL_STATS_VICEP:
1189 struct DiskPartitionStats64 vicep_stats;
1190 memcpy(&vicep_stats, res_buf, sizeof(vicep_stats));
1191 print_vol_stats_viceP(&vicep_stats);
1194 case FSYNC_VOL_STATS_HASH:
1196 struct VolumeHashChainStats hash_stats;
1197 memcpy(&hash_stats, res_buf, sizeof(hash_stats));
1198 print_vol_stats_hash(&hash_stats);
1201 #ifdef AFS_DEMAND_ATTACH_FS
1202 case FSYNC_VOL_STATS_HDR:
1204 struct volume_hdr_LRU_stats hdr_stats;
1205 memcpy(&hdr_stats, res_buf, sizeof(hdr_stats));
1206 print_vol_stats_hdr(&hdr_stats);
1209 #endif /* AFS_DEMAND_ATTACH_FS */
1217 print_vol_stats_general(VolPkgStats * stats)
1219 #ifdef AFS_DEMAND_ATTACH_FS
1223 printf("VolPkgStats = {\n");
1224 #ifdef AFS_DEMAND_ATTACH_FS
1225 for (i = 0; i < VOL_STATE_COUNT; i++) {
1226 printf("\tvol_state_count[%s] = %d\n",
1227 vol_state_to_string(i),
1228 stats->state_levels[i]);
1231 printf("\thash_looks = %"AFS_INT64_FMT"\n",
1233 printf("\thash_reorders = %"AFS_INT64_FMT"\n",
1234 stats->hash_reorders);
1235 printf("\tsalvages = %"AFS_INT64_FMT"\n",
1237 printf("\tvol_ops = %"AFS_INT64_FMT"\n",
1240 printf("\thdr_loads = %"AFS_INT64_FMT"\n",
1242 printf("\thdr_gets = %"AFS_INT64_FMT"\n",
1244 printf("\tattaches = %"AFS_INT64_FMT"\n",
1246 printf("\tsoft_detaches = %"AFS_INT64_FMT"\n",
1247 stats->soft_detaches);
1248 printf("\thdr_cache_size = %d\n", stats->hdr_cache_size);
1254 print_vol_stats_viceP(struct DiskPartitionStats64 * stats)
1256 printf("DiskPartitionStats64 = {\n");
1257 printf("\tfree = %" AFS_INT64_FMT "\n", stats->free);
1258 printf("\tminFree = %" AFS_INT64_FMT "\n", stats->minFree);
1259 printf("\ttotalUsable = %" AFS_INT64_FMT "\n", stats->totalUsable);
1260 printf("\tf_files = %" AFS_INT64_FMT "\n", stats->f_files);
1261 #ifdef AFS_DEMAND_ATTACH_FS
1262 printf("\tvol_list_len = %d\n", stats->vol_list_len);
1268 print_vol_stats_hash(struct VolumeHashChainStats * stats)
1270 printf("DiskPartitionStats = {\n");
1271 printf("\ttable_size = %d\n", stats->table_size);
1272 printf("\tchain_len = %d\n", stats->chain_len);
1274 #ifdef AFS_DEMAND_ATTACH_FS
1275 printf("\tchain_cacheCheck = %d\n", stats->chain_cacheCheck);
1276 printf("\tchain_busy = %d\n", stats->chain_busy);
1278 printf("\tchain_looks = %"AFS_INT64_FMT"\n",
1279 stats->chain_looks);
1280 printf("\tchain_gets = %"AFS_INT64_FMT"\n",
1282 printf("\tchain_reorders = %"AFS_INT64_FMT"\n",
1283 stats->chain_reorders);
1284 #endif /* AFS_DEMAND_ATTACH_FS */
1290 #ifdef AFS_DEMAND_ATTACH_FS
1292 print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats)
1294 printf("volume_hdr_LRU_stats = {\n");
1295 printf("\tfree = %d\n", stats->free);
1296 printf("\tused = %d\n", stats->used);
1297 printf("\tattached = %d\n", stats->attached);
1300 #endif /* AFS_DEMAND_ATTACH_FS */
1307 * - CUSTOM_PARMS_OFFSET+0 is partition string
1308 * - CUSTOM_PARMS_OFFSET+1 is volume id
1310 * @return operation status
1314 VGCQuery(struct cmd_syndesc * as, void * rock)
1317 struct fssync_state state;
1320 FSSYNC_VGQry_response_t q_res;
1323 struct cmd_item *ti;
1325 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1328 partName = ti->data;
1330 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -volumeid */
1333 volid = atoi(ti->data);
1335 common_prolog(as, &state);
1337 fprintf(stderr, "calling FSYNC_VCGQuery\n");
1339 code = FSYNC_VGCQuery(partName, volid, &q_res, &res);
1341 debug_response(code, &res);
1343 if (code == SYNC_OK) {
1345 printf("\trw\t=\t%u\n", q_res.rw);
1346 printf("\tchildren\t= (\n");
1347 for (i = 0; i < VOL_VG_MAX_VOLS; i++) {
1348 if (q_res.children[i]) {
1349 printf("\t\t%u\n", q_res.children[i]);
1361 VGCAdd(struct cmd_syndesc * as, void * rock)
1364 struct fssync_state state;
1366 VolumeId parent, child;
1367 struct cmd_item *ti;
1370 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1373 partName = ti->data;
1375 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -parent */
1378 parent = atoi(ti->data);
1380 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -child */
1383 child = atoi(ti->data);
1385 common_prolog(as, &state);
1386 fprintf(stderr, "calling FSYNC_VCGAdd\n");
1387 code = FSYNC_VGCAdd(partName, parent, child, state.reason, &res);
1388 debug_response(code, &res);
1396 VGCDel(struct cmd_syndesc * as, void * rock)
1399 struct fssync_state state;
1401 VolumeId parent, child;
1402 struct cmd_item *ti;
1405 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1408 partName = ti->data;
1410 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -parent */
1413 parent = atoi(ti->data);
1415 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -child */
1418 child = atoi(ti->data);
1420 common_prolog(as, &state);
1421 fprintf(stderr, "calling FSYNC_VCGDel\n");
1422 code = FSYNC_VGCDel(partName, parent, child, state.reason, &res);
1423 debug_response(code, &res);
1431 VGCScan(struct cmd_syndesc * as, void * rock)
1434 struct fssync_state state;
1436 struct cmd_item *ti;
1438 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1441 partName = ti->data;
1443 common_prolog(as, &state);
1444 fprintf(stderr, "calling FSYNC_VCGScan\n");
1445 code = FSYNC_VGCScan(partName, state.reason);
1446 debug_response(code, NULL);
1454 VGCScanAll(struct cmd_syndesc * as, void * rock)
1457 struct fssync_state state;
1459 common_prolog(as, &state);
1460 fprintf(stderr, "calling FSYNC_VCGScanAll\n");
1461 code = FSYNC_VGCScan(NULL, state.reason);
1462 debug_response(code, NULL);