From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/2] Loop block device for sandbox
Date: Thu, 6 Sep 2012 10:48:05 +0200 [thread overview]
Message-ID: <201209061048.05835.marex@denx.de> (raw)
In-Reply-To: <1489935.PEvPFmTTiP@bloomfield>
Dear Pavel Herrmann,
> On Thursday 06 of September 2012 03:08:42 Marek Vasut wrote:
> > Dear Pavel Herrmann,
> >
> > > On Wednesday 05 of September 2012 14:48:40 Marek Vasut wrote:
> > > > Dear Pavel Herrmann,
> > > >
> > > > [...]
> > > >
> > > > > > besides, I think it'd be much systematic to just scream at user
> > > > > > to call "sata rescan" and bail out instead of doing it for him.
> > > > >
> > > > > i dont actually need a sata rescan, i just need to make sure i have
> > > > > dynamically allocated names
> > > >
> > > > Sorry, I can't parse this ... but ...
> > > >
> > > > > , so i can safely call free() later, otherwise
> > > > > this segfaults when called before sata scan
> > > >
> > > > The free() function frees the memory space pointed to by ptr, which
> > > > must have been returned by a previous call to malloc(), calloc() or
> > > > realloc().
> > > > Otherwise, or if free(ptr) has already been called before, undefined
> > > > behavior occurs. If ptr is NULL, no operation is performed.
> > > >
> > > > So if you call free() on null pointer, nothing happens. Where's the
> > > > real problem?
> > >
> > > if you called "sata init" before setting all the loops you would get to
> > > open(NULL) and a strlen(NULL). i think its easier to supply valid empty
> > > string then check for NULL at every access.
> >
> > I'd say check for null on every access ... you'd lower memory
> > requirements and the increase in code requirement should really be very
> > minor. Also, it'd remove the "zeroed" static variable altogether,
> > correct?
>
> OK, fine by me
>
> > > > > > Make this "info" part mandatory. Than you can cut the whole argc
> > > > > > loop
> > > > > > into simple "if argc != 2 ; then fail" . And do simple checking
> > > > > > for the first letter of the argument being either i or d .
> > > > >
> > > > > wont help, still need argc 3 or 4
> > > >
> > > > Makes is simpler, you can bail out if it's not 3 or 4
> > >
> > > still, i should have a "sata_loop info" work on all files, so theres a
> > > valid command with argc 2
> >
> > Understood.
> >
> > > > > > > + "sata_loop load devnum file - load file from host FS into
> > > > > > > loop devnum"
> > > > > >
> > > > > > sata_loop is redundant above.
> > > > >
> > > > > really? how do you figure?
> > > >
> > > > Run "help sata_loop" and see the result ...
> > >
> > > =>help sata_loop
> > > sata_loop - SATA loopback
> > >
> > > Usage:
> > > sata_loop [info] devnum - show info about loop devnum
> > > sata_loop load devnum file - load file from host FS into loop devnum
> > >
> > > i dont see your problem
> >
> > Ewww ... nevermind ... I just detected yet another stupid issue in the
> > codebase. I'd say this "sata_loop" should be either omitted and filled by
> > the macro or something. But that's for other time to solve ... so I'm
> > fine with this now.
>
> it actually is, but only to the first line (as both lines are in one
> string). In my opinion it should either add this for each line (with some
> magic string modification) or none at all, to keep it consistent
Keep it as is now, but it's something that should eventually be resolved.
> Pavel Herrmann
next prev parent reply other threads:[~2012-09-06 8:48 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 15:46 [U-Boot] [PATCH] Loop block device for sandbox Pavel Herrmann
2012-08-29 15:48 ` Pavel Herrmann
2012-08-29 22:18 ` Marek Vasut
2012-08-30 17:14 ` Pavel Herrmann
2012-08-30 18:45 ` Marek Vasut
2012-08-30 19:07 ` Pavel Herrmann
2012-08-30 21:53 ` Marek Vasut
2012-08-31 9:09 ` Pavel Herrmann
2012-08-31 12:57 ` Marek Vasut
2012-08-31 14:25 ` Pavel Herrmann
2012-08-31 16:02 ` Marek Vasut
2012-08-31 17:56 ` Pavel Herrmann
2012-08-31 19:02 ` Marek Vasut
2012-09-01 13:19 ` [U-Boot] [PATCH v2 1/2] " Pavel Herrmann
2012-09-01 13:19 ` [U-Boot] [PATCH 2/2] Use loop block device in sandbox board Pavel Herrmann
2012-09-01 14:20 ` Marek Vasut
2012-09-03 17:24 ` Pavel Herrmann
2012-09-03 17:23 ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-09-03 16:49 ` [U-Boot] [PATCH v2 1/2] Loop block device for sandbox Marek Vasut
2012-09-03 17:31 ` Pavel Herrmann
2012-09-03 20:20 ` Marek Vasut
2012-09-05 11:16 ` [U-Boot] [PATCH v3 " Pavel Herrmann
2012-09-05 11:16 ` [U-Boot] [PATCH v3 2/2] Use loop block device in sandbox board Pavel Herrmann
2012-09-05 11:33 ` [U-Boot] [PATCH v3 1/2] Loop block device for sandbox Marek Vasut
2012-09-05 12:38 ` Pavel Herrmann
2012-09-05 12:48 ` Marek Vasut
2012-09-05 20:25 ` Pavel Herrmann
2012-09-06 1:08 ` Marek Vasut
2012-09-06 8:45 ` Pavel Herrmann
2012-09-06 8:48 ` Marek Vasut [this message]
2012-09-05 12:42 ` Pavel Herrmann
2012-09-05 12:52 ` Marek Vasut
2012-09-06 12:31 ` [U-Boot] [PATCH v4 " Pavel Herrmann
2012-09-06 23:29 ` Marek Vasut
2012-09-07 9:19 ` Pavel Herrmann
2012-09-07 9:26 ` Marek Vasut
2012-09-07 9:38 ` Pavel Herrmann
2012-09-07 9:42 ` Marek Vasut
2012-09-13 22:31 ` Tom Rini
2012-09-16 11:49 ` Pavel Herrmann
2012-09-16 11:58 ` [U-Boot] [PATCH v5 " Pavel Herrmann
2012-09-28 9:21 ` [U-Boot] [PATCH v6 " Pavel Herrmann
2012-09-28 18:22 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201209061048.05835.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox