Skip to content

Instantly share code, notes, and snippets.

@dtjm
Created September 9, 2011 20:52
Show Gist options
  • Save dtjm/1207301 to your computer and use it in GitHub Desktop.
Save dtjm/1207301 to your computer and use it in GitHub Desktop.
cramfs patch for OS X
--- cramfs-1.1/cramfsck.c 2011-09-09 13:39:01.000000000 -0700
+++ cramfs-dtjm/cramfsck.c 2011-09-09 13:39:02.000000000 -0700
@@ -47,14 +47,17 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <sys/sysmacros.h>
#include <utime.h>
#include <sys/ioctl.h>
#define _LINUX_STRING_H_
-#include <linux/fs.h>
#include <linux/cramfs_fs.h>
#include <zlib.h>
+#ifndef __APPLE__
+#include <sys/sysmacros.h>
+#include <linux/fs.h>
+#endif
+
/* Exit codes used by fsck-type programs */
#define FSCK_OK 0 /* No errors */
#define FSCK_NONDESTRUCT 1 /* File system errors corrected */
diff -ur cramfs-1.1/linux/cramfs_fs.h cramfs-dtjm/linux/cramfs_fs.h
--- cramfs-1.1/linux/cramfs_fs.h 2011-09-09 13:39:01.000000000 -0700
+++ cramfs-dtjm/linux/cramfs_fs.h 2011-09-09 13:39:02.000000000 -0700
@@ -1,6 +1,15 @@
#ifndef __CRAMFS_H
#define __CRAMFS_H
+#ifdef __APPLE__
+typedef long long loff_t;
+#define BLKGETSIZE 512
+#endif
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
#ifndef __KERNEL__
typedef unsigned char u8;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment