mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: "'Michal Nazarewicz'" <mina86@mina86.com>,
	"'Felipe Balbi'" <balbi@ti.com>
Cc: Krzysztof Opasiak <k.opasiak@samsung.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH 2/2] tools: ffs-test: convert to new descriptor format fixing compilation error
Date: Thu, 05 Jun 2014 13:25:01 +0200	[thread overview]
Message-ID: <008101cf80b0$caf88dc0$60e9a940$%opasiak@samsung.com> (raw)
In-Reply-To: <1401954206-8491-2-git-send-email-mina86@mina86.com>

Hi,

> -----Original Message-----
> From: Michal Nazarewicz [mailto:mina86@mina86.com]
> Sent: Thursday, June 05, 2014 9:43 AM
> To: Felipe Balbi
> Cc: Krzysztof Opasiak; linux-usb@vger.kernel.org; linux-
> kernel@vger.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@gmail.com>
> Reported-by: Krzysztof Opasiak <k.opasiak@samsung.com>
> Signed-off-by: Michal Nazarewicz <mina86@mina86.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@samsung.com






  reply	other threads:[~2014-06-05 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05  7:43 [PATCH 1/2] usb: gadget: f_fs: resurect usb_functionfs_descs_head structure Michal Nazarewicz
2014-06-05  7:43 ` [PATCH 2/2] tools: ffs-test: convert to new descriptor format fixing compilation error Michal Nazarewicz
2014-06-05 11:25   ` Krzysztof Opasiak [this message]
2014-06-05 11:56     ` Michal Nazarewicz
2014-06-05 13:49       ` Krzysztof Opasiak
2014-06-05 14:09 ` [PATCH 1/2] usb: gadget: f_fs: resurect usb_functionfs_descs_head structure Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='008101cf80b0$caf88dc0$60e9a940$%opasiak@samsung.com' \
    --to=k.opasiak@samsung.com \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®