public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one
       [not found]       ` <1268261495-686-5-git-send-email-andy.shevchenko@gmail.com>
@ 2010-03-10 23:18         ` OGAWA Hirofumi
  2010-03-11  7:14           ` Andy Shevchenko
  2010-03-11  7:21           ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " Joe Perches
  0 siblings, 2 replies; 10+ messages in thread
From: OGAWA Hirofumi @ 2010-03-10 23:18 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

Andy Shevchenko <andy.shevchenko@gmail.com> writes:

>  			if (uni_xlate == 1) {
> -				*op = ':';
> -				for (k = 4; k > 0; k--) {
> -					nc = ec & 0xF;
> -					op[k] = nc > 9	? nc + ('a' - 10)
> -							: nc + '0';
> -					ec >>= 4;
> -				}
> -				op += 5;
> +				*op++ = ':';
> +				*op++ = hex_asc_hi(ec >> 8);
> +				*op++ = hex_asc_lo(ec >> 8);
> +				*op++ = hex_asc_hi(ec);
> +				*op++ = hex_asc_lo(ec);
>  				len -= 5;

Why doesn't this use pack_hex_byte()?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom  one
  2010-03-10 23:18         ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one OGAWA Hirofumi
@ 2010-03-11  7:14           ` Andy Shevchenko
  2010-03-11  9:03             ` OGAWA Hirofumi
  2010-03-11  7:21           ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " Joe Perches
  1 sibling, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2010-03-11  7:14 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 678 bytes --]

On Thu, Mar 11, 2010 at 1:18 AM, OGAWA Hirofumi<hirofumi@mail.parknet.co.jp> wrote:>> +                             *op++ = hex_asc_hi(ec >> 8);>> +                             *op++ = hex_asc_lo(ec >> 8);>> +                             *op++ = hex_asc_hi(ec);>> +                             *op++ = hex_asc_lo(ec);> Why doesn't this use pack_hex_byte()?No specific reason, it could be so. Would you like me to change this?
-- With Best Regards,Andy Shevchenkoÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one
  2010-03-10 23:18         ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one OGAWA Hirofumi
  2010-03-11  7:14           ` Andy Shevchenko
@ 2010-03-11  7:21           ` Joe Perches
  2010-03-11  7:59             ` Andy Shevchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Joe Perches @ 2010-03-11  7:21 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: Andy Shevchenko, linux-kernel

On Thu, 2010-03-11 at 08:18 +0900, OGAWA Hirofumi wrote:
> Andy Shevchenko <andy.shevchenko@gmail.com> writes:
> 
> >  			if (uni_xlate == 1) {
> > -				*op = ':';
> > -				for (k = 4; k > 0; k--) {
> > -					nc = ec & 0xF;
> > -					op[k] = nc > 9	? nc + ('a' - 10)
> > -							: nc + '0';
> > -					ec >>= 4;
> > -				}
> > -				op += 5;
> > +				*op++ = ':';
> > +				*op++ = hex_asc_hi(ec >> 8);
> > +				*op++ = hex_asc_lo(ec >> 8);
> > +				*op++ = hex_asc_hi(ec);
> > +				*op++ = hex_asc_lo(ec);
> >  				len -= 5;
> 
> Why doesn't this use pack_hex_byte()?

or snprintf



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom  one
  2010-03-11  7:21           ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " Joe Perches
@ 2010-03-11  7:59             ` Andy Shevchenko
  2010-03-11  8:10               ` Joe Perches
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2010-03-11  7:59 UTC (permalink / raw)
  To: Joe Perches; +Cc: OGAWA Hirofumi, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 638 bytes --]

On Thu, Mar 11, 2010 at 9:21 AM, Joe Perches <joe@perches.com> wrote:>> > +                           *op++ = hex_asc_hi(ec >> 8);>> > +                           *op++ = hex_asc_lo(ec >> 8);>> > +                           *op++ = hex_asc_hi(ec);>> > +                           *op++ = hex_asc_lo(ec);>> Why doesn't this use pack_hex_byte()?> or snprintfsprintf looks like overkill here.
-- With Best Regards,Andy Shevchenkoÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom  one
  2010-03-11  7:59             ` Andy Shevchenko
@ 2010-03-11  8:10               ` Joe Perches
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Perches @ 2010-03-11  8:10 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: OGAWA Hirofumi, linux-kernel

