1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1998-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 #include <stdio.h>
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #include <sys/mman.h>
31 #include <sys/uio.h>
32 #include <sys/sysmacros.h>
33 #include <unistd.h>
34 #include <fcntl.h>
35 #include <dlfcn.h>
36 #include <sched.h>
37 #include <errno.h>
38 #include <strings.h>
39
40 #include <rsmapi.h>
41 #include <sys/rsm/rsmndi.h>
42 #include <rsmlib_in.h>
43 #include <sys/rsm/rsm.h>
44
45 extern int _rsm_memseg_import_map(rsm_memseg_import_handle_t,
46 void **,
47 rsm_attribute_t,
48 rsm_permission_t,
49 off_t, size_t);
50
51 extern int _rsm_memseg_import_unmap(rsm_memseg_import_handle_t);
52
53 static rsm_ndlib_attr_t _rsm_loopback_attr = {
54 B_TRUE, /* mapping needed for put/get */
55 B_TRUE /* mapping needed for putv/getv */
56 };
57
58 static int
loopback_get8(rsm_memseg_import_handle_t im_memseg,off_t off,uint8_t * datap,ulong_t rep_cnt,boolean_t swap)59 loopback_get8(rsm_memseg_import_handle_t im_memseg, off_t off,
60 uint8_t *datap,
61 ulong_t rep_cnt,
62 boolean_t swap)
63 {
64 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
65 uint8_t *data_addr =
66 (uint8_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
67 uint_t i = 0;
68 int e;
69
70 swap = swap;
71
72 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
73 "loopback_get8: enter\n"));
74
75 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
76 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
77 (rsm_barrier_handle_t)seg->rsmseg_barrier);
78 if (e != RSM_SUCCESS) {
79 return (e);
80 }
81 }
82
83 for (i = 0; i < rep_cnt; i++) {
84 datap[i] = data_addr[i];
85 }
86
87 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
88 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
89 (rsm_barrier_handle_t)seg->rsmseg_barrier);
90 if (e != RSM_SUCCESS) {
91 return (e);
92 }
93 }
94
95 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
96 "loopback_get8: exit\n"));
97
98 return (RSM_SUCCESS);
99 }
100
101 static int
loopback_get16(rsm_memseg_import_handle_t im_memseg,off_t off,uint16_t * datap,ulong_t rep_cnt,boolean_t swap)102 loopback_get16(rsm_memseg_import_handle_t im_memseg, off_t off,
103 uint16_t *datap,
104 ulong_t rep_cnt,
105 boolean_t swap)
106 {
107 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
108 uint16_t *data_addr =
109 /* LINTED */
110 (uint16_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
111 uint_t i = 0;
112 int e;
113
114 swap = swap;
115
116 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
117 "loopback_get16: enter\n"));
118
119 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
120 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
121 (rsm_barrier_handle_t)seg->rsmseg_barrier);
122 if (e != RSM_SUCCESS) {
123 return (e);
124 }
125 }
126
127 for (i = 0; i < rep_cnt; i++) {
128 datap[i] = data_addr[i];
129 }
130
131 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
132 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
133 (rsm_barrier_handle_t)seg->rsmseg_barrier);
134 if (e != RSM_SUCCESS) {
135 return (e);
136 }
137 }
138
139 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
140 "loopback_get16: exit\n"));
141
142 return (RSM_SUCCESS);
143 }
144
145 static int
loopback_get32(rsm_memseg_import_handle_t im_memseg,off_t off,uint32_t * datap,ulong_t rep_cnt,boolean_t swap)146 loopback_get32(rsm_memseg_import_handle_t im_memseg, off_t off,
147 uint32_t *datap,
148 ulong_t rep_cnt,
149 boolean_t swap)
150 {
151 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
152 uint32_t *data_addr =
153 /* LINTED */
154 (uint32_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
155 uint_t i = 0;
156 int e;
157
158 swap = swap;
159
160 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
161 "loopback_get32: enter\n"));
162
163 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
164 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
165 (rsm_barrier_handle_t)seg->rsmseg_barrier);
166 if (e != RSM_SUCCESS) {
167 return (e);
168 }
169 }
170
171 for (i = 0; i < rep_cnt; i++) {
172 datap[i] = data_addr[i];
173 }
174
175 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
176 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
177 (rsm_barrier_handle_t)seg->rsmseg_barrier);
178 if (e != RSM_SUCCESS) {
179 return (e);
180 }
181 }
182
183 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
184 "loopback_get32: exit\n"));
185
186 return (RSM_SUCCESS);
187 }
188
189 static int
loopback_get64(rsm_memseg_import_handle_t im_memseg,off_t off,uint64_t * datap,ulong_t rep_cnt,boolean_t swap)190 loopback_get64(rsm_memseg_import_handle_t im_memseg, off_t off,
191 uint64_t *datap,
192 ulong_t rep_cnt,
193 boolean_t swap)
194 {
195 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
196 uint64_t *data_addr =
197 /* LINTED */
198 (uint64_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
199 uint_t i = 0;
200 int e;
201
202 swap = swap;
203
204 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
205 "loopback_get64: enter\n"));
206
207 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
208 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
209 (rsm_barrier_handle_t)seg->rsmseg_barrier);
210 if (e != RSM_SUCCESS) {
211 return (e);
212 }
213 }
214
215 for (i = 0; i < rep_cnt; i++) {
216 datap[i] = data_addr[i];
217 }
218
219 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
220 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
221 (rsm_barrier_handle_t)seg->rsmseg_barrier);
222 if (e != RSM_SUCCESS) {
223 return (e);
224 }
225 }
226
227 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
228 "loopback_get64: exit\n"));
229
230 return (RSM_SUCCESS);
231 }
232
233 static int
loopback_put8(rsm_memseg_import_handle_t im_memseg,off_t off,uint8_t * datap,ulong_t rep_cnt,boolean_t swap)234 loopback_put8(rsm_memseg_import_handle_t im_memseg, off_t off,
235 uint8_t *datap,
236 ulong_t rep_cnt,
237 boolean_t swap)
238 {
239 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
240 uint8_t *data_addr =
241 (uint8_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
242 uint_t i = 0;
243 int e;
244
245 swap = swap;
246
247 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
248 "loopback_put8: enter\n"));
249
250 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
251 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
252 (rsm_barrier_handle_t)seg->rsmseg_barrier);
253 if (e != RSM_SUCCESS) {
254 return (e);
255 }
256 }
257
258 for (i = 0; i < rep_cnt; i++) {
259 data_addr[i] = datap[i];
260 }
261
262 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
263 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
264 (rsm_barrier_handle_t)seg->rsmseg_barrier);
265 if (e != RSM_SUCCESS) {
266 return (e);
267 }
268 }
269
270 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
271 "loopback_put8: exit\n"));
272
273 return (RSM_SUCCESS);
274 }
275
276 static int
loopback_put16(rsm_memseg_import_handle_t im_memseg,off_t off,uint16_t * datap,ulong_t rep_cnt,boolean_t swap)277 loopback_put16(rsm_memseg_import_handle_t im_memseg, off_t off,
278 uint16_t *datap,
279 ulong_t rep_cnt,
280 boolean_t swap)
281 {
282 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
283 uint16_t *data_addr =
284 /* LINTED */
285 (uint16_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
286 uint_t i = 0;
287 int e;
288
289 swap = swap;
290
291 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
292 "loopback_put16: enter\n"));
293
294 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
295 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
296 (rsm_barrier_handle_t)seg->rsmseg_barrier);
297 if (e != RSM_SUCCESS) {
298 return (e);
299 }
300 }
301
302 for (i = 0; i < rep_cnt; i++) {
303 data_addr[i] = datap[i];
304 }
305
306 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
307 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
308 (rsm_barrier_handle_t)seg->rsmseg_barrier);
309 if (e != RSM_SUCCESS) {
310 return (e);
311 }
312 }
313
314 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
315 "loopback_put16: exit\n"));
316
317 return (RSM_SUCCESS);
318 }
319
320 static int
loopback_put32(rsm_memseg_import_handle_t im_memseg,off_t off,uint32_t * datap,ulong_t rep_cnt,boolean_t swap)321 loopback_put32(rsm_memseg_import_handle_t im_memseg, off_t off,
322 uint32_t *datap,
323 ulong_t rep_cnt,
324 boolean_t swap)
325 {
326 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
327 uint32_t *data_addr =
328 /* LINTED */
329 (uint32_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
330 uint_t i = 0;
331 int e;
332
333 swap = swap;
334
335 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
336 "loopback_put32: enter\n"));
337
338 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
339 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
340 (rsm_barrier_handle_t)seg->rsmseg_barrier);
341 if (e != RSM_SUCCESS) {
342 return (e);
343 }
344 }
345
346 for (i = 0; i < rep_cnt; i++) {
347 data_addr[i] = datap[i];
348 }
349
350 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
351 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
352 (rsm_barrier_handle_t)seg->rsmseg_barrier);
353 if (e != RSM_SUCCESS) {
354 return (e);
355 }
356 }
357
358 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
359 "loopback_put32: exit\n"));
360
361 return (RSM_SUCCESS);
362 }
363
364 static int
loopback_put64(rsm_memseg_import_handle_t im_memseg,off_t off,uint64_t * datap,ulong_t rep_cnt,boolean_t swap)365 loopback_put64(rsm_memseg_import_handle_t im_memseg, off_t off,
366 uint64_t *datap,
367 ulong_t rep_cnt,
368 boolean_t swap)
369 {
370 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
371 uint64_t *data_addr =
372 /* LINTED */
373 (uint64_t *)&seg->rsmseg_vaddr[off - seg->rsmseg_mapoffset];
374 uint_t i = 0;
375 int e;
376
377 swap = swap;
378
379 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
380 "loopback_put64: enter\n"));
381
382 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
383 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
384 (rsm_barrier_handle_t)seg->rsmseg_barrier);
385 if (e != RSM_SUCCESS) {
386 return (e);
387 }
388 }
389
390 for (i = 0; i < rep_cnt; i++) {
391 data_addr[i] = datap[i];
392 }
393
394 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
395 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
396 (rsm_barrier_handle_t)seg->rsmseg_barrier);
397 if (e != RSM_SUCCESS) {
398 return (e);
399 }
400 }
401
402 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
403 "loopback_put64: exit\n"));
404
405 return (RSM_SUCCESS);
406 }
407
408 static int
loopback_get(rsm_memseg_import_handle_t im_memseg,off_t offset,void * dst_addr,size_t length)409 loopback_get(rsm_memseg_import_handle_t im_memseg, off_t offset, void *dst_addr,
410 size_t length)
411 {
412 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
413 int e;
414
415 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
416 "loopback_get: enter\n"));
417
418 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
419 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
420 (rsm_barrier_handle_t)seg->rsmseg_barrier);
421 if (e != RSM_SUCCESS) {
422 return (e);
423 }
424 }
425
426 bcopy(seg->rsmseg_vaddr + offset - seg->rsmseg_mapoffset, dst_addr,
427 length);
428
429 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
430 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
431 (rsm_barrier_handle_t)seg->rsmseg_barrier);
432 if (e != RSM_SUCCESS) {
433 return (e);
434 }
435 }
436
437 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
438 "loopback_get: exit\n"));
439
440 return (RSM_SUCCESS);
441 }
442
443
444 /*
445 * Move data to each component of the io vector from the remote segment
446 */
447 int
loopback_getv(rsm_scat_gath_t * sg_io)448 loopback_getv(rsm_scat_gath_t *sg_io)
449 {
450 rsm_iovec_t *iovec = sg_io->iovec;
451 rsmseg_handle_t *im_seg = (rsmseg_handle_t *)sg_io->remote_handle;
452 int i;
453
454 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
455 "loopback_getv: enter\n"));
456
457 /* do the vector data transfer */
458 for (i = 0; i < sg_io->io_request_count; i++) {
459 (void) bcopy(im_seg->rsmseg_vaddr + iovec->remote_offset,
460 iovec->local.vaddr + iovec->local_offset,
461 iovec->transfer_length);
462 iovec++;
463 }
464
465 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
466 "loopback_getv: exit\n"));
467
468 sg_io->io_residual_count = 0;
469
470 return (RSM_SUCCESS);
471 }
472
473 static int
loopback_put(rsm_memseg_import_handle_t im_memseg,off_t offset,void * src_addr,size_t length)474 loopback_put(rsm_memseg_import_handle_t im_memseg, off_t offset, void *src_addr,
475 size_t length)
476 {
477 rsmseg_handle_t *seg = (rsmseg_handle_t *)im_memseg;
478 int e;
479
480 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
481 "loopback_put: enter\n"));
482
483 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
484 e = seg->rsmseg_ops->rsm_memseg_import_open_barrier(
485 (rsm_barrier_handle_t)seg->rsmseg_barrier);
486 if (e != RSM_SUCCESS) {
487 return (e);
488 }
489 }
490
491 bcopy(src_addr, seg->rsmseg_vaddr + offset - seg->rsmseg_mapoffset,
492 length);
493
494 if (seg->rsmseg_barmode == RSM_BARRIER_MODE_IMPLICIT) {
495 e = seg->rsmseg_ops->rsm_memseg_import_close_barrier(
496 (rsm_barrier_handle_t)seg->rsmseg_barrier);
497 if (e != RSM_SUCCESS) {
498 return (e);
499 }
500 }
501
502 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
503 "loopback_put: exit\n"));
504
505 return (RSM_SUCCESS);
506 }
507
508
509 /*
510 * Move data from each component of the io vector to the remote segment
511 */
512 int
loopback_putv(rsm_scat_gath_t * sg_io)513 loopback_putv(rsm_scat_gath_t *sg_io)
514 {
515 rsm_iovec_t *iovec = sg_io->iovec;
516 rsmseg_handle_t *im_seg = (rsmseg_handle_t *)sg_io->remote_handle;
517 int i;
518
519 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
520 "loopback_putv: enter\n"));
521
522 /* do the vector data transfer */
523 for (i = 0; i < sg_io->io_request_count; i++) {
524 (void) bcopy(iovec->local.vaddr + iovec->local_offset,
525 im_seg->rsmseg_vaddr + iovec->remote_offset,
526 iovec->transfer_length);
527 iovec++;
528 }
529
530 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
531 "loopback_putv: exit\n"));
532
533 sg_io->io_residual_count = 0;
534
535 return (RSM_SUCCESS);
536 }
537
538 static int
loopback_create_handle(rsmapi_controller_handle_t controller,rsm_localmemory_handle_t * local_handle,caddr_t vaddr,size_t len)539 loopback_create_handle(rsmapi_controller_handle_t controller,
540 rsm_localmemory_handle_t *local_handle,
541 caddr_t vaddr, size_t len)
542 {
543
544 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
545 "loopback_create_handle: enter\n"));
546
547 controller = controller;
548 len = len;
549
550 *local_handle = (rsm_localmemory_handle_t)vaddr;
551
552 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
553 "loopback_create_handle: exit\n"));
554
555 return (RSM_SUCCESS);
556 }
557
558 static int
loopback_free_handle(rsm_localmemory_handle_t handle)559 loopback_free_handle(rsm_localmemory_handle_t handle)
560 {
561
562 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
563 "loopback_free_handle: enter\n"));
564
565 handle = handle;
566
567 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
568 "loopback_free_handle: exit\n"));
569
570 return (RSM_SUCCESS);
571 }
572
573
574 /*
575 * import side memory segment operations (barriers):
576 */
577 static int
loopback_init_barrier(rsm_memseg_import_handle_t im_memseg,rsm_barrier_type_t type,rsm_barrier_handle_t barrier)578 loopback_init_barrier(rsm_memseg_import_handle_t im_memseg,
579 rsm_barrier_type_t type,
580 rsm_barrier_handle_t barrier)
581 {
582
583 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
584 "loopback_init_barrier: enter\n"));
585
586 type = type; im_memseg = im_memseg; barrier = barrier;
587
588 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
589 "loopback_init_barrier: exit\n"));
590
591 return (RSM_SUCCESS);
592 }
593
594 static int
loopback_open_barrier(rsm_barrier_handle_t barrier)595 loopback_open_barrier(rsm_barrier_handle_t barrier)
596 {
597
598 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
599 "loopback_open_barrier: enter\n"));
600
601 barrier = barrier;
602
603 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
604 "loopback_open_barrier: exit\n"));
605
606 return (RSM_SUCCESS);
607 }
608
609 static int
loopback_order_barrier(rsm_barrier_handle_t barrier)610 loopback_order_barrier(rsm_barrier_handle_t barrier)
611 {
612
613 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
614 "loopback_order_barrier: enter\n"));
615
616 barrier = barrier;
617
618 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
619 "loopback_order_barrier: exit\n"));
620
621 return (RSM_SUCCESS);
622 }
623
624 static int
loopback_close_barrier(rsm_barrier_handle_t barrier)625 loopback_close_barrier(rsm_barrier_handle_t barrier)
626 {
627
628 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
629 "loopback_close_barrier: enter\n"));
630
631 barrier = barrier;
632
633 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
634 "loopback_close_barrier: exit\n"));
635
636 return (RSM_SUCCESS);
637 }
638
639 static int
loopback_destroy_barrier(rsm_barrier_handle_t barrier)640 loopback_destroy_barrier(rsm_barrier_handle_t barrier)
641 {
642
643 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
644 "loopback_destroy_barrier: enter\n"));
645
646 barrier = barrier;
647
648 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
649 "loopback_destroy_barrier: exit\n"));
650
651 return (RSM_SUCCESS);
652 }
653
654 static int
loopback_get_lib_attr(rsm_ndlib_attr_t ** libattrp)655 loopback_get_lib_attr(rsm_ndlib_attr_t **libattrp)
656 {
657
658 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
659 "loopback_get_lib_attr: enter\n"));
660
661 *libattrp = &_rsm_loopback_attr;
662
663 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
664 "loopback_get_lib_attr: exit\n"));
665
666 return (RSM_SUCCESS);
667 }
668 /*
669 * If an entry is NULL, the parent will fill it out with its entry point.
670 */
671 void
__rsmloopback_init_ops(rsm_segops_t * segops)672 __rsmloopback_init_ops(rsm_segops_t *segops)
673 {
674
675 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
676 "__rsmloopback_init_ops: enter\n"));
677
678 segops->rsm_memseg_import_get8 = loopback_get8;
679 segops->rsm_memseg_import_get16 = loopback_get16;
680 segops->rsm_memseg_import_get32 = loopback_get32;
681 segops->rsm_memseg_import_get64 = loopback_get64;
682
683 segops->rsm_memseg_import_put8 = loopback_put8;
684 segops->rsm_memseg_import_put16 = loopback_put16;
685 segops->rsm_memseg_import_put32 = loopback_put32;
686 segops->rsm_memseg_import_put64 = loopback_put64;
687
688 segops->rsm_memseg_import_put = loopback_put;
689 segops->rsm_memseg_import_get = loopback_get;
690
691 segops->rsm_memseg_import_putv = loopback_putv;
692 segops->rsm_memseg_import_getv = loopback_getv;
693
694 segops->rsm_create_localmemory_handle = loopback_create_handle;
695 segops->rsm_free_localmemory_handle = loopback_free_handle;
696
697 segops->rsm_memseg_import_init_barrier = loopback_init_barrier;
698 segops->rsm_memseg_import_open_barrier = loopback_open_barrier;
699 segops->rsm_memseg_import_order_barrier = loopback_order_barrier;
700 segops->rsm_memseg_import_close_barrier = loopback_close_barrier;
701 segops->rsm_memseg_import_destroy_barrier = loopback_destroy_barrier;
702
703 segops->rsm_get_lib_attr = loopback_get_lib_attr;
704
705 DBPRINTF((RSM_LIBRARY|RSM_LOOPBACK, RSM_DEBUG_VERBOSE,
706 "__rsmloopback_init_ops: exit\n"));
707
708 }
709