summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.h
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2011-06-14 17:10:32 +0000
committergibbs <gibbs@FreeBSD.org>2011-06-14 17:10:32 +0000
commit094b6aca1decaa03a1efdb6361ca6d7d1d3cc4d3 (patch)
tree2ba93494158658cf752e99e3930ef38a4872311c /sys/geom/geom_disk.h
parentf797e31a8d7ffc81bda219abef89c378821566db (diff)
downloadFreeBSD-src-094b6aca1decaa03a1efdb6361ca6d7d1d3cc4d3.zip
FreeBSD-src-094b6aca1decaa03a1efdb6361ca6d7d1d3cc4d3.tar.gz
Plumb device physical path reporting from CAM devices, through GEOM and
DEVFS, and make it accessible via the diskinfo utility. Extend GEOM's generic attribute query mechanism into generic disk consumers. sys/geom/geom_disk.c: sys/geom/geom_disk.h: sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Allow disk providers to implement a new method which can override the default BIO_GETATTR response, d_getattr(struct bio *). This function returns -1 if not handled, otherwise it returns 0 or an errno to be passed to g_io_deliver(). sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Don't copy the serial number to dp->d_ident anymore, as the CAM XPT is now responsible for returning this information via d_getattr()->(a)dagetattr()->xpt_getatr(). sys/geom/geom_dev.c: - Implement a new ioctl, DIOCGPHYSPATH, which returns the GEOM attribute "GEOM::physpath", if possible. If the attribute request returns a zero-length string, ENOENT is returned. usr.sbin/diskinfo/diskinfo.c: - If the DIOCGPHYSPATH ioctl is successful, report physical path data when diskinfo is executed with the '-v' option. Submitted by: will Reviewed by: gibbs Sponsored by: Spectra Logic Corporation Add generic attribute change notification support to GEOM. sys/sys/geom/geom.h: Add a new attrchanged method field to both g_class and g_geom. sys/sys/geom/geom.h: sys/geom/geom_event.c: - Provide the g_attr_changed() function that providers can use to advertise attribute changes. - Perform delivery of attribute change notifications from a thread context via the standard GEOM event mechanism. sys/geom/geom_subr.c: Inherit the attrchanged method from class to geom (class instance). sys/geom/geom_disk.c: Provide disk_attr_changed() to provide g_attr_changed() access to consumers of the disk API. sys/cam/scsi/scsi_pass.c: sys/cam/scsi/scsi_da.c: sys/geom/geom_dev.c: sys/geom/geom_disk.c: Use attribute changed events to track updates to physical path information. sys/cam/scsi/scsi_da.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, and the updated buffer type references our physical path attribute, emit a GEOM attribute changed event via the disk_attr_changed() API. sys/cam/scsi/scsi_pass.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, update the physical patch devfs alias for this pass instance. Submitted by: gibbs Sponsored by: Spectra Logic Corporation
Diffstat (limited to 'sys/geom/geom_disk.h')
-rw-r--r--sys/geom/geom_disk.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h
index 2d5f15d..e92f4aa 100644
--- a/sys/geom/geom_disk.h
+++ b/sys/geom/geom_disk.h
@@ -49,6 +49,7 @@ struct disk;
typedef int disk_open_t(struct disk *);
typedef int disk_close_t(struct disk *);
typedef void disk_strategy_t(struct bio *bp);
+typedef int disk_getattr_t(struct bio *bp);
typedef int disk_ioctl_t(struct disk *, u_long cmd, void *data,
int fflag, struct thread *td);
/* NB: disk_ioctl_t SHALL be cast'able to d_ioctl_t */
@@ -75,6 +76,7 @@ struct disk {
disk_strategy_t *d_strategy;
disk_ioctl_t *d_ioctl;
dumper_t *d_dump;
+ disk_getattr_t *d_getattr;
/* Info fields from driver to geom_disk.c. Valid when open */
u_int d_sectorsize;
@@ -104,6 +106,7 @@ struct disk *disk_alloc(void);
void disk_create(struct disk *disk, int version);
void disk_destroy(struct disk *disk);
void disk_gone(struct disk *disk);
+void disk_attr_changed(struct disk *dp, const char *attr, int flag);
#define DISK_VERSION_00 0x58561059
#define DISK_VERSION_01 0x5856105a
OpenPOWER on IntegriCloud