From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 07:25:20 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 45793106566B for ; Mon, 2 Jul 2012 07:25:18 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 07:25:18 +0000 Date: Mon, 02 Jul 2012 07:25:18 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702072518.45793106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238762 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:25:20 -0000 Author: rudot Date: Mon Jul 2 07:25:17 2012 New Revision: 238762 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238762 Log: initial version of subr_turnstile.c file Added: soc2012/rudot/sys/kern/subr_turnstile.c Added: soc2012/rudot/sys/kern/subr_turnstile.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/kern/subr_turnstile.c Mon Jul 2 07:25:17 2012 (r238762) @@ -0,0 +1,1309 @@ +/*- + * Copyright (c) 1998 Berkeley Software Design, Inc. 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. + * 3. Berkeley Software Design Inc's name may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``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 BERKELEY SOFTWARE DESIGN INC 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. + * + * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ + * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ + */ + +/* + * Implementation of turnstiles used to hold queue of threads blocked on + * non-sleepable locks. Sleepable locks use condition variables to + * implement their queues. Turnstiles differ from a sleep queue in that + * turnstile queue's are assigned to a lock held by an owning thread. Thus, + * when one thread is enqueued onto a turnstile, it can lend its priority + * to the owning thread. + * + * We wish to avoid bloating locks with an embedded turnstile and we do not + * want to use back-pointers in the locks for the same reason. Thus, we + * use a similar approach to that of Solaris 7 as described in Solaris + * Internals by Jim Mauro and Richard McDougall. Turnstiles are looked up + * in a hash table based on the address of the lock. Each entry in the + * hash table is a linked-lists of turnstiles and is called a turnstile + * chain. Each chain contains a spin mutex that protects all of the + * turnstiles in the chain. + * + * Each time a thread is created, a turnstile is allocated from a UMA zone + * and attached to that thread. When a thread blocks on a lock, if it is the + * first thread to block, it lends its turnstile to the lock. If the lock + * already has a turnstile, then it gives its turnstile to the lock's + * turnstile's free list. When a thread is woken up, it takes a turnstile from + * the free list if there are any other waiters. If it is the only thread + * blocked on the lock, then it reclaims the turnstile associated with the lock + * and removes it from the hash table. + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/subr_turnstile.c,v 1.183 2012/05/15 01:30:25 rstone Exp $"); + +#include "opt_ddb.h" +#include "opt_kdtrace.h" +#include "opt_turnstile_profiling.h" +#include "opt_sched.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef DDB +#include +#include +#include +#endif + +/* + * Constants for the hash table of turnstile chains. TC_SHIFT is a magic + * number chosen because the sleep queue's use the same value for the + * shift. Basically, we ignore the lower 8 bits of the address. + * TC_TABLESIZE must be a power of two for TC_MASK to work properly. + */ +#define TC_TABLESIZE 128 /* Must be power of 2. */ +#define TC_MASK (TC_TABLESIZE - 1) +#define TC_SHIFT 8 +#define TC_HASH(lock) (((uintptr_t)(lock) >> TC_SHIFT) & TC_MASK) +#define TC_LOOKUP(lock) &turnstile_chains[TC_HASH(lock)] + +/* + * There are three different lists of turnstiles as follows. The list + * connected by ts_link entries is a per-thread list of all the turnstiles + * attached to locks that we own. This is used to fixup our priority when + * a lock is released. The other two lists use the ts_hash entries. The + * first of these two is the turnstile chain list that a turnstile is on + * when it is attached to a lock. The second list to use ts_hash is the + * free list hung off of a turnstile that is attached to a lock. + * + * Each turnstile contains three lists of threads. The two ts_blocked lists + * are linked list of threads blocked on the turnstile's lock. One list is + * for exclusive waiters, and the other is for shared waiters. The + * ts_pending list is a linked list of threads previously awakened by + * turnstile_signal() or turnstile_wait() that are waiting to be put on + * the run queue. + * + * Locking key: + * c - turnstile chain lock + * q - td_contested lock + */ +struct turnstile { + struct mtx ts_lock; /* Spin lock for self. */ + struct threadqueue ts_blocked[2]; /* (c + q) Blocked threads. */ + struct threadqueue ts_pending; /* (c) Pending threads. */ + LIST_ENTRY(turnstile) ts_hash; /* (c) Chain and free list. */ + LIST_ENTRY(turnstile) ts_link; /* (q) Contested locks. */ + LIST_HEAD(, turnstile) ts_free; /* (c) Free turnstiles. */ + struct lock_object *ts_lockobj; /* (c) Lock we reference. */ + struct thread *ts_owner; /* (c + q) Who owns the lock. */ +}; + +struct turnstile_chain { + LIST_HEAD(, turnstile) tc_turnstiles; /* List of turnstiles. */ + struct mtx tc_lock; /* Spin lock for this chain. */ +#ifdef TURNSTILE_PROFILING + u_int tc_depth; /* Length of tc_queues. */ + u_int tc_max_depth; /* Max length of tc_queues. */ +#endif +}; + +#ifdef TURNSTILE_PROFILING +u_int turnstile_max_depth; +static SYSCTL_NODE(_debug, OID_AUTO, turnstile, CTLFLAG_RD, 0, + "turnstile profiling"); +static SYSCTL_NODE(_debug_turnstile, OID_AUTO, chains, CTLFLAG_RD, 0, + "turnstile chain stats"); +SYSCTL_UINT(_debug_turnstile, OID_AUTO, max_depth, CTLFLAG_RD, + &turnstile_max_depth, 0, "maximum depth achieved of a single chain"); +#endif +static struct mtx td_contested_lock; +static struct turnstile_chain turnstile_chains[TC_TABLESIZE]; +static uma_zone_t turnstile_zone; + +/* + * Prototypes for non-exported routines. + */ +static void init_turnstile0(void *dummy); +#ifdef TURNSTILE_PROFILING +static void init_turnstile_profiling(void *arg); +#endif +static void propagate_priority(struct thread *td); +static int turnstile_adjust_thread(struct turnstile *ts, + struct thread *td); +static struct thread *turnstile_first_waiter(struct turnstile *ts); +static void turnstile_setowner(struct turnstile *ts, struct thread *owner); +#ifdef INVARIANTS +static void turnstile_dtor(void *mem, int size, void *arg); +#endif +static int turnstile_init(void *mem, int size, int flags); +static void turnstile_fini(void *mem, int size); + +SDT_PROVIDER_DECLARE(sched); +SDT_PROBE_DEFINE(sched, , , sleep, sleep); +SDT_PROBE_DEFINE2(sched, , , wakeup, wakeup, "struct thread *", + "struct proc *"); + +/* + * Walks the chain of turnstiles and their owners to propagate the priority + * of the thread being blocked to all the threads holding locks that have to + * release their locks before this thread can run again. + */ +static void +propagate_priority(struct thread *td) +{ + struct turnstile *ts; + int pri; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + pri = td->td_priority; + ts = td->td_blocked; + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + /* + * Grab a recursive lock on this turnstile chain so it stays locked + * for the whole operation. The caller expects us to return with + * the original lock held. We only ever lock down the chain so + * the lock order is constant. + */ + mtx_lock_spin(&ts->ts_lock); + for (;;) { + td = ts->ts_owner; + + if (td == NULL) { + /* + * This might be a read lock with no owner. There's + * not much we can do, so just bail. + */ + mtx_unlock_spin(&ts->ts_lock); + return; + } + + thread_lock_flags(td, MTX_DUPOK); + mtx_unlock_spin(&ts->ts_lock); + MPASS(td->td_proc != NULL); + MPASS(td->td_proc->p_magic == P_MAGIC); + + /* + * If the thread is asleep, then we are probably about + * to deadlock. To make debugging this easier, just + * panic and tell the user which thread misbehaved so + * they can hopefully get a stack trace from the truly + * misbehaving thread. + */ + if (TD_IS_SLEEPING(td)) { + printf( + "Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n", + td->td_tid, td->td_proc->p_pid); + kdb_backtrace_thread(td); + panic("sleeping thread"); + } + + /* + * If this thread already has higher priority than the + * thread that is being blocked, we are finished. + */ + if (td->td_priority <= pri) { + thread_unlock(td); + return; + } + + /* + * Bump this thread's priority. + */ + sched_lend_prio(td, pri); + + /* + * If lock holder is actually running or on the run queue + * then we are done. + */ + if (TD_IS_RUNNING(td) || TD_ON_RUNQ(td)) { + MPASS(td->td_blocked == NULL); + thread_unlock(td); + return; + } + +#ifndef SMP + /* + * For UP, we check to see if td is curthread (this shouldn't + * ever happen however as it would mean we are in a deadlock.) + */ + KASSERT(td != curthread, ("Deadlock detected")); +#endif + + /* + * If we aren't blocked on a lock, we should be. + */ + KASSERT(TD_ON_LOCK(td), ( + "thread %d(%s):%d holds %s but isn't blocked on a lock\n", + td->td_tid, td->td_name, td->td_state, + ts->ts_lockobj->lo_name)); + + /* + * Pick up the lock that td is blocked on. + */ + ts = td->td_blocked; + MPASS(ts != NULL); + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + /* Resort td on the list if needed. */ + if (!turnstile_adjust_thread(ts, td)) { + mtx_unlock_spin(&ts->ts_lock); + return; + } + /* The thread lock is released as ts lock above. */ + } +} + +/* + * Adjust the thread's position on a turnstile after its priority has been + * changed. + */ +static int +turnstile_adjust_thread(struct turnstile *ts, struct thread *td) +{ + struct thread *td1, *td2; + int queue; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(TD_ON_LOCK(td)); + + /* + * This thread may not be blocked on this turnstile anymore + * but instead might already be woken up on another CPU + * that is waiting on the thread lock in turnstile_unpend() to + * finish waking this thread up. We can detect this case + * by checking to see if this thread has been given a + * turnstile by either turnstile_signal() or + * turnstile_broadcast(). In this case, treat the thread as + * if it was already running. + */ + if (td->td_turnstile != NULL) + return (0); + + /* + * Check if the thread needs to be moved on the blocked chain. + * It needs to be moved if either its priority is lower than + * the previous thread or higher than the next thread. + */ + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + td1 = TAILQ_PREV(td, threadqueue, td_lockq); + td2 = TAILQ_NEXT(td, td_lockq); + if ((td1 != NULL && td->td_priority < td1->td_priority) || + (td2 != NULL && td->td_priority > td2->td_priority)) { + + /* + * Remove thread from blocked chain and determine where + * it should be moved to. + */ + queue = td->td_tsqueue; + MPASS(queue == TS_EXCLUSIVE_QUEUE || queue == TS_SHARED_QUEUE); + mtx_lock_spin(&td_contested_lock); + TAILQ_REMOVE(&ts->ts_blocked[queue], td, td_lockq); + TAILQ_FOREACH(td1, &ts->ts_blocked[queue], td_lockq) { + MPASS(td1->td_proc->p_magic == P_MAGIC); + if (td1->td_priority > td->td_priority) + break; + } + + if (td1 == NULL) + TAILQ_INSERT_TAIL(&ts->ts_blocked[queue], td, td_lockq); + else + TAILQ_INSERT_BEFORE(td1, td, td_lockq); + mtx_unlock_spin(&td_contested_lock); + if (td1 == NULL) + CTR3(KTR_LOCK, + "turnstile_adjust_thread: td %d put at tail on [%p] %s", + td->td_tid, ts->ts_lockobj, ts->ts_lockobj->lo_name); + else + CTR4(KTR_LOCK, + "turnstile_adjust_thread: td %d moved before %d on [%p] %s", + td->td_tid, td1->td_tid, ts->ts_lockobj, + ts->ts_lockobj->lo_name); + } + return (1); +} + +/* + * Early initialization of turnstiles. This is not done via a SYSINIT() + * since this needs to be initialized very early when mutexes are first + * initialized. + */ +void +init_turnstiles(void) +{ + int i; + + for (i = 0; i < TC_TABLESIZE; i++) { + LIST_INIT(&turnstile_chains[i].tc_turnstiles); + mtx_init(&turnstile_chains[i].tc_lock, "turnstile chain", + NULL, MTX_SPIN); + } + mtx_init(&td_contested_lock, "td_contested", NULL, MTX_SPIN); + LIST_INIT(&thread0.td_contested); + thread0.td_turnstile = NULL; +} + +#ifdef TURNSTILE_PROFILING +static void +init_turnstile_profiling(void *arg) +{ + struct sysctl_oid *chain_oid; + char chain_name[10]; + int i; + + for (i = 0; i < TC_TABLESIZE; i++) { + snprintf(chain_name, sizeof(chain_name), "%d", i); + chain_oid = SYSCTL_ADD_NODE(NULL, + SYSCTL_STATIC_CHILDREN(_debug_turnstile_chains), OID_AUTO, + chain_name, CTLFLAG_RD, NULL, "turnstile chain stats"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(chain_oid), OID_AUTO, + "depth", CTLFLAG_RD, &turnstile_chains[i].tc_depth, 0, + NULL); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(chain_oid), OID_AUTO, + "max_depth", CTLFLAG_RD, &turnstile_chains[i].tc_max_depth, + 0, NULL); + } +} +SYSINIT(turnstile_profiling, SI_SUB_LOCK, SI_ORDER_ANY, + init_turnstile_profiling, NULL); +#endif + +static void +init_turnstile0(void *dummy) +{ + + turnstile_zone = uma_zcreate("TURNSTILE", sizeof(struct turnstile), + NULL, +#ifdef INVARIANTS + turnstile_dtor, +#else + NULL, +#endif + turnstile_init, turnstile_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE); + thread0.td_turnstile = turnstile_alloc(); +} +SYSINIT(turnstile0, SI_SUB_LOCK, SI_ORDER_ANY, init_turnstile0, NULL); + +/* + * Update a thread on the turnstile list after it's priority has been changed. + * The old priority is passed in as an argument. + */ +void +turnstile_adjust(struct thread *td, u_char oldpri) +{ + struct turnstile *ts; + + MPASS(TD_ON_LOCK(td)); + + /* + * Pick up the lock that td is blocked on. + */ + ts = td->td_blocked; + MPASS(ts != NULL); + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + mtx_assert(&ts->ts_lock, MA_OWNED); + + /* Resort the turnstile on the list. */ + if (!turnstile_adjust_thread(ts, td)) + return; + /* + * If our priority was lowered and we are at the head of the + * turnstile, then propagate our new priority up the chain. + * Note that we currently don't try to revoke lent priorities + * when our priority goes up. + */ + MPASS(td->td_tsqueue == TS_EXCLUSIVE_QUEUE || + td->td_tsqueue == TS_SHARED_QUEUE); + if (td == TAILQ_FIRST(&ts->ts_blocked[td->td_tsqueue]) && + td->td_priority < oldpri) { + propagate_priority(td); + } +} + +/* + * Set the owner of the lock this turnstile is attached to. + */ +static void +turnstile_setowner(struct turnstile *ts, struct thread *owner) +{ + + mtx_assert(&td_contested_lock, MA_OWNED); + MPASS(ts->ts_owner == NULL); + + /* A shared lock might not have an owner. */ + if (owner == NULL) + return; + + MPASS(owner->td_proc->p_magic == P_MAGIC); + ts->ts_owner = owner; + LIST_INSERT_HEAD(&owner->td_contested, ts, ts_link); +} + +#ifdef INVARIANTS +/* + * UMA zone item deallocator. + */ +static void +turnstile_dtor(void *mem, int size, void *arg) +{ + struct turnstile *ts; + + ts = mem; + MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE])); + MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE])); + MPASS(TAILQ_EMPTY(&ts->ts_pending)); +} +#endif + +/* + * UMA zone item initializer. + */ +static int +turnstile_init(void *mem, int size, int flags) +{ + struct turnstile *ts; + + bzero(mem, size); + ts = mem; + TAILQ_INIT(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]); + TAILQ_INIT(&ts->ts_blocked[TS_SHARED_QUEUE]); + TAILQ_INIT(&ts->ts_pending); + LIST_INIT(&ts->ts_free); + mtx_init(&ts->ts_lock, "turnstile lock", NULL, MTX_SPIN | MTX_RECURSE); + return (0); +} + +static void +turnstile_fini(void *mem, int size) +{ + struct turnstile *ts; + + ts = mem; + mtx_destroy(&ts->ts_lock); +} + +/* + * Get a turnstile for a new thread. + */ +struct turnstile * +turnstile_alloc(void) +{ + + return (uma_zalloc(turnstile_zone, M_WAITOK)); +} + +/* + * Free a turnstile when a thread is destroyed. + */ +void +turnstile_free(struct turnstile *ts) +{ + + uma_zfree(turnstile_zone, ts); +} + +/* + * Lock the turnstile chain associated with the specified lock. + */ +void +turnstile_chain_lock(struct lock_object *lock) +{ + struct turnstile_chain *tc; + + tc = TC_LOOKUP(lock); + mtx_lock_spin(&tc->tc_lock); +} + +struct turnstile * +turnstile_trywait(struct lock_object *lock) +{ + struct turnstile_chain *tc; + struct turnstile *ts; + + tc = TC_LOOKUP(lock); + mtx_lock_spin(&tc->tc_lock); + LIST_FOREACH(ts, &tc->tc_turnstiles, ts_hash) + if (ts->ts_lockobj == lock) { + mtx_lock_spin(&ts->ts_lock); + return (ts); + } + + ts = curthread->td_turnstile; + MPASS(ts != NULL); + mtx_lock_spin(&ts->ts_lock); + KASSERT(ts->ts_lockobj == NULL, ("stale ts_lockobj pointer")); + ts->ts_lockobj = lock; + + return (ts); +} + +void +turnstile_cancel(struct turnstile *ts) +{ + struct turnstile_chain *tc; + struct lock_object *lock; + + mtx_assert(&ts->ts_lock, MA_OWNED); + + mtx_unlock_spin(&ts->ts_lock); + lock = ts->ts_lockobj; + if (ts == curthread->td_turnstile) + ts->ts_lockobj = NULL; + tc = TC_LOOKUP(lock); + mtx_unlock_spin(&tc->tc_lock); +} + +/* + * Look up the turnstile for a lock in the hash table locking the associated + * turnstile chain along the way. If no turnstile is found in the hash + * table, NULL is returned. + */ +struct turnstile * +turnstile_lookup(struct lock_object *lock) +{ + struct turnstile_chain *tc; + struct turnstile *ts; + + tc = TC_LOOKUP(lock); + mtx_assert(&tc->tc_lock, MA_OWNED); + LIST_FOREACH(ts, &tc->tc_turnstiles, ts_hash) + if (ts->ts_lockobj == lock) { + mtx_lock_spin(&ts->ts_lock); + return (ts); + } + return (NULL); +} + +/* + * Unlock the turnstile chain associated with a given lock. + */ +void +turnstile_chain_unlock(struct lock_object *lock) +{ + struct turnstile_chain *tc; + + tc = TC_LOOKUP(lock); + mtx_unlock_spin(&tc->tc_lock); +} + +/* + * Return a pointer to the thread waiting on this turnstile with the + * most important priority or NULL if the turnstile has no waiters. + */ +static struct thread * +turnstile_first_waiter(struct turnstile *ts) +{ + struct thread *std, *xtd; + + std = TAILQ_FIRST(&ts->ts_blocked[TS_SHARED_QUEUE]); + xtd = TAILQ_FIRST(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]); + if (xtd == NULL || (std != NULL && std->td_priority < xtd->td_priority)) + return (std); + return (xtd); +} + +/* + * Take ownership of a turnstile and adjust the priority of the new + * owner appropriately. + */ +void +turnstile_claim(struct turnstile *ts) +{ + struct thread *td, *owner; + struct turnstile_chain *tc; + + mtx_assert(&ts->ts_lock, MA_OWNED); + MPASS(ts != curthread->td_turnstile); + + owner = curthread; + mtx_lock_spin(&td_contested_lock); + turnstile_setowner(ts, owner); + mtx_unlock_spin(&td_contested_lock); + + td = turnstile_first_waiter(ts); + MPASS(td != NULL); + MPASS(td->td_proc->p_magic == P_MAGIC); + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + + /* + * Update the priority of the new owner if needed. + */ + thread_lock(owner); + if (td->td_priority < owner->td_priority) + sched_lend_prio(owner, td->td_priority); + thread_unlock(owner); + tc = TC_LOOKUP(ts->ts_lockobj); + mtx_unlock_spin(&ts->ts_lock); + mtx_unlock_spin(&tc->tc_lock); +} + +/* + * Block the current thread on the turnstile assicated with 'lock'. This + * function will context switch and not return until this thread has been + * woken back up. This function must be called with the appropriate + * turnstile chain locked and will return with it unlocked. + */ +void +turnstile_wait(struct turnstile *ts, struct thread *owner, int queue) +{ + struct turnstile_chain *tc; + struct thread *td, *td1; + struct lock_object *lock; + + td = curthread; + mtx_assert(&ts->ts_lock, MA_OWNED); + if (owner) + MPASS(owner->td_proc->p_magic == P_MAGIC); + MPASS(queue == TS_SHARED_QUEUE || queue == TS_EXCLUSIVE_QUEUE); + + /* + * If the lock does not already have a turnstile, use this thread's + * turnstile. Otherwise insert the current thread into the + * turnstile already in use by this lock. + */ + tc = TC_LOOKUP(ts->ts_lockobj); + mtx_assert(&tc->tc_lock, MA_OWNED); + if (ts == td->td_turnstile) { +#ifdef TURNSTILE_PROFILING + tc->tc_depth++; + if (tc->tc_depth > tc->tc_max_depth) { + tc->tc_max_depth = tc->tc_depth; + if (tc->tc_max_depth > turnstile_max_depth) + turnstile_max_depth = tc->tc_max_depth; + } +#endif + LIST_INSERT_HEAD(&tc->tc_turnstiles, ts, ts_hash); + KASSERT(TAILQ_EMPTY(&ts->ts_pending), + ("thread's turnstile has pending threads")); + KASSERT(TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]), + ("thread's turnstile has exclusive waiters")); + KASSERT(TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE]), + ("thread's turnstile has shared waiters")); + KASSERT(LIST_EMPTY(&ts->ts_free), + ("thread's turnstile has a non-empty free list")); + MPASS(ts->ts_lockobj != NULL); + mtx_lock_spin(&td_contested_lock); + TAILQ_INSERT_TAIL(&ts->ts_blocked[queue], td, td_lockq); + turnstile_setowner(ts, owner); + mtx_unlock_spin(&td_contested_lock); + } else { + TAILQ_FOREACH(td1, &ts->ts_blocked[queue], td_lockq) + if (td1->td_priority > td->td_priority) + break; + mtx_lock_spin(&td_contested_lock); + if (td1 != NULL) + TAILQ_INSERT_BEFORE(td1, td, td_lockq); + else + TAILQ_INSERT_TAIL(&ts->ts_blocked[queue], td, td_lockq); + MPASS(owner == ts->ts_owner); + mtx_unlock_spin(&td_contested_lock); + MPASS(td->td_turnstile != NULL); + LIST_INSERT_HEAD(&ts->ts_free, td->td_turnstile, ts_hash); + } + thread_lock(td); + thread_lock_set(td, &ts->ts_lock); + td->td_turnstile = NULL; + + /* Save who we are blocked on and switch. */ + lock = ts->ts_lockobj; + td->td_tsqueue = queue; + td->td_blocked = ts; + td->td_lockname = lock->lo_name; + td->td_blktick = ticks; + TD_SET_LOCK(td); + mtx_unlock_spin(&tc->tc_lock); + propagate_priority(td); + + if (LOCK_LOG_TEST(lock, 0)) + CTR4(KTR_LOCK, "%s: td %d blocked on [%p] %s", __func__, + td->td_tid, lock, lock->lo_name); + + SDT_PROBE0(sched, , , sleep); + + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + mi_switch(SW_VOL | SWT_TURNSTILE, NULL); + + if (LOCK_LOG_TEST(lock, 0)) + CTR4(KTR_LOCK, "%s: td %d free from blocked on [%p] %s", + __func__, td->td_tid, lock, lock->lo_name); + thread_unlock(td); +} + +/* + * Pick the highest priority thread on this turnstile and put it on the + * pending list. This must be called with the turnstile chain locked. + */ +int +turnstile_signal(struct turnstile *ts, int queue) +{ + struct turnstile_chain *tc; + struct thread *td; + int empty; + + MPASS(ts != NULL); + mtx_assert(&ts->ts_lock, MA_OWNED); + MPASS(curthread->td_proc->p_magic == P_MAGIC); + MPASS(ts->ts_owner == curthread || ts->ts_owner == NULL); + MPASS(queue == TS_SHARED_QUEUE || queue == TS_EXCLUSIVE_QUEUE); + + /* + * Pick the highest priority thread blocked on this lock and + * move it to the pending list. + */ + td = TAILQ_FIRST(&ts->ts_blocked[queue]); + MPASS(td->td_proc->p_magic == P_MAGIC); + mtx_lock_spin(&td_contested_lock); + TAILQ_REMOVE(&ts->ts_blocked[queue], td, td_lockq); + mtx_unlock_spin(&td_contested_lock); + TAILQ_INSERT_TAIL(&ts->ts_pending, td, td_lockq); + + /* + * If the turnstile is now empty, remove it from its chain and + * give it to the about-to-be-woken thread. Otherwise take a + * turnstile from the free list and give it to the thread. + */ + empty = TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]) && + TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE]); + if (empty) { + tc = TC_LOOKUP(ts->ts_lockobj); + mtx_assert(&tc->tc_lock, MA_OWNED); + MPASS(LIST_EMPTY(&ts->ts_free)); +#ifdef TURNSTILE_PROFILING + tc->tc_depth--; +#endif + } else + ts = LIST_FIRST(&ts->ts_free); + MPASS(ts != NULL); + LIST_REMOVE(ts, ts_hash); + td->td_turnstile = ts; + + return (empty); +} + +/* + * Put all blocked threads on the pending list. This must be called with + * the turnstile chain locked. + */ +void +turnstile_broadcast(struct turnstile *ts, int queue) +{ + struct turnstile_chain *tc; + struct turnstile *ts1; + struct thread *td; + + MPASS(ts != NULL); + mtx_assert(&ts->ts_lock, MA_OWNED); + MPASS(curthread->td_proc->p_magic == P_MAGIC); + MPASS(ts->ts_owner == curthread || ts->ts_owner == NULL); + /* + * We must have the chain locked so that we can remove the empty + * turnstile from the hash queue. + */ + tc = TC_LOOKUP(ts->ts_lockobj); + mtx_assert(&tc->tc_lock, MA_OWNED); + MPASS(queue == TS_SHARED_QUEUE || queue == TS_EXCLUSIVE_QUEUE); + + /* + * Transfer the blocked list to the pending list. + */ + mtx_lock_spin(&td_contested_lock); + TAILQ_CONCAT(&ts->ts_pending, &ts->ts_blocked[queue], td_lockq); + mtx_unlock_spin(&td_contested_lock); + + /* + * Give a turnstile to each thread. The last thread gets + * this turnstile if the turnstile is empty. + */ + TAILQ_FOREACH(td, &ts->ts_pending, td_lockq) { + if (LIST_EMPTY(&ts->ts_free)) { + MPASS(TAILQ_NEXT(td, td_lockq) == NULL); + ts1 = ts; +#ifdef TURNSTILE_PROFILING + tc->tc_depth--; +#endif + } else + ts1 = LIST_FIRST(&ts->ts_free); + MPASS(ts1 != NULL); + LIST_REMOVE(ts1, ts_hash); + td->td_turnstile = ts1; + } +} + +/* + * Wakeup all threads on the pending list and adjust the priority of the + * current thread appropriately. This must be called with the turnstile + * chain locked. + */ +void +turnstile_unpend(struct turnstile *ts, int owner_type) +{ + TAILQ_HEAD( ,thread) pending_threads; + struct turnstile *nts; + struct thread *td; + u_char cp, pri; + + MPASS(ts != NULL); + mtx_assert(&ts->ts_lock, MA_OWNED); + MPASS(ts->ts_owner == curthread || ts->ts_owner == NULL); + MPASS(!TAILQ_EMPTY(&ts->ts_pending)); + + /* + * Move the list of pending threads out of the turnstile and + * into a local variable. + */ + TAILQ_INIT(&pending_threads); + TAILQ_CONCAT(&pending_threads, &ts->ts_pending, td_lockq); +#ifdef INVARIANTS + if (TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]) && + TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE])) + ts->ts_lockobj = NULL; +#endif + /* + * Adjust the priority of curthread based on other contested + * locks it owns. Don't lower the priority below the base + * priority however. + */ + td = curthread; + pri = PRI_MAX; + thread_lock(td); + mtx_lock_spin(&td_contested_lock); + /* + * Remove the turnstile from this thread's list of contested locks + * since this thread doesn't own it anymore. New threads will + * not be blocking on the turnstile until it is claimed by a new + * owner. There might not be a current owner if this is a shared + * lock. + */ + if (ts->ts_owner != NULL) { + ts->ts_owner = NULL; + LIST_REMOVE(ts, ts_link); + } + LIST_FOREACH(nts, &td->td_contested, ts_link) { + cp = turnstile_first_waiter(nts)->td_priority; + if (cp < pri) + pri = cp; + } + mtx_unlock_spin(&td_contested_lock); + sched_unlend_prio(td, pri); + thread_unlock(td); + /* + * Wake up all the pending threads. If a thread is not blocked + * on a lock, then it is currently executing on another CPU in + * turnstile_wait() or sitting on a run queue waiting to resume + * in turnstile_wait(). Set a flag to force it to try to acquire + * the lock again instead of blocking. + */ + while (!TAILQ_EMPTY(&pending_threads)) { + td = TAILQ_FIRST(&pending_threads); + TAILQ_REMOVE(&pending_threads, td, td_lockq); + SDT_PROBE2(sched, , , wakeup, td, td->td_proc); + thread_lock(td); + THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); + MPASS(td->td_proc->p_magic == P_MAGIC); + MPASS(TD_ON_LOCK(td)); + TD_CLR_LOCK(td); + MPASS(TD_CAN_RUN(td)); + td->td_blocked = NULL; + td->td_lockname = NULL; + td->td_blktick = 0; +#ifdef INVARIANTS + td->td_tsqueue = 0xff; +#endif + sched_add(td, SRQ_BORING); + thread_unlock(td); + } + mtx_unlock_spin(&ts->ts_lock); +} + +/* + * Give up ownership of a turnstile. This must be called with the + * turnstile chain locked. + */ +void +turnstile_disown(struct turnstile *ts) +{ + struct thread *td; + u_char cp, pri; + + MPASS(ts != NULL); + mtx_assert(&ts->ts_lock, MA_OWNED); + MPASS(ts->ts_owner == curthread); + MPASS(TAILQ_EMPTY(&ts->ts_pending)); + MPASS(!TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]) || + !TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE])); + + /* + * Remove the turnstile from this thread's list of contested locks + * since this thread doesn't own it anymore. New threads will + * not be blocking on the turnstile until it is claimed by a new + * owner. + */ + mtx_lock_spin(&td_contested_lock); + ts->ts_owner = NULL; + LIST_REMOVE(ts, ts_link); + mtx_unlock_spin(&td_contested_lock); + + /* + * Adjust the priority of curthread based on other contested + * locks it owns. Don't lower the priority below the base + * priority however. + */ + td = curthread; + pri = PRI_MAX; + thread_lock(td); + mtx_unlock_spin(&ts->ts_lock); + mtx_lock_spin(&td_contested_lock); + LIST_FOREACH(ts, &td->td_contested, ts_link) { + cp = turnstile_first_waiter(ts)->td_priority; + if (cp < pri) + pri = cp; + } + mtx_unlock_spin(&td_contested_lock); + sched_unlend_prio(td, pri); + thread_unlock(td); +} + +/* + * Return the first thread in a turnstile. + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 07:26:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F27AE106566B for ; Mon, 2 Jul 2012 07:26:29 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 07:26:29 +0000 Date: Mon, 02 Jul 2012 07:26:29 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702072629.F27AE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238763 - soc2012/rudot/aux X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:26:31 -0000 Author: rudot Date: Mon Jul 2 07:26:29 2012 New Revision: 238763 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238763 Log: small fixes Modified: soc2012/rudot/aux/psSum.sh Modified: soc2012/rudot/aux/psSum.sh ============================================================================== --- soc2012/rudot/aux/psSum.sh Mon Jul 2 07:25:17 2012 (r238762) +++ soc2012/rudot/aux/psSum.sh Mon Jul 2 07:26:29 2012 (r238763) @@ -1,5 +1,7 @@ FILE_UNSORTED=data.txt FILE_SORTED=dataSorted.txt +FILE_PLOT=plot.eps +DELAY_SLOT=10 if [ -z "$1" ]; then echo "Usage: $0 user" @@ -26,6 +28,7 @@ { sort_results command -v gnuplot > /dev/null && plot_graph + echo "Exiting..." exit 0 } @@ -39,7 +42,7 @@ XLIMITB=`echo $PCPU_MAX | awk '{print int($1) + 1}'` - gnuplot > plot.eps <<-EOF + gnuplot > $FILE_PLOT <<-EOF set term postscript eps enhanced color set style line 1 lt 1 lw 1 set xlabel "CPU percentage" @@ -52,15 +55,24 @@ trap finalize SIGINT +rm -f $FILE_UNSORTED +rm -f $FILE_SORTED +rm -f $FILE_PLOT + echo "Type [Ctrl + c] to exit" echo "Scanning..." while : do PCPU=`user_pcpu "$USER"` + + if [ "$PCPU" = "0" ]; then + sleep $DELAY_SLOT + continue + fi # Escape the decimal point because grep treats it as meta-character. - PCPU_GREP=`echo $PCPU | sed 's:\.:\\\.:'` + PCPU_ESC=`echo $PCPU | sed 's:\.:\\\.:'` [ -z "$PCPU_MIN" ] && PCPU_MIN=$PCPU [ -z "$PCPU_MAX" ] && PCPU_MAX=$PCPU @@ -74,18 +86,26 @@ `IFS=:; echo $PCPU_MIN_MAX` EOF - LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU_GREP}:"` + LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU_ESC}:"` + + NLINES=`echo "$LINE" | wc -l` + if [ "$NLINES" -gt 1 ]; then + cat $FILE_UNSORTED > debug + echo "$PCPU" >> debug + echo "$PCPU_ESC" >> debug + echo "$LINE" >> debug + fi if [ -n "$LINE" ]; then CNT=`echo "$LINE" | cut -d : -f 2` NEW_CNT=`expr "$CNT" + 1` ed -s data.txt <<-EOF - ,s/${PCPU}:${CNT}/${PCPU}:${NEW_CNT}/ + ,s/^${PCPU_ESC}:${CNT}/${PCPU}:${NEW_CNT}/ wq EOF else echo "$PCPU:1" >> $FILE_UNSORTED fi - sleep 10 + sleep $DELAY_SLOT done From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 07:29:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1291B1065670 for ; Mon, 2 Jul 2012 07:29:37 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 07:29:37 +0000 Date: Mon, 02 Jul 2012 07:29:37 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702072937.1291B1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238764 - soc2012/rudot/aux X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:29:39 -0000 Author: rudot Date: Mon Jul 2 07:29:36 2012 New Revision: 238764 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238764 Log: helper script for running benchmarks Added: soc2012/rudot/aux/buildWorld.sh (contents, props changed) Added: soc2012/rudot/aux/buildWorld.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/buildWorld.sh Mon Jul 2 07:29:36 2012 (r238764) @@ -0,0 +1,6 @@ +set -m +./psSum.sh `id -u` & +set +m +cd /usr/src +make buildworld +kill -INT $! From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 07:31:27 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AAF4E106564A for ; Mon, 2 Jul 2012 07:31:25 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 07:31:25 +0000 Date: Mon, 02 Jul 2012 07:31:25 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702073125.AAF4E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238765 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:31:27 -0000 Author: rudot Date: Mon Jul 2 07:31:25 2012 New Revision: 238765 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238765 Log: fix of kernel panic during buildworld Modified: soc2012/rudot/sys/kern/subr_turnstile.c Modified: soc2012/rudot/sys/kern/subr_turnstile.c ============================================================================== --- soc2012/rudot/sys/kern/subr_turnstile.c Mon Jul 2 07:29:36 2012 (r238764) +++ soc2012/rudot/sys/kern/subr_turnstile.c Mon Jul 2 07:31:25 2012 (r238765) @@ -246,7 +246,7 @@ * If lock holder is actually running or on the run queue * then we are done. */ - if (TD_IS_RUNNING(td) || TD_ON_RUNQ(td)) { + if (TD_IS_RUNNING(td) || TD_ON_RUNQ(td) || (td->td_flags & TDF_RACCT_RQ )) { MPASS(td->td_blocked == NULL); thread_unlock(td); return; From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 07:33:25 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DC1D5106566B for ; Mon, 2 Jul 2012 07:33:22 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 07:33:22 +0000 Date: Mon, 02 Jul 2012 07:33:22 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702073322.DC1D5106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238766 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:33:25 -0000 Author: rudot Date: Mon Jul 2 07:33:22 2012 New Revision: 238766 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238766 Log: fixing of buildworld bug - work in progress Modified: soc2012/rudot/sys/kern/kern_racct.c Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Mon Jul 2 07:31:25 2012 (r238765) +++ soc2012/rudot/sys/kern/kern_racct.c Mon Jul 2 07:33:22 2012 (r238766) @@ -897,11 +897,13 @@ { struct thread *td; + PROC_LOCK_ASSERT(p, MA_OWNED); FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_critnest > 1) + continue; if ((td->td_flags & TDF_RACCT_PCTCPU) == 0) { thread_lock(td); td->td_flags |= TDF_RACCT_PCTCPU; - switch (td->td_state) { case TDS_RUNQ: sched_rem(td); @@ -932,6 +934,7 @@ { struct thread *td; + PROC_LOCK_ASSERT(p, MA_OWNED); FOREACH_THREAD_IN_PROC(p, td) { if (td->td_flags & TDF_RACCT_PCTCPU) return (1); @@ -945,6 +948,7 @@ { struct thread *td; + PROC_LOCK_ASSERT(p, MA_OWNED); FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); td->td_flags &= ~TDF_RACCT_PCTCPU; @@ -970,12 +974,19 @@ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { - if (p->p_state != PRS_NORMAL) + PROC_LOCK(p); + if (p->p_state == PRS_ZOMBIE) { + pct = racct_getpcpu(p); + racct_set(p, RACCT_PCTCPU, pct); + } + + if (p->p_state != PRS_NORMAL) { + PROC_UNLOCK(p); continue; + } microuptime(&wallclock); timevalsub(&wallclock, &p->p_stats->p_start); - PROC_LOCK(p); PROC_SLOCK(p); FOREACH_THREAD_IN_PROC(p, td) ruxagg(p, td); From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 11:38:20 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 29B9A106566B for ; Mon, 2 Jul 2012 11:38:18 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 11:38:18 +0000 Date: Mon, 02 Jul 2012 11:38:18 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702113818.29B9A106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238796 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 11:38:20 -0000 Author: scher Date: Mon Jul 2 11:38:17 2012 New Revision: 238796 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238796 Log: [user_feedback] changes in _parv_${_lock_dir}_LOCK_SEQ, _parv_${_lock_dir}_LOCK_LOOP, _parv_${_lock_dir}_DO_UNLOCK scripts Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jul 2 10:16:14 2012 (r238795) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jul 2 11:38:17 2012 (r238796) @@ -207,10 +207,8 @@ while true; do \ ppid=$$( ps -o ppid -p $${cur_pid} | ${AWK} "NR==2" ); \ if [ $${ppid} -eq $${pid} ]; then \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is locked by parent make process!"; \ - ${ECHO_CMD} "We are allowed to work here"; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is locked by parent make process."; \ + ${ECHO_CMD} " We are allowed to work here."; \ break; \ elif [ $${ppid} -eq 0 ]; then \ exit ${_parv_ON_LOCK_EXIT_STATUS}; \ @@ -222,17 +220,13 @@ exit ${_parv_ON_LOCK_EXIT_STATUS}; \ fi; \ else \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Dir: ${${_lock_dir}} Stalled lock Detected!"; \ - ${ECHO_CMD} "Deleting stalled lock. PID=$${pid}"; \ - ${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> Stalled lock at ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} file."; \ + ${ECHO_CMD} " Deleting stalled lock."; \ + ${ECHO_CMD} "===> Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ fi; \ else \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ fi @@ -284,11 +278,9 @@ exit 0; \ elif [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -eq 0 ]; then \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Unable to lock ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ - ${ECHO_CMD} "Dir: ${${_lock_dir}} is already locked by another working process ..."; \ - ${ECHO_CMD} "Waiting for unlock ........................................................."; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> Unable to lock ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ + ${ECHO_CMD} " It is already locked by another working process."; \ + ${ECHO_CMD} " Waiting for unlock ..."; \ enable_feedback=0; \ fi; \ enable_feedback=$$(( $${enable_feedback} + 1 )); \ @@ -311,14 +303,10 @@ pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \ if [ ${.MAKE.PID} -eq $${pid} ]; then \ ${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is unlocked; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> Unlocking ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \ else \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} was locked by another process; \ - ${ECHO_CMD} Leave lock file; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} "===> ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} was locked by another process"; \ + ${ECHO_CMD} " Leave lock file."; \ fi; \ }' From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 11:42:17 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A6BAF106566C for ; Mon, 2 Jul 2012 11:42:15 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 11:42:15 +0000 Date: Mon, 02 Jul 2012 11:42:15 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702114215.A6BAF106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238797 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 11:42:17 -0000 Author: oleksandr Date: Mon Jul 2 11:42:15 2012 New Revision: 238797 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238797 Log: setup rest of mount information, style fix and add debug section Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 11:38:17 2012 (r238796) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 11:42:15 2012 (r238797) @@ -358,7 +358,7 @@ * We sum all free space up here regardless of type. */ -/* KASSERT(lvid); */ + KASSERT(lvid, ("lvid is null")); num_vpart = le32toh(lvid->num_part); #if 0 @@ -454,7 +454,7 @@ vpart = le16toh(icb_loc->loc.part_num); lb_num = le32toh(icb_loc->loc.lb_num); if (vpart > UDF_VTOP_RAWPART) - return EINVAL; + return (EINVAL); translate_again: part = ump->vtop[vpart]; @@ -465,38 +465,38 @@ /* 1:1 to the end of the device */ *lb_numres = lb_num; *extres = INT_MAX; - return 0; + return (0); case UDF_VTOP_TYPE_PHYS : /* transform into its disc logical block */ if (lb_num > le32toh(pdesc->part_len)) - return EINVAL; + return (EINVAL); *lb_numres = lb_num + le32toh(pdesc->start_loc); /* extent from here to the end of the partition */ *extres = le32toh(pdesc->part_len) - lb_num; - return 0; + return (0); case UDF_VTOP_TYPE_VIRT : /* only maps one logical block, lookup in VAT */ if (lb_num >= ump->vat_entries) /* XXX > or >= ? */ - return EINVAL; + return (EINVAL); /* lookup in virtual allocation table file */ error = udf_vat_read(ump->vat_node, (uint8_t *) &udf_rw32_lbmap, 4, ump->vat_offset + lb_num * 4); if (error) - return error; + return (error); lb_num = le32toh(udf_rw32_lbmap); /* transform into its disc logical block */ if (lb_num > le32toh(pdesc->part_len)) - return EINVAL; + return (EINVAL); *lb_numres = lb_num + le32toh(pdesc->start_loc); /* just one logical block */ *extres = 1; - return 0; + return (0); case UDF_VTOP_TYPE_SPARABLE : /* check if the packet containing the lb_num is remapped */ lb_packet = lb_num / ump->sparable_packet_size; @@ -508,18 +508,18 @@ /* NOTE maps to absolute disc logical block! */ *lb_numres = le32toh(sme->map) + lb_rel; *extres = ump->sparable_packet_size - lb_rel; - return 0; + return (0); } } /* transform into its disc logical block */ if (lb_num > le32toh(pdesc->part_len)) - return EINVAL; + return (EINVAL); *lb_numres = lb_num + le32toh(pdesc->start_loc); /* rest of block */ *extres = ump->sparable_packet_size - lb_rel; - return 0; + return (0); case UDF_VTOP_TYPE_META : printf("Metadata Partition Translated\n"); /* we have to look into the file's allocation descriptors */ @@ -537,7 +537,7 @@ slot, &s_icb_loc, &eof); if (eof) { UDF_UNLOCK_NODE(ump->metadata_node, 0); - return EINVAL; + return IEINVAL); } len = le32toh(s_icb_loc.len); flags = UDF_EXT_FLAGS(len); @@ -568,7 +568,7 @@ if (flags != UDF_EXT_ALLOCATED) { DPRINTF(TRANSLATE, ("Metadata partion translation " "failed: not allocated\n")); - return EINVAL; + return (EINVAL); } /* @@ -581,7 +581,7 @@ ump->vtop_tp[vpart]); } - return EINVAL; + return (EINVAL); } @@ -1981,6 +1981,8 @@ /* XXX l_ad == 0 should be enough to check */ *eof = (offset >= l_ad) || (l_ad == 0); if (*eof) { + DPRINTF(PARANOIDADWLK, ("returning EOF, extnr %d, offset %d, " + "l_ad %d\n", extnr, offset, l_ad)); memset(icb, 0, sizeof(struct long_ad)); return; } @@ -1995,6 +1997,9 @@ long_ad = (struct long_ad *) (data_pos + offset); *icb = *long_ad; } + DPRINTF(PARANOIDADWLK, ("returning element : v %d, lb %d, len %d, " + "flags %d\n", icb->loc.part_num, icb->loc.lb_num, + UDF_EXT_LEN(icb->len), UDF_EXT_FLAGS(icb->len))); } /* --------------------------------------------------------------------- */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 11:38:17 2012 (r238796) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 11:42:15 2012 (r238797) @@ -2112,7 +2112,7 @@ maps_on = ump->vtop[log_part]; switch (ump->vtop_tp[log_part]) { case UDF_VTOP_TYPE_PHYS : - /* assert(maps_on == log_part); */ + KASSERT(maps_on == log_part, (" maps_on != log_part")); ump->vtop_alloc[log_part] = UDF_ALLOC_SPACEMAP; break; case UDF_VTOP_TYPE_VIRT : @@ -2120,18 +2120,16 @@ ump->vtop_alloc[maps_on] = UDF_ALLOC_SEQUENTIAL; break; case UDF_VTOP_TYPE_SPARABLE : - /* assert(maps_on == log_part); */ + KASSERT(maps_on == log_part, ("maps_on != log_part")); ump->vtop_alloc[log_part] = UDF_ALLOC_SPACEMAP; break; case UDF_VTOP_TYPE_META : ump->vtop_alloc[log_part] = UDF_ALLOC_METABITMAP; -#if 0 if (ump->discinfo.mmc_cur & MMC_CAP_PSEUDOOVERWRITE) { /* special case for UDF 2.60 */ ump->vtop_alloc[log_part] = UDF_ALLOC_METASEQUENTIAL; ump->vtop_alloc[maps_on] = UDF_ALLOC_SEQUENTIAL; } -#endif break; default: panic("bad alloction type in udf's ump->vtop\n"); @@ -2227,6 +2225,7 @@ struct fileset_desc *fsd = NULL; struct udf_lv_info *lvi = NULL; + DPRINTF(VOLUMES, ("Updating logical volume name\n")); lvd = ump->logical_vol; fsd = ump->fileset_desc; if (ump->implementation) @@ -2684,6 +2683,7 @@ /* paranoia */ if (a_l != sizeof(*implext) -1 + le32toh(implext->iu_l) + sizeof(lvext)) + DPRINTF(VOLUMES, ("VAT LVExtension size doens't compute\n")); return (EINVAL); /* @@ -2691,6 +2691,7 @@ * bug in the specification it might not be word aligned so * copy first to avoid panics on some machines (!!) */ + DPRINTF(VOLUMES, ("Found VAT LVExtension attr\n")); lvextpos = implext->data + le32toh(implext->iu_l); memcpy(&lvext, lvextpos, sizeof(lvext)); @@ -2700,6 +2701,7 @@ lvinfo->num_directories = lvext.num_directories; udf_update_logvolname(ump, lvext.logvol_id); } else { + DPRINTF(VOLUMES, ("VAT LVExtension out of date")); /* replace VAT LVExt by free space EA */ memset(implext->imp_id.id, 0, UDF_REGID_ID_SIZE); strcpy(implext->imp_id.id, "*UDF FreeEASpace"); @@ -2955,6 +2957,7 @@ /* vat_length is really 64 bits though impossible */ + DPRINTF(VOLUMES, ("Checking for VAT\n")); if (!vat_node) return (ENOENT); @@ -2987,6 +2990,8 @@ if ((filetype != 0) && (filetype != UDF_ICB_FILETYPE_VAT)) return (ENOENT); + DPRINTF(VOLUMES, ("\tPossible VAT length %d\n", vat_length)); + vat_table_alloc_len = ((vat_length + UDF_VAT_CHUNKSIZE-1) / UDF_VAT_CHUNKSIZE) * UDF_VAT_CHUNKSIZE; @@ -3034,6 +3039,7 @@ regid_name = (char *) oldvat_tl->id.id; error = strncmp(regid_name, "*UDF Virtual Alloc Tbl", 22); if (error) { + DPRINTF(VOLUMES, ("VAT format 1.50 rejected\n")); error = ENOENT; goto out; } @@ -3083,6 +3089,7 @@ if (error) goto out; + DPRINTF(VOLUMES, ("VAT format accepted, marking it closed\n")); ump->logvol_integrity->lvint_next_unique_id = htole64(unique_id); ump->logvol_integrity->integrity_type = htole32(UDF_INTEGRITY_CLOSED); ump->logvol_integrity->time = *mtime; @@ -3127,9 +3134,16 @@ vat_loc = ump->last_possible_vat_location; early_vat_loc = vat_loc - 256; /* 8 blocks of 32 sectors */ + DPRINTF(VOLUMES, ("1) last possible %d, early_vat_loc %d \n", + vat_loc, early_vat_loc)); + early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location); + early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location); late_vat_loc = vat_loc + 1024; + DPRINTF(VOLUMES, ("2) last possible %d, early_vat_loc %d \n", + vat_loc, early_vat_loc)); + /* start looking from the end of the range */ do { if (vat_node) { @@ -3152,6 +3166,7 @@ icb_loc.loc.part_num = htole16(UDF_VTOP_RAWPART); icb_loc.loc.lb_num = htole32(vat_loc); ino = udf_get_node_id(&icb_loc); + error = udf_get_node(ump, ino, &vat_node); /* error = udf_vget(ump->vfs_mountp, ino, LK_EXCLUSIVE, &vp); */ /* vat_node = VTOI(vp); */ @@ -3287,8 +3302,8 @@ if (error) error = EROFS; } - /* DPRINTFIF(VOLUMES, error, ("udf mount: failed to read " - "metadata files\n")); */ + DPRINTFIF(VOLUMES, error, ("udf mount: failed to read " + "metadata files\n")); return (error); } /* --------------------------------------------------------------------- */ @@ -3347,7 +3362,7 @@ /* also read in metadata partition spacebitmap if defined */ error = udf_read_metadata_partition_spacetable(ump); - return error; + return (error); } #endif return (0); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 11:38:17 2012 (r238796) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 11:42:15 2012 (r238797) @@ -630,6 +630,13 @@ #endif /* setup rest of mount information */ + mp->mnt_data = ump; + +#if 0 + /* bshift is allways equal to disc sector size */ + mp->mnt_dev_bshift = bshift; + mp->mnt_fs_bshift = bshift; +#endif /* note that the mp info needs to be initialised for reading! */ /* read vds support tables like VAT, sparable etc. */ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 12:12:19 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1E2D41065673 for ; Mon, 2 Jul 2012 12:12:17 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 12:12:17 +0000 Date: Mon, 02 Jul 2012 12:12:17 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702121217.1E2D41065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238799 - soc2012/gpf/pefs_kmod/sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 12:12:19 -0000 Author: gpf Date: Mon Jul 2 12:12:16 2012 New Revision: 238799 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238799 Log: - if pefs_ioctl is called to retrieve name checksum (MAC) but the vnode has no keys, then the call to pefs_eccn_lookup() will result in a page fault kernel panic. fix the code's behavior for this case by avoiding the call of pefs_eccn_lookup(). Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon Jul 2 11:46:47 2012 (r238798) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon Jul 2 12:12:16 2012 (r238799) @@ -2557,23 +2557,30 @@ } pefs_enccn_init(&enccn); - - cn.cn_nameiop = LOOKUP; - cn.cn_thread = td; - cn.cn_cred = cred; - cn.cn_lkflags = 0; - cn.cn_flags = 0; - cn.cn_nameptr = xncs->pxnc_filename; - cn.cn_namelen = xncs->pxnc_namelen; - - /* XXXgpf: does this lookup rely solely on present cache data? */ - error = pefs_enccn_lookup(&enccn, vp, &cn); + if (pefs_no_keys(vp)) { + enc = xncs->pxnc_filename; + enc_len = xncs->pxnc_namelen; + error = 0; + } + else { + cn.cn_nameiop = LOOKUP; + cn.cn_thread = td; + cn.cn_cred = cred; + cn.cn_lkflags = 0; + cn.cn_flags = 0; + cn.cn_nameptr = xncs->pxnc_filename; + cn.cn_namelen = xncs->pxnc_namelen; + + /* XXXgpf: does this lookup rely solely on present cache data? */ + error = pefs_enccn_lookup(&enccn, vp, &cn); + if (error == 0) { + enc = enccn.pec_cn.cn_nameptr; + enc_len = enccn.pec_cn.cn_namelen; + } + } VOP_UNLOCK(vp, 0); if (error == 0) { - enc = enccn.pec_cn.cn_nameptr; - enc_len = enccn.pec_cn.cn_namelen; - if (enc[0] != '.' || enc_len <= 1) { pefs_enccn_free(&enccn); error = EINVAL; From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 13:09:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 60826106564A for ; Mon, 2 Jul 2012 13:09:29 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 13:09:29 +0000 Date: Mon, 02 Jul 2012 13:09:29 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702130929.60826106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238800 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 13:09:31 -0000 Author: gmiller Date: Mon Jul 2 13:09:28 2012 New Revision: 238800 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238800 Log: r238613@FreeBSD-dev: root | 2012-06-29 14:39:44 -0500 Properly check return values for pthread_mutex_lock() and pthread_mutex_unlock(). Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 12:12:16 2012 (r238799) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:28 2012 (r238800) @@ -38,7 +38,7 @@ int ret; ret = _pthread_mutex_lock(mutex); - if (mutex != &witness_mtx) { + if (mutex != &witness_mtx && ret == 0) { add_lock(mutex); } @@ -51,7 +51,7 @@ int ret; ret = _pthread_mutex_unlock(mutex); - if (mutex != &witness_mtx) { + if (mutex != &witness_mtx && ret == 0) { remove_lock(mutex); } From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 13:09:40 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A0DF8106567C for ; Mon, 2 Jul 2012 13:09:38 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 13:09:38 +0000 Date: Mon, 02 Jul 2012 13:09:38 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702130938.A0DF8106567C@hub.freebsd.org> Cc: Subject: socsvn commit: r238801 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 13:09:40 -0000 Author: gmiller Date: Mon Jul 2 13:09:38 2012 New Revision: 238801 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238801 Log: r238614@FreeBSD-dev: root | 2012-06-29 14:49:12 -0500 Add wrappers for the remaining mutex locking functions. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:28 2012 (r238800) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:38 2012 (r238801) @@ -28,6 +28,9 @@ #include "witness.h" int _pthread_mutex_lock(pthread_mutex_t *mutex); +int _pthread_mutex_trylock(pthread_mutex_t *mutex); +int _pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *ts); int _pthread_mutex_unlock(pthread_mutex_t *mutex); pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -46,6 +49,32 @@ } int +pthread_mutex_trylock(pthread_mutex_t *mutex) +{ + int ret; + + ret = _pthread_mutex_trylock(mutex); + if (mutex != &witness_mtx && ret == 0) { + add_lock(mutex); + } + + return (ret); +} + +int +pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *ts) +{ + int ret; + + ret = _pthread_mutex_timedlock(mutex, ts); + if (mutex != &witness_mtx && ret == 0) { + add_lock(mutex); + } + + return (ret); +} + +int pthread_mutex_unlock(pthread_mutex_t *mutex) { int ret; From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 13:09:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EEE36106567C for ; Mon, 2 Jul 2012 13:09:47 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 13:09:47 +0000 Date: Mon, 02 Jul 2012 13:09:47 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702130947.EEE36106567C@hub.freebsd.org> Cc: Subject: socsvn commit: r238802 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 13:09:50 -0000 Author: gmiller Date: Mon Jul 2 13:09:47 2012 New Revision: 238802 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238802 Log: r238615@FreeBSD-dev: root | 2012-06-29 14:49:54 -0500 Begin adding code to maintain an optimized lock order graph. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Jul 2 13:09:38 2012 (r238801) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Jul 2 13:09:47 2012 (r238802) @@ -52,7 +52,17 @@ return (NULL); } -/* XXX: produces suboptimal graph, fix this before the end of the project */ +static void +optimize_links(struct graph_node *to) +{ + to = to; + /* + find first node with multiple children, then start scanning for + multiple paths to "to" from any node with multiple children and + a link to "to" + */ +} + static int insert_edge(struct graph_node *from, struct graph_node *to) { @@ -67,6 +77,8 @@ to->sibling = from->child; from->child = to; + optimize_links(to); + return (0); } From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 13:09:59 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 12C9C106567E for ; Mon, 2 Jul 2012 13:09:57 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 13:09:57 +0000 Date: Mon, 02 Jul 2012 13:09:57 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702130957.12C9C106567E@hub.freebsd.org> Cc: Subject: socsvn commit: r238803 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 13:09:59 -0000 Author: gmiller Date: Mon Jul 2 13:09:56 2012 New Revision: 238803 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238803 Log: r238820@FreeBSD-dev: root | 2012-06-29 15:18:48 -0500 Add rwlock wrappers. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:47 2012 (r238802) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:56 2012 (r238803) @@ -32,6 +32,15 @@ int _pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *ts); int _pthread_mutex_unlock(pthread_mutex_t *mutex); +int _pthread_rwlock_rdlock(pthread_rwlock_t *mutex); +int _pthread_rwlock_tryrdlock(pthread_rwlock_t *mutex); +int _pthread_rwlock_timedrdlock(pthread_rwlock_t *mutex, + const struct timespec *ts); +int _pthread_rwlock_wrlock(pthread_rwlock_t *mutex); +int _pthread_rwlock_trywrlock(pthread_rwlock_t *mutex); +int _pthread_rwlock_timedwrlock(pthread_rwlock_t *mutex, + const struct timespec *ts); +int _pthread_rwlock_unlock(pthread_rwlock_t *mutex); pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -86,3 +95,94 @@ return (ret); } + +int +pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) +{ + int ret; + + ret = _pthread_rwlock_rdlock(rwlock); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) +{ + int ret; + + ret = _pthread_rwlock_tryrdlock(rwlock); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *ts) +{ + int ret; + + ret = _pthread_rwlock_timedrdlock(rwlock, ts); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) +{ + int ret; + + ret = _pthread_rwlock_wrlock(rwlock); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) +{ + int ret; + + ret = _pthread_rwlock_trywrlock(rwlock); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts) +{ + int ret; + + ret = _pthread_rwlock_timedwrlock(rwlock, ts); + if (ret == 0) { + add_lock(rwlock); + } + + return (ret); +} + +int +pthread_rwlock_unlock(pthread_rwlock_t *rwlock) +{ + int ret; + + ret = _pthread_rwlock_unlock(rwlock); + if (ret == 0) { + remove_lock(rwlock); + } + + return (ret); +} From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 13:10:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 68E19106567E for ; Mon, 2 Jul 2012 13:10:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 13:10:06 +0000 Date: Mon, 02 Jul 2012 13:10:06 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702131006.68E19106567E@hub.freebsd.org> Cc: Subject: socsvn commit: r238804 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 13:10:07 -0000 Author: gmiller Date: Mon Jul 2 13:10:06 2012 New Revision: 238804 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238804 Log: r238821@FreeBSD-dev: root | 2012-06-29 15:25:31 -0500 Add wrappers for spinlocks. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:56 2012 (r238803) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:10:06 2012 (r238804) @@ -32,15 +32,18 @@ int _pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *ts); int _pthread_mutex_unlock(pthread_mutex_t *mutex); -int _pthread_rwlock_rdlock(pthread_rwlock_t *mutex); -int _pthread_rwlock_tryrdlock(pthread_rwlock_t *mutex); -int _pthread_rwlock_timedrdlock(pthread_rwlock_t *mutex, +int _pthread_rwlock_rdlock(pthread_rwlock_t *rwlock); +int _pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock); +int _pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *ts); -int _pthread_rwlock_wrlock(pthread_rwlock_t *mutex); -int _pthread_rwlock_trywrlock(pthread_rwlock_t *mutex); -int _pthread_rwlock_timedwrlock(pthread_rwlock_t *mutex, +int _pthread_rwlock_wrlock(pthread_rwlock_t *rwlock); +int _pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock); +int _pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts); -int _pthread_rwlock_unlock(pthread_rwlock_t *mutex); +int _pthread_rwlock_unlock(pthread_rwlock_t *rwlock); +int _pthread_spin_lock(pthread_spinlock_t *spin); +int _pthread_spin_trylock(pthread_spinlock_t *spin); +int _pthread_spin_unlock(pthread_spinlock_t *spin); pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -186,3 +189,42 @@ return (ret); } + +int +pthread_spin_lock(pthread_spinlock_t *spin) +{ + int ret; + + ret = _pthread_spin_lock(spin); + if (ret == 0) { + add_lock(spin); + } + + return (ret); +} + +int +pthread_spin_trylock(pthread_spinlock_t *spin) +{ + int ret; + + ret = _pthread_spin_lock(spin); + if (ret == 0) { + add_lock(spin); + } + + return (ret); +} + +int +pthread_spin_unlock(pthread_spinlock_t *spin) +{ + int ret; + + ret = _pthread_spin_unlock(spin); + if (ret == 0) { + remove_lock(spin); + } + + return (ret); +} From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 14:58:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A648F1065670 for ; Mon, 2 Jul 2012 14:58:04 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 14:58:04 +0000 Date: Mon, 02 Jul 2012 14:58:04 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702145804.A648F1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238805 - soc2012/jhagewood X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 14:58:05 -0000 Author: jhagewood Date: Mon Jul 2 14:58:04 2012 New Revision: 238805 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238805 Log: Deleted: soc2012/jhagewood/ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 14:58:15 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 69A62106566B for ; Mon, 2 Jul 2012 14:58:14 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 14:58:14 +0000 Date: Mon, 02 Jul 2012 14:58:14 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702145814.69A62106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238806 - soc2012/jhagewood X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 14:58:15 -0000 Author: jhagewood Date: Mon Jul 2 14:58:14 2012 New Revision: 238806 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238806 Log: Added: soc2012/jhagewood/ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 14:59:23 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 61A15106564A for ; Mon, 2 Jul 2012 14:59:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 14:59:21 +0000 Date: Mon, 02 Jul 2012 14:59:21 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702145922.61A15106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238807 - in soc2012/jhagewood: . diff diff/diff diff/diff-orig diff/gabor_diff diff3 diff3/diff3 diff3/diff3-orig mdocml mdocml/mdocml-1.12.1 mdocml/mdocml-1.12.1-orig mdocml/ports-... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 14:59:23 -0000 Author: jhagewood Date: Mon Jul 2 14:59:21 2012 New Revision: 238807 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238807 Log: Added: soc2012/jhagewood/Milestones soc2012/jhagewood/diff/ soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/ soc2012/jhagewood/diff/diff-orig/ soc2012/jhagewood/diff/diff-orig/Makefile soc2012/jhagewood/diff/diff-orig/diff (contents, props changed) soc2012/jhagewood/diff/diff-orig/diff.1 soc2012/jhagewood/diff/diff-orig/diff.1.gz (contents, props changed) soc2012/jhagewood/diff/diff-orig/diff.c soc2012/jhagewood/diff/diff-orig/diff.h soc2012/jhagewood/diff/diff-orig/diffdir.c soc2012/jhagewood/diff/diff-orig/diffreg.c soc2012/jhagewood/diff/diff-orig/pathnames.h soc2012/jhagewood/diff/diff-test.sh soc2012/jhagewood/diff/diff/Makefile soc2012/jhagewood/diff/diff/diff (contents, props changed) soc2012/jhagewood/diff/diff/diff.1 soc2012/jhagewood/diff/diff/diff.1.gz (contents, props changed) soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diff.h soc2012/jhagewood/diff/diff/diffdir.c soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/diff/pathnames.h soc2012/jhagewood/diff/gabor_diff/ soc2012/jhagewood/diff/gabor_diff/Makefile soc2012/jhagewood/diff/gabor_diff/diff.1 soc2012/jhagewood/diff/gabor_diff/diff.c soc2012/jhagewood/diff/gabor_diff/diff.h soc2012/jhagewood/diff/gabor_diff/diffdir.c soc2012/jhagewood/diff/gabor_diff/diffreg.c soc2012/jhagewood/diff/gabor_diff/pathnames.h soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/ soc2012/jhagewood/diff3/diff3/ soc2012/jhagewood/diff3/diff3-orig/ soc2012/jhagewood/diff3/diff3-orig/Makefile soc2012/jhagewood/diff3/diff3-orig/diff3.1 soc2012/jhagewood/diff3/diff3-orig/diff3.ksh soc2012/jhagewood/diff3/diff3-orig/diff3.sh soc2012/jhagewood/diff3/diff3-orig/diff3prog.c soc2012/jhagewood/diff3/diff3/Makefile soc2012/jhagewood/diff3/diff3/diff3.1 soc2012/jhagewood/diff3/diff3/diff3.ksh soc2012/jhagewood/diff3/diff3/diff3.sh soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch soc2012/jhagewood/mdocml/manpaths.txt soc2012/jhagewood/mdocml/mdocml-1.12.1/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/whatis.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h.orig soc2012/jhagewood/mdocml/mdocml-1.12.1/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig soc2012/jhagewood/mdocml/mdocml-1.12.1/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1/whatis.1 soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt soc2012/jhagewood/mdocml/ports-textproc-patches/ soc2012/jhagewood/mdocml/ports-textproc-patches/patch-config.txt soc2012/jhagewood/mdocml/ports-textproc-patches/patch-lib.in.txt soc2012/jhagewood/mdocml/ports-textproc-patches/patch-mdoc_validate.c soc2012/jhagewood/mdocml/ports-textproc-patches/patch-msec.in.txt soc2012/jhagewood/mdocml/tests/ soc2012/jhagewood/mdocml/tests/compile-man-pages.sh (contents, props changed) soc2012/jhagewood/mdocml/tests/mdocml-test.sh (contents, props changed) soc2012/jhagewood/sdiff/ soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/ soc2012/jhagewood/sdiff/sdiff-orig/ soc2012/jhagewood/sdiff/sdiff-orig/Makefile soc2012/jhagewood/sdiff/sdiff-orig/common.c soc2012/jhagewood/sdiff/sdiff-orig/common.h soc2012/jhagewood/sdiff/sdiff-orig/edit.c soc2012/jhagewood/sdiff/sdiff-orig/extern.h soc2012/jhagewood/sdiff/sdiff-orig/sdiff.1 soc2012/jhagewood/sdiff/sdiff-orig/sdiff.c soc2012/jhagewood/sdiff/sdiff-test.sh soc2012/jhagewood/sdiff/sdiff/Makefile soc2012/jhagewood/sdiff/sdiff/common.c soc2012/jhagewood/sdiff/sdiff/common.h soc2012/jhagewood/sdiff/sdiff/edit.c soc2012/jhagewood/sdiff/sdiff/extern.h soc2012/jhagewood/sdiff/sdiff/sdiff.1 soc2012/jhagewood/sdiff/sdiff/sdiff.c Added: soc2012/jhagewood/Milestones ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/Milestones Mon Jul 2 14:59:21 2012 (r238807) @@ -0,0 +1,30 @@ +May 21 - June 17 + + Implement missing features of mdocml, including legacy features. + Testing of mdocml. + +June 18 - July 1 + + Complete diff + Debugging and testing of diff + +July 2 - July 18 + + Mid-term evaluations. + Complete sdiff + Debugging and testing of sdiff + +July 19 - August 5 + + Complete diff3 + Debugging and testing of diff3 + +August 6 – August 12 + + Thouroughly test and benchmark all utilities. + +August 13 - August 20 + + "Pencils down" period. + Finish cleaning up code and do any testing that might be left. + Write documentation. Added: soc2012/jhagewood/diff/TODO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/TODO Mon Jul 2 14:59:21 2012 (r238807) @@ -0,0 +1,65 @@ +TASK STATUS NOTE + +--unified GNU compatibility COMPLETE Fixed timestamp. +--context GNU compatibility COMPLETE Fixed timestamp, will test more. +--ignore-blank-lines IN PROGRESS Was already implemented in check(), but has weird outputs. +--left-column COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff. +--show-function-line INCOMPLETE +--unidirectional-new-file INCOMPLETE +--normal COMPLETE Sets format to D_NORMAL in getopt_long(). +--suppress-common-lines COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff. +--GTYPE-group-format IN PROGRESS Added options for various GTYPEs. +--line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility +--LTYPE-line-format INCOMPLETE +--from-file COMPLETE Checks for flag then calls diffreg() with input files diff'd against optarg. +--to-file COMPLETE Checks for flag then calls diffreg() with optarg diff'd against input files. +--horizon-lines INCOMPLETE +--speed-large-file INCOMPLETE +--ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) +--width INCOMPLETE +--help COMPLETE +Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and detects if file is binary. +Test script COMPLETE + +Notes: + +- When using text files with non-ascii characters, diff will interpret them as binary files and output "Files [file1] and [file2] differ." + Very important compatibility problem with GNU diff, which will diff files that aren't strictly ascii. + - Error is associated with asciifile() in diffreg.c + - FIX: Changed name of asciifile() to istextfile() (more appropriate), and instead of checking if every character is ASCII, it checks the first 32kb of data in the file for a null character. If a null character is found, diff assumes that the file is a text file. +- With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. +- The -ignore-*-* options need some work. +- BUG: BSD diff seg faults when another longopt is used with '--side-by-side'. FIX: When passing args to sdiff for side-by-side mode, only the + short option '-y' was excluded. Added '--side-by-side' as an exception also. + +- line formats: + + %l Only includes contents of a line, excluding trailing new line. + %L Only includes contents of a line, including trailing new line. + %% Stand for '%' + %c'C' Where C is a character. + %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O. + Fn Where n is: + -'e' + -'f' + -'l' + -'m' + -'n' + -'E, F, L, M, N' + +- group formats: + + %< Stands for the lines from the first file, including trailing new lines. + %> Stands for the lines from the second file, including trailing new lines. + %= Stands for lines common to both files, including trailing new lines. + %% Stands for '%' + %c'C' Where C is a character. + %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O. + Fn Where n is: + -'e' + -'f' + -'l' + -'m' + -'n' + -'E, F, L, M, N' + Added: soc2012/jhagewood/diff/diff-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-orig/Makefile Mon Jul 2 14:59:21 2012 (r238807) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# $OpenBSD: Makefile,v 1.2 2003/06/25 02:42:50 deraadt Exp $ + +DEBUG_FLAGS+= -g + +PROG= diff +SRCS= diff.c diffdir.c diffreg.c +CFLAGS+= -std=c99 -Wall -pedantic + +.include Added: soc2012/jhagewood/diff/diff-orig/diff ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff-orig/diff.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-orig/diff.1 Mon Jul 2 14:59:21 2012 (r238807) @@ -0,0 +1,511 @@ +.\" $FreeBSD$ +.\" $OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $ +.\" +.\" Copyright (c) 1980, 1990, 1993 +.\" The Regents of the University of California. 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. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" @(#)diff.1 8.1 (Berkeley) 6/30/93 +.\" +.Dd Apr 7, 2008 +.Dt DIFF 1 +.Os +.Sh NAME +.Nm diff +.Nd differential file and directory comparator +.Sh SYNOPSIS +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Op Fl L Ar label +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl C Op Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilqtw +.Op Fl I Ar pattern +.Fl D Ar string +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl U Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilNPpqrsTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Bk -words +.Op Fl L Ar label +.Op Fl S Ar name +.Op Fl X Ar file +.Op Fl x Ar pattern +.Ek +.Ar dir1 dir2 +.Nm diff +.Op Fl v +.Sh DESCRIPTION +The +.Nm +utility compares the contents of +.Ar file1 +and +.Ar file2 +and writes to the standard output the list of changes necessary to +convert one file into the other. +No output is produced if the files are identical. +.Pp +Output options (mutually exclusive): +.Bl -tag -width Ds +.It Fl C Op Ar number , Fl Fl context Ns = Ns Op Ar number +Like +.Fl c +but produces a diff with +.Ar number +lines of context. +.It Fl c +Produces a diff with 3 lines of context. +With +.Fl c +the output format is modified slightly: +the output begins with identification of the files involved and +their creation dates and then each change is separated +by a line with fifteen +.Li * Ns 's . +The lines removed from +.Ar file1 +are marked with +.Sq \&-\ \& ; +those added to +.Ar file2 +are marked +.Sq \+\ \& . +Lines which are changed from one file to the other are marked in +both files with +.Sq !\ \& . +Changes which lie within 3 lines of each other are grouped together on +output. +.It Fl D Ar string , Fl Fl ifdef Ns = Ns Ar string +Creates a merged version of +.Ar file1 +and +.Ar file2 +on the standard output, with C preprocessor controls included so that +a compilation of the result without defining +.Ar string +is equivalent to compiling +.Ar file1 , +while defining +.Ar string +will yield +.Ar file2 . +.It Fl e , Fl Fl ed +Produces output in a form suitable as input for the editor utility, +.Xr ed 1 , +which can then be used to convert file1 into file2. +.Pp +Extra commands are added to the output when comparing directories with +.Fl e , +so that the result is a +.Xr sh 1 +script for converting text files which are common to the two directories +from their state in +.Ar dir1 +to their state in +.Ar dir2 . +.It Fl f +Identical output to that of the +.Fl e +flag, but in reverse order. +It cannot be digested by +.Xr ed 1 . +.It Fl n , Fl Fl rcs +Produces a script similar to that of +.Fl e , +but in the opposite order and with a count of changed lines on each +insert or delete command. +This is the form used by +.Xr rcsdiff 1 . +.It Fl q , Fl Fl brief +Just print a line when the files differ. +Does not output a list of changes. +.It Fl U Op Ar number , Fl Fl unified Ns = Ns Op Ar number +Like +.Fl u +but produces a diff with +.Ar number +lines of context. +.It Fl u +Produces a +.Em unified +diff with 3 lines of context. +A unified diff is similar to the context diff produced by the +.Fl c +option. +However, unlike with +.Fl c , +all lines to be changed (added and/or removed) are present in +a single section. +.El +.Pp +Comparison options: +.Bl -tag -width Ds +.It Fl a , Fl Fl text +Treat all files as +.Tn ASCII +text. +Normally +.Nm +will simply print +.Dq Binary files ... differ +if files contain binary characters. +Use of this option forces +.Nm +to produce a diff. +.It Fl b , Fl Fl ignore-space-change +Causes trailing blanks (spaces and tabs) to be ignored, and other +strings of blanks to compare equal. +.It Fl d , Fl Fl minimal +Try very hard to produce a diff as small as possible. +This may consume a lot of processing power and memory when processing +large files with many changes. +.It Fl I Ar pattern , Fl Fl ignore-matching-lines Ns = Ns Ar pattern +Ignores changes, insertions, and deletions whose lines match the +extended regular expression +.Ar pattern . +Multiple +.Fl I +patterns may be specified. +All lines in the change must match some pattern for the change to be +ignored. +See +.Xr re_format 7 +for more information on regular expression patterns. +.It Fl i , Fl Fl ignore-case +Ignores the case of letters. +E.g., +.Dq A +will compare equal to +.Dq a . +.It Fl L Ar label +Print +.Ar label +instead of the first (and second, if this option is specified twice) +file name and time in the context or unified diff header. +.It Fl l , Fl Fl paginate +Long output format; each text file +.Nm diff Ns \'d +is piped through +.Xr pr 1 +to paginate it; +other differences are remembered and summarized +after all text file differences are reported. +.It Fl p , Fl Fl show-c-function +With unified and context diffs, show with each change +the first 40 characters of the last line before the context beginning +with a letter, an underscore or a dollar sign. +For C source code following standard layout conventions, this will +show the prototype of the function the change applies to. +.It Fl T , Fl Fl initial-tab +Print a tab rather than a space before the rest of the line for the +normal, context or unified output formats. +This makes the alignment of tabs in the line consistent. +.It Fl t , Fl Fl expand-tabs +Will expand tabs in output lines. +Normal or +.Fl c +output adds character(s) to the front of each line which may screw up +the indentation of the original source lines and make the output listing +difficult to interpret. +This option will preserve the original source's indentation. +.It Fl w , Fl Fl ignore-all-space +Is similar to +.Fl b +but causes whitespace (blanks and tabs) to be totally ignored. +E.g., +.Dq if (\ \&a == b \&) +will compare equal to +.Dq if(a==b) . +.El +.Pp +Directory comparison options: +.Bl -tag -width Ds +.It Fl N , Fl Fl new-file +If a file is found in only one directory, act as if it was found in the +other directory too but was of zero size. +.It Fl P +If a file is found only in +.Ar dir2 , +act as if it was found in +.Ar dir1 +too but was of zero size. +.It Fl r , Fl Fl recursive +Causes application of +.Nm +recursively to common sub7 directories encountered. +.It Fl S Ar name , Fl starting-file Ns = Ns Ar name +Re-starts a directory +.Nm +in the middle, beginning with file +.Ar name . +.It Fl s , Fl Fl report-identical-files +Causes +.Nm +to report files which are the same, which are otherwise not mentioned. +.It Fl X Ar file , Fl Fl exclude-from Ns = Ns Ar file +Exclude files and subdirectories from comparison whose basenames match +lines in +.Ar file . +Multiple +.Fl X +options may be specified. +.It Fl x Ar pattern , Fl Fl exclude Ns = Ns Ar pattern +Exclude files and subdirectories from comparison whose basenames match +.Ar pattern . +Patterns are matched using shell-style globbing via +.Xr fnmatch 3 . +Multiple +.Fl x +options may be specified. +.It Fl v , Fl Fl version +Print version ino. +.El +.Pp +If both arguments are directories, +.Nm +sorts the contents of the directories by name, and then runs the +regular file +.Nm +algorithm, producing a change list, +on text files which are different. +Binary files which differ, +common subdirectories, and files which appear in only one directory +are described as such. +In directory mode only regular files and directories are compared. +If a non-regular file such as a device special file or +.Tn FIFO +is encountered, a diagnostic message is printed. +.Pp +If only one of +.Ar file1 +and +.Ar file2 +is a directory, +.Nm +is applied to the non-directory file and the file contained in +the directory file with a filename that is the same as the +last component of the non-directory file. +.Pp +If either +.Ar file1 +or +.Ar file2 +is +.Sq Fl , +the standard input is +used in its place. +.Ss Output Style +The default (without +.Fl e , +.Fl c , +or +.Fl n +.\" -C +options) +output contains lines of these forms, where +.Va XX , YY , ZZ , QQ +are line numbers respective of file order. +.Pp +.Bl -tag -width "XX,YYcZZ,QQ" -compact +.It Li XX Ns Ic a Ns Li YY +At (the end of) line +.Va XX +of +.Ar file1 , +append the contents +of line +.Va YY +of +.Ar file2 +to make them equal. +.It Li XX Ns Ic a Ns Li YY,ZZ +Same as above, but append the range of lines, +.Va YY +through +.Va ZZ +of +.Ar file2 +to line +.Va XX +of file1. +.It Li XX Ns Ic d Ns Li YY +At line +.Va XX +delete +the line. +The value +.Va YY +tells to which line the change would bring +.Ar file1 +in line with +.Ar file1 . +.It Li XX,YY Ns Ic d Ns Li ZZ +Delete the range of lines +.Va XX +through +.Va YY +in +.Ar file1 . +.It Li XX Ns Ic c Ns Li YY +Change the line +.Va XX +in +.Ar file1 +to the line +.Va YY +in +.Ar file2 . +.It Li XX,YY Ns Ic c Ns Li ZZ +Replace the range of specified lines with the line +.Va ZZ . +.It Li XX,YY Ns Ic c Ns Li ZZ,QQ +Replace the range +.Va XX , Ns Va YY +from +.Ar file1 +with the range +.Va ZZ , Ns Va QQ +from +.Ar file2 . +.El +.Pp +These lines resemble +.Xr ed 1 +subcommands to convert +.Ar file1 +into +.Ar file2 . +The line numbers before the action letters pertain to +.Ar file1 ; +those after pertain to +.Ar file2 . +Thus, by exchanging +.Ic a +for +.Ic d +and reading the line in reverse order, one can also +determine how to convert +.Ar file2 +into +.Ar file1 . +As in +.Xr ed 1 , +identical +pairs (where num1 = num2) are abbreviated as a single +number. +.Sh ENVIRONMENT +.Bl -tag -width TMPDIR +.It Ev TMPDIR +If the environment variable +.Ev TMPDIR +exists, +.Nm +will use the directory specified by +.Ev TMPDIR +as the temporary directory. +.El +.Sh FILES +.Bl -tag -width /tmp/diff.XXXXXXXX -compact +.It Pa /tmp/diff. Ns Ar XXXXXXXX +Temporary file used when comparing a device or the standard input. +Note that the temporary file is unlinked as soon as it is created +so it will not show up in a directory listing. +.El +.Sh DIAGNOSTICS +The +.Nm +utility exits with one of the following values: +.Pp +.Bl -tag -width Ds -compact -offset indent +.It 0 +No differences were found. +.It 1 +Differences were found. +.It \*(Gt1 +An error occurred. +.El +.Sh SEE ALSO +.Xr cmp 1 , +.Xr comm 1 , +.Xr diff3 1 , +.Xr ed 1 , +.Xr pr 1 , +.Xr sdiff 1 , +.Xr fnmatch 3 , +.Xr re_format 7 +.Sh STANDARDS +The +.Nm +utility is compliant with the +St -p1003.1-2004 +specification. +.Pp +The flags +.Op Fl aDdIiLlNnPpqSsTtUuwXx +are extensions to that specification. +.Sh HISTORY +A +.Nm +command appeared in +.At v6 . +.Sh BUGS +When comparing directories with the +.Fl b , +.Fl w +or +.Fl i +options specified, +.Nm +first compares the files ala +.Xr cmp 1 , +and then decides to run the +.Nm +algorithm if they are not equal. +This may cause a small amount of spurious output if the files +then turn out to be identical because the only differences are +insignificant whitespace or case differences. Added: soc2012/jhagewood/diff/diff-orig/diff.1.gz ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff-orig/diff.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-orig/diff.c Mon Jul 2 14:59:21 2012 (r238807) @@ -0,0 +1,599 @@ +/*- + * Copyright (c) 2003 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#include + +#ifndef lint +#if 0 +__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); +#else +__FBSDID("$FreeBSD$"); +#endif +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "diff.h" +#include "pathnames.h" + +int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; +int sflag, tflag, Tflag, wflag; +int Bflag, yflag; +int strip_cr, tabsize=8; +char ignore_file_case = 0; +int format, context, status; +char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +struct stat stb1, stb2; +struct excludes *excludes_list; +regex_t ignore_re; + +int flag_opts = 0; + +#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" + + +/* Options which exceed manageable alphanumeric assignments */ +enum +{ + OPT_IGN_FN_CASE = CHAR_MAX + 1, + OPT_NIGN_FN_CASE, + OPT_STRIPCR, + OPT_NORMAL, + OPT_LEFTC, + OT_SUPCL, + OPT_GTYPE, + OPT_LF, + OPT_LLF, + OPT_TSIZE, + OPT_UNINF, + OPT_FFILE, + OPT_TOFILE, + OPT_HLINES, + OPT_LFILES, + OPT_HELP, +}; + + +static struct option longopts[] = { +/* XXX: UNIMPLEMENTED + { "normal", no_argument, NULL, OPT_NORMAL }, + { "left-column", no_argument, NULL, OPT_LEFTC }, + { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, + { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, + { "line-format", required_argument, NULL, OPT_LF }, + { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, + { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, + { "from-file", required_argument, NULL, OPT_FFILE }, + { "to-file", required_argument, NULL, OPT_TOFILE }, + { "horizon-lines", required_argument, NULL, OPT_HLINES }, + { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, + { "help", no_argument, NULL, OPT_HELP }, + { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "text", no_argument, NULL, 'a' }, +/* XXX: UNIMPLEMENTED */ + { "ignore-blank-lines", no_argument, NULL, 'B' }, + { "ignore-space-change", no_argument, NULL, 'b' }, +/* XXX: -c is incompatible with GNU version */ + { "context", optional_argument, NULL, 'C' }, + { "ifdef", required_argument, NULL, 'D' }, + { "minimal", no_argument, NULL, 'd' }, +/* XXX: UNIMPLEMENTED + { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ + { "ed", no_argument, NULL, 'e' }, +/* XXX: UNIMPLEMENTED + { "show-function-line", required_argument, NULL, 'F' }, */ + { "forward-ed", no_argument, NULL, 'f' }, + { "ignore-matching-lines", required_argument, NULL, 'I' }, + { "ignore-case", no_argument, NULL, 'i' }, + { "label", required_argument, NULL, 'L' }, + { "paginate", no_argument, NULL, 'l' }, + { "new-file", no_argument, NULL, 'N' }, + { "rcs", no_argument, NULL, 'n' }, + { "unidirectional-new-file", no_argument, NULL, 'P' }, + { "show-c-function", no_argument, NULL, 'p' }, + { "brief", no_argument, NULL, 'q' }, + { "recursive", no_argument, NULL, 'r' }, + { "starting-file", required_argument, NULL, 'S' }, + { "report-identical-files", no_argument, NULL, 's' }, + { "initial-tab", no_argument, NULL, 'T' }, + { "expand-tabs", no_argument, NULL, 't' }, +/* XXX: -u is incompatible with GNU version */ + { "unified", optional_argument, NULL, 'U' }, + { "version", no_argument, NULL, 'v' }, +/* XXX: UNIMPLEMENTED + { "width", optional_argument, NULL, 'W' }, */ + { "ignore-all-space", no_argument, NULL, 'w' }, + { "exclude-from", required_argument, NULL, 'X' }, + { "exclude", required_argument, NULL, 'x' }, + { "side-by-side", no_argument, NULL, 'y' }, + { NULL, 0, NULL, '\0'} +}; + +static const char *help_msg[] = { +"-a --text treat files as ASCII text", +"-B --ignore-blank-lines Ignore blank newlines in the comparison", +"-b --ignore-space-change Ignore all changes due to whitespace", +"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", +"-D --ifdef=NAME", +NULL, +}; +char **help_strs = (char **)help_msg; + +void set_argstr(char **, char **); + + +void usage(void); +void push_excludes(char *); +void push_ignore_pats(char *); +void read_excludes_file(char *); + +int +main(int argc, char **argv) +{ + char *ep, **oargv; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; + + oargv = argv; + oargc = argc; + gotstdin = 0; + + lastch = '\0'; + prevoptind = 1; + newarg = 1; + while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) { + switch (ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (newarg) + usage(); /* disallow -[0-9]+ */ + else if (lastch == 'c' || lastch == 'u') + context = 0; + else if (!isdigit(lastch) || context > INT_MAX / 10) + usage(); + context = (context * 10) + (ch - '0'); + break; + case 'a': + aflag = 1; + break; + case 'b': + bflag = 1; + break; + case 'B': + Bflag = 1; + break; + case 'C': + case 'c': + format = D_CONTEXT; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'D': + format = D_IFDEF; + ifdefname = optarg; + break; + case 'd': + dflag = 1; + break; + case 'e': + format = D_EDIT; + break; + case 'f': + format = D_REVERSE; + break; + case 'h': + /* silently ignore for backwards compatibility */ + break; + case 'I': + push_ignore_pats(optarg); + break; + case 'i': + iflag = 1; + break; + case 'L': + if (label[0] == NULL) + label[0] = optarg; + else if (label[1] == NULL) + label[1] = optarg; + else + usage(); + break; + case 'l': + lflag = 1; + signal(SIGPIPE, SIG_IGN); + break; + case 'N': + Nflag = 1; + break; + case 'n': + format = D_NREVERSE; + break; + case 'P': + Pflag = 1; + break; + case 'p': + pflag = 1; + break; + case 'r': + rflag = 1; + break; + case 'q': + format = D_BRIEF; + break; + case 'S': + start = optarg; + break; + case 's': + sflag = 1; + break; + case 'T': + Tflag = 1; + break; + case 't': + tflag = 1; + break; + case 'U': + case 'u': + format = D_UNIFIED; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'v': + printf("FreeBSD diff 2.8.7\n"); + exit(0); + case 'w': + wflag = 1; + break; + case 'X': + read_excludes_file(optarg); + break; + case 'x': + push_excludes(optarg); + break; + case 'y': + yflag = 1; + break; + case OPT_TSIZE: + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 1 || l >= INT_MAX) + usage(); + tabsize = (int)l; + } else + tabsize = 8; + break; + case OPT_STRIPCR: + strip_cr=1; + break; + case OPT_IGN_FN_CASE: + ignore_file_case = 1; + break; + case OPT_NIGN_FN_CASE: + ignore_file_case = 0; + break; + case OPT_HELP: + for(;*help_strs;help_strs++) + { + printf("%s\n", *help_strs); + } + exit(2); + break; + default: + usage(); + break; + } + lastch = ch; + newarg = optind != prevoptind; + prevoptind = optind; + } + argc -= optind; + argv += optind; + + if(yflag) { + /* remove y flag from args and call sdiff */ + for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); + while(argv != &oargv[oargc]){ + *argv=*(argv+1); + argv++; + } + oargv[0] = _PATH_SDIFF; + *argv= "\0"; + + execv(_PATH_SDIFF, oargv); + _exit(127); + } + + /* + * Do sanity checks, fill in stb1 and stb2 and call the appropriate + * driver routine. Both drivers use the contents of stb1 and stb2. + */ + if (argc != 2) + usage(); + if (ignore_pats != NULL) { + char buf[BUFSIZ]; + int error; + + if ((error = regcomp(&ignore_re, ignore_pats, + REG_NEWLINE | REG_EXTENDED)) != 0) { + regerror(error, &ignore_re, buf, sizeof(buf)); + if (*ignore_pats != '\0') + errx(2, "%s: %s", ignore_pats, buf); + else + errx(2, "%s", buf); + } + } + if (strcmp(argv[0], "-") == 0) { + fstat(STDIN_FILENO, &stb1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 15:08:41 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B46B5106568A for ; Mon, 2 Jul 2012 15:08:39 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 15:08:39 +0000 Date: Mon, 02 Jul 2012 15:08:39 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702150839.B46B5106568A@hub.freebsd.org> Cc: Subject: socsvn commit: r238809 - in soc2012/jhagewood: diff diff3 mdocml sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 15:08:41 -0000 Author: jhagewood Date: Mon Jul 2 15:08:39 2012 New Revision: 238809 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238809 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/sdiff-test.sh Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jul 2 14:03:19 2012 (r238808) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jul 2 15:08:39 2012 (r238809) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-30 03:46:55.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-07-02 15:05:57.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -528,8 +528,8 @@ "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-30 03:36:16.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.h 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-07-02 15:05:57.000000000 -0400 @@ -48,6 +48,8 @@ #define D_NREVERSE 5 /* Reverse ed script with numbered lines and no trailing . */ @@ -553,8 +553,8 @@ extern char ignore_file_case; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-30 03:36:16.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-07-02 15:05:57.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -663,8 +663,8 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-30 03:44:30.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-07-02 15:05:57.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1354,8 +1354,8 @@ + file2, buf2); } diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h ---- jhagewood/diff/diff-orig/pathnames.h 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff/diff/pathnames.h 2012-06-30 03:36:16.000000000 -0400 +--- jhagewood/diff/diff-orig/pathnames.h 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-07-02 15:05:57.000000000 -0400 @@ -23,4 +23,5 @@ #include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jul 2 14:03:19 2012 (r238808) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jul 2 15:08:39 2012 (r238809) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-30 03:36:16.000000000 -0400 +--- jhagewood/diff3/diff3-orig/Makefile 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-07-02 15:05:57.000000000 -0400 @@ -6,6 +6,6 @@ BINDIR= /usr/libexec beforeinstall: @@ -10,8 +10,8 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-30 03:36:16.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-30 03:36:16.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-07-02 15:05:57.000000000 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Mon Jul 2 14:03:19 2012 (r238808) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Mon Jul 2 15:08:39 2012 (r238809) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-30 03:36:17.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-30 03:36:17.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-07-02 15:05:58.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-30 03:36:17.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-07-02 15:05:58.000000000 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-30 03:36:17.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-30 03:36:17.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-07-02 15:05:58.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-30 03:36:17.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-07-02 15:05:58.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Mon Jul 2 14:03:19 2012 (r238808) +++ soc2012/jhagewood/sdiff/TODO Mon Jul 2 15:08:39 2012 (r238809) @@ -0,0 +1,2 @@ +Combine diff-spec args and pipe to diff INCOMPLETE +Test script IN PROGRESS Modified: soc2012/jhagewood/sdiff/sdiff-test.sh ============================================================================== --- soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 14:03:19 2012 (r238808) +++ soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:08:39 2012 (r238809) @@ -0,0 +1,27 @@ +# Script for testing BSD sdiff outputs against GNU sdiff outputs. +# Jesse Hagewood +# jhagewood@freebsd.org + +#!/bin/sh + +rm -rf ./test_outputs +mkdir ./test_outputs +mkdir ./test_outputs/gnu +mkdir ./test_outputs/bsd + +run () { + +} + +DIR_PATH="./test_outputs/gnu" +DIFF_PATH="/usr/bin/sdiff" +run "$DIFF_PATH" "$DIR_PATH" +DIR_PATH="./test_outputs/bsd" +DIFF_PATH="./sdiff" +run "$DIFF_PATH" "$DIR_PATH" + +# +# Get the diff between the GNU sdiff and BSD sdiff outputs. +# + +diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-sdiff.txt From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 15:19:59 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 45ECF106567B for ; Mon, 2 Jul 2012 15:19:57 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 15:19:57 +0000 Date: Mon, 02 Jul 2012 15:19:57 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702151957.45ECF106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r238810 - soc2012/jhagewood/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 15:19:59 -0000 Author: jhagewood Date: Mon Jul 2 15:19:56 2012 New Revision: 238810 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238810 Log: Modified: soc2012/jhagewood/sdiff/sdiff-test.sh Modified: soc2012/jhagewood/sdiff/sdiff-test.sh ============================================================================== --- soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:08:39 2012 (r238809) +++ soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:19:56 2012 (r238810) @@ -11,6 +11,51 @@ run () { + # --ignore-case + $1 -i 1.txt 2.txt >> $2/ignrcase.txt + $1 --ignore-case 1.txt 2.txt >> $2/ignrcase.txt + + # --ignore-tab-expansion + $1 -E 1.txt 2.txt >> $2/ignrtabexp.txt + $1 --ignore-tab-expansion 1.txt 2.txt >> $2/ignrtabexp.txt + + # --ignore-space-change + $1 -b 1.txt 2.txt >> $2/ignrspacechg.txt + $1 --ignore-space-change 1.txt 2.txt >> $2/ignrspacechg.txt + + # --ignore-all-space + $1 -W 1.txt 2.txt >> $2/ignrallspace.txt + $1 --ignore-all-space 1.txt 2.txt >> $2/ignrallspace.txt + + # --ignore-blank-lines + $1 -B 1.txt 2.txt >> $2/ignrblanklines.txt + $1 --ignore-blank-lines 1.txt 2.txt >> $2/ignrblanklines.txt + + # --strip-trailing-cr + $1 --ignore-space-change 1.txt 2.txt >> $2/ignrspacechg.txt + + # --text + $1 -a 1.txt 2.txt >> $2/text.txt + $1 --text 1.txt 2.txt >> $2/text.txt + + # --width + $1 -w 50 1.txt 2.txt >> $2/width.txt + $1 --width="50" 1.txt 2.txt >> $2/width.txt + + # --left-column + $1 -l 1.txt 2.txt >> $2/leftcolumn.txt + $1 --left-column 1.txt 2.txt >> $2/leftcolumn.txt + + # --suppress-common-lines + $1 -s 1.txt 2.txt >> $2/suppresscl.txt + $1 --suppress-common-lines 1.txt 2.txt >> $2/suppresscl.txt + + # --expand-tabs + $1 -t 1.txt 2.txt >> $2/expandtabs.txt + $1 --expand-tabs 1.txt 2.txt >> $2/expandtabs.txt + + # --tabsize + $1 --tabsize="6" 1.txt 2.txt >> $2/tabsize.txt } DIR_PATH="./test_outputs/gnu" From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 15:23:03 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E7CD31065670 for ; Mon, 2 Jul 2012 15:23:00 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 15:23:00 +0000 Date: Mon, 02 Jul 2012 15:23:00 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702152300.E7CD31065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238811 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 15:23:03 -0000 Author: gpf Date: Mon Jul 2 15:23:00 2012 New Revision: 238811 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238811 Log: - make pefs verify work for unmounted fs or fs without key - use a flags variable in all major functions due to different semantics or code that should be used according to whether fs is mounted and has a key or not. code is a little crude at some points and requires comments, more testing and handling of a few todos that can be seen in xxx comment headers. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jul 2 15:19:56 2012 (r238810) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jul 2 15:23:00 2012 (r238811) @@ -187,34 +187,43 @@ static int pefs_compute_symlink_checksum(struct file_header *fhp, const EVP_MD *md, - uint8_t hash_len) + uint8_t hash_len, int flags) { struct pefs_xslink_ctext xsl; EVP_MD_CTX mdctx; + char *buf; int error, i, md_len; + size_t buf_len; struct checksum *csp; TAILQ_INIT(&(fhp->checksums)); fhp->nhashes = 0; - /* feed parent directory to ioctl() */ - strlcpy(xsl.pxsl_filename, fhp->filename, sizeof(xsl.pxsl_filename)); - xsl.pxsl_namelen = strnlen(xsl.pxsl_filename, sizeof(xsl.pxsl_filename)); - - error = ioctl(fhp->pfd, PEFS_GETSLINKCTEXT, &xsl); - if (error != 0) { - pefs_warn("error retrieving symlink's ciphertext of %s", fhp->path); - return (PEFS_ERR_IO); + if ((flags & PEFS_UNMOUNTED) != 0 || (flags & PEFS_NOKEY) != 0) { + buf = fhp->target_path; + buf_len = strnlen(fhp->target_path, MAXPATHLEN + 1); + } + else { + /* feed parent directory to ioctl() */ + strlcpy(xsl.pxsl_filename, fhp->filename, sizeof(xsl.pxsl_filename)); + xsl.pxsl_namelen = strnlen(xsl.pxsl_filename, sizeof(xsl.pxsl_filename)); + + error = ioctl(fhp->pfd, PEFS_GETSLINKCTEXT, &xsl); + if (error != 0) { + pefs_warn("error retrieving symlink's ciphertext of %s", fhp->path); + return (PEFS_ERR_IO); + } + + dprintf(("read %d bytes from kernel\n\n", xsl.pxsl_slink_len)); + dprintf(("printing contents of buf:")); + for (i=0; i < (int)xsl.pxsl_slink_len; i++) dprintf(("%c", xsl.pxsl_slink[i])); + dprintf(("!\n")); + buf = xsl.pxsl_slink; + buf_len = xsl.pxsl_slink_len; } - - dprintf(("read %d bytes from kernel\n\n", xsl.pxsl_slink_len)); - dprintf(("printing contents of buf:")); - for (i=0; i < (int)xsl.pxsl_slink_len; i++) dprintf(("%c", xsl.pxsl_slink[i])); - dprintf(("!\n")); - EVP_MD_CTX_init(&mdctx); EVP_DigestInit_ex(&mdctx, md, NULL); - EVP_DigestUpdate(&mdctx, xsl.pxsl_slink, xsl.pxsl_slink_len); + EVP_DigestUpdate(&mdctx, buf, buf_len); csp = malloc(sizeof(struct checksum)); if (csp == NULL) { @@ -243,18 +252,22 @@ static int pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, - uint8_t hash_len) + uint8_t hash_len, int flags) { struct pefs_xsector_ctext xsct; + char sector_buf[PEFS_SECTOR_SIZE]; EVP_MD_CTX mdctx; struct stat sb; - off_t resid; + off_t offset, resid; + FILE * fp; + char *buf; uint32_t bytes_to_read; + size_t buf_len; int error, i, md_len; struct checksum *csp; if (fhp->target_path != NULL) - return (pefs_compute_symlink_checksum(fhp, md, hash_len)); + return (pefs_compute_symlink_checksum(fhp, md, hash_len, flags)); TAILQ_INIT(&(fhp->checksums)); @@ -267,34 +280,58 @@ resid = sb.st_size; if (resid == 0) { pefs_warn("empty files are not allowed: %s", fhp->path); - return (PEFS_ERR_INVALID); + return (PEFS_ERR_GENERIC); + } + + fp = NULL; + if ((flags & PEFS_UNMOUNTED) != 0 || (flags & PEFS_NOKEY) != 0) { + fp = fdopen(fhp->fd, "r"); + if (fp == NULL) { + pefs_warn("could not open file for reading: %s", fhp->path); + return (PEFS_ERR_IO); + } } fhp->nhashes = 0; + offset = 0; xsct.pxsct_offset = 0; while (resid > 0) { if (resid > PEFS_SECTOR_SIZE) bytes_to_read = PEFS_SECTOR_SIZE; else bytes_to_read = resid; - - resid-=bytes_to_read; - xsct.pxsct_ctext_len = bytes_to_read; - error = ioctl(fhp->fd, PEFS_GETSECTORCTEXT, &xsct); - if (error != 0) { - pefs_warn("error retrieving ciphertext of %s", fhp->path); - return (PEFS_ERR_IO); + + if ((flags & PEFS_UNMOUNTED) != 0 || (flags & PEFS_NOKEY) != 0) { + fread(sector_buf, bytes_to_read, sizeof(char), fp); + if (ferror(fp)) { + pefs_warn("error reading from file: %s", fhp->path); + return (PEFS_ERR_IO); + } + buf = sector_buf; + buf_len = bytes_to_read; + resid-=bytes_to_read; + } + else { + resid-=bytes_to_read; + xsct.pxsct_ctext_len = bytes_to_read; + error = ioctl(fhp->fd, PEFS_GETSECTORCTEXT, &xsct); + if (error != 0) { + pefs_warn("error retrieving ciphertext of %s", fhp->path); + return (PEFS_ERR_IO); + } + xsct.pxsct_offset+= xsct.pxsct_ctext_len; + buf = xsct.pxsct_ctext; + buf_len = xsct.pxsct_ctext_len; } - xsct.pxsct_offset+= xsct.pxsct_ctext_len; EVP_MD_CTX_init(&mdctx); EVP_DigestInit_ex(&mdctx, md, NULL); - EVP_DigestUpdate(&mdctx, xsct.pxsct_ctext, xsct.pxsct_ctext_len); + EVP_DigestUpdate(&mdctx, buf, buf_len); - dprintf(("read %d bytes from kernel\n\n", bytes_to_read)); - dprintf(("printing contents of buffer:")); - for (i=0; i < (int)bytes_to_read; i++) dprintf(("%c", xsct.pxsct_ctext[i])); - dprintf(("!\n")); + //dprintf(("read %d bytes\n\n", buf_len)); + //dprintf(("printing contents of buffer:")); + //for (i=0; i < (int)buf_len; i++) dprintf(("%c", buf[i])); + //dprintf(("!\n")); csp = malloc(sizeof(struct checksum)); if (csp == NULL) { @@ -320,6 +357,15 @@ fhp->nhashes++; } + /* + * XXXgpf: [TODO] better move the fp into file_header struct and deal with + * closing it during pefs_file_close. + */ + if (fp != NULL) { + fclose(fp); + fhp->fd = -1; + } + return (0); } @@ -333,11 +379,11 @@ } static int -pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, int flags) +pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, int alloc_flag) { uint32_t i; - if (flags == PEFS_EXTEND) { + if (alloc_flag == PEFS_EXTEND) { /* * spending 15% more space for each table lowers the chance to fall into an * infinite loop during cuckoo insertion to about 1.5%. @@ -349,12 +395,12 @@ return (PEFS_ERR_GENERIC); } } - else if (flags == PEFS_NOEXTEND) { + else if (alloc_flag == PEFS_NOEXTEND) { chtp->size = nelements; chtp->nelements = nelements; } /* reallocate the hash tables in case of infinite loop during cuckoo insert */ - else if (flags == PEFS_REALLOC) { + else if (alloc_flag == PEFS_REALLOC) { chtp->size = pefs_next_prime(chtp->size + 1); if (chtp->size < chtp->nelements) { pefs_warn("numeric overflow while computing new hash table size"); @@ -582,11 +628,40 @@ * file id used is checksum = VMAC(E(tweak || filename)) */ static int -pefs_get_file_id(struct file_header *fhp) +pefs_get_file_id(struct file_header *fhp, int flags) { struct pefs_xnamecsum xncs; uint64_t temp; - int error; + char *enc, *buf; + int error, r; + size_t buf_len, enc_len; + + if ((flags & PEFS_NOKEY) != 0 || (flags & PEFS_UNMOUNTED) != 0) { + enc = fhp->filename; + enc_len = strnlen(fhp->filename, sizeof(fhp->filename)); + enc++; + enc_len--; + buf_len = MAXNAMLEN + 1; + buf = malloc(buf_len); + if (buf == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + r = pefs_name_pton(enc, enc_len, buf, buf_len); + if (r <= 0) { + pefs_warn("failed to extract file id from encrypted filename: %s", fhp->filename); + error = PEFS_ERR_GENERIC; + } + else { + memcpy(&temp, buf, sizeof(temp)); + fhp->file_id = be64toh(temp); + error = 0; + } + + free(buf); + return (error); + } strlcpy(xncs.pxnc_filename, fhp->filename, sizeof(xncs.pxnc_filename)); xncs.pxnc_namelen = strnlen(xncs.pxnc_filename, sizeof(xncs.pxnc_filename)); @@ -600,7 +675,7 @@ fhp->file_id = be64toh(temp); } else - pefs_warn("failed to fetch file id from kernel"); + pefs_warn("failed to fetch file id from kernel for filename: %s", fhp->filename); return (error); } @@ -662,7 +737,7 @@ continue; } - error = pefs_get_file_id(&targetfh); + error = pefs_get_file_id(&targetfh, 0); if (error == 0) { res = pefs_cuckoo_lookup(chtp, &targetfh); if (res == NULL) @@ -753,7 +828,7 @@ } static int -pefs_open_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp) +pefs_open_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp, int flags) { char dirbuf[MAXPATHLEN + 1], namebuf[MAXNAMLEN + 1]; char sbuf[MAXPATHLEN + 1]; @@ -840,9 +915,15 @@ * symlink. * e.g. a directory */ - if (lstat(fhp->target_path, &sb) != 0) { - warn("cannot stat symlink's target file %s", fhp->target_path); - return (PEFS_ERR_SYS); + if ((flags & PEFS_NOKEY) == 0 && (flags & PEFS_UNMOUNTED) == 0) { + /* + * If target_path is encrypted due to no key or unmounted fs, + * lstat will always fail. + */ + if (lstat(fhp->target_path, &sb) != 0) { + warn("cannot stat symlink's target file %s", fhp->target_path); + return (PEFS_ERR_SYS); + } } /* @@ -880,16 +961,18 @@ return (PEFS_ERR_INVALID); } - if (fstatfs(fhp->fd, &this_fs) == -1) { - pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); - return (PEFS_ERR_SYS); - } + if ((flags & PEFS_UNMOUNTED) == 0) { + if (fstatfs(fhp->fd, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); + return (PEFS_ERR_SYS); + } - if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || - (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { - pefs_warn("filename: %s does not reside in filesystem %s", - fhp->path, fsp->f_mntonname); - return (PEFS_ERR_INVALID); + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || + (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { + pefs_warn("filename: %s does not reside in filesystem %s", + fhp->path, fsp->f_mntonname); + return (PEFS_ERR_INVALID); + } } /* Keep all hardlink file headers in a rb tree */ @@ -977,19 +1060,19 @@ TAILQ_INIT(&fh_head); RB_INIT(&hlc_head); while((fhp = pefs_next_file(fpin, &error, &nfiles)) != NULL) { - error = pefs_open_semantic_checks(fhp, &fs, &hlc_head); + error = pefs_open_semantic_checks(fhp, &fs, &hlc_head, 0); if (error != 0) { pefs_close_file(fhp); return (error); } - error = pefs_get_file_id(fhp); + error = pefs_get_file_id(fhp, 0); if (error != 0) { pefs_close_file(fhp); return (error); } - error = pefs_compute_file_checksums(fhp, md, hash_len); + error = pefs_compute_file_checksums(fhp, md, hash_len, 0); if (error != 0) { pefs_close_file(fhp); return (error); @@ -1602,7 +1685,8 @@ */ static int pefs_traverse_fs(struct cuckoo_hash_table *chtp, const EVP_MD *md, uint8_t hash_len, DIR *dirp, - char *path, struct statfs *fsp, struct hardlink_head *hlc_headp, struct file_header_head *fh_headp) + char *path, struct statfs *fsp, struct hardlink_head *hlc_headp, struct file_header_head *fh_headp, + int flags) { char tmpath[MAXPATHLEN]; struct stat sb; @@ -1614,6 +1698,7 @@ while (dirp) { sdp = readdir(dirp); if (sdp != NULL) { + /* XXXgpf: Need to pay special attention to these files */ if (strcmp(sdp->d_name, "..") == 0 || strcmp(sdp->d_name, ".") == 0 || strcmp(sdp->d_name, ".pefs.db") == 0 || strcmp(sdp->d_name, ".pefs.conf") == 0 || strcmp(sdp->d_name, ".pefs.checksum") == 0) @@ -1629,7 +1714,7 @@ closedir(dirp); return (PEFS_ERR_SYS); } - error = pefs_traverse_fs(chtp, md, hash_len, dirtmp, tmpath, fsp, hlc_headp, fh_headp); + error = pefs_traverse_fs(chtp, md, hash_len, dirtmp, tmpath, fsp, hlc_headp, fh_headp, flags); if (error != 0) { closedir(dirp); return (PEFS_ERR_SYS); @@ -1652,14 +1737,15 @@ return (PEFS_ERR_SYS); } strlcpy(fhp->path, tmpath, sizeof(fhp->path)); - error = pefs_open_semantic_checks(fhp, fsp, NULL); + + error = pefs_open_semantic_checks(fhp, fsp, NULL, flags); if (error != 0) { closedir(dirp); free(fhp); return (error); } - error = pefs_get_file_id(fhp); + error = pefs_get_file_id(fhp, flags); if (error != 0) { pefs_close_file(fhp); free(fhp); @@ -1674,13 +1760,14 @@ } indexfhp->found = 1; - error = pefs_compute_file_checksums(fhp, md, hash_len); + error = pefs_compute_file_checksums(fhp, md, hash_len, flags); if (error != 0) { pefs_close_file(fhp); free(fhp); return (error); } + /* get sb for pefs_rb_insert */ error = lstat(fhp->path, &sb); if (error != 0) { warn("cannot stat file %s", fhp->path); @@ -1695,17 +1782,13 @@ free(fhp); return (error); } - + /* - * XXXgpf: there's a chance of a false positive here. - * When creating .pefs.checksum we only check if there's a file id - * collision between files that need integrity checking, not against - * the entire filesystem. So there's a possibility we will have a - * false positive in case there are 2 files with the same file id - * now that we traverse the entire fs. - * - * So should exit and treat a checksum comparison as an error? - */ + * XXXgpf: [TODO] if error encountered during + * pefs_compare_cehcksums, then store this information + * but keep on traversing the fs to find other errors + * as well. + */ error = pefs_compare_checksums(fhp, indexfhp, hash_len); //if (error != 0) { //pefs_close_file(fhp); @@ -1730,6 +1813,7 @@ return (PEFS_ERR_SYS); } +/* XXXgpf: probably turn this to int */ static void pefs_found_all_entries(struct cuckoo_hash_table *chtp) { @@ -1757,7 +1841,7 @@ * XXXgpf: [TODO] comments */ int -pefs_verify_checksum(int fdin, char *fsroot) +pefs_verify_checksum(int fdin, char *fsroot, int flags) { struct statfs fs; struct checksum_file_header cfh; @@ -1797,25 +1881,27 @@ //pefs_print_hash_tables(&cht, hash_len); + RB_INIT(&hlc_head); + TAILQ_INIT(&fh_head); + dirp = opendir(fsroot); if (dirp == NULL) { pefs_warn("failed to open dir %s", fsroot); return (PEFS_ERR_SYS); } - RB_INIT(&hlc_head); - TAILQ_INIT(&fh_head); - - error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot, &fs, &hlc_head, &fh_head); + error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot, &fs, &hlc_head, &fh_head, flags); if (error != 0) return (error); //pefs_rb_print(&hlc_head); pefs_rb_warn(&hlc_head); - pefs_symlink_warn(&cht, &fh_head); + if ((flags & PEFS_UNMOUNTED) == 0 && (flags & PEFS_NOKEY) == 0) + pefs_symlink_warn(&cht, &fh_head); pefs_found_all_entries(&cht); /* XXXgpf: [TODO] free mem in the end and when error occurs */ + /* XXXgpf: [TODO] verify action should also use a signature to verify .pefs.checksum */ return (0); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon Jul 2 15:19:56 2012 (r238810) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon Jul 2 15:23:00 2012 (r238811) @@ -1102,7 +1102,7 @@ /* * XXXgpf: Instead of a man page entry: * - * pefs verify checksumpath filesystem + * pefs verify [-u/-n] checksumpath filesystem * * $command ... * @@ -1112,12 +1112,27 @@ static int pefs_verify(int argc, char *argv[]) { + struct stat sb; char fsroot[MAXPATHLEN]; - int error, fdin, i; + int error, fdin, flags, i; - while ((i = getopt(argc, argv, "a:i:p:")) != -1) + flags = 0; + while ((i = getopt(argc, argv, "nu")) != -1) switch(i) { - /* XXXgpf: Should I add an option to tell if it's a mounted or unmounted fs ? */ + case 'n': + flags|= PEFS_NOKEY; + if ((flags & PEFS_UNMOUNTED) != 0) { + pefs_warn("flags -u and -n are mutually exclusive"); + return (PEFS_ERR_INVALID); + } + break; + case 'u': + flags|= PEFS_UNMOUNTED; + if ((flags & PEFS_NOKEY) != 0) { + pefs_warn("flags -u and -n are mutually exclusive"); + return (PEFS_ERR_INVALID); + } + break; default: pefs_usage(); } @@ -1140,15 +1155,28 @@ argc -=1; argv +=1; - /* XXXgpf: For now, assume that verify works only with a mounted pefs fs */ - initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); + if ((flags & PEFS_UNMOUNTED) == 0) + initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); + else { + strlcpy(fsroot, argv[0], sizeof(fsroot)); + if (stat(fsroot, &sb) != 0) { + warn("cannot stat fs root: %s", fsroot); + return (PEFS_ERR_NOENT); + } - error = pefs_verify_checksum(fdin, fsroot); + if (S_ISDIR(sb.st_mode) == 0) { + pefs_warn("fs root is not a directory: %s", fsroot); + return (PEFS_ERR_SYS); + } + } + + error = pefs_verify_checksum(fdin, fsroot, flags); if (error == 0) printf("everything's ok!\n"); close(fdin); return (error); + } static void @@ -1177,7 +1205,7 @@ " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" " pefs addchecksum [-a algo] [-i inputfile] [-p checksumpath] filesystem\n" -" pefs verify [checksumpath filesystem]\n" +" pefs verify [-n/u] [checksumpath filesystem]\n" ); exit(PEFS_ERR_USAGE); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Mon Jul 2 15:19:56 2012 (r238810) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Mon Jul 2 15:23:00 2012 (r238811) @@ -44,6 +44,9 @@ #define PEFS_FILE_KEYCONF ".pefs.conf" #define PEFS_FILE_CHECKSUM ".pefs.checksum" +#define PEFS_NOKEY 0x0001 +#define PEFS_UNMOUNTED 0x0002 + #define PEFS_KEYCONF_ALG_IND 0 #define PEFS_KEYCONF_ITERATIONS_IND 1 @@ -95,7 +98,9 @@ const struct pefs_xkey *xk_parent); uintmax_t pefs_keyid_as_int(char *keyid); int pefs_create_checksum_file(FILE *fpin, char *fsroot, char *csm_path, const char *algo); -int pefs_verify_checksum(int fdin, char *fsroot); +int pefs_verify_checksum(int fdin, char *fsroot, int flags); + +int pefs_name_pton(char const *src, size_t srclen, u_char *target, size_t targsize); const char * pefs_alg_name(struct pefs_xkey *xk); void pefs_alg_list(FILE *stream); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Mon Jul 2 15:19:56 2012 (r238810) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Mon Jul 2 15:23:00 2012 (r238811) @@ -74,3 +74,72 @@ return (0); } +#define Assert(Cond) (void)0 + +/* + * Algorithm is standard base64 with few exceptions: + * - file system friendly alphabet + * - no paddings and whitespace skip + */ +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_"; +int +pefs_name_pton(char const *src, size_t srclen, u_char *target, size_t targsize) +{ + int tarindex, state, ch; + char *pos; + + state = 0; + tarindex = 0; + + while ((ch = *src++) != '\0' && srclen-- > 0) { + if (target && (size_t)tarindex >= targsize) + return (-1); + + pos = strchr(Base64, ch); + if (pos == 0) /* A non-base64 character. */ + return (-1); + + switch (state) { + case 0: + if (target) { + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + target[tarindex] |= (pos - Base64) >> 4; + if ((size_t)tarindex + 1 < targsize) + target[tarindex+1] = + ((pos - Base64) & 0x0f) << 4 ; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + target[tarindex] |= (pos - Base64) >> 2; + if ((size_t)tarindex + 1 < targsize) + target[tarindex+1] = + ((pos - Base64) & 0x03) << 6; + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + default: + return (-1); + } + } + + if (tarindex == 0) + return (-1); + return (tarindex); +} From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 15:26:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A6C1E1065670 for ; Mon, 2 Jul 2012 15:26:12 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 15:26:12 +0000 Date: Mon, 02 Jul 2012 15:26:12 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702152612.A6C1E1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238812 - soc2012/jhagewood/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 15:26:14 -0000 Author: jhagewood Date: Mon Jul 2 15:26:12 2012 New Revision: 238812 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238812 Log: Modified: soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/sdiff-test.sh Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Mon Jul 2 15:23:00 2012 (r238811) +++ soc2012/jhagewood/sdiff/TODO Mon Jul 2 15:26:12 2012 (r238812) @@ -1,2 +1,2 @@ Combine diff-spec args and pipe to diff INCOMPLETE -Test script IN PROGRESS +Test script COMPLETE Modified: soc2012/jhagewood/sdiff/sdiff-test.sh ============================================================================== --- soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:23:00 2012 (r238811) +++ soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:26:12 2012 (r238812) @@ -56,6 +56,25 @@ # --tabsize $1 --tabsize="6" 1.txt 2.txt >> $2/tabsize.txt + + # --minimal + $1 -d 1.txt 2.txt >> $2/minimal.txt + $1 --minimal 1.txt 2.txt >> $2/minimal.txt + + # --speed-large-files + $1 -H 1.txt 2.txt >> $2/speedlrgfiles.txt + $1 --speed-large-files 1.txt 2.txt >> $2/speedlrgfiles.txt + + # --diff-program + $1 --diff-program="usr/bin/diff" 1.txt 2.txt >> $2/diffprog.txt + + # --output + $1 -o $2/output.txt 1.txt 2.txt + $1 --output=$2/output.txt 1.txt 2.txt + + # --ignore-matching-lines + $1 -I "test" 1.txt 2.txt >> $2/ignrmatchinglines.txt + $1 --ignore-matching-lines="test" 1.txt 2.txt >> $2/ignrmatchinglines.txt } DIR_PATH="./test_outputs/gnu" From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 16:10:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BC9C5106566C for ; Mon, 2 Jul 2012 16:10:03 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 16:10:03 +0000 Date: Mon, 02 Jul 2012 16:10:03 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702161003.BC9C5106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238814 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 16:10:05 -0000 Author: jhagewood Date: Mon Jul 2 16:10:03 2012 New Revision: 238814 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238814 Log: Modified: soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff-test.sh soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/TODO Mon Jul 2 16:10:03 2012 (r238814) @@ -1,2 +1,10 @@ Combine diff-spec args and pipe to diff INCOMPLETE Test script COMPLETE +Adapt code to FreeBSD style guidelines INCOMPLETE + +NOTES: + +- BUG: Right side of output is 2 spaces further than GNU sdiff's output. + -FIX: In println(), change column width to width-1, take out + extra space when it prints 'div' on no right column. + Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 16:10:03 2012 (r238814) @@ -0,0 +1,44 @@ +diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c +--- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-02 16:08:17.000000000 -0400 +@@ -101,7 +101,8 @@ enum { + HLINES_OPT, + LFILES_OPT, + DIFFPROG_OPT, +- ++ PIPE_FD, ++ + /* pid from the diff parent (if applicable) */ + DIFF_PID, + +@@ -474,7 +475,7 @@ printcol(const char *s, size_t *col, con + return; + + /* Round to next multiple of eight. */ +- new_col = (*col / 8 + 1) * 8; ++ new_col = (*col / 8 +1) * 8; + + /* + * If printing the tab goes past the column +@@ -604,7 +605,7 @@ println(const char *s1, const char div, + } + + /* Otherwise, we pad this column up to width. */ +- for (; col < width; ++col) ++ for (; col < width-1; ++col) + putchar(' '); + + /* +@@ -612,10 +613,10 @@ println(const char *s1, const char div, + * need to add the space for padding. + */ + if (!s2) { +- printf(" %c\n", div); ++ printf("%c\n", div); + return; + } +- printf(" %c ", div); ++ printf("%c ", div); + col += 3; + + /* Skip angle bracket and space. */ Modified: soc2012/jhagewood/sdiff/sdiff-test.sh ============================================================================== --- soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 16:10:03 2012 (r238814) @@ -66,11 +66,11 @@ $1 --speed-large-files 1.txt 2.txt >> $2/speedlrgfiles.txt # --diff-program - $1 --diff-program="usr/bin/diff" 1.txt 2.txt >> $2/diffprog.txt + $1 --diff-program="/usr/bin/diff" 1.txt 2.txt >> $2/diffprog.txt # --output - $1 -o $2/output.txt 1.txt 2.txt - $1 --output=$2/output.txt 1.txt 2.txt + $1 -o $2/output.txt 1.txt 2.txt >> /dev/null + $1 --output=$2/output.txt 1.txt 2.txt >> /dev/null # --ignore-matching-lines $1 -I "test" 1.txt 2.txt >> $2/ignrmatchinglines.txt Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 16:10:03 2012 (r238814) @@ -101,7 +101,8 @@ HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - + PIPE_FD, + /* pid from the diff parent (if applicable) */ DIFF_PID, @@ -474,7 +475,7 @@ return; /* Round to next multiple of eight. */ - new_col = (*col / 8 + 1) * 8; + new_col = (*col / 8 +1) * 8; /* * If printing the tab goes past the column @@ -604,7 +605,7 @@ } /* Otherwise, we pad this column up to width. */ - for (; col < width; ++col) + for (; col < width-1; ++col) putchar(' '); /* @@ -612,10 +613,10 @@ * need to add the space for padding. */ if (!s2) { - printf(" %c\n", div); + printf("%c\n", div); return; } - printf(" %c ", div); + printf("%c ", div); col += 3; /* Skip angle bracket and space. */ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 16:24:20 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C52FE106566B for ; Mon, 2 Jul 2012 16:24:18 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 16:24:18 +0000 Date: Mon, 02 Jul 2012 16:24:18 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702162418.C52FE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238815 - in soc2012/aleek/beaglexm-armv6/sys/arm/ti: . am37x X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 16:24:21 -0000 Author: aleek Date: Mon Jul 2 16:24:17 2012 New Revision: 238815 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238815 Log: adapting MMC driver to beagleboard Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Mon Jul 2 16:10:03 2012 (r238814) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Mon Jul 2 16:24:17 2012 (r238815) @@ -835,7 +835,6 @@ struct omap3_gptimer_softc *sc = device_get_softc(dev); omap3_gptimer_attach_common(dev); - //device_printf( dev, "Timer specyfic attaching...\n" ); /* Set the clock source for the timer, this is just a one to one * mapping of the clock id to timer, i.e. n=0 => GPTIMER1_CLK. */ Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Mon Jul 2 16:10:03 2012 (r238814) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Mon Jul 2 16:24:17 2012 (r238815) @@ -253,7 +253,7 @@ *(bus_addr_t *)arg = segs[0].ds_addr; } -#ifndef SOC_TI_AM335X +#if !defined(SOC_TI_AM335X) /** * ti_mmchs_dma_intr - interrupt handler for DMA events triggered by the controller * @ch: the dma channel number @@ -968,7 +968,7 @@ uint32_t hctl_reg; uint32_t con_reg; uint32_t sysctl_reg; -#ifndef SOC_TI_AM335X +#if !defined(SOC_TI_AM335X) && !defined(SOC_TI_AM37X) uint16_t mv; #endif unsigned long timeout; @@ -1011,12 +1011,12 @@ hctl_reg &= ~(MMCHS_HCTL_SDVS_MASK | MMCHS_HCTL_SDBP); if ((ios->vdd == -1) || (ios->vdd >= vdd_240)) { -#ifndef SOC_TI_AM335X +#if !defined(SOC_TI_AM335X) && !defined(SOC_TI_AM37X) mv = 3000; #endif hctl_reg |= MMCHS_HCTL_SDVS_V30; } else { -#ifndef SOC_TI_AM335X +#if !defined(SOC_TI_AM335X) && !defined(SOC_TI_AM37X) mv = 1800; #endif hctl_reg |= MMCHS_HCTL_SDVS_V18; @@ -1024,7 +1024,7 @@ ti_mmchs_write_4(sc, MMCHS_HCTL, hctl_reg); -#ifdef SOC_TI_AM335X +#if defined(SOC_TI_AM335X) || defined(SOC_TI_AM37X) printf("%s: TWL unimplemented\n", __func__); #else /* Set the desired voltage on the regulator */ @@ -1045,7 +1045,7 @@ hctl_reg = ti_mmchs_read_4(sc, MMCHS_HCTL); ti_mmchs_write_4(sc, MMCHS_HCTL, (hctl_reg & ~MMCHS_HCTL_SDBP)); -#ifdef SOC_TI_AM335X +#if defined(SOC_TI_AM335X) || defined(SOC_TI_AM37X) printf("%s: TWL unimplemented\n", __func__); #else /* Turn the power off on the voltage regulator */ @@ -1729,13 +1729,16 @@ #endif /* Activate the device */ + device_printf( dev, "Activating the device..." ); err = ti_mmchs_activate(dev); if (err) goto out; + device_printf( dev, "Initializing the device..." ); /* Initialise the controller */ ti_mmchs_hw_init(dev); + device_printf( dev, "Setting up interrupt the device..." ); /* Activate the interrupt and attach a handler */ err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_mmchs_intr, sc, &sc->sc_irq_h); @@ -1751,6 +1754,7 @@ device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); + device_printf( dev, "Attaching to bus..." ); err = bus_generic_attach(dev); out: From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 16:35:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1BB421065676 for ; Mon, 2 Jul 2012 16:35:02 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 16:35:02 +0000 Date: Mon, 02 Jul 2012 16:35:02 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702163502.1BB421065676@hub.freebsd.org> Cc: Subject: socsvn commit: r238816 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 16:35:04 -0000 Author: jhagewood Date: Mon Jul 2 16:35:01 2012 New Revision: 238816 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238816 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 16:24:17 2012 (r238815) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 16:35:01 2012 (r238816) @@ -1,6 +1,6 @@ diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-02 16:08:17.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-02 16:34:59.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -11,15 +11,6 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -474,7 +475,7 @@ printcol(const char *s, size_t *col, con - return; - - /* Round to next multiple of eight. */ -- new_col = (*col / 8 + 1) * 8; -+ new_col = (*col / 8 +1) * 8; - - /* - * If printing the tab goes past the column @@ -604,7 +605,7 @@ println(const char *s1, const char div, } Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 16:24:17 2012 (r238815) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 16:35:01 2012 (r238816) @@ -475,7 +475,7 @@ return; /* Round to next multiple of eight. */ - new_col = (*col / 8 +1) * 8; + new_col = (*col / 8 + 1) * 8; /* * If printing the tab goes past the column From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 18:49:13 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 777FD1065670 for ; Mon, 2 Jul 2012 18:49:11 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 18:49:11 +0000 Date: Mon, 02 Jul 2012 18:49:11 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702184911.777FD1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238829 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 18:49:13 -0000 Author: oleksandr Date: Mon Jul 2 18:49:10 2012 New Revision: 238829 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238829 Log: add function udf_release_system_nodes for release nodes and udf_unmount_sanity_check for debug and some small correction Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 17:55:29 2012 (r238828) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Mon Jul 2 18:49:10 2012 (r238829) @@ -537,7 +537,7 @@ slot, &s_icb_loc, &eof); if (eof) { UDF_UNLOCK_NODE(ump->metadata_node, 0); - return IEINVAL); + return (EINVAL); } len = le32toh(s_icb_loc.len); flags = UDF_EXT_FLAGS(len); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 17:55:29 2012 (r238828) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jul 2 18:49:10 2012 (r238829) @@ -296,6 +296,7 @@ } +#endif int udf_synchronise_caches(struct udf_mount *ump) { @@ -314,14 +315,13 @@ mmc_op.operation = MMC_OP_SYNCHRONISECACHE; /* ignore return code */ - (void) VOP_IOCTL(ump->devvp, MMCOP, &mmc_op, FKIOCTL, NOCRED); + (void) VOP_IOCTL(ump->devvp, MMCOP, &mmc_op, FKIOCTL, NOCRED, curthread); return (0); } /* --------------------------------------------------------------------- */ -#endif /* track/session searching for mounting */ int udf_search_tracks(struct udf_mount *ump, struct udf_args *args, @@ -6457,11 +6457,10 @@ mutex_exit(&mntvnode_lock); } -#endif - /* --------------------------------------------------------------------- */ +#endif /* * Read and write file extent in/from the buffer. * Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Mon Jul 2 17:55:29 2012 (r238828) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Mon Jul 2 18:49:10 2012 (r238829) @@ -39,7 +39,7 @@ int *first_tracknr, int *last_tracknr); //int udf_search_writing_tracks(struct udf_mount *ump); //int udf_setup_writeparams(struct udf_mount *ump); -//int udf_synchronise_caches(struct udf_mount *ump); +int udf_synchronise_caches(struct udf_mount *ump); /* tags operations */ int udf_fidsize(struct fileid_desc *fid); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 17:55:29 2012 (r238828) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 18:49:10 2012 (r238829) @@ -116,6 +116,36 @@ /* --------------------------------------------------------------------- */ +/* if the system nodes exist, release them */ +static void +udf_release_system_nodes(struct mount *mp) +{ + struct udf_mount *ump = VFSTOUDF(mp); + int error; + + /* if we haven't even got an ump, dont bother */ + if (!ump) + return; + + /* VAT partition support */ + if (ump->vat_node) + vrele(ump->vat_node->vnode); + + /* Metadata partition support */ + if (ump->metadata_node) + vrele(ump->metadata_node->vnode); + if (ump->metadatamirror_node) + vrele(ump->metadatamirror_node->vnode); + if (ump->metadatabitmap_node) + vrele(ump->metadatabitmap_node->vnode); + + /* This flush should NOT write anything nor allow any node to remain */ + if ((error = vflush(ump->vfs_mountp, 0, 0, curthread))) + panic("Failure to flush UDF system vnodes\n"); +} + +/* --------------------------------------------------------------------- */ + #define MPFREE(a, lst) \ if ((a)) free((a), lst); static void @@ -129,18 +159,6 @@ ump = VFSTOUDF(mp); if (ump) { - /* VAT partition support */ - if (ump->vat_node) - udf_dispose_node(ump->vat_node); - - /* Metadata partition support */ - if (ump->metadata_node) - udf_dispose_node(ump->metadata_node); - if (ump->metadatamirror_node) - udf_dispose_node(ump->metadatamirror_node); - if (ump->metadatabitmap_node) - udf_dispose_node(ump->metadatabitmap_node); - /* clear our data */ for (i = 0; i < UDF_ANCHORS; i++) MPFREE(ump->anchors[i], M_UDFTEMP); @@ -274,7 +292,6 @@ } /* --------------------------------------------------------------------- */ -#if 0 #ifdef DEBUG static void udf_unmount_sanity_check(struct mount *mp) @@ -282,7 +299,7 @@ struct vnode *vp; printf("On unmount, i found the following nodes:\n"); - TAILQ_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes) { + TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { vprint("", vp); if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) { printf(" is locked\n"); @@ -292,7 +309,7 @@ } } #endif -#endif + int udf_unmount(struct mount *mp, int mntflags) @@ -300,58 +317,61 @@ struct udf_mount *ump; int error, flags = 0; - ump = VFSTOUDF(mp); + DPRINTF(CALL, ("udf_unmount called\n")); + ump = VFSTOUDF(mp); if (!ump) panic("UDF unmount: empty ump\n"); flags = (mntflags & MNT_FORCE) ? FORCECLOSE : 0; /* TODO remove these paranoid functions */ -#if 0 #ifdef DEBUG if (udf_verbose & UDF_DEBUG_LOCKING) udf_unmount_sanity_check(mp); #endif -#endif + /* * By specifying SKIPSYSTEM we can skip vnodes marked with VV_SYSTEM. * This hardly documented feature allows us to exempt certain files * from being flushed. */ - if ((error = vflush(mp, 0, flags, curthread)) != 0) + if ((error = vflush(mp, 0, flags, curthread))) return (error); /* update nodes and wait for completion of writeout of system nodes */ -#if 0 - udf_sync(mp, FSYNC_WAIT, NOCRED); + //udf_sync(mp, FSYNC_WAIT, NOCRED); #ifdef DEBUG if (udf_verbose & UDF_DEBUG_LOCKING) udf_unmount_sanity_check(mp); #endif - +#if 0 /* flush again, to check if we are still busy for something else */ - if ((error = vflush(ump->vfs_mountp, NULLVP, flags | SKIPSYSTEM)) != 0) + if ((error = vflush(ump->vfs_mountp, 0, flags, curthread))) return (error); /* close logical volume and close session if requested */ if ((error = udf_close_logvol(ump, mntflags)) != 0) return (error); +#endif + #ifdef DEBUG DPRINTF(VOLUMES, ("FINAL sanity check\n")); if (udf_verbose & UDF_DEBUG_LOCKING) udf_unmount_sanity_check(mp); #endif -#endif + + /* NOTE release system nodes should NOT write anything */ + udf_release_system_nodes(mp); #if 0 /* finalise disc strategy */ udf_discstrat_finish(ump); +#endif /* synchronise device caches */ (void) udf_synchronise_caches(ump); -#endif /* TODO: clean up iconv here */ if (ump->iconv_d2l) @@ -378,6 +398,7 @@ mp->mnt_flag &= ~MNT_LOCAL; MNT_IUNLOCK(mp); + DPRINTF(VOLUMES, ("Fin unmount\n")); return (0); } @@ -810,7 +831,6 @@ printf("UDF: skipping autosync\n"); return (0); } - /* get sync lock */ ump->syncing = 1; @@ -822,11 +842,10 @@ DPRINTF(CALL, ("end of udf_sync()\n")); ump->syncing = 0; - return (0); } -#endif +#endif /* This added only for temp use */ struct udf_node * udf_alloc_node() From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 19:56:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9B4A51065706 for ; Mon, 2 Jul 2012 19:56:54 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 19:56:54 +0000 Date: Mon, 02 Jul 2012 19:56:54 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702195654.9B4A51065706@hub.freebsd.org> Cc: Subject: socsvn commit: r238832 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 19:56:56 -0000 Author: rudot Date: Mon Jul 2 19:56:53 2012 New Revision: 238832 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238832 Log: fixed hanging of make buildworld - proper handling of zombies Modified: soc2012/rudot/sys/kern/kern_racct.c Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Mon Jul 2 18:35:08 2012 (r238831) +++ soc2012/rudot/sys/kern/kern_racct.c Mon Jul 2 19:56:53 2012 (r238832) @@ -973,13 +973,14 @@ for (;;) { sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { + LIST_FOREACH(p, &zombproc, p_list) { PROC_LOCK(p); - if (p->p_state == PRS_ZOMBIE) { - pct = racct_getpcpu(p); - racct_set(p, RACCT_PCTCPU, pct); - } + racct_set(p, RACCT_PCTCPU, 0); + PROC_UNLOCK(p); + } + FOREACH_PROC_IN_SYSTEM(p) { + PROC_LOCK(p); if (p->p_state != PRS_NORMAL) { PROC_UNLOCK(p); continue; From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 20:24:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B038F106564A for ; Mon, 2 Jul 2012 20:24:04 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 20:24:04 +0000 Date: Mon, 02 Jul 2012 20:24:04 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702202404.B038F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238839 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 20:24:06 -0000 Author: oleksandr Date: Mon Jul 2 20:24:02 2012 New Revision: 238839 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238839 Log: Reformat some part of code and and debug DPRINTF Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 19:56:31 2012 (r238838) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jul 2 20:24:02 2012 (r238839) @@ -715,10 +715,13 @@ struct udf_mount *ump = VFSTOUDF(mp); ino_t ino; int error; + + DPRINTF(CALL, ("udf_root called\n")); dir_loc = &ump->fileset_desc->rootdir_icb; ino = udf_get_node_id(dir_loc); error = udf_vget(mp, ino, flags, vpp); + if (!((*vpp)->v_vflag & VV_ROOT)) { printf("NOT A ROOT NODE?"); return (EDOOFUS); @@ -734,14 +737,12 @@ struct udf_mount *ump = VFSTOUDF(mp); struct logvol_int_desc *lvid; struct udf_logvol_info *impl; - uint64_t sizeblks, freeblks, files; + uint64_t sizeblks, freeblks, files = 0; int num_part; -/* mutex_enter(&ump->allocate_mutex); */ + DPRINTF(CALL, ("udf_statvfs called\n")); + /* mutex_enter(&ump->allocate_mutex); */ udf_calc_freespace(ump, &sizeblks, &freeblks); - //sizeblks = 0; // added to make if just compile. - //freeblks = 0; - files = 0; lvid = ump->logvol_integrity; num_part = le32toh(lvid->num_part); @@ -752,29 +753,28 @@ } /* mutex_exit(&ump->allocate_mutex); */ - sbp->f_version = STATFS_VERSION; /* structure version number */ - /*uint32_t f_type;*/ /* type of filesystem */ - sbp->f_flags = mp->mnt_flag; /* copy of mount exported flags */ + sbp->f_version = STATFS_VERSION; /* structure version number */ + /*uint32_t f_type;*/ /* type of filesystem */ + sbp->f_flags = mp->mnt_flag; /* copy of mount exported flags */ sbp->f_bsize = ump->discinfo.sector_size; /* filesystem fragment size */ sbp->f_iosize = ump->discinfo.sector_size; /* optimal transfer block size */ - sbp->f_blocks = sizeblks; /* total data blocks in filesystem */ - sbp->f_bfree = freeblks; /* free blocks in filesystem */ - sbp->f_bavail = 0; /* free blocks avail to non-superuser */ - sbp->f_files = files; /* total file nodes in filesystem */ - sbp->f_ffree = 0; /* free nodes avail to non-superuser */ - /*uint64_t f_syncwrites;*/ /* count of sync writes since mount */ - /*uint64_t f_asyncwrites;*/ /* count of async writes since mount */ - /*uint64_t f_syncreads;*/ /* count of sync reads since mount */ - /*uint64_t f_asyncreads;*/ /* count of async reads since mount */ - /*uint64_t f_spare[10];*/ /* unused spare */ - /*uint32_t f_namemax;*/ /* maximum filename length */ - /*uid_t f_owner;*/ /* user that mounted the filesystem */ - /*fsid_t f_fsid;*/ /* filesystem id */ - /*char f_charspare[80];*/ /* spare string space */ - /*char f_fstypename[MFSNAMELEN];*/ /* filesystem type name */ - /*char f_mntfromname[MNAMELEN];*/ /* mounted filesystem */ - /*char f_mntonname[MNAMELEN];*/ /* directory on which mounted */ - + sbp->f_blocks = sizeblks; /* total data blocks in filesystem */ + sbp->f_bfree = freeblks; /* free blocks in filesystem */ + sbp->f_bavail = 0; /* free blocks avail to non-superuser */ + sbp->f_files = files; /* total file nodes in filesystem */ + sbp->f_ffree = 0; /* free nodes avail to non-superuser */ + /*uint64_t f_syncwrites;*/ /* count of sync writes since mount */ + /*uint64_t f_asyncwrites;*/ /* count of async writes since mount */ + /*uint64_t f_syncreads;*/ /* count of sync reads since mount */ + /*uint64_t f_asyncreads;*/ /* count of async reads since mount */ + /*uint64_t f_spare[10];*/ /* unused spare */ + /*uint32_t f_namemax;*/ /* maximum filename length */ + /*uid_t f_owner;*/ /* user that mounted the filesystem */ + /*fsid_t f_fsid;*/ /* filesystem id */ + /*char f_charspare[80];*/ /* spare string space */ + /*char f_fstypename[MFSNAMELEN];*/ /* filesystem type name */ + /*char f_mntfromname[MNAMELEN];*/ /* mounted filesystem */ + /*char f_mntonname[MNAMELEN];*/ /* directory on which mounted */ return (0); } @@ -876,6 +876,7 @@ struct udf_mount *ump; int error, udf_file_type; + DPRINTF(NOTIMPL, ("udf_vget called\n")); error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL); if (error || *vpp != NULL) return (error); @@ -994,8 +995,7 @@ uint64_t filelen; int error; - error = VFS_VGET(mp, ufid->ino, LK_EXCLUSIVE, &nvp); - if (error != 0) { + if ((error = VFS_VGET(mp, ufid->ino, LK_EXCLUSIVE, &nvp)) != 0) { *vpp = NULLVP; return (error); } From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:07:41 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 6C6E9106566C for ; Mon, 2 Jul 2012 21:07:39 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:07:39 +0000 Date: Mon, 02 Jul 2012 21:07:39 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702210739.6C6E9106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238851 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:07:41 -0000 Author: scher Date: Mon Jul 2 21:07:39 2012 New Revision: 238851 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238851 Log: [docs] and some format changes Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jul 2 20:42:43 2012 (r238850) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jul 2 21:07:39 2012 (r238851) @@ -5122,6 +5122,7 @@ .if !defined(NO_DEPENDS) @if [ ! ${INSTALLS_DEPENDS} ]; then \ trap '${_TERMINATE_PROCESS_TREE}' EXIT INT TERM; \ + trap 'exit 1' INT TERM; \ fi; \ depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ @@ -5261,6 +5262,7 @@ .if defined(LIB_DEPENDS) && !defined(NO_DEPENDS) @if [ ! ${INSTALLS_DEPENDS} ]; then \ trap '${_TERMINATE_PROCESS_TREE}' EXIT INT TERM; \ + trap 'exit 1' INT TERM; \ fi; \ depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:21:57 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id ACAE01065670 for ; Mon, 2 Jul 2012 21:21:55 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:21:55 +0000 Date: Mon, 02 Jul 2012 21:21:55 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702212155.ACAE01065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238852 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:21:57 -0000 Author: syuu Date: Mon Jul 2 21:21:54 2012 New Revision: 238852 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238852 Log: register dump on vmcall handler Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Mon Jul 2 21:07:39 2012 (r238851) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Mon Jul 2 21:21:54 2012 (r238852) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -435,8 +436,34 @@ static int vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + int error; + uint64_t rsp, rip, rax, rbx, rcx, rdx; + uint64_t intr; + + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RSP, &rsp); + if (!error) + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RIP, &rip); + if (!error) + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RAX, &rax); + if (!error) + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RBX, &rbx); + if (!error) + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RCX, &rcx); + if (!error) + error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RDX, &rdx); + + if (error) { + printf("errno = %d\n", errno); + return (VMEXIT_ABORT); + } + printf("VMCALL handled\n"); - exit(1); + printf("rsp=%"PRIx64" rip=%"PRIx64" rax=%"PRIx64" rbx=%"PRIx64" rcx=%"PRIx64" rdx=%"PRIx64"\n", + rsp, rip, rax, rbx, rcx, rdx); + intr = (rip - 0x401) / 0x10; + printf("intr=%"PRIu64"\n", intr); + + return (VMEXIT_ABORT); return (VMEXIT_RESTART); } From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:24:08 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 24241106564A for ; Mon, 2 Jul 2012 21:24:06 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:24:06 +0000 Date: Mon, 02 Jul 2012 21:24:06 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702212406.24241106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238853 - soc2012/syuu/bhyve-bios/lib/libvmmapi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:24:08 -0000 Author: syuu Date: Mon Jul 2 21:24:05 2012 New Revision: 238853 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238853 Log: change register values for boot from disk Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Mon Jul 2 21:21:54 2012 (r238852) +++ soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Mon Jul 2 21:24:05 2012 (r238853) @@ -50,10 +50,7 @@ uint32_t desc_access, desc_limit; uint16_t gsel; -#if 0 - rip = 0xfff0; -#endif - rip = 0x0; + rip = 0x7c00; if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RIP, rip)) != 0) goto done; @@ -73,9 +70,6 @@ if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0) goto done; -#if 0 - desc_base = 0xffff0000; -#endif desc_base = 0x0; desc_limit = 0xffff; /* PRESENT | DESC_TYPE_CODEDATA | SEG_TYPE_DATA_RW_ACCESSED */ @@ -85,9 +79,6 @@ if (error) goto done; -#if 0 - gsel = 0xf000; -#endif gsel = 0x0; if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CS, gsel)) != 0) goto done; @@ -173,7 +164,7 @@ if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RBP, rbp)) != 0) goto done; - rsp = 0; + rsp = 0x8000 - 2; if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSP, rsp)) != 0) goto done; From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:28:44 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BB26E106564A for ; Mon, 2 Jul 2012 21:28:42 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:28:42 +0000 Date: Mon, 02 Jul 2012 21:28:42 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702212842.BB26E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238854 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:28:44 -0000 Author: scher Date: Mon Jul 2 21:28:42 2012 New Revision: 238854 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238854 Log: [bugfix] fixed bug, when in some cases keyboard interrupts were not triggered by trap in XXX-depends targets Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jul 2 21:24:05 2012 (r238853) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jul 2 21:28:42 2012 (r238854) @@ -14,7 +14,7 @@ # matter what value is assigned. # Example: _parv_WANT_PARALLEL_BUILD=yes # -# _parv_CHECK_ACTIVE_TIMEOUT - timeout in seconds before next check of active +# _parv_CHECK_ACTIVE_TIMEOUT - timeout in seconds before next check of active # builds in case if port is prohibit to spawn # another background process. Consider that this # variable is also used in non-parallel build. @@ -34,7 +34,7 @@ # next attempt to lock a directory. Default: 2 # # _parv_ON_LOCK_FEEDBACK_TIMEOUT -while trying to lock a directory in "while" -# loop, if the directory is locked, user +# loops, if the directory is locked, user # feedback is printed once in # ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} attempts. # Default: 2 @@ -46,6 +46,9 @@ # ${_parv_DEFAULT_PAR_BUILDS_NUM}, then it will # be set to ${_parv_DEFAULT_PAR_BUILDS_NUM}. # +# _parv_PORTS_LOGS_DIR - directory that contains dependency ports' log files. +# Default: /tmp/portslogs +# # The following variables are not assumed to be changed by user # # _parv_ON_LOCK_EXIT_STATUS - if the directory is locked script exits with @@ -67,6 +70,16 @@ # This file contains PID of the process, that # locked ${LOCK_DIR}. # +# _parv_PORT_LOG_FILE - name of dependency port's log file. +# Value: $$(cd $$dir; ${MAKE} -V PKGNAME)-spawned-by-pid${.MAKE.PID}.log +# where $${dir} is a dependency port's directory +# in ports tree. +# +# _parv_CHECKED_CONFIG_F_PREFIX - file name prefix for file in which already +# checked directories are stored while evaluating +# "config-recursive" target. Full file name is +# ${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID} +# # _parv_DEFAULT_TARGETS - sequence of bsd.port.mk targets. If at least # one of this targets is encounted in ${.TARGETS} # then port's directory has to be locked. @@ -74,6 +87,24 @@ # _parv_DEFAULT_PAR_BUILDS_NUM - default number of parallel dependency builds. # Value: number of logical CPUs on user's machine. # +# The following targets may be used by user +# +# check-license-depends - license checking for port's dependencies. +# Does not lock any directory. +# If any dependencies need to ask for comfirmation +# then port's build stops, and user is listed all +# ports that will ask for licences checking. +# Then a user will have to eval "make patch" for the +# above mentioned ports. Only if no dependencies +# require license confirmation parallel ports build +# will be allowed. +# +# locking-config-recursive - Configure options for current port and all dependencies +# recursively, while holding lock on +# ${_parv_PORT_DBDIR_LOCK_LOOP}. Considers dynamic +# changes in port's dependencies. Skips already checked +# ports. +# .if !defined(_POSTMKINCLUDED) && !defined(Parallel_Pre_Include) Parallel_Pre_Include= bsd.parallel.mk @@ -84,7 +115,7 @@ _parv_KILL_SIGNAL= USR1 _parv_PKILL= /bin/pkill _parv_PKILL_FLAGS= -P -_parv_UMASK= 777 +_parv_UMASK= 0644 DO_NADA?= ${TRUE} # End of Commands section @@ -140,20 +171,19 @@ ##################################################### # Locking variables and tools -# TODO: docs is needed _parv_PORTS_LOGS_DIR?= /tmp/portslogs LOCK_DIR?= /var/db/portslocks _parv_PKG_DBDIR_LOCK_FILE= .lock _parv_PORT_DBDIR_LOCK_FILE= .lock _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} -# TODO: docs is needed _parv_PORT_LOG_FILE= $$(cd $$dir; ${MAKE} -V PKGNAME)-spawned-by-pid${.MAKE.PID}.log +_parv_CHECKED_CONFIG_F_PREFIX= already-checked-config + _parv_WAIT_FOR_LOCK_TIME?= 5 _parv_WAIT_FOR_UNLOCK_TIME?= 15 _parv_LOCK_ATTEMPT_TIMEOUT?= 2 -# TODO: change docs _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2 _parv_CHECK_ACTIVE_TIMEOUT?= 2 @@ -163,20 +193,6 @@ _parv_MAKE_LOCK_EXIT_STATUS= 158 -_parv_CHECK_DIRS_SANITY= \ - if [ ! -d ${LOCK_DIR} ]; then \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Creating ports locks dir"; \ - ${_dparv_END_OUTPUT}; \ - ${MKDIR} ${LOCK_DIR}; \ - fi; \ - if [ ! -d ${_parv_PORTS_LOGS_DIR} ]; then \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Creating ports logs dir"; \ - ${_dparv_END_OUTPUT}; \ - ${MKDIR} ${_parv_PORTS_LOGS_DIR}; \ - fi - .for _lock_dir in PKG_DBDIR PORT_DBDIR LOCK_DIR # ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR} @@ -192,6 +208,7 @@ # Stalled locks cheking enabled. # # If the directory is locked this script returns ${_parv_ON_LOCK_EXIT_STATUS}. +# # Process is allowed to work in locked port's directory if and only if it is locked # by it's parent process. # @@ -235,6 +252,7 @@ # _parv_PKG_DBDIR_DO_LOCK # _parv_LOCK_DIR_DO_LOCK # _parv_PORT_DBDIR_DO_LOCK +# # This scripts handles exit status of lockf(1) call. # It substitutes exit status 75 of lockf(1) for ${_parv_ON_LOCK_EXIT_STATUS} # and pushes it. @@ -258,6 +276,7 @@ # _parv_PKG_DBDIR_LOCK_LOOP # _parv_LOCK_DIR_LOCK_LOOP # _parv_PORT_DBDIR_LOCK_LOOP +# # Loops to lock a directory # $${attempts} - Number of attempts to lock a directory. Exetranal variable. # Default: 1, if this var is not set. @@ -317,6 +336,7 @@ # _parv_CHECK_SEQ # _parv_CHECK_LOCK +# # The former variables implement check for lock utility. # $${pkg_name} - port to check, since ${_parv_LOCK_DIR_LOCK_FILE} = ${PKGNAME} # External variable for script. Supports sh(1) patterns @@ -324,7 +344,7 @@ # value before executing this script. # e.g. ( pkg_name=apache-[1234]; ${_parv_CHECK_LOCK} ) || ... # Script exits with exit status ${_parv_ON_LOCK_EXIT_STATUS} if $${pkg_name} is locked -# +# _parv_CHECK_SEQ= \ ${CHMOD} ${_parv_UMASK} ${LOCK_DIR}/$${pkg_name}; \ pid=\$$(${CAT} ${LOCK_DIR}/$${pkg_name}); \ @@ -380,7 +400,31 @@ # End of Locking variables and tools section ##################################################### -# +_parv_CHECK_DIRS_SANITY= \ + if [ ! -d ${LOCK_DIR} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Creating ports locks dir"; \ + ${_dparv_END_OUTPUT}; \ + ${MKDIR} ${LOCK_DIR}; \ + fi; \ + if [ ! -d ${_parv_PORTS_LOGS_DIR} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Creating ports logs dir"; \ + ${_dparv_END_OUTPUT}; \ + ${MKDIR} ${_parv_PORTS_LOGS_DIR}; \ + fi + +_parv_PRINT_ACTIVE_BUILDS= \ + ${ECHO_CMD} " Currently building dependency ports are"; \ + for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ + dep=$${build\#*:}; \ + dir=$${dep\#*:}; \ + target=$${dep\#\#*:}; \ + [ $$dir != $$target ] && dir=$${dir%%:*}; \ + ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ + done + + # _PROCESS_ACTIVE_BUILDS - this script contains all magic, related to # processing of background dependecy builds. # @@ -393,16 +437,6 @@ # tuples of all currently being processed ports, # spawned by this make process. # -_parv_PRINT_ACTIVE_BUILDS= \ - ${ECHO_CMD} " Currently building dependency ports are"; \ - for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ - dep=$${build\#*:}; \ - dir=$${dep\#*:}; \ - target=$${dep\#\#*:}; \ - [ $$dir != $$target ] && dir=$${dir%%:*}; \ - ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ - done - _PROCESS_ACTIVE_BUILDS= \ enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ while true; do \ @@ -468,7 +502,12 @@ fi; \ done -# TODO: docs needed +# _parv_CHECK_ALL_DEPS_LOCKED +# +# This script prevents infinity non-sleeping loop in XXX-depends targets. +# If all dependencies in corresponding XXX_DEPENDS variable are locked +# then parent make process will sleep ${_parv_CHECK_ACTIVE_TIMEOUT} seconds. +# _parv_CHECK_ALL_DEPS_LOCKED= \ if ! [ $${\#depends} -eq 0 ]; then \ enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ @@ -493,7 +532,7 @@ # # _TERMINATE_PROCESS_TREE - this script contains all magic, related to -# terminating of the whole process tree, starting +# termination of the whole process tree, starting # from ${.MAKE.PID}. # This script implements Breadth-first traversal of # the process tree. It prevents processes of the @@ -536,8 +575,6 @@ # Parallel targets section # TODO: outline intergation with bsd.port.mk # - -#TODO doc is needed .if !defined(INSTALLS_DEPENDS) check-license-depends: check-license-message @license_to_ask=""; \ @@ -568,7 +605,6 @@ check-license-message: @${ECHO_MSG} "===> Checking out licenses for ${PKGNAME} dependencies"; -#TODO doc is needed .if !defined(CONFIG_DONE_${UNIQUENAME:U}) && !defined(INSTALLS_DEPENDS) locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir .endif @@ -576,11 +612,6 @@ locking-config-message: @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; -# TODO: doc is needed -# TODO: shift to the beginning -_parv_CHECKED_CONFIG_F_PREFIX= already-checked-config - -# TODO: doc is needed config-recursive: config-conditional @if [ ! ${DEP_CHECK_CONFIG} ]; then \ already_checked_file=/tmp/${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID}; \ From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:29:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 45140106566C for ; Mon, 2 Jul 2012 21:29:19 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:29:19 +0000 Date: Mon, 02 Jul 2012 21:29:19 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702212919.45140106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238855 - soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:29:21 -0000 Author: syuu Date: Mon Jul 2 21:29:18 2012 New Revision: 238855 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238855 Log: Install real mode interrupt handler, support loading bootsector from disk image. Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Mon Jul 2 21:28:42 2012 (r238854) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Mon Jul 2 21:29:18 2012 (r238855) @@ -274,6 +274,11 @@ if (argc != 1) usage(); + if (!disk_image) { + printf("disk image is required.\n"); + exit(1); + } + vmname = argv[0]; error = vm_create(vmname); @@ -309,9 +314,15 @@ term.c_iflag &= ~ICRNL; tcsetattr(0, TCSAFLUSH, &term); - if (disk_image) { - disk_fd = open(disk_image, O_RDONLY); + disk_fd = open(disk_image, O_RDONLY); + buf = malloc(512); + if (read(disk_fd, buf, 512) != 512) { + perror("read "); + return (1); } + cb_copyin(NULL, buf, 0x7c00, 512); + free(buf); + close(disk_fd); if (cb_open(NULL, "/pseudobios.bin", &h)) { perror("cb_open "); @@ -319,15 +330,24 @@ } cf = h; buf = malloc(6); - if (cb_read(NULL, cf, buf, 3, &res) != 0 || res != 0) { + if (cb_read(NULL, cf, buf, 6, &res) != 0 || res != 0) { fprintf(stderr, "cb_read\n"); return (1); } -#if 0 - cb_copyin(NULL, buf, 0xFFFFFFF0, 3); -#endif - cb_copyin(NULL, buf, 0x0, 3); + + int addr = 0x400; + for (int i = 0x0; i < 0x400; i += 0x4) { + uint16_t *p = (uint16_t *)&membase[i]; + cb_copyin(NULL, buf, addr, 6); + *p = addr; + p = (uint16_t *)&membase[i + 0x2]; + *p = 0x0; + addr += 0x10; + } + + free(buf); cb_close(NULL, cf); cb_exec(NULL, 0); + return (0); } From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:32:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7AA20106564A for ; Mon, 2 Jul 2012 21:32:20 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:32:20 +0000 Date: Mon, 02 Jul 2012 21:32:20 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702213220.7AA20106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238856 - in soc2012/syuu/bhyve-bios/tmp: . pseudobios testbootsect X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:32:22 -0000 Author: syuu Date: Mon Jul 2 21:32:20 2012 New Revision: 238856 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238856 Log: adding pseudobios, disk boot sector image for debugging Added: soc2012/syuu/bhyve-bios/tmp/ soc2012/syuu/bhyve-bios/tmp/pseudobios/ soc2012/syuu/bhyve-bios/tmp/pseudobios/Makefile soc2012/syuu/bhyve-bios/tmp/pseudobios/ldscript.lds soc2012/syuu/bhyve-bios/tmp/pseudobios/pseudobios.s soc2012/syuu/bhyve-bios/tmp/testbootsect/ soc2012/syuu/bhyve-bios/tmp/testbootsect/Makefile soc2012/syuu/bhyve-bios/tmp/testbootsect/ldscript.lds soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S Added: soc2012/syuu/bhyve-bios/tmp/pseudobios/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/pseudobios/Makefile Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,6 @@ +all: + as --32 pseudobios.s -o pseudobios.o + ld -melf_i386_fbsd -T ldscript.lds pseudobios.o -o pseudobios.elf + objcopy -I elf32-i386-freebsd -O binary pseudobios.elf pseudobios.bin +clean: + rm *.o *.elf *.bin Added: soc2012/syuu/bhyve-bios/tmp/pseudobios/ldscript.lds ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/pseudobios/ldscript.lds Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,24 @@ +OUTPUT_FORMAT("elf32-i386") +OUTPUT_ARCH("i386") +SECTIONS +{ + .text 0x0: + { + *(.text) + *(.rodata) + } = 0 + .data : + { + *(.data) + } + .sbss : + { + *(.sbss) + *(.scommon) + } + .bss : + { + *(.bss) + *(COMMON) + } +} Added: soc2012/syuu/bhyve-bios/tmp/pseudobios/pseudobios.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/pseudobios/pseudobios.s Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,5 @@ +.code16 +pusha +vmcall +popa +iret Added: soc2012/syuu/bhyve-bios/tmp/testbootsect/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/testbootsect/Makefile Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,7 @@ +all: + cc -m32 -c testbootsect.S -o testbootsect.o + ld -melf_i386_fbsd -T ldscript.lds testbootsect.o -o testbootsect.elf + objcopy -I elf32-i386-freebsd -O binary testbootsect.elf testbootsect.bin + dd if=/dev/null of=testbootsect.bin seek=512 bs=1 count=1 +clean: + rm *.o *.elf *.bin Added: soc2012/syuu/bhyve-bios/tmp/testbootsect/ldscript.lds ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/testbootsect/ldscript.lds Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,24 @@ +OUTPUT_FORMAT("elf32-i386") +OUTPUT_ARCH("i386") +SECTIONS +{ + .text 0x0: + { + *(.text) + *(.rodata) + } = 0 + .data : + { + *(.data) + } + .sbss : + { + *(.sbss) + *(.scommon) + } + .bss : + { + *(.bss) + *(COMMON) + } +} Added: soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S Mon Jul 2 21:32:20 2012 (r238856) @@ -0,0 +1,7 @@ + .code16 + mov $0x1, %ax + mov $0x2, %bx + mov $0x3, %cx + mov $0x4, %dx + int $0x13 + int $0x14 From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 21:45:52 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9EDD0106564A for ; Mon, 2 Jul 2012 21:45:50 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 21:45:50 +0000 Date: Mon, 02 Jul 2012 21:45:50 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120702214550.9EDD0106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238857 - in soc2012/scher/par_ports/head: . db/portlocks db/portslocks fake_ports/with_deps/fake2 fake_ports/with_options/fake5a X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 21:45:52 -0000 Author: scher Date: Mon Jul 2 21:45:49 2012 New Revision: 238857 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238857 Log: Changes in testing tools Added: soc2012/scher/par_ports/head/db/portslocks/ (props changed) Deleted: soc2012/scher/par_ports/head/db/portlocks/ Modified: soc2012/scher/par_ports/head/dev_env.mk soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile Modified: soc2012/scher/par_ports/head/dev_env.mk ============================================================================== --- soc2012/scher/par_ports/head/dev_env.mk Mon Jul 2 21:32:20 2012 (r238856) +++ soc2012/scher/par_ports/head/dev_env.mk Mon Jul 2 21:45:49 2012 (r238857) @@ -2,13 +2,13 @@ CSH_PORTSDIR_ENTRY = "setenv PORTSDIR ${.CURDIR}" CSH_PKG_DBDIR_ENTRY = "setenv PKG_DBDIR ${.CURDIR}/db/pkg" CSH_PORT_DBDIR_ENTRY = "setenv PORT_DBDIR ${.CURDIR}/db/ports" -CSH_LOCK_DIR_ENTRY = "setenv LOCK_DIR ${.CURDIR}/db/portlocks" +CSH_LOCK_DIR_ENTRY = "setenv LOCK_DIR ${.CURDIR}/db/portslocks" SH_PREFIX_ENTRY = "PREFIX=${.CURDIR}/tmp\; export PREFIX" SH_PORTSDIR_ENTRY = "PORTSDIR=${.CURDIR}\; export PORTSDIR" SH_PKG_DBDIR_ENTRY = "PKG_DBDIR=${.CURDIR}/db/pkg\; export PKG_DBDIR" SH_PORT_DBDIR_ENTRY = "PORT_DBDIR=${.CURDIR}/db/ports\; export PORT_DBDIR" -SH_LOCK_DIR_ENTRY = "LOCK_DIR=${.CURDIR}/db/portlocks\; export LOCK_DIR" +SH_LOCK_DIR_ENTRY = "LOCK_DIR=${.CURDIR}/db/portslocks\; export LOCK_DIR" list_env_info: @echo "=== Configuring project environment" @@ -25,3 +25,6 @@ @echo "${SH_PKG_DBDIR_ENTRY}" @echo "${SH_PORT_DBDIR_ENTRY}" @echo "${SH_LOCK_DIR_ENTRY}" + @echo "=== I would want to Add the following lines to your /etc/make.conf" + @echo "_parv_WANT_PARALLEL_BUILD=1" + @echo "_parv_DEFAULT_PAR_BUILDS_NUM= 3" Modified: soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile ============================================================================== --- soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Mon Jul 2 21:32:20 2012 (r238856) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Mon Jul 2 21:45:49 2012 (r238857) @@ -6,7 +6,7 @@ WRKSRC= ${WRKDIR}/fake-1.0 FETCH_DEPENDS= ${PORTSDIR}/tmp/fake1:${PORTSDIR}/fake_ports/with_deps/fake1 \ - ${PORTSDIR}/tmp/fake1a:${PORTSDIR}/fake_ports/with_deps/fake1a + ${PORTSDIR}/tmp/fake1a:${PORTSDIR}/fake_ports/with_deps/fake1a:install NOCLEANDEPENDS= Modified: soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile ============================================================================== --- soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile Mon Jul 2 21:32:20 2012 (r238856) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile Mon Jul 2 21:45:49 2012 (r238857) @@ -4,7 +4,11 @@ CATEGORIES=fake_ports +#DISABLE_LICENSES= +#_LICENSE_STATUS= ask + WRKSRC= ${WRKDIR}/fake-1.0 +FETCH_DEPENDS= ${PORTSDIR}/tmp/fake5:${PORTSDIR}/fake_ports/with_options/fake5 OPTIONS_DEFINE= FAKE5A_OPT11 FAKE5A_OPT22 From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 01:58:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1A5501065670 for ; Tue, 3 Jul 2012 01:58:02 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 01:58:02 +0000 Date: Tue, 03 Jul 2012 01:58:02 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703015802.1A5501065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238875 - soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 01:58:04 -0000 Author: syuu Date: Tue Jul 3 01:58:01 2012 New Revision: 238875 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238875 Log: Put pseudo bios handler on the code Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Tue Jul 3 00:06:14 2012 (r238874) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Tue Jul 3 01:58:01 2012 (r238875) @@ -77,13 +77,10 @@ #include -#include "userboot.h" - #define MB (1024 * 1024UL) #define GB (1024 * 1024 * 1024UL) #define BSP 0 -static char *host_base = "/"; static struct termios term, oldterm; static int disk_fd = -1; @@ -91,134 +88,6 @@ static uint64_t lowmem, highmem; static struct vmctx *ctx; -static void cb_exit(void *arg, int v); - -/* - * Host filesystem i/o callbacks - */ - -struct cb_file { - int cf_isdir; - size_t cf_size; - struct stat cf_stat; - union { - int fd; - DIR *dir; - } cf_u; -}; - -static int -cb_open(void *arg, const char *filename, void **hp) -{ - struct stat st; - struct cb_file *cf; - char path[PATH_MAX]; - - if (!host_base) - return (ENOENT); - - strlcpy(path, host_base, PATH_MAX); - if (path[strlen(path) - 1] == '/') - path[strlen(path) - 1] = 0; - strlcat(path, filename, PATH_MAX); - cf = malloc(sizeof(struct cb_file)); - if (stat(path, &cf->cf_stat) < 0) { - free(cf); - return (errno); - } - - cf->cf_size = st.st_size; - if (S_ISDIR(cf->cf_stat.st_mode)) { - cf->cf_isdir = 1; - cf->cf_u.dir = opendir(path); - if (!cf->cf_u.dir) - goto out; - *hp = cf; - return (0); - } - if (S_ISREG(cf->cf_stat.st_mode)) { - cf->cf_isdir = 0; - cf->cf_u.fd = open(path, O_RDONLY); - if (cf->cf_u.fd < 0) - goto out; - *hp = cf; - return (0); - } - -out: - free(cf); - return (EINVAL); -} - -static int -cb_close(void *arg, void *h) -{ - struct cb_file *cf = h; - - if (cf->cf_isdir) - closedir(cf->cf_u.dir); - else - close(cf->cf_u.fd); - free(cf); - - return (0); -} - -static int -cb_read(void *arg, void *h, void *buf, size_t size, size_t *resid) -{ - struct cb_file *cf = h; - ssize_t sz; - - if (cf->cf_isdir) - return (EINVAL); - sz = read(cf->cf_u.fd, buf, size); - if (sz < 0) - return (EINVAL); - *resid = size - sz; - return (0); -} - -/* - * Guest virtual machine i/o callbacks - */ -static int -cb_copyin(void *arg, const void *from, uint64_t to, size_t size) -{ - - to &= 0x7fffffff; - if (to > lowmem) - return (EFAULT); - if (to + size > lowmem) - size = lowmem - to; - - memcpy(&membase[to], from, size); - - return (0); -} - -static void -cb_exec(void *arg, uint64_t rip) -{ - int error; - - error = vm_setup_bios_registers(ctx, BSP); - if (error) { - perror("vm_setup_freebsd_registers"); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } - - cb_exit(NULL, 0); -} - -static void -cb_exit(void *arg, int v) -{ - - tcsetattr(0, TCSAFLUSH, &oldterm); - exit(v); -} - static void usage(void) { @@ -232,12 +101,9 @@ int main(int argc, char** argv) { - void *h; int opt, error; char *disk_image; - struct cb_file *cf; - char *buf; - size_t res; + int i, addr; progname = argv[0]; @@ -245,16 +111,12 @@ highmem = 0; disk_image = NULL; - while ((opt = getopt(argc, argv, "d:h:m:M:")) != -1) { + while ((opt = getopt(argc, argv, "d:m:M:")) != -1) { switch (opt) { case 'd': disk_image = optarg; break; - case 'h': - host_base = optarg; - break; - case 'm': lowmem = strtoul(optarg, NULL, 0) * MB; break; @@ -315,39 +177,31 @@ tcsetattr(0, TCSAFLUSH, &term); disk_fd = open(disk_image, O_RDONLY); - buf = malloc(512); - if (read(disk_fd, buf, 512) != 512) { + if (read(disk_fd, &membase[0x7c00], 512) != 512) { perror("read "); return (1); } - cb_copyin(NULL, buf, 0x7c00, 512); - free(buf); close(disk_fd); - if (cb_open(NULL, "/pseudobios.bin", &h)) { - perror("cb_open "); - return (1); - } - cf = h; - buf = malloc(6); - if (cb_read(NULL, cf, buf, 6, &res) != 0 || res != 0) { - fprintf(stderr, "cb_read\n"); - return (1); - } - - int addr = 0x400; - for (int i = 0x0; i < 0x400; i += 0x4) { + addr = 0x400; + for (i = 0x0; i < 0x400; i += 0x4) { uint16_t *p = (uint16_t *)&membase[i]; - cb_copyin(NULL, buf, addr, 6); + membase[addr + 0] = 0x0f; /* vmcall(3byte) */ + membase[addr + 1] = 0x01; + membase[addr + 2] = 0xc1; + membase[addr + 3] = 0xcf; /* iret */ *p = addr; p = (uint16_t *)&membase[i + 0x2]; *p = 0x0; - addr += 0x10; + addr += 4; + } + error = vm_setup_bios_registers(ctx, BSP); + if (error) { + perror("vm_setup_freebsd_registers"); + return (-1); } - free(buf); - cb_close(NULL, cf); - cb_exec(NULL, 0); + tcsetattr(0, TCSAFLUSH, &oldterm); return (0); } From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 01:58:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8B2581065670 for ; Tue, 3 Jul 2012 01:58:29 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 01:58:29 +0000 Date: Tue, 03 Jul 2012 01:58:29 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703015829.8B2581065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238876 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 01:58:31 -0000 Author: syuu Date: Tue Jul 3 01:58:29 2012 New Revision: 238876 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238876 Log: Change handler align Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 01:58:01 2012 (r238875) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 01:58:29 2012 (r238876) @@ -460,7 +460,7 @@ printf("VMCALL handled\n"); printf("rsp=%"PRIx64" rip=%"PRIx64" rax=%"PRIx64" rbx=%"PRIx64" rcx=%"PRIx64" rdx=%"PRIx64"\n", rsp, rip, rax, rbx, rcx, rdx); - intr = (rip - 0x401) / 0x10; + intr = (rip - 0x400) / 0x4; printf("intr=%"PRIu64"\n", intr); return (VMEXIT_ABORT); From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 02:00:29 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8533C1065673 for ; Tue, 3 Jul 2012 02:00:28 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 02:00:28 +0000 Date: Tue, 03 Jul 2012 02:00:28 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703020028.8533C1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238880 - soc2012/syuu/bhyve-bios/tmp/pseudobios X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 02:00:29 -0000 Author: syuu Date: Tue Jul 3 02:00:28 2012 New Revision: 238880 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238880 Log: Now pseudobios is included in bhyvebiosload Deleted: soc2012/syuu/bhyve-bios/tmp/pseudobios/ From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 02:34:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B78FC1065673 for ; Tue, 3 Jul 2012 02:34:35 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 02:34:35 +0000 Date: Tue, 03 Jul 2012 02:34:35 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703023435.B78FC1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238881 - soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 02:34:37 -0000 Author: syuu Date: Tue Jul 3 02:34:35 2012 New Revision: 238881 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238881 Log: AMD-V vmmcall instruction; just commented out for now Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Tue Jul 3 02:00:28 2012 (r238880) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Tue Jul 3 02:34:35 2012 (r238881) @@ -186,9 +186,15 @@ addr = 0x400; for (i = 0x0; i < 0x400; i += 0x4) { uint16_t *p = (uint16_t *)&membase[i]; +#if 1 /* XXX: need to detect CPU vendor */ membase[addr + 0] = 0x0f; /* vmcall(3byte) */ membase[addr + 1] = 0x01; membase[addr + 2] = 0xc1; +#else /* for AMD-V */ + membase[addr + 0] = 0x0f; /* vmmcall(3byte) */ + membase[addr + 1] = 0x01; + membase[addr + 2] = 0xd9; +#endif membase[addr + 3] = 0xcf; /* iret */ *p = addr; p = (uint16_t *)&membase[i + 0x2]; From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 03:18:43 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D9B6C106564A for ; Tue, 3 Jul 2012 03:18:40 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 03:18:40 +0000 Date: Tue, 03 Jul 2012 03:18:40 +0000 From: vchan@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703031840.D9B6C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238883 - soc2012/vchan/gtcp/bwalex-tc-play X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 03:18:43 -0000 Author: vchan Date: Tue Jul 3 03:18:39 2012 New Revision: 238883 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238883 Log: check tcplay_new.c for changes Modified: soc2012/vchan/gtcp/bwalex-tc-play/Makefile soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Modified: soc2012/vchan/gtcp/bwalex-tc-play/Makefile ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/Makefile Tue Jul 3 02:55:27 2012 (r238882) +++ soc2012/vchan/gtcp/bwalex-tc-play/Makefile Tue Jul 3 03:18:39 2012 (r238883) @@ -21,7 +21,7 @@ OBJS= tcplay.o crc32.o safe_mem.o io.o hdr.o humanize.o OBJS+= crypto.o generic_xts.o -CFLAGS+= $(WARNFLAGS) +CFLAGS+= $(WARNFLAGS) -I/usr/include ifeq (${DEBUG}, yes) CFLAGS+= -O0 -g -DDEBUG Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 3 02:55:27 2012 (r238882) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 3 03:18:39 2012 (r238883) @@ -979,9 +979,9 @@ char *uu; char *uu_stack[64]; int uu_stack_idx; -#if defined(__DragonFly__) - uint32_t status; -#endif +//#if defined(__DragonFly__) +// uint32_t status; +//#endif int r, ret = 0; int j; off_t start, offset; @@ -1041,15 +1041,15 @@ goto out; } -#if defined(__linux__) - uuid_generate(info->uuid); - if ((uu = malloc(1024)) == NULL) { - tc_log(1, "uuid_unparse memory failed\n"); - ret = -1; - goto out; - } - uuid_unparse(info->uuid, uu); -#elif defined(__DragonFly__) +//#if defined(__linux__) +// uuid_generate(info->uuid); +// if ((uu = malloc(1024)) == NULL) { +// tc_log(1, "uuid_unparse memory failed\n"); +// ret = -1; +// goto out; +// } +// uuid_unparse(info->uuid, uu); +//#elif defined(__DragonFly__) uuid_create(&info->uuid, &status); if (status != uuid_s_ok) { tc_log(1, "uuid_create failed\n"); @@ -1063,7 +1063,7 @@ ret = -1; goto out; } -#endif +//#endif if ((dm_task_set_uuid(dmt, uu)) == 0) { free(uu); From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 03:25:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F12A310656A8 for ; Tue, 3 Jul 2012 03:25:50 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 03:25:50 +0000 Date: Tue, 03 Jul 2012 03:25:50 +0000 From: vchan@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703032550.F12A310656A8@hub.freebsd.org> Cc: Subject: socsvn commit: r238884 - in soc2012/vchan: ggate ggate/ggatec ggate/ggated ggate/ggatel ggate/shared gtcp/bwalex-tc-play X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 03:25:53 -0000 Author: vchan Date: Tue Jul 3 03:25:50 2012 New Revision: 238884 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238884 Log: fixed previous commit Added: soc2012/vchan/ggate/ soc2012/vchan/ggate/Makefile soc2012/vchan/ggate/Makefile.inc soc2012/vchan/ggate/ggatec/ soc2012/vchan/ggate/ggatec/Makefile soc2012/vchan/ggate/ggatec/ggatec.8 soc2012/vchan/ggate/ggatec/ggatec.c soc2012/vchan/ggate/ggated/ soc2012/vchan/ggate/ggated/Makefile soc2012/vchan/ggate/ggated/ggated.8 soc2012/vchan/ggate/ggated/ggated.c soc2012/vchan/ggate/ggatel/ soc2012/vchan/ggate/ggatel/Makefile soc2012/vchan/ggate/ggatel/ggatel.8 soc2012/vchan/ggate/ggatel/ggatel.c soc2012/vchan/ggate/shared/ soc2012/vchan/ggate/shared/ggate.c soc2012/vchan/ggate/shared/ggate.h soc2012/vchan/gtcp/bwalex-tc-play/tcplay_new.c Added: soc2012/vchan/ggate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/Makefile Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,14 @@ +# $FreeBSD: release/9.0.0/sbin/ggate/Makefile 177714 2008-03-29 17:44:40Z ru $ + +.include + +SUBDIR= ${_ggatec} \ + ${_ggated} \ + ggatel + +.if ${MK_LIBTHR} != "no" +_ggatec= ggatec +_ggated= ggated +.endif + +.include Added: soc2012/vchan/ggate/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/Makefile.inc Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,3 @@ +# $FreeBSD: release/9.0.0/sbin/ggate/Makefile.inc 198236 2009-10-19 16:00:24Z ru $ + +.include "../Makefile.inc" Added: soc2012/vchan/ggate/ggatec/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/ggatec/Makefile Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,16 @@ +# $FreeBSD: release/9.0.0/sbin/ggate/ggatec/Makefile 168422 2007-04-06 11:19:48Z pjd $ + +.PATH: ${.CURDIR}/../shared + +PROG= ggatec +MAN= ggatec.8 +SRCS= ggatec.c ggate.c + +CFLAGS+= -DMAX_SEND_SIZE=32768 +CFLAGS+= -DLIBGEOM +CFLAGS+= -I${.CURDIR}/../shared + +DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL} ${LIBPTHREAD} +LDADD= -lgeom -lsbuf -lbsdxml -lutil -lpthread + +.include Added: soc2012/vchan/ggate/ggatec/ggatec.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/ggatec/ggatec.8 Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,181 @@ +.\" Copyright (c) 2004 Pawel Jakub Dawidek +.\" 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 AUTHORS 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 AUTHORS 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: release/9.0.0/sbin/ggate/ggatec/ggatec.8 162395 2006-09-18 11:55:10Z ru $ +.\" +.Dd April 26, 2004 +.Dt GGATEC 8 +.Os +.Sh NAME +.Nm ggatec +.Nd "GEOM Gate network client and control utility" +.Sh SYNOPSIS +.Nm +.Cm create +.Op Fl n +.Op Fl v +.Op Fl o Cm ro | wo | rw +.Op Fl p Ar port +.Op Fl q Ar queue_size +.Op Fl R Ar rcvbuf +.Op Fl S Ar sndbuf +.Op Fl s Ar sectorsize +.Op Fl t Ar timeout +.Op Fl u Ar unit +.Ar host +.Ar path +.Nm +.Cm rescue +.Op Fl n +.Op Fl v +.Op Fl o Cm ro | wo | rw +.Op Fl p Ar port +.Op Fl R Ar rcvbuf +.Op Fl S Ar sndbuf +.Fl u Ar unit +.Ar host +.Ar path +.Nm +.Cm destroy +.Op Fl f +.Fl u Ar unit +.Nm +.Cm list +.Op Fl v +.Op Fl u Ar unit +.Sh DESCRIPTION +The +.Nm +utility is a network client for GEOM Gate class. +It is responsible for creation of +.Nm ggate +devices and forwarding I/O requests between +.Nm geom_gate.ko +kernel module and +.Xr ggated 8 +network daemon. +Available commands: +.Bl -tag -width ".Cm destroy" +.It Cm create +Connect to given +.Xr ggated 8 +daemon and create a +.Nm ggate +provider related to the given remote file or device. +.It Cm rescue +If +.Nm +process died/has been killed, you can save situation with this +command, which creates new connection to the +.Xr ggated 8 +daemon and will handle pending and future requests. +.It Cm destroy +Destroy the given +.Nm ggate +provider. +.It Cm list +List +.Nm ggate +providers. +.El +.Pp +Available options: +.Bl -tag -width ".Fl s Cm ro | wo | rw" +.It Fl f +Forcibly destroy +.Nm ggate +provider (cancels all pending requests). +.It Fl n +Do not use +.Dv TCP_NODELAY +option on TCP sockets. +.It Fl o Cm ro | wo | rw +Specify permission to use when opening the file or device: read-only +.Pq Cm ro , +write-only +.Pq Cm wo , +or read-write +.Pq Cm rw . +Default is +.Cm rw . +.It Fl p Ar port +Port to connect to on the remote host. +Default is 3080. +.It Fl q Ar queue_size +Number of pending I/O requests that can be queued before they will +start to be canceled. +Default is 1024. +.It Fl R Ar rcvbuf +Size of receive buffer to use. +Default is 131072 (128kB). +.It Fl S Ar sndbuf +Size of send buffer to use. +Default is 131072 (128kB). +.It Fl s Ar sectorsize +Sector size for +.Nm ggate +provider. +If not specified, it is taken from device, or set to 512 bytes for files. +.It Fl t Ar timeout +Number of seconds to wait before an I/O request will be canceled. +0 means no timeout. +Default is 0. +.It Fl u Ar unit +Unit number to use. +.It Fl v +Do not fork, run in foreground and print debug informations on standard +output. +.It Ar host +Remote host to connect to. +.It Ar path +Path to a regular file or device. +.El +.Sh EXIT STATUS +Exit status is 0 on success, or 1 if the command fails. +To get details about the failure, +.Nm +should be called with the +.Fl v +option. +.Sh EXAMPLES +Make use of CD-ROM device from remote host. +.Bd -literal -offset indent +server# cat /etc/gg.exports +client RO /dev/acd0 +server# ggated + +client# ggatec create -o ro server /dev/acd0 +ggate0 +client# mount_cd9660 /dev/ggate0 /cdrom +.Ed +.Sh SEE ALSO +.Xr geom 4 , +.Xr ggated 8 , +.Xr ggatel 8 , +.Xr mount_cd9660 8 +.Sh AUTHORS +The +.Nm +utility as well as this manual page was written by +.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . Added: soc2012/vchan/ggate/ggatec/ggatec.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/ggatec/ggatec.c Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,642 @@ +/*- + * Copyright (c) 2004 Pawel Jakub Dawidek + * 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 AUTHORS 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 AUTHORS 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: release/9.0.0/sbin/ggate/ggatec/ggatec.c 204076 2010-02-18 23:16:19Z pjd $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ggate.h" + + +enum { UNSET, CREATE, DESTROY, LIST, RESCUE } action = UNSET; + +static const char *path = NULL; +static const char *host = NULL; +static int unit = G_GATE_UNIT_AUTO; +static unsigned flags = 0; +static int force = 0; +static unsigned queue_size = G_GATE_QUEUE_SIZE; +static unsigned port = G_GATE_PORT; +static off_t mediasize; +static unsigned sectorsize = 0; +static unsigned timeout = G_GATE_TIMEOUT; +static int sendfd, recvfd; +static uint32_t token; +static pthread_t sendtd, recvtd; +static int reconnect; + +static void +usage(void) +{ + + fprintf(stderr, "usage: %s create [-nv] [-o ] [-p port] " + "[-q queue_size] [-R rcvbuf] [-S sndbuf] [-s sectorsize] " + "[-t timeout] [-u unit] \n", getprogname()); + fprintf(stderr, " %s rescue [-nv] [-o ] [-p port] " + "[-R rcvbuf] [-S sndbuf] <-u unit> \n", getprogname()); + fprintf(stderr, " %s destroy [-f] <-u unit>\n", getprogname()); + fprintf(stderr, " %s list [-v] [-u unit]\n", getprogname()); + exit(EXIT_FAILURE); +} + +static void * +send_thread(void *arg __unused) +{ + struct g_gate_ctl_io ggio; + struct g_gate_hdr hdr; + char buf[MAXPHYS]; + ssize_t data; + int error; + + g_gate_log(LOG_NOTICE, "%s: started!", __func__); + + ggio.gctl_version = G_GATE_VERSION; + ggio.gctl_unit = unit; + ggio.gctl_data = buf; + + for (;;) { + ggio.gctl_length = sizeof(buf); + ggio.gctl_error = 0; + g_gate_ioctl(G_GATE_CMD_START, &ggio); + error = ggio.gctl_error; + switch (error) { + case 0: + break; + case ECANCELED: + if (reconnect) + break; + /* Exit gracefully. */ + g_gate_close_device(); + exit(EXIT_SUCCESS); +#if 0 + case ENOMEM: + /* Buffer too small. */ + ggio.gctl_data = realloc(ggio.gctl_data, + ggio.gctl_length); + if (ggio.gctl_data != NULL) { + bsize = ggio.gctl_length; + goto once_again; + } + /* FALLTHROUGH */ +#endif + case ENXIO: + default: + g_gate_xlog("ioctl(/dev/%s): %s.", G_GATE_CTL_NAME, + strerror(error)); + } + + if (reconnect) + break; + + switch (ggio.gctl_cmd) { + case BIO_READ: + hdr.gh_cmd = GGATE_CMD_READ; + break; + case BIO_WRITE: + hdr.gh_cmd = GGATE_CMD_WRITE; + break; + } + hdr.gh_seq = ggio.gctl_seq; + hdr.gh_offset = ggio.gctl_offset; + hdr.gh_length = ggio.gctl_length; + hdr.gh_error = 0; + g_gate_swap2n_hdr(&hdr); + + data = g_gate_send(sendfd, &hdr, sizeof(hdr), MSG_NOSIGNAL); + g_gate_log(LOG_DEBUG, "Sent hdr packet."); + g_gate_swap2h_hdr(&hdr); + if (reconnect) + break; + if (data != sizeof(hdr)) { + g_gate_log(LOG_ERR, "Lost connection 1."); + reconnect = 1; + pthread_kill(recvtd, SIGUSR1); + break; + } + + if (hdr.gh_cmd == GGATE_CMD_WRITE) { + data = g_gate_send(sendfd, ggio.gctl_data, + ggio.gctl_length, MSG_NOSIGNAL); + if (reconnect) + break; + if (data != ggio.gctl_length) { + g_gate_log(LOG_ERR, "Lost connection 2 (%zd != %zd).", data, (ssize_t)ggio.gctl_length); + reconnect = 1; + pthread_kill(recvtd, SIGUSR1); + break; + } + g_gate_log(LOG_DEBUG, "Sent %zd bytes (offset=%llu, " + "size=%u).", data, hdr.gh_offset, hdr.gh_length); + } + } + g_gate_log(LOG_DEBUG, "%s: Died.", __func__); + return (NULL); +} + +static void * +recv_thread(void *arg __unused) +{ + struct g_gate_ctl_io ggio; + struct g_gate_hdr hdr; + char buf[MAXPHYS]; + ssize_t data; + + g_gate_log(LOG_NOTICE, "%s: started!", __func__); + + ggio.gctl_version = G_GATE_VERSION; + ggio.gctl_unit = unit; + ggio.gctl_data = buf; + + for (;;) { + data = g_gate_recv(recvfd, &hdr, sizeof(hdr), MSG_WAITALL); + if (reconnect) + break; + g_gate_swap2h_hdr(&hdr); + if (data != sizeof(hdr)) { + if (data == -1 && errno == EAGAIN) + continue; + g_gate_log(LOG_ERR, "Lost connection 3."); + reconnect = 1; + pthread_kill(sendtd, SIGUSR1); + break; + } + g_gate_log(LOG_DEBUG, "Received hdr packet."); + + ggio.gctl_seq = hdr.gh_seq; + ggio.gctl_cmd = hdr.gh_cmd; + ggio.gctl_offset = hdr.gh_offset; + ggio.gctl_length = hdr.gh_length; + ggio.gctl_error = hdr.gh_error; + + if (ggio.gctl_error == 0 && ggio.gctl_cmd == GGATE_CMD_READ) { + data = g_gate_recv(recvfd, ggio.gctl_data, + ggio.gctl_length, MSG_WAITALL); + if (reconnect) + break; + g_gate_log(LOG_DEBUG, "Received data packet."); + if (data != ggio.gctl_length) { + g_gate_log(LOG_ERR, "Lost connection 4."); + reconnect = 1; + pthread_kill(sendtd, SIGUSR1); + break; + } + g_gate_log(LOG_DEBUG, "Received %d bytes (offset=%ju, " + "size=%zu).", data, (uintmax_t)hdr.gh_offset, + (size_t)hdr.gh_length); + } + + g_gate_ioctl(G_GATE_CMD_DONE, &ggio); + } + g_gate_log(LOG_DEBUG, "%s: Died.", __func__); + pthread_exit(NULL); +} + +static int +handshake(int dir) +{ + struct g_gate_version ver; + struct g_gate_cinit cinit; + struct g_gate_sinit sinit; + struct sockaddr_in serv; + int sfd; + + /* + * Do the network stuff. + */ + bzero(&serv, sizeof(serv)); + serv.sin_family = AF_INET; + serv.sin_addr.s_addr = g_gate_str2ip(host); + if (serv.sin_addr.s_addr == INADDR_NONE) { + g_gate_log(LOG_DEBUG, "Invalid IP/host name: %s.", host); + return (-1); + } + serv.sin_port = htons(port); + sfd = socket(AF_INET, SOCK_STREAM, 0); + if (sfd == -1) { + g_gate_log(LOG_DEBUG, "Cannot open socket: %s.", + strerror(errno)); + return (-1); + } + + g_gate_socket_settings(sfd); + + if (connect(sfd, (struct sockaddr *)&serv, sizeof(serv)) == -1) { + g_gate_log(LOG_DEBUG, "Cannot connect to server: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + + g_gate_log(LOG_INFO, "Connected to the server: %s:%d.", host, port); + + /* + * Create and send version packet. + */ + g_gate_log(LOG_DEBUG, "Sending version packet."); + assert(strlen(GGATE_MAGIC) == sizeof(ver.gv_magic)); + bcopy(GGATE_MAGIC, ver.gv_magic, sizeof(ver.gv_magic)); + ver.gv_version = GGATE_VERSION; + ver.gv_error = 0; + g_gate_swap2n_version(&ver); + if (g_gate_send(sfd, &ver, sizeof(ver), MSG_NOSIGNAL) == -1) { + g_gate_log(LOG_DEBUG, "Error while sending version packet: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + bzero(&ver, sizeof(ver)); + if (g_gate_recv(sfd, &ver, sizeof(ver), MSG_WAITALL) == -1) { + g_gate_log(LOG_DEBUG, "Error while receiving data: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + if (ver.gv_error != 0) { + g_gate_log(LOG_DEBUG, "Version verification problem: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + + /* + * Create and send initial packet. + */ + g_gate_log(LOG_DEBUG, "Sending initial packet."); + if (strlcpy(cinit.gc_path, path, sizeof(cinit.gc_path)) >= + sizeof(cinit.gc_path)) { + g_gate_log(LOG_DEBUG, "Path name too long."); + close(sfd); + return (-1); + } + cinit.gc_flags = flags | dir; + cinit.gc_token = token; + cinit.gc_nconn = 2; + g_gate_swap2n_cinit(&cinit); + if (g_gate_send(sfd, &cinit, sizeof(cinit), MSG_NOSIGNAL) == -1) { + g_gate_log(LOG_DEBUG, "Error while sending initial packet: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + g_gate_swap2h_cinit(&cinit); + + /* + * Receiving initial packet from server. + */ + g_gate_log(LOG_DEBUG, "Receiving initial packet."); + if (g_gate_recv(sfd, &sinit, sizeof(sinit), MSG_WAITALL) == -1) { + g_gate_log(LOG_DEBUG, "Error while receiving data: %s.", + strerror(errno)); + close(sfd); + return (-1); + } + g_gate_swap2h_sinit(&sinit); + if (sinit.gs_error != 0) { + g_gate_log(LOG_DEBUG, "Error from server: %s.", + strerror(sinit.gs_error)); + close(sfd); + return (-1); + } + g_gate_log(LOG_DEBUG, "Received initial packet."); + + mediasize = sinit.gs_mediasize; + if (sectorsize == 0) + sectorsize = sinit.gs_sectorsize; + + return (sfd); +} + +static void +mydaemon(void) +{ + + if (g_gate_verbose > 0) + return; + if (daemon(0, 0) == 0) + return; + if (action == CREATE) + g_gate_destroy(unit, 1); + err(EXIT_FAILURE, "Cannot daemonize"); +} + +static int +g_gatec_connect(void) +{ + + token = arc4random(); + /* + * Our receive descriptor is connected to the send descriptor on the + * server side. + */ + recvfd = handshake(GGATE_FLAG_SEND); + if (recvfd == -1) + return (0); + /* + * Our send descriptor is connected to the receive descriptor on the + * server side. + */ + sendfd = handshake(GGATE_FLAG_RECV); + if (sendfd == -1) + return (0); + return (1); +} + +static void +g_gatec_start(void) +{ + int error; + + reconnect = 0; + error = pthread_create(&recvtd, NULL, recv_thread, NULL); + if (error != 0) { + g_gate_destroy(unit, 1); + g_gate_xlog("pthread_create(recv_thread): %s.", + strerror(error)); + } + sendtd = pthread_self(); + send_thread(NULL); + /* Disconnected. */ + close(sendfd); + close(recvfd); +} + +static void +signop(int sig __unused) +{ + + /* Do nothing. */ +} + +static void +g_gatec_loop(void) +{ + struct g_gate_ctl_cancel ggioc; + + signal(SIGUSR1, signop); + for (;;) { + g_gatec_start(); + g_gate_log(LOG_NOTICE, "Disconnected [%s %s]. Connecting...", + host, path); + while (!g_gatec_connect()) { + sleep(2); + g_gate_log(LOG_NOTICE, "Connecting [%s %s]...", host, + path); + } + ggioc.gctl_version = G_GATE_VERSION; + ggioc.gctl_unit = unit; + ggioc.gctl_seq = 0; + g_gate_ioctl(G_GATE_CMD_CANCEL, &ggioc); + } +} + +static void +g_gatec_create(void) +{ + struct g_gate_ctl_create ggioc; + + if (!g_gatec_connect()) + g_gate_xlog("Cannot connect: %s.", strerror(errno)); + + /* + * Ok, got both sockets, time to create provider. + */ + ggioc.gctl_version = G_GATE_VERSION; + ggioc.gctl_mediasize = mediasize; + ggioc.gctl_sectorsize = sectorsize; + ggioc.gctl_flags = flags; + ggioc.gctl_maxcount = queue_size; + ggioc.gctl_timeout = timeout; + ggioc.gctl_unit = unit; + snprintf(ggioc.gctl_info, sizeof(ggioc.gctl_info), "%s:%u %s", host, + port, path); + g_gate_ioctl(G_GATE_CMD_CREATE, &ggioc); + if (unit == -1) { + printf("%s%u\n", G_GATE_PROVIDER_NAME, ggioc.gctl_unit); + fflush(stdout); + } + unit = ggioc.gctl_unit; + + mydaemon(); + g_gatec_loop(); +} + +static void +g_gatec_rescue(void) +{ + struct g_gate_ctl_cancel ggioc; + + if (!g_gatec_connect()) + g_gate_xlog("Cannot connect: %s.", strerror(errno)); + + ggioc.gctl_version = G_GATE_VERSION; + ggioc.gctl_unit = unit; + ggioc.gctl_seq = 0; + g_gate_ioctl(G_GATE_CMD_CANCEL, &ggioc); + + mydaemon(); + g_gatec_loop(); +} + +int +main(int argc, char *argv[]) +{ + + if (argc < 2) + usage(); + if (strcasecmp(argv[1], "create") == 0) + action = CREATE; + else if (strcasecmp(argv[1], "destroy") == 0) + action = DESTROY; + else if (strcasecmp(argv[1], "list") == 0) + action = LIST; + else if (strcasecmp(argv[1], "rescue") == 0) + action = RESCUE; + else + usage(); + argc -= 1; + argv += 1; + for (;;) { + int ch; + + ch = getopt(argc, argv, "fno:p:q:R:S:s:t:u:v"); + if (ch == -1) + break; + switch (ch) { + case 'f': + if (action != DESTROY) + usage(); + force = 1; + break; + case 'n': + if (action != CREATE && action != RESCUE) + usage(); + nagle = 0; + break; + case 'o': + if (action != CREATE && action != RESCUE) + usage(); + if (strcasecmp("ro", optarg) == 0) + flags = G_GATE_FLAG_READONLY; + else if (strcasecmp("wo", optarg) == 0) + flags = G_GATE_FLAG_WRITEONLY; + else if (strcasecmp("rw", optarg) == 0) + flags = 0; + else { + errx(EXIT_FAILURE, + "Invalid argument for '-o' option."); + } + break; + case 'p': + if (action != CREATE && action != RESCUE) + usage(); + errno = 0; + port = strtoul(optarg, NULL, 10); + if (port == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid port."); + break; + case 'q': + if (action != CREATE) + usage(); + errno = 0; + queue_size = strtoul(optarg, NULL, 10); + if (queue_size == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid queue_size."); + break; + case 'R': + if (action != CREATE && action != RESCUE) + usage(); + errno = 0; + rcvbuf = strtoul(optarg, NULL, 10); + if (rcvbuf == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid rcvbuf."); + break; + case 'S': + if (action != CREATE && action != RESCUE) + usage(); + errno = 0; + sndbuf = strtoul(optarg, NULL, 10); + if (sndbuf == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid sndbuf."); + break; + case 's': + if (action != CREATE) + usage(); + errno = 0; + sectorsize = strtoul(optarg, NULL, 10); + if (sectorsize == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid sectorsize."); + break; + case 't': + if (action != CREATE) + usage(); + errno = 0; + timeout = strtoul(optarg, NULL, 10); + if (timeout == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid timeout."); + break; + case 'u': + errno = 0; + unit = strtol(optarg, NULL, 10); + if (unit == 0 && errno != 0) + errx(EXIT_FAILURE, "Invalid unit number."); + break; + case 'v': + if (action == DESTROY) + usage(); + g_gate_verbose++; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + switch (action) { + case CREATE: + if (argc != 2) + usage(); + g_gate_load_module(); + g_gate_open_device(); + host = argv[0]; + path = argv[1]; + g_gatec_create(); + break; + case DESTROY: + if (unit == -1) { + fprintf(stderr, "Required unit number.\n"); + usage(); + } + g_gate_verbose = 1; + g_gate_open_device(); + g_gate_destroy(unit, force); + break; + case LIST: + g_gate_list(unit, g_gate_verbose); + break; + case RESCUE: + if (argc != 2) + usage(); + if (unit == -1) { + fprintf(stderr, "Required unit number.\n"); + usage(); + } + g_gate_open_device(); + host = argv[0]; + path = argv[1]; + g_gatec_rescue(); + break; + case UNSET: + default: + usage(); + } + g_gate_close_device(); + exit(EXIT_SUCCESS); +} Added: soc2012/vchan/ggate/ggated/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/ggated/Makefile Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,14 @@ +# $FreeBSD: release/9.0.0/sbin/ggate/ggated/Makefile 147887 2005-07-10 21:10:20Z pjd $ + +.PATH: ${.CURDIR}/../shared + +PROG= ggated +MAN= ggated.8 +SRCS= ggated.c ggate.c + +DPADD= ${LIBPTHREAD} +LDADD= -lpthread + +CFLAGS+= -I${.CURDIR}/../shared + +.include Added: soc2012/vchan/ggate/ggated/ggated.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/ggate/ggated/ggated.8 Tue Jul 3 03:25:50 2012 (r238884) @@ -0,0 +1,111 @@ +.\" Copyright (c) 2004 Pawel Jakub Dawidek +.\" 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 AUTHORS 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 AUTHORS 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: release/9.0.0/sbin/ggate/ggated/ggated.8 140415 2005-01-18 10:09:38Z ru $ +.\" +.Dd April 29, 2004 +.Dt GGATED 8 +.Os +.Sh NAME +.Nm ggated +.Nd "GEOM Gate network daemon" +.Sh SYNOPSIS +.Nm +.Op Fl h +.Op Fl n +.Op Fl v +.Op Fl a Ar address +.Op Fl p Ar port +.Op Fl R Ar rcvbuf +.Op Fl S Ar sndbuf +.Op Ar "exports file" +.Sh DESCRIPTION +The +.Nm +utility is a network server for GEOM Gate class. +It runs on a server machine to service GEOM Gate requests from workers +placed on a client machine. +Keep in mind, that connection between +.Xr ggatec 8 +and +.Nm +is not encrypted. +.Pp +Available options: +.Bl -tag -width ".Ar exports\ file" +.It Fl a Ar address +Specifies an IP address to bind to. +.It Fl h +Print available options. +.It Fl n +Do not use +.Dv TCP_NODELAY +option on TCP sockets. +.It Fl p Ar port +Port on which +.Nm +listens for connection. +Default is 3080. +.It Fl R Ar rcvbuf +Size of receive buffer to use. +Default is 131072 (128kB). +.It Fl S Ar sndbuf +Size of send buffer to use. +Default is 131072 (128kB). +.It Fl v +Do not fork, run in foreground and print debug informations on standard +output. +.It Ar "exports file" +An alternate location for the exports file. +.El +.Pp +The format of an exports file is as follows: +.Bd -literal -offset indent +1.2.3.4 RO /dev/acd0 +1.2.3.0/24 RW /tmp/test.img +hostname WO /tmp/image +.Ed +.Sh EXIT STATUS +Exit status is 0 on success, or 1 if the command fails. +To get details about the failure, +.Nm +should be called with the +.Fl v +option. +.Sh EXAMPLES +Export CD-ROM device and a file: +.Bd -literal -offset indent +# echo "1.2.3.0/24 RO /dev/acd0" > /etc/gg.exports +# echo "client RW /image" >> /etc/gg.exports +# ggated +.Ed +.Sh SEE ALSO +.Xr geom 4 , +.Xr ggatec 8 , +.Xr ggatel 8 +.Sh AUTHORS +The +.Nm *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 05:15:59 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 37009106566B for ; Tue, 3 Jul 2012 05:15:57 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 05:15:57 +0000 Date: Tue, 03 Jul 2012 05:15:57 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703051557.37009106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238885 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 05:15:59 -0000 Author: syuu Date: Tue Jul 3 05:15:56 2012 New Revision: 238885 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238885 Log: continueing test code Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 03:25:50 2012 (r238884) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 05:15:56 2012 (r238885) @@ -463,9 +463,10 @@ intr = (rip - 0x400) / 0x4; printf("intr=%"PRIu64"\n", intr); - return (VMEXIT_ABORT); - - return (VMEXIT_RESTART); + if (intr == 0x14) + return (VMEXIT_ABORT); + else + return (VMEXIT_CONTINUE); } static void From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 08:05:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B435E1065674 for ; Tue, 3 Jul 2012 08:05:17 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 08:05:17 +0000 Date: Tue, 03 Jul 2012 08:05:17 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703080517.B435E1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238895 - soc2012/syuu/bhyve-bios/usr.sbin X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 08:05:18 -0000 Author: syuu Date: Tue Jul 3 08:05:17 2012 New Revision: 238895 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238895 Log: adding bhyvebiosload to Makefile.amd64 Modified: soc2012/syuu/bhyve-bios/usr.sbin/Makefile.amd64 Modified: soc2012/syuu/bhyve-bios/usr.sbin/Makefile.amd64 ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/Makefile.amd64 Tue Jul 3 07:28:57 2012 (r238894) +++ soc2012/syuu/bhyve-bios/usr.sbin/Makefile.amd64 Tue Jul 3 08:05:17 2012 (r238895) @@ -12,6 +12,7 @@ SUBDIR+= asf SUBDIR+= bhyve SUBDIR+= bhyveload +SUBDIR+= bhyvebiosload SUBDIR+= boot0cfg .if ${MK_TOOLCHAIN} != "no" SUBDIR+= btxld From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 11:24:44 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2FA2E106566C for ; Tue, 3 Jul 2012 11:24:42 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 11:24:42 +0000 Date: Tue, 03 Jul 2012 11:24:42 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703112442.2FA2E106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238904 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 11:24:44 -0000 Author: aleek Date: Tue Jul 3 11:24:41 2012 New Revision: 238904 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238904 Log: adapting MMC driver Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 09:11:47 2012 (r238903) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 11:24:41 2012 (r238904) @@ -1330,7 +1330,8 @@ uint32_t con; /* 1: Enable the controller and interface/functional clocks */ - clk = MMC0_CLK + sc->device_id; + //clk = MMC0_CLK + sc->device_id; + clk = MMC1_CLK; if (ti_prcm_clk_enable(clk) != 0) { device_printf(dev, "Error: failed to enable MMC clock\n"); @@ -1430,6 +1431,7 @@ static int ti_mmchs_init_dma_channels(struct ti_mmchs_softc *sc) { + printf( "%s:%d\n", __FILE__, __LINE__ ); #ifdef SOC_TI_AM335X switch (sc->device_id) { case 0: @@ -1453,13 +1455,16 @@ int err; uint32_t rev; + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the current chip revision */ rev = ti_revision(); if ((OMAP_REV_DEVICE(rev) != OMAP4430_DEV) && (sc->device_id > 3)) return(EINVAL); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the DMA MMC triggers */ switch (sc->device_id) { + case 0: case 1: sc->dma_tx_trig = 60; sc->dma_rx_trig = 61; @@ -1485,11 +1490,13 @@ return(EINVAL); } + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate a RX channel from the OMAP DMA driver */ err = ti_sdma_activate_channel(&sc->sc_dmach_rd, ti_mmchs_dma_intr, sc); if (err != 0) return(err); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the RX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_rd, TI_SDMA_BURST_NONE, TI_SDMA_BURST_64); @@ -1499,11 +1506,13 @@ ti_sdma_set_addr_mode(sc->sc_dmach_rd, TI_SDMA_ADDR_CONSTANT, TI_SDMA_ADDR_POST_INCREMENT); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate and configure the TX DMA channel */ err = ti_sdma_activate_channel(&sc->sc_dmach_wr, ti_mmchs_dma_intr, sc); if (err != 0) return(err); + printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the TX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_wr, TI_SDMA_BURST_64, TI_SDMA_BURST_NONE); @@ -1595,6 +1604,7 @@ if (sc->sc_mem_res == NULL) panic("%s: Cannot map registers", device_get_name(dev)); + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate an IRQ resource for the MMC controller */ rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -1602,6 +1612,7 @@ if (sc->sc_irq_res == NULL) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate DMA tags and maps */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, @@ -1610,17 +1621,19 @@ if (err != 0) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); err = bus_dmamap_create(sc->sc_dmatag, 0, &sc->sc_dmamap); if (err != 0) goto errout; + device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Initialise the DMA channels to be used by the controller */ err = ti_mmchs_init_dma_channels(sc); if (err != 0) goto errout; /* Set the register offset */ - if (ti_chip() == CHIP_OMAP_3) + if (ti_chip() == CHIP_OMAP_3 || ti_chip() == CHIP_AM37X) // @todo XXX maybe switch instead of if? sc->sc_reg_off = OMAP3_MMCHS_REG_OFFSET; else if (ti_chip() == CHIP_OMAP_4) sc->sc_reg_off = OMAP4_MMCHS_REG_OFFSET; @@ -1691,6 +1704,7 @@ return (ENXIO); } sc->device_id = fdt32_to_cpu(did); + device_printf( dev, "Device id: %d\n", did ); /* Initiate the mtex lock */ TI_MMCHS_LOCK_INIT(sc); @@ -1729,16 +1743,16 @@ #endif /* Activate the device */ - device_printf( dev, "Activating the device..." ); + device_printf( dev, "Activating the device...\n" ); err = ti_mmchs_activate(dev); if (err) goto out; - device_printf( dev, "Initializing the device..." ); + device_printf( dev, "Initializing the device...\n" ); /* Initialise the controller */ ti_mmchs_hw_init(dev); - device_printf( dev, "Setting up interrupt the device..." ); + device_printf( dev, "Setting up interrupt the device...\n" ); /* Activate the interrupt and attach a handler */ err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_mmchs_intr, sc, &sc->sc_irq_h); @@ -1754,7 +1768,7 @@ device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); - device_printf( dev, "Attaching to bus..." ); + device_printf( dev, "Attaching to bus...\n" ); err = bus_generic_attach(dev); out: Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 09:11:47 2012 (r238903) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 11:24:41 2012 (r238904) @@ -149,7 +149,7 @@ reg =<0x4809c000 0x1000 >; interrupts = <83>; interrupt-parent = <&AINTC>; - mmchs-device-id = <0>; + mmchs-device-id = <1>; }; From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 13:03:38 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A3433106564A for ; Tue, 3 Jul 2012 13:03:36 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 13:03:36 +0000 Date: Tue, 03 Jul 2012 13:03:36 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703130336.A3433106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238910 - soc2012/syuu/bhyve-bios/lib/libvmmapi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 13:03:38 -0000 Author: syuu Date: Tue Jul 3 13:03:36 2012 New Revision: 238910 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238910 Log: fix bug Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Tue Jul 3 12:08:55 2012 (r238909) +++ soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Tue Jul 3 13:03:36 2012 (r238910) @@ -213,7 +213,6 @@ if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_EFER, efer)) != 0) goto done; - error = 0; done: return (error); } From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 13:09:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DD9D9106564A for ; Tue, 3 Jul 2012 13:09:04 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 13:09:04 +0000 Date: Tue, 03 Jul 2012 13:09:04 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703130904.DD9D9106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238911 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 13:09:07 -0000 Author: gpf Date: Tue Jul 3 13:09:04 2012 New Revision: 238911 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238911 Log: - properly handle checksum integrity errors - a lot of testing was done and a few minor bugs were fixed sbin/pefs verify will try to print as many error messages as possible and will only exit prematurely if a system error occurs. e.g. could not allocate memory in heap or could not open a directory, etc. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jul 3 13:03:36 2012 (r238910) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jul 3 13:09:04 2012 (r238911) @@ -57,7 +57,7 @@ #include "pefs_ctl.h" -#define PEFS_INTEGRITY_DEBUG +//#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -207,13 +207,13 @@ /* feed parent directory to ioctl() */ strlcpy(xsl.pxsl_filename, fhp->filename, sizeof(xsl.pxsl_filename)); xsl.pxsl_namelen = strnlen(xsl.pxsl_filename, sizeof(xsl.pxsl_filename)); - + error = ioctl(fhp->pfd, PEFS_GETSLINKCTEXT, &xsl); if (error != 0) { pefs_warn("error retrieving symlink's ciphertext of %s", fhp->path); return (PEFS_ERR_IO); } - + dprintf(("read %d bytes from kernel\n\n", xsl.pxsl_slink_len)); dprintf(("printing contents of buf:")); for (i=0; i < (int)xsl.pxsl_slink_len; i++) dprintf(("%c", xsl.pxsl_slink[i])); @@ -300,7 +300,7 @@ bytes_to_read = PEFS_SECTOR_SIZE; else bytes_to_read = resid; - + if ((flags & PEFS_UNMOUNTED) != 0 || (flags & PEFS_NOKEY) != 0) { fread(sector_buf, bytes_to_read, sizeof(char), fp); if (ferror(fp)) { @@ -358,14 +358,14 @@ } /* - * XXXgpf: [TODO] better move the fp into file_header struct and deal with + * XXXgpf: [TODO] better move the fp into file_header struct and deal with * closing it during pefs_file_close. */ if (fp != NULL) { fclose(fp); fhp->fd = -1; } - + return (0); } @@ -562,7 +562,7 @@ elem = elem2; } - /* XXXgpf: should be left as a warning at least during development phase */ + /* XXXgpf: should be left as a warning during development phase */ pefs_warn("cuckoo_insert resulted in infinite loop!"); return (PEFS_ERR_GENERIC); } @@ -574,7 +574,7 @@ return (pefs_cuckoo_insert(chtp, fhp)); } -/* for debugging purposes */ +/* XXXgpf: for debugging purposes */ static void pefs_print_hash_tables(struct cuckoo_hash_table *chtp, uint8_t hash_len) { @@ -670,7 +670,6 @@ error = ioctl(fhp->pfd, PEFS_GETNAMECSUM, &xncs); if (error == 0) { - /* XXXgpf: Is this correct? */ memcpy(&temp, xncs.pxnc_csum, sizeof(xncs.pxnc_csum)); fhp->file_id = be64toh(temp); } @@ -775,7 +774,7 @@ RB_FOREACH(hlcp, hardlink_head, hlc_headp) { if (hlcp->total_links > hlcp->links_found) { - pefs_warn("%d hard links of total %d were found in input list for file with inode: %d", + pefs_warn("%d hard link(s) of total %d were found in input list for file with inode: %d", hlcp->links_found, hlcp->total_links, hlcp->inode); i = 1; TAILQ_FOREACH(fhp, &(hlcp->file_headers), fh_hardlink_entries) { @@ -902,7 +901,7 @@ sbuf[nchars] = '\0'; /* turn relative paths to absolute paths */ - if (sbuf[0] != '/') + if (sbuf[0] != '/' && (flags & PEFS_UNMOUNTED) == 0 && (flags & PEFS_NOKEY) == 0) snprintf(fhp->target_path, target_path_size, "%s/%s", fhp->dirpath, sbuf); else strlcpy(fhp->target_path, sbuf, target_path_size); @@ -925,15 +924,6 @@ return (PEFS_ERR_SYS); } } - - /* - * XXXgpf: - * Is there a way to check that symlink file itself exists in pefs filesystem? - * fstatfs() for example requires a fd and we can't open() the symlink without - * either failing, or having to traverse it. - * On the other hand, if the symlink does not reside in pefs fs, then the calls to - * ioctl() later on will fail. - */ return (0); } else @@ -1088,6 +1078,7 @@ pefs_rb_print(&hlc_head); pefs_rb_warn(&hlc_head); + /* XXXgpf: [TODO] rb_free */ error = pefs_allocate_hash_table(chtp, nfiles, PEFS_EXTEND); if (error != 0) @@ -1166,9 +1157,6 @@ return (0); } -/* - * XXXgpf: [TODO] take a look at chained offsets - */ static int pefs_write_file_header(int fdout, struct file_header *fhp, uint32_t *buckets_offset) { @@ -1589,6 +1577,7 @@ TAILQ_INIT(&(fhp->checksums)); hashes_offset = fhp->offset_to_checksums; fhp->found = 0; + fhp->target_path = NULL; for (k = 0; k < fhp->nhashes; k++) { csp = malloc(sizeof(struct checksum)); @@ -1622,6 +1611,7 @@ TAILQ_INIT(&(fhp->checksums)); hashes_offset = fhp->offset_to_checksums; fhp->found = 0; + fhp->target_path = NULL; for (k = 0; k < fhp->nhashes; k++) { csp = malloc(sizeof(struct checksum)); @@ -1652,32 +1642,33 @@ { struct checksum *csp1, *csp2; uint32_t i; - int error; + int error, cmp; dprintf(("comparing hashes for file with fid: %llu\t%llu\n", fhp->file_id, indexfhp->file_id)); + error = 0; if (fhp->nhashes != indexfhp->nhashes) { pefs_warn("number of hashes differ between on disk file and stored values for file %s: %u vs %u", fhp->path, fhp->nhashes, indexfhp->nhashes); - return (1); + error = PEFS_ERR_CHECKSUM; } csp1 = TAILQ_FIRST(&fhp->checksums); csp2 = TAILQ_FIRST(&indexfhp->checksums); i = 1; while (csp1 != NULL && csp2 != NULL) { - error = memcmp(csp1->hash, csp2->hash, hash_len); - if (error != 0) { + cmp = memcmp(csp1->hash, csp2->hash, hash_len); + if (cmp != 0) { pefs_warn("checksum no: %u differs between on disk file and stored values for file %s", i, fhp->path); - return (1); + error = PEFS_ERR_CHECKSUM; } csp1 = TAILQ_NEXT(csp1, checksum_entries); csp2 = TAILQ_NEXT(csp2, checksum_entries); i++; } - return (0); + return (error); } /* @@ -1686,7 +1677,7 @@ static int pefs_traverse_fs(struct cuckoo_hash_table *chtp, const EVP_MD *md, uint8_t hash_len, DIR *dirp, char *path, struct statfs *fsp, struct hardlink_head *hlc_headp, struct file_header_head *fh_headp, - int flags) + int flags, int *checksum_error) { char tmpath[MAXPATHLEN]; struct stat sb; @@ -1704,7 +1695,7 @@ strcmp(sdp->d_name, ".pefs.checksum") == 0) continue; - //dprintf(("dirent: %s\n", sdp->d_name)); + dprintf(("dirent: %s\n", sdp->d_name)); snprintf(tmpath, sizeof(tmpath), "%s/%s", path, sdp->d_name); switch (sdp->d_type) { case DT_DIR: @@ -1714,7 +1705,8 @@ closedir(dirp); return (PEFS_ERR_SYS); } - error = pefs_traverse_fs(chtp, md, hash_len, dirtmp, tmpath, fsp, hlc_headp, fh_headp, flags); + error = pefs_traverse_fs(chtp, md, hash_len, dirtmp, tmpath, + fsp, hlc_headp, fh_headp, flags, checksum_error); if (error != 0) { closedir(dirp); return (PEFS_ERR_SYS); @@ -1747,6 +1739,7 @@ error = pefs_get_file_id(fhp, flags); if (error != 0) { + closedir(dirp); pefs_close_file(fhp); free(fhp); return (error); @@ -1762,6 +1755,7 @@ error = pefs_compute_file_checksums(fhp, md, hash_len, flags); if (error != 0) { + closedir(dirp); pefs_close_file(fhp); free(fhp); return (error); @@ -1771,6 +1765,7 @@ error = lstat(fhp->path, &sb); if (error != 0) { warn("cannot stat file %s", fhp->path); + closedir(dirp); pefs_close_file(fhp); free(fhp); return (PEFS_ERR_SYS); @@ -1778,23 +1773,19 @@ error = pefs_rb_insert(hlc_headp, fhp, &sb); if (error != 0) { + closedir(dirp); pefs_close_file(fhp); free(fhp); return (error); } - + /* - * XXXgpf: [TODO] if error encountered during - * pefs_compare_cehcksums, then store this information - * but keep on traversing the fs to find other errors - * as well. - */ + * if error encountered during pefs_compare_cehcksums, + * keep on traversing the fs to find other errors as well. + */ error = pefs_compare_checksums(fhp, indexfhp, hash_len); - //if (error != 0) { - //pefs_close_file(fhp); - //free(fhp); - //break; - //} + if (error != 0) + *checksum_error = error; TAILQ_INSERT_TAIL(fh_headp, fhp, file_header_entries); pefs_close_file(fhp); @@ -1809,32 +1800,40 @@ } } + /* unreachable, just to silence compiler */ pefs_warn("invalid dirp argument for dir: %s", path); return (PEFS_ERR_SYS); } -/* XXXgpf: probably turn this to int */ -static void +static int pefs_found_all_entries(struct cuckoo_hash_table *chtp) { struct file_header *fhp; uint32_t i; + int error; + error = 0; for (i = 0; i < chtp->size; i++) { fhp = chtp->buckets1[i].fhp; if (fhp != NULL) - if (fhp->found != 1) + if (fhp->found != 1) { pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", fhp->file_id); + error = PEFS_ERR_NOENT; + } } for (i = 0; i < chtp->size; i++) { fhp = chtp->buckets2[i].fhp; if (fhp != NULL) - if (fhp->found != 1) + if (fhp->found != 1) { pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", fhp->file_id); + error = PEFS_ERR_NOENT; + } } + + return (error); } /* @@ -1850,9 +1849,13 @@ struct hardlink_head hlc_head; const EVP_MD *md; DIR *dirp; - int error; + int error, checksum_error; uint8_t hash_len; + RB_INIT(&hlc_head); + TAILQ_INIT(&fh_head); + checksum_error = 0; + if (statfs(fsroot, &fs) == -1) { pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); return (PEFS_ERR_SYS); @@ -1877,32 +1880,35 @@ error = pefs_read_checksum_file(fdin, &cfh, &cht); if (error != 0) - return (error); + goto out; - //pefs_print_hash_tables(&cht, hash_len); - - RB_INIT(&hlc_head); - TAILQ_INIT(&fh_head); + /* pefs_print_hash_tables(&cht, hash_len); */ dirp = opendir(fsroot); if (dirp == NULL) { pefs_warn("failed to open dir %s", fsroot); - return (PEFS_ERR_SYS); + goto out; } - error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot, &fs, &hlc_head, &fh_head, flags); + error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot, &fs, &hlc_head, &fh_head, flags, &checksum_error); if (error != 0) - return (error); + goto out; - //pefs_rb_print(&hlc_head); - pefs_rb_warn(&hlc_head); + /* pefs_rb_print(&hlc_head); */ + pefs_rb_warn(&hlc_head);printf("3\n"); if ((flags & PEFS_UNMOUNTED) == 0 && (flags & PEFS_NOKEY) == 0) pefs_symlink_warn(&cht, &fh_head); - pefs_found_all_entries(&cht); - /* XXXgpf: [TODO] free mem in the end and when error occurs */ - /* XXXgpf: [TODO] verify action should also use a signature to verify .pefs.checksum */ - return (0); + error = pefs_found_all_entries(&cht); + + if (error == 0 && checksum_error != 0) + error = checksum_error; + +out: + pefs_free_hash_table(&cht); + /* XXXgpf: [TODO] rb_free */ + /* XXXgpf: [TODO] fh_free */ + return (error); } RB_GENERATE(hardlink_head, hardlink_counter, hardlink_entries, pefs_rb_cmp); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Tue Jul 3 13:03:36 2012 (r238910) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Tue Jul 3 13:09:04 2012 (r238911) @@ -1161,22 +1161,25 @@ strlcpy(fsroot, argv[0], sizeof(fsroot)); if (stat(fsroot, &sb) != 0) { warn("cannot stat fs root: %s", fsroot); + close(fdin); return (PEFS_ERR_NOENT); } if (S_ISDIR(sb.st_mode) == 0) { pefs_warn("fs root is not a directory: %s", fsroot); + close(fdin); return (PEFS_ERR_SYS); } } error = pefs_verify_checksum(fdin, fsroot, flags); if (error == 0) - printf("everything's ok!\n"); + printf("integrity verification ok!\n"); + else + pefs_warn("integrity verification encountered error(s)"); close(fdin); return (error); - } static void Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Tue Jul 3 13:03:36 2012 (r238910) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Tue Jul 3 13:09:04 2012 (r238911) @@ -64,6 +64,7 @@ #define PEFS_ERR_NOENT 5 #define PEFS_ERR_EXIST 6 #define PEFS_ERR_INVALID 7 +#define PEFS_ERR_CHECKSUM 8 #define PEFS_FS_IGNORE_TYPE 0x0001 From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 16:58:46 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8B366106566C for ; Tue, 3 Jul 2012 16:58:44 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 16:58:44 +0000 Date: Tue, 03 Jul 2012 16:58:44 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703165844.8B366106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238917 - in soc2012/jhagewood: diff diff/diff sdiff sdiff/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 16:58:46 -0000 Author: jhagewood Date: Tue Jul 3 16:58:43 2012 New Revision: 238917 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238917 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jul 3 15:54:20 2012 (r238916) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jul 3 16:58:43 2012 (r238917) @@ -355,7 +355,7 @@ case OPT_NEW_GF: case OPT_OLD_GF: case OPT_UNCHGD_GF: - /* XXX To do: Coplete --GTYPE-group-format. */ + /* XXX To do: Complete --GTYPE-group-format. */ format = D_GF; group_format = optarg; break; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jul 3 15:54:20 2012 (r238916) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jul 3 16:58:43 2012 (r238917) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-07-02 15:05:57.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-07-03 15:59:52.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -292,7 +292,7 @@ + case OPT_NEW_GF: + case OPT_OLD_GF: + case OPT_UNCHGD_GF: -+ /* XXX To do: Coplete --GTYPE-group-format. */ ++ /* XXX To do: Complete --GTYPE-group-format. */ + format = D_GF; + group_format = optarg; + break; @@ -664,7 +664,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-07-02 15:05:57.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-07-02 15:05:57.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-07-03 16:22:08.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Tue Jul 3 15:54:20 2012 (r238916) +++ soc2012/jhagewood/sdiff/TODO Tue Jul 3 16:58:43 2012 (r238917) @@ -1,6 +1,8 @@ Combine diff-spec args and pipe to diff INCOMPLETE Test script COMPLETE Adapt code to FreeBSD style guidelines INCOMPLETE +Fix --width output indention IN PROGRESS + NOTES: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Tue Jul 3 15:54:20 2012 (r238916) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Tue Jul 3 16:58:43 2012 (r238917) @@ -1,6 +1,15 @@ diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-02 16:34:59.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-03 16:56:41.000000000 -0400 +@@ -34,7 +34,7 @@ + #include "common.h" + #include "extern.h" + +-#define WIDTH 130 ++#define WIDTH 128 + /* + * Each column must be at least one character wide, plus three + * characters between the columns (space, [<|>], space). @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -11,25 +20,22 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -604,7 +605,7 @@ println(const char *s1, const char div, - } - - /* Otherwise, we pad this column up to width. */ -- for (; col < width; ++col) -+ for (; col < width-1; ++col) - putchar(' '); - - /* -@@ -612,10 +613,10 @@ println(const char *s1, const char div, - * need to add the space for padding. - */ - if (!s2) { -- printf(" %c\n", div); -+ printf("%c\n", div); - return; - } -- printf(" %c ", div); -+ printf("%c ", div); - col += 3; +@@ -363,7 +364,9 @@ main(int argc, char **argv) + diffargv[diffargc++] = NULL; - /* Skip angle bracket and space. */ + /* Subtract column divider and divide by two. */ +- width = (wflag - 3) / 2; ++ width = ((wflag - 3) / 2) - 2; ++ if (!wflag) ++ width = ((wflag - 3) / 2); + /* Make sure line_width can fit in size_t. */ + if (width > (SIZE_MAX - 3) / 2) + errx(2, "width is too large: %zu", width); +@@ -383,7 +386,6 @@ main(int argc, char **argv) + err(2, "child could not duplicate descriptor"); + /* Free unused descriptor. */ + close(fd[1]); +- + execvp(diffprog, diffargv); + err(2, "could not execute diff: %s", diffprog); + break; Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Tue Jul 3 15:54:20 2012 (r238916) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Tue Jul 3 16:58:43 2012 (r238917) @@ -34,7 +34,7 @@ #include "common.h" #include "extern.h" -#define WIDTH 130 +#define WIDTH 128 /* * Each column must be at least one character wide, plus three * characters between the columns (space, [<|>], space). @@ -364,7 +364,9 @@ diffargv[diffargc++] = NULL; /* Subtract column divider and divide by two. */ - width = (wflag - 3) / 2; + width = ((wflag - 3) / 2) - 2; + if (!wflag) + width = ((wflag - 3) / 2); /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); @@ -384,7 +386,6 @@ err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); - execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; @@ -605,7 +606,7 @@ } /* Otherwise, we pad this column up to width. */ - for (; col < width-1; ++col) + for (; col < width; ++col) putchar(' '); /* @@ -613,10 +614,10 @@ * need to add the space for padding. */ if (!s2) { - printf("%c\n", div); + printf(" %c\n", div); return; } - printf("%c ", div); + printf(" %c ", div); col += 3; /* Skip angle bracket and space. */ From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 17:27:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E3724106566C for ; Tue, 3 Jul 2012 17:27:02 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 17:27:02 +0000 Date: Tue, 03 Jul 2012 17:27:02 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703172702.E3724106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238922 - in soc2012/aleek/beaglexm-armv6/sys: arm/conf arm/ti arm/ti/am37x boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 17:27:05 -0000 Author: aleek Date: Tue Jul 3 17:27:02 2012 New Revision: 238922 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238922 Log: attaching mmc driver - still not working Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jul 3 16:49:38 2012 (r238921) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jul 3 17:27:02 2012 (r238922) @@ -81,7 +81,7 @@ device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card -#options ROOTDEVNAME=\"ufs:mmcsd0s2\" +options ROOTDEVNAME=\"ufs:mmcsd0s2\" # Console and misc @@ -127,7 +127,7 @@ options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=beagleboardxm.dts -options MD_ROOT -options MD_ROOT_SIZE=8192 -makeoptions MFS_IMAGE=/home/alek/beaglexm-armv6/arm.ramfs -options ROOTDEVNAME=\"ufs:md0\" +#options MD_ROOT +#options MD_ROOT_SIZE=8192 +#makeoptions MFS_IMAGE=/home/alek/beaglexm-armv6/arm.ramfs +#options ROOTDEVNAME=\"ufs:md0\" Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Tue Jul 3 16:49:38 2012 (r238921) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Tue Jul 3 17:27:02 2012 (r238922) @@ -384,10 +384,10 @@ 0x00, 0x10, 0x20, 11), OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER11_CLK, -1, CORE_CM_OFFSET, 0x00, 0x10, 0x20, 12), -#if 0 /* HSMMC (MMC1 and MMC2 can have different input clocks) */ OMAP3_GENERIC_CLOCK_DETAILS(MMC1_CLK, FREQ_96MHZ, CORE_CM_OFFSET, 0x00, 0x10, 0x20, 24), +#if 0 OMAP3_GENERIC_CLOCK_DETAILS(MMC2_CLK, FREQ_96MHZ, CORE_CM_OFFSET, 0x00, 0x10, 0x20, 25), OMAP3_GENERIC_CLOCK_DETAILS(MMC3_CLK, FREQ_96MHZ, CORE_CM_OFFSET, @@ -587,7 +587,15 @@ return (ETIMEDOUT); } #endif - return (0); + + for( unsigned int i=0; i< MAX_MODULE_ENABLE_WAIT; ++i ) + { + if( ( cm_read_4( clk_details->idlest_offset ) & (1UL << clk_details->bit_offset) ) == 0 ) + { + return (0); + } + } + return (ETIMEDOUT); } static int @@ -644,7 +652,7 @@ } static int -omap3_clk_gptimer_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) { const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); @@ -703,7 +711,7 @@ } static int -omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +omap3_clk_gptimer_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) { const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); uint32_t bit, regoff; Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 16:49:38 2012 (r238921) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Tue Jul 3 17:27:02 2012 (r238922) @@ -1604,7 +1604,6 @@ if (sc->sc_mem_res == NULL) panic("%s: Cannot map registers", device_get_name(dev)); - device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate an IRQ resource for the MMC controller */ rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -1612,7 +1611,6 @@ if (sc->sc_irq_res == NULL) goto errout; - device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Allocate DMA tags and maps */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, @@ -1621,12 +1619,10 @@ if (err != 0) goto errout; - device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); err = bus_dmamap_create(sc->sc_dmatag, 0, &sc->sc_dmamap); if (err != 0) goto errout; - device_printf( dev, "%s:%d\n", __FILE__, __LINE__ ); /* Initialise the DMA channels to be used by the controller */ err = ti_mmchs_init_dma_channels(sc); if (err != 0) @@ -1703,8 +1699,8 @@ device_printf(dev, "missing mmchs-device-id attribute in FDT\n"); return (ENXIO); } - sc->device_id = fdt32_to_cpu(did); - device_printf( dev, "Device id: %d\n", did ); + sc->device_id = 1; //fdt32_to_cpu(did); + device_printf( dev, "Device id: %u\n", sc->device_id ); /* Initiate the mtex lock */ TI_MMCHS_LOCK_INIT(sc); @@ -1743,16 +1739,13 @@ #endif /* Activate the device */ - device_printf( dev, "Activating the device...\n" ); err = ti_mmchs_activate(dev); if (err) goto out; - device_printf( dev, "Initializing the device...\n" ); /* Initialise the controller */ ti_mmchs_hw_init(dev); - device_printf( dev, "Setting up interrupt the device...\n" ); /* Activate the interrupt and attach a handler */ err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_mmchs_intr, sc, &sc->sc_irq_h); @@ -1768,7 +1761,6 @@ device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); - device_printf( dev, "Attaching to bus...\n" ); err = bus_generic_attach(dev); out: Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 16:49:38 2012 (r238921) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Jul 3 17:27:02 2012 (r238922) @@ -151,8 +151,6 @@ interrupt-parent = <&AINTC>; mmchs-device-id = <1>; }; - - i2c0: i2c@48070000 { From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 19:19:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B1AA3106566C for ; Tue, 3 Jul 2012 19:19:03 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 19:19:03 +0000 Date: Tue, 03 Jul 2012 19:19:03 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703191903.B1AA3106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238926 - in soc2012/syuu/bhyve-bios/sys/amd64: include vmm/intel X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 19:19:05 -0000 Author: syuu Date: Tue Jul 3 19:19:03 2012 New Revision: 238926 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238926 Log: Rename VM_EXITCODE_VMCALL to VM_EXITCODE_HYPERCALL, because vmcall is Intel specific instruction name Modified: soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Modified: soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h ============================================================================== --- soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h Tue Jul 3 18:59:13 2012 (r238925) +++ soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h Tue Jul 3 19:19:03 2012 (r238926) @@ -228,7 +228,7 @@ VM_EXITCODE_MTRAP, VM_EXITCODE_PAUSE, VM_EXITCODE_PAGING, - VM_EXITCODE_VMCALL, + VM_EXITCODE_HYPERCALL, VM_EXITCODE_MAX }; Modified: soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c ============================================================================== --- soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Tue Jul 3 18:59:13 2012 (r238925) +++ soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Tue Jul 3 19:19:03 2012 (r238926) @@ -1190,7 +1190,7 @@ vmexit->u.paging.cr3 = vmcs_guest_cr3(); break; case EXIT_REASON_VMCALL: - vmexit->exitcode = VM_EXITCODE_VMCALL; + vmexit->exitcode = VM_EXITCODE_HYPERCALL; break; default: break; From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 19:26:02 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7DACB1065672 for ; Tue, 3 Jul 2012 19:26:00 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 19:26:00 +0000 Date: Tue, 03 Jul 2012 19:26:00 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703192600.7DACB1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238927 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 19:26:02 -0000 Author: syuu Date: Tue Jul 3 19:25:59 2012 New Revision: 238927 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238927 Log: Rename VMCALL -> HYPERCALL, inital implement of INT 10h Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.h soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Tue Jul 3 19:19:03 2012 (r238926) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Tue Jul 3 19:25:59 2012 (r238927) @@ -8,6 +8,7 @@ SRCS+= instruction_emul.c mevent.c SRCS+= pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c post.c rtc.c uart.c xmsr.c +SRCS+= bios_call.c bios_int10.c NO_MAN= Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c Tue Jul 3 19:25:59 2012 (r238927) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include "bios_call.h" + +SET_DECLARE(bios_call_set, struct bios_call); + +#define MAX_INTRS (0xff) + +static struct { + const char *name; + bios_call_func_t handler; +} bios_call_handlers[MAX_INTRS]; + +static int +default_bios_call(struct vmctx *ctx, int vcpu, int intno) +{ + fprintf(stderr, "Not implemented BIOS call int=%x\n", intno); + + return (-1); +} + +int +emulate_bios_call(struct vmctx *ctx, int vcpu, int intno) +{ + bios_call_func_t handler; + + assert(intno < MAX_INTRS); + + handler = bios_call_handlers[intno].handler; + + if (handler == default_bios_call) + return (-1); + + return ((*handler)(ctx, vcpu, intno)); +} + +void +init_bios_call(void) +{ + struct bios_call **bcpp, *bcp; + int i; + + /* + * Set up the default handler for all intnos + */ + for (i = 0; i < MAX_INTRS; i++) { + bios_call_handlers[i].name = "default"; + bios_call_handlers[i].handler = default_bios_call; + } + + /* + * Overwrite with specified handlers + */ + SET_FOREACH(bcpp, bios_call_set) { + bcp = *bcpp; + assert(bcp->intno < MAX_INTRS); + bios_call_handlers[bcp->intno].name = bcp->name; + bios_call_handlers[bcp->intno].handler = bcp->handler; + } +} + +int +register_bios_call(struct bios_call *bcp) +{ + assert(bcp->intno < MAX_INTRS); + bios_call_handlers[bcp->intno].name = bcp->name; + bios_call_handlers[bcp->intno].handler = bcp->handler; + + return (0); +} Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.h Tue Jul 3 19:25:59 2012 (r238927) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#ifndef _BIOS_CALL_H_ +#define _BIOS_CALL_H_ + +#include + +struct vmctx; + +typedef int (*bios_call_func_t)(struct vmctx *ctx, int vcpu, int intno); + +struct bios_call { + const char *name; + int intno; + bios_call_func_t handler; +}; + +#define BIOS_CALL(name, intno, handler) \ + static struct bios_call __CONCAT(__bios_call, __LINE__) = { \ + #name, \ + (intno), \ + (handler), \ + }; \ + DATA_SET(bios_call_set, __CONCAT(__bios_call, __LINE__)) + +void init_bios_call(void); +int emulate_bios_call(struct vmctx *, int vcpu, int intno); +int register_bios_call(struct bios_call *call); + +#endif /* _BIOS_CALL_H_ */ Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c Tue Jul 3 19:25:59 2012 (r238927) @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "bios_call.h" + +#define BVM_CONS_SIG ('b' << 8 | 'v') + +static struct termios tio_orig, tio_new; + +static void +ttyclose(void) +{ + tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig); +} + +static void +ttyopen(void) +{ + tcgetattr(STDIN_FILENO, &tio_orig); + + cfmakeraw(&tio_new); + tcsetattr(STDIN_FILENO, TCSANOW, &tio_new); + + atexit(ttyclose); +} + +static void +ttywrite(unsigned char wb) +{ + (void) write(STDOUT_FILENO, &wb, 1); +} + +static int +int10_handler(struct vmctx *ctx, int vcpu, int intno) +{ + static int opened; + uint64_t rax, rbx; + uint8_t al, ah, bl, bh; + int error; + + if (!opened) { + ttyopen(); + opened = 1; + } + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, &rax)) != 0) + goto done; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBX, &rbx)) != 0) + goto done; + + al = (uint8_t)rax; + ah = (uint8_t)(rax >> 8); + bl = (uint8_t)rbx; + bh = (uint8_t)(rbx >> 8); + + switch (ah) { + case 0x0e: + ttywrite(al); + break; + default: + fprintf(stderr, "Not implemented BIOS call int=%x ah=%x\n", + intno, ah); + } + +done: + return (error); + +} +BIOS_CALL(int10, 0x10, int10_handler); Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 19:19:03 2012 (r238926) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 19:25:59 2012 (r238927) @@ -43,7 +43,6 @@ #include #include #include -#include #include #include @@ -55,6 +54,7 @@ #include "pci_emul.h" #include "xmsr.h" #include "instruction_emul.h" +#include "bios_call.h" #define DEFAULT_GUEST_HZ 100 #define DEFAULT_GUEST_TSLICE 200 @@ -434,39 +434,23 @@ } static int -vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) +vmexit_hypercall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { - int error; - uint64_t rsp, rip, rax, rbx, rcx, rdx; - uint64_t intr; - - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RSP, &rsp); - if (!error) - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RIP, &rip); - if (!error) - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RAX, &rax); - if (!error) - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RBX, &rbx); - if (!error) - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RCX, &rcx); - if (!error) - error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RDX, &rdx); + int intno = (vmexit->rip - 0x400) / 0x4; - if (error) { - printf("errno = %d\n", errno); + if (!bios_mode) { + fprintf(stderr, "Failed to handle hypercall at 0x%lx\n", + vmexit->rip); return (VMEXIT_ABORT); } - - printf("VMCALL handled\n"); - printf("rsp=%"PRIx64" rip=%"PRIx64" rax=%"PRIx64" rbx=%"PRIx64" rcx=%"PRIx64" rdx=%"PRIx64"\n", - rsp, rip, rax, rbx, rcx, rdx); - intr = (rip - 0x400) / 0x4; - printf("intr=%"PRIu64"\n", intr); - - if (intr == 0x14) + + if (emulate_bios_call(ctx, *pvcpu, intno) != 0) { + fprintf(stderr, "Failed to emulate BIOS call at 0x%lx\n", + vmexit->rip); return (VMEXIT_ABORT); - else - return (VMEXIT_CONTINUE); + } + + return (VMEXIT_CONTINUE); } static void @@ -510,7 +494,7 @@ [VM_EXITCODE_WRMSR] = vmexit_wrmsr, [VM_EXITCODE_MTRAP] = vmexit_mtrap, [VM_EXITCODE_PAGING] = vmexit_paging, - [VM_EXITCODE_VMCALL] = vmexit_vmcall, + [VM_EXITCODE_HYPERCALL] = vmexit_hypercall, }; static void @@ -690,6 +674,7 @@ if (bios_mode != 0) { vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1); + init_bios_call(); } init_inout(); From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 19:26:32 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E2B161065674 for ; Tue, 3 Jul 2012 19:26:29 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 19:26:29 +0000 Date: Tue, 03 Jul 2012 19:26:29 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703192629.E2B161065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238928 - soc2012/syuu/bhyve-bios/tmp/testbootsect X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 19:26:32 -0000 Author: syuu Date: Tue Jul 3 19:26:29 2012 New Revision: 238928 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238928 Log: INT 10h test Modified: soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S Modified: soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S ============================================================================== --- soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S Tue Jul 3 19:25:59 2012 (r238927) +++ soc2012/syuu/bhyve-bios/tmp/testbootsect/testbootsect.S Tue Jul 3 19:26:29 2012 (r238928) @@ -1,7 +1,11 @@ .code16 - mov $0x1, %ax - mov $0x2, %bx - mov $0x3, %cx - mov $0x4, %dx - int $0x13 - int $0x14 + movb $'a',%al + movb $0xe,%ah + int $0x10 + movb $'b',%al + movb $0xe,%ah + int $0x10 + movb $'c',%al + movb $0xe,%ah + int $0x10 + int $0x20 From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 19:59:35 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E0262106566C for ; Tue, 3 Jul 2012 19:59:32 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 19:59:32 +0000 Date: Tue, 03 Jul 2012 19:59:32 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703195932.E0262106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238929 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 19:59:35 -0000 Author: syuu Date: Tue Jul 3 19:59:32 2012 New Revision: 238929 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238929 Log: Null handler for INT 18h Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Tue Jul 3 19:26:29 2012 (r238928) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Tue Jul 3 19:59:32 2012 (r238929) @@ -8,7 +8,7 @@ SRCS+= instruction_emul.c mevent.c SRCS+= pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c post.c rtc.c uart.c xmsr.c -SRCS+= bios_call.c bios_int10.c +SRCS+= bios_call.c bios_int10.c bios_int18.c NO_MAN= Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 19:26:29 2012 (r238928) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Tue Jul 3 19:59:32 2012 (r238929) @@ -445,8 +445,8 @@ } if (emulate_bios_call(ctx, *pvcpu, intno) != 0) { - fprintf(stderr, "Failed to emulate BIOS call at 0x%lx\n", - vmexit->rip); + fprintf(stderr, "Failed to emulate INT %x at 0x%lx\n", + intno, vmexit->rip); return (VMEXIT_ABORT); } From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 19:59:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 00B28106564A for ; Tue, 3 Jul 2012 19:59:54 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 19:59:54 +0000 Date: Tue, 03 Jul 2012 19:59:54 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703195954.00B28106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238930 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 19:59:56 -0000 Author: syuu Date: Tue Jul 3 19:59:53 2012 New Revision: 238930 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238930 Log: Null handler for INT 18h Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int18.c Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int18.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int18.c Tue Jul 3 19:59:53 2012 (r238930) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "bios_call.h" + +static int +int18_handler(struct vmctx *ctx, int vcpu, int intno) +{ + return (0); +} +BIOS_CALL(int18, 0x18, int18_handler); From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 21:55:43 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D153F106564A for ; Tue, 3 Jul 2012 21:55:40 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 21:55:40 +0000 Date: Tue, 03 Jul 2012 21:55:40 +0000 From: vchan@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703215540.D153F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238934 - soc2012/vchan/gtcp/bwalex-tc-play X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 21:55:43 -0000 Author: vchan Date: Tue Jul 3 21:55:40 2012 New Revision: 238934 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238934 Log: newest material in tcplay.c Deleted: soc2012/vchan/gtcp/bwalex-tc-play/tcplay_new.c Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 3 19:11:38 2012 (r238933) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jul 3 21:55:40 2012 (r238934) @@ -28,7 +28,11 @@ */ #include + +#if defined(__DragonFly__) #include +#endif + #include #include #include @@ -38,8 +42,16 @@ #include #include #include -#include -#include +//#if defined(__linux__) +//#include +//#include +//#elif defined(__DragonFly__) +//#include +//#include +#include +#include + +//#endif #include "crc32.h" #include "tcplay.h" @@ -911,6 +923,7 @@ return -1; } + int map_volume(const char *map_name, const char *device, int sflag, const char *sys_dev, int protect_hidden, const char *keyfiles[], @@ -945,6 +958,7 @@ return 0; } +/*fix*/ static int dm_remove_device(const char *name) @@ -964,7 +978,7 @@ ret = 0; out: if (dmt) - dm_task_destroy(dmt); + /*fix*/dm_task_destroy(dmt); return ret; } @@ -979,17 +993,18 @@ char *uu; char *uu_stack[64]; int uu_stack_idx; -//#if defined(__DragonFly__) -// uint32_t status; -//#endif +/*#if defined(__DragonFly__)*/ + uint32_t status; +/*#endif*/ int r, ret = 0; int j; off_t start, offset; char dev[PATH_MAX]; char map[PATH_MAX]; uint32_t cookie; - - dm_udev_set_sync_support(1); + static int force = 0; //new for FreeBSD + + /* dm_udev_set_sync_support(1); */ if ((params = alloc_safe_mem(512)) == NULL) { tc_log(1, "could not allocate safe parameters memory"); @@ -1010,7 +1025,8 @@ cipher_chain = cipher_chain->prev, j++) { cookie = 0; - + force = 1; //used in g_gate_destroy + /* aes-cbc-essiv:sha256 7997f8af... 0 /dev/ad0s0a 8 */ /* iv off---^ block off--^ */ snprintf(params, 512, "%s %s %"PRIu64 " %s %"PRIu64, @@ -1019,9 +1035,9 @@ #ifdef DEBUG printf("Params: %s\n", params); #endif - - if ((dmt = dm_task_create(DM_DEVICE_CREATE)) == NULL) { - tc_log(1, "dm_task_create failed\n"); + /* changed from, "if ((dmt = dm_task_create(DM_DEVICE_CREATE)) == NULL)" */ + if ((dmt = g_gatel_create()) == 1) { + tc_log(1, "g_gatel_create failed\n"); ret = -1; goto out; } @@ -1035,21 +1051,22 @@ else sprintf(map, "%s.%d", mapname, j); - if ((dm_task_set_name(dmt, map)) == 0) { - tc_log(1, "dm_task_set_name failed\n"); + /* changed from, "if ((dm_task_set_name(dmt, map)) == 0" */ + if (map == NULL) { + tc_log(1, "task_set_name failed\n"); ret = -1; goto out; } -//#if defined(__linux__) -// uuid_generate(info->uuid); -// if ((uu = malloc(1024)) == NULL) { -// tc_log(1, "uuid_unparse memory failed\n"); -// ret = -1; -// goto out; -// } -// uuid_unparse(info->uuid, uu); -//#elif defined(__DragonFly__) +/*#if defined(__linux__) + uuid_generate(info->uuid); + if ((uu = malloc(1024)) == NULL) { + tc_log(1, "uuid_unparse memory failed\n"); + ret = -1; + goto out; + } + uuid_unparse(info->uuid, uu); +#elif defined(__DragonFly__) uuid_create(&info->uuid, &status); if (status != uuid_s_ok) { tc_log(1, "uuid_create failed\n"); @@ -1063,9 +1080,9 @@ ret = -1; goto out; } -//#endif +#endif - if ((dm_task_set_uuid(dmt, uu)) == 0) { + if (( dm_task_set_uuid(dmt, uu)) == 0) { free(uu); tc_log(1, "dm_task_set_uuid failed\n"); ret = -1; @@ -1074,7 +1091,7 @@ free(uu); - if ((dm_task_add_target(dmt, start, info->size, "crypt", params)) == 0) { + if (( dm_task_add_target(dmt, start, info->size, "crypt", params)) == 0) { tc_log(1, "dm_task_add_target failed\n"); ret = -1; goto out; @@ -1101,6 +1118,7 @@ } dm_udev_wait(cookie); +*/ if ((r = asprintf(&uu_stack[uu_stack_idx++], "%s", map)) < 0) tc_log(1, "warning, asprintf failed. won't be able to " @@ -1111,8 +1129,8 @@ start = 0; sprintf(dev, "/dev/mapper/%s.%d", mapname, j); - dm_task_destroy(dmt); - dm_task_update_nodes(); + g_gate_destroy(dmt, force); /* was dm_task_destroy(dmt); */ + /*not needed in FreeBSD dm_task_update_nodes(); */ } out: @@ -1128,7 +1146,7 @@ uu_stack[j-1]); #endif if ((uu_stack[j-1] == NULL) || - ((r = dm_remove_device(uu_stack[--j])) != 0)) { + ((r = /*and here*/dm_remove_device(uu_stack[--j])) != 0)) { tc_log(1, "Tried to unroll dm changes, " "giving up.\n"); break; @@ -1154,7 +1172,7 @@ char map[PATH_MAX]; int i, error; - if ((error = dm_remove_device(mapname)) != 0) { + if ((error = /*and here*/dm_remove_device(mapname)) != 0) { tc_log(1, "Could not remove mapping %s\n", mapname); return error; } From owner-svn-soc-all@FreeBSD.ORG Tue Jul 3 22:45:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E14DB106566B for ; Tue, 3 Jul 2012 22:45:09 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 03 Jul 2012 22:45:09 +0000 Date: Tue, 03 Jul 2012 22:45:09 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120703224509.E14DB106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238936 - in soc2012/gmiller/locking-head: . tools/regression/lib/libthr tools/regression/lib/libthr/lockprof tools/regression/lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 22:45:12 -0000 Author: gmiller Date: Tue Jul 3 22:45:09 2012 New Revision: 238936 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238936 Log: r238827@FreeBSD-dev: root | 2012-07-03 05:12:44 -0500 Add the first round of lock profiling tests. Added: soc2012/gmiller/locking-head/tools/regression/lib/libthr/ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/Makefile soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.t soc2012/gmiller/locking-head/tools/regression/lib/libwitness/ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/witness.t Modified: soc2012/gmiller/locking-head/ (props changed) Added: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/Makefile Tue Jul 3 22:45:09 2012 (r238936) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +TESTS= lock-cycle +CFLAGS+= -DLOCK_PROFILING -g -Wall -Wextra -Werror -lthr_profile + +.PHONY: tests +tests: ${TESTS} + for p in ${TESTS}; do ${.OBJDIR}/$$p; done + +.PHONY: clean +clean: + -rm -f ${TESTS} + +lock-cycle: lock-cycle.c + ${CC} -o lock-cycle lock-cycle.c ${CFLAGS} \ No newline at end of file Added: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c Tue Jul 3 22:45:09 2012 (r238936) @@ -0,0 +1,138 @@ + +#include +#include +#include +#include +#include + +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +void +lock_cycle(void) +{ + int i; + + for (i = 0; i < 1000; i++) { + pthread_mutex_lock(&mutex); + + usleep(10); + + pthread_mutex_unlock(&mutex); + } +} + +void * +thread_func(void *v) +{ + v = v; + + lock_cycle(); + + return NULL; +} + +void +multi_cycle() +{ + pthread_t thread1; + pthread_t thread2; + + pthread_create(&thread1, NULL, thread_func, NULL); + pthread_create(&thread2, NULL, thread_func, NULL); + + lock_cycle(); + + pthread_join(thread1, NULL); + pthread_join(thread2, NULL); +} + +#define MAX_TESTS (100) + +int success_count = 0; +int fail_count = 0; +char result[MAX_TESTS]; + +void +check(char cond) +{ + result[success_count + fail_count] = cond; + + if (cond) { + success_count++; + } else { + fail_count++; + } +} + +void +show_test_results(void) +{ + int i; + + printf("1..%d\n", success_count + fail_count); + + for (i = 1; i <= success_count + fail_count; i++) { + if (result[i - 1]) { + printf("ok %d\n", i); + } else { + printf("not ok %d\n", i); + } + } +} + +void +check_stats_single(void) +{ + int record_count = 0; + struct pthread_statistics_np stats; + long tm; + + pthread_getstatistics_begin_np(&stats); + while (pthread_getstatistics_next_np(&stats)) { + record_count++; + } + pthread_getstatistics_end_np(&stats); + + check(record_count == 1); + + pthread_getstatistics_begin_np(&stats); + pthread_getstatistics_next_np(&stats); + pthread_getstatistics_end_np(&stats); + + check(strcmp(stats.file, "lock-cycle.c") == 0); + check(stats.line == 16); + + check(stats.wait_max.tv_sec == 0 && stats.wait_max.tv_nsec == 0); + + tm = stats.hold_max.tv_sec * 1000000L + stats.hold_max.tv_nsec / 1000; + check(tm >= 10); + + check(stats.contest_count == 0); + + check(stats.wait_time.tv_sec == 0 && stats.wait_time.tv_nsec == 0); + + tm = stats.hold_time.tv_sec * 1000000L + + stats.hold_time.tv_nsec / 1000; + check(tm >= 10000); + + check(stats.acq_count == 1000); +} + +void +check_stats_multi(void) +{ +} + +int +main(void) +{ + lock_cycle(); + check_stats_single(); + + multi_cycle(); + check_stats_multi(); + + show_test_results(); + + return 0; +} Added: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.t Tue Jul 3 22:45:09 2012 (r238936) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable Added: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/witness.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/witness.t Tue Jul 3 22:45:09 2012 (r238936) @@ -0,0 +1,5 @@ +#!/bin/sh +# $FreeBSD$ + +echo 1..1 +echo ok 1 From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 09:47:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D0EAE106566C for ; Wed, 4 Jul 2012 09:47:42 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 09:47:42 +0000 Date: Wed, 04 Jul 2012 09:47:42 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704094742.D0EAE106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238943 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 09:47:45 -0000 Author: oleksandr Date: Wed Jul 4 09:47:42 2012 New Revision: 238943 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238943 Log: fix style of return operator, add copyright, delete some unnecessary comments and funtion, add snprinf function, change vrele to udf_dispose_node in udf_release_system_nodes Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -521,7 +523,7 @@ *extres = ump->sparable_packet_size - lb_rel; return (0); case UDF_VTOP_TYPE_META : -printf("Metadata Partition Translated\n"); + /* printf("Metadata Partition Translated\n"); */ /* we have to look into the file's allocation descriptors */ /* use metadatafile allocation mutex */ @@ -668,7 +670,7 @@ ("Translate file extent " "failed: can't seek location\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); @@ -715,7 +717,7 @@ &t_ad, &transsec32, &translen); if (error) { UDF_UNLOCK_NODE(udf_node, 0); - return error; + return (error); } *lsector = transsec32; *maxblks = MIN(ext_remain, translen); @@ -724,12 +726,12 @@ DPRINTF(TRANSLATE, ("Translate file extend " "failed: bad flags %x\n", flags)); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -757,7 +759,7 @@ int slot, addr_type, icbflags; if (!udf_node) - return ENOENT; + return (ENOENT); KASSERT(num_lb > 0, "num_lb > 0"); @@ -779,7 +781,7 @@ if (addr_type == UDF_ICB_INTERN_ALLOC) { *map = UDF_TRANS_INTERN; UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } /* find first overlapping extent */ @@ -798,7 +800,7 @@ ("Translate file extent " "failed: can't seek location\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); @@ -833,7 +835,7 @@ ("Translate file extent " "failed: past eof\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); @@ -877,7 +879,7 @@ transsec = transsec32; if (error) { UDF_UNLOCK_NODE(udf_node, 0); - return error; + return (error); } while (overlap && num_lb && translen) { *map++ = transsec; @@ -890,7 +892,7 @@ ("Translate file extent " "failed: bad flags %x\n", flags)); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } } if (num_lb == 0) @@ -902,7 +904,7 @@ } UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } #if 0 @@ -968,7 +970,7 @@ free(blob, M_UDFTEMP); *lbnumres = lb_num; - return 0; + return (0); } @@ -1107,7 +1109,7 @@ } DPRINTF(RESERVE, ("\tfound %d sequential free bits in bitmap\n", seq_free)); - return seq_free; + return (seq_free); } /* --------------------------------------------------------------------- */ @@ -1210,7 +1212,7 @@ } mutex_exit(&ump->allocate_mutex); - return error; + return (error); } @@ -1390,7 +1392,7 @@ #endif mutex_exit(&ump->allocate_mutex); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -1589,14 +1591,14 @@ /* scale down if needed and bail out when out of space */ if (to_trunc >= meta_free_lbs) - return num_lb; + return (num_lb); /* check extent of bits marked free at the end of the map */ bitmap = &ump->metadata_unalloc_bits; to_trunc = udf_bitmap_check_trunc_free(bitmap, to_trunc); to_trunc = unit * (to_trunc / unit); /* round down again */ if (to_trunc == 0) - return num_lb; + return (num_lb); DPRINTF(RESERVE, ("\ttruncating %d lbs from the metadata bitmap\n", to_trunc)); @@ -1658,8 +1660,8 @@ mutex_enter(&ump->allocate_mutex); if (to_trunc > num_lb) - return 0; - return num_lb - to_trunc; + return (0); + return (num_lb - to_trunc); } @@ -1802,16 +1804,16 @@ /* defines same space */ if (a1_flags != a2_flags) - return 1; + return (1); if (a1_flags != UDF_EXT_FREE) { /* the same partition */ if (a1_part != a2_part) - return 1; + return (1); /* a2 is successor of a1 */ if (a1_lbnum * lb_size + a1_len != a2_lbnum * lb_size) - return 1; + return (1); } /* merge as most from a2 if possible */ @@ -1825,10 +1827,10 @@ a2->loc.lb_num = le32toh(a2_lbnum); if (a2_len > 0) - return 1; + return (1); /* there is space over to merge */ - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2247,7 +2249,7 @@ *l_ad_p = le32toh(l_ad); } - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2779,7 +2781,7 @@ KASSERT(new_inflen == orig_inflen + size_diff); KASSERT(new_lbrec == orig_lbrec); KASSERT(new_lbrec == 0); - return 0; + return (0); } DPRINTF(ALLOC, ("\tCONVERT from internal\n")); @@ -2948,7 +2950,7 @@ KASSERT(new_inflen == orig_inflen + size_diff); KASSERT(new_lbrec == orig_lbrec); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -3051,7 +3053,7 @@ KASSERT(new_lbrec == orig_lbrec); KASSERT(new_lbrec == 0); - return 0; + return (0); } /* setup node cleanup extents copy space */ @@ -3210,7 +3212,7 @@ KASSERT(new_inflen == 0); KASSERT(new_lbrec == 0); - return 0; + return (0); } printf("UDF_SHRINK_NODE: could convert to internal alloc!\n"); @@ -3290,6 +3292,6 @@ KASSERT(new_inflen == orig_inflen - size_diff); - return error; + return (error); } #endif Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c Wed Jul 4 09:47:42 2012 (r238943) @@ -44,20 +44,20 @@ if ((ch & 0xFFFFFF80) == 0) { if (*rrem < 1) - return 0; + return (0); n = 1; rp[0] = ch & 0x7F; } else if ((ch & 0xFFFFF800) == 0) { if (*rrem < 2) - return 0; + return (0); n = 2; rp[0] = 0xC0 | (ch >> 6); rp[1] = 0x80 | (0x3F & ch); } else if ((ch & 0xFFFF0000) == 0) { if (*rrem < 3) - return 0; + return (0); n = 3; rp[0] = 0xE0 | (ch >> 12); @@ -65,7 +65,7 @@ rp[2] = 0x80 | (0x3F & ch); } else if ((ch & 0xFFE00000) == 0) { if (*rrem < 4) - return 0; + return (0); n = 4; rp[0] = 0xF0 | (ch >> 18); @@ -74,12 +74,12 @@ rp[3] = 0x80 | (0x3F & ch); } else { /* do not convert points above 21 bits. */ - return 0; + return (0); } *rrem -= n; *result += n; - return n; + return (n); } static void Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c Wed Jul 4 09:47:42 2012 (r238943) @@ -53,7 +53,7 @@ while (n-- > 0) crc = crc_table[(crc>>8 ^ *s++) & 0xff] ^ (crc<<8); - return crc; + return (crc); } /* UNICODE Checksum */ @@ -69,7 +69,7 @@ crc = crc_table[(crc>>8 ^ (*s>>8)) & 0xff] ^ (crc<<8); crc = crc_table[(crc>>8 ^ (*s++ & 0xff)) & 0xff] ^ (crc<<8); } - return crc; + return (crc); } @@ -89,7 +89,7 @@ checksum += *data++; } - return checksum; + return (checksum); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2007, 2008 Reinoud Zandijk * All rights reserved. * @@ -282,13 +284,13 @@ if (addr_type == UDF_ICB_INTERN_ALLOC) { numb = min(length, file_size - fileblkoff); memcpy(blob, pos + fileblkoff, numb); - return error; + return (error); } while (length) { error = udf_bmap_translate(unode, fileblk, &lsect, &numlsect); if (error) - return error; + return (error); if (lsect == UDF_TRANS_ZERO) { numb = min(length, sector_size * numlsect - fileblkoff); @@ -297,14 +299,14 @@ blob += numb; fileblkoff = 0; } else if (lsect == UDF_TRANS_INTERN) { - return EDOOFUS; + return (EDOOFUS); } else { while (numlsect > 0) { if ((error = bread(devvp, lsect*blkinsect, sector_size, NOCRED, &bp)) != 0) { if (buf != NULL) brelse(bp); - return error; + return (error); } numb = min(length, sector_size - fileblkoff); @@ -344,7 +346,7 @@ &bp)) != 0) { if (buf != NULL) brelse(bp); - return error; + return (error); } bcopy(bp->b_data, blob, sector_size); @@ -440,7 +442,7 @@ /* return no error but with no dscrptr */ /* dispose first block */ free(dst, mtype); - return 0; + return (0); } } /* calculate descriptor size */ @@ -457,7 +459,7 @@ new_dst = realloc(dst, dscrlen, mtype, M_WAITOK); if (new_dst == NULL) { free(dst, mtype); - return ENOMEM; + return (ENOMEM); } dst = new_dst; @@ -475,7 +477,7 @@ } *dstp = dst; - return error; + return (error); } @@ -567,7 +569,7 @@ error = biowait(buf); putiobuf(buf); - return error; + return (error); } @@ -610,7 +612,7 @@ error = biowait(buf); putiobuf(buf); - return error; + return (error); } @@ -654,7 +656,7 @@ /* do the write and return no error */ udf_write_phys_buf(ump, what, buf); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -678,7 +680,7 @@ error = (strategy->create_logvol_dscr)(&args); *dscrptr = args.dscr; - return error; + return (error); } @@ -714,7 +716,7 @@ error = (strategy->read_logvol_dscr)(&args); *dscrptr = args.dscr; - return error; + return (error); } @@ -734,7 +736,7 @@ args.waitfor = waitfor; error = (strategy->write_logvol_dscr)(&args); - return error; + return (error); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -55,43 +57,8 @@ /* --------------------------------------------------------------------- */ -//#ifdef DEBUG #if 1 -#if 0 -static void -udf_dumpblob(boid *blob, uint32_t dlen) -{ - int i, j; - - printf("blob = %p\n", blob); - printf("dump of %d bytes\n", dlen); - - for (i = 0; i < dlen; i+ = 16) { - printf("%04x ", i); - for (j = 0; j < 16; j++) { - if (i+j < dlen) { - printf("%02x ", blob[i+j]); - } else { - printf(" "); - } - } - for (j = 0; j < 16; j++) { - if (i+j < dlen) { - if (blob[i+j]>32 && blob[i+j]! = 127) { - printf("%c", blob[i+j]); - } else { - printf("."); - } - } - } - printf("\n"); - } - printf("\n"); - Debugger(); -} -#endif - static void udf_dump_discinfo(struct udf_mount *ump) { @@ -112,8 +79,7 @@ printf("\tfst on last ses %d\n", di->first_track_last_session); printf("\tlst on last ses %d\n", di->last_track_last_session); printf("\tlink block penalty %d\n", di->link_block_penalty); -/* TODO: find analog function in Freebsd */ -// snprintb(bits, sizeof(bits), MMC_DFLAGS_FLAGBITS, di->disc_flags); + snprintf(bits, sizeof(bits), "%b\n", di->disc_flags, MMC_DFLAGS_FLAGBITS); printf("\tdisc flags %s\n", bits); printf("\tdisc id %x\n", di->disc_id); printf("\tdisc barcode %"PRIx64"\n", di->disc_barcode); @@ -121,11 +87,12 @@ printf("\tnum sessions %d\n", di->num_sessions); printf("\tnum tracks %d\n", di->num_tracks); -// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cur); + snprintf(bits, sizeof(bits), "%b\n", (int) di->mmc_cur, MMC_CAP_FLAGBITS); printf("\tcapabilities cur %s\n", bits); -// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cap); + snprintf(bits, sizeof(bits), "%b\n", (int) di->mmc_cap, MMC_CAP_FLAGBITS); printf("\tcapabilities cap %s\n", bits); } + #if 0 static void udf_dump_trackinfo(struct mmc_trackinfo *trackinfo) @@ -135,11 +102,11 @@ if ((udf_verbose & UDF_DEBUG_VOLUMES) == 0) return; - printf("Trackinfo for track %d:\n", trackinfo->tracknr); + printf("Trackinfo for track %d:\n", trackinfo->tracknr); printf("\tsessionnr %d\n", trackinfo->sessionnr); printf("\ttrack mode %d\n", trackinfo->track_mode); printf("\tdata mode %d\n", trackinfo->data_mode); -// snprintb(bits, sizeof(bits), MMC_TRACKINFO_FLAGBITS, trackinfo->flags); + snprintf(bits, sizeof(bits), "%b\n", trackinfo->flags, MMC_TRACKINFO_FLAGBITS); printf("\tflags %s\n", bits); printf("\ttrack start %d\n", trackinfo->track_start); @@ -149,6 +116,7 @@ printf("\ttrack size %d\n", trackinfo->track_size); printf("\tlast recorded block %d\n", trackinfo->last_recorded); } + #endif #else #define udf_dump_discinfo(a); @@ -178,12 +146,7 @@ udf_dump_discinfo(ump); return (0); } -#if 0 - /* disc partition support */ - error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, td); - if (error) - return (ENODEV); -#endif + /* set up a disc info profile for partitions */ di->mmc_profile = 0x01; /* disc type */ di->mmc_class = MMC_CLASS_DISC; @@ -2061,7 +2024,7 @@ } check_name = "*UDF Metadata Partition"; if (strncmp(map_name, check_name, len) == 0) { - printf("*UDF Metadata Partition\n"); + /* printf("*UDF Metadata Partition\n"); */ pmap_type = UDF_VTOP_TYPE_META; n_meta++; ump->node_part = log_part; @@ -3374,7 +3337,6 @@ udf_read_rootdirs(struct udf_mount *ump) { union dscrptr *dscr; - /* struct udf_args *args = &ump->mount_args; */ struct mount *mp; struct vnode *rootdir_node, *streamdir_node; struct long_ad fsd_loc, *dir_loc; @@ -3463,7 +3425,7 @@ if (error) return (ENOENT); - /* aparently it read in fine */ + /* apparently it read in fine */ /* * Try the system stream directory; not very likely in the ones we @@ -3471,14 +3433,13 @@ */ dir_loc = &ump->fileset_desc->streamdir_icb; if (le32toh(dir_loc->len)) { - printf("udf_read_rootdirs: streamdir defined "); ino = udf_get_node_id(dir_loc); error = udf_vget(mp, ino, LK_EXCLUSIVE, &streamdir_node); if (error) { - printf("but error in streamdir reading\n"); + printf("udf_read_rootdirs: streamdir defined: but error in streamdir reading\n"); } else { - printf("but ignored\n"); /* + * printf("udf_read_rootdirs: streamdir defined: but ignored"); * TODO process streamdir `baddies' i.e. files we dont * want if R/W */ @@ -3519,8 +3480,6 @@ } ino = (blkn + 1) | (part << 29); - //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); - //printf("udf_get_node_id -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino); return (ino); } @@ -3538,8 +3497,6 @@ icbptr->loc.lb_num = htole32(blkn); icbptr->loc.part_num = htole16(part); - //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); - //printf("udf_get_node_longad -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino2); return (0); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -27,16 +29,16 @@ #include #include #include -#include /* needed by malloc.h */ +#include #include -#include /* printf */ -#include /* needed by namei.h */ +#include +#include #include -#include /* thread */ +#include #include #include -#include /* dev_ref */ -#include /* MODULE_VERSION */ +#include +#include #include #include #include @@ -129,15 +131,15 @@ /* VAT partition support */ if (ump->vat_node) - vrele(ump->vat_node->vnode); + udf_dispose_node(ump->vat_node); /* Metadata partition support */ if (ump->metadata_node) - vrele(ump->metadata_node->vnode); + udf_dispose_node(ump->metadata_node); if (ump->metadatamirror_node) - vrele(ump->metadatamirror_node->vnode); + udf_dispose_node(ump->metadatamirror_node); if (ump->metadatabitmap_node) - vrele(ump->metadatabitmap_node->vnode); + udf_dispose_node(ump->metadatabitmap_node); /* This flush should NOT write anything nor allow any node to remain */ if ((error = vflush(ump->vfs_mountp, 0, 0, curthread))) Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -31,14 +33,14 @@ #include #include #include -#include /* printf, bzero, etc */ -#include /* componentname */ -#include /* buf */ +#include +#include +#include #include #include #include #include -#include /* udf_pathconf */ +#include #include #include "ecma167-udf.h" @@ -888,7 +890,7 @@ } /* --------------------------------------------------------------------- */ -/* This is finished */ + static int udf_getattr(struct vop_getattr_args *ap) { From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 12:10:28 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 69274106566B for ; Wed, 4 Jul 2012 12:10:26 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 12:10:26 +0000 Date: Wed, 04 Jul 2012 12:10:26 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704121026.69274106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238946 - in soc2012/aleek/beaglexm-armv6/sys/arm/ti: . am37x X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 12:10:28 -0000 Author: aleek Date: Wed Jul 4 12:10:20 2012 New Revision: 238946 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238946 Log: fixed bug in gptimer driver. mmc is dectected Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Wed Jul 4 10:17:02 2012 (r238945) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Wed Jul 4 12:10:20 2012 (r238946) @@ -119,7 +119,10 @@ void (*callback)(void *data), void *data); int -omap3_gptimer_start(struct eventtimer *et, struct bintime *first, struct bintime *period); +omap3_gptimer_start_et(struct eventtimer *et, struct bintime *first, struct bintime *period); + +int +omap3_gptimer_start(struct omap3_gptimer_softc *sc); int omap3_gptimer_stop(struct eventtimer *et); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Wed Jul 4 10:17:02 2012 (r238945) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Wed Jul 4 12:10:20 2012 (r238946) @@ -79,7 +79,7 @@ */ static struct timecounter omap3_gptimer_tc = { /* Name of the timecounter. */ - .tc_name = "OMAP3 Timecouter", + .tc_name = "OMAP3 Timecounter", /* * This function reads the counter. It is not required to * mask any unimplemented bits out, as long as they are @@ -464,7 +464,7 @@ * Returns 0 on success, otherwise an error code */ int -omap3_gptimer_start(struct eventtimer *et, struct bintime *first, struct bintime *period) +omap3_gptimer_start_et(struct eventtimer *et, struct bintime *first, struct bintime *period) { struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)et->et_priv; uint32_t val; @@ -486,6 +486,27 @@ return 0; } +int +omap3_gptimer_start(struct omap3_gptimer_softc *sc) +{ + uint32_t val; + + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) + return (EINVAL); + + //OMAP3_GPTIMER_LOCK(sc); + + val = gptimer_read_4(OMAP3_GPT_TCLR); + val |= TCLR_ST; + gptimer_write_4(OMAP3_GPT_TCLR, val); + + //OMAP3_GPTIMER_UNLOCK(sc); + + return 0; +} /** * omap3_gptimer_stop - stops a one-shot or periodic timer * @n: the number of the timer (first timer is number 1) @@ -772,12 +793,14 @@ /* setup GPTIMER10 for system ticks, and GPTIMER11 for general purpose counter */ oldirqstate = disable_interrupts(I32_bit); - /* Setup another timer to be the timecounter */ + /* Setup timer to be the timecounter */ if (omap3_gptimer_activate(sc, OMAP3_GPTIMER_PERIODIC_FLAG, 0, NULL, NULL)) { device_printf(dev, "Error: failed to activate system tick timer\n"); - }/* else if (omap3_gptimer_start(sc)) { + } + else if (omap3_gptimer_start(sc)) + { device_printf(dev, "Error: failed to start system tick timer\n"); - }*/ + } /* Save the system clock speed */ omap3_gptimer_get_freq(sc, &timer_freq); @@ -859,8 +882,8 @@ panic("Error: failed to start system tick timer\n"); /* Lastly start the tick timer */ - /*if (omap3_gptimer_start(sc)) - panic("Error: failed to start system tick timer\n");*/ + if (omap3_gptimer_start(sc)) + panic("Error: failed to start system tick timer\n"); omap3_gptimer_get_freq(sc, &timer_freq); device_printf(dev, "tick: timer_freq = %u\n", timer_freq); @@ -875,7 +898,7 @@ omap3_gptimer_et.et_min_period.frac = ((0x00000002LLU << 32) / omap3_gptimer_et.et_frequency) << 32; omap3_gptimer_et.et_max_period.sec = 0xfffffff0U / omap3_gptimer_et.et_frequency; omap3_gptimer_et.et_max_period.frac = ((0xfffffffeLLU << 32) / omap3_gptimer_et.et_frequency) << 32; - omap3_gptimer_et.et_start = omap3_gptimer_start; + omap3_gptimer_et.et_start = omap3_gptimer_start_et; omap3_gptimer_et.et_stop = omap3_gptimer_stop; omap3_gptimer_et.et_priv = &omap3_gptimer_et; et_register( &omap3_gptimer_et ); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Wed Jul 4 10:17:02 2012 (r238945) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_mmchs.c Wed Jul 4 12:10:20 2012 (r238946) @@ -908,7 +908,7 @@ /* Loop waiting for the command to finish */ timeout = hz; do { - pause("MMCINIT", 1); + pause("MMCINIT1", 1); if (timeout-- == 0) { device_printf(sc->sc_dev, "Error: first stream init timed out\n"); break; @@ -924,7 +924,7 @@ /* Loop waiting for the second command to finish */ timeout = hz; do { - pause("MMCINIT", 1); + pause("MMCINIT2", 1); if (timeout-- == 0) { device_printf(sc->sc_dev, "Error: second stream init timed out\n"); break; @@ -1431,7 +1431,6 @@ static int ti_mmchs_init_dma_channels(struct ti_mmchs_softc *sc) { - printf( "%s:%d\n", __FILE__, __LINE__ ); #ifdef SOC_TI_AM335X switch (sc->device_id) { case 0: @@ -1455,13 +1454,11 @@ int err; uint32_t rev; - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the current chip revision */ rev = ti_revision(); if ((OMAP_REV_DEVICE(rev) != OMAP4430_DEV) && (sc->device_id > 3)) return(EINVAL); - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Get the DMA MMC triggers */ switch (sc->device_id) { case 0: @@ -1490,13 +1487,11 @@ return(EINVAL); } - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate a RX channel from the OMAP DMA driver */ err = ti_sdma_activate_channel(&sc->sc_dmach_rd, ti_mmchs_dma_intr, sc); if (err != 0) return(err); - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the RX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_rd, TI_SDMA_BURST_NONE, TI_SDMA_BURST_64); @@ -1506,13 +1501,11 @@ ti_sdma_set_addr_mode(sc->sc_dmach_rd, TI_SDMA_ADDR_CONSTANT, TI_SDMA_ADDR_POST_INCREMENT); - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Activate and configure the TX DMA channel */ err = ti_sdma_activate_channel(&sc->sc_dmach_wr, ti_mmchs_dma_intr, sc); if (err != 0) return(err); - printf( "%s:%d\n", __FILE__, __LINE__ ); /* Setup the TX channel for MMC data transfers */ ti_sdma_set_xfer_burst(sc->sc_dmach_wr, TI_SDMA_BURST_64, TI_SDMA_BURST_NONE); From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 12:41:59 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 52428106566B for ; Wed, 4 Jul 2012 12:41:57 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 12:41:57 +0000 Date: Wed, 04 Jul 2012 12:41:57 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704124157.52428106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238947 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 12:41:59 -0000 Author: gpf Date: Wed Jul 4 12:41:56 2012 New Revision: 238947 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238947 Log: - comments! Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jul 4 12:10:20 2012 (r238946) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jul 4 12:41:56 2012 (r238947) @@ -79,18 +79,21 @@ RB_HEAD(hardlink_head, hardlink_counter); RB_PROTOTYPE(hardlink_head, hardlink_counter, hardlink_entries, pefs_rb_cmp); -#define PEFS_CFH_SIZE 16 -#define PEFS_FH_SIZE 16 +#define PEFS_CFH_SIZE 16 /* on disk size of .pefs.checksum's unique file header */ +#define PEFS_FH_SIZE 16 /* on disk size of a single file header (also a bucket in cuckoo hashing) */ +/* this struct is used to check if all hardlinks for a given inode are supplied by the user */ struct hardlink_counter { - ino_t inode; - uint32_t total_links; - uint32_t links_found; - struct hardlink_fh_head file_headers; - RB_ENTRY(hardlink_counter) hardlink_entries; + ino_t inode; /* inode number for the file in question */ + uint32_t total_links; /* total hardlinks of the file */ + uint32_t links_found; /* how many links are found in user supplied list */ + struct hardlink_fh_head file_headers; /* file headers of the links we have found */ + RB_ENTRY(hardlink_counter) hardlink_entries; /* entry in hardlink RB tree */ }; /* XXXgpf: unions for on disk structs and move to a different header? */ + +/* this is the unique file header of the .pefs.checksum file, found in the beginning of the file */ struct checksum_file_header { uint8_t version; uint8_t reserved; @@ -109,8 +112,8 @@ struct file_header { /* on disk information */ uint32_t nhashes; /* the number of hashes for the file */ - uint64_t file_id; /* id is MAC tweak from filename (first 64 bits) */ uint32_t offset_to_checksums; /* in file offset to start of checksums */ + uint64_t file_id; /* id is MAC tweak from filename (first 64 bits) */ /* in memory information */ char path[MAXPATHLEN + 1]; /* fullpath for this file */ @@ -120,8 +123,8 @@ int fd, pfd; /* file descriptors for the file and its parent dir */ int found; /* mark that this entry was found during "verify" action */ struct checksum_head checksums; /* this file's checksums */ - TAILQ_ENTRY(file_header) file_header_entries; - TAILQ_ENTRY(file_header) fh_hardlink_entries; + TAILQ_ENTRY(file_header) file_header_entries; /* entry in global file header tail */ + TAILQ_ENTRY(file_header) fh_hardlink_entries; /* entry in hardlink counter */ }; struct bucket { @@ -133,10 +136,10 @@ * with his own hash function: pefs_hash1() & pefs_hash2() */ struct cuckoo_hash_table { - struct bucket *buckets1; - struct bucket *buckets2; + struct bucket *buckets1; /* table1 */ + struct bucket *buckets2; /* table2 */ uint32_t size; /* how many buckets in each table */ - uint32_t nelements; + uint32_t nelements; /* total number of elements <= size */ }; static int @@ -637,6 +640,7 @@ size_t buf_len, enc_len; if ((flags & PEFS_NOKEY) != 0 || (flags & PEFS_UNMOUNTED) != 0) { + /* in this case, we already have the encrypted filename */ enc = fhp->filename; enc_len = strnlen(fhp->filename, sizeof(fhp->filename)); enc++; @@ -826,6 +830,7 @@ return 0; } +/* open a file and perform various semantic checks on it */ static int pefs_open_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp, int flags) { @@ -1644,12 +1649,12 @@ uint32_t i; int error, cmp; - dprintf(("comparing hashes for file with fid: %llu\t%llu\n", fhp->file_id, indexfhp->file_id)); + dprintf(("comparing hashes for file with fid: %llu\n", fhp->file_id)); error = 0; if (fhp->nhashes != indexfhp->nhashes) { - pefs_warn("number of hashes differ between on disk file and stored values for file %s: %u vs %u", - fhp->path, fhp->nhashes, indexfhp->nhashes); + pefs_warn("number of hashes differ between on disk file and %s values for file %s: %u vs %u", + PEFS_FILE_CHECKSUM, fhp->path, fhp->nhashes, indexfhp->nhashes); error = PEFS_ERR_CHECKSUM; } @@ -1659,8 +1664,8 @@ while (csp1 != NULL && csp2 != NULL) { cmp = memcmp(csp1->hash, csp2->hash, hash_len); if (cmp != 0) { - pefs_warn("checksum no: %u differs between on disk file and stored values for file %s", - i, fhp->path); + pefs_warn("checksum no: %u differs between on disk file and %s values for file %s", + i, PEFS_FILE_CHECKSUM, fhp->path); error = PEFS_ERR_CHECKSUM; } csp1 = TAILQ_NEXT(csp1, checksum_entries); @@ -1672,7 +1677,8 @@ } /* - * XXXgpf: [TODO] comments + * Traverse the entire filesystem and for every regular file or symbolic link, look it up in + * .pefs.checksum index and verify its checksums. */ static int pefs_traverse_fs(struct cuckoo_hash_table *chtp, const EVP_MD *md, uint8_t hash_len, DIR *dirp, @@ -1689,7 +1695,7 @@ while (dirp) { sdp = readdir(dirp); if (sdp != NULL) { - /* XXXgpf: Need to pay special attention to these files */ + /* XXXgpf: [TODO] Need to pay special attention to these files */ if (strcmp(sdp->d_name, "..") == 0 || strcmp(sdp->d_name, ".") == 0 || strcmp(sdp->d_name, ".pefs.db") == 0 || strcmp(sdp->d_name, ".pefs.conf") == 0 || strcmp(sdp->d_name, ".pefs.checksum") == 0) @@ -1817,8 +1823,8 @@ fhp = chtp->buckets1[i].fhp; if (fhp != NULL) if (fhp->found != 1) { - pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", - fhp->file_id); + pefs_warn("file with file id %llu was not found in filesystem but exists in %s", + fhp->file_id, PEFS_FILE_CHECKSUM); error = PEFS_ERR_NOENT; } } @@ -1827,8 +1833,8 @@ fhp = chtp->buckets2[i].fhp; if (fhp != NULL) if (fhp->found != 1) { - pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", - fhp->file_id); + pefs_warn("file with file id %llu was not found in filesystem but exists in %s", + fhp->file_id, PEFS_FILE_CHECKSUM); error = PEFS_ERR_NOENT; } } @@ -1837,7 +1843,11 @@ } /* - * XXXgpf: [TODO] comments + * Verify the contents of a .pefs.checksum file. + * A) .pefs.checksum is read into memory. + * B) The entire filesystem is traversed in order to check each and every file. + * C) warning messages are produces for hardlinks and symbolic links. + * D) check that every file in .pefs.checksum was actually found in filesystem. */ int pefs_verify_checksum(int fdin, char *fsroot, int flags) Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jul 4 12:10:20 2012 (r238946) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jul 4 12:41:56 2012 (r238947) @@ -1020,9 +1020,8 @@ * .pefs.checksum is created under $PWD. path should be a directory, * outside of target pefs filesystem. * - * When $command is run, filesystem should be already mounted with - * pefs. - * + * When $command is run, filesystem must be mounted with pefs, and + * user must have supplied the key. */ static int pefs_addchecksum(int argc, char *argv[]) @@ -1104,10 +1103,25 @@ * * pefs verify [-u/-n] checksumpath filesystem * - * $command ... + * $command verifies the contents of a .pefs.checksum file. It scans the + * entire filesystem and checks that every entry in .pefs.checksum is + * found in the filesystem with the same checksums. + * + * $command will try to produce the same warning messages as addchecksum + * concerning hardlinks and symbolic links. + * + * -n flag should be used if filesystem is mounted but key has not + * been provided yet. + * + * -u flag should be used if filesystem is unmounted. + * + * flags -u and -n are mutually exclusive. * - * XXX [TODO] comments + * By default, pefs will assume that filesystem is mounted and user + * has provided key. * + * Verifying the integrity of the checksum file itself via a signature + * remains a major TODO. */ static int pefs_verify(int argc, char *argv[]) Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Wed Jul 4 12:10:20 2012 (r238946) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Wed Jul 4 12:41:56 2012 (r238947) @@ -196,6 +196,7 @@ } } +/* XXXgpf: [TODO] move this to pefs_checksum.c */ static int pefs_checksum_load(struct mount *mp) { From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 14:04:47 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D24E4106564A for ; Wed, 4 Jul 2012 14:04:45 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 14:04:45 +0000 Date: Wed, 04 Jul 2012 14:04:45 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704140445.D24E4106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238955 - soc2012/oleksandr/udf-head/sys/modules X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 14:04:48 -0000 Author: oleksandr Date: Wed Jul 4 14:04:45 2012 New Revision: 238955 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238955 Log: Add modules udf2 and udf2_iconv to Makefile Modified: soc2012/oleksandr/udf-head/sys/modules/Makefile Modified: soc2012/oleksandr/udf-head/sys/modules/Makefile ============================================================================== --- soc2012/oleksandr/udf-head/sys/modules/Makefile Wed Jul 4 13:37:44 2012 (r238954) +++ soc2012/oleksandr/udf-head/sys/modules/Makefile Wed Jul 4 14:04:45 2012 (r238955) @@ -322,6 +322,8 @@ ubsec \ udf \ udf_iconv \ + udf2 \ + udf2_iconv \ ufs \ unionfs \ usb \ From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 15:21:19 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 772A7106566C for ; Wed, 4 Jul 2012 15:21:16 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 15:21:16 +0000 Date: Wed, 04 Jul 2012 15:21:16 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704152116.772A7106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238961 - soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 15:21:19 -0000 Author: tzabal Date: Wed Jul 4 15:21:15 2012 New Revision: 238961 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238961 Log: Updated version of crashreportd. Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Wed Jul 4 14:25:14 2012 (r238960) +++ soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Wed Jul 4 15:21:15 2012 (r238961) @@ -1,47 +1,142 @@ -#!/usr/bin/python +#!/usr/local/bin/python import os +import re import time import tarfile -# Check if the given filename matches the pattern of a valid crash report -# Return 1 in failure and 0 in success -def check_filename(filename): - matchObj = re.match('^crashreport\.[A-Za-z0-9]{6}\.tar\.gz$', filename) + +# Check if the filename matches the pattern of a valid crash report name +# Return False in failure and True in success +def check_report_name(filename): + match_obj = re.match('^crashreport\.[A-Za-z0-9]{6}\.tar\.gz$', filename) + + if not match_obj: + print "debug1" + return False - if not matchObj: - return 1 + return True + + +# Check if the filename matches the pattern of a valid crash data name +# Return False in failure and True in success +def check_data_name(filename): + match_obj = re.match('^crashreport\.[A-Za-z0-9]{6}\.xml$', filename) + + if not match_obj: + print "debug2" + return False - return 0 + return True -def extract_file(filename): +# Check if the report is a tar.gz file and if it has only one file inside +# with a valid name. +# Return False in failure and True in success +def check_report_contents(filename): + report = crashreports_dir + "/" + filename + + if not tarfile.is_tarfile(report): + print "debug3" + return False + + try: + tarfile_obj = tarfile.open(report, 'r:gz') + contents_list = tarfile_obj.getnames() + except ReadError: + print "debug4" + return False + except CompressionError: + print "debug5" + return False + + if not len(contents_list) == 1: + print "debug6" + return False + + if not check_data_name(contents_list[0]): + print "debug7" + return False + + return True + + +def extract_report(filename): + if not os.path.isdir(extraction_dir): + print "debug11" + return False + try: report = crashreports_dir + "/" + filename - tarfileObj = tarfile.open(report) + tarfile_obj = tarfile.open(report, 'r:gz') + tarfile_obj.extractall(extraction_dir); except ReadError: - return 1 - - return 0 + print "debug12" + return False + except CompressionError: + print "debug13" + return False + + dirlist = os.listdir(extraction_dir) + if not len(dirlist) == 1: + print "debug14" + return False + + data_name = dirlist[0] + #print "data_name: ", data_name + + return True +# Container function that call all the check related functions +# Return False in failure and True in success def check_report(filename): - check_filename(filename) + if not check_report_name(filename): + print "debug8" + return False + + if not check_report_contents(filename): + print "debug9" + return False - return 0; + if not extract_report(filename): + print "debug10" + return False + + return True + + +# Create the Process ID file that contains the PID of crashreportd. +# It used from the rc.d script to stop the program normally. +def create_pid_file(): + pid = os.getpid() -# Obtain the Process ID -pid = os.getpid() + pid_file = '/home/tzabal/Desktop/crashreportd.pid' + #pid_file = '/var/run/crashreportd.pid' + try: + file_obj = open(pid_file, 'w') + file_obj.write(str(pid)) + file_obj.close() + except IOError: + return False + finally: + file_obj.close() + + return True -# Create the pid file and write the Process ID inside -#pid_file = '/var/run/crashreportd.pid' -pid_file = '/home/tzabal/crashreportd.pid' -f = open(pid_file, 'w') -f.write(str(pid)) -f.close() # The infinite loop of the daemon -crashreports_dir = '/home/tzabal/crashreports' -dirlist = os.listdir(crashreports_dir) -for filename in dirlist: - check_report(filename) +interval = 10 +crashreports_dir = '/home/tzabal/Desktop/crashreports' +#crashreports_dir = '/var/spool/crashreports' +extraction_dir = '/tmp/crashreports' +counter = 1 +create_pid_file() +while True: + print "== Pass:", counter, "==" + dirlist = os.listdir(crashreports_dir) + for filename in dirlist: + print "Report:", filename + check_report(filename) + counter += 1 + time.sleep(interval) \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 20:10:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 17C961065670 for ; Wed, 4 Jul 2012 20:10:37 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 20:10:37 +0000 Date: Wed, 04 Jul 2012 20:10:37 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704201037.17C961065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238973 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 20:10:39 -0000 Author: syuu Date: Wed Jul 4 20:10:36 2012 New Revision: 238973 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238973 Log: export console functions to bios_int10.c, add bios_int13.c Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.h Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/pci_virtio_block.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c Wed Jul 4 19:51:25 2012 (r238972) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c Wed Jul 4 20:10:36 2012 (r238973) @@ -40,46 +40,19 @@ #include #include +#include "consport.h" #include "bios_call.h" -#define BVM_CONS_SIG ('b' << 8 | 'v') - -static struct termios tio_orig, tio_new; - -static void -ttyclose(void) -{ - tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig); -} - -static void -ttyopen(void) -{ - tcgetattr(STDIN_FILENO, &tio_orig); - - cfmakeraw(&tio_new); - tcsetattr(STDIN_FILENO, TCSANOW, &tio_new); - - atexit(ttyclose); -} - -static void -ttywrite(unsigned char wb) -{ - (void) write(STDOUT_FILENO, &wb, 1); -} - static int int10_handler(struct vmctx *ctx, int vcpu, int intno) { - static int opened; uint64_t rax, rbx; uint8_t al, ah, bl, bh; int error; - if (!opened) { + if (!console_opened) { ttyopen(); - opened = 1; + console_opened = 1; } if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, &rax)) != 0) Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c Wed Jul 4 20:10:36 2012 (r238973) @@ -0,0 +1,102 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "bios_call.h" + +#define MAKEPTR(s, o) (((s) << 4) + (o)) + +extern int block_drive_c_fd; + +static int +int13_handler(struct vmctx *ctx, int vcpu, int intno) +{ + uint64_t rax, rbx, rcx, rdx, es_base, rflags; + uint32_t es_limit, es_access; + uint16_t bx; + uint8_t al, ah, cl, ch, dl, dh; + int error; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, &rax)) != 0) + goto done; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBX, &rbx)) != 0) + goto done; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RCX, &rcx)) != 0) + goto done; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RDX, &rdx)) != 0) + goto done; + + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, &rflags)) != 0) + goto done; + + if ((error = vm_get_desc(ctx, vcpu, VM_REG_GUEST_ES, &es_base, + &es_limit, &es_access)) != 0) + goto done; + + al = (uint8_t)rax; + ah = (uint8_t)(rax >> 8); + bx = (uint16_t)rbx; + cl = (uint8_t)rcx; + ch = (uint8_t)(rcx >> 8); + + printf("%s ah=%x al=%x ch=%x cl=%x dh=%x dl=%x bx=%x es=%llx:%x:%x\n", + __func__, ah, al, ch, cl, dh, dl, bx, es_base, es_limit, es_access); + + switch (ah) { + case 0x02: + break; + case 0x41: + rflags |= 0x1; + error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RFLAGS, rflags); + break; + default: + fprintf(stderr, "Not implemented BIOS call int=%x ah=%x\n", + intno, ah); + } + +done: + return (error); + +} +BIOS_CALL(int13, 0x13, int13_handler); Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.c Wed Jul 4 19:51:25 2012 (r238972) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.c Wed Jul 4 20:10:36 2012 (r238973) @@ -44,6 +44,7 @@ #define BVM_CONS_SIG ('b' << 8 | 'v') static struct termios tio_orig, tio_new; +int console_opened = 0; static void ttyclose(void) @@ -51,7 +52,7 @@ tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig); } -static void +void ttyopen(void) { tcgetattr(STDIN_FILENO, &tio_orig); @@ -79,7 +80,7 @@ } } -static int +int ttyread(void) { char rb; @@ -92,7 +93,7 @@ } } -static void +void ttywrite(unsigned char wb) { (void) write(STDOUT_FILENO, &wb, 1); @@ -102,8 +103,6 @@ console_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - static int opened; - if (bytes == 2 && in) { *eax = BVM_CONS_SIG; return (0); @@ -112,9 +111,9 @@ if (bytes != 4) return (-1); - if (!opened) { + if (!console_opened) { ttyopen(); - opened = 1; + console_opened = 1; } if (in) Added: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/consport.h Wed Jul 4 20:10:36 2012 (r238973) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2012 Takuya ASADA + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#ifndef _CONSPORT_H_ +#define _CONSPORT_H_ + +extern int console_opened; +void ttyopen(void); +int ttyread(void); +void ttywrite(unsigned char wb); + + +#endif /* _CONSPORT_H_ */ + Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/pci_virtio_block.c Wed Jul 4 19:51:25 2012 (r238972) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/pci_virtio_block.c Wed Jul 4 20:10:36 2012 (r238973) @@ -136,6 +136,8 @@ struct vtblk_config vbsc_cfg; }; +int block_drive_c_fd = -1; + /* * Return the number of available descriptors in the vring taking care * of the 16-bit index wraparound. @@ -359,6 +361,10 @@ close(fd); return (1); } + + if (block_drive_c_fd == -1) { + block_drive_c_fd = fd; + } sc = malloc(sizeof(struct pci_vtblk_softc)); memset(sc, 0, sizeof(struct pci_vtblk_softc)); From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 20:29:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 531AA106566B for ; Wed, 4 Jul 2012 20:29:08 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 20:29:08 +0000 Date: Wed, 04 Jul 2012 20:29:08 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704202908.531AA106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238974 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 20:29:10 -0000 Author: syuu Date: Wed Jul 4 20:29:07 2012 New Revision: 238974 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238974 Log: add bios_int13.c to Makefile Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Wed Jul 4 20:10:36 2012 (r238973) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile Wed Jul 4 20:29:07 2012 (r238974) @@ -8,7 +8,7 @@ SRCS+= instruction_emul.c mevent.c SRCS+= pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c post.c rtc.c uart.c xmsr.c -SRCS+= bios_call.c bios_int10.c bios_int18.c +SRCS+= bios_call.c bios_int10.c bios_int13.c bios_int18.c NO_MAN= Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c Wed Jul 4 20:10:36 2012 (r238973) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c Wed Jul 4 20:29:07 2012 (r238974) @@ -80,15 +80,15 @@ cl = (uint8_t)rcx; ch = (uint8_t)(rcx >> 8); - printf("%s ah=%x al=%x ch=%x cl=%x dh=%x dl=%x bx=%x es=%llx:%x:%x\n", - __func__, ah, al, ch, cl, dh, dl, bx, es_base, es_limit, es_access); + printf("%s rax=%lx ah=%x al=%x rbx=%lx bx=%x rcx=%lx ch=%x cl=%x rdx=%lx dh=%x dl=%x es_base=%lx es_limit=%x es_access=%x\n", + __func__, rax, ah, al, rbx, bx, rcx, ch, cl, rdx, dh, dl, es_base, es_limit, es_access); switch (ah) { case 0x02: break; case 0x41: rflags |= 0x1; - error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RFLAGS, rflags); + error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, rflags); break; default: fprintf(stderr, "Not implemented BIOS call int=%x ah=%x\n", From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 22:47:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EE3751065672 for ; Wed, 4 Jul 2012 22:47:15 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 22:47:15 +0000 Date: Wed, 04 Jul 2012 22:47:15 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704224715.EE3751065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238979 - soc2012/oleksandr/udf-head/sbin/mount_udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 22:47:18 -0000 Author: oleksandr Date: Wed Jul 4 22:47:14 2012 New Revision: 238979 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238979 Log: remove unused function, add new option to mount_udf2 -g,u,c, correct Makefile and add man page for mount_udf2 Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile ============================================================================== --- soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile Wed Jul 4 20:59:30 2012 (r238978) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile Wed Jul 4 22:47:14 2012 (r238979) @@ -2,13 +2,13 @@ PROG= mount_udf2 SRCS= mount_udf.c getmntopts.c -MAN= mount_udf.8 +MAN= mount_udf2.8 DPADD= ${LIBKICONV} LDADD= -lkiconv -#MOUNT= ${.CURDIR}/../mount -#CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys -#.PATH: ${MOUNT} +MOUNT= ${.CURDIR}/../mount +CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys +.PATH: ${MOUNT} WARNS?= 1 # Needs to be dynamically linked for optional dlopen() access to Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c ============================================================================== --- soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Wed Jul 4 20:59:30 2012 (r238978) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Wed Jul 4 22:47:14 2012 (r238979) @@ -2,6 +2,7 @@ * Copyright (c) 1992, 1993, 1994 * The Regents of the University of California. All rights reserved. * Copyright (c) 2002 Scott Long + * Copyright (c) 2012 Oleksandr Dudinskyi * * This code is derived from software contributed to Berkeley * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension @@ -52,6 +53,7 @@ #include #include +#include "fs/udf2/udf_mount.h" #include #include @@ -63,7 +65,6 @@ #include #include "mntopts.h" -#include "udf2/udf_mount.h" struct mntopt mopts[] = { @@ -73,28 +74,39 @@ }; static int set_charset(char **, char **, const char *); -//static void getlastblock(char *dev, struct udf_session_info *usi, -// int session_num); static void usage(void); -//static void print_session_info(char *dev, int session_num); int main(int argc, char **argv) { - struct udf_session_info usi; - struct iovec iov[18]; - long session_num; - int ch, i, mntflags, opts, udf_flags, sessioninfo, verbose; - int32_t first_trackblank; + struct udf_args args; + struct iovec iov[14]; + int ch, i, mntflags, opts, udf_flags, verbose; char *dev, *dir, mntpath[MAXPATHLEN], *cs_disk, *cs_local, *endp; - session_num = 0; - sessioninfo = 0; + /* read in disk info from options */ + args.anon_uid = 0; + args.anon_gid = 0; + args.nobody_uid = -1; + args.nobody_gid = -1; i = mntflags = opts = udf_flags = verbose = 0; cs_disk = cs_local = NULL; - while ((ch = getopt(argc, argv, "o:vC:s:p")) != -1) + while ((ch = getopt(argc, argv, "o:vC:s:c:g:u:")) != -1) switch (ch) { + case 'c': + args.udfmflags |= UDFMNT_CLOSESESSION; + break; + case 'g': + args.anon_gid = strtol(optarg, &endp, 10); + if (optarg == endp || *endp != '\0') + usage(); + break; + case 'u': + args.anon_uid = strtol(optarg, &endp, 10); + if (optarg == endp || *endp != '\0') + usage(); + break; case 'o': getmntopts(optarg, mopts, &mntflags, &opts); break; @@ -107,13 +119,10 @@ udf_flags |= UDFMNT_KICONV; break; case 's': - session_num = strtol(optarg, &endp, 10); + args.sessionnr = strtol(optarg, &endp, 10); if (optarg == endp || *endp != '\0') usage(); break; - /*case 'p': - sessioninfo = 1; - break; */ case '?': default: usage(); @@ -121,13 +130,6 @@ argc -= optind; argv += optind; -#if 0 - if (sessioninfo) { - if (argc != 1) - usage(); - print_session_info(argv[0], session_num); - } -#endif if (argc != 2) usage(); @@ -143,11 +145,6 @@ (void)rmslashes(dev, dev); /* - * Get session info from device - */ -/* getlastblock(dev, &usi, session_num); */ - - /* * UDF file systems are not writeable. */ mntflags |= MNT_RDONLY; @@ -173,23 +170,10 @@ iov[i].iov_base = &udf_flags; iov[i++].iov_len = sizeof(udf_flags); -#if 0 - iov[i].iov_base = "first_trackblank"; - iov[i++].iov_len = sizeof("first_trackblank"); - first_trackblank = 0; - iov[i].iov_base = &first_trackblank; - iov[i++].iov_len = sizeof(uint32_t); - - iov[i].iov_base = "session_start_addr"; - iov[i++].iov_len = sizeof("session_start_addr"); - iov[i].iov_base = &usi.session_start_addr; - iov[i++].iov_len = sizeof(uint32_t); - - iov[i].iov_base = "session_end_addr"; - iov[i++].iov_len = sizeof("session_end_addr"); - iov[i].iov_base = &usi.session_end_addr; - iov[i++].iov_len = sizeof(uint32_t); -#endif + iov[i].iov_base = "udf_args"; + iov[i++].iov_len = sizeof("udf_args"); + iov[i].iov_base = &args; + iov[i++].iov_len = sizeof(args); if (udf_flags & UDFMNT_KICONV) { iov[i].iov_base = "cs_disk"; @@ -230,59 +214,11 @@ return (0); } -#if 0 -static void -getlastblock(char *dev, struct udf_session_info *usi, int session_num) -{ - int fd, error; - unsigned int out; - fd = open(dev, O_RDONLY, 0); - - if (fd < 0) - err(1, "open"); - - bzero(usi, sizeof(struct udf_session_info)); - usi->session_num = session_num; - error = ioctl(fd, UDFIOTEST, usi); - if (error != 0) { - if (session_num == 0) - warn("This device not not support sessions"); - else - err(2, "This device does not support sessions"); - } - - close(fd); -} - -static void -print_session_info(char *dev, int session_num) -{ - struct udf_session_info usi; - - rmslashes(dev, dev); - getlastblock(dev, &usi, session_num); - - - printf("session_num: %u\n", usi.session_num); - - printf("sector_size: %u\n", usi.sector_size); - printf("num_sessions: %u\n", usi.num_sessions); - printf("session_start_addr: %u\n", usi.session_start_addr); - printf("session_end_addr: %u\n", usi.session_end_addr); - - printf("num_tracks: %u\n", usi.num_tracks); - printf("first_track: %u\n", usi.first_track); - printf("session_first_track: %u\n", usi.session_first_track); - printf("session_last_track: %u\n", usi.session_last_track); - - exit(0); -} -#endif - static void usage(void) { (void)fprintf(stderr, - "usage: mount_udf [-v] [-o options] [-C charset] [-s session] [-p] special node\n"); + "usage: mount_udf2 [-v] [-o options] [-C charset] [-s session] " + "[-g gid] [-u uid] special node\n"); exit(EX_USAGE); } From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 22:49:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 44740106566C for ; Wed, 4 Jul 2012 22:49:04 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 22:49:04 +0000 Date: Wed, 04 Jul 2012 22:49:04 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704224904.44740106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238980 - soc2012/oleksandr/udf-head/sbin/mount_udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 22:49:06 -0000 Author: oleksandr Date: Wed Jul 4 22:49:03 2012 New Revision: 238980 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238980 Log: sorry, this is new man page for mount_udf2 Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf2.8 Deleted: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.8 Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf2.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf2.8 Wed Jul 4 22:49:03 2012 (r238980) @@ -0,0 +1,115 @@ +.\" Copyright (c) 2002 +.\" Scott Long +.\" Jeroen Ruigrok van der Werven +.\" 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 REGENTS 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 REGENTS 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: src/sbin/mount_udf/mount_udf.8,v 1.6 2005/02/10 09:19:31 ru Exp $ +.\" +.Dd March 23, 2002 +.Dt MOUNT_UDF2 8 +.Os +.Sh NAME +.Nm mount_udf2 +.Nd mount a UDF file system +.Sh SYNOPSIS +.Nm +.Op Fl v +.Op Fl c +.Op Fl g Ar gid +.Op Fl o Ar options +.Op Fl C Ar charset +.Op Fl s Ar session +.Op Fl u Ar uid +.Ar special node +.Sh DESCRIPTION +The +.Nm +utility attaches the UDF file system residing on the device +.Ar special +to the global file system namespace at the location indicated by +.Ar node . +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl c +Close the session after unmount creating remountable snapshots. +Closing a session also allows -ROM devices to read the disc created. +Note that this option only makes sense when mounting sequential +recordable media like CD-R and DVD*R. +.It Fl g Ar gid +Set the group of anonymous files on the file system. +The default group is the nobody group. +.It Fl o +Options are specified with a +.Fl o +flag followed by a comma separated string of options. +See the +.Xr mount 8 +man page for possible options and their meanings. +The following UDF specific options are available: +.It Fl v +Be verbose about mounting the UDF file system. +.It Fl C Ar charset +Specify local +.Ar charset +to convert Unicode file names. +.It Fl s Ar session +Select the session +.Ar session +to be mounted instead of the default last one. +Implements readonly snapshots on sequential media. +Positive +.Ar session +values indicate an absolute session number. +Negative +.Ar session +values are relative to the last session found on the disc. +Note that this option only makes sense when mounting sequential +recordable media like CD-R and DVD*R. +.It Fl u Ar uid +Set the owner of anonymous files on the file system. +The default owner is the user nobody. +.El +.Sh SEE ALSO +.Xr cdcontrol 1 , +.Xr mount 2 , +.Xr unmount 2 , +.Xr fstab 5 , +.Xr mount 8 +.Sh NOTES +UDF is a file system defined by the OSTA standardization group and +is tailored for data interchange on optical discs (like CDs and +DVDs) between different operating systems. +Its also more and more common on other media like Compact +Flash (CF) cards. +.Pp +Read-only access is supported for all media types that CD/DVD/BD type drives +can recognise including DVD-RAM. +.Pp +All current UDF versions up to version 2.60 are supported. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 22:51:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 76FEC106566B for ; Wed, 4 Jul 2012 22:51:35 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 22:51:35 +0000 Date: Wed, 04 Jul 2012 22:51:35 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704225135.76FEC106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238981 - soc2012/oleksandr/udf-head/sbin X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 22:51:37 -0000 Author: oleksandr Date: Wed Jul 4 22:51:35 2012 New Revision: 238981 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238981 Log: add new utility mount_udf2 to Makefile Modified: soc2012/oleksandr/udf-head/sbin/Makefile Modified: soc2012/oleksandr/udf-head/sbin/Makefile ============================================================================== --- soc2012/oleksandr/udf-head/sbin/Makefile Wed Jul 4 22:49:03 2012 (r238980) +++ soc2012/oleksandr/udf-head/sbin/Makefile Wed Jul 4 22:51:35 2012 (r238981) @@ -54,6 +54,7 @@ mount_ntfs \ mount_nullfs \ mount_udf \ + mount_udf2 \ mount_unionfs \ newfs \ newfs_msdos \ From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 23:13:02 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F14BA1065678 for ; Wed, 4 Jul 2012 23:12:59 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 23:12:59 +0000 Date: Wed, 04 Jul 2012 23:12:59 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704231259.F14BA1065678@hub.freebsd.org> Cc: Subject: socsvn commit: r238983 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 23:13:02 -0000 Author: oleksandr Date: Wed Jul 4 23:12:59 2012 New Revision: 238983 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238983 Log: read parameter -g and -u from mount options and remove commented code, fix translated UDF filetypes Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 22:12:10 2012 (r238982) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 23:12:59 2012 (r238983) @@ -421,7 +421,7 @@ int num_anchors, error, len, *udf_flags; uint32_t bshift, logvol_integrity, sector_size; /*lb_size,*/ char *cs_disk, *cs_local; -// void *optdata; + void *optdata; #if 0 /* flush out any old buffers remaining from a previous use. */ @@ -481,9 +481,6 @@ ump->geomcp = cp; ump->bo = &devvp->v_bufobj; - /* set up arguments and device */ -// ump->mount_args = *args; - /* Load flags for later. Not sure what to use them for... */ udf_flags = NULL; error = vfs_getopt(opts, "flags", (void **)&udf_flags, &len); @@ -491,38 +488,20 @@ return (EINVAL); ump->flags = *udf_flags; - /* read in disk info from options */ - ump->mount_args.anon_uid = 0; - ump->mount_args.anon_gid = 0; - ump->mount_args.nobody_uid = -1; - ump->mount_args.nobody_gid = -1; -#if 0 - optdata = NULL; - error = vfs_getopt(opts, "first_trackblank", &optdata, &len); - if (error || len != sizeof(uint32_t)) { - error = EINVAL; - goto fail; - } - ump->first_trackblank = *(uint32_t *)optdata; - - optdata = NULL; - error = vfs_getopt(opts, "session_start_addr", &optdata, &len); - if (error || len != sizeof(uint32_t)) { + optdata = NULL; + error = vfs_getopt(opts, "udf_args", &optdata, &len); + if (error || len != sizeof(struct udf_args)) { error = EINVAL; goto fail; } - ump->session_start = *(uint32_t *)optdata; - optdata = NULL; - error = vfs_getopt(opts, "session_end_addr", &optdata, &len); - if (error || len != sizeof(uint32_t)) { - error = EINVAL; - goto fail; - } - ump->session_end = *(uint32_t *)optdata; + /* set up arguments and device */ + ump->mount_args = *(struct udf_argRNO) == 0) + (kgdb) + 140 td->td_errno = error; + (kgdb) + 148 if (systrace_probe_func !=: - ump->last_possible_vat_location = ump->session_end; -#endif if (ump->flags & UDFMNT_KICONV && udf2_iconv) { cs_disk = "UTF-16BE"; @@ -965,8 +944,7 @@ nvp->v_type = VREG; break; default: - /* YIKES, something else */ - nvp->v_type = VNON; + nvp->v_type = VBAD; } /* TODO specfs, fifofs etc etc. vnops setting */ From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 04:20:33 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 886B3106566B for ; Thu, 5 Jul 2012 04:20:31 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 04:20:31 +0000 Date: Thu, 05 Jul 2012 04:20:31 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705042031.886B3106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238986 - in soc2012/jhagewood: diff diff/diff sdiff sdiff/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 04:20:33 -0000 Author: jhagewood Date: Thu Jul 5 04:20:30 2012 New Revision: 238986 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238986 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Thu Jul 5 00:52:23 2012 (r238985) +++ soc2012/jhagewood/diff/diff/diffreg.c Thu Jul 5 04:20:30 2012 (r238986) @@ -1354,22 +1354,20 @@ static int istextfile(FILE *f) { - char buf[BUFSIZ]; - int cnt, check_size; + int i, check_size; + char ch; if (aflag || f == NULL) return (1); rewind(f); - fread(buf, 1, BUFSIZ, f); - if (BUFSIZ >= MAX_CHECK) - check_size = MAX_CHECK; - else - check_size = BUFSIZ; - /* - * XXX Currently returns NULL even for file with no NULL chars? - if (memchr(buf, '\0', check_size) != NULL) { - return (0); - }*/ + for (i = 0; i <= MAX_CHECK || ch != EOF; i++) { + ch = fgetc(f); + if (ch == '\0') { + rewind(f); + return (0); + } + } + rewind(f); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 00:52:23 2012 (r238985) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 04:20:30 2012 (r238986) @@ -664,7 +664,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-07-02 15:05:57.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-07-03 16:22:08.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-07-05 04:19:42.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1178,7 +1178,7 @@ sum = 1; space = 0; -@@ -1305,20 +1346,30 @@ readhash(FILE *f) +@@ -1305,20 +1346,28 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1193,8 +1193,8 @@ { - char buf[BUFSIZ]; - int i, cnt; -+ char buf[BUFSIZ]; -+ int cnt, check_size; ++ int i, check_size; ++ char ch; if (aflag || f == NULL) return (1); @@ -1203,21 +1203,18 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) -- return (0); -+ fread(buf, 1, BUFSIZ, f); -+ if (BUFSIZ >= MAX_CHECK) -+ check_size = MAX_CHECK; -+ else -+ check_size = BUFSIZ; -+ /* -+ * XXX Currently returns NULL even for file with no NULL chars? -+ if (memchr(buf, '\0', check_size) != NULL) { -+ return (0); -+ }*/ ++ for (i = 0; i <= MAX_CHECK || ch != EOF; i++) { ++ ch = fgetc(f); ++ if (ch == '\0') { ++ rewind(f); + return (0); ++ } ++ } ++ rewind(f); return (1); } -@@ -1327,10 +1378,10 @@ asciifile(FILE *f) +@@ -1327,10 +1376,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1232,7 +1229,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1393,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1391,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1240,7 +1237,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1423,9 @@ static void +@@ -1373,9 +1421,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1253,7 +1250,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1440,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1438,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1264,7 +1261,7 @@ } } printf("\n*** "); -@@ -1478,9 +1528,9 @@ static void +@@ -1478,9 +1526,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1277,7 +1274,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1541,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1539,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1303,7 +1300,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1601,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1599,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 00:52:23 2012 (r238985) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 04:20:30 2012 (r238986) @@ -1,6 +1,6 @@ diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-03 16:56:41.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-03 17:10:59.000000000 -0400 @@ -34,7 +34,7 @@ #include "common.h" #include "extern.h" @@ -20,18 +20,16 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -363,7 +364,9 @@ main(int argc, char **argv) +@@ -363,7 +364,7 @@ main(int argc, char **argv) diffargv[diffargc++] = NULL; /* Subtract column divider and divide by two. */ - width = (wflag - 3) / 2; + width = ((wflag - 3) / 2) - 2; -+ if (!wflag) -+ width = ((wflag - 3) / 2); /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); -@@ -383,7 +386,6 @@ main(int argc, char **argv) +@@ -383,7 +384,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 00:52:23 2012 (r238985) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 04:20:30 2012 (r238986) @@ -365,8 +365,6 @@ /* Subtract column divider and divide by two. */ width = ((wflag - 3) / 2) - 2; - if (!wflag) - width = ((wflag - 3) / 2); /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 10:07:01 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 57C6D1065670 for ; Thu, 5 Jul 2012 10:06:59 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 10:06:59 +0000 Date: Thu, 05 Jul 2012 10:06:59 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705100659.57C6D1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238990 - in soc2012/rudot: benchmarking benchmarking/hw benchmarking/virtual benchmarking/virtual/buildkernel benchmarking/virtual/buildkernel/nolimit benchmarking/virtual/buildworl... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 10:07:01 -0000 Author: rudot Date: Thu Jul 5 10:06:59 2012 New Revision: 238990 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238990 Log: removed unnecessary subr_turnstile.c and added subr_trap.c Added: soc2012/rudot/benchmarking/ soc2012/rudot/benchmarking/hw/ soc2012/rudot/benchmarking/virtual/ soc2012/rudot/benchmarking/virtual/buildkernel/ soc2012/rudot/benchmarking/virtual/buildkernel/nolimit/ soc2012/rudot/benchmarking/virtual/buildworld/ soc2012/rudot/benchmarking/virtual/buildworld/80pct/ soc2012/rudot/benchmarking/virtual/buildworld/nolimit/ soc2012/rudot/sys/kern/subr_trap.c Deleted: soc2012/rudot/sys/kern/subr_turnstile.c Added: soc2012/rudot/sys/kern/subr_trap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/kern/subr_trap.c Thu Jul 5 10:06:59 2012 (r238990) @@ -0,0 +1,276 @@ +/*- + * Copyright (C) 1994, David Greenman + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2007 The FreeBSD Foundation + * + * This code is derived from software contributed to Berkeley by + * the University of Utah, and William Jolitz. + * + * Portions of this software were developed by A. Joseph Koshy under + * sponsorship from the FreeBSD Foundation and Google, Inc. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/subr_trap.c,v 1.330 2012/06/10 20:24:01 pjd Exp $"); + +#include "opt_hwpmc_hooks.h" +#include "opt_ktrace.h" +#include "opt_kdtrace.h" +#include "opt_sched.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef KTRACE +#include +#include +#endif +#include + +#include + +#ifdef VIMAGE +#include +#endif + +#ifdef XEN +#include +#include +#include +#endif + +#ifdef HWPMC_HOOKS +#include +#endif + +#include + +/* + * Define the code needed before returning to user mode, for trap and + * syscall. + */ +void +userret(struct thread *td, struct trapframe *frame) +{ + struct proc *p = td->td_proc; + + CTR3(KTR_SYSC, "userret: thread %p (pid %d, %s)", td, p->p_pid, + td->td_name); + KASSERT((p->p_flag & P_WEXIT) == 0, + ("Exiting process returns to usermode")); +#if 0 +#ifdef DIAGNOSTIC + /* Check that we called signotify() enough. */ + PROC_LOCK(p); + thread_lock(td); + if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 || + (td->td_flags & TDF_ASTPENDING) == 0)) + printf("failed to set signal flags properly for ast()\n"); + thread_unlock(td); + PROC_UNLOCK(p); +#endif +#endif +#ifdef KTRACE + KTRUSERRET(td); +#endif + /* + * If this thread tickled GEOM, we need to wait for the giggling to + * stop before we return to userland + */ + if (td->td_pflags & TDP_GEOM) + g_waitidle(); + + /* + * Charge system time if profiling. + */ + if (p->p_flag & P_PROFIL) + addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); + /* + * Let the scheduler adjust our priority etc. + */ + sched_userret(td); + KASSERT(td->td_locks == 0, + ("userret: Returning with %d locks held.", td->td_locks)); +#ifdef VIMAGE + /* Unfortunately td_vnet_lpush needs VNET_DEBUG. */ + VNET_ASSERT(curvnet == NULL, + ("%s: Returning on td %p (pid %d, %s) with vnet %p set in %s", + __func__, td, p->p_pid, td->td_name, curvnet, + (td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A")); +#endif +#ifdef XEN + PT_UPDATES_FLUSH(); +#endif +} + +/* + * Process an asynchronous software trap. + * This is relatively easy. + * This function will return with preemption disabled. + */ +void +ast(struct trapframe *framep) +{ + struct thread *td; + struct proc *p; + int flags; + int sig; + + td = curthread; + p = td->td_proc; + + CTR3(KTR_SYSC, "ast: thread %p (pid %d, %s)", td, p->p_pid, + p->p_comm); + KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode")); + WITNESS_WARN(WARN_PANIC, NULL, "Returning to user mode"); + mtx_assert(&Giant, MA_NOTOWNED); + THREAD_LOCK_ASSERT(td, MA_NOTOWNED); + td->td_frame = framep; + td->td_pticks = 0; + + /* + * This updates the td_flag's for the checks below in one + * "atomic" operation with turning off the astpending flag. + * If another AST is triggered while we are handling the + * AST's saved in flags, the astpending flag will be set and + * ast() will be called again. + */ + thread_lock(td); + flags = td->td_flags; + td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK | + TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND); + thread_unlock(td); + PCPU_INC(cnt.v_trap); + + if (td->td_ucred != p->p_ucred) + cred_update_thread(td); + if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) { + addupc_task(td, td->td_profil_addr, td->td_profil_ticks); + td->td_profil_ticks = 0; + td->td_pflags &= ~TDP_OWEUPC; + } +#ifdef HWPMC_HOOKS + /* Handle Software PMC callchain capture. */ + if (PMC_IS_PENDING_CALLCHAIN(td)) + PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_USER_CALLCHAIN_SOFT, (void *) framep); +#endif + if (flags & TDF_ALRMPEND) { + PROC_LOCK(p); + kern_psignal(p, SIGVTALRM); + PROC_UNLOCK(p); + } + if (flags & TDF_PROFPEND) { + PROC_LOCK(p); + kern_psignal(p, SIGPROF); + PROC_UNLOCK(p); + } +#ifdef MAC + if (flags & TDF_MACPEND) + mac_thread_userret(td); +#endif + if (flags & TDF_NEEDRESCHED) { +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(1, 1, __func__); +#endif + thread_lock(td); + sched_prio(td, td->td_user_pri); + mi_switch(SW_INVOL | SWT_NEEDRESCHED, NULL); + thread_unlock(td); +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(0, 1, __func__); +#endif + } + + /* + * Check for signals. Unlocked reads of p_pendingcnt or + * p_siglist might cause process-directed signal to be handled + * later. + */ + if (flags & TDF_NEEDSIGCHK || p->p_pendingcnt > 0 || + !SIGISEMPTY(p->p_siglist)) { + PROC_LOCK(p); + mtx_lock(&p->p_sigacts->ps_mtx); + while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) + postsig(sig); + mtx_unlock(&p->p_sigacts->ps_mtx); + PROC_UNLOCK(p); + } + /* + * We need to check to see if we have to exit or wait due to a + * single threading requirement or some other STOP condition. + */ + if (flags & TDF_NEEDSUSPCHK) { + PROC_LOCK(p); + thread_suspend_check(0); + PROC_UNLOCK(p); + } + + if (td->td_pflags & TDP_OLDMASK) { + td->td_pflags &= ~TDP_OLDMASK; + kern_sigprocmask(td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0); + } + + userret(td, framep); + mtx_assert(&Giant, MA_NOTOWNED); +} + +const char * +syscallname(struct proc *p, u_int code) +{ + static const char unknown[] = "unknown"; + struct sysentvec *sv; + + sv = p->p_sysent; + if (sv->sv_syscallnames == NULL || code >= sv->sv_size) + return (unknown); + return (sv->sv_syscallnames[code]); +} From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 10:21:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 706A5106566B for ; Thu, 5 Jul 2012 10:21:02 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 10:21:02 +0000 Date: Thu, 05 Jul 2012 10:21:02 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705102102.706A5106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238991 - in soc2012/rudot: aux sys/kern sys/sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 10:21:04 -0000 Author: rudot Date: Thu Jul 5 10:21:01 2012 New Revision: 238991 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238991 Log: trying different approach: instead of modifying scheduler I sleep in userret. It looks well so far to me. Modified: soc2012/rudot/aux/psSum.sh soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c soc2012/rudot/sys/kern/subr_trap.c soc2012/rudot/sys/sys/racct.h soc2012/rudot/sys/sys/sched.h Modified: soc2012/rudot/aux/psSum.sh ============================================================================== --- soc2012/rudot/aux/psSum.sh Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/aux/psSum.sh Thu Jul 5 10:21:01 2012 (r238991) @@ -66,7 +66,7 @@ do PCPU=`user_pcpu "$USER"` - if [ "$PCPU" = "0" ]; then + if echo "$PCPU" "0.2" | awk '{exit !($1 < $2)}'; then sleep $DELAY_SLOT continue fi Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/sys/kern/kern_racct.c Thu Jul 5 10:21:01 2012 (r238991) @@ -65,7 +65,7 @@ FEATURE(racct, "Resource Accounting"); -static struct mtx racct_lock; +struct mtx racct_lock; MTX_SYSINIT(racct_lock, &racct_lock, "racct lock", MTX_DEF); static uma_zone_t racct_zone; @@ -896,67 +896,50 @@ racct_proc_disable(struct proc *p) { struct thread *td; + int cpuid; PROC_LOCK_ASSERT(p, MA_OWNED); + mtx_assert(&racct_lock, MA_OWNED); + + p->p_racct->r_pflags |= R_PCPUEXCEEDED; + FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_critnest > 1) - continue; - if ((td->td_flags & TDF_RACCT_PCTCPU) == 0) { + switch (td->td_state) { + case TDS_RUNQ: thread_lock(td); - td->td_flags |= TDF_RACCT_PCTCPU; - switch (td->td_state) { - case TDS_RUNQ: - sched_rem(td); - td->td_flags |= TDF_RACCT_RQ; - break; - case TDS_RUNNING: - td->td_flags |= TDF_NEEDRESCHED; -#ifdef SMP - if (td != curthread) - ipi_cpu(td->td_oncpu, IPI_AST); -#endif - break; - default: - break; - } - + td->td_flags |= TDF_NEEDRESCHED; thread_unlock(td); + break; + case TDS_RUNNING: + thread_lock(td); + cpuid = td->td_oncpu; + td->td_flags |= TDF_NEEDRESCHED; + if ((cpuid != NOCPU) && (td != curthread)) + ipi_cpu(cpuid, IPI_AST); + thread_unlock(td); + break; + default: + break; } } } -/* - * Returns true if at least one of the process threads - * has been disabled. - */ -static int +int racct_proc_disabled(struct proc *p) { - struct thread *td; - - PROC_LOCK_ASSERT(p, MA_OWNED); - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_flags & TDF_RACCT_PCTCPU) - return (1); - } + mtx_assert(&racct_lock, MA_OWNED); - return (0); + return (p->p_racct->r_pflags & R_PCPUEXCEEDED); } static void racct_proc_enable(struct proc *p) { - struct thread *td; + mtx_assert(&racct_lock, MA_OWNED); - PROC_LOCK_ASSERT(p, MA_OWNED); - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - td->td_flags &= ~TDF_RACCT_PCTCPU; - if (td->td_flags & TDF_RACCT_RQ) { - td->td_flags &= ~TDF_RACCT_RQ; - sched_add(td, SRQ_BORING); - } - thread_unlock(td); + if (racct_proc_disabled(p)) { + p->p_racct->r_pflags &= ~R_PCPUEXCEEDED; + wakeup(p->p_racct); } } Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/sys/kern/sched_4bsd.c Thu Jul 5 10:21:01 2012 (r238991) @@ -1260,18 +1260,6 @@ SDT_PROBE4(sched, , , enqueue, td, td->td_proc, NULL, flags & SRQ_PREEMPTED); -#ifdef RACCT - /* - * Skip adding threads to the rq that have exceeded their racct - * pctcpu limits. Also set a flag that says when the thread is - * again within its pctcpu limits, it should be also added to - * the rq. - */ - if (td->td_flags & TDF_RACCT_PCTCPU) { - td->td_flags |= TDF_RACCT_RQ; - return; - } -#endif /* * Now that the thread is moving to the run-queue, set the lock * to the scheduler's lock. @@ -1578,6 +1566,7 @@ return (ts->ts_pctcpu); } +#ifdef RACCT fixpt_t sched_pctcpu_delta(struct thread *td) { @@ -1605,6 +1594,7 @@ return (delta); } +#endif void sched_tick(int cnt) Modified: soc2012/rudot/sys/kern/subr_trap.c ============================================================================== --- soc2012/rudot/sys/kern/subr_trap.c Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/sys/kern/subr_trap.c Thu Jul 5 10:21:01 2012 (r238991) @@ -68,6 +68,7 @@ #include #include #include +#include #ifdef KTRACE #include #include @@ -92,6 +93,8 @@ #include +extern struct mtx racct_lock; + /* * Define the code needed before returning to user mode, for trap and * syscall. @@ -148,6 +151,13 @@ #ifdef XEN PT_UPDATES_FLUSH(); #endif +#ifdef RACCT + mtx_lock(&racct_lock); + while (racct_proc_disabled(p)) { + msleep(p->p_racct, &racct_lock, 0, "racct", 0); + } + mtx_unlock(&racct_lock); +#endif } /* Modified: soc2012/rudot/sys/sys/racct.h ============================================================================== --- soc2012/rudot/sys/sys/racct.h Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/sys/sys/racct.h Thu Jul 5 10:21:01 2012 (r238991) @@ -122,8 +122,16 @@ struct racct { int64_t r_resources[RACCT_MAX + 1]; LIST_HEAD(, rctl_rule_link) r_rule_links; + + /* + * The racct extension to the process flags + */ + int r_pflags; }; +/* Flags kept in r_pflags. */ +#define R_PCPUEXCEEDED 0x00001 /* Process %cpu limits have been exceeded. */ + int racct_add(struct proc *p, int resource, uint64_t amount); void racct_add_cred(struct ucred *cred, int resource, uint64_t amount); void racct_add_force(struct proc *p, int resource, uint64_t amount); @@ -145,5 +153,6 @@ struct ucred *newcred); void racct_move(struct racct *dest, struct racct *src); u_int racct_getpcpu(struct proc *p); +int racct_proc_disabled(struct proc *p); #endif /* !_RACCT_H_ */ Modified: soc2012/rudot/sys/sys/sched.h ============================================================================== --- soc2012/rudot/sys/sys/sched.h Thu Jul 5 10:06:59 2012 (r238990) +++ soc2012/rudot/sys/sys/sched.h Thu Jul 5 10:21:01 2012 (r238991) @@ -94,7 +94,6 @@ void sched_lend_prio(struct thread *td, u_char prio); void sched_lend_user_prio(struct thread *td, u_char pri); fixpt_t sched_pctcpu(struct thread *td); -fixpt_t sched_pctcpu_delta(struct thread *td); void sched_prio(struct thread *td, u_char prio); void sched_sleep(struct thread *td, int prio); void sched_switch(struct thread *td, struct thread *newtd, int flags); @@ -104,6 +103,9 @@ void sched_userret(struct thread *td); void sched_wakeup(struct thread *td); void sched_preempt(struct thread *td); +#ifdef RACCT +fixpt_t sched_pctcpu_delta(struct thread *td); +#endif /* * Threads are moved on and off of run queues From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 10:23:47 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 13073106566C for ; Thu, 5 Jul 2012 10:23:45 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 10:23:45 +0000 Date: Thu, 05 Jul 2012 10:23:45 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705102345.13073106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238992 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 10:23:47 -0000 Author: oleksandr Date: Thu Jul 5 10:23:44 2012 New Revision: 238992 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238992 Log: clean strange code Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Thu Jul 5 10:21:01 2012 (r238991) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Thu Jul 5 10:23:44 2012 (r238992) @@ -353,6 +353,8 @@ if ((error = vflush(ump->vfs_mountp, 0, flags, curthread))) return (error); + DPRINTF(VOLUMES, ("flush OK on unmount\n")); + /* close logical volume and close session if requested */ if ((error = udf_close_logvol(ump, mntflags)) != 0) return (error); @@ -378,10 +380,6 @@ /* TODO: clean up iconv here */ if (ump->iconv_d2l) udf2_iconv->close(ump->iconv_d2l); -#if 0 - if (ump->iconv_d2l) - udf2_iconv->close(ump->iconv_d2l); -#endif DROP_GIANT(); g_topology_lock(); @@ -496,11 +494,7 @@ } /* set up arguments and device */ - ump->mount_args = *(struct udf_argRNO) == 0) - (kgdb) - 140 td->td_errno = error; - (kgdb) - 148 if (systrace_probe_func !=: + ump->mount_args = *(struct udf_args *)optdata; if (ump->flags & UDFMNT_KICONV && udf2_iconv) { cs_disk = "UTF-16BE"; From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 11:08:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B4DBD1065673 for ; Thu, 5 Jul 2012 11:08:48 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 11:08:48 +0000 Date: Thu, 05 Jul 2012 11:08:48 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705110848.B4DBD1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238993 - in soc2012/rudot/sys: kern sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 11:08:50 -0000 Author: rudot Date: Thu Jul 5 11:08:48 2012 New Revision: 238993 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238993 Log: cleanup of old code Modified: soc2012/rudot/sys/kern/sched_4bsd.c soc2012/rudot/sys/sys/sched.h Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Thu Jul 5 10:23:44 2012 (r238992) +++ soc2012/rudot/sys/kern/sched_4bsd.c Thu Jul 5 11:08:48 2012 (r238993) @@ -69,10 +69,6 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif -#ifdef RACCT -#include -#endif - /* * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in * the range 100-256 Hz (approximately). @@ -1260,6 +1256,7 @@ SDT_PROBE4(sched, , , enqueue, td, td->td_proc, NULL, flags & SRQ_PREEMPTED); + /* * Now that the thread is moving to the run-queue, set the lock * to the scheduler's lock. Modified: soc2012/rudot/sys/sys/sched.h ============================================================================== --- soc2012/rudot/sys/sys/sched.h Thu Jul 5 10:23:44 2012 (r238992) +++ soc2012/rudot/sys/sys/sched.h Thu Jul 5 11:08:48 2012 (r238993) @@ -239,10 +239,4 @@ __END_DECLS #endif - -#ifdef RACCT -#define TDF_RACCT_PCTCPU TDF_SCHED2 -#define TDF_RACCT_RQ TDF_SCHED3 -#endif - #endif /* !_SCHED_H_ */ From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 18:13:08 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D7F9C106564A for ; Thu, 5 Jul 2012 18:13:06 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 18:13:06 +0000 Date: Thu, 05 Jul 2012 18:13:06 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705181306.D7F9C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239007 - in soc2012/jhagewood: diff diff/diff sdiff sdiff/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 18:13:09 -0000 Author: jhagewood Date: Thu Jul 5 18:13:06 2012 New Revision: 239007 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239007 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Thu Jul 5 17:02:20 2012 (r239006) +++ soc2012/jhagewood/diff/diff/diff.c Thu Jul 5 18:13:06 2012 (r239007) @@ -104,7 +104,7 @@ { "help", no_argument, NULL, OPT_HELP }, /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ { "ifdef", required_argument, NULL, 'D' }, - { "ignore-all-space", no_argument, NULL, 'w' }, + { "ignore-all-space", no_argument, NULL, 'W' }, { "ignore-blank-lines", no_argument, NULL, 'B' }, { "ignore-case", no_argument, NULL, 'i' }, { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, @@ -142,7 +142,7 @@ { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, - /*{ "width", optional_argument, NULL, 'W' }, */ + /*{ "width", optional_argument, NULL, 'w' }, */ { NULL, 0, NULL, '\0'} }; @@ -172,6 +172,7 @@ "\t-t --expand-tabs Expand tabs to spaces in output", "\t-U -u NUM --unified=NUM Show NUM lines of unified context", "\t-v --version Show diff version", +"\t-W --ignore-all-space Ignore all space", "\t-w --width=NUM Output at most NUM (default 130) print columns", "\t-X --exclude-from=FILE Start with FILE when comparing directories", "\t-x --exclude=PAT Exclude files that match PAT", @@ -331,7 +332,7 @@ case 'v': printf("FreeBSD diff 2.8.7\n"); exit(0); - case 'w': + case 'W': wflag = 1; break; case 'X': @@ -395,11 +396,10 @@ ignore_file_case = 0; break; case OPT_HELP: - for(;*help_strs;help_strs++) - { + for (; *help_strs; help_strs++) { printf("%s\n", *help_strs); } - exit(2); + exit(0); break; default: usage(); Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 17:02:20 2012 (r239006) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 18:13:06 2012 (r239007) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-07-02 15:05:57.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-07-03 15:59:52.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-07-05 18:11:07.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,128 @@ enum +@@ -69,84 +67,129 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -128,7 +128,7 @@ + { "help", no_argument, NULL, OPT_HELP }, + /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ + { "ifdef", required_argument, NULL, 'D' }, -+ { "ignore-all-space", no_argument, NULL, 'w' }, ++ { "ignore-all-space", no_argument, NULL, 'W' }, + { "ignore-blank-lines", no_argument, NULL, 'B' }, + { "ignore-case", no_argument, NULL, 'i' }, + { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, @@ -182,7 +182,7 @@ - { "exclude-from", required_argument, NULL, 'X' }, - { "exclude", required_argument, NULL, 'x' }, - { "side-by-side", no_argument, NULL, 'y' }, -+ /*{ "width", optional_argument, NULL, 'W' }, */ ++ /*{ "width", optional_argument, NULL, 'w' }, */ { NULL, 0, NULL, '\0'} }; @@ -217,6 +217,7 @@ +"\t-t --expand-tabs Expand tabs to spaces in output", +"\t-U -u NUM --unified=NUM Show NUM lines of unified context", +"\t-v --version Show diff version", ++"\t-W --ignore-all-space Ignore all space", +"\t-w --width=NUM Output at most NUM (default 130) print columns", +"\t-X --exclude-from=FILE Start with FILE when comparing directories", +"\t-x --exclude=PAT Exclude files that match PAT", @@ -237,7 +238,7 @@ NULL, }; char **help_strs = (char **)help_msg; -@@ -162,14 +204,15 @@ void read_excludes_file(char *); +@@ -162,14 +205,15 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -258,7 +259,7 @@ lastch = '\0'; prevoptind = 1; -@@ -197,6 +240,7 @@ main(int argc, char **argv) +@@ -197,6 +241,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -266,7 +267,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +257,9 @@ main(int argc, char **argv) +@@ -213,6 +258,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -276,7 +277,16 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +343,48 @@ main(int argc, char **argv) +@@ -284,7 +332,7 @@ main(int argc, char **argv) + case 'v': + printf("FreeBSD diff 2.8.7\n"); + exit(0); +- case 'w': ++ case 'W': + wflag = 1; + break; + case 'X': +@@ -296,15 +344,48 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -333,6 +343,20 @@ case OPT_STRIPCR: strip_cr=1; break; +@@ -315,11 +396,10 @@ main(int argc, char **argv) + ignore_file_case = 0; + break; + case OPT_HELP: +- for(;*help_strs;help_strs++) +- { ++ for (; *help_strs; help_strs++) { + printf("%s\n", *help_strs); + } +- exit(2); ++ exit(0); + break; + default: + usage(); @@ -328,20 +408,20 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Thu Jul 5 17:02:20 2012 (r239006) +++ soc2012/jhagewood/sdiff/TODO Thu Jul 5 18:13:06 2012 (r239007) @@ -2,7 +2,9 @@ Test script COMPLETE Adapt code to FreeBSD style guidelines INCOMPLETE Fix --width output indention IN PROGRESS - +--help COMPLETE +Adapt source to FreBSD style(9) INCOMPLETE +Add more information to man file. INCOMPLETE NOTES: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 17:02:20 2012 (r239006) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 18:13:06 2012 (r239007) @@ -1,6 +1,6 @@ diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-03 17:10:59.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 18:12:04.000000000 -0400 @@ -34,7 +34,7 @@ #include "common.h" #include "extern.h" @@ -20,7 +20,54 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -363,7 +364,7 @@ main(int argc, char **argv) +@@ -137,6 +138,24 @@ static struct option longopts[] = { + + { NULL, 0, NULL, '\0'} + }; ++ ++static const char *help_msg[] = { ++ "-l, --left-column, Only print the left column for identical lines.", ++ "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", ++ "-s, --suppress-common-lines, Skip identical lines.", ++ "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", ++ "Options passed to diff(1) are:", ++ "\t-a, --text, Treat file1 and file2 as text files.", ++ "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", ++ "\t-d, --minimal, Minimize diff size.", ++ "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", ++ "\t-i, --ignore-case, Do a case-insensitive comparison.", ++ "\t-t, --expand-tabs Expand tabs to spaces.", ++ "\t-W, --ignore-all-spaces, Ignore all spaces.", ++ NULL, ++}; ++char **help_strs = (char **)help_msg; ++ + /* + * Create temporary file if source_file is not a regular file. + * Returns temporary file name if one was malloced, NULL if unnecessary. +@@ -289,17 +308,17 @@ main(int argc, char **argv) + if (errstr) + errx(2, "width is %s: %s", errstr, optarg); + break; +- + case DIFF_PID: + ppid = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(2, "diff pid value is %s: %s", errstr, optarg); + break; +- + case HELP_OPT: +- usage(); ++ for (; *help_strs; help_strs++) { ++ printf("%s\n", *help_strs); ++ } ++ exit(0); + break; +- + default: + usage(); + break; +@@ -363,7 +382,7 @@ main(int argc, char **argv) diffargv[diffargc++] = NULL; /* Subtract column divider and divide by two. */ @@ -29,7 +76,7 @@ /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); -@@ -383,7 +384,6 @@ main(int argc, char **argv) +@@ -383,7 +402,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); @@ -37,3 +84,16 @@ execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; +@@ -1117,10 +1135,8 @@ int_usage(void) + static void + usage(void) + { +- extern char *__progname; +- ++ + fprintf(stderr, +- "usage: %s [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", +- __progname); ++ "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n"); + exit(2); + } Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 17:02:20 2012 (r239006) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 18:13:06 2012 (r239007) @@ -138,6 +138,24 @@ { NULL, 0, NULL, '\0'} }; + +static const char *help_msg[] = { + "-l, --left-column, Only print the left column for identical lines.", + "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", + "-s, --suppress-common-lines, Skip identical lines.", + "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", + "Options passed to diff(1) are:", + "\t-a, --text, Treat file1 and file2 as text files.", + "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", + "\t-d, --minimal, Minimize diff size.", + "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", + "\t-i, --ignore-case, Do a case-insensitive comparison.", + "\t-t, --expand-tabs Expand tabs to spaces.", + "\t-W, --ignore-all-spaces, Ignore all spaces.", + NULL, +}; +char **help_strs = (char **)help_msg; + /* * Create temporary file if source_file is not a regular file. * Returns temporary file name if one was malloced, NULL if unnecessary. @@ -290,17 +308,17 @@ if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; - case DIFF_PID: ppid = strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) errx(2, "diff pid value is %s: %s", errstr, optarg); break; - case HELP_OPT: - usage(); + for (; *help_strs; help_strs++) { + printf("%s\n", *help_strs); + } + exit(0); break; - default: usage(); break; @@ -1117,10 +1135,8 @@ static void usage(void) { - extern char *__progname; - + fprintf(stderr, - "usage: %s [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", - __progname); + "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n"); exit(2); } From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 19:48:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E89A21065670 for ; Thu, 5 Jul 2012 19:48:27 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 19:48:27 +0000 Date: Thu, 05 Jul 2012 19:48:27 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705194827.E89A21065670@hub.freebsd.org> Cc: Subject: socsvn commit: r239011 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 19:48:30 -0000 Author: jhagewood Date: Thu Jul 5 19:48:27 2012 New Revision: 239011 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239011 Log: Modified: soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Thu Jul 5 18:57:39 2012 (r239010) +++ soc2012/jhagewood/sdiff/TODO Thu Jul 5 19:48:27 2012 (r239011) @@ -3,7 +3,6 @@ Adapt code to FreeBSD style guidelines INCOMPLETE Fix --width output indention IN PROGRESS --help COMPLETE -Adapt source to FreBSD style(9) INCOMPLETE Add more information to man file. INCOMPLETE NOTES: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 18:57:39 2012 (r239010) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 19:48:27 2012 (r239011) @@ -1,6 +1,6 @@ diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 18:12:04.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 19:48:01.000000000 -0400 @@ -34,7 +34,7 @@ #include "common.h" #include "extern.h" @@ -20,24 +20,25 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -137,6 +138,24 @@ static struct option longopts[] = { +@@ -137,6 +138,25 @@ static struct option longopts[] = { { NULL, 0, NULL, '\0'} }; + +static const char *help_msg[] = { -+ "-l, --left-column, Only print the left column for identical lines.", -+ "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", -+ "-s, --suppress-common-lines, Skip identical lines.", -+ "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", -+ "Options passed to diff(1) are:", -+ "\t-a, --text, Treat file1 and file2 as text files.", -+ "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", -+ "\t-d, --minimal, Minimize diff size.", -+ "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", -+ "\t-i, --ignore-case, Do a case-insensitive comparison.", -+ "\t-t, --expand-tabs Expand tabs to spaces.", -+ "\t-W, --ignore-all-spaces, Ignore all spaces.", ++ "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", ++ "\t-l, --left-column, Only print the left column for identical lines.", ++ "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", ++ "\t-s, --suppress-common-lines, Skip identical lines.", ++ "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", ++ "\tOptions passed to diff(1) are:", ++ "\t\t-a, --text, Treat file1 and file2 as text files.", ++ "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", ++ "\t\t-d, --minimal, Minimize diff size.", ++ "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", ++ "\t\t-i, --ignore-case, Do a case-insensitive comparison.", ++ "\t\t-t, --expand-tabs Expand tabs to spaces.", ++ "\t\t-W, --ignore-all-spaces, Ignore all spaces.", + NULL, +}; +char **help_strs = (char **)help_msg; @@ -45,7 +46,7 @@ /* * Create temporary file if source_file is not a regular file. * Returns temporary file name if one was malloced, NULL if unnecessary. -@@ -289,17 +308,17 @@ main(int argc, char **argv) +@@ -289,17 +309,17 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; @@ -67,7 +68,7 @@ default: usage(); break; -@@ -363,7 +382,7 @@ main(int argc, char **argv) +@@ -363,7 +383,7 @@ main(int argc, char **argv) diffargv[diffargc++] = NULL; /* Subtract column divider and divide by two. */ @@ -76,7 +77,7 @@ /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); -@@ -383,7 +402,6 @@ main(int argc, char **argv) +@@ -383,7 +403,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); @@ -84,7 +85,7 @@ execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; -@@ -1117,10 +1135,8 @@ int_usage(void) +@@ -1117,10 +1136,8 @@ int_usage(void) static void usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 18:57:39 2012 (r239010) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 19:48:27 2012 (r239011) @@ -140,18 +140,19 @@ }; static const char *help_msg[] = { - "-l, --left-column, Only print the left column for identical lines.", - "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", - "-s, --suppress-common-lines, Skip identical lines.", - "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", - "Options passed to diff(1) are:", - "\t-a, --text, Treat file1 and file2 as text files.", - "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", - "\t-d, --minimal, Minimize diff size.", - "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", - "\t-i, --ignore-case, Do a case-insensitive comparison.", - "\t-t, --expand-tabs Expand tabs to spaces.", - "\t-W, --ignore-all-spaces, Ignore all spaces.", + "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", + "\t-l, --left-column, Only print the left column for identical lines.", + "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", + "\t-s, --suppress-common-lines, Skip identical lines.", + "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", + "\tOptions passed to diff(1) are:", + "\t\t-a, --text, Treat file1 and file2 as text files.", + "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", + "\t\t-d, --minimal, Minimize diff size.", + "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", + "\t\t-i, --ignore-case, Do a case-insensitive comparison.", + "\t\t-t, --expand-tabs Expand tabs to spaces.", + "\t\t-W, --ignore-all-spaces, Ignore all spaces.", NULL, }; char **help_strs = (char **)help_msg; From owner-svn-soc-all@FreeBSD.ORG Thu Jul 5 20:37:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 65FA3106564A for ; Thu, 5 Jul 2012 20:37:43 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 05 Jul 2012 20:37:43 +0000 Date: Thu, 05 Jul 2012 20:37:43 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120705203743.65FA3106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239012 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2012 20:37:45 -0000 Author: jhagewood Date: Thu Jul 5 20:37:42 2012 New Revision: 239012 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239012 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.1 Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 19:48:27 2012 (r239011) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 20:37:42 2012 (r239012) @@ -1,3 +1,15 @@ +diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.1 jhagewood/sdiff/sdiff/sdiff.1 +--- jhagewood/sdiff/sdiff-orig/sdiff.1 2012-07-02 15:05:58.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.1 2012-07-05 20:29:55.000000000 -0400 +@@ -3,7 +3,7 @@ + .\" Written by Raymond Lai . + .\" Public domain. + .\" +-.Dd $Mdocdate: June 29 2007 $ ++.Dd $Mdocdate: July 5 2012 $ + .Dt SDIFF 1 + .Os + .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 +++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 19:48:01.000000000 -0400 Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.1 ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.1 Thu Jul 5 19:48:27 2012 (r239011) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.1 Thu Jul 5 20:37:42 2012 (r239012) @@ -3,7 +3,7 @@ .\" Written by Raymond Lai . .\" Public domain. .\" -.Dd $Mdocdate: June 29 2007 $ +.Dd $Mdocdate: July 5 2012 $ .Dt SDIFF 1 .Os .Sh NAME From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 01:23:26 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 65C49106564A for ; Fri, 6 Jul 2012 01:23:24 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 01:23:24 +0000 Date: Fri, 06 Jul 2012 01:23:24 +0000 From: vchan@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706012324.65C49106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239026 - soc2012/vchan/gtcp/bwalex-tc-play X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 01:23:26 -0000 Author: vchan Date: Fri Jul 6 01:23:23 2012 New Revision: 239026 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239026 Log: fixed all functions but not tested Modified: soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Modified: soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c Fri Jul 6 00:58:27 2012 (r239025) +++ soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c Fri Jul 6 01:23:23 2012 (r239026) @@ -78,14 +78,26 @@ return CRYPTO_AES_XTS; else if (strcmp(cipher->name, "AES-256-XTS") == 0) return CRYPTO_AES_XTS; - else if (strcmp(cipher->name, "TWOFISH-128-XTS") == 0) - return CRYPTO_TWOFISH_XTS; - else if (strcmp(cipher->name, "TWOFISH-256-XTS") == 0) - return CRYPTO_TWOFISH_XTS; - else if (strcmp(cipher->name, "SERPENT-128-XTS") == 0) - return CRYPTO_SERPENT_XTS; - else if (strcmp(cipher->name, "SERPENT-256-XTS") == 0) - return CRYPTO_SERPENT_XTS; + else if (strcmp(cipher->name, "TWOFISH-128-XTS") == 0) { + fprintf(stderr, "TWOFISH-128-XTS not available on FreeBSD.\n"); + //return CRYPTO_TWOFISH_XTS; + return -1; + } + else if (strcmp(cipher->name, "TWOFISH-256-XTS") == 0) { + fprintf(stderr, "TWOFISH-256-XTS not available on FreeBSD.\n"); + //return CRYPTO_TWOFISH_XTS; + return -1; + } + else if (strcmp(cipher->name, "SERPENT-128-XTS") == 0) { + fprintf(stderr, "SERPENT-128-XTS not available on FreeBSD.\n"); + //return CRYPTO_SERPENT_XTS; + return -1; + } + else if (strcmp(cipher->name, "SERPENT-256-XTS") == 0) { + fprintf(stderr, "SERPENT-256-XTS not available on FreeBSD.\n"); + //return CRYPTO_SERPENT_XTS; + return -1; + } else return -1; } Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Fri Jul 6 00:58:27 2012 (r239025) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Fri Jul 6 01:23:23 2012 (r239026) @@ -68,6 +68,10 @@ int tc_internal_verbose = 1; char tc_internal_log_buffer[LOG_BUFFER_SZ]; +/* new for FreeBSD */ +static int unit = G_GATE_UNIT_AUTO; +static int force = 0; + void tc_log(int is_err, const char *fmt, ...) { @@ -923,7 +927,7 @@ return -1; } - +/* int map_volume(const char *map_name, const char *device, int sflag, const char *sys_dev, int protect_hidden, const char *keyfiles[], @@ -957,8 +961,25 @@ return 0; } +*/ -/*fix*/ +static +void +dm_remove_device() +{ + int ret = EINVAL; + + force = 1; + + if (unit == -1) { + fprintf(stderr, "Required unit number.\n"); + } + + g_gate_verbose = 1; + g_gate_open_device(); + g_gate_destroy(unit, force); + +/* static int dm_remove_device(const char *name) @@ -978,31 +999,32 @@ ret = 0; out: if (dmt) - /*fix*/dm_task_destroy(dmt); - + dm_task_destroy(dmt); +*/ return ret; } int dm_setup(const char *mapname, struct tcplay_info *info) { + /* Commented out variables not needed in freeBSD*/ struct tc_cipher_chain *cipher_chain; - struct dm_task *dmt = NULL; - struct dm_info dmi; +// struct dm_task *dmt = NULL; +// struct dm_info dmi; char *params = NULL; - char *uu; +// char *uu; char *uu_stack[64]; int uu_stack_idx; -/*#if defined(__DragonFly__)*/ +/*#if defined(__DragonFly__) uint32_t status; -/*#endif*/ +#endif*/ int r, ret = 0; int j; off_t start, offset; char dev[PATH_MAX]; char map[PATH_MAX]; uint32_t cookie; - static int force = 0; //new for FreeBSD + /* dm_udev_set_sync_support(1); */ @@ -1035,13 +1057,14 @@ #ifdef DEBUG printf("Params: %s\n", params); #endif - /* changed from, "if ((dmt = dm_task_create(DM_DEVICE_CREATE)) == NULL)" */ - if ((dmt = g_gatel_create()) == 1) { - tc_log(1, "g_gatel_create failed\n"); + /* + if ((dmt = dm_task_create(DM_DEVICE_CREATE)) == NULL) { + tc_log(1, "dm_task_create failed\n"); ret = -1; goto out; } - + */ + /* * If this is the last element in the cipher chain, use the * final map name. Otherwise pick a secondary name... @@ -1129,7 +1152,7 @@ start = 0; sprintf(dev, "/dev/mapper/%s.%d", mapname, j); - g_gate_destroy(dmt, force); /* was dm_task_destroy(dmt); */ + g_gate_destroy(unit, force); /* was dm_task_destroy(dmt); */ /*not needed in FreeBSD dm_task_update_nodes(); */ } From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 10:16:03 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DDB1A1065672 for ; Fri, 6 Jul 2012 10:16:00 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 10:16:00 +0000 Date: Fri, 06 Jul 2012 10:16:00 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706101600.DDB1A1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r239033 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 10:16:03 -0000 Author: scher Date: Fri Jul 6 10:16:00 2012 New Revision: 239033 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239033 Log: [user_feedback] ")" simbol was missed in one echo command of ${_PROCESS_ACTIVE_BUILDS} Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Fri Jul 6 06:42:25 2012 (r239032) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Fri Jul 6 10:16:00 2012 (r239033) @@ -16,8 +16,7 @@ # # _parv_CHECK_ACTIVE_TIMEOUT - timeout in seconds before next check of active # builds in case if port is prohibit to spawn -# another background process. Consider that this -# variable is also used in non-parallel build. +# another background process. # Default: 2 # # _parv_WAIT_FOR_LOCK_TIME - time in seconds to wait if lock file is locked @@ -477,7 +476,7 @@ depends="$${depends} $${dep}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ else \ - ${ECHO_CMD} "Errors occured while building a dependency port $$(cd $${dir}; ${MAKE} -V PKGNAME"; \ + ${ECHO_CMD} "Errors occured while building a dependency port $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ ${ECHO_CMD} "Checkout its log"; \ ${ECHO_CMD} " ${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE})"; \ ${ECHO_CMD} "Terminating..."; \ From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 10:26:35 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9CC70106564A for ; Fri, 6 Jul 2012 10:26:33 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 10:26:33 +0000 Date: Fri, 06 Jul 2012 10:26:33 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706102633.9CC70106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239034 - in soc2012/rudot/benchmarking/hw: buildkernel buildworld buildworld/80pct buildworld/nolimit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 10:26:35 -0000 Author: rudot Date: Fri Jul 6 10:26:32 2012 New Revision: 239034 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239034 Log: some benchmarking results Added: soc2012/rudot/benchmarking/hw/buildkernel/ soc2012/rudot/benchmarking/hw/buildworld/ soc2012/rudot/benchmarking/hw/buildworld/80pct/ soc2012/rudot/benchmarking/hw/buildworld/80pct/dataSorted.txt soc2012/rudot/benchmarking/hw/buildworld/80pct/plot.eps (contents, props changed) soc2012/rudot/benchmarking/hw/buildworld/nolimit/ soc2012/rudot/benchmarking/hw/buildworld/nolimit/dataSorted.txt soc2012/rudot/benchmarking/hw/buildworld/nolimit/plot.eps (contents, props changed) Added: soc2012/rudot/benchmarking/hw/buildworld/80pct/dataSorted.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/benchmarking/hw/buildworld/80pct/dataSorted.txt Fri Jul 6 10:26:32 2012 (r239034) @@ -0,0 +1,422 @@ +0.2 14 +0.3 16 +0.4 15 +0.5 16 +0.6 9 +0.7 10 +0.8 13 +0.9 14 +1 8 +1.1 10 +1.2 5 +1.3 11 +1.4 9 +1.5 8 +1.6 10 +1.7 5 +1.8 6 +1.9 6 +2 10 +2.1 6 +2.2 3 +2.3 4 +2.4 4 +2.5 6 +2.6 12 +2.8 3 +2.9 4 +3 6 +3.1 9 +3.2 2 +3.4 2 +3.5 4 +3.6 3 +3.7 1 +3.8 2 +3.9 3 +4 3 +4.1 10 +4.2 3 +4.3 3 +4.6 2 +4.7 1 +4.8 2 +4.9 2 +5 2 +5.1 8 +5.2 1 +5.3 1 +5.4 1 +5.5 1 +5.6 6 +5.7 1 +5.8 1 +6 7 +6.2 3 +6.3 2 +6.6 1 +6.7 2 +6.8 1 +7 12 +7.1 1 +7.2 4 +7.5 1 +7.7 1 +7.8 1 +7.9 1 +8 8 +8.2 1 +8.7 1 +9 10 +9.1 3 +9.2 2 +10 4 +10.2 1 +10.3 1 +10.4 1 +10.6 1 +10.8 1 +11 8 +11.2 1 +12 9 +13 5 +13.3 1 +14 6 +15 3 +15.8 1 +17 3 +17.2 1 +18.2 1 +20 1 +21 1 +21.2 1 +22 1 +25 1 +26 1 +26.9 1 +28.7 1 +31.6 1 +32 2 +33 1 +36 1 +37.6 1 +38.9 1 +39.3 1 +40 3 +41 1 +41.2 1 +41.7 2 +42.1 1 +42.2 1 +42.5 1 +42.8 1 +43 4 +43.1 2 +43.3 1 +43.6 3 +44 1 +44.1 3 +44.4 1 +44.5 1 +44.7 1 +44.9 2 +45 1 +45.2 8 +45.4 1 +45.5 4 +45.6 1 +45.7 2 +45.9 1 +46 4 +46.1 1 +46.3 3 +46.5 1 +46.7 1 +46.8 3 +47 1 +47.1 1 +47.3 1 +47.6 1 +47.7 1 +47.9 2 +48 1 +48.1 1 +48.6 1 +48.7 1 +49 1 +49.1 2 +49.4 1 +49.6 1 +49.7 3 +49.8 1 +50.1 3 +50.2 3 +50.3 1 +50.4 1 +50.5 1 +50.7 3 +50.8 4 +51 1 +51.1 1 +51.2 3 +51.3 1 +51.5 1 +51.7 1 +51.8 5 +51.9 1 +52.2 1 +52.7 1 +52.8 1 +52.9 2 +53 1 +53.1 3 +53.2 1 +53.3 3 +53.6 4 +53.9 2 +54 2 +54.1 1 +54.2 2 +54.3 4 +54.4 1 +54.5 2 +54.6 1 +54.7 6 +54.8 3 +55 6 +55.1 2 +55.3 2 +55.4 2 +55.6 2 +55.7 2 +55.9 5 +56 1 +56.1 1 +56.2 2 +56.4 3 +56.5 1 +56.7 2 +56.9 6 +57 2 +57.1 6 +57.3 3 +57.4 2 +57.8 7 +57.9 3 +58.1 6 +58.3 1 +58.4 1 +58.5 3 +58.7 1 +58.8 6 +58.9 1 +59.1 3 +59.2 5 +59.3 3 +59.5 7 +59.8 2 +59.9 3 +60 9 +60.2 3 +60.3 1 +60.5 3 +60.6 1 +60.8 1 +61.1 1 +61.3 4 +61.4 3 +61.5 1 +61.6 1 +61.7 1 +61.8 2 +61.9 1 +62 5 +62.1 1 +62.2 1 +62.7 5 +62.8 1 +62.9 2 +63 1 +63.1 1 +63.2 1 +63.3 2 +63.4 3 +63.6 1 +63.7 1 +63.8 1 +63.9 2 +64 4 +64.1 3 +64.2 1 +64.3 3 +64.4 3 +64.5 1 +64.6 2 +64.7 4 +64.8 1 +64.9 1 +65 1 +65.1 4 +65.2 2 +65.3 1 +65.4 1 +65.5 4 +65.6 2 +65.7 2 +65.8 2 +65.9 2 +66.1 1 +66.2 4 +66.3 1 +66.6 3 +66.8 1 +66.9 2 +67 6 +67.1 2 +67.2 1 +67.3 1 +67.5 2 +67.6 7 +67.7 2 +67.8 3 +67.9 3 +68.1 2 +68.2 2 +68.3 1 +68.4 1 +68.5 3 +68.6 5 +68.7 4 +68.8 1 +69 3 +69.2 4 +69.5 2 +69.6 1 +69.7 2 +69.8 4 +69.9 1 +70 7 +70.2 6 +70.3 3 +70.4 2 +70.5 2 +70.6 2 +70.7 3 +70.8 1 +70.9 1 +71 2 +71.1 6 +71.3 1 +71.4 1 +71.6 4 +71.7 1 +71.8 2 +71.9 2 +72.1 1 +72.2 2 +72.3 4 +72.5 1 +72.6 2 +72.7 4 +72.8 1 +72.9 1 +73 3 +73.1 1 +73.2 4 +73.3 3 +73.4 1 +73.5 2 +73.6 4 +73.7 1 +73.8 7 +73.9 2 +74 4 +74.1 3 +74.2 1 +74.3 4 +74.4 1 +74.5 1 +74.7 1 +74.8 2 +74.9 7 +75 4 +75.1 2 +75.2 1 +75.3 8 +75.4 6 +75.5 1 +75.6 3 +75.7 2 +75.8 5 +75.9 8 +76 2 +76.1 1 +76.2 5 +76.3 4 +76.4 3 +76.5 1 +76.6 3 +76.7 1 +76.8 4 +76.9 4 +77 2 +77.1 1 +77.2 2 +77.3 5 +77.4 5 +77.6 2 +77.7 3 +77.8 3 +77.9 4 +78 2 +78.1 2 +78.2 3 +78.3 2 +78.4 8 +78.5 1 +78.6 2 +78.7 1 +78.9 3 +79.1 3 +79.2 1 +79.3 1 +79.4 4 +79.6 1 +79.8 4 +79.9 3 +80 1 +80.1 2 +80.2 2 +80.5 3 +80.6 3 +80.7 4 +80.8 1 +80.9 2 +81 1 +81.1 1 +81.7 1 +82 1 +82.9 1 +83 1 +87 5 +88.1 1 +90 2 +91 1 +92 3 +93 3 +93.9 1 +94 2 +95 2 +96 1 +97 4 +98 5 +98.5 1 +99 2 +100 3 +100.5 1 +101 1 +102.1 1 +102.9 1 +108.3 1 +152 1 +187 1 Added: soc2012/rudot/benchmarking/hw/buildworld/80pct/plot.eps ============================================================================== Binary file. No diff available. Added: soc2012/rudot/benchmarking/hw/buildworld/nolimit/dataSorted.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/benchmarking/hw/buildworld/nolimit/dataSorted.txt Fri Jul 6 10:26:32 2012 (r239034) @@ -0,0 +1,384 @@ +0.2 24 +0.3 11 +0.4 16 +0.5 8 +0.6 11 +0.7 16 +0.8 12 +0.9 13 +1 12 +1.1 14 +1.2 8 +1.3 19 +1.4 5 +1.5 12 +1.6 7 +1.7 1 +1.8 6 +1.9 5 +2 3 +2.1 5 +2.2 5 +2.3 4 +2.4 5 +2.5 4 +2.6 11 +2.7 4 +2.8 3 +2.9 3 +3 8 +3.1 9 +3.2 7 +3.3 1 +3.5 3 +3.6 5 +3.7 2 +3.8 2 +3.9 4 +4 5 +4.1 9 +4.2 2 +4.3 1 +4.4 1 +4.6 5 +4.7 1 +4.8 2 +4.9 2 +5 1 +5.1 5 +5.3 2 +5.4 1 +5.6 1 +5.7 1 +5.8 1 +6 11 +6.2 2 +6.3 1 +6.4 2 +6.5 1 +6.7 5 +6.9 1 +7 12 +7.1 1 +7.2 4 +7.9 1 +8 10 +8.7 4 +8.8 1 +9 7 +9.1 3 +9.2 2 +9.6 1 +10 7 +10.1 1 +10.3 1 +10.9 1 +11 7 +11.3 1 +11.5 1 +12 1 +13 4 +13.1 1 +13.9 1 +14 2 +14.1 1 +16 2 +17 2 +18 1 +19 2 +20.2 1 +23 1 +25 1 +26 2 +27 1 +29 1 +31.2 1 +31.4 1 +32 1 +36 1 +37 1 +37.8 1 +39.1 1 +40 1 +43 1 +46 1 +48 1 +49 1 +50 1 +53.7 1 +54 1 +57 1 +57.1 1 +58 2 +58.9 1 +60 2 +62.2 1 +63 1 +64.1 1 +64.3 1 +64.5 1 +66 2 +67 1 +67.6 1 +68 1 +68.6 1 +70 1 +70.2 1 +71 1 +71.2 4 +71.7 1 +72.9 1 +73.8 1 +74 1 +74.8 1 +74.9 1 +75.8 1 +76 2 +76.3 1 +76.4 1 +77 1 +77.4 1 +77.5 1 +77.6 2 +78.1 1 +78.9 1 +79.2 1 +79.4 1 +80.1 2 +80.6 1 +81 1 +81.7 1 +82 3 +83 4 +83.4 2 +83.9 1 +84.4 1 +84.5 1 +84.7 1 +84.9 1 +85 2 +85.6 1 +86 1 +86.5 2 +87 2 +87.1 1 +87.3 3 +87.6 1 +88 2 +88.1 1 +89 3 +89.3 1 +89.6 1 +89.7 1 +89.9 1 +90 1 +90.3 1 +90.4 1 +90.7 3 +90.8 1 +90.9 1 +91 1 +91.3 1 +91.5 2 +91.7 1 +92 2 +92.1 1 +92.5 1 +92.7 1 +92.8 1 +93 2 +93.1 1 +93.2 2 +93.3 3 +93.4 1 +93.5 1 +93.7 1 +93.8 1 +93.9 1 +94 2 +94.2 4 +94.3 3 +94.4 1 +94.5 2 +94.6 2 +94.7 1 +94.9 1 +95 1 +95.3 6 +95.4 2 +95.5 2 +95.6 3 +95.7 2 +96 3 +96.1 3 +96.2 2 +96.3 1 +96.4 2 +96.5 2 +96.6 2 +96.7 4 +96.8 3 +96.9 2 +97 3 +97.1 3 +97.2 2 +97.3 5 +97.5 2 +97.6 4 +97.7 2 +97.9 2 +98 3 +98.2 3 +98.3 1 +98.4 4 +98.5 2 +98.6 3 +98.7 2 +98.8 7 +98.9 7 +99 6 +99.1 2 +99.2 5 +99.3 2 +99.4 8 +99.5 5 +99.6 5 +99.7 6 +99.8 3 +99.9 5 +100 3 +100.1 3 +100.2 2 +100.3 5 +100.4 2 +100.5 2 +100.6 3 +100.7 1 +100.9 2 +101 7 +101.1 2 +101.2 2 +101.3 1 +101.5 3 +101.6 1 +101.7 2 +101.8 2 +102 2 +102.1 4 +102.2 2 +102.5 2 +102.6 2 +102.7 2 +102.8 1 +102.9 2 +103 7 +103.1 2 +103.4 1 +103.5 1 +103.6 4 +103.7 1 +103.8 3 +103.9 1 +104 2 +104.2 2 +104.3 1 +104.4 2 +104.7 3 +104.9 2 +105 1 +105.1 2 +105.2 4 +105.3 1 +105.5 1 +105.7 1 +106 2 +106.1 2 +106.6 1 +106.8 1 +107.3 1 +107.8 2 +108 1 +108.2 1 +108.4 1 +108.6 1 +109 1 +109.1 1 +109.2 2 +109.6 2 +109.8 1 +109.9 1 +110 2 +110.2 1 +110.6 1 +110.7 1 +111 2 +111.2 1 +111.3 1 +111.4 1 +111.6 1 +111.7 1 +111.9 1 +112 2 +112.1 1 +112.2 2 +112.5 2 +112.7 3 +112.9 1 +113.1 2 +113.8 1 +114.5 1 +114.8 1 +115.3 1 +115.4 1 +115.6 1 +116.3 1 +117 1 +117.3 1 +117.4 1 +117.5 1 +118 2 +118.1 1 +118.4 1 +118.6 1 +118.9 1 +119 1 +119.4 1 +119.9 1 +120 4 +120.2 1 +121.5 1 +122 1 +122.5 1 +123 4 +124.5 2 +125.2 1 +125.4 2 +126 2 +126.6 1 +126.7 1 +127 3 +127.6 1 +131 3 +132 1 +133 1 +134 3 +134.8 1 +135 1 +136 1 +140 1 +141.2 1 +142 1 +146.6 1 +149 2 +151 2 +158 1 +160.1 1 +160.3 1 +162.2 1 +177.7 1 +180 1 +181 1 +181.2 1 +181.8 1 +186.9 1 +189 1 Added: soc2012/rudot/benchmarking/hw/buildworld/nolimit/plot.eps ============================================================================== Binary file. No diff available. From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 10:35:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 54D9A106564A for ; Fri, 6 Jul 2012 10:35:29 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 10:35:29 +0000 Date: Fri, 06 Jul 2012 10:35:29 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706103529.54D9A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239035 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 10:35:31 -0000 Author: oleksandr Date: Fri Jul 6 10:35:29 2012 New Revision: 239035 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239035 Log: Add some DPRINTF and correct KASSERT functions Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Fri Jul 6 10:26:32 2012 (r239034) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Fri Jul 6 10:35:29 2012 (r239035) @@ -483,9 +483,12 @@ return (EINVAL); /* lookup in virtual allocation table file */ + /* mutex_enter(&ump->allocate_mutex); */ error = udf_vat_read(ump->vat_node, (uint8_t *) &udf_rw32_lbmap, 4, ump->vat_offset + lb_num * 4); + /* mutex_exit(&ump->allocate_mutex); */ + if (error) return (error); @@ -537,7 +540,17 @@ for (;;) { udf_get_adslot(ump->metadata_node, slot, &s_icb_loc, &eof); + DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, " + "len = %d, lb_num = %d, part = %d\n", + slot, eof, + UDF_EXT_FLAGS(le32toh(s_icb_loc.len)), + UDF_EXT_LEN(le32toh(s_icb_loc.len)), + le32toh(s_icb_loc.loc.lb_num), + le16toh(s_icb_loc.loc.part_num))); if (eof) { + DPRINTF(TRANSLATE, + ("Meta partition translation " + "failed: can't seek location\n")); UDF_UNLOCK_NODE(ump->metadata_node, 0); return (EINVAL); } @@ -913,12 +926,12 @@ static int udf_search_free_vatloc(struct udf_mount *ump, uint32_t *lbnumres) { - uint32_t lb_size, lb_num, lb_map, udf_rw32_lbmap; + uint32_t lb_size, lb_num, lb_map, le32toh_lbmap; uint8_t *blob; int entry, chunk, found, error; - KASSERT(ump); - KASSERT(ump->logical_vol); + KASSERT(ump, ("ump is NULL")); + KASSERT(ump->logical_vol, ("ump->logical_vol is NULL")); lb_size = le32toh(ump->logical_vol->lb_size); blob = malloc(lb_size, M_UDFTEMP, M_WAITOK); @@ -942,8 +955,8 @@ /* search this chunk */ for (entry=0; entry < chunk /4; entry++, lb_num++) { - udf_rw32_lbmap = *((uint32_t *) (blob + entry * 4)); - lb_map = le32toh(udf_rw32_lbmap); + le32toh_lbmap = *((uint32_t *) (blob + entry * 4)); + lb_map = le32toh(le32toh_lbmap); if (lb_map == 0xffffffff) { found = 1; break; @@ -1957,7 +1970,7 @@ l_icb.loc.part_num = udf_node->loc.loc.part_num; l_icb.loc.lb_num = short_ad->lb_num; } else { - KASSERT(addr_type == UDF_ICB_LONG_ALLOC,("addr_type == UDF_ICB_LONG_ALLOC")); + KASSERT(addr_type == UDF_ICB_LONG_ALLOC,("addr_type != UDF_ICB_LONG_ALLOC")); long_ad = (struct long_ad *) (data_pos + l_ad-adlen); l_icb = *long_ad; } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jul 6 10:26:32 2012 (r239034) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jul 6 10:35:29 2012 (r239035) @@ -2740,12 +2740,10 @@ { struct udf_mount *ump = vat_node->ump; -/* mutex_enter(&ump->allocate_mutex); */ if (offset + size > ump->vat_offset + ump->vat_entries * 4) return (EINVAL); - memcpy(blob, ump->vat_table + offset, size); -/* mutex_exit(&ump->allocate_mutex); */ + memcpy(blob, ump->vat_table + offset, size); return (0); } From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 12:29:17 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E78CE106566C for ; Fri, 6 Jul 2012 12:29:14 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 12:29:14 +0000 Date: Fri, 06 Jul 2012 12:29:14 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706122914.E78CE106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r239036 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 12:29:17 -0000 Author: oleksandr Date: Fri Jul 6 12:29:14 2012 New Revision: 239036 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239036 Log: add some comments and correct checks Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Fri Jul 6 10:35:29 2012 (r239035) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Fri Jul 6 12:29:14 2012 (r239036) @@ -170,10 +170,12 @@ struct vnode *vp = ap->a_vp; struct udf_node *udf_node = VTOI(vp); + DPRINTF(NODE, ("udf_reclaim called for node %p\n", udf_node)); + /* + * Destroy the vm object and flush associated pages. + */ vnode_destroy_vobject(vp); - if (udf_node == NULL) - return (0); #if 0 /* update note for closure */ udf_update(vp, NULL, NULL, NULL, UPDATE_CLOSE); @@ -188,9 +190,14 @@ cache_purge(vp); #endif /* dispose all node knowledge */ - vfs_hash_remove(vp); - udf_dispose_node(udf_node); - vp->v_data = NULL; + if (udf_node == NULL) { + DPRINTF(NODE, ("udf_reclaim(): null udfnode\n")); + } else { + vfs_hash_remove(vp); + /* dispose all node knowledge */ + udf_dispose_node(udf_node); + vp->v_data = NULL; + } return (0); } @@ -226,11 +233,12 @@ file_size = le64toh(udf_node->efe->inf_len); /* read contents using buffercache */ - while (error == 0 && uio->uio_resid > 0) { + do { /* reached end? */ if (file_size <= uio->uio_offset) break; + /* maximise length to file extremity */ n = min(file_size - uio->uio_offset, uio->uio_resid); lbn = uio->uio_offset / udf_node->ump->discinfo.sector_size; @@ -239,12 +247,12 @@ n = min(n, file_size - uio->uio_offset); error = bread(vp, lbn, udf_node->ump->discinfo.sector_size, NOCRED, &bp); n = min(n, udf_node->ump->discinfo.sector_size - bp->b_resid); + if (!error) error = uiomove(bp->b_data + on, n, uio); brelse(bp); - } - + } while (error == 0 && uio->uio_resid > 0 && n != 0) #if 0 /* note access time unless not requested */ if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) { From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 17:31:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 11CCC106564A for ; Fri, 6 Jul 2012 17:31:28 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 17:31:28 +0000 Date: Fri, 06 Jul 2012 17:31:28 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706173128.11CCC106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239048 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 17:31:30 -0000 Author: jhagewood Date: Fri Jul 6 17:31:27 2012 New Revision: 239048 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239048 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Fri Jul 6 16:54:25 2012 (r239047) +++ soc2012/jhagewood/diff/TODO Fri Jul 6 17:31:27 2012 (r239048) @@ -31,6 +31,16 @@ - The -ignore-*-* options need some work. - BUG: BSD diff seg faults when another longopt is used with '--side-by-side'. FIX: When passing args to sdiff for side-by-side mode, only the short option '-y' was excluded. Added '--side-by-side' as an exception also. +- --ignore-*-* options + -WORKING + --ignore-all-space + --ignore-case + --ignore-file-name-case + --ignore-matching-lines + --ignore-space-change + -NOT WORKING + --ignore-blank-lines + --ignore-tab-expansion - line formats: Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Fri Jul 6 16:54:25 2012 (r239047) +++ soc2012/jhagewood/diff/diff/diffreg.c Fri Jul 6 17:31:27 2012 (r239048) @@ -811,21 +811,14 @@ } /* ignore-blank-lines */ } else if (Bflag) { - if (c == '\n' && d != '\n') { - do { - if (c == '\n') { - ctold++; - } - } while ((c = getc(f1)) == '\n'); + while (isspace(c) && c == '\n') { + c = getc(f1); + ctold++; } - if (d == '\n' && c != '\n') { - do { - if (d == '\n') { - ctnew++; - } - } while ((d = getc(f2)) == '\n'); + while (isspace(d) && d == '\n') { + d = getc(f2); + ctnew++; } - break; /* ignore-tab-expansion */ } else if (Eflag) { if (isspace(c) && isspace(d)) { Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jul 6 16:54:25 2012 (r239047) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jul 6 17:31:27 2012 (r239048) @@ -688,7 +688,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-07-02 15:05:57.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-07-05 04:19:42.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-07-06 17:30:59.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -912,7 +912,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +809,62 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +809,55 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -921,33 +921,27 @@ } else if (Bflag) { - if( c == '\n' && d != '\n') { - -+ if (c == '\n' && d != '\n') { - do { - if (c == '\n') { +- do { +- if (c == '\n') { - ixold[i] = ctold; - i++; -+ ctold++; - } +- } - - } while ((c = getc(f1)) == '\n' && i <= len[0]); -+ } while ((c = getc(f1)) == '\n'); ++ while (isspace(c) && c == '\n') { ++ c = getc(f1); ++ ctold++; } - - if( d == '\n' && c != '\n') { -+ if (d == '\n' && c != '\n') { - do { - if (d == '\n') { +- do { +- if (d == '\n') { - ixnew[j] = ctnew; - j++; -+ ctnew++; - } -- } while ((d = getc(f2)) == '\n' && j <= len[1]); -- -+ } while ((d = getc(f2)) == '\n'); - } -- - break; -- } ++ while (isspace(d) && d == '\n') { ++ d = getc(f2); ++ ctnew++; ++ } + /* ignore-tab-expansion */ + } else if (Eflag) { + if (isspace(c) && isspace(d)) { @@ -961,7 +955,9 @@ + c = getc(f1); + if (c != ' ') + break; -+ } + } +- } while ((d = getc(f2)) == '\n' && j <= len[1]); +- + fsetpos(f1, &position); + while (c == ' ' && spacecount == 9) { + c = getc(f1); @@ -985,12 +981,15 @@ + ctnew++; + } + } -+ } + } +- +- break; +- } + } if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -872,7 +911,7 @@ static void +@@ -872,7 +904,7 @@ static void sort(struct line *a, int n) { struct line *ai, *aim, w; @@ -999,7 +998,7 @@ if (n == 0) return; -@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b) +@@ -916,7 +948,7 @@ unsort(struct line *f, int l, int *b) static int skipline(FILE *f) { @@ -1008,7 +1007,7 @@ for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; -@@ -926,7 +965,7 @@ skipline(FILE *f) +@@ -926,7 +958,7 @@ skipline(FILE *f) static void output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) { @@ -1017,7 +1016,7 @@ rewind(f1); rewind(f2); -@@ -965,7 +1004,7 @@ output(char *file1, FILE *f1, char *file +@@ -965,7 +997,7 @@ output(char *file1, FILE *f1, char *file #define c i0 if ((c = getc(f1)) == EOF) return; @@ -1026,7 +1025,7 @@ } #undef c } -@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file +@@ -980,6 +1012,7 @@ output(char *file1, FILE *f1, char *file static void range(int a, int b, char *separator) { @@ -1034,7 +1033,7 @@ printf("%d", a > b ? b : a); if (a < b) printf("%s%d", separator, b); -@@ -988,6 +1028,7 @@ range(int a, int b, char *separator) +@@ -988,6 +1021,7 @@ range(int a, int b, char *separator) static void uni_range(int a, int b) { @@ -1042,7 +1041,7 @@ if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) -@@ -999,22 +1040,22 @@ uni_range(int a, int b) +@@ -999,22 +1033,22 @@ uni_range(int a, int b) static char * preadline(int fd, size_t len, off_t off) { @@ -1069,7 +1068,7 @@ ret = regexec(&ignore_re, line, 0, NULL, 0); free(line); -@@ -1032,8 +1073,8 @@ static void +@@ -1032,8 +1066,8 @@ static void change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, int *pflags) { @@ -1080,7 +1079,7 @@ restart: if (format != D_IFDEF && a > b && c > d) -@@ -1113,15 +1154,15 @@ proceed: +@@ -1113,15 +1147,15 @@ proceed: case D_NORMAL: case D_EDIT: range(a, b, ","); @@ -1100,7 +1099,7 @@ break; case D_NREVERSE: if (a > b) -@@ -1137,7 +1178,7 @@ proceed: +@@ -1137,7 +1171,7 @@ proceed: if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) @@ -1109,7 +1108,7 @@ } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { -@@ -1148,14 +1189,14 @@ proceed: +@@ -1148,14 +1182,14 @@ proceed: * it. We have to add a substitute command to change this * back and restart where we left off. */ @@ -1126,7 +1125,7 @@ if (inifdef) { printf("#endif /* %s */\n", ifdefname); inifdef = 0; -@@ -1165,8 +1206,8 @@ proceed: +@@ -1165,8 +1199,8 @@ proceed: static int fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { @@ -1137,7 +1136,7 @@ /* * When doing #ifdef's, copy down to current line -@@ -1177,7 +1218,7 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1177,7 +1211,7 @@ fetch(long *f, int a, int b, FILE *lb, i /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; for (i = 0; i < nc; i++) @@ -1146,7 +1145,7 @@ } if (a > b) return (0); -@@ -1197,12 +1238,12 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1197,12 +1231,12 @@ fetch(long *f, int a, int b, FILE *lb, i fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; if (format != D_IFDEF && ch != '\0') { @@ -1162,7 +1161,7 @@ } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { -@@ -1211,13 +1252,13 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1211,13 +1245,13 @@ fetch(long *f, int a, int b, FILE *lb, i format == D_NREVERSE) warnx("No newline at end of file"); else @@ -1178,7 +1177,7 @@ } while (++col < newcol); } else { if (format == D_EDIT && j == 1 && c == '\n' -@@ -1229,10 +1270,10 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1229,10 +1263,10 @@ fetch(long *f, int a, int b, FILE *lb, i * giving the caller an offset * from which to restart. */ @@ -1191,7 +1190,7 @@ col++; } } -@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1246,8 +1280,8 @@ fetch(long *f, int a, int b, FILE *lb, i static int readhash(FILE *f) { @@ -1202,7 +1201,7 @@ sum = 1; space = 0; -@@ -1305,20 +1346,28 @@ readhash(FILE *f) +@@ -1305,20 +1339,28 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1238,7 +1237,7 @@ return (1); } -@@ -1327,10 +1376,10 @@ asciifile(FILE *f) +@@ -1327,10 +1369,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1253,7 +1252,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1391,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1384,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1261,7 +1260,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1421,9 @@ static void +@@ -1373,9 +1414,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1274,7 +1273,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1438,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1431,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1285,7 +1284,7 @@ } } printf("\n*** "); -@@ -1478,9 +1526,9 @@ static void +@@ -1478,9 +1519,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1298,7 +1297,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1539,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1532,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1324,7 +1323,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1599,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 17:51:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 308421065740 for ; Fri, 6 Jul 2012 17:51:48 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 17:51:48 +0000 Date: Fri, 06 Jul 2012 17:51:48 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706175148.308421065740@hub.freebsd.org> Cc: Subject: socsvn commit: r239049 - in soc2012/rudot/benchmarking/virtual/buildworld: 80pct nolimit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 17:51:50 -0000 Author: rudot Date: Fri Jul 6 17:51:47 2012 New Revision: 239049 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239049 Log: some benchmarks Added: soc2012/rudot/benchmarking/virtual/buildworld/80pct/dataSorted.txt soc2012/rudot/benchmarking/virtual/buildworld/80pct/plot.eps (contents, props changed) soc2012/rudot/benchmarking/virtual/buildworld/nolimit/dataSorted.txt soc2012/rudot/benchmarking/virtual/buildworld/nolimit/plot.eps (contents, props changed) Added: soc2012/rudot/benchmarking/virtual/buildworld/80pct/dataSorted.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/benchmarking/virtual/buildworld/80pct/dataSorted.txt Fri Jul 6 17:51:47 2012 (r239049) @@ -0,0 +1,608 @@ +0.2 25 +0.3 26 +0.4 24 +0.5 17 +0.6 19 +0.7 24 +0.8 27 +0.9 12 +1 20 +1.1 19 +1.2 20 +1.3 17 +1.4 11 +1.5 13 +1.6 12 +1.7 10 +1.8 12 +1.9 13 +2 10 +2.1 12 +2.2 7 +2.3 4 +2.4 6 +2.5 8 +2.6 8 +2.7 9 +2.8 11 +2.9 7 +3 14 +3.1 11 +3.2 6 +3.3 3 +3.4 6 +3.5 7 +3.6 8 +3.7 8 +3.8 3 +3.9 3 +4 11 +4.1 5 +4.2 9 +4.3 3 +4.4 4 +4.5 2 +4.6 15 +4.7 3 +4.8 7 +4.9 2 +5 3 +5.1 4 +5.2 2 +5.3 3 +5.4 2 +5.5 3 +5.6 5 +5.7 3 +5.8 1 +5.9 1 +6 4 +6.1 3 +6.2 6 +6.3 3 +6.4 3 +6.6 2 +6.7 5 +6.8 2 +6.9 2 +7 6 +7.1 3 +7.2 6 +7.3 3 +7.4 4 +7.5 1 +7.6 2 +7.7 4 +7.9 2 +8 6 +8.1 2 +8.2 6 +8.3 1 +8.4 5 +8.5 3 +8.6 3 +8.7 10 +8.8 2 +8.9 3 +9 9 +9.1 1 +9.2 3 +9.4 2 +9.5 2 +9.7 4 +9.8 1 +9.9 1 +10 14 +10.1 2 +10.2 5 +10.3 1 +10.6 3 +10.7 3 +10.9 2 +11 20 +11.1 1 +11.2 3 +11.3 1 +11.5 1 +11.8 3 +12 11 +12.1 1 +12.3 1 +12.5 1 +12.7 2 +12.9 1 +13 8 +13.3 2 +13.4 1 +13.6 1 +13.7 1 +14 14 +14.1 1 +14.4 2 +14.5 1 +14.6 1 +14.8 4 +14.9 2 +15 9 +15.1 1 +15.2 1 +15.3 1 +15.4 2 +15.7 1 +15.8 1 +16 4 +16.1 1 +16.2 1 +16.4 1 +16.8 2 +17 3 +17.1 1 +17.2 1 +17.4 1 +17.6 1 +17.9 1 +18 6 +18.5 2 +18.6 2 +18.7 2 +19 5 +19.2 1 +19.5 1 +19.9 3 +20 5 +20.4 1 +20.5 1 +20.9 1 +21 5 +21.7 1 +21.8 1 +22 6 +22.1 1 +22.3 1 +22.5 2 +22.7 2 +23 3 +23.3 1 +23.8 2 +24 2 +24.2 1 +24.5 1 +25 4 +25.8 1 +26 3 +26.2 1 +26.7 1 +27.1 1 +27.2 1 +27.7 1 +28 2 +29 3 +29.1 1 +29.9 1 +30 2 +30.7 1 +31 1 +31.7 1 +32 3 +32.1 1 +32.4 1 +33 3 +33.1 1 +34.1 1 +35 3 +35.1 1 +35.2 1 +35.5 3 +35.7 1 +36 4 +36.1 2 +36.2 1 +36.3 1 +36.9 2 +37.1 1 +37.2 1 +37.4 1 +37.7 1 +37.8 1 +37.9 1 +38 1 +38.7 1 +39 2 +39.1 1 +39.2 4 +39.3 1 +39.5 1 +39.6 1 +40 1 +40.1 1 +40.4 1 +40.7 1 +40.9 1 +41 2 +41.1 1 +41.2 1 +41.3 1 +41.5 1 +41.7 2 +41.8 1 +42 3 +42.2 1 +42.3 2 +42.4 2 +42.5 3 +42.8 3 +43 2 +43.1 4 +43.2 3 +43.3 1 +43.7 1 +43.9 2 +44 1 +44.1 4 +44.2 1 +44.3 1 +44.5 1 +44.6 2 +44.7 1 +45.1 1 +45.2 1 +45.3 1 +45.5 2 +45.6 2 +45.7 1 +45.8 2 +45.9 3 +46.1 1 +46.2 1 +46.3 2 +46.5 1 +46.6 1 +46.8 1 +46.9 2 +47 2 +47.1 2 +47.2 3 +47.4 1 +47.7 6 +47.8 1 +47.9 2 +48 2 +48.2 2 +48.3 1 +48.4 2 +48.5 1 +48.7 4 +48.8 1 +48.9 1 +49 4 +49.1 1 +49.2 3 +49.3 2 +49.4 2 +49.5 1 +49.7 7 +49.8 4 +49.9 1 +50 2 +50.1 2 +50.2 3 +50.3 4 +50.4 2 +50.5 3 +50.6 1 +50.8 11 +50.9 1 +51 1 +51.1 1 +51.2 5 +51.3 1 +51.4 1 +51.5 1 +51.6 1 +51.8 5 +51.9 1 +52.1 1 +52.2 9 +52.3 3 +52.4 3 +52.5 1 +52.6 3 +52.7 2 +52.8 4 +52.9 3 +53 3 +53.1 3 +53.2 2 +53.3 11 +53.4 3 +53.6 5 +53.7 2 +53.8 5 +53.9 1 +54 2 +54.1 3 +54.2 1 +54.3 1 +54.4 1 +54.5 3 +54.6 1 +54.7 6 +54.8 1 +54.9 2 +55 5 +55.2 4 +55.3 3 +55.4 1 +55.5 1 +55.6 1 +55.7 2 +55.8 1 +55.9 4 +56 5 +56.1 2 +56.2 2 +56.3 2 +56.4 2 +56.5 1 +56.6 2 +56.8 1 +57 4 +57.1 1 +57.3 2 +57.5 2 +57.6 1 +57.7 2 +57.8 1 +57.9 4 +58 3 +58.1 1 +58.2 2 +58.3 1 +58.4 2 +58.5 1 +58.6 1 +58.7 1 +58.8 3 +58.9 1 +59.2 3 +59.4 1 +59.5 2 +59.6 1 +59.7 5 +59.8 1 +59.9 3 +60 3 +60.1 1 +60.2 1 +60.3 2 +60.4 2 +60.5 3 +60.6 1 +60.8 1 +60.9 1 +61 4 +61.1 2 +61.2 2 +61.3 1 +61.5 5 +61.6 3 +61.8 2 +62 1 +62.1 4 +62.2 2 +62.4 4 +62.5 1 +62.6 1 +62.8 1 +62.9 1 +63 1 +63.2 2 +63.3 1 +63.4 1 +63.5 1 +63.6 2 +63.8 2 +64 4 +64.1 4 +64.2 4 +64.5 2 +64.7 2 +64.8 3 +64.9 1 +65 5 +65.1 1 +65.3 1 +65.4 2 +65.6 1 +65.7 2 +66 1 +66.1 3 +66.2 1 +66.4 2 +66.5 5 +66.6 1 +66.7 3 +66.9 1 +67 4 +67.1 3 +67.2 4 +67.3 3 +67.5 4 +67.6 6 +67.7 1 +67.8 1 +67.9 2 +68 1 +68.1 2 +68.2 7 +68.3 1 +68.4 2 +68.6 4 +68.7 4 +68.8 4 +68.9 1 +69 2 +69.1 2 +69.2 1 +69.3 3 +69.4 2 +69.5 2 +69.7 3 +69.8 3 +69.9 3 +70 1 +70.1 1 +70.2 5 +70.3 2 +70.4 1 +70.5 3 +70.6 1 +70.7 3 +70.8 3 +70.9 2 +71 2 +71.1 3 +71.2 9 +71.3 4 +71.4 4 +71.5 2 +71.6 4 +71.8 3 +71.9 2 +72 6 +72.1 1 +72.2 4 +72.3 4 +72.4 2 +72.5 1 +72.6 5 +72.7 3 +72.8 5 +72.9 4 +73 5 +73.1 1 +73.2 3 +73.3 3 +73.4 6 +73.6 1 +73.7 1 +73.8 5 +73.9 2 +74 2 +74.1 2 +74.2 1 +74.3 4 +74.4 6 +74.5 1 +74.6 2 +74.7 4 +74.8 5 +74.9 2 +75 8 +75.1 4 +75.2 1 +75.3 4 +75.4 2 +75.5 6 +75.6 2 +75.7 6 +75.8 3 +75.9 7 +76 2 +76.1 6 +76.2 3 +76.3 5 +76.4 11 +76.5 1 +76.6 3 +76.7 7 +76.8 4 +76.9 4 +77 5 +77.1 4 +77.2 2 +77.3 3 +77.4 3 +77.5 1 +77.6 5 +77.7 1 +77.8 3 +77.9 3 +78 2 +78.1 7 +78.2 7 +78.3 4 +78.4 3 +78.5 4 +78.6 2 +78.7 1 +78.8 4 +78.9 2 +79 1 +79.1 2 +79.2 3 +79.3 2 +79.4 3 +79.5 3 +79.6 1 +79.8 2 +79.9 4 +80 2 +80.1 1 +80.2 2 +80.3 1 +80.4 3 +80.5 2 +80.6 4 +80.7 2 +80.8 5 +81 2 +81.1 1 +81.2 1 +81.3 1 +81.7 1 +81.9 1 +82 1 +82.2 1 +82.4 1 +82.5 1 +83 3 +83.4 1 +84 3 +85 2 +86 2 +86.8 1 +88 2 +88.2 1 +88.6 1 +89 1 +89.1 1 +90 4 +91 3 +91.5 1 +92 2 +93 1 +94.5 1 +96 2 +101 1 +101.8 1 +104 1 +109 1 +110 1 +114 1 +115 2 +117.3 1 +119 1 +121.3 1 +122 1 +123.3 1 +127.2 1 +140.3 1 +147.3 1 +149 1 +161 1 +166 1 +174.7 1 +175 1 +176.4 1 +177 1 Added: soc2012/rudot/benchmarking/virtual/buildworld/80pct/plot.eps ============================================================================== Binary file. No diff available. Added: soc2012/rudot/benchmarking/virtual/buildworld/nolimit/dataSorted.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/benchmarking/virtual/buildworld/nolimit/dataSorted.txt Fri Jul 6 17:51:47 2012 (r239049) @@ -0,0 +1,562 @@ +0.2 21 +0.3 16 +0.4 23 +0.5 27 +0.6 27 +0.7 30 +0.8 13 +0.9 16 +1 17 +1.1 17 +1.2 12 +1.3 17 +1.4 15 +1.5 14 +1.6 15 +1.7 11 +1.8 12 +1.9 8 +2 12 +2.1 13 +2.2 12 +2.3 4 +2.4 7 +2.5 5 +2.6 9 +2.7 8 +2.8 8 +2.9 4 +3 16 +3.1 8 +3.2 4 +3.3 5 +3.4 3 +3.5 7 +3.6 10 +3.7 8 +3.8 4 +3.9 3 +4 14 +4.1 4 +4.2 9 +4.3 5 +4.4 2 +4.5 1 +4.6 19 +4.7 4 +4.8 9 +4.9 4 +5.1 11 +5.2 2 +5.3 8 +5.4 2 +5.5 5 +5.6 8 +5.7 5 +5.8 2 +5.9 3 +6 7 +6.1 5 +6.2 6 +6.3 6 +6.4 2 +6.5 3 +6.6 3 +6.7 5 +6.8 1 +6.9 5 +7 6 +7.1 1 +7.2 3 +7.3 1 +7.4 1 +7.5 3 +7.7 2 +7.8 1 +7.9 1 +8 5 +8.1 3 +8.2 7 +8.3 2 +8.4 3 +8.6 2 +8.7 3 +8.8 2 +8.9 1 +9 10 +9.1 3 +9.2 1 +9.4 1 +9.5 1 +9.6 2 +9.7 5 +9.8 1 +10 11 +10.1 3 +10.2 4 +10.3 6 +10.4 1 +10.7 1 +10.8 3 +10.9 2 +11 12 +11.1 1 +11.2 1 +11.3 3 +11.5 1 +11.8 4 +11.9 1 +12 11 +12.3 1 +12.5 1 +12.8 3 +12.9 2 +13 13 +13.2 3 +13.3 4 +13.4 2 +13.5 1 +13.6 1 +13.8 2 +14 10 +14.1 2 +14.2 1 +14.3 2 +14.6 2 +14.7 1 +15 6 +15.2 1 +15.3 2 +15.5 1 +15.6 3 +15.9 2 +16 8 +16.4 1 +16.5 1 +16.6 1 +16.7 1 +16.9 1 +17 12 +17.2 1 +17.3 1 +17.5 1 +18 9 +18.1 1 +18.5 1 +18.6 2 +18.9 1 +19 6 +19.1 1 +19.2 1 +19.3 1 +19.5 1 +20 5 +20.1 1 +20.2 2 +20.9 1 +21 8 +21.6 1 +22 9 +22.1 1 +22.7 1 +23 6 +23.3 1 +23.6 1 +24 2 +24.8 1 +25 5 +25.1 1 +25.2 1 +26 5 +26.4 2 +26.7 1 +26.9 1 +27 2 +27.1 1 +27.9 1 +28 3 +28.7 2 +29 2 +30 1 +31.7 1 +32 3 +33 1 +34 1 +35 2 +35.4 1 +36 3 +37.1 1 +37.2 1 +37.9 3 +38.3 1 +39.1 1 +39.3 1 +40 2 +41 1 +42 4 +42.2 2 +42.3 1 +42.8 1 +43.7 1 +44 1 +44.6 1 +45 3 +45.2 1 +45.7 1 +46 1 +46.3 1 +47 2 +47.1 1 +47.2 1 +47.8 1 +48 4 +48.5 1 +49 1 +50 3 +50.1 1 +50.9 1 +51.8 2 +51.9 1 +53 1 +53.4 1 +53.8 1 +54 3 +54.3 1 +54.7 1 +55 1 +56 2 +57 1 +57.3 1 +57.5 1 +57.9 1 +58 1 +59.9 3 +60 1 +60.5 1 +61.2 1 +61.8 1 +62 4 +62.4 1 +62.5 2 +63 2 +63.3 1 +63.5 1 +63.9 1 +64 1 +64.6 2 +65.3 1 +66.6 2 +67 3 +67.7 2 +68 1 +69 2 +69.2 1 +69.7 1 +70 1 +70.1 1 +70.5 1 +70.7 1 +71 2 +71.2 3 +71.5 1 +72 1 +72.2 1 +72.3 1 +73 1 +73.2 1 +74 1 +74.1 1 +74.3 1 +75.2 1 +75.3 2 +75.8 1 +76.4 1 +76.7 1 +76.9 1 +77.1 1 +77.4 1 +77.9 1 +78 2 +78.5 3 +78.6 1 +78.9 2 +79.2 1 +79.4 1 +79.5 1 +79.6 1 +79.9 1 +80 1 +80.2 1 +80.5 2 +80.9 1 +81.5 1 +81.6 1 +82 2 +82.1 1 +82.3 1 +82.8 1 +82.9 2 +83 5 +83.2 1 +83.4 1 +83.7 2 +84 4 +84.2 1 +84.3 1 +84.5 2 +84.7 1 +84.9 2 +85.1 1 +85.4 1 +85.5 1 +85.6 1 +85.8 1 +86 4 +86.1 3 +86.4 3 +86.5 1 +86.7 1 +86.9 1 +87 4 +87.1 1 +87.2 1 +87.3 2 +87.6 2 +87.8 1 +88 2 +88.1 1 +88.2 2 +88.3 1 +88.6 1 +88.8 2 +88.9 2 +89 3 +89.2 1 +89.3 5 +89.4 1 +89.6 1 +89.7 2 +89.8 1 +90 7 +90.1 1 +90.2 1 +90.5 2 +90.7 3 +91 6 +91.1 1 +91.2 1 +91.3 3 +91.4 1 +91.5 2 +91.6 3 +91.7 3 +91.8 2 +91.9 1 +92 5 +92.1 1 +92.2 2 +92.3 3 +92.5 2 +92.6 4 +92.7 4 +92.8 3 +92.9 9 +93 7 +93.1 3 +93.2 5 +93.3 5 +93.4 4 +93.5 3 +93.6 4 +93.7 5 +93.8 8 +93.9 3 +94 6 +94.1 4 +94.2 7 +94.3 4 +94.4 6 +94.5 4 +94.6 4 +94.7 2 +94.8 2 +94.9 1 +95 4 +95.1 3 +95.2 7 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Fri Jul 6 18:09:44 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 74C421065672 for ; Fri, 6 Jul 2012 18:09:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 06 Jul 2012 18:09:42 +0000 Date: Fri, 06 Jul 2012 18:09:42 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120706180942.74C421065672@hub.freebsd.org> Cc: Subject: socsvn commit: r239053 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2012 18:09:44 -0000 Author: jhagewood Date: Fri Jul 6 18:09:42 2012 New Revision: 239053 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239053 Log: Modified: soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Fri Jul 6 17:42:34 2012 (r239052) +++ soc2012/jhagewood/sdiff/TODO Fri Jul 6 18:09:42 2012 (r239053) @@ -1,7 +1,7 @@ Combine diff-spec args and pipe to diff INCOMPLETE Test script COMPLETE Adapt code to FreeBSD style guidelines INCOMPLETE -Fix --width output indention IN PROGRESS +Fix --width output indention COMPLETE --help COMPLETE Add more information to man file. INCOMPLETE @@ -11,3 +11,16 @@ -FIX: In println(), change column width to width-1, take out extra space when it prints 'div' on no right column. +- diff-specific args: + + -a Treat file1 and file2 as text files. + -b Ignore trailing blank spaces. + -d Minimize diff size. + -I regexp + Ignore line changes matching regexp. All lines in the change + must match regexp for the change to be ignored. + NOTE: Missing ')' on tests. + + -i Do a case-insensitive comparison. + -t Expand tabs to spaces. + -W Ignore all spaces (the -w flag is passed to diff(1)). Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Fri Jul 6 17:42:34 2012 (r239052) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Fri Jul 6 18:09:42 2012 (r239053) @@ -12,16 +12,7 @@ .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 19:48:01.000000000 -0400 -@@ -34,7 +34,7 @@ - #include "common.h" - #include "extern.h" - --#define WIDTH 130 -+#define WIDTH 128 - /* - * Each column must be at least one character wide, plus three - * characters between the columns (space, [<|>], space). ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-06 17:59:33.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -32,8 +23,22 @@ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -137,6 +138,25 @@ static struct option longopts[] = { +@@ -113,7 +114,7 @@ static struct option longopts[] = { + { "left-column", no_argument, NULL, LEFTC_OPT }, + { "suppress-common-lines", no_argument, NULL, 's' }, + { "width", required_argument, NULL, 'w' }, +- { "ignore-all-space", no_argument, NULL, 'W' }, ++ + { "output", required_argument, NULL, 'o' }, + { "diff-program", required_argument, NULL, DIFFPROG_OPT }, +@@ -134,9 +135,29 @@ static struct option longopts[] = { + { "ignore-case", no_argument, NULL, 'i' }, + { "expand-tabs", no_argument, NULL, 't' }, + { "speed-large-files", no_argument, NULL, 'H' }, +- ++ { "ignore-all-space", no_argument, NULL, 'W' }, ++ { NULL, 0, NULL, '\0'} }; + @@ -58,7 +63,25 @@ /* * Create temporary file if source_file is not a regular file. * Returns temporary file name if one was malloced, NULL if unnecessary. -@@ -289,17 +309,17 @@ main(int argc, char **argv) +@@ -247,9 +268,6 @@ main(int argc, char **argv) + case STRIPCR_OPT: + case TSIZE_OPT: + case 'S': +- case 'W': +- for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); +- asprintf(&diffargv[diffargc++], "%s", popt->name ); + break; + + /* combine no-arg single switches */ +@@ -261,6 +279,7 @@ main(int argc, char **argv) + case 'i': + case 't': + case 'H': ++ case 'W': + for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); + diffargv[1] = realloc( diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2 ); + sprintf(diffargv[1], "%s%c", diffargv[1], ch); +@@ -289,17 +308,17 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; @@ -80,7 +103,7 @@ default: usage(); break; -@@ -363,7 +383,7 @@ main(int argc, char **argv) +@@ -363,11 +382,11 @@ main(int argc, char **argv) diffargv[diffargc++] = NULL; /* Subtract column divider and divide by two. */ @@ -89,7 +112,12 @@ /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); -@@ -383,7 +403,6 @@ main(int argc, char **argv) +- line_width = width * 2 + 3; ++ line_width = ((width + 3) * 2); + + if( ppid == -1 ) + { +@@ -383,7 +402,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); @@ -97,7 +125,7 @@ execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; -@@ -1117,10 +1136,8 @@ int_usage(void) +@@ -1117,10 +1135,8 @@ int_usage(void) static void usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Fri Jul 6 17:42:34 2012 (r239052) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Fri Jul 6 18:09:42 2012 (r239053) @@ -34,7 +34,7 @@ #include "common.h" #include "extern.h" -#define WIDTH 128 +#define WIDTH 130 /* * Each column must be at least one character wide, plus three * characters between the columns (space, [<|>], space). @@ -114,7 +114,7 @@ { "left-column", no_argument, NULL, LEFTC_OPT }, { "suppress-common-lines", no_argument, NULL, 's' }, { "width", required_argument, NULL, 'w' }, - { "ignore-all-space", no_argument, NULL, 'W' }, + { "output", required_argument, NULL, 'o' }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, @@ -135,7 +135,8 @@ { "ignore-case", no_argument, NULL, 'i' }, { "expand-tabs", no_argument, NULL, 't' }, { "speed-large-files", no_argument, NULL, 'H' }, - + { "ignore-all-space", no_argument, NULL, 'W' }, + { NULL, 0, NULL, '\0'} }; @@ -267,9 +268,6 @@ case STRIPCR_OPT: case TSIZE_OPT: case 'S': - case 'W': - for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); - asprintf(&diffargv[diffargc++], "%s", popt->name ); break; /* combine no-arg single switches */ @@ -281,6 +279,7 @@ case 'i': case 't': case 'H': + case 'W': for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); diffargv[1] = realloc( diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2 ); sprintf(diffargv[1], "%s%c", diffargv[1], ch); @@ -387,7 +386,7 @@ /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); - line_width = width * 2 + 3; + line_width = ((width + 3) * 2); if( ppid == -1 ) { From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 01:08:00 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5B95A106564A for ; Sat, 7 Jul 2012 01:07:58 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 01:07:58 +0000 Date: Sat, 07 Jul 2012 01:07:58 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707010758.5B95A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239061 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 01:08:00 -0000 Author: jhagewood Date: Sat Jul 7 01:07:58 2012 New Revision: 239061 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239061 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 00:25:17 2012 (r239060) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:07:58 2012 (r239061) @@ -12,7 +12,7 @@ .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-06 17:59:33.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:03:06.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -63,7 +63,14 @@ /* * Create temporary file if source_file is not a regular file. * Returns temporary file name if one was malloced, NULL if unnecessary. -@@ -247,9 +268,6 @@ main(int argc, char **argv) +@@ -240,18 +261,13 @@ main(int argc, char **argv) + const char *errstr; + + switch (ch) { +- + /* only compatible --long-name-form with diff */ + case FCASE_IGNORE_OPT: + case FCASE_SENSITIVE_OPT: case STRIPCR_OPT: case TSIZE_OPT: case 'S': @@ -71,17 +78,25 @@ - for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); - asprintf(&diffargv[diffargc++], "%s", popt->name ); break; - +- /* combine no-arg single switches */ -@@ -261,6 +279,7 @@ main(int argc, char **argv) + case 'a': + case 'B': +@@ -261,11 +277,11 @@ main(int argc, char **argv) case 'i': case 't': case 'H': + case 'W': for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); - diffargv[1] = realloc( diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2 ); +- diffargv[1] = realloc( diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2 ); ++ diffargv[1] = realloc(diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2); sprintf(diffargv[1], "%s%c", diffargv[1], ch); -@@ -289,17 +308,17 @@ main(int argc, char **argv) + break; +- + case DIFFPROG_OPT: + diffargv[0] = diffprog = optarg; + break; +@@ -289,26 +305,23 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; @@ -103,11 +118,23 @@ default: usage(); break; -@@ -363,11 +382,11 @@ main(int argc, char **argv) + } +- +- +- + } +- ++ + /* no single switches were used */ + if( strcmp( diffargv[1], "-" ) == 0 ) + { +@@ -362,19 +375,19 @@ main(int argc, char **argv) + /* Add NULL to end of array to indicate end of array. */ diffargv[diffargc++] = NULL; - /* Subtract column divider and divide by two. */ +- /* Subtract column divider and divide by two. */ - width = (wflag - 3) / 2; ++ /* Subtract column divider, divide by two, subtract 2. */ + width = ((wflag - 3) / 2) - 2; /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) @@ -115,9 +142,18 @@ - line_width = width * 2 + 3; + line_width = ((width + 3) * 2); - if( ppid == -1 ) +- if( ppid == -1 ) ++ if (ppid == -1 ) { -@@ -383,7 +402,6 @@ main(int argc, char **argv) + if (pipe(fd)) + err(2, "pipe"); + +- switch(pid = fork()) { ++ switch (pid = fork()) { + case 0: + /* child */ + /* We don't read from the pipe. */ +@@ -383,7 +396,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); @@ -125,7 +161,42 @@ execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; -@@ -1117,10 +1135,8 @@ int_usage(void) +@@ -461,6 +473,7 @@ main(int argc, char **argv) + static void + printcol(const char *s, size_t *col, const size_t col_max) + { ++ + for (; *s && *col < col_max; ++s) { + size_t new_col; + +@@ -484,11 +497,9 @@ printcol(const char *s, size_t *col, con + return; + *col = new_col; + break; +- + default: + ++(*col); + } +- + putchar(*s); + } + } +@@ -527,13 +538,12 @@ prompt(const char *s1, const char *s2) + /* Choose left column as-is. */ + if (s1 != NULL) + fprintf(outfp, "%s\n", s1); +- + /* End of command parsing. */ + break; + + case 'q': + goto QUIT; +- ++ + case 'r': + case '2': + /* Choose right column as-is. */ +@@ -1117,10 +1127,8 @@ int_usage(void) static void usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 00:25:17 2012 (r239060) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:07:58 2012 (r239061) @@ -261,7 +261,6 @@ const char *errstr; switch (ch) { - /* only compatible --long-name-form with diff */ case FCASE_IGNORE_OPT: case FCASE_SENSITIVE_OPT: @@ -269,7 +268,6 @@ case TSIZE_OPT: case 'S': break; - /* combine no-arg single switches */ case 'a': case 'B': @@ -281,10 +279,9 @@ case 'H': case 'W': for(popt = longopts; ch != popt->val && popt->name != NULL; popt++); - diffargv[1] = realloc( diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2 ); + diffargv[1] = realloc(diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2); sprintf(diffargv[1], "%s%c", diffargv[1], ch); break; - case DIFFPROG_OPT: diffargv[0] = diffprog = optarg; break; @@ -323,11 +320,8 @@ usage(); break; } - - - } - + /* no single switches were used */ if( strcmp( diffargv[1], "-" ) == 0 ) { @@ -381,19 +375,19 @@ /* Add NULL to end of array to indicate end of array. */ diffargv[diffargc++] = NULL; - /* Subtract column divider and divide by two. */ + /* Subtract column divider, divide by two, subtract 2. */ width = ((wflag - 3) / 2) - 2; /* Make sure line_width can fit in size_t. */ if (width > (SIZE_MAX - 3) / 2) errx(2, "width is too large: %zu", width); line_width = ((width + 3) * 2); - if( ppid == -1 ) + if (ppid == -1 ) { if (pipe(fd)) err(2, "pipe"); - switch(pid = fork()) { + switch (pid = fork()) { case 0: /* child */ /* We don't read from the pipe. */ @@ -479,6 +473,7 @@ static void printcol(const char *s, size_t *col, const size_t col_max) { + for (; *s && *col < col_max; ++s) { size_t new_col; @@ -502,11 +497,9 @@ return; *col = new_col; break; - default: ++(*col); } - putchar(*s); } } @@ -545,13 +538,12 @@ /* Choose left column as-is. */ if (s1 != NULL) fprintf(outfp, "%s\n", s1); - /* End of command parsing. */ break; case 'q': goto QUIT; - + case 'r': case '2': /* Choose right column as-is. */ From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 01:11:01 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 79913106566C for ; Sat, 7 Jul 2012 01:10:59 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 01:10:59 +0000 Date: Sat, 07 Jul 2012 01:10:59 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707011100.79913106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r239062 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 01:11:01 -0000 Author: jhagewood Date: Sat Jul 7 01:10:59 2012 New Revision: 239062 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239062 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:07:58 2012 (r239061) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:10:59 2012 (r239062) @@ -12,7 +12,7 @@ .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:03:06.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:10:58.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -196,7 +196,29 @@ case 'r': case '2': /* Choose right column as-is. */ -@@ -1117,10 +1127,8 @@ int_usage(void) +@@ -1103,24 +1113,22 @@ printd(FILE *file1, size_t file1end) + static void + int_usage(void) + { +- puts("e:\tedit blank diff\n" +- "eb:\tedit both diffs concatenated\n" +- "el:\tedit left diff\n" +- "er:\tedit right diff\n" +- "l | 1:\tchoose left diff\n" +- "r | 2:\tchoose right diff\n" +- "s:\tsilent mode--don't print identical lines\n" +- "v:\tverbose mode--print identical lines\n" ++ printf("%s", "e:\tedit blank diff\n", ++ "eb:\tedit both diffs concatenated\n", ++ "el:\tedit left diff\n", ++ "er:\tedit right diff\n", ++ "l | 1:\tchoose left diff\n", ++ "r | 2:\tchoose right diff\n", ++ "s:\tsilent mode--don't print identical lines\n", ++ "v:\tverbose mode--print identical lines\n", + "q:\tquit"); + } + static void usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:07:58 2012 (r239061) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:10:59 2012 (r239062) @@ -1113,14 +1113,14 @@ static void int_usage(void) { - puts("e:\tedit blank diff\n" - "eb:\tedit both diffs concatenated\n" - "el:\tedit left diff\n" - "er:\tedit right diff\n" - "l | 1:\tchoose left diff\n" - "r | 2:\tchoose right diff\n" - "s:\tsilent mode--don't print identical lines\n" - "v:\tverbose mode--print identical lines\n" + printf("%s", "e:\tedit blank diff\n", + "eb:\tedit both diffs concatenated\n", + "el:\tedit left diff\n", + "er:\tedit right diff\n", + "l | 1:\tchoose left diff\n", + "r | 2:\tchoose right diff\n", + "s:\tsilent mode--don't print identical lines\n", + "v:\tverbose mode--print identical lines\n", "q:\tquit"); } From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 01:26:55 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 89E521065677 for ; Sat, 7 Jul 2012 01:26:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 01:26:53 +0000 Date: Sat, 07 Jul 2012 01:26:53 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707012653.89E521065677@hub.freebsd.org> Cc: Subject: socsvn commit: r239063 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 01:26:55 -0000 Author: jhagewood Date: Sat Jul 7 01:26:52 2012 New Revision: 239063 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239063 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:10:59 2012 (r239062) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:26:52 2012 (r239063) @@ -12,7 +12,7 @@ .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:10:58.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:25:58.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -181,7 +181,7 @@ putchar(*s); } } -@@ -527,13 +538,12 @@ prompt(const char *s1, const char *s2) +@@ -527,13 +538,13 @@ prompt(const char *s1, const char *s2) /* Choose left column as-is. */ if (s1 != NULL) fprintf(outfp, "%s\n", s1); @@ -190,13 +190,24 @@ break; case 'q': - goto QUIT; +- goto QUIT; - ++ fclose(outfp); ++ exit(0); + case 'r': case '2': /* Choose right column as-is. */ -@@ -1103,24 +1113,22 @@ printd(FILE *file1, size_t file1end) +@@ -570,7 +581,7 @@ PROMPT: + * If there was no error, we received an EOF from stdin, so we + * should quit. + */ +-QUIT: ++ + fclose(outfp); + exit(0); + } +@@ -1103,24 +1114,22 @@ printd(FILE *file1, size_t file1end) static void int_usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:10:59 2012 (r239062) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:26:52 2012 (r239063) @@ -542,7 +542,8 @@ break; case 'q': - goto QUIT; + fclose(outfp); + exit(0); case 'r': case '2': @@ -580,7 +581,7 @@ * If there was no error, we received an EOF from stdin, so we * should quit. */ -QUIT: + fclose(outfp); exit(0); } From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 01:31:25 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9EFCC106564A for ; Sat, 7 Jul 2012 01:31:24 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 01:31:24 +0000 Date: Sat, 07 Jul 2012 01:31:24 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707013124.9EFCC106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239064 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 01:31:25 -0000 Author: jhagewood Date: Sat Jul 7 01:31:24 2012 New Revision: 239064 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239064 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:26:52 2012 (r239063) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 01:31:24 2012 (r239064) @@ -12,7 +12,7 @@ .Sh NAME diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:25:58.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 01:31:20.000000000 -0400 @@ -101,7 +101,8 @@ enum { HLINES_OPT, LFILES_OPT, @@ -181,24 +181,40 @@ putchar(*s); } } -@@ -527,13 +538,13 @@ prompt(const char *s1, const char *s2) +@@ -527,30 +538,24 @@ prompt(const char *s1, const char *s2) /* Choose left column as-is. */ if (s1 != NULL) fprintf(outfp, "%s\n", s1); - /* End of command parsing. */ break; - +- case 'q': - goto QUIT; - + fclose(outfp); + exit(0); -+ case 'r': case '2': /* Choose right column as-is. */ -@@ -570,7 +581,7 @@ PROMPT: + if (s2 != NULL) + fprintf(outfp, "%s\n", s2); +- + /* End of command parsing. */ + break; +- + case 's': + sflag = 1; + goto PROMPT; +- + case 'v': + sflag = 0; + /* FALLTHROUGH */ +- + default: + /* Interactive usage help. */ + USAGE: +@@ -570,7 +575,7 @@ PROMPT: * If there was no error, we received an EOF from stdin, so we * should quit. */ @@ -207,7 +223,7 @@ fclose(outfp); exit(0); } -@@ -1103,24 +1114,22 @@ printd(FILE *file1, size_t file1end) +@@ -1103,24 +1108,22 @@ printd(FILE *file1, size_t file1end) static void int_usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:26:52 2012 (r239063) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 01:31:24 2012 (r239064) @@ -540,28 +540,22 @@ fprintf(outfp, "%s\n", s1); /* End of command parsing. */ break; - case 'q': fclose(outfp); exit(0); - case 'r': case '2': /* Choose right column as-is. */ if (s2 != NULL) fprintf(outfp, "%s\n", s2); - /* End of command parsing. */ break; - case 's': sflag = 1; goto PROMPT; - case 'v': sflag = 0; /* FALLTHROUGH */ - default: /* Interactive usage help. */ USAGE: From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 15:55:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F32CA106564A for ; Sat, 7 Jul 2012 15:55:04 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 15:55:04 +0000 Date: Sat, 07 Jul 2012 15:55:04 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707155504.F32CA106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239076 - soc2012/rudot/benchmarking/virtual/buildworld/60pct X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 15:55:06 -0000 Author: rudot Date: Sat Jul 7 15:55:03 2012 New Revision: 239076 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239076 Log: benchmark make buildworld - limit 60pct Added: soc2012/rudot/benchmarking/virtual/buildworld/60pct/ soc2012/rudot/benchmarking/virtual/buildworld/60pct/dataSorted.txt soc2012/rudot/benchmarking/virtual/buildworld/60pct/plot.eps (contents, props changed) Added: soc2012/rudot/benchmarking/virtual/buildworld/60pct/dataSorted.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/benchmarking/virtual/buildworld/60pct/dataSorted.txt Sat Jul 7 15:55:03 2012 (r239076) @@ -0,0 +1,650 @@ +0.2 58 +0.3 61 +0.4 53 +0.5 57 +0.6 52 +0.7 43 +0.8 40 +0.9 35 +1 42 +1.1 31 +1.2 38 +1.3 41 +1.4 22 +1.5 26 +1.6 29 +1.7 21 +1.8 34 +1.9 22 +2 16 +2.1 20 +2.2 23 +2.3 19 +2.4 21 +2.5 13 +2.6 15 +2.7 19 +2.8 12 +2.9 14 +3 30 +3.1 15 +3.2 24 +3.3 10 +3.4 8 +3.5 18 +3.6 9 +3.7 6 +3.8 12 +3.9 12 +4 20 +4.1 12 +4.2 14 +4.3 18 +4.4 3 +4.5 2 +4.6 18 +4.7 3 +4.8 9 +4.9 6 +5 9 +5.1 19 +5.2 3 +5.3 14 +5.4 3 +5.5 7 +5.6 12 +5.7 7 +5.8 4 +5.9 4 +6 18 +6.1 5 +6.2 11 +6.3 9 +6.4 2 +6.5 3 +6.6 5 +6.7 12 +6.8 5 +6.9 1 +7 10 +7.1 6 +7.2 9 +7.3 8 +7.4 7 +7.5 1 +7.6 1 +7.7 8 +7.8 3 +7.9 7 +8 12 +8.1 3 +8.2 11 +8.3 3 +8.4 4 +8.5 3 +8.6 1 +8.7 5 +8.8 4 +8.9 5 +9 15 +9.1 3 +9.2 8 +9.3 4 +9.4 5 +9.5 4 +9.6 4 +9.7 7 +9.8 3 +9.9 1 +10 20 +10.1 2 +10.2 2 +10.3 3 +10.4 2 +10.5 5 +10.6 3 +10.7 2 +10.8 4 +10.9 2 +11 32 +11.1 2 +11.2 5 +11.3 9 +11.4 2 +11.5 3 +11.6 3 +11.7 2 +11.8 6 +11.9 4 +12 35 +12.1 4 +12.2 2 +12.3 4 +12.4 4 +12.6 2 +12.7 4 +12.8 4 +12.9 1 +13 31 +13.1 2 +13.2 1 +13.3 8 +13.4 2 +13.5 1 +13.7 2 +13.8 2 +13.9 2 +14 25 +14.1 1 +14.2 1 +14.3 2 +14.4 5 +14.5 1 +14.6 1 +14.7 2 +14.9 5 +15 17 +15.1 3 +15.2 2 +15.3 2 +15.5 1 +15.6 1 +15.8 1 +15.9 1 +16 8 +16.1 1 +16.2 1 +16.3 1 +16.4 1 +16.5 3 +16.6 3 +16.7 1 +16.9 4 +17 7 +17.1 1 +17.2 2 +17.3 1 +17.4 3 +17.6 2 +17.9 3 +18 6 +18.2 3 +18.5 2 +18.6 3 +18.7 1 +18.8 1 +19 5 +19.1 2 +19.3 1 +19.4 3 +19.5 2 +19.6 1 +19.7 2 +19.9 1 +20 12 +20.2 1 +20.3 1 +20.4 2 +20.5 1 +20.6 2 +20.7 1 +21 8 +21.2 2 +21.3 1 +21.4 2 +21.5 1 +21.6 2 +21.8 1 +21.9 1 +22 8 +22.1 3 +22.3 1 +22.6 1 +22.9 1 +23 10 +23.1 1 +23.2 1 +23.4 1 +23.8 1 +23.9 1 +24 7 +24.1 1 +24.2 2 +24.7 1 +24.8 1 +25 10 +25.1 1 +25.2 1 +25.7 1 +25.9 1 +26 9 +26.1 1 +26.3 1 +26.6 2 +26.8 3 +26.9 2 +27 4 +27.1 1 +27.2 1 +27.3 1 +27.8 1 +28 2 +28.3 2 +28.5 3 +28.8 3 +29 4 +29.1 1 +29.4 1 +29.6 1 +29.9 1 +30 2 +30.1 1 +30.2 2 +30.4 2 +30.6 2 +30.7 1 +30.8 1 +30.9 1 +30.9 1 +31 1 +31.1 2 +31.2 3 +31.3 1 +31.7 1 +31.8 1 +32 4 +32.1 1 +32.3 1 +32.6 4 +32.7 1 +32.9 2 +33 5 +33.1 1 +33.2 1 +33.3 2 +33.5 1 +33.6 3 +33.7 1 +33.8 1 +33.9 2 +34 3 +34.1 1 +34.3 2 +34.4 4 +34.5 3 +34.6 2 +34.7 2 +34.8 2 +34.9 1 +35 6 +35.1 1 +35.2 2 +35.3 3 +35.4 3 +35.5 5 +35.6 1 +35.7 3 +35.8 5 +35.9 1 +36 2 +36.1 4 +36.2 3 +36.3 5 +36.6 5 +36.7 2 +36.8 8 +36.9 2 +37 3 +37.1 2 +37.2 4 +37.3 1 +37.4 1 +37.5 4 +37.6 1 +37.7 2 +37.8 3 +37.9 8 +38 3 +38.1 2 +38.2 4 +38.3 3 +38.4 1 +38.5 6 +38.6 3 +38.7 6 +38.8 6 +38.9 2 +39 1 +39 1 +39.2 4 +39.3 4 +39.4 3 +39.5 5 +39.6 7 +39.7 4 +39.8 5 +39.9 4 +40 7 +40.1 3 +40.2 1 +40.3 10 +40.4 2 +40.5 4 +40.6 3 +40.7 3 +40.8 4 +40.9 6 +41 11 +41.1 2 +41.2 3 +41.3 3 +41.4 14 +41.5 8 +41.6 5 +41.7 14 +41.8 3 +41.9 4 +42 6 +42.1 18 +42.2 5 +42.3 5 +42.4 3 +42.5 10 +42.6 2 +42.7 3 +42.8 13 +42.9 2 +43 8 +43.1 13 +43.2 7 +43.3 9 +43.4 7 +43.5 11 +43.6 7 +43.7 1 +43.8 10 +43.9 9 +44 6 +44.1 9 +44.2 6 +44.3 3 +44.4 5 +44.5 3 +44.6 6 +44.7 4 +44.8 7 +44.9 13 +45 6 +45.1 8 +45.2 12 +45.3 4 +45.4 4 +45.5 7 +45.6 11 +45.7 13 +45.8 3 +45.9 5 +46 8 +46.1 8 +46.2 5 +46.3 11 +46.4 3 +46.5 6 +46.6 12 +46.7 6 +46.8 2 +46.9 4 +47 12 +47.1 3 +47.2 6 +47.3 11 +47.4 12 +47.5 9 +47.6 15 +47.7 8 +47.8 5 +47.9 7 +48 10 +48.1 8 +48.2 8 +48.3 9 +48.4 7 +48.5 7 +48.6 6 +48.7 16 +48.8 11 +48.9 3 +49 7 +49.1 7 +49.2 13 +49.3 3 +49.4 9 +49.5 7 +49.6 6 +49.7 6 +49.8 21 +49.9 16 +50 11 +50.1 15 +50.2 9 +50.3 6 +50.4 3 +50.5 13 +50.6 10 +50.7 9 +50.8 8 +50.9 10 +51 9 +51.1 8 +51.2 11 +51.3 7 +51.4 13 +51.5 6 +51.6 6 +51.7 13 +51.8 14 +51.9 10 +52 12 +52.1 7 +52.2 5 +52.3 20 +52.4 8 +52.5 12 +52.6 12 +52.7 14 +52.8 14 +52.9 12 +53 15 +53.1 16 +53.2 4 +53.3 13 +53.4 15 +53.5 5 +53.6 17 +53.7 17 +53.8 10 +53.9 12 +54 11 +54.1 10 +54.2 14 +54.3 11 +54.4 10 +54.5 16 +54.6 11 +54.7 9 +54.8 8 +54.9 11 +55 11 +55.1 10 +55.2 15 +55.3 12 +55.4 11 +55.5 12 +55.6 17 +55.7 9 +55.8 14 +55.9 10 +56 15 +56.1 9 +56.2 17 +56.3 11 +56.4 13 +56.5 17 +56.6 9 +56.7 11 +56.8 18 +56.9 17 +57 18 +57.1 18 +57.2 13 +57.3 10 +57.4 14 +57.5 13 +57.6 9 +57.7 10 +57.8 18 +57.9 8 +58 20 +58.1 16 +58.2 9 +58.3 18 +58.4 22 +58.5 12 +58.6 11 +58.7 20 +58.8 14 +58.9 16 +59 16 +59.1 13 +59.2 12 +59.3 7 +59.4 9 +59.5 12 +59.6 11 +59.7 9 +59.8 10 +59.9 8 +60 17 +60.1 14 +60.2 10 +60.3 11 +60.4 10 +60.5 13 +60.6 5 +60.7 12 +60.8 10 +60.9 5 +61 16 +61.1 5 +61.2 1 +61.3 4 +61.5 2 +61.6 4 +61.7 2 +62 3 +62.1 2 +62.4 1 +62.6 2 +62.8 1 +62.9 3 +63 4 +63.1 1 +63.2 1 +63.4 1 +63.5 2 +63.7 1 +63.8 1 +64 2 +64.1 1 +64.2 1 +64.3 1 +64.4 1 +64.5 1 +64.6 1 +64.7 1 +65 3 +65.2 2 +65.3 1 +65.5 1 +65.6 1 +65.8 2 +66 2 +67 2 +67.2 2 +67.3 1 +68 1 +68.8 1 +69 3 +70 3 +70.1 1 +71 5 +73 3 +74 1 +74 1 +75.1 1 +75.5 2 +76 1 +76.1 1 +77 4 +78 4 +78.8 1 +79 1 +79.1 1 +80.2 1 +80.9 1 +81 4 +81.7 1 +82.6 1 +83 3 +83.3 1 +83.4 1 +84 4 +84.4 1 +85 3 +85.5 1 +85.8 1 +86 3 +86.6 1 +87 3 +87.1 1 +88 5 +88.3 1 +89 1 +89.3 1 +89.7 1 +90 1 +90.3 1 +91 3 +91.1 1 +91.6 1 +92 4 +92.3 1 +94 3 +95 2 +97 1 +97.4 1 +99 1 +99.2 1 +100 1 +102.2 2 +103.1 1 +104 1 +106 2 +120 1 +120.8 1 +122 1 +125.1 1 +126.3 1 +137 1 +146 1 +147 1 +148.6 1 +149 1 +150 1 +159 1 +163.1 1 +164 1 +167 1 +169 1 +173 1 +184.7 1 Added: soc2012/rudot/benchmarking/virtual/buildworld/60pct/plot.eps ============================================================================== Binary file. No diff available. From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 19:34:54 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C7EB8106564A for ; Sat, 7 Jul 2012 19:34:52 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 19:34:52 +0000 Date: Sat, 07 Jul 2012 19:34:52 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707193452.C7EB8106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239092 - in soc2012/jhagewood: diff diff3 mdocml sdiff sdiff/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 19:34:55 -0000 Author: jhagewood Date: Sat Jul 7 19:34:52 2012 New Revision: 239092 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239092 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.1 Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 18:25:56 2012 (r239091) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 19:34:52 2012 (r239092) @@ -1,6 +1,1589 @@ +diff -rupN jhagewood/diff/diff-orig/.svn/all-wcprops jhagewood/diff/diff/.svn/all-wcprops +--- jhagewood/diff/diff-orig/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 +@@ -1,59 +1,59 @@ + K 25 + svn:wc:ra_dav:version-url +-V 56 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig ++V 51 ++/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff + END + diff.1.gz + K 25 + svn:wc:ra_dav:version-url +-V 66 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1.gz ++V 61 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1.gz + END + pathnames.h + K 25 + svn:wc:ra_dav:version-url +-V 68 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/pathnames.h ++V 63 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/pathnames.h + END + diff.1 + K 25 + svn:wc:ra_dav:version-url +-V 63 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1 ++V 58 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1 + END + diffreg.c + K 25 + svn:wc:ra_dav:version-url +-V 66 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffreg.c ++V 61 ++/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff/diffreg.c + END + diff + K 25 + svn:wc:ra_dav:version-url +-V 61 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff ++V 56 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff + END + diffdir.c + K 25 + svn:wc:ra_dav:version-url +-V 66 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffdir.c ++V 61 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diffdir.c + END + diff.c + K 25 + svn:wc:ra_dav:version-url +-V 63 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.c ++V 58 ++/socsvn/!svn/ver/239007/soc2012/jhagewood/diff/diff/diff.c + END + Makefile + K 25 + svn:wc:ra_dav:version-url +-V 65 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/Makefile ++V 60 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/Makefile + END + diff.h + K 25 + svn:wc:ra_dav:version-url +-V 63 +-/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.h ++V 58 ++/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.h + END +diff -rupN jhagewood/diff/diff-orig/.svn/entries jhagewood/diff/diff/.svn/entries +--- jhagewood/diff/diff-orig/.svn/entries 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/entries 2012-07-07 14:53:51.000000000 -0400 +@@ -2,13 +2,13 @@ + + dir + 239088 +-https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff-orig ++https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff + https://socsvn.freebsd.org/socsvn + + + +-2012-07-02T14:59:21.494992Z +-238807 ++2012-07-06T17:31:27.428691Z ++239048 + jhagewood + + +@@ -67,7 +67,7 @@ file + + + 2012-07-07T18:53:51.000000Z +-5a0333c769b4cd0b56d0183979c3c3da ++02e0e4002578433745dc1989cde68db3 + 2012-07-02T14:59:21.494992Z + 238807 + jhagewood +@@ -92,7 +92,7 @@ jhagewood + + + +-1173 ++1208 + + diff.1 + file +@@ -135,9 +135,9 @@ file + + + 2012-07-07T18:53:51.000000Z +-41390d52e706fd5ff89e5139b1a3992a +-2012-07-02T14:59:21.494992Z +-238807 ++360e792dce77ba35267246e878158613 ++2012-07-06T17:31:27.428691Z ++239048 + jhagewood + + +@@ -160,7 +160,7 @@ jhagewood + + + +-38935 ++40791 + + diff + file +@@ -203,7 +203,7 @@ file + + + 2012-07-07T18:53:51.000000Z +-28bd85291f636c13f457cda2ec9e2168 ++44a983d6f3f06103b3210dc9799dc9aa + 2012-07-02T14:59:21.494992Z + 238807 + jhagewood +@@ -228,7 +228,7 @@ jhagewood + + + +-8385 ++8360 + + diff.c + file +@@ -237,9 +237,9 @@ file + + + 2012-07-07T18:53:51.000000Z +-5c74db6e58594c5d345aa050fcda44ae +-2012-07-02T14:59:21.494992Z +-238807 ++060bb447cdcbd060f328603bc0595a90 ++2012-07-05T18:13:06.636166Z ++239007 + jhagewood + + +@@ -262,7 +262,7 @@ jhagewood + + + +-14455 ++18176 + + Makefile + file +@@ -305,7 +305,7 @@ file + + + 2012-07-07T18:53:51.000000Z +-eab9e28aee9d963655a25372ef2f2657 ++f389a5742640cda8b39f75a4cda31197 + 2012-07-02T14:59:21.494992Z + 238807 + jhagewood +@@ -330,5 +330,5 @@ jhagewood + + + +-3738 ++3852 + +diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base jhagewood/diff/diff/.svn/text-base/diff.c.svn-base +--- jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 +@@ -1,4 +1,4 @@ +-/*- ++/* + * Copyright (c) 2003 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any +@@ -18,15 +18,13 @@ + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +-#include +- +-#ifndef lint + #if 0 +-__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); +-#else +-__FBSDID("$FreeBSD$"); ++#ifndef lint ++static char sccsid[] = "@(#)diff.c 8.1 (Berkeley) 6/6/93"; + #endif + #endif /* not lint */ ++#include ++__FBSDID("$FreeBSD$"); + + #include + #include +@@ -45,20 +43,20 @@ __FBSDID("$FreeBSD$"); + #include "diff.h" + #include "pathnames.h" + +-int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; +-int sflag, tflag, Tflag, wflag; +-int Bflag, yflag; +-int strip_cr, tabsize=8; +-char ignore_file_case = 0; +-int format, context, status; +-char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; ++int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; ++int sflag, tflag, Tflag, wflag, Toflag, Fromflag; ++int Bflag, yflag; ++int strip_cr, suppress_cl, tabsize = 8; ++char ignore_file_case = 0; ++int format, context, status; ++char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format; + struct stat stb1, stb2; + struct excludes *excludes_list; + regex_t ignore_re; + + int flag_opts = 0; + +-#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" ++#define OPTIONS "0123456789aBbC:cdD:EefhI:iL:lnNPpqrS:sTtU:uvwXy:x" + + + /* Options which exceed manageable alphanumeric assignments */ +@@ -69,84 +67,129 @@ enum + OPT_STRIPCR, + OPT_NORMAL, + OPT_LEFTC, +- OT_SUPCL, +- OPT_GTYPE, ++ OPT_SUPCL, ++ OPT_CHGD_GF, ++ OPT_NEW_GF, ++ OPT_OLD_GF, ++ OPT_UNCHGD_GF, + OPT_LF, + OPT_LLF, + OPT_TSIZE, +- OPT_UNINF, + OPT_FFILE, + OPT_TOFILE, + OPT_HLINES, + OPT_LFILES, + OPT_HELP, ++ OPT_NEW_LF, ++ OPT_OLD_LF, ++ OPT_UNCHGD_LF, + }; + + + static struct option longopts[] = { +-/* XXX: UNIMPLEMENTED +- { "normal", no_argument, NULL, OPT_NORMAL }, +- { "left-column", no_argument, NULL, OPT_LEFTC }, +- { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, +- { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, +- { "line-format", required_argument, NULL, OPT_LF }, +- { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, +- { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, +- { "from-file", required_argument, NULL, OPT_FFILE }, +- { "to-file", required_argument, NULL, OPT_TOFILE }, +- { "horizon-lines", required_argument, NULL, OPT_HLINES }, +- { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ +- { "tabsize", optional_argument, NULL, OPT_TSIZE }, +- { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, +- { "help", no_argument, NULL, OPT_HELP }, +- { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, +- { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, +- { "text", no_argument, NULL, 'a' }, +-/* XXX: UNIMPLEMENTED */ +- { "ignore-blank-lines", no_argument, NULL, 'B' }, +- { "ignore-space-change", no_argument, NULL, 'b' }, +-/* XXX: -c is incompatible with GNU version */ ++ ++ /* ++ * Commented-out options are unimplemented. ++ */ ++ ++ { "brief", no_argument, NULL, 'q' }, ++ { "changed-group-format", required_argument, NULL, OPT_CHGD_GF}, + { "context", optional_argument, NULL, 'C' }, +- { "ifdef", required_argument, NULL, 'D' }, +- { "minimal", no_argument, NULL, 'd' }, +-/* XXX: UNIMPLEMENTED +- { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ + { "ed", no_argument, NULL, 'e' }, +-/* XXX: UNIMPLEMENTED +- { "show-function-line", required_argument, NULL, 'F' }, */ ++ { "exclude", required_argument, NULL, 'x' }, ++ { "exclude-from", required_argument, NULL, 'X' }, ++ { "expand-tabs", no_argument, NULL, 't' }, ++ { "from-file", required_argument, NULL, OPT_FFILE }, + { "forward-ed", no_argument, NULL, 'f' }, ++ { "help", no_argument, NULL, OPT_HELP }, ++ /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ ++ { "ifdef", required_argument, NULL, 'D' }, ++ { "ignore-all-space", no_argument, NULL, 'W' }, ++ { "ignore-blank-lines", no_argument, NULL, 'B' }, ++ { "ignore-case", no_argument, NULL, 'i' }, ++ { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "ignore-matching-lines", required_argument, NULL, 'I' }, +- { "ignore-case", no_argument, NULL, 'i' }, ++ { "ignore-space-change", no_argument, NULL, 'b' }, ++ { "ignore-tab-expansion", no_argument, NULL, 'E' }, ++ { "initial-tab", no_argument, NULL, 'T' }, + { "label", required_argument, NULL, 'L' }, +- { "paginate", no_argument, NULL, 'l' }, ++ { "left-column", no_argument, NULL, OPT_LEFTC }, ++ { "line-format", required_argument, NULL, OPT_LF }, ++ { "minimal", no_argument, NULL, 'd' }, + { "new-file", no_argument, NULL, 'N' }, +- { "rcs", no_argument, NULL, 'n' }, +- { "unidirectional-new-file", no_argument, NULL, 'P' }, +- { "show-c-function", no_argument, NULL, 'p' }, +- { "brief", no_argument, NULL, 'q' }, ++ { "new-line-format", required_argument, NULL, OPT_NEW_LF}, ++ { "new-group-format", required_argument, NULL, OPT_NEW_GF}, ++ { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, ++ { "normal", no_argument, NULL, OPT_NORMAL }, ++ { "old-line-format", required_argument, NULL, OPT_OLD_LF}, ++ { "old-group-format", required_argument, NULL, OPT_OLD_GF}, ++ { "paginate", no_argument, NULL, 'l' }, + { "recursive", no_argument, NULL, 'r' }, +- { "starting-file", required_argument, NULL, 'S' }, + { "report-identical-files", no_argument, NULL, 's' }, +- { "initial-tab", no_argument, NULL, 'T' }, +- { "expand-tabs", no_argument, NULL, 't' }, +-/* XXX: -u is incompatible with GNU version */ ++ { "rcs", no_argument, NULL, 'n' }, ++ { "show-c-function", no_argument, NULL, 'p' }, ++ { "show-function-line", required_argument, NULL, 'F' }, ++ { "side-by-side", no_argument, NULL, 'y' }, ++ /*{ "speed-large-files", no_argument, NULL, OPT_LFILES }, */ ++ { "starting-file", required_argument, NULL, 'S' }, ++ { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, ++ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, ++ { "tabsize", optional_argument, NULL, OPT_TSIZE }, ++ { "text", no_argument, NULL, 'a' }, ++ { "to-file", required_argument, NULL, OPT_TOFILE }, ++ { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF}, ++ { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, ++ { "unidirectional-new-file", no_argument, NULL, 'P' }, + { "unified", optional_argument, NULL, 'U' }, + { "version", no_argument, NULL, 'v' }, +-/* XXX: UNIMPLEMENTED +- { "width", optional_argument, NULL, 'W' }, */ +- { "ignore-all-space", no_argument, NULL, 'w' }, +- { "exclude-from", required_argument, NULL, 'X' }, +- { "exclude", required_argument, NULL, 'x' }, +- { "side-by-side", no_argument, NULL, 'y' }, ++ /*{ "width", optional_argument, NULL, 'w' }, */ + { NULL, 0, NULL, '\0'} + }; + + static const char *help_msg[] = { +-"-a --text treat files as ASCII text", +-"-B --ignore-blank-lines Ignore blank newlines in the comparison", +-"-b --ignore-space-change Ignore all changes due to whitespace", +-"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", +-"-D --ifdef=NAME", ++"\t-a --text treat files as ASCII text", ++"\t-B --ignore-blank-lines Ignore blank newlines in the comparison", ++"\t-b --ignore-space-change Ignore all changes due to whitespace", ++"\t-C -c NUM --context=NUM Show NUM lines before and after change (default 3)", ++"\t-D --ifdef=NAME Output merged file with `#ifdef NAME' diffs", ++"\t-E --ignore-tab-expansion Ignore tab expansion in the comparison", ++"\t-e --ed Output an ed script", ++"\t-F --show-function-line=RE Show the most recent line matching RE", ++"\t-f --forward-ed Output a forward ed script", ++"\t-I --ignore-matching-lines=RE Ignore changes whose lines all match RE", ++"\t-i --ignore-case Ignore case differences in file contents", ++"\t-L --label=NAME Label file header", ++"\t-l --paginate Paginates output through pr", ++"\t-N --new-file Treat new files as empty", ++"\t-n --rcs Output an RCS format diff", ++"\t-P --unidirectional-new-file Treat absent-first files as empty", ++"\t-p --show-c-function Show which C function each change is in", ++"\t-q --brief report only when files differ", ++"\t-r --recursive Recursively compare any sub-directories found", ++"\t-S --starting-file=FILE Start with FILE when comparing directories", ++"\t-s --report-identical-files Report when two files are the same", ++"\t-T --initial-tab Make tabs line up by prepending a tab", ++"\t-t --expand-tabs Expand tabs to spaces in output", ++"\t-U -u NUM --unified=NUM Show NUM lines of unified context", ++"\t-v --version Show diff version", ++"\t-W --ignore-all-space Ignore all space", ++"\t-w --width=NUM Output at most NUM (default 130) print columns", ++"\t-X --exclude-from=FILE Start with FILE when comparing directories", ++"\t-x --exclude=PAT Exclude files that match PAT", ++"\t-y --side-by-side Output difference in two columns", ++"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", ++"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", ++"\t--from-file=FILE Compare FILE to all operands", ++"\t--to-file=FILE Compare all operands to FILE", ++"\t--ignore-file-name-case Ignore file name case", ++"\t--left-column Output the only the left column of common lines", ++"\t--line-format=LFMT Format all input lines with LFMT", ++"\t--no-ignore-file-name-case Do not ignore file name case", ++"\t--normal Output a normal diff (default output)", ++"\t--strip-trailing-cr Strip trailing carriage return", ++"\t--suppress-common-lines Do not output common lines", ++"\t--tabsize=NUM Tab stops every NUM (default 8) print columns", ++"\t--help Output this help message", + NULL, + }; + char **help_strs = (char **)help_msg; +@@ -162,14 +205,15 @@ void read_excludes_file(char *); + int + main(int argc, char **argv) + { +- char *ep, **oargv; +- long l; +- int ch, lastch, gotstdin, prevoptind, newarg; +- int oargc; +- ++ char *ep, **oargv, *optfile; ++ long l; ++ int ch, lastch, gotstdin, prevoptind, newarg; ++ int oargc; ++ + oargv = argv; + oargc = argc; + gotstdin = 0; ++ optfile = "\0"; + + lastch = '\0'; + prevoptind = 1; +@@ -197,6 +241,7 @@ main(int argc, char **argv) + break; + case 'C': + case 'c': ++ cflag = 1; + format = D_CONTEXT; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); +@@ -213,6 +258,9 @@ main(int argc, char **argv) + case 'd': + dflag = 1; + break; ++ case 'E': ++ Eflag = 1; ++ break; + case 'e': + format = D_EDIT; + break; +@@ -284,7 +332,7 @@ main(int argc, char **argv) + case 'v': + printf("FreeBSD diff 2.8.7\n"); + exit(0); +- case 'w': ++ case 'W': + wflag = 1; + break; + case 'X': +@@ -296,15 +344,48 @@ main(int argc, char **argv) + case 'y': + yflag = 1; + break; ++ case OPT_FFILE: ++ Toflag = 1; ++ optfile = optarg; ++ break; ++ case OPT_TOFILE: ++ Fromflag = 1; ++ optfile = optarg; ++ break; ++ case OPT_CHGD_GF: ++ case OPT_NEW_GF: ++ case OPT_OLD_GF: ++ case OPT_UNCHGD_GF: ++ /* XXX To do: Complete --GTYPE-group-format. */ ++ format = D_GF; ++ group_format = optarg; ++ break; ++ case OPT_NEW_LF: ++ case OPT_OLD_LF: ++ case OPT_UNCHGD_LF: ++ case OPT_LF: ++ /* XXX To do: Complete --line-format. */ ++ format = D_LF; ++ line_format = optarg; ++ break; ++ case OPT_NORMAL: ++ format = D_NORMAL; ++ break; ++ case OPT_LEFTC: ++ /* Do nothing, passes option to sdiff. */ ++ break; ++ case OPT_SUPCL: ++ /* Do nothing, passes option to sdiff. */ ++ break; + case OPT_TSIZE: +- if (optarg != NULL) { +- l = strtol(optarg, &ep, 10); +- if (*ep != '\0' || l < 1 || l >= INT_MAX) +- usage(); +- tabsize = (int)l; +- } else +- tabsize = 8; +- break; ++ if (optarg != NULL) { ++ l = strtol(optarg, &ep, 10); ++ if (*ep != '\0' || l < 1 || l >= INT_MAX) ++ usage(); ++ tabsize = (int)l; ++ } else ++ tabsize = 8; ++ break; + case OPT_STRIPCR: + strip_cr=1; + break; +@@ -315,11 +396,10 @@ main(int argc, char **argv) + ignore_file_case = 0; + break; + case OPT_HELP: +- for(;*help_strs;help_strs++) +- { ++ for (; *help_strs; help_strs++) { + printf("%s\n", *help_strs); + } +- exit(2); ++ exit(0); + break; + default: + usage(); +@@ -328,20 +408,20 @@ main(int argc, char **argv) + lastch = ch; + newarg = optind != prevoptind; + prevoptind = optind; ++ + } + argc -= optind; + argv += optind; +- +- if(yflag) { ++ if (yflag) { + /* remove y flag from args and call sdiff */ +- for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); ++ for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && ++ strcmp(*argv, "--side-by-side") != 0; argv++); + while(argv != &oargv[oargc]){ +- *argv=*(argv+1); ++ *argv= *(argv+1); + argv++; + } + oargv[0] = _PATH_SDIFF; + *argv= "\0"; +- + execv(_PATH_SDIFF, oargv); + _exit(127); + } +@@ -380,7 +460,10 @@ main(int argc, char **argv) + set_argstr(oargv, argv); + if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { + if (format == D_IFDEF) +- errx(2, "-D option not supported with directories"); ++ if (ch == 'D') ++ errx(2, "-D option not supported with directories"); ++ if (ch == OPT_LF) ++ errx(2, "--line-format option not supported with directories"); + diffdir(argv[0], argv[1]); + } else { + if (S_ISDIR(stb1.st_mode)) { +@@ -393,8 +476,26 @@ main(int argc, char **argv) + if (stat(argv[1], &stb2) < 0) + err(2, "%s", argv[1]); + } +- print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], +- NULL); ++ /* Checks if --to-file or --from-file are specified */ ++ if (Toflag && Fromflag) { ++ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); ++ exit(2); ++ } ++ if (Toflag) { ++ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0], ++ NULL); ++ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], ++ NULL); ++ } ++ if (Fromflag) { ++ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, ++ NULL); ++ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, ++ NULL); ++ } ++ if (!Toflag && !Fromflag) ++ print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], ++ NULL); + } + exit(status); + } +@@ -402,11 +503,10 @@ main(int argc, char **argv) + void * + emalloc(size_t n) + { +- void *p; ++ void *p; + + if (n == 0) + errx(2, NULL); +- + if ((p = malloc(n)) == NULL) + errx(2, NULL); + return (p); +@@ -415,7 +515,7 @@ emalloc(size_t n) + void * + erealloc(void *p, size_t n) + { +- void *q; ++ void *q; + + if (n == 0) + errx(2, NULL); +@@ -431,13 +531,12 @@ erealloc(void *p, size_t n) + int + easprintf(char **ret, const char *fmt, ...) + { +- int len; +- va_list ap; ++ int len; ++ va_list ap; + + va_start(ap, fmt); + len = vasprintf(ret, fmt, ap); + va_end(ap); +- + if (len < 0 || *ret == NULL) + errx(2, NULL); + return (len); +@@ -446,11 +545,12 @@ easprintf(char **ret, const char *fmt, . + char * + estrdup(const char *str) + { +- size_t len; +- char *cp; ++ size_t len; ++ char *cp; + + len = strlen(str) + 1; + cp = emalloc(len); ++ + strlcpy(cp, str, len); + return (cp); + } +@@ -531,6 +631,7 @@ push_ignore_pats(char *pattern) + void + print_only(const char *path, size_t dirlen, const char *entry) + { ++ + if (dirlen > 1) + dirlen--; + printf("Only in %.*s: %s\n", (int)dirlen, path, entry); +@@ -539,45 +640,46 @@ print_only(const char *path, size_t dirl + void + print_status(int val, char *path1, char *path2, char *entry) + { ++ + switch (val) { + case D_ONLY: + print_only(path1, strlen(path1), entry); + break; + case D_COMMON: + printf("Common subdirectories: %s%s and %s%s\n", +- path1, entry ? entry : "", path2, entry ? entry : ""); ++ path1, entry ? entry : "", path2, entry ? entry : ""); + break; + case D_BINARY: +- printf("Binary files %s%s and %s%s differ\n", +- path1, entry ? entry : "", path2, entry ? entry : ""); ++ printf("Files %s%s and %s%s differ\n", ++ path1, entry ? entry : "", path2, entry ? entry : ""); + break; + case D_DIFFER: + if (format == D_BRIEF) + printf("Files %s%s and %s%s differ\n", +- path1, entry ? entry : "", +- path2, entry ? entry : ""); ++ path1, entry ? entry : "", ++ path2, entry ? entry : ""); + break; + case D_SAME: + if (sflag) + printf("Files %s%s and %s%s are identical\n", +- path1, entry ? entry : "", +- path2, entry ? entry : ""); ++ path1, entry ? entry : "", ++ path2, entry ? entry : ""); + break; + case D_MISMATCH1: + printf("File %s%s is a directory while file %s%s is a regular file\n", +- path1, entry ? entry : "", path2, entry ? entry : ""); ++ path1, entry ? entry : "", path2, entry ? entry : ""); + break; + case D_MISMATCH2: + printf("File %s%s is a regular file while file %s%s is a directory\n", +- path1, entry ? entry : "", path2, entry ? entry : ""); ++ path1, entry ? entry : "", path2, entry ? entry : ""); + break; + case D_SKIPPED1: + printf("File %s%s is not a regular file or directory and was skipped\n", +- path1, entry ? entry : ""); ++ path1, entry ? entry : ""); + break; + case D_SKIPPED2: + printf("File %s%s is not a regular file or directory and was skipped\n", +- path2, entry ? entry : ""); ++ path2, entry ? entry : ""); + break; + } + } +@@ -585,6 +687,7 @@ print_status(int val, char *path1, char + void + usage(void) + { ++ + (void)fprintf(stderr, + "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" + " [-L label] file1 file2\n" +diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diff.h.svn-base jhagewood/diff/diff/.svn/text-base/diff.h.svn-base +--- jhagewood/diff/diff-orig/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 +@@ -48,6 +48,8 @@ + #define D_NREVERSE 5 /* Reverse ed script with numbered + lines and no trailing . */ + #define D_BRIEF 6 /* Say if the files differ */ ++#define D_GF 7 /* Group format */ ++#define D_LF 8 /* Line format */ + + /* + * Output flags +@@ -75,9 +77,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, +- sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diffdir.c.svn-base jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base +--- jhagewood/diff/diff-orig/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 +@@ -20,14 +20,13 @@ + + #include + +-#ifndef lint + #if 0 +-__RCSID("$OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray Exp $"); +-#else +-__FBSDID("$FreeBSD$"); ++#ifndef lint ++static char sccsid[] = "@(#)diffdir.c 8.1 (Berkeley) 6/6/93"; + #endif + #endif /* not lint */ +- ++#include ++__FBSDID("$FreeBSD$"); + #include + #include + +@@ -57,12 +56,12 @@ static void diffit(struct dirent *, char + void + diffdir(char *p1, char *p2) + { +- struct dirent **dirp1, **dirp2, **dp1, **dp2; +- struct dirent *dent1, *dent2; +- size_t dirlen1, dirlen2; +- char path1[MAXPATHLEN], path2[MAXPATHLEN]; +- char *dirbuf1, *dirbuf2; +- int pos; ++ struct dirent **dirp1, **dirp2, **dp1, **dp2; ++ struct dirent *dent1, *dent2; ++ size_t dirlen1, dirlen2; ++ char path1[MAXPATHLEN], path2[MAXPATHLEN]; ++ char *dirbuf1, *dirbuf2; ++ int pos; + + dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); + if (dirlen1 >= sizeof(path1) - 1) { +@@ -169,17 +168,16 @@ diffdir(char *p1, char *p2) + static struct dirent ** + slurpdir(char *path, char **bufp, int enoentok) + { +- char *buf, *ebuf, *cp; +- size_t bufsize, have, need; +- long base; +- int fd, nbytes, entries; +- struct stat sb; +- struct dirent **dirlist, *dp; ++ char *buf, *ebuf, *cp; ++ size_t bufsize, have, need; ++ long base; ++ int fd, nbytes, entries; ++ struct stat sb; ++ struct dirent **dirlist, *dp; + + *bufp = NULL; + if ((fd = open(path, O_RDONLY, 0644)) == -1) { + static struct dirent *dummy; +- + if (!enoentok || errno != ENOENT) { + warn("%s", path); + return (NULL); +@@ -191,19 +189,17 @@ slurpdir(char *path, char **bufp, int en + close(fd); + return (NULL); + } +- + need = roundup(sb.st_blksize, sizeof(struct dirent)); + have = bufsize = roundup(MAX(sb.st_size, sb.st_blksize), + sizeof(struct dirent)) + need; + ebuf = buf = emalloc(bufsize); +- + do { + if (have < need) { +- bufsize += need; +- have += need; +- cp = erealloc(buf, bufsize); +- ebuf = cp + (ebuf - buf); +- buf = cp; ++ bufsize += need; ++ have += need; ++ cp = erealloc(buf, bufsize); ++ ebuf = cp + (ebuf - buf); ++ buf = cp; + } + nbytes = getdirentries(fd, ebuf, have, &base); + if (nbytes == -1) { +@@ -255,8 +251,8 @@ slurpdir(char *path, char **bufp, int en + static int + dircompare(const void *vp1, const void *vp2) + { +- struct dirent *dp1 = *((struct dirent **) vp1); +- struct dirent *dp2 = *((struct dirent **) vp2); ++ struct dirent *dp1 = *((struct dirent **) vp1); ++ struct dirent *dp2 = *((struct dirent **) vp2); + + return (strcmp(dp1->d_name, dp2->d_name)); + } +@@ -267,7 +263,7 @@ dircompare(const void *vp1, const void * + static void + diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) + { +- int flags = D_HEADER; ++ int flags = D_HEADER; + + strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); + if (stat(path1, &stb1) != 0) { +diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base +--- jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 ++++ jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 +@@ -62,15 +62,13 @@ + * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 + */ + +-#include +- +-#ifndef lint + #if 0 +-__RCSID("$OpenBSD: diffreg.c,v 1.70 2007/09/11 15:47:17 gilles Exp $"); +-#else +-__FBSDID("$FreeBSD"); ++#ifndef lint ++static char sccsid[] = "@(#)diffreg.c 8.1 (Berkeley) 6/6/93"; + #endif + #endif /* not lint */ ++#include ++__FBSDID("$FreeBSD$"); + + #include + #include +@@ -90,6 +88,14 @@ __FBSDID("$FreeBSD"); + #include "diff.h" + #include "pathnames.h" + ++#ifdef ST_MTIM_NSEC ++# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) ++#else ++# define TIMESPEC_NS(timespec) 0 ++#endif ++ ++#define MAX_CHECK 768 ++ + /* + * diff - compare two files. + */ +@@ -196,7 +202,7 @@ static void change(char *, FILE *, char + static void sort(struct line *, int); + static void print_header(const char *, const char *); + static int ignoreline(char *); +-static int asciifile(FILE *); ++static int istextfile(FILE *); + static int fetch(long *, int, int, FILE *, int, int); + static int newcand(int, int, int); + static int search(int *, int, int); +@@ -294,13 +300,13 @@ u_char cup2low[256] = { + int + diffreg(char *ofile1, char *ofile2, int flags) + { +- char *file1 = ofile1; +- char *file2 = ofile2; +- FILE *f1 = NULL; +- FILE *f2 = NULL; +- int rval = D_SAME; +- int i, ostdout = -1; +- pid_t pid = -1; ++ char *file1 = ofile1; ++ char *file2 = ofile2; ++ FILE *f1 = NULL; ++ FILE *f2 = NULL; ++ int rval = D_SAME; ++ int i, ostdout = -1; ++ pid_t pid = -1; + + anychange = 0; + lastline = 0; +@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int + status |= 2; + goto closem; + } +- + switch (files_differ(f1, f2, flags)) { + case 0: + goto closem; +@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int + goto closem; + } + +- if (!asciifile(f1) || !asciifile(f2)) { ++ if (!istextfile(f1) || !istextfile(f2)) { + rval = D_BINARY; + status |= 1; + goto closem; +@@ -477,8 +482,8 @@ closem: + static int + files_differ(FILE *f1, FILE *f2, int flags) + { +- char buf1[BUFSIZ], buf2[BUFSIZ]; +- size_t i, j; ++ char buf1[BUFSIZ], buf2[BUFSIZ]; ++ size_t i, j; + + if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || + (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) +@@ -503,9 +508,9 @@ files_differ(FILE *f1, FILE *f2, int fla + static FILE * + opentemp(const char *file) + { +- char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; +- ssize_t nread; +- int ifd, ofd; ++ char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; ++ ssize_t nread; ++ int ifd, ofd; + + if (strcmp(file, "-") == 0) + ifd = STDIN_FILENO; +@@ -541,7 +546,7 @@ opentemp(const char *file) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 19:50:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id CEFE1106564A for ; Sat, 7 Jul 2012 19:50:04 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 19:50:04 +0000 Date: Sat, 07 Jul 2012 19:50:04 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707195004.CEFE1106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r239093 - in soc2012/jhagewood: diff diff3 mdocml sdiff sdiff/sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 19:50:07 -0000 Author: jhagewood Date: Sat Jul 7 19:50:04 2012 New Revision: 239093 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239093 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 19:34:52 2012 (r239092) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 19:50:04 2012 (r239093) @@ -1,1589 +1,6 @@ -diff -rupN jhagewood/diff/diff-orig/.svn/all-wcprops jhagewood/diff/diff/.svn/all-wcprops ---- jhagewood/diff/diff-orig/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 -@@ -1,59 +1,59 @@ - K 25 - svn:wc:ra_dav:version-url --V 56 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig -+V 51 -+/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff - END - diff.1.gz - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1.gz -+V 61 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1.gz - END - pathnames.h - K 25 - svn:wc:ra_dav:version-url --V 68 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/pathnames.h -+V 63 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/pathnames.h - END - diff.1 - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1 -+V 58 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1 - END - diffreg.c - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffreg.c -+V 61 -+/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff/diffreg.c - END - diff - K 25 - svn:wc:ra_dav:version-url --V 61 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff -+V 56 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff - END - diffdir.c - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffdir.c -+V 61 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diffdir.c - END - diff.c - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.c -+V 58 -+/socsvn/!svn/ver/239007/soc2012/jhagewood/diff/diff/diff.c - END - Makefile - K 25 - svn:wc:ra_dav:version-url --V 65 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/Makefile -+V 60 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/Makefile - END - diff.h - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.h -+V 58 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.h - END -diff -rupN jhagewood/diff/diff-orig/.svn/entries jhagewood/diff/diff/.svn/entries ---- jhagewood/diff/diff-orig/.svn/entries 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/entries 2012-07-07 14:53:51.000000000 -0400 -@@ -2,13 +2,13 @@ - - dir - 239088 --https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff-orig -+https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff - https://socsvn.freebsd.org/socsvn - - - --2012-07-02T14:59:21.494992Z --238807 -+2012-07-06T17:31:27.428691Z -+239048 - jhagewood - - -@@ -67,7 +67,7 @@ file - - - 2012-07-07T18:53:51.000000Z --5a0333c769b4cd0b56d0183979c3c3da -+02e0e4002578433745dc1989cde68db3 - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -92,7 +92,7 @@ jhagewood - - - --1173 -+1208 - - diff.1 - file -@@ -135,9 +135,9 @@ file - - - 2012-07-07T18:53:51.000000Z --41390d52e706fd5ff89e5139b1a3992a --2012-07-02T14:59:21.494992Z --238807 -+360e792dce77ba35267246e878158613 -+2012-07-06T17:31:27.428691Z -+239048 - jhagewood - - -@@ -160,7 +160,7 @@ jhagewood - - - --38935 -+40791 - - diff - file -@@ -203,7 +203,7 @@ file - - - 2012-07-07T18:53:51.000000Z --28bd85291f636c13f457cda2ec9e2168 -+44a983d6f3f06103b3210dc9799dc9aa - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -228,7 +228,7 @@ jhagewood - - - --8385 -+8360 - - diff.c - file -@@ -237,9 +237,9 @@ file - - - 2012-07-07T18:53:51.000000Z --5c74db6e58594c5d345aa050fcda44ae --2012-07-02T14:59:21.494992Z --238807 -+060bb447cdcbd060f328603bc0595a90 -+2012-07-05T18:13:06.636166Z -+239007 - jhagewood - - -@@ -262,7 +262,7 @@ jhagewood - - - --14455 -+18176 - - Makefile - file -@@ -305,7 +305,7 @@ file - - - 2012-07-07T18:53:51.000000Z --eab9e28aee9d963655a25372ef2f2657 -+f389a5742640cda8b39f75a4cda31197 - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -330,5 +330,5 @@ jhagewood - - - --3738 -+3852 - -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base jhagewood/diff/diff/.svn/text-base/diff.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -1,4 +1,4 @@ --/*- -+/* - * Copyright (c) 2003 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any -@@ -18,15 +18,13 @@ - * Materiel Command, USAF, under agreement number F39502-99-1-0512. - */ - --#include -- --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); --#else --__FBSDID("$FreeBSD$"); -+#ifndef lint -+static char sccsid[] = "@(#)diff.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -+#include -+__FBSDID("$FreeBSD$"); - - #include - #include -@@ -45,20 +43,20 @@ __FBSDID("$FreeBSD$"); - #include "diff.h" - #include "pathnames.h" - --int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; --int sflag, tflag, Tflag, wflag; --int Bflag, yflag; --int strip_cr, tabsize=8; --char ignore_file_case = 0; --int format, context, status; --char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -+int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -+int sflag, tflag, Tflag, wflag, Toflag, Fromflag; -+int Bflag, yflag; -+int strip_cr, suppress_cl, tabsize = 8; -+char ignore_file_case = 0; -+int format, context, status; -+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format; - struct stat stb1, stb2; - struct excludes *excludes_list; - regex_t ignore_re; - - int flag_opts = 0; - --#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" -+#define OPTIONS "0123456789aBbC:cdD:EefhI:iL:lnNPpqrS:sTtU:uvwXy:x" - - - /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,129 @@ enum - OPT_STRIPCR, - OPT_NORMAL, - OPT_LEFTC, -- OT_SUPCL, -- OPT_GTYPE, -+ OPT_SUPCL, -+ OPT_CHGD_GF, -+ OPT_NEW_GF, -+ OPT_OLD_GF, -+ OPT_UNCHGD_GF, - OPT_LF, - OPT_LLF, - OPT_TSIZE, -- OPT_UNINF, - OPT_FFILE, - OPT_TOFILE, - OPT_HLINES, - OPT_LFILES, - OPT_HELP, -+ OPT_NEW_LF, -+ OPT_OLD_LF, -+ OPT_UNCHGD_LF, - }; - - - static struct option longopts[] = { --/* XXX: UNIMPLEMENTED -- { "normal", no_argument, NULL, OPT_NORMAL }, -- { "left-column", no_argument, NULL, OPT_LEFTC }, -- { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, -- { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, -- { "line-format", required_argument, NULL, OPT_LF }, -- { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, -- { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, -- { "from-file", required_argument, NULL, OPT_FFILE }, -- { "to-file", required_argument, NULL, OPT_TOFILE }, -- { "horizon-lines", required_argument, NULL, OPT_HLINES }, -- { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ -- { "tabsize", optional_argument, NULL, OPT_TSIZE }, -- { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, -- { "help", no_argument, NULL, OPT_HELP }, -- { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, -- { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, -- { "text", no_argument, NULL, 'a' }, --/* XXX: UNIMPLEMENTED */ -- { "ignore-blank-lines", no_argument, NULL, 'B' }, -- { "ignore-space-change", no_argument, NULL, 'b' }, --/* XXX: -c is incompatible with GNU version */ -+ -+ /* -+ * Commented-out options are unimplemented. -+ */ -+ -+ { "brief", no_argument, NULL, 'q' }, -+ { "changed-group-format", required_argument, NULL, OPT_CHGD_GF}, - { "context", optional_argument, NULL, 'C' }, -- { "ifdef", required_argument, NULL, 'D' }, -- { "minimal", no_argument, NULL, 'd' }, --/* XXX: UNIMPLEMENTED -- { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ - { "ed", no_argument, NULL, 'e' }, --/* XXX: UNIMPLEMENTED -- { "show-function-line", required_argument, NULL, 'F' }, */ -+ { "exclude", required_argument, NULL, 'x' }, -+ { "exclude-from", required_argument, NULL, 'X' }, -+ { "expand-tabs", no_argument, NULL, 't' }, -+ { "from-file", required_argument, NULL, OPT_FFILE }, - { "forward-ed", no_argument, NULL, 'f' }, -+ { "help", no_argument, NULL, OPT_HELP }, -+ /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ -+ { "ifdef", required_argument, NULL, 'D' }, -+ { "ignore-all-space", no_argument, NULL, 'W' }, -+ { "ignore-blank-lines", no_argument, NULL, 'B' }, -+ { "ignore-case", no_argument, NULL, 'i' }, -+ { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, - { "ignore-matching-lines", required_argument, NULL, 'I' }, -- { "ignore-case", no_argument, NULL, 'i' }, -+ { "ignore-space-change", no_argument, NULL, 'b' }, -+ { "ignore-tab-expansion", no_argument, NULL, 'E' }, -+ { "initial-tab", no_argument, NULL, 'T' }, - { "label", required_argument, NULL, 'L' }, -- { "paginate", no_argument, NULL, 'l' }, -+ { "left-column", no_argument, NULL, OPT_LEFTC }, -+ { "line-format", required_argument, NULL, OPT_LF }, -+ { "minimal", no_argument, NULL, 'd' }, - { "new-file", no_argument, NULL, 'N' }, -- { "rcs", no_argument, NULL, 'n' }, -- { "unidirectional-new-file", no_argument, NULL, 'P' }, -- { "show-c-function", no_argument, NULL, 'p' }, -- { "brief", no_argument, NULL, 'q' }, -+ { "new-line-format", required_argument, NULL, OPT_NEW_LF}, -+ { "new-group-format", required_argument, NULL, OPT_NEW_GF}, -+ { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, -+ { "normal", no_argument, NULL, OPT_NORMAL }, -+ { "old-line-format", required_argument, NULL, OPT_OLD_LF}, -+ { "old-group-format", required_argument, NULL, OPT_OLD_GF}, -+ { "paginate", no_argument, NULL, 'l' }, - { "recursive", no_argument, NULL, 'r' }, -- { "starting-file", required_argument, NULL, 'S' }, - { "report-identical-files", no_argument, NULL, 's' }, -- { "initial-tab", no_argument, NULL, 'T' }, -- { "expand-tabs", no_argument, NULL, 't' }, --/* XXX: -u is incompatible with GNU version */ -+ { "rcs", no_argument, NULL, 'n' }, -+ { "show-c-function", no_argument, NULL, 'p' }, -+ { "show-function-line", required_argument, NULL, 'F' }, -+ { "side-by-side", no_argument, NULL, 'y' }, -+ /*{ "speed-large-files", no_argument, NULL, OPT_LFILES }, */ -+ { "starting-file", required_argument, NULL, 'S' }, -+ { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, -+ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, -+ { "tabsize", optional_argument, NULL, OPT_TSIZE }, -+ { "text", no_argument, NULL, 'a' }, -+ { "to-file", required_argument, NULL, OPT_TOFILE }, -+ { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF}, -+ { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, -+ { "unidirectional-new-file", no_argument, NULL, 'P' }, - { "unified", optional_argument, NULL, 'U' }, - { "version", no_argument, NULL, 'v' }, --/* XXX: UNIMPLEMENTED -- { "width", optional_argument, NULL, 'W' }, */ -- { "ignore-all-space", no_argument, NULL, 'w' }, -- { "exclude-from", required_argument, NULL, 'X' }, -- { "exclude", required_argument, NULL, 'x' }, -- { "side-by-side", no_argument, NULL, 'y' }, -+ /*{ "width", optional_argument, NULL, 'w' }, */ - { NULL, 0, NULL, '\0'} - }; - - static const char *help_msg[] = { --"-a --text treat files as ASCII text", --"-B --ignore-blank-lines Ignore blank newlines in the comparison", --"-b --ignore-space-change Ignore all changes due to whitespace", --"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", --"-D --ifdef=NAME", -+"\t-a --text treat files as ASCII text", -+"\t-B --ignore-blank-lines Ignore blank newlines in the comparison", -+"\t-b --ignore-space-change Ignore all changes due to whitespace", -+"\t-C -c NUM --context=NUM Show NUM lines before and after change (default 3)", -+"\t-D --ifdef=NAME Output merged file with `#ifdef NAME' diffs", -+"\t-E --ignore-tab-expansion Ignore tab expansion in the comparison", -+"\t-e --ed Output an ed script", -+"\t-F --show-function-line=RE Show the most recent line matching RE", -+"\t-f --forward-ed Output a forward ed script", -+"\t-I --ignore-matching-lines=RE Ignore changes whose lines all match RE", -+"\t-i --ignore-case Ignore case differences in file contents", -+"\t-L --label=NAME Label file header", -+"\t-l --paginate Paginates output through pr", -+"\t-N --new-file Treat new files as empty", -+"\t-n --rcs Output an RCS format diff", -+"\t-P --unidirectional-new-file Treat absent-first files as empty", -+"\t-p --show-c-function Show which C function each change is in", -+"\t-q --brief report only when files differ", -+"\t-r --recursive Recursively compare any sub-directories found", -+"\t-S --starting-file=FILE Start with FILE when comparing directories", -+"\t-s --report-identical-files Report when two files are the same", -+"\t-T --initial-tab Make tabs line up by prepending a tab", -+"\t-t --expand-tabs Expand tabs to spaces in output", -+"\t-U -u NUM --unified=NUM Show NUM lines of unified context", -+"\t-v --version Show diff version", -+"\t-W --ignore-all-space Ignore all space", -+"\t-w --width=NUM Output at most NUM (default 130) print columns", -+"\t-X --exclude-from=FILE Start with FILE when comparing directories", -+"\t-x --exclude=PAT Exclude files that match PAT", -+"\t-y --side-by-side Output difference in two columns", -+"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", -+"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", -+"\t--from-file=FILE Compare FILE to all operands", -+"\t--to-file=FILE Compare all operands to FILE", -+"\t--ignore-file-name-case Ignore file name case", -+"\t--left-column Output the only the left column of common lines", -+"\t--line-format=LFMT Format all input lines with LFMT", -+"\t--no-ignore-file-name-case Do not ignore file name case", -+"\t--normal Output a normal diff (default output)", -+"\t--strip-trailing-cr Strip trailing carriage return", -+"\t--suppress-common-lines Do not output common lines", -+"\t--tabsize=NUM Tab stops every NUM (default 8) print columns", -+"\t--help Output this help message", - NULL, - }; - char **help_strs = (char **)help_msg; -@@ -162,14 +205,15 @@ void read_excludes_file(char *); - int - main(int argc, char **argv) - { -- char *ep, **oargv; -- long l; -- int ch, lastch, gotstdin, prevoptind, newarg; -- int oargc; -- -+ char *ep, **oargv, *optfile; -+ long l; -+ int ch, lastch, gotstdin, prevoptind, newarg; -+ int oargc; -+ - oargv = argv; - oargc = argc; - gotstdin = 0; -+ optfile = "\0"; - - lastch = '\0'; - prevoptind = 1; -@@ -197,6 +241,7 @@ main(int argc, char **argv) - break; - case 'C': - case 'c': -+ cflag = 1; - format = D_CONTEXT; - if (optarg != NULL) { - l = strtol(optarg, &ep, 10); -@@ -213,6 +258,9 @@ main(int argc, char **argv) - case 'd': - dflag = 1; - break; -+ case 'E': -+ Eflag = 1; -+ break; - case 'e': - format = D_EDIT; - break; -@@ -284,7 +332,7 @@ main(int argc, char **argv) - case 'v': - printf("FreeBSD diff 2.8.7\n"); - exit(0); -- case 'w': -+ case 'W': - wflag = 1; - break; - case 'X': -@@ -296,15 +344,48 @@ main(int argc, char **argv) - case 'y': - yflag = 1; - break; -+ case OPT_FFILE: -+ Toflag = 1; -+ optfile = optarg; -+ break; -+ case OPT_TOFILE: -+ Fromflag = 1; -+ optfile = optarg; -+ break; -+ case OPT_CHGD_GF: -+ case OPT_NEW_GF: -+ case OPT_OLD_GF: -+ case OPT_UNCHGD_GF: -+ /* XXX To do: Complete --GTYPE-group-format. */ -+ format = D_GF; -+ group_format = optarg; -+ break; -+ case OPT_NEW_LF: -+ case OPT_OLD_LF: -+ case OPT_UNCHGD_LF: -+ case OPT_LF: -+ /* XXX To do: Complete --line-format. */ -+ format = D_LF; -+ line_format = optarg; -+ break; -+ case OPT_NORMAL: -+ format = D_NORMAL; -+ break; -+ case OPT_LEFTC: -+ /* Do nothing, passes option to sdiff. */ -+ break; -+ case OPT_SUPCL: -+ /* Do nothing, passes option to sdiff. */ -+ break; - case OPT_TSIZE: -- if (optarg != NULL) { -- l = strtol(optarg, &ep, 10); -- if (*ep != '\0' || l < 1 || l >= INT_MAX) -- usage(); -- tabsize = (int)l; -- } else -- tabsize = 8; -- break; -+ if (optarg != NULL) { -+ l = strtol(optarg, &ep, 10); -+ if (*ep != '\0' || l < 1 || l >= INT_MAX) -+ usage(); -+ tabsize = (int)l; -+ } else -+ tabsize = 8; -+ break; - case OPT_STRIPCR: - strip_cr=1; - break; -@@ -315,11 +396,10 @@ main(int argc, char **argv) - ignore_file_case = 0; - break; - case OPT_HELP: -- for(;*help_strs;help_strs++) -- { -+ for (; *help_strs; help_strs++) { - printf("%s\n", *help_strs); - } -- exit(2); -+ exit(0); - break; - default: - usage(); -@@ -328,20 +408,20 @@ main(int argc, char **argv) - lastch = ch; - newarg = optind != prevoptind; - prevoptind = optind; -+ - } - argc -= optind; - argv += optind; -- -- if(yflag) { -+ if (yflag) { - /* remove y flag from args and call sdiff */ -- for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); -+ for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && -+ strcmp(*argv, "--side-by-side") != 0; argv++); - while(argv != &oargv[oargc]){ -- *argv=*(argv+1); -+ *argv= *(argv+1); - argv++; - } - oargv[0] = _PATH_SDIFF; - *argv= "\0"; -- - execv(_PATH_SDIFF, oargv); - _exit(127); - } -@@ -380,7 +460,10 @@ main(int argc, char **argv) - set_argstr(oargv, argv); - if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { - if (format == D_IFDEF) -- errx(2, "-D option not supported with directories"); -+ if (ch == 'D') -+ errx(2, "-D option not supported with directories"); -+ if (ch == OPT_LF) -+ errx(2, "--line-format option not supported with directories"); - diffdir(argv[0], argv[1]); - } else { - if (S_ISDIR(stb1.st_mode)) { -@@ -393,8 +476,26 @@ main(int argc, char **argv) - if (stat(argv[1], &stb2) < 0) - err(2, "%s", argv[1]); - } -- print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], -- NULL); -+ /* Checks if --to-file or --from-file are specified */ -+ if (Toflag && Fromflag) { -+ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); -+ exit(2); -+ } -+ if (Toflag) { -+ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0], -+ NULL); -+ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], -+ NULL); -+ } -+ if (Fromflag) { -+ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, -+ NULL); -+ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, -+ NULL); -+ } -+ if (!Toflag && !Fromflag) -+ print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], -+ NULL); - } - exit(status); - } -@@ -402,11 +503,10 @@ main(int argc, char **argv) - void * - emalloc(size_t n) - { -- void *p; -+ void *p; - - if (n == 0) - errx(2, NULL); -- - if ((p = malloc(n)) == NULL) - errx(2, NULL); - return (p); -@@ -415,7 +515,7 @@ emalloc(size_t n) - void * - erealloc(void *p, size_t n) - { -- void *q; -+ void *q; - - if (n == 0) - errx(2, NULL); -@@ -431,13 +531,12 @@ erealloc(void *p, size_t n) - int - easprintf(char **ret, const char *fmt, ...) - { -- int len; -- va_list ap; -+ int len; -+ va_list ap; - - va_start(ap, fmt); - len = vasprintf(ret, fmt, ap); - va_end(ap); -- - if (len < 0 || *ret == NULL) - errx(2, NULL); - return (len); -@@ -446,11 +545,12 @@ easprintf(char **ret, const char *fmt, . - char * - estrdup(const char *str) - { -- size_t len; -- char *cp; -+ size_t len; -+ char *cp; - - len = strlen(str) + 1; - cp = emalloc(len); -+ - strlcpy(cp, str, len); - return (cp); - } -@@ -531,6 +631,7 @@ push_ignore_pats(char *pattern) - void - print_only(const char *path, size_t dirlen, const char *entry) - { -+ - if (dirlen > 1) - dirlen--; - printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +640,46 @@ print_only(const char *path, size_t dirl - void - print_status(int val, char *path1, char *path2, char *entry) - { -+ - switch (val) { - case D_ONLY: - print_only(path1, strlen(path1), entry); - break; - case D_COMMON: - printf("Common subdirectories: %s%s and %s%s\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_BINARY: -- printf("Binary files %s%s and %s%s differ\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ printf("Files %s%s and %s%s differ\n", -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: - if (format == D_BRIEF) - printf("Files %s%s and %s%s differ\n", -- path1, entry ? entry : "", -- path2, entry ? entry : ""); -+ path1, entry ? entry : "", -+ path2, entry ? entry : ""); - break; - case D_SAME: - if (sflag) - printf("Files %s%s and %s%s are identical\n", -- path1, entry ? entry : "", -- path2, entry ? entry : ""); -+ path1, entry ? entry : "", -+ path2, entry ? entry : ""); - break; - case D_MISMATCH1: - printf("File %s%s is a directory while file %s%s is a regular file\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_MISMATCH2: - printf("File %s%s is a regular file while file %s%s is a directory\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_SKIPPED1: - printf("File %s%s is not a regular file or directory and was skipped\n", -- path1, entry ? entry : ""); -+ path1, entry ? entry : ""); - break; - case D_SKIPPED2: - printf("File %s%s is not a regular file or directory and was skipped\n", -- path2, entry ? entry : ""); -+ path2, entry ? entry : ""); - break; - } - } -@@ -585,6 +687,7 @@ print_status(int val, char *path1, char - void - usage(void) - { -+ - (void)fprintf(stderr, - "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" - " [-L label] file1 file2\n" -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diff.h.svn-base jhagewood/diff/diff/.svn/text-base/diff.h.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -48,6 +48,8 @@ - #define D_NREVERSE 5 /* Reverse ed script with numbered - lines and no trailing . */ - #define D_BRIEF 6 /* Say if the files differ */ -+#define D_GF 7 /* Group format */ -+#define D_LF 8 /* Line format */ - - /* - * Output flags -@@ -75,9 +77,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -- sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+ sflag, tflag, Tflag, Toflag, wflag; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diffdir.c.svn-base jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -20,14 +20,13 @@ - - #include - --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray Exp $"); --#else --__FBSDID("$FreeBSD$"); -+#ifndef lint -+static char sccsid[] = "@(#)diffdir.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -- -+#include -+__FBSDID("$FreeBSD$"); - #include - #include - -@@ -57,12 +56,12 @@ static void diffit(struct dirent *, char - void - diffdir(char *p1, char *p2) - { -- struct dirent **dirp1, **dirp2, **dp1, **dp2; -- struct dirent *dent1, *dent2; -- size_t dirlen1, dirlen2; -- char path1[MAXPATHLEN], path2[MAXPATHLEN]; -- char *dirbuf1, *dirbuf2; -- int pos; -+ struct dirent **dirp1, **dirp2, **dp1, **dp2; -+ struct dirent *dent1, *dent2; -+ size_t dirlen1, dirlen2; -+ char path1[MAXPATHLEN], path2[MAXPATHLEN]; -+ char *dirbuf1, *dirbuf2; -+ int pos; - - dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); - if (dirlen1 >= sizeof(path1) - 1) { -@@ -169,17 +168,16 @@ diffdir(char *p1, char *p2) - static struct dirent ** - slurpdir(char *path, char **bufp, int enoentok) - { -- char *buf, *ebuf, *cp; -- size_t bufsize, have, need; -- long base; -- int fd, nbytes, entries; -- struct stat sb; -- struct dirent **dirlist, *dp; -+ char *buf, *ebuf, *cp; -+ size_t bufsize, have, need; -+ long base; -+ int fd, nbytes, entries; -+ struct stat sb; -+ struct dirent **dirlist, *dp; - - *bufp = NULL; - if ((fd = open(path, O_RDONLY, 0644)) == -1) { - static struct dirent *dummy; -- - if (!enoentok || errno != ENOENT) { - warn("%s", path); - return (NULL); -@@ -191,19 +189,17 @@ slurpdir(char *path, char **bufp, int en - close(fd); - return (NULL); - } -- - need = roundup(sb.st_blksize, sizeof(struct dirent)); - have = bufsize = roundup(MAX(sb.st_size, sb.st_blksize), - sizeof(struct dirent)) + need; - ebuf = buf = emalloc(bufsize); -- - do { - if (have < need) { -- bufsize += need; -- have += need; -- cp = erealloc(buf, bufsize); -- ebuf = cp + (ebuf - buf); -- buf = cp; -+ bufsize += need; -+ have += need; -+ cp = erealloc(buf, bufsize); -+ ebuf = cp + (ebuf - buf); -+ buf = cp; - } - nbytes = getdirentries(fd, ebuf, have, &base); - if (nbytes == -1) { -@@ -255,8 +251,8 @@ slurpdir(char *path, char **bufp, int en - static int - dircompare(const void *vp1, const void *vp2) - { -- struct dirent *dp1 = *((struct dirent **) vp1); -- struct dirent *dp2 = *((struct dirent **) vp2); -+ struct dirent *dp1 = *((struct dirent **) vp1); -+ struct dirent *dp2 = *((struct dirent **) vp2); - - return (strcmp(dp1->d_name, dp2->d_name)); - } -@@ -267,7 +263,7 @@ dircompare(const void *vp1, const void * - static void - diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) - { -- int flags = D_HEADER; -+ int flags = D_HEADER; - - strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); - if (stat(path1, &stb1) != 0) { -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -62,15 +62,13 @@ - * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 - */ - --#include -- --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diffreg.c,v 1.70 2007/09/11 15:47:17 gilles Exp $"); --#else --__FBSDID("$FreeBSD"); -+#ifndef lint -+static char sccsid[] = "@(#)diffreg.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -+#include -+__FBSDID("$FreeBSD$"); - - #include - #include -@@ -90,6 +88,14 @@ __FBSDID("$FreeBSD"); - #include "diff.h" - #include "pathnames.h" - -+#ifdef ST_MTIM_NSEC -+# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) -+#else -+# define TIMESPEC_NS(timespec) 0 -+#endif -+ -+#define MAX_CHECK 768 -+ - /* - * diff - compare two files. - */ -@@ -196,7 +202,7 @@ static void change(char *, FILE *, char - static void sort(struct line *, int); - static void print_header(const char *, const char *); - static int ignoreline(char *); --static int asciifile(FILE *); -+static int istextfile(FILE *); - static int fetch(long *, int, int, FILE *, int, int); - static int newcand(int, int, int); - static int search(int *, int, int); -@@ -294,13 +300,13 @@ u_char cup2low[256] = { - int - diffreg(char *ofile1, char *ofile2, int flags) - { -- char *file1 = ofile1; -- char *file2 = ofile2; -- FILE *f1 = NULL; -- FILE *f2 = NULL; -- int rval = D_SAME; -- int i, ostdout = -1; -- pid_t pid = -1; -+ char *file1 = ofile1; -+ char *file2 = ofile2; -+ FILE *f1 = NULL; -+ FILE *f2 = NULL; -+ int rval = D_SAME; -+ int i, ostdout = -1; -+ pid_t pid = -1; - - anychange = 0; - lastline = 0; -@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int - status |= 2; - goto closem; - } -- - switch (files_differ(f1, f2, flags)) { - case 0: - goto closem; -@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int - goto closem; - } - -- if (!asciifile(f1) || !asciifile(f2)) { -+ if (!istextfile(f1) || !istextfile(f2)) { - rval = D_BINARY; - status |= 1; - goto closem; -@@ -477,8 +482,8 @@ closem: - static int - files_differ(FILE *f1, FILE *f2, int flags) - { -- char buf1[BUFSIZ], buf2[BUFSIZ]; -- size_t i, j; -+ char buf1[BUFSIZ], buf2[BUFSIZ]; -+ size_t i, j; - - if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || - (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) -@@ -503,9 +508,9 @@ files_differ(FILE *f1, FILE *f2, int fla - static FILE * - opentemp(const char *file) - { -- char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; -- ssize_t nread; -- int ifd, ofd; -+ char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; -+ ssize_t nread; -+ int ifd, ofd; - - if (strcmp(file, "-") == 0) - ifd = STDIN_FILENO; -@@ -541,7 +546,7 @@ opentemp(const char *file) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Sat Jul 7 19:58:16 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0913E106566B for ; Sat, 7 Jul 2012 19:58:14 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 07 Jul 2012 19:58:14 +0000 Date: Sat, 07 Jul 2012 19:58:14 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120707195814.0913E106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r239094 - in soc2012/jhagewood/sdiff: . sdiff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2012 19:58:16 -0000 Author: jhagewood Date: Sat Jul 7 19:58:13 2012 New Revision: 239094 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239094 Log: Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 19:50:04 2012 (r239093) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Sat Jul 7 19:58:13 2012 (r239094) @@ -112,7 +112,7 @@ + diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c --- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-07 19:37:22.000000000 -0400 -+++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 19:48:42.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-07 19:58:11.000000000 -0400 @@ -5,6 +5,14 @@ * Public domain. */ @@ -128,17 +128,45 @@ #include #include #include -@@ -101,7 +109,8 @@ enum { +@@ -76,8 +84,8 @@ FILE *outfp; /* file to save changes to + const char *tmpdir; /* TMPDIR or /tmp */ + + enum { +- HELP_OPT = CHAR_MAX + 1, +- NORMAL_OPT, ++ HELP_OPT = CHAR_MAX + 1, ++ NORMAL_OPT, + FCASE_SENSITIVE_OPT, + FCASE_IGNORE_OPT, + FROMFILE_OPT, +@@ -89,19 +97,19 @@ enum { + SUPCL_OPT, + LF_OPT, + /* the following groupings must be in sequence */ +- OLDGF_OPT, +- NEWGF_OPT, ++ OLDGF_OPT, ++ NEWGF_OPT, + UNCGF_OPT, +- CHGF_OPT, +- OLDLF_OPT, +- NEWLF_OPT, +- UNCLF_OPT, ++ CHGF_OPT, ++ OLDLF_OPT, ++ NEWLF_OPT, ++ UNCLF_OPT, + /* end order-sensitive enums */ + TSIZE_OPT, HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - + PIPE_FD, -+ /* pid from the diff parent (if applicable) */ DIFF_PID, -@@ -113,7 +122,7 @@ static struct option longopts[] = { +@@ -113,7 +121,7 @@ static struct option longopts[] = { { "left-column", no_argument, NULL, LEFTC_OPT }, { "suppress-common-lines", no_argument, NULL, 's' }, { "width", required_argument, NULL, 'w' }, @@ -147,7 +175,7 @@ { "output", required_argument, NULL, 'o' }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, -@@ -134,9 +143,29 @@ static struct option longopts[] = { +@@ -134,9 +142,35 @@ static struct option longopts[] = { { "ignore-case", no_argument, NULL, 'i' }, { "expand-tabs", no_argument, NULL, 't' }, { "speed-large-files", no_argument, NULL, 'H' }, @@ -171,6 +199,12 @@ + "\t\t-i, --ignore-case, Do a case-insensitive comparison.", + "\t\t-t, --expand-tabs Expand tabs to spaces.", + "\t\t-W, --ignore-all-spaces, Ignore all spaces.", ++ "\t\t--speed-large-files, Assume large file with scattered changes.", ++ "\t\t--strip-trailing-cr, Strip trailing carriage return.", ++ "\t\t--ignore-file-name-case, Ignore case of file names.", ++ "\t\t--no-ignore-file-name-case, Do not ignore file name case", ++ "\t\t--tabsize NUM, Change size of tabs (default 8.)", ++ + NULL, +}; +char **help_strs = (char **)help_msg; @@ -178,7 +212,7 @@ /* * Create temporary file if source_file is not a regular file. * Returns temporary file name if one was malloced, NULL if unnecessary. -@@ -240,18 +269,13 @@ main(int argc, char **argv) +@@ -240,18 +274,13 @@ main(int argc, char **argv) const char *errstr; switch (ch) { @@ -197,7 +231,7 @@ /* combine no-arg single switches */ case 'a': case 'B': -@@ -261,11 +285,11 @@ main(int argc, char **argv) +@@ -261,11 +290,11 @@ main(int argc, char **argv) case 'i': case 't': case 'H': @@ -211,7 +245,7 @@ case DIFFPROG_OPT: diffargv[0] = diffprog = optarg; break; -@@ -289,26 +313,23 @@ main(int argc, char **argv) +@@ -289,26 +318,23 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; @@ -243,7 +277,7 @@ /* no single switches were used */ if( strcmp( diffargv[1], "-" ) == 0 ) { -@@ -362,19 +383,19 @@ main(int argc, char **argv) +@@ -362,19 +388,19 @@ main(int argc, char **argv) /* Add NULL to end of array to indicate end of array. */ diffargv[diffargc++] = NULL; @@ -268,7 +302,7 @@ case 0: /* child */ /* We don't read from the pipe. */ -@@ -383,7 +404,6 @@ main(int argc, char **argv) +@@ -383,7 +409,6 @@ main(int argc, char **argv) err(2, "child could not duplicate descriptor"); /* Free unused descriptor. */ close(fd[1]); @@ -276,7 +310,7 @@ execvp(diffprog, diffargv); err(2, "could not execute diff: %s", diffprog); break; -@@ -461,6 +481,7 @@ main(int argc, char **argv) +@@ -461,6 +486,7 @@ main(int argc, char **argv) static void printcol(const char *s, size_t *col, const size_t col_max) { @@ -284,7 +318,7 @@ for (; *s && *col < col_max; ++s) { size_t new_col; -@@ -484,11 +505,9 @@ printcol(const char *s, size_t *col, con +@@ -484,11 +510,9 @@ printcol(const char *s, size_t *col, con return; *col = new_col; break; @@ -296,7 +330,7 @@ putchar(*s); } } -@@ -527,30 +546,24 @@ prompt(const char *s1, const char *s2) +@@ -527,30 +551,24 @@ prompt(const char *s1, const char *s2) /* Choose left column as-is. */ if (s1 != NULL) fprintf(outfp, "%s\n", s1); @@ -329,7 +363,7 @@ default: /* Interactive usage help. */ USAGE: -@@ -570,7 +583,7 @@ PROMPT: +@@ -570,7 +588,7 @@ PROMPT: * If there was no error, we received an EOF from stdin, so we * should quit. */ @@ -338,7 +372,7 @@ fclose(outfp); exit(0); } -@@ -1103,24 +1116,22 @@ printd(FILE *file1, size_t file1end) +@@ -1103,24 +1121,22 @@ printd(FILE *file1, size_t file1end) static void int_usage(void) { Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 19:50:04 2012 (r239093) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Sat Jul 7 19:58:13 2012 (r239094) @@ -84,8 +84,8 @@ const char *tmpdir; /* TMPDIR or /tmp */ enum { - HELP_OPT = CHAR_MAX + 1, - NORMAL_OPT, + HELP_OPT = CHAR_MAX + 1, + NORMAL_OPT, FCASE_SENSITIVE_OPT, FCASE_IGNORE_OPT, FROMFILE_OPT, @@ -97,20 +97,19 @@ SUPCL_OPT, LF_OPT, /* the following groupings must be in sequence */ - OLDGF_OPT, - NEWGF_OPT, + OLDGF_OPT, + NEWGF_OPT, UNCGF_OPT, - CHGF_OPT, - OLDLF_OPT, - NEWLF_OPT, - UNCLF_OPT, + CHGF_OPT, + OLDLF_OPT, + NEWLF_OPT, + UNCLF_OPT, /* end order-sensitive enums */ TSIZE_OPT, HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, PIPE_FD, - /* pid from the diff parent (if applicable) */ DIFF_PID, @@ -162,6 +161,12 @@ "\t\t-i, --ignore-case, Do a case-insensitive comparison.", "\t\t-t, --expand-tabs Expand tabs to spaces.", "\t\t-W, --ignore-all-spaces, Ignore all spaces.", + "\t\t--speed-large-files, Assume large file with scattered changes.", + "\t\t--strip-trailing-cr, Strip trailing carriage return.", + "\t\t--ignore-file-name-case, Ignore case of file names.", + "\t\t--no-ignore-file-name-case, Do not ignore file name case", + "\t\t--tabsize NUM, Change size of tabs (default 8.)", + NULL, }; char **help_strs = (char **)help_msg;