Compilation clean up
[yaffs2.git] / direct / yaffs_attribs.c
1 /*
2  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2011 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Charles Manning <charles@aleph1.co.uk>
8  *
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.
12  */
13
14 #include "yaffs_attribs.h"
15
16
17 void yaffs_load_attribs(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh)
18 {
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];
26 #else
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;
33 #endif
34 }
35
36
37 void yaffs_load_attribs_oh(struct yaffs_obj_hdr *oh, struct yaffs_obj *obj)
38 {
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];
46 #else
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;
53 #endif
54 }
55
56 void yaffs_attribs_init(struct yaffs_obj *obj, u32 gid, u32 uid, u32 rdev)
57 {
58
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];
63
64 #else
65         yaffs_load_current_time(obj, 1, 1);
66         obj->yst_rdev = rdev;
67         obj->yst_uid = uid;
68         obj->yst_gid = gid;
69 #endif
70 }
71
72 void yaffs_load_current_time(struct yaffs_obj *obj, int do_a, int do_c)
73 {
74 #ifdef CONFIG_YAFFS_WINCE
75         yfsd_win_file_time_now(obj->win_atime);
76         obj->win_ctime[0] = obj->win_mtime[0] =
77             obj->win_atime[0];
78         obj->win_ctime[1] = obj->win_mtime[1] =
79             obj->win_atime[1];
80
81 #else
82
83         obj->yst_mtime = Y_CURRENT_TIME;
84         if (do_a)
85                 obj->yst_atime = obj->yst_atime;
86         if (do_c)
87                 obj->yst_ctime = obj->yst_atime;
88 #endif
89 }