Re: [PATCH hurd-dde 1/3] libmachdev: fix getting parameter for get_status

2014-11-16 Thread Samuel Thibault
Justus Winter, le Fri 14 Nov 2014 19:28:06 +0100, a écrit :
> Complements aa949401.
> 
> * libmachdev/net.c (device_get_status): Use count as number of parameter,
> not number of bytes. Take status as integer, not short.

Ack.

> ---
>  libmachdev/net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libmachdev/net.c b/libmachdev/net.c
> index e04b558..53edcd0 100644
> --- a/libmachdev/net.c
> +++ b/libmachdev/net.c
> @@ -513,10 +513,10 @@ device_get_status (void *d, dev_flavor_t flavor, 
> dev_status_t status,
>  
>if (flavor == NET_FLAGS)
>  {
> -  if (*count != sizeof(short))
> +  if (*count != 1)
>   return D_INVALID_SIZE;
>  
> -  *(short *) status = netdev_flags (net->dev);
> +  *(int *) status = netdev_flags (net->dev);
>return D_SUCCESS;
>  }
>  
> -- 
> 2.1.1
> 

-- 
Samuel
  sl  -  display animations aimed to correct users who accidentally enter
sl instead of ls.



Re: [PATCH hurd-dde 2/3] eth-multiplexer: fix device_{get,set}_status calls

2014-11-16 Thread Samuel Thibault
Justus Winter, le Fri 14 Nov 2014 19:28:07 +0100, a écrit :
> * eth-multiplexer/ethernet.c (set_promisc): Make flags an int, count
> must be 1.

Ack.

> ---
>  eth-multiplexer/ethernet.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/eth-multiplexer/ethernet.c b/eth-multiplexer/ethernet.c
> index 32c5589..886f5df 100644
> --- a/eth-multiplexer/ethernet.c
> +++ b/eth-multiplexer/ethernet.c
> @@ -76,12 +76,12 @@ int set_promisc (char *dev_name, mach_port_t ether_port, 
> int is_promisc)
>  #ifndef NET_FLAGS
>  #define NET_FLAGS (('n'<<16) + 4)
>  #endif
> -  short flags;
> +  int flags;
>int ret;
>size_t count;
>  
>debug ("set_promisc is called, is_promisc: %d\n", is_promisc);
> -  count = sizeof (flags);
> +  count = 1;
>ret = device_get_status (ether_port, NET_FLAGS, (dev_status_t) &flags, 
> &count);
>if (ret) 
> @@ -93,8 +93,7 @@ int set_promisc (char *dev_name, mach_port_t ether_port, 
> int is_promisc)
>  flags |= IFF_PROMISC;
>else
>  flags &= ~IFF_PROMISC;
> -  ret = device_set_status(ether_port, NET_FLAGS, (dev_status_t) &flags,
> -  sizeof (flags));
> +  ret = device_set_status(ether_port, NET_FLAGS, (dev_status_t) &flags, 1);
>if (ret) 
>  {
>error (0, ret, "device_set_status");
> -- 
> 2.1.1
> 

-- 
Samuel
if (argc > 1 && strcmp(argv[1], "-advice") == 0) {
printf("Don't Panic!\n");
exit(42);
}
-- Arnold Robbins in the LJ of February '95, describing RCS



Re: [PATCH hurd-dde 3/3] eth-multiplexer: improve the netfs_demuxer function

2014-11-16 Thread Samuel Thibault
Justus Winter, le Fri 14 Nov 2014 19:28:08 +0100, a écrit :
> Handle multiple request types as recommended by the Mach Server
> Writer's Guide section 4, subsection "Handling Multiple Request
> Types".  This avoids initializing the reply message in every X_server
> function.  The reply message has already been properly initialized in
> libports, so there is no need to call mig_reply_setup.

Ack.

> * eth-multiplexer/demuxer.c (netfs_demuxer): Improve the demuxer
> function.
> ---
>  eth-multiplexer/demuxer.c | 37 +++--
>  1 file changed, 23 insertions(+), 14 deletions(-)
> 
> diff --git a/eth-multiplexer/demuxer.c b/eth-multiplexer/demuxer.c
> index 1f671b2..68bf968 100644
> --- a/eth-multiplexer/demuxer.c
> +++ b/eth-multiplexer/demuxer.c
> @@ -1,5 +1,5 @@
>  /* 
> -   Copyright (C) 1996 Free Software Foundation, Inc.
> +   Copyright (C) 1996, 2013 Free Software Foundation, Inc.
> Written by Michael I. Bushnell, p/BSG.
>  
> This file is part of the GNU Hurd.
> @@ -20,22 +20,31 @@
>  
>  #include 
>  
> +#include "libnetfs/io_S.h"
> +#include "libnetfs/fs_S.h"
> +#include "libports/notify_S.h"
> +#include "libnetfs/fsys_S.h"
> +#include "libports/interrupt_S.h"
> +#include "libnetfs/ifsock_S.h"
> +#include "device_S.h"
> +
>  int
>  netfs_demuxer (mach_msg_header_t *inp,
>  mach_msg_header_t *outp)
>  {
> -  int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
> -  int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
> -  int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
> -  int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
> -  int device_server (mach_msg_header_t *, mach_msg_header_t *);
> -
> -  return (netfs_io_server (inp, outp)
> -  || netfs_fs_server (inp, outp)
> -  || ports_notify_server (inp, outp)
> -  || netfs_fsys_server (inp, outp)
> -  || ports_interrupt_server (inp, outp)
> -  || netfs_ifsock_server (inp, outp)
> -   || device_server (inp, outp));
> +  mig_routine_t routine;
> +  if ((routine = netfs_io_server_routine (inp)) ||
> +  (routine = netfs_fs_server_routine (inp)) ||
> +  (routine = ports_notify_server_routine (inp)) ||
> +  (routine = netfs_fsys_server_routine (inp)) ||
> +  (routine = ports_interrupt_server_routine (inp)) ||
> +  (routine = netfs_ifsock_server_routine (inp)) ||
> +  (routine = device_server_routine (inp)))
> +{
> +  (*routine) (inp, outp);
> +  return TRUE;
> +}
> +  else
> +return FALSE;
>  }
>  
> -- 
> 2.1.1
> 

-- 
Samuel
How do I type "for i in *.dvi do xdvi i done" in a GUI?
(Discussion in comp.os.linux.misc on the intuitiveness of interfaces.)