Some yaffsfs cleanups for WinCE
[yaffs2.git] / direct / yaffsfs.h
index 3196f0c6a691b3b17f2d652e075971329ac1d977..e10fe84c075a44886cbfc58db0877a8148875a9a 100644 (file)
        ( (sizeof(Y_LOFF_T) < 8) ? YAFFS_MAX_FILE_SIZE_32 : (0x800000000LL - 1) )
 
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
 struct yaffs_dirent {
        long d_ino;                     /* inode number */
        off_t d_off;                    /* offset to this dirent */
@@ -76,6 +82,7 @@ struct yaffs_utimbuf {
        unsigned long modtime;
 };
 
+/* Normal POSIX-style API functions */
 
 int yaffs_open(const YCHAR *path, int oflag, int mode) ;
 
@@ -132,20 +139,6 @@ int yaffs_listxattr(const char *path, char *list, int size);
 int yaffs_llistxattr(const char *path, char *list, int size);
 int yaffs_flistxattr(int fd, char *list, int size);
 
-
-#ifdef CONFIG_YAFFS_WINCE
-
-int yaffs_set_wince_times(int fd,
-                       const unsigned *wctime,
-                       const unsigned *watime,
-                       const unsigned *wmtime);
-int yaffs_get_wince_times(int fd,
-                       unsigned *wctime,
-                       unsigned *watime,
-                       unsigned *wmtime);
-
-#endif
-
 int yaffs_chmod(const YCHAR *path, mode_t mode);
 int yaffs_fchmod(int fd, mode_t mode);
 
@@ -159,12 +152,16 @@ int yaffs_closedir(yaffs_DIR *dirp) ;
 
 int yaffs_mount(const YCHAR *path) ;
 int yaffs_mount2(const YCHAR *path, int read_only);
-int yaffs_mount_common(const YCHAR *path, int read_only, int skip_checkpt);
+int yaffs_mount3(const YCHAR *path, int read_only, int skip_checkpt);
 
 int yaffs_unmount(const YCHAR *path) ;
 int yaffs_unmount2(const YCHAR *path, int force);
 int yaffs_remount(const YCHAR *path, int force, int read_only);
 
+int yaffs_format(const YCHAR *path,
+               int unmount_flag,
+               int force_unmount_flag,
+               int remount_flag);
 
 int yaffs_sync(const YCHAR *path) ;
 
@@ -177,10 +174,120 @@ int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev);
 Y_LOFF_T yaffs_freespace(const YCHAR *path);
 Y_LOFF_T yaffs_totalspace(const YCHAR *path);
 
