[PATCH 3/5 v2] JFFS2: Update Linux compatibility layer
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Sep 16 09:01:01 UTC 2013
Modify compatbility layer for RTEMS. Add support for Linux 3.11 based
JFFS2.
---
cpukit/libfs/src/jffs2/include/asm/bug.h | 6 ++-
cpukit/libfs/src/jffs2/include/asm/page.h | 7 +--
cpukit/libfs/src/jffs2/include/linux/compiler.h | 1 +
cpukit/libfs/src/jffs2/include/linux/crc32.h | 2 +
cpukit/libfs/src/jffs2/include/linux/fs.h | 25 ++++++-
.../libfs/src/jffs2/include/linux/kernel-rtems.h | 30 ++++++++
cpukit/libfs/src/jffs2/include/linux/kernel.h | 76 +++++++++++++++++---
cpukit/libfs/src/jffs2/include/linux/list.h | 14 ++++
cpukit/libfs/src/jffs2/include/linux/magic.h | 6 ++
cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h | 18 +++++
cpukit/libfs/src/jffs2/include/linux/mutex.h | 29 ++++++++
cpukit/libfs/src/jffs2/include/linux/posix_acl.h | 3 +
cpukit/libfs/src/jffs2/include/linux/rbtree.h | 24 ++++---
cpukit/libfs/src/jffs2/include/linux/rwsem.h | 16 +----
cpukit/libfs/src/jffs2/include/linux/sched.h | 2 +
cpukit/libfs/src/jffs2/include/linux/slab.h | 3 +-
cpukit/libfs/src/jffs2/include/linux/timer.h | 4 -
cpukit/libfs/src/jffs2/include/linux/types.h | 24 ++++---
cpukit/libfs/src/jffs2/include/linux/uio.h | 4 +
cpukit/libfs/src/jffs2/include/linux/wait.h | 3 +-
cpukit/libfs/src/jffs2/include/linux/workqueue.h | 1 -
cpukit/libfs/src/jffs2/include/linux/xattr.h | 7 ++
cpukit/libfs/src/jffs2/include/linux/zlib.h | 2 +-
cpukit/libfs/src/jffs2/include/linux/zutil.h | 2 +-
cpukit/libfs/src/jffs2/src/compat-rbtree.c | 18 ++++-
25 files changed, 261 insertions(+), 66 deletions(-)
create mode 100644 cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
create mode 100644 cpukit/libfs/src/jffs2/include/linux/magic.h
create mode 100644 cpukit/libfs/src/jffs2/include/linux/mutex.h
create mode 100644 cpukit/libfs/src/jffs2/include/linux/posix_acl.h
create mode 100644 cpukit/libfs/src/jffs2/include/linux/uio.h
create mode 100644 cpukit/libfs/src/jffs2/include/linux/xattr.h
diff --git a/cpukit/libfs/src/jffs2/include/asm/bug.h b/cpukit/libfs/src/jffs2/include/asm/bug.h
index 060eb27..190e8cf 100644
--- a/cpukit/libfs/src/jffs2/include/asm/bug.h
+++ b/cpukit/libfs/src/jffs2/include/asm/bug.h
@@ -1,6 +1,10 @@
#ifndef __ASM_BUG_H__
#define __ASM_BUG_H__
-#define BUG() do { diag_printf("BUG() at %s %d\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
+#include <assert.h>
+
+#define BUG() assert(0)
+
+#define WARN_ON(condition) do { } while (0)
#endif /* __ASM_BUG_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/asm/page.h b/cpukit/libfs/src/jffs2/include/asm/page.h
index d77a39a..a1956f7 100644
--- a/cpukit/libfs/src/jffs2/include/asm/page.h
+++ b/cpukit/libfs/src/jffs2/include/asm/page.h
@@ -1,11 +1,6 @@
#ifndef __ASM_PAGE_H__
#define __ASM_PAGE_H__
-#include <pkgconf/linux_compat.h>
-
-/* These aren't used by much yet. If that changes, you might want
- to make them actually correct :) */
-#define PAGE_SIZE (0x1 << PAGE_SHIFT)
-
+#include <sys/param.h>
#endif /* __ASM_PAGE_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/compiler.h b/cpukit/libfs/src/jffs2/include/linux/compiler.h
index fb25365..fb6c7c3 100644
--- a/cpukit/libfs/src/jffs2/include/linux/compiler.h
+++ b/cpukit/libfs/src/jffs2/include/linux/compiler.h
@@ -3,5 +3,6 @@
#define likely(x) (x)
#define unlikely(x) (x)
+#define uninitialized_var(x) x = x
#endif /* __LINUX_COMPILER_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/crc32.h b/cpukit/libfs/src/jffs2/include/linux/crc32.h
index 8d19a1e..d7fa071 100644
--- a/cpukit/libfs/src/jffs2/include/linux/crc32.h
+++ b/cpukit/libfs/src/jffs2/include/linux/crc32.h
@@ -1,8 +1,10 @@
#ifndef CRC32_H
#define CRC32_H
+#include <zlib.h>
#include <cyg/crc/crc.h>
+#undef crc32
#define crc32(val, s, len) cyg_crc32_accumulate(val, (unsigned char *)s, len)
#endif
diff --git a/cpukit/libfs/src/jffs2/include/linux/fs.h b/cpukit/libfs/src/jffs2/include/linux/fs.h
index c2f173a..8da9880 100644
--- a/cpukit/libfs/src/jffs2/include/linux/fs.h
+++ b/cpukit/libfs/src/jffs2/include/linux/fs.h
@@ -2,12 +2,31 @@
#define __LINUX_FS_H__
#include <linux/stat.h>
-/*
- * File types
- */
+#include <sys/types.h>
+#include <sys/time.h>
+
#define DT_UNKNOWN 0
#define DT_DIR 4
#define DT_REG 8
+#define DT_LNK 10
+
+#define ATTR_MODE (1U << 0)
+#define ATTR_UID (1U << 1)
+#define ATTR_GID (1U << 2)
+#define ATTR_SIZE (1U << 3)
+#define ATTR_ATIME (1U << 4)
+#define ATTR_MTIME (1U << 5)
+#define ATTR_CTIME (1U << 6)
+struct iattr {
+ unsigned int ia_valid;
+ mode_t ia_mode;
+ uid_t ia_uid;
+ gid_t ia_gid;
+ off_t ia_size;
+ time_t ia_atime;
+ time_t ia_mtime;
+ time_t ia_ctime;
+};
#endif /* __LINUX_FS_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h b/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
new file mode 100644
index 0000000..29c4f31
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef __LINUX_RTEMS_IMPL_H__
+#define __LINUX_RTEMS_IMPL_H__
+
+static inline char *do_kmemdup(const char *s, size_t n)
+{
+ char *dup = malloc(n + 1);
+
+ if (dup != 0) {
+ dup[n] = '\0';
+ dup = memcpy(dup, s, n);
+ }
+
+ return dup;
+}
+
+#endif /* __LINUX_RTEMS_IMPL_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/kernel.h b/cpukit/libfs/src/jffs2/include/linux/kernel.h
index e5d8d90..3dc0ba1 100644
--- a/cpukit/libfs/src/jffs2/include/linux/kernel.h
+++ b/cpukit/libfs/src/jffs2/include/linux/kernel.h
@@ -1,28 +1,84 @@
#ifndef __LINUX_KERNEL_H__
#define __LINUX_KERNEL_H__
-#define jiffies ((unsigned long)cyg_current_time())
+#include <rtems.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "kernel-rtems.h"
+
+#define jiffies ((unsigned long)rtems_clock_get_ticks_since_boot())
#define ERR_PTR(err) ((void*)(err))
#define PTR_ERR(err) ((unsigned long)(err))
#define IS_ERR(err) ((unsigned long)err > (unsigned long)-1000L)
+static inline void *ERR_CAST(const void *ptr)
+{
+ return (void *) (uintptr_t) ptr;
+}
#define CURRENT_TIME cyg_timestamp()
-#define KERN_EMERG "<0>" // system is unusable
-#define KERN_ALERT "<1>" // action must be taken immediately
-#define KERN_CRIT "<2>" // critical conditions
-#define KERN_ERR "<3>" // error conditions
-#define KERN_WARNING "<4>" // warning conditions
-#define KERN_NOTICE "<5>" // normal but significant condition
-#define KERN_INFO "<6>" // informational
-#define KERN_DEBUG "<7>" // debug-level messages
-#define printk diag_printf
+#define KERN_EMERG "<0>"
+#define KERN_ALERT "<1>"
+#define KERN_CRIT "<2>"
+#define KERN_ERR "<3>"
+#define KERN_WARNING "<4>"
+#define KERN_NOTICE "<5>"
+#define KERN_INFO "<6>"
+#define KERN_DEBUG "<7>"
+#define KERN_CONT ""
+
+#ifndef pr_fmt
+#define pr_fmt(fmt) fmt
+#endif
+
+#define pr_emerg(fmt, ...) \
+ printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_alert(fmt, ...) \
+ printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_crit(fmt, ...) \
+ printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_err(fmt, ...) \
+ printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warning(fmt, ...) \
+ printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warn pr_warning
+#define pr_notice(fmt, ...) \
+ printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_info(fmt, ...) \
+ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont(fmt, ...) \
+ printk(KERN_CONT fmt, ##__VA_ARGS__)
+
+#ifdef DEBUG
+#define pr_debug(fmt, ...) \
+ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+static inline int no_printk(const char *fmt, ...)
+{
+ (void) fmt;
+ return 0;
+}
+#define pr_debug(fmt, ...) \
+ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
#define min(x,y) (x<y?x:y)
#define max(x,y) (x<y?y:x)
#define min_t(t, x,y) ((t)x<(t)y?(t)x:(t)y)
+#define capable(x) 0
+
+#define kmemdup(x, y, z) do_kmemdup(x, y)
+
+#define from_kuid(x, y) (y)
+#define from_kgid(x, y) (y)
+#define i_uid_read(x) ((x)->i_uid)
+#define i_gid_read(x) ((x)->i_gid)
+#define i_uid_write(x, y) do { (x)->i_uid = (y); } while (0)
+#define i_gid_write(x, y) do { (x)->i_gid = (y); } while (0)
+#define truncate_setsize(x, y) do { (x)->i_size = (y); } while (0)
#endif /* __LINUX_KERNEL_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/list.h b/cpukit/libfs/src/jffs2/include/linux/list.h
index e9ebab1..4dc8a5a 100644
--- a/cpukit/libfs/src/jffs2/include/linux/list.h
+++ b/cpukit/libfs/src/jffs2/include/linux/list.h
@@ -103,6 +103,20 @@ list_del( struct list_head *ent )
ent->next->prev = ent->prev;
} /* list_del() */
+static __inline__ void
+list_move( struct list_head *list, struct list_head *head )
+{
+ list_del( list );
+ list_add( list, head );
+}
+
+static __inline__ void
+list_move_tail( struct list_head *list, struct list_head *head )
+{
+ list_del( list );
+ list_add_tail( list, head );
+}
+
/* Is this list empty? */
static __inline__ int
list_empty( struct list_head *list )
diff --git a/cpukit/libfs/src/jffs2/include/linux/magic.h b/cpukit/libfs/src/jffs2/include/linux/magic.h
new file mode 100644
index 0000000..07ba6b6
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/magic.h
@@ -0,0 +1,6 @@
+#ifndef _LINUX_MAGIC_H
+#define _LINUX_MAGIC_H
+
+#define JFFS2_SUPER_MAGIC 0x72b6
+
+#endif /* _LINUX_MAGIC_H */
diff --git a/cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h b/cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h
index 817d31c..bcf0a9a 100644
--- a/cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h
+++ b/cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h
@@ -1,5 +1,23 @@
#ifndef __LINUX_MTD_MTD_H__
#define __LINUX_MTD_MTD_H__
+#include <linux/slab.h>
+#include <errno.h>
+
+#define MTD_FAIL_ADDR_UNKNOWN -1LL
+
+static inline int do_mtd_point(size_t *retlen, void **ebuf)
+{
+ *retlen = 0;
+ *ebuf = NULL;
+
+ return -EOPNOTSUPP;
+}
+
+#define mtd_point(a, b, c, d, e, f) do_mtd_point(d, e)
+
+#define mtd_unpoint(a, b, c) do { } while (0)
+
+#define mtd_kmalloc_up_to(a, b) kmalloc(*(b), GFP_KERNEL)
#endif /* __LINUX_MTD_MTD_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/mutex.h b/cpukit/libfs/src/jffs2/include/linux/mutex.h
new file mode 100644
index 0000000..f5e1efb
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/mutex.h
@@ -0,0 +1,29 @@
+#ifndef __LINUX_MUTEX_H
+#define __LINUX_MUTEX_H
+
+struct mutex { };
+
+#define DEFINE_MUTEX(m) struct mutex m
+
+static inline void mutex_init(struct mutex *m)
+{
+ (void) m;
+}
+
+static inline void mutex_lock(struct mutex *m)
+{
+ (void) m;
+}
+
+static inline int mutex_lock_interruptible(struct mutex *m)
+{
+ (void) m;
+ return 0;
+}
+
+static inline void mutex_unlock(struct mutex *m)
+{
+ (void) m;
+}
+
+#endif
diff --git a/cpukit/libfs/src/jffs2/include/linux/posix_acl.h b/cpukit/libfs/src/jffs2/include/linux/posix_acl.h
new file mode 100644
index 0000000..49504bc
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/posix_acl.h
@@ -0,0 +1,3 @@
+#ifndef __LINUX_POSIX_ACL_H
+#define __LINUX_POSIX_ACL_H
+#endif
diff --git a/cpukit/libfs/src/jffs2/include/linux/rbtree.h b/cpukit/libfs/src/jffs2/include/linux/rbtree.h
index fef5f71..73cf937 100644
--- a/cpukit/libfs/src/jffs2/include/linux/rbtree.h
+++ b/cpukit/libfs/src/jffs2/include/linux/rbtree.h
@@ -1,21 +1,21 @@
#ifndef _LINUX_RBTREE_H
#define _LINUX_RBTREE_H
+#include <stddef.h>
struct rb_node {
- struct rb_node *rb_left; /* left element */
- struct rb_node *rb_right; /* right element */
- struct rb_node *rb_parent; /* parent element */
- int rb_color; /* node color */
+ struct rb_node *rb_left;
+ struct rb_node *rb_right;
+ struct rb_node *rb_parent;
+ int rb_color;
};
struct rb_root {
- struct rb_node *rb_node; /* root of the tree */
+ struct rb_node *rb_node;
};
-#define NULL ((void *)0)
-#define RB_ROOT ((struct rb_root){NULL})
+#define RB_ROOT ((struct rb_root){0})
#define rb_entry(p, container, field) \
- ((container *) ((char *)p - ((char *)&(((container *)0)->field))))
+ ((container *) ((char *)p - offsetof(container, field)))
#define RB_BLACK 0
#define RB_RED 1
@@ -24,12 +24,11 @@ struct rb_root {
extern void rb_insert_color(struct rb_node *, struct rb_root *);
extern void rb_erase(struct rb_node *, struct rb_root *);
-/* Find logical next and previous nodes in a tree */
extern struct rb_node *rb_next(struct rb_node *);
extern struct rb_node *rb_prev(struct rb_node *);
extern struct rb_node *rb_first(struct rb_root *);
+extern struct rb_node *rb_last(struct rb_root *);
-/* Fast replacement of a single node without remove/rebalance/add/rebalance */
extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
struct rb_root *root);
@@ -43,4 +42,9 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
*rb_link = node;
}
+static inline struct rb_node *rb_parent(struct rb_node * node)
+{
+ return node->rb_parent;
+}
+
#endif /* _LINUX_RBTREE_H */
diff --git a/cpukit/libfs/src/jffs2/include/linux/rwsem.h b/cpukit/libfs/src/jffs2/include/linux/rwsem.h
index d648a15..57bfdf1 100644
--- a/cpukit/libfs/src/jffs2/include/linux/rwsem.h
+++ b/cpukit/libfs/src/jffs2/include/linux/rwsem.h
@@ -1,20 +1,6 @@
#ifndef __LINUX_RWSEM_H__
#define __LINUX_RWSEM_H__
-// eCos does not have the concept of a read/write semaphore. So just
-// map them onto normal semaphores and hope we don't deadlock
-// somewhere.
-
-#include <asm/semaphore.h>
-
struct rw_semaphore;
-#define down_read(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
-#define down_read_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
-#define down_write(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
-#define down_write_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
-#define up_read(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
-#define up_write(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
-#define downgrade_write(sem)
-
-#endif // __LINUX_RWSEM_H__
+#endif /* __LINUX_RWSEM_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/sched.h b/cpukit/libfs/src/jffs2/include/linux/sched.h
index 14a7359..1f4e7da 100644
--- a/cpukit/libfs/src/jffs2/include/linux/sched.h
+++ b/cpukit/libfs/src/jffs2/include/linux/sched.h
@@ -1,7 +1,9 @@
#ifndef __LINUX_SCHED_H__
#define __LINUX_SCHED_H__
+#define schedule() do { } while(0)
#define cond_resched() do { } while(0)
#define signal_pending(x) (0)
+#define set_current_state(x) do { } while (0)
#endif /* __LINUX_SCHED_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/slab.h b/cpukit/libfs/src/jffs2/include/linux/slab.h
index fff3949..00ddbb2 100644
--- a/cpukit/libfs/src/jffs2/include/linux/slab.h
+++ b/cpukit/libfs/src/jffs2/include/linux/slab.h
@@ -3,8 +3,9 @@
#include <stdlib.h>
-#include <asm/page.h> /* Don't ask. Linux headers are a mess. */
+#include <asm/page.h>
+#define kzalloc(x, y) calloc(1, x)
#define kmalloc(x, y) malloc(x)
#define kfree(x) free(x)
#define vmalloc(x) malloc(x)
diff --git a/cpukit/libfs/src/jffs2/include/linux/timer.h b/cpukit/libfs/src/jffs2/include/linux/timer.h
index 80e9ef5..15da863 100644
--- a/cpukit/libfs/src/jffs2/include/linux/timer.h
+++ b/cpukit/libfs/src/jffs2/include/linux/timer.h
@@ -1,10 +1,6 @@
#ifndef __LINUX_TIMER_H__
#define __LINUX_TIMER_H__
-/* Not yet */
-
struct timer_list { } ;
-
#endif /* __LINUX_TIMER_H__ */
-
diff --git a/cpukit/libfs/src/jffs2/include/linux/types.h b/cpukit/libfs/src/jffs2/include/linux/types.h
index 56665b7..a85b856 100644
--- a/cpukit/libfs/src/jffs2/include/linux/types.h
+++ b/cpukit/libfs/src/jffs2/include/linux/types.h
@@ -1,19 +1,25 @@
#ifndef __LINUX_TYPES_H__
#define __LINUX_TYPES_H__
-#include "cyg/infra/cyg_type.h"
-
-#define uint8_t cyg_uint8
-#define uint16_t cyg_uint16
-#define uint32_t cyg_uint32
-
-#define int8_t cyg_int8
-#define int16_t cyg_int16
-#define int32_t cyg_int32
+#include <sys/types.h>
+#include <stdint.h>
#define loff_t off_t
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
#define kvec iovec
+
+struct qstr {
+ const char *name;
+ size_t len;
+};
+
#endif /* __LINUX_TYPES_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/uio.h b/cpukit/libfs/src/jffs2/include/linux/uio.h
new file mode 100644
index 0000000..f58e0ad
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/uio.h
@@ -0,0 +1,4 @@
+#ifndef _LINUX_UIO_H
+#define _LINUX_UIO_H
+
+#endif /* _LINUX_UIO_H */
diff --git a/cpukit/libfs/src/jffs2/include/linux/wait.h b/cpukit/libfs/src/jffs2/include/linux/wait.h
index 2b422e3..ba355b5 100644
--- a/cpukit/libfs/src/jffs2/include/linux/wait.h
+++ b/cpukit/libfs/src/jffs2/include/linux/wait.h
@@ -9,7 +9,6 @@ typedef struct { } wait_queue_head_t;
#define remove_wait_queue(wait,old_wait) do{} while (0)
#define DECLARE_WAITQUEUE(wait,current) do{} while (0)
-static inline void wake_up(wait_queue_head_t *erase_wait)
-{ /* Only used for waking up threads blocks on erases. Not used in eCos */ }
+static inline void wake_up(wait_queue_head_t *erase_wait) { }
#endif /* __LINUX_WAIT_H__ */
diff --git a/cpukit/libfs/src/jffs2/include/linux/workqueue.h b/cpukit/libfs/src/jffs2/include/linux/workqueue.h
index 8c900a4..90d9828 100644
--- a/cpukit/libfs/src/jffs2/include/linux/workqueue.h
+++ b/cpukit/libfs/src/jffs2/include/linux/workqueue.h
@@ -1,7 +1,6 @@
#ifndef __LINUX_WORKQUEUE_H__
#define __LINUX_WORKQUEUE_H__
-/* We don't do this yet */
struct work_struct { } ;
#define INIT_WORK(x,y,z) /* */
diff --git a/cpukit/libfs/src/jffs2/include/linux/xattr.h b/cpukit/libfs/src/jffs2/include/linux/xattr.h
new file mode 100644
index 0000000..9b17d44
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/xattr.h
@@ -0,0 +1,7 @@
+#ifndef _LINUX_XATTR_H
+#define _LINUX_XATTR_H
+
+#include <asm/atomic.h>
+#include <linux/types.h>
+
+#endif /* _LINUX_XATTR_H */
diff --git a/cpukit/libfs/src/jffs2/include/linux/zlib.h b/cpukit/libfs/src/jffs2/include/linux/zlib.h
index 9de691e..783aea1 100644
--- a/cpukit/libfs/src/jffs2/include/linux/zlib.h
+++ b/cpukit/libfs/src/jffs2/include/linux/zlib.h
@@ -1,7 +1,7 @@
#ifndef __LINUX_ZLIB_H__
#define __LINUX_ZLIB_H__
-#include <cyg/compress/zlib.h>
+#include <zlib.h>
#define zlib_deflateInit(x,y) deflateInit(x,y)
#define zlib_deflate(x,y) deflate(x,y)
diff --git a/cpukit/libfs/src/jffs2/include/linux/zutil.h b/cpukit/libfs/src/jffs2/include/linux/zutil.h
index c3774ba..d298658 100644
--- a/cpukit/libfs/src/jffs2/include/linux/zutil.h
+++ b/cpukit/libfs/src/jffs2/include/linux/zutil.h
@@ -1,6 +1,6 @@
#ifndef __LINUX_ZUTIL_H__
#define __LINUX_ZUTIL_H__
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+#define PRESET_DICT 0x20
#endif /* __LINUX_ZUTIL_H__ */
diff --git a/cpukit/libfs/src/jffs2/src/compat-rbtree.c b/cpukit/libfs/src/jffs2/src/compat-rbtree.c
index 5bc1cc5..a73cdc2 100644
--- a/cpukit/libfs/src/jffs2/src/compat-rbtree.c
+++ b/cpukit/libfs/src/jffs2/src/compat-rbtree.c
@@ -119,8 +119,9 @@
RB_LEFT(tmp) = (elm); \
RB_PARENT(elm) = (tmp); \
RB_AUGMENT(tmp); \
- if ((RB_PARENT(tmp))) \
+ if ((RB_PARENT(tmp))) { \
RB_AUGMENT(RB_PARENT(tmp)); \
+ } \
} while (0)
#define RB_ROTATE_RIGHT(head, elm, tmp) do { \
@@ -139,8 +140,9 @@
RB_RIGHT(tmp) = (elm); \
RB_PARENT(elm) = (tmp); \
RB_AUGMENT(tmp); \
- if ((RB_PARENT(tmp))) \
+ if ((RB_PARENT(tmp))) { \
RB_AUGMENT(RB_PARENT(tmp)); \
+ } \
} while(0)
/* Note args swapped to match Linux */
@@ -384,6 +386,18 @@ struct rb_node *rb_first(struct rb_root *root)
return n;
}
+struct rb_node *rb_last(struct rb_root *root)
+{
+ struct rb_node *n;
+
+ n = root->rb_node;
+ if (!n)
+ return 0;
+ while (n->rb_right)
+ n = n->rb_right;
+ return n;
+}
+
void rb_replace_node(struct rb_node *victim, struct rb_node *new,
struct rb_root *root)
{
--
1.7.7
More information about the devel
mailing list