From: lsr@neapel230.server4you.de
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] Manually inline shortname_info_to_lcase()
Date: Tue, 9 Nov 2004 02:43:58 +0100 [thread overview]
Message-ID: <20041109014358.GE6835@neapel230.server4you.de> (raw)
In-Reply-To: <41901DD1.mail5VX1GOOYK@lsrfire.ath.cx>
This patch inlines shortname_info_to_lcase() by hand. At least my
compiler (gcc 3.3.4 from Debian) doesn't go all the way, so the compiled
text size is decreased by this patch. And IMHO the code gets more
readable, too.
The terms (base->valid && ext->valid), (ext->lower || ext->upper) and
(base->lower || base->upper) are trivially found to be true at the
single callsite of shortname_info_to_lcase(). The relevant lines are
included in this patch file.
--- ./fs/vfat/namei.c.orig 2004-11-09 01:40:54.000000000 +0100
+++ ./fs/vfat/namei.c 2004-11-09 01:41:16.000000000 +0100
@@ -258,22 +258,6 @@
(x)->valid = 1; \
} while (0)
-static inline unsigned char
-shortname_info_to_lcase(struct shortname_info *base,
- struct shortname_info *ext)
-{
- unsigned char lcase = 0;
-
- if (base->valid && ext->valid) {
- if (!base->upper && base->lower && (ext->lower || ext->upper))
- lcase |= CASE_LOWER_BASE;
- if (!ext->upper && ext->lower && (base->lower || base->upper))
- lcase |= CASE_LOWER_EXT;
- }
-
- return lcase;
-}
-
static inline int to_shortname_char(struct nls_table *nls,
unsigned char *buf, int buf_size, wchar_t *src,
struct shortname_info *info)
@@ -447,20 +431,22 @@
if (is_shortname && base_info.valid && ext_info.valid) {
if (vfat_find_form(dir, name_res) == 0)
return -EEXIST;
if (opt_shortname & VFAT_SFN_CREATE_WIN95) {
return (base_info.upper && ext_info.upper);
} else if (opt_shortname & VFAT_SFN_CREATE_WINNT) {
if ((base_info.upper || base_info.lower)
&& (ext_info.upper || ext_info.lower)) {
- *lcase = shortname_info_to_lcase(&base_info,
- &ext_info);
+ if (!base_info.upper && base_info.lower)
+ *lcase |= CASE_LOWER_BASE;
+ if (!ext_info.upper && ext_info.lower)
+ *lcase |= CASE_LOWER_EXT;
return 1;
}
return 0;
} else {
BUG();
}
}
if (MSDOS_SB(dir->i_sb)->options.numtail == 0)
next prev parent reply other threads:[~2004-11-09 1:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-09 1:30 [PATCH 0/4] VFAT cleanup Rene Scharfe
2004-11-09 1:35 ` [PATCH 1/4] Move check for invalid chars to vfat_valid_longname() lsr
2004-11-09 15:03 ` OGAWA Hirofumi
2004-11-09 16:22 ` René Scharfe
2004-11-09 17:25 ` OGAWA Hirofumi
2004-11-09 18:22 ` Rene Scharfe
2004-11-09 18:41 ` OGAWA Hirofumi
2004-11-09 1:38 ` [PATCH 2/4] Return better error codes from vfat_valid_longname() lsr
2004-11-09 15:28 ` OGAWA Hirofumi
2004-11-09 16:49 ` Rene Scharfe
2004-11-09 17:35 ` OGAWA Hirofumi
2004-11-09 18:35 ` Rene Scharfe
2004-11-09 19:08 ` OGAWA Hirofumi
2004-11-09 1:42 ` [PATCH 3/4] Simplify checks for unwanted chars lsr
2004-11-09 15:40 ` OGAWA Hirofumi
2004-11-09 1:43 ` lsr [this message]
2004-11-09 15:11 ` [PATCH 4/4] Manually inline shortname_info_to_lcase() OGAWA Hirofumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041109014358.GE6835@neapel230.server4you.de \
--to=lsr@neapel230.server4you.de \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome