[PATCH 1/2] chips/busses.c: use boolean instead of an int
* chips/busses.c (found): Constrain range of values to a boolean. --- chips/busses.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chips/busses.c b/chips/busses.c index 89afa97..e555856 100644 --- a/chips/busses.c +++ b/chips/busses.c @@ -69,7 +69,7 @@ boolean_t configure_bus_master( register struct bus_ctlr *master; register struct bus_driver *driver; - int found = 0; + boolean_t found = FALSE; /* * Match the name in the table, then pick the entry that has the @@ -81,7 +81,7 @@ boolean_t configure_bus_master( continue; if (((master->adaptor == adpt_no) || (master->adaptor == '?')) && (strcmp(master->name, name) == 0)) { - found = 1; + found = TRUE; break; } } @@ -180,7 +180,7 @@ boolean_t configure_bus_device( register struct bus_device *device; register struct bus_driver *driver; - int found = 0; + boolean_t found = FALSE; /* * Walk all devices to find one with the right name @@ -196,7 +196,7 @@ boolean_t configure_bus_device( ((!device->phys_address) || ((device->phys_address == phys) && (device->address == virt))) && (strcmp(device->name, name) == 0)) { - found = 1; + found = TRUE; break; } } -- 1.8.1.4
[PATCH 2/2] chips/busses.c: remove register qualifiers
* chips/busses.c: Remove register qualifiers. --- chips/busses.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chips/busses.c b/chips/busses.c index e555856..f9f6f1b 100644 --- a/chips/busses.c +++ b/chips/busses.c @@ -65,9 +65,9 @@ boolean_t configure_bus_master( int adpt_no, char*bus_name) { - register struct bus_device *device; - register struct bus_ctlr *master; - register struct bus_driver *driver; + struct bus_device *device; + struct bus_ctlr *master; + struct bus_driver *driver; boolean_t found = FALSE; @@ -177,8 +177,8 @@ boolean_t configure_bus_device( int adpt_no, char*bus_name) { - register struct bus_device *device; - register struct bus_driver *driver; + struct bus_device *device; + struct bus_driver *driver; boolean_t found = FALSE; -- 1.8.1.4
[RFC] cleanup of #includes
Hi :) I've been playing with include-what-you-use [0] (iwyu in Debian). Unfortunately iwyu depends on clang-3.{3,4} which is not currently avaliable on Debian/Hurd, so I'm using a horrible^Wingenious hack that runs iwyu on Linux while the actual build runs on Hurd. 0: https://code.google.com/p/include-what-you-use/ iwyu is somewhat aggressive by default, e.g. it likes to pull mach_port_allocate from mach-shortcuts.h. It can be tuned however, by means of mapping files that map symbols or private header to public headers. But, this makes the whole process a lot more manual than I anticipated. So before I put any more time into this, I'd like to hear your oppinion on the whole thing. As an example of a patch generated here is a patch that fixes the includes in libihash/ihash.c. 1. Do you consider the comment describing which symbols are pulled from the header as noise or worthwile information? 2. Do you consider it too noisy to include mach-shortcuts.h instead of mach.h for stuff like mach_port_allocate? 3. libihash/ihash.c includes . Shouldn't it include "ihash.h" instead, so that it gets the local version instead of the one in /usr/include? Cheers, Justus
[PATCH] libihash: cleanup the #includes
* libihash/ihash.c: Cleanup #includes. --- libihash/ihash.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libihash/ihash.c b/libihash/ihash.c index fe9eaed..e813f63 100644 --- a/libihash/ihash.c +++ b/libihash/ihash.c @@ -25,14 +25,12 @@ #include #endif -#include -#include -#include -#include -#include -#include - -#include +#include /* for ENOMEM, error_t. */ +#include /* for free, NULL, calloc, malloc. */ +#include /* for UINT64_C, uint64_t, etc. */ +#include /* for assert. */ + +#include /* for hurd_ihash, etc. */ /* The prime numbers of the form 4 * i + 3 for some i, all greater -- 1.7.10.4
Re: [RFC] cleanup of #includes
On Thu, 2013-11-14 at 12:41 +0100, Justus Winter wrote: > Hi :) > > As an example of a patch generated here is a patch that fixes the > includes in libihash/ihash.c. > > 1. Do you consider the comment describing which symbols are pulled >from the header as noise or worthwile information? Very useful! > 2. Do you consider it too noisy to include mach-shortcuts.h instead of >mach.h for stuff like mach_port_allocate? No, otherwise you need to check which header files are included by mach.h, to find the declaration of it in mach/mach_port.h.
Re: [RFC] cleanup of #includes
On Thu, Nov 14, 2013 at 12:41:30PM +0100, Justus Winter wrote: > 1. Do you consider the comment describing which symbols are pulled >from the header as noise or worthwile information? Noise. > 2. Do you consider it too noisy to include mach-shortcuts.h instead of >mach.h for stuff like mach_port_allocate? Yes, but I guess such occurrences are rare. > 3. libihash/ihash.c includes . Shouldn't it include >"ihash.h" instead, so that it gets the local version instead of the >one in /usr/include? It probably should, yes. -- Richard Braun
Re: [RFC] cleanup of #includes
At Thu, 14 Nov 2013 13:56:30 +0100, Svante Signell wrote: > > 1. Do you consider the comment describing which symbols are pulled > >from the header as noise or worthwile information? > > Very useful! No. This information gets out of date. Neal
Re: [RFC] cleanup of #includes
On Thu, 2013-11-14 at 14:26 +0100, Neal H. Walfield wrote: > At Thu, 14 Nov 2013 13:56:30 +0100, > Svante Signell wrote: > > > 1. Do you consider the comment describing which symbols are pulled > > >from the header as noise or worthwile information? > > > > Very useful! > > No. This information gets out of date. Not if it is automatically updated regularly. I thought this was the intention from Justus.
Re: [RFC] cleanup of #includes
At Thu, 14 Nov 2013 14:38:04 +0100, Svante Signell wrote: > > On Thu, 2013-11-14 at 14:26 +0100, Neal H. Walfield wrote: > > At Thu, 14 Nov 2013 13:56:30 +0100, > > Svante Signell wrote: > > > > 1. Do you consider the comment describing which symbols are pulled > > > >from the header as noise or worthwile information? > > > > > > Very useful! > > > > No. This information gets out of date. > > Not if it is automatically updated regularly. I thought this was the > intention from Justus. The churn in the comments will only be noise in the commit history. Identifying and removing unused headers, however, is fine.
Small cleanup of i386 source
Hello, Attached is a gzipped series of 33 patches which do various cleanups of i386 source. Cleanups include: 1. Removal of register qualifiers. 2. Qualification of constants with const. 3. Addition of comments after endifs. 4. Stylistic fixes. 5. Removal of unused variables. i386_cleanup.tar.gz Description: application/compressed-tar
[PATCH 2/2] i386/i386/vm_tuning.h: remove file
* i386/Makefrag.am: Remove i386/i386/vm_tuning.h. * i386/i386/vm_tuning.h: Remove file. * vm/vm_pageout.c: Don't include i386/i386/vm_tuning.h. --- i386/Makefrag.am | 1 - i386/i386/vm_tuning.h | 35 --- vm/vm_pageout.c | 1 - 3 files changed, 37 deletions(-) delete mode 100644 i386/i386/vm_tuning.h diff --git a/i386/Makefrag.am b/i386/Makefrag.am index 738c60a..32730a5 100644 --- a/i386/Makefrag.am +++ b/i386/Makefrag.am @@ -134,7 +134,6 @@ libkernel_a_SOURCES += \ i386/i386/user_ldt.c \ i386/i386/user_ldt.h \ i386/i386/vm_param.h \ - i386/i386/vm_tuning.h \ i386/i386/xpr.h \ i386/intel/pmap.c \ i386/intel/pmap.h \ diff --git a/i386/i386/vm_tuning.h b/i386/i386/vm_tuning.h deleted file mode 100644 index f54e110..000 --- a/i386/i386/vm_tuning.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or software.distribut...@cs.cmu.edu - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * File: i386/vm_tuning.h - * - * VM tuning parameters for the i386 (without reference bits). - */ - -#ifndef_I386_VM_TUNING_H_ -#define_I386_VM_TUNING_H_ - -#endif /* _I386_VM_TUNING_H_ */ diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c index 661675f..fb6d840 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c @@ -52,7 +52,6 @@ #include #include #include -#include -- 1.8.1.4
[PATCH 1/2] i386/i386at: add ifndefs
* i386/i386at/kd_queue.h: Add ifndef. * i386/i386at/kdsoft.h: Likewise. * i386/i386at/lprreg.h: Likewise. * i386/i386at/rtc.h: Likewise. --- i386/i386at/kd_queue.h | 5 + i386/i386at/kdsoft.h | 5 + i386/i386at/lprreg.h | 5 + i386/i386at/rtc.h | 5 + 4 files changed, 20 insertions(+) diff --git a/i386/i386at/kd_queue.h b/i386/i386at/kd_queue.h index c976acf..bd3fc7b 100644 --- a/i386/i386at/kd_queue.h +++ b/i386/i386at/kd_queue.h @@ -64,6 +64,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * /dev/mouse. */ +#ifndef _KD_QUEUE_H_ +#define _KD_QUEUE_H_ + #include #include @@ -79,3 +82,5 @@ extern void kdq_reset(kd_event_queue *); extern boolean_t kdq_empty(kd_event_queue *); extern boolean_t kdq_full(kd_event_queue *); extern kd_event *kdq_get(kd_event_queue *); + +#endif /* _KD_QUEUE_H_ */ diff --git a/i386/i386at/kdsoft.h b/i386/i386at/kdsoft.h index 96e2df8..297c57b 100644 --- a/i386/i386at/kdsoft.h +++ b/i386/i386at/kdsoft.h @@ -57,6 +57,9 @@ NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef _KDSOFT_H +#define _KDSOFT_H_ + /* * Globals used for both character-based controllers and bitmap-based * controllers. @@ -203,3 +206,5 @@ extern shortxstart, ystart; extern short char_byte_width;/* char_width/8 */ extern short fb_byte_width; /* fb_width/8 */ extern short font_byte_width;/* num bytes in 1 scan line of font */ + +#endif /* _KDSOFT_H_ */ diff --git a/i386/i386at/lprreg.h b/i386/i386at/lprreg.h index c6fbed4..648e4ea 100644 --- a/i386/i386at/lprreg.h +++ b/i386/i386at/lprreg.h @@ -27,7 +27,12 @@ * Parallel port printer driver v1.0 * All rights reserved. */ + +#ifndef _LPRREG_H_ +#define _LPRREG_H_ #define DATA(addr) (addr + 0) #define STATUS(addr) (addr + 1) #define INTR_ENAB(addr)(addr + 2) + +#endif /* _LPRREG_H_ */ diff --git a/i386/i386at/rtc.h b/i386/i386at/rtc.h index ced39b9..64a528a 100644 --- a/i386/i386at/rtc.h +++ b/i386/i386at/rtc.h @@ -45,6 +45,9 @@ NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef _RTC_H_ +#define _RTC_H_ + #define RTC_ADDR 0x70/* I/O port address for register select */ #define RTC_DATA 0x71/* I/O port address for data read/write */ @@ -136,3 +139,5 @@ struct rtc_st { extern int readtodc(u_int *tp); extern int writetodc(void); + +#endif /* _RTC_H_ */ -- 1.8.1.4
Re: [PATCH 1/2] i386/i386at: add ifndefs
On 14.11.2013 21:04:04, Marin Ramesa wrote: > +#ifndef _KDSOFT_H This is a typo. This should be "+#ifndef _KDSOFT_H_".
Re: [PATCH 03/12] vm/vm_fault.c: qualify constant with const
Marin Ramesa, le Wed 13 Nov 2013 16:40:40 +0100, a écrit : > * vm/vm_fault.c: Qualify constant with const. Mmm, one could want to change it dynamically. > --- > vm/vm_fault.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/vm/vm_fault.c b/vm/vm_fault.c > index 7e84961..ae34d91 100644 > --- a/vm/vm_fault.c > +++ b/vm/vm_fault.c > @@ -86,7 +86,7 @@ typedef struct vm_fault_state { > > struct kmem_cachevm_fault_state_cache; > > -int vm_object_absent_max = 50; > +const intvm_object_absent_max = 50; > > int vm_fault_debug = 0; > > -- > 1.8.1.4 > > -- Samuel argh, pi est plus grand que 2. Ca casse tout -+- #ens-mim -+-
Re: [PATCH 01/12] vm/memory_object.c: remove register qualifiers
Applied the rest, thanks! Samuel
Re: [PATCH 1/2] chips/busses.c: use boolean instead of an int
Applied, thanks! Samuel
Re: [PATCH 1/2] i386/i386at: add ifndefs
Applied, thanks! Samuel
Re: [RFC] cleanup of #includes
Neal H. Walfield, le Thu 14 Nov 2013 14:42:22 +0100, a écrit : > Identifying and removing unused headers, however, is fine. Yes, that's mostly what I'd expect as patches. Samuel
Re: Small cleanup of i386 source
> -int cpuspeed = 4; > +const int cpuspeed = 4; > -int simple_lock_pause_loop = 100; > +const int simple_lock_pause_loop = 100; Well, these should really be computed dynamically. I have applied almost all the rest, thanks! Samuel
Re: Small cleanup of i386 source
> - register unsigned long _temp__ asm("esp"); \ > + unsigned long _temp__ asm("esp"); \ I'll rather keep those, at least as documentation. Samuel