Skip to content

Instantly share code, notes, and snippets.

@lundman
Last active April 11, 2018 08:08
Show Gist options
  • Save lundman/2423a74780d2bd09eaa49f15aa3e551c to your computer and use it in GitHub Desktop.
Save lundman/2423a74780d2bd09eaa49f15aa3e551c to your computer and use it in GitHub Desktop.
10.10 build fix
diff --git a/include/sys/ZFSDataset.h b/include/sys/ZFSDataset.h
index 7ca3c25..c45c2e3 100644
--- a/include/sys/ZFSDataset.h
+++ b/include/sys/ZFSDataset.h
@@ -28,6 +28,7 @@
#ifdef __cplusplus
#include <IOKit/storage/IOMedia.h>
+#include <AvailabilityMacros.h>
#ifdef super
#undef super
@@ -87,21 +88,35 @@ public:
IOStorageAttributes *attributes,
IOStorageCompletion *completion);
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
virtual IOReturn synchronize(IOService *client,
UInt64 byteStart, UInt64 byteCount,
IOStorageSynchronizeOptions options = 0);
+#else
+ virtual IOReturn synchronizeCache(IOService *client);
+#endif
+
virtual IOReturn unmap(IOService *client,
IOStorageExtent *extents, UInt32 extentsCount,
- IOStorageUnmapOptions options = 0);
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
+ IOStorageUnmapOptions options = 0);
+#else
+ UInt32 options = 0);
+#endif
virtual bool lockPhysicalExtents(IOService *client);
virtual IOStorage *copyPhysicalExtent(IOService *client,
UInt64 *byteStart, UInt64 *byteCount);
virtual void unlockPhysicalExtents(IOService *client);
+#if defined (MAC_OS_X_VERSION_10_10) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10)
virtual IOReturn setPriority(IOService *client,
IOStorageExtent *extents, UInt32 extentsCount,
IOStoragePriority priority);
+#endif
virtual UInt64 getPreferredBlockSize() const;
virtual UInt64 getSize() const;
diff --git a/include/sys/ZFSDatasetProxy.h b/include/sys/ZFSDatasetProxy.h
index f04cb11..22f6b7b 100644
--- a/include/sys/ZFSDatasetProxy.h
+++ b/include/sys/ZFSDatasetProxy.h
@@ -56,6 +56,8 @@ public:
virtual IOReturn reportEjectability(bool *);
virtual IOReturn reportMaxValidBlock(UInt64 *);
+ virtual IOReturn setWriteCacheState(bool enabled);
+ virtual IOReturn getWriteCacheState(bool *enabled);
#if 0
virtual void read(IOService *client, UInt64 byteStart,
IOMemoryDescriptor *buffer, IOStorageAttributes *attr,
diff --git a/include/sys/ZFSDatasetScheme.h b/include/sys/ZFSDatasetScheme.h
index c2590dc..31c8b5c 100644
--- a/include/sys/ZFSDatasetScheme.h
+++ b/include/sys/ZFSDatasetScheme.h
@@ -30,6 +30,7 @@
#include <IOKit/storage/IOPartitionScheme.h>
#include <sys/ZFSDataset.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -75,15 +76,25 @@ public:
IOStorageAttributes *attributes,
IOStorageCompletion *completion);
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
virtual IOReturn synchronize(IOService *client,
UInt64 byteStart,
UInt64 byteCount,
IOStorageSynchronizeOptions options = 0);
+#else
+ virtual IOReturn synchronizeCache(IOService *client);
+#endif
virtual IOReturn unmap(IOService *client,
IOStorageExtent *extents,
UInt32 extentsCount,
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
IOStorageUnmapOptions options = 0);
+#else
+ UInt32 options = 0);
+#endif
virtual bool lockPhysicalExtents(IOService *client);
@@ -93,10 +104,13 @@ public:
virtual void unlockPhysicalExtents(IOService *client);
+#if defined (MAC_OS_X_VERSION_10_10) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10)
virtual IOReturn setPriority(IOService *client,
IOStorageExtent *extents,
UInt32 extentsCount,
IOStoragePriority priority);
+#endif
protected:
private:
diff --git a/include/sys/zfs_boot.h b/include/sys/zfs_boot.h
index 8b29799..0fac76c 100644
--- a/include/sys/zfs_boot.h
+++ b/include/sys/zfs_boot.h
@@ -94,7 +94,7 @@ public:
virtual IOReturn reportMaxValidBlock(UInt64 *);
virtual IOReturn setWriteCacheState(bool enabled);
- virtual IOReturn getWriteCacheState(bool *enabled);
+ virtual IOReturn getWriteCacheState(bool *enabled);
private:
/* These are declared class static to share across instances */
diff --git a/include/sys/zvolIO.h b/include/sys/zvolIO.h
index 39d21dd..315a22e 100644
--- a/include/sys/zvolIO.h
+++ b/include/sys/zvolIO.h
@@ -57,7 +57,7 @@ public:
virtual IOService* probe(IOService* provider, SInt32* score);
virtual bool start(IOService* provider);
virtual void stop(IOService* provider);
-
+
virtual bool handleOpen(IOService *client,
IOOptionBits options, void *arg);
virtual bool handleIsOpen(const IOService *client) const;
diff --git a/module/zfs/ZFSDataset.cpp b/module/zfs/ZFSDataset.cpp
index 1775981..699776a 100644
--- a/module/zfs/ZFSDataset.cpp
+++ b/module/zfs/ZFSDataset.cpp
@@ -697,10 +697,16 @@ volatile SInt64 num_sync = 0;
/*
* Compatibility method simulates a barrier sync as a no-op.
*/
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
IOReturn
ZFSDataset::synchronize(IOService *client,
UInt64 byteStart, UInt64 byteCount,
IOStorageSynchronizeOptions options)
+#else
+IOReturn
+ZFSDataset::synchronizeCache(IOService *client)
+#endif
{
#ifdef DEBUG
SInt64 cur_sync = 0;
@@ -719,7 +725,12 @@ ZFSDataset::synchronize(IOService *client,
IOReturn
ZFSDataset::unmap(IOService *client,
IOStorageExtent *extents, UInt32 extentsCount,
- IOStorageUnmapOptions options)
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
+ IOStorageUnmapOptions options)
+#else
+ UInt32 options)
+#endif
{
DPRINTF_FUNC();
return (kIOReturnUnsupported);
@@ -761,6 +772,8 @@ ZFSDataset::unlockPhysicalExtents(IOService *client)
/*
* Compatibility method returns failure (unsupported).
*/
+#if defined (MAC_OS_X_VERSION_10_10) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10)
IOReturn
ZFSDataset::setPriority(IOService *client,
IOStorageExtent *extents, UInt32 extentsCount,
@@ -770,6 +783,7 @@ ZFSDataset::setPriority(IOService *client,
return (kIOReturnUnsupported);
//return (IOMedia::setPriority(client, extents, extentsCount, priority));
}
+#endif
/*
* Compatibility method returns default system blocksize.
diff --git a/module/zfs/ZFSDatasetScheme.cpp b/module/zfs/ZFSDatasetScheme.cpp
index c9a673d..37419e5 100644
--- a/module/zfs/ZFSDatasetScheme.cpp
+++ b/module/zfs/ZFSDatasetScheme.cpp
@@ -923,7 +923,9 @@ ZFSDatasetScheme::addDataset(const char *osname)
/* Set location in plane and partiton ID property */
dataset->setLocation(location);
+#ifdef kIOMediaBaseKey
dataset->setProperty(kIOMediaBaseKey, 0ULL, 64);
+#endif
dataset->setProperty(kIOMediaPartitionIDKey, part_id, 32);
// This sets the "diskutil list -> TYPE" field
@@ -1054,11 +1056,17 @@ ZFSDatasetScheme::write(IOService *client,
IOStorage::complete(completion, kIOReturnError, 0);
}
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
IOReturn
ZFSDatasetScheme::synchronize(IOService *client,
UInt64 byteStart,
UInt64 byteCount,
IOStorageSynchronizeOptions options)
+#else
+IOReturn
+ZFSDatasetScheme::synchronizeCache(IOService *client)
+#endif
{
return (kIOReturnUnsupported);
}
@@ -1067,7 +1075,12 @@ IOReturn
ZFSDatasetScheme::unmap(IOService *client,
IOStorageExtent *extents,
UInt32 extentsCount,
- IOStorageUnmapOptions options)
+#if defined (MAC_OS_X_VERSION_10_11) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)
+ IOStorageUnmapOptions options)
+#else
+ UInt32 options)
+#endif
{
return (kIOReturnUnsupported);
}
@@ -1092,6 +1105,8 @@ ZFSDatasetScheme::unlockPhysicalExtents(IOService *client)
return;
}
+#if defined (MAC_OS_X_VERSION_10_10) && \
+ (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10)
IOReturn
ZFSDatasetScheme::setPriority(IOService *client,
IOStorageExtent *extents,
@@ -1100,3 +1115,4 @@ ZFSDatasetScheme::setPriority(IOService *client,
{
return (kIOReturnUnsupported);
}
+#endif
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index 6e6e1ba..592d0aa 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -2420,8 +2420,12 @@ zfs_vfs_getattr(struct mount *mp, struct vfs_attr *fsap, __unused vfs_context_t
ATTR_CMN_EXTENDED_SECURITY |
ATTR_CMN_UUID |
ATTR_CMN_GRPUUID |
+#ifdef ATTR_CMN_DOCUMENT_ID
ATTR_CMN_DOCUMENT_ID |
+#endif
+#ifdef ATTR_CMN_GEN_COUNT
ATTR_CMN_GEN_COUNT |
+#endif
0;
fsap->f_attributes.validattr.volattr =
ATTR_VOL_FSTYPE |
@@ -2484,9 +2488,12 @@ zfs_vfs_getattr(struct mount *mp, struct vfs_attr *fsap, __unused vfs_context_t
ATTR_CMN_EXTENDED_SECURITY |
ATTR_CMN_UUID |
ATTR_CMN_GRPUUID |
+#ifdef ATTR_CMN_DOCUMENT_ID
ATTR_CMN_DOCUMENT_ID |
+#endif
+#ifdef ATTR_CMN_GEN_COUNT
ATTR_CMN_GEN_COUNT |
-
+#endif
0;
fsap->f_attributes.nativeattr.volattr =
ATTR_VOL_FSTYPE |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment