2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2007 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;
63 #define O_APPEND 02000
134 #define S_IFMT 0170000
138 #define S_IFLNK 0120000
142 #define S_IFDIR 0040000
146 #define S_IFREG 0100000
150 #define S_IREAD 0000400
154 #define S_IWRITE 0000200
161 long d_ino; /* inode number */
162 off_t d_off; /* offset to this dirent */
163 unsigned short d_reclen; /* length of this d_name */
164 char d_name [NAME_MAX+1]; /* file name (null-terminated) */
165 unsigned d_dont_use; /* debug pointer, not for public consumption */
168 typedef struct yaffs_dirent yaffs_dirent;
171 typedef struct __opaque yaffs_DIR;
176 int st_dev; /* device */
177 int st_ino; /* inode */
178 mode_t st_mode; /* protection */
179 int st_nlink; /* number of hard links */
180 int st_uid; /* user ID of owner */
181 int st_gid; /* group ID of owner */
182 unsigned st_rdev; /* device type (if inode device) */
183 off_t st_size; /* total size, in bytes */
184 unsigned long st_blksize; /* blocksize for filesystem I/O */
185 unsigned long st_blocks; /* number of blocks allocated */
186 unsigned long yst_atime; /* time of last access */
187 unsigned long yst_mtime; /* time of last modification */
188 unsigned long yst_ctime; /* time of last change */
191 int yaffs_open(const char *path, int oflag, int mode) ;
192 int yaffs_read(int fd, void *buf, unsigned int nbyte) ;
193 int yaffs_write(int fd, const void *buf, unsigned int nbyte) ;
194 int yaffs_close(int fd) ;
195 off_t yaffs_lseek(int fd, off_t offset, int whence) ;
196 int yaffs_truncate(int fd, off_t newSize);
198 int yaffs_unlink(const char *path) ;
199 int yaffs_rename(const char *oldPath, const char *newPath) ;
201 int yaffs_stat(const char *path, struct yaffs_stat *buf) ;
202 int yaffs_lstat(const char *path, struct yaffs_stat *buf) ;
203 int yaffs_fstat(int fd, struct yaffs_stat *buf) ;
205 int yaffs_chmod(const char *path, mode_t mode);
206 int yaffs_fchmod(int fd, mode_t mode);
208 int yaffs_mkdir(const char *path, mode_t mode) ;
209 int yaffs_rmdir(const char *path) ;
211 yaffs_DIR *yaffs_opendir(const char *dirname) ;
212 struct yaffs_dirent *yaffs_readdir(yaffs_DIR *dirp) ;
213 void yaffs_rewinddir(yaffs_DIR *dirp) ;
214 int yaffs_closedir(yaffs_DIR *dirp) ;
216 int yaffs_mount(const char *path) ;
217 int yaffs_unmount(const char *path) ;
219 int yaffs_symlink(const char *oldpath, const char *newpath);
220 int yaffs_readlink(const char *path, char *buf, int bufsiz);
222 int yaffs_link(const char *oldpath, const char *newpath);
223 int yaffs_mknod(const char *pathname, mode_t mode, dev_t dev);
225 loff_t yaffs_freespace(const char *path);
227 void yaffs_initialise(yaffsfs_DeviceConfiguration *configList);
229 int yaffs_StartUp(void);