Fix style(9) issue in TTY header files: document function argument names.

According to style(9), function argument names should only be omitted
for prototypes that are exported to userspace. This means we should
document the function arguments in the TTY header files, because they
are only used in userspace.

While there, change the type of the buffer argument of
ttydisc_rint_bypass() to `const void *' instead of `char *'.

Requested by:	attilio
Obtained from:	//depot/projects/mpsafetty/...
This commit is contained in:
Ed Schouten 2008-09-22 18:44:09 +00:00
parent c750e17cf5
commit d344ffe549
5 changed files with 75 additions and 69 deletions

View File

@ -1035,7 +1035,7 @@ print:
}
size_t
ttydisc_rint_bypass(struct tty *tp, char *buf, size_t len)
ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len)
{
size_t ret;

View File

@ -144,51 +144,52 @@ struct xtty {
#ifdef _KERNEL
/* Allocation and deallocation. */
struct tty *tty_alloc(struct ttydevsw *, void *, struct mtx *);
void tty_rel_pgrp(struct tty *, struct pgrp *);
void tty_rel_sess(struct tty *, struct session *);
void tty_rel_gone(struct tty *);
struct tty *tty_alloc(struct ttydevsw *tsw, void *softc, struct mtx *mtx);
void tty_rel_pgrp(struct tty *tp, struct pgrp *pgrp);
void tty_rel_sess(struct tty *tp, struct session *sess);
void tty_rel_gone(struct tty *tp);
#define tty_lock(tp) mtx_lock((tp)->t_mtx)
#define tty_unlock(tp) mtx_unlock((tp)->t_mtx)
#define tty_lock_assert(tp,ma) mtx_assert((tp)->t_mtx, (ma))
/* Device node creation. */
void tty_makedev(struct tty *, struct ucred *, const char *, ...)
void tty_makedev(struct tty *tp, struct ucred *cred, const char *fmt, ...)
__printflike(3, 4);
#define tty_makealias(tp,fmt,...) \
make_dev_alias((tp)->t_dev, fmt, ## __VA_ARGS__)
/* Signalling processes. */
void tty_signal_sessleader(struct tty *, int);
void tty_signal_pgrp(struct tty *, int);
void tty_signal_sessleader(struct tty *tp, int signal);
void tty_signal_pgrp(struct tty *tp, int signal);
/* Waking up readers/writers. */
int tty_wait(struct tty *, struct cv *);
int tty_timedwait(struct tty *, struct cv *, int);
void tty_wakeup(struct tty *, int);
int tty_wait(struct tty *tp, struct cv *cv);
int tty_timedwait(struct tty *tp, struct cv *cv, int timo);
void tty_wakeup(struct tty *tp, int flags);
/* System messages. */
int tty_checkoutq(struct tty *);
int tty_putchar(struct tty *, char);
int tty_checkoutq(struct tty *tp);
int tty_putchar(struct tty *tp, char c);
int tty_ioctl(struct tty *, u_long, void *, struct thread *);
int tty_ioctl_compat(struct tty *, u_long, caddr_t, struct thread *);
void tty_init_console(struct tty *, speed_t);
void tty_flush(struct tty *, int);
void tty_hiwat_in_block(struct tty *);
void tty_hiwat_in_unblock(struct tty *);
dev_t tty_udev(struct tty *);
int tty_ioctl(struct tty *tp, u_long cmd, void *data, struct thread *td);
int tty_ioctl_compat(struct tty *tp, u_long cmd, caddr_t data,
struct thread *td);
void tty_init_console(struct tty *tp, speed_t speed);
void tty_flush(struct tty *tp, int flags);
void tty_hiwat_in_block(struct tty *tp);
void tty_hiwat_in_unblock(struct tty *tp);
dev_t tty_udev(struct tty *tp);
#define tty_opened(tp) ((tp)->t_flags & TF_OPENED)
#define tty_gone(tp) ((tp)->t_flags & TF_GONE)
#define tty_softc(tp) ((tp)->t_softc)
#define tty_devname(tp) devtoname((tp)->t_dev)
/* Status line printing. */
void tty_info(struct tty *);
void tty_info(struct tty *tp);
/* Pseudo-terminal hooks. */
int pts_alloc_external(int, struct thread *, struct file *,
struct cdev *, const char *);
int pts_alloc_external(int fd, struct thread *td, struct file *fp,
struct cdev *dev, const char *name);
/* Drivers and line disciplines also need to call these. */
#include <sys/ttydevsw.h>

View File

@ -40,16 +40,18 @@
* Driver routines that are called from the line discipline to adjust
* hardware parameters and such.
*/
typedef int tsw_open_t(struct tty *);
typedef void tsw_close_t(struct tty *);
typedef void tsw_outwakeup_t(struct tty *);
typedef void tsw_inwakeup_t(struct tty *);
typedef int tsw_ioctl_t(struct tty *, u_long, caddr_t, struct thread *);
typedef int tsw_param_t(struct tty *, struct termios *);
typedef int tsw_modem_t(struct tty *, int, int);
typedef int tsw_mmap_t(struct tty *, vm_offset_t, vm_paddr_t *, int);
typedef void tsw_pktnotify_t(struct tty *, char);
typedef void tsw_free_t(void *);
typedef int tsw_open_t(struct tty *tp);
typedef void tsw_close_t(struct tty *tp);
typedef void tsw_outwakeup_t(struct tty *tp);
typedef void tsw_inwakeup_t(struct tty *tp);
typedef int tsw_ioctl_t(struct tty *tp, u_long cmd, caddr_t data,
struct thread *td);
typedef int tsw_param_t(struct tty *tp, struct termios *t);
typedef int tsw_modem_t(struct tty *tp, int sigon, int sigoff);
typedef int tsw_mmap_t(struct tty *tp, vm_offset_t offset,
vm_paddr_t * paddr, int nprot);
typedef void tsw_pktnotify_t(struct tty *tp, char event);
typedef void tsw_free_t(void *softc);
struct ttydevsw {
unsigned int tsw_flags; /* Default TTY flags. */

View File

@ -42,20 +42,20 @@ struct tty;
struct uio;
/* Top half routines. */
void ttydisc_open(struct tty *);
void ttydisc_close(struct tty *);
int ttydisc_read(struct tty *, struct uio *, int);
int ttydisc_write(struct tty *, struct uio *, int);
void ttydisc_optimize(struct tty *);
void ttydisc_open(struct tty *tp);
void ttydisc_close(struct tty *tp);
int ttydisc_read(struct tty *tp, struct uio *uio, int ioflag);
int ttydisc_write(struct tty *tp, struct uio *uio, int ioflag);
void ttydisc_optimize(struct tty *tp);
/* Bottom half routines. */
void ttydisc_modem(struct tty *, int);
void ttydisc_modem(struct tty *tp, int open);
#define ttydisc_can_bypass(tp) ((tp)->t_flags & TF_BYPASS)
int ttydisc_rint(struct tty *, char, int);
size_t ttydisc_rint_bypass(struct tty *, char *, size_t);
void ttydisc_rint_done(struct tty *);
size_t ttydisc_getc(struct tty *, void *, size_t);
int ttydisc_getc_uio(struct tty *, struct uio *);
int ttydisc_rint(struct tty *tp, char c, int flags);
size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len);
void ttydisc_rint_done(struct tty *tp);
size_t ttydisc_getc(struct tty *tp, void *buf, size_t len);
int ttydisc_getc_uio(struct tty *tp, struct uio *uio);
/* Error codes for ttydisc_rint(). */
#define TRE_FRAMING 0x01

View File

@ -69,19 +69,22 @@ struct ttyoutq {
#ifdef _KERNEL
/* Input queue handling routines. */
void ttyinq_setsize(struct ttyinq *, struct tty *, size_t);
void ttyinq_free(struct ttyinq *);
int ttyinq_read_uio(struct ttyinq *, struct tty *, struct uio *,
size_t, size_t);
size_t ttyinq_write(struct ttyinq *, const void *, size_t, int);
int ttyinq_write_nofrag(struct ttyinq *, const void *, size_t, int);
void ttyinq_canonicalize(struct ttyinq *);
size_t ttyinq_findchar(struct ttyinq *, const char *, size_t, char *);
void ttyinq_flush(struct ttyinq *);
int ttyinq_peekchar(struct ttyinq *, char *, int *);
void ttyinq_unputchar(struct ttyinq *);
void ttyinq_reprintpos_set(struct ttyinq *);
void ttyinq_reprintpos_reset(struct ttyinq *);
void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);
void ttyinq_free(struct ttyinq *ti);
int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio,
size_t readlen, size_t flushlen);
size_t ttyinq_write(struct ttyinq *ti, const void *buf, size_t len,
int quote);
int ttyinq_write_nofrag(struct ttyinq *ti, const void *buf, size_t len,
int quote);
void ttyinq_canonicalize(struct ttyinq *ti);
size_t ttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen,
char *lastc);
void ttyinq_flush(struct ttyinq *ti);
int ttyinq_peekchar(struct ttyinq *ti, char *c, int *quote);
void ttyinq_unputchar(struct ttyinq *ti);
void ttyinq_reprintpos_set(struct ttyinq *ti);
void ttyinq_reprintpos_reset(struct ttyinq *ti);
static __inline void
ttyinq_init(struct ttyinq *ti)
@ -125,20 +128,20 @@ ttyinq_bytesline(struct ttyinq *ti)
}
/* Input buffer iteration. */
typedef void ttyinq_line_iterator_t(void *, char, int);
void ttyinq_line_iterate_from_linestart(struct ttyinq *,
ttyinq_line_iterator_t *, void *);
void ttyinq_line_iterate_from_reprintpos(struct ttyinq *,
ttyinq_line_iterator_t *, void *);
typedef void ttyinq_line_iterator_t(void *data, char c, int flags);
void ttyinq_line_iterate_from_linestart(struct ttyinq *ti,
ttyinq_line_iterator_t *iterator, void *data);
void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti,
ttyinq_line_iterator_t *iterator, void *data);
/* Output queue handling routines. */
void ttyoutq_flush(struct ttyoutq *);
void ttyoutq_setsize(struct ttyoutq *, struct tty *, size_t);
void ttyoutq_free(struct ttyoutq *);
size_t ttyoutq_read(struct ttyoutq *, void *, size_t);
int ttyoutq_read_uio(struct ttyoutq *, struct tty *, struct uio *);
size_t ttyoutq_write(struct ttyoutq *, const void *, size_t);
int ttyoutq_write_nofrag(struct ttyoutq *, const void *, size_t);
void ttyoutq_flush(struct ttyoutq *to);
void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);
void ttyoutq_free(struct ttyoutq *to);
size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len);
int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio);
size_t ttyoutq_write(struct ttyoutq *to, const void *buf, size_t len);
int ttyoutq_write_nofrag(struct ttyoutq *to, const void *buf, size_t len);
static __inline void
ttyoutq_init(struct ttyoutq *to)