hal: remove block.block_size
Robert Love
rml at ximian.com
Sun Mar 28 01:23:15 EET 2004
Hi, David.
There is a FIXME associated with block.block_size:
"is a block always 512 bytes?? Must check kernel source"
Indeed, the block size is not always 512 bytes. It can vary.
Unfortunately, the only way to get the block size is to open() the
device, which is hopefully something only root can do. Therefore, I
suggest that we just remove this property altogether. It is not a very
useful property, anyhow.
The following patch removes it. Simple enough.
If we _do_ want to keep this property and actually fill in the correct
value, then we need to do something like:
#include <sys/ioctl.h>
#include <linux/fs.h>
int fd, size;
fd = open (device, O_RDONLY);
if (fd < 0)
/* error */
if (ioctl (fd, BLKSSZGET, &size) < 0)
/* error */
close (fd);
ds_property_set_int (d, "block.block_size", size);
If you want to do that, let me know and I will cook up a patch. But
neither requiring root nor touching hard drives seems HAL-like.
Thanks,
Robert Love
2004-03-27 Robert Love <rml at ximian.com>
* hald/linux/linux_class_block.c: remove block.block_size
Index: hald/linux/linux_class_block.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/linux_class_block.c,v
retrieving revision 1.26
diff -u -r1.26 linux_class_block.c
--- hald/linux/linux_class_block.c 3 Mar 2004 17:56:56 -0000 1.26
+++ hald/linux/linux_class_block.c 27 Mar 2004 23:16:55 -0000
@@ -157,9 +157,6 @@
}
ds_property_set_bool (d, "block.is_volume", !not_partition);
- /** @todo FIXME is a block always 512 bytes?? Must check kernel source */
- ds_property_set_int (d, "block.block_size", 512);
-
if (class_device->sysdevice == NULL) {
/* there is no sys device corresponding to us.. this means we
* must be the child of another block device ie. a partition
More information about the xdg
mailing list