17a1b4ef3SAxel Dörfler/*
26f7fc220SAxel Dörfler * Copyright 2004-2016, Haiku Inc. All Rights Reserved.
358e12c8dSAxel Dörfler * Distributed under the terms of the MIT License.
458e12c8dSAxel Dörfler */
58f0cd8cdSAxel Dörfler#ifndef _FS_INTERFACE_H
68f0cd8cdSAxel Dörfler#define _FS_INTERFACE_H
78f0cd8cdSAxel Dörfler
85a95af70SAxel Dörfler
97a1b4ef3SAxel Dörfler/*! File System Interface Layer Definition */
107a1b4ef3SAxel Dörfler
117af4ca8aSAxel Dörfler
1280a9c4f4Sshatty#include <OS.h>
138384cc5cSAxel Dörfler#include <Select.h>
1434c763c9SAxel Dörfler#include <module.h>
1547f39c93SAxel Dörfler#include <disk_device_manager.h>
168384cc5cSAxel Dörfler
178384cc5cSAxel Dörfler#include <sys/uio.h>
188f0cd8cdSAxel Dörfler
197af4ca8aSAxel Dörfler
208f0cd8cdSAxel Dörflerstruct dirent;
218f0cd8cdSAxel Dörflerstruct stat;
228f0cd8cdSAxel Dörflerstruct fs_info;
23cbc6d404SIngo Weinholdstruct select_sync;
248f0cd8cdSAxel Dörfler
25ec598fe4SIngo Weinholdtypedef struct IORequest io_request;
26ec598fe4SIngo Weinhold
27ec598fe4SIngo Weinhold
285e2ef462SAxel Dörfler/* additional flags passed to write_stat() (see NodeMonitor.h for the others) */
29a121b8c8SAxel Dörfler// NOTE: Changing the constants here or in NodeMonitor.h will break
30a121b8c8SAxel Dörfler// src/kits/storage/LibBeAdapter.cpp:_kern_write_stat().
31a121b8c8SAxel Dörfler#define B_STAT_SIZE_INSECURE	0x2000
32a121b8c8SAxel Dörfler	// TODO: this should be faded out once BFS supports sparse files
338f0cd8cdSAxel Dörfler
348f0cd8cdSAxel Dörfler/* passed to write_fs_info() */
358f0cd8cdSAxel Dörfler#define	FS_WRITE_FSINFO_NAME	0x0001
368f0cd8cdSAxel Dörfler
377af4ca8aSAxel Dörflerstruct file_io_vec {
387af4ca8aSAxel Dörfler	off_t	offset;
397af4ca8aSAxel Dörfler	off_t	length;
407af4ca8aSAxel Dörfler};
417af4ca8aSAxel Dörfler
4234c763c9SAxel Dörfler#define	B_CURRENT_FS_API_VERSION "/v1"
438f0cd8cdSAxel Dörfler
447ffafac8SIngo Weinhold// flags for publish_vnode() and fs_volume_ops::get_vnode()
457ffafac8SIngo Weinhold#define B_VNODE_PUBLISH_REMOVED					0x01
467ffafac8SIngo Weinhold#define B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE	0x02
477ffafac8SIngo Weinhold
487ffafac8SIngo Weinhold
498f0cd8cdSAxel Dörfler#ifdef __cplusplus
508f0cd8cdSAxel Dörflerextern "C" {
515e2ef462SAxel Dörfler#endif
528f0cd8cdSAxel Dörfler
537ffafac8SIngo Weinholdtypedef struct fs_volume fs_volume;
547ffafac8SIngo Weinholdtypedef struct fs_volume_ops fs_volume_ops;
557ffafac8SIngo Weinholdtypedef struct fs_vnode fs_vnode;
567ffafac8SIngo Weinholdtypedef struct fs_vnode_ops fs_vnode_ops;
57a26c2439SMichael Lotztypedef struct file_system_module_info file_system_module_info;
5834c763c9SAxel Dörfler
597ffafac8SIngo Weinholdstruct fs_volume {
60a26c2439SMichael Lotz	dev_t						id;
61a26c2439SMichael Lotz	partition_id				partition;
62a26c2439SMichael Lotz	int32						layer;
63a26c2439SMichael Lotz	void*						private_volume;
64a26c2439SMichael Lotz	fs_volume_ops*				ops;
65a26c2439SMichael Lotz	fs_volume*					sub_volume;
66a26c2439SMichael Lotz	fs_volume*					super_volume;
67a26c2439SMichael Lotz	file_system_module_info*	file_system;
68a26c2439SMichael Lotz	char*						file_system_name;
697ffafac8SIngo Weinhold};
707ffafac8SIngo Weinhold
717ffafac8SIngo Weinholdstruct fs_vnode {
727ffafac8SIngo Weinhold	void*			private_node;
737ffafac8SIngo Weinhold	fs_vnode_ops*	ops;
747ffafac8SIngo Weinhold};
757ffafac8SIngo Weinhold
767ffafac8SIngo Weinholdstruct fs_volume_ops {
774e98292bSAxel Dörfler	status_t (*unmount)(fs_volume* volume);
788f0cd8cdSAxel Dörfler
794e98292bSAxel Dörfler	status_t (*read_fs_info)(fs_volume* volume, struct fs_info* info);
804e98292bSAxel Dörfler	status_t (*write_fs_info)(fs_volume* volume, const struct fs_info* info,
811fbe3ccdSIngo Weinhold				uint32 mask);
824e98292bSAxel Dörfler	status_t (*sync)(fs_volume* volume);
837ffafac8SIngo Weinhold
844e98292bSAxel Dörfler	status_t (*get_vnode)(fs_volume* volume, ino_t id, fs_vnode* vnode,
854e98292bSAxel Dörfler				int* _type, uint32* _flags, bool reenter);
867ffafac8SIngo Weinhold
877ffafac8SIngo Weinhold	/* index directory & index operations */
884e98292bSAxel Dörfler	status_t (*open_index_dir)(fs_volume* volume, void** _cookie);
894e98292bSAxel Dörfler	status_t (*close_index_dir)(fs_volume* volume, void* cookie);
904e98292bSAxel Dörfler	status_t (*free_index_dir_cookie)(fs_volume* volume, void* cookie);
914e98292bSAxel Dörfler	status_t (*read_index_dir)(fs_volume* volume, void* cookie,
924e98292bSAxel Dörfler				struct dirent* buffer, size_t bufferSize, uint32* _num);
934e98292bSAxel Dörfler	status_t (*rewind_index_dir)(fs_volume* volume, void* cookie);
944e98292bSAxel Dörfler
954e98292bSAxel Dörfler	status_t (*create_index)(fs_volume* volume, const char* name, uint32 type,
967ffafac8SIngo Weinhold				uint32 flags);
974e98292bSAxel Dörfler	status_t (*remove_index)(fs_volume* volume, const char* name);
984e98292bSAxel Dörfler	status_t (*read_index_stat)(fs_volume* volume, const char* name,
994e98292bSAxel Dörfler				struct stat* stat);
1008f0cd8cdSAxel Dörfler
1017ffafac8SIngo Weinhold	/* query operations */
1024e98292bSAxel Dörfler	status_t (*open_query)(fs_volume* volume, const char* query, uint32 flags,
1034e98292bSAxel Dörfler				port_id port, uint32 token, void** _cookie);
1044e98292bSAxel Dörfler	status_t (*close_query)(fs_volume* volume, void* cookie);
1054e98292bSAxel Dörfler	status_t (*free_query_cookie)(fs_volume* volume, void* cookie);
1064e98292bSAxel Dörfler	status_t (*read_query)(fs_volume* volume, void* cookie,
1074e98292bSAxel Dörfler				struct dirent* buffer, size_t bufferSize, uint32* _num);
1084e98292bSAxel Dörfler	status_t (*rewind_query)(fs_volume* volume, void* cookie);
1097ffafac8SIngo Weinhold
1107ffafac8SIngo Weinhold	/* support for FS layers */
1114e98292bSAxel Dörfler	status_t (*all_layers_mounted)(fs_volume* volume);
1124e98292bSAxel Dörfler	status_t (*create_sub_vnode)(fs_volume* volume, ino_t id, fs_vnode* vnode);
1134e98292bSAxel Dörfler	status_t (*delete_sub_vnode)(fs_volume* volume, fs_vnode* vnode);
1147ffafac8SIngo Weinhold};
1157ffafac8SIngo Weinhold
1167ffafac8SIngo Weinholdstruct fs_vnode_ops {
1178f0cd8cdSAxel Dörfler	/* vnode operations */
1184e98292bSAxel Dörfler	status_t (*lookup)(fs_volume* volume, fs_vnode* dir, const char* name,
1194e98292bSAxel Dörfler				ino_t* _id);
1204e98292bSAxel Dörfler	status_t (*get_vnode_name)(fs_volume* volume, fs_vnode* vnode, char* buffer,
1211fbe3ccdSIngo Weinhold				size_t bufferSize);
1228f0cd8cdSAxel Dörfler
1234e98292bSAxel Dörfler	status_t (*put_vnode)(fs_volume* volume, fs_vnode* vnode, bool reenter);
1244e98292bSAxel Dörfler	status_t (*remove_vnode)(fs_volume* volume, fs_vnode* vnode, bool reenter);
1258f0cd8cdSAxel Dörfler
1268f0cd8cdSAxel Dörfler	/* VM file access */
1274e98292bSAxel Dörfler	bool (*can_page)(fs_volume* volume, fs_vnode* vnode, void* cookie);
1284e98292bSAxel Dörfler	status_t (*read_pages)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1294e98292bSAxel Dörfler				off_t pos, const iovec* vecs, size_t count, size_t* _numBytes);
1304e98292bSAxel Dörfler	status_t (*write_pages)(fs_volume* volume, fs_vnode* vnode,
1314e98292bSAxel Dörfler				void* cookie, off_t pos, const iovec* vecs, size_t count,
1324e98292bSAxel Dörfler				size_t* _numBytes);
1337af4ca8aSAxel Dörfler
134ec598fe4SIngo Weinhold	/* asynchronous I/O */
1354e98292bSAxel Dörfler	status_t (*io)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1364e98292bSAxel Dörfler				io_request* request);
1374e98292bSAxel Dörfler	status_t (*cancel_io)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1384e98292bSAxel Dörfler				io_request* request);
139ec598fe4SIngo Weinhold
1407af4ca8aSAxel Dörfler	/* cache file access */
1414e98292bSAxel Dörfler	status_t (*get_file_map)(fs_volume* volume, fs_vnode* vnode, off_t offset,
1424e98292bSAxel Dörfler				size_t size, struct file_io_vec* vecs, size_t* _count);
1438f0cd8cdSAxel Dörfler
1448f0cd8cdSAxel Dörfler	/* common operations */
1454e98292bSAxel Dörfler	status_t (*ioctl)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1469d570af7SIngo Weinhold				uint32 op, void* buffer, size_t length);
1474e98292bSAxel Dörfler	status_t (*set_flags)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1481fbe3ccdSIngo Weinhold				int flags);
1494e98292bSAxel Dörfler	status_t (*select)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1504e98292bSAxel Dörfler				uint8 event, selectsync* sync);
1514e98292bSAxel Dörfler	status_t (*deselect)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1524e98292bSAxel Dörfler				uint8 event, selectsync* sync);
1534e98292bSAxel Dörfler	status_t (*fsync)(fs_volume* volume, fs_vnode* vnode);
1544e98292bSAxel Dörfler
1554e98292bSAxel Dörfler	status_t (*read_symlink)(fs_volume* volume, fs_vnode* link, char* buffer,
1564e98292bSAxel Dörfler				size_t* _bufferSize);
1574e98292bSAxel Dörfler	status_t (*create_symlink)(fs_volume* volume, fs_vnode* dir,
1584e98292bSAxel Dörfler				const char* name, const char* path, int mode);
1594e98292bSAxel Dörfler
1604e98292bSAxel Dörfler	status_t (*link)(fs_volume* volume, fs_vnode* dir, const char* name,
1614e98292bSAxel Dörfler				fs_vnode* vnode);
1624e98292bSAxel Dörfler	status_t (*unlink)(fs_volume* volume, fs_vnode* dir, const char* name);
1634e98292bSAxel Dörfler	status_t (*rename)(fs_volume* volume, fs_vnode* fromDir,
1644e98292bSAxel Dörfler				const char* fromName, fs_vnode* toDir, const char* toName);
1654e98292bSAxel Dörfler
1664e98292bSAxel Dörfler	status_t (*access)(fs_volume* volume, fs_vnode* vnode, int mode);
1674e98292bSAxel Dörfler	status_t (*read_stat)(fs_volume* volume, fs_vnode* vnode,
1684e98292bSAxel Dörfler				struct stat* stat);
1694e98292bSAxel Dörfler	status_t (*write_stat)(fs_volume* volume, fs_vnode* vnode,
1704e98292bSAxel Dörfler				const struct stat* stat, uint32 statMask);
171d63f4274SJérôme Duval	status_t (*preallocate)(fs_volume* volume, fs_vnode* vnode,
172d63f4274SJérôme Duval				off_t pos, off_t length);
1738f0cd8cdSAxel Dörfler
1748f0cd8cdSAxel Dörfler	/* file operations */
1754e98292bSAxel Dörfler	status_t (*create)(fs_volume* volume, fs_vnode* dir, const char* name,
1764e98292bSAxel Dörfler				int openMode, int perms, void** _cookie,
1774e98292bSAxel Dörfler				ino_t* _newVnodeID);
1784e98292bSAxel Dörfler	status_t (*open)(fs_volume* volume, fs_vnode* vnode, int openMode,
1794e98292bSAxel Dörfler				void** _cookie);
1804e98292bSAxel Dörfler	status_t (*close)(fs_volume* volume, fs_vnode* vnode, void* cookie);
1814e98292bSAxel Dörfler	status_t (*free_cookie)(fs_volume* volume, fs_vnode* vnode,
1824e98292bSAxel Dörfler				void* cookie);
1834e98292bSAxel Dörfler	status_t (*read)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1844e98292bSAxel Dörfler				off_t pos, void* buffer, size_t* length);
1854e98292bSAxel Dörfler	status_t (*write)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1864e98292bSAxel Dörfler				off_t pos, const void* buffer, size_t* length);
1878f0cd8cdSAxel Dörfler
1888f0cd8cdSAxel Dörfler	/* directory operations */
1894e98292bSAxel Dörfler	status_t (*create_dir)(fs_volume* volume, fs_vnode* parent,
1904e98292bSAxel Dörfler				const char* name, int perms);
1914e98292bSAxel Dörfler	status_t (*remove_dir)(fs_volume* volume, fs_vnode* parent,
1924e98292bSAxel Dörfler				const char* name);
1934e98292bSAxel Dörfler	status_t (*open_dir)(fs_volume* volume, fs_vnode* vnode,
1944e98292bSAxel Dörfler				void** _cookie);
1954e98292bSAxel Dörfler	status_t (*close_dir)(fs_volume* volume, fs_vnode* vnode, void* cookie);
1964e98292bSAxel Dörfler	status_t (*free_dir_cookie)(fs_volume* volume, fs_vnode* vnode,
1974e98292bSAxel Dörfler				void* cookie);
1984e98292bSAxel Dörfler	status_t (*read_dir)(fs_volume* volume, fs_vnode* vnode, void* cookie,
1994e98292bSAxel Dörfler				struct dirent* buffer, size_t bufferSize, uint32* _num);
2004e98292bSAxel Dörfler	status_t (*rewind_dir)(fs_volume* volume, fs_vnode* vnode,
2014e98292bSAxel Dörfler				void* cookie);
2028f0cd8cdSAxel Dörfler
2038f0cd8cdSAxel Dörfler	/* attribute directory operations */
2044e98292bSAxel Dörfler	status_t (*open_attr_dir)(fs_volume* volume, fs_vnode* vnode,
2054e98292bSAxel Dörfler				void** _cookie);
2064e98292bSAxel Dörfler	status_t (*close_attr_dir)(fs_volume* volume, fs_vnode* vnode,
2074e98292bSAxel Dörfler				void* cookie);
2084e98292bSAxel Dörfler	status_t (*free_attr_dir_cookie)(fs_volume* volume, fs_vnode* vnode,
2094e98292bSAxel Dörfler				void* cookie);
2104e98292bSAxel Dörfler	status_t (*read_attr_dir)(fs_volume* volume, fs_vnode* vnode,
2114e98292bSAxel Dörfler				void* cookie, struct dirent* buffer, size_t bufferSize,
2124e98292bSAxel Dörfler				uint32* _num);
2134e98292bSAxel Dörfler	status_t (*rewind_attr_dir)(fs_volume* volume, fs_vnode* vnode,
2144e98292bSAxel Dörfler				void* cookie);
2158f0cd8cdSAxel Dörfler
2168f0cd8cdSAxel Dörfler	/* attribute operations */
2174e98292bSAxel Dörfler	status_t (*create_attr)(fs_volume* volume, fs_vnode* vnode,
2184e98292bSAxel Dörfler				const char* name, uint32 type, int openMode,
2194e98292bSAxel Dörfler				void** _cookie);
2204e98292bSAxel Dörfler	status_t (*open_attr)(fs_volume* volume, fs_vnode* vnode, const char* name,
2214e98292bSAxel Dörfler				int openMode, void** _cookie);
2224e98292bSAxel Dörfler	status_t (*close_attr)(fs_volume* volume, fs_vnode* vnode,
2234e98292bSAxel Dörfler				void* cookie);
2244e98292bSAxel Dörfler	status_t (*free_attr_cookie)(fs_volume* volume, fs_vnode* vnode,
2254e98292bSAxel Dörfler				void* cookie);
2264e98292bSAxel Dörfler	status_t (*read_attr)(fs_volume* volume, fs_vnode* vnode, void* cookie,
2274e98292bSAxel Dörfler				off_t pos, void* buffer, size_t* length);
2284e98292bSAxel Dörfler	status_t (*write_attr)(fs_volume* volume, fs_vnode* vnode, void* cookie,
2294e98292bSAxel Dörfler				off_t pos, const void* buffer, size_t* length);
2304e98292bSAxel Dörfler
2314e98292bSAxel Dörfler	status_t (*read_attr_stat)(fs_volume* volume, fs_vnode* vnode,
2324e98292bSAxel Dörfler				void* cookie, struct stat* stat);
2334e98292bSAxel Dörfler	status_t (*write_attr_stat)(fs_volume* volume, fs_vnode* vnode,
2344e98292bSAxel Dörfler				void* cookie, const struct stat* stat, int statMask);
2354e98292bSAxel Dörfler	status_t (*rename_attr)(fs_volume* volume, fs_vnode* fromVnode,
2364e98292bSAxel Dörfler				const char* fromName, fs_vnode* toVnode, const char* toName);
2374e98292bSAxel Dörfler	status_t (*remove_attr)(fs_volume* volume, fs_vnode* vnode,
2384e98292bSAxel Dörfler				const char* name);
2397ffafac8SIngo Weinhold
2407ffafac8SIngo Weinhold	/* support for node and FS layers */
2414e98292bSAxel Dörfler	status_t (*create_special_node)(fs_volume* volume, fs_vnode* dir,
2424e98292bSAxel Dörfler				const char* name, fs_vnode* subVnode, mode_t mode, uint32 flags,
2434e98292bSAxel Dörfler				fs_vnode* _superVnode, ino_t* _nodeID);
2444e98292bSAxel Dörfler	status_t (*get_super_vnode)(fs_volume* volume, fs_vnode* vnode,
2454e98292bSAxel Dörfler				fs_volume* superVolume, fs_vnode* superVnode);
246d764d148SPawel Dziepak
247d764d148SPawel Dziepak	/* lock operations */
248d764d148SPawel Dziepak	status_t (*test_lock)(fs_volume* volume, fs_vnode* vnode, void* cookie,
249d764d148SPawel Dziepak				struct flock* lock);
250d764d148SPawel Dziepak	status_t (*acquire_lock)(fs_volume* volume, fs_vnode* vnode, void* cookie,
251d764d148SPawel Dziepak				const struct flock* lock, bool wait);
252d764d148SPawel Dziepak	status_t (*release_lock)(fs_volume* volume, fs_vnode* vnode, void* cookie,
253d764d148SPawel Dziepak				const struct flock* lock);
2547ffafac8SIngo Weinhold};
2558f0cd8cdSAxel Dörfler
256a26c2439SMichael Lotzstruct file_system_module_info {
2577ffafac8SIngo Weinhold	struct module_info	info;
2581da9f5ceSAxel Dörfler	const char*			short_name;
2597ffafac8SIngo Weinhold	const char*			pretty_name;
2607ffafac8SIngo Weinhold	uint32				flags;	// DDM flags
2618f0cd8cdSAxel Dörfler
2627ffafac8SIngo Weinhold	/* scanning (the device is write locked) */
2634e98292bSAxel Dörfler	float (*identify_partition)(int fd, partition_data* partition,
2644e98292bSAxel Dörfler				void** _cookie);
2654e98292bSAxel Dörfler	status_t (*scan_partition)(int fd, partition_data* partition,
2664e98292bSAxel Dörfler				void* cookie);
2674e98292bSAxel Dörfler	void (*free_identify_partition_cookie)(partition_data* partition,
2684e98292bSAxel Dörfler				void* cookie);
2694e98292bSAxel Dörfler	void (*free_partition_content_cookie)(partition_data* partition);
2708f0cd8cdSAxel Dörfler
2717ffafac8SIngo Weinhold	/* general operations */
2724e98292bSAxel Dörfler	status_t (*mount)(fs_volume* volume, const char* device, uint32 flags,
2734e98292bSAxel Dörfler				const char* args, ino_t* _rootVnodeID);
27447f39c93SAxel Dörfler
27547f39c93SAxel Dörfler	/* capability querying (the device is read locked) */
27676a8ec23SIngo Weinhold	uint32 (*get_supported_operations)(partition_data* partition, uint32 mask);
27747f39c93SAxel Dörfler
2784e98292bSAxel Dörfler	bool (*validate_resize)(partition_data* partition, off_t* size);
2794e98292bSAxel Dörfler	bool (*validate_move)(partition_data* partition, off_t* start);
2804e98292bSAxel Dörfler	bool (*validate_set_content_name)(partition_data* partition,
2814e98292bSAxel Dörfler				char* name);
2824e98292bSAxel Dörfler	bool (*validate_set_content_parameters)(partition_data* partition,
2834e98292bSAxel Dörfler				const char* parameters);
2844e98292bSAxel Dörfler	bool (*validate_initialize)(partition_data* partition, char* name,
2854e98292bSAxel Dörfler				const char* parameters);
28647f39c93SAxel Dörfler
28747f39c93SAxel Dörfler	/* shadow partition modification (device is write locked) */
2884e98292bSAxel Dörfler	status_t (*shadow_changed)(partition_data* partition,
2894e98292bSAxel Dörfler				partition_data* child, uint32 operation);
29047f39c93SAxel Dörfler
29147f39c93SAxel Dörfler	/* writing (the device is NOT locked) */
29247f39c93SAxel Dörfler	status_t (*defragment)(int fd, partition_id partition,
29347f39c93SAxel Dörfler				disk_job_id job);
29447f39c93SAxel Dörfler	status_t (*repair)(int fd, partition_id partition, bool checkOnly,
29547f39c93SAxel Dörfler				disk_job_id job);
29647f39c93SAxel Dörfler	status_t (*resize)(int fd, partition_id partition, off_t size,
29747f39c93SAxel Dörfler				disk_job_id job);
29847f39c93SAxel Dörfler	status_t (*move)(int fd, partition_id partition, off_t offset,
29947f39c93SAxel Dörfler				disk_job_id job);
30047f39c93SAxel Dörfler	status_t (*set_content_name)(int fd, partition_id partition,
3014e98292bSAxel Dörfler				const char* name, disk_job_id job);
30247f39c93SAxel Dörfler	status_t (*set_content_parameters)(int fd, partition_id partition,
3034e98292bSAxel Dörfler				const char* parameters, disk_job_id job);
3044e98292bSAxel Dörfler	status_t (*initialize)(int fd, partition_id partition, const char* name,
3054e98292bSAxel Dörfler				const char* parameters, off_t partitionSize, disk_job_id job);
30690ade5e2SIngo Weinhold	status_t (*uninitialize)(int fd, partition_id partition,
30790ade5e2SIngo Weinhold				off_t partitionSize, uint32 blockSize, disk_job_id job);
308a26c2439SMichael Lotz};
3098f0cd8cdSAxel Dörfler
3108f0cd8cdSAxel Dörfler
3116d16fb1dSAxel Dörfler/* file system add-ons only prototypes */
312ec598fe4SIngo Weinhold
313ec598fe4SIngo Weinhold// callbacks for do_iterative_fd_io()
3144e98292bSAxel Dörflertypedef status_t (*iterative_io_get_vecs)(void* cookie, io_request* request,
3154e98292bSAxel Dörfler				off_t offset, size_t size, struct file_io_vec* vecs,
3164e98292bSAxel Dörfler				size_t* _count);
317ec598fe4SIngo Weinholdtypedef status_t (*iterative_io_finished)(void* cookie, io_request* request,
3187f12cc54SIngo Weinhold				status_t status, bool partialTransfer, size_t bytesTransferred);
319ec598fe4SIngo Weinhold
3204e98292bSAxel Dörflerextern status_t new_vnode(fs_volume* volume, ino_t vnodeID, void* privateNode,
3214e98292bSAxel Dörfler					fs_vnode_ops* ops);
3224e98292bSAxel Dörflerextern status_t publish_vnode(fs_volume* volume, ino_t vnodeID,
3234e98292bSAxel Dörfler					void* privateNode, fs_vnode_ops* ops, int type,
3247ffafac8SIngo Weinhold					uint32 flags);
3254e98292bSAxel Dörflerextern status_t get_vnode(fs_volume* volume, ino_t vnodeID,
3264e98292bSAxel Dörfler					void** _privateNode);
3274e98292bSAxel Dörflerextern status_t put_vnode(fs_volume* volume, ino_t vnodeID);
3284e98292bSAxel Dörflerextern status_t acquire_vnode(fs_volume* volume, ino_t vnodeID);
3294e98292bSAxel Dörflerextern status_t remove_vnode(fs_volume* volume, ino_t vnodeID);
3304e98292bSAxel Dörflerextern status_t unremove_vnode(fs_volume* volume, ino_t vnodeID);
3314e98292bSAxel Dörflerextern status_t get_vnode_removed(fs_volume* volume, ino_t vnodeID,
3324e98292bSAxel Dörfler					bool* _removed);
3338497a2ccSahenrikssonextern status_t mark_vnode_busy(fs_volume* volume, ino_t vnodeID, bool busy);
3348497a2ccSahenrikssonextern status_t change_vnode_id(fs_volume* volume, ino_t vnodeID, ino_t newID);
3354e98292bSAxel Dörflerextern fs_volume* volume_for_vnode(fs_vnode* vnode);
3365a95af70SAxel Dörflerextern status_t check_access_permissions(int accessMode, mode_t mode,
3375a95af70SAxel Dörfler					gid_t nodeGroupID, uid_t nodeUserID);
3384e98292bSAxel Dörfler
3394e98292bSAxel Dörflerextern status_t read_pages(int fd, off_t pos, const struct iovec* vecs,
3404e98292bSAxel Dörfler					size_t count, size_t* _numBytes);
3414e98292bSAxel Dörflerextern status_t write_pages(int fd, off_t pos, const struct iovec* vecs,
3424e98292bSAxel Dörfler					size_t count, size_t* _numBytes);
3433d268edaSAxel Dörflerextern status_t read_file_io_vec_pages(int fd,
3444e98292bSAxel Dörfler					const struct file_io_vec* fileVecs, size_t fileVecCount,
3454e98292bSAxel Dörfler					const struct iovec* vecs, size_t vecCount,
3464e98292bSAxel Dörfler					uint32* _vecIndex, size_t* _vecOffset, size_t* _bytes);
3473d268edaSAxel Dörflerextern status_t write_file_io_vec_pages(int fd,
3484e98292bSAxel Dörfler					const struct file_io_vec* fileVecs, size_t fileVecCount,
3494e98292bSAxel Dörfler					const struct iovec* vecs, size_t vecCount,
3504e98292bSAxel Dörfler					uint32* _vecIndex, size_t* _vecOffset, size_t* _bytes);
3514e98292bSAxel Dörflerextern status_t do_fd_io(int fd, io_request* request);
3524e98292bSAxel Dörflerextern status_t do_iterative_fd_io(int fd, io_request* request,
353ec598fe4SIngo Weinhold					iterative_io_get_vecs getVecs,
3544e98292bSAxel Dörfler					iterative_io_finished finished, void* cookie);
355d0da374bSAxel Dörfler
3567a1b4ef3SAxel Dörflerextern status_t notify_entry_created(dev_t device, ino_t directory,
3574e98292bSAxel Dörfler					const char* name, ino_t node);
3587a1b4ef3SAxel Dörflerextern status_t notify_entry_removed(dev_t device, ino_t directory,
3594e98292bSAxel Dörfler					const char* name, ino_t node);
3607a1b4ef3SAxel Dörflerextern status_t notify_entry_moved(dev_t device, ino_t fromDirectory,
3614e98292bSAxel Dörfler					const char* fromName, ino_t toDirectory,
3624e98292bSAxel Dörfler					const char* toName, ino_t node);
3636f7fc220SAxel Dörflerextern status_t notify_stat_changed(dev_t device, ino_t directory, ino_t node,
36498f9f2bfSIngo Weinhold					uint32 statFields);
3656f7fc220SAxel Dörflerextern status_t notify_attribute_changed(dev_t device, ino_t directory,
3666f7fc220SAxel Dörfler					ino_t node, const char* attribute, int32 cause);
3675207cc7aSIngo Weinhold
3685207cc7aSIngo Weinholdextern status_t notify_query_entry_created(port_id port, int32 token,
3694e98292bSAxel Dörfler					dev_t device, ino_t directory, const char* name,
3707a1b4ef3SAxel Dörfler					ino_t node);
3715207cc7aSIngo Weinholdextern status_t notify_query_entry_removed(port_id port, int32 token,
3724e98292bSAxel Dörfler					dev_t device, ino_t directory, const char* name,
3737a1b4ef3SAxel Dörfler					ino_t node);
3744a5a077fSClemens Zeidlerextern status_t notify_query_attr_changed(port_id port, int32 token,
3754a5a077fSClemens Zeidler					dev_t device, ino_t directory, const char* name,
3764a5a077fSClemens Zeidler					ino_t node);
3775207cc7aSIngo Weinhold
378136805bcSAxel Dörfler#ifdef __cplusplus
379136805bcSAxel Dörfler}
380136805bcSAxel Dörfler#endif
381136805bcSAxel Dörfler
3828f0cd8cdSAxel Dörfler#endif	/* _FS_INTERFACE_H */
383