+/* Function variants that use a relative directory */
+struct yaffs_obj;
+int yaffs_open_sharing_reldir(struct yaffs_obj *reldir, const YCHAR *path, int oflag, int mode, int sharing);
+int yaffs_open_reldir(struct yaffs_obj *reldir,const YCHAR *path, int oflag, int mode);
+int yaffs_truncate_reldir(struct yaffs_obj *reldir, const YCHAR *path, Y_LOFF_T new_size);
+int yaffs_unlink_reldir(struct yaffs_obj *reldir, const YCHAR *path);
+int yaffs_rename_reldir(struct yaffs_obj *reldir,
+                       const YCHAR *oldPath, const YCHAR *newPath);
+int yaffs_stat_reldir(struct yaffs_obj *reldir, const YCHAR *path, struct yaffs_stat *buf);
+int yaffs_lstat_reldir(struct yaffs_obj *reldir, const YCHAR *path, struct yaffs_stat *buf);
+int yaffs_utime_reldir(struct yaffs_obj *reldir, const YCHAR *path, const struct yaffs_utimbuf *buf);
+int yaffs_setxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name, const void *data, int size, int flags);
+int yaffs_lsetxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name, const void *data, int size, int flags);
+int yaffs_getxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name, void *data, int size);
+int yaffs_lgetxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name, void *data, int size);
+int yaffs_listxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       char *data, int size);
+int yaffs_llistxattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       char *data, int size);
+int yaffs_removexattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name);
+int yaffs_lremovexattr_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+                       const char *name);
+int yaffs_access_reldir(struct yaffs_obj *reldir, const YCHAR *path, int amode);
+int yaffs_chmod_reldir(struct yaffs_obj *reldir, const YCHAR *path, mode_t mode);
+int yaffs_mkdir_reldir(struct yaffs_obj *reldir, const YCHAR *path, mode_t mode);
+int yaffs_rmdir_reldir(struct yaffs_obj *reldir, const YCHAR *path);
+yaffs_DIR *yaffs_opendir_reldir(struct yaffs_obj *reldir, const YCHAR *dirname);
+int yaffs_symlink_reldir(struct yaffs_obj *reldir,
+                       const YCHAR *oldpath, const YCHAR *newpath);
+int yaffs_readlink_reldir(struct yaffs_obj *reldir,const YCHAR *path,
+                       YCHAR *buf, int bufsiz);
+int yaffs_link_reldir(struct yaffs_obj *reldir,
+                       const YCHAR *oldpath, const YCHAR *linkpath);
+int yaffs_mknod_reldir(struct yaffs_obj *reldir, const YCHAR *pathname,
+                    mode_t mode, dev_t dev);
+
+/* Function variants that use a relative device */
+struct yaffs_dev;
+int yaffs_open_sharing_reldev(struct yaffs_dev *dev, const YCHAR *path, int oflag, int mode, int sharing);
+int yaffs_open_reldev(struct yaffs_dev *dev,const YCHAR *path, int oflag, int mode);
+int yaffs_truncate_reldev(struct yaffs_dev *dev, const YCHAR *path, Y_LOFF_T new_size);
+int yaffs_unlink_reldev(struct yaffs_dev *dev, const YCHAR *path);
+int yaffs_rename_reldev(struct yaffs_dev *dev,
+                       const YCHAR *oldPath, const YCHAR *newPath);
+int yaffs_stat_reldev(struct yaffs_dev *dev, const YCHAR *path, struct yaffs_stat *buf);
+int yaffs_lstat_reldev(struct yaffs_dev *dev, const YCHAR *path, struct yaffs_stat *buf);
+int yaffs_utime_reldev(struct yaffs_dev *dev, const YCHAR *path, const struct yaffs_utimbuf *buf);
+int yaffs_setxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name, const void *data, int size, int flags);
+int yaffs_lsetxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name, const void *data, int size, int flags);
+int yaffs_getxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name, void *data, int size);
+int yaffs_lgetxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name, void *data, int size);
+int yaffs_listxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       char *data, int size);
+int yaffs_llistxattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       char *data, int size);
+int yaffs_removexattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name);
+int yaffs_lremovexattr_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       const char *name);
+int yaffs_access_reldev(struct yaffs_dev *dev, const YCHAR *path, int amode);
+int yaffs_chmod_reldev(struct yaffs_dev *dev, const YCHAR *path, mode_t mode);
+int yaffs_mkdir_reldev(struct yaffs_dev *dev, const YCHAR *path, mode_t mode);
+int yaffs_rmdir_reldev(struct yaffs_dev *dev, const YCHAR *path);
+yaffs_DIR *yaffs_opendir_reldev(struct yaffs_dev *dev, const YCHAR *dirname);
+int yaffs_symlink_reldev(struct yaffs_dev *dev,
+                       const YCHAR *oldpath, const YCHAR *newpath);
+int yaffs_readlink_reldev(struct yaffs_dev *dev, const YCHAR *path,
+                       YCHAR *buf, int bufsiz);
+int yaffs_link_reldev(struct yaffs_dev *dev,
+                       const YCHAR *oldpath, const YCHAR *linkpath);
+int yaffs_mknod_reldev(struct yaffs_dev *dev, const YCHAR *pathname,
+                    mode_t mode, dev_t dev_val);
+Y_LOFF_T yaffs_freespace_reldev(struct yaffs_dev *dev);
+Y_LOFF_T yaffs_totalspace_reldev(struct yaffs_dev *dev);
+
+/* Some non-standard functions to use fds to access directories */
+struct yaffs_dirent *yaffs_readdir_fd(int fd);
+void yaffs_rewinddir_fd(int fd);
+
+/* Non-standard functions to pump garbage collection. */
+int yaffs_do_background_gc(const YCHAR *path, int urgency);
+int yaffs_do_background_gc_reldev(struct yaffs_dev *dev, int urgency);
+
+/* Non-standard functions to get usage info */
 int yaffs_inodecount(const YCHAR *path);
 
 int yaffs_n_handles(const YCHAR *path);
 
+int yaffs_n_handles_reldir(struct yaffs_obj *reldir, const YCHAR *path);
+int yaffs_dump_dev_reldir(struct yaffs_obj *reldir, const YCHAR *path);
+int yaffs_n_handles_reldev(struct yaffs_dev *dev, const YCHAR *path);
+int yaffs_dump_dev_reldev(struct yaffs_dev *dev, const YCHAR *path);
+
+#ifdef CONFIG_YAFFS_WINCE
+int yaffs_set_wince_times(int fd,
+                       const unsigned *wctime,
+                       const unsigned *watime,
+                       const unsigned *wmtime);
+int yaffs_get_wince_times(int fd,
+                       unsigned *wctime,
+                       unsigned *watime,
+                       unsigned *wmtime);
+#endif
+
+
 #define YAFFS_SHARE_READ  1
 #define YAFFS_SHARE_WRITE 2
 int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int shareMode);
@@ -207,4 +314,11 @@ int yaffs_set_error(int error);
 /* Trace control functions */
 unsigned  yaffs_set_trace(unsigned tm);
 unsigned  yaffs_get_trace(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
 #endif