Re: [PATCH 1/3] cifs: Introduce helper to compute length of nls string in bytes
Günter Kukkukk <[email protected]>
| Newsgroups | gmane.linux.file-systems.cifs |
|---|---|
| Organization | Entwicklungsbüro für Informationstechnologien |
| Message-ID | <[email protected]> |
Am Donnerstag, 23. April 2009 schrieb Günter Kukkukk: > Am Mittwoch, 22. April 2009 schrieb Jeff Layton: > > On Wed, 22 Apr 2009 02:25:05 +0200 > > Günter Kukkukk <[email protected]> wrote: > > > > > > during cleanup of the unicode related stuff we should also have a look > > > at functions currently located in misc.c > > > - cifs_convertUCSpath() > > > - cifsConvertToUCS() > > > > > > At the moment cifs_convertUCSpath() contains the following check: > > > ... > > > /* make sure we do not overrun callers allocated temp buffer */ > > > if (j >= (2 * NAME_MAX)) > > > break; > > > ... > > > Probably both functions should be moved away from misc.c. > > > > Agreed on all counts. For now, we're focused on the cases where we're > > converting the data from the server to the local charset. After that's > > resolved we need to fix the other direction as well. > > > > It might make sense to consolidate all of this in a separate file > > someplace as well. > > > > Hi Jeff, > > the function cifs_convertUCSpath() _is_ related to > "...we're focused on the cases where we're converting the data from > the server to the local charset. ....". > > And - it's heavily used. > Cheers, Günter just some further notes. With "it's heavily used" i didn't mean the number of callers using this function (only 1 in readdir.c) - i meant "the number of times" cifs_convertUCSpath() is called in daily usage.... (readdir results) The current focus was mostly on cifs_strfromUCS_le() - but the _same_ applies to cifs_convertUCSpath()! See the following code snippet: readdir.c --> static int cifs_get_name_from_search_buf() .... if (unicode) { /* BB fixme - test with long names */ /* Note converted filename can be longer than in unicode */ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) pqst->len = cifs_convertUCSpath((char *)pqst->name, (__le16 *)filename, len/2, nlt); else pqst->len = cifs_strfromUCS_le((char *)pqst->name, (__le16 *)filename, len/2, nlt); .... Cheers, Günter