Rewrite some functions to ANSI style.

This commit is contained in:
Kees van Reeuwijk 2010-01-27 10:19:13 +00:00
parent e0f7043e04
commit c6eb51d66a
17 changed files with 71 additions and 145 deletions

View file

@ -20,18 +20,18 @@
#define SECTOR_SIZE 512
enum {
typedef enum {
ST_NIL, /* Zero checksums */
ST_XOR, /* XOR-based checksums */
ST_CRC, /* CRC32-based checksums */
ST_MD5 /* MD5-based checksums */
};
} checksum_type;
enum {
typedef enum {
FLT_WRITE, /* write to up to two disks */
FLT_READ, /* read from one disk */
FLT_READ2 /* read from both disks */
};
} disk_operation;
/* Something was wrong and the disk driver has been restarted/refreshed,
* so the request needs to be redone.
@ -43,13 +43,13 @@ enum {
* BD_PROTO: a protocol error has occurred. Refresh it.
* BD_DATA: a data error has occurred. Refresh it.
*/
enum {
typedef enum {
BD_NONE,
BD_DEAD,
BD_PROTO,
BD_DATA,
BD_LAST
};
} driver_state;
#define DRIVER_MAIN 0
#define DRIVER_BACKUP 1

View file

@ -1,11 +1,11 @@
#ifndef _OPTSET_H
#define _OPTSET_H
enum {
typedef enum {
OPT_BOOL,
OPT_STRING,
OPT_INT
};
} opt_type;
/* An entry for the parser of an options set. The 'os_name' field must point
* to a string, which is treated case-insensitively; the last entry of a table
@ -20,7 +20,7 @@ enum {
*/
struct optset {
char *os_name;
int os_type;
opt_type os_type;
void *os_ptr;
int os_val;
};

View file

@ -24,7 +24,6 @@
#include "floppy.h"
#include <timers.h>
#include <assert.h>
#include <ibm/diskparm.h>
#include <minix/sysutil.h>
#include <minix/syslib.h>

View file

@ -42,7 +42,6 @@
#include "../drivers.h"
#include <minix/keymap.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>

View file

@ -18,7 +18,6 @@
#include "../drivers.h"
#include "../libdriver/driver.h"
#include <sys/ioc_memory.h>
#include <env.h>
#include <minix/ds.h>
#include <minix/vm.h>
#include <sys/mman.h>
@ -26,11 +25,8 @@
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include <sys/vm.h>
#include <sys/vm_i386.h>
#include "assert.h"
#include "local.h"
/* ramdisks (/dev/ram*) */

View file

@ -14,8 +14,8 @@ for initializing a character array in C.
#include <string.h>
#include <unistd.h>
char *progname;
unsigned char buf[1024];
static char *progname;
static unsigned char buf[1024];
static void fatal(char *fmt, ...);
static void usage(void);

View file

