kdev_t patches - part 6

Andries.Brouwer@cwi.nl
Fri, 27 Feb 1998 20:03:12 +0100 (MET)


Below some more kdev_t related patches.
In the nfs/nfsd/lockd code dev_t and kdev_t are freely mixed
(sometimes the author even hopes that just casting (kdev_t)
will turn an integer into a kdev_t).

The philosophy is that inside the kernel one has kdev_t's -
pointers to structures - and outside the kernel there are dev_t's
(an arithmetic type describing devices, perhaps long or long long).

Earlier, it was not necessary to equip the kernel with machinery
to handle dev_t's, since these hardly occurred anyway. But the
nfsd code is full of debugging statements, and in order to
preserve these I added functions
char * xdevname(dev_t)
dev_t to_dev_t(kdev_t)
in <linux/kdev_t.h>.

I am running kernels in which kdev_t is a pointer, but do not
use kernel nfsd. Maybe Olaf Kirch will be willing to verify
that I left everything that goes over the wire a dev_t,
and everything internal a kdev_t. (Maybe we want to have
kdev_t's on the wire as well, just like dentries, for efficiency?)

Anyway - this patch does almost nothing unless one redefines kdev_t.
(Only change: the kernel reveals what fs it complains about in
messages "mounting unchecked fs; running e2fsck is recommended".
With a mount -a that mounts a few dozen filesystems it is entirely
unclear what fs the message is about. I get nice messages mentioning
/dev/sda1. The standard kernel must for the time being be satisfied
with [08:01].)

Andries

-----
diff -u --recursive --new-file ../linux-2.1.88/linux/arch/ppc/kernel/pmac_setup.c ./linux/arch/ppc/kernel/pmac_setup.c
--- ../linux-2.1.88/linux/arch/ppc/kernel/pmac_setup.c Tue Jan 13 00:18:13 1998
+++ ./linux/arch/ppc/kernel/pmac_setup.c Sat Feb 21 23:15:26 1998
@@ -192,7 +192,7 @@
{
int dev;

- if (kdev_t_to_nr(ROOT_DEV) != 0)
+ if (ROOT_DEV)
return;
ROOT_DEV = to_kdev_t(DEFAULT_ROOT_DEVICE);
if (boot_host == NULL)
diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/block/loop.c ./linux/drivers/block/loop.c
--- ../linux-2.1.88/linux/drivers/block/loop.c Thu Jul 17 05:37:21 1997
+++ ./linux/drivers/block/loop.c Sat Feb 21 23:12:17 1998
@@ -421,9 +421,9 @@
return err;
memset(&info, 0, sizeof(info));
info.lo_number = lo->lo_number;
- info.lo_device = kdev_t_to_nr(lo->lo_inode->i_dev);
+ info.lo_device = to_dev_t(lo->lo_inode->i_dev);
info.lo_inode = lo->lo_inode->i_ino;
- info.lo_rdevice = kdev_t_to_nr(lo->lo_device);
+ info.lo_rdevice = to_dev_t(lo->lo_device);
info.lo_offset = lo->lo_offset;
info.lo_flags = lo->lo_flags;
strncpy(info.lo_name, lo->lo_name, LO_NAME_SIZE);
diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/char/apm_bios.c ./linux/drivers/char/apm_bios.c
--- ../linux-2.1.88/linux/drivers/char/apm_bios.c Fri Feb 27 01:56:16 1998
+++ ./linux/drivers/char/apm_bios.c Sat Feb 21 17:06:04 1998
@@ -43,7 +43,7 @@
* screen-blanking and gpm (Stephen Rothwell); Linux 1.99.4
* 1.2a:Simple change to stop mysterious bug reports with SMP also added
* levels to the printk calls. APM is not defined for SMP machines.
- * The new replacment for it is, but Linux doesn't yet support this.
+ * The new replacement for it is, but Linux doesn't yet support this.
* Alan Cox Linux 2.1.55
* 1.3: Set up a valid data descriptor 0x40 for buggy BIOS's
*
@@ -494,6 +494,7 @@
return APM_SUCCESS;
}

+#if 0
static int apm_get_battery_status(u_short which,
u_short *bat, u_short *life, u_short *nbat)
{
@@ -511,6 +512,7 @@
return (error >> 8);
return APM_SUCCESS;
}
+#endif

static inline int apm_engage_power_management(u_short device)
{
diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/scsi/Config.in ./linux/drivers/scsi/Config.in
--- ../linux-2.1.88/linux/drivers/scsi/Config.in Fri Feb 27 01:55:40 1998
+++ ./linux/drivers/scsi/Config.in Sun Feb 22 04:01:13 1998
@@ -76,7 +76,7 @@
int ' maximum number of queued commands' CONFIG_SCSI_NCR53C8XX_MAX_TAGS 4
int ' synchronous transfers frequency in MHz' CONFIG_SCSI_NCR53C8XX_SYNC 5
if [ "$CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE" != "y" ]; then
- bool ' not allow targets to disconnect' CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT
+ bool ' do not allow targets to disconnect' CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' assume boards are SYMBIOS compatible' CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT
diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/sound/maui.c ./linux/drivers/sound/maui.c
--- ../linux-2.1.88/linux/drivers/sound/maui.c Fri Feb 27 01:56:25 1998
+++ ./linux/drivers/sound/maui.c Sat Feb 21 20:29:37 1998
@@ -180,7 +180,7 @@

static int maui_init(int irq)
{
-#ifdef __SMP__
+#ifndef __SMP__
int i;
#endif
unsigned char bits;
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/devices.c ./linux/fs/devices.c
--- ../linux-2.1.88/linux/fs/devices.c Wed Aug 13 02:15:15 1997
+++ ./linux/fs/devices.c Sat Feb 21 22:41:15 1998
@@ -345,3 +345,14 @@
sprintf(buffer, "%02x:%02x", MAJOR(dev), MINOR(dev));
return buffer;
}
+
+/*
+ * Idem, but hexadecimal only. Used mostly for debugging in
+ * kernel areas (like nfsd) where dev_t's are used.
+ */
+char * xdevname(dev_t dev)
+{
+ static char buffer[32];
+ sprintf(buffer, "%02x:%02x", XMAJOR(dev), XMINOR(dev));
+ return buffer;
+}
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/ext2/super.c ./linux/fs/ext2/super.c
--- ../linux-2.1.88/linux/fs/ext2/super.c Wed Jul 16 19:26:21 1997
+++ ./linux/fs/ext2/super.c Fri Feb 27 13:41:33 1998
@@ -275,6 +275,12 @@
return 1;
}

+static void ext2_advise_e2fsck (struct super_block * sb, char *warning)
+{
+ printk ("EXT2-fs warning: %s %s, running e2fsck is recommended\n",
+ kdevname(sb->s_dev), warning);
+}
+
static void ext2_setup_super (struct super_block * sb,
struct ext2_super_block * es)
{
@@ -285,20 +291,17 @@
}
if (!(sb->s_flags & MS_RDONLY)) {
if (!(sb->u.ext2_sb.s_mount_state & EXT2_VALID_FS))
- printk ("EXT2-fs warning: mounting unchecked fs, "
- "running e2fsck is recommended\n");
+ ext2_advise_e2fsck (sb, "mounting unchecked fs");
else if ((sb->u.ext2_sb.s_mount_state & EXT2_ERROR_FS))
- printk ("EXT2-fs warning: mounting fs with errors, "
- "running e2fsck is recommended\n");
+ ext2_advise_e2fsck (sb, "mounting fs with errors");
else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
le16_to_cpu(es->s_mnt_count) >=
(unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
- printk ("EXT2-fs warning: maximal mount count reached, "
- "running e2fsck is recommended\n");
+ ext2_advise_e2fsck (sb, "maximal mount count reached");
else if (le32_to_cpu(es->s_checkinterval) &&
- (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= CURRENT_TIME))
- printk ("EXT2-fs warning: checktime reached, "
- "running e2fsck is recommended\n");
+ (le32_to_cpu(es->s_lastcheck)
+ + le32_to_cpu(es->s_checkinterval) <= CURRENT_TIME))
+ ext2_advise_e2fsck (sb, "checktime reached");
es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT2_VALID_FS);
if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
es->s_max_mnt_count = (__s16) cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT);
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/lockd/svclock.c ./linux/fs/lockd/svclock.c
--- ../linux-2.1.88/linux/fs/lockd/svclock.c Mon Jul 14 06:20:10 1997
+++ ./linux/fs/lockd/svclock.c Sat Feb 7 01:57:01 1998
@@ -273,8 +273,8 @@
struct nlm_block *block;
int error;

