Changeset 78b85286 in rtems


Ignore:
Timestamp:
Sep 12, 2013, 2:53:41 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
3c96bee
Parents:
672038b
git-author:
Sebastian Huber <sebastian.huber@…> (09/12/13 14:53:41)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/19/13 11:16:06)
Message:

JFFS2: Update Linux compatibility layer

Modify compatbility layer for RTEMS. Add support for Linux 3.11 based
JFFS2.

Location:
cpukit/libfs/src/jffs2
Files:
6 added
19 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/jffs2/include/asm/bug.h

    r672038b r78b85286  
    22#define __ASM_BUG_H__
    33
    4 #define BUG() do { diag_printf("BUG() at %s %d\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
     4#include <assert.h>
     5
     6#define BUG() assert(0)
     7
     8#define WARN_ON(condition) do { } while (0)
    59
    610#endif /* __ASM_BUG_H__ */
  • cpukit/libfs/src/jffs2/include/asm/page.h

    r672038b r78b85286  
    22#define __ASM_PAGE_H__
    33
    4 #include <pkgconf/linux_compat.h>
    5 
    6 /* These aren't used by much yet. If that changes, you might want
    7    to make them actually correct :) */
    8 #define PAGE_SIZE  (0x1 << PAGE_SHIFT)
    9 
     4#include <sys/param.h>
    105
    116#endif /* __ASM_PAGE_H__ */
  • cpukit/libfs/src/jffs2/include/linux/compiler.h

    r672038b r78b85286  
    44#define likely(x) (x)
    55#define unlikely(x) (x)
     6#define uninitialized_var(x) x = x
    67
    78#endif /* __LINUX_COMPILER_H__ */
  • cpukit/libfs/src/jffs2/include/linux/crc32.h

    r672038b r78b85286  
    22#define CRC32_H
    33
     4#include <zlib.h>
    45#include <cyg/crc/crc.h>
    56
     7#undef crc32
    68#define crc32(val, s, len) cyg_crc32_accumulate(val, (unsigned char *)s, len)
    79
  • cpukit/libfs/src/jffs2/include/linux/fs.h

    r672038b r78b85286  
    33
    44#include <linux/stat.h>
    5 /*
    6  * File types
    7  */
     5#include <sys/types.h>
     6#include <sys/time.h>
     7
    88#define DT_UNKNOWN      0
    99#define DT_DIR          4
    1010#define DT_REG          8
     11#define DT_LNK          10
    1112
     13#define ATTR_MODE       (1U << 0)
     14#define ATTR_UID        (1U << 1)
     15#define ATTR_GID        (1U << 2)
     16#define ATTR_SIZE       (1U << 3)
     17#define ATTR_ATIME      (1U << 4)
     18#define ATTR_MTIME      (1U << 5)
     19#define ATTR_CTIME      (1U << 6)
     20
     21struct iattr {
     22        unsigned int    ia_valid;
     23        mode_t          ia_mode;
     24        uid_t           ia_uid;
     25        gid_t           ia_gid;
     26        off_t           ia_size;
     27        time_t          ia_atime;
     28        time_t          ia_mtime;
     29        time_t          ia_ctime;
     30};
    1231
    1332#endif /* __LINUX_FS_H__ */
  • cpukit/libfs/src/jffs2/include/linux/kernel.h

    r672038b r78b85286  
    22#define __LINUX_KERNEL_H__
    33
    4 #define jiffies ((unsigned long)cyg_current_time())
     4#include <rtems.h>
     5#include <stdlib.h>
     6#include <string.h>
     7
     8#include "kernel-rtems.h"
     9
     10#define jiffies ((unsigned long)rtems_clock_get_ticks_since_boot())
    511
    612#define ERR_PTR(err) ((void*)(err))
    713#define PTR_ERR(err) ((unsigned long)(err))
    814#define IS_ERR(err) ((unsigned long)err > (unsigned long)-1000L)
     15static inline void *ERR_CAST(const void *ptr)
     16{
     17        return (void *) (uintptr_t) ptr;
     18}
    919
    1020#define CURRENT_TIME cyg_timestamp()
    1121
    12 #define KERN_EMERG              "<0>" // system is unusable
    13 #define KERN_ALERT              "<1>" // action must be taken immediately
    14 #define KERN_CRIT               "<2>" // critical conditions
    15 #define KERN_ERR                "<3>" // error conditions
    16 #define KERN_WARNING            "<4>" // warning conditions
    17 #define KERN_NOTICE             "<5>" // normal but significant condition
    18 #define KERN_INFO               "<6>" // informational
    19 #define KERN_DEBUG              "<7>" // debug-level messages
    20 #define printk diag_printf
     22#define KERN_EMERG              "<0>"
     23#define KERN_ALERT              "<1>"
     24#define KERN_CRIT               "<2>"
     25#define KERN_ERR                "<3>"
     26#define KERN_WARNING            "<4>"
     27#define KERN_NOTICE             "<5>"
     28#define KERN_INFO               "<6>"
     29#define KERN_DEBUG              "<7>"
     30#define KERN_CONT               ""
     31
     32#ifndef pr_fmt
     33#define pr_fmt(fmt) fmt
     34#endif
     35
     36#define pr_emerg(fmt, ...) \
     37        printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
     38#define pr_alert(fmt, ...) \
     39        printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
     40#define pr_crit(fmt, ...) \
     41        printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
     42#define pr_err(fmt, ...) \
     43        printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
     44#define pr_warning(fmt, ...) \
     45        printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
     46#define pr_warn pr_warning
     47#define pr_notice(fmt, ...) \
     48        printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
     49#define pr_info(fmt, ...) \
     50        printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
     51#define pr_cont(fmt, ...) \
     52        printk(KERN_CONT fmt, ##__VA_ARGS__)
     53
     54#ifdef DEBUG
     55#define pr_debug(fmt, ...) \
     56        printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
     57#else
     58static inline int no_printk(const char *fmt, ...)
     59{
     60        (void) fmt;
     61        return 0;
     62}
     63#define pr_debug(fmt, ...) \
     64        no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
     65#endif
    2166
    2267#define min(x,y) (x<y?x:y)
     
    2469#define min_t(t, x,y) ((t)x<(t)y?(t)x:(t)y)
    2570
     71#define capable(x) 0
     72
     73#define kmemdup(x, y, z) do_kmemdup(x, y)
     74
     75#define from_kuid(x, y) (y)
     76#define from_kgid(x, y) (y)
     77#define i_uid_read(x) ((x)->i_uid)
     78#define i_gid_read(x) ((x)->i_gid)
     79#define i_uid_write(x, y) do { (x)->i_uid = (y); } while (0)
     80#define i_gid_write(x, y) do { (x)->i_gid = (y); } while (0)
     81#define truncate_setsize(x, y) do { (x)->i_size = (y); } while (0)
    2682
    2783#endif /* __LINUX_KERNEL_H__ */
  • cpukit/libfs/src/jffs2/include/linux/list.h

    r672038b r78b85286  
    104104} /* list_del() */
    105105
     106static __inline__ void
     107list_move( struct list_head *list, struct list_head *head )
     108{
     109    list_del( list );
     110    list_add( list, head );
     111}
     112
     113static __inline__ void
     114list_move_tail( struct list_head *list, struct list_head *head )
     115{
     116    list_del( list );
     117    list_add_tail( list, head );
     118}
     119
    106120/* Is this list empty? */
    107121static __inline__ int
  • cpukit/libfs/src/jffs2/include/linux/mtd/mtd.h

    r672038b r78b85286  
    22#define __LINUX_MTD_MTD_H__
    33
     4#include <linux/slab.h>
     5#include <errno.h>
     6
     7#define MTD_FAIL_ADDR_UNKNOWN -1LL
     8
     9static inline int do_mtd_point(size_t *retlen, void **ebuf)
     10{
     11        *retlen = 0;
     12        *ebuf = NULL;
     13
     14        return -EOPNOTSUPP;
     15}
     16
     17#define mtd_point(a, b, c, d, e, f) do_mtd_point(d, e)
     18
     19#define mtd_unpoint(a, b, c) do { } while (0)
     20
     21#define mtd_kmalloc_up_to(a, b) kmalloc(*(b), GFP_KERNEL)
    422
    523#endif /* __LINUX_MTD_MTD_H__ */
  • cpukit/libfs/src/jffs2/include/linux/rbtree.h

    r672038b r78b85286  
    22#define _LINUX_RBTREE_H
    33
     4#include <stddef.h>
    45
    56struct rb_node {
    6         struct rb_node *rb_left;        /* left element */
    7         struct rb_node *rb_right;       /* right element */
    8         struct rb_node *rb_parent;      /* parent element */
    9         int rb_color;                   /* node color */
     7        struct rb_node *rb_left;
     8        struct rb_node *rb_right;
     9        struct rb_node *rb_parent;
     10        int rb_color;
    1011};
    1112
    1213struct rb_root {
    13         struct rb_node *rb_node; /* root of the tree */
     14        struct rb_node *rb_node;
    1415};
    15 #define NULL ((void *)0)
    16 #define RB_ROOT ((struct rb_root){NULL})
     16#define RB_ROOT ((struct rb_root){0})
    1717#define rb_entry(p, container, field)           \
    18         ((container *) ((char *)p - ((char *)&(((container *)0)->field))))
     18        ((container *) ((char *)p - offsetof(container, field)))
    1919
    2020#define RB_BLACK        0
     
    2525extern void rb_erase(struct rb_node *, struct rb_root *);
    2626
    27 /* Find logical next and previous nodes in a tree */
    2827extern struct rb_node *rb_next(struct rb_node *);
    2928extern struct rb_node *rb_prev(struct rb_node *);
    3029extern struct rb_node *rb_first(struct rb_root *);
     30extern struct rb_node *rb_last(struct rb_root *);
    3131
    32 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
    3332extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
    3433                            struct rb_root *root);
     
    4443}
    4544
     45static inline struct rb_node *rb_parent(struct rb_node * node)
     46{
     47        return node->rb_parent;
     48}
     49
    4650#endif  /* _LINUX_RBTREE_H */
  • cpukit/libfs/src/jffs2/include/linux/rwsem.h

    r672038b r78b85286  
    22#define __LINUX_RWSEM_H__
    33
    4 // eCos does not have the concept of a read/write semaphore. So just
    5 // map them onto normal semaphores and hope we don't deadlock
    6 // somewhere.
    7 
    8 #include <asm/semaphore.h>
    9 
    104struct rw_semaphore;
    115
    12 #define down_read(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
    13 #define down_read_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
    14 #define down_write(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
    15 #define down_write_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
    16 #define up_read(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
    17 #define up_write(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
    18 #define downgrade_write(sem)
    19 
    20 #endif // __LINUX_RWSEM_H__
     6#endif /* __LINUX_RWSEM_H__ */
  • cpukit/libfs/src/jffs2/include/linux/sched.h

    r672038b r78b85286  
    22#define __LINUX_SCHED_H__
    33
     4#define schedule() do { } while(0)
    45#define cond_resched() do { } while(0)
    56#define signal_pending(x) (0)
     7#define set_current_state(x) do { } while (0)
    68
    79#endif /* __LINUX_SCHED_H__ */
  • cpukit/libfs/src/jffs2/include/linux/slab.h

    r672038b r78b85286  
    44#include <stdlib.h>
    55
    6 #include <asm/page.h> /* Don't ask. Linux headers are a mess. */
     6#include <asm/page.h>
    77
     8#define kzalloc(x, y) calloc(1, x)
    89#define kmalloc(x, y) malloc(x)
    910#define kfree(x) free(x)
  • cpukit/libfs/src/jffs2/include/linux/timer.h

    r672038b r78b85286  
    22#define __LINUX_TIMER_H__
    33
    4 /* Not yet */
    5 
    64struct timer_list { } ;
    75
    8 
    96#endif /* __LINUX_TIMER_H__ */
    10 
  • cpukit/libfs/src/jffs2/include/linux/types.h

    r672038b r78b85286  
    22#define __LINUX_TYPES_H__
    33
    4 #include "cyg/infra/cyg_type.h"
    5 
    6 #define uint8_t cyg_uint8
    7 #define uint16_t cyg_uint16
    8 #define uint32_t cyg_uint32
    9 
    10 #define int8_t cyg_int8
    11 #define int16_t cyg_int16
    12 #define int32_t cyg_int32
     4#include <sys/types.h>
     5#include <stdint.h>
    136
    147#define loff_t off_t
    158
     9typedef uint8_t u8;
     10typedef uint16_t u16;
     11typedef uint32_t u32;
     12
     13typedef uint8_t __u8;
     14typedef uint16_t __u16;
     15typedef uint32_t __u32;
    1616
    1717#define kvec iovec
     18
     19struct qstr {
     20        const char *name;
     21        size_t len;
     22};
     23
    1824#endif /* __LINUX_TYPES_H__ */
    1925
  • cpukit/libfs/src/jffs2/include/linux/wait.h

    r672038b r78b85286  
    1010#define DECLARE_WAITQUEUE(wait,current) do{} while (0)
    1111
    12 static inline void wake_up(wait_queue_head_t *erase_wait)
    13 { /* Only used for waking up threads blocks on erases. Not used in eCos */ }
     12static inline void wake_up(wait_queue_head_t *erase_wait) { }
    1413
    1514#endif /* __LINUX_WAIT_H__ */
  • cpukit/libfs/src/jffs2/include/linux/workqueue.h

    r672038b r78b85286  
    22#define __LINUX_WORKQUEUE_H__
    33
    4 /* We don't do this yet */
    54struct work_struct { } ;
    65
  • cpukit/libfs/src/jffs2/include/linux/zlib.h

    r672038b r78b85286  
    22#define __LINUX_ZLIB_H__
    33
    4 #include <cyg/compress/zlib.h>
     4#include <zlib.h>
    55
    66#define zlib_deflateInit(x,y) deflateInit(x,y)
  • cpukit/libfs/src/jffs2/include/linux/zutil.h

    r672038b r78b85286  
    22#define __LINUX_ZUTIL_H__
    33
    4 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
     4#define PRESET_DICT 0x20
    55
    66#endif /* __LINUX_ZUTIL_H__ */
  • cpukit/libfs/src/jffs2/src/compat-rbtree.c

    r672038b r78b85286  
    120120        RB_PARENT(elm) = (tmp);                                 \
    121121        RB_AUGMENT(tmp);                                        \
    122         if ((RB_PARENT(tmp)))                                   \
     122        if ((RB_PARENT(tmp))) {                                 \
    123123                RB_AUGMENT(RB_PARENT(tmp));                     \
     124        }                                                       \
    124125} while (0)
    125126
     
    140141        RB_PARENT(elm) = (tmp);                                 \
    141142        RB_AUGMENT(tmp);                                        \
    142         if ((RB_PARENT(tmp)))                                   \
     143        if ((RB_PARENT(tmp))) {                                 \
    143144                RB_AUGMENT(RB_PARENT(tmp));                     \
     145        }                                                       \
    144146} while(0)
    145147
     
    385387}
    386388
     389struct rb_node *rb_last(struct rb_root *root)
     390{
     391        struct rb_node  *n;
     392
     393        n = root->rb_node;
     394        if (!n)
     395                return 0;
     396        while (n->rb_right)
     397                n = n->rb_right;
     398        return n;
     399}
     400
    387401void rb_replace_node(struct rb_node *victim, struct rb_node *new,
    388402                     struct rb_root *root)
Note: See TracChangeset for help on using the changeset viewer.