linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] cleanup file io
@ 2003-09-04  5:11 Steve Schmidtke
  2003-09-05 19:00 ` [uml-devel] " Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Schmidtke @ 2003-09-04  5:11 UTC (permalink / raw)
  To: jdike; +Cc: User-mode-linux-devel

Hi Jeff,

Can I submit a cleanup patch that does stuff like this all over UML:

int load_initrd(char *filename, void *buf, int size)
{
        int fd, n;

        if((fd = os_open_file(filename, of_read(OPENFLAGS()), 0)) < 0){
-               printk("Opening '%s' failed - errno = %d\n", filename, 
errno);
+               printk("Opening '%s' failed - err = %d\n", filename, fd);
                return(-1);
        }
-       if((n = read(fd, buf, size)) != size){
+       if((n = os_read_file(fd, buf, size)) != size){
                printk("Read of %d bytes from '%s' returned %d, errno = 
%d\n",
                       size, filename, n, errno);
                return(-1);
        }
        return(0);
}

i.e. wrap bare file functions into their os_* counterparts, and remove 
unnecessary references to errno?

Also, is there a style reason some functions like the one above return -1 
rather than -errno or the failed (negative) return value from the os_* 
functions?  I'd like to standardize one style or the other while I'm at it, 
if that's workable.

Thanks,

Steve Schmidtke

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-05 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-04  5:11 [uml-devel] cleanup file io Steve Schmidtke
2003-09-05 19:00 ` [uml-devel] " Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox