nfsdumpstate.c (1248463c17a9b3220911c02a262e30e15badcf61) nfsdumpstate.c (11f0e011c8e03ef2992945a4b4a2694a49f2d2af)
1/*-
2 * Copyright (c) 2009 Rick Macklem, University of Guelph
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 107 unchanged lines hidden (view full) ---

116/*
117 * Dump all open/lock state.
118 */
119static void
120dump_openstate(void)
121{
122 struct nfsd_dumplist dumplist;
123 int cnt, i;
1/*-
2 * Copyright (c) 2009 Rick Macklem, University of Guelph
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 107 unchanged lines hidden (view full) ---

116/*
117 * Dump all open/lock state.
118 */
119static void
120dump_openstate(void)
121{
122 struct nfsd_dumplist dumplist;
123 int cnt, i;
124 char nbuf[INET6_ADDRSTRLEN];
124
125 dumplist.ndl_size = DUMPSIZE;
126 dumplist.ndl_list = (void *)dp;
127 if (nfssvc(NFSSVC_DUMPCLIENTS, &dumplist) < 0)
128 errx(1, "Can't perform dump clients syscall");
129
125
126 dumplist.ndl_size = DUMPSIZE;
127 dumplist.ndl_list = (void *)dp;
128 if (nfssvc(NFSSVC_DUMPCLIENTS, &dumplist) < 0)
129 errx(1, "Can't perform dump clients syscall");
130
130 printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n",
131 printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-45s %s\n",
131 "Flags", "OpenOwner", "Open", "LockOwner",
132 "Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID");
133 /*
134 * Loop through results, printing them out.
135 */
136 cnt = 0;
137 while (dp[cnt].ndcl_clid.nclid_idlen > 0 && cnt < DUMPSIZE) {
138 printf("%-13s ", client_flags(dp[cnt].ndcl_flags));
139 printf("%9d %9d %9d %9d %9d %9d ",
140 dp[cnt].ndcl_nopenowners,
141 dp[cnt].ndcl_nopens,
142 dp[cnt].ndcl_nlockowners,
143 dp[cnt].ndcl_nlocks,
144 dp[cnt].ndcl_ndelegs,
145 dp[cnt].ndcl_nolddelegs);
132 "Flags", "OpenOwner", "Open", "LockOwner",
133 "Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID");
134 /*
135 * Loop through results, printing them out.
136 */
137 cnt = 0;
138 while (dp[cnt].ndcl_clid.nclid_idlen > 0 && cnt < DUMPSIZE) {
139 printf("%-13s ", client_flags(dp[cnt].ndcl_flags));
140 printf("%9d %9d %9d %9d %9d %9d ",
141 dp[cnt].ndcl_nopenowners,
142 dp[cnt].ndcl_nopens,
143 dp[cnt].ndcl_nlockowners,
144 dp[cnt].ndcl_nlocks,
145 dp[cnt].ndcl_ndelegs,
146 dp[cnt].ndcl_nolddelegs);
146 if (dp[cnt].ndcl_addrfam == AF_INET)
147 printf("%-15s ",
147 switch (dp[cnt].ndcl_addrfam) {
148#ifdef INET
149 case AF_INET:
150 printf("%-45s ",
148 inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr));
151 inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr));
152 break;
153#endif
154#ifdef INET6
155 case AF_INET6:
156 if (inet_ntop(AF_INET6, &dp[cnt].ndcl_cbaddr.sin6_addr,
157 nbuf, sizeof(nbuf)) != NULL)
158 printf("%-45s ", nbuf);
159 else
160 printf("%-45s ", " ");
161 break;
162#endif
163 }
149 for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++)
150 printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]);
151 printf("\n");
152 cnt++;
153 }
154}
155
156/*

--- 124 unchanged lines hidden ---
164 for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++)
165 printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]);
166 printf("\n");
167 cnt++;
168 }
169}
170
171/*

--- 124 unchanged lines hidden ---