/*
* dir.h - Definitions for storing the ramdisk directory tree
*
* Copyright (C) 2002-2003 Gero Kuhlmann <gero@gkminix.han.de>
*
* 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 2 of the License, or
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: dir.h,v 1.2 2003/01/25 23:29:43 gkminix Exp $
*/
/* Structure to hold file name information */
typedef unsigned short utf16_t;
struct fname_struct {
char name[8]; /* file name */
char ext[3]; /* extension name */
utf16_t *lfn_name; /* LFN file name (unicode) */
int lfn_num; /* number of LFN dir entries */
};
/* Union to hold information from the source directory */
union src_info {
char path[1]; /* path name on host server */
unsigned long cluster; /* start cluster in FAT image file */
};
/* Structure to hold file information from directory */
struct file_struct {
struct fname_struct name; /* file name */
char attrib; /* attributes */
unsigned int time; /* time of last access (DOS format) */
unsigned int date; /* date of last access (DOS format) */
unsigned int cluster; /* number of start cluster */
unsigned int clustnum; /* number of clusters */
unsigned long size; /* file size in bytes */
struct file_struct *next; /* pointer to next file in dir */
union src_info src; /* file source info */
};
/* Structure to hold information about subdirectories */
struct dir_struct {
struct fname_struct name; /* file name */
char attrib; /* attributes */
unsigned int time; /* time of last access (DOS format) */
unsigned int date; /* date of last access (DOS format) */
unsigned int cluster; /* number of start cluster */
unsigned int clustnum; /* number of clusters */
unsigned long totsize; /* total size of all files in kB */
int subdirnum; /* number of subdirectories */
int filenum; /* number of files in directory */
int lfnnum; /* number of LFN directory entries */
struct dir_struct *subdirs; /* pointer to first subdir */
struct file_struct *files; /* pointer to first file */
struct dir_struct *next; /* pointer to next dir in cur subdir */
union src_info src; /* directory source info */
};
#define DIR_ENTRIES(dir) ((dir)->subdirnum + \
(dir)->filenum + \
(dir)->lfnnum + 2)
/*
* Global variables and routines
*/
/* Global variables */
extern struct dir_struct *root_dir; /* pointer to root directory */
extern __u8 *boot_block; /* boot block buffer */
extern unsigned int boot_size; /* size of boot block */
/* Routines in misc.c */
extern struct file_struct *findfile __P((struct dir_struct *dsp,
int recursive, char *name, char *ext));
extern void gettime __P((time_t mtime, unsigned int *date,
unsigned int *time));
/* Routines in hostfs.c */
extern void hostopen __P((char *name));
extern void hostclose __P((void));
extern void hostcopy __P((int clustsize, int handle, struct file_struct *fsp));
/* Routines in fatfs.c */
extern void fatopen __P((char *name));
extern void fatclose __P((void));
extern void fatcopy __P((int clustsize, int handle, struct file_struct *fsp));
syntax highlighted by Code2HTML, v. 0.9.1