[Midnightbsd-cvs] src [7861] U trunk/sys/geom: Make the addition of the d_gone binary compatible.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Sep 14 12:11:16 EDT 2016
Revision: 7861
http://svnweb.midnightbsd.org/src/?rev=7861
Author: laffer1
Date: 2016-09-14 12:11:16 -0400 (Wed, 14 Sep 2016)
Log Message:
-----------
Make the addition of the d_gone binary compatible. This allows
storage drivers compiled for 9.0 to work on 9.1 and preserves the ABI
for disks.
Obtained from: FreeBSD
Modified Paths:
--------------
trunk/sys/geom/geom_disk.c
trunk/sys/geom/geom_disk.h
Property Changed:
----------------
trunk/sys/geom/geom_disk.c
trunk/sys/geom/geom_disk.h
Modified: trunk/sys/geom/geom_disk.c
===================================================================
--- trunk/sys/geom/geom_disk.c 2016-09-14 16:08:56 UTC (rev 7860)
+++ trunk/sys/geom/geom_disk.c 2016-09-14 16:11:16 UTC (rev 7861)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/geom/geom_disk.c,v 1.5 2012/03/31 16:58:04 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Poul-Henning Kamp
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -510,7 +510,14 @@
dp = sc->dp;
- if (dp->d_gone != NULL)
+ /*
+ * FreeBSD 9 started with VERSION_01 of the struct disk structure.
+ * However, g_gone was added in the middle of the branch. To
+ * cope with version being missing from struct disk, we set a flag
+ * in g_disk_create for VERSION_01 and avoid touching the d_gone
+ * field for old consumers.
+ */
+ if (!(dp->d_flags & DISKFLAG_LACKS_GONE) && dp->d_gone != NULL)
dp->d_gone(dp);
}
@@ -578,7 +585,7 @@
void
disk_create(struct disk *dp, int version)
{
- if (version != DISK_VERSION_02) {
+ if (version != DISK_VERSION_02 && version != DISK_VERSION_01) {
printf("WARNING: Attempt to add disk %s%d %s",
dp->d_name, dp->d_unit,
" using incompatible ABI version of disk(9)\n");
@@ -586,6 +593,8 @@
dp->d_name, dp->d_unit);
return;
}
+ if (version == DISK_VERSION_01)
+ dp->d_flags |= DISKFLAG_LACKS_GONE;
KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy"));
KASSERT(dp->d_name != NULL, ("disk_create need d_name"));
KASSERT(*dp->d_name != 0, ("disk_create need d_name"));
Property changes on: trunk/sys/geom/geom_disk.c
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.6
\ No newline at end of property
Modified: trunk/sys/geom/geom_disk.h
===================================================================
--- trunk/sys/geom/geom_disk.h 2016-09-14 16:08:56 UTC (rev 7860)
+++ trunk/sys/geom/geom_disk.h 2016-09-14 16:11:16 UTC (rev 7861)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/geom/geom_disk.h,v 1.4 2012/03/31 16:58:04 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2003 Poul-Henning Kamp
* All rights reserved.
@@ -79,7 +79,6 @@
disk_ioctl_t *d_ioctl;
dumper_t *d_dump;
disk_getattr_t *d_getattr;
- disk_gone_t *d_gone;
/* Info fields from driver to geom_disk.c. Valid when open */
u_int d_sectorsize;
@@ -98,6 +97,9 @@
/* Fields private to the driver */
void *d_drv1;
+
+ /* new fields in stable - don't use if DISKFLAG_LACKS_GONE is set */
+ disk_gone_t *d_gone;
};
#define DISKFLAG_NEEDSGIANT 0x1
@@ -104,6 +106,7 @@
#define DISKFLAG_OPEN 0x2
#define DISKFLAG_CANDELETE 0x4
#define DISKFLAG_CANFLUSHCACHE 0x8
+#define DISKFLAG_LACKS_GONE 0x10
struct disk *disk_alloc(void);
void disk_create(struct disk *disk, int version);
Property changes on: trunk/sys/geom/geom_disk.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.5
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list