2026-03-06 20:17:23 +00:00
|
|
|
#ifndef FS_CONTEXT_H_
|
|
|
|
|
#define FS_CONTEXT_H_
|
|
|
|
|
|
|
|
|
|
#include <rosetta/fs.h>
|
2026-03-10 19:15:26 +00:00
|
|
|
#include <xpc/msg.h>
|
2026-03-06 20:17:23 +00:00
|
|
|
|
|
|
|
|
struct fs_file;
|
2026-03-10 19:15:26 +00:00
|
|
|
struct fs_dentry;
|
2026-03-06 20:17:23 +00:00
|
|
|
struct fs_context;
|
|
|
|
|
struct fs_allocator;
|
|
|
|
|
struct fs_superblock;
|
|
|
|
|
|
2026-03-10 19:15:26 +00:00
|
|
|
enum fs_mount_flags {
|
|
|
|
|
FS_MOUNT_READONLY = 0x01u,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef enum fs_status (*fs_mount_function_t)(
|
|
|
|
|
struct fs_context *,
|
|
|
|
|
void *arg,
|
|
|
|
|
enum fs_mount_flags,
|
|
|
|
|
struct fs_superblock **);
|
|
|
|
|
|
|
|
|
|
extern struct fs_context *fs_context_create(struct fs_allocator *alloc);
|
2026-03-06 20:17:23 +00:00
|
|
|
extern void fs_context_destroy(struct fs_context *ctx);
|
|
|
|
|
|
2026-03-10 19:15:26 +00:00
|
|
|
extern enum fs_status fs_context_mount_filesystem(
|
|
|
|
|
struct fs_context *ctx,
|
|
|
|
|
fs_mount_function_t func,
|
|
|
|
|
void *arg,
|
|
|
|
|
enum fs_mount_flags flags);
|
|
|
|
|
extern enum fs_status fs_context_unmount_filesystem(struct fs_context *ctx);
|
|
|
|
|
|
2026-03-06 20:17:23 +00:00
|
|
|
extern struct fs_file *fs_context_open_file(
|
|
|
|
|
struct fs_context *ctx,
|
|
|
|
|
unsigned long id);
|
2026-03-10 19:15:26 +00:00
|
|
|
extern struct fs_file *fs_context_get_file(
|
|
|
|
|
struct fs_context *ctx,
|
|
|
|
|
unsigned long id);
|
2026-03-06 20:17:23 +00:00
|
|
|
extern void fs_context_close_file(struct fs_context *ctx, struct fs_file *f);
|
|
|
|
|
|
2026-03-10 19:15:26 +00:00
|
|
|
extern enum fs_status fs_context_resolve_path(
|
2026-03-06 20:17:23 +00:00
|
|
|
struct fs_context *ctx,
|
2026-03-10 19:15:26 +00:00
|
|
|
const char *path,
|
|
|
|
|
struct fs_dentry **out);
|
2026-03-06 20:17:23 +00:00
|
|
|
|
|
|
|
|
extern kern_status_t fs_context_dispatch_msg(
|
|
|
|
|
struct fs_context *ctx,
|
2026-03-10 19:15:26 +00:00
|
|
|
xpc_msg_t *msg);
|
|
|
|
|
|
|
|
|
|
extern void *fs_context_alloc(struct fs_context *ctx, size_t count);
|
|
|
|
|
extern void *fs_context_calloc(struct fs_context *ctx, size_t count, size_t sz);
|
|
|
|
|
extern void *fs_context_realloc(struct fs_context *ctx, void *p, size_t count);
|
|
|
|
|
extern void fs_context_free(struct fs_context *ctx, void *p);
|
2026-03-06 20:17:23 +00:00
|
|
|
|
|
|
|
|
#endif
|