changeset: 134:d2e397b59ed1
user: Kris Maglione <kris_AT_suckless.org>
date: Wed Jun 23 13:53:42 2010 -0400
files: debian/copyright include/ixp.h include/ixp_srvutil.h lib/libixp/convert.c lib/libixp/srv_util.c
description:
Add ixp_pending_print and ixp_pending_vprint.
diff -r a327a2c96b77 -r d2e397b59ed1 debian/copyright
--- a/debian/copyright Wed Jun 23 13:43:32 2010 -0400
+++ b/debian/copyright Wed Jun 23 13:53:42 2010 -0400
@@ -1,1 +1,21 @@
-../LICENSE
\ No newline at end of file
+
+© 2005-2006 Anselm R. Garbe <garbeam_AT_gmail.com>
+© 2006-2010 Kris Maglione <maglione.k at Gmail>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff -r a327a2c96b77 -r d2e397b59ed1 include/ixp.h
--- a/include/ixp.h Wed Jun 23 13:43:32 2010 -0400
+++ b/include/ixp.h Wed Jun 23 13:53:42 2010 -0400
@@ -30,14 +30,17 @@
* of libixp with a different API version than it was compiled
* against.
*/
-#define IXP_API 129
+#define IXP_API 134
+#define _IXP_ASSERT_VERSION ixp_version_ ## 134 ## _required
+
#ifndef IXP_NEEDAPI
#define IXP_NEEDAPI IXP_API
#endif
+
#ifndef IXP_MAXAPI
#define IXP_MAXAPI IXP_API
#endif
-#define _IXP_ASSERT_VERSION ixp_version_##129##_required
+
#define IXP_ASSERT_VERSION do _IXP_ASSERT_VERSION = 0; while(0)
extern int _IXP_ASSERT_VERSION;
@@ -46,19 +49,22 @@
# error A newer version of libixp is needed for this compilation.
#endif
#if IXP_API > IXP_MAXAPI
-# warning This version of libixp has a newer API than this compilation requires.
+# warning This version of libixp has a newer API than this compilation requests.
#endif
#if IXP_NEEDAPI < 127
+# undef uchar
# undef ushort
# undef ulong
# undef vlong
# undef uvlong
+# define uchar _ixpuchar
# define ushort _ixpushort
# define ulong _ixpulong
# define vlong _ixpvlong
# define uvlong _ixpuvlong
+typedef unsigned char uchar;
typedef uint16_t ushort;
typedef uint32_t ulong;
typedef uint64_t uvlong;
@@ -66,11 +72,8 @@
typedef int64_t vlong;
#endif
-#undef uchar
#undef uint
-#define uchar _ixpuchar
#define uint _ixpuint
-typedef unsigned char uchar;
typedef unsigned int uint;
#ifdef KENC
@@ -398,7 +401,7 @@
struct IxpFRStat {
IxpFHdr hdr;
uint16_t nstat;
- uchar* stat;
+ uint8_t* stat;
};
struct IxpFTWStat {
IxpFHdr hdr;
@@ -456,7 +459,7 @@
)
STRUCT ( /* Rstat */
uint16_t nstat;
- uchar *stat;
+ char *stat;
)
STRUCT ( /* Twstat */
IxpStat st;
@@ -739,12 +742,12 @@
void ixp_unmount(IxpClient*);
int ixp_vprint(IxpCFid*, const char*, va_list);
long ixp_write(IxpCFid*, const void*, long);
-IxpCFid* ixp_create(IxpClient*, const char*, uint perm, uchar mode);
+IxpCFid* ixp_create(IxpClient*, const char*, uint perm, int8_t mode);
IxpStat* ixp_fstat(IxpCFid*);
IxpClient* ixp_mount(const char*);
IxpClient* ixp_mountfd(int);
IxpClient* ixp_nsmount(const char*);
-IxpCFid* ixp_open(IxpClient*, const char*, uchar);
+IxpCFid* ixp_open(IxpClient*, const char*, uint8_t);
IxpStat* ixp_stat(IxpClient*, const char*);
/* convert.c */
diff -r a327a2c96b77 -r d2e397b59ed1 include/ixp_srvutil.h
--- a/include/ixp_srvutil.h Wed Jun 23 13:43:32 2010 -0400
+++ b/include/ixp_srvutil.h Wed Jun 23 13:53:42 2010 -0400
@@ -32,7 +32,7 @@
struct IxpDirtab {
char* name;
- uchar qtype;
+ uint8_t qtype;
uint type;
uint perm;
uint flags;
@@ -46,7 +46,7 @@
uint index;
IxpDirtab tab;
uint nref;
- uchar volatil;
+ char volatil;
};
enum {
@@ -55,9 +55,11 @@
bool ixp_pending_clunk(Ixp9Req*);
void ixp_pending_flush(Ixp9Req*);
+int ixp_pending_print(IxpPending*, const char*, ...);
void ixp_pending_pushfid(IxpPending*, IxpFid*);
void ixp_pending_respond(Ixp9Req*);
-void ixp_pending_write(IxpPending*, char*, long);
+int ixp_pending_vprint(IxpPending*, const char*, va_list ap);
+void ixp_pending_write(IxpPending*, const char*, long);
IxpFileId* ixp_srv_clonefiles(IxpFileId*);
void ixp_srv_data2cstring(Ixp9Req*);
void ixp_srv_freefile(IxpFileId*);
diff -r a327a2c96b77 -r d2e397b59ed1 lib/libixp/convert.c
--- a/lib/libixp/convert.c Wed Jun 23 13:43:32 2010 -0400
+++ b/lib/libixp/convert.c Wed Jun 23 13:53:42 2010 -0400
@@ -17,11 +17,11 @@
static void
ixp_puint(IxpMsg *msg, uint size, uint32_t *val) {
- uchar *pos;
+ uint8_t *pos;
int v;
if(msg->pos + size <= msg->end) {
- pos = (uchar*)msg->pos;
+ pos = (uint8_t*)msg->pos;
switch(msg->mode) {
case MsgPack:
v = *val;
@@ -74,16 +74,12 @@
* T<IxpMsg>
*/
void
-ixp_pu32(IxpMsg *msg, uint32_t *val) {
- ixp_puint(msg, SDWord, val);
-}
-void
-ixp_pu8(IxpMsg *msg, uchar *val) {
+ixp_pu8(IxpMsg *msg, uint8_t *val) {
uint32_t v;
v = *val;
ixp_puint(msg, SByte, &v);
- *val = (uchar)v;
+ *val = (uint8_t)v;
}
void
ixp_pu16(IxpMsg *msg, uint16_t *val) {
@@ -94,6 +90,10 @@
*val = (uint16_t)v;
}
void
+ixp_pu32(IxpMsg *msg, uint32_t *val) {
+ ixp_puint(msg, SDWord, val);
+}
+void
ixp_pu64(IxpMsg *msg, uint64_t *val) {
uint32_t vl, vb;
diff -r a327a2c96b77 -r d2e397b59ed1 lib/libixp/srv_util.c
--- a/lib/libixp/srv_util.c Wed Jun 23 13:43:32 2010 -0400
+++ b/lib/libixp/srv_util.c Wed Jun 23 13:53:42 2010 -0400
@@ -239,6 +239,8 @@
/**
* Function: ixp_pending_write
+ * Function: ixp_pending_print
+ * Function: ixp_pending_vprint
* Function: ixp_pending_pushfid
* Function: ixp_pending_clunk
* Function: ixp_pending_flush
@@ -263,6 +265,9 @@
* queued when ixp_pending_respond is called, it is written
* immediately, otherwise the request is queued.
*
+ * ixp_pending_print and ixp_pending_vprint call ixp_pending_write
+ * after formatting their arguments with V<ixp_vsmprint>.
+ *
* The IxpPending data structure is opaque and should be
* initialized zeroed before using these functions for the first
* time.
@@ -307,7 +312,7 @@
}
void
-ixp_pending_write(IxpPending *pending, char *dat, long ndat) {
+ixp_pending_write(IxpPending *pending, const char *dat, long ndat) {
IxpRequestLink req_link;
IxpQueue **qp, *queue;
IxpPendingLink *pp;
@@ -348,6 +353,29 @@
ixp_pending_respond(rp->req);
}
+int
+ixp_pending_vprint(IxpPending *pending, const char *fmt, va_list ap) {
+ char *dat;
+ int res;
+
+ dat = ixp_vsmprint(fmt, ap);
+ res = strlen(dat);
+ ixp_pending_write(pending, dat, res);
+ free(dat);
+ return res;
+}
+
+int
+ixp_pending_print(IxpPending *pending, const char *fmt, ...) {
+ va_list ap;
+ int res;
+
+ va_start(ap, fmt);
+ res = ixp_pending_vprint(pending, fmt, ap);
+ va_end(ap);
+ return res;
+}
+
void
ixp_pending_pushfid(IxpPending *pending, IxpFid *fid) {
IxpPendingLink *pend_link;
Received on Wed Jun 23 2010 - 18:10:01 UTC
This archive was generated by hypermail 2.2.0 : Wed Jun 23 2010 - 18:12:04 UTC