All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Davidlohr Bueso <dave@gnu.org>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH] partx: support loop devices
Date: Tue, 16 Aug 2011 17:03:33 +0200	[thread overview]
Message-ID: <20110816150333.GD14535@nb.net.home> (raw)
In-Reply-To: <1313500807.2586.1.camel@offbook>

On Tue, Aug 16, 2011 at 09:20:07AM -0400, Davidlohr Bueso wrote:
> On Mon, 2011-08-15 at 13:58 +0200, Karel Zak wrote:
> > On Mon, Aug 15, 2011 at 12:11:17AM -0400, Davidlohr Bueso wrote:
> > > @@ -800,14 +857,23 @@ int main(int argc, char **argv)
> > >  	if (what == ACT_ADD || what == ACT_DELETE) {
> > >  		struct stat x;
> > >  
> > > -		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode))
> > > -			errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk);
> > > +		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode)) {
> > 
> >   && S_ISREG() :-)
> > 
> > > +			/* not a blkdev, try to associate it to a loop device */
> > 
> >             if (what == ACT_DELETE)
> >                 errx(EXIT_FAILURE, _("%s: cannot delete partitions"), wholedisk);
> > 
> > > +			if (!loopmod_supports_parts())
> > > +				errx(EXIT_FAILURE, _("%s: does not support loop device partitions"), 
> > > +				     wholedisk);
> > > +			assoc_loopdev(wholedisk);
> > > +			wholedisk = xstrdup(lc.device);
> > > +		}
> > >  	}
> > >  	if ((fd = open(wholedisk, O_RDONLY)) == -1)
> > >  		err(EXIT_FAILURE, _("%s: open failed"), wholedisk);
> > >  
> > > -	if (what == ACT_DELETE)
> > > +	if (what == ACT_DELETE) {
> > > +		if (loopdev)
> > > +			errx(EXIT_FAILURE, _("%s: cannot delete partitions"), wholedisk);
> > >  		rc = del_parts(fd, wholedisk, disk_devno, lower, upper);
> > > +	}
> > 
> >  Does it make sense to initialize loop device if ACT_DELETE is requested?
> 
> Ah, yes, good catch. Below is the corrected patch, do you think this
> feature could go into 2.20?

 2.21, for 2.20 is too late

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2011-08-16 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15  4:11 [PATCH] partx: support loop devices Davidlohr Bueso
2011-08-15 11:58 ` Karel Zak
2011-08-16 13:20   ` Davidlohr Bueso
2011-08-16 15:03     ` Karel Zak [this message]
2011-08-31 14:56     ` Karel Zak

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=20110816150333.GD14535@nb.net.home \
    --to=kzak@redhat.com \
    --cc=dave@gnu.org \
    --cc=util-linux@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.