Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/geom_io.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/sbuf.h> | |||||
#include <sys/stack.h> | #include <sys/stack.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/vmem.h> | #include <sys/vmem.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <geom/geom.h> | #include <geom/geom.h> | ||||
#include <geom/geom_int.h> | #include <geom/geom_int.h> | ||||
#include <sys/devicestat.h> | #include <sys/devicestat.h> | ||||
▲ Show 20 Lines • Show All 964 Lines • ▼ Show 20 Lines | g_delete_data(struct g_consumer *cp, off_t offset, off_t length) | ||||
bp->bio_data = NULL; | bp->bio_data = NULL; | ||||
g_io_request(bp, cp); | g_io_request(bp, cp); | ||||
error = biowait(bp, "gdelete"); | error = biowait(bp, "gdelete"); | ||||
g_destroy_bio(bp); | g_destroy_bio(bp); | ||||
return (error); | return (error); | ||||
} | } | ||||
void | void | ||||
g_print_bio(struct bio *bp) | g_format_bio(struct sbuf *sb, struct bio *bp) | ||||
{ | { | ||||
const char *pname, *cmd = NULL; | const char *pname, *cmd = NULL; | ||||
if (bp->bio_to != NULL) | if (bp->bio_to != NULL) | ||||
pname = bp->bio_to->name; | pname = bp->bio_to->name; | ||||
else | else | ||||
rlibby: Why `__unused`? | |||||
Done Inline Actions(Context for readers: This is about the struct sbuf *sbp __unused, which is no longer here but can be found in geom_subr.c.) I only use the pointer to error-check the sbuf_new() return. And the error checking is only a KASSERT(). KASSERT is less like Isilon's ASSERT() and more like our ASSERT_DEBUG(), i.e., it is compiled out in !INVARIANTS builds. Without __unused, the compiler would produce -Wunused-but-set-variable (included in -Wall) for !INVARIANTS configs, breaking the -Werror build. cem: (Context for readers: This is about the `struct sbuf *sbp __unused`, which is no longer here… | |||||
Done Inline ActionsAh, yes. Thanks. rlibby: Ah, yes. Thanks. | |||||
pname = "[unknown]"; | pname = "[unknown]"; | ||||
switch (bp->bio_cmd) { | switch (bp->bio_cmd) { | ||||
case BIO_GETATTR: | case BIO_GETATTR: | ||||
cmd = "GETATTR"; | cmd = "GETATTR"; | ||||
printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute); | sbuf_printf(sb, "%s[%s(attr=%s)]", pname, cmd, | ||||
bp->bio_attribute); | |||||
return; | return; | ||||
case BIO_FLUSH: | case BIO_FLUSH: | ||||
cmd = "FLUSH"; | cmd = "FLUSH"; | ||||
printf("%s[%s]", pname, cmd); | sbuf_printf(sb, "%s[%s]", pname, cmd); | ||||
return; | return; | ||||
case BIO_ZONE: { | case BIO_ZONE: { | ||||
char *subcmd = NULL; | char *subcmd = NULL; | ||||
cmd = "ZONE"; | cmd = "ZONE"; | ||||
switch (bp->bio_zone.zone_cmd) { | switch (bp->bio_zone.zone_cmd) { | ||||
case DISK_ZONE_OPEN: | case DISK_ZONE_OPEN: | ||||
subcmd = "OPEN"; | subcmd = "OPEN"; | ||||
break; | break; | ||||
Show All 11 Lines | case DISK_ZONE_REPORT_ZONES: | ||||
break; | break; | ||||
case DISK_ZONE_GET_PARAMS: | case DISK_ZONE_GET_PARAMS: | ||||
subcmd = "GET PARAMS"; | subcmd = "GET PARAMS"; | ||||
break; | break; | ||||
default: | default: | ||||
subcmd = "UNKNOWN"; | subcmd = "UNKNOWN"; | ||||
break; | break; | ||||
} | } | ||||
printf("%s[%s,%s]", pname, cmd, subcmd); | sbuf_printf(sb, "%s[%s,%s]", pname, cmd, subcmd); | ||||
return; | return; | ||||
} | } | ||||
case BIO_READ: | case BIO_READ: | ||||
cmd = "READ"; | cmd = "READ"; | ||||
break; | break; | ||||
case BIO_WRITE: | case BIO_WRITE: | ||||
cmd = "WRITE"; | cmd = "WRITE"; | ||||
break; | break; | ||||
case BIO_DELETE: | case BIO_DELETE: | ||||
cmd = "DELETE"; | cmd = "DELETE"; | ||||
break; | break; | ||||
default: | default: | ||||
cmd = "UNKNOWN"; | cmd = "UNKNOWN"; | ||||
printf("%s[%s()]", pname, cmd); | sbuf_printf(sb, "%s[%s()]", pname, cmd); | ||||
return; | return; | ||||
} | } | ||||
printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd, | sbuf_printf(sb, "%s[%s(offset=%jd, length=%jd)]", pname, cmd, | ||||
(intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); | (intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); | ||||
} | } |
Why __unused?