summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-07-03 10:12:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-04 08:38:22 +0200
commit8d064097eb1033f9ada70e786dd09617ffa0eed0 (patch)
tree155d7c803db286aa039f1d74de69a5bdc6a14b71 /include
parentcca17e25bfb7e7cc2b0ab4164561f725969ce36a (diff)
downloadbarebox-8d064097eb1033f9ada70e786dd09617ffa0eed0.tar.gz
barebox-8d064097eb1033f9ada70e786dd09617ffa0eed0.tar.xz
fs: fix standard zero, full devices
The standard devices are currently broken since they have the size ~0. As now files use loff_t as file size which is a signed type the read implementation gets confused and now returns -1. The current implementation also has the (somewhat theorical) problem that we do not have real streaming devices, so /dev/zero went out of zeroes after reading 4GB (or now LLONG_MAX). This patch introduces a new cdev flag DEVFS_IS_CHARACTER_DEV and a new file size flag FILE_SIZE_STREAM which makes it possible to create real stream devices instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/driver.h1
-rw-r--r--include/fs.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h
index a5e3f44212..7d597b41b7 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -417,6 +417,7 @@ int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
#define DEVFS_PARTITION_FIXED (1 << 0)
#define DEVFS_PARTITION_READONLY (1 << 1)
#define DEVFS_IS_PARTITION (1 << 2)
+#define DEVFS_IS_CHARACTER_DEV (1 << 3)
int devfs_add_partition(const char *devname, loff_t offset, loff_t size,
int flags, const char *name);
diff --git a/include/fs.h b/include/fs.h
index 2b1023e453..c0b9f71fbd 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -24,6 +24,7 @@ typedef struct dir {
typedef struct filep {
struct device_d *dev; /* The device this FILE belongs to */
loff_t pos; /* current position in stream */
+#define FILE_SIZE_STREAM ((loff_t) -1)
loff_t size; /* The size of this inode */
ulong flags; /* the O_* flags from open */