uboot/fs/yaffs2/yportenv.h
<<
>>
Prefs
   1/*
   2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
   3 *
   4 * Copyright (C) 2002-2011 Aleph One Ltd.
   5 *   for Toby Churchill Ltd and Brightstar Engineering
   6 *
   7 * Created by Charles Manning <charles@aleph1.co.uk>
   8 *
   9 * This program is free software; you can redistribute it and/or modify
  10 * it under the terms of the GNU Lesser General Public License version 2.1 as
  11 * published by the Free Software Foundation.
  12 *
  13 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  14 */
  15
  16
  17#ifndef __YPORTENV_H__
  18#define __YPORTENV_H__
  19
  20#include <linux/types.h>
  21
  22/* Definition of types */
  23#ifdef CONFIG_YAFFS_DEFINES_TYPES
  24typedef unsigned char u8;
  25typedef unsigned short u16;
  26typedef unsigned u32;
  27#endif
  28
  29
  30#ifdef CONFIG_YAFFS_PROVIDE_DEFS
  31/* File types */
  32
  33
  34#define DT_UNKNOWN      0
  35#define DT_FIFO         1
  36#define DT_CHR          2
  37#define DT_DIR          4
  38#define DT_BLK          6
  39#define DT_REG          8
  40#define DT_LNK          10
  41#define DT_SOCK         12
  42#define DT_WHT          14
  43
  44
  45/*
  46 * Attribute flags.
  47 * These are or-ed together to select what has been changed.
  48 */
  49#define ATTR_MODE       1
  50#define ATTR_UID        2
  51#define ATTR_GID        4
  52#define ATTR_SIZE       8
  53#define ATTR_ATIME      16
  54#define ATTR_MTIME      32
  55#define ATTR_CTIME      64
  56
  57struct iattr {
  58        unsigned int ia_valid;
  59        unsigned ia_mode;
  60        unsigned ia_uid;
  61        unsigned ia_gid;
  62        unsigned ia_size;
  63        unsigned ia_atime;
  64        unsigned ia_mtime;
  65        unsigned ia_ctime;
  66        unsigned int ia_attr_flags;
  67};
  68
  69#endif
  70
  71
  72
  73#if defined CONFIG_YAFFS_WINCE
  74
  75#include "ywinceenv.h"
  76
  77
  78#elif defined CONFIG_YAFFS_DIRECT
  79
  80/* Direct interface */
  81#include "ydirectenv.h"
  82
  83#elif defined CONFIG_YAFFS_UTIL
  84
  85#include "yutilsenv.h"
  86
  87#else
  88/* Should have specified a configuration type */
  89#error Unknown configuration
  90
  91#endif
  92
  93#if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
  94
  95#ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
  96
  97#ifndef O_RDONLY
  98#define O_RDONLY        00
  99#endif
 100
 101#ifndef O_WRONLY
 102#define O_WRONLY        01
 103#endif
 104
 105#ifndef O_RDWR
 106#define O_RDWR          02
 107#endif
 108
 109#ifndef O_CREAT
 110#define O_CREAT         0100
 111#endif
 112
 113#ifndef O_EXCL
 114#define O_EXCL          0200
 115#endif
 116
 117#ifndef O_TRUNC
 118#define O_TRUNC         01000
 119#endif
 120
 121#ifndef O_APPEND
 122#define O_APPEND        02000
 123#endif
 124
 125#ifndef SEEK_SET
 126#define SEEK_SET        0
 127#endif
 128
 129#ifndef SEEK_CUR
 130#define SEEK_CUR        1
 131#endif
 132
 133#ifndef SEEK_END
 134#define SEEK_END        2
 135#endif
 136
 137#ifndef EBUSY
 138#define EBUSY   16
 139#endif
 140
 141#ifndef ENODEV
 142#define ENODEV  19
 143#endif
 144
 145#ifndef EINVAL
 146#define EINVAL  22
 147#endif
 148
 149#ifndef ENFILE
 150#define ENFILE  23
 151#endif
 152
 153#ifndef EBADF
 154#define EBADF   9
 155#endif
 156
 157#ifndef EACCES
 158#define EACCES  13
 159#endif
 160
 161#ifndef EXDEV
 162#define EXDEV   18
 163#endif
 164
 165#ifndef ENOENT
 166#define ENOENT  2
 167#endif
 168
 169#ifndef ENOSPC
 170#define ENOSPC  28
 171#endif
 172
 173#ifndef EROFS
 174#define EROFS   30
 175#endif
 176
 177#ifndef ERANGE
 178#define ERANGE 34
 179#endif
 180
 181#ifndef ENODATA
 182#define ENODATA 61
 183#endif
 184
 185#ifndef ENOTEMPTY
 186#define ENOTEMPTY 39
 187#endif
 188
 189#ifndef ENAMETOOLONG
 190#define ENAMETOOLONG 36
 191#endif
 192
 193#ifndef ENOMEM
 194#define ENOMEM 12
 195#endif
 196
 197#ifndef EFAULT
 198#define EFAULT 14
 199#endif
 200
 201#ifndef EEXIST
 202#define EEXIST 17
 203#endif
 204
 205#ifndef ENOTDIR
 206#define ENOTDIR 20
 207#endif
 208
 209#ifndef EISDIR
 210#define EISDIR 21
 211#endif
 212
 213#ifndef ELOOP
 214#define ELOOP   40
 215#endif
 216
 217
 218/* Mode flags */
 219
 220#ifndef S_IFMT
 221#define S_IFMT          0170000
 222#endif
 223
 224#ifndef S_IFSOCK
 225#define S_IFSOCK        0140000
 226#endif
 227
 228#ifndef S_IFIFO
 229#define S_IFIFO         0010000
 230#endif
 231
 232#ifndef S_IFCHR
 233#define S_IFCHR         0020000
 234#endif
 235
 236#ifndef S_IFBLK
 237#define S_IFBLK         0060000
 238#endif
 239
 240#ifndef S_IFLNK
 241#define S_IFLNK         0120000
 242#endif
 243
 244#ifndef S_IFDIR
 245#define S_IFDIR         0040000
 246#endif
 247
 248#ifndef S_IFREG
 249#define S_IFREG         0100000
 250#endif
 251
 252#define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)
 253#define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
 254#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
 255#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
 256#define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
 257#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
 258#define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
 259
 260
 261#ifndef S_IREAD
 262#define S_IREAD         0000400
 263#endif
 264
 265#ifndef S_IWRITE
 266#define S_IWRITE        0000200
 267#endif
 268
 269#ifndef S_IEXEC
 270#define S_IEXEC 0000100
 271#endif
 272
 273#ifndef XATTR_CREATE
 274#define XATTR_CREATE 1
 275#endif
 276
 277#ifndef XATTR_REPLACE
 278#define XATTR_REPLACE 2
 279#endif
 280
 281#ifndef R_OK
 282#define R_OK    4
 283#define W_OK    2
 284#define X_OK    1
 285#define F_OK    0
 286#endif
 287
 288#else
 289#include <errno.h>
 290#include <sys/stat.h>
 291#include <fcntl.h>
 292#endif
 293
 294#endif
 295
 296#ifndef Y_DUMP_STACK
 297#define Y_DUMP_STACK() do { } while (0)
 298#endif
 299
 300#ifndef BUG
 301#define BUG() do {\
 302        yaffs_trace(YAFFS_TRACE_BUG,\
 303                "==>> yaffs bug: " __FILE__ " %d",\
 304                __LINE__);\
 305        Y_DUMP_STACK();\
 306} while (0)
 307#endif
 308
 309#endif
 310