]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
ptserver: Rename ubik.c as ptubik.c
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 26 Feb 2013 12:26:36 +0000 (12:26 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 3 Jun 2014 16:12:10 +0000 (12:12 -0400)
Coverity gets confused between ubik/ubik.c and ptserver/ubik.c,
and produces a load of false positives. Rename the ptserver ubik
shim (which is only used by pt_util) in order to reduce this
confusion.

Reviewed-on: http://gerrit.openafs.org/9273
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit daed548f70a2187c679232e4f79d703389419c4e)

Change-Id: I834fab3b65859cb73ece3fc52d9272d0b7d452ed
Reviewed-on: http://gerrit.openafs.org/11012
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/ptserver/Makefile.in
src/ptserver/NTMakefile
src/ptserver/ptubik.c [new file with mode: 0644]
src/ptserver/ubik.c [deleted file]
src/tptserver/Makefile.in

index d4663c8b2e1b71a6022fcab3751725c15d31a320..b836ef1f26811559a4f8effcf56c75bbecadd7c3 100644 (file)
@@ -189,10 +189,10 @@ testpt: testpt.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS)
 
 testpt.o: testpt.c ${INCLS} ${TOP_INCDIR}/afs/cmd.h AFS_component_version_number.c
 
-pt_util: pt_util.o ptutils.o ubik.o utils.o map.o libprot.a $(LIBS)
-       $(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ubik.o utils.o map.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) ${XLIBS} ${KRB5_LIBS}
+pt_util: pt_util.o ptutils.o ptubik.o utils.o map.o libprot.a $(LIBS)
+       $(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ptubik.o utils.o map.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) ${XLIBS} ${KRB5_LIBS}
 
-ubik.o: ubik.c ${INCLS}
+ptubik.o: ptubik.c ${INCLS}
 
 prerror.h: pterror.h
        ${INSTALL_DATA} $? $@
index a5749f6cb8ece502eaf949108dbfae4e2660345b..9595b4175a128c75a4ce0a640843db38a26b6f69 100644 (file)
@@ -102,7 +102,7 @@ PTCLIENT_EXEOBJS =\
 PT_UTIL_EXEOBJS = \
         $(OUT)\pt_util.obj \
         $(OUT)\ptutils.obj \
-        $(OUT)\ubik.obj \
+        $(OUT)\ptubik.obj \
         $(OUT)\utils.obj \
         $(OUT)\map.obj \
         $(OUT)\pt_util.res
