[PATCH 2/6] torture: test FSCTL_SET_SPARSE

David Disseldorp ddiss at suse.de
Thu Aug 28 00:56:59 MDT 2014



On 28 August 2014 1:42:52 am GMT+02:00, Jeremy Allison <jra at samba.org> wrote:
>On Wed, Aug 27, 2014 at 03:41:58PM +0200, David Disseldorp wrote:
>> Check that the FILE_ATTRIBUTE_SPARSE is set following
>FSCTL_SET_SPARSE.
>> Also confirm that adding the attribute on create doesn't carry
>through
>> to subsequent SMB2_GETINFO_FILE requests.
>
>> +static NTSTATUS test_sparse_get(struct torture_context *torture,
>> +				TALLOC_CTX *mem_ctx,
>> +				struct smb2_tree *tree,
>> +				struct smb2_handle fh,
>> +				bool *_is_sparse)
>> +{
>> +	union smb_fileinfo io;
>> +	NTSTATUS status;
>> +
>> +	ZERO_STRUCT(io);
>> +	io.generic.level = RAW_FILEINFO_BASIC_INFORMATION;
>> +	io.generic.in.file.handle = fh;
>> +	status = smb2_getinfo_file(tree, mem_ctx, &io);
>> +	if (!NT_STATUS_IS_OK(status)) {
>> +		return status;
>> +	}
>> +	*_is_sparse = !!(io.basic_info.out.attrib & FILE_ATTRIBUTE_SPARSE);
>
>This line:
>
>                      ^^
>                      ||
>
>is weird :-). Double ! Typo ?

That's intended. It's shorthand for converting the flag to a bool.

Thanks for the review.

Cheers, David



More information about the samba-technical mailing list