Hi,
> -----Original Message-----
> From: Michal Nazarewicz [mailto:[email protected]]
> Sent: Thursday, June 05, 2014 9:43 AM
> To: Felipe Balbi
> Cc: Krzysztof Opasiak; [email protected]; linux-
> [email protected]; 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 <[email protected]>
> Reported-by: Krzysztof Opasiak <[email protected]>
> Signed-off-by: Michal Nazarewicz <[email protected]>
(...)
>
> 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
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/