]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Get xfstests building on irix using root/toolroot.
authorTim Shimmin <tes@sgi.com>
Fri, 22 Oct 2004 14:38:06 +0000 (14:38 +0000)
committerTim Shimmin <tes@sgi.com>
Fri, 22 Oct 2004 14:38:06 +0000 (14:38 +0000)
Merge of xfs-cmds-melb:slinx:19868a by kenmcd.

  Update to work with xfstests/src and ltp code.

include/irix.h

index 37d92eb353d9227d690ee5d0e42f1c70ab35451c..dee62795380025ebda122d7b7495903719cb68d7 100644 (file)
 #ifndef __XFS_IRIX_H__
 #define __XFS_IRIX_H__
 
+#include <stdlib.h>
+#include <unistd.h>
 #include <libgen.h>
 #include <values.h>
 #include <strings.h>
 #include <inttypes.h>
+#include <limits.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/uuid.h>
 #include <sys/param.h>
@@ -67,7 +71,22 @@ typedef __int64_t    xfs_ino_t;
 typedef __int32_t      xfs_dev_t;
 typedef __int64_t      xfs_daddr_t;
 typedef char*          xfs_caddr_t;
-typedef flock64_t      xfs_flock64_t;
+
+#define xfs_flock64    flock64
+#define xfs_flock64_t  struct flock64
+
+typedef struct xfs_error_injection {
+        __int32_t           fd;
+        __int32_t           errtag;
+} xfs_error_injection_t;
+
+
+typedef struct xfs_fsop_bulkreq {
+        ino64_t             *lastip;      
+        __int32_t           icount;   
+        xfs_bstat_t         *ubuffer;      
+        __int32_t           *ocount;       
+} xfs_fsop_bulkreq_t;
 
 #include <sys/endian.h>
 #define __BYTE_ORDER   BYTE_ORDER
@@ -83,16 +102,40 @@ typedef flock64_t  xfs_flock64_t;
 #define __inline__     __inline
 #endif
 
-#define INT_MAX                INT32_MAX
-#define UINT_MAX       UINT32_MAX
-#define PATH_MAX       MAXPATHLEN
 #define constpp                char * const *
 
-static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
+static __inline__ int xfsctl(const char *path, int fd, int cmd, void *arg)
 {
-       if (cmd >= 0 && cmd < XFS_FSOPS_COUNT)
-               return syssgi(SGI_XFS_FSOPERATIONS, fd, cmd, (void *)0, p);
-       return fcntl(fd, cmd, p);
+       if (cmd >= 0 && cmd < XFS_FSOPS_COUNT) {
+               /*
+                * We have a problem in that xfsctl takes 1 arg but
+                * some sgi xfs ops take an input arg and/or an output arg
+                * So have to special case the ops to decide if xfsctl arg
+                * is an input or an output argument.
+                */
+               if (cmd == XFS_FS_GOINGDOWN)
+                       return syssgi(SGI_XFS_FSOPERATIONS, fd, cmd, arg, 0);
+               return syssgi(SGI_XFS_FSOPERATIONS, fd, cmd, 0, arg);
+       }
+       switch (cmd) {
+               case SGI_FS_BULKSTAT:
+                       return syssgi(SGI_FS_BULKSTAT, fd, 
+                                       ((xfs_fsop_bulkreq_t*)arg)->lastip,
+                                       ((xfs_fsop_bulkreq_t*)arg)->icount,
+                                       ((xfs_fsop_bulkreq_t*)arg)->ubuffer,
+                                       ((xfs_fsop_bulkreq_t*)arg)->ocount);
+               case SGI_FS_BULKSTAT_SINGLE:
+                       return syssgi(SGI_FS_BULKSTAT_SINGLE, fd, 
+                                       ((xfs_fsop_bulkreq_t*)arg)->lastip,
+                                       ((xfs_fsop_bulkreq_t*)arg)->ubuffer);
+               case SGI_XFS_INJECT_ERROR:
+                       return syssgi(SGI_XFS_INJECT_ERROR,
+                                       ((xfs_error_injection_t*)arg)->errtag,
+                                       fd);
+               case SGI_XFS_CLEARALL_ERROR:
+                       return syssgi(SGI_XFS_CLEARALL_ERROR, fd);
+       }
+       return fcntl(fd, cmd, arg);
 }
 
 static __inline__ int platform_test_xfs_fd(int fd)
@@ -152,15 +195,17 @@ static __inline__ char * strsep(char **s, const char *ct)
 #define XFS_IOC_FREESP64               F_FREESP64
 #define XFS_IOC_GETBMAP                        F_GETBMAP
 #define XFS_IOC_FSSETDM                        F_FSSETDM
+#define XFS_IOC_RESVSP                 F_RESVSP                 
 #define XFS_IOC_RESVSP64               F_RESVSP64
+#define XFS_IOC_UNRESVSP               F_UNRESVSP                 
 #define XFS_IOC_UNRESVSP64             F_UNRESVSP64
 #define XFS_IOC_GETBMAPA               F_GETBMAPA
 #define XFS_IOC_FSGETXATTRA            F_FSGETXATTRA
 #define XFS_IOC_GETBMAPX               F_GETBMAPX
 
 #define XFS_IOC_FSGEOMETRY_V1          XFS_FS_GEOMETRY
-#define XFS_IOC_FSBULKSTAT             /* TODO */
-#define XFS_IOC_FSBULKSTAT_SINGLE      /* TODO */
+#define XFS_IOC_FSBULKSTAT             SGI_FS_BULKSTAT     
+#define XFS_IOC_FSBULKSTAT_SINGLE      SGI_FS_BULKSTAT_SINGLE
 #define XFS_IOC_FSINUMBERS             /* TODO */
 #define XFS_IOC_PATH_TO_FSHANDLE       /* TODO */
 #define XFS_IOC_PATH_TO_HANDLE         /* TODO */
@@ -174,8 +219,8 @@ static __inline__ char * strsep(char **s, const char *ct)
 #define XFS_IOC_FSCOUNTS               XFS_FS_COUNTS
 #define XFS_IOC_SET_RESBLKS            XFS_SET_RESBLKS
 #define XFS_IOC_GET_RESBLKS            XFS_GET_RESBLKS
-#define XFS_IOC_ERROR_INJECTION                /* TODO */
-#define XFS_IOC_ERROR_CLEARALL         /* TODO */
+#define XFS_IOC_ERROR_INJECTION                SGI_XFS_INJECT_ERROR
+#define XFS_IOC_ERROR_CLEARALL         SGI_XFS_CLEARALL_ERROR
 #define XFS_IOC_FREEZE                 XFS_FS_FREEZE
 #define XFS_IOC_THAW                   XFS_FS_THAW
 #define XFS_IOC_FSSETDM_BY_HANDLE      /* TODO */