From: Arnd Bergmann <arndb@de.ibm.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] 17/18 support arbitrary devfs names for tty devices
Date: Mon, 5 Aug 2002 20:04:03 +0200 [thread overview]
Message-ID: <200208051959.53644.arndb@de.ibm.com> (raw)
In-Reply-To: <200208051830.50713.arndb@de.ibm.com>
This patch introduces two functions tty_io. They are needed by the 3270 driver
to generate the correct entries in the device file system. We do not want
the 3270 device to get device names according to their minor number but
we want to see the real device number. If the device file system is not
used this can be replaced by a call to tty_register_devfs.
diff -urN linux-2.4.19-rc3/drivers/char/tty_io.c linux-2.4.19-s390/drivers/char/tty_io.c
--- linux-2.4.19-rc3/drivers/char/tty_io.c Tue Jul 30 09:02:27 2002
+++ linux-2.4.19-s390/drivers/char/tty_io.c Tue Jul 30 09:02:43 2002
@@ -2058,8 +2058,63 @@
#endif /* CONFIG_DEVFS_FS */
}
+/*
+ * Register a tty device described by <driver>, with minor number <minor>,
+ * device name <name> and in the /dev directory given by <dir>.
+ */
+void tty_register_devfs_name (struct tty_driver *driver, unsigned int flags,
+ unsigned minor, devfs_handle_t dir,
+ const char *name)
+{
+#ifdef CONFIG_DEVFS_FS
+ umode_t mode = S_IFCHR | S_IRUSR | S_IWUSR;
+ kdev_t device = MKDEV (driver->major, minor);
+
+ switch (device) {
+ case TTY_DEV:
+ case PTMX_DEV:
+ mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ break;
+ default:
+ if (driver->major == PTY_MASTER_MAJOR)
+ flags |= DEVFS_FL_AUTO_OWNER;
+ break;
+ }
+ if ( (minor < driver->minor_start) ||
+ (minor >= driver->minor_start + driver->num) ) {
+ printk(KERN_ERR "Attempt to register invalid minor number "
+ "with devfs (%d:%d).\n", (int)driver->major,(int)minor);
+ return;
+ }
+# ifdef CONFIG_UNIX98_PTYS
+ if ( (driver->major >= UNIX98_PTY_SLAVE_MAJOR) &&
+ (driver->major < UNIX98_PTY_SLAVE_MAJOR + UNIX98_NR_MAJORS) )
+ flags |= DEVFS_FL_CURRENT_OWNER;
+# endif
+ devfs_register (dir, name, flags | DEVFS_FL_DEFAULT,
+ driver->major, minor, mode, &tty_fops, NULL);
+#endif /* CONFIG_DEVFS_FS */
+}
+
+void tty_unregister_devfs_name (struct tty_driver *driver, unsigned minor,
+ devfs_handle_t dir, const char *name)
+{
+#ifdef CONFIG_DEVFS_FS
+ void * handle;
+
+ handle = devfs_find_handle (dir, name, driver->major, minor,
+ DEVFS_SPECIAL_CHR, 0);
+ devfs_unregister (handle);
+#endif /* CONFIG_DEVFS_FS */
+}
+
+extern void tty_unregister_devfs_name (struct tty_driver *driver,
+ unsigned minor, devfs_handle_t dir,
+ const char *name);
EXPORT_SYMBOL(tty_register_devfs);
EXPORT_SYMBOL(tty_unregister_devfs);
+EXPORT_SYMBOL(tty_register_devfs_name);
+EXPORT_SYMBOL(tty_unregister_devfs_name);
/*
* Called by a tty driver to register itself.
diff -urN linux-2.4.19-rc3/include/linux/tty.h linux-2.4.19-s390/include/linux/tty.h
--- linux-2.4.19-rc3/include/linux/tty.h Thu Nov 22 20:46:19 2001
+++ linux-2.4.19-s390/include/linux/tty.h Tue Jul 30 09:01:23 2002
@@ -381,6 +381,13 @@
extern void tty_register_devfs (struct tty_driver *driver, unsigned int flags,
unsigned minor);
extern void tty_unregister_devfs (struct tty_driver *driver, unsigned minor);
+struct devfs_entry;
+extern void tty_register_devfs_name (struct tty_driver *driver,
+ unsigned int flags, unsigned minor,
+ struct devfs_entry *dir, const char *name);
+extern void tty_unregister_devfs_name (struct tty_driver *driver,
+ unsigned minor, struct devfs_entry *dir,
+ const char *name);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
extern void tty_write_message(struct tty_struct *tty, char *msg);
next prev parent reply other threads:[~2002-08-05 16:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-05 18:12 0/18 2.4.19 architecture updates for s390 following Arnd Bergmann
2002-08-05 17:47 ` [PATCH] 12/18 console_unblank bug fix Arnd Bergmann
2002-08-05 17:48 ` [PATCH] 13/18 Export elevator_init Arnd Bergmann
2002-08-05 17:50 ` [PATCH] 14/18 support for partition labels in devfs Arnd Bergmann
2002-08-05 17:14 ` Christoph Hellwig
2002-08-05 17:54 ` [PATCH] 15/18 better pte invalidation Arnd Bergmann
2002-08-05 17:01 ` Christoph Hellwig
2002-08-06 11:05 ` Arnd Bergmann
2002-08-06 9:43 ` Christoph Hellwig
2002-08-10 12:28 ` Paul Mackerras
2002-08-05 17:56 ` [PATCH] 16/18 add more possible root devices Arnd Bergmann
2002-08-05 17:15 ` Christoph Hellwig
2002-08-06 11:23 ` Arnd Bergmann
2002-08-05 18:04 ` Arnd Bergmann [this message]
2002-08-05 18:08 ` [PATCH] 18/18 scsi core changes Arnd Bergmann
2002-08-05 17:12 ` Christoph Hellwig
2002-08-06 11:06 ` Arnd Bergmann
2002-08-06 9:18 ` Christoph Hellwig
2002-08-06 23:10 ` Ingo Adlung
2002-08-06 23:12 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200208051959.53644.arndb@de.ibm.com \
--to=arndb@de.ibm.com \
--cc=arnd@bergmann-dalldorf.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox