xserver: Branch 'master' - 2 commits

Kristian Høgsberg krh at kemper.freedesktop.org
Mon Mar 10 21:59:18 PDT 2008


 hw/xfree86/dri2/dri2.c |   11 +++++++++++
 hw/xfree86/dri2/dri2.h |    2 ++
 include/os.h           |    4 ++--
 os/io.c                |   10 ++++++----
 os/osdep.h             |    2 +-
 5 files changed, 22 insertions(+), 7 deletions(-)

New commits:
commit cc05255191413b3f376edbc600122ff085f45f7b
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Mar 11 00:51:43 2008 -0400

    Make WriteToClient take a const void * like any decent IO write function.
    
    Enough with the casting.  Doesn't break API or even ABI, but does make
    a lot of silly casts superfluos.

diff --git a/include/os.h b/include/os.h
index 4be6b80..c0f04c6 100644
--- a/include/os.h
+++ b/include/os.h
@@ -115,7 +115,7 @@ extern void FlushIfCriticalOutputPending(void);
 
 extern void SetCriticalOutputPending(void);
 
-extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
+extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
 
 extern void ResetOsBuffers(void);
 
@@ -448,7 +448,7 @@ typedef struct {
 extern CallbackListPtr ReplyCallback;
 typedef struct {
     ClientPtr client;
-    pointer replyData;
+    const void *replyData;
     unsigned long dataLenBytes;
     unsigned long bytesRemaining;
     Bool startOfReply;
diff --git a/os/io.c b/os/io.c
index e7ec609..4f4a109 100644
--- a/os/io.c
+++ b/os/io.c
@@ -730,11 +730,12 @@ SetCriticalOutputPending(void)
  *****************/
 
 _X_EXPORT int
-WriteToClient (ClientPtr who, int count, char *buf)
+WriteToClient (ClientPtr who, int count, const void *__buf)
 {
     OsCommPtr oc = (OsCommPtr)who->osPrivate;
     ConnectionOutputPtr oco = oc->output;
     int padBytes;
+    const char *buf = __buf;
 #ifdef DEBUG_COMMUNICATION
     Bool multicount = FALSE;
 #endif
@@ -871,13 +872,14 @@ WriteToClient (ClientPtr who, int count, char *buf)
  **********************/
 
 int
-FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
+FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
 {
     ConnectionOutputPtr oco = oc->output;
     int connection = oc->fd;
     XtransConnInfo trans_conn = oc->trans_conn;
     struct iovec iov[3];
     static char padBuffer[3];
+    const char *extraBuf = __extraBuf;
     long written;
     long padsize;
     long notWritten;
@@ -916,14 +918,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
 	    before = (-len); \
 	} else { \
 	    iov[i].iov_len = len; \
-	    iov[i].iov_base = (pointer) + before; \
+	    iov[i].iov_base = (pointer) + before;	\
 	    i++; \
 	    remain -= len; \
 	    before = 0; \
 	}
 
 	InsertIOV ((char *)oco->buf, oco->count)
-	InsertIOV (extraBuf, extraCount)
+	InsertIOV ((char *)extraBuf, extraCount)
 	InsertIOV (padBuffer, padsize)
 
 	errno = 0;
diff --git a/os/osdep.h b/os/osdep.h
index b6894c1..84f7177 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -184,7 +184,7 @@ typedef struct _osComm {
 extern int FlushClient(
     ClientPtr /*who*/,
     OsCommPtr /*oc*/,
-    char* /*extraBuf*/,
+    const void * /*extraBuf*/,
     int /*extraCount*/
 );
 
commit bc504ffbba3dec2e3467bab8ba1ac25db6dd317e
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Mar 11 00:35:31 2008 -0400

    DRI2: Add DRI2AuthConnection().
    
    DRI2 uses the same authentication scheme as XF86DRI, so implement this
    entry point so DRI2 protocol code can access it.

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index d2664b1..d527387 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -342,6 +342,17 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
     return TRUE;
 }
 
+Bool
+DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic)
+{
+    DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+    if (ds == NULL || drmAuthMagic(ds->fd, magic))
+	return FALSE;
+
+    return TRUE;
+}
+
 unsigned int
 DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
 {
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index a319085..126087a 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -58,6 +58,8 @@ Bool DRI2Connect(ScreenPtr pScreen,
 		 const char **driverName,
 		 unsigned int *sareaHandle);
 
+Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
+
 unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
 				 unsigned int *flags);
 


More information about the xorg-commit mailing list