Commit 2b4107a8 authored by Alexander Viro's avatar Alexander Viro Committed by Christoph Hellwig

[PATCH] tty cleanups (11/12)

	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.
parent 50dceaae
......@@ -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);
}
......
......@@ -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 );
}
......
......@@ -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 @@ static int tty_open(struct inode * inode, struct file * filp)
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; */
}
......
......@@ -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
......
......@@ -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
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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)
......
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