> On 2011-04-18 21:20:49, Nathan Binkert wrote:
> > util/gem5img.py, line 64
> > <http://reviews.m5sim.org/r/644/diff/1/?file=11664#file11664line64>
> >
> >     This is pretty similar to m5.util.readCommand which made me think that 
> > it might be nice if we put your utility functions here in m5.util
> 
> Gabe Black wrote:
>     Can I use m5.util from an arbitrary python script? If I can that's good 
> to know. Also, how does readCommand work? Does it pass through stdout/stderr 
> or capture it? Depending on the answer it might be an appropriate replacement 
> for this or the subsequent getOutput, but changing only one obscures the 
> similarities between the two functions. If you're advocating adding a new 
> version of readCommand that has the other behavior then that makes sense. I 
> also funnel text into stdin for input, and I think sudo happens to still work 
> because it goes around any redirection I set up.
> 
> Nathan Binkert wrote:
>     Yes, you can.  Several scripts do that.  You have to get it into your 
> path though.  Check out the style hook.  I suggest just looking at 
> readCommand and the examples to see exactly what it does.

I looked at it and it is similar, but it's different enough that they can't be 
interchanged. My functions all allow passing a string in as standard input and 
return the error code, but readCommand doesn't. I could extend it to take an 
input string, but it's not clear how to return the output and the error code 
without changing all the call sites and complicating all the code that's 
working fine now without it. readCommand doesn't allow printing the command 
before it's run so I'd have to add a wrapper to handle that, and it doesn't 
handle adding 'sudo'. I think tying in readCommand would actually make 
everything bigger and more complicated because it's not quite what I need and 
I'd have to add a bunch of wrappers. Also wrapping all the possible variations 
of Popen people might need (not that that's what you're saying, but it heads 
that way) is probably also counter productive because at that point you might 
as well just use Popen directly.


- Gabe


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/644/#review1133
-----------------------------------------------------------


On 2011-04-18 02:37:48, Gabe Black wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/644/
> -----------------------------------------------------------
> 
> (Updated 2011-04-18 02:37:48)
> 
> 
> Review request for Default, Ali Saidi, Gabe Black, Steve Reinhardt, and 
> Nathan Binkert.
> 
> 
> Summary
> -------
> 
> Util: Replace mkblankimage.sh with the new gem5img.py.
> 
> This change replaces the mkblankimage.sh script, used for creating new disk
> images, with a new gem5img.py script. The new version is written in python
> instead of bash, takes its parameters from command line arguments instead of
> prompting for them, and finds a free loopback device dynamically instead of
> hardcoding /dev/loop1. The file system used is now optionally configurable,
> and the blank image is filled by a "hole" left by lseek and write instead of
> literally filling it with zeroes.
> 
> The functionality of the new script is broken into subcommands "init",
> "mount", "umount", "new", "partition", and "format". "init" creates a new file
> of the appropriate size, partitions it, and then formats the first (and only)
> new parition. "mount" attaches a new loopback device to the first parition of
> the image file and mounts it to the specified mount point. "umount" unmounts
> the specified mount point and identifies and cleans up the underlying loopback
> device. "new", "partition", and "format" are the individual stages of "init"
> but broken out so they can be run individually. That's so an image can be
> reinitialized in place if needed.
> 
> Two features of the original script are being dropped. The first is the
> ability to specify a source directory to copy into the new file system. The
> second is the ability to specify a list of commands to run which are expected
> to (but not required to) update the permissions of the files in the new fs.
> Both of these seem easy enough to do manually, especially given the "mount"
> and "umount" commands, that removing them would meaningfully simplify the
> script without making it less useful.
> 
> 
> Diffs
> -----
> 
>   util/gem5img.py PRE-CREATION 
>   util/mkblankimage.sh d8ec0a7b3f0c 
> 
> Diff: http://reviews.m5sim.org/r/644/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Gabe
> 
>

_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to