ubik: make uphys_close static
[openafs.git] / src / ubik / phys.c
index 78448b3..5ef33be 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -10,6 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <sys/types.h>
 #include <stdarg.h>
@@ -59,12 +60,12 @@ static char pbuffer[1024];
  * \warning Beware, when using this function, of the header in front of most files.
  */
 static int
-uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
+uphys_open(struct ubik_dbase *adbase, afs_int32 afid)
 {
-    register int fd;
+    int fd;
     static int initd;
-    register int i;
-    register struct fdcache *tfd;
+    int i;
+    struct fdcache *tfd;
     struct fdcache *bestfd;
 
     /* initialize package */
@@ -88,7 +89,7 @@ uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
     }
 
     /* not found, open it and try to enter in cache */
-    afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d", adbase->pathName, 
+    afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d", adbase->pathName,
                 (afid<0)?"SYS":"", (afid<0)?-afid:afid);
     fd = open(pbuffer, O_CREAT | O_RDWR, 0600);
     if (fd < 0) {
@@ -118,7 +119,7 @@ uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
     }
     if (bestfd) {              /* found a usable slot */
        tfd = bestfd;
-       if (tfd->fd >= 0) 
+       if (tfd->fd >= 0)
            close(tfd->fd);
        tfd->fd = fd;
        tfd->refCount = 1;      /* us */
@@ -132,11 +133,11 @@ uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
 /*!
  * \brief Close the file, maintaining ref count in cache structure.
  */
-int
-uphys_close(register int afd)
+static int
+uphys_close(int afd)
 {
-    register int i;
-    register struct fdcache *tfd;
+    int i;
+    struct fdcache *tfd;
 
     if (afd < 0)
        return EBADF;
@@ -166,9 +167,9 @@ uphys_close(register int afd)
 int
 uphys_stat(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat)
 {
-    register int fd;
+    int fd;
     struct stat tstat;
-    register afs_int32 code;
+    afs_int32 code;
 
     fd = uphys_open(adbase, afid);
     if (fd < 0)
@@ -188,11 +189,11 @@ uphys_stat(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat)
 }
 
 int
-uphys_read(register struct ubik_dbase *adbase, afs_int32 afile,
-          register void *abuffer, afs_int32 apos, afs_int32 alength)
+uphys_read(struct ubik_dbase *adbase, afs_int32 afile,
+          void *abuffer, afs_int32 apos, afs_int32 alength)
 {
-    register int fd;
-    register afs_int32 code;
+    int fd;
+    afs_int32 code;
 
     fd = uphys_open(adbase, afile);
     if (fd < 0)
@@ -208,11 +209,11 @@ uphys_read(register struct ubik_dbase *adbase, afs_int32 afile,
 }
 
 int
-uphys_write(register struct ubik_dbase *adbase, afs_int32 afile,
-           register void *abuffer, afs_int32 apos, afs_int32 alength)
+uphys_write(struct ubik_dbase *adbase, afs_int32 afile,
+           void *abuffer, afs_int32 apos, afs_int32 alength)
 {
-    register int fd;
-    register afs_int32 code;
+    int fd;
+    afs_int32 code;
     afs_int32 length;
 
     fd = uphys_open(adbase, afile);
@@ -232,10 +233,10 @@ uphys_write(register struct ubik_dbase *adbase, afs_int32 afile,
 }
 
 int
-uphys_truncate(register struct ubik_dbase *adbase, afs_int32 afile,
+uphys_truncate(struct ubik_dbase *adbase, afs_int32 afile,
               afs_int32 asize)
 {
-    register afs_int32 code, fd;
+    afs_int32 code, fd;
     fd = uphys_open(adbase, afile);
     if (fd < 0)
        return UNOENT;
@@ -250,7 +251,7 @@ uphys_truncate(register struct ubik_dbase *adbase, afs_int32 afile,
  * \todo Really should scan dir for data.
  */
 int
-uphys_getnfiles(register struct ubik_dbase *adbase)
+uphys_getnfiles(struct ubik_dbase *adbase)
 {
     /* really should scan dir for data */
     return 1;
@@ -260,11 +261,11 @@ uphys_getnfiles(register struct ubik_dbase *adbase)
  * \brief Get database label, with \p aversion in host order.
  */
 int
-uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile,
+uphys_getlabel(struct ubik_dbase *adbase, afs_int32 afile,
               struct ubik_version *aversion)
 {
     struct ubik_hdr thdr;
-    register afs_int32 code, fd;
+    afs_int32 code, fd;
 
     fd = uphys_open(adbase, afile);
     if (fd < 0)
@@ -284,11 +285,11 @@ uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile,
  * \brief Label database, with \p aversion in host order.
  */
 int
-uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
+uphys_setlabel(struct ubik_dbase *adbase, afs_int32 afile,
               struct ubik_version *aversion)
 {
     struct ubik_hdr thdr;
-    register afs_int32 code, fd;
+    afs_int32 code, fd;
 
     fd = uphys_open(adbase, afile);
     if (fd < 0)
@@ -307,9 +308,9 @@ uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
 }
 
 int
-uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile)
+uphys_sync(struct ubik_dbase *adbase, afs_int32 afile)
 {
-    register afs_int32 code, fd;
+    afs_int32 code, fd;
     fd = uphys_open(adbase, afile);
     code = fsync(fd);
     uphys_close(fd);
@@ -317,10 +318,10 @@ uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile)
 }
 
 void
-uphys_invalidate(register struct ubik_dbase *adbase, afs_int32 afid)
+uphys_invalidate(struct ubik_dbase *adbase, afs_int32 afid)
 {
-    register int i;
-    register struct fdcache *tfd;
+    int i;
+    struct fdcache *tfd;
 
     /* scan file descr cache */
     for (tfd = fdcache, i = 0; i < MAXFDCACHE; i++, tfd++) {