* UBI Tools - problem with multiple ubi devices. @ 2007-02-27 21:12 John Smith 2007-02-28 9:29 ` Alexander Schmidt 0 siblings, 1 reply; 5+ messages in thread From: John Smith @ 2007-02-27 21:12 UTC (permalink / raw) To: linux-mtd In GIT: users/haver/mtd-utils.git File: ubi-utils/src/libubi.c Function: get_ubi_info The code counts the number of UBI volumes by looking for files called /sys/class/ubi0, /sys/class/ubi1, ... but the files are actually /sys/class/ubi/ubi0, ... The count starts from 1 (probably also wrong), so is usable if there is a single UBI device. But if there is more than one UBI device, tools like ubimkvol fail. John ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: UBI Tools - problem with multiple ubi devices. 2007-02-27 21:12 UBI Tools - problem with multiple ubi devices John Smith @ 2007-02-28 9:29 ` Alexander Schmidt 2007-02-28 22:08 ` Frank Haverkamp 0 siblings, 1 reply; 5+ messages in thread From: Alexander Schmidt @ 2007-02-28 9:29 UTC (permalink / raw) To: linux-mtd, John Smith; +Cc: Frank Haverkamp On Tuesday 27 February 2007, John Smith wrote: > In > GIT: users/haver/mtd-utils.git > File: ubi-utils/src/libubi.c > Function: get_ubi_info > > The code counts the number of UBI volumes by looking for files called > > /sys/class/ubi0, /sys/class/ubi1, ... > > but the files are actually > > /sys/class/ubi/ubi0, ... > > The count starts from 1 (probably also wrong), so is usable if there is a > single UBI device. But if there is more than one UBI device, tools like > ubimkvol fail. Hi John, thanks for pointing this out. Frank, please review and commit. Signed-off-by: Alexander Schmidt <alexs@linux.vnet.ibm.com> --- ubi-utils/src/libubi.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) --- mtd-utils.orig/ubi-utils/src/libubi.c +++ mtd-utils/ubi-utils/src/libubi.c @@ -138,7 +138,7 @@ static int get_ubi_info(ubi_lib_t desc, struct ubi_info *ubi) { int err; - int n = 1; + int dev_count = 0; char *path; struct stat stat; @@ -147,31 +147,31 @@ get_ubi_info(ubi_lib_t desc, struct ubi_ return -1; /* Calculate number of UBI devices */ - do { + while (!err) { char dir[20]; - sprintf(&dir[0], "ubi%d", n); - path = mkpath(desc->sysfs_root, dir); + sprintf(&dir[0], "ubi%d", dev_count); + path = mkpath(desc->ubi_root, dir); if (!path) return ENOMEM; err = lstat(path, &stat); if (err == 0) - n += 1; + dev_count += 1; free(path); - } while (err == 0); + } if (errno != ENOENT) return -1; - if (n == 0) { + if (dev_count == 0) { ubi_err("no UBI devices found"); errno = EINVAL; return -1; } errno = 0; - ubi->dev_count = n; + ubi->dev_count = dev_count; return 0; } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: UBI Tools - problem with multiple ubi devices. 2007-02-28 9:29 ` Alexander Schmidt @ 2007-02-28 22:08 ` Frank Haverkamp 2007-03-07 13:15 ` Josh Boyer 0 siblings, 1 reply; 5+ messages in thread From: Frank Haverkamp @ 2007-02-28 22:08 UTC (permalink / raw) To: Alexander Schmidt; +Cc: John Smith, linux-mtd, Frank Haverkamp Hi Alex & John, thanks for taking care. I included it in my git. I also reworked my git to be based on the mtd-utils.git again. I will start there now to use the ubi branch for the changes we want to try out before Josh can take them into the offical mtd-utils.git/ubi. On Wed, 2007-02-28 at 10:29 +0100, Alexander Schmidt wrote: > On Tuesday 27 February 2007, John Smith wrote: > > In > > GIT: users/haver/mtd-utils.git > > File: ubi-utils/src/libubi.c > > Function: get_ubi_info > > > > The code counts the number of UBI volumes by looking for files called > > > > /sys/class/ubi0, /sys/class/ubi1, ... > > > > but the files are actually > > > > /sys/class/ubi/ubi0, ... > > > > The count starts from 1 (probably also wrong), so is usable if there is a > > single UBI device. But if there is more than one UBI device, tools like > > ubimkvol fail. John, thanks for pointing this out. Feel free to send us a patch in addition to your bug-report. If it works we can immediately include it. Pleaes let us know if it works for you now. > > Hi John, > > thanks for pointing this out. > Frank, please review and commit. > Thanks, looks good to me, included. Frank ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: UBI Tools - problem with multiple ubi devices. 2007-02-28 22:08 ` Frank Haverkamp @ 2007-03-07 13:15 ` Josh Boyer 2007-03-14 17:36 ` Josh Boyer 0 siblings, 1 reply; 5+ messages in thread From: Josh Boyer @ 2007-03-07 13:15 UTC (permalink / raw) To: haver; +Cc: John Smith, Alexander Schmidt, linux-mtd, Frank Haverkamp On 2/28/07, Frank Haverkamp <haver@vnet.ibm.com> wrote: > John, thanks for pointing this out. Feel free to send us a patch in > addition to your bug-report. If it works we can immediately include it. > Pleaes let us know if it works for you now. John, if this patch worked for you please let us know. I'm waiting to pull it based on some kind of confirmation that it fixed the issue. thx, josh ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: UBI Tools - problem with multiple ubi devices. 2007-03-07 13:15 ` Josh Boyer @ 2007-03-14 17:36 ` Josh Boyer 0 siblings, 0 replies; 5+ messages in thread From: Josh Boyer @ 2007-03-14 17:36 UTC (permalink / raw) To: haver; +Cc: John Smith, Alexander Schmidt, linux-mtd, Frank Haverkamp On 3/7/07, Josh Boyer <jwboyer@gmail.com> wrote: > On 2/28/07, Frank Haverkamp <haver@vnet.ibm.com> wrote: > > John, thanks for pointing this out. Feel free to send us a patch in > > addition to your bug-report. If it works we can immediately include it. > > Pleaes let us know if it works for you now. > > John, if this patch worked for you please let us know. I'm waiting to > pull it based on some kind of confirmation that it fixed the issue. I committed this today. Thanks for the patch Alexander. josh ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-14 17:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-02-27 21:12 UBI Tools - problem with multiple ubi devices John Smith 2007-02-28 9:29 ` Alexander Schmidt 2007-02-28 22:08 ` Frank Haverkamp 2007-03-07 13:15 ` Josh Boyer 2007-03-14 17:36 ` Josh Boyer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox