void yaffs_load_attribs(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh)
{
+#ifdef CONFIG_YAFFS_WINCE
+ obj->win_atime[0] = oh->win_atime[0];
+ obj->win_ctime[0] = oh->win_ctime[0];
+ obj->win_mtime[0] = oh->win_mtime[0];
+ obj->win_atime[1] = oh->win_atime[1];
+ obj->win_ctime[1] = oh->win_ctime[1];
+ obj->win_mtime[1] = oh->win_mtime[1];
+#else
obj->yst_uid = oh->yst_uid;
obj->yst_gid = oh->yst_gid;
obj->yst_atime = oh->yst_atime;
obj->yst_mtime = oh->yst_mtime;
obj->yst_ctime = oh->yst_ctime;
obj->yst_rdev = oh->yst_rdev;
+#endif
}
void yaffs_load_attribs_oh(struct yaffs_obj_hdr *oh, struct yaffs_obj *obj)
{
#ifdef CONFIG_YAFFS_WINCE
- oh->win_atime[0] = obj->win_atime[0];
- oh->win_ctime[0] = obj->win_ctime[0];
- oh->win_mtime[0] = obj->win_mtime[0];
- oh->win_atime[1] = obj->win_atime[1];
- oh->win_ctime[1] = obj->win_ctime[1];
- oh->win_mtime[1] = obj->win_mtime[1];
+ oh->win_atime[0] = obj->win_atime[0];
+ oh->win_ctime[0] = obj->win_ctime[0];
+ oh->win_mtime[0] = obj->win_mtime[0];
+ oh->win_atime[1] = obj->win_atime[1];
+ oh->win_ctime[1] = obj->win_ctime[1];
+ oh->win_mtime[1] = obj->win_mtime[1];
#else
- oh->yst_uid = obj->yst_uid;
- oh->yst_gid = obj->yst_gid;
- oh->yst_atime = obj->yst_atime;
- oh->yst_mtime = obj->yst_mtime;
- oh->yst_ctime = obj->yst_ctime;
- oh->yst_rdev = obj->yst_rdev;
+ oh->yst_uid = obj->yst_uid;
+ oh->yst_gid = obj->yst_gid;
+ oh->yst_atime = obj->yst_atime;
+ oh->yst_mtime = obj->yst_mtime;
+ oh->yst_ctime = obj->yst_ctime;
+ oh->yst_rdev = obj->yst_rdev;
#endif
-
}
void yaffs_attribs_init(struct yaffs_obj *obj, u32 gid, u32 uid, u32 rdev)
{
#ifdef CONFIG_YAFFS_WINCE
- yfsd_win_file_time_now(obj->win_atime);
- obj->win_ctime[0] = obj->win_mtime[0] = obj->win_atime[0];
- obj->win_ctime[1] = obj->win_mtime[1] = obj->win_atime[1];
+ yfsd_win_file_time_now(obj->win_atime);
+ obj->win_ctime[0] = obj->win_mtime[0] = obj->win_atime[0];
+ obj->win_ctime[1] = obj->win_mtime[1] = obj->win_atime[1];
#else
yaffs_load_current_time(obj, 1, 1);
void yaffs_load_current_time(struct yaffs_obj *obj, int do_a, int do_c)
{
#ifdef CONFIG_YAFFS_WINCE
- yfsd_win_file_time_now(the_obj->win_atime);
- the_obj->win_ctime[0] = the_obj->win_mtime[0] =
- the_obj->win_atime[0];
- the_obj->win_ctime[1] = the_obj->win_mtime[1] =
- the_obj->win_atime[1];
+ yfsd_win_file_time_now(obj->win_atime);
+ obj->win_ctime[0] = obj->win_mtime[0] =
+ obj->win_atime[0];
+ obj->win_ctime[1] = obj->win_mtime[1] =
+ obj->win_atime[1];
#else
}
}
-int yaffs_set_attribs(struct yaffs_obj *obj, struct iattr *attr)
-{
- unsigned int valid = attr->ia_valid;
-
- if (valid & ATTR_MODE)
- obj->yst_mode = attr->ia_mode;
- if (valid & ATTR_UID)
- obj->yst_uid = attr->ia_uid;
- if (valid & ATTR_GID)
- obj->yst_gid = attr->ia_gid;
-
- if (valid & ATTR_ATIME)
- obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime);
- if (valid & ATTR_CTIME)
- obj->yst_ctime = Y_TIME_CONVERT(attr->ia_ctime);
- if (valid & ATTR_MTIME)
- obj->yst_mtime = Y_TIME_CONVERT(attr->ia_mtime);
-
- if (valid & ATTR_SIZE)
- yaffs_resize_file(obj, attr->ia_size);
-
- yaffs_update_oh(obj, NULL, 1, 0, 0, NULL);
-
- return YAFFS_OK;
-
-}
-
-int yaffs_get_attribs(struct yaffs_obj *obj, struct iattr *attr)
-{
- unsigned int valid = 0;
-
- attr->ia_mode = obj->yst_mode;
- valid |= ATTR_MODE;
- attr->ia_uid = obj->yst_uid;
- valid |= ATTR_UID;
- attr->ia_gid = obj->yst_gid;
- valid |= ATTR_GID;
-
- Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime;
- valid |= ATTR_ATIME;
- Y_TIME_CONVERT(attr->ia_ctime) = obj->yst_ctime;
- valid |= ATTR_CTIME;
- Y_TIME_CONVERT(attr->ia_mtime) = obj->yst_mtime;
- valid |= ATTR_MTIME;
-
- attr->ia_size = yaffs_get_file_size(obj);
- valid |= ATTR_SIZE;
-
- attr->ia_valid = valid;
-
- return YAFFS_OK;
-}
-
* Stuff to handle names.
*/
#ifdef CONFIG_YAFFS_CASE_INSENSITIVE
-
+#ifndef CONFIG_YAFFS_WINCE
static int yaffs_toupper(YCHAR a)
{
if (a >= 'a' && a <= 'z')
else
return a;
}
+#endif
static int yaffsfs_Match(YCHAR a, YCHAR b)
{
return 0;
}
-static int yaffsfs_CheckNameLength(const char *name)
+static int yaffsfs_CheckNameLength(const YCHAR *name)
{
int retVal = 0;
else if (obj->my_dev->read_only)
yaffsfs_SetError(-EROFS);
else {
- yaffs_flush_file(obj, 1, datasync);
+ yaffs_flush_file(obj, 1, datasync, 0);
retVal = 0;
}
else {
/* clean up */
if(!f->isDir)
- yaffs_flush_file(obj, 1, 0);
+ yaffs_flush_file(obj, 1, 0, 1);
yaffsfs_PutHandle(handle);
retVal = 0;
}
const struct yaffs_utimbuf *buf)
{
int retVal = -1;
- int result;
-
struct yaffs_utimbuf local;
obj = yaffs_get_equivalent_obj(obj);
return -1;
}
+#if !CONFIG_YAFFS_WINCE
if (!buf) {
local.actime = Y_CURRENT_TIME;
local.modtime = local.actime;
}
if (obj) {
+ int result;
+
obj->yst_atime = buf->actime;
obj->yst_mtime = buf->modtime;
obj->dirty = 1;
- result = yaffs_flush_file(obj, 0, 0);
+ result = yaffs_flush_file(obj, 0, 0, 0);
retVal = result == YAFFS_OK ? 0 : -1;
}
+#endif
return retVal;
}
}
obj->dirty = 1;
- result = yaffs_flush_file(obj, 0, 0);
+ result = yaffs_flush_file(obj, 0, 0, 0);
retVal = 0;
} else
/* bad handle */
if (obj) {
obj->yst_mode = mode;
obj->dirty = 1;
- result = yaffs_flush_file(obj, 0, 0);
+ result = yaffs_flush_file(obj, 0, 0, 0);
}
return result == YAFFS_OK ? 0 : -1;
yaffsfs_SetError(-EROFS);
else {
- yaffs_flush_whole_cache(dev);
+ yaffs_flush_whole_cache(dev, 0);
yaffs_checkpoint_save(dev);
retVal = 0;
if (dev) {
if (dev->is_mounted) {
- yaffs_flush_whole_cache(dev);
+ yaffs_flush_whole_cache(dev, 0);
if (force || !yaffsfs_IsDevBusy(dev)) {
if (read_only)
if (dev) {
if (dev->is_mounted) {
int inUse;
- yaffs_flush_whole_cache(dev);
+ yaffs_flush_whole_cache(dev, 0);
yaffs_checkpoint_save(dev);
inUse = yaffsfs_IsDevBusy(dev);
if (!inUse || force) {
if (dev->is_mounted && unmount_flag) {
int inUse;
- yaffs_flush_whole_cache(dev);
+ yaffs_flush_whole_cache(dev, 0);
yaffs_checkpoint_save(dev);
inUse = yaffsfs_IsDevBusy(dev);
if (!inUse || force_unmount_flag) {
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);
#define S_IFREG 0100000
#endif
+#ifndef S_ISSOCK
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+#endif
+#ifndef S_ISLNK
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif
+#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+#ifndef S_ISREG
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+#ifndef S_ISBLK
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#endif
+#ifndef S_ISCHR
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#endif
+#ifndef S_ISFIFO
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#endif
+
#ifndef S_IREAD
/*---------------- Name handling functions ------------*/
+static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
+ const YCHAR *oh_name, int buff_size)
+{
+#ifdef CONFIG_YAFFS_AUTO_UNICODE
+ if (dev->param.auto_unicode) {
+ if (*oh_name) {
+ /* It is an ASCII name, do an ASCII to
+ * unicode conversion */
+ const char *ascii_oh_name = (const char *)oh_name;
+ int n = buff_size - 1;
+ while (n > 0 && *ascii_oh_name) {
+ *name = *ascii_oh_name;
+ name++;
+ ascii_oh_name++;
+ n--;
+ }
+ } else {
+ strncpy(name, oh_name + 1, buff_size - 1);
+ }
+ } else {
+#else
+ (void) dev;
+ {
+#endif
+ strncpy(name, oh_name, buff_size - 1);
+ }
+}
+
+static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
+ const YCHAR *name)
+{
+#ifdef CONFIG_YAFFS_AUTO_UNICODE
+
+ int is_ascii;
+ const YCHAR *w;
+
+ if (dev->param.auto_unicode) {
+
+ is_ascii = 1;
+ w = name;
+
+ /* Figure out if the name will fit in ascii character set */
+ while (is_ascii && *w) {
+ if ((*w) & 0xff00)
+ is_ascii = 0;
+ w++;
+ }
+
+ if (is_ascii) {
+ /* It is an ASCII name, so convert unicode to ascii */
+ char *ascii_oh_name = (char *)oh_name;
+ int n = YAFFS_MAX_NAME_LENGTH - 1;
+ while (n > 0 && *name) {
+ *ascii_oh_name = *name;
+ name++;
+ ascii_oh_name++;
+ n--;
+ }
+ } else {
+ /* Unicode name, so save starting at the second YCHAR */
+ *oh_name = 0;
+ strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
+ }
+ } else {
+#else
+ dev = dev;
+ {
+#endif
+ strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+ }
+}
+
static u16 yaffs_calc_name_sum(const YCHAR *name)
{
u16 sum = 0;
yaffs_release_temp_buffer(dev, buf);
}
-static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
- const YCHAR *oh_name, int buff_size)
-{
-#ifdef CONFIG_YAFFS_AUTO_UNICODE
- if (dev->param.auto_unicode) {
- if (*oh_name) {
- /* It is an ASCII name, do an ASCII to
- * unicode conversion */
- const char *ascii_oh_name = (const char *)oh_name;
- int n = buff_size - 1;
- while (n > 0 && *ascii_oh_name) {
- *name = *ascii_oh_name;
- name++;
- ascii_oh_name++;
- n--;
- }
- } else {
- strncpy(name, oh_name + 1, buff_size - 1);
- }
- } else {
-#else
- (void) dev;
- {
-#endif
- strncpy(name, oh_name, buff_size - 1);
- }
-}
-
-static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
- const YCHAR *name)
-{
-#ifdef CONFIG_YAFFS_AUTO_UNICODE
-
- int is_ascii;
- YCHAR *w;
-
- if (dev->param.auto_unicode) {
-
- is_ascii = 1;
- w = name;
-
- /* Figure out if the name will fit in ascii character set */
- while (is_ascii && *w) {
- if ((*w) & 0xff00)
- is_ascii = 0;
- w++;
- }
-
- if (is_ascii) {
- /* It is an ASCII name, so convert unicode to ascii */
- char *ascii_oh_name = (char *)oh_name;
- int n = YAFFS_MAX_NAME_LENGTH - 1;
- while (n > 0 && *name) {
- *ascii_oh_name = *name;
- name++;
- ascii_oh_name++;
- n--;
- }
- } else {
- /* Unicode name, so save starting at the second YCHAR */
- *oh_name = 0;
- strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
- }
- } else {
-#else
- dev = dev;
- {
-#endif
- strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
- }
-}
-
/* UpdateObjectHeader updates the header on NAND for an object.
* If name is not NULL, then that new name is used.
*/