Date: Tue, 26 Apr 2011 10:02:22 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Alexander Motin <mav@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" <bz@freebsd.org>, Robert Watson <rwatson@freebsd.org>, svn-src-head@freebsd.org, Warner Losh <imp@bsdimp.com> Subject: Re: svn commit: r220982 - in head: . sys/amd64/conf sys/arm/conf sys/conf sys/i386/conf sys/ia64/conf sys/mips/conf sys/mips/malta sys/pc98/conf sys/powerpc/conf sys/sparc64/conf sys/sun4v/conf Message-ID: <20110426080222.GG2472@garage.freebsd.pl> In-Reply-To: <4DB67939.6080301@FreeBSD.org> References: <CD028561-B550-4896-BE65-7C827BE6A34A@FreeBSD.org> <20110425134531.GA4391@garage.freebsd.pl> <50385B7B-7EC8-4BC3-8F88-83F9EB4096FB@bsdimp.com> <4DB5A166.9010302@FreeBSD.org> <67F62848-FAA3-4C46-A95A-DA7C82281898@bsdimp.com> <4DB5B0A9.4030805@FreeBSD.org> <20110426070020.GC2472@garage.freebsd.pl> <4DB6721B.3020600@FreeBSD.org> <20110426073517.GF2472@garage.freebsd.pl> <4DB67939.6080301@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--ahP6B03r4gLOj5uD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 26, 2011 at 10:50:17AM +0300, Alexander Motin wrote: > On 26.04.2011 10:35, Pawel Jakub Dawidek wrote: > >On Tue, Apr 26, 2011 at 10:19:55AM +0300, Alexander Motin wrote: > >>On 26.04.2011 10:00, Pawel Jakub Dawidek wrote: > >>>On Mon, Apr 25, 2011 at 08:34:33PM +0300, Alexander Motin wrote: > >>>>I've thought about the process of fixing hardcoded provider names the= re, > >>>>and it is absolutely not trivial. If we take the "symlinking" way (pa= tch > >>>>is already posted to current@), I think it will be much easier for > >>>>everybody, and especially users, if I hack all mentioned above GEOM > >>>>classes to ignore adX/adaY difference in provider names. And it should > >>>>perfectly fit into remaining time window. > >>> > >>>Could you be more specific what the hack would do exactly? > >> > >>I would write some comparison function, which would search both > >>names for adX/adaY prefixes, if they found on both arguments, > >>trimmed them and compared remaining parts. > >> > >>I think for usual purpose of name hardcoding device name part is > >>less important. Comparing partition names part should be enough. The > >>tricky part there is to properly identify device part, so I was > >>thinking about specific hack for adX/adaY. > > > >I was wondering how would you match X and Y, but this is indeed not > >important. So on taste we could do (totally untested): > > > >static bool > >provider_name_matches(const char *ppname, const char *hcname) > >{ > > > > if (strcmp(ppname, hcname) =3D=3D 0) > > return (true); > > if (strncmp(hcname, "ad", 2) !=3D 0 || > > hcname[2]< '0' || hcname[2]> '9') { > > return (false); > > } > > if (strncmp(ppname, "ada", 3) !=3D 0 || > > ppname[3]< '0' || ppname[3]> '9') { > > return (false); > > } > > /* Skip 'ad[0-9]+'. */ > > hcname +=3D 3; > > while (hcname[0]>=3D '0'&& hcname[0]<=3D '9') > > hcname++; > > /* Skip 'ada[0-9]+'. > > ppname +=3D 4; > > while (ppname[0]>=3D '0'&& ppname[0]<=3D '9') > > ppname++; > > > > return (strcmp(ppname, hcname) =3D=3D 0); > >} > > > >That could work. >=20 > Yes, I was thinking about something like that. May be just > symmetric, so it could handle some cases of downgrade. Ok, so this will handle hardcoded provider names. I think this is good enough. Now, what about fstab? There is a problem to figure out which disk we booted from once we enter the kernel. I was wondering if we could detect that someone is trying to mount root which from 'ad[0-9]+<X>' and then we could scan all ada[0-9]+<X> looking for UFS file system and /etc/fstab in there and / entry which matches vfs.root.mountfrom variable. This should cover 99% of cases. 1% is for cases where another disk have identical partitioning scheme and /etc/fstab file. There also might be cases where someone defines vfs.root.mountfrom in /boot/loader.conf and doesn't really use /etc/fstab. > >Another possibility I was thinking of was to create GEOM providers for > >both names and orphan the other name once one of them is opened for > >writing. >=20 > I've even implemented patch (posted on current@) with close idea (I > was creating extra geom with legacy name), and it will have the same > problem: if somebody open any partition on the device with the new > name, all legacy names will become inaccessible (busy), and vice > versa. It could be not a big problem if it would only be user's > choice -- we could say just: "use one or another, not both". But > provider could be chosen blindly by some GEOM class, such as glabel, > and then it turns into pure lottery. Good point. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --ahP6B03r4gLOj5uD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk22fA4ACgkQForvXbEpPzSVkgCg58FJFGH9t000FC0OxifMvnJ1 rWEAnRKfV9yeHHuQpVbqpInURY8T6tHj =vyDX -----END PGP SIGNATURE----- --ahP6B03r4gLOj5uD--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110426080222.GG2472>