RE: [PATCH 2/2] tools: ffs-test: convert to new descriptor format fixing compilation error

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

 



Hi,

> -----Original Message-----
> From: Michal Nazarewicz [mailto:mina86@xxxxxxxxxx]
> Sent: Thursday, June 05, 2014 9:43 AM
> To: Felipe Balbi
> Cc: Krzysztof Opasiak; linux-usb@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Michal Nazarewicz
> Subject: [PATCH 2/2] tools: ffs-test: convert to new descriptor
> format fixing compilation error
> 
> Commit [ac8dde11: “usb: gadget: f_fs: Add flags to descriptors
> block”]
> which introduced a new descriptor format for FunctionFS removed the
> usb_functionfs_descs_head structure, which is still used by ffs-
> test.
> tool.
> 
> Convert ffs-test by converting it to use the new header format.
> For
> testing kernels prior to 3.14 (when the new format was introduced)
> and
> parsing of the legacy headers in the new kernels, provide a
> compilation
> flag to make the tool use the old format.
> 
> Finally, include information as to when the legacy FunctionFS
> headers
> format has been deprecated (which is also when the new one has been
> introduced).
> 
> Reported-by: Lad, Prabhakar <prabhakar.csengg@xxxxxxxxx>
> Reported-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
> Signed-off-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

(...)

> 
>  static const struct {
> -	struct usb_functionfs_descs_head header;
> +	struct {
> +		__le32 magic;
> +		__le32 length;
> +#ifndef USE_LEGACY_DESC_HEAD
> +		__le32 flags;
> +#endif
> +		__le32 fs_count;
> +		__le32 hs_count;
> +	} __attribute__((packed)) header;

I would suggest adding a suitable structure as you described in previous discussion[1]. Writing first 3 fields in each userspace program doesn't look quite good. Using:

#ifndef USE_LEGACY_DESC_HEAD
struct {
	struct usb_functionfs_desc_head2 header;
	__le32 fs_count
	(... and rest according to flags ...)
} __attribute__((packed)) header;
#else ...

Would be shorter, more flexible and user friendly. Moreover it gives less places for mistake (writing fields in wrong order).

Footnotes:
1 - http://marc.info/?l=linux-usb&m=140190878901586&w=2


--
BR's
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
k.opasiak@xxxxxxxxxxx





--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux