Deleted Added
sdiff udiff text old ( 168404 ) new ( 169303 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 145 unchanged lines hidden (view full) ---

154 }
155 geom_deletetree(&mesh);
156 return (rv);
157}
158
159static boolean_t
160is_provider(const char *name)
161{
162 off_t mediasize;
163 int fd;
164
165 fd = open(name, O_RDONLY);
166 if (fd == -1)
167 return (B_FALSE);
168 if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) == -1) {
169 close(fd);
170 return (B_FALSE);
171 }
172 close(fd);
173 return (B_TRUE);
174
175}
176/*
177 * Create a leaf vdev. Determine if this is a GEOM provider.
178 * Valid forms for a leaf vdev are:
179 *
180 * /dev/xxx Complete path to a GEOM provider
181 * xxx Shorthand for /dev/xxx
182 */
183nvlist_t *
184make_leaf_vdev(const char *arg)
185{
186 char path[MAXPATHLEN];
187 nvlist_t *vdev = NULL;
188 char *type = NULL;
189
190 if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
191 strlcpy(path, arg, sizeof (path));
192 else
193 snprintf(path, sizeof (path), "%s%s", _PATH_DEV, arg);
194
195 if (is_provider(path))
196 type = VDEV_TYPE_DISK;

--- 10 unchanged lines hidden (view full) ---

207 */
208 verify(nvlist_alloc(&vdev, NV_UNIQUE_NAME, 0) == 0);
209 verify(nvlist_add_string(vdev, ZPOOL_CONFIG_PATH, path) == 0);
210 verify(nvlist_add_string(vdev, ZPOOL_CONFIG_TYPE, type) == 0);
211 if (strcmp(type, VDEV_TYPE_DISK) == 0)
212 verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK,
213 (uint64_t)B_FALSE) == 0);
214
215 return (vdev);
216}
217
218/*
219 * Go through and verify the replication level of the pool is consistent.
220 * Performs the following checks:
221 *
222 * For the new spec, verifies that devices in mirrors and raidz are the

--- 628 unchanged lines hidden ---