[libvirt] [PATCH v4 1/4] storage: Split out the valid path check

Ján Tomko jtomko at redhat.com
Tue Apr 21 07:12:28 UTC 2015


On Mon, Apr 20, 2015 at 12:54:46PM -0400, John Ferlan wrote:
> 
> 
> On 04/20/2015 12:23 PM, Eric Blake wrote:
> > On 04/19/2015 06:38 PM, John Ferlan wrote:
> >> For virStorageBackendStablePath, in order to make decisions in other code
> >> split out the checks regarding whether the pool's target is empty, using /dev,
> >> using /dev/, or doesn't start with /dev
> >>
> >> Signed-off-by: John Ferlan <jferlan at redhat.com>
> >> ---
> >>  src/storage/storage_backend.c | 26 +++++++++++++-------------
> >>  src/storage/storage_backend.h |  1 +
> >>  2 files changed, 14 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> >> index 0435983..b07e0d9 100644
> >> --- a/src/storage/storage_backend.c
> >> +++ b/src/storage/storage_backend.c
> >> @@ -1674,6 +1674,17 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
> >>      return 0;
> >>  }
> >>  
> >> +bool
> >> +virStorageBackendPoolPathIsStable(const char *path)
> >> +{
> >> +    if (path == NULL || STREQ(path, "/dev") || STREQ(path, "/dev/"))
> >> +        return false;
> >> +
> >> +    if (!STRPREFIX(path, "/dev"))
> >> +        return false;
> > 
> > I think you want "/dev/" here as the prefix to be required; otherwise,
> > "/device" would match the prefix.  (This also means that someone using
> > "//dev/..." would fail the check, but that's probably something we don't
> > need to worry about).
> > 
> Hmm... Sure I see that... I can make that adjustment. I'll wait a bit
> before pushing just so see if there's other feedback...
> 

I think that change should be separate from this code motion.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150421/567a45a2/attachment-0001.sig>


More information about the libvir-list mailing list