<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 17, 2018 at 9:37 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">> <br>
> Contains definitions for system-dependent operations<br>
> related to local cd devices and files<br>
> <br>
> Signed-off-by: Yuri Benditovich <<a href="mailto:yuri.benditovich@daynix.com">yuri.benditovich@daynix.com</a>><br>
> ---<br>
>  src/cd-device.h | 40 ++++++++++++++++++++++++++++++<wbr>++++++++++<br>
>  1 file changed, 40 insertions(+)<br>
>  create mode 100644 src/cd-device.h<br>
> <br>
> diff --git a/src/cd-device.h b/src/cd-device.h<br>
> new file mode 100644<br>
> index 0000000..050c7a1<br>
> --- /dev/null<br>
> +++ b/src/cd-device.h<br>
> @@ -0,0 +1,40 @@<br>
> +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */<br>
> +/*<br>
> +Copyright (C) 2018 Red Hat, Inc.<br>
> +<br>
> +Red Hat Authors:<br>
> +Yuri Benditovich<<a href="mailto:ybendito@redhat.com">ybendito@redhat.<wbr>com</a>><br>
> +<br>
> +This library is free software; you can redistribute it and/or<br>
> +modify it under the terms of the GNU Lesser General Public<br>
> +License as published by the Free Software Foundation; either<br>
> +version 2.1 of the License, or (at your option) any later version.<br>
> +<br>
> +This library is distributed in the hope that it will be useful,<br>
> +but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
> +Lesser General Public License for more details.<br>
> +<br>
> +You should have received a copy of the GNU Lesser General Public<br>
> +License along with this library; if not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>><wbr>.<br>
> +*/<br>
> +<br>
> +#ifndef __CD_DEVICE_H__<br>
> +#define __CD_DEVICE_H__<br>
> +<br>
> +typedef struct _SpiceCdLU<br>
> +{<br>
> +    char *filename;<br>
> +    GFile *file_object;<br>
> +    GFileInputStream *stream;<br>
> +    uint64_t size;<br>
> +    uint32_t blockSize;<br>
> +    uint32_t loaded : 1;<br>
> +    uint32_t device : 1;<br>
> +} SpiceCdLU;<br>
<br>
</div></div>Why not SpiceCdDevice? In neither APIs, title or commit message there's<br>
no explanation for the "LU", Logical Unit?<br></blockquote><div><br></div><div>This is logical unit, when CD device contains one or more units</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In C99 identifiers starting with double underscore or underscore and<br>
capital letter are reserved, do you need C89 compatibility?<br></blockquote><div><br></div><div>To be fixed on next round</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> +<br>
> +int cd_device_open_stream(<wbr>SpiceCdLU *unit, const char *filename);<br>
> +int cd_device_load(SpiceCdLU *unit, gboolean load);<br>
> +int cd_device_check(SpiceCdLU *unit);<br>
<br>
</span>Maybe some small comment. What the functions return? <0 error, >=0 success?<br></blockquote><div><br></div><div>Yes, as usually should be.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
"check" I assume is checking disk presence.<br>
Why you have an open but not a close? Is it implicit?<br></blockquote><div><br></div><div>close does not require any platform-dependent operations and is on common part</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How to initialize SpiceCdLU? memset to 0?<br></blockquote><div><br></div><div>Initialized outside, according to parameters, defaults to zero. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +<br>
> +#endif<br>
<span class="HOEnZb"><font color="#888888"><br>
Frediano<br>
</font></span></blockquote></div><br></div></div>