[linux-cifs-client] [RFC][PATCH] cifs: add helper to simplify handling of unicode strings and use it

Steve French smfrench at gmail.com
Tue Apr 14 17:25:14 GMT 2009


On Mon, Apr 13, 2009 at 11:34 PM, Suresh Jayaraman <sjayaraman at suse.de> wrote:
> Christoph Hellwig wrote:
>> On Sun, Apr 12, 2009 at 02:43:57PM +0530, Suresh Jayaraman wrote:
>>> Based on the recent discussions on opencoded, inconsistent allocation of
>>> memory needed for a unicode string conversion, the consensus is to
>>> calculate the memory needed exactly instead of using size assumptions
>>> and to consolidate some code that allocates memory and does conversion
>>> in a helper function and use it widely.
>>>
>>> This patch attempts to do the same. Please note that non-unicode cases
>>> has not been converted now as they are less error-prone than unicode
>>> cases. I've only compile tested this patch and yet to test it
>>> completely, but posting this little premature patch as there are lot
>>> of discussions happening around this code. This patch requires careful
>>> review.
>>>
>>> Thanks to Jeff, Steve and Simo for useful suggestions.
>>
>> One little comment before even looking at the code:  would it be useful
>> to have some of those helpers in common code?  We have an awful lot of
>> filesystems dealing with utf8 or ucs16 encoding with a lot of ad-hoc
>> helpers or even worse opencoded handling.
>
> Yes, I think. My quick look at some of the fs/* code suggests that it
> needs consistent handling. I'll see whether this helper can me made
> generic so that other filesystems could use them too. What other
> filesystems (apart from xfs) which you think can benefit from this?
>
> If there are enough canditates, may be we could consider adding this
> helper to fs/nls/ ?

I agree.
This makes sense to move at least some of these helpers to fs/nls (besides
making the SMB2 prototype a little smaller, it would likely provide
benefit for NTFS, cifs and others to use consistent handling)


-- 
Thanks,

Steve


More information about the linux-cifs-client mailing list