geom_subr.c (106518) | geom_subr.c (107953) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_subr.c 106518 2002-11-06 20:05:15Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_subr.c 107953 2002-12-16 22:33:27Z phk $ |
36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 39 unchanged lines hidden (view full) --- 83 LIST_INIT(&mp->geom); 84 LIST_INSERT_HEAD(&g_classes, mp, class); 85 if (g_nproviders > 0) 86 g_post_event(EV_NEW_CLASS, mp, NULL, NULL, NULL); 87 g_topology_unlock(); 88} 89 90struct g_geom * | 36 */ 37 38 39#include <sys/param.h> 40#include <sys/stdint.h> 41#ifndef _KERNEL 42#include <stdio.h> 43#include <unistd.h> --- 39 unchanged lines hidden (view full) --- 83 LIST_INIT(&mp->geom); 84 LIST_INSERT_HEAD(&g_classes, mp, class); 85 if (g_nproviders > 0) 86 g_post_event(EV_NEW_CLASS, mp, NULL, NULL, NULL); 87 g_topology_unlock(); 88} 89 90struct g_geom * |
91g_new_geomf(struct g_class *mp, char *fmt, ...) | 91g_new_geomf(struct g_class *mp, const char *fmt, ...) |
92{ 93 struct g_geom *gp; 94 va_list ap; 95 struct sbuf *sb; 96 97 g_topology_assert(); 98 va_start(ap, fmt); 99 mtx_lock(&Giant); --- 62 unchanged lines hidden (view full) --- 162 KASSERT (cp->acr == 0, ("g_destroy_consumer with acr")); 163 KASSERT (cp->acw == 0, ("g_destroy_consumer with acw")); 164 KASSERT (cp->ace == 0, ("g_destroy_consumer with ace")); 165 LIST_REMOVE(cp, consumer); 166 g_free(cp); 167} 168 169struct g_provider * | 92{ 93 struct g_geom *gp; 94 va_list ap; 95 struct sbuf *sb; 96 97 g_topology_assert(); 98 va_start(ap, fmt); 99 mtx_lock(&Giant); --- 62 unchanged lines hidden (view full) --- 162 KASSERT (cp->acr == 0, ("g_destroy_consumer with acr")); 163 KASSERT (cp->acw == 0, ("g_destroy_consumer with acw")); 164 KASSERT (cp->ace == 0, ("g_destroy_consumer with ace")); 165 LIST_REMOVE(cp, consumer); 166 g_free(cp); 167} 168 169struct g_provider * |
170g_new_providerf(struct g_geom *gp, char *fmt, ...) | 170g_new_providerf(struct g_geom *gp, const char *fmt, ...) |
171{ 172 struct g_provider *pp; 173 struct sbuf *sb; 174 va_list ap; 175 176 g_topology_assert(); 177 va_start(ap, fmt); 178 mtx_lock(&Giant); --- 267 unchanged lines hidden (view full) --- 446 cp->acr += dcr; 447 cp->acw += dcw; 448 cp->ace += dce; 449 } 450 return (error); 451} 452 453int | 171{ 172 struct g_provider *pp; 173 struct sbuf *sb; 174 va_list ap; 175 176 g_topology_assert(); 177 va_start(ap, fmt); 178 mtx_lock(&Giant); --- 267 unchanged lines hidden (view full) --- 446 cp->acr += dcr; 447 cp->acw += dcw; 448 cp->ace += dce; 449 } 450 return (error); 451} 452 453int |
454g_handleattr_int(struct bio *bp, char *attribute, int val) | 454g_handleattr_int(struct bio *bp, const char *attribute, int val) |
455{ 456 457 return (g_handleattr(bp, attribute, &val, sizeof val)); 458} 459 460int | 455{ 456 457 return (g_handleattr(bp, attribute, &val, sizeof val)); 458} 459 460int |
461g_handleattr_off_t(struct bio *bp, char *attribute, off_t val) | 461g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val) |
462{ 463 464 return (g_handleattr(bp, attribute, &val, sizeof val)); 465} 466 467 468int | 462{ 463 464 return (g_handleattr(bp, attribute, &val, sizeof val)); 465} 466 467 468int |
469g_handleattr(struct bio *bp, char *attribute, void *val, int len) | 469g_handleattr(struct bio *bp, const char *attribute, void *val, int len) |
470{ 471 int error; 472 473 if (strcmp(bp->bio_attribute, attribute)) 474 return (0); 475 if (bp->bio_length != len) { 476 printf("bio_length %jd len %d -> EFAULT\n", 477 (intmax_t)bp->bio_length, len); --- 80 unchanged lines hidden (view full) --- 558*/ 559 KASSERT(cp2->ace == 0, ("spoiling cp->ace = %d", cp2->ace)); 560 cp2->spoiled++; 561 } 562 g_post_event(EV_SPOILED, NULL, NULL, pp, cp); 563} 564 565static struct g_class * | 470{ 471 int error; 472 473 if (strcmp(bp->bio_attribute, attribute)) 474 return (0); 475 if (bp->bio_length != len) { 476 printf("bio_length %jd len %d -> EFAULT\n", 477 (intmax_t)bp->bio_length, len); --- 80 unchanged lines hidden (view full) --- 558*/ 559 KASSERT(cp2->ace == 0, ("spoiling cp->ace = %d", cp2->ace)); 560 cp2->spoiled++; 561 } 562 g_post_event(EV_SPOILED, NULL, NULL, pp, cp); 563} 564 565static struct g_class * |
566g_class_by_name(char *name) | 566g_class_by_name(const char *name) |
567{ 568 struct g_class *mp; 569 570 g_trace(G_T_TOPOLOGY, "g_class_by_name(%s)", name); 571 g_topology_assert(); 572 LIST_FOREACH(mp, &g_classes, class) 573 if (!strcmp(mp->name, name)) 574 return (mp); 575 return (NULL); 576} 577 578struct g_geom * | 567{ 568 struct g_class *mp; 569 570 g_trace(G_T_TOPOLOGY, "g_class_by_name(%s)", name); 571 g_topology_assert(); 572 LIST_FOREACH(mp, &g_classes, class) 573 if (!strcmp(mp->name, name)) 574 return (mp); 575 return (NULL); 576} 577 578struct g_geom * |
579g_insert_geom(char *class, struct g_consumer *cp) | 579g_insert_geom(const char *class, struct g_consumer *cp) |
580{ 581 struct g_class *mp; 582 struct g_geom *gp; 583 struct g_provider *pp, *pp2; 584 struct g_consumer *cp2; 585 int error; 586 587 g_trace(G_T_TOPOLOGY, "g_insert_geomf(%s, %p)", class, cp); --- 166 unchanged lines hidden --- | 580{ 581 struct g_class *mp; 582 struct g_geom *gp; 583 struct g_provider *pp, *pp2; 584 struct g_consumer *cp2; 585 int error; 586 587 g_trace(G_T_TOPOLOGY, "g_insert_geomf(%s, %p)", class, cp); --- 166 unchanged lines hidden --- |