Sophie

Sophie

distrib > Arklinux > devel > i586 > by-pkgid > 864897aaa2a755c11ce36bb0af3b0dfc > files > 1

raidtools-1.00.3-3ark.src.rpm

/* RAID AUTORUN tool
 * (c) 2004 LINUX4MEDIA GmbH, Bernhard Rosenkraenzer <bero@arklinux.org>
 * Released under the terms of the GNU General Public License (GPL)
 * version 2, or if, and only if, version 2 is ruled invalid in a court
 * of law, any later version of the GPL published by the Free Software
 * Foundation.
 */
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/major.h>
#include <linux/raid/md_u.h>

int main(int argc, char **argv)
{
	char *dev="/dev/md0";
	int fd;
	if(argc>1)
		dev=argv[1];
	fd=open(dev, O_RDWR, 0);
	if(fd < 0) {
		fprintf(stderr, "Can't open %s: %s\n", dev, strerror(errno));
		close(fd);
		return 1;
	}

	if(ioctl(fd, RAID_AUTORUN, 0)) {
		fprintf(stderr, "RAID_AUTORUN: %s\n", strerror(errno));
		close(fd);
		return 1;
	}
	
	close(fd);
	return 0;
}