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 there,
and it is absolutely not trivial. If we take the "symlinking" way (patch
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) == 0)
                return (true);
        if (strncmp(hcname, "ad", 2) != 0 ||
            hcname[2]<  '0' || hcname[2]>  '9') {
                return (false);
        }
        if (strncmp(ppname, "ada", 3) != 0 ||
            ppname[3]<  '0' || ppname[3]>  '9') {
                return (false);
        }
        /* Skip 'ad[0-9]+'. */
        hcname += 3;
        while (hcname[0]>= '0'&&  hcname[0]<= '9')
                hcname++;
        /* Skip 'ada[0-9]+'.
        ppname += 4;
        while (ppname[0]>= '0'&&  ppname[0]<= '9')
                ppname++;

        return (strcmp(ppname, hcname) == 0);
}

That could work.

Yes, I was thinking about something like that. May be just symmetric, so it could handle some cases of downgrade.

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.

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.

--
Alexander Motin
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to