summaryrefslogtreecommitdiffstats
path: root/include/driver.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-09-10 12:07:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-09-11 09:13:33 +0200
commitf46010a1ab5182346e424af31fe8b654e8d700f4 (patch)
treefbd7a3bedb25f9ebceb11d16f082bfc05058fea3 /include/driver.h
parent2ee3e596c5dfc56baca440faed47bc641719d26b (diff)
downloadbarebox-f46010a1ab5182346e424af31fe8b654e8d700f4.tar.gz
barebox-f46010a1ab5182346e424af31fe8b654e8d700f4.tar.xz
devfs: add open counter
Add an open counter for device files so that we cannot accidently remove an opened device. This happened with bb devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/driver.h')
-rw-r--r--include/driver.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/driver.h b/include/driver.h
index 68f744a942..2ee7fb1cf8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -301,10 +301,11 @@ struct cdev {
unsigned long offset;
size_t size;
unsigned int flags;
+ int open;
};
int devfs_create(struct cdev *);
-void devfs_remove(struct cdev *);
+int devfs_remove(struct cdev *);
struct cdev *cdev_by_name(const char *filename);
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags);
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags);