From owner-svn-src-all@FreeBSD.ORG Wed Apr 27 08:24:02 2011 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 0568B106564A; Wed, 27 Apr 2011 08:24:02 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 312C38FC1D; Wed, 27 Apr 2011 08:24:00 +0000 (UTC) Received: by bwz12 with SMTP id 12so1702754bwz.13 for ; Wed, 27 Apr 2011 01:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=uil9GRazJPvsH8okLg/FR/cuMm5pHj6k6enW3mTSXgk=; b=TXEJ8ag16V4m1ViQ+mc3vKKzEzD4GJ5XZfbtF43yW212K8fyjIaYDfeIEDqhIS+DYF 9mBY4ckNuM4mffzFoRv3ozERV/UCIzJA467gjrlq30hsRGVDAiU0p+taFMnUagAz8fey +4xqJOPh/8OICBHslyv8TFxrRt5SIErT2agWQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=o4yOGr06Yo8neg57WRy66WD97wPnJBRodSKHdhigLwNdzS4FdhJF1adcSogcQL0SnY GZTJVwP5k2Mssf40v55EnbVyuzsU8X6F/BsGg2qSs2a41RAFG2Diu8gcjklmCGhm60XF lQ0SiOM4ixt0U5O332b59aF+qDMhoCbMbL7NI= Received: by 10.204.71.193 with SMTP id i1mr1760293bkj.102.1303892640022; Wed, 27 Apr 2011 01:24:00 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id w3sm281681bkt.5.2011.04.27.01.23.58 (version=SSLv3 cipher=OTHER); Wed, 27 Apr 2011 01:23:59 -0700 (PDT) Sender: Alexander Motin Message-ID: <4DB7D296.7020300@FreeBSD.org> Date: Wed, 27 Apr 2011 11:23:50 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Kostik Belousov References: <201104270010.p3R0AQQv044866@svn.freebsd.org> <20110427080325.GV48734@deviant.kiev.zoral.com.ua> In-Reply-To: <20110427080325.GV48734@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221101 - in head/sys/geom: . concat journal mirror raid3 shsec stripe virstor 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: Wed, 27 Apr 2011 08:24:02 -0000 Kostik Belousov wrote: > On Wed, Apr 27, 2011 at 12:10:26AM +0000, Alexander Motin wrote: >> Author: mav >> Date: Wed Apr 27 00:10:26 2011 >> New Revision: 221101 >> URL: http://svn.freebsd.org/changeset/base/221101 >> >> Log: >> Implement relaxed comparision for hardcoded provider names to make it >> ignore adX/adaY difference in both directions to simplify migration to >> the CAM-based ATA or back. >> >> Modified: >> head/sys/geom/concat/g_concat.c >> head/sys/geom/geom.h >> head/sys/geom/geom_subr.c >> head/sys/geom/journal/g_journal.c >> head/sys/geom/mirror/g_mirror.c >> head/sys/geom/raid3/g_raid3.c >> head/sys/geom/shsec/g_shsec.c >> head/sys/geom/stripe/g_stripe.c >> head/sys/geom/virstor/g_virstor.c >> >> Modified: head/sys/geom/concat/g_concat.c >> ============================================================================== >> --- head/sys/geom/concat/g_concat.c Tue Apr 26 23:00:32 2011 (r221100) >> +++ head/sys/geom/concat/g_concat.c Wed Apr 27 00:10:26 2011 (r221101) >> @@ -678,7 +678,8 @@ g_concat_taste(struct g_class *mp, struc >> if (md.md_version < 4) >> md.md_provsize = pp->mediasize; >> >> - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) >> + if (md.md_provider[0] != '\0' && >> + !g_compare_names(md.md_provider, pp->name)) >> return (NULL); >> if (md.md_provsize != pp->mediasize) >> return (NULL); >> >> Modified: head/sys/geom/geom.h >> ============================================================================== >> --- head/sys/geom/geom.h Tue Apr 26 23:00:32 2011 (r221100) >> +++ head/sys/geom/geom.h Wed Apr 27 00:10:26 2011 (r221101) >> @@ -238,6 +238,7 @@ void g_waitidlelock(void); >> /* geom_subr.c */ >> int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); >> int g_attach(struct g_consumer *cp, struct g_provider *pp); >> +int g_compare_names(const char *namea, const char *nameb); >> void g_destroy_consumer(struct g_consumer *cp); >> void g_destroy_geom(struct g_geom *pp); >> void g_destroy_provider(struct g_provider *pp); >> >> Modified: head/sys/geom/geom_subr.c >> ============================================================================== >> --- head/sys/geom/geom_subr.c Tue Apr 26 23:00:32 2011 (r221100) >> +++ head/sys/geom/geom_subr.c Wed Apr 27 00:10:26 2011 (r221101) >> @@ -1017,6 +1017,43 @@ g_getattr__(const char *attr, struct g_c >> return (0); >> } >> >> +static int >> +g_get_device_prefix_len(const char *name) >> +{ >> + int len; >> + >> + if (strncmp(name, "ada", 3) == 0) >> + len = 3; >> + else if (strncmp(name, "ad", 2) == 0) >> + len = 2; >> + else >> + return (0); >> + if (name[len] < '0' || name[len] > '9') >> + return (0); >> + do { >> + len++; >> + } while (name[len] >= '0' && name[len] <= '9'); >> + return (len); >> +} >> + >> +int >> +g_compare_names(const char *namea, const char *nameb) >> +{ >> + int deva, devb; >> + >> + if (strcmp(namea, nameb) == 0) >> + return (1); >> + deva = g_get_device_prefix_len(namea); >> + if (deva == 0) >> + return (0); >> + devb = g_get_device_prefix_len(nameb); >> + if (devb == 0) >> + return (0); >> + if (strcmp(namea + deva, nameb + devb) == 0) >> + return (1); >> + return (0); >> +} >> + > This is most likely my misunderstanding of things. > > Can we have a legitimate situation where both ada* and ad* devices coexist > on the same system ? E.g. on-board AHCI and legacy PATA controller ? Yes, we can and sometimes do. But the new GENERIC kernels in CURRENT switch everything to the adaX. > Wouldn't this hack then wreak the havoc ? Can the hack be put under the > control of some tunable ? I can't imagine useful situation when device name part of the hardcoded provider name is important. Only partition name sometimes is. -- Alexander Motin