mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Rewrite the MAJOR() macro as a call to imajor().
Date: Fri, 4 May 2007 08:21:26 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0705040809510.24097@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.61.0705041340310.18504@yvahk01.tjqt.qr>

On Fri, 4 May 2007, Jan Engelhardt wrote:

> On May 4 2007 04:14, Robert P. J. Day wrote:
> >> On May 3 2007 23:18, Andrew Morton wrote:
> >> >>  	struct inode *i = file->f_mapping->host;
> >> >>
> >> >> -	return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
> >> >> +	return i && S_ISBLK(i->i_mode) && imajor(i) == LOOP_MAJOR;
> >> >>  }
> >> >
> >> >there's no runtime change, and I count a couple hundred MAJORs in the tree.
> >>
> >> Why do we even have imajor() if all it does is calling the MAJOR()
> >> macro?
> >
> >  i'm guessing it's to hide the underlying implementation of
> >extracting the major/minor numbers from an inode, in case that
> >implementation ever changes, which strikes me as perfectly reasonable.
>
> How often has the implementation changed? I think i_rdev has been
> there for a looong time. But yes, doing the MAJOR => imajor
> conversion is preferable. Because you don't need the struct
> declaration for inode then, and may omit to #include <linux/fs.h>.
> (Other things may need fs.h so it's a bit of a corner case.)
>
> >  all i was doing was standardizing the small handful of holdouts.
>
> Please continue, this was not a rant :)

that was it, that one-line patch.  as i pointed out, the entire source
tree currently contains precisely this set of holdouts:

arch/sh/boards/landisk/landisk_pwb.c:   minor = MINOR(inode->i_rdev);
arch/sh/boards/landisk/landisk_pwb.c:   minor = MINOR(inode->i_rdev);
drivers/block/loop.c:   return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
drivers/media/video/ivtv/ivtv-fileops.c:        int minor = MINOR(inode->i_rdev);
include/linux/fs.h:     return MINOR(inode->i_rdev);
include/linux/fs.h:     return MAJOR(inode->i_rdev);
sound/oss/au1550_ac97.c:        int             minor = MINOR(inode->i_rdev);

  the first two are SH-related and i mailed the SH maintainer offline
about them, that previous patch was for the loop.c file, i'm not sure
who's in charge of video/ivtv (hints?), the next two lines are the
header files that define the functions, and i long ago decided not to
invest any time cleaning anything in the OSS directory.

  so, really, it's all of four lines that need to be updated to
complete the job.

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

  reply	other threads:[~2007-05-04 12:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-28 10:23 Robert P. J. Day
2007-05-04  6:18 ` Andrew Morton
2007-05-04  7:20   ` Robert P. J. Day
2007-05-04  8:09   ` Jan Engelhardt
2007-05-04  8:14     ` Robert P. J. Day
2007-05-04 11:42       ` Jan Engelhardt
2007-05-04 12:21         ` Robert P. J. Day [this message]
2007-05-04 12:34           ` Jan Engelhardt

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=Pine.LNX.4.64.0705040809510.24097@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=akpm@linux-foundation.org \
    --cc=jengelh@linux01.gwdg.de \
    --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

all inboxes | Powered by JetHome®