40#define NUM_OPEN_FILES 4
43#define NUM_OPEN_FILES 20
93int Device::open(
struct _reent *reent,
const char *path,
int flags,
int mode)
108 if (!strcmp(dev->name, path))
142 if (fd >=0 && fd <= 2)
165int Device::stat(
struct _reent *reent,
const char *path,
struct stat *stat)
171 if (!strcmp(dev->name, path))
174 stat->st_mode = dev->get_mode();
Base class for both Device and FileSystem objects.
static void fd_free(int fd)
Free up a file descriptor.
static File * file_lookup(int fd)
Looks up a reference to a File corresponding to a given file descriptor.
friend class Device
Allow access from Device class.
virtual int close(File *file)=0
Close a file or device.
static File files[]
File descriptor pool.
virtual int open(File *file, const char *path, int flags, int mode)=0
Open a file or device.
static int fd_alloc(void)
Allocate a free file descriptor.
static OSMutex mutex
mutual exclusion for fileio
void unlock()
Unlock a mutex.
static Device * first
first device in linked list
static int stat(struct _reent *reent, const char *path, struct stat *stat)
Get the status information of a file or device.
Device * next
next device in linked list
virtual ~Device()
Destructor.
static int close(struct _reent *reent, int fd)
Close a file or device.
static int open(struct _reent *reent, const char *path, int flags, int mode)
Open a file or device.
Device * prev
previous device in linked list
uint8_t inshdn
true if this fd is in shutdown.
uint8_t device
true if this is a device, false if file system
FileIO * dev
file operations