Commit 7f904771 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] prepare for 32-bit dev_t: tty usage

	tty->device had been used only in a couple of places and can be
calculated by tty->index and tty->driver.  Field removed, its users switched
to static inline dev_t tty_devnum(tty).
parent 59dffd62
......@@ -35,7 +35,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(real_tty->device, ptr);
return put_user(tty_devnum(real_tty), ptr);
}
......
......@@ -826,7 +826,6 @@ static int init_dev(struct tty_driver *driver, int idx,
if(!tty)
goto fail_no_mem;
initialize_tty_struct(tty);
tty->device = MKDEV(driver->major, driver->minor_start) + idx;
tty->driver = driver;
tty->index = idx;
tty_line_name(driver, idx, tty->name);
......@@ -854,8 +853,6 @@ 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 = 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);
......
......@@ -869,12 +869,12 @@ slip_open(struct tty_struct *tty)
/* OK. Find a free SLIP channel to use. */
err = -ENFILE;
if ((sl = sl_alloc(tty->device)) == NULL)
if ((sl = sl_alloc(tty_devnum(tty))) == NULL)
goto err_exit;
sl->tty = tty;
tty->disc_data = sl;
sl->line = tty->device;
sl->line = tty_devnum(tty);
sl->pid = current->pid;
if (tty->driver->flush_buffer)
tty->driver->flush_buffer(tty);
......
......@@ -306,7 +306,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
mm = mmgrab(mm);
if (task->tty) {
tty_pgrp = task->tty->pgrp;
tty_nr = task->tty->device;
tty_nr = tty_devnum(task->tty);
}
task_unlock(task);
if (mm) {
......
......@@ -264,7 +264,6 @@ struct tty_struct {
char name[64];
int pgrp;
int session;
dev_t device;
unsigned long flags;
int count;
struct winsize winsize;
......@@ -419,5 +418,10 @@ extern void console_print(const char *);
extern int vt_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg);
static inline dev_t tty_devnum(struct tty_struct *tty)
{
return MKDEV(tty->driver->major, tty->driver->minor_start) + tty->index;
}
#endif /* __KERNEL__ */
#endif
......@@ -342,7 +342,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 ? current->tty->device : 0;
ac.ac_tty = current->tty ? tty_devnum(current->tty) : 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