All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] 1/3] libxc: prefer using privcmd character device
@ 2015-12-01 19:27 Doug Goldstein
  2015-12-01 19:27 ` [PATCHv3] 2/3] update outdated header comment on privcmd.h Doug Goldstein
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Doug Goldstein @ 2015-12-01 19:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Jackson, Wei Liu, Doug Goldstein, Ian Campbell, Stefano Stabellini

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 <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 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

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

* [PATCHv3] 2/3] update outdated header comment on privcmd.h
  2015-12-01 19:27 [PATCHv3] 1/3] libxc: prefer using privcmd character device Doug Goldstein
@ 2015-12-01 19:27 ` Doug Goldstein
  2015-12-01 19:27 ` [PATCHv3] 3/3] xendomains initscript: test for privcmd char device Doug Goldstein
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Doug Goldstein @ 2015-12-01 19:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Jackson, Wei Liu, Doug Goldstein, Ian Campbell, Stefano Stabellini

The BSDs have always accessed privcmd via /dev/xen/privcmd while Linux
has used /proc/xen/privcmd but things are shifting to /dev/xen/privcmd
as well.

CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/include/xen-sys/FreeBSD/privcmd.h    | 2 +-
 tools/include/xen-sys/Linux/privcmd.h      | 2 +-
 tools/include/xen-sys/NetBSD/privcmd.h     | 2 +-
 tools/include/xen-sys/NetBSDRump/privcmd.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/include/xen-sys/FreeBSD/privcmd.h b/tools/include/xen-sys/FreeBSD/privcmd.h
index 0434d4d..cf1241f 100644
--- a/tools/include/xen-sys/FreeBSD/privcmd.h
+++ b/tools/include/xen-sys/FreeBSD/privcmd.h
@@ -1,7 +1,7 @@
 /******************************************************************************
  * privcmd.h
  *
- * Interface to /proc/xen/privcmd.
+ * Interface to /dev/xen/privcmd.
  *
  * Copyright (c) 2003-2005, K A Fraser
  *
diff --git a/tools/include/xen-sys/Linux/privcmd.h b/tools/include/xen-sys/Linux/privcmd.h
index 5be860a..e4e666a 100644
--- a/tools/include/xen-sys/Linux/privcmd.h
+++ b/tools/include/xen-sys/Linux/privcmd.h
@@ -1,7 +1,7 @@
 /******************************************************************************
  * privcmd.h
  * 
- * Interface to /proc/xen/privcmd.
+ * Interface to /dev/xen/privcmd.
  * 
  * Copyright (c) 2003-2005, K A Fraser
  * 
diff --git a/tools/include/xen-sys/NetBSD/privcmd.h b/tools/include/xen-sys/NetBSD/privcmd.h
index 1296b30..555bad9 100644
--- a/tools/include/xen-sys/NetBSD/privcmd.h
+++ b/tools/include/xen-sys/NetBSD/privcmd.h
@@ -30,7 +30,7 @@
 #ifndef __NetBSD_PRIVCMD_H__
 #define __NetBSD_PRIVCMD_H__
 
-/* Interface to /proc/xen/privcmd */
+/* Interface to /dev/xen/privcmd */
 
 typedef struct privcmd_hypercall
 {
diff --git a/tools/include/xen-sys/NetBSDRump/privcmd.h b/tools/include/xen-sys/NetBSDRump/privcmd.h
index 1296b30..555bad9 100644
--- a/tools/include/xen-sys/NetBSDRump/privcmd.h
+++ b/tools/include/xen-sys/NetBSDRump/privcmd.h
@@ -30,7 +30,7 @@
 #ifndef __NetBSD_PRIVCMD_H__
 #define __NetBSD_PRIVCMD_H__
 
-/* Interface to /proc/xen/privcmd */
+/* Interface to /dev/xen/privcmd */
 
 typedef struct privcmd_hypercall
 {
-- 
2.4.10

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

* [PATCHv3] 3/3] xendomains initscript: test for privcmd char device
  2015-12-01 19:27 [PATCHv3] 1/3] libxc: prefer using privcmd character device Doug Goldstein
  2015-12-01 19:27 ` [PATCHv3] 2/3] update outdated header comment on privcmd.h Doug Goldstein
