PageRenderTime 117ms CodeModel.GetById 107ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/filesystems/unixfs/ancientfs/ancientfs_oar.h

http://macfuse.googlecode.com/
C++ Header | 76 lines | 57 code | 13 blank | 6 comment | 2 complexity | 568ec33f7ea0a4c7333110b670f14f3c MD5 | raw file
 1/*
 2 * Ancient UNIX File Systems for MacFUSE
 3 * Amit Singh
 4 * http://osxbook.com
 5 */
 6
 7#ifndef _ANCIENTFS_OAR_H_
 8#define _ANCIENTFS_OAR_H_
 9
10#include "unixfs_internal.h"
11#include "ancientfs.h"
12
13typedef int16_t  a_short;       /* ancient short */
14typedef uint16_t a_ushort;      /* ancient unsigned short */
15typedef int16_t  a_int;         /* ancient int */
16typedef uint16_t a_uint;        /* ancient unsigned int */
17typedef int32_t  a_long;        /* ancient long */
18typedef uint32_t a_ulong;       /* ancient unsigned long */
19
20typedef a_uint   a_ino_t;       /* ancient inode type (ancient unsigned int) */
21typedef a_long   a_off_t;       /* ancient offset type (ancient long) */
22typedef a_long   a_time_t;      /* ancient time type (ancient long) */
23typedef a_long   a_daddr_t;     /* ancient disk address type (ancient long) */
24typedef a_int    a_dev_t;       /* ancient device type (ancient int) */
25
26#define BSIZE    512
27#define BMASK    0777           /* BSIZE - 1 */
28
29#define ROOTINO  1
30#define DIRSIZ   14
31
32struct filsys
33{
34    uint32_t s_fsize;
35    uint32_t s_files;
36    uint32_t s_directories;
37    uint32_t s_lastino;
38    struct inode* s_rootip;
39};
40
41#define ARMAG  (uint16_t)0177545
42
43struct ar_hdr
44{
45    char   ar_name[DIRSIZ];
46    a_long ar_date;
47    char   ar_uid;
48    char   ar_gid;
49    a_int  ar_mode;
50    a_long ar_size;
51} __attribute__((packed));
52
53struct ar_node_info
54{ 
55    struct inode* ar_self;
56    uint8_t ar_name[DIRSIZ + 1];
57    struct ar_node_info* ar_parent;
58    struct ar_node_info* ar_children;
59    struct ar_node_info* ar_next_sibling;
60};
61
62/* modes */
63#define IALLOC  0100000 /* file is used */
64#define IFMT    060000
65#define ILARG   010000  /* large addressing algorithm */
66
67static inline a_int
68ancientfs_ar_mode(mode_t mode)
69{
70    a_int newmode = (a_int)mode & ~(IALLOC | ILARG);
71    if ((newmode & IFMT) == 0) /* ancient regular file */
72        newmode |= S_IFREG;
73    return newmode;
74}
75   
76#endif /* _ANCIENTFS_OAR_H_ */