View of xos/fs/pfs.h


XOS | Parent Directory | View | Download

/* 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 <http://www.gnu.org/licenses/>. */
 
#ifndef PFS_H
#define PFS_H
 
struct device_struct;
 
struct pfs_dir_entry_info_struct;
struct pfs_dir_entry_struct;
struct pfs_dir_struct;
 
int pfs_name_match(const char *fs_basename, const char *name);
char *pfs_create_name(const char *fs_basename);
 
void pfs_set_dir_entry_info_name(struct pfs_dir_entry_info_struct *dir_entry_info, char *name);
int pfs_set_dir_entry_info_name_dup(struct pfs_dir_entry_info_struct *dir_entry_info, const char *name);
void pfs_free_dir_entry_info_name(struct pfs_dir_entry_info_struct *dir_entry_info);
void pfs_init_dir(struct pfs_dir_struct *dir);
void pfs_insert_dir_entry(struct pfs_dir_entry_struct *dir_entry, struct pfs_dir_struct *dir);
void pfs_remove_dir_entry(struct pfs_dir_entry_struct *dir_entry, struct pfs_dir_struct *dir);
 
int pfs_file_exists(const struct pfs_dir_struct *dir, const char *fs_basename);
int pfs_find(const struct pfs_dir_struct *dir, const char *fs_basename, unsigned long *id, int *type);
int pfs_read_name(const char *name, unsigned long pos, char *fs_buf, unsigned int count);
int pfs_read_dir(const struct pfs_dir_struct *dir, unsigned long pos, char *fs_buf, unsigned int count);
 
int pfs_read_zeros(char *fs_buf, unsigned int count);
int pfs_read_buf(const char *buf, unsigned int buf_size, unsigned long pos, char *fs_buf, unsigned int count);
int pfs_read_block(const struct device_struct *device, unsigned long pos, char *fs_buf, unsigned int count);
int pfs_write_block(const struct device_struct *device, unsigned long pos, const char *fs_buf, unsigned int count);
 
#endif