From owner-freebsd-audit Sun Mar 3 13:20:25 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 7FDFD37B416 for ; Sun, 3 Mar 2002 13:20:20 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g23LKGh08909 for audit@freebsd.org; Sun, 3 Mar 2002 21:20:16 GMT (envelope-from mark@grimreaper.grondar.za) Received: from grimreaper (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.2/8.12.2) with ESMTP id g23LHCRV002897 for ; Sun, 3 Mar 2002 21:17:12 GMT (envelope-from mark@grimreaper.grondar.za) Message-Id: <200203032117.g23LHCRV002897@grimreaper.grondar.org> To: audit@freebsd.org Subject: kernel; lint and other warns. Review? Date: Sun, 03 Mar 2002 21:17:12 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Please review the enclosed diffs. they are intended to make no functional difference other than fixing lint warnings. Thanks! M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn #text/plain; name=kernel.diff [Kernel lint warning fixes] diff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Mar 3 13:21:29 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id E3E2137B41A for ; Sun, 3 Mar 2002 13:20:22 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g23LKMN08913 for audit@freebsd.org; Sun, 3 Mar 2002 21:20:22 GMT (envelope-from mark@grimreaper.grondar.za) Received: from grimreaper (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.2/8.12.2) with ESMTP id g23LJ8RV002907 for ; Sun, 3 Mar 2002 21:19:08 GMT (envelope-from mark@grimreaper.grondar.za) Message-Id: <200203032119.g23LJ8RV002907@grimreaper.grondar.org> To: audit@freebsd.org Subject: Kernel; lint warnings and fixes. Review, please? MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <2904.1015190331.0@grimreaper> Date: Sun, 03 Mar 2002 21:19:08 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2904.1015190331.1@grimreaper> [ D'uh. This time I actually MIMEified the mail ] Hi Please review the enclosed diffs. they are intended to make no functional difference other than fixing lint warnings. Thanks! M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn ------- =_aaaaaaaaaa0 Content-Type: text/plain; name="kernel.diff"; charset="us-ascii" Content-ID: <2904.1015190331.2@grimreaper> Content-Description: Kernel lint warning fixes Index: i386/include/atomic.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/atomic.h,v retrieving revision 1.26 diff -u -d -r1.26 atomic.h --- i386/include/atomic.h 28 Feb 2002 06:17:05 -0000 1.26 +++ i386/include/atomic.h 1 Mar 2002 22:13:09 -0000 @@ -89,6 +89,7 @@ * The assembly is volatilized to demark potential before-and-after side * effects if an interrupt or SMP collision were to occur. */ +#ifdef __GNUC__ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ @@ -97,6 +98,11 @@ : "+m" (*p) \ : CONS (V)); \ } +#else /* !__GNUC__ */ +#warning "This file must be compiled with GCC" +#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ +static extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +#endif /* __GNUC__ */ /* * Atomic compare and set, used by the mutex functions @@ -106,6 +112,7 @@ * Returns 0 on failure, non-zero on success */ +#if defined(__GNUC__) #if defined(I386_CPU) static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) @@ -151,7 +158,24 @@ return (res); } #endif /* defined(I386_CPU) */ +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy function!! Do not be confused into thinking that this is + * actually atomic! + */ +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + if (*dst == exp) { + *dst = new; + return 1; + } + else + return 0; +} +#endif /* defined(__GNUC__) */ +#if defined(__GNUC__) #if defined(I386_CPU) /* * We assume that a = b will do atomic loads and stores. @@ -172,7 +196,7 @@ *p = v; \ __asm __volatile("" : : : "memory"); \ } -#else +#else /* !defined(I386_CPU) */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ @@ -200,6 +224,28 @@ : : "memory"); \ } #endif /* defined(I386_CPU) */ +#else /* !defined(__GNUC__) */ + +/* + * XXXX: Dummy functions!! Do not be confused into thinking that these are + * actually atomic! + */ +#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +static __inline u_##TYPE \ +atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ +{ \ + return (*p); \ +} \ + \ +/* \ + * The XCHG instruction asserts LOCK automagically. \ + */ \ +static __inline void \ +atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + *p = v; \ +} +#endif /* defined(__GNUC__) */ #endif /* KLD_MODULE */ ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v) @@ -370,6 +416,7 @@ #undef ATOMIC_PTR +#if defined(__GNUC__) static __inline u_int atomic_readandclear_int(volatile u_int *addr) { @@ -384,7 +431,22 @@ return (result); } +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy! + */ +static __inline u_int +atomic_readandclear_int(volatile u_int *addr) +{ + u_int ret; + ret = *addr; + *addr = 0; + return (ret); +} +#endif /* defined(__GNUC__) */ + +#if defined(__GNUC__) static __inline u_long atomic_readandclear_long(volatile u_long *addr) { @@ -399,5 +461,19 @@ return (result); } +#else /* !defined(__GNUC__) */ +/* + * XXXX: Dummy! + */ +static __inline u_long +atomic_readandclear_long(volatile u_long *addr) +{ + u_long ret; + + ret = *addr; + *addr = 0; + return (ret); +} +#endif /* defined(__GNUC__) */ #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ Index: i386/include/bus_at386.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/bus_at386.h,v retrieving revision 1.18 diff -u -d -r1.18 bus_at386.h --- i386/include/bus_at386.h 18 Feb 2002 13:43:19 -0000 1.18 +++ i386/include/bus_at386.h 24 Feb 2002 21:28:54 -0000 @@ -274,6 +274,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movb (%2),%%al \n\ @@ -282,6 +283,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -301,6 +303,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movw (%2),%%ax \n\ @@ -309,6 +312,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -328,6 +332,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: movl (%2),%%eax \n\ @@ -336,6 +341,7 @@ "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#endif } #endif } @@ -374,7 +380,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inb %w2,%%al \n\ @@ -384,6 +391,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -391,7 +399,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -399,6 +408,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -412,7 +422,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inw %w2,%%ax \n\ @@ -422,6 +433,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -429,7 +441,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -437,6 +450,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -450,7 +464,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: inl %w2,%%eax \n\ @@ -460,6 +475,7 @@ "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -467,7 +483,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -475,6 +492,7 @@ "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#endif } #endif } @@ -595,6 +613,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -603,6 +622,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -622,6 +642,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -630,6 +651,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -649,6 +671,7 @@ else #endif { +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -657,6 +680,7 @@ "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#endif } #endif } @@ -696,7 +720,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -706,6 +731,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -713,7 +739,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -721,6 +748,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -734,7 +762,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -744,6 +773,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -751,7 +781,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -759,6 +790,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -772,7 +804,8 @@ if (tag == I386_BUS_SPACE_IO) #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -782,6 +815,7 @@ "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#endif } #endif #if defined(_I386_BUS_MEMIO_H_) @@ -789,7 +823,8 @@ else #endif { - int _port_ = bsh + offset; \ + int _port_ = bsh + offset; +#ifdef __GNUC__ __asm __volatile(" \n\ cld \n\ repne \n\ @@ -797,6 +832,7 @@ "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#endif } #endif } @@ -1167,10 +1203,12 @@ bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags) { +#ifdef __GNUC__ if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else __asm __volatile("" : : : "memory"); +#endif } #endif /* _I386_BUS_AT386_H_ */ Index: i386/include/pcpu.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/pcpu.h,v retrieving revision 1.32 diff -u -d -r1.32 pcpu.h --- i386/include/pcpu.h 11 Dec 2001 23:33:40 -0000 1.32 +++ i386/include/pcpu.h 28 Feb 2002 10:44:43 -0000 @@ -32,8 +32,22 @@ #ifdef _KERNEL #ifndef __GNUC__ -#error gcc is required to use this file -#endif + +#ifndef lint +#error gcc or lint is required to use this file +#else /* lint */ +#define __PCPU_PTR(name) +#define __PCPU_GET(name) +#define __PCPU_SET(name, val) +#define PCPU_GET(member) __PCPU_GET(pc_ ## member) +#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) +#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +#define PCPU_MD_FIELDS \ + int foo; \ + char bar +#endif /* lint */ + +#else /* __GNUC__ */ #include #include @@ -141,6 +155,8 @@ #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) + +#endif /* __GNUC__ */ #endif /* _KERNEL */ Index: i386/include/profile.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/profile.h,v retrieving revision 1.26 diff -u -d -r1.26 profile.h --- i386/include/profile.h 31 Jan 2002 13:49:55 -0000 1.26 +++ i386/include/profile.h 19 Feb 2002 16:56:31 -0000 @@ -82,28 +82,35 @@ #define _MCOUNT_DECL static __inline void _mcount -#define MCOUNT \ -void \ -mcount() \ -{ \ - uintfptr_t selfpc, frompc; \ - /* \ - * Find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * selfpc = pc pushed by call to mcount \ - */ \ - asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ - /* \ - * frompc = pc pushed by call to mcount's caller. \ - * The caller's stack frame has already been built, so %ebp is \ - * the caller's frame pointer. The caller's raddr is in the \ - * caller's frame following the caller's caller's frame pointer. \ - */ \ - asm("movl (%%ebp),%0" : "=r" (frompc)); \ - frompc = ((uintfptr_t *)frompc)[1]; \ - _mcount(frompc, selfpc); \ +#ifdef __GNUC__ +#define MCOUNT \ +void \ +mcount() \ +{ \ + uintfptr_t selfpc, frompc; \ + /* \ + * Find the return address for mcount, \ + * and the return address for mcount's caller. \ + * \ + * selfpc = pc pushed by call to mcount \ + */ \ + asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ + /* \ + * frompc = pc pushed by call to mcount's caller. \ + * The caller's stack frame has already been built, so %ebp is \ + * the caller's frame pointer. The caller's raddr is in the \ + * caller's frame following the caller's caller's frame pointer.\ + */ \ + asm("movl (%%ebp),%0" : "=r" (frompc)); \ + frompc = ((uintfptr_t *)frompc)[1]; \ + _mcount(frompc, selfpc); \ +} +#else /* __GNUC__ */ +void \ +mcount() \ +{ \ } +#endif /* __GNUC__ */ typedef unsigned int uintfptr_t; @@ -117,16 +124,16 @@ #ifdef _KERNEL -void mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); -void kmupetext __P((uintfptr_t nhighpc)); +void mcount(uintfptr_t frompc, uintfptr_t selfpc); +void kmupetext(uintfptr_t nhighpc); #ifdef GUPROF struct gmonparam; -void nullfunc_loop_profiled __P((void)); -void nullfunc_profiled __P((void)); -void startguprof __P((struct gmonparam *p)); -void stopguprof __P((struct gmonparam *p)); +void nullfunc_loop_profiled(void); +void nullfunc_profiled(void); +void startguprof(struct gmonparam *p); +void stopguprof(struct gmonparam *p); #else #define startguprof(p) #define stopguprof(p) @@ -139,12 +146,12 @@ __BEGIN_DECLS #ifdef __GNUC__ #ifdef __ELF__ -void mcount __P((void)) __asm(".mcount"); +void mcount(void) __asm(".mcount"); #else -void mcount __P((void)) __asm("mcount"); +void mcount(void) __asm("mcount"); #endif #endif -static void _mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); +static void _mcount(uintfptr_t frompc, uintfptr_t selfpc); __END_DECLS #endif /* _KERNEL */ @@ -154,11 +161,11 @@ extern int cputime_bias; __BEGIN_DECLS -int cputime __P((void)); -void empty_loop __P((void)); -void mexitcount __P((uintfptr_t selfpc)); -void nullfunc __P((void)); -void nullfunc_loop __P((void)); +int cputime(void); +void empty_loop(void); +void mexitcount(uintfptr_t selfpc); +void nullfunc(void); +void nullfunc_loop(void); __END_DECLS #endif Index: kern/bus_if.m =================================================================== RCS file: /home/ncvs/src/sys/kern/bus_if.m,v retrieving revision 1.19 diff -u -d -r1.19 bus_if.m --- kern/bus_if.m 28 Nov 2000 06:49:15 -0000 1.19 +++ kern/bus_if.m 24 Feb 2002 21:39:42 -0000 @@ -82,20 +82,20 @@ # Read an instance variable. Return 0 on success. # METHOD int read_ivar { - device_t dev; - device_t child; - int index; - uintptr_t *result; + device_t _dev; + device_t _child; + int _index; + uintptr_t *_result; }; # # Write an instance variable. Return 0 on success. # METHOD int write_ivar { - device_t dev; - device_t child; - int index; - uintptr_t value; + device_t _dev; + device_t _child; + int _index; + uintptr_t _value; }; # @@ -103,8 +103,8 @@ # to reclaim any resources allocated on behalf of the child. # METHOD void child_detached { - device_t dev; - device_t child; + device_t _dev; + device_t _child; }; # @@ -113,8 +113,8 @@ # attach any un-matched children of the bus. # METHOD void driver_added { - device_t dev; - driver_t *driver; + device_t _dev; + driver_t *_driver; } DEFAULT bus_generic_driver_added; # @@ -124,10 +124,10 @@ # added after the last existing child with the same order. # METHOD device_t add_child { - device_t dev; - int order; - const char *name; - int unit; + device_t _dev; + int _order; + const char *_name; + int _unit; }; # @@ -145,30 +145,30 @@ # uses the resource. # METHOD struct resource * alloc_resource { - device_t dev; - device_t child; - int type; - int *rid; - u_long start; - u_long end; - u_long count; - u_int flags; + device_t _dev; + device_t _child; + int _type; + int *_rid; + u_long _start; + u_long _end; + u_long _count; + u_int _flags; } DEFAULT null_alloc_resource; METHOD int activate_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *r; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_r; }; METHOD int deactivate_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *r; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_r; }; # @@ -177,28 +177,28 @@ # is not necessarily the same as the one the client passed). # METHOD int release_resource { - device_t dev; - device_t child; - int type; - int rid; - struct resource *res; + device_t _dev; + device_t _child; + int _type; + int _rid; + struct resource *_res; }; METHOD int setup_intr { - device_t dev; - device_t child; - struct resource *irq; - int flags; - driver_intr_t *intr; - void *arg; - void **cookiep; + device_t _dev; + device_t _child; + struct resource *_irq; + int _flags; + driver_intr_t *_intr; + void *_arg; + void **_cookiep; }; METHOD int teardown_intr { - device_t dev; - device_t child; - struct resource *irq; - void *cookie; + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; }; # @@ -206,12 +206,12 @@ # the type or rid are out of range. # METHOD int set_resource { - device_t dev; - device_t child; - int type; - int rid; - u_long start; - u_long count; + device_t _dev; + device_t _child; + int _type; + int _rid; + u_long _start; + u_long _count; }; # @@ -219,28 +219,28 @@ # out of range or have not been set. # METHOD int get_resource { - device_t dev; - device_t child; - int type; - int rid; - u_long *startp; - u_long *countp; + device_t _dev; + device_t _child; + int _type; + int _rid; + u_long *_startp; + u_long *_countp; }; # # Delete a resource. # METHOD void delete_resource { - device_t dev; - device_t child; - int type; - int rid; + device_t _dev; + device_t _child; + int _type; + int _rid; }; # # Return a struct resource_list. # METHOD struct resource_list * get_resource_list { - device_t dev; - device_t child; + device_t _dev; + device_t _child; } DEFAULT bus_generic_get_resource_list; Index: kern/kern_sysctl.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.121 diff -u -d -r1.121 kern_sysctl.c --- kern/kern_sysctl.c 27 Feb 2002 18:32:12 -0000 1.121 +++ kern/kern_sysctl.c 1 Mar 2002 17:51:00 -0000 @@ -311,7 +311,7 @@ sysctl_unregister_oid(oidp); if (del) { if (oidp->descr) - free(oidp->descr, M_SYSCTLOID); + free((void *)(uintptr_t)(const void *)oidp->descr, M_SYSCTLOID); free((void *)(uintptr_t)(const void *)oidp->oid_name, M_SYSCTLOID); free(oidp, M_SYSCTLOID); @@ -376,7 +376,7 @@ int len = strlen(descr) + 1; oidp->descr = malloc(len, M_SYSCTLOID, M_WAITOK); if (oidp->descr) - strcpy(oidp->descr, descr); + strcpy((char *)(uintptr_t)(const void *)oidp->descr, descr); } /* Update the context, if used */ if (clist != NULL) Index: sys/eventhandler.h =================================================================== RCS file: /home/ncvs/src/sys/sys/eventhandler.h,v retrieving revision 1.17 diff -u -d -r1.17 eventhandler.h --- sys/eventhandler.h 12 Sep 2001 08:38:05 -0000 1.17 +++ sys/eventhandler.h 1 Mar 2002 12:09:50 -0000 @@ -39,21 +39,19 @@ #include #include -struct eventhandler_entry -{ - TAILQ_ENTRY(eventhandler_entry) ee_link; - int ee_priority; - void *ee_arg; +struct eventhandler_entry { + TAILQ_ENTRY(eventhandler_entry) ee_link; + int ee_priority; + void *ee_arg; }; -struct eventhandler_list -{ - char *el_name; - int el_flags; +struct eventhandler_list { + char *el_name; + int el_flags; #define EHE_INITTED (1<<0) - struct lock el_lock; - TAILQ_ENTRY(eventhandler_list) el_link; - TAILQ_HEAD(,eventhandler_entry) el_entries; + struct lock el_lock; + TAILQ_ENTRY(eventhandler_list) el_link; + TAILQ_HEAD(,eventhandler_entry) el_entries; }; typedef struct eventhandler_entry *eventhandler_tag; @@ -70,10 +68,9 @@ */ #define EVENTHANDLER_FAST_DECLARE(name, type) \ extern struct eventhandler_list Xeventhandler_list_ ## name ; \ -struct eventhandler_entry_ ## name \ -{ \ - struct eventhandler_entry ee; \ - type eh_func; \ +struct eventhandler_entry_ ## name { \ + struct eventhandler_entry ee; \ + type eh_func; \ }; \ struct __hack @@ -81,29 +78,30 @@ struct eventhandler_list Xeventhandler_list_ ## name = { #name }; \ struct __hack -#define EVENTHANDLER_FAST_INVOKE(name, args...) \ -do { \ - struct eventhandler_list *_el = &Xeventhandler_list_ ## name ; \ - struct eventhandler_entry *_ep, *_en; \ - \ - if (_el->el_flags & EHE_INITTED) { \ - lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ - _ep = TAILQ_FIRST(&(_el->el_entries)); \ - while (_ep != NULL) { \ - _en = TAILQ_NEXT(_ep, ee_link); \ - ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , \ - ## args); \ - _ep = _en; \ - } \ - lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ - } \ +#define EVENTHANDLER_FAST_INVOKE(name, args...) \ +do { \ + struct eventhandler_list *_el = &Xeventhandler_list_ ## name ; \ + struct eventhandler_entry *_ep, *_en; \ + struct eventhandler_entry ## name *_epn; \ + \ + if (_el->el_flags & EHE_INITTED) { \ + lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ + _ep = TAILQ_FIRST(&(_el->el_entries)); \ + while (_ep != NULL) { \ + _en = TAILQ_NEXT(_ep, ee_link); \ + _epn = (struct eventhandler_entry_ ## name *)_ep;\ + _epn->eh_func(_ep->ee_arg , ## args ); \ + _ep = _en; \ + } \ + lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ + } \ } while (0) -#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \ - eventhandler_register(&Xeventhandler_list_ ## name, #name, func, arg, priority) +#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \ + eventhandler_register(&Xeventhandler_list_ ## name, #name, func, arg, priority) #define EVENTHANDLER_FAST_DEREGISTER(name, tag) \ - eventhandler_deregister(&Xeventhandler_list_ ## name, tag) + eventhandler_deregister(&Xeventhandler_list_ ## name, tag) /* * Slow handlers are entirely dynamic; lists are created @@ -115,39 +113,40 @@ #define EVENTHANDLER_DECLARE(name, type) \ struct eventhandler_entry_ ## name \ { \ - struct eventhandler_entry ee; \ - type eh_func; \ + struct eventhandler_entry ee; \ + type eh_func;\ }; \ struct __hack -#define EVENTHANDLER_INVOKE(name, args...) \ -do { \ - struct eventhandler_list *_el; \ - struct eventhandler_entry *_ep, *_en; \ - \ - if (((_el = eventhandler_find_list(#name)) != NULL) && \ - (_el->el_flags & EHE_INITTED)) { \ - lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ - _ep = TAILQ_FIRST(&(_el->el_entries)); \ - while (_ep != NULL) { \ - _en = TAILQ_NEXT(_ep, ee_link); \ - ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , \ - ## args); \ - _ep = _en; \ - } \ - lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ - } \ +#define EVENTHANDLER_INVOKE(name, args...) \ +do { \ + struct eventhandler_list *_el; \ + struct eventhandler_entry *_ep, *_en; \ + struct eventhandler_entry_ ## name *_epn; \ + \ + if (((_el = eventhandler_find_list(#name)) != NULL) && \ + (_el->el_flags & EHE_INITTED)) { \ + lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread); \ + _ep = TAILQ_FIRST(&(_el->el_entries)); \ + while (_ep != NULL) { \ + _en = TAILQ_NEXT(_ep, ee_link); \ + _epn = (struct eventhandler_entry_ ## name *)_ep;\ + _epn->eh_func( _ep->ee_arg , ## args ); \ + _ep = _en; \ + } \ + lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread); \ + } \ } while (0) #define EVENTHANDLER_REGISTER(name, func, arg, priority) \ - eventhandler_register(NULL, #name, func, arg, priority) + eventhandler_register(NULL, #name, func, arg, priority) -#define EVENTHANDLER_DEREGISTER(name, tag) \ -do { \ - struct eventhandler_list *_el; \ - \ - if ((_el = eventhandler_find_list(#name)) != NULL) \ - eventhandler_deregister(_el, tag); \ +#define EVENTHANDLER_DEREGISTER(name, tag) \ +do { \ + struct eventhandler_list *_el; \ + \ + if ((_el = eventhandler_find_list(#name)) != NULL) \ + eventhandler_deregister(_el, tag); \ } while(0) @@ -165,7 +164,7 @@ */ /* Shutdown events */ -typedef void (*shutdown_fn) __P((void *, int)); +typedef void (*shutdown_fn)(void *, int); #define SHUTDOWN_PRI_FIRST 0 #define SHUTDOWN_PRI_DEFAULT 10000 @@ -176,7 +175,7 @@ EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn); /* Idle process event */ -typedef void (*idle_eventhandler_t) __P((void *, int)); +typedef void (*idle_eventhandler_t)(void *, int); #define IDLE_PRI_FIRST 10000 #define IDLE_PRI_LAST 20000 Index: sys/kernel.h =================================================================== RCS file: /home/ncvs/src/sys/sys/kernel.h,v retrieving revision 1.98 diff -u -d -r1.98 kernel.h --- sys/kernel.h 9 Jan 2002 04:58:49 -0000 1.98 +++ sys/kernel.h 1 Mar 2002 12:26:44 -0000 @@ -229,13 +229,13 @@ subsystem, \ order, \ func, \ - ident \ + (ident) \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); #define SYSINIT(uniquifier, subsystem, order, func, ident) \ C_SYSINIT(uniquifier, subsystem, order, \ - (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident) + (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident)) /* * Called on module unload: no special processing @@ -245,13 +245,13 @@ subsystem, \ order, \ func, \ - ident \ + (ident) \ }; \ DATA_SET(sysuninit_set,uniquifier ## _sys_uninit) #define SYSUNINIT(uniquifier, subsystem, order, func, ident) \ C_SYSUNINIT(uniquifier, subsystem, order, \ - (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident) + (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident)) void sysinit_add __P((struct sysinit **set, struct sysinit **set_end)); Index: sys/linker_set.h =================================================================== RCS file: /home/ncvs/src/sys/sys/linker_set.h,v retrieving revision 1.9 diff -u -d -r1.9 linker_set.h --- sys/linker_set.h 13 Jun 2001 10:58:39 -0000 1.9 +++ sys/linker_set.h 2 Mar 2002 14:32:09 -0000 @@ -42,6 +42,7 @@ * Private macros, not to be used outside this header file. */ /* this bit of h0h0magic brought to you by cpp */ +#ifdef __GNUC__ #define __GLOBL(sym) __GLOBL2(sym) #define __GLOBL2(sym) __asm(".globl " #sym) @@ -50,6 +51,12 @@ __GLOBL(__CONCAT(__stop_set_,set)); \ static void const * const __set_##set##_sym_##sym \ __attribute__((__section__("set_" #set),__unused__)) = &sym +#else /* !__GNUC__ */ +#ifndef lint +#error "This file needs to be compiled by GCC or lint" +#endif /* lint */ +#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym) +#endif /* __GNUC__ */ /* * Public macros. Index: sys/lock.h =================================================================== RCS file: /home/ncvs/src/sys/sys/lock.h,v retrieving revision 1.42 diff -u -d -r1.42 lock.h --- sys/lock.h 5 Jan 2002 08:47:13 -0000 1.42 +++ sys/lock.h 24 Feb 2002 21:41:04 -0000 @@ -245,8 +245,8 @@ witness_restore((lock), __CONCAT(n, __wf), __CONCAT(n, __wl)) #else /* WITNESS */ -#define WITNESS_INIT(lock) (lock)->lo_flags |= LO_INITIALIZED -#define WITNESS_DESTROY(lock) (lock)->lo_flags &= ~LO_INITIALIZED +#define WITNESS_INIT(lock) ((lock)->lo_flags |= LO_INITIALIZED) +#define WITNESS_DESTROY(lock) ((lock)->lo_flags &= ~LO_INITIALIZED) #define WITNESS_LOCK(lock, flags, file, line) #define WITNESS_UPGRADE(lock, flags, file, line) #define WITNESS_DOWNGRADE(lock, flags, file, line) Index: sys/malloc.h =================================================================== RCS file: /home/ncvs/src/sys/sys/malloc.h,v retrieving revision 1.54 diff -u -d -r1.54 malloc.h --- sys/malloc.h 10 Aug 2001 06:37:04 -0000 1.54 +++ sys/malloc.h 28 Feb 2002 10:24:13 -0000 @@ -153,7 +153,7 @@ * Deprecated macro versions of not-quite-malloc() and free(). */ #define MALLOC(space, cast, size, type, flags) \ - (space) = (cast)malloc((u_long)(size), (type), (flags)) + ((space) = (cast)malloc((u_long)(size), (type), (flags))) #define FREE(addr, type) free((addr), (type)) /* Index: sys/sysctl.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysctl.h,v retrieving revision 1.101 diff -u -d -r1.101 sysctl.h --- sys/sysctl.h 16 Dec 2001 02:55:41 -0000 1.101 +++ sys/sysctl.h 1 Mar 2002 12:19:45 -0000 @@ -133,14 +133,14 @@ struct sysctl_oid_list *oid_parent; SLIST_ENTRY(sysctl_oid) oid_link; int oid_number; - int oid_kind; + u_int oid_kind; void *oid_arg1; int oid_arg2; const char *oid_name; int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; int oid_refcnt; - char *descr; + const char *descr; }; #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) ------- =_aaaaaaaaaa0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Mar 3 20:58: 3 2002 Delivered-To: freebsd-audit@freebsd.org Received: from leviathan.inethouston.net (leviathan.inethouston.net [66.64.12.249]) by hub.freebsd.org (Postfix) with ESMTP id 22C8337B402 for ; Sun, 3 Mar 2002 20:58:01 -0800 (PST) Received: by leviathan.inethouston.net (Postfix, from userid 1001) id 955ED319BD2; Sun, 3 Mar 2002 22:58:07 -0600 (CST) Date: Sun, 3 Mar 2002 22:58:07 -0600 From: "David W. Chapman Jr." To: audit@freebsd.org Subject: echo.c style(9) fixes Message-ID: <20020304045807.GA50137@leviathan.inethouston.net> Reply-To: "David W. Chapman Jr." Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline User-Agent: Mutt/1.3.27i X-Operating-System: FreeBSD 4.5-STABLE i386 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is a patch for echo.c on -STABLE to update it to style(9). Anyone have any feedback? -- David W. Chapman Jr. dwcjr@inethouston.net Raintree Network Services, Inc. dwcjr@freebsd.org FreeBSD Committer --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="echo.patch" --- echo.c.orig Sun Mar 3 22:14:11 2002 +++ echo.c Sun Mar 3 22:17:38 2002 @@ -49,12 +49,8 @@ #include #include -int main __P((int, char *[])); - int -main(argc, argv) - int argc __unused; - char *argv[]; +main(int argc, char *argv[]) { int nflag; --dDRMvlgZJXvWKvBx-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Mar 3 21:14: 2 2002 Delivered-To: freebsd-audit@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id A533337B404 for ; Sun, 3 Mar 2002 21:13:59 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g245Dvi68318; Sun, 3 Mar 2002 22:13:58 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g245DvL66224; Sun, 3 Mar 2002 22:13:57 -0700 (MST) (envelope-from imp@village.org) Date: Sun, 03 Mar 2002 22:12:58 -0700 (MST) Message-Id: <20020303.221258.63482016.imp@village.org> To: dwcjr@inethouston.net Cc: audit@FreeBSD.ORG Subject: Re: echo.c style(9) fixes From: "M. Warner Losh" In-Reply-To: <20020304045807.GA50137@leviathan.inethouston.net> References: <20020304045807.GA50137@leviathan.inethouston.net> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20020304045807.GA50137@leviathan.inethouston.net> "David W. Chapman Jr." writes: : This is a patch for echo.c on -STABLE to update it to style(9). : Anyone have any feedback? Looks good to me and similar to what I'm doing to a bunch of other programs. But I haven't gotten to echo yet, so there's no duplication. And if you wanted to do others, I'd be happy to review them. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Mar 5 2: 2:36 2002 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id 9900337B400; Tue, 5 Mar 2002 02:00:48 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id MAA13740; Tue, 5 Mar 2002 12:00:38 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h34.229.dialup.iptcom.net [212.9.229.34]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id MAA16763; Tue, 5 Mar 2002 12:00:30 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id g259xwB02794; Tue, 5 Mar 2002 11:59:58 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C84974D.37F683BD@FreeBSD.org> Date: Tue, 05 Mar 2002 12:00:45 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Extending loader(8) for loading kerels/modules split across several disks Content-Type: multipart/mixed; boundary="------------C69442EE275E6B52E76568F1" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------C69442EE275E6B52E76568F1 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Hi folks, Please review attached patch, which adds long overdue feature to our loader(8), allowing it to load sequence of files as a single object. This should allow us to lift 1.44M limit on compressed kernel for the installation diskette. Please note, that to use this feature to load gzip-compressed objects you need to split the object first and then compress each piece individually, not compress first and then split already compressed file. Therefore tight fitting of each piece to the 1.44M limit could be a little tricky, but not impossible. Other way around is to use kgzip(8) utility to compress kernel and then split it into pieces 1.44M each. If there are no objections I would like to commit it ASAP, so that our RE team is able to use this feature in the forthcoming 5.0-DP1 release. Any feedback is appreciated. -Maxim --------------C69442EE275E6B52E76568F1 Content-Type: text/plain; charset=koi8-r; name="loader-multifiles.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="loader-multifiles.diff" Index: src/lib/libstand/close.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/close.c,v retrieving revision 1.3 diff -d -u -r1.3 close.c --- src/lib/libstand/close.c 30 Sep 2001 22:28:00 -0000 1.3 +++ src/lib/libstand/close.c 5 Mar 2002 09:22:00 -0000 @@ -88,6 +88,7 @@ if (f->f_devdata != NULL) devclose(f); f->f_flags = 0; + f->f_udata = NULL; if (err1) { errno = err1; return (-1); Index: src/lib/libstand/open.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/open.c,v retrieving revision 1.6 diff -d -u -r1.6 open.c --- src/lib/libstand/open.c 30 Sep 2001 22:28:01 -0000 1.6 +++ src/lib/libstand/open.c 5 Mar 2002 09:22:00 -0000 @@ -108,6 +108,7 @@ f->f_ops = (struct fs_ops *)0; f->f_offset = 0; f->f_devdata = NULL; + f->f_udata = NULL; file = (char *)0; error = devopen(f, fname, &file); if (error || Index: src/lib/libstand/stand.h =================================================================== RCS file: /home/ncvs/src/lib/libstand/stand.h,v retrieving revision 1.28 diff -d -u -r1.28 stand.h --- src/lib/libstand/stand.h 18 Feb 2002 20:35:19 -0000 1.28 +++ src/lib/libstand/stand.h 5 Mar 2002 09:22:00 -0000 @@ -164,6 +164,7 @@ char *f_rabuf; /* readahead buffer pointer */ size_t f_ralen; /* valid data in readahead buffer */ off_t f_raoffset; /* consumer offset in readahead buffer */ + void *f_udata; /* user data */ #define SOPEN_RASIZE 512 }; Index: src/sys/boot/alpha/libalpha/alpha_copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/alpha/libalpha/alpha_copy.c,v retrieving revision 1.5 diff -d -u -r1.5 alpha_copy.c --- src/sys/boot/alpha/libalpha/alpha_copy.c 3 Aug 2000 09:49:44 -0000 1.5 +++ src/sys/boot/alpha/libalpha/alpha_copy.c 5 Mar 2002 09:22:00 -0000 @@ -33,6 +33,7 @@ #include #include "libalpha.h" +#include "sread.h" ssize_t alpha_copyin(const void *src, vm_offset_t dest, const size_t len) @@ -51,7 +52,7 @@ ssize_t alpha_readin(const int fd, vm_offset_t dest, const size_t len) { - return(read(fd, (void *) dest, len)); + return(sread(fd, (void *) dest, len)); } Index: src/sys/boot/common/Makefile.inc =================================================================== RCS file: /home/ncvs/src/sys/boot/common/Makefile.inc,v retrieving revision 1.12 diff -d -u -r1.12 Makefile.inc --- src/sys/boot/common/Makefile.inc 27 Mar 2001 11:59:21 -0000 1.12 +++ src/sys/boot/common/Makefile.inc 5 Mar 2002 09:22:00 -0000 @@ -2,7 +2,7 @@ SRCS+= bcache.c boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c load_aout.c load_elf.c ls.c misc.c -SRCS+= module.c panic.c +SRCS+= module.c panic.c sread.c .if defined(LOADER_NET_SUPPORT) SRCS+= dev_net.c Index: src/sys/boot/common/boot.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/boot.c,v retrieving revision 1.28 diff -d -u -r1.28 boot.c --- src/sys/boot/common/boot.c 11 Sep 2001 01:09:19 -0000 1.28 +++ src/sys/boot/common/boot.c 5 Mar 2002 09:22:00 -0000 @@ -65,7 +65,7 @@ } /* find/load the kernel module */ - if (mod_loadkld(argv[1], argc - 2, argv + 2) != 0) + if (mod_loadkld(1, argv + 1, argc - 2, argv + 2) != 0) return(CMD_ERROR); /* we have consumed all arguments */ argc = 1; @@ -340,11 +340,11 @@ static int loadakernel(int try, int argc, char* argv[]) { - char *cp; + char *filesv[1]; - for (try = 0; (cp = getbootfile(try)) != NULL; try++) - if (mod_loadkld(cp, argc - 1, argv + 1) != 0) - printf("can't load '%s'\n", cp); + for (try = 0; (filesv[0] = getbootfile(try)) != NULL; try++) + if (mod_loadkld(1, filesv, argc - 1, argv + 1) != 0) + printf("can't load '%s'\n", filesv[0]); else return 1; return 0; Index: src/sys/boot/common/bootstrap.h =================================================================== RCS file: /home/ncvs/src/sys/boot/common/bootstrap.h,v retrieving revision 1.35 diff -d -u -r1.35 bootstrap.h --- src/sys/boot/common/bootstrap.h 25 Feb 2002 04:31:25 -0000 1.35 +++ src/sys/boot/common/bootstrap.h 5 Mar 2002 09:22:00 -0000 @@ -210,7 +210,7 @@ struct file_format { /* Load function must return EFTYPE if it can't handle the module supplied */ - int (* l_load)(char *filename, vm_offset_t dest, struct preloaded_file **result); + int (* l_load)(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result); /* Only a loader that will load a kernel (first module) should have an exec handler */ int (* l_exec)(struct preloaded_file *mp); }; @@ -218,9 +218,8 @@ extern struct file_format *file_formats[]; /* supplied by consumer */ extern struct preloaded_file *preloaded_files; -int mod_load(char *name, struct mod_depend *verinfo, int argc, char *argv[]); -int mod_loadobj(char *type, char *name); -int mod_loadkld(const char *name, int argc, char *argv[]); +int mod_load(int filesc, char *filesv[], struct mod_depend *verinfo, int argc, char *argv[]); +int mod_loadkld(int filesc, char *filesv[], int argc, char *argv[]); struct preloaded_file *file_alloc(void); struct preloaded_file *file_findfile(char *name, char *type); @@ -232,10 +231,10 @@ /* MI module loaders */ -int aout_loadfile(char *filename, vm_offset_t dest, struct preloaded_file **result); +int aout_loadfile(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result); vm_offset_t aout_findsym(char *name, struct preloaded_file *fp); -int elf_loadfile(char *filename, vm_offset_t dest, struct preloaded_file **result); +int elf_loadfile(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result); /* * Support for commands Index: src/sys/boot/common/load_aout.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/load_aout.c,v retrieving revision 1.20 diff -d -u -r1.20 load_aout.c --- src/sys/boot/common/load_aout.c 11 Sep 2001 01:09:19 -0000 1.20 +++ src/sys/boot/common/load_aout.c 5 Mar 2002 09:22:06 -0000 @@ -39,6 +39,7 @@ #include #include "bootstrap.h" +#include "sread.h" static int aout_loadimage(struct preloaded_file *fp, int fd, vm_offset_t loadaddr, struct exec *ehdr, int kernel); @@ -56,7 +57,7 @@ * will be saved in (result). */ int -aout_loadfile(char *filename, vm_offset_t dest, struct preloaded_file **result) +aout_loadfile(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result) { struct preloaded_file *fp, *kfp; struct exec ehdr; @@ -70,11 +71,11 @@ /* * Open the image, read and validate the a.out header */ - if (filename == NULL) /* can't handle nameless */ + if (filesv[0] == NULL) /* can't handle nameless */ return(EFTYPE); - if ((fd = open(filename, O_RDONLY)) == -1) + if ((fd = sopen(filesc, filesv, O_RDONLY)) == -1) return(errno); - if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) { + if (sread(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) { err = EFTYPE; /* could be EIO, but may be small file */ goto oerr; } @@ -132,8 +133,8 @@ */ fp = file_alloc(); if (kernel) - setenv("kernelname", filename, 1); - fp->f_name = strdup(filename); + setenv("kernelname", filesv[0], 1); + fp->f_name = strdup(filesv[0]); fp->f_type = strdup(kernel ? aout_kerneltype : aout_moduletype); /* Page-align the load address */ @@ -145,7 +146,7 @@ } fp->f_addr = addr; /* save the aligned load address */ if (kernel) - printf("%s at %p\n", filename, (void *) addr); + printf("%s at %p\n", filesv[0], (void *) addr); fp->f_size = aout_loadimage(fp, fd, addr, &ehdr, kernel); if (fp->f_size == 0) @@ -170,7 +171,7 @@ oerr: file_discard(fp); out: - close(fd); + sclose(fd); return(err); } @@ -191,7 +192,7 @@ vm_offset_t ssym, esym; addr = loadaddr; - lseek(fd, (off_t)N_TXTOFF(*ehdr), SEEK_SET); + slseek(fd, (off_t)N_TXTOFF(*ehdr), SEEK_SET); /* text segment */ printf(" text=0x%lx ", ehdr->a_text); @@ -232,7 +233,7 @@ addr += ehdr->a_syms; /* string table */ - read(fd, &ss, sizeof(ss)); + sread(fd, &ss, sizeof(ss)); archsw.arch_copyin(&ss, addr, sizeof(ss)); addr += sizeof(ss); ss -= sizeof(ss); Index: src/sys/boot/common/load_elf.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/load_elf.c,v retrieving revision 1.21 diff -d -u -r1.21 load_elf.c --- src/sys/boot/common/load_elf.c 11 Sep 2001 01:09:19 -0000 1.21 +++ src/sys/boot/common/load_elf.c 5 Mar 2002 09:22:06 -0000 @@ -40,6 +40,7 @@ #include #include "bootstrap.h" +#include "sread.h" #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) @@ -76,7 +77,7 @@ * will be saved in (result). */ int -elf_loadfile(char *filename, vm_offset_t dest, struct preloaded_file **result) +elf_loadfile(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result) { struct preloaded_file *fp, *kfp; struct elf_file ef; @@ -91,16 +92,16 @@ /* * Open the image, read and validate the ELF header */ - if (filename == NULL) /* can't handle nameless */ + if (filesv[0] == NULL) /* can't handle nameless */ return(EFTYPE); - if ((ef.fd = open(filename, O_RDONLY)) == -1) + if ((ef.fd = sopen(filesc, filesv, O_RDONLY)) == -1) return(errno); ef.firstpage = malloc(PAGE_SIZE); if (ef.firstpage == NULL) { - close(ef.fd); + sclose(ef.fd); return(ENOMEM); } - bytes_read = read(ef.fd, ef.firstpage, PAGE_SIZE); + bytes_read = sread(ef.fd, ef.firstpage, PAGE_SIZE); ef.firstlen = (size_t)bytes_read; if (bytes_read < 0 || ef.firstlen <= sizeof(Elf_Ehdr)) { err = EFTYPE; /* could be EIO, but may be small file */ @@ -181,15 +182,15 @@ goto out; } if (ef.kernel) - setenv("kernelname", filename, 1); - fp->f_name = strdup(filename); + setenv("kernelname", filesv[0], 1); + fp->f_name = strdup(filesv[0]); fp->f_type = strdup(ef.kernel ? elf_kerneltype : elf_moduletype); #ifdef ELF_VERBOSE if (ef.kernel) - printf("%s entry at %p\n", filename, (void *) dest); + printf("%s entry at %p\n", filesv[0], (void *) dest); #else - printf("%s ", filename); + printf("%s ", filesv[0]); #endif fp->f_size = elf_loadimage(fp, &ef, dest); @@ -211,7 +212,7 @@ out: if (ef.firstpage) free(ef.firstpage); - close(ef.fd); + sclose(ef.fd); return(err); } @@ -289,7 +290,7 @@ phdr[i].p_vaddr + off, fpcopy); } if (phdr[i].p_filesz > fpcopy) { - if (lseek(ef->fd, (off_t)(phdr[i].p_offset + fpcopy), + if (slseek(ef->fd, (off_t)(phdr[i].p_offset + fpcopy), SEEK_SET) == -1) { printf("\nelf_loadexec: cannot seek\n"); goto out; @@ -348,11 +349,11 @@ shdr = malloc(chunk); if (shdr == NULL) goto nosyms; - if (lseek(ef->fd, (off_t)ehdr->e_shoff, SEEK_SET) == -1) { + if (slseek(ef->fd, (off_t)ehdr->e_shoff, SEEK_SET) == -1) { printf("\nelf_loadimage: cannot lseek() to section headers"); goto nosyms; } - result = read(ef->fd, shdr, chunk); + result = sread(ef->fd, shdr, chunk); if (result < 0 || (size_t)result != chunk) { printf("\nelf_loadimage: read section headers failed"); goto nosyms; @@ -418,7 +419,7 @@ printf("0x%lx+0x%lx", (long)sizeof(size), size); #endif - if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { + if (slseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { printf("\nelf_loadimage: could not seek for symbols - skipped!"); lastaddr = ssym; ssym = 0; Index: src/sys/boot/common/loader.8 =================================================================== RCS file: /home/ncvs/src/sys/boot/common/loader.8,v retrieving revision 1.40 diff -d -u -r1.40 loader.8 --- src/sys/boot/common/loader.8 21 Feb 2002 05:15:51 -0000 1.40 +++ src/sys/boot/common/loader.8 5 Mar 2002 09:22:06 -0000 @@ -189,11 +189,21 @@ .Pp .It Ic load Xo .Op Fl t Ar type -.Ar file Cm ... +.Op Fl n Ar N +.Ar file1 +.Op Ar ... fileN +.Cm ... .Xc Loads a kernel, kernel loadable module (kld), or a file of opaque contents tagged as being of the type .Ar type . +If +.Fl n +is specified it loads number of files as a single object joining +them together and prompting for user's confirmation when one of +the files could not be found. +This allows loading a large file from a limited-size media (such +as floppy disks) by splitting the file into smaller pieces. Kernel and modules can be either in a.out or elf format. Any arguments passed after the name of the file to be loaded will be passed as arguments to that file. Index: src/sys/boot/common/module.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/module.c,v retrieving revision 1.22 diff -d -u -r1.22 module.c --- src/sys/boot/common/module.c 16 Nov 2001 21:08:40 -0000 1.22 +++ src/sys/boot/common/module.c 5 Mar 2002 09:22:11 -0000 @@ -38,6 +38,7 @@ #include #include "bootstrap.h" +#include "sread.h" #define MDIR_REMOVED 0x0001 #define MDIR_NOHINTS 0x0002 @@ -50,8 +51,8 @@ STAILQ_ENTRY(moduledir) d_link; }; -static int file_load(char *filename, vm_offset_t dest, struct preloaded_file **result); -static int file_loadraw(char *type, char *name); +static int file_load(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result); +static int file_loadraw(char *type, int filesc, char *filesv[]); static int file_load_dependencies(struct preloaded_file *base_mod); static char * file_search(const char *name, char **extlist); static struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname, struct mod_depend *verinfo); @@ -79,15 +80,15 @@ /* - * load an object, either a disk file or code module. + * load an object, either a disk file(s) or code module. * * To load a file, the syntax is: * - * load -t + * load -t [-n N] ... * * code modules are loaded as: * - * load + * load [-n N] ... */ COMMAND_SET(load, "load", "load a kernel or module", command_load); @@ -96,9 +97,10 @@ command_load(int argc, char *argv[]) { char *typestr; - int dofile, dokld, ch, error; + int dofile, dokld, ch, error, filesc; dokld = dofile = 0; + filesc = 1; optind = 1; optreset = 1; typestr = NULL; @@ -106,11 +108,14 @@ command_errmsg = "no filename specified"; return(CMD_ERROR); } - while ((ch = getopt(argc, argv, "kt:")) != -1) { + while ((ch = getopt(argc, argv, "kn:t:")) != -1) { switch(ch) { case 'k': dokld = 1; break; + case 'n': + filesc = (int)strtol(optarg, (char **)NULL, 10); + break; case 't': typestr = optarg; dofile = 1; @@ -121,34 +126,38 @@ return(CMD_OK); } } - argv += (optind - 1); - argc -= (optind - 1); + argv += optind; + argc -= optind; + if ((filesc <= 0) || (argc < filesc)) { + command_errmsg = "number of slices is missed or invalid"; + return(CMD_ERROR); + } /* * Request to load a raw file? */ if (dofile) { - if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) { + if ((argc != filesc) || (typestr == NULL) || (*typestr == 0)) { command_errmsg = "invalid load type"; return(CMD_ERROR); } - return(file_loadraw(typestr, argv[1])); + return(file_loadraw(typestr, filesc, argv)); } /* * Do we have explicit KLD load ? */ - if (dokld || file_havepath(argv[1])) { - error = mod_loadkld(argv[1], argc - 2, argv + 2); + if (dokld || file_havepath(argv[0]) || (filesc > 1)) { + error = mod_loadkld(filesc, argv, argc - filesc, argv + filesc); if (error == EEXIST) - sprintf(command_errbuf, "warning: KLD '%s' already loaded", argv[1]); + sprintf(command_errbuf, "warning: KLD '%s' already loaded", argv[0]); return (error == 0 ? CMD_OK : CMD_ERROR); } /* * Looks like a request for a module. */ - error = mod_load(argv[1], NULL, argc - 2, argv + 2); + error = mod_load(filesc, argv, NULL, argc - filesc, argv + filesc); if (error == EEXIST) - sprintf(command_errbuf, "warning: module '%s' already loaded", argv[1]); + sprintf(command_errbuf, "warning: module '%s' already loaded", argv[0]); return (error == 0 ? CMD_OK : CMD_ERROR); } @@ -229,7 +238,7 @@ * File level interface, functions file_* */ int -file_load(char *filename, vm_offset_t dest, struct preloaded_file **result) +file_load(int filesc, char *filesv[], vm_offset_t dest, struct preloaded_file **result) { struct preloaded_file *fp; int error; @@ -237,7 +246,7 @@ error = EFTYPE; for (i = 0, fp = NULL; file_formats[i] && fp == NULL; i++) { - error = (file_formats[i]->l_load)(filename, loadaddr, &fp); + error = (file_formats[i]->l_load)(filesc, filesv, loadaddr, &fp); if (error == 0) { fp->f_loader = i; /* remember the loader */ *result = fp; @@ -247,7 +256,7 @@ continue; /* Unknown to this handler? */ if (error) { sprintf(command_errbuf, "can't load file '%s': %s", - filename, strerror(error)); + filesv[0], strerror(error)); break; } } @@ -261,6 +270,7 @@ struct mod_depend *verinfo; struct kernel_module *mp; char *dmodname; + char *filesv[1]; int error; md = file_findmetadata(base_file, MODINFOMD_DEPLIST); @@ -272,7 +282,8 @@ dmodname = (char *)(verinfo + 1); if (file_findmodule(NULL, dmodname, verinfo) == NULL) { printf("loading required module '%s'\n", dmodname); - error = mod_load(dmodname, verinfo, 0, NULL); + filesv[0] = dmodname; + error = mod_load(1, filesv, verinfo, 0, NULL); if (error) break; /* @@ -305,7 +316,7 @@ * no arguments or anything. */ int -file_loadraw(char *type, char *name) +file_loadraw(char *type, int filesc, char *filesv[]) { struct preloaded_file *fp; char *cp; @@ -319,16 +330,16 @@ } /* locate the file on the load path */ - cp = file_search(name, NULL); + cp = file_search(filesv[0], NULL); if (cp == NULL) { - sprintf(command_errbuf, "can't find '%s'", name); + sprintf(command_errbuf, "can't find '%s'", filesv[0]); return(CMD_ERROR); } - name = cp; + filesv[0] = cp; - if ((fd = open(name, O_RDONLY)) < 0) { - sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno)); - free(name); + if ((fd = sopen(filesc, filesv, O_RDONLY)) < 0) { + sprintf(command_errbuf, "can't open '%s': %s", filesv[0], strerror(errno)); + free(filesv[0]); return(CMD_ERROR); } @@ -339,9 +350,9 @@ if (got == 0) /* end of file */ break; if (got < 0) { /* error */ - sprintf(command_errbuf, "error reading '%s': %s", name, strerror(errno)); - free(name); - close(fd); + sprintf(command_errbuf, "error reading '%s': %s", filesv[0], strerror(errno)); + free(filesv[0]); + sclose(fd); return(CMD_ERROR); } laddr += got; @@ -349,7 +360,7 @@ /* Looks OK so far; create & populate control structure */ fp = file_alloc(); - fp->f_name = name; + fp->f_name = filesv[0]; fp->f_type = strdup(type); fp->f_args = NULL; fp->f_metadata = NULL; @@ -362,7 +373,7 @@ /* Add to the list of loaded files */ file_insert_tail(fp); - close(fd); + sclose(fd); return(CMD_OK); } @@ -372,18 +383,18 @@ * If module is already loaded just assign new argc/argv. */ int -mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[]) +mod_load(int filesc, char *filesv[], struct mod_depend *verinfo, int argc, char *argv[]) { struct kernel_module *mp; int err; char *filename; - if (file_havepath(modname)) { - printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname); - return (mod_loadkld(modname, argc, argv)); + if (file_havepath(filesv[0])) { + printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", filesv[0]); + return (mod_loadkld(filesc, filesv, argc, argv)); } /* see if module is already loaded */ - mp = file_findmodule(NULL, modname, verinfo); + mp = file_findmodule(NULL, filesv[0], verinfo); if (mp) { #ifdef moduleargs if (mp->m_args) @@ -394,12 +405,12 @@ return (0); } /* locate file with the module on the search path */ - filename = mod_searchmodule(modname, verinfo); + filename = mod_searchmodule(filesv[0], verinfo); if (filename == NULL) { - sprintf(command_errbuf, "can't find '%s'", modname); + sprintf(command_errbuf, "can't find '%s'", filesv[0]); return (ENOENT); } - err = mod_loadkld(filename, argc, argv); + err = mod_loadkld(filesc, filesv, argc, argv); return (err); } @@ -408,7 +419,7 @@ * search path. */ int -mod_loadkld(const char *kldname, int argc, char *argv[]) +mod_loadkld(int filesc, char *filesv[], int argc, char *argv[]) { struct preloaded_file *fp, *last_file; int err; @@ -417,9 +428,9 @@ /* * Get fully qualified KLD name */ - filename = file_search(kldname, kld_ext_list); + filename = file_search(filesv[0], kld_ext_list); if (filename == NULL) { - sprintf(command_errbuf, "can't find '%s'", kldname); + sprintf(command_errbuf, "can't find '%s'", filesv[0]); return (ENOENT); } /* @@ -437,7 +448,8 @@ ; do { - err = file_load(filename, loadaddr, &fp); + filesv[0] = filename; + err = file_load(filesc, filesv, loadaddr, &fp); if (err) break; fp->f_args = unargv(argc, argv); Index: src/sys/boot/common/sread.c =================================================================== RCS file: src/sys/boot/common/sread.c diff -N src/sys/boot/common/sread.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/sys/boot/common/sread.c 5 Mar 2002 09:22:11 -0000 @@ -0,0 +1,227 @@ +/*- + * Copyright (c) 2002 Maxim Sobolev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * sfiles.c - API for reading sequence of files as if they were a single big + * file. Modeled after standard open()/read()/lseek()/close(). + * Useful for bootstraping a system from a limited-size media, such + * as floppy disks, when one of the files required for + * bootstrapping doesn't fit onto the single media. + * + * API is backward-compatible with file descriptors created using + * ordinary open() - they could with used with s-functions without + * any problems. Please note, however, that the descriptors opened + * with sopen() can't be used with non s-functions. + * + * Please note that for obvious reasons slseek() doesn't support + * SEEK_END and seeking backwards is limited to one slice only. + */ + +#include + +#define NTRIES (3) +#define SLSEEK_BUF (512) + +struct sfiles { + char **filesv; /* Filenames */ + int filesc; /* Number of files */ + int mode; /* sopen() mode */ + int curfile; /* Current file number */ + off_t cur_pos; /* Current offset from the beginning of the sequence */ + off_t file_pos; /* Current offset from the beginning of the slice */ +}; + +int +sopen(int filesc, char *const filesv[], int mode) +{ + int i, fd; + struct sfiles *sfiles; + + if ((fd = open(filesv[0], mode)) == -1) + return (-1); + + /* + * Don't need any extra processing if there is only one file. In this case + * files[fd].f_udata is NULL (ensured by the open()). + */ + if (filesc == 1) + return (fd); + + /* Create and populate sfiles instance */ + sfiles = malloc(sizeof(*sfiles)); + sfiles->filesv = malloc(filesc * sizeof(char *)); + for (i = 0; i < filesc; i++) + sfiles->filesv[i] = strdup(filesv[i]); + sfiles->filesc = filesc; + sfiles->mode = mode; + sfiles->curfile = 0; + sfiles->cur_pos = 0; + sfiles->file_pos = 0; + + (struct sfiles *)files[fd].f_udata = sfiles; + + return (fd); +} + +int +sclose(int fd) +{ + int i; + struct sfiles *sfiles; + + sfiles = (struct sfiles *)files[fd].f_udata; + if (sfiles != NULL) { + /* Destroy sfiles instance */ + for (i = 0; i < sfiles->filesc; i++) + free(sfiles->filesv[i]); + free(sfiles->filesv); + free(sfiles); + files[fd].f_udata = NULL; + } + + return (close(fd)); +} + +int +sread(int fd, void *buf, size_t nbytes) +{ + int i, fd1, nread, totread; + struct sfiles *sfiles; + struct open_file tmp; + + sfiles = (struct sfiles *)files[fd].f_udata; + if (sfiles == NULL) + return (read(fd, buf, nbytes)); + totread = 0; + do { + nread = read(fd, buf, nbytes - totread); + + /* Error */ + if (nread == -1) + return (-1); + + sfiles->cur_pos += nread; + sfiles->file_pos += nread; + totread += nread; + buf += nread; + + /* EOF */ + if ((nread == 0) || (nread < (nbytes - totread))) { + /* Last slice? */ + if (sfiles->curfile == (sfiles->filesc - 1)) + return (nread); + /* Close previous slice */ + if (close(fd) != 0) + return (-1); + sfiles->curfile++; + for (i = 0;; i++) { + fd1 = open(sfiles->filesv[sfiles->curfile], sfiles->mode); + if (fd1 >= 0) + break; + if ((fd1 == -1 && errno != ENOENT) || i == NTRIES) + return (-1); + printf("\nInsert media that contains `%s' and press any key...", \ + sfiles->filesv[sfiles->curfile]); + getchar();putchar('\n'); + } + (struct sfiles *)files[fd1].f_udata = sfiles; + sfiles->file_pos = 0; + if (fd1 != fd) { + tmp = files[fd]; + files[fd] = files[fd1]; + files[fd1] = tmp; + } + } + } while (totread < nbytes); + + return (totread); +} + +off_t +slseek(int fd, off_t offset, int where) +{ + int nread; + struct sfiles *sfiles; + off_t new_pos, seek_by; + + sfiles = (struct sfiles *)files[fd].f_udata; + if (sfiles == NULL) + return (lseek(fd, offset, where)); + + seek_by = 0; + switch (where) { + case SEEK_SET: + seek_by = offset - sfiles->cur_pos; + break; + + case SEEK_CUR: + seek_by = offset; + break; + + case SEEK_END: + panic("slseek(): SEEK_END not supported"); + break; + } + + if (seek_by > 0) { + /* + * Seek forward - implemented using sread(), because otherwise we'll be + * unable to detect that we have crossed slice boundary and hence unable + * to do a long seek crossing that boundary. + */ + void *tmp; + + tmp = malloc(SLSEEK_BUF); + if (tmp == NULL) + return (-1); + + nread = 0; + for (; seek_by > 0; seek_by -= nread) { + nread = sread(fd, tmp, min(seek_by, SLSEEK_BUF)); + if (nread <= 0) + /* Error or EOF */ + break; + } + free(tmp); + if (nread == -1) + return (-1); + } + + if (seek_by != 0) { + /* Seek backward or seek past the boundary of the last slice */ + if (sfiles->file_pos + seek_by < 0) + panic("slseek(): can't seek past the beginning of the slice"); + new_pos = lseek(fd, seek_by, SEEK_CUR); + if (new_pos < 0) + return (-1); + sfiles->cur_pos += new_pos - sfiles->file_pos; + sfiles->file_pos = new_pos; + } + + return (sfiles->cur_pos); +} Index: src/sys/boot/common/sread.h =================================================================== RCS file: src/sys/boot/common/sread.h diff -N src/sys/boot/common/sread.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/sys/boot/common/sread.h 5 Mar 2002 09:22:11 -0000 @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2002 Maxim Sobolev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +extern int sopen(int, char * const *, int); +extern int sclose(int); +extern int sread(int, void *, size_t); +extern off_t slseek(int, off_t, int); Index: src/sys/boot/efi/libefi/copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/efi/libefi/copy.c,v retrieving revision 1.3 diff -d -u -r1.3 copy.c --- src/sys/boot/efi/libefi/copy.c 14 Sep 2001 08:26:00 -0000 1.3 +++ src/sys/boot/efi/libefi/copy.c 5 Mar 2002 09:22:11 -0000 @@ -38,6 +38,8 @@ #include #include +#include "sread.h" + int efi_copyin(void *src, vm_offset_t dest, size_t len) { @@ -65,5 +67,5 @@ BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData, len >> 12, &p); #endif - return (read(fd, (void*) p, len)); + return (sread(fd, (void*) p, len)); } Index: src/sys/boot/i386/libi386/i386_copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/libi386/i386_copy.c,v retrieving revision 1.9 diff -d -u -r1.9 i386_copy.c --- src/sys/boot/i386/libi386/i386_copy.c 3 Aug 2000 09:14:01 -0000 1.9 +++ src/sys/boot/i386/libi386/i386_copy.c 5 Mar 2002 09:22:11 -0000 @@ -35,6 +35,7 @@ #include "libi386.h" #include "btxv86.h" +#include "sread.h" #define READIN_BUF (16 * 1024) @@ -80,7 +81,7 @@ for (resid = len; resid > 0; resid -= got, dest += got) { get = min(chunk, resid); - got = read(fd, buf, get); + got = sread(fd, buf, get); if (got <= 0) break; bcopy(buf, PTOV(dest), (size_t)got); Index: src/sys/boot/i386/libi386/i386_module.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/libi386/i386_module.c,v retrieving revision 1.5 diff -d -u -r1.5 i386_module.c --- src/sys/boot/i386/libi386/i386_module.c 11 Sep 2001 01:09:23 -0000 1.5 +++ src/sys/boot/i386/libi386/i386_module.c 5 Mar 2002 09:22:11 -0000 @@ -44,13 +44,14 @@ i386_autoload(void) { int error; + char *filesv[1] = {"acpi"}; /* XXX use PnP to locate stuff here */ /* autoload ACPI support */ /* XXX should be in 4th keyed off acpi_load */ if ((getenv("acpi_load") && !getenv("hint.acpi.0.disable"))) { - error = mod_load("acpi", NULL, 0, NULL); + error = mod_load(1, filesv, NULL, 0, NULL); if (error != 0) printf("ACPI autoload failed - %s\n", strerror(error)); } Index: src/sys/boot/ia64/libski/copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ia64/libski/copy.c,v retrieving revision 1.1 diff -d -u -r1.1 copy.c --- src/sys/boot/ia64/libski/copy.c 12 Sep 2001 08:34:26 -0000 1.1 +++ src/sys/boot/ia64/libski/copy.c 5 Mar 2002 09:22:11 -0000 @@ -38,6 +38,8 @@ #include +#include "sread.h" + int ski_copyin(void *src, vm_offset_t dest, size_t len) { @@ -55,5 +57,5 @@ int ski_readin(int fd, vm_offset_t dest, size_t len) { - return (read(fd, (void*) IA64_RR_MASK(dest), len)); + return (sread(fd, (void*) IA64_RR_MASK(dest), len)); } Index: src/sys/boot/ofw/libofw/ofw_copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/ofw_copy.c,v retrieving revision 1.10 diff -d -u -r1.10 ofw_copy.c --- src/sys/boot/ofw/libofw/ofw_copy.c 7 Oct 2001 13:27:27 -0000 1.10 +++ src/sys/boot/ofw/libofw/ofw_copy.c 5 Mar 2002 09:22:11 -0000 @@ -33,6 +33,7 @@ #include #include "libofw.h" +#include "sread.h" #define READIN_BUF (4 * 1024) @@ -69,7 +70,7 @@ for (resid = len; resid > 0; resid -= got, p += got) { get = min(chunk, resid); - got = read(fd, buf, get); + got = sread(fd, buf, get); if (got <= 0) { printf("ofw_readin: read failed\n"); Index: src/sys/boot/sparc64/loader/main.c =================================================================== RCS file: /home/ncvs/src/sys/boot/sparc64/loader/main.c,v retrieving revision 1.6 diff -d -u -r1.6 main.c --- src/sys/boot/sparc64/loader/main.c 1 Mar 2002 06:17:28 -0000 1.6 +++ src/sys/boot/sparc64/loader/main.c 5 Mar 2002 09:22:11 -0000 @@ -37,6 +37,7 @@ #include "bootstrap.h" #include "libofw.h" #include "dev_net.h" +#include "sread.h" enum { HEAPVA = 0x800000, @@ -193,7 +194,7 @@ sparc64_readin(const int fd, vm_offset_t va, const size_t len) { mmu_mapin(va, len); - return read(fd, (void *)va, len); + return sread(fd, (void *)va, len); } static ssize_t --------------C69442EE275E6B52E76568F1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Mar 5 2:56: 6 2002 Delivered-To: freebsd-audit@freebsd.org Received: from columbus.cris.net (columbus.cris.net [212.110.128.65]) by hub.freebsd.org (Postfix) with ESMTP id 991ED37B402 for ; Tue, 5 Mar 2002 02:56:00 -0800 (PST) Received: from ark.cris.net (ark.cris.net [212.110.128.68]) by columbus.cris.net (8.9.3/8.9.3) with ESMTP id MAA40614; Tue, 5 Mar 2002 12:55:55 +0200 (EET) Received: (from phantom@localhost) by ark.cris.net (8.11.1/8.11.1) id g25AtmN97151; Tue, 5 Mar 2002 12:55:48 +0200 (EET) Date: Tue, 5 Mar 2002 12:55:48 +0200 From: Alexey Zelkin To: "Andrey A. Chernov" Cc: audit@FreeBSD.org Subject: Re: safety checking for catgets (NLS catalogs) Message-ID: <20020305125548.A92735@ark.cris.net> References: <20020302202437.A1078@gate.sim.ionidea.com> <20020302184656.GA32218@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20020302184656.GA32218@nagual.pp.ru>; from ache@nagual.pp.ru on Sat, Mar 02, 2002 at 09:46:57PM +0300 X-Operating-System: FreeBSD 3.5-STABLE i386 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hi, On Sat, Mar 02, 2002 at 09:46:57PM +0300, Andrey A. Chernov wrote: > I dislike whole idea, it just add yet one runtime slowness. Yes it adds small overhead. Actually I think it was not good idea to add this check each time on catgets() and will move this check to catalog loading stage. > Suser programs > authors should just check their translations more accurately. We can't guarantee accuratness of all third party authors :-( And what about case when host was compromised ? > Better way to solve it is to add external check tool to run through all > existen catalogs for given program, do it once and not each run time. I don't think that it's good idea, since this require adding new tool into base system and it's not guaranteed that people will use it. Actually runtime check is much more accurate in this case. As I noted before it will be moved to loading stage and will not add any slownes to runtime behaviour. > Translation strings are per program version constants and not changed each > run time, so there is absolutely no needs to check them each run time. I've tried to design check procedure as simple as possible and it's quite fast in my opinion. At least in this case we can guarantee that incorrectly translated or stale strings from catalog will not affect application work. > On Sat, Mar 02, 2002 at 20:24:37 +0200, Alexey Zelkin wrote: > > > + while (*src != '\0' && *dflt != '\0') { > > + while (1) { > > + if (*dflt != *src) > > + return (1); > > + if (strchr(VALID_CONV_SPECIFIERS, *dflt)) > > *dflt can be '\0' here and strchr() will succeed. > > > + break; > > + src++; > > + dflt++; > > + } > > -- > Andrey A. Chernov > http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Mar 5 3: 7:25 2002 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 9659937B400; Tue, 5 Mar 2002 03:07:21 -0800 (PST) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.2/8.12.2) with ESMTP id g25B75Yl077921; Tue, 5 Mar 2002 14:07:16 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.2/8.12.2/Submit) id g25B72RW077920; Tue, 5 Mar 2002 14:07:03 +0300 (MSK) Date: Tue, 5 Mar 2002 14:07:01 +0300 From: "Andrey A. Chernov" To: Alexey Zelkin Cc: audit@FreeBSD.ORG Subject: Re: safety checking for catgets (NLS catalogs) Message-ID: <20020305110659.GA77856@nagual.pp.ru> References: <20020302202437.A1078@gate.sim.ionidea.com> <20020302184656.GA32218@nagual.pp.ru> <20020305125548.A92735@ark.cris.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020305125548.A92735@ark.cris.net> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Mar 05, 2002 at 12:55:48 +0200, Alexey Zelkin wrote: > Actually I think it was not good idea to > add this check each time on catgets() and will move this check to > catalog loading stage. Ok, I could live with that. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Mar 5 7:53:57 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mail11.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by hub.freebsd.org (Postfix) with ESMTP id 4C6EE37B425 for ; Tue, 5 Mar 2002 07:52:23 -0800 (PST) Received: (qmail 25636 invoked from network); 5 Mar 2002 15:52:13 -0000 Received: from unknown (HELO server.baldwin.cx) ([65.91.137.49]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 5 Mar 2002 15:52:13 -0000 Received: from laptop.baldwin.cx (john@laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g25Fq0G57090; Tue, 5 Mar 2002 10:52:00 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3C84974D.37F683BD@FreeBSD.org> Date: Tue, 05 Mar 2002 10:51:48 -0500 (EST) From: John Baldwin To: Maxim Sobolev Subject: RE: Extending loader(8) for loading kerels/modules split across Cc: re@FreeBSD.org, audit@FreeBSD.org, hackers@FreeBSD.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 05-Mar-02 Maxim Sobolev wrote: > Hi folks, > > Please review attached patch, which adds long overdue feature to our > loader(8), allowing it to load sequence of files as a single object. > This should allow us to lift 1.44M limit on compressed kernel for the > installation diskette. Please note, that to use this feature to load > gzip-compressed objects you need to split the object first and then > compress each piece individually, not compress first and then split > already compressed file. Therefore tight fitting of each piece to the > 1.44M limit could be a little tricky, but not impossible. Other way > around is to use kgzip(8) utility to compress kernel and then split it > into pieces 1.44M each. > > If there are no objections I would like to commit it ASAP, so that our > RE team is able to use this feature in the forthcoming 5.0-DP1 > release. > > Any feedback is appreciated. Looks good to me I guess. :) Do you have an example loader.conf that can be used on the floppies to demonstrate it? > -Maxim -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Mar 5 9: 9:14 2002 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id B5AC137B400; Tue, 5 Mar 2002 09:09:02 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id TAA27722; Tue, 5 Mar 2002 19:08:57 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h73.227.dialup.iptcom.net [212.9.227.73]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id TAA24544; Tue, 5 Mar 2002 19:08:54 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id g25H7TB04366; Tue, 5 Mar 2002 19:07:29 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C84FB80.A609FD3E@FreeBSD.org> Date: Tue, 05 Mar 2002 19:08:16 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: John Baldwin Cc: re@FreeBSD.org, audit@FreeBSD.org, hackers@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across References: Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG John Baldwin wrote: > > On 05-Mar-02 Maxim Sobolev wrote: > > Hi folks, > > > > Please review attached patch, which adds long overdue feature to our > > loader(8), allowing it to load sequence of files as a single object. > > This should allow us to lift 1.44M limit on compressed kernel for the > > installation diskette. Please note, that to use this feature to load > > gzip-compressed objects you need to split the object first and then > > compress each piece individually, not compress first and then split > > already compressed file. Therefore tight fitting of each piece to the > > 1.44M limit could be a little tricky, but not impossible. Other way > > around is to use kgzip(8) utility to compress kernel and then split it > > into pieces 1.44M each. > > > > If there are no objections I would like to commit it ASAP, so that our > > RE team is able to use this feature in the forthcoming 5.0-DP1 > > release. > > > > Any feedback is appreciated. > > Looks good to me I guess. :) Do you have an example loader.conf that can be > used on the floppies to demonstrate it? You probably meant loader.rc? Very simple: load -n3 /kernel /kernel.1 /kernel.2 This will load kernel out of 3 pieces - they could be either /kernel, /kernel.1 and /kernel.2 or /kernel.gz, /kernel.1.gz and /kernel.2.gz or any combination of those. Just as an example I've split stock kern.flp image from 4.5-RELEASE into two images - they could be downloaded from http://people.freebsd.org/~sobomax/kern.flp.bz2 and http://people.freebsd.org/~sobomax/kern1.flp.bz2. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Mar 6 4:45:18 2002 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 40A1837B405; Wed, 6 Mar 2002 04:45:15 -0800 (PST) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.2/8.12.2) with ESMTP id g26CiuYl099877; Wed, 6 Mar 2002 15:45:05 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.2/8.12.2/Submit) id g26Cis8B099876; Wed, 6 Mar 2002 15:44:54 +0300 (MSK) Date: Wed, 6 Mar 2002 15:44:52 +0300 From: "Andrey A. Chernov" To: Alexey Zelkin Cc: audit@FreeBSD.ORG Subject: Re: safety checking for catgets (NLS catalogs) Message-ID: <20020306124449.GB99728@nagual.pp.ru> References: <20020302202437.A1078@gate.sim.ionidea.com> <20020302184656.GA32218@nagual.pp.ru> <20020305125548.A92735@ark.cris.net> <20020305110659.GA77856@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020305110659.GA77856@nagual.pp.ru> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Mar 05, 2002 at 14:07:01 +0300, Andrey A. Chernov wrote: > On Tue, Mar 05, 2002 at 12:55:48 +0200, Alexey Zelkin wrote: > > > Actually I think it was not good idea to > > add this check each time on catgets() and will move this check to > > catalog loading stage. > > Ok, I could live with that. On second thought, not quite so. catgets() not load whole message catalog once but do it part-by-part. It means, that if I want small string from one section, whole section will be scanned, and if I want another one from another section, it will be scanned too, and it repeats. It means that sections list must be maintained indicating which sections are already scanned and which are not yet. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Mar 6 6:21:24 2002 Delivered-To: freebsd-audit@freebsd.org Received: from columbus.cris.net (columbus.cris.net [212.110.128.65]) by hub.freebsd.org (Postfix) with ESMTP id 153C237B400 for ; Wed, 6 Mar 2002 06:21:16 -0800 (PST) Received: from ark.cris.net (ns2.cris.net [212.110.128.68]) by columbus.cris.net (8.9.3/8.9.3) with ESMTP id QAA87903; Wed, 6 Mar 2002 16:21:07 +0200 (EET) Received: (from phantom@localhost) by ark.cris.net (8.11.1/8.11.1) id g26EKdl77929; Wed, 6 Mar 2002 16:20:39 +0200 (EET) Date: Wed, 6 Mar 2002 16:20:39 +0200 From: Alexey Zelkin To: "Andrey A. Chernov" Cc: audit@FreeBSD.ORG Subject: Re: safety checking for catgets (NLS catalogs) Message-ID: <20020306162039.A77231@ark.cris.net> References: <20020302202437.A1078@gate.sim.ionidea.com> <20020302184656.GA32218@nagual.pp.ru> <20020305125548.A92735@ark.cris.net> <20020305110659.GA77856@nagual.pp.ru> <20020306124449.GB99728@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20020306124449.GB99728@nagual.pp.ru>; from ache@nagual.pp.ru on Wed, Mar 06, 2002 at 03:44:52PM +0300 X-Operating-System: FreeBSD 3.5-STABLE i386 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hi, On Wed, Mar 06, 2002 at 03:44:52PM +0300, Andrey A. Chernov wrote: > On Tue, Mar 05, 2002 at 14:07:01 +0300, Andrey A. Chernov wrote: > > On Tue, Mar 05, 2002 at 12:55:48 +0200, Alexey Zelkin wrote: > > > > > Actually I think it was not good idea to > > > add this check each time on catgets() and will move this check to > > > catalog loading stage. > > > > Ok, I could live with that. > > On second thought, not quite so. > > catgets() not load whole message catalog once but do it part-by-part. It > means, that if I want small string from one section, whole section will be > scanned, and if I want another one from another section, it will be > scanned too, and it repeats. It means that sections list must be > maintained indicating which sections are already scanned and which are not > yet. I see no reason to scan whole set if only one string is loaded. It will be checked once. If retrived from message catalog string is unsafe it will be freed from pre-loaded catalog and marked as unsafe and should not be tried to load again. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Mar 6 6:36:37 2002 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id B29A337B416; Wed, 6 Mar 2002 06:36:28 -0800 (PST) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.2/8.12.2) with ESMTP id g26EaEYl001309; Wed, 6 Mar 2002 17:36:21 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.2/8.12.2/Submit) id g26Ea8G4001308; Wed, 6 Mar 2002 17:36:09 +0300 (MSK) Date: Wed, 6 Mar 2002 17:36:05 +0300 From: "Andrey A. Chernov" To: Alexey Zelkin Cc: audit@FreeBSD.ORG Subject: Re: safety checking for catgets (NLS catalogs) Message-ID: <20020306143603.GA1145@nagual.pp.ru> References: <20020302202437.A1078@gate.sim.ionidea.com> <20020302184656.GA32218@nagual.pp.ru> <20020305125548.A92735@ark.cris.net> <20020305110659.GA77856@nagual.pp.ru> <20020306124449.GB99728@nagual.pp.ru> <20020306162039.A77231@ark.cris.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020306162039.A77231@ark.cris.net> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Mar 06, 2002 at 16:20:39 +0200, Alexey Zelkin wrote: > I see no reason to scan whole set if only one string is loaded. It will > be checked once. If retrived from message catalog string is unsafe it will > be freed from pre-loaded catalog and marked as unsafe and should not be tried > to load again. 1) Only one string can't be loaded, whole set is loaded in any case, as I see. 2) If the string will be checked once (on output) and this fact is remembered somewhere inside set, it will be lost when next set is loaded, so recheck required when this set will be loaded again. Only one set can be currently active. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 1: 0:52 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 96E6B37B402; Thu, 7 Mar 2002 01:00:47 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g2790Ha04392; Thu, 7 Mar 2002 01:00:17 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203070900.g2790Ha04392@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Maxim Sobolev Cc: hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Tue, 05 Mar 2002 12:00:45 +0200." <3C84974D.37F683BD@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 01:00:17 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Please review attached patch, which adds long overdue feature to our > loader(8), allowing it to load sequence of files as a single object. I don't like this. I would much rather see support for 'split' files implemented as a stacking filesystem layer like the gzip support, with the simple recognition of 'foo.gz.aa' as the first part of a split version of 'foo.gz', which in turn is recognised as a compressed version of 'foo'. Making all these changes to parts of the loader that should never know about split files is a bad idea; please don't do it. The "right" approach will be easier and cleaner. Regards, Mike -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 1:21:46 2002 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id 02EB137B417; Thu, 7 Mar 2002 01:21:34 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id LAA93625; Thu, 7 Mar 2002 11:21:25 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h209.229.dialup.iptcom.net [212.9.229.209]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id LAA52776; Thu, 7 Mar 2002 11:21:21 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id g279KAB10343; Thu, 7 Mar 2002 11:20:10 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C8730FC.E88F85B4@FreeBSD.org> Date: Thu, 07 Mar 2002 11:21:00 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Michael Smith Cc: hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203070900.g2790Ha04392@mass.dis.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Smith wrote: > > > Please review attached patch, which adds long overdue feature to our > > loader(8), allowing it to load sequence of files as a single object. > > I don't like this. I would much rather see support for 'split' files > implemented as a stacking filesystem layer like the gzip support, with > the simple recognition of 'foo.gz.aa' as the first part of a split > version of 'foo.gz', which in turn is recognised as a compressed version > of 'foo'. I am curious how in this case the layer is going to know how many parts the file contains? -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 1:41: 7 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 747CB37B402; Thu, 7 Mar 2002 01:41:00 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g279eTa04750; Thu, 7 Mar 2002 01:40:30 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203070940.g279eTa04750@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Maxim Sobolev Cc: Michael Smith , hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Thu, 07 Mar 2002 11:21:00 +0200." <3C8730FC.E88F85B4@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 01:40:29 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > > Please review attached patch, which adds long overdue feature to our > > > loader(8), allowing it to load sequence of files as a single object. > > > > I don't like this. I would much rather see support for 'split' files > > implemented as a stacking filesystem layer like the gzip support, with > > the simple recognition of 'foo.gz.aa' as the first part of a split > > version of 'foo.gz', which in turn is recognised as a compressed version > > of 'foo'. > > I am curious how in this case the layer is going to know how many > parts the file contains? The simple way to do it is to keep asking for more parts until there are no more. You can take the NetBSD approach of wrapping the file in a multipart tar archive. Or a more elegant method involves the use of a control file. eg. the splitfs code, when asked to open "foo" looks for "foo.split" which is a text file containing a list of filenames and media names, eg. foo.aa "Kernel floppy 1" foo.ab "Kernel floppy 2" foo.ac "Kernel and modules floppy" For each file segment, the process is: - try to open the file - prompt "please insert the disk labelled '" - try to open the file - return error At any rate, my key point is that the splitting should be invisible, and *definitely* not pushed up into the loader. -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 4:17:45 2002 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id 943E537B404; Thu, 7 Mar 2002 04:17:21 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id OAA14827; Thu, 7 Mar 2002 14:17:16 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h74.228.dialup.iptcom.net [212.9.228.74]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id OAA52147; Thu, 7 Mar 2002 14:17:14 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id g27CGhB12330; Thu, 7 Mar 2002 14:16:43 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3C875A5C.53949862@FreeBSD.org> Date: Thu, 07 Mar 2002 14:17:32 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Michael Smith Cc: hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203070940.g279eTa04750@mass.dis.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Smith wrote: > > > > > Please review attached patch, which adds long overdue feature to our > > > > loader(8), allowing it to load sequence of files as a single object. > > > > > > I don't like this. I would much rather see support for 'split' files > > > implemented as a stacking filesystem layer like the gzip support, with > > > the simple recognition of 'foo.gz.aa' as the first part of a split > > > version of 'foo.gz', which in turn is recognised as a compressed version > > > of 'foo'. > > > > I am curious how in this case the layer is going to know how many > > parts the file contains? > > The simple way to do it is to keep asking for more parts until there are > no more. > > You can take the NetBSD approach of wrapping the file in a multipart tar > archive. > > Or a more elegant method involves the use of a control file. > > eg. the splitfs code, when asked to open "foo" looks for "foo.split" > which is a text file containing a list of filenames and media names, eg. > > foo.aa "Kernel floppy 1" > foo.ab "Kernel floppy 2" > foo.ac "Kernel and modules floppy" > > For each file segment, the process is: > > - try to open the file > - prompt "please insert the disk labelled '" > - try to open the file > - return error > > At any rate, my key point is that the splitting should be invisible, and > *definitely* not pushed up into the loader. Ok, sounds reasonably. I'll try to reimplement the feature this way. Thank you for suggestion. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 9:50:43 2002 Delivered-To: freebsd-audit@freebsd.org Received: from harrier.prod.itd.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by hub.freebsd.org (Postfix) with ESMTP id 0F78C37B429; Thu, 7 Mar 2002 09:50:31 -0800 (PST) Received: from pool0314.cvx21-bradley.dialup.earthlink.net ([209.179.193.59] helo=mindspring.com) by harrier.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16j22A-0005aJ-00; Thu, 07 Mar 2002 09:50:30 -0800 Message-ID: <3C87A856.E222EDD3@mindspring.com> Date: Thu, 07 Mar 2002 09:50:14 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Maxim Sobolev Cc: Michael Smith , hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203070900.g2790Ha04392@mass.dis.org> <3C8730FC.E88F85B4@FreeBSD.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Maxim Sobolev wrote: > Michael Smith wrote: > > > Please review attached patch, which adds long overdue feature to our > > > loader(8), allowing it to load sequence of files as a single object. > > > > I don't like this. I would much rather see support for 'split' files > > implemented as a stacking filesystem layer like the gzip support, with > > the simple recognition of 'foo.gz.aa' as the first part of a split > > version of 'foo.gz', which in turn is recognised as a compressed version > > of 'foo'. > > I am curious how in this case the layer is going to know how many > parts the file contains? I'm curious how you're going to get the code to execute to do this layering, when it's spread across three floppy images. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 10:38:53 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 0C35637B416; Thu, 7 Mar 2002 10:38:35 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g27Ic4s01239; Thu, 7 Mar 2002 10:38:04 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203071838.g27Ic4s01239@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Maxim Sobolev Cc: Michael Smith , hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Thu, 07 Mar 2002 14:17:32 +0200." <3C875A5C.53949862@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 10:38:04 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > At any rate, my key point is that the splitting should be invisible, and > > *definitely* not pushed up into the loader. > > Ok, sounds reasonably. I'll try to reimplement the feature this way. > > Thank you for suggestion. Thanks for doing the real work! = Mike -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 10:49:23 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 1A4D237B404; Thu, 7 Mar 2002 10:49:15 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g27Imgs01327; Thu, 7 Mar 2002 10:48:42 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203071848.g27Imgs01327@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Terry Lambert Cc: Maxim Sobolev , Michael Smith , hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Thu, 07 Mar 2002 09:50:14 PST." <3C87A856.E222EDD3@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 10:48:42 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > > I don't like this. I would much rather see support for 'split' files > > > implemented as a stacking filesystem layer like the gzip support, with > > > the simple recognition of 'foo.gz.aa' as the first part of a split > > > version of 'foo.gz', which in turn is recognised as a compressed version > > > of 'foo'. > > > > I am curious how in this case the layer is going to know how many > > parts the file contains? > > I'm curious how you're going to get the code to execute > to do this layering, when it's spread across three floppy > images. I'm curious to know what you think you're doing getting into yet another discussion about something you don't understand. Which is about the best answer I can offer to your question, since it's otherwise a non sequiter. -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 11:26:20 2002 Delivered-To: freebsd-audit@freebsd.org Received: from snipe.prod.itd.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id 4B87737B404; Thu, 7 Mar 2002 11:25:41 -0800 (PST) Received: from pool0314.cvx21-bradley.dialup.earthlink.net ([209.179.193.59] helo=mindspring.com) by snipe.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16j3WF-00006q-00; Thu, 07 Mar 2002 11:25:40 -0800 Message-ID: <3C87BEA3.452B8860@mindspring.com> Date: Thu, 07 Mar 2002 11:25:23 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Michael Smith Cc: Maxim Sobolev , hackers@FreeBSD.org, audit@FreeBSD.org, re@FreeBSD.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203071848.g27Imgs01327@mass.dis.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Smith wrote: > > > > I don't like this. I would much rather see support for 'split' files > > > > implemented as a stacking filesystem layer like the gzip support, with > > > > the simple recognition of 'foo.gz.aa' as the first part of a split > > > > version of 'foo.gz', which in turn is recognised as a compressed version > > > > of 'foo'. > > > > > > I am curious how in this case the layer is going to know how many > > > parts the file contains? > > > > I'm curious how you're going to get the code to execute > > to do this layering, when it's spread across three floppy > > images. > > I'm curious to know what you think you're doing getting into yet another > discussion about something you don't understand. Which is about the best > answer I can offer to your question, since it's otherwise a non sequiter. I guess it was your use of "a stacking filesystem layer" that made me thing you were stacking filesystem layers. Sorry if this wasn't clear to you. I guess what you really meant to say was that you wanted it pounded into the file I/O in libstand, rather than saying that you wanted it in a stacking layer? It wasn't clear that what you meant was not what you said until you replied with your scheme to the same posting which I replied to. It would be nice if you didn't rip people a new one, merely because you had replied to the same message they replied to earlier, and they didn't have the information clarifying the original post at the time they made theirs. It would be particularly nice, considering it was your statements that required the clarification in the first place. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 11:46:11 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id B884D37B405; Thu, 7 Mar 2002 11:46:06 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g27JjXs01815; Thu, 7 Mar 2002 11:45:33 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203071945.g27JjXs01815@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Terry Lambert Cc: Michael Smith , Maxim Sobolev , hackers@freebsd.org, audit@freebsd.org, re@freebsd.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Thu, 07 Mar 2002 11:25:23 PST." <3C87BEA3.452B8860@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 11:45:33 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Michael Smith wrote: > > > > > I don't like this. I would much rather see support for 'split' files > > > > > implemented as a stacking filesystem layer like the gzip support, wit > h > > > > > the simple recognition of 'foo.gz.aa' as the first part of a split > > > > > version of 'foo.gz', which in turn is recognised as a compressed vers > ion > > > > > of 'foo'. > > > > > > > > I am curious how in this case the layer is going to know how many > > > > parts the file contains? > > > > > > I'm curious how you're going to get the code to execute > > > to do this layering, when it's spread across three floppy > > > images. > > > > I'm curious to know what you think you're doing getting into yet another > > discussion about something you don't understand. Which is about the best > > answer I can offer to your question, since it's otherwise a non sequiter. > > I guess it was your use of "a stacking filesystem layer" that > made me thing you were stacking filesystem layers. Oddly enough, that's exactly what I'm doing, or more accurately, asking Maxim to do. Should you care to be informed rather than playing from the sidelines, see the primitive 'stacking' used to implement transparent gzipped file support in libstand. -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 11:58:33 2002 Delivered-To: freebsd-audit@freebsd.org Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by hub.freebsd.org (Postfix) with ESMTP id 945B637B43B; Thu, 7 Mar 2002 11:58:09 -0800 (PST) Received: from pool0314.cvx21-bradley.dialup.earthlink.net ([209.179.193.59] helo=mindspring.com) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 16j41g-0006Gh-00; Thu, 07 Mar 2002 11:58:09 -0800 Message-ID: <3C87C640.E26DE955@mindspring.com> Date: Thu, 07 Mar 2002 11:57:52 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Michael Smith Cc: Maxim Sobolev , hackers@freebsd.org, audit@freebsd.org, re@freebsd.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203071945.g27JjXs01815@mass.dis.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Smith wrote: > Should you care to be informed rather than playing from the sidelines, > see the primitive 'stacking' used to implement transparent gzipped file > support in libstand. The only place this is referred to as a "stack" at all is in one comment in the libstand.3 man page, which hardly excuses you ripping me a new one. The source code in zipfs.c itself *certainly* doesn't call it that in comments. Also the way the operations are encapsulated (not stacked, since a stack could be reordered) is by directly calling "read", rather than calling through a "stack". This basically means that the reassembly order means that you would have to call the reassembly both at the read and the zfread, so that you could handle multipart for both cases of uncompressed and compressed multipart files. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 12:17:12 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 574A637B402; Thu, 7 Mar 2002 12:17:04 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g27KGVs02007; Thu, 7 Mar 2002 12:16:31 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203072016.g27KGVs02007@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Terry Lambert Cc: Michael Smith , Maxim Sobolev , hackers@freebsd.org, audit@freebsd.org, re@freebsd.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks In-reply-to: Your message of "Thu, 07 Mar 2002 11:57:52 PST." <3C87C640.E26DE955@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 12:16:31 -0800 From: Michael Smith Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Michael Smith wrote: > > Should you care to be informed rather than playing from the sidelines, > > see the primitive 'stacking' used to implement transparent gzipped file > > support in libstand. > > The only place this is referred to as a "stack" at all is in > one comment in the libstand.3 man page, which hardly excuses > you ripping me a new one. So because I called it a "stack" I *must* have been referring to the kernel, not actually the loader (since that's only mentioned in the subject line and implicitly throughout my message)? Get real, Terry. > Also the way the operations are encapsulated (not stacked, > since a stack could be reordered) is by directly calling > "read", rather than calling through a "stack". This is an implementation detail. -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 12:48:38 2002 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id 223EA37B417 for ; Thu, 7 Mar 2002 12:48:34 -0800 (PST) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.33 #1) id 16j4rl-000Ogp-00; Thu, 07 Mar 2002 22:51:57 +0200 From: Sheldon Hearn To: Mark Murray Cc: audit@freebsd.org Subject: Re: kernel; lint and other warns. Review? In-reply-to: Your message of "Sun, 03 Mar 2002 21:17:12 GMT." <200203032117.g23LHCRV002897@grimreaper.grondar.org> Date: Thu, 07 Mar 2002 22:51:57 +0200 Message-ID: <94910.1015534317@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 03 Mar 2002 21:17:12 GMT, Mark Murray wrote: > Please review the enclosed diffs. they are intended to make no > functional difference other than fixing lint warnings. If you're wondering why nobody responded, you didn't actually enclose anything. :-) Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 13: 5:56 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id ADB7E37B404 for ; Thu, 7 Mar 2002 13:05:51 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g27L5oN61652; Thu, 7 Mar 2002 21:05:50 GMT (envelope-from mark@grimreaper.grondar.za) Received: from grimreaper (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.2/8.12.2) with ESMTP id g27L4sRV081859; Thu, 7 Mar 2002 21:04:54 GMT (envelope-from mark@grimreaper.grondar.za) Message-Id: <200203072104.g27L4sRV081859@grimreaper.grondar.org> To: Sheldon Hearn Cc: Mark Murray , audit@freebsd.org Subject: Re: kernel; lint and other warns. Review? References: <94910.1015534317@axl.seasidesoftware.co.za> In-Reply-To: <94910.1015534317@axl.seasidesoftware.co.za> ; from Sheldon Hearn "Thu, 07 Mar 2002 22:51:57 +0200." Date: Thu, 07 Mar 2002 21:04:54 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > On Sun, 03 Mar 2002 21:17:12 GMT, Mark Murray wrote: > > > Please review the enclosed diffs. they are intended to make no > > functional difference other than fixing lint warnings. > > If you're wondering why nobody responded, you didn't actually enclose > anything. :-) See the follow-up message. If you are going to reply to old(-ish) mail, at least clear your mailbox before you do so. :-) M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 13:23:39 2002 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id 4BE5337B400 for ; Thu, 7 Mar 2002 13:23:34 -0800 (PST) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.33 #1) id 16j5Pn-000Ok4-00; Thu, 07 Mar 2002 23:27:07 +0200 From: Sheldon Hearn To: Mark Murray Cc: audit@freebsd.org Subject: Re: kernel; lint and other warns. Review? In-reply-to: Your message of "Thu, 07 Mar 2002 21:04:54 GMT." <200203072104.g27L4sRV081859@grimreaper.grondar.org> Date: Thu, 07 Mar 2002 23:27:07 +0200 Message-ID: <95111.1015536427@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 07 Mar 2002 21:04:54 GMT, Mark Murray wrote: > See the follow-up message. Ooops, I only looked for messages with the same subject line. :-) Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Mar 7 14: 3:52 2002 Delivered-To: freebsd-audit@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id A79E637B402; Thu, 7 Mar 2002 14:03:47 -0800 (PST) Received: from pool0584.cvx40-bradley.dialup.earthlink.net ([216.244.44.74] helo=mindspring.com) by albatross.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16j5zG-00077v-00; Thu, 07 Mar 2002 14:03:47 -0800 Message-ID: <3C87E3B1.E1443DFF@mindspring.com> Date: Thu, 07 Mar 2002 14:03:29 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Michael Smith Cc: Maxim Sobolev , hackers@freebsd.org, audit@freebsd.org, re@freebsd.org Subject: Re: Extending loader(8) for loading kerels/modules split across several disks References: <200203072016.g27KGVs02007@mass.dis.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Smith wrote: > > The only place this is referred to as a "stack" at all is in > > one comment in the libstand.3 man page, which hardly excuses > > you ripping me a new one. > > So because I called it a "stack" I *must* have been referring to the > kernel, not actually the loader (since that's only mentioned in the > subject line and implicitly throughout my message)? > > Get real, Terry. So I asked a question in a humorous fashion because what you said didn't make sense to me, I must be a dolt. Get real, Michael. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Mar 9 11:57:17 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id D9EDE37B400 for ; Sat, 9 Mar 2002 11:57:14 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g29JvDVu106624 for ; Sat, 9 Mar 2002 14:57:13 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: Date: Sat, 9 Mar 2002 14:57:12 -0500 To: freebsd-audit@freebsd.org From: Garance A Drosihn Subject: Fix for login.c in current Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG For some reason I often manage to mistype my super-clever root password. On freebsd-current the syslog error message for login failures is screwed-up. A tricky interaction happens in the section: if (olduser != NULL) free(olduser); olduser = username; The problem is that at this point olduser is *already* equal to username (the pointer is exactly the same), so the first part is free-ing both olduser and username, and then sets olduser to the already-freed area. In my testing, the simple fix is: Index: login.c =================================================================== RCS file: /home/ncvs/src/usr.bin/login/login.c,v retrieving revision 1.81 diff -u -r1.81 login.c --- login.c 5 Mar 2002 21:56:06 -0000 1.81 +++ login.c 9 Mar 2002 19:36:19 -0000 @@ -284,7 +284,6 @@ if (failures > (pwd ? 0 : 1)) badlogin(olduser); } - olduser = username; /* * Load the PAM policy and set some variables The earlier section of code will set olduser when it needs to be set, so there was no need for the line I'm deleting here. Anyone see a problem if I commit this? -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Mar 9 12:34:50 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id BEDF637B404; Sat, 9 Mar 2002 12:34:44 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g29KYhVu137732; Sat, 9 Mar 2002 15:34:43 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Sat, 9 Mar 2002 15:34:42 -0500 To: arch@FreeBSD.ORG From: Garance A Drosihn Subject: Re: Fix for login.c, added questions Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 2:57 PM -0500 3/9/02, Garance A Drosihn wrote to freebsd-audit: >In my testing, the simple fix is: > >Index: login.c Reading thru login.c, it seems to me that we should probably consider some other changes too. One thing I noticed, for instance, is that login.c tries to setup a 300-second timeout, but apparently that timeout is masked off somewhere inside the auth_pam() processing. So, if a person types in a login name, a wrong password, types in the same login name and then just sits in the next password prompt, the session (apparently) never times out. Or at least it doesn't seem to have timed out for me in the more than 20 minutes I've left it sitting there on a console login. One thing the code tries to do is avoid a syslog message for the case of: login myid wrong password login myid correct password My claim is that this goal complicates the code enough that it also opens up some subtle opportunities for nefarious souls to be guessing passwords without syslog messages occurring. For one, it means you have to delay writing the syslog message at least until you read in the new userid, which is under the control of the very user who (perhaps) is trying to do something nasty. Do people think we could drop the nice idea of avoiding the syslog message in the above situation, and just always write out the syslog message right when we know the password is wrong? That will increase the number of syslog messages, which might alarm some users, but I think it's safer. Perhaps we could avoid that alarm by also writing out a syslog message if the session gives the correct password for a userid after having given a failed password. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message