Re: [PATCH 10/16] usb/gadget: FunctionFS: Remove VLAIS usage from gadget code

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

 



W dniu 08.11.2013 16:38, Sebastian Andrzej Siewior pisze:
On 11/08/2013 04:01 PM, Andrzej Pietrasiewicz wrote:
Hello Sebastian,

Hallo Andrzej,

Please correct me if I'm wrong but I think it is not possible to use
usb_gstrings_attach(). Basically, usb_gstrings_attach() requires

struct usb_gadget_strings **sp

on input, then it does copy_gadget_strings(sp, n_gstrings, n_strings);
and then does its job. So actually to do usb_gstrings_attach() you need
to _already_ have struct usb_gadget_strings **sp.

FunctionFS is different in that it takes data to _build_
usb_gadget_strings **stringtabs from userspace (the char *const _data).
In other words, the string descriptors are provided from userspace as
a character buffer which needs to be parsed and it is what
__ffs_data_got_strings() does.

You are right.
So you would have to assume sane upper values for str_count and
lang_count or allocate the three arrays separately. Later you need to
parse that buffer anyway so there is not much win except that the
strings are handled the same way like in other places.

We don't need to copy the strings again with usb_gstrings_attach()
because each FunctionFS instance uses its own copy by design:

ffs->stringtabs

Andrzej

--
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