4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
31 * As the size of a metadevice used to be stored in 32 bit signed variables,
32 * there was a limit of 1 TB for the size (2^31 * 512 byte).
33 * In order to be able to create larger metadevices, a 2nd set of structures
34 * with wider variables for the size has been created.
35 * There's one structure being shared by all types (mdc_unit_t) and one
36 * for each type of metadevice (mm_unit_t, ms_unit_t, mr_unit_t, ...).
37 * the wide structures are named like mdc_unit_t, mm_unit_t,..
38 * The narrow structures are named like mdc_unit32_od_t, mm_unit32_od_t,...
40 * The wide structures are used for md's >= 1TB, the narrow structures
41 * are used for md's < 1TB.
42 * Once a metadevice grows from < 1TB to >= 1TB the record has to be
43 * converted from a narrow one to a wide one.
45 * Incore (commands, libs and drivers) we only use the wide structures,
46 * in order to keep it simple.
47 * This means when we snarf a narrow struct, we have to convert it to a
48 * wide incore instance before we can use the md.
51 * This file contains conversion routines for the various metadevices.
52 * All the conversion routines take as input two pointers to memory areas
53 * and a direction. The directions specifies which memory area is the
54 * source and which is the destination.
58 #include <sys/sysmacros.h>
59 #include <sys/types.h>
60 #include <sys/cmn_err.h>
61 #include <sys/lvm/mdvar.h>
63 #include <sys/lvm/md_basic.h>
65 #include <meta_basic.h>
67 #include <sys/lvm/md_convert.h>
71 * SVM private devt expansion routine
72 * INPUT: dev a 64 bit container holding either a 32 bit or a 64 bit device
73 * OUTPUT: always an expanded 64 bit device, even if we are running in a
77 md_expldev(md_dev64_t dev
)
80 major_t major
= (major_t
)(dev
>> NBITSMINOR64
) & MAXMAJ64
;
82 /* Here we were given a 64bit dev, return unchanged */
83 if (major
!= (major_t
)0)
85 /* otherwise we were given a 32 bit dev */
86 major
= (major_t
)dev
>> NBITSMINOR32
& MAXMAJ32
;
87 minor
= (minor_t
)dev
& MAXMIN32
;
88 return (((md_dev64_t
)major
<< NBITSMINOR64
) | minor
);
92 * SVM private devt compact routine
93 * INPUT: dev a 64 bit container holding either a 32 bit or a 64 bit device
94 * OUTPUT: always a compacted 32 bit device, even if we are running in a
98 md_cmpldev(md_dev64_t dev
)
101 major_t major
= (major_t
)(dev
>> NBITSMINOR64
) & MAXMAJ64
;
103 /* Here we were given a 32bit dev, return unchanged */
105 return ((dev32_t
)dev
);
107 /* otherwise we were given a 64 bit dev */
108 minor
= (minor_t
)dev
& MAXMIN32
;
109 return (((dev32_t
)major
<< NBITSMINOR32
) | minor
);
114 * given a small stripe unit, compute the size of an appropriate
116 * if first_comp_only is set just return the offset of the first component
117 * in the new big unit.
120 * usr/src/lib/lvm/libmeta/common/meta_statconcise.c:get_stripe_req_size()
121 * contains code derived from this function and thus if any changes are made to
122 * this function get_stripe_req_size() should be evaluated to determine whether
123 * or not code changes will also be necessary there.
127 get_big_stripe_req_size(ms_unit32_od_t
*un
, int first_comp_only
)
129 struct ms_row32_od
*mdr
;
133 size_t first_comp
= 0;
136 /* Compute the offset of the first component */
137 first_comp
= sizeof (ms_unit_t
) +
138 sizeof (struct ms_row
) * (un
->un_nrows
- 1);
139 first_comp
= roundup(first_comp
, sizeof (long long));
140 if (first_comp_only
== FIRST_COMP_OFFSET
)
144 * Requestor wants to have the total size, add the sizes of
147 mdr
= &un
->un_row
[0];
148 for (row
= 0; (row
< un
->un_nrows
); row
++)
149 ncomps
+= mdr
[row
].un_ncomp
;
150 mdsize
= first_comp
+ sizeof (ms_comp_t
) * ncomps
;
155 * given a big stripe unit, compute the size of an appropriate
157 * if first_comp_only is set just return the offset of the first component
158 * in the new small unit.
161 get_small_stripe_req_size(ms_unit_t
*un
, int first_comp_only
)
169 /* Compute the size of the new small ms_unit */
170 first_comp
= sizeof (ms_unit32_od_t
) +
171 sizeof (struct ms_row32_od
) * (un
->un_nrows
- 1);
172 first_comp
= roundup(first_comp
, sizeof (long long));
173 if (first_comp_only
== FIRST_COMP_OFFSET
)
177 * Requestor wants to have the total size, add the sizes of
180 mdr
= &un
->un_row
[0];
181 for (row
= 0; (row
< un
->un_nrows
); row
++)
182 ncomps
+= mdr
[row
].un_ncomp
;
183 mdsize
= first_comp
+ sizeof (ms_comp32_od_t
) * ncomps
;
189 * stripe_convert(small, big, dir)
192 * small is the address of a ms_unit32_od_t structure
193 * big is the address of a ms_unit_t structure
194 * dir is either BIG2SMALL or SMALL2BIG
195 * Return value is void
198 * if dir is BIG2SMALL, convert from big to small (updating old records)
199 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
201 * Caveat emptor: big and small must be well allocated memory areas.
205 stripe_convert(caddr_t small
, caddr_t big
, int direction
)
208 ms_unit32_od_t
*small_un
= (ms_unit32_od_t
*)small
;
210 ms_unit_t
*big_un
= (ms_unit_t
*)big
;
212 struct ms_row32_od
*small_mdr
;
213 struct ms_row
*big_mdr
;
214 uint_t row
, comp
, ncomps
= 0;
215 ms_comp_t
*big_mdcomp
;
216 ms_comp32_od_t
*small_mdcomp
;
218 if (direction
== BIG_2_SMALL
) {
219 MDC_UNIT_BIG2SMALL(big_un
, small_un
);
221 small_un
->un_hsp_id
= big_un
->un_hsp_id
;
222 small_un
->un_nrows
= big_un
->un_nrows
;
223 small_un
->c
.un_size
=
224 get_small_stripe_req_size(big_un
, COMPLETE_STRUCTURE
);
226 get_small_stripe_req_size(big_un
, FIRST_COMP_OFFSET
);
228 /* walk through all rows */
229 big_mdr
= &big_un
->un_row
[0];
230 small_mdr
= &small_un
->un_row
[0];
232 for (row
= 0; (row
< big_un
->un_nrows
); row
++) {
233 ncomps
+= big_mdr
[row
].un_ncomp
;
234 MSROW_BIG2SMALL((&(big_mdr
[row
])), (&(small_mdr
[row
])));
237 /* Now copy the components */
238 big_mdcomp
= (ms_comp_t
*)(void *)&((char *)big_un
)
240 small_mdcomp
= (ms_comp32_od_t
*)(void *)&((char *)small_un
)
241 [small_un
->un_ocomp
];
242 for (comp
= 0; (comp
< ncomps
); ++comp
) {
243 ms_comp_t
*big_mdcp
= &big_mdcomp
[comp
];
244 ms_comp32_od_t
*small_mdcp
= &small_mdcomp
[comp
];
246 MSCOMP_BIG2SMALL(big_mdcp
, small_mdcp
);
251 if (direction
== SMALL_2_BIG
) {
252 MDC_UNIT_SMALL2BIG(small_un
, big_un
);
254 big_un
->un_hsp_id
= small_un
->un_hsp_id
;
255 big_un
->un_nrows
= small_un
->un_nrows
;
257 get_big_stripe_req_size(small_un
, COMPLETE_STRUCTURE
);
259 get_big_stripe_req_size(small_un
, FIRST_COMP_OFFSET
);
262 /* walk through all rows */
263 small_mdr
= &small_un
->un_row
[0];
264 big_mdr
= &big_un
->un_row
[0];
266 for (row
= 0; (row
< small_un
->un_nrows
); row
++) {
267 ncomps
+= small_mdr
[row
].un_ncomp
;
268 MSROW_SMALL2BIG((&(small_mdr
[row
])), (&(big_mdr
[row
])));
270 /* Now copy the components */
271 big_mdcomp
= (ms_comp_t
*)(void *)&((char *)big_un
)
273 small_mdcomp
= (ms_comp32_od_t
*)(void *)&((char *)small_un
)
274 [small_un
->un_ocomp
];
275 for (comp
= 0; (comp
< ncomps
); ++comp
) {
276 ms_comp_t
*big_mdcp
= &big_mdcomp
[comp
];
277 ms_comp32_od_t
*small_mdcp
= &small_mdcomp
[comp
];
279 MSCOMP_SMALL2BIG(small_mdcp
, big_mdcp
);
286 * mirror_convert(small, big, dir)
289 * small is the address of a mm_unit32_od_t structure
290 * big is the address of a mm_unit_t structure
291 * dir is either BIG2SMALL or SMALL2BIG
292 * Return value is void
295 * if dir is BIG2SMALL, convert from big to small (updating old records)
296 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
298 * Caveat emptor: big and small must be well allocated memory areas.
301 mirror_convert(caddr_t small
, caddr_t big
, int direction
)
304 mm_unit32_od_t
*small_un
= (mm_unit32_od_t
*)small
;
306 mm_unit_t
*big_un
= (mm_unit_t
*)big
;
310 if (direction
== BIG_2_SMALL
) {
311 MDC_UNIT_BIG2SMALL(big_un
, small_un
);
313 small_un
->c
.un_size
=
314 roundup(sizeof (mm_unit32_od_t
), sizeof (long long));
315 small_un
->un_last_read
= big_un
->un_last_read
;
316 small_un
->un_changecnt
= big_un
->un_changecnt
;
317 small_un
->un_nsm
= big_un
->un_nsm
;
318 for (i
= 0; i
< NMIRROR
; i
++) {
319 MMSM_BIG2SMALL((&(big_un
->un_sm
[i
])),
320 (&(small_un
->un_sm
[i
])));
322 small_un
->un_overlap_tree_flag
= big_un
->un_overlap_tree_flag
;
323 small_un
->un_read_option
= big_un
->un_read_option
;
324 small_un
->un_write_option
= big_un
->un_write_option
;
325 small_un
->un_pass_num
= big_un
->un_pass_num
;
326 small_un
->un_rrd_blksize
= big_un
->un_rrd_blksize
;
327 small_un
->un_rrd_num
= big_un
->un_rrd_num
;
328 small_un
->un_rr_dirty_recid
= big_un
->un_rr_dirty_recid
;
329 small_un
->un_rs_copysize
= big_un
->un_rs_copysize
;
330 small_un
->un_rs_dests
= big_un
->un_rs_dests
;
331 small_un
->un_rs_resync_done
=
332 (daddr32_t
)big_un
->un_rs_resync_done
;
333 small_un
->un_rs_resync_2_do
=
334 (daddr32_t
)big_un
->un_rs_resync_2_do
;
335 small_un
->un_rs_dropped_lock
= big_un
->un_rs_dropped_lock
;
336 small_un
->un_rs_type
= big_un
->un_rs_type
;
339 if (direction
== SMALL_2_BIG
) {
340 MDC_UNIT_SMALL2BIG(small_un
, big_un
);
342 roundup(sizeof (mm_unit_t
), sizeof (long long));
343 big_un
->un_last_read
= small_un
->un_last_read
;
344 big_un
->un_changecnt
= small_un
->un_changecnt
;
345 big_un
->un_nsm
= small_un
->un_nsm
;
348 for (i
= 0; i
< NMIRROR
; i
++) {
349 MMSM_SMALL2BIG((&(small_un
->un_sm
[i
])),
350 (&(big_un
->un_sm
[i
])));
354 /* Now back to the simple things again */
355 big_un
->un_overlap_tree_flag
= small_un
->un_overlap_tree_flag
;
356 big_un
->un_read_option
= small_un
->un_read_option
;
357 big_un
->un_write_option
= small_un
->un_write_option
;
358 big_un
->un_pass_num
= small_un
->un_pass_num
;
359 big_un
->un_rrd_blksize
= small_un
->un_rrd_blksize
;
360 big_un
->un_rrd_num
= small_un
->un_rrd_num
;
361 big_un
->un_rr_dirty_recid
= small_un
->un_rr_dirty_recid
;
362 big_un
->un_rs_copysize
= small_un
->un_rs_copysize
;
363 big_un
->un_rs_dests
= small_un
->un_rs_dests
;
364 big_un
->un_rs_resync_done
=
365 (diskaddr_t
)small_un
->un_rs_resync_done
;
366 big_un
->un_rs_resync_2_do
=
367 (diskaddr_t
)small_un
->un_rs_resync_2_do
;
368 big_un
->un_rs_dropped_lock
= small_un
->un_rs_dropped_lock
;
369 big_un
->un_rs_type
= small_un
->un_rs_type
;
374 * raid_convert(small, big, dir)
377 * small is the address of a mr_unit32_od_t structure
378 * big is the address of a mr_unit_t structure
379 * dir is either BIG2SMALL or SMALL2BIG
380 * Return value is void
383 * if dir is BIG2SMALL, convert from big to small (updating old records)
384 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
386 * Caveat emptor: big and small must be well allocated memory areas.
389 raid_convert(caddr_t small
, caddr_t big
, int direction
)
393 mr_unit32_od_t
*small_un
= (mr_unit32_od_t
*)small
;
395 mr_unit_t
*big_un
= (mr_unit_t
*)big
;
400 if (direction
== BIG_2_SMALL
) {
401 MRUNIT_BIG2SMALL(big_un
, small_un
);
403 ncol
= small_un
->un_totalcolumncnt
;
404 small_un
->c
.un_size
= sizeof (mr_unit32_od_t
);
405 small_un
->c
.un_size
+= (ncol
- 1) * sizeof (mr_column32_od_t
);
406 for (i
= 0; i
< ncol
; i
++) {
407 MRCOL_BIG2SMALL((&(big_un
->un_column
[i
])),
408 (&(small_un
->un_column
[i
])));
412 if (direction
== SMALL_2_BIG
) {
413 MRUNIT_SMALL2BIG(small_un
, big_un
);
415 ncol
= big_un
->un_totalcolumncnt
;
416 big_un
->c
.un_size
= sizeof (mr_unit_t
);
417 big_un
->c
.un_size
+= (ncol
- 1) * sizeof (mr_column_t
);
418 for (i
= 0; i
< ncol
; i
++) {
419 MRCOL_SMALL2BIG((&(small_un
->un_column
[i
])),
420 (&(big_un
->un_column
[i
])));
430 * softpart_convert(small, big, dir)
433 * small is the address of a mp_unit32_od_t structure
434 * big is the address of a mp_unit_t structure
435 * dir is either BIG2SMALL or SMALL2BIG
436 * Return value is void
439 * if dir is BIG2SMALL, convert from big to small (updating old records)
440 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
442 * Caveat emptor: big and small must be well allocated memory areas.
445 softpart_convert(caddr_t small
, caddr_t big
, int direction
)
449 mp_unit32_od_t
*small_un
= (mp_unit32_od_t
*)small
;
451 mp_unit_t
*big_un
= (mp_unit_t
*)big
;
453 if (direction
== BIG_2_SMALL
) {
454 MPUNIT_BIG2SMALL(big_un
, small_un
);
456 * Note that there isn't a mp_ext32_od_t, it's right to use
457 * mp_ext_t here, too.
459 small_un
->c
.un_size
= sizeof (mp_unit32_od_t
) +
460 (small_un
->un_numexts
- 1) * sizeof (mp_ext_t
);
463 if (direction
== SMALL_2_BIG
) {
464 MPUNIT_SMALL2BIG(small_un
, big_un
);
465 big_un
->c
.un_size
= sizeof (mp_unit_t
) +
466 (big_un
->un_numexts
- 1) * sizeof (mp_ext_t
);
472 * trans_master_convert(smallp, bigp, dir)
475 * smallp is the address of a mt_unit32_od_t structure
476 * bigp is the address of a mt_unit_t structure
477 * dir is either BIG2SMALL or SMALL2BIG
478 * Return value is void
481 * if dir is BIG2SMALL, convert from big to small (updating old records)
482 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
484 * Caveat emptor: bigp and smallp must be well allocated memory areas.
487 trans_master_convert(caddr_t smallp
, caddr_t bigp
, int direction
)
490 mt_unit32_od_t
*small
= (mt_unit32_od_t
*)smallp
;
492 mt_unit_t
*big
= (mt_unit_t
*)bigp
;
494 if (direction
== SMALL_2_BIG
) {
495 MDC_UNIT_SMALL2BIG(small
, big
);
497 roundup(sizeof (mt_unit_t
), sizeof (long long));
498 big
->un_flags
= small
->un_flags
;
499 big
->un_m_key
= small
->un_m_key
;
500 big
->un_m_dev
= md_expldev(small
->un_m_dev
);
501 big
->un_l_key
= small
->un_l_key
;
502 big
->un_l_dev
= md_expldev(small
->un_l_dev
);
503 big
->un_l_sblk
= small
->un_l_sblk
;
504 big
->un_l_pwsblk
= small
->un_l_pwsblk
;
505 big
->un_l_nblks
= small
->un_l_nblks
;
506 big
->un_l_tblks
= small
->un_l_tblks
;
507 big
->un_l_head
= small
->un_l_head
;
508 big
->un_l_tail
= small
->un_l_tail
;
509 big
->un_l_resv
= small
->un_l_resv
;
510 big
->un_l_maxresv
= small
->un_l_maxresv
;
511 big
->un_l_recid
= small
->un_l_recid
;
512 big
->un_l_error
= small
->un_l_error
;
513 big
->un_s_dev
= md_expldev(small
->un_s_dev
);
514 big
->un_debug
= small
->un_debug
;
515 big
->un_dev
= md_expldev(small
->un_dev
);
516 big
->un_logreset
= small
->un_logreset
;
517 big
->un_l_maxtransfer
= small
->un_l_maxtransfer
;
518 big
->un_timestamp
.tv_sec
= small
->un_timestamp
.tv_sec
;
519 big
->un_timestamp
.tv_usec
= small
->un_timestamp
.tv_usec
;
520 big
->un_l_timestamp
.tv_sec
= small
->un_l_timestamp
.tv_sec
;
521 big
->un_l_timestamp
.tv_usec
= small
->un_l_timestamp
.tv_usec
;
523 if (direction
== BIG_2_SMALL
) {
524 MDC_UNIT_BIG2SMALL(big
, small
);
526 roundup(sizeof (mt_unit32_od_t
), sizeof (long long));
527 small
->un_flags
= big
->un_flags
;
528 small
->un_m_key
= big
->un_m_key
;
529 small
->un_m_dev
= md_cmpldev(big
->un_m_dev
);
530 small
->un_l_key
= big
->un_l_key
;
531 small
->un_l_dev
= md_cmpldev(big
->un_l_dev
);
532 small
->un_l_sblk
= big
->un_l_sblk
;
533 small
->un_l_pwsblk
= big
->un_l_pwsblk
;
534 small
->un_l_nblks
= big
->un_l_nblks
;
535 small
->un_l_tblks
= big
->un_l_tblks
;
536 small
->un_l_head
= big
->un_l_head
;
537 small
->un_l_tail
= big
->un_l_tail
;
538 small
->un_l_resv
= big
->un_l_resv
;
539 small
->un_l_maxresv
= big
->un_l_maxresv
;
540 small
->un_l_maxtransfer
= big
->un_l_maxtransfer
;
541 small
->un_l_recid
= big
->un_l_recid
;
542 small
->un_l_error
= big
->un_l_error
;
543 small
->un_s_dev
= md_cmpldev(big
->un_s_dev
);
544 small
->un_debug
= big
->un_debug
;
545 small
->un_dev
= md_cmpldev(big
->un_dev
);
546 small
->un_logreset
= big
->un_logreset
;
547 small
->un_timestamp
.tv_sec
= big
->un_timestamp
.tv_sec
;
548 small
->un_timestamp
.tv_usec
= big
->un_timestamp
.tv_usec
;
549 small
->un_l_timestamp
.tv_sec
= big
->un_l_timestamp
.tv_sec
;
550 small
->un_l_timestamp
.tv_usec
= big
->un_l_timestamp
.tv_usec
;
557 * trans_log_convert(smallp, bigp, dir)
560 * smallp is the address of a ml_unit32_od_t structure
561 * bigp is the address of a ml_unit_t structure
562 * dir is either BIG2SMALL or SMALL2BIG
563 * Return value is void
566 * if dir is BIG2SMALL, convert from big to small (updating old records)
567 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
569 * Caveat emptor: bigp and smallp must be well allocated memory areas.
572 trans_log_convert(caddr_t smallp
, caddr_t bigp
, int direction
)
575 ml_unit32_od_t
*small
= (ml_unit32_od_t
*)smallp
;
577 ml_unit_t
*big
= (ml_unit_t
*)bigp
;
579 if (direction
== SMALL_2_BIG
) {
580 big
->un_revision
= small
->un_revision
;
581 big
->un_recid
= small
->un_recid
;
582 big
->un_key
= small
->un_key
;
583 big
->un_dev
= md_expldev(small
->un_dev
);
584 big
->un_opencnt
= small
->un_opencnt
;
585 big
->un_transcnt
= small
->un_transcnt
;
586 big
->un_head_lof
= small
->un_head_lof
;
587 big
->un_head_ident
= small
->un_head_ident
;
588 big
->un_tail_lof
= small
->un_tail_lof
;
589 big
->un_tail_ident
= small
->un_tail_ident
;
590 big
->un_bol_lof
= small
->un_bol_lof
;
591 big
->un_eol_lof
= small
->un_eol_lof
;
592 big
->un_nblks
= small
->un_nblks
;
593 big
->un_tblks
= small
->un_tblks
;
594 big
->un_maxtransfer
= small
->un_maxtransfer
;
595 big
->un_status
= small
->un_status
;
596 big
->un_maxresv
= small
->un_maxresv
;
597 big
->un_pwsblk
= small
->un_pwsblk
;
598 big
->un_devbsize
= small
->un_devbsize
;
599 big
->un_resv
= small
->un_resv
;
600 big
->un_resv_wantin
= small
->un_resv_wantin
;
601 big
->un_error
= small
->un_error
;
602 big
->un_tid
= small
->un_tid
;
603 big
->un_head_tid
= small
->un_head_tid
;
604 big
->un_timestamp
.tv_sec
= small
->un_timestamp
.tv_sec
;
605 big
->un_timestamp
.tv_usec
= small
->un_timestamp
.tv_usec
;
607 if (direction
== BIG_2_SMALL
) {
608 small
->un_revision
= big
->un_revision
;
609 small
->un_recid
= big
->un_recid
;
610 small
->un_key
= big
->un_key
;
611 small
->un_dev
= md_cmpldev(big
->un_dev
);
612 small
->un_opencnt
= big
->un_opencnt
;
613 small
->un_transcnt
= big
->un_transcnt
;
614 small
->un_head_lof
= big
->un_head_lof
;
615 small
->un_head_ident
= big
->un_head_ident
;
616 small
->un_tail_lof
= big
->un_tail_lof
;
617 small
->un_tail_ident
= big
->un_tail_ident
;
618 small
->un_bol_lof
= big
->un_bol_lof
;
619 small
->un_eol_lof
= big
->un_eol_lof
;
620 small
->un_nblks
= big
->un_nblks
;
621 small
->un_tblks
= big
->un_tblks
;
622 small
->un_maxtransfer
= big
->un_maxtransfer
;
623 small
->un_status
= big
->un_status
;
624 small
->un_maxresv
= big
->un_maxresv
;
625 small
->un_pwsblk
= big
->un_pwsblk
;
626 small
->un_devbsize
= big
->un_devbsize
;
627 small
->un_resv
= big
->un_resv
;
628 small
->un_resv_wantin
= big
->un_resv_wantin
;
629 small
->un_error
= big
->un_error
;
630 small
->un_tid
= big
->un_tid
;
631 small
->un_head_tid
= big
->un_head_tid
;
632 small
->un_timestamp
.tv_sec
= big
->un_timestamp
.tv_sec
;
633 small
->un_timestamp
.tv_usec
= big
->un_timestamp
.tv_usec
;
638 * hs_convert(small, big, dir)
641 * small is the address of a hot_spare32_od_t structure
642 * big is the address of a hot_spare_t structure
643 * dir is either BIG2SMALL or SMALL2BIG
644 * Return value is void
647 * if dir is BIG2SMALL, convert from big to small (updating old records)
648 * if dir is SMALL2BIG, convert from small to big (snarfing old records)
650 * Caveat emptor: big and small must be well allocated memory areas.
653 hs_convert(caddr_t small
, caddr_t big
, int direction
)
657 hot_spare32_od_t
*small_un
= (hot_spare32_od_t
*)small
;
659 hot_spare_t
*big_un
= (hot_spare_t
*)big
;
661 if (direction
== BIG_2_SMALL
) {
662 MHS_BIG2SMALL(big_un
, small_un
);
665 if (direction
== SMALL_2_BIG
) {
666 MHS_SMALL2BIG(small_un
, big_un
);