> - Simplified time conversion functions drastically without
> sacrificing accuracy, now the offending function is 3 lines instead of
> two pages of code. (-8
Does this mean I have to change the code I borrowed?
(Never mind ... :)
> -/* Converts a single wide character to a sequence of utf8 bytes.
> +/*
> + * Converts a single wide character to a sequence of utf8 bytes.
> * The character is represented in host byte order.
> - * Returns the number of bytes, or 0 on error. */
> -static int to_utf8(ntfs_u16 c, unsigned char* buf)
> + * Returns the number of bytes, or 0 on error.
> + */
> +static int to_utf8(ntfs_u16 c, unsigned char *buf)
How is this different from utf8_wctomb in fs/nls/nls_base.c?
(in purpose)
If it is to allow ntfs_dupuni2utf8 to count the new string length, could
that be done differently? If there is a max allowed length of filenames
the "double parsing" can be avoided.
ntfs_printcb -> ntfs_encodeuni -> ntfs_dupuni2utf8 -> to_utf8
ntfs_dupuni2utf8 does a kmalloc, which is later free'd by ntfs_printcb.
Which in turn is called once for each entry read by ntfs_readdir.
Wouldn't it be nicer to allocate one 255*max_utf8_size buffer in
ntfs_readdir and use that for all entries. Assuming 255 is the upper limit
on NTFS filename length, as I read somewhere.
smbfs does something like this, except it allocates a buffer at mount time
(which works since it is only used while protected by a per-mount lock).
/Urban
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/