/
githubmirror
/
xfsprogs
Обзор
Документация
Войти
/
githubmirror
/
xfsprogs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
preadv2
libdisk/evms.c
68 строк
2 KB
Nathan Scott
Extend get_subvol_wrapper with another parameter which tells whether or not to align sectors/blocks for this device. Use it in mkfs for RAID4/5/6.
06 июн 2005, 10:01
06 июн 2005, 10:01
c22b5fd
Код
Авторство
О чём код?
/* * Copyright (c) International Business Machines Corp., 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/sysmacros.h> #include <disk/volume.h> #include "evms.h" int mnt_is_evms_subvol( dev_t dev) { if (major(dev) == EVMS_MAJOR) return 1; return get_driver_block_major("evms", major(dev)); } int evms_get_subvol_stripe( char *device, sv_type_t type, int *sunit, int *swidth, int *sectalign, struct stat64 *sb) { if (mnt_is_evms_subvol(sb->st_rdev)) { evms_vol_stripe_info_t info; int fd; fd = open(device, O_RDONLY); if (fd == -1) return 0; if (ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, &info)) { close(fd); return 0; } /* Update sizes */ *sunit = info.size; *swidth = *sunit * info.width; *sectalign = 0; close(fd); return 1; } return 0; }