1354195Sbrooks/* This file contains the prototypes for various functions copied from "lowntfs-3g.c"
2354195Sbrooks * and then modified for use in Haiku's filesystem driver. (The implementations are GPL.) */
3354195Sbrooks
4354195Sbrooks#ifndef LOWNTFS_H
5354195Sbrooks#define LOWNTFS_H
6354195Sbrooks
7354195Sbrooks#include <StorageDefs.h>
8354195Sbrooks
9354195Sbrooks#include "libntfs/inode.h"
10354195Sbrooks#include "libntfs/security.h"
11354195Sbrooks
12354195Sbrooks
13354195Sbrooksstruct lowntfs_context {
14354195Sbrooks	void* haiku_fs_volume;
15354195Sbrooks	void* current_close_state_vnode;
16354195Sbrooks
17354195Sbrooks	ntfs_volume* vol;
18354195Sbrooks	char* abs_mnt_point;
19354195Sbrooks	unsigned int dmask, fmask;
20354195Sbrooks	s64 dmtime;
21354195Sbrooks	ntfs_volume_special_files special_files;
22354195Sbrooks	BOOL posix_nlink, inherit, windows_names;
23354195Sbrooks
24316957Sdchagin	u64 latest_ghost;
25316957Sdchagin};
26316957Sdchagin
27316957Sdchaginint* ntfs_haiku_get_close_state(struct lowntfs_context *ctx, u64 ino);
28316957Sdchaginvoid ntfs_haiku_put_close_state(struct lowntfs_context *ctx, u64 ino, u64 ghost);
29316957Sdchagin
30316957Sdchaginenum {
31316957Sdchagin	CLOSE_GHOST = 1,
32316957Sdchagin	CLOSE_COMPRESSED = 2,
33316957Sdchagin	CLOSE_ENCRYPTED = 4,
34316957Sdchagin	CLOSE_DMTIME = 8,
35316957Sdchagin	CLOSE_REPARSE = 16
36316957Sdchagin};
37316957Sdchagin
38316957Sdchaginu64 ntfs_fuse_inode_lookup(struct lowntfs_context *ctx, u64 parent, const char* name);
39316957Sdchagin
40316957Sdchaginint ntfs_fuse_getstat(struct lowntfs_context *ctx, struct SECURITY_CONTEXT *scx,
41316957Sdchagin	ntfs_inode *ni, struct stat *stbuf);
42316957Sdchagin
43316957Sdchaginint ntfs_fuse_readlink(struct lowntfs_context *ctx, u64 ino, void* buffer, size_t* bufferSize);
44316957Sdchagin
45316957Sdchaginint ntfs_fuse_read(ntfs_inode* ni, off_t offset, char* buffer, size_t size);
46316957Sdchaginint ntfs_fuse_write(struct lowntfs_context* ctx, ntfs_inode* ni, const char *buf,
47316957Sdchagin	size_t size, off_t offset);
48316957Sdchagin
49316957Sdchaginint ntfs_fuse_create(struct lowntfs_context *ctx, ino_t parent, const char *name,
50316957Sdchagin	mode_t typemode, dev_t dev, const char *target, ino_t* ino);
51316957Sdchagin
52316957Sdchaginenum RM_TYPES {
53316957Sdchagin	RM_LINK = 0,
54316957Sdchagin	RM_DIR,
55316957Sdchagin	RM_ANY,
56316957Sdchagin
57316957Sdchagin	RM_NO_CHECK_OPEN = 1 << 8
58316957Sdchagin		// Haiku addition, so that ntfs_fuse_rm skips doing vnode lookups.
59316957Sdchagin};
60316957Sdchagin
61316957Sdchaginint ntfs_fuse_rm(struct lowntfs_context *ctx, ino_t parent, const char *name,
62316957Sdchagin	enum RM_TYPES rm_type);
63316957Sdchagin
64316957Sdchaginint ntfs_fuse_release(struct lowntfs_context *ctx, ino_t parent, ino_t ino, int state, u64 ghost);
65316957Sdchagin
66316957Sdchaginint ntfs_fuse_rename(struct lowntfs_context *ctx, ino_t parent, const char *name,
67316957Sdchagin	ino_t newparent, const char *newname);
68316957Sdchagin
69316957Sdchagin#endif	// LOWNTFS_H
70316957Sdchagin