usd: Tidy header includes
[openafs.git] / src / usd / usd_file.c
index af3cc8e..8b71e30 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
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
 #if defined(AFS_AIX_ENV)
 #include <sys/tape.h>
 #include <sys/statfs.h>
 #endif
 #endif /* AFS_AIX_ENV */
 
-#include <string.h>
-#include <stdlib.h>
+#include <afs/afs_assert.h>
 
-#include <afs/debug.h>
 #include "usd.h"
 
 #ifdef O_LARGEFILE
@@ -77,7 +71,7 @@ static int
 usd_FileRead(usd_handle_t usd, char *buf, afs_uint32 nbytes,
             afs_uint32 * xferdP)
 {
-    int fd = (int)(usd->handle);
+    int fd = (intptr_t)(usd->handle);
     int got;
 
     got = read(fd, buf, nbytes);
@@ -95,7 +89,7 @@ static int
 usd_FileWrite(usd_handle_t usd, char *buf, afs_uint32 nbytes,
              afs_uint32 * xferdP)
 {
-    int fd = (int)(usd->handle);
+    int fd = (intptr_t)(usd->handle);
     int sent;
 
     sent = write(fd, buf, nbytes);
@@ -115,7 +109,7 @@ static int
 usd_FileSeek(usd_handle_t usd, afs_hyper_t reqOff, int whence,
             afs_hyper_t * curOffP)
 {
-    int fd = (int)(usd->handle);
+    int fd = (intptr_t)(usd->handle);
     osi_lloff_t lloff;
 
     if (!osi_hFitsInOff(reqOff, lloff))
@@ -134,7 +128,7 @@ usd_FileSeek(usd_handle_t usd, afs_hyper_t reqOff, int whence,
 static int
 usd_FileIoctl(usd_handle_t usd, int req, void *arg)
 {
-    int fd = (int)(usd->handle);
+    int fd = (intptr_t)(usd->handle);
 #ifdef O_LARGEFILE
     struct stat64 info;
 #else /* O_LARGEFILE */
@@ -290,7 +284,7 @@ usd_FileIoctl(usd_handle_t usd, int req, void *arg)
 static int
 usd_FileClose(usd_handle_t usd)
 {
-    int fd = (int)(usd->handle);
+    int fd = (intptr_t)(usd->handle);
     int code = 0;
     int ccode;
 
@@ -351,7 +345,7 @@ usd_FileOpen(const char *path, int flags, int mode, usd_handle_t * usdP)
 
     usd = (usd_handle_t) malloc(sizeof(*usd));
     memset(usd, 0, sizeof(*usd));
-    usd->handle = (void *)fd;
+    usd->handle = (void *)(intptr_t)fd;
     usd->read = usd_FileRead;
     usd->write = usd_FileWrite;
     usd->seek = usd_FileSeek;
@@ -386,10 +380,10 @@ usd_FileOpen(const char *path, int flags, int mode, usd_handle_t * usdP)
 
        /* If we're trying to obtain a write lock on a real disk, then the
         * aggregate must not be attached by the kernel.  If so, unlock it
-        * and fail. 
+        * and fail.
         * WARNING: The code to check for the above has been removed when this
         * file was ported from DFS src. It should be put back if
-        * this library is used to access hard disks 
+        * this library is used to access hard disks
         */
     }