Deleted Added
full compact
geom_part.c (279324) geom_part.c (280687)
1/*-
2 * Copyright (c) 2007, 2008 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007, 2008 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sbin/geom/class/part/geom_part.c 279324 2015-02-26 15:59:45Z ae $");
28__FBSDID("$FreeBSD: head/sbin/geom/class/part/geom_part.c 280687 2015-03-26 12:17:47Z mav $");
29
30#include <sys/stat.h>
31#include <sys/vtoc.h>
32
33#include <assert.h>
34#include <ctype.h>
35#include <err.h>
36#include <errno.h>

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

202 return (classp);
203 }
204 return (NULL);
205}
206
207static struct ggeom *
208find_geom(struct gclass *classp, const char *name)
209{
29
30#include <sys/stat.h>
31#include <sys/vtoc.h>
32
33#include <assert.h>
34#include <ctype.h>
35#include <err.h>
36#include <errno.h>

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

202 return (classp);
203 }
204 return (NULL);
205}
206
207static struct ggeom *
208find_geom(struct gclass *classp, const char *name)
209{
210 struct ggeom *gp;
210 struct ggeom *gp, *wgp;
211
212 if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
213 name += sizeof(_PATH_DEV) - 1;
211
212 if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
213 name += sizeof(_PATH_DEV) - 1;
214 wgp = NULL;
214 LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
215 LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
215 if (strcmp(gp->lg_name, name) == 0)
216 if (strcmp(gp->lg_name, name) != 0)
217 continue;
218 if (find_geomcfg(gp, "wither") == NULL)
216 return (gp);
219 return (gp);
220 else
221 wgp = gp;
217 }
222 }
218 return (NULL);
223 return (wgp);
219}
220
221static const char *
222find_geomcfg(struct ggeom *gp, const char *cfg)
223{
224 struct gconfig *gc;
225
226 LIST_FOREACH(gc, &gp->lg_config, lg_config) {

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

604gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
605{
606 struct gprovider *pp;
607 const char *s, *scheme;
608 off_t first, last, sector, end;
609 off_t length, secsz;
610 int idx, wblocks, wname, wmax;
611
224}
225
226static const char *
227find_geomcfg(struct ggeom *gp, const char *cfg)
228{
229 struct gconfig *gc;
230
231 LIST_FOREACH(gc, &gp->lg_config, lg_config) {

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

609gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
610{
611 struct gprovider *pp;
612 const char *s, *scheme;
613 off_t first, last, sector, end;
614 off_t length, secsz;
615 int idx, wblocks, wname, wmax;
616
617 if (find_geomcfg(gp, "wither"))
618 return;
612 scheme = find_geomcfg(gp, "scheme");
613 if (scheme == NULL)
614 errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name);
615 s = find_geomcfg(gp, "first");
616 if (s == NULL)
617 errx(EXIT_FAILURE, "Starting block not found for geom %s",
618 gp->lg_name);
619 first = (off_t)strtoimax(s, NULL, 0);

--- 701 unchanged lines hidden ---
619 scheme = find_geomcfg(gp, "scheme");
620 if (scheme == NULL)
621 errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name);
622 s = find_geomcfg(gp, "first");
623 if (s == NULL)
624 errx(EXIT_FAILURE, "Starting block not found for geom %s",
625 gp->lg_name);
626 first = (off_t)strtoimax(s, NULL, 0);

--- 701 unchanged lines hidden ---