- Consequently use "unsigned int", not "unsigned"
- Indent
- Sort headers
This commit is contained in:
Kim Woelders
2018-06-28 11:58:28 +02:00
parent ac76071e0e
commit 8956f3f851
2 changed files with 25 additions and 25 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ typedef struct {
unsigned int bytes_rx; /* Rx byte count */ unsigned int bytes_rx; /* Rx byte count */
unsigned char mode_telnet; /* Telnet mode */ unsigned char mode_telnet; /* Telnet mode */
unsigned char mode_rfc2217; /* RFC-2217 mode */ unsigned char mode_rfc2217; /* RFC-2217 mode */
unsigned char telnet_ack[256]; /* telnet option ack counter */ unsigned char telnet_ack[256]; /* telnet option ack counter */
} tn_ctx_t; } tn_ctx_t;
extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx, extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx,
@@ -30,11 +30,11 @@ extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx,
extern int telnet_open(tn_ctx_t * tcc); extern int telnet_open(tn_ctx_t * tcc);
extern int telnet_rx(tn_ctx_t * tcc, char *buf, size_t *plen); extern int telnet_rx(tn_ctx_t * tcc, char *buf, size_t * plen);
extern int telnet_tx(tn_ctx_t * tcc, const char *buf, int len); extern int telnet_tx(tn_ctx_t * tcc, const char *buf, int len);
extern void telnet_set_opt(tn_ctx_t * tcc, int opt, int prm, extern void telnet_set_opt(tn_ctx_t * tcc, int opt, int prm,
const void *val, int len); const void *val, int len);
extern void telnet_rfc2217_handle_opt(tn_ctx_t * tcc, int opt, extern void telnet_rfc2217_handle_opt(tn_ctx_t * tcc, int opt,
unsigned char *pu, int nd); unsigned char *pu, int nd);
+22 -22
View File
@@ -5,28 +5,27 @@
#include "config.h" #include "config.h"
#include <cuse_lowlevel.h> #include <cuse_lowlevel.h>
#include <errno.h>
#include <fcntl.h>
#include <fuse_opt.h> #include <fuse_opt.h>
#include <netdb.h>
#include <pthread.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <syslog.h>
#include <sys/socket.h> #include <termios.h>
#include <time.h>
#include <unistd.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <pthread.h>
#include <sys/poll.h>
#include <signal.h>
#include <termios.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <time.h> #include <sys/poll.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "telnet.h" #include "telnet.h"
@@ -128,7 +127,7 @@ static void ttynvt_update_notify(ttynvt_t * tty, struct fuse_pollhandle *ph)
fuse_pollhandle_destroy(tmp_ph); fuse_pollhandle_destroy(tmp_ph);
} }
static unsigned ttynvt_write_avail(ttynvt_t * tty) static unsigned int ttynvt_write_avail(ttynvt_t * tty)
{ {
size_t write_avail; size_t write_avail;
int used; int used;
@@ -250,7 +249,7 @@ static int ttynvt_connect(const char *host, unsigned int port)
(sockfd, (const struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0) (sockfd, (const struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0)
{ {
ttynvt_log("ERROR: failed to connect to: %s:%u:%s\n", ttynvt_log("ERROR: failed to connect to: %s:%u:%s\n",
host, port, strerror(errno)); host, port, strerror(errno));
return -1; return -1;
} }
return sockfd; return sockfd;
@@ -484,7 +483,7 @@ static const char pstr[] = { ' ', 'N', 'O', 'E', 'M', 'S' };
static void static void
ttynvt_ioctl(fuse_req_t req, int cmd, void *arg, ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
struct fuse_file_info *info, unsigned flags, struct fuse_file_info *info, unsigned int flags,
const void *in_buf, size_t in_bufsz, size_t out_bufsz) const void *in_buf, size_t in_bufsz, size_t out_bufsz)
{ {
ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh; ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh;
@@ -558,7 +557,8 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
telnet_rfc2217_ctl(tty->tn, TNS_CTL_DTR_ON); telnet_rfc2217_ctl(tty->tn, TNS_CTL_DTR_ON);
} }
ttynvt_log("CFG ioctl: %u%c%u%u %cCTSRTS %cCREAD %cHUPCL %cCLOCAL\n", ttynvt_log
("CFG ioctl: %u%c%u%u %cCTSRTS %cCREAD %cHUPCL %cCLOCAL\n",
baudrate(speed), pstr[par], csize, sb, baudrate(speed), pstr[par], csize, sb,
tio.c_cflag & CRTSCTS ? '+' : '-', tio.c_cflag & CRTSCTS ? '+' : '-',
tio.c_cflag & CREAD ? '+' : '-', tio.c_cflag & CREAD ? '+' : '-',
@@ -777,12 +777,12 @@ static const struct cuse_lowlevel_ops ttynvt_op = {
#define TTYNET_OPT(t, p, v) { t, offsetof(struct ttynvt_param, p), v } #define TTYNET_OPT(t, p, v) { t, offsetof(struct ttynvt_param, p), v }
struct ttynvt_param { struct ttynvt_param {
unsigned major; unsigned int major;
unsigned minor; unsigned int minor;
char *dev_name; char *dev_name;
char *logfile; char *logfile;
char *host; char *host;
unsigned port; unsigned int port;
}; };
static const struct fuse_opt ttynvt_opts[] = { static const struct fuse_opt ttynvt_opts[] = {