2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
38 /*---------------------------------------------------------------------------
40 Test program used to test the DMAPI function dm_get_config_events(). The
43 get_config_events [-n nelem] handle
45 where handle is the handle of a file or filesystem, and nelem is the value
46 to use for the nelem parameter to dm_get_eventlist().
48 ----------------------------------------------------------------------------*/
61 fprintf(stderr, "usage:\t%s [-n nelem] handle\n", Progname);
71 u_int nelem = DM_EVENT_MAX;
73 dm_eventset_t eventset;
82 if (Progname = strrchr(argv[0], '/')) {
88 /* Crack and validate the command line options. */
90 while ((opt = getopt(argc, argv, "n:")) != EOF) {
99 if (optind + 1 != argc)
101 han_str = argv[optind];
102 if ((error = atohan(han_str, &hanp, &hlen)) != 0) {
103 fprintf(stderr, "atohan() failed, %s\n", strerror(error));
107 if (dm_init_service(&name)) {
108 fprintf(stderr, "Can't inititalize the DMAPI\n");
114 if (dm_get_config_events(hanp, hlen, nelem, &eventset, &nelemp)) {
115 fprintf(stderr, "dm_get_config_events failed, %s\n",
120 fprintf(stdout, "Events supported (0x%llx), nelemp %d:\n",
123 for (i = 0; i < nelemp; i++) {
124 if (!DMEV_ISSET(i, eventset))
127 case DM_EVENT_CANCEL:
128 fprintf(stdout, "DM_EVENT_CANCEL");
131 fprintf(stdout, "DM_EVENT_MOUNT");
133 case DM_EVENT_PREUNMOUNT:
134 fprintf(stdout, "DM_EVENT_PREUNMOUNT");
136 case DM_EVENT_UNMOUNT:
137 fprintf(stdout, "DM_EVENT_UNMOUNT");
140 fprintf(stdout, "DM_EVENT_DEBUT");
142 case DM_EVENT_CREATE:
143 fprintf(stdout, "DM_EVENT_CREATE");
146 fprintf(stdout, "DM_EVENT_CLOSE");
148 case DM_EVENT_POSTCREATE:
149 fprintf(stdout, "DM_EVENT_POSTCREATE");
151 case DM_EVENT_REMOVE:
152 fprintf(stdout, "DM_EVENT_REMOVE");
154 case DM_EVENT_POSTREMOVE:
155 fprintf(stdout, "DM_EVENT_POSTREMOVE");
157 case DM_EVENT_RENAME:
158 fprintf(stdout, "DM_EVENT_RENAME");
160 case DM_EVENT_POSTRENAME:
161 fprintf(stdout, "DM_EVENT_POSTRENAME");
164 fprintf(stdout, "DM_EVENT_LINK");
166 case DM_EVENT_POSTLINK:
167 fprintf(stdout, "DM_EVENT_POSTLINK");
169 case DM_EVENT_SYMLINK:
170 fprintf(stdout, "DM_EVENT_SYMLINK");
172 case DM_EVENT_POSTSYMLINK:
173 fprintf(stdout, "DM_EVENT_POSTSYMLINK");
176 fprintf(stdout, "DM_EVENT_READ");
179 fprintf(stdout, "DM_EVENT_WRITE");
181 case DM_EVENT_TRUNCATE:
182 fprintf(stdout, "DM_EVENT_TRUNCATE");
184 case DM_EVENT_ATTRIBUTE:
185 fprintf(stdout, "DM_EVENT_ATTRIBUTE");
187 case DM_EVENT_DESTROY:
188 fprintf(stdout, "DM_EVENT_DESTROY");
190 case DM_EVENT_NOSPACE:
191 fprintf(stdout, "DM_EVENT_NOSPACE");
194 fprintf(stdout, "DM_EVENT_USER");
197 fprintf(stdout, "DM_EVENT_23");
200 fprintf(stdout, " (%d)\n", i);
203 dm_handle_free(hanp, hlen);