[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/4] virfile: Introduce virFileIsNFSFSType




On 08/08/2014 07:07 AM, Ján Tomko wrote:
> On 08/05/2014 04:38 PM, John Ferlan wrote:
>> Use the virFileGetFSFtype() in order to compare the returned
>> f_type for the NFS super magic number
>>
>> Signed-off-by: John Ferlan <jferlan redhat com>
>> ---
>>  src/libvirt_private.syms |  1 +
>>  src/util/virfile.c       | 19 +++++++++++++++++++
>>  src/util/virfile.h       |  1 +
>>  3 files changed, 21 insertions(+)
>>
>> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>> index 08111d4..121e578 100644
>> --- a/src/libvirt_private.syms
>> +++ b/src/libvirt_private.syms
>> @@ -1291,6 +1291,7 @@ virFileIsDir;
>>  virFileIsExecutable;
>>  virFileIsLink;
>>  virFileIsMountPoint;
>> +virFileIsNFSFSType;
>>  virFileIsSharedFS;
>>  virFileIsSharedFSType;
>>  virFileLinkPointsTo;
>> diff --git a/src/util/virfile.c b/src/util/virfile.c
>> index 7612007..e6c767d 100644
>> --- a/src/util/virfile.c
>> +++ b/src/util/virfile.c
>> @@ -2927,6 +2927,18 @@ virFileIsSharedFSType(const char *path,
>>      return 0;
>>  }
>>  
>> +bool
>> +virFileIsNFSFSType(const char *path)
>> +{
>> +    long long int f_type;
>> +
>> +    if ((virFileGetFSFtype(path, &f_type) == 0) &&
>> +        (f_type == NFS_SUPER_MAGIC))
>> +        return true;
>> +
>> +    return false;
>> +}
>> +
>>  int
>>  virFileGetHugepageSize(const char *path,
>>                         unsigned long long *size)
>> @@ -3060,6 +3072,13 @@ int virFileIsSharedFSType(const char *path ATTRIBUTE_UNUSED,
>>  }
>>  
>>  int
>> +virFileIsNFSFSType(const char *path ATTRIBUTE_UNUSED)
> 
> This doesn't match the prototype in virfile.h.
> 

Drat - boy I hate making the same mistake twice - changed the function
late, but forgot to change the #else...

> Also, I wonder if virFileIsNFSFSType(path) is that much more readable than
> virFileIsSharedFSType(path, VIR_FILE_SHFS_NFS) == 1.
> 

hmm... guess that makes patch 1 & 2 unnecessary. Guess I was more
hyperfocused on how to get at NFS_SUPER_MAGIC that I missed the SHFS enum

I'll rework...


John


>> +{
>> +    /* XXX implement me :-) */ 
>> +    return false;
>> +}
>> +
>> +int
>>  virFileGetHugepageSize(const char *path ATTRIBUTE_UNUSED,
>>                         unsigned long long *size ATTRIBUTE_UNUSED)
>>  {
>> diff --git a/src/util/virfile.h b/src/util/virfile.h
>> index 403d0ba..cc07c53 100644
>> --- a/src/util/virfile.h
>> +++ b/src/util/virfile.h
>> @@ -191,6 +191,7 @@ enum {
>>  };
>>  
>>  int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
>> +bool virFileIsNFSFSType(const char *path);
> 
> ATTRIBUTE_NONNULL(1);
> 
>>  int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1);
>>  int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1);
>>  
>>
> 
> ACK
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]