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/
33 #ifndef _DMFSAPI_DMPORT_H
34 #define _DMFSAPI_DMPORT_H
40 /**************************************************************************
42 * DMF's use of DMAPI is based upon the X/Open document *
43 * Systems Management: Data Storage Managment (XDSM) API *
44 * dated February 1997. However, no implementation of DMAPI perfectly *
45 * matches the spec. Each implementation has some functions that it *
46 * didn't implement, non-standard functions that it added, differences *
47 * in function parameter types, return value types, number and order of *
48 * parameters, etc. There are also differences in the formats of some *
49 * of the DMAPI structures used by those functions. Finally, there are *
50 * many scalar values for which DMAPI assigned no particular size. For *
51 * example, a dm_fsid_t is 32 bits under Veritas and 64 bits under SGI. *
53 * To hide the differences as much as possible, this include file tries *
54 * to shoehorn each DMAPI implementation into the XDSM mold as much as *
55 * possible. Functions which are not compatible with the XDSM spec are *
56 * redefined using wrapper routines to make them conform to the spec. *
57 * Functions which were not implemented have stubs defined which return *
58 * ENOSYS (see file stubs.c for all wrappers and stubs). In dmport.h, *
59 * missing structures and scalers are defined, incompatible typedefs are *
62 * The goal is to reduce as much as possible the number of #ifdefs that *
63 * have to be added to DMF to handle specific DMAPI implementations. *
64 * Some #ifdefs may still be required because of semantic differences *
65 * between the XDSM spec definition and the actual implementation. *
67 * Following all the implementation-specific definitions, dmport.h *
68 * includes a complete set of prototypes for all functions that are part *
69 * of the XDSM specification. This is done as a double-check. Should *
70 * any of the actual implementations change, the compiler should tip us *
71 * off by complaining about imcompatible function redefinitions. *
73 **************************************************************************/
76 /* ---------------- Veritas-specific hack documentation -----------------
78 The following functions have no prototypes in the Veritas include file
79 <sys/dmapi/dmapi.h>. They do not link either.
81 extern int dm_handle_is_valid(void *, size_t);
84 The following functions have prototypes in <sys/dmapi/dmapi.h>, but
87 extern int dm_getall_disp(dm_sessid_t, size_t, void *, size_t *);
88 extern int dm_getall_dmattr(dm_sessid_t, void *, size_t,
89 dm_token_t, size_t, void *, size_t *);
92 The following functions have no prototypes in <sys/dmapi/dmapi.h> but do link.
94 extern int dm_obj_ref_hold(dm_sessid_t, dm_token_t, void *, size_t);
95 extern int dm_obj_ref_rele(dm_sessid_t, dm_token_t, void *, size_t);
96 extern int dm_obj_ref_query(dm_sessid_t, dm_token_t, void *, size_t);
99 The following Veritas prototypes are different in some way from the
100 spec prototypes, either in parameter types, return value types, or in
101 some semantic way. Look below to see the spec versions of the prototypes.
103 extern int dm_downgrade_right(dm_sessid_t, void *, size_t,
104 dm_token_t, int, dm_right_t);
105 extern int dm_get_config_events(void *, size_t, u_int,
106 dm_eventset_t *, u_int *);
107 extern int dm_get_events(dm_sessid_t, u_int, int, size_t, void *, size_t *);
108 extern int dm_get_mountinfo(dm_sessid_t, dm_token_t, void *, size_t,
109 size_t, void *, size_t *);
110 extern int dm_init_service(void);
111 extern int dm_make_handle(dev_t , long, long, void **, size_t *);
112 extern int dm_make_fshandle(dev_t , void **, size_t *);
113 extern dev_t dm_handle_to_dev(void *, size_t);
114 extern long dm_handle_to_fgen(void *, size_t);
115 extern long dm_handle_to_ino(void *, size_t);
116 extern int dm_pending(dm_sessid_t, void *, size_t, dm_token_t, int);
117 extern dm_ssize_t dm_read_invis(dm_sessid_t, void *, size_t,
118 dm_token_t, dm_off_t, dm_ssize_t, void *);
119 extern dm_ssize_t dm_write_invis(dm_sessid_t, void *, size_t,
120 dm_token_t, dm_off_t, dm_ssize_t, void *, int);
121 extern int dm_request_right(dm_sessid_t, void *, size_t,
122 dm_token_t, int, dm_right_t);
123 extern int dm_set_inherit(dm_sessid_t, void *, size_t,
124 dm_token_t, dm_attrname_t *, u_int);
125 extern int dm_set_return_ondestroy(dm_sessid_t, void *, size_t,
126 dm_token_t, dm_attrname_t *, int);
127 extern int dm_upgrade_right(dm_sessid_t, void *, size_t,
128 dm_token_t, int, dm_right_t);
129 extern int dm_set_region(dm_sessid_t, void *, size_t,
130 dm_token_t, u_int, dm_region_t *, u_int *);
131 extern dm_ssize_t dm_sync_by_handle(dm_sessid_t, void *, size_t, dm_token_t);
134 The following Veritas prototype exists in <sys/dmapi/dmapi.h> but
135 does not appear in the spec.
137 extern void dm_attach_event(dm_sessid_t, dm_token_t);
139 The following functions exist in the Veritas library libdmi.a, but have no
140 prototypes within <sys/dmapi/dmapi.h>. Their function is unknown.
142 dm_attach_event_nofork
151 -------------- end of Veritas-specific hack documentation --------------- */
155 #include <sys/types.h>
157 #include <sys/dmapi/dmapi.h>
159 /* Rename functions whose prototypes clash with the XDSM standard. (Library
160 routines map from XDSM functions back to Veritas functions.)
163 #define dm_downgrade_right xvfs_dm_downgrade_right
164 #define dm_fd_to_handle xvfs_dm_fd_to_handle
165 #define dm_get_events xvfs_dm_get_events
166 #define dm_get_mountinfo xvfs_dm_get_mountinfo
167 #define dm_handle_to_ino xvfs_dm_handle_to_ino
168 #define dm_init_service xvfs_dm_init_service
169 #define dm_make_fshandle xvfs_dm_make_fshandle
170 #define dm_make_handle xvfs_dm_make_handle
171 #define dm_path_to_fshandle xvfs_dm_path_to_fshandle
172 #define dm_path_to_handle xvfs_dm_path_to_handle
173 #define dm_pending xvfs_dm_pending
174 #define dm_read_invis xvfs_dm_read_invis
175 #define dm_write_invis xvfs_dm_write_invis
176 #define dm_request_right xvfs_dm_request_right
177 #define dm_set_inherit xvfs_dm_set_inherit
178 #define dm_set_region xvfs_dm_set_region
179 #define dm_sync_by_handle xvfs_dm_sync_by_handle
180 #define dm_upgrade_right xvfs_dm_upgrade_right
183 #define DM_ATTR_NAME_SIZE 8
184 #undef DM_ATTRNAME_SIZE
185 #define DM_VER_STR_CONTENTS "Veritas DMAPI V1.0"
187 #define DM_EV_WAIT 0x1
188 #define DM_RR_WAIT 0x1
191 #undef DM_EVENT_NOWAIT
193 #define DM_CONFIG_INHERIT_ATTRIBS (DM_CONFIG_LOCK_UPGRADE + 1)
194 #undef DM_CONFIG_INHERIT
195 #define DM_CONFIG_MAX_HANDLE_SIZE (DM_CONFIG_INHERIT_ATTRIBS + 1)
196 #undef DM_CONFIG_MAX_FILE_HANDLE_SIZE
197 #define DM_CONFIG_MAX_ATTR_ON_DESTROY (DM_CONFIG_MAX_HANDLE_SIZE + 1)
198 #undef DM_CONFIG_MAX_ATTR_BYTES_ON_DESTROY
199 #define DM_CONFIG_OBJ_REF (DM_CONFIG_MAX_ATTR_ON_DESTROY + 1)
200 #define DM_CONFIG_DTIME_OVERLOAD (DM_CONFIG_OBJ_REF + 1)
203 #define DM_AT_DTIME DM_AT_DTIMES
205 /* In the dm_fileattr_t structure, Veritas used 'timeval' structures for all
206 the time fields while XDSM uses 'time_t' structures. Define some symbols
207 that can be used for the time fields with all implementation types.
210 #define FA_ATIME fa_atime.tv_sec
211 #define FA_MTIME fa_atime.tv_sec
212 #define FA_CTIME fa_ctime.tv_sec
213 #define FA_DTIME fa_dtime.tv_sec
215 #define DM_WRITE_SYNC 0x1 /* used in dm_write_invis() */
217 #define DM_UNMOUNT_FORCE 0x1 /* ne_mode field in dm_namesp_event_t */
219 /* Rename one event to match the XDSM standard. */
221 #define DM_EVENT_CLOSE (DM_EVENT_DESTROY + 1)
222 #undef DM_EVENT_CLOSED
224 /* DM_EVENT_CANCEL is defined above DM_EVENT_MAX, and is unsupported. */
226 #undef DM_REGION_VALIDFLAG
228 /* Add missing typedefs */
230 typedef u_int dm_boolean_t;
231 typedef dev_t dm_fsid_t; /* This could be made a uint64_t with work! */
232 typedef long dm_igen_t;
233 typedef long dm_ino_t;
234 typedef u_int dm_sequence_t;
237 /* Define missing fields within the various event structures. */
239 #define ev_sequence ev_token /* for compilation only! Won't work! */
241 #define ds_handle te_handle /* fix fields in dm_destroy_event_t */
242 #define ds_attrname te_attrname
243 #define ds_attrcopy te_attrdata
246 struct dm_cancel_event { /* define missing dm_cancel_event_t */
247 dm_sequence_t ce_sequence;
250 typedef struct dm_cancel_event dm_cancel_event_t;
253 struct dm_mount_event { /* define missing dm_mount_event_t */
255 dm_vardata_t me_handle1;
256 dm_vardata_t me_handle2;
257 dm_vardata_t me_name1;
258 dm_vardata_t me_name2;
259 dm_vardata_t me_roothandle;
261 typedef struct dm_mount_event dm_mount_event_t;
264 /* Add the missing dm_timestruct_t structure used by dm_pending. */
266 struct dm_timestruct {
270 typedef struct dm_timestruct dm_timestruct_t;
276 /* -------------------- SGI-specific hack documentation -------------------
278 There are various fields within DMAPI structures that are not supported.
279 Fill in this information someday.
281 The following functions have prototypes defined in <sys/dmi.h> and have
282 entry points defined in libdm.so, but they are not actually implemented
283 within the kernel. They all return ENOSYS if called.
293 The DMAPI functions which deal with rights do not work as described in
294 the specification. While the functions exist and are callable, they
295 always return successfully without actually obtaining any locks within
304 The following non-standard SGI prototype is added to the DMAPI interface
305 so that real-time files may be migrated and recalled.
309 -------------- end of SGI-specific hack documentation --------------- */
315 /* In the dm_fileattr_t structure, Veritas used 'timeval' structures for all
316 the time fields while XDSM uses 'time_t' structures. Define some symbols
317 that can be used for the time fields with all implementation types.
320 #define FA_ATIME fa_atime
321 #define FA_MTIME fa_mtime
322 #define FA_CTIME fa_ctime
323 #define FA_DTIME fa_dtime
331 /* In the dm_fileattr_t structure, Veritas used 'timeval' structures for all
332 the time fields while XDSM uses 'time_t' structures. Define some symbols
333 that can be used for the time fields with all implementation types.
336 #define FA_ATIME fa_atime
337 #define FA_MTIME fa_mtime
338 #define FA_CTIME fa_ctime
339 #define FA_DTIME fa_dtime
343 /* ----------------------- XDSM standard prototypes ----------------------- */
345 /* The following list provides the prototypes for all functions defined in
346 the DMAPI interface spec from X/Open (XDSM) dated February 1997. They
347 are here to force compiler errors in case the Veritas or SGI DMAPI
348 prototypes should ever change without our knowing about it.
357 dm_attrname_t *attrnamep);
373 dm_sessid_t *newsidp);
415 dm_extent_t *extentp,
425 dm_attrname_t *attrnamep,
447 dm_config_t flagname,
451 dm_get_config_events(
455 dm_eventset_t *eventsetp,
476 dm_attrname_t *attrnamep,
488 dm_eventset_t *eventsetp,
526 dm_region_t *regbufp,
553 dm_inherit_t *inheritbufp,
559 dm_sessid_t *sidbufp,
566 dm_token_t *tokenbufp,
592 dm_handle_to_fshandle(
636 char **versionstrpp);
666 dm_sessid_t targetsid,
667 dm_token_t *rtokenp);
706 dm_timestruct_t *delay);
767 dm_attrname_t *attrnamep);
782 dm_response_t response,
789 dm_sessid_t targetsid,
790 dm_msgtype_t msgtype,
800 dm_eventset_t *eventsetp,
809 dm_attrname_t *attrnamep,
820 dm_eventset_t *eventsetp,
830 dm_fileattr_t *attrp);
838 dm_attrname_t *attrnamep,
848 dm_region_t *regbufp,
849 dm_boolean_t *exactflagp);
852 dm_set_return_on_destroy(
857 dm_attrname_t *attrnamep,
858 dm_boolean_t enable);
861 dm_symlink_by_handle(
901 #endif /* _DMFSAPI_DMPORT_H */