~ubuntu-branches/ubuntu/feisty/basilisk2/feisty

« back to all changes in this revision

Viewing changes to src/extfs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2006-06-01 01:11:16 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060601011116-xjhegbgyfsxag5fl
Tags: 0.9.20060529-1
* New upstream CVS snapshot.
* Update local cdbs snippet copyright-check.mk:
  + Broaden scan to also look for "(c)" by default.
  + Make egrep options configurable.
  + Ignore auto-tools files.
* Bump up standards-version to 3.7.2 (no changes needed).
* Let dh_strip do the stripping (not the make install target).

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include <dirent.h>
49
49
#endif
50
50
 
 
51
#if defined __APPLE__ && defined __MACH__
 
52
#include <sys/attr.h>
 
53
#endif
 
54
 
51
55
#include "cpu_emulation.h"
52
56
#include "emul_op.h"
53
57
#include "main.h"
165
169
 
166
170
 
167
171
/*
 
172
 *  Get object creation time
 
173
 */
 
174
 
 
175
#if defined __APPLE__ && defined __MACH__
 
176
struct crtimebuf {
 
177
        unsigned long length;
 
178
        struct timespec crtime;
 
179
};
 
180
 
 
181
static uint32 do_get_creation_time(const char *path)
 
182
{
 
183
        struct attrlist attr;
 
184
        memset(&attr, 0, sizeof(attr));
 
185
        attr.bitmapcount = ATTR_BIT_MAP_COUNT;
 
186
        attr.commonattr = ATTR_CMN_CRTIME;
 
187
 
 
188
        crtimebuf buf;
 
189
        if (getattrlist(path, &attr, &buf, sizeof(buf), FSOPT_NOFOLLOW) < 0)
 
190
                return 0;
 
191
        return TimeToMacTime(buf.crtime.tv_sec);
 
192
}
 
193
 
 
194
static uint32 get_creation_time(const char *path)
 
195
{
 
196
        if (path == NULL)
 
197
                return 0;
 
198
        if (path == RootPath) {
 
199
                static uint32 root_crtime = UINT_MAX;
 
200
                if (root_crtime == UINT_MAX)
 
201
                        root_crtime = do_get_creation_time(path);
 
202
                return root_crtime;
 
203
        }
 
204
        return do_get_creation_time(path);
 
205
}
 
206
#endif
 
207
 
 
208
 
 
209
/*
168
210
 *  Find FSItem for given CNID
169
211
 */
170
212
 
976
1018
        WriteMacInt16(vcb + vcbSigWord, 0x4244);
977
1019
#if defined(__BEOS__) || defined(WIN32)
978
1020
        WriteMacInt32(vcb + vcbCrDate, TimeToMacTime(root_stat.st_crtime));
 
1021
#elif defined __APPLE__ && defined __MACH__
 
1022
        WriteMacInt32(vcb + vcbCrDate, get_creation_time(RootPath));
979
1023
#else
980
1024
        WriteMacInt32(vcb + vcbCrDate, 0);
981
1025
#endif
1039
1083
                pstrcpy((char *)Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), VOLUME_NAME);
1040
1084
#if defined(__BEOS__) || defined(WIN32)
1041
1085
        WriteMacInt32(pb + ioVCrDate, TimeToMacTime(root_stat.st_crtime));
 
1086
#elif defined __APPLE__ && defined __MACH__
 
1087
        WriteMacInt32(pb + ioVCrDate, get_creation_time(RootPath));
1042
1088
#else
1043
1089
        WriteMacInt32(pb + ioVCrDate, 0);
1044
1090
#endif
1231
1277
 
1232
1278
#if defined(__BEOS__) || defined(WIN32)
1233
1279
        WriteMacInt32(pb + ioFlCrDat, TimeToMacTime(st.st_crtime));
 
1280
#elif defined __APPLE__ && defined __MACH__
 
1281
        WriteMacInt32(pb + ioFlCrDat, get_creation_time(full_path));
1234
1282
#else
1235
1283
        WriteMacInt32(pb + ioFlCrDat, 0);
1236
1284
#endif
1353
1401
        WriteMacInt32(pb + ioFlParID, fs_item->parent_id);
1354
1402
#if defined(__BEOS__) || defined(WIN32)
1355
1403
        WriteMacInt32(pb + ioFlCrDat, TimeToMacTime(st.st_crtime));
 
1404
#elif defined __APPLE__ && defined __MACH__
 
1405
        WriteMacInt32(pb + ioFlCrDat, get_creation_time(full_path));
1356
1406
#else
1357
1407
        WriteMacInt32(pb + ioFlCrDat, 0);
1358
1408
#endif