Commit f2820f23 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] dev_t handling cleanups (11/12)

new helper - imajor(inode)
parent b2230d13
......@@ -443,7 +443,7 @@ static int eeprom_open(struct inode * inode, struct file * file)
if(iminor(inode) != EEPROM_MINOR_NR)
return -ENXIO;
if(major(inode->i_rdev) != EEPROM_MAJOR_NR)
if(imajor(inode) != EEPROM_MAJOR_NR)
return -ENXIO;
if( eeprom.size > 0 )
......
......@@ -92,7 +92,7 @@ asmlinkage unsigned long sunos_mmap(unsigned long addr, unsigned long len,
* SunOS is so stupid some times... hmph!
*/
if (file) {
if(major(file->f_dentry->d_inode->i_rdev) == MEM_MAJOR &&
if(imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
iminor(file->f_dentry->d_inode) == 5) {
flags |= MAP_ANONYMOUS;
fput(file);
......
......@@ -90,7 +90,7 @@ asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 of
if (!file)
goto out;
inode = file->f_dentry->d_inode;
if (major(inode->i_rdev) == MEM_MAJOR && iminor(inode) == 5) {
if (imajor(inode) == MEM_MAJOR && iminor(inode) == 5) {
flags |= MAP_ANONYMOUS;
fput(file);
file = NULL;
......
......@@ -77,7 +77,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o
goto out;
else {
struct inode * inode = file->f_dentry->d_inode;
if(major(inode->i_rdev) == MEM_MAJOR &&
if(imajor(inode) == MEM_MAJOR &&
iminor(inode) == 5) {
flags |= MAP_ANONYMOUS;
fput(file);
......
......@@ -924,7 +924,7 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
if (!ino) goto out;
if (!ino->i_sock &&
(major(ino->i_rdev) != 30 || iminor(ino) != 1))
(imajor(ino) != 30 || iminor(ino) != 1))
goto out;
ctlptr = (struct strbuf *)A(arg1);
......
......@@ -356,11 +356,11 @@ static void cmd_free(ctlr_info_t *h, CommandList_struct *c, int got_from_pool)
*/
static int cciss_open(struct inode *inode, struct file *filep)
{
int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
int dsk = iminor(inode) >> NWD_SHIFT;
#ifdef CCISS_DEBUG
printk(KERN_DEBUG "cciss_open %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
printk(KERN_DEBUG "cciss_open %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
#endif /* CCISS_DEBUG */
if (ctlr >= MAX_CTLR || hba[ctlr] == NULL)
......@@ -386,11 +386,11 @@ static int cciss_open(struct inode *inode, struct file *filep)
*/
static int cciss_release(struct inode *inode, struct file *filep)
{
int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
int dsk = iminor(inode) >> NWD_SHIFT;
#ifdef CCISS_DEBUG
printk(KERN_DEBUG "cciss_release %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
printk(KERN_DEBUG "cciss_release %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
#endif /* CCISS_DEBUG */
/* fsync_dev(inode->i_rdev); */
......@@ -406,7 +406,7 @@ static int cciss_release(struct inode *inode, struct file *filep)
static int cciss_ioctl(struct inode *inode, struct file *filep,
unsigned int cmd, unsigned long arg)
{
int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
int dsk = iminor(inode) >> NWD_SHIFT;
#ifdef CCISS_DEBUG
......
......@@ -228,7 +228,7 @@ static int mousedev_open(struct inode * inode, struct file * file)
int i;
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
if (major(inode->i_rdev) == MISC_MAJOR)
if (imajor(inode) == MISC_MAJOR)
i = MOUSEDEV_MIX;
else
#endif
......
......@@ -238,7 +238,7 @@ tapechar_open (struct inode *inode, struct file *filp)
struct tape_device *device;
int minor, rc;
if (major(filp->f_dentry->d_inode->i_rdev) != tapechar_major)
if (imajor(filp->f_dentry->d_inode) != tapechar_major)
return -ENODEV;
minor = iminor(filp->f_dentry->d_inode);
device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
......
......@@ -115,7 +115,7 @@ static int get_device_index(struct coda_mount_data *data)
inode = file->f_dentry->d_inode;
if(!inode || !S_ISCHR(inode->i_mode) ||
major(inode->i_rdev) != CODA_PSDEV_MAJOR) {
imajor(inode) != CODA_PSDEV_MAJOR) {
if(file)
fput(file);
......
......@@ -103,7 +103,7 @@ int jffs2_setattr (struct dentry *dentry, struct iattr *iattr)
it out again with the appropriate data attached */
if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
/* For these, we don't actually need to read the old node */
dev = (major(dentry->d_inode->i_rdev) << 8) |
dev = (imajor(dentry->d_inode) << 8) |
iminor(dentry->d_inode);
mdata = (char *)&dev;
mdatalen = sizeof(dev);
......
......@@ -45,7 +45,7 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,1)
#define JFFS2_F_I_RDEV_MIN(f) (iminor(OFNI_EDONI_2SFFJ(f)))
#define JFFS2_F_I_RDEV_MAJ(f) (major(OFNI_EDONI_2SFFJ(f)->i_rdev))
#define JFFS2_F_I_RDEV_MAJ(f) (imajor(OFNI_EDONI_2SFFJ(f)))
#else
#define JFFS2_F_I_RDEV_MIN(f) (MINOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
#define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
......
......@@ -472,6 +472,11 @@ static inline unsigned iminor(struct inode *inode)
return minor(inode->i_rdev);
}
static inline unsigned imajor(struct inode *inode)
{
return major(inode->i_rdev);
}
struct fown_struct {
rwlock_t lock; /* protects pid, uid, euid fields */
int pid; /* pid or -pgrp where SIGIO should be sent */
......
......@@ -294,7 +294,7 @@ fill_post_wcc(struct svc_fh *fhp)
/* how much do we care for accuracy with MinixFS? */
fhp->fh_post_blocks = (inode->i_size+511) >> 9;
}
fhp->fh_post_rdev[0] = htonl((u32)major(inode->i_rdev));
fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
fhp->fh_post_atime = inode->i_atime;
fhp->fh_post_mtime = inode->i_mtime;
......
......@@ -73,7 +73,7 @@ static ssize_t snd_hwdep_write(struct file * file, const char *buf, size_t count
static int snd_hwdep_open(struct inode *inode, struct file * file)
{
int major = major(inode->i_rdev);
int major = imajor(inode);
int cardnum;
int device;
snd_hwdep_t *hw;
......
......@@ -1431,7 +1431,7 @@ static struct file *snd_pcm_file_fd(int fd)
return 0;
inode = file->f_dentry->d_inode;
if (!S_ISCHR(inode->i_mode) ||
major(inode->i_rdev) != snd_major) {
imajor(inode) != snd_major) {
fput(file);
return 0;
}
......
......@@ -345,7 +345,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
static int snd_rawmidi_open(struct inode *inode, struct file *file)
{
int maj = major(inode->i_rdev);
int maj = imajor(inode);
int cardnum;
snd_card_t *card;
int device, subdevice;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment