2 * Copyright (c) 2000-2001 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/
37 #include <sys/ioctl.h>
42 mnt_is_xvm_subvol(dev_t dev
)
44 if (major(dev
) == get_driver_block_major("xvm"))
50 * If the logical device is a xvm striped volume, then it returns the
51 * stripe unit and stripe width information.
52 * Input parameters: the logical volume
53 * the subvolume type - (SVTYPE_RT or
55 * Output parameters: the stripe unit and width in 512 byte blocks
56 * true/false - was this device an XVM volume?
59 xvm_get_subvol_stripe(
68 xvm_subvol_stripe_t subvol_stripe
;
70 if (!mnt_is_xvm_subvol(sb
->st_rdev
))
74 * This will actually open the data subvolume.
76 if ((fd
= open(dev
, O_RDONLY
)) < 0)
80 * Go and get the the information for the correct
83 if (ioctl(fd
, DIOCGETVOLDEV
, &getdev
) < 0) {
87 if ( (type
== SVTYPE_RT
) && (getdev
.rt_subvol_dev
) )
88 subvol_stripe
.dev
= getdev
.rt_subvol_dev
;
89 else if ( (type
== SVTYPE_DATA
) && (getdev
.data_subvol_dev
) )
90 subvol_stripe
.dev
= getdev
.data_subvol_dev
;
96 if (ioctl(fd
, DIOCGETVOLSTRIPE
, &subvol_stripe
) < 0) {
101 *sunit
= subvol_stripe
.unit_size
;
102 *swidth
= *sunit
* subvol_stripe
.width_size
;