[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH mini-os enhancements for vtpm 2/8] add posix io to blkfront



> diff --git a/extras/mini-os/include/lib.h b/extras/mini-os/include/lib.h
> --- a/extras/mini-os/include/lib.h
> +++ b/extras/mini-os/include/lib.h
> @@ -174,6 +174,7 @@ extern struct file {
>      } tap;
>      struct {
>          struct blkfront_dev *dev;
> +            off_t offset;

In indentation here and in several other places in this patch is all
over the place. Please try and stick to the prevailing style (tabs vs
spaces, numbers of them, brace placement etc) in the surrounding code.

>      } blk;
>      struct {
>          struct kbdfront_dev *dev;
> diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c
> --- a/extras/mini-os/lib/sys.c
> +++ b/extras/mini-os/lib/sys.c
> @@ -289,6 +289,11 @@ int read(int fd, void *buf, size_t nbytes)
>          return ret * sizeof(union xenfb_in_event);
>          }
>  #endif
> +#ifdef CONFIG_BLKFRONT
> +        case FTYPE_BLK: {
> +        return blkfront_posix_read(fd, buf, nbytes);
> +        }
> +#endif
>      default:
>          break;
>      }
> @@ -321,6 +326,10 @@ int write(int fd, const void *buf, size_t nbytes)
>          netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
>          return nbytes;
>  #endif
> +#ifdef CONFIG_BLKFRONT
> +    case FTYPE_BLK:
> +        return blkfront_posix_write(fd, buf, nbytes);
> +#endif
>      default:
>          break;
>      }
> @@ -331,8 +340,37 @@ int write(int fd, const void *buf, size_t nbytes)
>  
>  off_t lseek(int fd, off_t offset, int whence)
>  {
> -    errno = ESPIPE;
> -    return (off_t) -1;
> +    switch(files[fd].type) {
> +#ifdef CONFIG_BLKFRONT

The whitespace in the rest of this hunk is particularly confused.

> +       case FTYPE_BLK:
> +      switch (whence) {
> +         case SEEK_SET:
> +        files[fd].file.offset = offset;
> +        break;
> +         case SEEK_CUR:
> +        files[fd].file.offset += offset;
> +        break;
> +         case SEEK_END:
> +        {
> +           struct stat st;
> +           int ret;
> +           ret = fstat(fd, &st);
> +           if (ret)
> +              return -1;
> +           files[fd].file.offset = st.st_size + offset;
> +           break;
> +        }
> +         default:
> +        errno = EINVAL;
> +        return -1;
> +      }
> +      return files[fd].file.offset;
> +      break;
> +#endif
> +       default: /* Not implemented on this FTYPE */
> +      errno = ESPIPE;
> +      return (off_t) -1;
> +    }
>  }
>  
>  int fsync(int fd) {
> @@ -445,6 +483,10 @@ int fstat(int fd, struct stat *buf)
>          buf->st_ctime = time(NULL);
>          return 0;
>      }
> +#ifdef CONFIG_BLKFRONT
> +    case FTYPE_BLK:
> +       return blkfront_posix_fstat(fd, buf);
> +#endif
>      default:
>          break;
>      }
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.