On Thu, 2010-03-11 at 09:59 +0200, Andy Shevchenko wrote:
> On Thu, Mar 11, 2010 at 9:21 AM, Joe Perches <joe@perches.com> wrote:
> >> > +                           *op++ = hex_asc_hi(ec >> 8);
> >> > +                           *op++ = hex_asc_lo(ec >> 8);
> >> > +                           *op++ = hex_asc_hi(ec);
> >> > +                           *op++ = hex_asc_lo(ec);
> >> Why doesn't this use pack_hex_byte()?
> > or snprintf
> sprintf looks like overkill here.

It's shorter and more intelligible though

	op += sprintf(op, ":%04x:%04x", etc) 

cheers, Joe



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom  one
  2010-03-11  7:14           ` Andy Shevchenko
@ 2010-03-11  9:03             ` OGAWA Hirofumi
  2010-03-11 15:00               ` [PATCHv2] fs: fat: use pack_hex_byte() " Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: OGAWA Hirofumi @ 2010-03-11  9:03 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

Andy Shevchenko <andy.shevchenko@gmail.com> writes:

> On Thu, Mar 11, 2010 at 1:18 AM, OGAWA Hirofumi
> <hirofumi@mail.parknet.co.jp> wrote:
>>> +                             *op++ = hex_asc_hi(ec >> 8);
>>> +                             *op++ = hex_asc_lo(ec >> 8);
>>> +                             *op++ = hex_asc_hi(ec);
>>> +                             *op++ = hex_asc_lo(ec);
>> Why doesn't this use pack_hex_byte()?
> No specific reason, it could be so. Would you like me to change this?

Yes, please change it if you have no problem.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
  2010-03-11  9:03             ` OGAWA Hirofumi
@ 2010-03-11 15:00               ` Andy Shevchenko
  2010-03-11 15:12                 ` OGAWA Hirofumi
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2010-03-11 15:00 UTC (permalink / raw)
  To: OGAWA Hirofumi, linux-kernel; +Cc: Andy Shevchenko

From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 fs/fat/dir.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 530b4ca..5de1a70 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -19,6 +19,7 @@
 #include <linux/buffer_head.h>
 #include <linux/compat.h>
 #include <asm/uaccess.h>
