Port-xen archive

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

Re: port-xen/30027: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN abuses errno



> > But if we fix this we'll have a backward compat issue. I'm not sure how to
> > handle it.
> 
> isn't it enough to renumber the ioctl
> (and keep the old one for compatibility if needed)?

if no one objects, i'll
- change the ioctl as the following diff.
- then request pullup for netbsd-3.
- finally change xentools in pkgsrc.

YAMAMOTO Takashi

Index: arch/xen/include/xenio.h
===================================================================
--- arch/xen/include/xenio.h    (revision 1082)
+++ arch/xen/include/xenio.h    (working copy)
@@ -72,14 +72,11 @@ typedef struct privcmd_blkmsg
 #define IOCTL_PRIVCMD_HYPERCALL         \
     _IOWR('P', 0, privcmd_hypercall_t)
 
-/*
- * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
- * @arg: n/a
- * Return: Port associated with domain-controller end of control event channel
- *         for the initial domain.
- */
-#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
+#if defined(_KERNEL)
+/* compat */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD \
     _IO('P', 1)
+#endif /* defined(_KERNEL) */
     
 #define IOCTL_PRIVCMD_MMAP             \
     _IOW('P', 2, privcmd_mmap_t)
@@ -87,6 +84,15 @@ typedef struct privcmd_blkmsg
     _IOW('P', 3, privcmd_mmapbatch_t)
 #define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \
     _IOW('P', 4, unsigned long)
+
+/*
+ * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
+ * @arg: n/a
+ * Return: Port associated with domain-controller end of control event channel
+ *         for the initial domain.
+ */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
+    _IOR('P', 5, int)
 
 /* Interface to /dev/xenevt */
 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
Index: arch/xen/xen/privcmd.c
===================================================================
--- arch/xen/xen/privcmd.c      (revision 1082)
+++ arch/xen/xen/privcmd.c      (working copy)
@@ -82,11 +82,20 @@ privcmd_ioctl(void *v)
                        : "=a" (error) : "0" (ap->a_data) : "memory" );
                error = -error;
                break;
-       case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN:
+#if 1 /* COMPAT_xxx */
+       case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD:
                {
                extern int initdom_ctrlif_domcontroller_port;
                error = initdom_ctrlif_domcontroller_port;
                }
+               break;
+#endif
+       case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN:
+               {
+               extern int initdom_ctrlif_domcontroller_port;
+               *(int *)ap->a_data = initdom_ctrlif_domcontroller_port;
+               }
+               error = 0;
                break;
        case IOCTL_PRIVCMD_MMAP:
        {



Home | Main Index | Thread Index | Old Index