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
20 #include <lib/dmport.h>
23 The variable 'flags' was used with two different meanings within
24 the spec. Sometimes it was an int, and sometimes a u_int. I
25 changed all the u_int references to use the new symbol uflags.
27 The variable 'rlenp' was also used with two different meanings;
28 sometimes size_t, and sometimes dm_size_t. I introduced the new
29 symbol 'dmrlenp' for the dm_size_t cases.
39 dm_sessid_t sid = 0, oldsid = 0, targetsid = 0;
40 dm_sessid_t *newsidp = NULL, *sidbufp = NULL;
41 dm_token_t token = 0, *tokenp = NULL;
42 dm_token_t *rtokenp = NULL, *tokenbufp = NULL;
43 dm_attrname_t *attrnamep = NULL;
44 dm_off_t off = 0, *offp = NULL, *roffp = NULL;
45 dm_extent_t *extentp = NULL;
46 dm_inherit_t *inheritbufp = NULL;
47 dm_stat_t *statp = NULL;
48 dm_size_t len = 0, *dmrlenp = NULL, *retvalp = NULL;
49 dm_attrloc_t *locp = NULL;
50 dm_eventset_t *eventsetp = NULL;
51 dm_config_t flagname = DM_CONFIG_INVALID;
52 dm_region_t *regbufp = NULL;
53 dm_response_t response = DM_RESP_INVALID;
54 dm_right_t right = DM_RIGHT_NULL, *rightp = NULL;
55 dm_igen_t igen, *igenp = NULL;
56 dm_msgtype_t msgtype = DM_MSGTYPE_INVALID;
57 dm_fileattr_t *attrp = NULL;
58 dm_boolean_t enable = 0, *exactflagp = NULL;
59 dm_timestruct_t *delay = NULL;
61 size_t hlen = 0, dirhlen = 0, hlen1 = 0, hlen2 = 0;
62 size_t targhlen = 0, *fshlenp = NULL, *hlenp = NULL;
63 size_t msglen = 0, buflen = 0, *rlenp = NULL;
64 u_int nelem = 0, mask = 0, maxmsgs = 0, uflags = 0;
65 u_int *nelemp = NULL, maxevent = 0;
66 void *hanp = NULL, *dirhanp = NULL;
67 void *hanp1 = NULL, *hanp2 = NULL, *targhanp = NULL;
68 void *msgdatap = NULL, *bufp = NULL, **hanpp = NULL;
69 void *respbufp = NULL, **fshanpp = NULL;
70 dm_fsid_t fsid, *fsidp = NULL;
71 dm_ino_t ino, *inop = NULL;
72 char *cname = NULL, *sessinfop = NULL;
73 char *path = NULL, *pathbufp = NULL, **versionstrpp = NULL;
74 int flags = 0, fd = 0, setdtime = 0, reterror = 0;
76 /* Definitions per the prototypes in dmport.h, in the same order. */
78 dm_clear_inherit(sid, hanp, hlen, token, attrnamep);
79 dm_create_by_handle(sid, dirhanp, dirhlen, token,
81 dm_create_session(oldsid, sessinfop, newsidp);
82 dm_create_userevent(sid, msglen, msgdatap, tokenp);
83 dm_destroy_session(sid);
84 dm_downgrade_right(sid, hanp, hlen, token);
85 dm_fd_to_handle(fd, hanpp, hlenp);
86 dm_find_eventmsg(sid, token, buflen, bufp, rlenp);
87 dm_get_allocinfo(sid, hanp, hlen,
88 token, offp, nelem, extentp, nelemp);
89 dm_get_bulkall(sid, hanp, hlen, token, mask, attrnamep,
90 locp, buflen, bufp, rlenp);
91 dm_get_bulkattr(sid, hanp, hlen, token, mask, locp, buflen,
93 dm_get_config(hanp, hlen, flagname, retvalp);
94 dm_get_config_events(hanp, hlen, nelem, eventsetp, nelemp);
95 dm_get_dirattrs(sid, hanp, hlen, token, mask, locp, buflen,
97 dm_get_dmattr(sid, hanp, hlen, token, attrnamep, buflen,
99 dm_get_eventlist(sid, hanp, hlen, token, nelem, eventsetp, nelemp);
100 dm_get_events(sid, maxmsgs, flags, buflen, bufp, rlenp);
101 dm_get_fileattr(sid, hanp, hlen, token, mask, statp);
102 dm_get_mountinfo(sid, hanp, hlen, token, buflen, bufp, rlenp);
103 dm_get_region(sid, hanp, hlen, token, nelem, regbufp, nelemp);
104 dm_getall_disp(sid, buflen, bufp, rlenp);
105 dm_getall_dmattr(sid, hanp, hlen, token, buflen, bufp, rlenp);
106 dm_getall_inherit(sid, hanp, hlen,
107 token, nelem, inheritbufp, nelemp);
108 dm_getall_sessions(nelem, sidbufp, nelemp);
109 dm_getall_tokens(sid, nelem, tokenbufp, nelemp);
110 dm_handle_cmp(hanp1, hlen1, hanp2, hlen2);
111 dm_handle_free(hanp, hlen);
112 dm_handle_hash(hanp, hlen);
113 dm_handle_is_valid(hanp, hlen);
114 dm_handle_to_fshandle(hanp, hlen, fshanpp, fshlenp);
115 dm_handle_to_fsid(hanp, hlen, fsidp);
116 dm_handle_to_igen(hanp, hlen, igenp);
117 dm_handle_to_ino(hanp, hlen, inop);
118 dm_handle_to_path(dirhanp, dirhlen, targhanp, targhlen,
119 buflen, pathbufp, rlenp);
120 dm_init_attrloc(sid, hanp, hlen, token, locp);
121 dm_init_service(versionstrpp);
122 dm_make_handle(&fsid, &ino, &igen, hanpp, hlenp);
123 dm_make_fshandle(&fsid, hanpp, hlenp);
124 dm_mkdir_by_handle(sid, dirhanp, dirhlen, token,
126 dm_move_event(sid, token, targetsid, rtokenp);
127 dm_obj_ref_hold(sid, token, hanp, hlen);
128 dm_obj_ref_query(sid, token, hanp, hlen);
129 dm_obj_ref_rele(sid, token, hanp, hlen);
130 dm_path_to_fshandle(path, hanpp, hlenp);
131 dm_path_to_handle(path, hanpp, hlenp);
132 dm_pending(sid, token, delay);
133 dm_probe_hole(sid, hanp, hlen, token, off, len, roffp, dmrlenp);
134 dm_punch_hole(sid, hanp, hlen, token, off, len);
135 dm_query_right(sid, hanp, hlen, token, rightp);
136 dm_query_session(sid, buflen, bufp, rlenp);
137 dm_read_invis(sid, hanp, hlen, token, off, len, bufp);
138 dm_release_right(sid, hanp, hlen, token);
139 dm_remove_dmattr(sid, hanp, hlen, token, setdtime, attrnamep);
140 dm_request_right(sid, hanp, hlen, token, uflags, right);
141 dm_respond_event(sid, token, response, reterror, buflen, respbufp);
142 dm_send_msg(sid, msgtype, buflen, bufp);
143 dm_set_disp(sid, hanp, hlen, token, eventsetp, maxevent);
144 dm_set_dmattr(sid, hanp, hlen,
145 token, attrnamep, setdtime, buflen, bufp);
146 dm_set_eventlist(sid, hanp, hlen, token, eventsetp, maxevent);
147 dm_set_fileattr(sid, hanp, hlen, token, mask, attrp);
148 dm_set_inherit(sid, hanp, hlen, token, attrnamep, mode);
149 dm_set_region(sid, hanp, hlen, token, nelem, regbufp, exactflagp);
150 dm_set_return_on_destroy(sid, hanp, hlen,
151 token, attrnamep, enable);
152 dm_symlink_by_handle(sid, dirhanp, dirhlen, token,
153 hanp, hlen, cname, path);
154 dm_sync_by_handle(sid, hanp, hlen, token);
155 dm_upgrade_right(sid, hanp, hlen, token);
156 dm_write_invis(sid, hanp, hlen, flags, token, off, len, bufp);