- Extend disk structure to allow to store disk's serial number, which can be

retrieved via GEOM::ident attribute.
- Bump disk(9) ABI version.

OK'ed by:	phk
This commit is contained in:
Pawel Jakub Dawidek 2007-05-05 17:12:15 +00:00
parent 0589353ac7
commit d0c11f9eb7
3 changed files with 9 additions and 2 deletions

View File

@ -172,6 +172,8 @@ natural performance boundaries for most disk technologies.
Please see Please see
.Pa src/sys/geom/notes .Pa src/sys/geom/notes
for details. for details.
.It Vt char Va d_ident[DISK_IDENT_SIZE]
This field can and should be used to store disk's serial number.
.El .El
.Ss Driver Private Data .Ss Driver Private Data
This field may be used by the device driver to store a pointer to This field may be used by the device driver to store a pointer to

View File

@ -301,6 +301,8 @@ g_disk_start(struct bio *bp)
break; break;
else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0))
break; break;
else if (g_handleattr_str(bp, "GEOM::ident", dp->d_ident))
break;
else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump"))
g_disk_kerneldump(bp, dp); g_disk_kerneldump(bp, dp);
else else
@ -408,7 +410,7 @@ disk_alloc()
void void
disk_create(struct disk *dp, int version) disk_create(struct disk *dp, int version)
{ {
if (version != DISK_VERSION_00) { if (version != DISK_VERSION_00 && version != DISK_VERSION_01) {
printf("WARNING: Attempt to add disk %s%d %s", printf("WARNING: Attempt to add disk %s%d %s",
dp->d_name, dp->d_unit, dp->d_name, dp->d_unit,
" using incompatible ABI version of disk(9)\n"); " using incompatible ABI version of disk(9)\n");

View File

@ -42,6 +42,7 @@
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/_lock.h> #include <sys/_lock.h>
#include <sys/_mutex.h> #include <sys/_mutex.h>
#include <sys/disk.h>
struct disk; struct disk;
@ -83,6 +84,7 @@ struct disk {
u_int d_maxsize; u_int d_maxsize;
u_int d_stripeoffset; u_int d_stripeoffset;
u_int d_stripesize; u_int d_stripesize;
char d_ident[DISK_IDENT_SIZE];
/* Fields private to the driver */ /* Fields private to the driver */
void *d_drv1; void *d_drv1;
@ -99,7 +101,8 @@ void disk_destroy(struct disk *disk);
void disk_gone(struct disk *disk); void disk_gone(struct disk *disk);
#define DISK_VERSION_00 0x58561059 #define DISK_VERSION_00 0x58561059
#define DISK_VERSION DISK_VERSION_00 #define DISK_VERSION_01 0x5856105a
#define DISK_VERSION DISK_VERSION_01
#endif /* _KERNEL */ #endif /* _KERNEL */
#endif /* _GEOM_GEOM_DISK_H_ */ #endif /* _GEOM_GEOM_DISK_H_ */