Deleted Added
full compact
g_nop.c (162153) g_nop.c (217262)
1/*-
2 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
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) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
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/sys/geom/nop/g_nop.c 162153 2006-09-08 13:46:18Z pjd $");
28__FBSDID("$FreeBSD: head/sys/geom/nop/g_nop.c 217262 2011-01-11 11:42:22Z ae $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/bio.h>

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

171 return (EINVAL);
172 }
173 if (secsize == 0)
174 secsize = pp->sectorsize;
175 else if ((secsize % pp->sectorsize) != 0) {
176 gctl_error(req, "Invalid secsize for provider %s.", pp->name);
177 return (EINVAL);
178 }
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/bio.h>

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

171 return (EINVAL);
172 }
173 if (secsize == 0)
174 secsize = pp->sectorsize;
175 else if ((secsize % pp->sectorsize) != 0) {
176 gctl_error(req, "Invalid secsize for provider %s.", pp->name);
177 return (EINVAL);
178 }
179 if (size % secsize != 0)
180 size -= size % secsize;
179 snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
180 LIST_FOREACH(gp, &mp->geom, geom) {
181 if (strcmp(gp->name, name) == 0) {
182 gctl_error(req, "Provider %s already exists.", name);
183 return (EEXIST);
184 }
185 }
186 gp = g_new_geomf(mp, name);

--- 424 unchanged lines hidden ---
181 snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
182 LIST_FOREACH(gp, &mp->geom, geom) {
183 if (strcmp(gp->name, name) == 0) {
184 gctl_error(req, "Provider %s already exists.", name);
185 return (EEXIST);
186 }
187 }
188 gp = g_new_geomf(mp, name);

--- 424 unchanged lines hidden ---