[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <008101cf80b0$caf88dc0$60e9a940$%opasiak@samsung.com>
Date: Thu, 05 Jun 2014 13:25:01 +0200
From: Krzysztof Opasiak <k.opasiak@...sung.com>
To: 'Michal Nazarewicz' <mina86@...a86.com>,
'Felipe Balbi' <balbi@...com>
Cc: Krzysztof Opasiak <k.opasiak@...sung.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: RE: [PATCH 2/2] tools: ffs-test: convert to new descriptor format
fixing compilation error
Hi,
> -----Original Message-----
> From: Michal Nazarewicz [mailto:mina86@...a86.com]
> Sent: Thursday, June 05, 2014 9:43 AM
> To: Felipe Balbi
> Cc: Krzysztof Opasiak; linux-usb@...r.kernel.org; linux-
> kernel@...r.kernel.org; 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@...il.com>
> Reported-by: Krzysztof Opasiak <k.opasiak@...sung.com>
> Signed-off-by: Michal Nazarewicz <mina86@...a86.com>
(...)
>
> 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@...sung.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists