uboot/fs/fdos/fdos.h
<<
>>
Prefs
   1/*
   2 * (C) Copyright 2002
   3 * Stäubli Faverges - <www.staubli.com>
   4 * Pierre AUBERT  p.aubert@staubli.com
   5 *
   6 * SPDX-License-Identifier:     GPL-2.0+
   7 */
   8
   9#ifndef _FDOS_H_
  10#define _FDOS_H_
  11
  12
  13#undef  FDOS_DEBUG
  14
  15#ifdef  FDOS_DEBUG
  16#define PRINTF(fmt,args...)     printf (fmt ,##args)
  17#else
  18#define PRINTF(fmt,args...)
  19#endif
  20
  21/* Data structure describing media                                           */
  22typedef struct fs
  23{
  24    unsigned long       tot_sectors;
  25
  26    int                 cluster_size;
  27    int                 num_clus;
  28
  29    int                 fat_start;
  30    int                 fat_len;
  31    int                 nb_fat;
  32    int                 num_fat;
  33
  34    int                 dir_start;
  35    int                 dir_len;
  36
  37    unsigned char       *fat_buf;
  38
  39} Fs_t;
  40
  41/* Data structure describing one file system slot                            */
  42typedef struct slot {
  43    int (*map) (struct fs *fs,
  44                struct slot *file,
  45                int where,
  46                int *len);
  47    unsigned long FileSize;
  48
  49    unsigned short int FirstAbsCluNr;
  50    unsigned short int PreviousAbsCluNr;
  51    unsigned short int PreviousRelCluNr;
  52
  53    Directory_t dir;
  54} Slot_t;
  55
  56typedef struct file {
  57    char                *name;
  58    int                 Case;
  59    Fs_t                *fs;
  60    Slot_t              subdir;
  61    Slot_t              file;
  62} File_t;
  63
  64
  65/* dev.c                                                                     */
  66int dev_read (void *buffer, int where, int len);
  67int dev_open (void);
  68int check_dev (BootSector_t *boot, Fs_t *fs);
  69
  70/* fat.c                                                                     */
  71unsigned int fat_decode (Fs_t *fs, unsigned int num);
  72int read_fat (BootSector_t *boot, Fs_t *fs);
  73
  74/* vfat.c                                                                    */
  75int vfat_lookup (Slot_t *dir,
  76                 Fs_t *fs,
  77                 Directory_t *dirent,
  78                 int *entry,
  79                 int *vfat_start,
  80                 char *filename,
  81                 int flags,
  82                 char *outname,
  83                 Slot_t *file);
  84
  85/* subdir.c                                                                  */
  86char *basename (char *name);
  87int open_subdir (File_t *desc);
  88int open_file (Slot_t *file, Directory_t *dir);
  89int read_file (Fs_t *fs,
  90               Slot_t *file,
  91               char *buf,
  92               int where,
  93               int len);
  94void init_subdir (void);
  95
  96/* fs.c                                                                      */
  97int fs_init (Fs_t *fs);
  98
  99
 100#endif
 101