1/* This file contains the prototypes for various functions copied from "lowntfs-3g.c"
2 * and then modified for use in Haiku's filesystem driver. (The implementations are GPL.) */
3
4#ifndef LOWNTFS_H
5#define LOWNTFS_H
6
7#include <StorageDefs.h>
8
9#include "libntfs/inode.h"
10#include "libntfs/security.h"
11
12
13struct lowntfs_context {
14	void* haiku_fs_volume;
15	void* current_close_state_vnode;
16
17	ntfs_volume* vol;
18	char* abs_mnt_point;
19	unsigned int dmask, fmask;
20	s64 dmtime;
21	ntfs_volume_special_files special_files;
22	BOOL posix_nlink, inherit, windows_names;
23
24	u64 latest_ghost;
25};
26
27int* ntfs_haiku_get_close_state(struct lowntfs_context *ctx, u64 ino);
28void ntfs_haiku_put_close_state(struct lowntfs_context *ctx, u64 ino, u64 ghost);
29
30enum {
31	CLOSE_GHOST = 1,
32	CLOSE_COMPRESSED = 2,
33	CLOSE_ENCRYPTED = 4,
34	CLOSE_DMTIME = 8,
35	CLOSE_REPARSE = 16
36};
37
38u64 ntfs_fuse_inode_lookup(struct lowntfs_context *ctx, u64 parent, const char* name);
39
40int ntfs_fuse_getstat(struct lowntfs_context *ctx, struct SECURITY_CONTEXT *scx,
41	ntfs_inode *ni, struct stat *stbuf);
42
43int ntfs_fuse_readlink(struct lowntfs_context *ctx, u64 ino, void* buffer, size_t* bufferSize);
44
45int ntfs_fuse_read(ntfs_inode* ni, off_t offset, char* buffer, size_t size);
46int ntfs_fuse_write(struct lowntfs_context* ctx, ntfs_inode* ni, const char *buf,
47	size_t size, off_t offset);
48
49int ntfs_fuse_create(struct lowntfs_context *ctx, ino_t parent, const char *name,
50	mode_t typemode, dev_t dev, const char *target, ino_t* ino);
51
52enum RM_TYPES {
53	RM_LINK = 0,
54	RM_DIR,
55	RM_ANY,
56
57	RM_NO_CHECK_OPEN = 1 << 8
58		// Haiku addition, so that ntfs_fuse_rm skips doing vnode lookups.
59};
60
61int ntfs_fuse_rm(struct lowntfs_context *ctx, ino_t parent, const char *name,
62	enum RM_TYPES rm_type);
63
64int ntfs_fuse_release(struct lowntfs_context *ctx, ino_t parent, ino_t ino, int state, u64 ghost);
65
66int ntfs_fuse_rename(struct lowntfs_context *ctx, ino_t parent, const char *name,
67	ino_t newparent, const char *newname);
68
69#endif	// LOWNTFS_H
70