g_nop.c (23090366f729c56cab62de74c7a51792357e98a9) g_nop.c (02c62349c93f29b881498630c7a0623540255764)
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

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

210 size -= size % secsize;
211 snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
212 LIST_FOREACH(gp, &mp->geom, geom) {
213 if (strcmp(gp->name, name) == 0) {
214 gctl_error(req, "Provider %s already exists.", name);
215 return (EEXIST);
216 }
217 }
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

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

210 size -= size % secsize;
211 snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
212 LIST_FOREACH(gp, &mp->geom, geom) {
213 if (strcmp(gp->name, name) == 0) {
214 gctl_error(req, "Provider %s already exists.", name);
215 return (EEXIST);
216 }
217 }
218 gp = g_new_geomf(mp, name);
218 gp = g_new_geomf(mp, "%s", name);
219 sc = g_malloc(sizeof(*sc), M_WAITOK);
220 sc->sc_offset = offset;
221 sc->sc_explicitsize = explicitsize;
222 sc->sc_error = ioerror;
223 sc->sc_rfailprob = rfailprob;
224 sc->sc_wfailprob = wfailprob;
225 sc->sc_reads = 0;
226 sc->sc_writes = 0;
227 sc->sc_readbytes = 0;
228 sc->sc_wrotebytes = 0;
229 gp->softc = sc;
230 gp->start = g_nop_start;
231 gp->orphan = g_nop_orphan;
232 gp->resize = g_nop_resize;
233 gp->access = g_nop_access;
234 gp->dumpconf = g_nop_dumpconf;
235
219 sc = g_malloc(sizeof(*sc), M_WAITOK);
220 sc->sc_offset = offset;
221 sc->sc_explicitsize = explicitsize;
222 sc->sc_error = ioerror;
223 sc->sc_rfailprob = rfailprob;
224 sc->sc_wfailprob = wfailprob;
225 sc->sc_reads = 0;
226 sc->sc_writes = 0;
227 sc->sc_readbytes = 0;
228 sc->sc_wrotebytes = 0;
229 gp->softc = sc;
230 gp->start = g_nop_start;
231 gp->orphan = g_nop_orphan;
232 gp->resize = g_nop_resize;
233 gp->access = g_nop_access;
234 gp->dumpconf = g_nop_dumpconf;
235
236 newpp = g_new_providerf(gp, gp->name);
236 newpp = g_new_providerf(gp, "%s", gp->name);
237 newpp->mediasize = size;
238 newpp->sectorsize = secsize;
239
240 cp = g_new_consumer(gp);
241 error = g_attach(cp, pp);
242 if (error != 0) {
243 gctl_error(req, "Cannot attach to provider %s.", pp->name);
244 goto fail;

--- 380 unchanged lines hidden ---
237 newpp->mediasize = size;
238 newpp->sectorsize = secsize;
239
240 cp = g_new_consumer(gp);
241 error = g_attach(cp, pp);
242 if (error != 0) {
243 gctl_error(req, "Cannot attach to provider %s.", pp->name);
244 goto fail;

--- 380 unchanged lines hidden ---