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 Progname = strrchr(argv[0], '/');
75 /* Crack and validate the command line options. */
77 while ((opt = getopt(argc, argv, "n:")) != EOF) {
86 if (optind + 1 != argc)
88 han_str = argv[optind];
89 if ((error = atohan(han_str, &hanp, &hlen)) != 0) {
90 fprintf(stderr, "atohan() failed, %s\n", strerror(error));
94 if (dm_init_service(&name)) {
95 fprintf(stderr, "Can't initialize the DMAPI\n");
101 if (dm_get_config_events(hanp, hlen, nelem, &eventset, &nelemp)) {
102 fprintf(stderr, "dm_get_config_events failed, %s\n",
107 fprintf(stdout, "Events supported (0x%llx), nelemp %d:\n",
108 (unsigned long long) eventset, nelemp);
110 for (i = 0; i < nelemp; i++) {
111 if (!DMEV_ISSET(i, eventset))
114 case DM_EVENT_CANCEL:
115 fprintf(stdout, "DM_EVENT_CANCEL");
118 fprintf(stdout, "DM_EVENT_MOUNT");
120 case DM_EVENT_PREUNMOUNT:
121 fprintf(stdout, "DM_EVENT_PREUNMOUNT");
123 case DM_EVENT_UNMOUNT:
124 fprintf(stdout, "DM_EVENT_UNMOUNT");
127 fprintf(stdout, "DM_EVENT_DEBUT");
129 case DM_EVENT_CREATE:
130 fprintf(stdout, "DM_EVENT_CREATE");
133 fprintf(stdout, "DM_EVENT_CLOSE");
135 case DM_EVENT_POSTCREATE:
136 fprintf(stdout, "DM_EVENT_POSTCREATE");
138 case DM_EVENT_REMOVE:
139 fprintf(stdout, "DM_EVENT_REMOVE");
141 case DM_EVENT_POSTREMOVE:
142 fprintf(stdout, "DM_EVENT_POSTREMOVE");
144 case DM_EVENT_RENAME:
145 fprintf(stdout, "DM_EVENT_RENAME");
147 case DM_EVENT_POSTRENAME:
148 fprintf(stdout, "DM_EVENT_POSTRENAME");
151 fprintf(stdout, "DM_EVENT_LINK");
153 case DM_EVENT_POSTLINK:
154 fprintf(stdout, "DM_EVENT_POSTLINK");
156 case DM_EVENT_SYMLINK:
157 fprintf(stdout, "DM_EVENT_SYMLINK");
159 case DM_EVENT_POSTSYMLINK:
160 fprintf(stdout, "DM_EVENT_POSTSYMLINK");
163 fprintf(stdout, "DM_EVENT_READ");
166 fprintf(stdout, "DM_EVENT_WRITE");
168 case DM_EVENT_TRUNCATE:
169 fprintf(stdout, "DM_EVENT_TRUNCATE");
171 case DM_EVENT_ATTRIBUTE:
172 fprintf(stdout, "DM_EVENT_ATTRIBUTE");
174 case DM_EVENT_DESTROY:
175 fprintf(stdout, "DM_EVENT_DESTROY");
177 case DM_EVENT_NOSPACE:
178 fprintf(stdout, "DM_EVENT_NOSPACE");
181 fprintf(stdout, "DM_EVENT_USER");
184 fprintf(stdout, "DM_EVENT_23");
187 fprintf(stdout, " (%d)\n", i);
190 dm_handle_free(hanp, hlen);