<commit_before>// Basic filesystem stuff

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define MAX_NAME_LENGTH 128 // Maximum length of a filename

// FS_node.type defines
#define       FILE_NODE 1
#define        DIR_NODE 2
#define   CHAR_DEV_NODE 3
#define  BLOCK_DEV_NODE 4
#define       PIPE_NODE 5
#define    SYMLINK_NODE 6
#define MOUNTPOINT_NODE 8 // Not 7; we want to OR it with DIR_NODE sometimes

struct FS_node;
struct Dir_entry;

// Standard file function types
typedef uint32_t (*Read) (struct FS_node*, size_t, size_t, char*);
typedef uint32_t (*Write)(struct FS_node*, size_t, size_t, char*);
typedef void     (*Open) (struct FS_node*);
typedef void     (*Close)(struct FS_node*);

typedef struct Dir_entry *(*Read_dir)(struct FS_node*, size_t);
typedef struct FS_node   *(*Find_dir)(struct FS_node*, char*);

typedef struct FS_node
{
	char            name[MAX_NAME_LENGTH];
	uint32_t        length;
	uint32_t        inode;
	uint32_t        permissions;
	uint32_t        uid;
	uint32_t        gid;
	uint32_t        impl;
	uint8_t         type;

	struct FS_node *node_ptr; // Used in symlinks and mountpoints

	// Standard file functions<commit_msg>Change #defines to an enum for FS_node types<commit_after>// Basic filesystem stuff

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define MAX_NAME_LENGTH 128 // Maximum length of a filename

typedef enum Node_type
{
	FILE_NODE       = 1,
	DIR_NODE,
	CHAR_DEV_NODE,
	BLOCK_DEV_NODE,
	PIPE_NODE,
	SYMLINK_NODE,
	MOUNTPOINT_NODE = 8 // We want to OR with DIR_NODE sometimes
} Node_type;

struct FS_node;
struct Dir_entry;

// Standard file function types
typedef uint32_t (*Read) (struct FS_node*, size_t, size_t, char*);
typedef uint32_t (*Write)(struct FS_node*, size_t, size_t, char*);
typedef void     (*Open) (struct FS_node*);
typedef void     (*Close)(struct FS_node*);

typedef struct Dir_entry *(*Read_dir)(struct FS_node*, size_t);
typedef struct FS_node   *(*Find_dir)(struct FS_node*, char*);

typedef struct FS_node
{
	char            name[MAX_NAME_LENGTH];
	uint32_t        length;
	uint32_t        inode;
	uint32_t        permissions;
	uint32_t        uid;
	uint32_t        gid;
	uint32_t        impl;
	Node_type       type;

	struct FS_node *node_ptr; // Used in symlinks and mountpoints

	// Standard file functions
{'fraction_non_alphanumeric': 0.09419354838709677, 'fraction_numerical': 0.021075268817204302, 'mean_word_length': 3.569744597249509, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1628855', 'n_tokens_mistral': 891, 'n_tokens_neox': 795, 'n_words': 243}