From owner-svn-src-all@FreeBSD.ORG Sun Aug 26 05:11:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C688C106566B; Sun, 26 Aug 2012 05:11:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18288FC15; Sun, 26 Aug 2012 05:11:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7Q5BrhE065876; Sun, 26 Aug 2012 05:11:53 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7Q5Brgh065872; Sun, 26 Aug 2012 05:11:53 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208260511.q7Q5Brgh065872@svn.freebsd.org> From: Warner Losh Date: Sun, 26 Aug 2012 05:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239707 - releng/9.1/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Aug 2012 05:11:54 -0000 Author: imp Date: Sun Aug 26 05:11:52 2012 New Revision: 239707 URL: http://svn.freebsd.org/changeset/base/239707 Log: MFS: r239148 r239148 | imp | 2012-08-08 14:21:33 -0600 (Wed, 08 Aug 2012) | 8 lines 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. Reviewed by: scottl, ken Approved by: re@ (kensmith) MFS after: releng/9.1 gets sorted This change fixes the binary compatibility problems with additions to the disk(9) API. Disk drivers compiled against 9.0 will not work on 9.1-RC1, but should start working after this change or in 9.1-RC2 and later. Disk drivers should not be linked against 9.1-RC1 for distribution, except specifically for testing on RC1. This was planned for RC1, but it was delayed due to circumstancs beyond my control. Approved by: re@ (kensmith) Modified: releng/9.1/sys/geom/geom_disk.c releng/9.1/sys/geom/geom_disk.h Directory Properties: releng/9.1/sys/ (props changed) Modified: releng/9.1/sys/geom/geom_disk.c ============================================================================== --- releng/9.1/sys/geom/geom_disk.c Sun Aug 26 04:39:20 2012 (r239706) +++ releng/9.1/sys/geom/geom_disk.c Sun Aug 26 05:11:52 2012 (r239707) @@ -509,7 +509,14 @@ g_disk_providergone(struct g_provider *p 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); } @@ -577,7 +584,7 @@ disk_alloc() 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"); @@ -585,6 +592,8 @@ disk_create(struct disk *dp, int version 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")); Modified: releng/9.1/sys/geom/geom_disk.h ============================================================================== --- releng/9.1/sys/geom/geom_disk.h Sun Aug 26 04:39:20 2012 (r239706) +++ releng/9.1/sys/geom/geom_disk.h Sun Aug 26 05:11:52 2012 (r239707) @@ -78,7 +78,6 @@ struct disk { 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; @@ -97,12 +96,16 @@ struct disk { /* 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 #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);