xref: /freebsd/tools/regression/ccd/layout/ccd.sh (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1#!/bin/sh
2
3set -e
4
5if mount | grep ccd3 ; then
6	echo "ccd3 seems to be mounted"
7	exit 1
8fi
9
10(
11ccdconfig -u ccd3 || true
12mdconfig -d -u 90 || true
13mdconfig -d -u 91 || true
14mdconfig -d -u 92 || true
15mdconfig -d -u 93 || true
16) > /dev/null 2>&1
17
18mdconfig -a -t malloc -s $1 -u 90
19mdconfig -a -t malloc -s $2 -u 91
20mdconfig -a -t malloc -s $3 -u 92
21mdconfig -a -t malloc -s $4 -u 93
22
23ccdconfig -v ccd3 $5 $6 /dev/md90 /dev/md91 /dev/md92 /dev/md93
24./a > /dev/ccd3
25
26md5 < /dev/md90
27md5 < /dev/md91
28md5 < /dev/md92
29md5 < /dev/md93
30
31(
32./b < /dev/md90 | sed -e 1,16d -e 's/^/md90	/'
33./b < /dev/md91 | sed -e 1,16d -e 's/^/md91	/'
34./b < /dev/md92 | sed -e 1,16d -e 's/^/md92	/'
35./b < /dev/md93 | sed -e 1,16d -e 's/^/md93	/'
36) | sort +2n | awk '
37	{
38	if ($1 != l1) {
39		if (l1 != "") {
40			if (l1 == "md90") printf ""
41			if (l1 == "md91") printf "		"
42			if (l1 == "md92") printf "				"
43			if (l1 == "md93") printf "						"
44			print l3,l2,l
45		}
46		l1 = $1
47		l2 = $2
48		l3 = $3
49		l = 0;
50	}
51	l++;
52	}
53END	{
54	if (l1 == "md90") printf ""
55	if (l1 == "md91") printf "		"
56	if (l1 == "md92") printf "				"
57	if (l1 == "md93") printf "						"
58	print l3,l2,l
59	}
60'
61