From owner-p4-projects@FreeBSD.ORG Mon Jun 14 04:53:02 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 67DEC16A4D1; Mon, 14 Jun 2004 04:53:02 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 372CB16A4D0 for ; Mon, 14 Jun 2004 04:53:02 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 218DE43D39 for ; Mon, 14 Jun 2004 04:53:02 +0000 (GMT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5E4r1Zc076803 for ; Mon, 14 Jun 2004 04:53:01 GMT (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5E4r1Mo076800 for perforce@freebsd.org; Mon, 14 Jun 2004 04:53:01 GMT (envelope-from jmallett@freebsd.org) Date: Mon, 14 Jun 2004 04:53:01 GMT Message-Id: <200406140453.i5E4r1Mo076800@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 54901 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2004 04:53:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=54901 Change 54901 by jmallett@jmallett_oingo on 2004/06/14 04:52:32 Open, Close, Seek. Fix return type botch for errors from Read/Write. Affected files ... .. //depot/projects/mips/sys/dev/arcs/arcs.c#4 edit .. //depot/projects/mips/sys/dev/arcs/arcs.h#3 edit Differences ... ==== //depot/projects/mips/sys/dev/arcs/arcs.c#4 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/dev/arcs/arcs.c#3 $ + * $P4: //depot/projects/mips/sys/dev/arcs/arcs.c#4 $ */ #include @@ -51,9 +51,12 @@ #define ARCS_FV_EnterInteractiveMode_Offset (7 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetChild_Offset (10 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetMemoryDescriptor_Offset (18 * sizeof (ARCS_Pointer_t)) +#define ARCS_FV_Open_Offset (23 * sizeof (ARCS_Pointer_t)) +#define ARCS_FV_Close_Offset (24 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_Read_Offset (25 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetReadStatus_Offset (26 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_Write_Offset (27 * sizeof (ARCS_Pointer_t)) +#define ARCS_FV_Seek_Offset (28 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetEnvironmentVariable_Offset (30 * sizeof (ARCS_Pointer_t)) int @@ -135,10 +138,46 @@ return (value); } +int +ARCS_Open(const char *name, int mode, int *fdp) +{ + uint32_t (*Open)(ARCS_Pointer_t, uint32_t, ARCS_Pointer_t); + int error; + uint32_t errord; + ARCS_Pointer_t named; + uint32_t moded; + uint32_t fdd; + ARCS_Pointer_t fdpd; + + Open = (uint32_t (*)(ARCS_Pointer_t, uint32_t, ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Open_Offset]; + named = (ARCS_Pointer_t)(intptr_t)name; + moded = (uint32_t)mode; + fdpd = (ARCS_Pointer_t)(intptr_t)&fdd; + errord = (*Open)(named, moded, fdpd); + error = (int)errord; + *fdp = (int)fdd; + return (error); +} + +int +ARCS_Close(int fd) +{ + uint32_t (*Close)(uint32_t); + int error; + uint32_t errord; + uint32_t fdd; + + Close = (uint32_t (*)(uint32_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Close_Offset]; + fdd = (uint32_t)fd; + errord = (*Close)(fdd); + error = (int)errord; + return (error); +} + size_t ARCS_Read(int fd, char *buf, size_t buflen) { - ARCS_Pointer_t (*Read)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t); + uint32_t (*Read)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t); size_t len; uint32_t fdd; ARCS_Pointer_t bufd; @@ -146,7 +185,7 @@ uint32_t lend; ARCS_Pointer_t lenpd; - Read = (ARCS_Pointer_t (*)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Read_Offset]; + Read = (uint32_t (*)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Read_Offset]; fdd = (uint32_t)fd; bufd = (ARCS_Pointer_t)(intptr_t)buf; buflend = (uint32_t)buflen; @@ -174,7 +213,7 @@ size_t ARCS_Write(int fd, const char *buf, size_t buflen) { - ARCS_Pointer_t (*Write)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t); + uint32_t (*Write)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t); size_t len; uint32_t fdd; ARCS_Pointer_t bufd; @@ -182,7 +221,7 @@ uint32_t lend; ARCS_Pointer_t lenpd; - Write = (ARCS_Pointer_t (*)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Write_Offset]; + Write = (uint32_t (*)(uint32_t, ARCS_Pointer_t, uint32_t, ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Write_Offset]; fdd = (uint32_t)fd; bufd = (ARCS_Pointer_t)(intptr_t)buf; buflend = (uint32_t)buflen; @@ -192,6 +231,28 @@ return (len); } +int +ARCS_Seek(int fd, off_t *offp, int whence) +{ + uint32_t (*Seek)(uint32_t, ARCS_Pointer_t, uint32_t); + int error; + uint32_t errord; + uint32_t fdd; + uint64_t offd; + ARCS_Pointer_t offpd; + uint32_t whenced; + + Seek = (uint32_t (*)(uint32_t, ARCS_Pointer_t, uint32_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_Seek_Offset]; + fdd = (uint32_t)fd; + offd = (uint64_t)*offp; + offpd = (ARCS_Pointer_t)(intptr_t)&offd; + whenced = (uint32_t)whence; + errord = (*Seek)(fdd, offpd, whenced); + error = (int)errord; + *offp = offd; + return (error); +} + struct ARCS_Component * ARCS_GetChild(const struct ARCS_Component *component) { ==== //depot/projects/mips/sys/dev/arcs/arcs.h#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/dev/arcs/arcs.h#2 $ + * $P4: //depot/projects/mips/sys/dev/arcs/arcs.h#3 $ */ #ifndef _DEV_ARCS_ARCS_H_ @@ -34,6 +34,8 @@ #if defined (IP22) typedef int32_t ARCS_Pointer_t; +#elif defined (IP30) +typedef int64_t ARCS_Pointer_t; #endif #else #error "ARCS not supported." @@ -107,9 +109,12 @@ void ARCS_Reboot(void); const char *ARCS_GetEnvironmentVariable(const char *); struct ARCS_Mem *ARCS_GetMemoryDescriptor(const struct ARCS_Mem *); +int ARCS_Open(const char *, int, int *); +int ARCS_Close(int); size_t ARCS_Read(int, char *, size_t); int ARCS_GetReadStatus(int); size_t ARCS_Write(int, const char *, size_t); +int ARCS_Seek(int, off_t *, int); struct ARCS_Component *ARCS_GetChild(const struct ARCS_Component *); #endif /* _DEV_ARCS_ARCS_H_ */