|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Library of functions to make emulated filesystem as independent as
5: * possible of the host filesystem's capabilities.
6: *
7: * Copyright 1999 Bernd Schmidt
8: */
9:
10: #ifndef FSDB_FILE
11: #define FSDB_FILE "_UAEFSDB.___"
12: #endif
13:
14: #ifndef FSDB_DIR_SEPARATOR
15: #define FSDB_DIR_SEPARATOR '/'
16: #endif
17:
18: /* AmigaOS errors */
19: #define ERROR_NO_FREE_STORE 103
20: #define ERROR_OBJECT_IN_USE 202
21: #define ERROR_OBJECT_EXISTS 203
22: #define ERROR_DIR_NOT_FOUND 204
23: #define ERROR_OBJECT_NOT_FOUND 205
24: #define ERROR_ACTION_NOT_KNOWN 209
25: #define ERROR_INVALID_LOCK 211
26: #define ERROR_OBJECT_WRONG_TYPE 212
27: #define ERROR_DISK_WRITE_PROTECTED 214
28: #define ERROR_DIRECTORY_NOT_EMPTY 216
29: #define ERROR_DEVICE_NOT_MOUNTED 218
30: #define ERROR_SEEK_ERROR 219
31: #define ERROR_DISK_IS_FULL 221
32: #define ERROR_DELETE_PROTECTED 222
33: #define ERROR_WRITE_PROTECTED 223
34: #define ERROR_READ_PROTECTED 224
35: #define ERROR_NO_MORE_ENTRIES 232
36: #define ERROR_NOT_IMPLEMENTED 236
37:
38: #define A_FIBF_SCRIPT (1<<6)
39: #define A_FIBF_PURE (1<<5)
40: #define A_FIBF_ARCHIVE (1<<4)
41: #define A_FIBF_READ (1<<3)
42: #define A_FIBF_WRITE (1<<2)
43: #define A_FIBF_EXECUTE (1<<1)
44: #define A_FIBF_DELETE (1<<0)
45:
46: /* AmigaOS "keys" */
47: typedef struct a_inode_struct {
48: /* Circular list of recycleable a_inodes. */
49: struct a_inode_struct *next, *prev;
50: /* This a_inode's relatives in the directory structure. */
51: struct a_inode_struct *parent;
52: struct a_inode_struct *child, *sibling;
53: /* AmigaOS name, and host OS name. The host OS name is a full path, the
54: * AmigaOS name is relative to the parent. */
55: char *aname;
56: char *nname;
57: /* AmigaOS file comment, or NULL if file has none. */
58: char *comment;
59: /* AmigaOS protection bits. */
60: int amigaos_mode;
61: /* Unique number for identification. */
62: uae_u32 uniq;
63: /* AmigaOS locking bits. */
64: int shlock;
65: unsigned int dir:1;
66: unsigned int elock:1;
67: /* Nonzero if this came from an entry in our database. */
68: unsigned int has_dbentry:1;
69: /* Nonzero if this will need an entry in our database. */
70: unsigned int needs_dbentry:1;
71: /* This a_inode possibly needs writing back to the database. */
72: unsigned int dirty:1;
73: /* If nonzero, this represents a deleted file; the corresponding
74: * entry in the database must be cleared. */
75: unsigned int deleted:1;
76: } a_inode;
77:
78: extern char *nname_begin (char *);
79:
80: extern char *build_nname (const char *d, const char *n);
81: extern char *build_aname (const char *d, const char *n);
82:
83: /* Filesystem-independent functions. */
84: extern void fsdb_clean_dir (a_inode *);
85: extern char *fsdb_search_dir (const char *dirname, char *rel);
86: extern void fsdb_dir_writeback (a_inode *);
87: extern int fsdb_used_as_nname (a_inode *base, const char *);
88: extern a_inode *fsdb_lookup_aino_aname (a_inode *base, const char *);
89: extern a_inode *fsdb_lookup_aino_nname (a_inode *base, const char *);
90:
1.1.1.2 ! root 91: STATIC_INLINE int same_aname (const char *an1, const char *an2)
1.1 root 92: {
93: return strcasecmp (an1, an2) == 0;
94: }
95:
96: /* Filesystem-dependent functions. */
97: extern int fsdb_name_invalid (const char *n);
98: extern void fsdb_fill_file_attrs (a_inode *);
99: extern int fsdb_set_file_attrs (a_inode *, int);
100: extern int fsdb_mode_representable_p (const a_inode *);
101: extern char *fsdb_create_unique_nname (a_inode *base, const char *);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.