2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
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.
13 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
17 * Header file for using yaffs in an application via
31 //typedef unsigned long mode_t;
39 #ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
66 #define O_APPEND 02000
118 #define ENAMETOOLONG 36
141 #define S_IFMT 0170000
145 #define S_IFLNK 0120000
149 #define S_IFDIR 0040000
153 #define S_IFREG 0100000
157 #define S_IREAD 0000400
161 #define S_IWRITE 0000200
165 #define S_IEXEC 0000100
177 #include <sys/stat.h>
183 long d_ino; /* inode number */
184 off_t d_off; /* offset to this dirent */
185 unsigned short d_reclen; /* length of this d_name */
186 YUCHAR d_type; /* type of this record */
187 YCHAR d_name [NAME_MAX+1]; /* file name (null-terminated) */
188 unsigned d_dont_use; /* debug pointer, not for public consumption */
191 typedef struct yaffs_dirent yaffs_dirent;
194 typedef struct __opaque yaffs_DIR;
199 int st_dev; /* device */
200 int st_ino; /* inode */
201 unsigned st_mode; /* protection */
202 int st_nlink; /* number of hard links */
203 int st_uid; /* user ID of owner */
204 int st_gid; /* group ID of owner */
205 unsigned st_rdev; /* device type (if inode device) */
206 off_t st_size; /* total size, in bytes */
207 unsigned long st_blksize; /* blocksize for filesystem I/O */
208 unsigned long st_blocks; /* number of blocks allocated */
209 #ifdef CONFIG_YAFFS_WINCE
210 /* Special 64-bit times for WinCE */
211 unsigned long yst_wince_atime[2];
212 unsigned long yst_wince_mtime[2];
213 unsigned long yst_wince_ctime[2];
215 unsigned long yst_atime; /* time of last access */
216 unsigned long yst_mtime; /* time of last modification */
217 unsigned long yst_ctime; /* time of last change */
221 int yaffs_open(const YCHAR *path, int oflag, int mode) ;
222 int yaffs_close(int fd) ;
223 int yaffs_fsync(int fd) ;
224 int yaffs_fdatasync(int fd) ;
225 int yaffs_flush(int fd) ; /* same as yaffs_fsync() */
227 int yaffs_access(const YCHAR *path, int amode);
229 int yaffs_dup(int fd);
231 int yaffs_read(int fd, void *buf, unsigned int nbyte) ;
232 int yaffs_write(int fd, const void *buf, unsigned int nbyte) ;
234 int yaffs_pread(int fd, void *buf, unsigned int nbyte, unsigned int offset);
235 int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, unsigned int offset);
237 off_t yaffs_lseek(int fd, off_t offset, int whence) ;
239 int yaffs_truncate(const YCHAR *path, off_t newSize);
240 int yaffs_ftruncate(int fd, off_t newSize);
242 int yaffs_unlink(const YCHAR *path) ;
243 int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) ;
245 int yaffs_stat(const YCHAR *path, struct yaffs_stat *buf) ;
246 int yaffs_lstat(const YCHAR *path, struct yaffs_stat *buf) ;
247 int yaffs_fstat(int fd, struct yaffs_stat *buf) ;
249 int yaffs_setxattr(const char *path, const char *name, const void *data, int size, int flags);
250 int yaffs_fsetxattr(int fd, const char *name, const void *data, int size, int flags);
252 int yaffs_getxattr(const char *path, const char *name, void *data, int size);
253 int yaffs_fgetxattr(int fd, const char *name, void *data, int size);
255 int yaffs_removexattr(const char *path, const char *name);
256 int yaffs_fremovexattr(int fd, const char *name);
258 int yaffs_listxattr(const char *path, char *list, int size);
259 int yaffs_flistxattr(int fd, char *list, int size);
262 #ifdef CONFIG_YAFFS_WINCE
264 int yaffs_set_wince_times(int fd, const unsigned *wctime, const unsigned *watime, const unsigned *wmtime);
265 int yaffs_get_wince_times(int fd, unsigned *wctime, unsigned *watime, unsigned *wmtime);
269 int yaffs_chmod(const YCHAR *path, mode_t mode);
270 int yaffs_fchmod(int fd, mode_t mode);
272 int yaffs_mkdir(const YCHAR *path, mode_t mode) ;
273 int yaffs_rmdir(const YCHAR *path) ;
275 yaffs_DIR *yaffs_opendir(const YCHAR *dirname) ;
276 struct yaffs_dirent *yaffs_readdir(yaffs_DIR *dirp) ;
277 void yaffs_rewinddir(yaffs_DIR *dirp) ;
278 int yaffs_closedir(yaffs_DIR *dirp) ;
280 int yaffs_mount(const YCHAR *path) ;
281 int yaffs_mount2(const YCHAR *path, int readOnly);
282 int yaffs_unmount(const YCHAR *path) ;
283 int yaffs_unmount2(const YCHAR *path, int force);
284 int yaffs_remount(const YCHAR *path, int force, int readOnly);
287 int yaffs_sync(const YCHAR *path) ;
289 int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath);
290 int yaffs_readlink(const YCHAR *path, YCHAR *buf, int bufsiz);
292 int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath);
293 int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev);
295 loff_t yaffs_freespace(const YCHAR *path);
296 loff_t yaffs_totalspace(const YCHAR *path);
298 int yaffs_inodecount(const YCHAR *path);
303 int yaffs_StartUp(void);