Re: [PATCH 4/5] UBI: introduce attach ioctls

Arnd Bergmann
2007-12-19T14:19:35Z

On Wednesday 19 December 2007, Artem Bityutskiy wrote:
> +/**
> + * struct ubi_attach_req - attach MTD device request.
> + * @vid_hdr_offset: VID header offset
> + * @data_offset: data offset
> + * @mtd_num: MTD device number to attach
> + * @padding: reserved for future, not used, has to be zeroed
> + *
> + * This data structure is used to specify MTD device UBI has to attach and the
> + * parameters it has to use. The "attach MTD device" ioctl returns the number
> + * of the newly created UBI device as the return value.
> + */
> +struct ubi_attach_req {
> +       int32_t vid_hdr_offset;
> +       int32_t data_offset;
> +       int32_t mtd_num;
> +       uint8_t padding[12];
>  };

Can you explain why you need to pass vid_hdr_offset /and/ data_offset here?
What is the difference between the two? Can't you autoprobe them if you
have the device?

The reason I'm asking is that I'd really like to make this a simple
attribute in sysfs, in the mtd object. The question there is what a
user would need to store into that attribute. The device is identified
implicitly already, but this looks like you still need two distint
integers in order to create an UBI device.