@ 2015-12-01 19:27 ` Doug Goldstein
  2015-12-02 11:42 ` [PATCHv3] 1/3] libxc: prefer using privcmd character device Wei Liu
  2016-01-27 14:40 ` Doug Goldstein
  3 siblings, 0 replies; 7+ messages in thread
From: Doug Goldstein @ 2015-12-01 19:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Jackson, Wei Liu, Doug Goldstein, Ian Campbell, Stefano Stabellini

Allow the init script to continue if either the character device or the
proc file is available.

CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/hotplug/Linux/xendomains.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/xendomains.in b/tools/hotplug/Linux/xendomains.in
index 0603842..686f061 100644
--- a/tools/hotplug/Linux/xendomains.in
+++ b/tools/hotplug/Linux/xendomains.in
@@ -45,7 +45,7 @@ fi
 
 # Correct exit code would probably be 5, but it's enough
 # if xend complains if we're not running as privileged domain
-if ! [ -e /proc/xen/privcmd ]; then
+if ! [ -e /dev/xen/privcmd ] || [ -e /proc/xen/privcmd ]; then
 	exit 0
 fi
 
-- 
2.4.10

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

* Re: [PATCHv3] 1/3] libxc: prefer using privcmd character device
  2015-12-01 19:27 [PATCHv3] 1/3] libxc: prefer using privcmd character device Doug Goldstein
  2015-12-01 19:27 ` [PATCHv3] 2/3] update outdated header comment on privcmd.h Doug Goldstein
  2015-12-01 19:27 ` [PATCHv3] 3/3] xendomains initscript: test for privcmd char device Doug Goldstein
@ 2015-12-02 11:42 ` Wei Liu
  2015-12-02 15:52   ` Ian Campbell
  2016-01-27 14:40 ` Doug Goldstein
  3 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2015-12-02 11:42 UTC (permalink / raw)
  To: Doug Goldstein
  Cc: Wei Liu, Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel

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 <ian.jackson@eu.citrix.com>
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> CC: Ian Campbell <ian.campbell@citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  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
> 

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

* Re: [PATCHv3] 1/3] libxc: prefer using privcmd character device
  2015-12-02 11:42 ` [PATCHv3] 1/3] libxc: prefer using privcmd character device Wei Liu
@ 2015-12-02 15:52   ` Ian Campbell
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2015-12-02 15:52 UTC (permalink / raw)
  To: Wei Liu, Doug Goldstein; +Cc: Stefano Stabellini, Ian Jackson, xen-devel

On Wed, 2015-12-02 at 11:42 +0000, 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 <ian.jackson@eu.citrix.com>
> > CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > CC: Ian Campbell <ian.campbell@citrix.com>
> > CC: Wei Liu <wei.liu2@citrix.com>
> > Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

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

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

* Re: [PATCHv3] 1/3] libxc: prefer using privcmd character device
  2015-12-01 19:27 [PATCHv3] 1/3] libxc: prefer using privcmd character device Doug Goldstein
                   ` (2 preceding siblings ...)
  2015-12-02 11:42 ` [PATCHv3] 1/3] libxc: prefer using privcmd character device Wei Liu
@ 2016-01-27 14:40 ` Doug Goldstein
  2016-01-27 14:45   ` Processed: " xen
  3 siblings, 1 reply; 7+ messages in thread
From: Doug Goldstein @ 2016-01-27 14:40 UTC (permalink / raw)
  To: xen; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1362 bytes --]

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 <ian.jackson@eu.citrix.com>
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> CC: Ian Campbell <ian.campbell@citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> ---
>  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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

* Processed: Re: [PATCHv3] 1/3] libxc: prefer using privcmd character device
  2016-01-27 14:40 ` Doug Goldstein
@ 2016-01-27 14:45   ` xen
  0 siblings, 0 replies; 7+ messages in thread
From: xen @ 2016-01-27 14:45 UTC (permalink / raw)
  To: Doug Goldstein, xen-devel

Processing commands for xen@bugs.xenproject.org:

> graft 34 ^
Graft `<1448998075-23878-1-git-send-email-cardoe@cardoe.com>' onto #34
> close it
Command failed: No previous bug found at /srv/xen-devel-bugs/lib/emesinae/control.pl line 273, <GEN4> line 2.
Stop processing here.

Modified/created Bugs:
 - 34: http://bugs.xenproject.org/xen/bug/34

---
Xen Hypervisor Bug Tracker
See http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen for information on reporting bugs
Contact xen-bugs-owner@bugs.xenproject.org with any infrastructure issues

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

end of thread, other threads:[~2016-01-27 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 19:27 [PATCHv3] 1/3] libxc: prefer using privcmd character device Doug Goldstein
2015-12-01 19:27 ` [PATCHv3] 2/3] update outdated header comment on privcmd.h Doug Goldstein
2015-12-01 19:27 ` [PATCHv3] 3/3] xendomains initscript: test for privcmd char device Doug Goldstein
2015-12-02 11:42 ` [PATCHv3] 1/3] libxc: prefer using privcmd character device Wei Liu
2015-12-02 15:52   ` Ian Campbell
2016-01-27 14:40 ` Doug Goldstein
2016-01-27 14:45   ` Processed: " xen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.