geom_io.c (0edd2576c0e07f525c80e4aa5ff24350b55f18b7) | geom_io.c (9a6844d55fe33a5c55973951843be9aac013693f) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * Copyright (c) 2013 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 8 * and NAI Labs, the Security Research Division of Network Associates, Inc. --- 204 unchanged lines hidden (view full) --- 213 (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST); 214 bp2->bio_length = bp->bio_length; 215 bp2->bio_offset = bp->bio_offset; 216 bp2->bio_data = bp->bio_data; 217 bp2->bio_ma = bp->bio_ma; 218 bp2->bio_ma_n = bp->bio_ma_n; 219 bp2->bio_ma_offset = bp->bio_ma_offset; 220 bp2->bio_attribute = bp->bio_attribute; | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * Copyright (c) 2013 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 8 * and NAI Labs, the Security Research Division of Network Associates, Inc. --- 204 unchanged lines hidden (view full) --- 213 (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST); 214 bp2->bio_length = bp->bio_length; 215 bp2->bio_offset = bp->bio_offset; 216 bp2->bio_data = bp->bio_data; 217 bp2->bio_ma = bp->bio_ma; 218 bp2->bio_ma_n = bp->bio_ma_n; 219 bp2->bio_ma_offset = bp->bio_ma_offset; 220 bp2->bio_attribute = bp->bio_attribute; |
221 if (bp->bio_cmd == BIO_ZONE) 222 bcopy(&bp->bio_zone, &bp2->bio_zone, 223 sizeof(bp->bio_zone)); |
|
221 /* Inherit classification info from the parent */ 222 bp2->bio_classifier1 = bp->bio_classifier1; 223 bp2->bio_classifier2 = bp->bio_classifier2; 224 bp->bio_children++; 225 } 226#ifdef KTR 227 if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) { 228 struct stack st; --- 71 unchanged lines hidden (view full) --- 300 g_io_request(bp, cp); 301 error = biowait(bp, "ggetattr"); 302 *len = bp->bio_completed; 303 g_destroy_bio(bp); 304 return (error); 305} 306 307int | 224 /* Inherit classification info from the parent */ 225 bp2->bio_classifier1 = bp->bio_classifier1; 226 bp2->bio_classifier2 = bp->bio_classifier2; 227 bp->bio_children++; 228 } 229#ifdef KTR 230 if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) { 231 struct stack st; --- 71 unchanged lines hidden (view full) --- 303 g_io_request(bp, cp); 304 error = biowait(bp, "ggetattr"); 305 *len = bp->bio_completed; 306 g_destroy_bio(bp); 307 return (error); 308} 309 310int |
311g_io_zonecmd(struct disk_zone_args *zone_args, struct g_consumer *cp) 312{ 313 struct bio *bp; 314 int error; 315 316 g_trace(G_T_BIO, "bio_zone(%d)", zone_args->zone_cmd); 317 bp = g_alloc_bio(); 318 bp->bio_cmd = BIO_ZONE; 319 bp->bio_done = NULL; 320 /* 321 * XXX KDM need to handle report zone data. 322 */ 323 bcopy(zone_args, &bp->bio_zone, sizeof(*zone_args)); 324 if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) 325 bp->bio_length = 326 zone_args->zone_params.report.entries_allocated * 327 sizeof(struct disk_zone_rep_entry); 328 else 329 bp->bio_length = 0; 330 331 g_io_request(bp, cp); 332 error = biowait(bp, "gzone"); 333 bcopy(&bp->bio_zone, zone_args, sizeof(*zone_args)); 334 g_destroy_bio(bp); 335 return (error); 336} 337 338int |
|
308g_io_flush(struct g_consumer *cp) 309{ 310 struct bio *bp; 311 int error; 312 313 g_trace(G_T_BIO, "bio_flush(%s)", cp->provider->name); 314 bp = g_alloc_bio(); 315 bp->bio_cmd = BIO_FLUSH; --- 28 unchanged lines hidden (view full) --- 344 return (EPERM); 345 break; 346 case BIO_WRITE: 347 case BIO_DELETE: 348 case BIO_FLUSH: 349 if (cp->acw == 0) 350 return (EPERM); 351 break; | 339g_io_flush(struct g_consumer *cp) 340{ 341 struct bio *bp; 342 int error; 343 344 g_trace(G_T_BIO, "bio_flush(%s)", cp->provider->name); 345 bp = g_alloc_bio(); 346 bp->bio_cmd = BIO_FLUSH; --- 28 unchanged lines hidden (view full) --- 375 return (EPERM); 376 break; 377 case BIO_WRITE: 378 case BIO_DELETE: 379 case BIO_FLUSH: 380 if (cp->acw == 0) 381 return (EPERM); 382 break; |
383 case BIO_ZONE: 384 if ((bp->bio_zone.zone_cmd == DISK_ZONE_REPORT_ZONES) || 385 (bp->bio_zone.zone_cmd == DISK_ZONE_GET_PARAMS)) { 386 if (cp->acr == 0) 387 return (EPERM); 388 } else if (cp->acw == 0) 389 return (EPERM); 390 break; |
|
352 default: 353 return (EPERM); 354 } 355 /* if provider is marked for error, don't disturb. */ 356 if (pp->error) 357 return (pp->error); 358 if (cp->flags & G_CF_ORPHAN) 359 return (ENXIO); --- 623 unchanged lines hidden (view full) --- 983 case BIO_GETATTR: 984 cmd = "GETATTR"; 985 printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute); 986 return; 987 case BIO_FLUSH: 988 cmd = "FLUSH"; 989 printf("%s[%s]", pname, cmd); 990 return; | 391 default: 392 return (EPERM); 393 } 394 /* if provider is marked for error, don't disturb. */ 395 if (pp->error) 396 return (pp->error); 397 if (cp->flags & G_CF_ORPHAN) 398 return (ENXIO); --- 623 unchanged lines hidden (view full) --- 1022 case BIO_GETATTR: 1023 cmd = "GETATTR"; 1024 printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute); 1025 return; 1026 case BIO_FLUSH: 1027 cmd = "FLUSH"; 1028 printf("%s[%s]", pname, cmd); 1029 return; |
1030 case BIO_ZONE: { 1031 char *subcmd = NULL; 1032 cmd = "ZONE"; 1033 switch (bp->bio_zone.zone_cmd) { 1034 case DISK_ZONE_OPEN: 1035 subcmd = "OPEN"; 1036 break; 1037 case DISK_ZONE_CLOSE: 1038 subcmd = "CLOSE"; 1039 break; 1040 case DISK_ZONE_FINISH: 1041 subcmd = "FINISH"; 1042 break; 1043 case DISK_ZONE_RWP: 1044 subcmd = "RWP"; 1045 break; 1046 case DISK_ZONE_REPORT_ZONES: 1047 subcmd = "REPORT ZONES"; 1048 break; 1049 case DISK_ZONE_GET_PARAMS: 1050 subcmd = "GET PARAMS"; 1051 break; 1052 default: 1053 subcmd = "UNKNOWN"; 1054 break; 1055 } 1056 printf("%s[%s,%s]", pname, cmd, subcmd); 1057 return; 1058 } |
|
991 case BIO_READ: 992 cmd = "READ"; 993 break; 994 case BIO_WRITE: 995 cmd = "WRITE"; 996 break; 997 case BIO_DELETE: 998 cmd = "DELETE"; 999 break; 1000 default: 1001 cmd = "UNKNOWN"; 1002 printf("%s[%s()]", pname, cmd); 1003 return; 1004 } 1005 printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd, 1006 (intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); 1007} | 1059 case BIO_READ: 1060 cmd = "READ"; 1061 break; 1062 case BIO_WRITE: 1063 cmd = "WRITE"; 1064 break; 1065 case BIO_DELETE: 1066 cmd = "DELETE"; 1067 break; 1068 default: 1069 cmd = "UNKNOWN"; 1070 printf("%s[%s()]", pname, cmd); 1071 return; 1072 } 1073 printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd, 1074 (intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); 1075} |