From 9d8751b3f5c6358b6167c38899f1e41498d24a45 Mon Sep 17 00:00:00 2001 From: Richard Genoud Date: Wed, 22 Aug 2012 18:04:37 +0200 Subject: ubiattach: fail if kernel ignores max_beb_per1024 If the kernel doesn't know the max_beb_per1024 parameter in the attach ioctl, but the call still succeeded ubi_attach and ubi_attach_mtd will return 1 instead of 0. In this case, the ubiattach command will detach the device and fail with an error message. Signed-off-by: Richard Genoud Signed-off-by: Artem Bityutskiy --- ubi-utils/include/libubi.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ubi-utils/include/libubi.h') diff --git a/ubi-utils/include/libubi.h b/ubi-utils/include/libubi.h index 84ac84c..47f40e2 100644 --- a/ubi-utils/include/libubi.h +++ b/ubi-utils/include/libubi.h @@ -221,12 +221,14 @@ int mtd_num2ubi_dev(libubi_t desc, int mtd_num, int *dev_num); * @req. If @req->mtd_dev_node is given it should contain path to the MTD * device node. Otherwise @req->mtd_num will be used. * - * Returns %0 in case of success and %-1 in case of failure (errno is set). - * The newly created UBI device number is returned in @req->dev_num. - * The MTD device number is returned in @req->mtd_num (-1 if not found) + * Returns %0 in case of success, %-1 in case of failure (errno is set) and %1 + * if parameter @req->max_beb_per1024 was ignored by kernel (because the kernel + * is old and does not support this feature, which was added in 3.7). The newly + * created UBI device number is returned in @req->dev_num. In the MTD device + * was specified by its device node path, the MTD device number is returned in + * @req->mtd_num. */ -int ubi_attach(libubi_t desc, const char *node, - struct ubi_attach_request *req); +int ubi_attach(libubi_t desc, const char *node, struct ubi_attach_request *req); /** * ubi_detach_mtd - detach an MTD device. -- cgit v1.2.3