summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-05-26 01:51:22 -0400
committerIan Moffett <ian@osmora.org>2025-05-26 01:51:22 -0400
commit6b52b61f5bde1bcc1e08d760b6650009e9f1cab4 (patch)
tree8b807f62328afc186e79383f585595f4833727c5 /sys/include
parent08d925bce8a18361655a56bf5b38d6f9e9134b8a (diff)
kernel: devfs: Add callback to request block size
Add bsize() callback within the bdevsw structure. This returns the number of blocks a block device supports at maximum. This result is *not* in bytes. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/sys/device.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/include/sys/device.h b/sys/include/sys/device.h
index f5f92ad..fcafdab 100644
--- a/sys/include/sys/device.h
+++ b/sys/include/sys/device.h
@@ -42,6 +42,7 @@ typedef uint8_t devmajor_t;
/* Device operation typedefs */
typedef int(*dev_read_t)(dev_t, struct sio_txn *, int);
typedef int(*dev_write_t)(dev_t, struct sio_txn *, int);
+typedef int(*dev_bsize_t)(dev_t);
struct cdevsw {
int(*read)(dev_t dev, struct sio_txn *sio, int flags);
@@ -51,6 +52,7 @@ struct cdevsw {
struct bdevsw {
int(*read)(dev_t dev, struct sio_txn *sio, int flags);
int(*write)(dev_t dev, struct sio_txn *sio, int flags);
+ int(*bsize)(dev_t dev);
};
void *dev_get(devmajor_t major, dev_t dev);
@@ -61,10 +63,12 @@ int dev_register(devmajor_t major, dev_t dev, void *devsw);
int dev_noread(void);
int dev_nowrite(void);
+int dev_nobsize(void);
/* Device operation stubs */
#define noread ((dev_read_t)dev_noread)
#define nowrite ((dev_write_t)dev_nowrite)
+#define nobsize ((dev_bsize_t)dev_nobsize)
#endif /* _KERNEL */
#endif /* !_SYS_DEVICE_H_ */