+#include <linux/kernel.h>
 #include "fat.h"
 
 /*
@@ -149,19 +150,14 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,
 
 	while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
 		ec = *ip++;
-		if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
+		if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
 			op += charlen;
 			len -= charlen;
 		} else {
 			if (uni_xlate == 1) {
-				*op = ':';
-				for (k = 4; k > 0; k--) {
-					nc = ec & 0xF;
-					op[k] = nc > 9	? nc + ('a' - 10)
-							: nc + '0';
-					ec >>= 4;
-				}
-				op += 5;
+				*op++ = ':';
+				op = pack_hex_byte(op, ec >> 8);
+				op = pack_hex_byte(op, ec);
 				len -= 5;
 			} else {
 				*op++ = '?';
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
  2010-03-11 15:00               ` [PATCHv2] fs: fat: use pack_hex_byte() " Andy Shevchenko
@ 2010-03-11 15:12                 ` OGAWA Hirofumi
  2010-03-11 15:15                   ` Andy Shevchenko
       [not found]                   ` <1268468961-17033-1-git-send-email-andy.shevchenko@gmail.com>
  0 siblings, 2 replies; 10+ messages in thread
From: OGAWA Hirofumi @ 2010-03-11 15:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Andy Shevchenko

Andy Shevchenko <andy.shevchenko@gmail.com> writes:

> From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
>
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Looks good to me.

	Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

(From 1/4 with previous patch, I guess it's series of patches) Or I
should take this patch into my tree?

Thanks.

> ---
>  fs/fat/dir.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
> index 530b4ca..5de1a70 100644
> --- a/fs/fat/dir.c
> +++ b/fs/fat/dir.c
> @@ -19,6 +19,7 @@
>  #include <linux/buffer_head.h>
>  #include <linux/compat.h>
>  #include <asm/uaccess.h>
> +#include <linux/kernel.h>
>  #include "fat.h"
>  
>  /*
> @@ -149,19 +150,14 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,
>  
>  	while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
>  		ec = *ip++;
> -		if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
> +		if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
>  			op += charlen;
>  			len -= charlen;
>  		} else {
>  			if (uni_xlate == 1) {
> -				*op = ':';
> -				for (k = 4; k > 0; k--) {
> -					nc = ec & 0xF;
> -					op[k] = nc > 9	? nc + ('a' - 10)
> -							: nc + '0';
> -					ec >>= 4;
> -				}
> -				op += 5;
> +				*op++ = ':';
> +				op = pack_hex_byte(op, ec >> 8);
> +				op = pack_hex_byte(op, ec);
>  				len -= 5;
>  			} else {
>  				*op++ = '?';

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] fs: fat: use pack_hex_byte() instead of custom one
  2010-03-11 15:12                 ` OGAWA Hirofumi
@ 2010-03-11 15:15                   ` Andy Shevchenko
       [not found]                   ` <1268468961-17033-1-git-send-email-andy.shevchenko@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2010-03-11 15:15 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-kernel, Andy Shevchenko

On Thu, Mar 11, 2010 at 5:12 PM, OGAWA Hirofumi
<hirofumi@mail.parknet.co.jp> wrote:
> (From 1/4 with previous patch, I guess it's series of patches) Or I
> should take this patch into my tree?
It has only one in common - cleanup. Basically it's a bunch of
independent fixes.
Please, take it in your tree. thank you.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv3] fs: fat: use pack_hex_byte() instead of custom one
       [not found]                   ` <1268468961-17033-1-git-send-email-andy.shevchenko@gmail.com>
@ 2010-03-13 11:09                     ` OGAWA Hirofumi
  0 siblings, 0 replies; 10+ messages in thread
From: OGAWA Hirofumi @ 2010-03-13 11:09 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Andy Shevchenko

Andy Shevchenko <andy.shevchenko@gmail.com> writes:

>  	const wchar_t *ip;
>  	wchar_t ec;
> -	unsigned char *op, nc;
> +	unsigned char *op;
>  	int charlen;
> -	int k;

Ah, thanks. I fixed this myself before commit.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-03-13 11:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1268261495-686-1-git-send-email-andy.shevchenko@gmail.com>
     [not found] ` <1268261495-686-2-git-send-email-andy.shevchenko@gmail.com>
     [not found]   ` <1268261495-686-3-git-send-email-andy.shevchenko@gmail.com>
     [not found]     ` <1268261495-686-4-git-send-email-andy.shevchenko@gmail.com>
     [not found]       ` <1268261495-686-5-git-send-email-andy.shevchenko@gmail.com>
2010-03-10 23:18         ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi instead of custom one OGAWA Hirofumi
2010-03-11  7:14           ` Andy Shevchenko
2010-03-11  9:03             ` OGAWA Hirofumi
2010-03-11 15:00               ` [PATCHv2] fs: fat: use pack_hex_byte() " Andy Shevchenko
2010-03-11 15:12                 ` OGAWA Hirofumi
2010-03-11 15:15                   ` Andy Shevchenko
     [not found]                   ` <1268468961-17033-1-git-send-email-andy.shevchenko@gmail.com>
2010-03-13 11:09                     ` [PATCHv3] " OGAWA Hirofumi
2010-03-11  7:21           ` [PATCH 4/5] fs: fat: use hex_asc_lo/hex_asc_hi " Joe Perches
2010-03-11  7:59             ` Andy Shevchenko
2010-03-11  8:10               ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox