2 * Copyright (c) 2000-2005 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
24 #include <sys/ioctl.h>
25 #include <disk/volume.h>
32 return get_driver_block_major("xvm", major(dev
));
36 * If the logical device is a xvm striped volume, then it returns the
37 * stripe unit and stripe width information.
38 * Input parameters: the logical volume
39 * the subvolume type - (SVTYPE_RT or
41 * Output parameters: the stripe unit and width in 512 byte blocks
42 * true/false - was this device an XVM volume?
45 xvm_get_subvol_stripe(
55 xvm_subvol_stripe_t subvol_stripe
;
57 if (!mnt_is_xvm_subvol(sb
->st_rdev
))
61 * This will actually open the data subvolume.
63 if ((fd
= open(dev
, O_RDONLY
)) < 0)
67 * Go and get the the information for the correct
70 if (ioctl(fd
, DIOCGETVOLDEV
, &getdev
) < 0) {
74 if ( (type
== SVTYPE_RT
) && (getdev
.rt_subvol_dev
) )
75 subvol_stripe
.dev
= getdev
.rt_subvol_dev
;
76 else if ( (type
== SVTYPE_DATA
) && (getdev
.data_subvol_dev
) )
77 subvol_stripe
.dev
= getdev
.data_subvol_dev
;
83 if (ioctl(fd
, DIOCGETVOLSTRIPE
, &subvol_stripe
) < 0) {
88 *sunit
= subvol_stripe
.unit_size
;
89 *swidth
= *sunit
* subvol_stripe
.width_size
;