2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2011 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 General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include "yaffs_attribs.h"
17 void yaffs_load_attribs(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh)
19 #ifdef CONFIG_YAFFS_WINCE
20 obj->win_atime[0] = oh->win_atime[0];
21 obj->win_ctime[0] = oh->win_ctime[0];
22 obj->win_mtime[0] = oh->win_mtime[0];
23 obj->win_atime[1] = oh->win_atime[1];
24 obj->win_ctime[1] = oh->win_ctime[1];
25 obj->win_mtime[1] = oh->win_mtime[1];
27 obj->yst_uid = oh->yst_uid;
28 obj->yst_gid = oh->yst_gid;
29 obj->yst_atime = oh->yst_atime;
30 obj->yst_mtime = oh->yst_mtime;
31 obj->yst_ctime = oh->yst_ctime;
32 obj->yst_rdev = oh->yst_rdev;
37 void yaffs_load_attribs_oh(struct yaffs_obj_hdr *oh, struct yaffs_obj *obj)
39 #ifdef CONFIG_YAFFS_WINCE
40 oh->win_atime[0] = obj->win_atime[0];
41 oh->win_ctime[0] = obj->win_ctime[0];
42 oh->win_mtime[0] = obj->win_mtime[0];
43 oh->win_atime[1] = obj->win_atime[1];
44 oh->win_ctime[1] = obj->win_ctime[1];
45 oh->win_mtime[1] = obj->win_mtime[1];
47 oh->yst_uid = obj->yst_uid;
48 oh->yst_gid = obj->yst_gid;
49 oh->yst_atime = obj->yst_atime;
50 oh->yst_mtime = obj->yst_mtime;
51 oh->yst_ctime = obj->yst_ctime;
52 oh->yst_rdev = obj->yst_rdev;
56 void yaffs_attribs_init(struct yaffs_obj *obj, u32 gid, u32 uid, u32 rdev)
59 #ifdef CONFIG_YAFFS_WINCE
60 yfsd_win_file_time_now(obj->win_atime);
61 obj->win_ctime[0] = obj->win_mtime[0] = obj->win_atime[0];
62 obj->win_ctime[1] = obj->win_mtime[1] = obj->win_atime[1];
65 yaffs_load_current_time(obj, 1, 1);
72 void yaffs_load_current_time(struct yaffs_obj *obj, int do_a, int do_c)
74 #ifdef CONFIG_YAFFS_WINCE
75 yfsd_win_file_time_now(obj->win_atime);
76 obj->win_ctime[0] = obj->win_mtime[0] =
78 obj->win_ctime[1] = obj->win_mtime[1] =
83 obj->yst_mtime = Y_CURRENT_TIME;
85 obj->yst_atime = obj->yst_atime;
87 obj->yst_ctime = obj->yst_atime;
91 static Y_LOFF_T yaffs_get_file_size(struct yaffs_obj *obj)
94 obj = yaffs_get_equivalent_obj(obj);
96 switch (obj->variant_type) {
97 case YAFFS_OBJECT_TYPE_FILE:
98 return obj->variant.file_variant.file_size;
99 case YAFFS_OBJECT_TYPE_SYMLINK:
100 alias = obj->variant.symlink_variant.alias;
103 return yaffs_strnlen(alias, YAFFS_MAX_ALIAS_LENGTH);