On 11/1/13, 4:56 PM, Zach Brown wrote:
>> +static int btrfs_ioctl_get_supported_features(struct file *file,
>> +                                          void __user *arg)
>> +{
>> +    struct btrfs_ioctl_feature_flags features[3];
>> +
>> +    features[0].compat_flags = BTRFS_FEATURE_COMPAT_SUPP;
>> +    features[0].compat_ro_flags = BTRFS_FEATURE_COMPAT_RO_SUPP;
>> +    features[0].incompat_flags = BTRFS_FEATURE_INCOMPAT_SUPP;
>> +
>> +    features[1].compat_flags = BTRFS_FEATURE_COMPAT_SAFE_SET;
>> +    features[1].compat_ro_flags = BTRFS_FEATURE_COMPAT_RO_SAFE_SET;
>> +    features[1].incompat_flags = BTRFS_FEATURE_INCOMPAT_SAFE_SET;
>> +
>> +    features[2].compat_flags = BTRFS_FEATURE_COMPAT_SAFE_CLEAR;
>> +    features[2].compat_ro_flags = BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR;
>> +    features[2].incompat_flags = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR;
>> +
>> +    if (copy_to_user(arg, &features, sizeof(features)))
>> +            return -EFAULT;
> 
> If these are all constants shouldn't that just copy out of a static
> built flags array?

Works for me. Change added.

-Jeff

> #define cpp4ever(suff) \
>       BTRFS_FEATURE_COMPAT_#suff, BTRFS_FEATURE_COMPAT_RO_#suff, \
>       BTRFS_FEATURE_INCOMPAT_#suff
> 
>       static struct btrfs_ioctl_feature_flags features[3] = {
>               { cpp4ever(SUPP) }, { cpp4ever(SAFE_SET) },
>               { cpp4ever(SAFE_CLEAR) },
>       };
> 
>       if (copy_to_user(arg, &features, sizeof(features)))
>               return -EFAULT;
> 
> ?
> 
> - z
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
Jeff Mahoney
SUSE Labs

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to