> -----Original Message----- > From: Cornelia Huck <cohuck@xxxxxxxxxx> > Sent: Tuesday, August 20, 2019 11:25 PM > To: Alex Williamson <alex.williamson@xxxxxxxxxx> > Cc: Parav Pandit <parav@xxxxxxxxxxxx>; Jiri Pirko <jiri@xxxxxxxxxxxx>; > David S . Miller <davem@xxxxxxxxxxxxx>; Kirti Wankhede > <kwankhede@xxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx; linux- > kernel@xxxxxxxxxxxxxxx; cjia <cjia@xxxxxxxxxx>; netdev@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v2 0/2] Simplify mtty driver and mdev core > > On Tue, 20 Aug 2019 11:19:04 -0600 > Alex Williamson <alex.williamson@xxxxxxxxxx> wrote: > > > What about an alias based on the uuid? For example, we use 160-bit > > sha1s daily with git (uuids are only 128-bit), but we generally don't > > reference git commits with the full 20 character string. Generally 12 > > characters is recommended to avoid ambiguity. Could mdev > > automatically create an abbreviated sha1 alias for the device? If so, > > how many characters should we use and what do we do on collision? The > > colliding device could add enough alias characters to disambiguate (we > > likely couldn't re-alias the existing device to disambiguate, but I'm > > not sure it matters, userspace has sysfs to associate aliases). Ex. > > > > UUID=$(uuidgen) > > ALIAS=$(echo $UUID | sha1sum | colrm 13) > > > > Since there seems to be some prefix overhead, as I ask about above in > > how many characters we actually have to work with in IFNAMESZ, maybe > > we start with 8 characters (matching your "index" namespace) and > > expand as necessary for disambiguation. If we can eliminate overhead > > in IFNAMESZ, let's start with 12. Thanks, > > > > Alex > > I really like that idea, and it seems the best option proposed yet, as we don't > need to create a secondary identifier. User setting this alias at mdev creation time and exposed via sysfs as read only attribute works. Exposing that as const char *mdev_alias(struct mdev_device *dev) to vendor drivers..