-#ifndef CONFIG_YAFFS_WINCE
-
-int yaffs_set_attribs(yaffs_obj_t *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(yaffs_obj_t *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;
-}
-
-#endif
-
-
-static int yaffs_do_xattrib_mod(yaffs_obj_t *obj, int set, const YCHAR *name, const void *value, int size, int flags)
-{
- yaffs_xattr_mod xmod;
-
- int result;
-
- xmod.set = set;
- xmod.name = name;
- xmod.data = value;
- xmod.size = size;
- xmod.flags = flags;
- xmod.result = -ENOSPC;
-
- result = yaffs_update_oh(obj, NULL, 0, 0, 0, &xmod);
-
- if(result > 0)
- return xmod.result;
- else
- return -ENOSPC;
-}
-
-static int yaffs_apply_xattrib_mod(yaffs_obj_t *obj, char *buffer, yaffs_xattr_mod *xmod)
-{
- int retval = 0;
- int x_offs = sizeof(yaffs_obj_header);
- yaffs_dev_t *dev = obj->my_dev;
- int x_size = dev->data_bytes_per_chunk - sizeof(yaffs_obj_header);
-
- char * x_buffer = buffer + x_offs;
-
- if(xmod->set)
- retval = nval_set(x_buffer, x_size, xmod->name, xmod->data, xmod->size, xmod->flags);
- else
- retval = nval_del(x_buffer, x_size, xmod->name);
-
- obj->has_xattr = nval_hasvalues(x_buffer, x_size);
- obj->xattr_known = 1;
-
- xmod->result = retval;
-
- return retval;
-}
-
-static int yaffs_do_xattrib_fetch(yaffs_obj_t *obj, const YCHAR *name, void *value, int size)
-{
- char *buffer = NULL;
- int result;
- yaffs_ext_tags tags;
- yaffs_dev_t *dev = obj->my_dev;
- int x_offs = sizeof(yaffs_obj_header);
- int x_size = dev->data_bytes_per_chunk - sizeof(yaffs_obj_header);
-
- char * x_buffer;
-
- int retval = 0;
-
- if(obj->hdr_chunk < 1)
- return -ENODATA;
-
- /* If we know that the object has no xattribs then don't do all the
- * reading and parsing.
- */
- if(obj->xattr_known && !obj->has_xattr){
- if(name)
- return -ENODATA;
- else
- return 0;
- }
-
- buffer = (char *) yaffs_get_temp_buffer(dev, __LINE__);
- if(!buffer)
- return -ENOMEM;
-
- result = yaffs_rd_chunk_tags_nand(dev,obj->hdr_chunk, (__u8 *)buffer, &tags);
-
- if(result != YAFFS_OK)
- retval = -ENOENT;
- else{
- x_buffer = buffer + x_offs;
-
- if (!obj->xattr_known){
- obj->has_xattr = nval_hasvalues(x_buffer, x_size);
- obj->xattr_known = 1;
- }
-
- if(name)
- retval = nval_get(x_buffer, x_size, name, value, size);
- else
- retval = nval_list(x_buffer, x_size, value,size);
- }
- yaffs_release_temp_buffer(dev,(__u8 *)buffer,__LINE__);
- return retval;
-}
-
-int yaffs_set_xattrib(yaffs_obj_t *obj, const YCHAR *name, const void * value, int size, int flags)
-{
- return yaffs_do_xattrib_mod(obj, 1, name, value, size, flags);
-}
-
-int yaffs_remove_xattrib(yaffs_obj_t *obj, const YCHAR *name)
-{
- return yaffs_do_xattrib_mod(obj, 0, name, NULL, 0, 0);
-}
-
-int yaffs_get_xattrib(yaffs_obj_t *obj, const YCHAR *name, void *value, int size)
-{
- return yaffs_do_xattrib_fetch(obj, name, value, size);
-}
-
-int yaffs_list_xattrib(yaffs_obj_t *obj, char *buffer, int size)
-{
- return yaffs_do_xattrib_fetch(obj, NULL, buffer,size);
-}
-
-
-
-#if 0
-int yaffs_dump_obj(yaffs_obj_t *obj)
-{
- YCHAR name[257];
-
- yaffs_get_obj_name(obj, name, YAFFS_MAX_NAME_LENGTH + 1);
-
- T(YAFFS_TRACE_ALWAYS,
- (TSTR
- ("Object %d, inode %d \"%s\"\n dirty %d valid %d serial %d sum %d"
- " chunk %d type %d size %d\n"
- TENDSTR), obj->obj_id, yaffs_get_obj_inode(obj), name,
- obj->dirty, obj->valid, obj->serial, obj->sum, obj->hdr_chunk,
- yaffs_get_obj_type(obj), yaffs_get_obj_length(obj)));
-
- return YAFFS_OK;
-}
-#endif
-
-/*---------------------------- Initialisation code -------------------------------------- */