Constification
This commit is contained in:
@@ -373,8 +373,8 @@ elnkR3HardReset(threec501_t *dev)
|
||||
static __inline int
|
||||
padr_match(threec501_t *dev, const uint8_t *buf)
|
||||
{
|
||||
struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result;
|
||||
const struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result;
|
||||
|
||||
/* Checks own + broadcast as well as own + multicast. */
|
||||
result = (dev->RcvCmd.adr_match >= EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, dev->aStationAddr, 6);
|
||||
@@ -388,9 +388,9 @@ padr_match(threec501_t *dev, const uint8_t *buf)
|
||||
static __inline int
|
||||
padr_bcast(threec501_t *dev, const uint8_t *buf)
|
||||
{
|
||||
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6);
|
||||
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
const struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ threec503_ram_write(uint32_t addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
threec503_ram_read(uint32_t addr, void *priv)
|
||||
{
|
||||
threec503_t *dev = (threec503_t *) priv;
|
||||
const threec503_t *dev = (threec503_t *) priv;
|
||||
|
||||
if ((addr & 0x3fff) >= 0x2000)
|
||||
return 0xff;
|
||||
|
||||
@@ -63,10 +63,10 @@ static int
|
||||
mcast_index(const void *dst)
|
||||
{
|
||||
#define POLYNOMIAL 0x04c11db6
|
||||
uint32_t crc = 0xffffffffL;
|
||||
int carry;
|
||||
uint8_t b;
|
||||
uint8_t *ep = (uint8_t *) dst;
|
||||
uint32_t crc = 0xffffffffL;
|
||||
int carry;
|
||||
uint8_t b;
|
||||
const uint8_t *ep = (uint8_t *) dst;
|
||||
|
||||
for (int8_t i = 6; --i >= 0;) {
|
||||
b = *ep++;
|
||||
@@ -409,7 +409,7 @@ dp8390_rx_common(void *priv, uint8_t *buf, int io_len)
|
||||
int
|
||||
dp8390_rx(void *priv, uint8_t *buf, int io_len)
|
||||
{
|
||||
dp8390_t *dev = (dp8390_t *) priv;
|
||||
const dp8390_t *dev = (dp8390_t *) priv;
|
||||
|
||||
if ((dev->DCR.loop == 0) || (dev->TCR.loop_cntl != 0))
|
||||
return 0;
|
||||
|
||||
@@ -149,7 +149,7 @@ nelog(int lvl, const char *fmt, ...)
|
||||
static void
|
||||
nic_interrupt(void *priv, int set)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
if (dev->is_pci) {
|
||||
if (set)
|
||||
@@ -527,7 +527,7 @@ nic_pnp_read_vendor_reg(uint8_t ld, uint8_t reg, void *priv)
|
||||
if (ld != 0)
|
||||
return 0x00;
|
||||
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
switch (reg) {
|
||||
case 0xF0:
|
||||
@@ -634,8 +634,8 @@ nic_update_bios(nic_t *dev)
|
||||
static uint8_t
|
||||
nic_pci_read(UNUSED(int func), int addr, void *priv)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
uint8_t ret = 0x00;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
uint8_t ret = 0x00;
|
||||
|
||||
switch (addr) {
|
||||
case 0x00: /* PCI_VID_LO */
|
||||
@@ -842,7 +842,7 @@ nic_rom_init(nic_t *dev, char *s)
|
||||
static uint8_t
|
||||
nic_mca_read(int port, void *priv)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
return (dev->pos_regs[port & 7]);
|
||||
}
|
||||
@@ -907,7 +907,7 @@ nic_mca_write(int port, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
nic_mca_feedb(void *priv)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
return (dev->pos_regs[2] & 0x01);
|
||||
}
|
||||
|
||||
@@ -747,9 +747,9 @@ static const uint32_t crctab[256] =
|
||||
static __inline int
|
||||
padr_match(nic_t *dev, const uint8_t *buf, UNUSED(int size))
|
||||
{
|
||||
struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result;
|
||||
uint8_t padr[6];
|
||||
const struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result;
|
||||
uint8_t padr[6];
|
||||
|
||||
padr[0] = dev->aCSR[12] & 0xff;
|
||||
padr[1] = dev->aCSR[12] >> 8;
|
||||
@@ -772,9 +772,9 @@ padr_match(nic_t *dev, const uint8_t *buf, UNUSED(int size))
|
||||
static __inline int
|
||||
padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size))
|
||||
{
|
||||
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6);
|
||||
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
const struct ether_header *hdr = (struct ether_header *) buf;
|
||||
int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6);
|
||||
|
||||
pcnet_log(3, "%s: padr_bcast result=%d\n", dev->name, result);
|
||||
|
||||
@@ -784,7 +784,7 @@ padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size))
|
||||
static int
|
||||
ladr_match(nic_t *dev, const uint8_t *buf, UNUSED(size_t size))
|
||||
{
|
||||
struct ether_header *hdr = (struct ether_header *) buf;
|
||||
const struct ether_header *hdr = (struct ether_header *) buf;
|
||||
|
||||
if ((hdr->ether_dhost[0] & 0x01) && ((uint64_t *) &dev->aCSR[8])[0] != 0LL) {
|
||||
int index;
|
||||
@@ -1271,14 +1271,14 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size)
|
||||
++;
|
||||
pcnet_log(2, "%s: pcnetReceiveNoSync: packet missed\n", dev->name);
|
||||
} else {
|
||||
RTNETETHERHDR *pEth = (RTNETETHERHDR *) buf;
|
||||
int fStrip = 0;
|
||||
size_t len_802_3;
|
||||
uint8_t *src = &dev->abRecvBuf[8];
|
||||
uint32_t crda = CSR_CRDA(dev);
|
||||
uint32_t next_crda;
|
||||
RMD rmd;
|
||||
RMD next_rmd;
|
||||
const RTNETETHERHDR *pEth = (RTNETETHERHDR *) buf;
|
||||
int fStrip = 0;
|
||||
size_t len_802_3;
|
||||
uint8_t *src = &dev->abRecvBuf[8];
|
||||
uint32_t crda = CSR_CRDA(dev);
|
||||
uint32_t next_crda;
|
||||
RMD rmd;
|
||||
RMD next_rmd;
|
||||
|
||||
/*
|
||||
* Ethernet framing considers these two octets to be
|
||||
@@ -1305,8 +1305,8 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size)
|
||||
while (size < 60)
|
||||
src[size++] = 0;
|
||||
|
||||
uint32_t fcs = UINT32_MAX;
|
||||
uint8_t *p = src;
|
||||
uint32_t fcs = UINT32_MAX;
|
||||
const uint8_t *p = src;
|
||||
|
||||
while (p != &src[size])
|
||||
CRC(fcs, *p++);
|
||||
@@ -1316,7 +1316,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size)
|
||||
size += 4;
|
||||
}
|
||||
|
||||
cbPacket = (int) size;
|
||||
cbPacket = size;
|
||||
|
||||
pcnetRmdLoad(dev, &rmd, PHYSADDR(dev, crda), 0);
|
||||
/* if (!CSR_LAPPEN(dev)) */
|
||||
@@ -2648,7 +2648,7 @@ pcnet_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
pcnet_pci_read(UNUSED(int func), int addr, void *priv)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
pcnet_log(4, "%s: Read to register %02X\n", dev->name, addr & 0xff);
|
||||
|
||||
@@ -2760,7 +2760,7 @@ pcnet_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv)
|
||||
static uint8_t
|
||||
pcnet_pnp_read_vendor_reg(uint8_t ld, uint8_t reg, void *priv)
|
||||
{
|
||||
nic_t *dev = (nic_t *) priv;
|
||||
const nic_t *dev = (nic_t *) priv;
|
||||
|
||||
if (!ld && (reg == 0xf0))
|
||||
return dev->aPROM[50];
|
||||
|
||||
@@ -368,7 +368,7 @@ plip_write_ctrl(uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
plip_read_status(void *priv)
|
||||
{
|
||||
plip_t *dev = (plip_t *) priv;
|
||||
const plip_t *dev = (plip_t *) priv;
|
||||
|
||||
plip_log(3, "PLIP: read_status() = %02X\n", dev->status);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ static const int we_int_table[4] = { 2, 3, 4, 7 };
|
||||
static void
|
||||
wd_interrupt(void *priv, int set)
|
||||
{
|
||||
wd_t *dev = (wd_t *) priv;
|
||||
const wd_t *dev = (wd_t *) priv;
|
||||
|
||||
if (!(dev->irr & WE_IRR_ENABLE_IRQ))
|
||||
return;
|
||||
@@ -180,7 +180,7 @@ wd_soft_reset(void *priv)
|
||||
static uint8_t
|
||||
wd_ram_read(uint32_t addr, void *priv)
|
||||
{
|
||||
wd_t *dev = (wd_t *) priv;
|
||||
const wd_t *dev = (wd_t *) priv;
|
||||
|
||||
wdlog("WD80x3: RAM Read: addr=%06x, val=%02x\n", addr & (dev->ram_size - 1), dev->dp8390->mem[addr & (dev->ram_size - 1)]);
|
||||
return dev->dp8390->mem[addr & (dev->ram_size - 1)];
|
||||
@@ -520,7 +520,7 @@ wd_io_remove(wd_t *dev, uint16_t addr)
|
||||
static uint8_t
|
||||
wd_mca_read(int port, void *priv)
|
||||
{
|
||||
wd_t *dev = (wd_t *) priv;
|
||||
const wd_t *dev = (wd_t *) priv;
|
||||
|
||||
return (dev->pos_regs[port & 7]);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ start_cap(char *dev)
|
||||
char temp[PCAP_ERRBUF_SIZE];
|
||||
struct pcap_pkthdr *hdr;
|
||||
const unsigned char *pkt;
|
||||
struct tm *ltime;
|
||||
const struct tm *ltime;
|
||||
time_t now;
|
||||
pcap_t *pcap;
|
||||
int rc;
|
||||
|
||||
Reference in New Issue
Block a user