]> git.hungrycats.org Git - linux/commitdiff
[PATCH] tty cleanups (11/12)
authorAlexander Viro <viro@www.linux.org.uk>
Wed, 23 Apr 2003 11:19:46 +0000 (04:19 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 23 Apr 2003 11:19:46 +0000 (04:19 -0700)
tty->device switched to dev_t
There are very few uses of tty->device left by now; most of
them actually want dev_t (process accounting, proc/<pid>/stat, several
ioctls, slip.c logics, etc.) and the rest will go away shortly.

arch/x86_64/ia32/ia32_ioctl.c
drivers/char/pty.c
drivers/char/tty_io.c
drivers/net/slip.c
drivers/net/slip.h
fs/proc/array.c
include/linux/tty.h
kernel/acct.c

index 3e786a7794595b77033051c1ef502342d6072127..812f02c45edc05675c9f2715072aa2e87c54ec75 100644 (file)
@@ -2847,7 +2847,7 @@ static int tiocgdev(unsigned fd, unsigned cmd,  unsigned int *ptr)
        real_tty = (struct tty_struct *)file->private_data;
        if (!real_tty)  
                return -EINVAL; 
-       return put_user(kdev_t_to_nr(real_tty->device), ptr); 
+       return put_user(real_tty->device, ptr); 
 } 
 
 
index 1459910ae5ce28c8191979808685f66d3c0c2823..e58858146d698129b2215600aaaccafc5f684906 100644 (file)
@@ -88,7 +88,7 @@ static void pty_close(struct tty_struct * tty, struct file * filp)
                set_bit(TTY_OTHER_CLOSED, &tty->flags);
 #ifdef CONFIG_UNIX98_PTYS
                {
-                       unsigned int major = major(tty->device) - UNIX98_PTY_MASTER_MAJOR;
+                       unsigned int major = MAJOR(tty->device) - UNIX98_PTY_MASTER_MAJOR;
                        if ( major < UNIX98_NR_MAJORS ) {
                                devpts_pty_kill( tty->index + tty->driver->name_base );
                        }
index 06184a0df09f0c4eae646c33bbff8850927861db..8298988afaf50b558626a5a3d9f94e46cc56d7af 100644 (file)
@@ -838,7 +838,7 @@ static int init_dev(struct tty_driver *driver, int idx,
        if(!tty)
                goto fail_no_mem;
        initialize_tty_struct(tty);
-       tty->device = mk_kdev(driver->major, driver->minor_start + idx);
+       tty->device = MKDEV(driver->major, driver->minor_start) + idx;
        tty->driver = driver;
        tty->index = idx;
        tty_line_name(driver, idx, tty->name);
@@ -866,8 +866,8 @@ static int init_dev(struct tty_driver *driver, int idx,
                if (!o_tty)
                        goto free_mem_out;
                initialize_tty_struct(o_tty);
-               o_tty->device = mk_kdev(driver->other->major,
-                                       driver->other->minor_start + idx);
+               o_tty->device = MKDEV(driver->other->major,
+                                       driver->other->minor_start) + idx;
                o_tty->driver = driver->other;
                o_tty->index = idx;
                tty_line_name(driver->other, idx, o_tty->name);
@@ -1321,7 +1321,7 @@ retry_open:
        if (IS_TTY_DEV(device)) {
                if (!current->tty)
                        return -ENXIO;
-               device = current->tty->device;
+               device = to_kdev_t(current->tty->device);
                filp->f_flags |= O_NONBLOCK; /* Don't let /dev/tty block */
                /* noctty = 1; */
        }
index 5a437dca6e77551bbbf85e1b8290ad12a3fdbb37..4a5564b33304af53eac043b74e7eee6a7094bc2a 100644 (file)
@@ -722,7 +722,7 @@ static void sl_sync(void)
 
 /* Find a free SLIP channel, and link in this `tty' line. */
 static struct slip *
-sl_alloc(kdev_t line)
+sl_alloc(dev_t line)
 {
        struct slip *sl;
        slip_ctrl_t *slp = NULL;
@@ -739,7 +739,7 @@ sl_alloc(kdev_t line)
                        break;
 
                if (slp->ctrl.leased) {
-                       if (!kdev_same(slp->ctrl.line, line))
+                       if (slp->ctrl.line != line)
                                continue;
                        if (slp->ctrl.tty)
                                return NULL;
@@ -753,7 +753,7 @@ sl_alloc(kdev_t line)
                        continue;
 
                if (current->pid == slp->ctrl.pid) {
-                       if (kdev_same(slp->ctrl.line, line) && score < 3) {
+                       if (slp->ctrl.line == line && score < 3) {
                                sel = i;
                                score = 3;
                                continue;
@@ -764,7 +764,7 @@ sl_alloc(kdev_t line)
                        }
                        continue;
                }
-               if (kdev_same(slp->ctrl.line, line) && score < 1) {
+               if (slp->ctrl.line == line && score < 1) {
                        sel = i;
                        score = 1;
                        continue;
@@ -941,7 +941,7 @@ slip_close(struct tty_struct *tty)
        tty->disc_data = 0;
        sl->tty = NULL;
        if (!sl->leased)
-               sl->line = NODEV;
+               sl->line = 0;
 
        /* VSV = very important to remove timers */
 #ifdef CONFIG_SLIP_SMART
index bbd82fda55c832a91a656873dca9242662d37385..524297033053e4532655b5e23ec3ec9c2e5d8171 100644 (file)
@@ -100,7 +100,7 @@ struct slip {
 
   unsigned char                mode;           /* SLIP mode                    */
   unsigned char                leased;
-  kdev_t               line;
+  dev_t                        line;
   pid_t                        pid;
 #define SL_MODE_SLIP   0
 #define SL_MODE_CSLIP  1
index 186864bb7898958df499e320e520d23b76a0fc77..643ccd392f23c699a86a002565ef4ec2ba6c52ba 100644 (file)
@@ -303,7 +303,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
                atomic_inc(&mm->mm_users);
        if (task->tty) {
                tty_pgrp = task->tty->pgrp;
-               tty_nr = kdev_t_to_nr(task->tty->device);
+               tty_nr = task->tty->device;
        }
        task_unlock(task);
        if (mm) {
index eaa682168a7a60e38fadb01ad22f699c3383a40e..d7948e7ad0ebdf746cf47cc56acb2afc32ca7cd0 100644 (file)
@@ -266,7 +266,7 @@ struct tty_struct {
        char name[64];
        int pgrp;
        int session;
-       kdev_t  device;
+       dev_t   device;
        unsigned long flags;
        int count;
        struct winsize winsize;
index 47736b0fb8e5c6106dfe763edc6471619aede52d..2de6d736f7d89b4be5642054bd48cd8f44d01ecb 100644 (file)
@@ -335,7 +335,7 @@ static void do_acct_process(long exitcode, struct file *file)
        ac.ac_stime = encode_comp_t(current->stime);
        ac.ac_uid = current->uid;
        ac.ac_gid = current->gid;
-       ac.ac_tty = (current->tty) ? kdev_t_to_nr(current->tty->device) : 0;
+       ac.ac_tty = current->tty ? current->tty->device : 0;
 
        ac.ac_flag = 0;
        if (current->flags & PF_FORKNOEXEC)