- dprintk("lockd: nlmsvc_lock(%04x/%ld, ty=%d, pi=%d, %ld-%ld, bl=%d)\n",
- file->f_file.f_dentry->d_inode->i_dev,
+ dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %ld-%ld, bl=%d)\n",
+ kdevname(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_type, lock->fl.fl_pid,
lock->fl.fl_start,
@@ -343,8 +343,8 @@
{
struct file_lock *fl;

- dprintk("lockd: nlmsvc_testlock(%04x/%ld, ty=%d, %ld-%ld)\n",
- file->f_file.f_dentry->d_inode->i_dev,
+ dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %ld-%ld)\n",
+ kdevname(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_type,
lock->fl.fl_start,
@@ -374,8 +374,8 @@
{
int error;

- dprintk("lockd: nlmsvc_unlock(%04x/%ld, pi=%d, %ld-%ld)\n",
- file->f_file.f_dentry->d_inode->i_dev,
+ dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %ld-%ld)\n",
+ kdevname(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_pid,
lock->fl.fl_start,
@@ -402,8 +402,8 @@
{
struct nlm_block *block;

- dprintk("lockd: nlmsvc_cancel(%04x/%ld, pi=%d, %ld-%ld)\n",
- file->f_file.f_dentry->d_inode->i_dev,
+ dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %ld-%ld)\n",
+ kdevname(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_pid,
lock->fl.fl_start,
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/lockd/svcsubs.c ./linux/fs/lockd/svcsubs.c
--- ../linux-2.1.88/linux/fs/lockd/svcsubs.c Tue Dec 9 21:16:25 1997
+++ ./linux/fs/lockd/svcsubs.c Sat Feb 21 22:55:12 1998
@@ -54,7 +54,7 @@
u32 nfserr;

dprintk("lockd: nlm_file_lookup(%s/%ld)\n",
- kdevname(fh->fh_dev), fh->fh_ino);
+ xdevname(fh->fh_dev), fh->fh_ino);

/* Lock file table */
down(&nlm_file_sema);
@@ -66,7 +66,7 @@
}

dprintk("lockd: creating file for %s/%ld\n",
- kdevname(fh->fh_dev), fh->fh_ino);
+ xdevname(fh->fh_dev), fh->fh_ino);
nfserr = nlm_lck_denied_nolocks;
file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
if (!file)
@@ -114,7 +114,7 @@

dprintk("lockd: closing file %s/%ld\n",
kdevname(inode->i_dev), inode->i_ino);
- fp = nlm_files + file_hash(inode->i_dev, inode->i_ino);
+ fp = nlm_files + file_hash(to_dev_t(inode->i_dev), inode->i_ino);
while ((f = *fp) != NULL) {
if (f == file) {
*fp = file->f_next;
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfs/dir.c ./linux/fs/nfs/dir.c
--- ../linux-2.1.88/linux/fs/nfs/dir.c Fri Feb 27 01:55:11 1998
+++ ./linux/fs/nfs/dir.c Tue Feb 3 23:38:47 1998
@@ -42,7 +42,7 @@
* the cache grows larger, we will need a LRU list.
*/
struct nfs_dirent {
- dev_t dev; /* device number */
+ kdev_t dev; /* device number */
ino_t ino; /* inode number */
u32 cookie; /* cookie of first entry */
unsigned short valid : 1, /* data is valid */
@@ -319,11 +319,12 @@
nfs_invalidate_dircache(struct inode *inode)
{
struct nfs_dirent *cache = dircache;
- dev_t dev = inode->i_dev;
+ kdev_t dev = inode->i_dev;
ino_t ino = inode->i_ino;
int i;

- dfprintk(DIRCACHE, "NFS: invalidate dircache for %x/%ld\n", dev, (long)ino);
+ dfprintk(DIRCACHE, "NFS: invalidate dircache for %s/%ld\n",
+ kdevname(dev), (long)ino);
for (i = NFS_MAX_DIRCACHE; i--; cache++) {
if (cache->ino != ino)
continue;
@@ -633,8 +634,8 @@
struct nfs_fattr fattr;
struct nfs_fh fhandle;

- dfprintk(VFS, "NFS: create(%x/%ld, %s\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name);
+ dfprintk(VFS, "NFS: create(%s/%ld, %s\n",
+ kdevname(dir->i_dev), dir->i_ino, dentry->d_name.name);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_create: inode is NULL or not a directory\n");
@@ -673,8 +674,8 @@
struct nfs_fattr fattr;
struct nfs_fh fhandle;

- dfprintk(VFS, "NFS: mknod(%x/%ld, %s\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name);
+ dfprintk(VFS, "NFS: mknod(%s/%ld, %s\n",
+ kdevname(dir->i_dev), dir->i_ino, dentry->d_name.name);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_mknod: inode is NULL or not a directory\n");
@@ -710,8 +711,8 @@
struct nfs_fattr fattr;
struct nfs_fh fhandle;

- dfprintk(VFS, "NFS: mkdir(%x/%ld, %s\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name);
+ dfprintk(VFS, "NFS: mkdir(%s/%ld, %s\n",
+ kdevname(dir->i_dev), dir->i_ino, dentry->d_name.name);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_mkdir: inode is NULL or not a directory\n");
@@ -752,8 +753,8 @@
{
int error, rehash = 0;

- dfprintk(VFS, "NFS: rmdir(%x/%ld, %s\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name);
+ dfprintk(VFS, "NFS: rmdir(%s/%ld, %s\n",
+ kdevname(dir->i_dev), dir->i_ino, dentry->d_name.name);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_rmdir: inode is NULL or not a directory\n");
@@ -1008,8 +1009,8 @@
{
int error;

- dfprintk(VFS, "NFS: unlink(%x/%ld, %s)\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name);
+ dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n",
+ kdevname(dir->i_dev), dir->i_ino, dentry->d_name.name);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_unlink: inode is NULL or not a directory\n");
@@ -1037,8 +1038,9 @@
struct nfs_sattr sattr;
int error;

- dfprintk(VFS, "NFS: symlink(%x/%ld, %s, %s)\n",
- dir->i_dev, dir->i_ino, dentry->d_name.name, symname);
+ dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s)\n",
+ kdevname(dir->i_dev), dir->i_ino,
+ dentry->d_name.name, symname);

if (!dir || !S_ISDIR(dir->i_mode)) {
printk("nfs_symlink: inode is NULL or not a directory\n");
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfs/file.c ./linux/fs/nfs/file.c
--- ../linux-2.1.88/linux/fs/nfs/file.c Sun Jan 4 09:53:41 1998
+++ ./linux/fs/nfs/file.c Tue Feb 3 23:27:54 1998
@@ -97,7 +97,8 @@
{
int status, error;

- dfprintk(VFS, "nfs: close(%x/%ld)\n", inode->i_dev, inode->i_ino);
+ dfprintk(VFS, "nfs: close(%s/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino);

status = nfs_flush_dirty_pages(inode, 0, 0, 0);
error = nfs_write_error(inode);
@@ -148,7 +149,8 @@
struct inode *inode = dentry->d_inode;
int status, error;

- dfprintk(VFS, "nfs: fsync(%x/%ld)\n", inode->i_dev, inode->i_ino);
+ dfprintk(VFS, "nfs: fsync(%s/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino);

status = nfs_flush_dirty_pages(inode, current->pid, 0, 0);
error = nfs_write_error(inode);
@@ -215,8 +217,8 @@
struct inode * inode = filp->f_dentry->d_inode;
int status;

- dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%ld:%ld)\n",
- inode->i_dev, inode->i_ino,
+ dprintk("NFS: nfs_lock(f=%4s/%ld, t=%x, fl=%x, r=%ld:%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino,
fl->fl_type, fl->fl_flags,
fl->fl_start, fl->fl_end);

diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfs/inode.c ./linux/fs/nfs/inode.c
--- ../linux-2.1.88/linux/fs/nfs/inode.c Fri Feb 27 01:55:11 1998
+++ ./linux/fs/nfs/inode.c Tue Feb 3 23:26:26 1998
@@ -80,7 +80,8 @@
static void
nfs_put_inode(struct inode * inode)
{
- dprintk("NFS: put_inode(%x/%ld)\n", inode->i_dev, inode->i_ino);
+ dprintk("NFS: put_inode(%s/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino);
/*
* We want to get rid of unused inodes ...
*/
@@ -93,7 +94,8 @@
{
int failed;

- dprintk("NFS: delete_inode(%x/%ld)\n", inode->i_dev, inode->i_ino);
+ dprintk("NFS: delete_inode(%s/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino);
/*
* Flush out any pending write requests ...
*/
@@ -538,8 +540,8 @@
goto retry;
}
nfs_fill_inode(inode, fattr);
- dprintk("NFS: __nfs_fhget(%x/%ld ct=%d)\n",
- inode->i_dev, inode->i_ino, inode->i_count);
+ dprintk("NFS: __nfs_fhget(%s/%ld ct=%d)\n",
+ kdevname(inode->i_dev), inode->i_ino, inode->i_count);

out:
return inode;
@@ -695,8 +697,8 @@
int invalid = 0;
int error = -EIO;

- dfprintk(VFS, "NFS: refresh_inode(%x/%ld ct=%d)\n",
- inode->i_dev, inode->i_ino, inode->i_count);
+ dfprintk(VFS, "NFS: refresh_inode(%s/%ld ct=%d)\n",
+ kdevname(inode->i_dev), inode->i_ino, inode->i_count);

if (!inode || !fattr) {
printk("nfs_refresh_inode: inode or fattr is NULL\n");
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfs/write.c ./linux/fs/nfs/write.c
--- ../linux-2.1.88/linux/fs/nfs/write.c Fri Feb 27 01:55:11 1998
+++ ./linux/fs/nfs/write.c Tue Feb 3 23:30:34 1998
@@ -236,8 +236,8 @@
{
struct nfs_wreq *head, *req;

- dprintk("NFS: find_write_request(%x/%ld, %p)\n",
- inode->i_dev, inode->i_ino, page);
+ dprintk("NFS: find_write_request(%s/%ld, %p)\n",
+ kdevname(inode->i_dev), inode->i_ino, page);
if (!(req = head = NFS_WRITEBACK(inode)))
return NULL;
do {
@@ -716,8 +716,9 @@
struct nfs_wreq *last = NULL;
int result = 0, cancel = 0;

- dprintk("NFS: flush_dirty_pages(%x/%ld for pid %d %ld/%ld)\n",
- inode->i_dev, inode->i_ino, current->pid, offset, len);
+ dprintk("NFS: flush_dirty_pages(%s/%ld for pid %d %ld/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino,
+ current->pid, offset, len);

if (IS_SOFT && signalled()) {
nfs_cancel_dirty(inode, pid);
@@ -754,8 +755,8 @@
void
nfs_invalidate_pages(struct inode *inode)
{
- dprintk("NFS: nfs_invalidate_pages(%x/%ld)\n",
- inode->i_dev, inode->i_ino);
+ dprintk("NFS: nfs_invalidate_pages(%s/%ld)\n",
+ kdevname(inode->i_dev), inode->i_ino);

nfs_flush_pages(inode, 0, 0, 0, 1);
}
@@ -770,8 +771,8 @@
struct nfs_wreq *req, *head;
unsigned long rqoffset;

- dprintk("NFS: truncate_dirty_pages(%d/%ld, %ld)\n",
- inode->i_dev, inode->i_ino, offset);
+ dprintk("NFS: truncate_dirty_pages(%s/%ld, %ld)\n",
+ kdevname(inode->i_dev), inode->i_ino, offset);

req = head = NFS_WRITEBACK(inode);
while (req != NULL) {
@@ -798,13 +799,14 @@
struct nfs_wreq *req;
int status = 0;

- dprintk("nfs: checking for write error inode %04x/%ld\n",
- inode->i_dev, inode->i_ino);
+ dprintk("nfs: checking for write error inode %s/%ld\n",
+ kdevname(inode->i_dev), inode->i_ino);

req = find_failed_request(inode, current->pid);
if (req) {
- dprintk("nfs: write error %d inode %04x/%ld\n",
- req->wb_task.tk_status, inode->i_dev, inode->i_ino);
+ dprintk("nfs: write error %d inode %s/%ld\n",
+ req->wb_task.tk_status,
+ kdevname(inode->i_dev), inode->i_ino);

status = req->wb_task.tk_status;
remove_failed_request(req);
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfsd/export.c ./linux/fs/nfsd/export.c
--- ../linux-2.1.88/linux/fs/nfsd/export.c Fri Feb 27 01:55:41 1998
+++ ./linux/fs/nfsd/export.c Sun Feb 22 00:28:24 1998
@@ -115,12 +115,13 @@
nfsd_parentdev(dev_t *devp)
{
struct super_block *sb;
+ kdev_t dev = to_kdev_t(*devp);

- if (!(sb = get_super(*devp)) || !sb->s_root->d_covers)
+ if (!(sb = get_super(dev)) || !sb->s_root->d_covers)
return 0;
- if (*devp == sb->s_root->d_covers->d_inode->i_dev)
+ if (dev == sb->s_root->d_covers->d_inode->i_dev)
return 0;
- *devp = sb->s_root->d_covers->d_inode->i_dev;
+ *devp = to_dev_t(sb->s_root->d_covers->d_inode->i_dev);
return 1;
}

@@ -205,7 +206,8 @@
if(!inode)
goto finish;
err = -EINVAL;
- if(inode->i_dev != nxp->ex_dev || inode->i_ino != nxp->ex_ino) {
+ if(to_dev_t(inode->i_dev) != nxp->ex_dev ||
+ inode->i_ino != nxp->ex_ino) {
/* I'm just being paranoid... */
goto finish;
}
@@ -301,14 +303,15 @@
* and if so flush any cached dentries.
*/
if (!exp_device_in_use(unexp->ex_dev)) {
-printk("exp_do_unexport: %s last use, flushing cache\n",
-kdevname(unexp->ex_dev));
+printk("exp_do_unexport: dev %s last use, flushing cache\n",
+xdevname(unexp->ex_dev));
nfsd_fh_flush(unexp->ex_dev);
}

dentry = unexp->ex_dentry;
inode = dentry->d_inode;
- if (unexp->ex_dev != inode->i_dev || unexp->ex_ino != inode->i_ino)
+ if (unexp->ex_dev != to_dev_t(inode->i_dev) ||
+ unexp->ex_ino != inode->i_ino)
printk(KERN_WARNING "nfsd: bad dentry in unexport!\n");
dput(dentry);

@@ -404,10 +407,11 @@
printk("exp_rootfh: Aieee, NULL d_inode\n");
return -EPERM;
}
- if(inode->i_dev != dev || inode->i_ino != ino) {
+ if(to_dev_t(inode->i_dev) != dev || inode->i_ino != ino) {
printk("exp_rootfh: Aieee, ino/dev mismatch\n");
- printk("exp_rootfh: arg[dev(%x):ino(%ld)] inode[dev(%x):ino(%ld)]\n",
- dev, ino, inode->i_dev, inode->i_ino);
+ printk("exp_rootfh: arg[dev(%x):ino(%ld)]"
+ " inode[dev(%x):ino(%ld)]\n",
+ dev, ino, to_dev_t(inode->i_dev), inode->i_ino);
}

dget(dentry);
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfsd/nfsfh.c ./linux/fs/nfsd/nfsfh.c
--- ../linux-2.1.88/linux/fs/nfsd/nfsfh.c Fri Feb 27 01:55:01 1998
+++ ./linux/fs/nfsd/nfsfh.c Sat Feb 21 23:07:27 1998
@@ -29,7 +29,7 @@
struct dentry * dentry;
unsigned long reftime;
ino_t ino;
- dev_t dev;
+ kdev_t dev;
};

#define NFSD_MAXFH PAGE_SIZE/sizeof(struct fh_entry)
@@ -42,7 +42,7 @@

static int add_to_fhcache(struct dentry *, int);
static int nfsd_d_validate(struct dentry *);
-struct dentry * lookup_inode(dev_t, ino_t, ino_t);
+struct dentry * lookup_inode(kdev_t, ino_t, ino_t);

static LIST_HEAD(fixup_head);
static LIST_HEAD(path_inuse);
@@ -65,7 +65,7 @@
unsigned long reftime;
int users;
ino_t ino;
- dev_t dev;
+ kdev_t dev;
char name[1];
};

@@ -233,7 +233,7 @@
/*
* Search for a path entry for the specified (dev, inode).
*/
-struct nfsd_path *get_path_entry(dev_t dev, ino_t ino)
+struct nfsd_path *get_path_entry(kdev_t dev, ino_t ino)
{
struct nfsd_path *pe;
struct list_head *tmp;
@@ -381,7 +381,7 @@
* searching for a dentry given the inode: as we walk up the tree,
* it's likely that a dentry exists before we reach the root.
*/
-struct dentry * lookup_inode(dev_t dev, ino_t dirino, ino_t ino)
+struct dentry * lookup_inode(kdev_t dev, ino_t dirino, ino_t ino)
{
struct super_block *sb;
struct dentry *root, *dentry, *result;
@@ -649,7 +649,7 @@
/*
* Find an entry in the dir cache for the specified inode number.
*/
-static struct fh_entry *find_fhe_by_ino(dev_t dev, ino_t ino)
+static struct fh_entry *find_fhe_by_ino(kdev_t dev, ino_t ino)
{
struct fh_entry * fhe = &dirstable[0];
int i;
@@ -667,7 +667,7 @@
* Find the (directory) dentry with the specified (dev, inode) number.
* Note: this leaves the dentry in the cache.
*/
-static struct dentry *find_dentry_by_ino(dev_t dev, ino_t ino)
+static struct dentry *find_dentry_by_ino(kdev_t dev, ino_t ino)
{
struct fh_entry *fhe;
struct nfsd_path *pe;
@@ -762,7 +762,8 @@
#endif
goto out;
}
- if (inode->i_ino != fh->fh_ino || inode->i_dev != fh->fh_dev)
+ if (inode->i_ino != fh->fh_ino ||
+ to_dev_t(inode->i_dev) != fh->fh_dev)
goto out;

fhe->dentry = NULL;
@@ -874,6 +875,7 @@
{
struct dentry *dentry, *parent;
int looked_up = 0, retry = 0;
+ kdev_t dev;

/*
* Stage 1: Look for the dentry in the short-term fhcache.
@@ -892,7 +894,8 @@
if (nfsd_d_validate(dentry)) {
struct inode * dir = dentry->d_parent->d_inode;

- if (dir->i_ino == fh->fh_dirino && dir->i_dev == fh->fh_dev) {
+ if (dir->i_ino == fh->fh_dirino &&
+ to_dev_t(dir->i_dev) == fh->fh_dev) {
struct inode * inode = dentry->d_inode;
/*
* NFS filehandles must always have an inode,
@@ -931,7 +934,8 @@
* numbers. This should work for all unix-like filesystems ...
*/
looked_up = 1;
- dentry = lookup_inode(fh->fh_dev, fh->fh_dirino, fh->fh_ino);
+ dev = to_kdev_t(fh->fh_dev);
+ dentry = lookup_inode(dev, fh->fh_dirino, fh->fh_ino);
if (!IS_ERR(dentry)) {
struct inode * inode = dentry->d_inode;
#ifdef NFSD_DEBUG_VERBOSE
@@ -952,7 +956,7 @@
/*
* Stage 4: Look for the parent dentry in the fhcache ...
*/
- parent = find_dentry_by_ino(fh->fh_dev, fh->fh_dirino);
+ parent = find_dentry_by_ino(dev, fh->fh_dirino);
if (parent) {
/*
* ... then search for the inode in the parent directory.
@@ -967,8 +971,8 @@
* Stage 5: Search the whole volume.
*/
#ifdef NFSD_PARANOIA
-printk("find_fh_dentry: %s, %ld/%ld not found -- need full search!\n",
-kdevname(fh->fh_dev), fh->fh_dirino, fh->fh_ino);
+printk("find_fh_dentry: %x, %ld/%ld not found -- need full search!\n",
+fh->fh_dev, fh->fh_dirino, fh->fh_ino);
#endif
dentry = NULL;
nfsdstats.fh_stale++;
@@ -1107,7 +1111,7 @@
fhp->fh_handle.fh_ino = inode->i_ino;
}
fhp->fh_handle.fh_dirino = dentry->d_parent->d_inode->i_ino;
- fhp->fh_handle.fh_dev = dentry->d_parent->d_inode->i_dev;
+ fhp->fh_handle.fh_dev = to_dev_t(dentry->d_parent->d_inode->i_dev);
fhp->fh_handle.fh_xdev = exp->ex_dev;
fhp->fh_handle.fh_xino = exp->ex_ino;

@@ -1229,7 +1233,7 @@
struct dentry *dentry = fhe->dentry;
if (!dentry)
continue;
- if (dev && dentry->d_inode->i_dev != dev)
+ if (dev && to_dev_t(dentry->d_inode->i_dev) != dev)
continue;
fhe->dentry = NULL;
dput(dentry);
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/nfsd/nfsproc.c ./linux/fs/nfsd/nfsproc.c
--- ../linux-2.1.88/linux/fs/nfsd/nfsproc.c Fri Feb 27 01:55:11 1998
+++ ./linux/fs/nfsd/nfsproc.c Sat Feb 21 23:08:32 1998
@@ -196,7 +196,7 @@
struct inode *inode = NULL;
int nfserr, type, mode;
int rdonly = 0, exists;
- dev_t rdev = NODEV;
+ dev_t rdev = 0;

dprintk("nfsd: CREATE %d/%ld %s\n",
SVCFH_DEV(dirfhp), SVCFH_INO(dirfhp), argp->name);
@@ -275,7 +275,7 @@

/* Make sure the type and device matches */
if (exists && (type != (inode->i_mode & S_IFMT)
- || (is_borc && inode->i_rdev != rdev))) {
+ || (is_borc && to_dev_t(inode->i_rdev) != rdev))) {
nfserr = nfserr_exist;
goto done;
}
diff -u --recursive --new-file ../linux-2.1.88/linux/fs/ufs/ufs_inode.c ./linux/fs/ufs/ufs_inode.c
--- ../linux-2.1.88/linux/fs/ufs/ufs_inode.c Fri Feb 27 01:56:01 1998
+++ ./linux/fs/ufs/ufs_inode.c Sun Feb 22 00:29:51 1998
@@ -281,13 +281,13 @@
}

/* KRR - I need to check the SunOS header files, but for the time
- * being, I'm going to tread ui_db[0] and [1] as a __u64 and swab
+ * being, I'm going to treat ui_db[0] and [1] as a __u64 and swab
* them appropriately. This should clean up any real endian problems,
* but we'll still need to add size checks in the write portion of
* the code.
*/
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
- inode->i_rdev = (kdev_t)SWAB64(*(__u64*)&ufsip->ui_u2.ui_addr.ui_db);
+ inode->i_rdev = to_kdev_t(SWAB64(*(__u64*)&ufsip->ui_u2.ui_addr.ui_db));
}

inode->u.ufs_i.i_flags = SWAB32(ufsip->ui_flags);
diff -u --recursive --new-file ../linux-2.1.88/linux/include/linux/blk.h ./linux/include/linux/blk.h
--- ../linux-2.1.88/linux/include/linux/blk.h Fri Feb 27 01:56:27 1998
+++ ./linux/include/linux/blk.h Sun Feb 22 01:49:46 1998
@@ -447,7 +447,7 @@

/*
* The [*_]end_request() handler has to be called with the request queue
- * spinlock aquired. All functions called within end_request() _must be_
+ * spinlock acquired. All functions called within end_request() _must be_
* atomic.
*/
#if defined(IDE_DRIVER) && !defined(_IDE_C) /* shared copy for IDE modules */
diff -u --recursive --new-file ../linux-2.1.88/linux/net/sched/sch_cbq.c ./linux/net/sched/sch_cbq.c
--- ../linux-2.1.88/linux/net/sched/sch_cbq.c Sun Nov 30 23:00:40 1997
+++ ./linux/net/sched/sch_cbq.c Sun Feb 22 17:04:16 1998
@@ -792,7 +792,6 @@
static int cbq_init(struct Qdisc *sch, void *arg)
{
struct cbq_sched_data *q;
- struct cbqctl *ctl = (struct cbqctl*)arg;

q = (struct cbq_sched_data *)sch->data;
init_timer(&q->wd_timer);
--- ../linux-2.1.88/linux/include/linux/kdev_t.h Sat Nov 23 11:29:04 1996
+++ ./linux/include/linux/kdev_t.h Fri Feb 27 15:51:18 1998
@@ -74,6 +74,7 @@
#define B_FREE 0xffff /* yuk */

extern char * kdevname(kdev_t); /* note: returns pointer to static data! */
+extern char * xdevname(dev_t); /* note: returns pointer to static data! */

/*
As long as device numbers in the outside world have 16 bits only,
@@ -99,6 +100,13 @@
minor = (dev & 0xff);
#endif
return MKDEV(major, minor);
+}
+
+#define XMAJOR(dev) ((dev) >> 8)
+#define XMINOR(dev) ((dev) & 0xff)
+
+static inline dev_t to_dev_t(kdev_t dev) {
+ return (dev_t) kdev_t_to_nr(dev);
}

#else /* __KERNEL__ */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu