From 3b6d6a45e705efb64fe522158ed33f640073da12 Mon Sep 17 00:00:00 2001 From: sascha Date: Fri, 19 Oct 2007 08:45:57 +0200 Subject: - Implement tree structure for devices - Use device tree structure to implement partitions - Let devinfo print a nice tree - Introduce 'fixed' partitions which are not removable - Fix mount: It was not possible to mount on a relative path. --- common/partition.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'common/partition.c') diff --git a/common/partition.c b/common/partition.c index a37177c08d..98bae393a2 100644 --- a/common/partition.c +++ b/common/partition.c @@ -7,7 +7,8 @@ #include #include -struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset, size_t size, char *name) +struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset, + size_t size, int flags, const char *name) { struct partition *part; @@ -24,8 +25,10 @@ struct device_d *dev_add_partition(struct device_d *dev, unsigned long offset, s part->offset = offset; part->physdev = dev; + part->flags = flags; register_device(&part->device); + dev_add_child(dev, &part->device); if (part->device.driver) return &part->device; @@ -81,15 +84,17 @@ static ssize_t part_write(struct device_d *dev, const void *buf, size_t count, u { struct partition *part = dev->type_data; - if (part->readonly) - return -EROFS; + if (part->flags & PARTITION_READONLY) + return -EROFS; else return dev_write(part->physdev, buf, count, offset + part->offset, flags); } static int part_probe(struct device_d *dev) { +#ifdef DEBUG struct partition *part = dev->type_data; +#endif debug("registering partition %s on device %s (size=0x%08x, name=%s)\n", dev->id, part->physdev->id, dev->size, part->name); -- cgit v1.2.3