[PATCH 4/4] remove register qualifiers

2013-11-10 Thread Marin Ramesa
* device/subrs.c: Remove register qualifiers.

---
 device/subrs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/device/subrs.c b/device/subrs.c
index a82bae3..e094f68 100644
--- a/device/subrs.c
+++ b/device/subrs.c
@@ -61,11 +61,11 @@ u_char  etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff };
  */
 char *
 ether_sprintf(ap)
-   register u_char *ap;
+   u_char *ap;
 {
-   register int i;
+   int i;
static char etherbuf[18];
-   register char *cp = etherbuf;
+   char *cp = etherbuf;
static char digits[] = "0123456789abcdef";
 
for (i = 0; i < 6; i++) {
@@ -81,7 +81,7 @@ ether_sprintf(ap)
  * Initialize send and receive queues on an interface.
  */
 void if_init_queues(ifp)
-   register struct ifnet *ifp;
+   struct ifnet *ifp;
 {
IFQ_INIT(&ifp->if_snd);
queue_init(&ifp->if_rcv_port_list);
@@ -112,7 +112,7 @@ struct buf *
 geteblk(size)
int size;
 {
-   register io_req_t   ior;
+   io_req_tior;
 
io_req_alloc(ior, 0);
ior->io_device = (mach_device_t)0;
@@ -136,7 +136,7 @@ geteblk(size)
 void brelse(bp)
struct buf *bp;
 {
-   register io_req_t   ior = bp;
+   io_req_tior = bp;
 
(void) vm_deallocate(kernel_map,
(vm_offset_t) ior->io_data,
-- 
1.8.1.4




[PATCH 2/4] remove definitions of ETHERMTU and ETHERMIN

2013-11-10 Thread Marin Ramesa
* device/if_ether.h (ETHERMTU, ETHERMIN): Remove unused definitions.

---
 device/if_ether.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/device/if_ether.h b/device/if_ether.h
index 2ac938e..dbdd818 100644
--- a/device/if_ether.h
+++ b/device/if_ether.h
@@ -45,9 +45,6 @@ structether_header {
u_short ether_type;
 };
 
-#defineETHERMTU1500
-#defineETHERMIN(60-14)
-
 #ifdef KERNEL
 u_char etherbroadcastaddr[6];
 
-- 
1.8.1.4




[PATCH 1/4] remove register qualifiers

2013-11-10 Thread Marin Ramesa
* device/blkio.c: Remove register qualifiers.

---
 device/blkio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/device/blkio.c b/device/blkio.c
index 27fec0e..939067d 100644
--- a/device/blkio.c
+++ b/device/blkio.c
@@ -41,9 +41,9 @@
 io_return_t block_io(strat, max_count, ior)
void(*strat)();
void(*max_count)();
-   register io_req_t   ior;
+   io_req_tior;
 {
-   register kern_return_t  rc;
+   kern_return_t   rc;
boolean_t   wait = FALSE;
 
/*
@@ -89,7 +89,7 @@ io_return_t block_io(strat, max_count, ior)
 #define MAX_PHYS(256 * 1024)
 
 void minphys(ior)
-   register io_req_t   ior;
+   io_req_tior;
 {
if ((ior->io_op & (IO_WRITE | IO_READ | IO_OPEN)) == IO_WRITE)
return;
-- 
1.8.1.4




[PATCH 3/4] remove register qualifiers

2013-11-10 Thread Marin Ramesa
* device/net_io.c: Remove register qualifiers.

---
 device/net_io.c | 102 
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/device/net_io.c b/device/net_io.c
index fd71c02..1958840 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -144,7 +144,7 @@ vm_size_t   net_kmsg_size;  /* initialized 
below */
 ipc_kmsg_t
 net_kmsg_get(void)
 {
-   register ipc_kmsg_t kmsg;
+   ipc_kmsg_t kmsg;
spl_t s;
 
/*
@@ -196,7 +196,7 @@ net_kmsg_get(void)
 }
 
 void
-net_kmsg_put(register ipc_kmsg_t kmsg)
+net_kmsg_put(ipc_kmsg_t kmsg)
 {
spl_t s;
 
@@ -212,7 +212,7 @@ net_kmsg_put(register ipc_kmsg_t kmsg)
 void
 net_kmsg_collect(void)
 {
-   register ipc_kmsg_t kmsg;
+   ipc_kmsg_t kmsg;
spl_t s;
 
s = splimp();
@@ -238,7 +238,7 @@ net_kmsg_collect(void)
 void
 net_kmsg_more(void)
 {
-   register ipc_kmsg_t kmsg;
+   ipc_kmsg_t kmsg;
 
/*
 * Replenish net kmsg pool if low.  We don't have the locks
@@ -387,7 +387,7 @@ int bpf_validate(
 int bpf_eq (
 bpf_insn_t f1,
bpf_insn_t f2,
-register int bytes);
+int bytes);
 
 int net_add_q_info (ipc_port_t rcv_port);
 
@@ -413,7 +413,7 @@ int bpf_match (
 boolean_t ethernet_priority(kmsg)
ipc_kmsg_t kmsg;
 {
-   register unsigned char *addr =
+   unsigned char *addr =
(unsigned char *) net_kmsg(kmsg)->header;
 
/*
@@ -457,7 +457,7 @@ mach_msg_type_t packet_type = {
 boolean_t net_deliver(nonblocking)
boolean_t nonblocking;
 {
-   register ipc_kmsg_t kmsg;
+   ipc_kmsg_t kmsg;
boolean_t high_priority;
struct ipc_kmsg_queue send_list;
 
@@ -646,9 +646,9 @@ void net_thread()
 
 void
 reorder_queue(first, last)
-   register queue_tfirst, last;
+   queue_t first, last;
 {
-   register queue_entry_t  prev, next;
+   queue_entry_t   prev, next;
 
prev = first->prev;
next = last->next;
@@ -669,8 +669,8 @@ reorder_queue(first, last)
  */
 void
 net_packet(ifp, kmsg, count, priority)
-   register struct ifnet   *ifp;
-   register ipc_kmsg_t kmsg;
+   struct ifnet*ifp;
+   ipc_kmsg_t  kmsg;
unsigned intcount;
boolean_t   priority;
 {
@@ -732,12 +732,12 @@ int net_filter_queue_reorder = 0; /* non-zero to enable 
reordering */
  */
 void
 net_filter(kmsg, send_list)
-   register ipc_kmsg_t kmsg;
+   ipc_kmsg_t  kmsg;
ipc_kmsg_queue_tsend_list;
 {
-   register struct ifnet   *ifp;
-   register net_rcv_port_t infp, nextfp;
-   register ipc_kmsg_t new_kmsg;
+   struct ifnet*ifp;
+   net_rcv_port_t  infp, nextfp;
+   ipc_kmsg_t  new_kmsg;
 
net_hash_entry_tentp, *hash_headp;
ipc_port_t  dest;
@@ -857,7 +857,7 @@ net_filter(kmsg, send_list)
ipc_kmsg_enqueue(send_list, new_kmsg);
 
{
-   register net_rcv_port_t prevfp;
+   net_rcv_port_t prevfp;
int rcount = ++infp->rcv_count;
 
/*
@@ -919,9 +919,9 @@ net_do_filter(infp, data, data_count, header)
char *  header;
 {
int stack[NET_FILTER_STACK_DEPTH+1];
-   register int*sp;
-   register filter_t   *fp, *fpe;
-   register unsigned int   op, arg;
+   int *sp;
+   filter_t*fp, *fpe;
+   unsigned intop, arg;
 
/*
 * The filter accesses the header and data
@@ -1053,12 +1053,12 @@ net_do_filter(infp, data, data_count, header)
  */
 boolean_t
 parse_net_filter(filter, count)
-   register filter_t   *filter;
+   filter_t*filter;
unsigned intcount;
 {
-   register intsp;
-   register filter_t   *fpe = &filter[count];
-   register filter_t   op, arg;
+   int sp;
+   filter_t*fpe = &filter[count];
+   filter_top, arg;
 
/*
 * count is at least 1, and filter[0] is used for flags.
@@ -1155,10 +1155,10 @@ net_set_filter(ifp, rcv_port, priority, filter, 
filter_count)
 {
 intfilter_bytes;
 bpf_insn_t match;
-register net_rcv_port_tinfp, my_infp;
+net_rcv_port_t infp, my_infp;
 net_rcv_port_t nextfp;
 net_hash_header_t  hhp;
-register net_hash_entry_t  entp, hash_entp;
+net_hash_entry_t   entp, hash_entp;
 net_hash_entry_t   *head, nextentp;
 queue_entry_t  dead_infp, dead_entp;
 inti;
@@ -1413,7 +1413,7 @@ net_getstat(ifp, flavor, status, count)
switch (flavor) {
case NET_STATUS:
{
-  

Re: [PATCH 1/4] remove register qualifiers

2013-11-10 Thread Samuel Thibault
Applied, thanks!

Samuel



Re: [PATCH] libports: fix the thread counts in case the thread creation fails

2013-11-10 Thread Neal H. Walfield
At Sat, 9 Nov 2013 18:21:51 +0100,
Samuel Thibault wrote:
> > + pthread_spin_lock (&lock);
> > + totalthreads--;
> > + nreqthreads--;
> > + pthread_spin_unlock (&lock);

It might be a good idea use atomic operations instead of the spin lock
(which is what the spin lock is using behind the scenes anyways).

Neal



Re: [PATCH] libports: fix the thread counts in case the thread creation fails

2013-11-10 Thread Samuel Thibault
Neal H. Walfield, le Sun 10 Nov 2013 11:38:04 +0100, a écrit :
> At Sat, 9 Nov 2013 18:21:51 +0100,
> Samuel Thibault wrote:
> > > +   pthread_spin_lock (&lock);
> > > +   totalthreads--;
> > > +   nreqthreads--;
> > > +   pthread_spin_unlock (&lock);
> 
> It might be a good idea use atomic operations instead of the spin lock
> (which is what the spin lock is using behind the scenes anyways).

It may not be possible: further down there is a decision taken depending
on totalthreads/nreqthreads becoming 1, and thus you need a spinlock to
make that coherent with the ++/--.

Samuel



Re: [PATCH] libports: fix the thread counts in case the thread creation fails

2013-11-10 Thread Neal H. Walfield
At Sun, 10 Nov 2013 11:54:20 +0100,
Samuel Thibault wrote:
> 
> Neal H. Walfield, le Sun 10 Nov 2013 11:38:04 +0100, a écrit :
> > At Sat, 9 Nov 2013 18:21:51 +0100,
> > Samuel Thibault wrote:
> > > > + pthread_spin_lock (&lock);
> > > > + totalthreads--;
> > > > + nreqthreads--;
> > > > + pthread_spin_unlock (&lock);
> > 
> > It might be a good idea use atomic operations instead of the spin lock
> > (which is what the spin lock is using behind the scenes anyways).
> 
> It may not be possible: further down there is a decision taken depending
> on totalthreads/nreqthreads becoming 1, and thus you need a spinlock to
> make that coherent with the ++/--.

Too bad.  Perhaps combining the quantities into a single word as
follows would work:

  atomic.add(threads, 1<<16 | 1)

This has the further advantage of reducing the number of atomic
operations.

Neal



[PATCH 1/2] device: initialize to zero offset

2013-11-10 Thread Marin Ramesa
Initialize addr to zero offset to quiet warnings about uninitialized
deallocation.

* device/chario.c (addr): Initialize to zero.

---
 device/chario.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/device/chario.c b/device/chario.c
index c40705e..19f3bae 100644
--- a/device/chario.c
+++ b/device/chario.c
@@ -260,7 +260,7 @@ io_return_t char_write(
spl_t   s;
int count;
char*data;
-   vm_offset_t addr;
+   vm_offset_t addr = 0;
io_return_t rc = D_SUCCESS;
 
data  = ior->io_data;
-- 
1.8.1.4




[PATCH 2/2] avoid dereference of null pointer

2013-11-10 Thread Marin Ramesa
Check to see if pte is a null pointer and perform dereference only
if that is not the case.

* i386/intel/pmap.c (pte): Check if it is a null pointer.

---
 i386/intel/pmap.c | 5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index c1eca6e..283992e 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -1567,8 +1567,9 @@ void pmap_page_protect(phys, prot)
/*
 * Remove the mapping, collecting any modify bits.
 */
-   if (*pte & INTEL_PTE_WIRED)
-   panic("pmap_remove_all removing a wired page");
+   if (pte != NULL)
+   if (*pte & INTEL_PTE_WIRED)
+   panic("pmap_remove_all removing a wired 
page");
 
{
register inti = ptes_per_vm_page;
-- 
1.8.1.4




Re: [PATCH 1/2] device: initialize to zero offset

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 16:46:29 +0100, a écrit :
> Initialize addr to zero offset to quiet warnings about uninitialized
> deallocation.
> 
> * device/chario.c (addr): Initialize to zero.

Applied, thanks.

> ---
>  device/chario.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/device/chario.c b/device/chario.c
> index c40705e..19f3bae 100644
> --- a/device/chario.c
> +++ b/device/chario.c
> @@ -260,7 +260,7 @@ io_return_t char_write(
>   spl_t   s;
>   int count;
>   char*data;
> - vm_offset_t addr;
> + vm_offset_t addr = 0;
>   io_return_t rc = D_SUCCESS;
>  
>   data  = ior->io_data;
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
/* Amuse the user in a SPARC fashion */
if (err) printk(
KERN_CRIT "  ___ \n"
KERN_CRIT " < Your System ate a SPARC! Gah! >\n"
KERN_CRIT "  --- \n"
KERN_CRIT " \\   ^__^\n"
KERN_CRIT "  \\  (xx)\\___\n"
KERN_CRIT " (__)\\   )\\/\\\n"
KERN_CRIT "  U  ||w |\n"
KERN_CRIT " || ||\n");
(From linux/arch/parisc/kernel/traps.c:die_if_kernel())



Re: [PATCH 2/2] avoid dereference of null pointer

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 16:46:30 +0100, a écrit :
> Check to see if pte is a null pointer and perform dereference only
> if that is not the case.
> 
> * i386/intel/pmap.c (pte): Check if it is a null pointer.

Well, it can never be null, since earlier in the code we see the pv_h
pointing to a map which has the physical page mapped somewhere.

> ---
>  i386/intel/pmap.c | 5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
> index c1eca6e..283992e 100644
> --- a/i386/intel/pmap.c
> +++ b/i386/intel/pmap.c
> @@ -1567,8 +1567,9 @@ void pmap_page_protect(phys, prot)
>   /*
>* Remove the mapping, collecting any modify bits.
>*/
> - if (*pte & INTEL_PTE_WIRED)
> - panic("pmap_remove_all removing a wired page");
> + if (pte != NULL)
> + if (*pte & INTEL_PTE_WIRED)
> + panic("pmap_remove_all removing a wired 
> page");
>  
>   {
>   register inti = ptes_per_vm_page;
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
 M.  MIMRAM  Samuel Antonin
 en voila un qui etait predestiné
 -+- #ens-mim - Quelles gueules qu'ils ont les ptits nouveaux ? -+-



Re: [PATCH 2/2] avoid dereference of null pointer

2013-11-10 Thread Marin Ramesa
On 10.11.2013 16:53:39, Samuel Thibault wrote:
> Marin Ramesa, le Sun 10 Nov 2013 16:46:30 +0100, a écrit :
> > Check to see if pte is a null pointer and perform dereference only
> > if that is not the case.
> > 
> > * i386/intel/pmap.c (pte): Check if it is a null pointer.
> 
> Well, it can never be null, since earlier in the code we see the pv_h
> pointing to a map which has the physical page mapped somewhere.

OK, thanks. I assumed pmap_pte() returns NULL since clang reports say 
pte is a null pointer.



Re: [PATCH 2/2] avoid dereference of null pointer

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 18:16:20 +0100, a écrit :
> On 10.11.2013 16:53:39, Samuel Thibault wrote:
> > Marin Ramesa, le Sun 10 Nov 2013 16:46:30 +0100, a écrit :
> > > Check to see if pte is a null pointer and perform dereference only
> > > if that is not the case.
> > > 
> > > * i386/intel/pmap.c (pte): Check if it is a null pointer.
> > 
> > Well, it can never be null, since earlier in the code we see the pv_h
> > pointing to a map which has the physical page mapped somewhere.
> 
> OK, thanks. I assumed pmap_pte() returns NULL since clang reports say 
> pte is a null pointer.

Yes, it may return NULL when there is nothing at that virtual address,
but the va precisely comes from a mapped area, so we're sure there's
something there.

Samuel



Small cleanup of gnumach's assignments

2013-11-10 Thread Marin Ramesa
What follows is a small cleanup of gnumach's assignments. Patches
are based on clang's "dead assignment" reports.

[PATCH 1/5] kern: comment unused variable
[PATCH 2/5] kern (rbtree_insert_rebalance): rewrite node swap
[PATCH 3/5] kern: eliminate unused assignment
[PATCH 4/5] vm: remove duplicate assignment
[PATCH 5/5] vm: remove unused assignment



[PATCH 2/5] kern (rbtree_insert_rebalance): rewrite node swap

2013-11-10 Thread Marin Ramesa
Value of node is never read. Simplify the node swap to one assignment
and remove the temporary variable.

* kern/rbtree.c (rbtree_insert_rebalance): Simplify node swap.

---
 kern/rbtree.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kern/rbtree.c b/kern/rbtree.c
index 0f5eb9a..d90a8bc 100644
--- a/kern/rbtree.c
+++ b/kern/rbtree.c
@@ -147,7 +147,7 @@ static void rbtree_rotate(struct rbtree *tree, struct 
rbtree_node *node,
 void rbtree_insert_rebalance(struct rbtree *tree, struct rbtree_node *parent,
  int index, struct rbtree_node *node)
 {
-struct rbtree_node *grand_parent, *uncle, *tmp;
+struct rbtree_node *grand_parent, *uncle;
 int left, right;
 
 assert(rbtree_check_alignment(parent));
@@ -196,9 +196,7 @@ void rbtree_insert_rebalance(struct rbtree *tree, struct 
rbtree_node *parent,
  */
 if (parent->children[right] == node) {
 rbtree_rotate(tree, parent, left);
-tmp = node;
-node = parent;
-parent = tmp;
+parent = node;
 }
 
 /*
-- 
1.8.1.4




[PATCH 1/5] kern: comment unused variable

2013-11-10 Thread Marin Ramesa
Variable reply_port is never used. There is indication in the comments
that it might be used in future function call, so comment it.

* kern/ipc_mig.c (syscall_device_writev_request): Comment variable.

---
 kern/ipc_mig.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index e1532ac..2d93eaa 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -979,7 +979,7 @@ syscall_device_writev_request(mach_port_t   device_name,
  vm_size_t iocount)
 {
device_tdev;
-   ipc_port_t  reply_port;
+   /*ipc_port_treply_port;*/
io_return_t res;
 
/*
@@ -1000,9 +1000,10 @@ syscall_device_writev_request(mach_port_t
device_name,
/*
 * Translate reply port.
 */
-   if (reply_name == MACH_PORT_NULL)
+   /*if (reply_name == MACH_PORT_NULL)
reply_port = IP_NULL;
-   else {
+   */
+   if (reply_name != MACH_PORT_NULL) {
/* Homey don't play that. */
device_deallocate(dev);
return KERN_INVALID_RIGHT;
-- 
1.8.1.4




[PATCH 4/5] vm: remove duplicate assignment

2013-11-10 Thread Marin Ramesa
* vm/vm_fault.c: Remove duplicate assignment.

---
 vm/vm_fault.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index 7e84961..aacf3cb 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -726,7 +726,6 @@ vm_fault_return_t vm_fault_page(first_object, first_offset,
vm_object_unlock(object);
 
object = first_object;
-   offset = first_offset;
vm_object_lock(object);
}
 
-- 
1.8.1.4




[PATCH 3/5] kern: eliminate unused assignment

2013-11-10 Thread Marin Ramesa
Value of result is never read. Eliminate the unused assignment.

* kern/elf-load.c: Eliminate unused assignment.

---
 kern/elf-load.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kern/elf-load.c b/kern/elf-load.c
index 1d103d3..c1f4bed 100644
--- a/kern/elf-load.c
+++ b/kern/elf-load.c
@@ -77,9 +77,9 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t 
*read_exec,
if (ph->p_flags & PF_R) type |= EXEC_SECTYPE_READ;
if (ph->p_flags & PF_W) type |= EXEC_SECTYPE_WRITE;
if (ph->p_flags & PF_X) type |= EXEC_SECTYPE_EXECUTE;
-   result = (*read_exec)(handle,
- ph->p_offset, ph->p_filesz,
- ph->p_vaddr, ph->p_memsz, type);
+   (*read_exec)(handle,
+   ph->p_offset, ph->p_filesz,
+   ph->p_vaddr, ph->p_memsz, type);
}
}
 
-- 
1.8.1.4




[PATCH 5/5] vm: remove unused assignment

2013-11-10 Thread Marin Ramesa
Value of src_size is never read. Remove unused assignment.

* vm/vm_map.c: Remove unused assignment.

---
 vm/vm_map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vm/vm_map.c b/vm/vm_map.c
index 2be7147..9d5b01c 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -3401,7 +3401,7 @@ kern_return_t vm_map_copyin(src_map, src_addr, len, 
src_destroy, copy_result)
goto VerificationFailed;
 
if (src_entry->vme_end < new_entry->vme_end)
-   src_size = (new_entry->vme_end = src_entry->vme_end) - 
src_start;
+   new_entry->vme_end = src_entry->vme_end;
 
if ((src_entry->object.vm_object != src_object) ||
(src_entry->offset != src_offset) ) {
-- 
1.8.1.4




Re: [PATCH 2/5] kern (rbtree_insert_rebalance): rewrite node swap

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 22:50:21 +0100, a écrit :
> Value of node is never read. Simplify the node swap to one assignment
> and remove the temporary variable.
> 
> * kern/rbtree.c (rbtree_insert_rebalance): Simplify node swap.

I'd rather keep it as such, as an expression of the rbtree rotation.

> ---
>  kern/rbtree.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/kern/rbtree.c b/kern/rbtree.c
> index 0f5eb9a..d90a8bc 100644
> --- a/kern/rbtree.c
> +++ b/kern/rbtree.c
> @@ -147,7 +147,7 @@ static void rbtree_rotate(struct rbtree *tree, struct 
> rbtree_node *node,
>  void rbtree_insert_rebalance(struct rbtree *tree, struct rbtree_node *parent,
>   int index, struct rbtree_node *node)
>  {
> -struct rbtree_node *grand_parent, *uncle, *tmp;
> +struct rbtree_node *grand_parent, *uncle;
>  int left, right;
>  
>  assert(rbtree_check_alignment(parent));
> @@ -196,9 +196,7 @@ void rbtree_insert_rebalance(struct rbtree *tree, struct 
> rbtree_node *parent,
>   */
>  if (parent->children[right] == node) {
>  rbtree_rotate(tree, parent, left);
> -tmp = node;
> -node = parent;
> -parent = tmp;
> +parent = node;
>  }
>  
>  /*
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
 un driver qui fait quoi, alors ?
 ben pour les bips
 pour passer les oops en morse
 -+- #ens-mim - vive les rapports de bug -+-



Re: [PATCH 3/5] kern: eliminate unused assignment

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 22:50:22 +0100, a écrit :
> Value of result is never read. Eliminate the unused assignment.
> 
> * kern/elf-load.c: Eliminate unused assignment.

Justus has an ACKed better patch which propagates the result, but I
don't see it applied on the tree, Justus?

> ---
>  kern/elf-load.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kern/elf-load.c b/kern/elf-load.c
> index 1d103d3..c1f4bed 100644
> --- a/kern/elf-load.c
> +++ b/kern/elf-load.c
> @@ -77,9 +77,9 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t 
> *read_exec,
>   if (ph->p_flags & PF_R) type |= EXEC_SECTYPE_READ;
>   if (ph->p_flags & PF_W) type |= EXEC_SECTYPE_WRITE;
>   if (ph->p_flags & PF_X) type |= EXEC_SECTYPE_EXECUTE;
> - result = (*read_exec)(handle,
> -   ph->p_offset, ph->p_filesz,
> -   ph->p_vaddr, ph->p_memsz, type);
> + (*read_exec)(handle,
> + ph->p_offset, ph->p_filesz,
> + ph->p_vaddr, ph->p_memsz, type);
>   }
>   }
>  
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
I develop for Linux for a living, I used to develop for DOS.
Going from DOS to Linux is like trading a glider for an F117.
(By entr...@world.std.com, Lawrence Foard)



Re: [PATCH 4/5] vm: remove duplicate assignment

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 22:50:23 +0100, a écrit :
> * vm/vm_fault.c: Remove duplicate assignment.

I'd rather keep it, the assignment makes sense, even if not used. It
might be used someday.

> ---
>  vm/vm_fault.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/vm/vm_fault.c b/vm/vm_fault.c
> index 7e84961..aacf3cb 100644
> --- a/vm/vm_fault.c
> +++ b/vm/vm_fault.c
> @@ -726,7 +726,6 @@ vm_fault_return_t vm_fault_page(first_object, 
> first_offset,
>   vm_object_unlock(object);
>  
>   object = first_object;
> - offset = first_offset;
>   vm_object_lock(object);
>   }
>  
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
 le y est un animal discret se logeant facilement dans un terminal
*** c has changed the topic on channel #ens-mim to ne pas jeter de cacahuetes 
aux ys, svp
 -+- #ens-mim - n'oubliez pas le guide -+-



Re: [PATCH 5/5] vm: remove unused assignment

2013-11-10 Thread Samuel Thibault
Marin Ramesa, le Sun 10 Nov 2013 22:50:24 +0100, a écrit :
> Value of src_size is never read. Remove unused assignment.

Same here, I'd rather keep it.

> * vm/vm_map.c: Remove unused assignment.
> 
> ---
>  vm/vm_map.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/vm/vm_map.c b/vm/vm_map.c
> index 2be7147..9d5b01c 100644
> --- a/vm/vm_map.c
> +++ b/vm/vm_map.c
> @@ -3401,7 +3401,7 @@ kern_return_t vm_map_copyin(src_map, src_addr, len, 
> src_destroy, copy_result)
>   goto VerificationFailed;
>  
>   if (src_entry->vme_end < new_entry->vme_end)
> - src_size = (new_entry->vme_end = src_entry->vme_end) - 
> src_start;
> + new_entry->vme_end = src_entry->vme_end;
>  
>   if ((src_entry->object.vm_object != src_object) ||
>   (src_entry->offset != src_offset) ) {
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
 bash: ls: Computer bought the farm
 THAT frightens ppl! :P
 id rather see: "bash: ls: Initialization of googol(AWAX)
disengaged in HYPER32/64 mode due to faulty page request at
AX:12A34F84B"
 at least that would give me the feeling that the
*programmers* knows what is going on :P
(lovely Hurd...)



Re: [PATCH 3/5] kern: eliminate unused assignment

2013-11-10 Thread Justus Winter
Quoting Samuel Thibault (2013-11-10 23:04:28)
> Marin Ramesa, le Sun 10 Nov 2013 22:50:22 +0100, a écrit :
> > Value of result is never read. Eliminate the unused assignment.
> > 
> > * kern/elf-load.c: Eliminate unused assignment.
> 
> Justus has an ACKed better patch which propagates the result, but I
> don't see it applied on the tree, Justus?

Right, will merge that next thing tomorrow morning.

Justus



Re: [PATCH 3/5] kern: eliminate unused assignment

2013-11-10 Thread Marin Ramesa
On 10.11.2013 23:24:42, Justus Winter wrote:
> Quoting Samuel Thibault (2013-11-10 23:04:28)
> > Marin Ramesa, le Sun 10 Nov 2013 22:50:22 +0100, a écrit :
> > > Value of result is never read. Eliminate the unused assignment.
> > > 
> > > * kern/elf-load.c: Eliminate unused assignment.
> > 
> > Justus has an ACKed better patch which propagates the result, but I
> > don't see it applied on the tree, Justus?
> 
> Right, will merge that next thing tomorrow morning.
> 
> Justus

I guess I missed that email by Justus - I'll see the archives.