diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-06-06 09:25:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-06-06 09:30:48 +0200 |
commit | ee6d36a5405305f3bbdb0457948c219731b3d9cc (patch) | |
tree | 0a328bd96f2cf2f190372b654515e509c694930a /include/driver.h | |
parent | 3f73e61600f8fce0b6fa02e9a82124c1c89937c7 (diff) | |
download | barebox-ee6d36a5405305f3bbdb0457948c219731b3d9cc.tar.gz barebox-ee6d36a5405305f3bbdb0457948c219731b3d9cc.tar.xz |
- introduce ioctl call
- pass open/close/lseek through to drivers
Diffstat (limited to 'include/driver.h')
-rw-r--r-- | include/driver.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h index cade9fdfb6..4000ba689e 100644 --- a/include/driver.h +++ b/include/driver.h @@ -64,6 +64,8 @@ /*@{*/ /* do not delete, doxygen relevant */ +struct filep; + /** @brief Describes a particular device present in the system */ struct device_d { /*! This member (and 'type' described below) is used to match with a @@ -131,6 +133,11 @@ struct driver_d { /*! Called in response of write to this device. Required */ ssize_t (*write) (struct device_d*, const void* buf, size_t count, ulong offset, ulong flags); + int (*ioctl) (struct device_d*, int, void *); + + off_t (*lseek) (struct device_d*, off_t); + int (*open) (struct device_d*, struct filep*); + int (*close) (struct device_d*, struct filep*); int (*erase) (struct device_d*, size_t count, unsigned long offset); int (*protect)(struct device_d*, size_t count, unsigned long offset, int prot); @@ -219,6 +226,10 @@ struct driver_d *get_driver_by_name(const char *name); ssize_t dev_read(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags); ssize_t dev_write(struct device_d *dev, const void *buf, size_t count, ulong offset, ulong flags); +int dev_open(struct device_d *dev, struct filep *); +int dev_close(struct device_d *dev, struct filep *); +int dev_ioctl(struct device_d *dev, int, void *); +off_t dev_lseek(struct device_d *dev, off_t offset); int dev_erase(struct device_d *dev, size_t count, unsigned long offset); int dev_protect(struct device_d *dev, size_t count, unsigned long offset, int prot); int dev_memmap(struct device_d *dev, void **map, int flags); @@ -233,5 +244,20 @@ int dummy_probe(struct device_d *); int generic_memmap_ro(struct device_d *dev, void **map, int flags); int generic_memmap_rw(struct device_d *dev, void **map, int flags); +static inline off_t dev_lseek_default(struct device_d *dev, off_t ofs) +{ + return ofs; +} + +static inline int dev_open_default(struct device_d *dev, struct filep *f) +{ + return 0; +} + +static inline int dev_close_default(struct device_d *dev, struct filep *f) +{ + return 0; +} + #endif /* DRIVER_H */ |