diff --git a/src/ptserver/ptubik.c b/src/ptserver/ptubik.c
new file mode 100644 (file)
index 0000000..53c8bcf
--- /dev/null
@@ -0,0 +1,190 @@
+/* $Id$ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+
+#include <sys/types.h>
+#ifdef AFS_NT40_ENV
+#include <io.h>
+#else
+#include <netinet/in.h>
+#endif
+#include <string.h>
+#include <stdarg.h>
+
+#include <lock.h>
+#define UBIK_INTERNALS
+#include <afs/stds.h>
+#include <afs/cellconfig.h>
+#include <ubik.h>
+#include <rx/xdr.h>
+#include "ptint.h"
+#include "ptserver.h"
+
+extern int dbase_fd;
+struct ubik_dbase *dbase;
+
+int
+ubik_ServerInit(afs_uint32 myHost, short myPort, afs_uint32 serverList[],
+                const char *pathName, struct ubik_dbase **dbase)
+{
+    return (0);
+}
+
+int
+ubik_BeginTrans(struct ubik_dbase *dbase, afs_int32 transMode,
+               struct ubik_trans **transPtr)
+{
+    static int init = 0;
+    struct ubik_hdr thdr;
+
+    if (!init) {
+       thdr.version.epoch = htonl(2);
+       thdr.version.counter = htonl(0);
+       thdr.magic = htonl(UBIK_MAGIC);
+       thdr.size = htons(HDRSIZE);
+       lseek(dbase_fd, 0, 0);
+       write(dbase_fd, &thdr, sizeof(thdr));
+       fsync(dbase_fd);
+       init = 1;
+    }
+    return (0);
+}
+
+int
+ubik_BeginTransReadAny(struct ubik_dbase *dbase, afs_int32 transMode,
+                       struct ubik_trans **transPtr)
+{
+    return (0);
+}
+
+int
+ubik_AbortTrans(struct ubik_trans *transPtr)
+{
+    return (0);
+}
+
+int
+ubik_EndTrans(struct ubik_trans *transPtr)
+{
+    return (0);
+}
+
+int
+ubik_Tell(struct ubik_trans *transPtr, afs_int32 * fileid,
+          afs_int32 * position)
+{
+    return (0);
+}
+
+int
+ubik_Truncate(struct ubik_trans *transPtr, afs_int32 length)
+{
+    return (0);
+}
+
+int
+ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
+             int atype)
+{
+    return (0);
+}
+
+int
+ubik_WaitVersion(struct ubik_dbase *adatabase,
+                 struct ubik_version *aversion)
+{
+    return (0);
+}
+
+int
+ubik_CheckCache(struct ubik_trans *atrans, ubik_updatecache_func cbf, void *rock)
+{
+    return (*cbf)(atrans, rock);
+}
+
+void
+panic(char *format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    vprintf(format, ap);
+    va_end(ap);
+
+    abort();
+    printf("BACK FROM ABORT\n");       /* shouldn't come back from floating pt exception */
+    exit(1);                   /* never know, though */
+}
+
+int
+ubik_GetVersion(struct ubik_trans *dummy, struct ubik_version *ver)
+{
+    memset(ver, 0, sizeof(struct ubik_version));
+    return (0);
+}
+
+
+int
+ubik_Seek(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos)
+{
+    if (lseek(dbase_fd, pos + HDRSIZE, 0) < 0) {
+       perror("ubik_Seek");
+       return (-1);
+    }
+    return (0);
+}
+
+int
+ubik_Write(struct ubik_trans *tt, void *buf, afs_int32 len)
+{
+    int status;
+
+    status = write(dbase_fd, buf, len);
+    if (status < len) {
+       perror("ubik_Write");
+       return (1);
+    }
+    return (0);
+}
+
+int
+ubik_Read(struct ubik_trans *tt, void *buf, afs_int32 len)
+{
+    int status;
+
+    status = read(dbase_fd, buf, len);
+    if (status < 0) {
+       perror("ubik_Read");
+       return (1);
+    }
+    if (status < len)
+       memset((char *)buf + status, 0, len - status);
+    return (0);
+}
+
+
+/* Global declarations from ubik.c */
+afs_int32 ubik_quorum = 0;
+struct ubik_dbase *ubik_dbase = 0;
+struct ubik_stats ubik_stats;
+afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
+afs_int32 ubik_epochTime = 0;
+afs_int32 urecovery_state = 0;
+
+struct rx_securityClass *ubik_sc[3];
+
+
+/* Other declarations */
+
+int
+afsconf_GetNoAuthFlag(struct afsconf_dir *adir)
+{
+    return (1);
+}
+
+
+char *prdir = "/dev/null";
+struct prheader cheader;
+char *pr_realmName;
diff --git a/src/ptserver/ubik.c b/src/ptserver/ubik.c
deleted file mode 100644 (file)
index 53c8bcf..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $Id$ */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#else
-#include <netinet/in.h>
-#endif
-#include <string.h>
-#include <stdarg.h>
-
-#include <lock.h>
-#define UBIK_INTERNALS
-#include <afs/stds.h>
-#include <afs/cellconfig.h>
-#include <ubik.h>
-#include <rx/xdr.h>
-#include "ptint.h"
-#include "ptserver.h"
-
-extern int dbase_fd;
-struct ubik_dbase *dbase;
-
-int
-ubik_ServerInit(afs_uint32 myHost, short myPort, afs_uint32 serverList[],
-                const char *pathName, struct ubik_dbase **dbase)
-{
-    return (0);
-}
-
-int
-ubik_BeginTrans(struct ubik_dbase *dbase, afs_int32 transMode,
-               struct ubik_trans **transPtr)
-{
-    static int init = 0;
-    struct ubik_hdr thdr;
-
-    if (!init) {
-       thdr.version.epoch = htonl(2);
-       thdr.version.counter = htonl(0);
-       thdr.magic = htonl(UBIK_MAGIC);
-       thdr.size = htons(HDRSIZE);
-       lseek(dbase_fd, 0, 0);
-       write(dbase_fd, &thdr, sizeof(thdr));
-       fsync(dbase_fd);
-       init = 1;
-    }
-    return (0);
-}
-
-int
-ubik_BeginTransReadAny(struct ubik_dbase *dbase, afs_int32 transMode,
-                       struct ubik_trans **transPtr)
-{
-    return (0);
-}
-
-int
-ubik_AbortTrans(struct ubik_trans *transPtr)
-{
-    return (0);
-}
-
-int
-ubik_EndTrans(struct ubik_trans *transPtr)
-{
-    return (0);
-}
-
-int
-ubik_Tell(struct ubik_trans *transPtr, afs_int32 * fileid,
-          afs_int32 * position)
-{
-    return (0);
-}
-
-int
-ubik_Truncate(struct ubik_trans *transPtr, afs_int32 length)
-{
-    return (0);
-}
-
-int
-ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
-             int atype)
-{
-    return (0);
-}
-
-int
-ubik_WaitVersion(struct ubik_dbase *adatabase,
-                 struct ubik_version *aversion)
-{
-    return (0);
-}
-
-int
-ubik_CheckCache(struct ubik_trans *atrans, ubik_updatecache_func cbf, void *rock)
-{
-    return (*cbf)(atrans, rock);
-}
-
-void
-panic(char *format, ...)
-{
-    va_list ap;
-
-    va_start(ap, format);
-    vprintf(format, ap);
-    va_end(ap);
-
-    abort();
-    printf("BACK FROM ABORT\n");       /* shouldn't come back from floating pt exception */
-    exit(1);                   /* never know, though */
-}
-
-int
-ubik_GetVersion(struct ubik_trans *dummy, struct ubik_version *ver)
-{
-    memset(ver, 0, sizeof(struct ubik_version));
-    return (0);
-}
-
-
-int
-ubik_Seek(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos)
-{
-    if (lseek(dbase_fd, pos + HDRSIZE, 0) < 0) {
-       perror("ubik_Seek");
-       return (-1);
-    }
-    return (0);
-}
-
-int
-ubik_Write(struct ubik_trans *tt, void *buf, afs_int32 len)
-{
-    int status;
-
-    status = write(dbase_fd, buf, len);
-    if (status < len) {
-       perror("ubik_Write");
-       return (1);
-    }
-    return (0);
-}
-
-int
-ubik_Read(struct ubik_trans *tt, void *buf, afs_int32 len)
-{
-    int status;
-
-    status = read(dbase_fd, buf, len);
-    if (status < 0) {
-       perror("ubik_Read");
-       return (1);
-    }
-    if (status < len)
-       memset((char *)buf + status, 0, len - status);
-    return (0);
-}
-
-
-/* Global declarations from ubik.c */
-afs_int32 ubik_quorum = 0;
-struct ubik_dbase *ubik_dbase = 0;
-struct ubik_stats ubik_stats;
-afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
-afs_int32 ubik_epochTime = 0;
-afs_int32 urecovery_state = 0;
-
-struct rx_securityClass *ubik_sc[3];
-
-
-/* Other declarations */
-
-int
-afsconf_GetNoAuthFlag(struct afsconf_dir *adir)
-{
-    return (1);
-}
-
-
-char *prdir = "/dev/null";
-struct prheader cheader;
-char *pr_realmName;
index 40c75196d7fa3bb543fc2d5416e61d116da4818e..5a1f5d9ccd5563717104bcb01a8b3fa424bd5100 100644 (file)
@@ -202,14 +202,14 @@ testpt: testpt.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS)
 testpt.o: ${PTSERVER}/testpt.c ${INCLS}
        ${CCRULE} ${srcdir}/${PTSERVER}/testpt.c
 
-pt_util: pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) $(LIBS)
-       $(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS) ${MT_LIBS} ${XLIBS} ${KRB5_LIBS}
+pt_util: pt_util.o ptutils.o ptubik.o utils.o map.o $(PTOBJS) $(LIBS)
+       $(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ptubik.o utils.o map.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS) ${MT_LIBS} ${XLIBS} ${KRB5_LIBS}
 
 pt_util.o: ${PTSERVER}/pt_util.c
        ${CCRULE} ${srcdir}/${PTSERVER}/pt_util.c
 
-ubik.o: ${PTSERVER}/ubik.c ${INCLS}
-       ${CCRULE} ${srcdir}/${PTSERVER}/ubik.c
+ptubik.o: ${PTSERVER}/ptubik.c ${INCLS}
+       ${CCRULE} ${srcdir}/${PTSERVER}/ptubik.c
 
 prerror.h: pterror.h
        ${INSTALL} $? $@