/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef FILE_SYSTEM_STRUCT_H #define FILE_SYSTEM_STRUCT_H struct device_struct; struct stat_struct; /* Dans un systeme de fichiers, chaque fichier est represente par un * identifiant de type unsigned long. La racine du systeme de fichiers doit * avoir l'identifiant 0. */ struct file_system_struct { const char *name; int type; /* FT_NONE, FT_BLK */ /* montage et demontage */ int (*mount)(const struct device_struct *device, void **data); void (*umount)(void *data); /* operations sur les fichiers */ /* Le nom de l'argument indique son type (node par defaut). `!` indique que l'argument, s'il peut etre un repertoire, ne peut pas etre la racine. */ int (*find)(void *data, unsigned long dir_id, const char *fs_basename, unsigned long *id, int *type); int (*get_name)(void *data, unsigned long id, char name[]); /* ! */ int (*get_device)(void *data, unsigned long spec_id, struct device_struct **spec_device); int (*get_size)(void *data, unsigned long reg_id, unsigned long *size); int (*stat)(void *data, unsigned long id, struct stat_struct *fs_buf); int (*read_dir)(void *data, unsigned long dir_id, unsigned long pos, char *fs_buf, unsigned int count); int (*read)(void *data, unsigned long leaf_id, unsigned long pos, char *fs_buf, unsigned int count); int (*write)(void *data, unsigned long leaf_id, unsigned long pos, const char *fs_buf, unsigned int count); int (*ioctl)(void *data, unsigned long spec_id, int request, void *fs_arg); int (*create)(void *data, unsigned long dir_id, const char *fs_basename); int (*mkdir)(void *data, unsigned long dir_id, const char *fs_basename); int (*can_remove)(void *data, unsigned long leaf_id); int (*remove)(void *data, unsigned long leaf_id, unsigned long parent_dir_id); int (*rmdir)(void *data, unsigned long dir_id, unsigned long parent_dir_id); /* ! */ int (*rename)(void *data, unsigned long old_id, unsigned long old_parent_dir_id, unsigned long new_dir_id, const char *fs_basename); /* ! */ }; #endif