Update copyright dates (again)
[xfstests-dev.git] / dmapi / src / suite1 / cmd / link_test.c
1 /*
2  * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
3  * 
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.
7  * 
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.
11  * 
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.
18  * 
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.
22  * 
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  * 
26  * http://www.sgi.com 
27  * 
28  * For further information regarding this notice, see: 
29  * 
30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31  */
32
33 #include <stdlib.h>
34 #include <lib/dmport.h>
35
36 /*
37         The variable 'flags' was used with two different meanings within
38         the spec.  Sometimes it was an int, and sometimes a u_int.  I 
39         changed all the u_int references to use the new symbol uflags.
40
41         The variable 'rlenp' was also used with two different meanings;
42         sometimes size_t, and sometimes dm_size_t.  I introduced the new
43         symbol 'dmrlenp' for the dm_size_t cases.
44 */
45
46 char *Progname;
47
48 int
49 main(
50         int     argc,
51         char    **argv)
52 {
53         dm_sessid_t     sid, oldsid, targetsid, *newsidp, *sidbufp;
54         dm_token_t      token, *tokenp, *rtokenp, *tokenbufp;
55         dm_attrname_t   *attrnamep;
56         dm_off_t        off, *offp, *roffp;
57         dm_extent_t     *extentp;
58         dm_inherit_t    *inheritbufp;
59         dm_stat_t       *statp;
60         dm_size_t       len, *dmrlenp, *retvalp;
61         dm_attrloc_t    *locp;
62         dm_eventset_t   *eventsetp;
63         dm_config_t     flagname;
64         dm_region_t     *regbufp;
65         dm_response_t   response;
66         dm_right_t      right, *rightp;
67         dm_igen_t       igen, *igenp;
68         dm_msgtype_t    msgtype;
69         dm_fileattr_t   *attrp;
70         dm_boolean_t    enable, *exactflagp;
71         dm_timestruct_t *delay;
72         mode_t          mode;
73         size_t          hlen, dirhlen, hlen1, hlen2, targhlen, *fshlenp, *hlenp;
74         size_t          msglen, buflen, *rlenp;
75         u_int           nelem, mask, maxmsgs, uflags, *nelemp, maxevent;
76         void            *hanp, *dirhanp, *hanp1, *hanp2, *targhanp;
77         void            *msgdatap, *bufp, **hanpp, *respbufp, **fshanpp;
78         dm_fsid_t       fsid, *fsidp;
79         dm_ino_t        ino, *inop;
80         char            *cname, *sessinfop, *path, *pathbufp, **versionstrpp;
81         int             flags, fd, setdtime, reterror;
82         u_int   urc;
83         int     rc;
84         dm_ssize_t      ssrc;
85
86 /* Definitions per the prototypes in dmport.h, in the same order. */
87
88         rc = dm_clear_inherit(sid, hanp, hlen, token, attrnamep);
89         rc = dm_create_by_handle(sid, dirhanp, dirhlen, token,
90                 hanp, hlen, cname);
91         rc = dm_create_session(oldsid, sessinfop, newsidp);
92         rc = dm_create_userevent(sid, msglen, msgdatap, tokenp);
93         rc = dm_destroy_session(sid);
94         rc = dm_downgrade_right(sid, hanp, hlen, token);
95         rc = dm_fd_to_handle(fd, hanpp, hlenp);
96         rc = dm_find_eventmsg(sid, token, buflen, bufp, rlenp);
97         rc = dm_get_allocinfo(sid, hanp, hlen,
98                 token, offp, nelem, extentp, nelemp);
99         rc = dm_get_bulkall(sid, hanp, hlen, token, mask, attrnamep,
100                 locp, buflen, bufp, rlenp);
101         rc = dm_get_bulkattr(sid, hanp, hlen, token, mask, locp, buflen, 
102                 bufp, rlenp);
103         rc = dm_get_config(hanp, hlen, flagname, retvalp);
104         rc = dm_get_config_events(hanp, hlen, nelem, eventsetp, nelemp);
105         rc = dm_get_dirattrs(sid, hanp, hlen, token, mask, locp, buflen,
106                 bufp, rlenp);
107         rc = dm_get_dmattr(sid, hanp, hlen, token, attrnamep, buflen,
108                 bufp, rlenp);
109         rc = dm_get_eventlist(sid, hanp, hlen, token, nelem, eventsetp, nelemp);
110         rc = dm_get_events(sid, maxmsgs, flags, buflen, bufp, rlenp);
111         rc = dm_get_fileattr(sid, hanp, hlen, token, mask, statp);
112         rc = dm_get_mountinfo(sid, hanp, hlen, token, buflen, bufp, rlenp);
113         rc = dm_get_region(sid, hanp, hlen, token, nelem, regbufp, nelemp);
114         rc = dm_getall_disp(sid, buflen, bufp, rlenp);
115         rc = dm_getall_dmattr(sid, hanp, hlen, token, buflen, bufp, rlenp);
116         rc = dm_getall_inherit(sid, hanp, hlen,
117                 token, nelem, inheritbufp, nelemp);
118         rc = dm_getall_sessions(nelem, sidbufp, nelemp);
119         rc = dm_getall_tokens(sid, nelem, tokenbufp, nelemp);
120         rc = dm_handle_cmp(hanp1, hlen1, hanp2, hlen2);
121         dm_handle_free(hanp, hlen);
122         urc = dm_handle_hash(hanp, hlen);
123         rc = dm_handle_is_valid(hanp, hlen);
124         rc = dm_handle_to_fshandle(hanp, hlen, fshanpp, fshlenp);
125         rc = dm_handle_to_fsid(hanp, hlen, fsidp);
126         rc = dm_handle_to_igen(hanp, hlen, igenp);
127         rc = dm_handle_to_ino(hanp, hlen, inop);
128         rc = dm_handle_to_path(dirhanp, dirhlen, targhanp, targhlen, 
129                 buflen, pathbufp, rlenp);
130         rc = dm_init_attrloc(sid, hanp, hlen, token, locp);
131         rc = dm_init_service(versionstrpp);
132         rc = dm_make_handle(&fsid, &ino, &igen, hanpp, hlenp);
133         rc = dm_make_fshandle(&fsid, hanpp, hlenp);
134         rc = dm_mkdir_by_handle(sid, dirhanp, dirhlen, token,
135                 hanp, hlen, cname); 
136         rc = dm_move_event(sid, token, targetsid, rtokenp);
137         rc = dm_obj_ref_hold(sid, token, hanp, hlen);
138         rc = dm_obj_ref_query(sid, token, hanp, hlen);
139         rc = dm_obj_ref_rele(sid, token, hanp, hlen);
140         rc = dm_path_to_fshandle(path, hanpp, hlenp);
141         rc = dm_path_to_handle(path, hanpp, hlenp);
142         rc = dm_pending(sid, token, delay);
143         rc = dm_probe_hole(sid, hanp, hlen, token, off, len, roffp, dmrlenp);
144         rc = dm_punch_hole(sid, hanp, hlen, token, off, len);
145         rc = dm_query_right(sid, hanp, hlen, token, rightp);
146         rc = dm_query_session(sid, buflen, bufp, rlenp);
147         ssrc = dm_read_invis(sid, hanp, hlen, token, off, len, bufp);
148         rc =  dm_release_right(sid, hanp, hlen, token);
149         rc = dm_remove_dmattr(sid, hanp, hlen, token, setdtime, attrnamep);
150         rc = dm_request_right(sid, hanp, hlen, token, uflags, right);
151         rc = dm_respond_event(sid, token, response, reterror, buflen, respbufp);
152         rc = dm_send_msg(sid, msgtype, buflen, bufp);
153         rc = dm_set_disp(sid, hanp, hlen, token, eventsetp, maxevent);
154         rc = dm_set_dmattr(sid, hanp, hlen,
155                 token, attrnamep, setdtime, buflen, bufp);
156         rc = dm_set_eventlist(sid, hanp, hlen, token, eventsetp, maxevent);
157         rc = dm_set_fileattr(sid, hanp, hlen, token, mask, attrp);
158         rc = dm_set_inherit(sid, hanp, hlen, token, attrnamep, mode);
159         rc = dm_set_region(sid, hanp, hlen, token, nelem, regbufp, exactflagp);
160         rc = dm_set_return_on_destroy(sid, hanp, hlen,
161                 token,  attrnamep, enable);
162         rc = dm_symlink_by_handle(sid, dirhanp, dirhlen, token,
163                 hanp, hlen, cname, path); 
164         rc = dm_sync_by_handle(sid, hanp, hlen, token);
165         rc = dm_upgrade_right(sid, hanp, hlen, token);
166         ssrc = dm_write_invis(sid, hanp, hlen, flags, token, off, len, bufp);
167         exit(0);
168 }