Commit 75eead62 authored by Linus Torvalds's avatar Linus Torvalds

Merge home.transmeta.com:/home/torvalds/v2.5/viro

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 78f1f626 88cc0d3e
......@@ -230,3 +230,21 @@ anything from oops to silent memory corruption.
Use bdev_read_only(bdev) instead of is_read_only(kdev). The latter
is still alive, but only because of the mess in drivers/s390/block/dasd.c.
As soon as it gets fixed is_read_only() will die.
---
[mandatory]
is_read_only() is gone; use bdev_read_only() instead.
---
[mandatory]
destroy_buffers() is gone; use invalidate_bdev().
---
[mandatory]
fsync_dev() is gone; use fsync_bdev(). NOTE: lvm breakage is
deliberate; as soon as struct block_device * is propagated in a reasonable
way by that code fixing will become trivial; until then nothing can be
done.
......@@ -1090,7 +1090,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
#ifdef DEBUG_SIGNALS_MAPS
#define MAPS_LINE_FORMAT "%08lx-%08lx %s %08lx %s %lu "
#define MAPS_LINE_FORMAT "%08lx-%08lx %s %08lx %02x:%02x %lu "
static inline void read_maps (void)
{
......@@ -1107,7 +1107,7 @@ static inline void read_maps (void)
char *line;
char str[5], *cp = str;
int flags;
kdev_t dev;
dev_t dev;
unsigned long ino;
/*
......@@ -1132,7 +1132,7 @@ static inline void read_maps (void)
buffer, PAGE_SIZE);
}
printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
kdevname(dev), ino);
MAJOR(dev), MINOR(dev), ino);
if (map->vm_file != NULL)
printk("%s\n", line);
else
......
......@@ -633,7 +633,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
#ifdef DEBUG_SIGNALS_MAPS
#define MAPS_LINE_FORMAT "%016lx-%016lx %s %016lx %s %lu "
#define MAPS_LINE_FORMAT "%016lx-%016lx %s %016lx %02x:%02x %lu "
static inline void read_maps (void)
{
......@@ -650,7 +650,7 @@ static inline void read_maps (void)
char *line;
char str[5], *cp = str;
int flags;
kdev_t dev;
dev_t dev;
unsigned long ino;
/*
......@@ -675,7 +675,7 @@ static inline void read_maps (void)
buffer, PAGE_SIZE);
}
printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
kdevname(dev), ino);
MAJOR(dev), MINOR(dev), ino);
if (map->vm_file != NULL)
printk("%s\n", line);
else
......
......@@ -1319,7 +1319,7 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
#ifdef DEBUG_SIGNALS_MAPS
#define MAPS_LINE_FORMAT "%016lx-%016lx %s %016lx %s %lu "
#define MAPS_LINE_FORMAT "%016lx-%016lx %s %016lx %02x:%02x %lu "
static inline void read_maps (void)
{
......@@ -1336,7 +1336,7 @@ static inline void read_maps (void)
char *line;
char str[5], *cp = str;
int flags;
kdev_t dev;
dev_t dev;
unsigned long ino;
/*
......@@ -1361,7 +1361,7 @@ static inline void read_maps (void)
buffer, PAGE_SIZE);
}
printk(MAPS_LINE_FORMAT, map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
kdevname(dev), ino);
MAJOR(dev), MINOR(dev), ino);
if (map->vm_file != NULL)
printk("%s\n", line);
else
......
......@@ -1211,21 +1211,19 @@ void blk_put_request(struct request *rq)
static long ro_bits[MAX_BLKDEV][8];
int is_read_only(kdev_t dev)
int bdev_read_only(struct block_device *bdev)
{
int minor,major;
major = major(dev);
minor = minor(dev);
if (major < 0 || major >= MAX_BLKDEV) return 0;
if (!bdev)
return 0;
major = MAJOR(bdev->bd_dev);
minor = MINOR(bdev->bd_dev);
if (major < 0 || major >= MAX_BLKDEV)
return 0;
return ro_bits[major][minor >> 5] & (1 << (minor & 31));
}
int bdev_read_only(struct block_device *bdev)
{
return bdev && is_read_only(to_kdev_t(bdev->bd_dev));
}
void set_device_ro(kdev_t dev,int flag)
{
int minor,major;
......
......@@ -318,8 +318,9 @@ static void sanitize_format(union cdrom_addr *addr,
static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
unsigned long arg);
int cdrom_get_last_written(kdev_t dev, long *last_written);
int cdrom_get_next_writable(kdev_t dev, long *next_writable);
int cdrom_get_last_written(struct cdrom_device_info *, long *);
static int cdrom_get_next_writable(struct cdrom_device_info *, long *);
static void cdrom_count_tracks(struct cdrom_device_info *, tracktype*);
#ifdef CONFIG_SYSCTL
static void cdrom_sysctl_register(void);
......@@ -441,7 +442,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg)
return 0;
}
struct cdrom_device_info *cdrom_find_device(kdev_t dev)
static struct cdrom_device_info *cdrom_find_device(kdev_t dev)
{
struct cdrom_device_info *cdi;
......@@ -780,7 +781,7 @@ static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot)
return cdi->ops->generic_packet(cdi, &cgc);
}
int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)
static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)
{
struct cdrom_changer_info info;
int curslot;
......@@ -864,7 +865,7 @@ int cdrom_media_changed(kdev_t dev)
}
/* badly broken, I know. Is due for a fixup anytime. */
void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
{
struct cdrom_tochdr header;
struct cdrom_tocentry entry;
......@@ -1926,7 +1927,6 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
{
struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc;
kdev_t dev = cdi->dev;
char buffer[32];
int ret = 0;
......@@ -2198,7 +2198,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
case CDROM_NEXT_WRITABLE: {
long next = 0;
cdinfo(CD_DO_IOCTL, "entering CDROM_NEXT_WRITABLE\n");
if ((ret = cdrom_get_next_writable(dev, &next)))
if ((ret = cdrom_get_next_writable(cdi, &next)))
return ret;
IOCTL_OUT(arg, long, next);
return 0;
......@@ -2206,7 +2206,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
case CDROM_LAST_WRITTEN: {
long last = 0;
cdinfo(CD_DO_IOCTL, "entering CDROM_LAST_WRITTEN\n");
if ((ret = cdrom_get_last_written(dev, &last)))
if ((ret = cdrom_get_last_written(cdi, &last)))
return ret;
IOCTL_OUT(arg, long, last);
return 0;
......@@ -2216,10 +2216,9 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
return -ENOTTY;
}
int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8 type,
track_information *ti)
{
struct cdrom_device_info *cdi = cdrom_find_device(dev);
struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc;
int ret;
......@@ -2246,9 +2245,8 @@ int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
}
/* requires CD R/RW */
int cdrom_get_disc_info(kdev_t dev, disc_information *di)
static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di)
{
struct cdrom_device_info *cdi = cdrom_find_device(dev);
struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc;
int ret;
......@@ -2278,9 +2276,8 @@ int cdrom_get_disc_info(kdev_t dev, disc_information *di)
/* return the last written block on the CD-R media. this is for the udf
file system. */
int cdrom_get_last_written(kdev_t dev, long *last_written)
{
struct cdrom_device_info *cdi = cdrom_find_device(dev);
int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written)
{
struct cdrom_tocentry toc;
disc_information di;
track_information ti;
......@@ -2290,17 +2287,17 @@ int cdrom_get_last_written(kdev_t dev, long *last_written)
if (!CDROM_CAN(CDC_GENERIC_PACKET))
goto use_toc;
if ((ret = cdrom_get_disc_info(dev, &di)))
if ((ret = cdrom_get_disc_info(cdi, &di)))
goto use_toc;
last_track = (di.last_track_msb << 8) | di.last_track_lsb;
if ((ret = cdrom_get_track_info(dev, last_track, 1, &ti)))
if ((ret = cdrom_get_track_info(cdi, last_track, 1, &ti)))
goto use_toc;
/* if this track is blank, try the previous. */
if (ti.blank) {
last_track--;
if ((ret = cdrom_get_track_info(dev, last_track, 1, &ti)))
if ((ret = cdrom_get_track_info(cdi, last_track, 1, &ti)))
goto use_toc;
}
......@@ -2330,9 +2327,8 @@ int cdrom_get_last_written(kdev_t dev, long *last_written)
}
/* return the next writable block. also for udf file system. */
int cdrom_get_next_writable(kdev_t dev, long *next_writable)
static int cdrom_get_next_writable(struct cdrom_device_info *cdi, long *next_writable)
{
struct cdrom_device_info *cdi = cdrom_find_device(dev);
disc_information di;
track_information ti;
__u16 last_track;
......@@ -2341,17 +2337,17 @@ int cdrom_get_next_writable(kdev_t dev, long *next_writable)
if (!CDROM_CAN(CDC_GENERIC_PACKET))
goto use_last_written;
if ((ret = cdrom_get_disc_info(dev, &di)))
if ((ret = cdrom_get_disc_info(cdi, &di)))
goto use_last_written;
last_track = (di.last_track_msb << 8) | di.last_track_lsb;
if ((ret = cdrom_get_track_info(dev, last_track, 1, &ti)))
if ((ret = cdrom_get_track_info(cdi, last_track, 1, &ti)))
goto use_last_written;
/* if this track is blank, try the previous. */
if (ti.blank) {
last_track--;
if ((ret = cdrom_get_track_info(dev, last_track, 1, &ti)))
if ((ret = cdrom_get_track_info(cdi, last_track, 1, &ti)))
goto use_last_written;
}
......@@ -2364,7 +2360,7 @@ int cdrom_get_next_writable(kdev_t dev, long *next_writable)
return 0;
use_last_written:
if ((ret = cdrom_get_last_written(dev, next_writable))) {
if ((ret = cdrom_get_last_written(cdi, next_writable))) {
*next_writable = 0;
return ret;
} else {
......@@ -2373,11 +2369,7 @@ int cdrom_get_next_writable(kdev_t dev, long *next_writable)
}
}
EXPORT_SYMBOL(cdrom_get_disc_info);
EXPORT_SYMBOL(cdrom_get_track_info);
EXPORT_SYMBOL(cdrom_get_next_writable);
EXPORT_SYMBOL(cdrom_get_last_written);
EXPORT_SYMBOL(cdrom_count_tracks);
EXPORT_SYMBOL(register_cdrom);
EXPORT_SYMBOL(unregister_cdrom);
EXPORT_SYMBOL(cdrom_open);
......@@ -2385,11 +2377,9 @@ EXPORT_SYMBOL(cdrom_release);
EXPORT_SYMBOL(cdrom_ioctl);
EXPORT_SYMBOL(cdrom_media_changed);
EXPORT_SYMBOL(cdrom_number_of_slots);
EXPORT_SYMBOL(cdrom_select_disc);
EXPORT_SYMBOL(cdrom_mode_select);
EXPORT_SYMBOL(cdrom_mode_sense);
EXPORT_SYMBOL(init_cdrom_command);
EXPORT_SYMBOL(cdrom_find_device);
#ifdef CONFIG_SYSCTL
......
......@@ -25,8 +25,6 @@
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/bitops.h>
#define BUILDING_PTY_C 1
#include <linux/devpts_fs.h>
struct pty_struct {
......
......@@ -1336,7 +1336,7 @@ static int tty_open(struct inode * inode, struct file * filp)
ptmx_found:
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
minor -= driver->minor_start;
devpts_pty_new(driver->other->name_base + minor, mk_kdev(driver->other->major, minor + driver->other->minor_start));
devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->other->major, minor + driver->other->minor_start));
tty_register_devfs(&pts_driver[major], DEVFS_FL_DEFAULT,
pts_driver[major].minor_start + minor);
noctty = 1;
......
......@@ -1937,9 +1937,9 @@ static int cdrom_read_tocentry(struct ata_device *drive, int trackno, int msf_fl
/* Try to read the entire TOC for the disk into our internal buffer. */
static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense)
{
int minor, stat, ntracks, i;
kdev_t dev;
int stat, ntracks, i;
struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo;
struct atapi_toc *toc = info->toc;
struct {
struct atapi_toc_header hdr;
......@@ -2071,10 +2071,8 @@ static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense)
toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
/* Now try to get the total cdrom capacity. */
minor = (drive->select.b.unit) << PARTN_BITS;
dev = mk_kdev(drive->channel->major, minor);
/* FIXME: This is making worng assumptions about register layout. */
stat = cdrom_get_last_written(dev, (unsigned long *) &toc->capacity);
stat = cdrom_get_last_written(cdi, (unsigned long *) &toc->capacity);
if (stat)
stat = cdrom_read_capacity(drive, &toc->capacity, sense);
if (stat)
......
......@@ -60,7 +60,6 @@ static int linear_run (mddev_t *mddev)
goto out;
}
disk->dev = rdev->dev;
disk->bdev = rdev->bdev;
atomic_inc(&rdev->bdev->bd_count);
disk->size = rdev->size;
......@@ -163,7 +162,7 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
if (block >= (tmp_dev->size + tmp_dev->offset)
|| block < tmp_dev->offset) {
printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, kdevname(tmp_dev->dev), tmp_dev->size, tmp_dev->offset);
printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, bdevname(tmp_dev->bdev), tmp_dev->size, tmp_dev->offset);
bio_io_error(bio);
return 0;
}
......@@ -186,11 +185,11 @@ static int linear_status (char *page, mddev_t *mddev)
for (j = 0; j < conf->nr_zones; j++)
{
sz += sprintf(page+sz, "[%s",
partition_name(conf->hash_table[j].dev0->dev));
bdev_partition_name(conf->hash_table[j].dev0->bdev));
if (conf->hash_table[j].dev1)
sz += sprintf(page+sz, "/%s] ",
partition_name(conf->hash_table[j].dev1->dev));
bdev_partition_name(conf->hash_table[j].dev1->bdev));
else
sz += sprintf(page+sz, "] ");
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -522,8 +522,8 @@ void get_sectorsize(int i)
SCp->needs_sector_size = 1;
} else {
#if 0
if (cdrom_get_last_written(mkdev(MAJOR_NR, i),
&scsi_CDs[i].capacity))
if (cdrom_get_last_written(&SCp->cdi,
&SCp->capacity))
#endif
SCp->capacity = 1 + ((buffer[0] << 24) |
(buffer[1] << 16) |
......
......@@ -40,6 +40,7 @@ obj-$(CONFIG_QUOTACTL) += quota.o
obj-$(CONFIG_PROC_FS) += proc/
obj-y += partitions/
obj-y += driverfs/
obj-y += devpts/
# Do not add any filesystems before this line
obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
......@@ -81,7 +82,6 @@ obj-$(CONFIG_AUTOFS_FS) += autofs/
obj-$(CONFIG_AUTOFS4_FS) += autofs4/
obj-$(CONFIG_ADFS_FS) += adfs/
obj-$(CONFIG_REISERFS_FS) += reiserfs/
obj-$(CONFIG_DEVPTS_FS) += devpts/
obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/
obj-$(CONFIG_JFS_FS) += jfs/
......
......@@ -297,7 +297,6 @@ struct block_device *bdget(dev_t dev)
new_bdev->bd_inode = inode;
inode->i_mode = S_IFBLK;
inode->i_rdev = kdev;
inode->i_dev = kdev;
inode->i_bdev = new_bdev;
inode->i_data.a_ops = &def_blk_aops;
inode->i_data.gfp_mask = GFP_USER;
......
......@@ -245,22 +245,6 @@ int fsync_bdev(struct block_device *bdev)
return sync_blockdev(bdev);
}
/*
* Write out and wait upon all dirty data associated with this
* kdev_t. Filesystem data as well as the underlying block
* device. Takes the superblock lock.
*/
int fsync_dev(kdev_t dev)
{
struct block_device *bdev = bdget(kdev_t_to_nr(dev));
if (bdev) {
int res = fsync_bdev(bdev);
bdput(bdev);
return res;
}
return 0;
}
/*
* sync everything.
*/
......
......@@ -4,6 +4,6 @@
obj-$(CONFIG_DEVPTS_FS) += devpts.o
devpts-objs := root.o inode.o
devpts-objs := inode.o
include $(TOPDIR)/Rules.make
/* -*- linux-c -*- --------------------------------------------------------- *
*
* linux/fs/devpts/devpts_i.h
*
* Copyright 1998 H. Peter Anvin -- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ------------------------------------------------------------------------- */
#include <linux/fs.h>
#include <linux/tty.h>
#include <linux/types.h>
#define BUILDING_DEVPTS 1
#include <linux/devpts_fs.h>
struct devpts_sb_info {
u32 magic;
int setuid;
int setgid;
uid_t uid;
gid_t gid;
umode_t mode;
unsigned int max_ptys;
struct inode **inodes;
};
#define DEVPTS_SUPER_MAGIC 0x1cd1
#define DEVPTS_SBI_MAGIC 0x01da1d02
extern inline struct devpts_sb_info *SBI(struct super_block *sb)
{
return (struct devpts_sb_info *)(sb->u.generic_sbp);
}
extern struct inode_operations devpts_root_inode_operations;
extern struct file_operations devpts_root_operations;
......@@ -11,135 +11,70 @@
* ------------------------------------------------------------------------- */
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kdev_t.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/tty.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/namei.h>
#include "devpts_i.h"
#define DEVPTS_SUPER_MAGIC 0x1cd1
static struct vfsmount *devpts_mnt;
static struct dentry *devpts_root;
static void devpts_put_super(struct super_block *sb)
{
struct devpts_sb_info *sbi = SBI(sb);
struct inode *inode;
int i;
static struct {
int setuid;
int setgid;
uid_t uid;
gid_t gid;
umode_t mode;
} config = {mode: 0600};
for ( i = 0 ; i < sbi->max_ptys ; i++ ) {
if ( (inode = sbi->inodes[i]) ) {
if ( atomic_read(&inode->i_count) != 1 )
printk("devpts_put_super: badness: entry %d count %d\n",
i, atomic_read(&inode->i_count));
inode->i_nlink--;
iput(inode);
}
}
kfree(sbi->inodes);
kfree(sbi);
}
static int devpts_remount (struct super_block * sb, int * flags, char * data);
static struct super_operations devpts_sops = {
put_super: devpts_put_super,
statfs: simple_statfs,
remount_fs: devpts_remount,
};
static int devpts_parse_options(char *options, struct devpts_sb_info *sbi)
static int devpts_remount(struct super_block *sb, int *flags, char *data)
{
int setuid = 0;
int setgid = 0;
uid_t uid = 0;
gid_t gid = 0;
umode_t mode = 0600;
char *this_char, *value;
char *this_char;
this_char = NULL;
while ((this_char = strsep(&options, ",")) != NULL) {
while ((this_char = strsep(&data, ",")) != NULL) {
int n;
char dummy;
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0;
if (!strcmp(this_char,"uid")) {
if (!value || !*value)
return 1;
uid = simple_strtoul(value,&value,0);
if (*value)
return 1;
if (sscanf(this_char, "uid=%i%c", &n, &dummy) == 1) {
setuid = 1;
}
else if (!strcmp(this_char,"gid")) {
if (!value || !*value)
return 1;
gid = simple_strtoul(value,&value,0);
if (*value)
return 1;
uid = n;
} else if (sscanf(this_char, "gid=%i%c", &n, &dummy) == 1) {
setgid = 1;
gid = n;
} else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1)
mode = n & ~S_IFMT;
else {
printk("devpts: called with bogus options\n");
return -EINVAL;
}
else if (!strcmp(this_char,"mode")) {
if (!value || !*value)
return 1;
mode = simple_strtoul(value,&value,8);
if (*value)
return 1;
}
else
return 1;
}
sbi->setuid = setuid;
sbi->setgid = setgid;
sbi->uid = uid;
sbi->gid = gid;
sbi->mode = mode & ~S_IFMT;
config.setuid = setuid;
config.setgid = setgid;
config.uid = uid;
config.gid = gid;
config.mode = mode;
return 0;
}
static int devpts_remount(struct super_block * sb, int * flags, char * data)
{
struct devpts_sb_info *sbi = sb->u.generic_sbp;
int res = devpts_parse_options(data,sbi);
if (res) {
printk("devpts: called with bogus options\n");
return -EINVAL;
}
return 0;
}
static struct super_operations devpts_sops = {
statfs: simple_statfs,
remount_fs: devpts_remount,
};
static int devpts_fill_super(struct super_block *s, void *data, int silent)
{
int error = -ENOMEM;
struct inode * inode;
struct devpts_sb_info *sbi;
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
if ( !sbi )
goto fail;
memset(sbi, 0, sizeof(*sbi));
sbi->magic = DEVPTS_SBI_MAGIC;
sbi->max_ptys = unix98_max_ptys;
sbi->inodes = kmalloc(sizeof(struct inode *) * sbi->max_ptys, GFP_KERNEL);
if ( !sbi->inodes )
goto fail_free;
memset(sbi->inodes, 0, sizeof(struct inode *) * sbi->max_ptys);
if ( devpts_parse_options(data,sbi) && !silent) {
error = -EINVAL;
printk("devpts: called with bogus options\n");
goto fail_free;
}
s->u.generic_sbp = (void *) sbi;
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
s->s_magic = DEVPTS_SUPER_MAGIC;
......@@ -147,27 +82,25 @@ static int devpts_fill_super(struct super_block *s, void *data, int silent)
inode = new_inode(s);
if (!inode)
goto fail_free;
goto fail;
inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0;
inode->i_blksize = 1024;
inode->i_uid = inode->i_gid = 0;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
inode->i_op = &devpts_root_inode_operations;
inode->i_fop = &devpts_root_operations;
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
inode->i_nlink = 2;
s->s_root = d_alloc_root(inode);
devpts_root = s->s_root = d_alloc_root(inode);
if (s->s_root)
return 0;
printk("devpts: get root dentry failed\n");
iput(inode);
fail_free:
kfree(sbi);
fail:
return error;
return -ENOMEM;
}
static struct super_block *devpts_get_sb(struct file_system_type *fs_type,
......@@ -183,44 +116,52 @@ static struct file_system_type devpts_fs_type = {
kill_sb: kill_anon_super,
};
void devpts_pty_new(int number, kdev_t device)
/*
* The normal naming convention is simply /dev/pts/<number>; this conforms
* to the System V naming convention
*/
static struct dentry *get_node(int num)
{
struct super_block *sb = devpts_mnt->mnt_sb;
struct devpts_sb_info *sbi = SBI(sb);
struct inode *inode;
if ( sbi->inodes[number] )
return; /* Already registered, this does happen */
inode = new_inode(sb);
char s[10];
struct dentry *root = devpts_root;
down(&root->d_inode->i_sem);
return lookup_one_len(s, root, sprintf(s, "%d", num));
}
void devpts_pty_new(int number, dev_t device)
{
struct dentry *dentry;
struct inode *inode = new_inode(devpts_mnt->mnt_sb);
if (!inode)
return;
inode->i_ino = number+2;
inode->i_blocks = 0;
inode->i_blksize = 1024;
inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
inode->i_uid = config.setuid ? config.uid : current->fsuid;
inode->i_gid = config.setgid ? config.gid : current->fsgid;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
init_special_inode(inode, S_IFCHR|sbi->mode, kdev_t_to_nr(device));
init_special_inode(inode, S_IFCHR|config.mode, device);
if ( sbi->inodes[number] ) {
iput(inode);
return;
}
sbi->inodes[number] = inode;
dentry = get_node(number);
if (!IS_ERR(dentry) && !dentry->d_inode)
d_instantiate(dentry, inode);
up(&devpts_root->d_inode->i_sem);
}
void devpts_pty_kill(int number)
{
struct super_block *sb = devpts_mnt->mnt_sb;
struct devpts_sb_info *sbi = SBI(sb);
struct inode *inode = sbi->inodes[number];
struct dentry *dentry = get_node(number);
if ( inode ) {
sbi->inodes[number] = NULL;
inode->i_nlink--;
iput(inode);
if (!IS_ERR(dentry)) {
struct inode *inode = dentry->d_inode;
if (inode) {
inode->i_nlink--;
d_delete(dentry);
dput(dentry);
}
dput(dentry);
}
up(&devpts_root->d_inode->i_sem);
}
static int __init init_devpts_fs(void)
......@@ -231,22 +172,12 @@ static int __init init_devpts_fs(void)
err = PTR_ERR(devpts_mnt);
if (!IS_ERR(devpts_mnt))
err = 0;
#ifdef MODULE
if ( !err ) {
devpts_upcall_new = devpts_pty_new;
devpts_upcall_kill = devpts_pty_kill;
}
#endif
}
return err;
}
static void __exit exit_devpts_fs(void)
{
#ifdef MODULE
devpts_upcall_new = NULL;
devpts_upcall_kill = NULL;
#endif
unregister_filesystem(&devpts_fs_type);
kern_umount(devpts_mnt);
}
......@@ -254,4 +185,3 @@ static void __exit exit_devpts_fs(void)
module_init(init_devpts_fs)
module_exit(exit_devpts_fs)
MODULE_LICENSE("GPL");
/* -*- linux-c -*- --------------------------------------------------------- *
*
* linux/fs/devpts/root.c
*
* Copyright 1998 H. Peter Anvin -- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ------------------------------------------------------------------------- */
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include "devpts_i.h"
static int devpts_root_readdir(struct file *,void *,filldir_t);
static struct dentry *devpts_root_lookup(struct inode *,struct dentry *);
static int devpts_revalidate(struct dentry *, int);
struct file_operations devpts_root_operations = {
read: generic_read_dir,
readdir: devpts_root_readdir,
};
struct inode_operations devpts_root_inode_operations = {
lookup: devpts_root_lookup,
};
static struct dentry_operations devpts_dentry_operations = {
d_revalidate: devpts_revalidate,
};
/*
* The normal naming convention is simply /dev/pts/<number>; this conforms
* to the System V naming convention
*/
#define genptsname(buf,num) sprintf(buf, "%d", num)
static int devpts_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct inode * inode = filp->f_dentry->d_inode;
struct devpts_sb_info * sbi = SBI(filp->f_dentry->d_inode->i_sb);
off_t nr;
char numbuf[16];
lock_kernel();
nr = filp->f_pos;
switch(nr)
{
case 0:
if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
goto out;
filp->f_pos = ++nr;
/* fall through */
case 1:
if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
goto out;
filp->f_pos = ++nr;
/* fall through */
default:
while ( nr - 2 < sbi->max_ptys ) {
int ptynr = nr - 2;
if ( sbi->inodes[ptynr] ) {
genptsname(numbuf, ptynr);
if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_CHR) < 0 )
goto out;
}
filp->f_pos = ++nr;
}
break;
}
out:
unlock_kernel();
return 0;
}
/*
* Revalidate is called on every cache lookup. We use it to check that
* the pty really does still exist. Never revalidate negative dentries;
* for simplicity (fix later?)
*/
static int devpts_revalidate(struct dentry * dentry, int flags)
{
struct devpts_sb_info *sbi;
if ( !dentry->d_inode )
return 0;
sbi = SBI(dentry->d_inode->i_sb);
return ( sbi->inodes[dentry->d_inode->i_ino - 2] == dentry->d_inode );
}
static struct dentry *devpts_root_lookup(struct inode * dir, struct dentry * dentry)
{
struct devpts_sb_info *sbi = SBI(dir->i_sb);
unsigned int entry;
int i;
const char *p;
dentry->d_op = &devpts_dentry_operations;
if ( dentry->d_name.len == 1 && dentry->d_name.name[0] == '0' ) {
entry = 0;
} else if ( dentry->d_name.len < 1 ) {
return NULL;
} else {
p = dentry->d_name.name;
if ( *p < '1' || *p > '9' )
return NULL;
entry = *p++ - '0';
for ( i = dentry->d_name.len-1 ; i ; i-- ) {
unsigned int nentry = *p++ - '0';
if ( nentry > 9 )
return NULL;
if ( entry >= ~0U/10 )
return NULL;
entry = nentry + entry * 10;
}
}
if ( entry >= sbi->max_ptys )
return NULL;
lock_kernel();
if ( sbi->inodes[entry] )
atomic_inc(&sbi->inodes[entry]->i_count);
d_add(dentry, sbi->inodes[entry]);
unlock_kernel();
return NULL;
}
......@@ -101,7 +101,7 @@ static struct inode *alloc_inode(struct super_block *sb)
struct address_space * const mapping = &inode->i_data;
inode->i_sb = sb;
inode->i_dev = to_kdev_t(sb->s_dev);
inode->i_dev = sb->s_dev;
inode->i_blkbits = sb->s_blocksize_bits;
inode->i_flags = 0;
atomic_set(&inode->i_count, 1);
......
......@@ -122,7 +122,7 @@ struct jfs_sb_info {
short nbperpage; /* 2: blocks per page */
short l2nbperpage; /* 2: log2 blocks per page */
short l2niperblk; /* 2: log2 inodes per page */
kdev_t logdev; /* 2: external log device */
u32 logdev; /* 2: external log device */
uint aggregate; /* volume identifier in log record */
pxd_t logpxd; /* 8: pxd describing log */
pxd_t ait2; /* 8: pxd describing AIT copy */
......
......@@ -1102,7 +1102,7 @@ int lmLogOpen(struct super_block *sb, log_t ** logptr)
*/
externalLog:
if (!(bdev = bdget(kdev_t_to_nr(JFS_SBI(sb)->logdev)))) {
if (!(bdev = bdget(JFS_SBI(sb)->logdev))) {
rc = ENODEV;
goto free;
}
......
......@@ -406,7 +406,7 @@ static int chkSuper(struct super_block *sb)
if (sbi->mntflag & JFS_INLINELOG)
sbi->logpxd = j_sb->s_logpxd;
else {
sbi->logdev = to_kdev_t(le32_to_cpu(j_sb->s_logdev));
sbi->logdev = le32_to_cpu(j_sb->s_logdev);
memcpy(sbi->uuid, j_sb->s_uuid, sizeof(sbi->uuid));
memcpy(sbi->loguuid, j_sb->s_loguuid, sizeof(sbi->uuid));
}
......
......@@ -1751,9 +1751,12 @@ static void lock_get_status(char* out, struct file_lock *fl, int id, char *pfx)
? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ "
: (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
}
/*
* NOTE: it should be inode->i_sb->s_id, not kdevname(...).
*/
out += sprintf(out, "%d %s:%ld ",
fl->fl_pid,
inode ? kdevname(inode->i_dev) : "<none>",
inode ? kdevname(to_kdev_t(inode->i_dev)) : "<none>",
inode ? inode->i_ino : 0);
out += sprintf(out, "%Ld ", fl->fl_start);
if (fl->fl_end == OFFSET_MAX)
......
......@@ -68,17 +68,17 @@ static svc_client * clients;
* Find the client's export entry matching xdev/xino.
*/
svc_export *
exp_get(svc_client *clp, kdev_t dev, ino_t ino)
exp_get(svc_client *clp, dev_t dev, ino_t ino)
{
struct list_head *head, *p;
if (!clp)
return NULL;
head = &clp->cl_export[EXPORT_HASH(kdev_t_to_nr(dev))];
head = &clp->cl_export[EXPORT_HASH(dev)];
list_for_each(p, head) {
svc_export *exp = list_entry(p, svc_export, ex_hash);
if (exp->ex_ino == ino && kdev_same(exp->ex_dev, dev))
if (exp->ex_ino == ino && exp->ex_dev == dev)
return exp;
}
return NULL;
......@@ -250,7 +250,7 @@ exp_export(struct nfsctl_export *nxp)
struct nameidata nd;
struct inode *inode = NULL;
int err;
kdev_t dev;
dev_t dev;
ino_t ino;
/* Consistency check */
......@@ -276,7 +276,7 @@ exp_export(struct nfsctl_export *nxp)
if (err)
goto out_unlock;
inode = nd.dentry->d_inode;
dev = inode->i_dev;
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
err = -EINVAL;
......@@ -364,7 +364,7 @@ exp_export(struct nfsctl_export *nxp)
if (parent)
exp_change_parents(clp, parent, exp);
list_add(&exp->ex_hash, clp->cl_export + EXPORT_HASH(kdev_t_to_nr(dev)));
list_add(&exp->ex_hash, clp->cl_export + EXPORT_HASH(dev));
list_add_tail(&exp->ex_list, &clp->cl_list);
exp_fsid_hash(clp, exp);
......@@ -398,7 +398,7 @@ exp_do_unexport(svc_export *unexp)
dentry = unexp->ex_dentry;
mnt = unexp->ex_mnt;
inode = dentry->d_inode;
if (!kdev_same(unexp->ex_dev, inode->i_dev) || unexp->ex_ino != inode->i_ino)
if (unexp->ex_dev != inode->i_sb->s_dev || unexp->ex_ino != inode->i_ino)
printk(KERN_WARNING "nfsd: bad dentry in unexport!\n");
dput(dentry);
mntput(mnt);
......@@ -440,8 +440,7 @@ exp_unexport(struct nfsctl_export *nxp)
err = -EINVAL;
clp = exp_getclientbyname(nxp->ex_client);
if (clp) {
kdev_t ex_dev = to_kdev_t(nxp->ex_dev);
svc_export *exp = exp_get(clp, ex_dev, nxp->ex_ino);
svc_export *exp = exp_get(clp, nxp->ex_dev, nxp->ex_ino);
if (exp) {
exp_do_unexport(exp);
err = 0;
......
......@@ -219,7 +219,7 @@ encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
&& (fhp->fh_export->ex_flags & NFSEXP_FSID))
p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
else
p = xdr_encode_hyper(p, (u64) kdev_t_to_nr(inode->i_dev));
p = xdr_encode_hyper(p, (u64) inode->i_dev);
p = xdr_encode_hyper(p, (u64) inode->i_ino);
p = encode_time3(p, fhp->fh_post_atime);
p = encode_time3(p, fhp->fh_post_mtime);
......
......@@ -97,7 +97,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
rqstp->rq_reffh = fh;
if (!fhp->fh_dentry) {
kdev_t xdev = NODEV;
dev_t xdev = 0;
ino_t xino = 0;
__u32 *datap=NULL;
__u32 tfh[3]; /* filehandle fragment for oldstyle filehandles */
......@@ -122,7 +122,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
case 0:
if ((data_left-=2)<0) goto out;
nfsdev = ntohl(*datap++);
xdev = mk_kdev(nfsdev>>16, nfsdev&0xFFFF);
xdev = MKDEV(nfsdev>>16, nfsdev&0xFFFF);
xino = *datap++;
break;
case 1:
......@@ -136,7 +136,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
if (fh->fh_size != NFS_FHSIZE)
goto out;
/* assume old filehandle format */
xdev = u32_to_kdev_t(fh->ofh_xdev);
xdev = u32_to_dev_t(fh->ofh_xdev);
xino = u32_to_ino_t(fh->ofh_xino);
}
......@@ -308,7 +308,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
__u32 *datap;
dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
major(exp->ex_dev), minor(exp->ex_dev), (long) exp->ex_ino,
MAJOR(exp->ex_dev), MINOR(exp->ex_dev), (long) exp->ex_ino,
parent->d_name.name, dentry->d_name.name,
(inode ? inode->i_ino : 0));
......@@ -329,7 +329,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE);
fhp->fh_handle.fh_size = NFS_FHSIZE;
fhp->fh_handle.ofh_dcookie = 0xfeebbaca;
fhp->fh_handle.ofh_dev = htonl((major(exp->ex_dev)<<16)| minor(exp->ex_dev));
fhp->fh_handle.ofh_dev = htonl((MAJOR(exp->ex_dev)<<16)| MINOR(exp->ex_dev));
fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_ino);
fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
......@@ -348,7 +348,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
} else {
fhp->fh_handle.fh_fsid_type = 0;
/* fsid_type 0 == 2byte major, 2byte minor, 4byte inode */
*datap++ = htonl((major(exp->ex_dev)<<16)| minor(exp->ex_dev));
*datap++ = htonl((MAJOR(exp->ex_dev)<<16)| MINOR(exp->ex_dev));
*datap++ = ino_t_to_u32(exp->ex_ino);
fhp->fh_handle.fh_size = 3*4;
}
......
......@@ -66,7 +66,7 @@ struct raparms {
struct raparms *p_next;
unsigned int p_count;
ino_t p_ino;
kdev_t p_dev;
dev_t p_dev;
struct file_ra_state p_ra;
};
......@@ -527,14 +527,14 @@ nfsd_sync_dir(struct dentry *dp)
static spinlock_t ra_lock = SPIN_LOCK_UNLOCKED;
static inline struct raparms *
nfsd_get_raparms(kdev_t dev, ino_t ino)
nfsd_get_raparms(dev_t dev, ino_t ino)
{
struct raparms *ra, **rap, **frap = NULL;
int depth = 0;
spin_lock(&ra_lock);
for (rap = &raparm_cache; (ra = *rap); rap = &ra->p_next) {
if (ra->p_ino == ino && kdev_same(ra->p_dev, dev))
if (ra->p_ino == ino && ra->p_dev == dev)
goto found;
depth++;
if (ra->p_count == 0)
......@@ -691,8 +691,8 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
}
if (err >= 0 && stable) {
static unsigned long last_ino;
static kdev_t last_dev = NODEV;
static ino_t last_ino;
static dev_t last_dev = 0;
/*
* Gathered writes: If another process is currently
......@@ -708,7 +708,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
*/
if (EX_WGATHER(exp)) {
if (atomic_read(&inode->i_writecount) > 1
|| (last_ino == inode->i_ino && kdev_same(last_dev, inode->i_dev))) {
|| (last_ino == inode->i_ino && last_dev == inode->i_dev)) {
dprintk("nfsd: write defer %d\n", current->pid);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((HZ+99)/100);
......
......@@ -13,14 +13,9 @@
* Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl}
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/genhd.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/blk.h>
#include <linux/init.h>
#include <linux/raid/md.h>
#include <linux/buffer_head.h> /* for invalidate_bdev() */
#include <linux/kmod.h>
......
......@@ -539,11 +539,11 @@ int proc_pid_statm(struct task_struct *task, char * buffer)
* + (index into the line)
*/
/* for systems with sizeof(void*) == 4: */
#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %08lx %s %lu"
#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %08lx %02x:%02x %lu"
#define MAPS_LINE_MAX4 49 /* sum of 8 1 8 1 4 1 8 1 5 1 10 1 */
/* for systems with sizeof(void*) == 8: */
#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %s %lu"
#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %02x:%02x %lu"
#define MAPS_LINE_MAX8 73 /* sum of 16 1 16 1 4 1 16 1 5 1 10 1 */
#define MAPS_LINE_FORMAT (sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8)
......@@ -555,7 +555,7 @@ static int proc_pid_maps_get_line (char *buf, struct vm_area_struct *map)
char *line;
char str[5];
int flags;
kdev_t dev;
dev_t dev;
unsigned long ino;
int len;
......@@ -567,7 +567,7 @@ static int proc_pid_maps_get_line (char *buf, struct vm_area_struct *map)
str[3] = flags & VM_MAYSHARE ? 's' : 'p';
str[4] = 0;
dev = NODEV;
dev = 0;
ino = 0;
if (map->vm_file != NULL) {
dev = map->vm_file->f_dentry->d_inode->i_dev;
......@@ -585,7 +585,7 @@ static int proc_pid_maps_get_line (char *buf, struct vm_area_struct *map)
len = sprintf(line,
MAPS_LINE_FORMAT,
map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
kdevname(dev), ino);
MAJOR(dev), MINOR(dev), ino);
if(map->vm_file) {
int i;
......
......@@ -145,7 +145,6 @@ smb_get_inode_attr(struct inode *inode, struct smb_fattr *fattr)
fattr->f_ino = inode->i_ino;
fattr->f_uid = inode->i_uid;
fattr->f_gid = inode->i_gid;
fattr->f_rdev = inode->i_rdev;
fattr->f_size = inode->i_size;
fattr->f_mtime = inode->i_mtime;
fattr->f_ctime = inode->i_ctime;
......@@ -183,7 +182,6 @@ smb_set_inode_attr(struct inode *inode, struct smb_fattr *fattr)
inode->i_nlink = fattr->f_nlink;
inode->i_uid = fattr->f_uid;
inode->i_gid = fattr->f_gid;
inode->i_rdev = fattr->f_rdev;
inode->i_ctime = fattr->f_ctime;
inode->i_blksize= fattr->f_blksize;
inode->i_blocks = fattr->f_blocks;
......
......@@ -17,7 +17,7 @@
void generic_fillattr(struct inode *inode, struct kstat *stat)
{
stat->dev = kdev_t_to_nr(inode->i_dev);
stat->dev = inode->i_dev;
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
stat->nlink = inode->i_nlink;
......
......@@ -203,8 +203,6 @@ extern struct bio *bio_copy(struct bio *, int, int);
extern inline void bio_init(struct bio *);
extern int bio_ioctl(kdev_t, unsigned int, unsigned long);
#ifdef CONFIG_HIGHMEM
/*
* remember to add offset! and never ever reenable interrupts between a
......
......@@ -121,7 +121,6 @@ BUFFER_FNS(Boundary, boundary)
#define page_has_buffers(page) PagePrivate(page)
#define invalidate_buffers(dev) __invalidate_buffers((dev), 0)
#define destroy_buffers(dev) __invalidate_buffers((dev), 1)
/*
......@@ -156,7 +155,6 @@ int sync_blockdev(struct block_device *bdev);
void __wait_on_buffer(struct buffer_head *);
void sleep_on_buffer(struct buffer_head *bh);
void wake_up_buffer(struct buffer_head *bh);
int fsync_dev(kdev_t);
int fsync_bdev(struct block_device *);
int fsync_super(struct super_block *);
int fsync_no_super(struct block_device *);
......
......@@ -807,11 +807,8 @@ typedef struct {
long error;
} tracktype;
extern void cdrom_count_tracks(struct cdrom_device_info *cdi,tracktype* tracks);
extern int cdrom_get_next_writable(kdev_t dev, long *next_writable);
extern int cdrom_get_last_written(kdev_t dev, long *last_written);
extern int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written);
extern int cdrom_number_of_slots(struct cdrom_device_info *cdi);
extern int cdrom_select_disc(struct cdrom_device_info *cdi, int slot);
extern int cdrom_mode_select(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc);
extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
......@@ -819,7 +816,6 @@ extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
int page_code, int page_control);
extern void init_cdrom_command(struct cdrom_generic_command *cgc,
void *buffer, int len, int type);
extern struct cdrom_device_info *cdrom_find_device(kdev_t dev);
typedef struct {
__u16 disc_information_length;
......@@ -903,10 +899,6 @@ typedef struct {
__u32 last_rec_address;
} track_information;
extern int cdrom_get_disc_info(kdev_t dev, disc_information *di);
extern int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
track_information *ti);
/* The SCSI spec says there could be 256 slots. */
#define CDROM_MAX_SLOTS 256
......
......@@ -10,64 +10,23 @@
*
* ------------------------------------------------------------------------- */
/*
* Prototypes for the pty driver <-> devpts filesystem interface. Most
* of this is really just a hack so we can exclude it or build it as a
* module, and probably should go away eventually.
*/
#ifndef _LINUX_DEVPTS_FS_H
#define _LINUX_DEVPTS_FS_H 1
#include <linux/config.h>
#include <linux/kdev_t.h>
#include <linux/tty.h>
#ifdef CONFIG_DEVPTS_FS
void devpts_pty_new(int, kdev_t);
void devpts_pty_kill(int);
#define unix98_max_ptys NR_PTYS * UNIX98_NR_MAJORS;
#elif defined(CONFIG_DEVPTS_FS_MODULE)
void devpts_pty_new(int, dev_t); /* mknod in devpts */
void devpts_pty_kill(int); /* unlink */
#ifdef BUILDING_PTY_C
void (*devpts_upcall_new)(int,kdev_t) = NULL;
void (*devpts_upcall_kill)(int) = NULL;
unsigned int unix98_max_ptys = NR_PTYS * UNIX98_NR_MAJORS;
EXPORT_SYMBOL(devpts_upcall_new);
EXPORT_SYMBOL(devpts_upcall_kill);
EXPORT_SYMBOL(unix98_max_ptys);
#else
extern void (*devpts_upcall_new)(int,kdev_t);
extern void (*devpts_upcall_kill)(int);
extern unsigned int unix98_max_ptys;
#endif
#ifndef BUILDING_DEVPTS
static inline void
devpts_pty_new(int line, kdev_t device)
static inline void devpts_pty_new(int line, dev_t device)
{
if ( devpts_upcall_new )
return devpts_upcall_new(line,device);
}
static inline void
devpts_pty_kill(int line)
static inline void devpts_pty_kill(int line)
{
if ( devpts_upcall_kill )
return devpts_upcall_kill(line);
}
#endif
#else /* No /dev/pts filesystem at all */
static inline void
devpts_pty_new(int line, kdev_t device) { }
static inline void
devpts_pty_kill(int line) { }
#endif
......
......@@ -359,7 +359,7 @@ struct inode {
struct list_head i_dentry;
unsigned long i_ino;
atomic_t i_count;
kdev_t i_dev;
dev_t i_dev;
umode_t i_mode;
nlink_t i_nlink;
uid_t i_uid;
......@@ -1223,7 +1223,6 @@ extern void ll_rw_block(int, int, struct buffer_head * bh[]);
extern int submit_bh(int, struct buffer_head *);
struct bio;
extern int submit_bio(int, struct bio *);
extern int is_read_only(kdev_t);
extern int bdev_read_only(struct block_device *);
extern int set_blocksize(struct block_device *, int);
extern int sb_set_blocksize(struct super_block *, int);
......
......@@ -36,8 +36,7 @@ typedef struct { unsigned short major, minor; } kdev_t;
Admissible operations on an object of type kdev_t:
- passing it along
- comparing it for equality with another such object
- storing it in inode->i_dev, inode->i_rdev, req->rq_dev, de->dc_dev,
- tty->device
- storing it in inode->i_rdev, req->rq_dev, de->dc_dev, tty->device
- using its bit pattern as argument in a hash function
- finding its major and minor
- complaining about it
......
......@@ -70,7 +70,7 @@ struct svc_export {
int ex_flags;
struct vfsmount * ex_mnt;
struct dentry * ex_dentry;
kdev_t ex_dev;
dev_t ex_dev;
ino_t ex_ino;
uid_t ex_anon_uid;
gid_t ex_anon_gid;
......@@ -94,7 +94,7 @@ void exp_readlock(void);
void exp_readunlock(void);
struct svc_client * exp_getclient(struct sockaddr_in *sin);
void exp_putclient(struct svc_client *clp);
struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino);
struct svc_export * exp_get(struct svc_client *clp, dev_t dev, ino_t ino);
struct svc_export * exp_get_fsid(struct svc_client *clp, int fsid);
struct svc_export * exp_get_by_name(struct svc_client *clp,
struct vfsmount *mnt,
......
......@@ -143,13 +143,13 @@ static inline __u32 kdev_t_to_u32(kdev_t dev)
return udev;
}
static inline kdev_t u32_to_kdev_t(__u32 udev)
static inline dev_t u32_to_dev_t(__u32 udev)
{
unsigned int minor, major;
minor = (udev & 0xff) | ((udev >> 8) & 0xfff00);
major = ((udev >> 8) & 0xff) | ((udev >> 20) & 0xf00);
return mk_kdev(major, minor);
return MKDEV(major, minor);
}
static inline __u32 ino_t_to_u32(ino_t ino)
......
......@@ -4,7 +4,6 @@
#include <linux/raid/md.h>
struct dev_info {
kdev_t dev;
struct block_device *bdev;
unsigned long size;
unsigned long offset;
......
......@@ -66,7 +66,7 @@ extern struct hd_struct md_hd_struct[MAX_MD_DEVS];
extern char * partition_name (kdev_t dev);
extern inline char * bdev_partition_name (struct block_device *bdev)
{
return partition_name(to_kdev_t(bdev->bd_dev));
return partition_name(bdev ? to_kdev_t(bdev->bd_dev) : NODEV);
}
extern int register_md_personality (int p_num, mdk_personality_t *p);
extern int unregister_md_personality (int p_num);
......@@ -77,7 +77,7 @@ extern void md_wakeup_thread(mdk_thread_t *thread);
extern void md_interrupt_thread (mdk_thread_t *thread);
extern void md_update_sb (mddev_t *mddev);
extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
extern void md_sync_acct(kdev_t dev, unsigned long nr_sectors);
extern void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors);
extern int md_error (mddev_t *mddev, struct block_device *bdev);
extern int md_run_setup(void);
......
......@@ -160,16 +160,6 @@ struct mdk_rdev_s
int desc_nr; /* descriptor index in the superblock */
};
/*
* disk operations in a working array:
*/
#define DISKOP_SPARE_INACTIVE 0
#define DISKOP_SPARE_WRITE 1
#define DISKOP_SPARE_ACTIVE 2
#define DISKOP_HOT_REMOVE_DISK 3
#define DISKOP_HOT_ADD_DISK 4
typedef struct mdk_personality_s mdk_personality_t;
struct mddev_s
......@@ -213,19 +203,12 @@ struct mdk_personality_s
int (*run)(mddev_t *mddev);
int (*stop)(mddev_t *mddev);
int (*status)(char *page, mddev_t *mddev);
int (*error_handler)(mddev_t *mddev, kdev_t dev);
/*
* Some personalities (RAID-1, RAID-5) can have disks hot-added and
* hot-removed. Hot removal is different from failure. (failure marks
* a disk inactive, but the disk is still part of the array) The interface
* to such operations is the 'pers->diskop()' function, can be NULL.
*
* the diskop function can change the pointer pointing to the incoming
* descriptor, but must do so very carefully. (currently only
* SPARE_ACTIVE expects such a change)
*/
int (*diskop) (mddev_t *mddev, mdp_disk_t **descriptor, int state);
int (*error_handler)(mddev_t *mddev, struct block_device *bdev);
int (*hot_add_disk) (mddev_t *mddev, mdp_disk_t *descriptor, mdk_rdev_t *rdev);
int (*hot_remove_disk) (mddev_t *mddev, int number);
int (*spare_write) (mddev_t *mddev, int number);
int (*spare_inactive) (mddev_t *mddev);
int (*spare_active) (mddev_t *mddev, mdp_disk_t **descriptor);
int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster);
};
......
......@@ -6,7 +6,6 @@
struct multipath_info {
int number;
int raid_disk;
kdev_t dev;
struct block_device *bdev;
/*
......
......@@ -8,7 +8,6 @@ typedef struct mirror_info mirror_info_t;
struct mirror_info {
int number;
int raid_disk;
kdev_t dev;
struct block_device *bdev;
sector_t head_position;
atomic_t nr_pending;
......
......@@ -192,7 +192,6 @@ struct stripe_head {
struct disk_info {
kdev_t dev;
struct block_device *bdev;
int operational;
int number;
......
......@@ -1675,13 +1675,10 @@ int pop_journal_writer(int windex) ;
int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ;
int reiserfs_in_journal(struct super_block *p_s_sb, unsigned long bl, int searchall, unsigned long *next) ;
int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ;
struct super_block *reiserfs_get_super(kdev_t dev) ;
void flush_async_commits(struct super_block *p_s_sb) ;
int buffer_journaled(const struct buffer_head *bh) ;
int mark_buffer_journal_new(struct buffer_head *bh) ;
int reiserfs_sync_all_buffers(kdev_t dev, int wait) ;
int reiserfs_sync_buffers(kdev_t dev, int wait) ;
int reiserfs_add_page_to_flush_list(struct reiserfs_transaction_handle *,
struct inode *, struct buffer_head *) ;
int reiserfs_remove_page_from_flush_list(struct reiserfs_transaction_handle *,
......
......@@ -160,7 +160,7 @@ struct reiserfs_transaction_handle {
int t_blocks_allocated ; /* number of blocks this writer allocated */
unsigned long t_trans_id ; /* sanity check, equals the current trans id */
struct super_block *t_super ; /* super for this FS when journal_begin was
called. saves calls to reiserfs_get_super */
called. */
} ;
/*
......
......@@ -10,7 +10,6 @@
#define _LINUX_SMB_H
#include <linux/types.h>
#include <linux/kdev_t.h>
enum smb_protocol {
SMB_PROTOCOL_NONE,
......@@ -85,7 +84,6 @@ struct smb_fattr {
nlink_t f_nlink;
uid_t f_uid;
gid_t f_gid;
kdev_t f_rdev;
loff_t f_size;
time_t f_atime;
time_t f_mtime;
......
......@@ -185,7 +185,6 @@ EXPORT_SYMBOL(invalidate_inodes);
EXPORT_SYMBOL(invalidate_device);
EXPORT_SYMBOL(invalidate_inode_pages);
EXPORT_SYMBOL(truncate_inode_pages);
EXPORT_SYMBOL(fsync_dev);
EXPORT_SYMBOL(fsync_bdev);
EXPORT_SYMBOL(permission);
EXPORT_SYMBOL(vfs_permission);
......@@ -327,7 +326,6 @@ EXPORT_SYMBOL(tty_std_termios);
/* block device driver support */
EXPORT_SYMBOL(blk_size);
EXPORT_SYMBOL(blk_dev);
EXPORT_SYMBOL(is_read_only);
EXPORT_SYMBOL(bdev_read_only);
EXPORT_SYMBOL(set_device_ro);
EXPORT_SYMBOL(bmap);
......
......@@ -465,7 +465,7 @@ struct socket *sock_alloc(void)
if (!inode)
return NULL;
inode->i_dev = NODEV;
inode->i_dev = 0;
sock = SOCKET_I(inode);
inode->i_mode = S_IFSOCK|S_IRWXUGO;
......
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