* [PATCH] misc: fix create_inode warnings with LLVM
@ 2014-05-20 23:12 Andreas Dilger
2014-05-27 16:34 ` Lukáš Czerner
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2014-05-20 23:12 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4, Andreas Dilger
Fix name clash in do_mknod_internal() due to local variables named
"major" and "minor" shadowing identical macro names.
Also, no need to set the major and minor device for a FIFO inode.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
---
misc/create_inode.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 964c66a..1d666c7 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -96,9 +96,9 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
struct stat *st)
{
ext2_ino_t ino;
- errcode_t retval;
+ errcode_t retval;
struct ext2_inode inode;
- unsigned long major, minor, mode;
+ unsigned long devmajor, devminor, mode;
int filetype;
switch(st->st_mode & S_IFMT) {
@@ -153,16 +153,18 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
inode.i_atime = inode.i_ctime = inode.i_mtime =
fs->now ? fs->now : time(0);
- major = major(st->st_rdev);
- minor = minor(st->st_rdev);
-
- if ((major < 256) && (minor < 256)) {
- inode.i_block[0] = major * 256 + minor;
- inode.i_block[1] = 0;
- } else {
- inode.i_block[0] = 0;
- inode.i_block[1] = (minor & 0xff) | (major << 8) |
- ((minor & ~0xff) << 12);
+ if (filetype != S_IFIFO) {
+ devmajor = major(st->st_rdev);
+ devminor = minor(st->st_rdev);
+
+ if ((devmajor < 256) && (devminor < 256)) {
+ inode.i_block[0] = devmajor * 256 + devminor;
+ inode.i_block[1] = 0;
+ } else {
+ inode.i_block[0] = 0;
+ inode.i_block[1] = (devminor & 0xff) | (devmajor << 8) |
+ ((devminor & ~0xff) << 12);
+ }
}
inode.i_links_count = 1;
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] misc: fix create_inode warnings with LLVM
2014-05-20 23:12 [PATCH] misc: fix create_inode warnings with LLVM Andreas Dilger
@ 2014-05-27 16:34 ` Lukáš Czerner
2014-05-27 16:51 ` Theodore Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Lukáš Czerner @ 2014-05-27 16:34 UTC (permalink / raw)
To: Andreas Dilger; +Cc: tytso, linux-ext4
On Tue, 20 May 2014, Andreas Dilger wrote:
> Date: Tue, 20 May 2014 17:12:22 -0600
> From: Andreas Dilger <adilger@dilger.ca>
> To: tytso@mit.edu
> Cc: linux-ext4@vger.kernel.org, Andreas Dilger <adilger@dilger.ca>
> Subject: [PATCH] misc: fix create_inode warnings with LLVM
>
> Fix name clash in do_mknod_internal() due to local variables named
> "major" and "minor" shadowing identical macro names.
>
> Also, no need to set the major and minor device for a FIFO inode.
>
> Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Looks good, thanks!
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
> ---
> misc/create_inode.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/misc/create_inode.c b/misc/create_inode.c
> index 964c66a..1d666c7 100644
> --- a/misc/create_inode.c
> +++ b/misc/create_inode.c
> @@ -96,9 +96,9 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
> struct stat *st)
> {
> ext2_ino_t ino;
> - errcode_t retval;
> + errcode_t retval;
> struct ext2_inode inode;
> - unsigned long major, minor, mode;
> + unsigned long devmajor, devminor, mode;
> int filetype;
>
> switch(st->st_mode & S_IFMT) {
> @@ -153,16 +153,18 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
> inode.i_atime = inode.i_ctime = inode.i_mtime =
> fs->now ? fs->now : time(0);
>
> - major = major(st->st_rdev);
> - minor = minor(st->st_rdev);
> -
> - if ((major < 256) && (minor < 256)) {
> - inode.i_block[0] = major * 256 + minor;
> - inode.i_block[1] = 0;
> - } else {
> - inode.i_block[0] = 0;
> - inode.i_block[1] = (minor & 0xff) | (major << 8) |
> - ((minor & ~0xff) << 12);
> + if (filetype != S_IFIFO) {
> + devmajor = major(st->st_rdev);
> + devminor = minor(st->st_rdev);
> +
> + if ((devmajor < 256) && (devminor < 256)) {
> + inode.i_block[0] = devmajor * 256 + devminor;
> + inode.i_block[1] = 0;
> + } else {
> + inode.i_block[0] = 0;
> + inode.i_block[1] = (devminor & 0xff) | (devmajor << 8) |
> + ((devminor & ~0xff) << 12);
> + }
> }
> inode.i_links_count = 1;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] misc: fix create_inode warnings with LLVM
2014-05-27 16:34 ` Lukáš Czerner
@ 2014-05-27 16:51 ` Theodore Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2014-05-27 16:51 UTC (permalink / raw)
To: Lukáš Czerner; +Cc: Andreas Dilger, linux-ext4
On Tue, May 27, 2014 at 06:34:52PM +0200, Lukáš Czerner wrote:
> On Tue, 20 May 2014, Andreas Dilger wrote:
>
> > Date: Tue, 20 May 2014 17:12:22 -0600
> > From: Andreas Dilger <adilger@dilger.ca>
> > To: tytso@mit.edu
> > Cc: linux-ext4@vger.kernel.org, Andreas Dilger <adilger@dilger.ca>
> > Subject: [PATCH] misc: fix create_inode warnings with LLVM
> >
> > Fix name clash in do_mknod_internal() due to local variables named
> > "major" and "minor" shadowing identical macro names.
> >
> > Also, no need to set the major and minor device for a FIFO inode.
> >
> > Signed-off-by: Andreas Dilger <adilger@dilger.ca>
>
> Looks good, thanks!
>
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Applied, thanks.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-27 16:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 23:12 [PATCH] misc: fix create_inode warnings with LLVM Andreas Dilger
2014-05-27 16:34 ` Lukáš Czerner
2014-05-27 16:51 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).