Replace time_t values in libsa sources with the following two types

to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
 numbers in seconds returned by the machine dependent getsecs() function
 which are used to measure relative time

saseconds_t (currently int):
 numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
This commit is contained in:
tsutsui 2009-01-12 11:32:43 +00:00
parent ab4ced3e93
commit 69cf32a782
62 changed files with 208 additions and 198 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getsecs.c,v 1.8 2009/01/12 11:04:00 tsutsui Exp $ */
/* $NetBSD: getsecs.c,v 1.9 2009/01/12 11:32:43 tsutsui Exp $ */
#include <sys/param.h>
@ -11,7 +11,7 @@
#include "include/prom.h"
#include "include/rpb.h"
time_t
satime_t
getsecs(void)
{
static uint64_t tnsec;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_prom.c,v 1.19 2003/03/13 14:15:58 drochner Exp $ */
/* $NetBSD: if_prom.c,v 1.20 2009/01/12 11:32:43 tsutsui Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
@ -93,10 +93,10 @@ prom_put(struct iodesc *desc, void *pkt, size_t len)
}
static int
prom_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
prom_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
{
prom_return_t ret;
time_t t;
satime_t t;
int cc;
char hate[2000];

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.3 2008/04/28 20:23:16 martin Exp $ */
/* $NetBSD: clock.c,v 1.4 2009/01/12 11:32:43 tsutsui Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@ delay(int ms)
__insn_barrier();
}
time_t
satime_t
getsecs(void)
{
volatile uint8_t *mcclock_reg, *mcclock_data;
@ -77,5 +77,5 @@ getsecs(void)
*mcclock_reg = MC_HOUR;
sec += bcdtobin(*mcclock_data) * 60 * 60;
return (time_t)sec;
return (satime_t)sec;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nif_tlp.c,v 1.2 2008/04/28 20:23:16 martin Exp $ */
/* $NetBSD: nif_tlp.c,v 1.3 2009/01/12 11:32:43 tsutsui Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -49,7 +49,7 @@
static int tlp_match(struct netif *, void *);
static int tlp_probe(struct netif *, void *);
static void tlp_attach(struct iodesc *, void *);
static int tlp_get(struct iodesc *, void *, size_t, time_t);
static int tlp_get(struct iodesc *, void *, size_t, saseconds_t);
static int tlp_put(struct iodesc *, void *, size_t);
static void tlp_end(struct netif *);
@ -103,7 +103,7 @@ tlp_attach(struct iodesc *desc, void *hint)
}
int
tlp_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
tlp_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timeout)
{
int len;
struct netif *nif = desc->io_netif;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ether_if.c,v 1.4 2009/01/12 11:00:49 tsutsui Exp $ */
/* $NetBSD: ether_if.c,v 1.5 2009/01/12 11:32:43 tsutsui Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@ struct devsw netdevsw = {
int ether_match(struct netif *, void *);
int ether_probe(struct netif *, void *);
void ether_init(struct iodesc *, void *);
int ether_get(struct iodesc *, void *, size_t, time_t);
int ether_get(struct iodesc *, void *, size_t, saseconds_t);
int ether_put(struct iodesc *, void *, size_t);
void ether_end(struct netif *);
@ -109,7 +109,7 @@ ether_init(struct iodesc *iodesc, void *hint)
}
int
ether_get(struct iodesc *iodesc, void *pkt, size_t len, time_t timeout)
ether_get(struct iodesc *iodesc, void *pkt, size_t len, saseconds_t timeout)
{
return lance_get(pkt, len) ? len : -1;
@ -137,7 +137,7 @@ _rtt(void)
/* NOTREACHED */
}
time_t
satime_t
getsecs(void)
{
volatile uint8_t *mkclock;
@ -148,5 +148,5 @@ getsecs(void)
t += bcdtobin(*(mkclock + 8)) * 60;
t += bcdtobin(*(mkclock + 12)) * 60 * 60;
return (time_t)t;
return (satime_t)t;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.8 2006/06/25 17:35:12 tsutsui Exp $ */
/* $NetBSD: clock.c,v 1.9 2009/01/12 11:32:43 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -111,13 +111,13 @@ static const int month_days[12] = {
u_char bbc_registers[13];
struct hil_dev *bbcaddr = BBCADDR;
static int bbc_to_gmt(time_t *);
static int bbc_to_gmt(satime_t *);
time_t
satime_t
getsecs(void)
{
static int bbcinited = 0;
time_t timbuf = 0;
satime_t timbuf = 0;
if (!bbc_to_gmt(&timbuf) && !bbcinited)
printf("WARNING: bad date in battery clock\n");
@ -129,7 +129,7 @@ getsecs(void)
static int
bbc_to_gmt(time_t *timbuf)
bbc_to_gmt(satime_t *timbuf)
{
int i;
u_long tmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.10 2007/03/04 05:59:50 christos Exp $ */
/* $NetBSD: if_le.c,v 1.11 2009/01/12 11:32:43 tsutsui Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -75,7 +75,7 @@ struct le_sel {
int le_probe(struct netif *, void *);
int le_match(struct netif *, void *);
void le_init(struct iodesc *, void *);
int le_get(struct iodesc *, void *, size_t, time_t);
int le_get(struct iodesc *, void *, size_t, saseconds_t);
int le_put(struct iodesc *, void *, size_t);
void le_end(struct netif *);
@ -625,9 +625,9 @@ le_put(struct iodesc *desc, void *pkt, size_t len)
int
le_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
le_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
{
time_t t;
satime_t t;
int cc;
t = getsecs();

View File

@ -1,4 +1,4 @@
/* $NetBSD: tgets.c,v 1.5 2005/12/11 12:17:24 christos Exp $ */
/* $NetBSD: tgets.c,v 1.6 2009/01/12 11:32:43 tsutsui Exp $ */
/*-
* Copyright (c) 1993
@ -33,6 +33,7 @@
#include <sys/types.h>
#include <arch/hp700/stand/common/libsa.h>
#include <lib/libsa/net.h>
int tgets(char *);
@ -41,7 +42,7 @@ tgets(char *buf)
{
int c, i;
char *p, *lp = buf;
time_t seconds1, seconds2;
satime_t seconds1, seconds2;
seconds1 = getsecs();
for (i = 10; i > 0; ) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: libsa.h,v 1.5 2005/12/11 12:17:25 christos Exp $ */
/* $NetBSD: libsa.h,v 1.6 2009/01/12 11:32:44 tsutsui Exp $ */
/* $OpenBSD: libsa.h,v 1.7 1999/12/23 04:07:47 mickey Exp $ */
@ -50,7 +50,6 @@ int cngetc(void);
int tcngetc(void);
void cnputc(int);
void cninit(void);
time_t getsecs(void);
int tgetchar(void);
void pdc_init(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: time.c,v 1.2 2002/11/28 05:38:42 chs Exp $ */
/* $NetBSD: time.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
/* $OpenBSD: time.c,v 1.3 1999/02/13 04:43:18 mickey Exp $ */
@ -35,14 +35,15 @@
#include <sys/types.h>
#include <machine/pdc.h>
#include <sys/disklabel.h>
#include <lib/libsa/net.h>
#include "libsa.h"
#include "dev_hppa.h"
time_t
satime_t
getsecs(void)
{
int err;
time_t tt;
satime_t tt;
if ((err = (*pdc)(PDC_TOD, PDC_TOD_READ, &pdcbuf)) < 0) {
tt = 0;

View File

@ -1,15 +1,14 @@
/* $NetBSD: getsecs.c,v 1.3 2008/12/14 17:03:43 christos Exp $ */
/* $NetBSD: getsecs.c,v 1.4 2009/01/12 11:32:44 tsutsui Exp $ */
/* extracted from netbsd:sys/arch/i386/netboot/misc.c */
#include <sys/types.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
#include "libi386.h"
extern int biosgetrtc(u_long*);
static inline u_long bcd2dec(u_long);
static inline u_long
@ -18,14 +17,14 @@ bcd2dec(u_long arg)
return (arg >> 4) * 10 + (arg & 0x0f);
}
time_t
satime_t
getsecs(void) {
/*
* Return the current time in seconds
*/
u_long t;
time_t sec;
satime_t sec;
if (biosgetrtc(&t))
panic("RTC invalid");

View File

@ -1,4 +1,4 @@
/* $NetBSD: libi386.h,v 1.28 2008/12/13 23:30:54 christos Exp $ */
/* $NetBSD: libi386.h,v 1.29 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1996
@ -92,9 +92,6 @@ struct bootblk_command {
void bootmenu(void);
void docommand(char *);
/* getsecs.c */
time_t getsecs(void);
/* in "user code": */
void command_help(char *);
extern const struct bootblk_command commands[];

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_small.c,v 1.9 2008/12/14 18:46:33 christos Exp $ */
/* $NetBSD: netif_small.c,v 1.10 2009/01/12 11:32:44 tsutsui Exp $ */
/* minimal netif - for boot ROMs we don't have to select between
several interfaces, and we have to save space
@ -140,14 +140,14 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
int
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
int len;
time_t t;
satime_t t;
#ifdef NETIF_DEBUG
if (netif_debug)
printf("netif_get: pkt=%p, maxlen=%d, tmo=%ld\n",
printf("netif_get: pkt=%p, maxlen=%d, tmo=%d\n",
pkt, maxlen, timo);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pxe.c,v 1.11 2009/01/11 02:45:45 christos Exp $ */
/* $NetBSD: pxe.c,v 1.12 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -151,7 +151,7 @@ sendudp(struct iodesc *d, void *pkt, size_t len)
* Caller leaves room for the headers (Ether, IP, UDP).
*/
ssize_t
readudp(struct iodesc *d, void *pkt, size_t len, time_t tleft)
readudp(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
t_PXENV_UDP_READ *ur = (void *) pxe_command_buf;
struct udphdr *uh;

View File

@ -1,4 +1,4 @@
/* $NetBSD: getsecs.c,v 1.2 2006/09/11 13:48:57 nonaka Exp $ */
/* $NetBSD: getsecs.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
#include <sys/param.h>
#include <sys/types.h>
@ -164,14 +164,14 @@ rtc_write(uint32_t addr, uint8_t data)
rtc_ce(0);
}
time_t
satime_t
getsecs(void)
{
uint32_t sec, min, hour, day;
#if 0
uint32_t mon, year;
#endif
time_t secs;
satime_t secs;
sec = rtc_read(RS5C313_SEC1);
sec += rtc_read(RS5C313_SEC10) * 10;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_of.c,v 1.12 2009/01/12 07:05:22 tsutsui Exp $ */
/* $NetBSD: netif_of.c,v 1.13 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank.
@ -177,7 +177,7 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
struct of_dev *op;
int tick0, tmo_ms;
@ -221,8 +221,9 @@ netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
/*
* Shouldn't really be here, but is used solely for networking, so...
*/
time_t
satime_t
getsecs(void)
{
return OF_milliseconds() / 1000;
}

View File

@ -1,9 +1,10 @@
/* $NetBSD: clock.c,v 1.8 2008/01/12 09:54:32 tsutsui Exp $ */
/* $NetBSD: clock.c,v 1.9 2009/01/12 11:32:44 tsutsui Exp $ */
#include <sys/types.h>
#include <machine/prom.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
#include "libsa.h"
/*
@ -53,7 +54,7 @@ chiptotime(int sec, int min, int hour, int day, int mon, int year)
return days * SECDAY + hour * 3600 + min * 60 + sec;
}
time_t
satime_t
getsecs(void)
{
struct mvmeprom_time m;

View File

@ -1,4 +1,4 @@
/* $NetBSD: libsa.h,v 1.5 2008/01/12 09:54:32 tsutsui Exp $ */
/* $NetBSD: libsa.h,v 1.6 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* libsa prototypes
@ -14,7 +14,6 @@ int bugscstrategy(void *, int, daddr_t, size_t, void *, size_t *);
/* clock.c */
u_long chiptotime(int, int, int, int, int, int);
time_t getsecs(void);
/* exec_mvme.c */
void exec_mvme(char *, int, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie.c,v 1.12 2008/01/12 09:54:32 tsutsui Exp $ */
/* $NetBSD: if_ie.c,v 1.13 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@ -58,7 +58,7 @@ int ie_debug = 0;
void ie_stop(struct netif *);
void ie_end(struct netif *);
void ie_error(struct netif *, char *, volatile struct iereg *);
int ie_get(struct iodesc *, void *, size_t, time_t);
int ie_get(struct iodesc *, void *, size_t, saseconds_t);
void ie_init(struct iodesc *, void *);
int ie_match(struct netif *, void *);
int ie_poll(struct iodesc *, void *, int);
@ -400,9 +400,9 @@ ie_put(struct iodesc *desc, void *pkt, size_t len)
}
int
ie_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
ie_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
{
time_t t;
satime_t t;
int cc;
t = getsecs();

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.9 2008/01/12 09:54:32 tsutsui Exp $ */
/* $NetBSD: if_le.c,v 1.10 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@ -77,7 +77,7 @@ int le_debug = 0;
void le_end(struct netif *);
void le_error(struct netif *, char *, volatile struct lereg1 *);
int le_get(struct iodesc *, void *, size_t, time_t);
int le_get(struct iodesc *, void *, size_t, saseconds_t);
void le_init(struct iodesc *, void *);
int le_match(struct netif *, void *);
int le_poll(struct iodesc *, void *, int);
@ -399,9 +399,9 @@ le_put(struct iodesc *desc, void *pkt, size_t len)
}
int
le_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
le_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
{
time_t t;
satime_t t;
int cc;
t = getsecs();

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.1 2002/02/27 21:02:27 scw Exp $ */
/* $NetBSD: clock.c,v 1.2 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* This is a slightly modified version of mvme68k's standalone clock.c.
@ -9,6 +9,7 @@
#include <sys/types.h>
#include "stand.h"
#include "net.h"
#include "libsa.h"
#include "bugsyscalls.h"
@ -54,7 +55,7 @@ chiptotime(int sec, int min, int hour, int day, int mon, int year)
return (days * SECDAY + hour * 3600 + min * 60 + sec);
}
time_t
satime_t
getsecs()
{
struct bug_rtc_rd rr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bug.c,v 1.2 2008/04/28 20:23:30 martin Exp $ */
/* $NetBSD: if_bug.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@
static int bug_match(struct netif *, void *);
static int bug_probe(struct netif *, void *);
static void bug_init(struct iodesc *, void *);
static int bug_get(struct iodesc *, void *, size_t, time_t);
static int bug_get(struct iodesc *, void *, size_t, saseconds_t);
static int bug_put(struct iodesc *, void *, size_t);
static void bug_end(struct netif *);
@ -147,7 +147,7 @@ bug_get(desc, pkt, len, timeout)
struct iodesc *desc;
void *pkt;
size_t len;
time_t timeout;
saseconds_t timeout;
{
struct netif *nif = desc->io_netif;
struct bug_softc *sc = nif->nif_devdata;

View File

@ -1,4 +1,4 @@
/* $NetBSD: libsa.h,v 1.2 2008/04/28 20:23:30 martin Exp $ */
/* $NetBSD: libsa.h,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -33,9 +33,6 @@
* libsa prototypes
*/
/* clock.c */
time_t getsecs(void);
/* exec_mvme.c */
void exec_mvme(const char *, int, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_news.c,v 1.6 2005/12/11 12:18:25 christos Exp $ */
/* $NetBSD: netif_news.c,v 1.7 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -151,10 +151,10 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
struct romdev *pd;
int tick0;
satime_t tick0;
ssize_t len;
pd = (struct romdev *)desc->io_netif;
@ -206,7 +206,7 @@ prom_getether(struct romdev *pd, u_char *ea)
return 0;
}
time_t
satime_t
getsecs(void)
{
u_int t[2];

View File

@ -1,4 +1,4 @@
/* $NetBSD: en.c,v 1.14 2005/12/11 12:18:29 christos Exp $ */
/* $NetBSD: en.c,v 1.15 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1996 Rolf Grossmann
* All rights reserved.
@ -61,7 +61,7 @@ extern char *mg;
int en_match(struct netif *, void *);
int en_probe(struct netif *, void *);
void en_init(struct iodesc *, void *);
int en_get(struct iodesc *, void *, size_t, time_t);
int en_get(struct iodesc *, void *, size_t, saseconds_t);
int en_put(struct iodesc *, void *, size_t);
void en_end(struct netif *);
@ -273,7 +273,7 @@ en_put(struct iodesc *desc, void *pkt, size_t len)
}
int
en_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
en_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
{
volatile struct en_regs *er;
volatile struct dma_dev *rxdma;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtc.c,v 1.5 2006/03/08 03:29:49 christos Exp $ */
/* $NetBSD: rtc.c,v 1.6 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1997 Rolf Grossmann
* All rights reserved.
@ -32,11 +32,11 @@
#include <sys/param.h>
#include <next68k/dev/clockreg.h>
#include <machine/cpu.h>
#include <stand.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
u_char rtc_read(u_char);
void rtc_init(void);
time_t getsecs(void);
/* ### where shall I put this definition? */
@ -101,7 +101,7 @@ rtc_init(void)
new_clock = (val & RTC_NEW_CLOCK) ? 1 : 0;
}
time_t
satime_t
getsecs(void)
{
u_int secs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.2 2008/05/04 00:01:08 martin Exp $ */
/* $NetBSD: clock.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
/* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -32,8 +32,9 @@
#include <machine/dec_prom.h>
#include <stand/common/common.h>
#include <lib/libsa/net.h>
long
satime_t
getsecs()
{
long ticks;

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.h,v 1.7 2008/04/28 20:23:31 martin Exp $ */
/* $NetBSD: common.h,v 1.8 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -36,9 +36,6 @@ extern int debug; /* only used for network debugging for now */
/* startprog.S */
void startprog __P((int, int, int, char **, int, const void *, int, int));
/* clock.c */
long getsecs __P((void));
/* PROM callbacks */
int bootinit __P((const char *));
int bootread __P((int, void *, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_prom.c,v 1.4 2008/05/04 00:02:11 martin Exp $ */
/* $NetBSD: if_prom.c,v 1.5 2009/01/12 11:32:44 tsutsui Exp $ */
/* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -70,7 +70,7 @@ void fill_arpcache __P((void *, int));
int prom_probe __P((struct netif *, void *));
int prom_match __P((struct netif *, void *));
void prom_init __P((struct iodesc *, void *));
int prom_get __P((struct iodesc *, void *, size_t, time_t));
int prom_get __P((struct iodesc *, void *, size_t, saseconds_t));
int prom_put __P((struct iodesc *, void *, size_t));
void prom_end __P((struct netif *));
@ -209,10 +209,10 @@ prom_get(desc, pkt, len, timeout)
struct iodesc *desc;
void *pkt;
size_t len;
time_t timeout;
saseconds_t timeout;
{
int s;
time_t t;
satime_t t;
#ifdef NET_DEBUG
printf("prom_get: called\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: brdsetup.c,v 1.3 2009/01/12 09:41:58 tsutsui Exp $ */
/* $NetBSD: brdsetup.c,v 1.4 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -32,8 +32,6 @@
#include <sys/param.h>
#include <lib/libsa/stand.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <lib/libsa/net.h>
#include <lib/libkern/libkern.h>
@ -136,7 +134,7 @@ mftb()
return (tb);
}
time_t
satime_t
getsecs()
{
u_quad_t tb = mftb();

View File

@ -1,4 +1,4 @@
/* $NetBSD: nif.c,v 1.8 2009/01/12 09:41:59 tsutsui Exp $ */
/* $NetBSD: nif.c,v 1.9 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -132,7 +132,7 @@ netif_get(desc, pkt, maxlen, timo)
struct iodesc *desc;
void *pkt;
size_t maxlen;
time_t timo;
saseconds_t timo;
{
struct nifdv *dv = desc->io_netif;
int len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: getsecs.c,v 1.3 2006/04/15 16:47:30 simonb Exp $ */
/* $NetBSD: getsecs.c,v 1.4 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright 2001
@ -44,12 +44,12 @@
#include "stand/common/cfe_api.h"
time_t
satime_t
getsecs(void)
{
long long time;
time = cfe_getticks();
return (int) (time / 10);
return (time / 10);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cfe.c,v 1.2 2003/03/13 13:59:11 drochner Exp $ */
/* $NetBSD: if_cfe.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
@ -51,7 +51,7 @@
int cfenet_probe(struct netif *, void *);
int cfenet_match(struct netif *, void *);
void cfenet_init(struct iodesc *, void *);
int cfenet_get(struct iodesc *, void *, size_t, time_t);
int cfenet_get(struct iodesc *, void *, size_t, saseconds_t);
int cfenet_put(struct iodesc *, void *, size_t);
void cfenet_end(struct netif *);
@ -113,9 +113,9 @@ cfenet_get(desc, pkt, len, timeout)
struct iodesc *desc;
void *pkt;
size_t len;
time_t timeout;
saseconds_t timeout;
{
time_t t;
satime_t t;
int cc;
t = getsecs();

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_of.c,v 1.4 2005/12/11 12:19:05 christos Exp $ */
/* $NetBSD: netif_of.c,v 1.5 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank.
@ -169,7 +169,7 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
struct of_dev *op;
int tick0, tmo_ms;
@ -213,7 +213,7 @@ netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
/*
* Shouldn't really be here, but is used solely for networking, so...
*/
time_t
satime_t
getsecs(void)
{
return OF_milliseconds() / 1000;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_sun.c,v 1.9 2006/07/13 20:03:34 uwe Exp $ */
/* $NetBSD: netif_sun.c,v 1.10 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -176,10 +176,10 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
struct promdata *pd;
int tick0;
satime_t tick0;
ssize_t len;
pd = (struct promdata *)((struct netif *)desc->io_netif)->nif_devdata;

View File

@ -1,4 +1,4 @@
/* $NetBSD: promdev.c,v 1.21 2008/04/05 06:39:08 tsutsui Exp $ */
/* $NetBSD: promdev.c,v 1.22 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@ -45,6 +45,7 @@
#include <machine/pte.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
#include <lib/libkern/libkern.h>
#include <sparc/stand/common/promdev.h>
@ -505,7 +506,7 @@ getchar(void)
return (prom_getchar());
}
time_t
satime_t
getsecs(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: promdev.h,v 1.13 2008/04/28 20:23:36 martin Exp $ */
/* $NetBSD: promdev.h,v 1.14 2009/01/12 11:32:44 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -47,8 +47,6 @@ struct promdata {
#define DDB_MAGIC1 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('1') )
#define DDB_MAGIC2 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('2') )
extern time_t getsecs(void);
#define MAX_PROM_PATH 128
extern char prom_bootdevice[MAX_PROM_PATH];

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_of.c,v 1.5 2008/05/07 17:56:09 mlelstv Exp $ */
/* $NetBSD: netif_of.c,v 1.6 2009/01/12 11:32:44 tsutsui Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank.
@ -183,7 +183,7 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timo)
{
struct of_dev *op;
int tick0, tmo_ms;
@ -227,7 +227,7 @@ netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
/*
* Shouldn't really be here, but is used solely for networking, so...
*/
time_t
satime_t
getsecs(void)
{

View File

@ -1,14 +1,15 @@
/* $NetBSD: clock.c,v 1.3 2005/12/11 12:19:29 christos Exp $ */
/* $NetBSD: clock.c,v 1.4 2009/01/12 11:32:45 tsutsui Exp $ */
#include <sys/types.h>
#include <machine/mon.h>
#include "libsa.h"
#include "net.h"
int hz = 1000;
long
satime_t
getsecs(void)
{
long ticks;

View File

@ -1,4 +1,4 @@
/* $NetBSD: libsa.h,v 1.6 2009/01/12 07:00:59 tsutsui Exp $ */
/* $NetBSD: libsa.h,v 1.7 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* This file defines the API for libsa.a
@ -28,7 +28,6 @@ void exit(int);
/* clock.c */
extern int hz;
long getsecs(void);
long getticks(void);
/* exec_sun.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif.h,v 1.3 2005/12/11 12:19:29 christos Exp $ */
/* $NetBSD: netif.h,v 1.4 2009/01/12 11:32:45 tsutsui Exp $ */
#include "iodesc.h"
@ -7,11 +7,5 @@ struct netif {
void *nif_devdata;
};
ssize_t netif_get(struct iodesc *, void *, size_t, time_t);
ssize_t netif_put(struct iodesc *, void *, size_t);
int netif_open(void *);
int netif_close(int);
struct iodesc *socktodesc(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_sun.c,v 1.7 2009/01/12 07:00:59 tsutsui Exp $ */
/* $NetBSD: netif_sun.c,v 1.8 2009/01/12 11:32:45 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -338,7 +338,7 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
* Return the total length received (or -1 on error).
*/
int
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, seseconds_t timo)
{
struct netif *nif;
struct devdata *dd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.26 2008/03/31 06:19:59 he Exp $ */
/* $NetBSD: autoconf.c,v 1.27 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -36,6 +36,7 @@
#include <sys/param.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
#include "../include/mtpr.h"
#include "../include/sid.h"
@ -49,7 +50,6 @@ void autoconf(void);
void findcpu(void);
void consinit(void);
void scbinit(void);
int getsecs(void);
void scb_stray(void *);
void longjmp(int *, int);
void rtimer(void *);
@ -126,7 +126,7 @@ autoconf()
volatile int tickcnt;
int
satime_t
getsecs()
{
return tickcnt/100;

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.26 2005/12/24 22:45:40 perry Exp $ */
/* $NetBSD: boot.c,v 1.27 2009/01/12 11:32:45 tsutsui Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@ -35,6 +35,7 @@
#include <sys/boot_flag.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/net.h>
#include <lib/libsa/loadfile.h>
#include <lib/libkern/libkern.h>
@ -57,7 +58,6 @@ extern unsigned opendev;
void usage(char *), boot(char *), halt(char *);
void Xmain(void);
void autoconf(void);
int getsecs(void);
int setjmp(int *);
int testkey(void);
void loadpcs(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_de.c,v 1.4 2006/07/01 05:55:34 mrg Exp $ */
/* $NetBSD: if_de.c,v 1.5 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@ -56,7 +56,7 @@
#include "vaxstand.h"
static int de_get(struct iodesc *, void *, size_t, time_t);
static int de_get(struct iodesc *, void *, size_t, saseconds_t);
static int de_put(struct iodesc *, void *, size_t);
static void dewait(char *);
@ -191,7 +191,7 @@ deopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
}
int
de_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
de_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timeout)
{
volatile int to = 100000 * timeout;
int len, csr0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.11 2008/03/31 06:19:59 he Exp $ */
/* $NetBSD: if_le.c,v 1.12 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -67,7 +67,7 @@
#define QW_ALLOC(x) (((uintptr_t)alloc((x) + 7) + 7) & ~7)
static int le_get(struct iodesc *, void *, size_t, time_t);
static int le_get(struct iodesc *, void *, size_t, saseconds_t);
static int le_put(struct iodesc *, void *, size_t);
static void copyout(void *from, int dest, int len);
static void copyin(int src, void *to, int len);
@ -239,7 +239,7 @@ igen:
}
int
le_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
le_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timeout)
{
int csr, len;
volatile int to = 100000 * timeout;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ni.c,v 1.4 2007/03/04 06:00:56 christos Exp $ */
/* $NetBSD: if_ni.c,v 1.5 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -92,7 +92,7 @@
#define DELAY(x) {volatile int i = x * 3;while (--i);}
#define WAITREG(csr,val) while (NI_RREG(csr) & val);
static int ni_get(struct iodesc *, void *, size_t, time_t);
static int ni_get(struct iodesc *, void *, size_t, saseconds_t);
static int ni_put(struct iodesc *, void *, size_t);
static int *syspte, allocbase, niaddr;
@ -449,17 +449,19 @@ niopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
}
int
ni_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout)
ni_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timeout)
{
struct ni_dg *data;
struct ni_bbd *bd;
int nsec = getsecs() + timeout;
satime_t nsec = getsecs();
int len, idx;
loop: while ((data = REMQHI(&gvp->nc_forwr)) == 0 && (nsec > getsecs()))
loop:
while ((data = REMQHI(&gvp->nc_forwr)) == 0 &&
((getsecs() - nsec) < timeout))
;
if (nsec <= getsecs())
if ((getsecs() - nsec) >= timeout)
return 0;
switch (data->nd_opcode) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_qe.c,v 1.5 2007/03/04 06:00:56 christos Exp $ */
/* $NetBSD: if_qe.c,v 1.6 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1998 Roar Thronæs. All rights reserved.
@ -48,7 +48,7 @@
#include "vaxstand.h"
static int qe_get(struct iodesc *desc, void *pkt, size_t, time_t timeout);
static int qe_get(struct iodesc *desc, void *pkt, size_t, saseconds_t timeout);
static int qe_put(struct iodesc *desc, void *pkt, size_t);
static void qe_init(u_char *eaddr);
@ -180,7 +180,7 @@ qe_init(u_char *eaddr)
}
int
qe_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) {
qe_get(struct iodesc *desc, void *pkt, size_t maxlen, saseconds_t timeout) {
int len, j;
retry:

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ze.c,v 1.12 2002/05/27 16:54:18 ragge Exp $ */
/* $NetBSD: if_ze.c,v 1.13 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1998 James R. Maynard III. All rights reserved.
*
@ -54,7 +54,7 @@
#include "vaxstand.h"
static int ze_get(struct iodesc *, void *, size_t, time_t);
static int ze_get(struct iodesc *, void *, size_t, saseconds_t);
static int ze_put(struct iodesc *, void *, size_t);
@ -190,7 +190,7 @@ ze_get(desc, pkt, maxlen, timeout)
struct iodesc *desc;
void *pkt;
size_t maxlen;
time_t timeout;
saseconds_t timeout;
{
int timeout_ctr=100000*timeout, len, rdes;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netio.c,v 1.10 2008/04/28 20:23:39 martin Exp $ */
/* $NetBSD: netio.c,v 1.11 2009/01/12 11:32:45 tsutsui Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -182,7 +182,7 @@ netif_put(struct iodesc *desc, void *pkt, size_t len)
}
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timo)
{
return (*((struct netif*)desc->io_netif)->nif_driver->netif_get)
(desc, pkt, len, timo);

View File

@ -1,4 +1,4 @@
/* $NetBSD: arp.c,v 1.31 2008/03/25 22:55:25 christos Exp $ */
/* $NetBSD: arp.c,v 1.32 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -90,7 +90,7 @@ int arp_num = 1;
/* Local forwards */
static ssize_t arpsend __P((struct iodesc *, void *, size_t));
static ssize_t arprecv __P((struct iodesc *, void *, size_t, time_t));
static ssize_t arprecv __P((struct iodesc *, void *, size_t, saseconds_t));
/* Broadcast an ARP packet, asking who has addr on interface d */
u_char *
@ -186,7 +186,7 @@ arpsend(struct iodesc *d, void *pkt, size_t len)
* else -1 (and errno == 0)
*/
static ssize_t
arprecv(struct iodesc *d, void *pkt, size_t len, time_t tleft)
arprecv(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
ssize_t n;
struct ether_arp *ah;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootp.c,v 1.32 2008/03/25 21:23:50 christos Exp $ */
/* $NetBSD: bootp.c,v 1.33 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -63,7 +63,7 @@ char linuxcmdline[256];
static n_long nmask, smask;
static time_t bot;
static satime_t bot;
static char vm_rfc1048[4] = VM_RFC1048;
#ifdef BOOTP_VEND_CMU
@ -72,7 +72,7 @@ static char vm_cmu[4] = VM_CMU;
/* Local forwards */
static ssize_t bootpsend __P((struct iodesc *, void *, size_t));
static ssize_t bootprecv __P((struct iodesc *, void *, size_t, time_t));
static ssize_t bootprecv __P((struct iodesc *, void *, size_t, saseconds_t));
static int vend_rfc1048 __P((u_char *, u_int));
#ifdef BOOTP_VEND_CMU
static void vend_cmu __P((u_char *));
@ -291,7 +291,7 @@ bootpsend(struct iodesc *d, void *pkt, size_t len)
}
static ssize_t
bootprecv(struct iodesc *d, void *pkt, size_t len, time_t tleft)
bootprecv(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
ssize_t n;
struct bootp *bp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ether.c,v 1.21 2007/11/24 13:20:55 isaki Exp $ */
/* $NetBSD: ether.c,v 1.22 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -89,7 +89,7 @@ sendether(struct iodesc *d, void *pkt, size_t len, u_char *dea, int etype)
* NOTE: Caller must leave room for the Ether header.
*/
ssize_t
readether(struct iodesc *d, void *pkt, size_t len, time_t tleft,
readether(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft,
u_int16_t *etype)
{
ssize_t n;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iodesc.h,v 1.7 2005/12/11 12:24:46 christos Exp $ */
/* $NetBSD: iodesc.h,v 1.8 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -41,6 +41,25 @@
#ifndef __SYS_LIBNETBOOT_IODESC_H
#define __SYS_LIBNETBOOT_IODESC_H
#ifdef _STANDALONE
/*
* libsa code uses the following types to avoid 64 bit time_t:
*
* satime_t:
* numbers in seconds returned by the machine dependent getsecs() function
* which are used to measure relative time
*
* saseconds_t:
* numbers in seconds used to specify timeout to network drivers
*
*/
typedef unsigned int satime_t;
typedef int saseconds_t;
#else
typedef time_t satime_t;
typedef time_t saseconds_t;
#endif
struct iodesc {
struct in_addr destip; /* dest. ip addr, net order */
struct in_addr myip; /* local ip addr, net order */
@ -52,7 +71,7 @@ struct iodesc {
};
struct iodesc *socktodesc __P((int));
ssize_t netif_get __P((struct iodesc *, void *, size_t, time_t));
ssize_t netif_get __P((struct iodesc *, void *, size_t, saseconds_t));
ssize_t netif_put __P((struct iodesc *, void *, size_t));
#endif /* __SYS_LIBNETBOOT_IODESC_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.31 2007/11/24 13:20:56 isaki Exp $ */
/* $NetBSD: net.c,v 1.32 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -84,12 +84,12 @@ ssize_t
sendrecv(struct iodesc *d,
ssize_t (*sproc)(struct iodesc *, void *, size_t),
void *sbuf, size_t ssize,
ssize_t (*rproc)(struct iodesc *, void *, size_t, time_t),
ssize_t (*rproc)(struct iodesc *, void *, size_t, saseconds_t),
void *rbuf, size_t rsize)
{
ssize_t cc;
time_t t, tmo, tlast;
long tleft;
satime_t t, tlast;
saseconds_t tmo, tleft;
#ifdef NET_DEBUG
if (debug)
@ -97,7 +97,8 @@ sendrecv(struct iodesc *d,
#endif
tmo = MINTMO;
tlast = tleft = 0;
tlast = 0;
tleft = 0;
t = getsecs();
for (;;) {
if (tleft <= 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.h,v 1.22 2008/03/25 22:54:54 christos Exp $ */
/* $NetBSD: net.h,v 1.23 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -38,6 +38,9 @@
* SUCH DAMAGE.
*/
#include <netinet/in.h>
#include <netinet/in_systm.h>
#ifndef _KERNEL /* XXX - see <netinet/in.h> */
#undef __IPADDR
#define __IPADDR(x) htonl((u_int32_t)(x))
@ -93,14 +96,14 @@ int rarp_getipaddress __P((int));
/* Link functions: */
ssize_t sendether __P((struct iodesc *, void *, size_t, u_char *, int));
ssize_t readether __P((struct iodesc *, void *, size_t, time_t, u_int16_t *));
ssize_t readether __P((struct iodesc *, void *, size_t, saseconds_t, u_int16_t *));
ssize_t sendudp __P((struct iodesc *, void *, size_t));
ssize_t readudp __P((struct iodesc *, void *, size_t, time_t));
ssize_t readudp __P((struct iodesc *, void *, size_t, saseconds_t));
ssize_t sendrecv __P((struct iodesc *,
ssize_t (*)(struct iodesc *, void *, size_t),
void *, size_t,
ssize_t (*)(struct iodesc *, void *, size_t, time_t),
ssize_t (*)(struct iodesc *, void *, size_t, saseconds_t),
void *, size_t));
/* Utilities: */
@ -108,4 +111,4 @@ char *ether_sprintf __P((const u_char *));
int ip_cksum __P((const void *, size_t));
/* Machine-dependent functions: */
time_t getsecs __P((void));
satime_t getsecs __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif.c,v 1.22 2008/03/25 21:23:50 christos Exp $ */
/* $NetBSD: netif.c,v 1.23 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -214,7 +214,7 @@ netif_detach(struct netif *nif)
}
ssize_t
netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo)
netif_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timo)
{
struct netif *nif = desc->io_netif;
struct netif_driver *drv = nif->nif_driver;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif.h,v 1.5 2003/03/12 14:49:19 drochner Exp $ */
/* $NetBSD: netif.h,v 1.6 2009/01/12 11:32:45 tsutsui Exp $ */
#ifndef __SYS_LIBNETBOOT_NETIF_H
#define __SYS_LIBNETBOOT_NETIF_H
@ -12,7 +12,7 @@ struct netif_driver {
int (*netif_match) __P((struct netif *, void *));
int (*netif_probe) __P((struct netif *, void *));
void (*netif_init) __P((struct iodesc *, void *));
int (*netif_get) __P((struct iodesc *, void *, size_t, time_t));
int (*netif_get) __P((struct iodesc *, void *, size_t, saseconds_t));
int (*netif_put) __P((struct iodesc *, void *, size_t));
void (*netif_end) __P((struct netif *));
struct netif_dif *netif_ifs;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rarp.c,v 1.28 2008/04/05 05:15:33 tsutsui Exp $ */
/* $NetBSD: rarp.c,v 1.29 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -77,7 +77,7 @@ struct ether_arp {
#define arp_op ea_hdr.ar_op
static ssize_t rarpsend __P((struct iodesc *, void *, size_t));
static ssize_t rarprecv __P((struct iodesc *, void *, size_t, time_t));
static ssize_t rarprecv __P((struct iodesc *, void *, size_t, saseconds_t));
/*
* Ethernet (Reverse) Address Resolution Protocol (see RFC 903, and 826).
@ -172,7 +172,7 @@ rarpsend(struct iodesc *d, void *pkt, size_t len)
* else -1 (and errno == 0)
*/
static ssize_t
rarprecv(struct iodesc *d, void *pkt, size_t len, time_t tleft)
rarprecv(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
ssize_t n;
struct ether_arp *ap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc.c,v 1.27 2008/03/25 21:23:50 christos Exp $ */
/* $NetBSD: rpc.c,v 1.28 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -103,7 +103,7 @@ struct rpc_reply {
};
/* Local forwards */
static ssize_t recvrpc __P((struct iodesc *, void *, size_t, time_t));
static ssize_t recvrpc __P((struct iodesc *, void *, size_t, saseconds_t));
int rpc_xid;
int rpc_port = 0x400; /* predecrement */
@ -232,7 +232,7 @@ rpc_call(struct iodesc *d, n_long prog, n_long vers, n_long proc,
* Remaining checks are done by callrpc
*/
static ssize_t
recvrpc(struct iodesc *d, void *pkt, size_t len, time_t tleft)
recvrpc(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
struct rpc_reply *reply;
ssize_t n;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tftp.c,v 1.27 2008/11/19 12:36:41 ad Exp $ */
/* $NetBSD: tftp.c,v 1.28 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1996
@ -90,7 +90,7 @@ static const int tftperrors[8] = {
EINVAL, /* ??? */
};
static ssize_t recvtftp __P((struct iodesc *, void *, size_t, time_t));
static ssize_t recvtftp __P((struct iodesc *, void *, size_t, saseconds_t));
static int tftp_makereq __P((struct tftp_handle *));
static int tftp_getnextblock __P((struct tftp_handle *));
#ifndef TFTP_NOTERMINATE
@ -99,7 +99,7 @@ static void tftp_terminate __P((struct tftp_handle *));
static ssize_t tftp_size_of_file __P((struct tftp_handle *tftpfile));
static ssize_t
recvtftp(struct iodesc *d, void *pkt, size_t len, time_t tleft)
recvtftp(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
ssize_t n;
struct tftphdr *t;
@ -322,14 +322,14 @@ tftp_read(struct open_file *f, void *addr, size_t size, size_t *resid)
offinblock = tftpfile->off % SEGSIZE;
inbuffer = tftpfile->validsize - offinblock;
if (inbuffer < 0) {
if (offinblock > tftpfile->validsize) {
#ifdef DEBUG
printf("tftp: invalid offset %d\n",
tftpfile->off);
#endif
return EINVAL;
}
inbuffer = tftpfile->validsize - offinblock;
count = (size < inbuffer ? size : inbuffer);
(void)memcpy(addr,
tftpfile->lastdata.t.th_data + offinblock,

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp.c,v 1.7 2008/03/25 21:23:51 christos Exp $ */
/* $NetBSD: udp.c,v 1.8 2009/01/12 11:32:45 tsutsui Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -136,7 +136,7 @@ sendudp(struct iodesc *d, void *pkt, size_t len)
* Caller leaves room for the headers (Ether, IP, UDP)
*/
ssize_t
readudp(struct iodesc *d, void *pkt, size_t len, time_t tleft)
readudp(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
{
ssize_t n;
size_t hlen;