Re: [PATCH 001 of 7] md: Support 'external' metadata for md arrays.

Andrew Morton
2007-12-25T22:04:36Z

On Fri, 14 Dec 2007 17:26:08 +1100 NeilBrown <neilb@suse.de> wrote:

> + if (strncmp(buf, "external:", 9) == 0) {
> + int namelen = len-9;
> + if (namelen >= sizeof(mddev->metadata_type))
> + namelen = sizeof(mddev->metadata_type)-1;
> + strncpy(mddev->metadata_type, buf+9, namelen);
> + mddev->metadata_type[namelen] = 0;
> + if (namelen && mddev->metadata_type[namelen-1] == '\n')
> + mddev->metadata_type[--namelen] = 0;
> + mddev->persistent = 0;
> + mddev->external = 1;

size_t would be a more appropriate type for `namelen'.