g_part.c (279935) | g_part.c (280687) |
---|---|
1/*- 2 * Copyright (c) 2002, 2005-2009 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002, 2005-2009 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/geom/part/g_part.c 279935 2015-03-12 18:51:31Z ae $"); | 28__FBSDID("$FreeBSD: head/sys/geom/part/g_part.c 280687 2015-03-26 12:17:47Z mav $"); |
29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/endian.h> 33#include <sys/kernel.h> 34#include <sys/kobj.h> 35#include <sys/limits.h> 36#include <sys/lock.h> --- 410 unchanged lines hidden (view full) --- 447 g_error_provider(entry->gpe_pp, 0); 448} 449 450static struct g_geom* 451g_part_find_geom(const char *name) 452{ 453 struct g_geom *gp; 454 LIST_FOREACH(gp, &g_part_class.geom, geom) { | 29 30#include <sys/param.h> 31#include <sys/bio.h> 32#include <sys/endian.h> 33#include <sys/kernel.h> 34#include <sys/kobj.h> 35#include <sys/limits.h> 36#include <sys/lock.h> --- 410 unchanged lines hidden (view full) --- 447 g_error_provider(entry->gpe_pp, 0); 448} 449 450static struct g_geom* 451g_part_find_geom(const char *name) 452{ 453 struct g_geom *gp; 454 LIST_FOREACH(gp, &g_part_class.geom, geom) { |
455 if (!strcmp(name, gp->name)) | 455 if ((gp->flags & G_GEOM_WITHER) == 0 && 456 strcmp(name, gp->name) == 0) |
456 break; 457 } 458 return (gp); 459} 460 461static int 462g_part_parm_geom(struct gctl_req *req, const char *name, struct g_geom **v) 463{ --- 5 unchanged lines hidden (view full) --- 469 return (ENOATTR); 470 if (strncmp(gname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) 471 gname += sizeof(_PATH_DEV) - 1; 472 gp = g_part_find_geom(gname); 473 if (gp == NULL) { 474 gctl_error(req, "%d %s '%s'", EINVAL, name, gname); 475 return (EINVAL); 476 } | 457 break; 458 } 459 return (gp); 460} 461 462static int 463g_part_parm_geom(struct gctl_req *req, const char *name, struct g_geom **v) 464{ --- 5 unchanged lines hidden (view full) --- 470 return (ENOATTR); 471 if (strncmp(gname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) 472 gname += sizeof(_PATH_DEV) - 1; 473 gp = g_part_find_geom(gname); 474 if (gp == NULL) { 475 gctl_error(req, "%d %s '%s'", EINVAL, name, gname); 476 return (EINVAL); 477 } |
477 if ((gp->flags & G_GEOM_WITHER) != 0) { 478 gctl_error(req, "%d %s", ENXIO, gname); 479 return (ENXIO); 480 } | |
481 *v = gp; 482 return (0); 483} 484 485static int 486g_part_parm_provider(struct gctl_req *req, const char *name, 487 struct g_provider **v) 488{ --- 1846 unchanged lines hidden --- | 478 *v = gp; 479 return (0); 480} 481 482static int 483g_part_parm_provider(struct gctl_req *req, const char *name, 484 struct g_provider **v) 485{ --- 1846 unchanged lines hidden --- |