PageRenderTime 19ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/filesystems/unixfs/ancientfs/ancientfs_cpio_odc.h

http://macfuse.googlecode.com/
C++ Header | 68 lines | 50 code | 10 blank | 8 comment | 0 complexity | a3053bb15e096b75559fef88aec58789 MD5 | raw file
 1/*
 2 * Ancient UNIX File Systems for MacFUSE
 3 * Amit Singh
 4 * http://osxbook.com
 5 */
 6
 7#ifndef _ANCIENTFS_CPIO_ODC_H_
 8#define _ANCIENTFS_CPIO_ODC_H_
 9
10#include "unixfs_internal.h"
11#include "ancientfs.h"
12
13#define ROOTINO  1
14
15struct filsys
16{
17    uint32_t s_fsize;
18    uint32_t s_files;
19    uint32_t s_directories;
20    uint32_t s_lastino;
21    uint32_t s_dataoffset;
22    uint32_t s_needsswap;
23    struct inode* s_rootip;
24};
25
26#define CPIO_ODC_BLOCK       512
27#define CPIO_ODC_MAGIC       "070707"
28#define CPIO_ODC_MAGLEN      6
29#define CPIO_ODC_TRAILER     "TRAILER!!!"
30#define CPIO_ODC_TRAILER_LEN (sizeof(CPIO_ODC_TRAILER)/sizeof(unsigned char))
31
32struct cpio_odc_header {
33    char c_magic[6];
34    char c_dev[6];
35    char c_ino[6];
36    char c_mode[6];
37    char c_uid[6];
38    char c_gid[6];
39    char c_nlink[6];
40    char c_rdev[6];
41    char c_mtime[11];
42    char c_namesize[6];
43    char c_filesize[11];
44/*  char c_name[c_namesize]; */
45/*  char c_data[c_filesize]; */
46} __attribute__((packed));
47
48struct cpio_odc_node_info {
49    struct inode*              ci_self;
50    struct cpio_odc_node_info* ci_parent;
51    struct cpio_odc_node_info* ci_children;
52    struct cpio_odc_node_info* ci_next_sibling;
53    char*                      ci_name;
54    char*                      ci_linktargetname;
55};
56
57/* modes */
58#define IALLOC  0100000 /* i-node is allocated */
59#define ILARG   010000  /* large file */
60#define IFMT    0170000 /* type of file */
61
62static inline mode_t
63ancientfs_cpio_odc_mode(mode_t mode, uint32_t flags)
64{
65    return mode & (uint16_t)~(IALLOC & ILARG);
66}
67
68#endif /* _ANCIENTFS_CPIO_ODC_H_ */