[Xen-devel] [PATCHv3] 1/3] libxc: prefer using privcmd character device

2015-12-01 Thread Doug Goldstein
Prefer using the character device over the proc file if the character
device exists. This follows similar conversions of xenbus to avoid
issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer.

CC: Ian Jackson 
CC: Stefano Stabellini 
CC: Ian Campbell 
CC: Wei Liu 
Signed-off-by: Doug Goldstein 
---
 tools/libxc/xc_linux_osdep.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
index 76c55ff..c3a3a14 100644
--- a/tools/libxc/xc_linux_osdep.c
+++ b/tools/libxc/xc_linux_osdep.c
@@ -46,7 +46,13 @@
 static xc_osdep_handle linux_privcmd_open(xc_interface *xch)
 {
 int flags, saved_errno;
-int fd = open("/proc/xen/privcmd", O_RDWR);
+int fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer interface 
*/
+
+if ( fd == -1 && ( errno == ENOENT || errno == ENXIO || errno == ENODEV ))
+{
+/* Fallback to /proc/xen/privcmd */
+fd = open("/proc/xen/privcmd", O_RDWR);
+}
 
 if ( fd == -1 )
 {
-- 
2.4.10


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


Re: [Xen-devel] [PATCHv3] 1/3] libxc: prefer using privcmd character device

2016-01-27 Thread Doug Goldstein
graft 34 ^
close it
thanks

On 12/1/15 1:27 PM, Doug Goldstein wrote:
> Prefer using the character device over the proc file if the character
> device exists. This follows similar conversions of xenbus to avoid
> issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer.
> 
> CC: Ian Jackson 
> CC: Stefano Stabellini 
> CC: Ian Campbell 
> CC: Wei Liu 
> Signed-off-by: Doug Goldstein 
> ---
>  tools/libxc/xc_linux_osdep.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
> index 76c55ff..c3a3a14 100644
> --- a/tools/libxc/xc_linux_osdep.c
> +++ b/tools/libxc/xc_linux_osdep.c
> @@ -46,7 +46,13 @@
>  static xc_osdep_handle linux_privcmd_open(xc_interface *xch)
>  {
>  int flags, saved_errno;
> -int fd = open("/proc/xen/privcmd", O_RDWR);
> +int fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer 
> interface */
> +
> +if ( fd == -1 && ( errno == ENOENT || errno == ENXIO || errno == ENODEV 
> ))
> +{
> +/* Fallback to /proc/xen/privcmd */
> +fd = open("/proc/xen/privcmd", O_RDWR);
> +}
>  
>  if ( fd == -1 )
>  {
> 


-- 
Doug Goldstein



signature.asc
Description: OpenPGP digital signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCHv3] 1/3] libxc: prefer using privcmd character device

2015-12-02 Thread Wei Liu
On Tue, Dec 01, 2015 at 01:27:53PM -0600, Doug Goldstein wrote:
> Prefer using the character device over the proc file if the character
> device exists. This follows similar conversions of xenbus to avoid
> issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer.
> 
> CC: Ian Jackson 
> CC: Stefano Stabellini 
> CC: Ian Campbell 
> CC: Wei Liu 
> Signed-off-by: Doug Goldstein 

Acked-by: Wei Liu 

> ---
>  tools/libxc/xc_linux_osdep.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
> index 76c55ff..c3a3a14 100644
> --- a/tools/libxc/xc_linux_osdep.c
> +++ b/tools/libxc/xc_linux_osdep.c
> @@ -46,7 +46,13 @@
>  static xc_osdep_handle linux_privcmd_open(xc_interface *xch)
>  {
>  int flags, saved_errno;
> -int fd = open("/proc/xen/privcmd", O_RDWR);
> +int fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer 
> interface */
> +
> +if ( fd == -1 && ( errno == ENOENT || errno == ENXIO || errno == ENODEV 
> ))
> +{
> +/* Fallback to /proc/xen/privcmd */
> +fd = open("/proc/xen/privcmd", O_RDWR);
> +}
>  
>  if ( fd == -1 )
>  {
> -- 
> 2.4.10
> 

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


Re: [Xen-devel] [PATCHv3] 1/3] libxc: prefer using privcmd character device

2015-12-02 Thread Ian Campbell
On Wed, 2015-12-02 at 11:42 +, Wei Liu wrote:
> On Tue, Dec 01, 2015 at 01:27:53PM -0600, Doug Goldstein wrote:
> > Prefer using the character device over the proc file if the character
> > device exists. This follows similar conversions of xenbus to avoid
> > issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer.
> > 
> > CC: Ian Jackson 
> > CC: Stefano Stabellini 
> > CC: Ian Campbell 
> > CC: Wei Liu 
> > Signed-off-by: Doug Goldstein 
> 
> Acked-by: Wei Liu 

I believe this version also satisfies Ian's comments on v1, so I've applied
all 3 patches.

NB the extra "]" in the subject meant git am produced things like "1/3]
libxc: prefer using privcmd character device". I've fixed that up.

> 
> > ---
> >  tools/libxc/xc_linux_osdep.c | 8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/libxc/xc_linux_osdep.c
> > b/tools/libxc/xc_linux_osdep.c
> > index 76c55ff..c3a3a14 100644
> > --- a/tools/libxc/xc_linux_osdep.c
> > +++ b/tools/libxc/xc_linux_osdep.c
> > @@ -46,7 +46,13 @@
> >  static xc_osdep_handle linux_privcmd_open(xc_interface *xch)
> >  {
> >  int flags, saved_errno;
> > -int fd = open("/proc/xen/privcmd", O_RDWR);
> > +int fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer
> > interface */
> > +
> > +if ( fd == -1 && ( errno == ENOENT || errno == ENXIO || errno ==
> > ENODEV ))
> > +{
> > +/* Fallback to /proc/xen/privcmd */
> > +fd = open("/proc/xen/privcmd", O_RDWR);
> > +}
> >  
> >  if ( fd == -1 )
> >  {

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