g_mountver.c (23090366f729c56cab62de74c7a51792357e98a9) g_mountver.c (02c62349c93f29b881498630c7a0623540255764)
1/*-
2 * Copyright (c) 2010 Edward Tomasz Napierala <trasz@FreeBSD.org>
3 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

245
246 snprintf(name, sizeof(name), "%s%s", pp->name, G_MOUNTVER_SUFFIX);
247 LIST_FOREACH(gp, &mp->geom, geom) {
248 if (strcmp(gp->name, name) == 0) {
249 gctl_error(req, "Provider %s already exists.", name);
250 return (EEXIST);
251 }
252 }
1/*-
2 * Copyright (c) 2010 Edward Tomasz Napierala <trasz@FreeBSD.org>
3 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

245
246 snprintf(name, sizeof(name), "%s%s", pp->name, G_MOUNTVER_SUFFIX);
247 LIST_FOREACH(gp, &mp->geom, geom) {
248 if (strcmp(gp->name, name) == 0) {
249 gctl_error(req, "Provider %s already exists.", name);
250 return (EEXIST);
251 }
252 }
253 gp = g_new_geomf(mp, name);
253 gp = g_new_geomf(mp, "%s", name);
254 sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
255 mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF);
256 TAILQ_INIT(&sc->sc_queue);
257 sc->sc_provider_name = strdup(pp->name, M_GEOM);
258 gp->softc = sc;
259 gp->start = g_mountver_start;
260 gp->orphan = g_mountver_orphan;
261 gp->resize = g_mountver_resize;
262 gp->access = g_mountver_access;
263 gp->dumpconf = g_mountver_dumpconf;
264
254 sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
255 mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF);
256 TAILQ_INIT(&sc->sc_queue);
257 sc->sc_provider_name = strdup(pp->name, M_GEOM);
258 gp->softc = sc;
259 gp->start = g_mountver_start;
260 gp->orphan = g_mountver_orphan;
261 gp->resize = g_mountver_resize;
262 gp->access = g_mountver_access;
263 gp->dumpconf = g_mountver_dumpconf;
264
265 newpp = g_new_providerf(gp, gp->name);
265 newpp = g_new_providerf(gp, "%s", gp->name);
266 newpp->mediasize = pp->mediasize;
267 newpp->sectorsize = pp->sectorsize;
268
269 cp = g_new_consumer(gp);
270 error = g_attach(cp, pp);
271 if (error != 0) {
272 gctl_error(req, "Cannot attach to provider %s.", pp->name);
273 goto fail;

--- 367 unchanged lines hidden ---
266 newpp->mediasize = pp->mediasize;
267 newpp->sectorsize = pp->sectorsize;
268
269 cp = g_new_consumer(gp);
270 error = g_attach(cp, pp);
271 if (error != 0) {
272 gctl_error(req, "Cannot attach to provider %s.", pp->name);
273 goto fail;

--- 367 unchanged lines hidden ---