Opened 16 years ago

Last modified 15 years ago

#2 closed task

Rework VFS — at Version 4

Reported by: Nicolas Pouillon Owned by: Nicolas Pouillon
Priority: minor Milestone:
Component: libvfs Keywords:
Cc:

Description (last modified by Nicolas Pouillon)

VFS types

struct vfs_mount_state_s
{
	vfs_fs_open_t *open;
	vfs_fs_lookup_t *lookup;
	vfs_fs_create_t *create;
	vfs_fs_link_t *link;
	vfs_fs_unlink_t *unlink;
	vfs_fs_stat_t *stat;

	struct vfs_node_dir_s *old_node;
	struct vfs_node_dir_s *root;
};

/* base object, inherited twice */
struct vfs_node_base_s
{
	CONTAINER_ENTRY_TYPE(HASHLIST) hash_entry;
	enum vfs_node_type_e type;
	struct vfs_mount_state_s *mount;
	char name[CONFIG_VFS_NAMELEN];
	struct vfs_node_dir_s *parent;
};

struct vfs_node_dir_s
{
	struct vfs_node_base_s base;
	vfs_node_dir_entry_t obj_entry;
	vfs_dir_hash_root_t children;
};

struct vfs_node_leaf_s
{
	struct vfs_node_base_s base;
	vfs_node_leaf_entry_t obj_entry;
};

/* opened file, it defines the operations */
struct vfs_file_s
{
	struct vfs_node_s *node;
	vfs_file_close_t *close;
	vfs_file_read_t *read;
	vfs_file_write_t *write;
	vfs_file_seek_t *seek;
};

VFS operations

error_t vfs_mount(struct vfs_node_dir_s *mountpoint,
				  struct vfs_node_dir_s *fs_root);

error_t vfs_umount(struct vfs_node_dir_s *fs_root);

error_t vfs_node_lookup(struct vfs_node_dir_s *parent,
						const char *name,
						size_t namelen,
						struct vfs_node_base_s **node);

error_t vfs_node_create(struct vfs_mount_state_s *fs,
						enum vfs_node_type_e type,
						struct vfs_node_base_s **node);

error_t vfs_node_link(struct vfs_node_dir_s *parent,
					  struct vfs_node_base_s *node,
					  const char *name,
					  size_t namelen);

error_t vfs_node_unlink(struct vfs_node_dir_s *parent,
						const char *name,
						size_t namelen);

error_t vfs_node_stat(struct vfs_node_base_s *node,
					  struct vfs_stat_s *stat);

error_t vfs_file_open(struct vfs_node_leaf_s *ref,
					  struct vfs_file_s **file);

Change History (4)

comment:1 Changed 16 years ago by Nicolas Pouillon

Type: defecttask

comment:2 Changed 16 years ago by Nicolas Pouillon

Owner: changed from becoulet to Nicolas Pouillon
Status: newassigned

comment:3 Changed 16 years ago by Nicolas Pouillon

Description: modified (diff)
Summary: Implement a correctly-abstracted VFAT driverRework VFS

comment:4 Changed 16 years ago by Nicolas Pouillon

Description: modified (diff)
Note: See TracTickets for help on using tickets.