@ -37,12 +37,8 @@
*/
#include "hermes.h"
#include <sys/vm.h>
#include "assert.h"
#include <ibm/pci.h>
#include "string.h"
int this_proc;
PRIVATE int this_proc;
/*****************************************************************************
* milli_delay *

View file

@ -55,13 +55,10 @@
#include "../drivers.h"
#include <string.h>
#include <stddef.h>
#include <minix/keymap.h>
#include <minix/syslib.h>
#include <minix/type.h>
#include <minix/sysutil.h>
#include <timers.h>
#include <sys/ioc_memory.h>
#include <ibm/pci.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
@ -96,7 +93,6 @@ static tmra_ut or_watchdog;
#include <net/gen/eth_io.h>
#include <sys/vm_i386.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

View file

@ -4,7 +4,6 @@ main.c
#include "../drivers.h"
#include <ibm/pci.h>
#include <minix/rs.h>
#include <minix/endpoint.h>

View file

@ -29,7 +29,6 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <minix/sysutil.h>
#define PBT_INTEL_HOST 1

View file

@ -5,7 +5,6 @@
#include "../drivers.h"
#include "../libdriver/driver.h"
#include <sys/ioc_memory.h>
#include <minix/type.h>
#include "assert.h"

View file

@ -11,10 +11,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <minix/com.h>
#include <minix/ds.h>
#include <minix/keymap.h>
#include <minix/syslib.h>
#include <minix/type.h>
#include <minix/sysutil.h>
@ -26,10 +24,8 @@
#include <ibm/pci.h>
#include <sys/types.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>
#include <sys/ioc_memory.h>
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"

View file

@ -233,8 +233,7 @@ PRIVATE int dsp_close()
/*===========================================================================*
* dsp_ioctl
*===========================================================================*/
PRIVATE int dsp_ioctl(m_ptr)
message *m_ptr;
PRIVATE int dsp_ioctl(message *m_ptr)
{
int status;
phys_bytes user_phys;
@ -274,8 +273,7 @@ message *m_ptr;
/*===========================================================================*
* dsp_write
*===========================================================================*/
PRIVATE void dsp_write(m_ptr)
message *m_ptr;
PRIVATE void dsp_write(message *m_ptr)
{
int s;
message mess;
@ -381,8 +379,8 @@ PRIVATE void dsp_hardware_msg()
/*===========================================================================*
* dsp_status *
*===========================================================================*/
PRIVATE void dsp_status(m_ptr)
message *m_ptr; /* pointer to the newly arrived message */
PRIVATE void dsp_status(message *m_ptr)
/* m_ptr pointer to the newly arrived message */
{
if(revivePending) {
m_ptr->m_type = DEV_REVIVE; /* build message */
@ -404,11 +402,7 @@ message *m_ptr; /* pointer to the newly arrived message */
/*===========================================================================*
* reply *
*===========================================================================*/
PRIVATE void reply(code, replyee, process, status)
int code;
int replyee;
int process;
int status;
PRIVATE void reply(int code, int replyee, int process, int status)
{
message m;
@ -491,8 +485,7 @@ PRIVATE int dsp_reset()
/*===========================================================================*
* dsp_command
*===========================================================================*/
PRIVATE int dsp_command(value)
int value;
PRIVATE int dsp_command(int value)
{
int i, status;
@ -511,8 +504,7 @@ int value;
/*===========================================================================*
* dsp_set_size
*===========================================================================*/
static int dsp_set_size(size)
unsigned int size;
static int dsp_set_size(unsigned int size)
{
dprint("dsp_set_size(): set fragment size to %u\n", size);
@ -530,8 +522,7 @@ unsigned int size;
/*===========================================================================*
* dsp_set_speed
*===========================================================================*/
static int dsp_set_speed(speed)
unsigned int speed;
static int dsp_set_speed(unsigned int speed)
{
dprint("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo);
@ -562,8 +553,7 @@ unsigned int speed;
/*===========================================================================*
* dsp_set_stereo
*===========================================================================*/
static int dsp_set_stereo(stereo)
unsigned int stereo;
static int dsp_set_stereo(unsigned int stereo)
{
if(stereo) {
DspStereo = 1;
@ -578,8 +568,7 @@ unsigned int stereo;
/*===========================================================================*
* dsp_set_bits
*===========================================================================*/
static int dsp_set_bits(bits)
unsigned int bits;
static int dsp_set_bits(unsigned int bits)
{
/* Sanity checks */
if(bits != 8 && bits != 16) {
@ -595,8 +584,7 @@ unsigned int bits;
/*===========================================================================*
* dsp_set_sign
*===========================================================================*/
static int dsp_set_sign(sign)
unsigned int sign;
static int dsp_set_sign(unsigned int sign)
{
dprint("sb16: set sign to %u\n", sign);
@ -609,9 +597,7 @@ unsigned int sign;
/*===========================================================================*
* dsp_dma_setup
*===========================================================================*/
PRIVATE void dsp_dma_setup(address, count)
phys_bytes address;
int count;
PRIVATE void dsp_dma_setup(phys_bytes address, int count)
{
pvb_pair_t pvb[9];

View file

@ -109,8 +109,7 @@ PRIVATE void sef_local_startup()
/*=========================================================================*
* mixer_open
*=========================================================================*/
PRIVATE int mixer_open(m_ptr)
message *m_ptr;
PRIVATE int mixer_open(message *m_ptr)
{
dprint("mixer_open\n");
@ -124,8 +123,7 @@ message *m_ptr;
/*=========================================================================*
* mixer_close
*=========================================================================*/
PRIVATE int mixer_close(m_ptr)
message *m_ptr;
PRIVATE int mixer_close(message *m_ptr)
{
dprint("mixer_close\n");
@ -136,8 +134,7 @@ message *m_ptr;
/*=========================================================================*
* mixer_ioctl
*=========================================================================*/
PRIVATE int mixer_ioctl(m_ptr)
message *m_ptr;
PRIVATE int mixer_ioctl(message *m_ptr)
{
int status;
@ -188,8 +185,7 @@ PRIVATE int mixer_init()
/*=========================================================================*
* mixer_get
*=========================================================================*/
PRIVATE int mixer_get(reg)
int reg;
PRIVATE int mixer_get(int reg)
{
int i;
@ -202,9 +198,8 @@ int reg;
/*=========================================================================*
* get_set_volume *
*=========================================================================*/
PRIVATE int get_set_volume(m_ptr, flag)
message *m_ptr;
int flag; /* 0 = get, 1 = set */
PRIVATE int get_set_volume(message *m_ptr, int flag)
/* flag 0 = get, 1 = set */
{
phys_bytes user_phys;
struct volume_level level;
@ -286,10 +281,11 @@ int flag; /* 0 = get, 1 = set */
/*=========================================================================*
* get_set_input *
*=========================================================================*/
PRIVATE int get_set_input(m_ptr, flag, channel)
message *m_ptr;
int flag; /* 0 = get, 1 = set */
int channel; /* 0 = left, 1 = right */
PRIVATE int get_set_input(message *m_ptr, int flag, int channel)
/*
* flag 0 = get, 1 = set
* channel 0 = left, 1 = right
*/
{
phys_bytes user_phys;
struct inout_ctrl input;
@ -351,9 +347,8 @@ int channel; /* 0 = left, 1 = right */
/*=========================================================================*
* get_set_output *
*=========================================================================*/
PRIVATE int get_set_output(m_ptr, flag)
message *m_ptr;
int flag; /* 0 = get, 1 = set */
PRIVATE int get_set_output(message *m_ptr, int flag)
/* flag 0 = get, 1 = set */
{
phys_bytes user_phys;
struct inout_ctrl output;

View file

@ -6,7 +6,6 @@ Created: Dec 2005 by Philip Homburg
#include "../drivers.h"
#include <ibm/pci.h>
#include <sys/vm.h>
#include <sys/vm_i386.h>
#include "ti1225.h"

View file

@ -82,9 +82,7 @@ FORWARD _PROTOTYPE( int pty_select, (tty_t *tp, message *m) );
/*===========================================================================*
* do_pty *
*===========================================================================*/
PUBLIC void do_pty(tp, m_ptr)
tty_t *tp;
message *m_ptr;
PUBLIC void do_pty(tty_t *tp, message *m_ptr)
{
/* Perform an open/close/read/write call on a /dev/ptypX device. */
pty_t *pp = tp->tty_priv;
@ -203,9 +201,7 @@ message *m_ptr;
/*===========================================================================*
* pty_write *
*===========================================================================*/
PRIVATE int pty_write(tp, try)
tty_t *tp;
int try;
PRIVATE int pty_write(tty_t *tp, int try)
{
/* (*dev_write)() routine for PTYs. Transfer bytes from the writer on
* /dev/ttypX to the output buffer.
@ -289,9 +285,7 @@ int try;
/*===========================================================================*
* pty_echo *
*===========================================================================*/
PRIVATE void pty_echo(tp, c)
tty_t *tp;
int c;
PRIVATE void pty_echo(tty_t *tp, int c)
{
/* Echo one character. (Like pty_write, but only one character, optionally.) */
@ -314,8 +308,7 @@ int c;
/*===========================================================================*
* pty_start *
*===========================================================================*/
PRIVATE void pty_start(pp)
pty_t *pp;
PRIVATE void pty_start(pty_t *pp)
{
/* Transfer bytes written to the output buffer to the PTY reader. */
int count;
@ -355,8 +348,7 @@ pty_t *pp;
/*===========================================================================*
* pty_finish *
*===========================================================================*/
PRIVATE void pty_finish(pp)
pty_t *pp;
PRIVATE void pty_finish(pty_t *pp)
{
/* Finish the read request of a PTY reader if there is at least one byte
* transferred.
@ -375,9 +367,7 @@ pty_t *pp;
/*===========================================================================*
* pty_read *
*===========================================================================*/
PRIVATE int pty_read(tp, try)
tty_t *tp;
int try;
PRIVATE int pty_read(tty_t *tp, int try)
{
/* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at
* a time, 99% of the writes will be for one byte, so no sense in being smart.)
@ -448,9 +438,7 @@ int try;
/*===========================================================================*
* pty_close *
*===========================================================================*/
PRIVATE int pty_close(tp, try)
tty_t *tp;
int try;
PRIVATE int pty_close(tty_t *tp, int try)
{
/* The tty side has closed, so shut down the pty side. */
pty_t *pp = tp->tty_priv;
@ -475,9 +463,7 @@ int try;
/*===========================================================================*
* pty_icancel *
*===========================================================================*/
PRIVATE int pty_icancel(tp, try)
tty_t *tp;
int try;
PRIVATE int pty_icancel(tty_t *tp, int try)
{
/* Discard waiting input. */
pty_t *pp = tp->tty_priv;
@ -494,9 +480,7 @@ int try;
/*===========================================================================*
* pty_ocancel *
*===========================================================================*/
PRIVATE int pty_ocancel(tp, try)
tty_t *tp;
int try;
PRIVATE int pty_ocancel(tty_t *tp, int try)
{
/* Drain the output buffer. */
pty_t *pp = tp->tty_priv;
@ -510,8 +494,7 @@ int try;
/*===========================================================================*
* pty_init *
*===========================================================================*/
PUBLIC void pty_init(tp)
tty_t *tp;
PUBLIC void pty_init(tty_t *tp)
{
pty_t *pp;
int line;

View file

@ -212,9 +212,7 @@ PRIVATE int my_inb(port_t port)
/*===========================================================================*
* rs_write *
*===========================================================================*/
PRIVATE int rs_write(tp, try)
register tty_t *tp;
int try;
PRIVATE int rs_write(register tty_t *tp, int try)
{
/* (*devwrite)() routine for RS232. */
@ -335,9 +333,8 @@ int c; /* character to echo */
/*===========================================================================*
* rs_ioctl *
*===========================================================================*/
PRIVATE int rs_ioctl(tp, dummy)
tty_t *tp; /* which TTY */
int dummy;
PRIVATE int rs_ioctl(tty_t *tp, int dummy)
/* tp; which TTY */
{
/* Reconfigure the line as soon as the output has drained. */
rs232_t *rs = tp->tty_priv;
@ -349,8 +346,8 @@ int dummy;
/*===========================================================================*
* rs_config *
*===========================================================================*/
PRIVATE void rs_config(rs)
rs232_t *rs; /* which line */
PRIVATE void rs_config(rs232_t *rs)
/* rs which line */
{
/* Set various line control parameters for RS232 I/O.
* If DataBits == 5 and StopBits == 2, 8250 will generate 1.5 stop bits.
@ -435,8 +432,8 @@ rs232_t *rs; /* which line */
/*===========================================================================*
* rs_init *
*===========================================================================*/
PUBLIC void rs_init(tp)
tty_t *tp; /* which TTY */
PUBLIC void rs_init(tty_t *tp)
/* tp which TTY */
{
unsigned long dummy;
/* Initialize RS232 for one line. */
@ -539,8 +536,7 @@ tty_t *tp; /* which TTY */
/*===========================================================================*
* rs_interrupt *
*===========================================================================*/
PUBLIC void rs_interrupt(m)
message *m; /* which TTY */
PUBLIC void rs_interrupt(message *m)
{
unsigned long irq_set;
int i;
@ -557,9 +553,7 @@ message *m; /* which TTY */
/*===========================================================================*
* rs_icancel *
*===========================================================================*/
PRIVATE int rs_icancel(tp, dummy)
tty_t *tp; /* which TTY */
int dummy;
PRIVATE int rs_icancel(tty_t *tp, int dummy)
{
/* Cancel waiting input. */
rs232_t *rs = tp->tty_priv;
@ -576,9 +570,7 @@ int dummy;
/*===========================================================================*
* rs_ocancel *
*===========================================================================*/
PRIVATE int rs_ocancel(tp, dummy)
tty_t *tp; /* which TTY */
int dummy;
PRIVATE int rs_ocancel(tty_t *tp, int dummy)
{
/* Cancel pending output. */
rs232_t *rs = tp->tty_priv;
@ -595,9 +587,7 @@ int dummy;
/*===========================================================================*
* rs_read *
*===========================================================================*/
PRIVATE int rs_read(tp, try)
tty_t *tp; /* which tty */
int try;
PRIVATE int rs_read(tty_t *tp, int try)
{
/* Process characters from the circular input buffer. */
@ -644,8 +634,7 @@ int try;
/*===========================================================================*
* rs_ostart *
*===========================================================================*/
PRIVATE void rs_ostart(rs)
rs232_t *rs; /* which rs line */
PRIVATE void rs_ostart(rs232_t *rs)
{
/* Tell RS232 there is something waiting in the output buffer. */
@ -656,9 +645,7 @@ rs232_t *rs; /* which rs line */
/*===========================================================================*
* rs_break *
*===========================================================================*/
PRIVATE int rs_break(tp, dummy)
tty_t *tp; /* which tty */
int dummy;
PRIVATE int rs_break(tty_t *tp, int dummy)
{
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
rs232_t *rs = tp->tty_priv;
@ -676,9 +663,7 @@ int dummy;
/*===========================================================================*
* rs_close *
*===========================================================================*/
PRIVATE int rs_close(tp, dummy)
tty_t *tp; /* which tty */
int dummy;
PRIVATE int rs_close(tty_t *tp, int dummy)
{
/* The line is closed; optionally hang up. */
rs232_t *rs = tp->tty_priv;
@ -694,8 +679,7 @@ int dummy;
/*===========================================================================*
* rs232_handler *
*===========================================================================*/
PRIVATE void rs232_handler(rs)
struct rs232 *rs;
PRIVATE void rs232_handler(struct rs232 *rs)
{
/* Interrupt hander for RS232. */
@ -728,8 +712,8 @@ struct rs232 *rs;
/*===========================================================================*
* in_int *
*===========================================================================*/
PRIVATE void in_int(rs)
register rs232_t *rs; /* line with input interrupt */
PRIVATE void in_int(register rs232_t *rs)
/* rs line with input interrupt */
{
/* Read the data which just arrived.
* If it is the oxoff char, clear OSWREADY, else if OSWREADY was clear, set
@ -776,8 +760,8 @@ register rs232_t *rs; /* line with input interrupt */
/*===========================================================================*
* line_int *
*===========================================================================*/
PRIVATE void line_int(rs)
register rs232_t *rs; /* line with line status interrupt */
PRIVATE void line_int(register rs232_t *rs)
/* rs line with line status interrupt */
{
/* Check for and record errors. */
@ -793,8 +777,8 @@ register rs232_t *rs; /* line with line status interrupt */
/*===========================================================================*
* modem_int *
*===========================================================================*/
PRIVATE void modem_int(rs)
register rs232_t *rs; /* line with modem interrupt */
PRIVATE void modem_int(register rs232_t *rs)
/* rs line with modem interrupt */
{
/* Get possibly new device-ready status, and clear ODEVREADY if necessary.
* If the device just became ready, restart output.
@ -817,8 +801,8 @@ register rs232_t *rs; /* line with modem interrupt */
/*===========================================================================*
* out_int *
*===========================================================================*/
PRIVATE void out_int(rs)
register rs232_t *rs; /* line with output interrupt */
PRIVATE void out_int(register rs232_t *rs)
/* rs; line with output interrupt */
{
/* If there is output to do and everything is ready, do it (local device is
* known ready).