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>
29 #include <afs/afsint.h>
32 #include <afs/osi_inode.h>
37 #include <afs/afsutil.h>
38 #include <afs/fileutil.h>
39 #include <rx/rx_queue.h>
46 #include "volume_inline.h"
47 #include "partition.h"
48 #include "daemon_com.h"
49 #include "daemon_com_inline.h"
51 #include "fssync_inline.h"
57 int VolumeChanged; /* hack to make dir package happy */
69 struct volop_state * vop;
72 #ifndef AFS_DEMAND_ATTACH_FS
73 /* remember argv/argc for later, if we need to re-exec */
74 static char **fssd_argv;
78 static int common_prolog(struct cmd_syndesc *, struct fssync_state *);
79 static int common_volop_prolog(struct cmd_syndesc *, struct fssync_state *);
81 static int do_volop(struct fssync_state *, afs_int32 command,
84 static int VolOnline(struct cmd_syndesc * as, void * rock);
85 static int VolOffline(struct cmd_syndesc * as, void * rock);
86 static int VolMode(struct cmd_syndesc * as, void * rock);
87 static int VolDetach(struct cmd_syndesc * as, void * rock);
88 static int VolBreakCBKs(struct cmd_syndesc * as, void * rock);
89 static int VolMove(struct cmd_syndesc * as, void * rock);
90 static int VolList(struct cmd_syndesc * as, void * rock);
91 static int VolLeaveOff(struct cmd_syndesc * as, void * rock);
92 static int VolForceAttach(struct cmd_syndesc * as, void * rock);
93 static int VolForceError(struct cmd_syndesc * as, void * rock);
94 static int VolQuery(struct cmd_syndesc * as, void * rock);
95 static int VolHdrQuery(struct cmd_syndesc * as, void * rock);
96 static int VolOpQuery(struct cmd_syndesc * as, void * rock);
97 static int StatsQuery(struct cmd_syndesc * as, void * rock);
98 static int VnQuery(struct cmd_syndesc * as, void * rock);
100 static int VGCQuery(struct cmd_syndesc * as, void * rock);
101 static int VGCAdd(struct cmd_syndesc * as, void * rock);
102 static int VGCDel(struct cmd_syndesc * as, void * rock);
103 static int VGCScan(struct cmd_syndesc * as, void * rock);
104 static int VGCScanAll(struct cmd_syndesc * as, void * rock);
106 static void print_vol_stats_general(VolPkgStats * stats);
107 static void print_vol_stats_viceP(struct DiskPartitionStats64 * stats);
108 static void print_vol_stats_hash(struct VolumeHashChainStats * stats);
109 #ifdef AFS_DEMAND_ATTACH_FS
110 static void print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats);
114 #include "AFS_component_version_number.c"
118 #define COMMON_PARMS_OFFSET 12
119 #define COMMON_PARMS(ts) \
120 cmd_Seek(ts, COMMON_PARMS_OFFSET); \
121 cmd_AddParm(ts, "-reason", CMD_SINGLE, CMD_OPTIONAL, "sync protocol reason code"); \
122 cmd_AddParm(ts, "-programtype", CMD_SINGLE, CMD_OPTIONAL, "program type code")
124 #define COMMON_VOLOP_PARMS_OFFSET 10
125 #define COMMON_VOLOP_PARMS(ts) \
126 cmd_Seek(ts, COMMON_VOLOP_PARMS_OFFSET); \
127 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id"); \
128 cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL, "partition name")
130 #define CUSTOM_PARMS_OFFSET 1
133 #define VOLOP_PARMS_DECL(ts) \
134 COMMON_VOLOP_PARMS(ts); \
136 #define COMMON_PARMS_DECL(ts) \
140 main(int argc, char **argv)
142 struct cmd_syndesc *ts;
145 /* Initialize directory paths */
146 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
148 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
150 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
155 #ifndef AFS_DEMAND_ATTACH_FS
160 ts = cmd_CreateSyntax("online", VolOnline, NULL, 0, "bring a volume online (FSYNC_VOL_ON opcode)");
161 VOLOP_PARMS_DECL(ts);
163 ts = cmd_CreateSyntax("offline", VolOffline, NULL, 0, "take a volume offline (FSYNC_VOL_OFF opcode)");
164 VOLOP_PARMS_DECL(ts);
166 ts = cmd_CreateSyntax("mode", VolMode, NULL, 0, "change volume attach mode (FSYNC_VOL_NEEDVOLUME opcode)");
167 VOLOP_PARMS_DECL(ts);
168 cmd_CreateAlias(ts, "needvolume");
170 ts = cmd_CreateSyntax("detach", VolDetach, NULL, 0, "detach a volume (FSYNC_VOL_DONE opcode)");
171 VOLOP_PARMS_DECL(ts);
173 ts = cmd_CreateSyntax("callback", VolBreakCBKs, NULL, 0, "break callbacks for volume (FSYNC_VOL_BREAKCBKS opcode)");
174 VOLOP_PARMS_DECL(ts);
175 cmd_CreateAlias(ts, "cbk");
177 ts = cmd_CreateSyntax("move", VolMove, NULL, 0, "set volume moved flag (FSYNC_VOL_MOVE opcode)");
178 VOLOP_PARMS_DECL(ts);
180 ts = cmd_CreateSyntax("list", VolList, NULL, 0, "sync local volume list (FSYNC_VOL_LISTVOLUMES opcode)");
181 VOLOP_PARMS_DECL(ts);
182 cmd_CreateAlias(ts, "ls");
184 ts = cmd_CreateSyntax("leaveoff", VolLeaveOff, 0, 0, "leave volume offline (FSYNC_VOL_LEAVE_OFF opcode)");
185 VOLOP_PARMS_DECL(ts);
187 ts = cmd_CreateSyntax("attach", VolForceAttach, 0, 0, "force full attachment (FSYNC_VOL_ATTACH opcode)");
188 VOLOP_PARMS_DECL(ts);
190 ts = cmd_CreateSyntax("error", VolForceError, 0, 0, "force into hard error state (FSYNC_VOL_FORCE_ERROR opcode)");
191 VOLOP_PARMS_DECL(ts);
193 ts = cmd_CreateSyntax("query", VolQuery, NULL, 0, "get volume structure (FSYNC_VOL_QUERY opcode)");
194 VOLOP_PARMS_DECL(ts);
195 cmd_CreateAlias(ts, "qry");
197 ts = cmd_CreateSyntax("header", VolHdrQuery, NULL, 0, "get volume disk data structure (FSYNC_VOL_QUERY_HDR opcode)");
198 VOLOP_PARMS_DECL(ts);
199 cmd_CreateAlias(ts, "hdr");
201 ts = cmd_CreateSyntax("volop", VolOpQuery, NULL, 0, "get pending volume operation info (FSYNC_VOL_QUERY_VOP opcode)");
202 VOLOP_PARMS_DECL(ts);
203 cmd_CreateAlias(ts, "vop");
205 ts = cmd_CreateSyntax("vnode", VnQuery, NULL, 0, "get vnode structure (FSYNC_VOL_QUERY_VNODE opcode)");
206 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
207 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id");
208 cmd_AddParm(ts, "-vnodeid", CMD_SINGLE, 0, "vnode id");
209 cmd_AddParm(ts, "-unique", CMD_SINGLE, 0, "uniquifier");
210 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
211 COMMON_PARMS_DECL(ts);
213 ts = cmd_CreateSyntax("stats", StatsQuery, NULL, 0, "see 'stats help' for more information");
214 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
215 cmd_AddParm(ts, "-cmd", CMD_SINGLE, 0, "subcommand");
216 cmd_AddParm(ts, "-arg1", CMD_SINGLE, CMD_OPTIONAL, "arg1");
217 cmd_AddParm(ts, "-arg2", CMD_SINGLE, CMD_OPTIONAL, "arg2");
218 COMMON_PARMS_DECL(ts);
220 ts = cmd_CreateSyntax("vgcquery", VGCQuery, 0, 0, "query volume group cache (FSYNC_VG_QUERY opcode)");
221 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
222 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
223 cmd_AddParm(ts, "-volumeid", CMD_SINGLE, 0, "volume id");
224 COMMON_PARMS_DECL(ts);
225 cmd_CreateAlias(ts, "vgcqry");
227 ts = cmd_CreateSyntax("vgcadd", VGCAdd, 0, 0, "add entry to volume group cache (FSYNC_VG_ADD opcode)");
228 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
229 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
230 cmd_AddParm(ts, "-parent", CMD_SINGLE, 0, "parent volume id");
231 cmd_AddParm(ts, "-child", CMD_SINGLE, 0, "child volume id");
232 COMMON_PARMS_DECL(ts);
234 ts = cmd_CreateSyntax("vgcdel", VGCDel, 0, 0, "delete entry from volume group cache (FSYNC_VG_DEL opcode)");
235 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
236 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
237 cmd_AddParm(ts, "-parent", CMD_SINGLE, 0, "parent volume id");
238 cmd_AddParm(ts, "-child", CMD_SINGLE, 0, "child volume id");
239 COMMON_PARMS_DECL(ts);
241 ts = cmd_CreateSyntax("vgcscan", VGCScan, 0, 0,
242 "start volume group cache re-scan"
243 " (FSYNC_VG_SCAN opcode)");
244 cmd_Seek(ts, CUSTOM_PARMS_OFFSET);
245 cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
246 COMMON_PARMS_DECL(ts);
248 ts = cmd_CreateSyntax("vgcscanall", VGCScanAll, 0, 0,
249 "start whole-server volume group cache re-scan"
250 " (FSYNC_VG_SCAN_ALL opcode)");
251 COMMON_PARMS_DECL(ts);
253 err = cmd_Dispatch(argc, argv);
257 #ifdef AFS_DEMAND_ATTACH_FS
258 # define dafs_prolog()
260 /* Try to detect if the fileserver is DAFS, and if so, re-exec as the
261 * DAFS-enabled fssync-debug (dafssync_debug). If we fail to detect or
262 * exec, just try to proceed anyway as if the server is not DAFS */
267 SYNC_PROTO_BUF_DECL(res_buf);
271 res.payload.len = SYNC_PROTO_MAX_LEN;
272 res.payload.buf = res_buf;
274 /* LISTVOLUMES is a no-op; we just want to get the response header flags
275 * to see if the server reports itself as DAFS or not */
276 code = FSYNC_VolOp(0, NULL, FSYNC_VOL_LISTVOLUMES, FSYNC_WHATEVER, &res);
277 VDisconnectFS(); /* disconnect before continuing */
279 /* probably failed to contact the fileserver; later code will provide
280 * some warning/error indication */
284 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
285 /* fileserver is not DAFS, so we don't need to do anything */
289 dfssd = afs_exec_alt(fssd_argc, fssd_argv, "da", NULL);
291 fprintf(stderr, "\n*** server asserted demand attach extensions, but we failed\n"
292 "*** to exec a DAFS-enabled fssync-debug '%s' (errno=%d);\n"
293 "*** attempting to proceed without it.\n\n", dfssd, errno);
297 #endif /* !AFS_DEMAND_ATTACH_FS */
300 common_prolog(struct cmd_syndesc * as, struct fssync_state * state)
303 VolumePackageOptions opts;
306 if (afs_winsockInit() < 0) {
311 VOptDefaults(debugUtility, &opts);
312 if (VInitVolumePackage2(debugUtility, &opts)) {
313 /* VInitVolumePackage2 can fail on e.g. partition attachment errors,
314 * but we don't really care, since all we're doing is trying to use
316 fprintf(stderr, "errors encountered initializing volume package, but "
317 "trying to continue anyway\n");
321 if ((ti = as->parms[COMMON_PARMS_OFFSET].items)) { /* -reason */
322 state->reason = atoi(ti->data);
324 state->reason = FSYNC_WHATEVER;
327 if ((ti = as->parms[COMMON_PARMS_OFFSET+1].items)) { /* -programtype */
328 if (!strcmp(ti->data, "fileServer")) {
329 programType = fileServer;
330 } else if (!strcmp(ti->data, "volumeUtility")) {
331 programType = volumeUtility;
332 } else if (!strcmp(ti->data, "salvager")) {
333 programType = salvager;
334 } else if (!strcmp(ti->data, "salvageServer")) {
335 programType = salvageServer;
336 } else if (!strcmp(ti->data, "volumeServer")) {
337 programType = volumeServer;
338 } else if (!strcmp(ti->data, "volumeSalvager")) {
339 programType = volumeSalvager;
341 programType = (ProgramType) atoi(ti->data);
351 common_volop_prolog(struct cmd_syndesc * as, struct fssync_state * state)
355 state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
356 opr_Assert(state->vop != NULL);
358 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET].items)) { /* -volumeid */
359 state->vop->volume = atoi(ti->data);
361 fprintf(stderr, "required argument -volumeid not given\n");
364 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET+1].items)) { /* -partition */
365 strlcpy(state->vop->partName, ti->data, sizeof(state->vop->partName));
367 memset(state->vop->partName, 0, sizeof(state->vop->partName));
374 debug_response(afs_int32 code, SYNC_response * res)
381 fprintf(stderr, "warning: response code indicates possible protocol error.\n");
384 fprintf(stderr, "FSSYNC service returned %d (%s)\n", code, SYNC_res2string(code));
387 fprintf(stderr, "protocol header response code was %d (%s)\n",
388 res->hdr.response, SYNC_res2string(res->hdr.response));
389 fprintf(stderr, "protocol reason code was %d (%s)\n",
390 res->hdr.reason, FSYNC_reason2string(res->hdr.reason));
397 do_volop(struct fssync_state * state, afs_int32 command, SYNC_response * res)
400 SYNC_PROTO_BUF_DECL(res_buf);
405 res->payload.len = SYNC_PROTO_MAX_LEN;
406 res->payload.buf = res_buf;
409 fprintf(stderr, "calling FSYNC_VolOp with command code %d (%s)\n",
410 command, FSYNC_com2string(command));
412 code = FSYNC_VolOp(state->vop->volume,
413 state->vop->partName,
418 debug_response(code, res);
427 #define ENUMTOSTRING(en) #en
428 #define ENUMCASE(en) \
429 case en: return ENUMTOSTRING(en)
431 #define FLAGTOSTRING(fl) #fl
432 #define FLAGCASE(bitstr, fl, str, count) \
434 if ((bitstr) & (fl)) { \
436 strlcat((str), " | ", sizeof(str)); \
437 strlcat((str), FLAGTOSTRING(fl), sizeof(str)); \
443 VolOnline(struct cmd_syndesc * as, void * rock)
445 struct fssync_state state;
447 common_prolog(as, &state);
448 common_volop_prolog(as, &state);
450 if (*(state.vop->partName)==0) {
451 fprintf(stderr, "required argument -partition not given\n");
454 do_volop(&state, FSYNC_VOL_ON, NULL);
460 VolOffline(struct cmd_syndesc * as, void * rock)
462 struct fssync_state state;
464 common_prolog(as, &state);
465 common_volop_prolog(as, &state);
467 do_volop(&state, FSYNC_VOL_OFF, NULL);
473 VolMode(struct cmd_syndesc * as, void * rock)
475 struct fssync_state state;
477 common_prolog(as, &state);
478 common_volop_prolog(as, &state);
480 do_volop(&state, FSYNC_VOL_NEEDVOLUME, NULL);
486 VolDetach(struct cmd_syndesc * as, void * rock)
488 struct fssync_state state;
490 common_prolog(as, &state);
491 common_volop_prolog(as, &state);
493 do_volop(&state, FSYNC_VOL_DONE, NULL);
499 VolBreakCBKs(struct cmd_syndesc * as, void * rock)
501 struct fssync_state state;
503 common_prolog(as, &state);
504 common_volop_prolog(as, &state);
506 do_volop(&state, FSYNC_VOL_BREAKCBKS, NULL);
512 VolMove(struct cmd_syndesc * as, void * rock)
514 struct fssync_state state;
516 common_prolog(as, &state);
517 common_volop_prolog(as, &state);
519 do_volop(&state, FSYNC_VOL_MOVE, NULL);
525 VolList(struct cmd_syndesc * as, void * rock)
527 struct fssync_state state;
529 common_prolog(as, &state);
530 common_volop_prolog(as, &state);
532 do_volop(&state, FSYNC_VOL_LISTVOLUMES, NULL);
538 VolLeaveOff(struct cmd_syndesc * as, void * rock)
540 struct fssync_state state;
542 common_prolog(as, &state);
543 common_volop_prolog(as, &state);
545 do_volop(&state, FSYNC_VOL_LEAVE_OFF, NULL);
551 VolForceAttach(struct cmd_syndesc * as, void * rock)
553 struct fssync_state state;
555 common_prolog(as, &state);
556 common_volop_prolog(as, &state);
558 do_volop(&state, FSYNC_VOL_ATTACH, NULL);
564 VolForceError(struct cmd_syndesc * as, void * rock)
566 struct fssync_state state;
568 common_prolog(as, &state);
569 common_volop_prolog(as, &state);
571 do_volop(&state, FSYNC_VOL_FORCE_ERROR, NULL);
576 #ifdef AFS_DEMAND_ATTACH_FS
578 vol_state_to_string(VolState state)
581 ENUMCASE(VOL_STATE_UNATTACHED);
582 ENUMCASE(VOL_STATE_PREATTACHED);
583 ENUMCASE(VOL_STATE_ATTACHING);
584 ENUMCASE(VOL_STATE_ATTACHED);
585 ENUMCASE(VOL_STATE_UPDATING);
586 ENUMCASE(VOL_STATE_GET_BITMAP);
587 ENUMCASE(VOL_STATE_HDR_LOADING);
588 ENUMCASE(VOL_STATE_HDR_ATTACHING);
589 ENUMCASE(VOL_STATE_SHUTTING_DOWN);
590 ENUMCASE(VOL_STATE_GOING_OFFLINE);
591 ENUMCASE(VOL_STATE_OFFLINING);
592 ENUMCASE(VOL_STATE_DETACHING);
593 ENUMCASE(VOL_STATE_SALVSYNC_REQ);
594 ENUMCASE(VOL_STATE_SALVAGING);
595 ENUMCASE(VOL_STATE_ERROR);
596 ENUMCASE(VOL_STATE_VNODE_ALLOC);
597 ENUMCASE(VOL_STATE_VNODE_GET);
598 ENUMCASE(VOL_STATE_VNODE_CLOSE);
599 ENUMCASE(VOL_STATE_VNODE_RELEASE);
600 ENUMCASE(VOL_STATE_VLRU_ADD);
601 ENUMCASE(VOL_STATE_DELETED);
602 ENUMCASE(VOL_STATE_SALVAGE_REQ);
603 ENUMCASE(VOL_STATE_FREED);
605 return "**UNKNOWN**";
610 vol_flags_to_string(afs_uint16 flags)
612 static char str[256];
616 FLAGCASE(flags, VOL_HDR_ATTACHED, str, count);
617 FLAGCASE(flags, VOL_HDR_LOADED, str, count);
618 FLAGCASE(flags, VOL_HDR_IN_LRU, str, count);
619 FLAGCASE(flags, VOL_IN_HASH, str, count);
620 FLAGCASE(flags, VOL_ON_VBYP_LIST, str, count);
621 FLAGCASE(flags, VOL_IS_BUSY, str, count);
622 FLAGCASE(flags, VOL_ON_VLRU, str, count);
623 FLAGCASE(flags, VOL_HDR_DONTSALV, str, count);
624 FLAGCASE(flags, VOL_LOCKED, str, count);
630 vlru_idx_to_string(int idx)
633 ENUMCASE(VLRU_QUEUE_NEW);
634 ENUMCASE(VLRU_QUEUE_MID);
635 ENUMCASE(VLRU_QUEUE_OLD);
636 ENUMCASE(VLRU_QUEUE_CANDIDATE);
637 ENUMCASE(VLRU_QUEUE_HELD);
638 ENUMCASE(VLRU_QUEUE_INVALID);
640 return "**UNKNOWN**";
646 vn_state_to_string(VnState state)
649 ENUMCASE(VN_STATE_INVALID);
650 ENUMCASE(VN_STATE_RELEASING);
651 ENUMCASE(VN_STATE_CLOSING);
652 ENUMCASE(VN_STATE_ALLOC);
653 ENUMCASE(VN_STATE_ONLINE);
654 ENUMCASE(VN_STATE_LOAD);
655 ENUMCASE(VN_STATE_EXCLUSIVE);
656 ENUMCASE(VN_STATE_STORE);
657 ENUMCASE(VN_STATE_READ);
658 ENUMCASE(VN_STATE_ERROR);
660 return "**UNKNOWN**";
665 vn_flags_to_string(afs_uint32 flags)
667 static char str[128];
671 FLAGCASE(flags, VN_ON_HASH, str, count);
672 FLAGCASE(flags, VN_ON_LRU, str, count);
673 FLAGCASE(flags, VN_ON_VVN, str, count);
680 VolQuery(struct cmd_syndesc * as, void * rock)
682 struct fssync_state state;
683 SYNC_PROTO_BUF_DECL(res_buf);
689 res.hdr.response_len = sizeof(res.hdr);
690 res.payload.buf = res_buf;
691 res.payload.len = SYNC_PROTO_MAX_LEN;
693 common_prolog(as, &state);
694 common_volop_prolog(as, &state);
696 do_volop(&state, FSYNC_VOL_QUERY, &res);
698 if (res.hdr.response == SYNC_OK) {
699 memcpy(&v, res.payload.buf, sizeof(Volume));
701 printf("volume = {\n");
702 printf("\thashid = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.hashid));
703 printf("\theader = %p\n", v.header);
704 printf("\tdevice = %d\n", v.device);
705 printf("\tpartition = %p\n", v.partition);
706 printf("\tlinkHandle = %p\n", v.linkHandle);
707 printf("\tnextVnodeUnique = %u\n", v.nextVnodeUnique);
708 printf("\tdiskDataHandle = %p\n", v.diskDataHandle);
709 printf("\tshuttingDown = %d\n", v.shuttingDown);
710 printf("\tgoingOffline = %d\n", v.goingOffline);
711 printf("\tcacheCheck = %u\n", v.cacheCheck);
712 printf("\tnUsers = %d\n", v.nUsers);
713 printf("\tneedsPutBack = %d\n", v.needsPutBack);
714 printf("\tspecialStatus = %d\n", v.specialStatus);
715 printf("\tupdateTime = %u\n", v.updateTime);
717 printf("\tvnodeIndex[vSmall] = {\n");
718 printf("\t\thandle = %p\n", v.vnodeIndex[vSmall].handle);
719 printf("\t\tbitmap = %p\n", v.vnodeIndex[vSmall].bitmap);
720 printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vSmall].bitmapSize);
721 printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vSmall].bitmapOffset);
723 printf("\tvnodeIndex[vLarge] = {\n");
724 printf("\t\thandle = %p\n", v.vnodeIndex[vLarge].handle);
725 printf("\t\tbitmap = %p\n", v.vnodeIndex[vLarge].bitmap);
726 printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vLarge].bitmapSize);
727 printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vLarge].bitmapOffset);
729 #ifdef AFS_DEMAND_ATTACH_FS
730 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
731 printf("\tupdateTime = %u\n", v.updateTime);
732 printf("\tattach_state = %s\n", vol_state_to_string(v.attach_state));
733 printf("\tattach_flags = %s\n", vol_flags_to_string(v.attach_flags));
734 printf("\tnWaiters = %d\n", v.nWaiters);
735 printf("\tchainCacheCheck = %d\n", v.chainCacheCheck);
737 /* online salvage structure */
738 printf("\tsalvage = {\n");
739 printf("\t\tprio = %u\n", v.salvage.prio);
740 printf("\t\treason = %d\n", v.salvage.reason);
741 printf("\t\trequested = %d\n", v.salvage.requested);
742 printf("\t\tscheduled = %d\n", v.salvage.scheduled);
745 /* statistics structure */
746 printf("\tstats = {\n");
748 printf("\t\thash_lookups = %"AFS_INT64_FMT"\n",
749 v.stats.hash_lookups);
750 printf("\t\thash_short_circuits = %"AFS_INT64_FMT"\n",
751 v.stats.hash_short_circuits);
752 printf("\t\thdr_loads = %"AFS_INT64_FMT"\n",
754 printf("\t\thdr_gets = %"AFS_INT64_FMT"\n",
758 printf("\t\tattaches = %u\n", v.stats.attaches);
759 printf("\t\tsoft_detaches = %u\n", v.stats.soft_detaches);
760 printf("\t\tsalvages = %u\n", v.stats.salvages);
761 printf("\t\tvol_ops = %u\n", v.stats.vol_ops);
763 printf("\t\tlast_attach = %u\n", v.stats.last_attach);
764 printf("\t\tlast_get = %u\n", v.stats.last_get);
765 printf("\t\tlast_promote = %u\n", v.stats.last_promote);
766 printf("\t\tlast_hdr_get = %u\n", v.stats.last_hdr_get);
767 printf("\t\tlast_hdr_load = %u\n", v.stats.last_hdr_load);
768 printf("\t\tlast_salvage = %u\n", v.stats.last_salvage);
769 printf("\t\tlast_salvage_req = %u\n", v.stats.last_salvage_req);
770 printf("\t\tlast_vol_op = %u\n", v.stats.last_vol_op);
774 printf("\tvlru = {\n");
775 printf("\t\tidx = %d (%s)\n",
776 v.vlru.idx, vlru_idx_to_string(v.vlru.idx));
779 /* volume op state */
780 printf("\tpending_vol_op = %p\n", v.pending_vol_op);
782 #else /* !AFS_DEMAND_ATTACH_FS */
783 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
784 printf("*** server asserted demand attach extensions. this fssync-debug\n"
785 "*** is not built to recognize those extensions. please use an\n"
786 "*** fssync-debug with demand attach if you need to dump dafs\n"
787 "*** extended state.\n");
789 #endif /* !AFS_DEMAND_ATTACH_FS */
797 VolHdrQuery(struct cmd_syndesc * as, void * rock)
799 struct fssync_state state;
800 SYNC_PROTO_BUF_DECL(res_buf);
805 res.hdr.response_len = sizeof(res.hdr);
806 res.payload.buf = res_buf;
807 res.payload.len = SYNC_PROTO_MAX_LEN;
809 common_prolog(as, &state);
810 common_volop_prolog(as, &state);
812 do_volop(&state, FSYNC_VOL_QUERY_HDR, &res);
814 if (res.hdr.response == SYNC_OK) {
815 memcpy(&v, res.payload.buf, sizeof(VolumeDiskData));
817 printf("VolumeDiskData = {\n");
818 printf("\tstamp = {\n");
819 printf("\t\tmagic = 0x%x\n", v.stamp.magic);
820 printf("\t\tversion = %u\n", v.stamp.version);
823 printf("\tid = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.id));
824 printf("\tname = '%s'\n", v.name);
826 printf("\tinUse = %d (%s)\n", v.inUse, VPTypeToString(v.inUse));
828 printf("\tinUse = %d (no)\n", v.inUse);
830 printf("\tinService = %d\n", v.inService);
831 printf("\tblessed = %d\n", v.blessed);
832 printf("\tneedsSalvaged = %d\n", v.needsSalvaged);
833 printf("\tuniquifier = %u\n", v.uniquifier);
834 printf("\ttype = %d\n", v.type);
835 printf("\tparentId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.parentId));
836 printf("\tcloneId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.cloneId));
837 printf("\tbackupId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.backupId));
838 printf("\trestoredFromId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.restoredFromId));
839 printf("\tneedsCallback = %d\n", v.needsCallback);
840 printf("\tdestroyMe = %d\n", v.destroyMe);
841 printf("\tdontSalvage = %d\n", v.dontSalvage);
842 printf("\tmaxquota = %d\n", v.maxquota);
843 printf("\tminquota = %d\n", v.minquota);
844 printf("\tmaxfiles = %d\n", v.maxfiles);
845 printf("\taccountNumber = %u\n", v.accountNumber);
846 printf("\towner = %u\n", v.owner);
847 printf("\tfilecount = %d\n", v.filecount);
848 printf("\tdiskused = %d\n", v.diskused);
849 printf("\tdayUse = %d\n", v.dayUse);
850 for (i = 0; i < 7; i++) {
851 printf("\tweekUse[%d] = %d\n", i, v.weekUse[i]);
853 printf("\tdayUseDate = %u\n", v.dayUseDate);
854 printf("\tcreationDate = %u\n", v.creationDate);
855 printf("\taccessDate = %u\n", v.accessDate);
856 printf("\tupdateDate = %u\n", v.updateDate);
857 printf("\texpirationDate = %u\n", v.expirationDate);
858 printf("\tbackupDate = %u\n", v.backupDate);
859 printf("\tcopyDate = %u\n", v.copyDate);
860 printf("\tstat_initialized = %d\n", v.stat_initialized);
868 VolOpQuery(struct cmd_syndesc * as, void * rock)
870 struct fssync_state state;
871 SYNC_PROTO_BUF_DECL(res_buf);
873 FSSYNC_VolOp_info vop;
875 res.hdr.response_len = sizeof(res.hdr);
876 res.payload.buf = res_buf;
877 res.payload.len = SYNC_PROTO_MAX_LEN;
879 common_prolog(as, &state);
880 common_volop_prolog(as, &state);
882 do_volop(&state, FSYNC_VOL_QUERY_VOP, &res);
884 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
885 printf("*** file server not compiled with demand attach extensions.\n");
886 printf("*** pending volume operation metadata not available.\n");
889 if (res.hdr.response == SYNC_OK) {
890 memcpy(&vop, res.payload.buf, sizeof(FSSYNC_VolOp_info));
892 printf("pending_vol_op = {\n");
894 printf("\tcom = {\n");
895 printf("\t\tproto_version = %u\n", vop.com.proto_version);
896 printf("\t\tpkt_seq = %u\n", vop.com.pkt_seq);
897 printf("\t\tcom_seq = %u\n", vop.com.com_seq);
898 printf("\t\tprogramType = %d (%s)\n",
899 vop.com.programType, VPTypeToString(vop.com.programType));
900 printf("\t\tpid = %d\n", vop.com.pid);
901 printf("\t\ttid = %d\n", vop.com.tid);
902 printf("\t\tcommand = %d (%s)\n",
903 vop.com.command, FSYNC_com2string(vop.com.command));
904 printf("\t\treason = %d (%s)\n",
905 vop.com.reason, FSYNC_reason2string(vop.com.reason));
906 printf("\t\tcommand_len = %u\n", vop.com.command_len);
907 printf("\t\tflags = 0x%lux\n", afs_printable_uint32_lu(vop.com.flags));
910 printf("\tvop = {\n");
911 printf("\t\tvolume = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(vop.vop.volume));
912 if (strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
913 sizeof(vop.vop.partName)) {
914 printf("\t\tpartName = '%s'\n", vop.vop.partName);
916 printf("\t\tpartName = (illegal string)\n");
927 vn_prolog(struct cmd_syndesc * as, struct fssync_state * state)
931 state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
932 osi_Assert(state->vop != NULL);
934 if ((ti = as->parms[CUSTOM_PARMS_OFFSET].items)) { /* -volumeid */
935 state->vop->volume = atoi(ti->data);
937 fprintf(stderr, "required argument -volumeid not given\n");
940 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -vnodeid */
941 state->vop->vnode = atoi(ti->data);
943 fprintf(stderr, "required argument -vnodeid not given\n");
946 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -unique */
947 state->vop->unique = atoi(ti->data);
949 state->vop->unique = 0;
952 if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET+3].items)) { /* -partition */
953 strlcpy(state->vop->partName, ti->data, sizeof(state->vop->partName));
955 memset(state->vop->partName, 0, sizeof(state->vop->partName));
962 do_vnqry(struct fssync_state * state, SYNC_response * res)
965 int command = FSYNC_VOL_QUERY_VNODE;
966 FSSYNC_VnQry_hdr qry;
968 qry.volume = state->vop->volume;
969 qry.vnode = state->vop->vnode;
970 qry.unique = state->vop->unique;
972 strlcpy(qry.partName, state->vop->partName, sizeof(qry.partName));
974 fprintf(stderr, "calling FSYNC_GenericOp with command code %d (%s)\n",
975 command, FSYNC_com2string(command));
977 code = FSYNC_GenericOp(&qry, sizeof(qry), command, FSYNC_OPERATOR, res);
979 debug_response(code, res);
987 VnQuery(struct cmd_syndesc * as, void * rock)
989 struct fssync_state state;
990 SYNC_PROTO_BUF_DECL(res_buf);
996 res.hdr.response_len = sizeof(res.hdr);
997 res.payload.buf = res_buf;
998 res.payload.len = SYNC_PROTO_MAX_LEN;
1000 common_prolog(as, &state);
1001 vn_prolog(as, &state);
1003 do_vnqry(&state, &res);
1005 if (res.hdr.response == SYNC_OK) {
1006 memcpy(&v, res.payload.buf, sizeof(Vnode));
1008 printf("vnode = {\n");
1010 printf("\tvid_hash = {\n");
1011 printf("\t\tnext = %p\n", v.vid_hash.next);
1012 printf("\t\tprev = %p\n", v.vid_hash.prev);
1015 printf("\thashNext = %p\n", v.hashNext);
1016 printf("\tlruNext = %p\n", v.lruNext);
1017 printf("\tlruPrev = %p\n", v.lruPrev);
1018 printf("\thashIndex = %hu\n", v.hashIndex);
1019 printf("\tchanged_newTime = %u\n", (unsigned int) v.changed_newTime);
1020 printf("\tchanged_oldTime = %u\n", (unsigned int) v.changed_oldTime);
1021 printf("\tdelete = %u\n", (unsigned int) v.delete);
1022 printf("\tvnodeNumber = %u\n", v.vnodeNumber);
1023 printf("\tvolumePtr = %p\n", v.volumePtr);
1024 printf("\tnUsers = %u\n", v.nUsers);
1025 printf("\tcacheCheck = %u\n", v.cacheCheck);
1027 #ifdef AFS_DEMAND_ATTACH_FS
1028 if (!(res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS)) {
1029 printf("*** this fssync-debug is built to expect demand attach extensions.\n"
1030 "*** server asserted that is was not compiled with demand attach.\n"
1031 "*** please use an fssync-debug without demand attach to match your\n"
1036 printf("\tnReaders = %u\n", v.nReaders);
1037 printf("\tvn_state_flags = %s\n", vn_flags_to_string(v.vn_state_flags));
1038 printf("\tvn_state = %s\n", vn_state_to_string(v.vn_state));
1040 if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
1041 printf("*** server asserted demand attach extensions. this fssync-debug is not\n"
1042 "*** built to recognize those extensions. please use an fssync-debug\n"
1043 "*** with demand attach to match your server.\n");
1046 #endif /* !AFS_DEMAND_ATTACH_FS */
1048 printf("\tvcp = %p\n", v.vcp);
1049 printf("\thandle = %p\n", v.handle);
1051 printf("\tdisk = {\n");
1052 printf("\t\ttype = %u\n", v.disk.type);
1053 printf("\t\tcloned = %u\n", v.disk.cloned);
1054 printf("\t\tmodeBits = %u\n", v.disk.modeBits);
1055 printf("\t\tlinkCount = %d\n", v.disk.linkCount);
1056 printf("\t\tlength = %u\n", v.disk.length);
1057 printf("\t\tuniquifier = %u\n", v.disk.uniquifier);
1058 printf("\t\tdataVersion = %u\n", v.disk.dataVersion);
1059 printf("\t\tvn_ino_lo = %u\n", v.disk.vn_ino_lo);
1060 printf("\t\tunixModifyTime = %u\n", v.disk.unixModifyTime);
1061 printf("\t\tauthor = %u\n", v.disk.author);
1062 printf("\t\towner = %u\n", v.disk.owner);
1063 printf("\t\tparent = %u\n", v.disk.parent);
1064 printf("\t\tvnodeMagic = %u\n", v.disk.vnodeMagic);
1066 printf("\t\tlock = {\n");
1067 printf("\t\t\tlockCount = %d\n", v.disk.lock.lockCount);
1068 printf("\t\t\tlockTime = %d\n", v.disk.lock.lockTime);
1071 printf("\t\tserverModifyTime = %u\n", v.disk.serverModifyTime);
1072 printf("\t\tgroup = %d\n", v.disk.group);
1073 printf("\t\tvn_ino_hi = %d\n", v.disk.vn_ino_hi);
1074 printf("\t\tvn_length_hi = %u\n", v.disk.vn_length_hi);
1086 StatsQuery(struct cmd_syndesc * as, void * rock)
1090 struct cmd_item *ti;
1091 struct fssync_state state;
1092 SYNC_PROTO_BUF_DECL(res_buf);
1094 FSSYNC_StatsOp_hdr scom;
1096 res.hdr.response_len = sizeof(res.hdr);
1097 res.payload.buf = res_buf;
1098 res.payload.len = SYNC_PROTO_MAX_LEN;
1100 if ((ti = as->parms[CUSTOM_PARMS_OFFSET].items)) { /* -subcommand */
1101 if (!strcasecmp(ti->data, "vicep")) {
1102 command = FSYNC_VOL_STATS_VICEP;
1103 } else if (!strcasecmp(ti->data, "hash")) {
1104 command = FSYNC_VOL_STATS_HASH;
1105 #ifdef AFS_DEMAND_ATTACH_FS
1106 } else if (!strcasecmp(ti->data, "hdr")) {
1107 command = FSYNC_VOL_STATS_HDR;
1108 } else if (!strcasecmp(ti->data, "vlru")) {
1109 command = FSYNC_VOL_STATS_VLRU;
1111 } else if (!strcasecmp(ti->data, "pkg")) {
1112 command = FSYNC_VOL_STATS_GENERAL;
1113 } else if (!strcasecmp(ti->data, "help")) {
1114 fprintf(stderr, "fssync-debug stats subcommands:\n");
1115 fprintf(stderr, "\tpkg\tgeneral volume package stats\n");
1116 fprintf(stderr, "\tvicep\tvice partition stats\n");
1117 fprintf(stderr, "\thash\tvolume hash chain stats\n");
1118 #ifdef AFS_DEMAND_ATTACH_FS
1119 fprintf(stderr, "\thdr\tvolume header cache stats\n");
1120 fprintf(stderr, "\tvlru\tvlru generation stats\n");
1124 fprintf(stderr, "invalid stats subcommand");
1128 command = FSYNC_VOL_STATS_GENERAL;
1131 if ((ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -arg1 */
1133 case FSYNC_VOL_STATS_VICEP:
1134 strlcpy(scom.args.partName, ti->data, sizeof(state.vop->partName));
1136 case FSYNC_VOL_STATS_HASH:
1137 scom.args.hash_bucket = atoi(ti->data);
1139 case FSYNC_VOL_STATS_VLRU:
1140 scom.args.vlru_generation = atoi(ti->data);
1143 fprintf(stderr, "unrecognized arguments\n");
1148 case FSYNC_VOL_STATS_VICEP:
1149 case FSYNC_VOL_STATS_HASH:
1150 case FSYNC_VOL_STATS_VLRU:
1151 fprintf(stderr, "this subcommand requires more parameters\n");
1156 common_prolog(as, &state);
1158 fprintf(stderr, "calling FSYNC_askfs with command code %d (%s)\n",
1159 command, FSYNC_com2string(command));
1161 code = FSYNC_StatsOp(&scom, command, FSYNC_WHATEVER, &res);
1168 fprintf(stderr, "possible sync protocol error. return code was %d\n", code);
1171 fprintf(stderr, "FSYNC_VolOp returned %d (%s)\n", code, SYNC_res2string(code));
1172 fprintf(stderr, "protocol response code was %d (%s)\n",
1173 res.hdr.response, SYNC_res2string(res.hdr.response));
1174 fprintf(stderr, "protocol reason code was %d (%s)\n",
1175 res.hdr.reason, FSYNC_reason2string(res.hdr.reason));
1179 if (res.hdr.response == SYNC_OK) {
1181 case FSYNC_VOL_STATS_GENERAL:
1183 struct VolPkgStats vol_stats;
1184 memcpy(&vol_stats, res_buf, sizeof(vol_stats));
1185 print_vol_stats_general(&vol_stats);
1188 case FSYNC_VOL_STATS_VICEP:
1190 struct DiskPartitionStats64 vicep_stats;
1191 memcpy(&vicep_stats, res_buf, sizeof(vicep_stats));
1192 print_vol_stats_viceP(&vicep_stats);
1195 case FSYNC_VOL_STATS_HASH:
1197 struct VolumeHashChainStats hash_stats;
1198 memcpy(&hash_stats, res_buf, sizeof(hash_stats));
1199 print_vol_stats_hash(&hash_stats);
1202 #ifdef AFS_DEMAND_ATTACH_FS
1203 case FSYNC_VOL_STATS_HDR:
1205 struct volume_hdr_LRU_stats hdr_stats;
1206 memcpy(&hdr_stats, res_buf, sizeof(hdr_stats));
1207 print_vol_stats_hdr(&hdr_stats);
1210 #endif /* AFS_DEMAND_ATTACH_FS */
1218 print_vol_stats_general(VolPkgStats * stats)
1220 #ifdef AFS_DEMAND_ATTACH_FS
1224 printf("VolPkgStats = {\n");
1225 #ifdef AFS_DEMAND_ATTACH_FS
1226 for (i = 0; i < VOL_STATE_COUNT; i++) {
1227 printf("\tvol_state_count[%s] = %d\n",
1228 vol_state_to_string(i),
1229 stats->state_levels[i]);
1232 printf("\thash_looks = %"AFS_INT64_FMT"\n",
1234 printf("\thash_reorders = %"AFS_INT64_FMT"\n",
1235 stats->hash_reorders);
1236 printf("\tsalvages = %"AFS_INT64_FMT"\n",
1238 printf("\tvol_ops = %"AFS_INT64_FMT"\n",
1241 printf("\thdr_loads = %"AFS_INT64_FMT"\n",
1243 printf("\thdr_gets = %"AFS_INT64_FMT"\n",
1245 printf("\tattaches = %"AFS_INT64_FMT"\n",
1247 printf("\tsoft_detaches = %"AFS_INT64_FMT"\n",
1248 stats->soft_detaches);
1249 printf("\thdr_cache_size = %d\n", stats->hdr_cache_size);
1255 print_vol_stats_viceP(struct DiskPartitionStats64 * stats)
1257 printf("DiskPartitionStats64 = {\n");
1258 printf("\tfree = %" AFS_INT64_FMT "\n", stats->free);
1259 printf("\tminFree = %" AFS_INT64_FMT "\n", stats->minFree);
1260 printf("\ttotalUsable = %" AFS_INT64_FMT "\n", stats->totalUsable);
1261 printf("\tf_files = %" AFS_INT64_FMT "\n", stats->f_files);
1262 #ifdef AFS_DEMAND_ATTACH_FS
1263 printf("\tvol_list_len = %d\n", stats->vol_list_len);
1269 print_vol_stats_hash(struct VolumeHashChainStats * stats)
1271 printf("DiskPartitionStats = {\n");
1272 printf("\ttable_size = %d\n", stats->table_size);
1273 printf("\tchain_len = %d\n", stats->chain_len);
1275 #ifdef AFS_DEMAND_ATTACH_FS
1276 printf("\tchain_cacheCheck = %d\n", stats->chain_cacheCheck);
1277 printf("\tchain_busy = %d\n", stats->chain_busy);
1279 printf("\tchain_looks = %"AFS_INT64_FMT"\n",
1280 stats->chain_looks);
1281 printf("\tchain_gets = %"AFS_INT64_FMT"\n",
1283 printf("\tchain_reorders = %"AFS_INT64_FMT"\n",
1284 stats->chain_reorders);
1285 #endif /* AFS_DEMAND_ATTACH_FS */
1291 #ifdef AFS_DEMAND_ATTACH_FS
1293 print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats)
1295 printf("volume_hdr_LRU_stats = {\n");
1296 printf("\tfree = %d\n", stats->free);
1297 printf("\tused = %d\n", stats->used);
1298 printf("\tattached = %d\n", stats->attached);
1301 #endif /* AFS_DEMAND_ATTACH_FS */
1308 * - CUSTOM_PARMS_OFFSET+0 is partition string
1309 * - CUSTOM_PARMS_OFFSET+1 is volume id
1311 * @return operation status
1315 VGCQuery(struct cmd_syndesc * as, void * rock)
1318 struct fssync_state state;
1321 FSSYNC_VGQry_response_t q_res;
1324 struct cmd_item *ti;
1326 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1329 partName = ti->data;
1331 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -volumeid */
1334 volid = atoi(ti->data);
1336 common_prolog(as, &state);
1338 fprintf(stderr, "calling FSYNC_VCGQuery\n");
1340 code = FSYNC_VGCQuery(partName, volid, &q_res, &res);
1342 debug_response(code, &res);
1344 if (code == SYNC_OK) {
1346 printf("\trw\t=\t%u\n", q_res.rw);
1347 printf("\tchildren\t= (\n");
1348 for (i = 0; i < VOL_VG_MAX_VOLS; i++) {
1349 if (q_res.children[i]) {
1350 printf("\t\t%u\n", q_res.children[i]);
1362 VGCAdd(struct cmd_syndesc * as, void * rock)
1365 struct fssync_state state;
1367 VolumeId parent, child;
1368 struct cmd_item *ti;
1371 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1374 partName = ti->data;
1376 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -parent */
1379 parent = atoi(ti->data);
1381 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -child */
1384 child = atoi(ti->data);
1386 common_prolog(as, &state);
1387 fprintf(stderr, "calling FSYNC_VCGAdd\n");
1388 code = FSYNC_VGCAdd(partName, parent, child, state.reason, &res);
1389 debug_response(code, &res);
1397 VGCDel(struct cmd_syndesc * as, void * rock)
1400 struct fssync_state state;
1402 VolumeId parent, child;
1403 struct cmd_item *ti;
1406 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1409 partName = ti->data;
1411 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+1].items)) { /* -parent */
1414 parent = atoi(ti->data);
1416 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+2].items)) { /* -child */
1419 child = atoi(ti->data);
1421 common_prolog(as, &state);
1422 fprintf(stderr, "calling FSYNC_VCGDel\n");
1423 code = FSYNC_VGCDel(partName, parent, child, state.reason, &res);
1424 debug_response(code, &res);
1432 VGCScan(struct cmd_syndesc * as, void * rock)
1435 struct fssync_state state;
1437 struct cmd_item *ti;
1439 if (!(ti = as->parms[CUSTOM_PARMS_OFFSET+0].items)) { /* -partition */
1442 partName = ti->data;
1444 common_prolog(as, &state);
1445 fprintf(stderr, "calling FSYNC_VCGScan\n");
1446 code = FSYNC_VGCScan(partName, state.reason);
1447 debug_response(code, NULL);
1455 VGCScanAll(struct cmd_syndesc * as, void * rock)
1458 struct fssync_state state;
1460 common_prolog(as, &state);
1461 fprintf(stderr, "calling FSYNC_VCGScanAll\n");
1462 code = FSYNC_VGCScan(NULL, state.reason);
1463 debug_response(code, NULL);