From ff0eea7e58b77e868294431fc16a02b743725cde Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 27 Jan 2017 14:22:37 +0100 Subject: hdlcutil: Remove HDRVC_KERNEL ifdefery. HDRVC_KERNEL was always defined to on. Signed-off-by: Ralf Baechle --- hdlcutil/fl/xfhdlcst_main.cxx | 6 ------ hdlcutil/hdrvcomm.c | 32 -------------------------------- hdlcutil/hdrvcomm.h | 8 -------- hdlcutil/sethdlc.c | 10 ---------- 4 files changed, 56 deletions(-) (limited to 'hdlcutil') diff --git a/hdlcutil/fl/xfhdlcst_main.cxx b/hdlcutil/fl/xfhdlcst_main.cxx index 421805a..da2f2bc 100644 --- a/hdlcutil/fl/xfhdlcst_main.cxx +++ b/hdlcutil/fl/xfhdlcst_main.cxx @@ -76,9 +76,7 @@ int main(int argc, char *argv[]) int c, i; int ret; struct hdrvc_channel_state cs; -#ifdef HDRVC_KERNEL struct sm_ioctl smi; -#endif /* HDRVC_KERNEL */ char buf[32]; char name[64]; @@ -126,10 +124,8 @@ int main(int argc, char *argv[]) /* * check for soundmodem driver */ -#ifdef HDRVC_KERNEL ret = hdrvc_sm_ioctl(SMCTL_GETDEBUG, &smi); if (ret < 0) { -#endif /* HDRVC_KERNEL */ tdemodcyc->hide(); tmodcyc->hide(); tintfreq->hide(); @@ -138,9 +134,7 @@ int main(int argc, char *argv[]) modcyc->hide(); intfreq->hide(); dmares->hide(); -#ifdef HDRVC_KERNEL } -#endif /* HDRVC_KERNEL */ hdlcst->show(); for (;;) { Fl::wait(); diff --git a/hdlcutil/hdrvcomm.c b/hdlcutil/hdrvcomm.c index c362c1b..7acc74d 100644 --- a/hdlcutil/hdrvcomm.c +++ b/hdlcutil/hdrvcomm.c @@ -62,9 +62,7 @@ /* ---------------------------------------------------------------------- */ -#ifdef HDRVC_KERNEL static int kernel_mode = 1; -#endif /* HDRVC_KERNEL */ static const char *if_name = "bcsf0"; static char *prg_name; static int fd = -1; @@ -77,14 +75,12 @@ static int msqid = -1; static void terminate(void) { -#ifdef HDRVC_KERNEL if (kernel_mode) { if (ioctl(fd, SIOCSIFFLAGS, &ifr_h) < 0) { perror("ioctl (SIOCSIFFLAGS)"); exit(1); } } -#endif /* HDRVC_KERNEL */ exit(0); } @@ -104,7 +100,6 @@ int hdrvc_recvpacket(char *pkt, int maxlen) struct sockaddr_ll from; socklen_t from_len = sizeof(from); -#ifdef HDRVC_KERNEL if (kernel_mode) { if (!promisc) { if (afpacket) { @@ -158,7 +153,6 @@ int hdrvc_recvpacket(char *pkt, int maxlen) return 0; return recvfrom(fd, pkt, maxlen, 0, (struct sockaddr *)&from, &from_len); } -#endif /* HDRVC_KERNEL */ return -1; } @@ -188,7 +182,6 @@ void hdrvc_args(int *argc, char *argv[], const char *def_if) return; prg_name = argv[0]; for (i = 1; i < ac-1; i++) { -#ifdef HDRVC_KERNEL if (!strcmp(argv[i], "-i")) { kernel_mode = 1; if_name = argv[i+1]; @@ -197,11 +190,8 @@ void hdrvc_args(int *argc, char *argv[], const char *def_if) memmove(argv+i, argv+i+2, (ac-i) * sizeof(void *)); i--; } else -#endif /* HDRVC_KERNEL */ if (!strcmp(argv[i], "-u")) { -#ifdef HDRVC_KERNEL kernel_mode = 0; -#endif /* HDRVC_KERNEL */ if_name = argv[i+1]; ac -= 2; if (i < ac) @@ -219,7 +209,6 @@ void hdrvc_init(void) key_t k; static struct ifreq ifr; -#ifdef HDRVC_KERNEL if (kernel_mode) { strcpy(ifr_h.ifr_name, if_name); /* first try to use AF_PACKET */ @@ -252,7 +241,6 @@ void hdrvc_init(void) } return; } -#endif /* HDRVC_KERNEL */ k = ftok(if_name, USERSM_KEY_PROJ); if (k == (key_t)-1) { fprintf(stderr, "%s: Error %s (%i), cannot ftok on %s\n", prg_name, @@ -300,7 +288,6 @@ int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type) /* ---------------------------------------------------------------------- */ -#ifdef HDRVC_KERNEL int hdrvc_hdlcdrv_ioctl(int cmd, struct hdlcdrv_ioctl *par) { @@ -402,7 +389,6 @@ int hdrvc_diag(struct sm_diag_data *diag) return 0; } -#endif /* HDRVC_KERNEL */ /* ---------------------------------------------------------------------- */ @@ -411,14 +397,12 @@ int hdrvc_get_samples(void) int ret; struct hdlcdrv_ioctl bi; -#ifdef HDRVC_KERNEL if (kernel_mode) { ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETSAMPLES, &bi); if (ret < 0) return ret; return bi.data.bits & 0xff; } -#endif /* HDRVC_KERNEL */ errno = EAGAIN; return -1; } @@ -430,14 +414,12 @@ int hdrvc_get_bits(void) int ret; struct hdlcdrv_ioctl bi; -#ifdef HDRVC_KERNEL if (kernel_mode) { ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETBITS, &bi); if (ret < 0) return ret; return bi.data.bits & 0xff; } -#endif /* HDRVC_KERNEL */ errno = EAGAIN; return -1; } @@ -450,7 +432,6 @@ int hdrvc_get_channel_access_param(struct hdrvc_channel_params *par) int ret; struct usersmmsg msg; -#ifdef HDRVC_KERNEL if (kernel_mode) { if ((ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETCHANNELPAR, &hi)) < 0) return ret; @@ -465,7 +446,6 @@ int hdrvc_get_channel_access_param(struct hdrvc_channel_params *par) par->fulldup = hi.data.cp.fulldup; return 0; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_REQ_CHACCESS_PAR; msg.hdr.channel = 0; hdrvc_sendmsg(&msg, 0); @@ -491,7 +471,6 @@ int hdrvc_set_channel_access_param(struct hdrvc_channel_params par) int ret; struct usersmmsg msg; -#ifdef HDRVC_KERNEL if (kernel_mode) { struct hdlcdrv_ioctl hi; @@ -504,7 +483,6 @@ int hdrvc_set_channel_access_param(struct hdrvc_channel_params par) return ret; return 0; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_SET_CHACCESS_PAR; msg.hdr.channel = 0; msg.data.cp.tx_delay = par.tx_delay; @@ -523,12 +501,10 @@ int hdrvc_calibrate(int calib) struct hdlcdrv_ioctl bhi; struct usersmmsg msg; -#ifdef HDRVC_KERNEL if (kernel_mode) { bhi.data.calibrate = calib; return hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_CALIBRATE, &bhi); } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_CALIBRATE; msg.hdr.channel = 0; msg.data.calib = calib; @@ -548,7 +524,6 @@ int hdrvc_get_channel_state(struct hdrvc_channel_state *st) errno = EINVAL; return -1; } -#ifdef HDRVC_KERNEL if (kernel_mode) { ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETSTAT, &bhi); if (ret >= 0) { @@ -562,7 +537,6 @@ int hdrvc_get_channel_state(struct hdrvc_channel_state *st) } return ret; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_REQ_CHANNELSTATE; msg.hdr.channel = 0; hdrvc_sendmsg(&msg, 0); @@ -599,7 +573,6 @@ int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data, errno = EINVAL; return -1; } -#ifdef HDRVC_KERNEL if (kernel_mode) { struct sm_ioctl smi; static unsigned int modeconvsm[4] = { @@ -619,7 +592,6 @@ int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data, return 0; return smi.data.diag.datalen; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_REQ_DIAG; msg.hdr.channel = 0; msg.data.diag.mode = modeconvusersm[mode]; @@ -651,7 +623,6 @@ int hdrvc_get_driver_name(char *buf, int bufsz) int ret; struct usersmmsg msg; -#ifdef HDRVC_KERNEL if (kernel_mode) { struct hdlcdrv_ioctl bhi; @@ -661,7 +632,6 @@ int hdrvc_get_driver_name(char *buf, int bufsz) strncpy(buf, bhi.data.modename, bufsz); return 0; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_REQ_DRVNAME; msg.hdr.channel = 0; hdrvc_sendmsg(&msg, 0); @@ -686,7 +656,6 @@ int hdrvc_get_mode_name(char *buf, int bufsz) int ret; struct usersmmsg msg; -#ifdef HDRVC_KERNEL if (kernel_mode) { struct hdlcdrv_ioctl bhi; @@ -696,7 +665,6 @@ int hdrvc_get_mode_name(char *buf, int bufsz) strncpy(buf, bhi.data.modename, bufsz); return 0; } -#endif /* HDRVC_KERNEL */ msg.hdr.type = USERSM_CMD_REQ_DRVMODE; msg.hdr.channel = 0; hdrvc_sendmsg(&msg, 0); diff --git a/hdlcutil/hdrvcomm.h b/hdlcutil/hdrvcomm.h index 520f2d9..ba1b74c 100644 --- a/hdlcutil/hdrvcomm.h +++ b/hdlcutil/hdrvcomm.h @@ -36,15 +36,9 @@ extern "C" { /* ---------------------------------------------------------------------- */ -#define HDRVC_KERNEL 1 - -/* ---------------------------------------------------------------------- */ - -#ifdef HDRVC_KERNEL #include #include "soundmodem.h" #include -#endif /* HDRVC_KERNEL */ /* ---------------------------------------------------------------------- */ @@ -102,12 +96,10 @@ extern int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data, unsig extern int hdrvc_get_driver_name(char *buf, int bufsz); extern int hdrvc_get_mode_name(char *buf, int bufsz); -#ifdef HDRVC_KERNEL extern int hdrvc_hdlcdrv_ioctl(int cmd, struct hdlcdrv_ioctl *par); extern int hdrvc_sm_ioctl(int cmd, struct sm_ioctl *par); extern int hdrvc_baycom_ioctl(int cmd, struct baycom_ioctl *par); extern int hdrvc_diag(struct sm_diag_data *diag); -#endif /* HDRVC_KERNEL */ /* ---------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c index e88d0b5..0684d60 100644 --- a/hdlcutil/sethdlc.c +++ b/hdlcutil/sethdlc.c @@ -237,7 +237,6 @@ static void print_bits(int (*bitproc)(void)) /* ---------------------------------------------------------------------- */ -#ifdef HDRVC_KERNEL static void do_set_params(int argc, char **argv) { @@ -375,7 +374,6 @@ static void do_set_params(int argc, char **argv) exit(0); } -#endif /* HDRVC_KERNEL */ /* ---------------------------------------------------------------------- */ @@ -466,9 +464,7 @@ static const char *usage_str = " -d: trace dcd and ptt status on stdout\n" " -i: specify the name of the baycom kernel driver interface\n" " -c: calibrate (i.e. send calibration pattern) for cal seconds\n" -#ifdef HDRVC_KERNEL " -p: set or display interface parameters\n" -#endif /* HDRVC_KERNEL */ " -h: this help\n\n"; int main(int argc, char *argv[]) @@ -499,11 +495,9 @@ int main(int argc, char *argv[]) case 'd': trace_stat = 1; break; -#ifdef HDRVC_KERNEL case 'p': getsetparams = 1; break; -#endif /* HDRVC_KERNEL */ case 'a': getsetparams = 2; break; @@ -518,9 +512,7 @@ int main(int argc, char *argv[]) } hdrvc_init(); if (getsetparams == 1) { -#ifdef HDRVC_KERNEL do_set_params(argc - optind, argv+optind); -#endif /* HDRVC_KERNEL */ exit(0); } if (getsetparams == 2) { @@ -549,7 +541,6 @@ int main(int argc, char *argv[]) chst.dcd ? 'D' : '-', chst.ptt ? 'P' : '-', chst.rx_packets, chst.tx_packets, chst.rx_errors, chst.tx_errors); -#ifdef HDRVC_KERNEL if (hdrvc_sm_ioctl(SMCTL_GETDEBUG, &bsi) >= 0) { printf(" intrate: %u modcyc: %u " "demodcyc: %u dmares: %u", @@ -563,7 +554,6 @@ int main(int argc, char *argv[]) bbi.data.dbg.debug1, bbi.data.dbg.debug2, bbi.data.dbg.debug3); } -#endif /* HDRVC_KERNEL */ printf("\n"); break; case 2: -- cgit v1.2.3