2 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 /*---------------------------------------------------------------------------
26 Test program used to test the DMAPI function dm_get_config_events(). The
29 get_config_events [-n nelem] handle
31 where handle is the handle of a file or filesystem, and nelem is the value
32 to use for the nelem parameter to dm_get_eventlist().
34 ----------------------------------------------------------------------------*/
47 fprintf(stderr, "usage:\t%s [-n nelem] handle\n", Progname);
57 u_int nelem = DM_EVENT_MAX;
59 dm_eventset_t eventset;
68 if (Progname = strrchr(argv[0], '/')) {
74 /* Crack and validate the command line options. */
76 while ((opt = getopt(argc, argv, "n:")) != EOF) {
85 if (optind + 1 != argc)
87 han_str = argv[optind];
88 if ((error = atohan(han_str, &hanp, &hlen)) != 0) {
89 fprintf(stderr, "atohan() failed, %s\n", strerror(error));
93 if (dm_init_service(&name)) {
94 fprintf(stderr, "Can't initialize the DMAPI\n");
100 if (dm_get_config_events(hanp, hlen, nelem, &eventset, &nelemp)) {
101 fprintf(stderr, "dm_get_config_events failed, %s\n",
106 fprintf(stdout, "Events supported (0x%llx), nelemp %d:\n",
109 for (i = 0; i < nelemp; i++) {
110 if (!DMEV_ISSET(i, eventset))
113 case DM_EVENT_CANCEL:
114 fprintf(stdout, "DM_EVENT_CANCEL");
117 fprintf(stdout, "DM_EVENT_MOUNT");
119 case DM_EVENT_PREUNMOUNT:
120 fprintf(stdout, "DM_EVENT_PREUNMOUNT");
122 case DM_EVENT_UNMOUNT:
123 fprintf(stdout, "DM_EVENT_UNMOUNT");
126 fprintf(stdout, "DM_EVENT_DEBUT");
128 case DM_EVENT_CREATE:
129 fprintf(stdout, "DM_EVENT_CREATE");
132 fprintf(stdout, "DM_EVENT_CLOSE");
134 case DM_EVENT_POSTCREATE:
135 fprintf(stdout, "DM_EVENT_POSTCREATE");
137 case DM_EVENT_REMOVE:
138 fprintf(stdout, "DM_EVENT_REMOVE");
140 case DM_EVENT_POSTREMOVE:
141 fprintf(stdout, "DM_EVENT_POSTREMOVE");
143 case DM_EVENT_RENAME:
144 fprintf(stdout, "DM_EVENT_RENAME");
146 case DM_EVENT_POSTRENAME:
147 fprintf(stdout, "DM_EVENT_POSTRENAME");
150 fprintf(stdout, "DM_EVENT_LINK");
152 case DM_EVENT_POSTLINK:
153 fprintf(stdout, "DM_EVENT_POSTLINK");
155 case DM_EVENT_SYMLINK:
156 fprintf(stdout, "DM_EVENT_SYMLINK");
158 case DM_EVENT_POSTSYMLINK:
159 fprintf(stdout, "DM_EVENT_POSTSYMLINK");
162 fprintf(stdout, "DM_EVENT_READ");
165 fprintf(stdout, "DM_EVENT_WRITE");
167 case DM_EVENT_TRUNCATE:
168 fprintf(stdout, "DM_EVENT_TRUNCATE");
170 case DM_EVENT_ATTRIBUTE:
171 fprintf(stdout, "DM_EVENT_ATTRIBUTE");
173 case DM_EVENT_DESTROY:
174 fprintf(stdout, "DM_EVENT_DESTROY");
176 case DM_EVENT_NOSPACE:
177 fprintf(stdout, "DM_EVENT_NOSPACE");
180 fprintf(stdout, "DM_EVENT_USER");
183 fprintf(stdout, "DM_EVENT_23");
186 fprintf(stdout, " (%d)\n", i);
189 dm_handle_free(hanp, hlen);