]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - include/darwin.h
Revert "Merge branch 'xfsprogs-dev'"
[thirdparty/xfsprogs-dev.git] / include / darwin.h
index 887d0e94955346890a5a9de165bc6b3a6d0cf9e7..25cd61841cb8163bf0729947316addb6ed2299c2 100644 (file)
@@ -1,34 +1,19 @@
 /*
- * Copyright (c) 2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2006 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
  *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef __XFS_DARWIN_H__
 #define __XFS_DARWIN_H__
 #include <sys/ioctl.h>
 #include <sys/mount.h>
 
+#include <machine/endian.h>
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
+
 #include <sys/syscall.h>
 # ifndef SYS_fsctl
 #  define SYS_fsctl    242
@@ -54,7 +44,7 @@ static __inline__ int platform_test_xfs_fd(int fd)
        struct statfs buf;
        if (fstatfs(fd, &buf) < 0)
                return 0;
-       return (strcmp(buf.f_fstypename, "xfs") == 0);
+       return strncmp(buf.f_fstypename, "xfs", 4) == 0;
 }
 
 static __inline__ int platform_test_xfs_path(const char *path)
@@ -62,7 +52,7 @@ static __inline__ int platform_test_xfs_path(const char *path)
        struct statfs buf;
        if (statfs(path, &buf) < 0)
                return 0;
-       return (strcmp(buf.f_fstypename, "xfs") == 0);
+       return strncmp(buf.f_fstypename, "xfs", 4) == 0;
 }
 
 static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
@@ -76,6 +66,49 @@ static __inline__ void platform_getoptreset(void)
        optreset = 0;
 }
 
+static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
+{
+       return uuid_compare(uu1, uu2, NULL);
+}
+
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
+{
+       uint32_t status;
+       char *s;
+       uuid_to_string(uu, &s, &status);
+       if (status == uuid_s_ok)
+               strcpy(buffer, s);
+       else buffer[0] = '\0';
+       free(s);
+}
+
+static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
+{
+       uint32_t status;
+       uuid_from_string(buffer, uu, &status);
+       return (status == uuid_s_ok);
+}
+
+static __inline__ int platform_uuid_is_null(uuid_t *uu)
+{
+       return uuid_is_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_generate(uuid_t *uu)
+{
+       uuid_create(uu, NULL);
+}
+
+static __inline__ void platform_uuid_clear(uuid_t *uu)
+{
+       uuid_create_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
+{
+       memcpy(dst, src, sizeof(uuid_t));
+}
+
 #define __int8_t       int8_t
 #define __int16_t      int16_t
 #define __int32_t      int32_t
@@ -85,14 +118,6 @@ static __inline__ void platform_getoptreset(void)
 #define __uint16_t     u_int16_t
 #define __uint32_t     u_int32_t
 #define __uint64_t     u_int64_t
-#define __s8           int8_t
-#define __s16          int16_t
-#define __s32          int32_t
-#define __s64          int64_t
-#define __u8           u_int8_t
-#define __u16          u_int16_t
-#define __u32          u_int32_t
-#define __u64          u_int64_t
 #define loff_t         off_t
 #define off64_t                off_t
 
@@ -112,12 +137,6 @@ typedef unsigned char      uchar_t;
 #define fdatasync      fsync
 #define memalign(a,sz) valloc(sz)
 
-#include <machine/endian.h>
-#define __BYTE_ORDER   BYTE_ORDER
-#define __BIG_ENDIAN   BIG_ENDIAN
-#define __LITTLE_ENDIAN        LITTLE_ENDIAN
-#include <xfs/swab.h>
-
 #define O_LARGEFILE     0
 #ifndef O_DIRECT
 #define O_DIRECT        0