From owner-svn-soc-all@FreeBSD.ORG Sun Jun 17 02:29: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 23577106566B for ; Sun, 17 Jun 2012 02:29:05 +0000 (UTC) (envelope-from exxo@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 17 Jun 2012 02:29:05 +0000 Date: Sun, 17 Jun 2012 02:29:05 +0000 From: exxo@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: <20120617022905.23577106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237821 - in soc2012/exxo: openssl-1.0.1c/crypto/bio regress regress/openssl-1.0.1c 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: Sun, 17 Jun 2012 02:29:07 -0000 Author: exxo Date: Sun Jun 17 02:29:04 2012 New Revision: 237821 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237821 Log: Major rewrite in b_sock.c without breaking the API (however see TODO list), correct buffering issue in regress Modified: soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h soc2012/exxo/regress/openssl-1.0.1c/Makefile soc2012/exxo/regress/regress.in Modified: soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c ============================================================================== --- soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c Sun Jun 17 00:28:57 2012 (r237820) +++ soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c Sun Jun 17 02:29:04 2012 (r237821) @@ -59,6 +59,7 @@ #include #include #include +#include #define USE_SOCKETS #include "cryptlib.h" #include @@ -84,6 +85,10 @@ #define MAX_LISTEN 32 #endif +#ifdef OPENSSL_USE_IPV6 +extern const struct in6_addr in6addr_any; +#endif + #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) static int wsa_init_done=0; #endif @@ -123,8 +128,12 @@ int err = 1; int locked = 0; struct hostent *he; + struct addrinfo hint, *res = NULL; + char *addr = NULL; + int addrlen = 4; + int gai_err; - i=get_ip(str,ip); + i=get_ip(str,ip); /* Search for an IPv4 address in in standard dot notation */ if (i < 0) { BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_INVALID_IP_ADDRESS); @@ -140,29 +149,66 @@ anything more */ if (i > 0) return(1); - /* do a gethostbyname */ - CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); - locked = 1; - he=BIO_gethostbyname(str); - if (he == NULL) + memset(&hint,0,sizeof(hint)); +#if OPENSSL_USE_IPV6 + hint.ai_family=AF_INET6; +#else + hint.ai_family=AF_INET; +#endif + gai_err = BIO_getaddrinfo(str, NULL, &hint, &res); + if (gai_err == 0) { - BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_BAD_HOSTNAME_LOOKUP); + res=NULL; goto err; } + else if (gai_err < 0) /* Not supported fallback in gethostbyname */ + { + ERR_get_error(); /* suppress the error generated by BIO_getaddrinfo */ + /* do a gethostbyname */ + CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); + locked = 1; + he=BIO_gethostbyname(str); + if (he == NULL) + { + BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_BAD_HOSTNAME_LOOKUP); + goto err; + } - /* cast to short because of win16 winsock definition */ - if ((short)he->h_addrtype != AF_INET) + /* cast to short because of win16 winsock definition */ + if ((short)he->h_addrtype != AF_INET) + { + BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); + goto err; + } + addr = he->h_addr; + addrlen = he->h_length; + } + else { - BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); - goto err; + if (res->ai_family == AF_INET) + { + assert(res->ai_addrlen == sizeof(struct sockaddr_in)); + addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr; + addrlen = 4; + } + else if (res->ai_family == AF_INET6) + { + assert(res->ai_addrlen == sizeof(struct sockaddr_in6)); + addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr.s6_addr; + addrlen = 16; + } + else + goto err; } - for (i=0; i<4; i++) - ip[i]=he->h_addr_list[0][i]; + for (i=0; i < addrlen; i++) + ip[i]=addr[i]; /* Store the address in network byte order */ err = 0; err: if (locked) CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); + if (res) + BIO_freeaddrinfo(res); if (err) { ERR_add_error_data(2,"host=",str); @@ -498,7 +544,7 @@ #endif ERR_add_error_data(1, reason); } - return (-1); + return (0); } return (1); } @@ -670,122 +716,133 @@ return(1); } -int BIO_get_accept_socket(char *host, int bind_mode) +static int parse_ip(char *str, char **host, char **port, int *is_inet6) { - int ret=0; - union { - struct sockaddr sa; - struct sockaddr_in sa_in; -#if OPENSSL_USE_IPV6 - struct sockaddr_in6 sa_in6; -#endif - } server,client; - int s=INVALID_SOCKET,cs,addrlen; - unsigned char ip[4]; - unsigned short port; - char *str=NULL,*e; - char *h,*p; - unsigned long l; - int err_num; - - if (BIO_sock_init() != 1) return(INVALID_SOCKET); - - if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); - - h=p=NULL; - h=str; - for (e=str; *e; e++) - { - if (*e == ':') + char *tmp; + char *h = *host = NULL; + char *p = *port = NULL; + + *is_inet6 = 0; + if (*str == '\0') + return (0); + if (*str == '[' && (tmp = strchr(str + 1, ']'))) + { + h = str + 1; + *tmp++ = '\0'; + if (*tmp == ':') + p = tmp + 1; + else if (*tmp != '\0') + return (0); + *is_inet6 = 1; + } + else + { + if ((tmp = strchr(str, ':'))) { - p=e; + h = str; + *tmp++ = '\0'; + p = tmp; } - else if (*e == '/') + else if ((tmp = strchr(str, '/'))) { - *e='\0'; - break; + if (*(tmp + 1) != '\0') + return (0); + p = str; + *tmp = '\0'; } - } - if (p) *p++='\0'; /* points at last ':', '::port' is special [see below] */ - else p=h,h=NULL; - -#ifdef EAI_FAMILY - do { - static union { void *p; - int (WSAAPI *f)(const char *,const char *, - const struct addrinfo *, - struct addrinfo **); - } p_getaddrinfo = {NULL}; - static union { void *p; - void (WSAAPI *f)(struct addrinfo *); - } p_freeaddrinfo = {NULL}; - struct addrinfo *res,hint; + else + h = str; + } + if (h && (*h == '\0' || !strcmp(h, "*"))) + h = NULL; + if (p && (*p == '\0' || !strcmp(p, "*"))) + p = NULL; + *host = h; + *port = p; + return (1); + } - if (p_getaddrinfo.p==NULL) - { - if ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL || - (p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL) - p_getaddrinfo.p=(void*)-1; - } - if (p_getaddrinfo.p==(void *)-1) break; +static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6) + { + unsigned short p; + int sa_len = 0; +#ifdef OPENSSL_USE_IPV6 + unsigned char h[16]; +#else + unsigned char h[4]; +#endif - /* '::port' enforces IPv6 wildcard listener. Some OSes, - * e.g. Solaris, default to IPv6 without any hint. Also - * note that commonly IPv6 wildchard socket can service - * IPv4 connections just as well... */ - memset(&hint,0,sizeof(hint)); - hint.ai_flags = AI_PASSIVE; - if (h) - { - if ((e = strchr(h,':'))) + if (!BIO_get_port(port,&p)) return (0); + memset((char *)sa,0,sizeof(*sa)); + memset(h, 0, sizeof(h)); + if (is_inet6) /* deal with inet6 format (ie: [host]:port) */ + { +#ifdef OPENSSL_USE_IPV6 + assert(sizeof(*sa) >= sizeof(struct sockaddr_in6)); + sa->sa_in6.sin6_family = AF_INET6; + sa->sa_in6.sin6_port = htons(p); + sa_len = sizeof(sa->sa_in6); +#ifdef SIN6_LEN /* BSD 4.4 */ + sa->sa_in6.sin6_len = sa_len; +#endif + if (h == NULL) + sa->sa_in6.sin6_addr = in6addr_any; + else { - *e = '\0'; - if (h[1]=='\0') h=NULL; -#if OPENSSL_USE_IPV6 - hint.ai_family = AF_INET6; + if (!BIO_get_host_ip(host, h)) return (0); + memcpy(&sa->sa_in6.sin6_addr.s6_addr, h, sizeof(h)); + } #else - h=NULL; + /* inet6 format used without OPENSSL configured properly, thus invalid */ + BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS); + return (0); +#endif + } + else /* we must resolve an inet4 address */ + { + assert(sizeof(*sa) >= sizeof(struct sockaddr_in)); + sa->sa_in.sin_family=AF_INET; + sa->sa_in.sin_port=htons(p); + sa_len = sizeof(sa->sa_in); +#if 1 + /* TODO add a definition at compile time */ + sa->sa_in.sin_len = sa_len; #endif - } - else if (h[0]=='*' && h[1]=='\0') + if (h == NULL) + sa->sa_in.sin_addr.s_addr=INADDR_ANY; + else { - hint.ai_family = AF_INET; - h=NULL; + /* + * TODO force inet4 listening even with OPENSSL_USE_IPV6 + * + * CONF_LOCAL(h) + * CONF_INETONLY(h) + */ + if (!BIO_get_host_ip(host, h)) return (0); + memcpy(&sa->sa_in.sin_addr.s_addr, h, 4); /* always 4 here especially when using inet6 */ } } + return (sa_len); + } - if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break; - - addrlen = res->ai_addrlen<=sizeof(server) ? - res->ai_addrlen : - sizeof(server); - memcpy(&server, res->ai_addr, addrlen); - - (*p_freeaddrinfo.f)(res); - goto again; - } while (0); -#endif - - if (!BIO_get_port(p,&port)) goto err; - - memset((char *)&server,0,sizeof(server)); - server.sa_in.sin_family=AF_INET; - server.sa_in.sin_port=htons(port); - addrlen = sizeof(server.sa_in); +int BIO_get_accept_socket(char *host, int bind_mode) + { + union sa_storage server,client; + int s=INVALID_SOCKET,cs,addrlen; + char *str=NULL; + char *h,*p; + int err_num; + int is_inet6 = 0; + int ret = 0; - if (h == NULL || strcmp(h,"*") == 0) - server.sa_in.sin_addr.s_addr=INADDR_ANY; - else + if (BIO_sock_init() != 1) return(INVALID_SOCKET); + if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); + if (parse_ip(str, &h, &p, &is_inet6) != 1) { - if (!BIO_get_host_ip(h,&(ip[0]))) goto err; - l=(unsigned long) - ((unsigned long)ip[0]<<24L)| - ((unsigned long)ip[1]<<16L)| - ((unsigned long)ip[2]<< 8L)| - ((unsigned long)ip[3]); - server.sa_in.sin_addr.s_addr=htonl(l); + BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS); + goto err; } - + if ((addrlen = fill_addr(&server, h, p, is_inet6)) == 0) goto err; /* Errors have been already generated */ again: s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL); if (s == INVALID_SOCKET) @@ -820,7 +877,7 @@ #endif { client = server; - if (h == NULL || strcmp(h,"*") == 0) + if (h == NULL) { #if OPENSSL_USE_IPV6 if (client.sa.sa_family == AF_INET6) Modified: soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h ============================================================================== --- soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h Sun Jun 17 00:28:57 2012 (r237820) +++ soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h Sun Jun 17 02:29:04 2012 (r237821) @@ -76,8 +76,12 @@ # endif #endif -/* under which condition ? */ +/* TODO + * Under which condition ? + */ #include +#include +#include #ifdef __cplusplus extern "C" { @@ -720,9 +724,40 @@ */ #ifndef EAI_FAMILY -struct addrinfo { /* dummy interface */ }; + +struct addrinfo /* fake interface */ + { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + int ai_addrlen; + char* ai_canonname; + struct sockaddr *ai_addr; + struct addrinfo *ai_next; + }; + +/* dummy definitions */ +#define AI_PASSIVE 0 +#define AI_CANONNAME 0 +#define AI_NUMERICHOST 0 +#define AI_NUMERICSERV 0 +#define AI_ALL 0 +#define AI_V4MAPPED_CFG 0 +#define AI_ADDRCONFIG 0 +#define AI_V4MAPPED 0 + #endif +union sa_storage + { + struct sockaddr sa; + struct sockaddr_in sa_in; +#if OPENSSL_USE_IPV6 + struct sockaddr_in6 sa_in6; +#endif + }; + int BIO_getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res); void BIO_freeaddrinfo(struct addrinfo *ai); Modified: soc2012/exxo/regress/openssl-1.0.1c/Makefile ============================================================================== --- soc2012/exxo/regress/openssl-1.0.1c/Makefile Sun Jun 17 00:28:57 2012 (r237820) +++ soc2012/exxo/regress/openssl-1.0.1c/Makefile Sun Jun 17 02:29:04 2012 (r237821) @@ -1,6 +1,7 @@ REGRESS_TARGETS = rg1 rg2 rg3 OPENSSL = ${.CURDIR}/../../openssl-1.0.1c +OPENSSL_FLAGS += -g -DOPENSSL_USE_IPV6 LIB_CRYPTO = $(OPENSSL)/libcrypto.a MAKE ?= make @@ -8,7 +9,7 @@ .PHONY: all clean openssl openssl-fconfig openssl-clean regress .MAIN: all -OPENSSL_CONFIGURE = cd $(OPENSSL) && ./config -g +OPENSSL_CONFIGURE = cd $(OPENSSL) && ./config $(OPENSSL_FLAGS) depend $(LIB_CRYPTO): .SILENT if ! [ -e $(OPENSSL)/Makefile.bak ]; then \ Modified: soc2012/exxo/regress/regress.in ============================================================================== --- soc2012/exxo/regress/regress.in Sun Jun 17 00:28:57 2012 (r237820) +++ soc2012/exxo/regress/regress.in Sun Jun 17 02:29:04 2012 (r237821) @@ -72,7 +72,9 @@ _startest_() { - ${BINDIR}/${BASENAME} > "${LOGDIR}/${BASENAME}-err.log" 2>&1 & + local args="" + + stdbuf -o L ${BINDIR}/${BASENAME} "${args}" > "${LOGDIR}/${BASENAME}-err.log" 2>&1 & PID=$! } From owner-svn-soc-all@FreeBSD.ORG Sun Jun 17 04:30: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 87D781065674 for ; Sun, 17 Jun 2012 04:30:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 17 Jun 2012 04:30:53 +0000 Date: Sun, 17 Jun 2012 04:30: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: <20120617043053.87D781065674@hub.freebsd.org> Cc: Subject: socsvn commit: r237826 - in soc2012/jhagewood: diff diff3 mdocml 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: Sun, 17 Jun 2012 04:30:55 -0000 Author: jhagewood Date: Sun Jun 17 04:30:52 2012 New Revision: 237826 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237826 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sun Jun 17 03:59:17 2012 (r237825) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sun Jun 17 04:30:52 2012 (r237826) @@ -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-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-15 22:42:05.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-17 04:30:34.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-17 04:30:34.000000000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -90,7 +90,7 @@ yflag = 1; break; + case OPT_NORMAL: -+ /* Default output style, do nothing to change output. */ ++ format = D_NORMAL; + break; case OPT_TSIZE: if (optarg != NULL) { @@ -105,8 +105,8 @@ break; case D_DIFFER: diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-13 05:07:22.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.h 2012-06-17 04:30:34.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-17 04:30:34.000000000 -0400 @@ -75,7 +75,7 @@ struct excludes { struct excludes *next; }; @@ -117,8 +117,8 @@ extern int Bflag, strip_cr, tabsize; extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-15 21:45:34.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-17 04:30:34.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-17 04:30:34.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sun Jun 17 03:59:17 2012 (r237825) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sun Jun 17 04:30:52 2012 (r237826) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-10 03:31:05.000000000 -0400 +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-17 04:30:34.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-17 04:30:34.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-14 05:32:21.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-15 18:23:03.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-17 04:30:34.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-17 04:30:34.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 Sun Jun 17 03:59:17 2012 (r237825) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Sun Jun 17 04:30:52 2012 (r237826) @@ -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-10 03:31:06.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-12 04:34:37.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-17 04:30:35.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-17 04:30:35.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-10 03:31:06.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-17 04:30:35.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-10 03:31:06.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-12 04:36:15.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-17 04:30:35.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-17 04:30:35.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-10 03:31:06.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-17 04:30:35.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Sun Jun 17 04:32: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 DA8E31065670 for ; Sun, 17 Jun 2012 04:32:44 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 17 Jun 2012 04:32:44 +0000 Date: Sun, 17 Jun 2012 04:32: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: <20120617043244.DA8E31065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237827 - 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: Sun, 17 Jun 2012 04:32:47 -0000 Author: jhagewood Date: Sun Jun 17 04:32:44 2012 New Revision: 237827 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237827 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Sun Jun 17 04:30:52 2012 (r237826) +++ soc2012/jhagewood/diff/TODO Sun Jun 17 04:32:44 2012 (r237827) @@ -9,7 +9,7 @@ --normal COMPLETE Sets format to D_NORMAL in getopt_long(). --supress-common-lines INCOMPLETE --GTYPE-group-format INCOMPLETE ---line-format INCOMPLETE +--line-format IN PROGRESS --LTYPE-line-format INCOMPLETE --from-file INCOMPLETE --to-file INCOMPLETE Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Sun Jun 17 04:30:52 2012 (r237826) +++ soc2012/jhagewood/diff/diff/diff.c Sun Jun 17 04:32:44 2012 (r237827) @@ -85,11 +85,12 @@ static struct option longopts[] = { { "normal", no_argument, NULL, OPT_NORMAL }, + { "line-format", required_argument, NULL, OPT_LF }, /* XXX: UNIMPLEMENTED { "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 }, { "from-file", required_argument, NULL, OPT_FFILE }, { "to-file", required_argument, NULL, OPT_TOFILE }, @@ -297,6 +298,10 @@ case 'y': yflag = 1; break; + case OPT_LF: + /* XXX To do: Complete --line-format. */ + format = D_IFDEF; + break; case OPT_NORMAL: format = D_NORMAL; break; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sun Jun 17 04:30:52 2012 (r237826) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sun Jun 17 04:32:44 2012 (r237827) @@ -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-17 04:30:34.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-17 04:30:34.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-10 03:31:05.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-17 04:31:37.036993000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -31,7 +31,7 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,14 +83,14 @@ enum +@@ -84,14 +83,15 @@ enum static struct option longopts[] = { @@ -39,17 +39,19 @@ + { "normal", no_argument, NULL, OPT_NORMAL }, - { "left-column", no_argument, NULL, OPT_LEFTC }, ++ { "line-format", required_argument, NULL, OPT_LF }, +/* XXX: UNIMPLEMENTED + { "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 }, +- { "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 }, -@@ -109,8 +108,7 @@ static struct option longopts[] = { +@@ -109,8 +109,7 @@ static struct option longopts[] = { { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, @@ -59,7 +61,7 @@ { "ed", no_argument, NULL, 'e' }, /* XXX: UNIMPLEMENTED { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +127,6 @@ static struct option longopts[] = { +@@ -129,7 +128,6 @@ static struct option longopts[] = { { "report-identical-files", no_argument, NULL, 's' }, { "initial-tab", no_argument, NULL, 'T' }, { "expand-tabs", no_argument, NULL, 't' }, @@ -67,7 +69,7 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -197,6 +194,7 @@ main(int argc, char **argv) +@@ -197,6 +195,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -75,7 +77,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +211,9 @@ main(int argc, char **argv) +@@ -213,6 +212,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -85,17 +87,21 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +297,9 @@ main(int argc, char **argv) +@@ -296,6 +298,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; ++ case OPT_LF: ++ /* XXX To do: Complete --line-format. */ ++ format = D_IFDEF; ++ break; + case OPT_NORMAL: + format = D_NORMAL; + break; case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +552,7 @@ print_status(int val, char *path1, char +@@ -548,7 +557,7 @@ print_status(int val, char *path1, char path1, entry ? entry : "", path2, entry ? entry : ""); break; case D_BINARY: @@ -105,8 +111,8 @@ break; case D_DIFFER: diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-17 04:30:34.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-17 04:30:34.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.h 2012-06-10 03:31:05.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-13 05:07:22.000000000 -0400 @@ -75,7 +75,7 @@ struct excludes { struct excludes *next; }; @@ -117,8 +123,8 @@ extern int Bflag, strip_cr, tabsize; extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-17 04:30:34.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-17 04:30:34.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-10 03:31:05.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-17 04:31:40.465581000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" From owner-svn-soc-all@FreeBSD.ORG Sun Jun 17 20:11:36 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 D0DAE1065670 for ; Sun, 17 Jun 2012 20:11:33 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 17 Jun 2012 20:11:33 +0000 Date: Sun, 17 Jun 2012 20:11:33 +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: <20120617201133.D0DAE1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237848 - in soc2012/aleek/beaglexm-armv6/sys: 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: Sun, 17 Jun 2012 20:11:36 -0000 Author: aleek Date: Sun Jun 17 20:11:33 2012 New Revision: 237848 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237848 Log: modified System Control Module (SCM) for omap3. Seems to work, need to test after PRCM is working Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_scm_padconf.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sun Jun 17 19:16:31 2012 (r237847) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sun Jun 17 20:11:33 2012 (r237848) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2011 - * Ben Gray . + * Copyright (c) 2012 Damjan Marion * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -12,10 +11,10 @@ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -30,171 +29,103 @@ #include #include +#include #include #include -#include -#include -#include -#include #include - +#include +#include +#include +#include #include #include -#include #include -#include #include #include +#include #include -#include - - - -/* - * This file defines the clock configuration for the OMAP3xxx series of - * devices. - * - * How This is Suppose to Work - * =========================== - * - There is a top level omap_prcm module that defines all OMAP SoC drivers - * should use to enable/disable the system clocks regardless of the version - * of OMAP device they are running on. This top level PRCM module is just - * a thin shim to chip specific functions that perform the donkey work of - * configuring the clock - this file is the 'donkey' for OMAP35xx devices. - * - * - The key bit in this file is the omap_clk_devmap array, it's - * used by the omap_prcm driver to determine what clocks are valid and which - * functions to call to manipulate them. - * - * - In essence you just need to define some callbacks for each of the - * clocks and then you're done. - * - * - The other thing worth noting is that when the omap_prcm device - * is registered you typically pass in some memory ranges which are the - * SYS_MEMORY resources. These resources are in turn allocated using - * bus_allocate_resources(...) and the resource handles are passed to all - * individual clock callback handlers. - * - * - * - * - */ - - -void -omap3_clk_init(device_t dev, int prio); - -static int -omap3_clk_generic_activate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - -static int -omap3_clk_generic_deactivate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - -static int -omap3_clk_generic_accessible(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - -static int -omap3_clk_generic_set_source(const struct ti_clock_dev *clkdev, clk_src_t clksrc, - struct resource* mem_res[]); - -static int -omap3_clk_generic_get_source_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, - struct resource* mem_res[]); - - -static int -omap3_clk_gptimer_get_source_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, - struct resource* mem_res[]); -static int -omap3_clk_gptimer_set_source(const struct ti_clock_dev *clkdev, - clk_src_t clksrc, struct resource* mem_res[]); - - - -static int -omap3_clk_alwayson_null_func(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - - - -static int -omap3_clk_get_sysclk_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, struct resource* mem_res[]); - -static int -omap3_clk_get_arm_fclk_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, struct resource* mem_res[]); - - - -static int -omap3_clk_hsusbhost_activate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - -static int -omap3_clk_hsusbhost_deactivate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]); - - - - -#define FREQ_96MHZ 96000000 -#define FREQ_64MHZ 64000000 -#define FREQ_48MHZ 48000000 -#define FREQ_32KHZ 32000 +#include +#include +#include +#include +#include +#include -/** - * Only one memory regions is needed for OMAP35xx clock control (unlike OMAP4) - * - * CM Instance - 0x4800 4000 : 0x4800 5500 - * PRM Instance - 0x4830 6000 : 0x4830 8000 - * - */ -#define CM_INSTANCE_MEM_REGION 0 -#define PRM_INSTANCE_MEM_REGION 1 - -#define IVA2_CM_OFFSET 0x0000 -#define OCP_SYSTEM_CM_OFFSET 0x0800 -#define MPU_CM_OFFSET 0x0900 -#define CORE_CM_OFFSET 0x0A00 -#define SGX_CM_OFFSET 0x0B00 -#define WKUP_CM_OFFSET 0x0C00 -#define CLOCK_CTRL_CM_OFFSET 0x0D00 -#define DSS_CM_OFFSET 0x0E00 -#define CAM_CM_OFFSET 0x0F00 -#define PER_CM_OFFSET 0x1000 -#define EMU_CM_OFFSET 0x1100 -#define GLOBAL_CM_OFFSET 0x1200 -#define NEON_CM_OFFSET 0x1300 -#define USBHOST_CM_OFFSET 0x1400 - -#define IVA2_PRM_OFFSET 0x0000 -#define OCP_SYSTEM_PRM_OFFSET 0x0800 -#define MPU_PRM_OFFSET 0x0900 -#define CORE_PRM_OFFSET 0x0A00 -#define SGX_PRM_OFFSET 0x0B00 -#define WKUP_PRM_OFFSET 0x0C00 -#define CLOCK_CTRL_PRM_OFFSET 0x0D00 -#define DSS_PRM_OFFSET 0x0E00 -#define CAM_PRM_OFFSET 0x0F00 -#define PER_PRM_OFFSET 0x1000 -#define EMU_PRM_OFFSET 0x1100 -#define GLOBAL_PRM_OFFSET 0x1200 -#define NEON_PRM_OFFSET 0x1300 -#define USBHOST_PRM_OFFSET 0x1400 - - +#define CM_PER 0 +#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000) +#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004) +#define CM_PER_L3_CLKSTCTRL (CM_PER + 0x00C) +#define CM_PER_CPGMAC0_CLKCTRL (CM_PER + 0x014) +#define CM_PER_USB0_CLKCTRL (CM_PER + 0x01C) +#define CM_PER_TPTC0_CLKCTRL (CM_PER + 0x024) +#define CM_PER_MMC0_CLKCTRL (CM_PER + 0x03C) +#define CM_PER_I2C2_CLKCTRL (CM_PER + 0x044) +#define CM_PER_I2C1_CLKCTRL (CM_PER + 0x048) +#define CM_PER_TIMER7_CLKCTRL (CM_PER + 0x07C) +#define CM_PER_TIMER2_CLKCTRL (CM_PER + 0x080) +#define CM_PER_TIMER3_CLKCTRL (CM_PER + 0x084) +#define CM_PER_TIMER4_CLKCTRL (CM_PER + 0x088) +#define CM_PER_GPIO1_CLKCTRL (CM_PER + 0x0AC) +#define CM_PER_GPIO2_CLKCTRL (CM_PER + 0x0B0) +#define CM_PER_GPIO3_CLKCTRL (CM_PER + 0x0B4) +#define CM_PER_TPCC_CLKCTRL (CM_PER + 0x0BC) +#define CM_PER_L3_INSTR_CLKCTRL (CM_PER + 0x0DC) +#define CM_PER_L3_CLKCTRL (CM_PER + 0x0E0) +#define CM_PER_TIMER5_CLKCTRL (CM_PER + 0x0EC) +#define CM_PER_TIMER6_CLKCTRL (CM_PER + 0x0F0) +#define CM_PER_MMC1_CLKCTRL (CM_PER + 0x0F4) +#define CM_PER_MMC2_CLKCTRL (CM_PER + 0x0F8) +#define CM_PER_TPTC1_CLKCTRL (CM_PER + 0x0FC) +#define CM_PER_TPTC2_CLKCTRL (CM_PER + 0x100) +#define CM_PER_OCPWP_L3_CLKSTCTRL (CM_PER + 0x12C) +#define CM_PER_OCPWP_CLKCTRL (CM_PER + 0x130) +#define CM_PER_CPSW_CLKSTCTRL (CM_PER + 0x144) + +#define CM_WKUP 0x400 +#define CM_WKUP_CLKSTCTRL (CM_WKUP + 0x000) +#define CM_WKUP_CONTROL_CLKCTRL (CM_WKUP + 0x004) +#define CM_WKUP_GPIO0_CLKCTRL (CM_WKUP + 0x008) +#define CM_WKUP_CM_L3_AON_CLKSTCTRL (CM_WKUP + 0x01C) +#define CM_WKUP_CM_CLKSEL_DPLL_MPU (CM_WKUP + 0x02C) +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER (CM_WKUP + 0x07C) +#define CM_WKUP_I2C0_CLKCTRL (CM_WKUP + 0x0B8) + +#define CM_DPLL 0x500 +#define CLKSEL_TIMER7_CLK (CM_DPLL + 0x004) +#define CLKSEL_TIMER2_CLK (CM_DPLL + 0x008) +#define CLKSEL_TIMER3_CLK (CM_DPLL + 0x00C) +#define CLKSEL_TIMER4_CLK (CM_DPLL + 0x010) +#define CLKSEL_TIMER5_CLK (CM_DPLL + 0x018) +#define CLKSEL_TIMER6_CLK (CM_DPLL + 0x01C) + +#define PRM_DEVICE_OFFSET 0xF00 +#define PRM_RSTCTRL (PRM_DEVICE_OFFSET + 0x00) + +struct omap3_prcm_softc { + struct resource * res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; +}; +static struct resource_spec omap3_prcm_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; +static struct omap3_prcm_softc *omap3_prcm_sc = NULL; +static int omap3_clk_generic_activate(struct ti_clock_dev *clkdev); +static int omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev); +static int omap3_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); +static int omap3_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static void omap3_prcm_reset(void); +static int omap3_clk_cpsw_activate(struct ti_clock_dev *clkdev); +static int omap3_clk_musb0_activate(struct ti_clock_dev *clkdev); /** * omap_clk_devmap - Array of clock devices available on OMAP3xxx devices @@ -245,9 +176,10 @@ } -const struct ti_clock_dev omap_clk_devmap[] = { - /* System clock */ + +struct ti_clock_dev ti_clk_devmap[] = { + /* System clocks */ { .id = SYS_CLK, .clk_activate = NULL, .clk_deactivate = NULL, @@ -263,934 +195,373 @@ .clk_accessible = NULL, .clk_get_source_freq = omap3_clk_get_arm_fclk_freq, }, + /* CPSW Ethernet Switch core clocks */ + { .id = CPSW_CLK, + .clk_activate = omap3_clk_cpsw_activate, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = NULL, + }, + /* Mentor USB HS controller core clocks */ + { .id = MUSB0_CLK, + .clk_activate = omap3_clk_musb0_activate, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = NULL, + }, - /* UART device clocks */ - OMAP3_GENERIC_CLOCK_DEV(UART1_CLK), - OMAP3_GENERIC_CLOCK_DEV(UART2_CLK), - OMAP3_GENERIC_CLOCK_DEV(UART3_CLK), - OMAP3_GENERIC_CLOCK_DEV(UART4_CLK), - - /* Timer device source clocks */ - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER1_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER2_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER3_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER4_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER5_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER6_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER7_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER8_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER9_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER10_CLK), - OMAP3_GPTIMER_CLOCK_DEV(GPTIMER11_CLK), - - /* MMC device clocks (MMC1 and MMC2 can have different input clocks) */ - OMAP3_GENERIC_CLOCK_DEV(MMC1_CLK), - OMAP3_GENERIC_CLOCK_DEV(MMC2_CLK), - OMAP3_GENERIC_CLOCK_DEV(MMC3_CLK), - - /* USB HS (high speed TLL, EHCI and OHCI) */ - OMAP3_GENERIC_CLOCK_DEV(USBTLL_CLK), - OMAP3_HSUSBHOST_CLOCK_DEV(USBHSHOST_CLK), + /* DMTimer */ + AM335X_GENERIC_CLOCK_DEV(DMTIMER2_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER3_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER4_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER5_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER6_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER7_CLK), /* GPIO */ - OMAP3_GENERIC_CLOCK_DEV(GPIO1_CLK), - OMAP3_GENERIC_CLOCK_DEV(GPIO2_CLK), - OMAP3_GENERIC_CLOCK_DEV(GPIO3_CLK), - OMAP3_GENERIC_CLOCK_DEV(GPIO4_CLK), - OMAP3_GENERIC_CLOCK_DEV(GPIO5_CLK), - OMAP3_GENERIC_CLOCK_DEV(GPIO6_CLK), - - /* I2C */ - OMAP3_GENERIC_CLOCK_DEV(I2C1_CLK), - OMAP3_GENERIC_CLOCK_DEV(I2C2_CLK), - OMAP3_GENERIC_CLOCK_DEV(I2C3_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO0_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO1_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO2_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO3_CLK), - /* sDMA */ - OMAP3_ALWAYSON_CLOCK_DEV(SDMA_CLK), + /* I2C */ + AM335X_GENERIC_CLOCK_DEV(I2C0_CLK), + AM335X_GENERIC_CLOCK_DEV(I2C1_CLK), + AM335X_GENERIC_CLOCK_DEV(I2C2_CLK), + + /* EDMA */ + AM335X_GENERIC_CLOCK_DEV(EDMA_TPCC_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC0_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC1_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC2_CLK), + + /* MMCHS */ + AM335X_MMCHS_CLOCK_DEV(MMC0_CLK), + AM335X_MMCHS_CLOCK_DEV(MMC1_CLK), + AM335X_MMCHS_CLOCK_DEV(MMC2_CLK), { INVALID_CLK_IDENT, NULL, NULL, NULL, NULL } }; - - - - - -/** - * g_omap3_clk_details - Stores details for all the different clocks supported - * - * Whenever an operation on a clock is being performed (activated, deactivated, - * etc) this array is looked up to find the correct register and bit(s) we - * should be modifying. - * - */ - struct omap3_clk_details { - clk_ident_t id; - int32_t src_freq; - - /* The register offset from the CM module register region of the registers*/ - uint32_t fclken_offset; - uint32_t iclken_offset; - uint32_t idlest_offset; - - /* The bit offset for the clock */ - uint32_t bit_offset; + clk_ident_t id; + uint32_t clkctrl_reg; + uint32_t clksel_reg; }; -#define OMAP3_GENERIC_CLOCK_DETAILS(d, freq, base, fclk, iclk, idlest, bit) \ - { .id = (d), \ - .src_freq = (freq), \ - .fclken_offset = ((base) + (fclk)), \ - .iclken_offset = ((base) + (iclk)), \ - .idlest_offset = ((base) + (idlest)), \ - .bit_offset = (bit), \ +#define _CLK_DETAIL(i, c, s) \ + { .id = (i), \ + .clkctrl_reg = (c), \ + .clksel_reg = (s), \ } -static const struct omap3_clk_details g_omap3_clk_details[] = { +static struct omap3_clk_details g_omap3_clk_details[] = { - /* UART */ - OMAP3_GENERIC_CLOCK_DETAILS(UART1_CLK, FREQ_48MHZ, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 13), - OMAP3_GENERIC_CLOCK_DETAILS(UART2_CLK, FREQ_48MHZ, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 14), - OMAP3_GENERIC_CLOCK_DETAILS(UART3_CLK, FREQ_48MHZ, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 11), - - /* General purpose timers */ - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER1_CLK, -1, WKUP_CM_OFFSET, - 0x00, 0x10, 0x20, 3), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER2_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 3), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER3_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 4), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER4_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 5), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER5_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 6), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER6_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 7), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER7_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 8), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER8_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 9), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER9_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 10), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER10_CLK, -1, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 11), - OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER11_CLK, -1, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 12), - - /* HSMMC (MMC1 and MMC2 can have different input clocks) */ - OMAP3_GENERIC_CLOCK_DETAILS(MMC1_CLK, FREQ_96MHZ, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 24), - 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, - 0x00, 0x10, 0x20, 30), - - /* USB HS (high speed TLL, EHCI and OHCI) */ - OMAP3_GENERIC_CLOCK_DETAILS(USBTLL_CLK, -1, CORE_CM_OFFSET, - 0x08, 0x18, 0x28, 2), - OMAP3_GENERIC_CLOCK_DETAILS(USBHSHOST_CLK, -1, USBHOST_CM_OFFSET, - 0x00, 0x10, 0x20, 1), + /* DMTimer modules */ + _CLK_DETAIL(DMTIMER2_CLK, CM_PER_TIMER2_CLKCTRL, CLKSEL_TIMER2_CLK), + _CLK_DETAIL(DMTIMER3_CLK, CM_PER_TIMER3_CLKCTRL, CLKSEL_TIMER3_CLK), + _CLK_DETAIL(DMTIMER4_CLK, CM_PER_TIMER4_CLKCTRL, CLKSEL_TIMER4_CLK), + _CLK_DETAIL(DMTIMER5_CLK, CM_PER_TIMER5_CLKCTRL, CLKSEL_TIMER5_CLK), + _CLK_DETAIL(DMTIMER6_CLK, CM_PER_TIMER6_CLKCTRL, CLKSEL_TIMER6_CLK), + _CLK_DETAIL(DMTIMER7_CLK, CM_PER_TIMER7_CLKCTRL, CLKSEL_TIMER7_CLK), /* GPIO modules */ - OMAP3_GENERIC_CLOCK_DETAILS(GPIO1_CLK, -1, WKUP_CM_OFFSET, - 0x00, 0x10, 0x20, 3), - OMAP3_GENERIC_CLOCK_DETAILS(GPIO2_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 13), - OMAP3_GENERIC_CLOCK_DETAILS(GPIO3_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 14), - OMAP3_GENERIC_CLOCK_DETAILS(GPIO4_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 15), - OMAP3_GENERIC_CLOCK_DETAILS(GPIO5_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 16), - OMAP3_GENERIC_CLOCK_DETAILS(GPIO6_CLK, -1, PER_CM_OFFSET, - 0x00, 0x10, 0x20, 17), - - /* I2C modules */ - OMAP3_GENERIC_CLOCK_DETAILS(I2C1_CLK, -1, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 15), - OMAP3_GENERIC_CLOCK_DETAILS(I2C2_CLK, -1, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 16), - OMAP3_GENERIC_CLOCK_DETAILS(I2C3_CLK, -1, CORE_CM_OFFSET, - 0x00, 0x10, 0x20, 17), + _CLK_DETAIL(GPIO0_CLK, CM_WKUP_GPIO0_CLKCTRL, 0), + _CLK_DETAIL(GPIO1_CLK, CM_PER_GPIO1_CLKCTRL, 0), + _CLK_DETAIL(GPIO2_CLK, CM_PER_GPIO2_CLKCTRL, 0), + _CLK_DETAIL(GPIO3_CLK, CM_PER_GPIO3_CLKCTRL, 0), + /* I2C modules */ + _CLK_DETAIL(I2C0_CLK, CM_WKUP_I2C0_CLKCTRL, 0), + _CLK_DETAIL(I2C1_CLK, CM_PER_I2C1_CLKCTRL, 0), + _CLK_DETAIL(I2C2_CLK, CM_PER_I2C2_CLKCTRL, 0), + + /* EDMA modules */ + _CLK_DETAIL(EDMA_TPCC_CLK, CM_PER_TPCC_CLKCTRL, 0), + _CLK_DETAIL(EDMA_TPTC0_CLK, CM_PER_TPTC0_CLKCTRL, 0), + _CLK_DETAIL(EDMA_TPTC1_CLK, CM_PER_TPTC1_CLKCTRL, 0), + _CLK_DETAIL(EDMA_TPTC2_CLK, CM_PER_TPTC2_CLKCTRL, 0), + + /* MMCHS modules*/ + _CLK_DETAIL(MMC0_CLK, CM_PER_MMC0_CLKCTRL, 0), + _CLK_DETAIL(MMC1_CLK, CM_PER_MMC1_CLKCTRL, 0), + _CLK_DETAIL(MMC2_CLK, CM_PER_MMC1_CLKCTRL, 0), - { INVALID_CLK_IDENT, 0, 0, 0, 0 }, + { INVALID_CLK_IDENT, 0}, }; +/* Read/Write macros */ +#define prcm_read_4(reg) \ + bus_space_read_4(omap3_prcm_sc->bst, omap3_prcm_sc->bsh, reg) +#define prcm_write_4(reg, val) \ + bus_space_write_4(omap3_prcm_sc->bst, omap3_prcm_sc->bsh, reg, val) +void omap3_prcm_setup_dmtimer(int); - - - -/** - * MAX_MODULE_ENABLE_WAIT - the number of loops to wait for the module to come - * alive. - * - */ -#define MAX_MODULE_ENABLE_WAIT 1000 - - -/** - * ARRAY_SIZE - Macro to return the number of elements in a static const array. - * - */ -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - - - - -/** - * omap3_clk_wait_on_reg - loops for MAX_MODULE_ENABLE_WAIT times or until - * register bit(s) change. - * @mem_res: memory resource of the register to read - * @off: offset of the register within mem_res - * @mask: the mask to bitwise AND with the register - * @cmp: if this value matches the register value after the mask is applied - * the function returns with 0. - * - * - * RETURNS: - * Returns 0 on success or ETIMEDOUT on failure. - */ static int -omap3_clk_wait_on_reg(struct resource* mem_res, bus_size_t off, uint32_t mask, - uint32_t cmp) +omap3_prcm_probe(device_t dev) { - unsigned int i; - for (i = 0; i < MAX_MODULE_ENABLE_WAIT; i++) { - if ((bus_read_4(mem_res, off) & mask) == cmp) - return (0); + if (ofw_bus_is_compatible(dev, "omap3,prcm")) { + device_set_desc(dev, "AM335x Power and Clock Management"); + return(BUS_PROBE_DEFAULT); } - return (ETIMEDOUT); + return (ENXIO); } - - - - -/** - * omap3_clk_details - returns a pointer to the generic clock details - * @id: The ID of the clock to get the details for - * - * This function iterates over the g_omap3_clk_details array and returns a - * pointer to the entry that matches the supplied ID, or NULL if no entry - * is found. - * - * RETURNS: - * Pointer to clock details or NULL on failure - */ -static const struct omap3_clk_details* -omap3_clk_details(clk_ident_t id) +static int +omap3_prcm_attach(device_t dev) { - const struct omap3_clk_details *walker; + struct omap3_prcm_softc *sc = device_get_softc(dev); + unsigned int sysclk, fclk; - for (walker = g_omap3_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { - if (id == walker->id) - return (walker); - } + if (omap3_prcm_sc) + return (ENXIO); - return NULL; -} + if (bus_alloc_resources(dev, omap3_prcm_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + omap3_prcm_sc = sc; + ti_cpu_reset = omap3_prcm_reset; + omap3_clk_get_sysclk_freq(NULL, &sysclk); + omap3_clk_get_arm_fclk_freq(NULL, &fclk); + device_printf(dev, "Clocks: System %u.%01u MHz, CPU %u MHz\n", + sysclk/1000000, (sysclk % 1000000)/100000, fclk/1000000); -/** - * omap3_clk_alwayson_null_func - dummy function for always on clocks - * @clkdev: pointer to the clock device structure (ignored) - * @mem_res: array of memory resources mapped when PRCM driver attached (ignored) - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a positive error code on failure. - */ -static int -omap3_clk_alwayson_null_func(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]) -{ return (0); } +static device_method_t omap3_prcm_methods[] = { + DEVMETHOD(device_probe, omap3_prcm_probe), + DEVMETHOD(device_attach, omap3_prcm_attach), + { 0, 0 } +}; +static driver_t omap3_prcm_driver = { + "omap3_prcm", + omap3_prcm_methods, + sizeof(struct omap3_prcm_softc), +}; +static devclass_t omap3_prcm_devclass; +DRIVER_MODULE(omap3_prcm, simplebus, omap3_prcm_driver, + omap3_prcm_devclass, 0, 0); +MODULE_DEPEND(omap3_prcm, ti_scm, 1, 1, 1); -/** - * omap3_clk_get_sysclk_freq - gets the sysclk frequency - * @sc: pointer to the clk module/device context - * - * Read the clocking information from the power-control/boot-strap registers, - * and stored in two global variables. - * - * RETURNS: - * nothing, values are saved in global variables - */ -static int -omap3_clk_get_sysclk_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, struct resource* mem_res[]) +static struct omap3_clk_details* +omap3_clk_details(clk_ident_t id) { - uint32_t clksel; - uint32_t clknsel; - unsigned int oscclk; - unsigned int sysclk; - - /* Read the input clock freq from the configuration register */ - clknsel = bus_read_4(mem_res[PRM_INSTANCE_MEM_REGION], CLOCK_CTRL_PRM_OFFSET + 0x40); - switch (clknsel & 0x7) { - case 0x0: - /* 12Mhz */ - oscclk = 12000000; - break; - case 0x1: - /* 13Mhz */ - oscclk = 13000000; - break; - case 0x2: - /* 19.2Mhz */ - oscclk = 19200000; - break; - case 0x3: - /* 26Mhz */ - oscclk = 26000000; - break; - case 0x4: - /* 38.4Mhz */ - oscclk = 38400000; - break; - case 0x5: - /* 16.8Mhz */ - oscclk = 16800000; - break; - default: - panic("%s: Invalid clock freq", __func__); - } + struct omap3_clk_details *walker; - /* Read the value of the clock divider used for the system clock */ - clksel = bus_read_4(mem_res[PRM_INSTANCE_MEM_REGION], GLOBAL_PRM_OFFSET + 0x70); - switch (clksel & 0xC0) { - case 0x40: - sysclk = oscclk; - break; - case 0x80: - sysclk = oscclk / 2; - break; - default: - panic("%s: Invalid system clock divider", __func__); + for (walker = g_omap3_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { + if (id == walker->id) + return (walker); } - /* Return the value */ - if (freq) - *freq = sysclk; - - return (0); + return NULL; } - - -/** - * omap3_clk_get_arm_fclk_freq - gets the MPU clock frequency - * @clkdev: ignored - * @freq: pointer which upon return will contain the freq in hz - * @mem_res: array of allocated memory resources - * - * Reads the frequency setting information registers and returns the value - * in the freq variable. - * - * RETURNS: - * returns 0 on success, a positive error code on failure. - */ static int -omap3_clk_get_arm_fclk_freq(const struct ti_clock_dev *clkdev, - unsigned int *freq, struct resource* mem_res[]) +omap3_clk_generic_activate(struct ti_clock_dev *clkdev) { - unsigned int sysclk; - unsigned int coreclk; - unsigned int mpuclk; - uint32_t clksel; - uint32_t clkout; - - - /* Get the SYSCLK freq */ - omap3_clk_get_sysclk_freq(clkdev, &sysclk, mem_res); - - - /* First get the freq of the CORE_CLK (feed from DPLL3) */ - clksel = bus_read_4(mem_res[CM_INSTANCE_MEM_REGION], CLOCK_CTRL_CM_OFFSET + 0x40); - clkout = (sysclk * ((clksel >> 16) & 0x7FF)) / (((clksel >> 8) & 0x7F) + 1); - coreclk = clkout / (clksel >> 27); - - - /* Next get the freq for the MPU_CLK */ - clksel = bus_read_4(mem_res[CM_INSTANCE_MEM_REGION], MPU_CM_OFFSET + 0x40); - mpuclk = (coreclk * ((clksel >> 8) & 0x7FF)) / ((clksel & 0x7F) + 1); - - - /* Return the value */ - if (freq) - *freq = mpuclk; - - return (0); -} - - - + struct omap3_prcm_softc *sc = omap3_prcm_sc; + struct omap3_clk_details* clk_details; + if (sc == NULL) + return ENXIO; - - - -/** - * omap3_clk_generic_activate - activates a modules iinterface and func clock - * @clkdev: pointer to the clock device structure. - * @mem_res: array of memory resources mapped when PRCM driver attached - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a positive error code on failure. - */ -static int -omap3_clk_generic_activate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]) -{ - const struct omap3_clk_details* clk_details = omap3_clk_details(clkdev->id); - struct resource* clk_mem_res = mem_res[CM_INSTANCE_MEM_REGION]; - uint32_t fclken, iclken; + clk_details = omap3_clk_details(clkdev->id); if (clk_details == NULL) return (ENXIO); - if (clk_mem_res == NULL) - return (ENOMEM); - - - /* All the 'generic' clocks have a FCLKEN, ICLKEN and IDLEST register which - * is for the functional, interface and clock status regsters respectively. - */ - - /* Enable the interface clock */ - iclken = bus_read_4(clk_mem_res, clk_details->iclken_offset); - iclken |= (1UL << clk_details->bit_offset); - bus_write_4(clk_mem_res, clk_details->iclken_offset, iclken); - - /* Read back the value to ensure the write has taken place ... needed ? */ - iclken = bus_read_4(clk_mem_res, clk_details->iclken_offset); - - - /* Enable the functional clock */ - fclken = bus_read_4(clk_mem_res, clk_details->fclken_offset); - fclken |= (1UL << clk_details->bit_offset); - bus_write_4(clk_mem_res, clk_details->fclken_offset, fclken); - - /* Read back the value to ensure the write has taken place ... needed ? */ - fclken = bus_read_4(clk_mem_res, clk_details->fclken_offset); - - - /* Now poll on the IDLEST register to tell us if the module has come up. - * TODO: We need to take into account the parent clocks. - */ - - /* Try MAX_MODULE_ENABLE_WAIT number of times to check if enabled */ - if (omap3_clk_wait_on_reg(clk_mem_res, clk_details->idlest_offset, - (1UL << clk_details->bit_offset), 0) != 0) { - printf("Error: failed to enable module with clock %d\n", clkdev->id); - return (ETIMEDOUT); - } - - return (0); -} + /* set *_CLKCTRL register MODULEMODE[1:0] to enable(2) */ + prcm_write_4(clk_details->clkctrl_reg, 2); + while ((prcm_read_4(clk_details->clkctrl_reg) & 0x3) != 2) + DELAY(10); - -/** - * omap3_clk_generic_deactivate - deactivates a modules clock - * @clkdev: pointer to the clock device structure. - * @mem_res: array of memory resources mapped when PRCM driver attached - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a positive error code on failure. - */ -static int -omap3_clk_generic_deactivate(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]) -{ - const struct omap3_clk_details* clk_details = omap3_clk_details(clkdev->id); - struct resource* clk_mem_res = mem_res[CM_INSTANCE_MEM_REGION]; - uint32_t fclken, iclken; - - if (clk_details == NULL) - return (ENXIO); - if (clk_mem_res == NULL) - return (ENOMEM); - - - /* All the 'generic' clocks have a FCLKEN, ICLKEN and IDLEST register which - * is for the functional, interface and clock status regsters respectively. - */ - - /* Disable the interface clock */ - iclken = bus_read_4(clk_mem_res, clk_details->iclken_offset); - iclken &= ~(1UL << clk_details->bit_offset); - bus_write_4(clk_mem_res, clk_details->iclken_offset, iclken); - - /* Disable the functional clock */ - fclken = bus_read_4(clk_mem_res, clk_details->fclken_offset); - fclken &= ~(1UL << clk_details->bit_offset); - bus_write_4(clk_mem_res, clk_details->fclken_offset, fclken); - - return (0); } - -/** - * omap3_clk_generic_set_source - checks if a module is accessible - * @clkdev: pointer to the clock device structure. - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a positive error code on failure. - */ static int -omap3_clk_generic_set_source(const struct ti_clock_dev *clkdev, - clk_src_t clksrc, struct resource* mem_res[]) +omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev) { + struct omap3_prcm_softc *sc = omap3_prcm_sc; + struct omap3_clk_details* clk_details; + if (sc == NULL) + return ENXIO; - return (0); -} - -/** - * omap3_clk_generic_accessible - checks if a module is accessible - * @clkdev: pointer to the clock device structure. - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a negative error code on failure. - */ -static int -omap3_clk_generic_accessible(const struct ti_clock_dev *clkdev, - struct resource* mem_res[]) -{ - const struct omap3_clk_details* clk_details = omap3_clk_details(clkdev->id); - struct resource* clk_mem_res = mem_res[CM_INSTANCE_MEM_REGION]; - uint32_t idlest; + clk_details = omap3_clk_details(clkdev->id); if (clk_details == NULL) return (ENXIO); - if (clk_mem_res == NULL) - return (ENOMEM); - - idlest = bus_read_4(clk_mem_res, clk_details->idlest_offset); - - /* Check the enabled state */ - if ((idlest & (1UL << clk_details->bit_offset)) == 0) - return (0); - - return (1); -} - -/** - * omap3_clk_generic_get_source_freq - checks if a module is accessible - * @clkdev: pointer to the clock device structure. - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a negative error code on failure. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 01:39: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 C8612106566B for ; Mon, 18 Jun 2012 01:39:39 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 01:39:39 +0000 Date: Mon, 18 Jun 2012 01:39: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: <20120618013939.C8612106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237861 - soc2012/jhagewood/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: Mon, 18 Jun 2012 01:39:42 -0000 Author: jhagewood Date: Mon Jun 18 01:39:38 2012 New Revision: 237861 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237861 Log: Added: soc2012/jhagewood/diff/diff-test.sh Added: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-test.sh Mon Jun 18 01:39:38 2012 (r237861) @@ -0,0 +1,43 @@ +# Script for testing BSD diff outputs against GNU diff outputs. +# Jesse Hagewood +# jhagewood@freebsd.org + +#!/bin/sh + +rm -rf ./test_outputs +mkdir ./test_outputs +mkdir ./test_outputs/gnu +mkdir ./test_outputs/bsd + +# +# Run GNU diff with various options, direct output to a file. +# + +# Default diff +diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# Unified output +diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt +diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt + +# Context output +diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt +diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt + +# +# Run BSD diff with various options, direct output to a file. +# + +# Default diff +./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# Unified output +./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt +./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt + +# Context output +./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt +./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt + +diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-diff.txt + From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:05: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 1845F106564A for ; Mon, 18 Jun 2012 02:05:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:05:53 +0000 Date: Mon, 18 Jun 2012 02:05: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: <20120618020553.1845F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237862 - 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: Mon, 18 Jun 2012 02:05:55 -0000 Author: jhagewood Date: Mon Jun 18 02:05:52 2012 New Revision: 237862 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237862 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 18 01:39:38 2012 (r237861) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 18 02:05:52 2012 (r237862) @@ -1602,10 +1602,12 @@ tm_ptr2 = localtime(&stb2.st_mtime); strftime(buf1, 256, time_format, tm_ptr1); strftime(buf2, 256, time_format, tm_ptr2); - strftime(end1, 10, "%z", tm_ptr1); - strftime(end2, 10, "%z", tm_ptr2); - sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1); - sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2); + if (!cflag) { + strftime(end1, 10, "%z", tm_ptr1); + strftime(end2, 10, "%z", tm_ptr2); + sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1); + sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2); + } if (label[0] != NULL) printf("%s %s\n", format == D_CONTEXT ? "***" : "---", label[0]); Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 01:39:38 2012 (r237861) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 02:05:52 2012 (r237862) @@ -124,7 +124,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-17 04:31:40.465581000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-18 02:05:37.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -224,7 +224,7 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -1551,16 +1581,41 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1581,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { @@ -249,10 +249,12 @@ + tm_ptr2 = localtime(&stb2.st_mtime); + strftime(buf1, 256, time_format, tm_ptr1); + strftime(buf2, 256, time_format, tm_ptr2); -+ strftime(end1, 10, "%z", tm_ptr1); -+ strftime(end2, 10, "%z", tm_ptr2); -+ sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1); -+ sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2); ++ if (!cflag) { ++ strftime(end1, 10, "%z", tm_ptr1); ++ strftime(end2, 10, "%z", tm_ptr2); ++ sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1); ++ sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2); ++ } if (label[0] != NULL) printf("%s %s\n", format == D_CONTEXT ? "***" : "---", - label[0]); From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:52: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 C02F710656D0 for ; Mon, 18 Jun 2012 02:52:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:52:42 +0000 Date: Mon, 18 Jun 2012 02:52: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: <20120618025242.C02F710656D0@hub.freebsd.org> Cc: Subject: socsvn commit: r237863 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:52:45 -0000 Author: jhagewood Date: Mon Jun 18 02:52:41 2012 New Revision: 237863 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237863 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 02:05:52 2012 (r237862) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 02:52:41 2012 (r237863) @@ -124,7 +124,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-18 02:05:37.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-18 02:52:22.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:57: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 4FEA9106564A for ; Mon, 18 Jun 2012 02:57:11 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:57:11 +0000 Date: Mon, 18 Jun 2012 02:57:11 +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: <20120618025711.4FEA9106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237864 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:57:13 -0000 Author: jhagewood Date: Mon Jun 18 02:57:11 2012 New Revision: 237864 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237864 Log: Added: soc2012/jhagewood/diff/diff-test.shclear Added: soc2012/jhagewood/diff/diff-test.shclear ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-test.shclear Mon Jun 18 02:57:11 2012 (r237864) @@ -0,0 +1,57 @@ +# Script for testing BSD diff outputs against GNU diff outputs. +# Jesse Hagewood +# jhagewood@freebsd.org + +#!/bin/sh + +rm -rf ./test_outputs +mkdir ./test_outputs +mkdir ./test_outputs/gnu +mkdir ./test_outputs/bsd + +# +# Run GNU diff with various options, direct output to a file. +# + +# Default diff +diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# Unified output +diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt +diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt + +# Context output +diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt +diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt + +# Normal format output +diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt + +# +# Run BSD diff with various options, direct output to a file. +# + +# Default diff +./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# Unified output +./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt +./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt + +# Context output +./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt +./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt + +# Normal format output +./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt + +# +# Get the diff between the GNU and BSD outputs. +# + +diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-diff.txt + From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:57:36 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 9D798106566C for ; Mon, 18 Jun 2012 02:57:35 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:57:35 +0000 Date: Mon, 18 Jun 2012 02:57:35 +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: <20120618025735.9D798106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237865 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:57:36 -0000 Author: jhagewood Date: Mon Jun 18 02:57:35 2012 New Revision: 237865 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237865 Log: Deleted: soc2012/jhagewood/diff/diff-test.shclear From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:57: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 6A177106566B for ; Mon, 18 Jun 2012 02:57:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:57:42 +0000 Date: Mon, 18 Jun 2012 02:57: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: <20120618025742.6A177106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237866 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:57:43 -0000 Author: jhagewood Date: Mon Jun 18 02:57:42 2012 New Revision: 237866 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237866 Log: Deleted: soc2012/jhagewood/diff/diff-test.sh From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:57: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 338E71065670 for ; Mon, 18 Jun 2012 02:57:50 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:57:50 +0000 Date: Mon, 18 Jun 2012 02:57:50 +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: <20120618025750.338E71065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237867 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:57:52 -0000 Author: jhagewood Date: Mon Jun 18 02:57:49 2012 New Revision: 237867 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237867 Log: Added: soc2012/jhagewood/diff/diff-test.shclear Added: soc2012/jhagewood/diff/diff-test.shclear ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-test.shclear Mon Jun 18 02:57:49 2012 (r237867) @@ -0,0 +1,57 @@ +# Script for testing BSD diff outputs against GNU diff outputs. +# Jesse Hagewood +# jhagewood@freebsd.org + +#!/bin/sh + +rm -rf ./test_outputs +mkdir ./test_outputs +mkdir ./test_outputs/gnu +mkdir ./test_outputs/bsd + +# +# Run GNU diff with various options, direct output to a file. +# + +# Default diff +diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# Unified output +diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt +diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt + +# Context output +diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt +diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt + +# Normal format output +diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt + +# +# Run BSD diff with various options, direct output to a file. +# + +# Default diff +./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# Unified output +./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt +./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt + +# Context output +./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt +./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt + +# Normal format output +./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt + +# +# Get the diff between the GNU and BSD outputs. +# + +diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-diff.txt + From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:58: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 1A5561065674 for ; Mon, 18 Jun 2012 02:58:01 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:58:01 +0000 Date: Mon, 18 Jun 2012 02:58:01 +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: <20120618025801.1A5561065674@hub.freebsd.org> Cc: Subject: socsvn commit: r237868 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:58:03 -0000 Author: jhagewood Date: Mon Jun 18 02:58:00 2012 New Revision: 237868 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237868 Log: Added: soc2012/jhagewood/diff/diff-test.sh Added: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff-test.sh Mon Jun 18 02:58:00 2012 (r237868) @@ -0,0 +1,57 @@ +# Script for testing BSD diff outputs against GNU diff outputs. +# Jesse Hagewood +# jhagewood@freebsd.org + +#!/bin/sh + +rm -rf ./test_outputs +mkdir ./test_outputs +mkdir ./test_outputs/gnu +mkdir ./test_outputs/bsd + +# +# Run GNU diff with various options, direct output to a file. +# + +# Default diff +diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# Unified output +diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt +diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt + +# Context output +diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt +diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt + +# Normal format output +diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt + +# +# Run BSD diff with various options, direct output to a file. +# + +# Default diff +./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# Unified output +./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt +./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt + +# Context output +./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt +./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt + +# Normal format output +./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt + +# +# Get the diff between the GNU and BSD outputs. +# + +diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-diff.txt + From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:58: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 CA843106566B for ; Mon, 18 Jun 2012 02:58:09 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:58:09 +0000 Date: Mon, 18 Jun 2012 02:58:09 +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: <20120618025809.CA843106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237869 - soc2012/jhagewood/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: Mon, 18 Jun 2012 02:58:11 -0000 Author: jhagewood Date: Mon Jun 18 02:58:09 2012 New Revision: 237869 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237869 Log: Deleted: soc2012/jhagewood/diff/diff-test.shclear From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02:59: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 17BB1106564A for ; Mon, 18 Jun 2012 02:59:10 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:59:10 +0000 Date: Mon, 18 Jun 2012 02:59:10 +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: <20120618025910.17BB1106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237870 - 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, 18 Jun 2012 02:59:11 -0000 Author: jhagewood Date: Mon Jun 18 02:59:09 2012 New Revision: 237870 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237870 Log: Deleted: soc2012/jhagewood/ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 02: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 524A0106566B for ; Mon, 18 Jun 2012 02:59:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 02:59:22 +0000 Date: Mon, 18 Jun 2012 02:59:22 +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: <20120618025922.524A0106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237871 - 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, 18 Jun 2012 02:59:23 -0000 Author: jhagewood Date: Mon Jun 18 02:59:22 2012 New Revision: 237871 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237871 Log: Added: soc2012/jhagewood/ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 03:00: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 D1056106566C for ; Mon, 18 Jun 2012 03:00:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 03:00:53 +0000 Date: Mon, 18 Jun 2012 03:00: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: <20120618030053.D1056106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237873 - 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, 18 Jun 2012 03:00:56 -0000 Author: jhagewood Date: Mon Jun 18 03:00:53 2012 New Revision: 237873 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237873 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/Makefile soc2012/jhagewood/sdiff/common.c soc2012/jhagewood/sdiff/common.h soc2012/jhagewood/sdiff/edit.c soc2012/jhagewood/sdiff/extern.h soc2012/jhagewood/sdiff/sdiff.1 soc2012/jhagewood/sdiff/sdiff.c Added: soc2012/jhagewood/Milestones ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/Milestones Mon Jun 18 03:00:53 2012 (r237873) @@ -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 Jun 18 03:00:53 2012 (r237873) @@ -0,0 +1,19 @@ +TASK STATUS NOTE + +--unified GNU compatibility COMPLETE Fixed timestamp. +--context GNU compatibility IN PROGRESS +--ingnore-blank-lines INCOMPLETE +--left-column INCOMPLETE +--show-function-line INCOMPLETE +--unidirectional-new-file INCOMPLETE +--normal COMPLETE Sets format to D_NORMAL in getopt_long(). +--supress-common-lines INCOMPLETE +--GTYPE-group-format INCOMPLETE +--line-format IN PROGRESS +--LTYPE-line-format INCOMPLETE +--from-file INCOMPLETE +--to-file INCOMPLETE +--horizontal-lines INCOMPLETE +--speed-large-file INCOMPLETE +--ignore-tab-expansion IN PROGRESS +--width INCOMPLETE 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 Jun 18 03:00:53 2012 (r237873) @@ -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 Jun 18 03:00:53 2012 (r237873) @@ -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 Jun 18 03:00:53 2012 (r237873) @@ -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); + gotstdin = 1; + } else if (stat(argv[0], &stb1) != 0) + err(2, "%s", argv[0]); + if (strcmp(argv[1], "-") == 0) { + fstat(STDIN_FILENO, &stb2); + gotstdin = 1; + } else if (stat(argv[1], &stb2) != 0) + err(2, "%s", argv[1]); + if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) + errx(2, "can't compare - to a directory"); + 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"); + diffdir(argv[0], argv[1]); + } else { + if (S_ISDIR(stb1.st_mode)) { + argv[0] = splice(argv[0], argv[1]); + if (stat(argv[0], &stb1) < 0) + err(2, "%s", argv[0]); + } + if (S_ISDIR(stb2.st_mode)) { + argv[1] = splice(argv[1], argv[0]); + if (stat(argv[1], &stb2) < 0) + err(2, "%s", argv[1]); + } + print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + NULL); + } + exit(status); +} + +void * +emalloc(size_t n) +{ + void *p; + + if (n == 0) + errx(2, NULL); + + if ((p = malloc(n)) == NULL) + errx(2, NULL); + return (p); +} + +void * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 03:08:48 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 E572A106566C for ; Mon, 18 Jun 2012 03:08:45 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 03:08:45 +0000 Date: Mon, 18 Jun 2012 03:08:45 +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: <20120618030845.E572A106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237874 - in soc2012/jhagewood: diff diff3 mdocml 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, 18 Jun 2012 03:08:48 -0000 Author: jhagewood Date: Mon Jun 18 03:08:45 2012 New Revision: 237874 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237874 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 03:00:53 2012 (r237873) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 03:08:45 2012 (r237874) @@ -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-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-17 04:31:37.036993000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-18 03:07:38.000000000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -111,8 +111,8 @@ break; case D_DIFFER: diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-13 05:07:22.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.h 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-18 03:07:38.000000000 -0400 @@ -75,7 +75,7 @@ struct excludes { struct excludes *next; }; @@ -123,8 +123,8 @@ extern int Bflag, strip_cr, tabsize; extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-18 02:52:22.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-18 03:07:38.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jun 18 03:00:53 2012 (r237873) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jun 18 03:08:45 2012 (r237874) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-17 04:30:34.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-17 04:30:34.000000000 -0400 +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-18 03:07:38.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-17 04:30:34.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-17 04:30:34.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-18 03:07:38.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 Jun 18 03:00:53 2012 (r237873) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Mon Jun 18 03:08:45 2012 (r237874) @@ -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-17 04:30:35.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-17 04:30:35.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-18 03:07:41.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-18 03:07:43.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-17 04:30:35.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-18 03:07:43.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-17 04:30:35.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-17 04:30:35.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-18 03:07:41.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-18 03:07:43.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-17 04:30:35.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-18 03:07:43.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 03:44: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 7BF04106566B for ; Mon, 18 Jun 2012 03:43:59 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 03:43:59 +0000 Date: Mon, 18 Jun 2012 03:43: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: <20120618034359.7BF04106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237875 - soc2012/jhagewood/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: Mon, 18 Jun 2012 03:44:00 -0000 Author: jhagewood Date: Mon Jun 18 03:43:58 2012 New Revision: 237875 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237875 Log: Modified: soc2012/jhagewood/diff/diff-test.sh Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Mon Jun 18 03:08:45 2012 (r237874) +++ soc2012/jhagewood/diff/diff-test.sh Mon Jun 18 03:43:58 2012 (r237875) @@ -54,4 +54,3 @@ # diff -rupN ./test_outputs/gnu/ ./test_outputs/bsd/ >> ./test_outputs/gnu-bsd-diff.txt - From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 04:31: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 D384C106564A for ; Mon, 18 Jun 2012 04:31:15 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 04:31:15 +0000 Date: Mon, 18 Jun 2012 04:31:15 +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: <20120618043115.D384C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237876 - soc2012/jhagewood/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: Mon, 18 Jun 2012 04:31:17 -0000 Author: jhagewood Date: Mon Jun 18 04:31:15 2012 New Revision: 237876 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237876 Log: Modified: soc2012/jhagewood/diff/TODO Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 18 03:43:58 2012 (r237875) +++ soc2012/jhagewood/diff/TODO Mon Jun 18 04:31:15 2012 (r237876) @@ -1,7 +1,7 @@ TASK STATUS NOTE --unified GNU compatibility COMPLETE Fixed timestamp. ---context GNU compatibility IN PROGRESS +--context GNU compatibility COMPLETE Fixed timestamp, will test more. --ingnore-blank-lines INCOMPLETE --left-column INCOMPLETE --show-function-line INCOMPLETE @@ -17,3 +17,7 @@ --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS --width INCOMPLETE + +Notes: + +- When using large files as input, diff will only output "Files [file1] and [file2] differ." From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 04:42: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 9432E1065675 for ; Mon, 18 Jun 2012 04:42:39 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 04:42:39 +0000 Date: Mon, 18 Jun 2012 04:42:39 +0000 From: emc2@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: <20120618044239.9432E1065675@hub.freebsd.org> Cc: Subject: socsvn commit: r237877 - in soc2012/emc2: experimental head/sys/boot/efi/include head/sys/boot/efi/include/i386 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, 18 Jun 2012 04:42:41 -0000 Author: emc2 Date: Mon Jun 18 04:42:39 2012 New Revision: 237877 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237877 Log: Very hard-won progress. Due to a bug in stdint.h, uint64_t (and by extension, UINT64) was being typedef'ed to unsigned long, but when compiling with -m32, this meant sizeof(uint64_t) == 4. This ultimately caused the EFI_SYSTEM_TABLE and others to have the wrong offsets, which caused the errors I'd been seeing. I added a temporary fix to detect when compiling for i386 vs amd64, and to select the proper UINT64. Added: soc2012/emc2/experimental/reloc.c Modified: soc2012/emc2/experimental/Makefile soc2012/emc2/experimental/helloworld.c soc2012/emc2/experimental/start.S soc2012/emc2/head/sys/boot/efi/include/efiapi.h soc2012/emc2/head/sys/boot/efi/include/i386/efibind.h Modified: soc2012/emc2/experimental/Makefile ============================================================================== --- soc2012/emc2/experimental/Makefile Mon Jun 18 04:31:15 2012 (r237876) +++ soc2012/emc2/experimental/Makefile Mon Jun 18 04:42:39 2012 (r237877) @@ -1,13 +1,23 @@ -CC=gcc -CFLAGS=-O2 -m32 -I../head/sys/boot/efi/include/ -I../head/sys/boot/efi/include/i386 -fPIC -OBJCOPY=objcopy +GCCPREFIX= +#GCCPREFIX=/usr/local/mingw32/bin +CC=${GCCPREFIX}gcc +INCLUDEFLAGS=-I../head/sys/boot/efi/include/ -I../head/sys/boot/efi/include/i386 -I../head/sys/boot/common +CFLAGS=-O2 -m32 ${INCLUDEFLAGS} +#CFLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe ${INCLUDEFLAGS} +OBJCOPY=${GCCPREFIX}objcopy + EFIFORMAT=efi-app-ia32 LDSCRIPT=ldscript.i386 +CLEANFILES=helloworld.dll helloworld.obj helloworld.o helloworld helloworld.efi start.o reloc.o + all: helloworld.efi clean: - rm -f helloworld.o helloworld helloworld.efi start.o + rm -rf ${CLEANFILES} + +reloc.o: reloc.c + ${CC} -c ${CFLAGS} reloc.c start.o: start.S ${CC} -c ${CFLAGS} start.S @@ -15,8 +25,9 @@ helloworld.o: helloworld.c ${CC} -c ${CFLAGS} helloworld.c -helloworld: helloworld.o start.o - ${CC} -nostdlib -o helloworld -Wl,-T ${LDSCRIPT} -shared -symbolic helloworld.o start.o +helloworld: helloworld.o start.o reloc.o + ${CC} -nostdlib -o helloworld -Wl,-T ${LDSCRIPT} -shared -symbolic helloworld.o start.o reloc.o +# libefi.a helloworld.efi: helloworld ${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \ Modified: soc2012/emc2/experimental/helloworld.c ============================================================================== --- soc2012/emc2/experimental/helloworld.c Mon Jun 18 04:31:15 2012 (r237876) +++ soc2012/emc2/experimental/helloworld.c Mon Jun 18 04:42:39 2012 (r237877) @@ -1,12 +1,55 @@ +#include #include - +#include +/* +int main(int argc, char** argv) { + return -1; +} +*/ static unsigned short str[] = { 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\n', '\r', 0 }; + EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systab) { + /* + sig = systab->Hdr.Signature; + rev = systab->Hdr.Revision; + hdrsize = systab->Hdr.HeaderSize; + CRC32 = systab->Hdr.CRC32; + reserved = systab->Hdr.Reserved; + vendor = systab->FirmwareVendor; + revision = systab->FirmwareRevision; + coninhandle = systab->ConsoleInHandle; + ConIn = systab->ConIn; + conouthandle = systab->ConsoleOutHandle; + ConOut = systab->ConOut; + */ + systab->ConOut->OutputString(systab->ConOut, str); + /* + EFI_STATUS status; + + IH = image; + ST = systab; + BS = ST->BootServices; + RS = ST->RuntimeServices; + + heapsize = 2 * 1024 * 1024; + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + EFI_SIZE_TO_PAGES(heapsize), &heap); + + if(NULL == ST->ConOut->Reset) + return -1; + else + return EFI_SUCCESS; + */ + return sizeof(UINT64); + //return (EFI_STATUS)systab->ConOut; +} - systab->ConOut->ClearScreen(systab->ConOut); +#include - return EFI_SUCCESS; +main() { + printf("%d\n", sizeof(uint64_t)); + return 0; } Added: soc2012/emc2/experimental/reloc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/experimental/reloc.c Mon Jun 18 04:42:39 2012 (r237877) @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 2008-2010 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD: soc2012/emc2/head/sys/boot/i386/efi/reloc.c 235458 2012-05-09 07:55:42Z avg $"); + +#include +#include +#include +#include + +/* + * A simple relocator for IA32 EFI binaries. + */ +EFI_STATUS +_reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle, + EFI_SYSTEM_TABLE *system_table) +{ + unsigned long relsz, relent; + unsigned long *newaddr; + Elf32_Rel *rel; + Elf32_Dyn *dynp; + + /* + * Find the relocation address, its size and the relocation entry. + */ + relsz = 0; + relent = 0; + for (dynp = dynamic; dynp->d_tag != DT_NULL; dynp++) { + switch (dynp->d_tag) { + case DT_REL: + rel = (Elf32_Rel *) ((unsigned long) dynp->d_un.d_ptr + + ImageBase); + break; + case DT_RELSZ: + relsz = dynp->d_un.d_val; + break; + case DT_RELENT: + relent = dynp->d_un.d_val; + break; + default: + break; + } + } + + /* + * Perform the actual relocation. + * XXX: We are reusing code for the amd64 version of this, but + * we must make sure the relocation types are the same. + */ + CTASSERT(R_386_NONE == R_X86_64_NONE); + CTASSERT(R_386_RELATIVE == R_X86_64_RELATIVE); + for (; relsz > 0; relsz -= relent) { + switch (ELF32_R_TYPE(rel->r_info)) { + case R_386_NONE: + /* No relocation needs be performed. */ + break; + case R_386_RELATIVE: + /* Address relative to the base address. */ + newaddr = (unsigned long *)(ImageBase + rel->r_offset); + *newaddr += ImageBase; + break; + default: + /* XXX: do we need other relocations ? */ + return (EFI_LOAD_ERROR); + } + rel = (Elf32_Rel *) ((caddr_t) rel + relent); + } + + return (EFI_SUCCESS); +} Modified: soc2012/emc2/experimental/start.S ============================================================================== --- soc2012/emc2/experimental/start.S Mon Jun 18 04:31:15 2012 (r237876) +++ soc2012/emc2/experimental/start.S Mon Jun 18 04:42:39 2012 (r237877) @@ -46,8 +46,20 @@ pushl 12(%ebp) /* image_handle */ pushl 8(%ebp) /* system_table */ + call 0f +0: popl %eax + movl %eax, %ebx + addl $ImageBase-0b, %eax + addl $_DYNAMIC-0b, %ebx + pushl %ebx /* dynamic */ + pushl %eax /* ImageBase */ + call _reloc + cmpl $EFI_SUCCESS, %eax + jne 1f + popl %ebx /* remove ImageBase from the stack */ + popl %ebx /* remove dynamic from the stack */ call efi_main - leave +1: leave ret END(_start) Modified: soc2012/emc2/head/sys/boot/efi/include/efiapi.h ============================================================================== --- soc2012/emc2/head/sys/boot/efi/include/efiapi.h Mon Jun 18 04:31:15 2012 (r237876) +++ soc2012/emc2/head/sys/boot/efi/include/efiapi.h Mon Jun 18 04:42:39 2012 (r237877) @@ -666,7 +666,7 @@ // Standard EFI table header // -typedef struct _EFI_TABLE_HEARDER { +typedef struct _EFI_TABLE_HEADER { UINT64 Signature; UINT32 Revision; UINT32 HeaderSize; Modified: soc2012/emc2/head/sys/boot/efi/include/i386/efibind.h ============================================================================== --- soc2012/emc2/head/sys/boot/efi/include/i386/efibind.h Mon Jun 18 04:31:15 2012 (r237876) +++ soc2012/emc2/head/sys/boot/efi/include/i386/efibind.h Mon Jun 18 04:42:39 2012 (r237877) @@ -84,9 +84,13 @@ // // Basic EFI types of various widths // - -typedef uint64_t UINT64; -typedef int64_t INT64; +#if defined(__amd64) +typedef unsigned long UINT64; +typedef long INT64; +#elif defined(__i386) +typedef unsigned long long UINT64; +typedef long long INT64; +#endif #ifndef _BASETSD_H_ typedef uint32_t UINT32; From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 11:49: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 6230B1065676 for ; Mon, 18 Jun 2012 11:49:24 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 11:49:24 +0000 Date: Mon, 18 Jun 2012 11:49:24 +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: <20120618114924.6230B1065676@hub.freebsd.org> Cc: Subject: socsvn commit: r237888 - 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, 18 Jun 2012 11:49:26 -0000 Author: oleksandr Date: Mon Jun 18 11:49:23 2012 New Revision: 237888 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237888 Log: Add some debug section and function udf_find_raw_phys Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h 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 Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Mon Jun 18 10:56:29 2012 (r237887) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Mon Jun 18 11:49:23 2012 (r237888) @@ -28,6 +28,8 @@ #define _FS_UDF_UDF_H_ #include "udf_osta.h" +#include "udf_mount.h" +#include "udfio.h" /* lets see debug stuff for now */ #define DEBUG @@ -253,9 +255,9 @@ struct cdev *dev; struct g_consumer *geomcp; struct bufobj *bo; -/* struct mmc_discinfo discinfo; */ + struct mmc_discinfo discinfo; uint32_t sector_size; -// struct udf_args mount_args; + struct udf_args mount_args; int flags; uid_t anon_uid; gid_t anon_gid; Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Mon Jun 18 10:56:29 2012 (r237887) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Mon Jun 18 11:49:23 2012 (r237888) @@ -35,7 +35,7 @@ #include "ecma167-udf.h" #include "udf.h" #include "udf_subr.h" - +#include "udf_mount.h" static int udf_read_phys_sectors(struct udf_mount *ump, int what, void *blob, uint32_t start, uint32_t sectors); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jun 18 10:56:29 2012 (r237887) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Mon Jun 18 11:49:23 2012 (r237888) @@ -38,6 +38,7 @@ #include "udf.h" #include "udf_subr.h" #include "udf_mount.h" +#include "udfio.h" #define VTOI(vnode) ((struct udf_node *) (vnode)->v_data) @@ -386,7 +387,6 @@ return 0; } - /* * NOTE: this is the only routine in this file that directly peeks into the * metadata file but since its at a larval state of the mount it can't hurt. @@ -937,6 +937,10 @@ int error, anch, ok, first_anchor; uint32_t positions[4], track_start, track_end; +// struct udf_args *args = &ump->mount_args; +// struct mmc_trackinfo first_track; +// struct mmc_trackinfo second_track; + track_start = ump->session_start; track_end = ump->session_end; @@ -968,6 +972,88 @@ } return ok; +#if 0 + struct udf_args *args = &ump->mount_args; + struct mmc_trackinfo first_track; + struct mmc_trackinfo second_track; + struct mmc_trackinfo last_track; + struct anchor_vdp **anchorsp; + uint32_t track_start; + uint32_t track_end; + uint32_t positions[4]; + int first_tracknr, last_tracknr; + int error, anch, ok, first_anchor; + + /* search the first and last track of the specified session */ + error = udf_search_tracks(ump, args, &first_tracknr, &last_tracknr); + if (!error) { + first_track.tracknr = first_tracknr; + error = udf_update_trackinfo(ump, &first_track); + } + if (!error) { + last_track.tracknr = last_tracknr; + error = udf_update_trackinfo(ump, &last_track); + } + if ((!error) && (first_tracknr != last_tracknr)) { + second_track.tracknr = first_tracknr+1; + error = udf_update_trackinfo(ump, &second_track); + } + if (error) { + printf("UDF mount: reading disc geometry failed\n"); + return 0; + } + + track_start = first_track.track_start; + + /* `end' is not as straitforward as start. */ + track_end = last_track.track_start + + last_track.track_size - last_track.free_blocks - 1; + + if (ump->discinfo.mmc_cur & MMC_CAP_SEQUENTIAL) { + /* end of track is not straitforward here */ + if (last_track.flags & MMC_TRACKINFO_LRA_VALID) + track_end = last_track.last_recorded; + else if (last_track.flags & MMC_TRACKINFO_NWA_VALID) + track_end = last_track.next_writable + - ump->discinfo.link_block_penalty; + } + + /* its no use reading a blank track */ + first_anchor = 0; + if (first_track.flags & MMC_TRACKINFO_BLANK) + first_anchor = 1; + + /* get our packet size */ + ump->packet_size = first_track.packet_size; + if (first_track.flags & MMC_TRACKINFO_BLANK) + ump->packet_size = second_track.packet_size; + + if (ump->packet_size <= 1) { + /* take max, but not bigger than 64 */ + ump->packet_size = MAXPHYS / ump->discinfo.sector_size; + ump->packet_size = MIN(ump->packet_size, 64); + } + KASSERT(ump->packet_size >= 1); + + /* read anchors start+256, start+512, end-256, end */ + positions[0] = track_start+256; + positions[1] = track_end-256; + positions[2] = track_end; + positions[3] = track_start+512; /* [UDF 2.60/6.11.2] */ + /* XXX shouldn't +512 be prefered above +256 for compat with Roxio CD */ + + ok = 0; + anchorsp = ump->anchors; + for (anch = first_anchor; anch < 4; anch++) { + DPRINTF(VOLUMES, ("Read anchor %d at sector %d\n", anch, + positions[anch])); + error = udf_read_anchor(ump, positions[anch], anchorsp); + if (!error) { + anchorsp++; + ok++; + } + } +#endif } /* --------------------------------------------------------------------- */ @@ -1002,6 +1088,28 @@ return vpart_num; } #endif + +/* + * BUGALERT: some rogue implementations use random physical partition + * numbers to break other implementations so lookup the number. + */ + +static uint16_t +udf_find_raw_phys(struct udf_mount *ump, uint16_t raw_phys_part) +{ + struct part_desc *part; + uint16_t phys_part; + + for (phys_part = 0; phys_part < UDF_PARTITIONS; phys_part++) { + part = ump->partitions[phys_part]; + if (part == NULL) + break; + if (le16toh(part->part_num) == raw_phys_part) + break; + } + return phys_part; +} + /* --------------------------------------------------------------------- */ /* we dont try to be smart; we just record the parts */ @@ -1013,9 +1121,10 @@ static int udf_process_vds_descriptor(struct udf_mount *ump, union dscrptr *dscr) { - struct part_desc *part; uint16_t phys_part, raw_phys_part; + DPRINTF(VOLUMES, ("\tprocessing VDS descr %d\n", + le16toh(dscr->tag.id))); switch (le16toh(dscr->tag.id)) { case TAGID_PRI_VOL : /* primary partition */ UDF_UPDATE_DSCR(ump->primary_vol, &dscr->pvd); @@ -1043,13 +1152,8 @@ * the number. */ raw_phys_part = le16toh(dscr->pd.part_num); - for (phys_part = 0; phys_part < UDF_PARTITIONS; phys_part++) { - part = ump->partitions[phys_part]; - if (part == NULL) - break; - if (le16toh(part->part_num) == raw_phys_part) - break; - } + phys_part = udf_find_raw_phys(ump, raw_phys_part); + if (phys_part == UDF_PARTITIONS) { free(dscr, M_UDFTEMP); return EINVAL; @@ -1058,9 +1162,12 @@ UDF_UPDATE_DSCR(ump->partitions[phys_part], &dscr->pd); break; case TAGID_VOL : /* volume space extender; rare */ + DPRINTF(VOLUMES, ("VDS extender ignored\n")); free(dscr, M_UDFTEMP); break; default : + DPRINTF(VOLUMES, ("Unhandled VDS type %d\n", + le16toh(dscr->tag.id))); free(dscr, M_UDFTEMP); } @@ -1224,6 +1331,9 @@ lvint = &dscr->lvid; dscr = NULL; } /* else hope for the best... maybe the next is ok */ + + DPRINTFIF(VOLUMES, lvint, ("logvol integrity read, state %s\n", + le32toh(lvint->integrity_type) ? "CLOSED" : "OPEN")); /* proceed sequential */ lbnum += 1; @@ -1236,6 +1346,7 @@ if (trace_len >= UDF_LVDINT_SEGMENTS-1) { /* IEK! segment link full... */ + DPRINTF(VOLUMES, ("lvdint segments full\n")); error = EINVAL; } else { trace++; @@ -1851,14 +1962,21 @@ /* struct udf_args *args = &ump->mount_args; */ union udf_pmap *mapping; struct logvol_int_desc *lvint; - struct part_desc *part; struct udf_logvol_info *lvinfo; int pmap_stype, pmap_size, pmap_type, log_part, phys_part, error; - int raw_phys_part, maps_on, n_phys, n_virt, n_spar, n_meta, len; + int raw_phys_part, maps_on, len; + int n_phys, n_virt, n_spar, n_meta; uint32_t n_pm, mt_l; char *domain_name, *map_name; /* bits[128]; */ const char *check_name; uint8_t *pmap_pos; + + if (ump == NULL) + return ENOENT; + + /* we need at least an anchor (trivial, but for safety) */ + if (ump->anchors[0] == NULL) + return EINVAL; /* we need at least one primary and one logical volume descriptor */ if ((ump->primary_vol == NULL) || (ump->logical_vol) == NULL) @@ -1889,14 +2007,18 @@ return EINVAL; } + /* retrieve logical volume integrity sequence */ + error = udf_retrieve_lvint(ump); + if (error != 0) + return EINVAL; // previously it always returned this on error. + /* * We need at least one logvol integrity descriptor recorded. Note * that its OK to have an open logical volume integrity here. The VAT * will close/update the integrity. */ - error = udf_retrieve_lvint(ump); - if (error != 0) - return EINVAL; // previously it always returned this on error. + if (ump->logvol_integrity == NULL) + return EINVAL; /* process derived structures */ n_pm = le32toh(ump->logical_vol->n_pm); /* num partmaps */ @@ -1911,6 +2033,7 @@ * check and recording of the mapping results. Saves expensive * strncmp() in tight places. */ + DPRINTF(VOLUMES, ("checking logvol mappings\n")); n_pm = le32toh(ump->logical_vol->n_pm); /* num partmaps */ mt_l = le32toh(ump->logical_vol->mt_l); /* partmaps data length */ pmap_pos = ump->logical_vol->maps; @@ -1963,7 +2086,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; @@ -1980,14 +2103,11 @@ * partition numbers to break other implementations so lookup * the number. */ - for (phys_part = 0; phys_part < UDF_PARTITIONS; phys_part++) { - part = ump->partitions[phys_part]; - if (part == NULL) - continue; - if (le16toh(part->part_num) == raw_phys_part) - break; - } + phys_part = udf_find_raw_phys(ump, raw_phys_part); + DPRINTF(VOLUMES, ("\t%d -> %d(%d) type %d\n", log_part, + raw_phys_part, phys_part, pmap_type)); + if (phys_part == UDF_PARTITIONS) return EINVAL; if (pmap_type == UDF_VTOP_TYPE_UNKNOWN) @@ -2092,6 +2212,13 @@ if (ump->vfs_mountp->mnt_flag & MNT_RDONLY) ump->strategy = &udf_strat_direct; #endif + /*print results */ + DPRINTF(VOLUMES, ("\tdata partition %d\n", ump->data_part)); + DPRINTF(VOLUMES, ("\t\talloc scheme %d\n", ump->vtop_alloc[ump->data_part])); + DPRINTF(VOLUMES, ("\tnode partition %d\n", ump->node_part)); + DPRINTF(VOLUMES, ("\t\talloc scheme %d\n", ump->vtop_alloc[ump->node_part])); + DPRINTF(VOLUMES, ("\tfids partition %d\n", ump->fids_part)); + DPRINTF(VOLUMES, ("\t\talloc scheme %d\n", ump->vtop_alloc[ump->fids_part])); snprintb(bits, sizeof(bits), UDFLOGVOL_BITS, ump->lvopen); DPRINTF(VOLUMES, ("\tactions on logvol open %s\n", bits)); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jun 18 10:56:29 2012 (r237887) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Mon Jun 18 11:49:23 2012 (r237888) @@ -50,8 +50,12 @@ MALLOC_DEFINE(M_UDFTEMP, "UDF temp", "UDF allocation space"); uma_zone_t udf_zone_node = NULL; +/* verbose levels of the udf filingsystem */ +int udf_verbose = UDF_DEBUGGING; + struct iconv_functions *udf2_iconv = NULL; +/* internal finctions */ static int udf_mountfs(struct vnode *, struct mount *); /* --------------------------------------------------------------------- */ @@ -368,7 +372,7 @@ mp->mnt_flag &= ~MNT_LOCAL; MNT_IUNLOCK(mp); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -812,9 +816,8 @@ * used for reference to files by unique ID and for NFSv3. * (optional) TODO lookup why some sources state NFSv3 - - This done as in the current udf implementation. I really have no idea - if it is correct. + * This done as in the current udf implementation. I really have no idea + * if it is correct. */ int udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) @@ -827,7 +830,11 @@ error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL); if (error || *vpp != NULL) return error; - + + /* + * We must promote to an exclusive lock for vnode creation. This + * can happen if lookup is passed LOCKSHARED. + */ if ((flags & LK_TYPE_MASK) == LK_SHARED) { flags &= ~LK_TYPE_MASK; flags |= LK_EXCLUSIVE; @@ -932,27 +939,27 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) { - struct vnode *vp; + struct vnode *nvp; struct udf_fid *ufid = (struct udf_fid*)fhp; struct udf_node *udf_node; uint64_t filelen; int error; - error = VFS_VGET(mp, ufid->ino, LK_EXCLUSIVE, &vp); + error = VFS_VGET(mp, ufid->ino, LK_EXCLUSIVE, &nvp); if (error != 0) { *vpp = NULLVP; return error; } - udf_node = VTOI(vp); + udf_node = VTOI(nvp); if (udf_node->efe) filelen = le64toh(udf_node->efe->inf_len); else filelen = le64toh(udf_node->fe->inf_len); - vnode_create_vobject(vp, filelen, curthread); - *vpp = vp; + *vpp = nvp; + vnode_create_vobject(*vpp, filelen, curthread); - return 0; + return (0); } From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 12:33: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 774BE1065673 for ; Mon, 18 Jun 2012 12:33:38 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 12:33:38 +0000 Date: Mon, 18 Jun 2012 12:33:38 +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: <20120618123338.774BE1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r237889 - in soc2012/aleek/beaglexm-armv6/sys: 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: Mon, 18 Jun 2012 12:33:40 -0000 Author: aleek Date: Mon Jun 18 12:33:37 2012 New Revision: 237889 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237889 Log: stub of PRCM driver Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 11:49:23 2012 (r237888) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 12:33:37 2012 (r237889) @@ -1,7 +1,10 @@ /*- - * Copyright (c) 2012 Damjan Marion + * Copyright (c) 2011 + * Ben Gray . * All rights reserved. * + * Modified 2012 Aleksander Dutkowski + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -11,10 +14,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -29,103 +32,146 @@ #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 -#include -#include -#include -#include -#include -#define CM_PER 0 -#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000) -#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004) -#define CM_PER_L3_CLKSTCTRL (CM_PER + 0x00C) -#define CM_PER_CPGMAC0_CLKCTRL (CM_PER + 0x014) -#define CM_PER_USB0_CLKCTRL (CM_PER + 0x01C) -#define CM_PER_TPTC0_CLKCTRL (CM_PER + 0x024) -#define CM_PER_MMC0_CLKCTRL (CM_PER + 0x03C) -#define CM_PER_I2C2_CLKCTRL (CM_PER + 0x044) -#define CM_PER_I2C1_CLKCTRL (CM_PER + 0x048) -#define CM_PER_TIMER7_CLKCTRL (CM_PER + 0x07C) -#define CM_PER_TIMER2_CLKCTRL (CM_PER + 0x080) -#define CM_PER_TIMER3_CLKCTRL (CM_PER + 0x084) -#define CM_PER_TIMER4_CLKCTRL (CM_PER + 0x088) -#define CM_PER_GPIO1_CLKCTRL (CM_PER + 0x0AC) -#define CM_PER_GPIO2_CLKCTRL (CM_PER + 0x0B0) -#define CM_PER_GPIO3_CLKCTRL (CM_PER + 0x0B4) -#define CM_PER_TPCC_CLKCTRL (CM_PER + 0x0BC) -#define CM_PER_L3_INSTR_CLKCTRL (CM_PER + 0x0DC) -#define CM_PER_L3_CLKCTRL (CM_PER + 0x0E0) -#define CM_PER_TIMER5_CLKCTRL (CM_PER + 0x0EC) -#define CM_PER_TIMER6_CLKCTRL (CM_PER + 0x0F0) -#define CM_PER_MMC1_CLKCTRL (CM_PER + 0x0F4) -#define CM_PER_MMC2_CLKCTRL (CM_PER + 0x0F8) -#define CM_PER_TPTC1_CLKCTRL (CM_PER + 0x0FC) -#define CM_PER_TPTC2_CLKCTRL (CM_PER + 0x100) -#define CM_PER_OCPWP_L3_CLKSTCTRL (CM_PER + 0x12C) -#define CM_PER_OCPWP_CLKCTRL (CM_PER + 0x130) -#define CM_PER_CPSW_CLKSTCTRL (CM_PER + 0x144) - -#define CM_WKUP 0x400 -#define CM_WKUP_CLKSTCTRL (CM_WKUP + 0x000) -#define CM_WKUP_CONTROL_CLKCTRL (CM_WKUP + 0x004) -#define CM_WKUP_GPIO0_CLKCTRL (CM_WKUP + 0x008) -#define CM_WKUP_CM_L3_AON_CLKSTCTRL (CM_WKUP + 0x01C) -#define CM_WKUP_CM_CLKSEL_DPLL_MPU (CM_WKUP + 0x02C) -#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER (CM_WKUP + 0x07C) -#define CM_WKUP_I2C0_CLKCTRL (CM_WKUP + 0x0B8) - -#define CM_DPLL 0x500 -#define CLKSEL_TIMER7_CLK (CM_DPLL + 0x004) -#define CLKSEL_TIMER2_CLK (CM_DPLL + 0x008) -#define CLKSEL_TIMER3_CLK (CM_DPLL + 0x00C) -#define CLKSEL_TIMER4_CLK (CM_DPLL + 0x010) -#define CLKSEL_TIMER5_CLK (CM_DPLL + 0x018) -#define CLKSEL_TIMER6_CLK (CM_DPLL + 0x01C) +/* + * This file defines the clock configuration for the OMAP3xxx series of + * devices. + * + * How This is Suppose to Work + * =========================== + * - There is a top level omap_prcm module that defines all OMAP SoC drivers + * should use to enable/disable the system clocks regardless of the version + * of OMAP device they are running on. This top level PRCM module is just + * a thin shim to chip specific functions that perform the donkey work of + * configuring the clock - this file is the 'donkey' for OMAP35xx devices. + * + * - The key bit in this file is the omap_clk_devmap array, it's + * used by the omap_prcm driver to determine what clocks are valid and which + * functions to call to manipulate them. + * + * - In essence you just need to define some callbacks for each of the + * clocks and then you're done. + * + * - The other thing worth noting is that when the omap_prcm device + * is registered you typically pass in some memory ranges which are the + * SYS_MEMORY resources. These resources are in turn allocated using + * bus_allocate_resources(...) and the resource handles are passed to all + * individual clock callback handlers. + * + * + * + * + */ + + +void +omap3_clk_init(device_t dev, int prio); + +#define FREQ_96MHZ 96000000 +#define FREQ_64MHZ 64000000 +#define FREQ_48MHZ 48000000 +#define FREQ_32KHZ 32000 + + + +/** + * Only one memory regions is needed for OMAP35xx clock control (unlike OMAP4) + * + * CM Instance - 0x4800 4000 : 0x4800 5500 + * PRM Instance - 0x4830 6000 : 0x4830 8000 + * + */ +//#define CM_INSTANCE_MEM_REGION 0 +//#define PRM_INSTANCE_MEM_REGION 1 -#define PRM_DEVICE_OFFSET 0xF00 -#define PRM_RSTCTRL (PRM_DEVICE_OFFSET + 0x00) +#define IVA2_CM_OFFSET 0x0000 +#define OCP_SYSTEM_CM_OFFSET 0x0800 +#define MPU_CM_OFFSET 0x0900 +#define CORE_CM_OFFSET 0x0A00 +#define SGX_CM_OFFSET 0x0B00 +#define WKUP_CM_OFFSET 0x0C00 +#define CLOCK_CTRL_CM_OFFSET 0x0D00 +#define DSS_CM_OFFSET 0x0E00 +#define CAM_CM_OFFSET 0x0F00 +#define PER_CM_OFFSET 0x1000 +#define EMU_CM_OFFSET 0x1100 +#define GLOBAL_CM_OFFSET 0x1200 +#define NEON_CM_OFFSET 0x1300 +#define USBHOST_CM_OFFSET 0x1400 + +#define IVA2_PRM_OFFSET 0x0000 +#define OCP_SYSTEM_PRM_OFFSET 0x0800 +#define MPU_PRM_OFFSET 0x0900 +#define CORE_PRM_OFFSET 0x0A00 +#define SGX_PRM_OFFSET 0x0B00 +#define WKUP_PRM_OFFSET 0x0C00 +#define CLOCK_CTRL_PRM_OFFSET 0x0D00 +#define DSS_PRM_OFFSET 0x0E00 +#define CAM_PRM_OFFSET 0x0F00 +#define PER_PRM_OFFSET 0x1000 +#define EMU_PRM_OFFSET 0x1100 +#define GLOBAL_PRM_OFFSET 0x1200 +#define NEON_PRM_OFFSET 0x1300 +#define USBHOST_PRM_OFFSET 0x1400 struct omap3_prcm_softc { - struct resource * res[2]; - bus_space_tag_t bst; - bus_space_handle_t bsh; + struct resource *res[2]; + bus_space_tag_t prm_bst, cm_bst; + bus_space_tag_t prm_bsh, cm_bsh; }; static struct resource_spec omap3_prcm_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { -1, 0 } + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL }, + { -1, 0, 0 } }; -static struct omap3_prcm_softc *omap3_prcm_sc = NULL; +static int +omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); + +static int +omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); + +static int +omap3_clk_generic_activate(struct ti_clock_dev *clkdev); + +static int +omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev); + +static int +omap3_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); + +static int +omap3_clk_generic_accessible(struct ti_clock_dev *clkdev); + + + + + + -static int omap3_clk_generic_activate(struct ti_clock_dev *clkdev); -static int omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev); -static int omap3_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); -static int omap3_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); -static int omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); -static int omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); -static void omap3_prcm_reset(void); -static int omap3_clk_cpsw_activate(struct ti_clock_dev *clkdev); -static int omap3_clk_musb0_activate(struct ti_clock_dev *clkdev); /** * omap_clk_devmap - Array of clock devices available on OMAP3xxx devices @@ -176,10 +222,9 @@ } +const struct ti_clock_dev omap_clk_devmap[] = { - -struct ti_clock_dev ti_clk_devmap[] = { - /* System clocks */ + /* System clock */ { .id = SYS_CLK, .clk_activate = NULL, .clk_deactivate = NULL, @@ -195,373 +240,320 @@ .clk_accessible = NULL, .clk_get_source_freq = omap3_clk_get_arm_fclk_freq, }, - /* CPSW Ethernet Switch core clocks */ - { .id = CPSW_CLK, - .clk_activate = omap3_clk_cpsw_activate, - .clk_deactivate = NULL, - .clk_set_source = NULL, - .clk_accessible = NULL, - .clk_get_source_freq = NULL, - }, - /* Mentor USB HS controller core clocks */ - { .id = MUSB0_CLK, - .clk_activate = omap3_clk_musb0_activate, - .clk_deactivate = NULL, - .clk_set_source = NULL, - .clk_accessible = NULL, - .clk_get_source_freq = NULL, - }, - /* DMTimer */ - AM335X_GENERIC_CLOCK_DEV(DMTIMER2_CLK), - AM335X_GENERIC_CLOCK_DEV(DMTIMER3_CLK), - AM335X_GENERIC_CLOCK_DEV(DMTIMER4_CLK), - AM335X_GENERIC_CLOCK_DEV(DMTIMER5_CLK), - AM335X_GENERIC_CLOCK_DEV(DMTIMER6_CLK), - AM335X_GENERIC_CLOCK_DEV(DMTIMER7_CLK), + /* UART device clocks */ + OMAP3_GENERIC_CLOCK_DEV(UART1_CLK), + OMAP3_GENERIC_CLOCK_DEV(UART2_CLK), + OMAP3_GENERIC_CLOCK_DEV(UART3_CLK), + OMAP3_GENERIC_CLOCK_DEV(UART4_CLK), + + /* Timer device source clocks */ + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER1_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER2_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER3_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER4_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER5_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER6_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER7_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER8_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER9_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER10_CLK), + OMAP3_GPTIMER_CLOCK_DEV(GPTIMER11_CLK), +#if 0 + /* MMC device clocks (MMC1 and MMC2 can have different input clocks) */ + OMAP3_GENERIC_CLOCK_DEV(MMC1_CLK), + OMAP3_GENERIC_CLOCK_DEV(MMC2_CLK), + OMAP3_GENERIC_CLOCK_DEV(MMC3_CLK), + + /* USB HS (high speed TLL, EHCI and OHCI) */ + OMAP3_GENERIC_CLOCK_DEV(USBTLL_CLK), + OMAP3_HSUSBHOST_CLOCK_DEV(USBHSHOST_CLK), /* GPIO */ - AM335X_GENERIC_CLOCK_DEV(GPIO0_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO1_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO2_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO3_CLK), - + OMAP3_GENERIC_CLOCK_DEV(GPIO1_CLK), + OMAP3_GENERIC_CLOCK_DEV(GPIO2_CLK), + OMAP3_GENERIC_CLOCK_DEV(GPIO3_CLK), + OMAP3_GENERIC_CLOCK_DEV(GPIO4_CLK), + OMAP3_GENERIC_CLOCK_DEV(GPIO5_CLK), + OMAP3_GENERIC_CLOCK_DEV(GPIO6_CLK), + /* I2C */ - AM335X_GENERIC_CLOCK_DEV(I2C0_CLK), - AM335X_GENERIC_CLOCK_DEV(I2C1_CLK), - AM335X_GENERIC_CLOCK_DEV(I2C2_CLK), - - /* EDMA */ - AM335X_GENERIC_CLOCK_DEV(EDMA_TPCC_CLK), - AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC0_CLK), - AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC1_CLK), - AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC2_CLK), - - /* MMCHS */ - AM335X_MMCHS_CLOCK_DEV(MMC0_CLK), - AM335X_MMCHS_CLOCK_DEV(MMC1_CLK), - AM335X_MMCHS_CLOCK_DEV(MMC2_CLK), - + OMAP3_GENERIC_CLOCK_DEV(I2C1_CLK), + OMAP3_GENERIC_CLOCK_DEV(I2C2_CLK), + OMAP3_GENERIC_CLOCK_DEV(I2C3_CLK), + + /* sDMA */ + OMAP3_ALWAYSON_CLOCK_DEV(SDMA_CLK), +#endif { INVALID_CLK_IDENT, NULL, NULL, NULL, NULL } }; -struct omap3_clk_details { - clk_ident_t id; - uint32_t clkctrl_reg; - uint32_t clksel_reg; -}; -#define _CLK_DETAIL(i, c, s) \ - { .id = (i), \ - .clkctrl_reg = (c), \ - .clksel_reg = (s), \ - } -static struct omap3_clk_details g_omap3_clk_details[] = { - /* DMTimer modules */ - _CLK_DETAIL(DMTIMER2_CLK, CM_PER_TIMER2_CLKCTRL, CLKSEL_TIMER2_CLK), - _CLK_DETAIL(DMTIMER3_CLK, CM_PER_TIMER3_CLKCTRL, CLKSEL_TIMER3_CLK), - _CLK_DETAIL(DMTIMER4_CLK, CM_PER_TIMER4_CLKCTRL, CLKSEL_TIMER4_CLK), - _CLK_DETAIL(DMTIMER5_CLK, CM_PER_TIMER5_CLKCTRL, CLKSEL_TIMER5_CLK), - _CLK_DETAIL(DMTIMER6_CLK, CM_PER_TIMER6_CLKCTRL, CLKSEL_TIMER6_CLK), - _CLK_DETAIL(DMTIMER7_CLK, CM_PER_TIMER7_CLKCTRL, CLKSEL_TIMER7_CLK), - /* GPIO modules */ - _CLK_DETAIL(GPIO0_CLK, CM_WKUP_GPIO0_CLKCTRL, 0), - _CLK_DETAIL(GPIO1_CLK, CM_PER_GPIO1_CLKCTRL, 0), - _CLK_DETAIL(GPIO2_CLK, CM_PER_GPIO2_CLKCTRL, 0), - _CLK_DETAIL(GPIO3_CLK, CM_PER_GPIO3_CLKCTRL, 0), - /* I2C modules */ - _CLK_DETAIL(I2C0_CLK, CM_WKUP_I2C0_CLKCTRL, 0), - _CLK_DETAIL(I2C1_CLK, CM_PER_I2C1_CLKCTRL, 0), - _CLK_DETAIL(I2C2_CLK, CM_PER_I2C2_CLKCTRL, 0), - - /* EDMA modules */ - _CLK_DETAIL(EDMA_TPCC_CLK, CM_PER_TPCC_CLKCTRL, 0), - _CLK_DETAIL(EDMA_TPTC0_CLK, CM_PER_TPTC0_CLKCTRL, 0), - _CLK_DETAIL(EDMA_TPTC1_CLK, CM_PER_TPTC1_CLKCTRL, 0), - _CLK_DETAIL(EDMA_TPTC2_CLK, CM_PER_TPTC2_CLKCTRL, 0), - - /* MMCHS modules*/ - _CLK_DETAIL(MMC0_CLK, CM_PER_MMC0_CLKCTRL, 0), - _CLK_DETAIL(MMC1_CLK, CM_PER_MMC1_CLKCTRL, 0), - _CLK_DETAIL(MMC2_CLK, CM_PER_MMC1_CLKCTRL, 0), +/** + * g_omap3_clk_details - Stores details for all the different clocks supported + * + * Whenever an operation on a clock is being performed (activated, deactivated, + * etc) this array is looked up to find the correct register and bit(s) we + * should be modifying. + * + */ - { INVALID_CLK_IDENT, 0}, +struct omap3_clk_details { + clk_ident_t id; + int32_t src_freq; + + /* The register offset from the CM module register region of the registers*/ + uint32_t fclken_offset; + uint32_t iclken_offset; + uint32_t idlest_offset; + + /* The bit offset for the clock */ + uint32_t bit_offset; }; -/* Read/Write macros */ -#define prcm_read_4(reg) \ - bus_space_read_4(omap3_prcm_sc->bst, omap3_prcm_sc->bsh, reg) -#define prcm_write_4(reg, val) \ - bus_space_write_4(omap3_prcm_sc->bst, omap3_prcm_sc->bsh, reg, val) - -void omap3_prcm_setup_dmtimer(int); - -static int -omap3_prcm_probe(device_t dev) -{ - if (ofw_bus_is_compatible(dev, "omap3,prcm")) { - device_set_desc(dev, "AM335x Power and Clock Management"); - return(BUS_PROBE_DEFAULT); +#define OMAP3_GENERIC_CLOCK_DETAILS(d, freq, base, fclk, iclk, idlest, bit) \ + { .id = (d), \ + .src_freq = (freq), \ + .fclken_offset = ((base) + (fclk)), \ + .iclken_offset = ((base) + (iclk)), \ + .idlest_offset = ((base) + (idlest)), \ + .bit_offset = (bit), \ } - return (ENXIO); -} - -static int -omap3_prcm_attach(device_t dev) -{ - struct omap3_prcm_softc *sc = device_get_softc(dev); - unsigned int sysclk, fclk; - - if (omap3_prcm_sc) - return (ENXIO); +static const struct omap3_clk_details g_omap3_clk_details[] = { - if (bus_alloc_resources(dev, omap3_prcm_spec, sc->res)) { - device_printf(dev, "could not allocate resources\n"); - return (ENXIO); - } + /* UART */ + OMAP3_GENERIC_CLOCK_DETAILS(UART1_CLK, FREQ_48MHZ, CORE_CM_OFFSET, + 0x00, 0x10, 0x20, 13), + OMAP3_GENERIC_CLOCK_DETAILS(UART2_CLK, FREQ_48MHZ, CORE_CM_OFFSET, + 0x00, 0x10, 0x20, 14), + OMAP3_GENERIC_CLOCK_DETAILS(UART3_CLK, FREQ_48MHZ, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 11), + + /* General purpose timers */ + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER1_CLK, -1, WKUP_CM_OFFSET, + 0x00, 0x10, 0x20, 3), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER2_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 3), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER3_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 4), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER4_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 5), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER5_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 6), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER6_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 7), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER7_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 8), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER8_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 9), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER9_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 10), + OMAP3_GENERIC_CLOCK_DETAILS(GPTIMER10_CLK, -1, CORE_CM_OFFSET, + 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), + 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, + 0x00, 0x10, 0x20, 30), + + /* USB HS (high speed TLL, EHCI and OHCI) */ + OMAP3_GENERIC_CLOCK_DETAILS(USBTLL_CLK, -1, CORE_CM_OFFSET, + 0x08, 0x18, 0x28, 2), + OMAP3_GENERIC_CLOCK_DETAILS(USBHSHOST_CLK, -1, USBHOST_CM_OFFSET, + 0x00, 0x10, 0x20, 1), - sc->bst = rman_get_bustag(sc->res[0]); - sc->bsh = rman_get_bushandle(sc->res[0]); + /* GPIO modules */ + OMAP3_GENERIC_CLOCK_DETAILS(GPIO1_CLK, -1, WKUP_CM_OFFSET, + 0x00, 0x10, 0x20, 3), + OMAP3_GENERIC_CLOCK_DETAILS(GPIO2_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 13), + OMAP3_GENERIC_CLOCK_DETAILS(GPIO3_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 14), + OMAP3_GENERIC_CLOCK_DETAILS(GPIO4_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 15), + OMAP3_GENERIC_CLOCK_DETAILS(GPIO5_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 16), + OMAP3_GENERIC_CLOCK_DETAILS(GPIO6_CLK, -1, PER_CM_OFFSET, + 0x00, 0x10, 0x20, 17), + + /* I2C modules */ + OMAP3_GENERIC_CLOCK_DETAILS(I2C1_CLK, -1, CORE_CM_OFFSET, + 0x00, 0x10, 0x20, 15), + OMAP3_GENERIC_CLOCK_DETAILS(I2C2_CLK, -1, CORE_CM_OFFSET, + 0x00, 0x10, 0x20, 16), + OMAP3_GENERIC_CLOCK_DETAILS(I2C3_CLK, -1, CORE_CM_OFFSET, + 0x00, 0x10, 0x20, 17), +#endif - omap3_prcm_sc = sc; - ti_cpu_reset = omap3_prcm_reset; + { INVALID_CLK_IDENT, 0, 0, 0, 0 }, +}; - omap3_clk_get_sysclk_freq(NULL, &sysclk); - omap3_clk_get_arm_fclk_freq(NULL, &fclk); - device_printf(dev, "Clocks: System %u.%01u MHz, CPU %u MHz\n", - sysclk/1000000, (sysclk % 1000000)/100000, fclk/1000000); +static struct omap3_prcm_softc *omap3_prcm_sc = NULL; - return (0); -} -static device_method_t omap3_prcm_methods[] = { - DEVMETHOD(device_probe, omap3_prcm_probe), - DEVMETHOD(device_attach, omap3_prcm_attach), - { 0, 0 } -}; +/** + * MAX_MODULE_ENABLE_WAIT - the number of loops to wait for the module to come + * alive. + * + */ +#define MAX_MODULE_ENABLE_WAIT 1000 -static driver_t omap3_prcm_driver = { - "omap3_prcm", - omap3_prcm_methods, - sizeof(struct omap3_prcm_softc), -}; + +/** + * ARRAY_SIZE - Macro to return the number of elements in a static const array. + * + */ +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -static devclass_t omap3_prcm_devclass; -DRIVER_MODULE(omap3_prcm, simplebus, omap3_prcm_driver, - omap3_prcm_devclass, 0, 0); -MODULE_DEPEND(omap3_prcm, ti_scm, 1, 1, 1); -static struct omap3_clk_details* -omap3_clk_details(clk_ident_t id) +static int +omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) { - struct omap3_clk_details *walker; - - for (walker = g_omap3_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { - if (id == walker->id) - return (walker); - } + + return (0); +} - return NULL; +static int +omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +{ + + return (0); } static int omap3_clk_generic_activate(struct ti_clock_dev *clkdev) { - struct omap3_prcm_softc *sc = omap3_prcm_sc; - struct omap3_clk_details* clk_details; - - if (sc == NULL) - return ENXIO; - - clk_details = omap3_clk_details(clkdev->id); - - if (clk_details == NULL) - return (ENXIO); - - /* set *_CLKCTRL register MODULEMODE[1:0] to enable(2) */ - prcm_write_4(clk_details->clkctrl_reg, 2); - while ((prcm_read_4(clk_details->clkctrl_reg) & 0x3) != 2) - DELAY(10); - + return (0); } static int omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev) { - struct omap3_prcm_softc *sc = omap3_prcm_sc; - struct omap3_clk_details* clk_details; - - if (sc == NULL) - return ENXIO; - - clk_details = omap3_clk_details(clkdev->id); - - if (clk_details == NULL) - return (ENXIO); - - /* set *_CLKCTRL register MODULEMODE[1:0] to disable(0) */ - prcm_write_4(clk_details->clkctrl_reg, 0); - while ((prcm_read_4(clk_details->clkctrl_reg) & 0x3) != 0) - DELAY(10); - + return (0); } static int omap3_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc) { - struct omap3_prcm_softc *sc = omap3_prcm_sc; - struct omap3_clk_details* clk_details; - uint32_t reg; - - if (sc == NULL) - return ENXIO; - - clk_details = omap3_clk_details(clkdev->id); - - if (clk_details == NULL) - return (ENXIO); - - switch (clksrc) { - case EXT_CLK: - reg = 0; /* SEL2: TCLKIN clock */ - break; - case SYSCLK_CLK: - reg = 1; /* SEL1: CLK_M_OSC clock */ - break; - case F32KHZ_CLK: - reg = 2; /* SEL3: CLK_32KHZ clock */ - break; - default: - return (ENXIO); - } - - prcm_write_4(clk_details->clksel_reg, reg); - while ((prcm_read_4(clk_details->clksel_reg) & 0x3) != reg) - DELAY(10); - + return (0); } static int -omap3_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +omap3_clk_generic_accessible(struct ti_clock_dev *clkdev) { - *freq = 96000000; + return (0); } -static int -omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) + +/** + * omap3_clk_init - add a child item to the root omap3 device + * @dev: the parent device + * @prio: defines roughly the order with which to add the child to the parent + * + * Initialises the clock structure and add an instance of the omap_prcm to + * the parent device with the correct memory regions assigned. + * + * + */ +void +omap3_clk_init(device_t dev, int prio) { - uint32_t ctrl_status; + device_t kid; + struct omap_ivar *ivar; - /* Read the input clock freq from the control module */ - /* control_status reg (0x40) */ - if (ti_scm_reg_read_4(0x40, &ctrl_status)) - return ENXIO; - - switch ((ctrl_status>>22) & 0x3) { - case 0x0: - /* 19.2Mhz */ - *freq = 19200000; - break; - case 0x1: - /* 24Mhz */ - *freq = 24000000; - break; - case 0x2: - /* 25Mhz */ - *freq = 25000000; - break; - case 0x3: - /* 26Mhz */ - *freq = 26000000; - break; + /* Start by adding the actual child to the parent (us) */ + kid = device_add_child_ordered(dev, prio, "omap_prcm", 0); + if (kid == NULL) { + printf("Can't add child omap_prcm0 ordered\n"); + return; } - - return (0); + + /* Allocate some memory for the omap_ivar structure */ + ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO); + if (ivar == NULL) { + device_delete_child(dev, kid); + printf("Can't add alloc ivar\n"); + return; + } + + /* Assign the ivars to the child item and populate with the device resources */ + device_set_ivars(kid, ivar); + + /* Assign the IRQ(s) in the resource list */ + resource_list_init(&ivar->resources); + + /* Assign the memory region to the resource list */ + bus_set_resource(kid, SYS_RES_MEMORY, CM_INSTANCE_MEM_REGION, + OMAP35XX_CM_HWBASE, 0x2000); + bus_set_resource(kid, SYS_RES_MEMORY, PRM_INSTANCE_MEM_REGION, + OMAP35XX_PRM_HWBASE, 0x2000); } static int -omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) -{ - uint32_t reg; - uint32_t sysclk; -#define DPLL_BYP_CLKSEL(reg) ((reg>>23) & 1) -#define DPLL_DIV(reg) ((reg & 0x7f)+1) -#define DPLL_MULT(reg) ((reg>>8) & 0x7FF) - - reg = prcm_read_4(CM_WKUP_CM_CLKSEL_DPLL_MPU); - - /*Check if we are running in bypass */ - if (DPLL_BYP_CLKSEL(reg)) - return ENXIO; - - omap3_clk_get_sysclk_freq(NULL, &sysclk); - *freq = DPLL_MULT(reg) * (sysclk / DPLL_DIV(reg)); - return(0); -} - -static void -omap3_prcm_reset(void) +omap3_prcm_probe(device_t dev) { - prcm_write_4(PRM_RSTCTRL, (1<<1)); + if (ofw_bus_is_compatible(dev, "am37x,prcm")) { + device_set_desc(dev, "OMAP3 Power and Clock Management"); + return(BUS_PROBE_DEFAULT); + } + return (ENXIO); } static int -omap3_clk_cpsw_activate(struct ti_clock_dev *clkdev) +omap3_prcm_attach(device_t dev) { - struct omap3_prcm_softc *sc = omap3_prcm_sc; - - if (sc == NULL) - return ENXIO; + struct omap3_prcm_softc *sc = device_get_softc(dev); - /* set MODULENAME to ENABLE */ - prcm_write_4(CM_PER_CPGMAC0_CLKCTRL, 2); + if( omap3_prcm_sc ) + { + return (ENXIO); + } + if( bus_alloc_resources(dev, omap3_prcm_spec, sc->res ) ) + { + device_printf(dev, "could not allocate resources\n" ); + return (ENXIO); + } - /* wait for IDLEST to become Func(0) */ - while(prcm_read_4(CM_PER_CPGMAC0_CLKCTRL) & (3<<16)); + sc->cm_bst = rman_get_bustag(sc->res[0]); + sc->cm_bsh = rman_get_bushandle(sc->res[0]); + sc->prm_bst = rman_get_bustag(sc->res[1]); + sc->prm_bsh = rman_get_bushandle(sc->res[1]); + omap3_prcm_sc = sc; - /*set CLKTRCTRL to SW_WKUP(2) */ - prcm_write_4(CM_PER_CPSW_CLKSTCTRL, 2); - /* wait for 125 MHz OCP clock to become active */ - while((prcm_read_4(CM_PER_CPSW_CLKSTCTRL) & (1<<4)) == 0); - return(0); + return (0); } -static int -omap3_clk_musb0_activate(struct ti_clock_dev *clkdev) -{ - struct omap3_prcm_softc *sc = omap3_prcm_sc; - - if (sc == NULL) - return ENXIO; - - /* set ST_DPLL_CLKDCOLDO(9) to CLK_GATED(1) */ - /* set DPLL_CLKDCOLDO_GATE_CTRL(8) to CLK_ENABLE(1)*/ - prcm_write_4(CM_WKUP_CM_CLKDCOLDO_DPLL_PER, 0x300); - - /*set MODULEMODE to ENABLE(2) */ - prcm_write_4(CM_PER_USB0_CLKCTRL, 2); - - /* wait for MODULEMODE to become ENABLE(2) */ - while ((prcm_read_4(CM_PER_USB0_CLKCTRL) & 0x3) != 2) - DELAY(10); +static device_method_t omap3_prcm_methods[] = { + DEVMETHOD(device_probe, omap3_prcm_probe), + DEVMETHOD(device_attach, omap3_prcm_attach), + { 0, 0 } +}; - /* wait for IDLEST to become Func(0) */ - while(prcm_read_4(CM_PER_USB0_CLKCTRL) & (3<<16)) - DELAY(10); +static driver_t omap3_prcm_driver = { + "omap3_prcm", + omap3_prcm_methods, + sizeof(struct omap3_prcm_softc), +}; - return(0); -} +static devclass_t omap3_prcm_devclass; +DRIVER_MODULE(omap3_prcm, simplebus, omap3_prcm_driver, omap3_prcm_devclass, 0, 0); +MODULE_DEPEND(omap3_prcm, ti_scm, 1, 1, 1); Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 11:49:23 2012 (r237888) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 12:33:37 2012 (r237889) @@ -69,11 +69,12 @@ "I2C0_SCL", "I2C0_SCL","input_pullup_inact_slow"; }; - prcm@44E00000 { - compatible = "am37x,prcm"; + prcm@48004000 { + compatible = "am37x,omap3_prcm"; #address-cells = <1>; #size-cells = <1>; - reg = < 0x44E00000 0x1300 >; + reg = < 0x48004000 0x2000 + 0x48306000 0x2000>; }; GPIO: gpio { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 12:58:48 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 90692106566B for ; Mon, 18 Jun 2012 12:58:46 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 12:58:46 +0000 Date: Mon, 18 Jun 2012 12:58:46 +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: <20120618125846.90692106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237890 - soc2012/rudot/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: Mon, 18 Jun 2012 12:58:48 -0000 Author: rudot Date: Mon Jun 18 12:58:45 2012 New Revision: 237890 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237890 Log: Adding some header files Added: soc2012/rudot/sys/sys/rctl.h soc2012/rudot/sys/sys/sched.h Added: soc2012/rudot/sys/sys/rctl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/sys/rctl.h Mon Jun 18 12:58:45 2012 (r237890) @@ -0,0 +1,169 @@ +/*- + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/rctl.h,v 1.3 2011/05/03 07:32:58 trasz Exp $ + */ + +/* + * Resource Limits. + */ + +#ifndef _RCTL_H_ +#define _RCTL_H_ + +#include +#include +#include +#include + +struct proc; +struct uidinfo; +struct loginclass; +struct prison_racct; +struct ucred; +struct rctl_rule_link; + +#ifdef _KERNEL + +/* + * Rules describe an action to be taken when conditions defined + * in the rule are met. There is no global list of rules; instead, + * rules are linked to by the racct structures for all the subjects + * they apply to - for example, a rule of type "user" is linked to the + * appropriate struct uidinfo, and to all the processes of that user. + * + * 'rr_refcount' is equal to the number of rctl_rule_link structures + * pointing to the rule. + * + * This structure must never change after being added, via rctl_rule_link + * structures, to subjects. In order to change a rule, add a new rule + * and remove the previous one. + */ +struct rctl_rule { + int rr_subject_type; + union { + struct proc *rs_proc; + struct uidinfo *rs_uip; + struct loginclass *rs_loginclass; + struct prison_racct *rs_prison_racct; + } rr_subject; + int rr_per; + int rr_resource; + int rr_action; + int64_t rr_amount; + u_int rr_refcount; + struct task rr_task; +}; + +/* + * Allowed values for rr_subject_type and rr_per fields. + */ +#define RCTL_SUBJECT_TYPE_UNDEFINED -1 +#define RCTL_SUBJECT_TYPE_PROCESS 0x0000 +#define RCTL_SUBJECT_TYPE_USER 0x0001 +#define RCTL_SUBJECT_TYPE_LOGINCLASS 0x0003 +#define RCTL_SUBJECT_TYPE_JAIL 0x0004 +#define RCTL_SUBJECT_TYPE_MAX RCTL_SUBJECT_TYPE_JAIL + +/* + * Allowed values for rr_action field. + */ +#define RCTL_ACTION_UNDEFINED -1 +#define RCTL_ACTION_SIGHUP SIGHUP +#define RCTL_ACTION_SIGINT SIGINT +#define RCTL_ACTION_SIGQUIT SIGQUIT +#define RCTL_ACTION_SIGILL SIGILL +#define RCTL_ACTION_SIGTRAP SIGTRAP +#define RCTL_ACTION_SIGABRT SIGABRT +#define RCTL_ACTION_SIGEMT SIGEMT +#define RCTL_ACTION_SIGFPE SIGFPE +#define RCTL_ACTION_SIGKILL SIGKILL +#define RCTL_ACTION_SIGBUS SIGBUS +#define RCTL_ACTION_SIGSEGV SIGSEGV +#define RCTL_ACTION_SIGSYS SIGSYS +#define RCTL_ACTION_SIGPIPE SIGPIPE +#define RCTL_ACTION_SIGALRM SIGALRM +#define RCTL_ACTION_SIGTERM SIGTERM +#define RCTL_ACTION_SIGURG SIGURG +#define RCTL_ACTION_SIGSTOP SIGSTOP +#define RCTL_ACTION_SIGTSTP SIGTSTP +#define RCTL_ACTION_SIGCHLD SIGCHLD +#define RCTL_ACTION_SIGTTIN SIGTTIN +#define RCTL_ACTION_SIGTTOU SIGTTOU +#define RCTL_ACTION_SIGIO SIGIO +#define RCTL_ACTION_SIGXCPU SIGXCPU +#define RCTL_ACTION_SIGXFSZ SIGXFSZ +#define RCTL_ACTION_SIGVTALRM SIGVTALRM +#define RCTL_ACTION_SIGPROF SIGPROF +#define RCTL_ACTION_SIGWINCH SIGWINCH +#define RCTL_ACTION_SIGINFO SIGINFO +#define RCTL_ACTION_SIGUSR1 SIGUSR1 +#define RCTL_ACTION_SIGUSR2 SIGUSR2 +#define RCTL_ACTION_SIGTHR SIGTHR +#define RCTL_ACTION_SIGNAL_MAX RCTL_ACTION_SIGTHR +#define RCTL_ACTION_DENY (RCTL_ACTION_SIGNAL_MAX + 1) +#define RCTL_ACTION_LOG (RCTL_ACTION_SIGNAL_MAX + 2) +#define RCTL_ACTION_DEVCTL (RCTL_ACTION_SIGNAL_MAX + 3) +#define RCTL_ACTION_MAX RCTL_ACTION_DEVCTL + +#define RCTL_AMOUNT_UNDEFINED -1 + +struct rctl_rule *rctl_rule_alloc(int flags); +struct rctl_rule *rctl_rule_duplicate(const struct rctl_rule *rule, int flags); +void rctl_rule_acquire(struct rctl_rule *rule); +void rctl_rule_release(struct rctl_rule *rule); +int rctl_rule_add(struct rctl_rule *rule); +int rctl_rule_remove(struct rctl_rule *filter); +int rctl_enforce(struct proc *p, int resource, uint64_t amount); +uint64_t rctl_get_limit(struct proc *p, int resource); +uint64_t rctl_get_available(struct proc *p, int resource); +const char *rctl_resource_name(int resource); +void rctl_proc_ucred_changed(struct proc *p, struct ucred *newcred); +int rctl_proc_fork(struct proc *parent, struct proc *child); +void rctl_racct_release(struct racct *racct); +#else /* !_KERNEL */ + +/* + * Syscall interface. + */ +__BEGIN_DECLS +int rctl_get_racct(const char *inbufp, size_t inbuflen, char *outbufp, + size_t outbuflen); +int rctl_get_rules(const char *inbufp, size_t inbuflen, char *outbufp, + size_t outbuflen); +int rctl_get_limits(const char *inbufp, size_t inbuflen, char *outbufp, + size_t outbuflen); +int rctl_add_rule(const char *inbufp, size_t inbuflen, char *outbufp, + size_t outbuflen); +int rctl_remove_rule(const char *inbufp, size_t inbuflen, char *outbufp, + size_t outbuflen); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_RCTL_H_ */ Added: soc2012/rudot/sys/sys/sched.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/sys/sched.h Mon Jun 18 12:58:45 2012 (r237890) @@ -0,0 +1,240 @@ +/*- + * Copyright (c) 1996, 1997 + * HD Associates, 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by HD Associates, Inc + * and Jukka Antero Ukkonen. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES 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 HD ASSOCIATES 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. + */ + +/*- + * Copyright (c) 2002-2008, Jeffrey Roberson + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR 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/sys/sys/sched.h,v 1.46 2012/03/08 19:41:05 jhb Exp $ + */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +#ifdef _KERNEL +/* + * General scheduling info. + * + * sched_load: + * Total runnable non-ithread threads in the system. + * + * sched_runnable: + * Runnable threads for this processor. + */ +int sched_load(void); +int sched_rr_interval(void); +int sched_runnable(void); + +/* + * Proc related scheduling hooks. + */ +void sched_exit(struct proc *p, struct thread *childtd); +void sched_fork(struct thread *td, struct thread *childtd); +void sched_fork_exit(struct thread *td); +void sched_class(struct thread *td, int class); +void sched_nice(struct proc *p, int nice); + +/* + * Threads are switched in and out, block on resources, have temporary + * priorities inherited from their procs, and use up cpu time. + */ +void sched_exit_thread(struct thread *td, struct thread *child); +void sched_fork_thread(struct thread *td, struct thread *child); +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); +void sched_throw(struct thread *td); +void sched_unlend_prio(struct thread *td, u_char prio); +void sched_user_prio(struct thread *td, u_char prio); +void sched_userret(struct thread *td); +void sched_wakeup(struct thread *td); +void sched_preempt(struct thread *td); + +/* + * Threads are moved on and off of run queues + */ +void sched_add(struct thread *td, int flags); +void sched_clock(struct thread *td); +void sched_rem(struct thread *td); +void sched_tick(int cnt); +void sched_relinquish(struct thread *td); +struct thread *sched_choose(void); +void sched_idletd(void *); + +/* + * Binding makes cpu affinity permanent while pinning is used to temporarily + * hold a thread on a particular CPU. + */ +void sched_bind(struct thread *td, int cpu); +static __inline void sched_pin(void); +void sched_unbind(struct thread *td); +static __inline void sched_unpin(void); +int sched_is_bound(struct thread *td); +void sched_affinity(struct thread *td); + +/* + * These procedures tell the process data structure allocation code how + * many bytes to actually allocate. + */ +int sched_sizeof_proc(void); +int sched_sizeof_thread(void); + +/* + * This routine provides a consistent thread name for use with KTR graphing + * functions. + */ +char *sched_tdname(struct thread *td); +#ifdef KTR +void sched_clear_tdname(struct thread *td); +#endif + +static __inline void +sched_pin(void) +{ + curthread->td_pinned++; +} + +static __inline void +sched_unpin(void) +{ + curthread->td_pinned--; +} + +/* sched_add arguments (formerly setrunqueue) */ +#define SRQ_BORING 0x0000 /* No special circumstances. */ +#define SRQ_YIELDING 0x0001 /* We are yielding (from mi_switch). */ +#define SRQ_OURSELF 0x0002 /* It is ourself (from mi_switch). */ +#define SRQ_INTR 0x0004 /* It is probably urgent. */ +#define SRQ_PREEMPTED 0x0008 /* has been preempted.. be kind */ +#define SRQ_BORROWING 0x0010 /* Priority updated due to prio_lend */ + +/* Scheduler stats. */ +#ifdef SCHED_STATS +DPCPU_DECLARE(long, sched_switch_stats[SWT_COUNT]); + +#define SCHED_STAT_DEFINE_VAR(name, ptr, descr) \ +static void name ## _add_proc(void *dummy __unused) \ +{ \ + \ + SYSCTL_ADD_PROC(NULL, \ + SYSCTL_STATIC_CHILDREN(_kern_sched_stats), OID_AUTO, \ + #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, \ + ptr, 0, sysctl_dpcpu_long, "LU", descr); \ +} \ +SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, NULL); + +#define SCHED_STAT_DEFINE(name, descr) \ + DPCPU_DEFINE(unsigned long, name); \ + SCHED_STAT_DEFINE_VAR(name, &DPCPU_NAME(name), descr) +/* + * Sched stats are always incremented in critical sections so no atomic + * is necesssary to increment them. + */ +#define SCHED_STAT_INC(var) DPCPU_GET(var)++; +#else +#define SCHED_STAT_DEFINE_VAR(name, descr, ptr) +#define SCHED_STAT_DEFINE(name, descr) +#define SCHED_STAT_INC(var) (void)0 +#endif + +/* + * Fixup scheduler state for proc0 and thread0 + */ +void schedinit(void); +#endif /* _KERNEL */ + +/* POSIX 1003.1b Process Scheduling */ + +/* + * POSIX scheduling policies + */ +#define SCHED_FIFO 1 +#define SCHED_OTHER 2 +#define SCHED_RR 3 + +struct sched_param { + int sched_priority; +}; + +/* + * POSIX scheduling declarations for userland. + */ +#ifndef _KERNEL +#include +#include + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +struct timespec; + +__BEGIN_DECLS +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param *); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec *); +int sched_setparam(pid_t, const struct sched_param *); +int sched_setscheduler(pid_t, int, const struct sched_param *); +int sched_yield(void); +__END_DECLS + +#endif +#endif /* !_SCHED_H_ */ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 13:32: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 CA6FB1065676 for ; Mon, 18 Jun 2012 13:32:54 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 13:32:54 +0000 Date: Mon, 18 Jun 2012 13:32:54 +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: <20120618133254.CA6FB1065676@hub.freebsd.org> Cc: Subject: socsvn commit: r237892 - in soc2012/aleek/beaglexm-armv6/sys: 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: Mon, 18 Jun 2012 13:32:57 -0000 Author: aleek Date: Mon Jun 18 13:32:54 2012 New Revision: 237892 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237892 Log: extended prcm driver Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 12:45:35 2012 (r237891) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 13:32:54 2012 (r237892) @@ -47,6 +47,12 @@ #include #include +#include +#include +#include +#include +#include + #include #include #include @@ -137,7 +143,7 @@ struct omap3_prcm_softc { struct resource *res[2]; bus_space_tag_t prm_bst, cm_bst; - bus_space_tag_t prm_bsh, cm_bsh; + bus_space_handle_t prm_bsh, cm_bsh; }; static struct resource_spec omap3_prcm_spec[] = { @@ -166,8 +172,14 @@ static int omap3_clk_generic_accessible(struct ti_clock_dev *clkdev); +static int +omap3_clk_gptimer_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int +omap3_clk_gptimer_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); +static int +omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); @@ -222,7 +234,7 @@ } -const struct ti_clock_dev omap_clk_devmap[] = { +const struct ti_clock_dev ti_clk_devmap[] = { /* System clock */ { .id = SYS_CLK, @@ -241,7 +253,6 @@ .clk_get_source_freq = omap3_clk_get_arm_fclk_freq, }, - /* UART device clocks */ OMAP3_GENERIC_CLOCK_DEV(UART1_CLK), OMAP3_GENERIC_CLOCK_DEV(UART2_CLK), @@ -303,7 +314,7 @@ * */ -struct omap3_clk_details { +struct ti_clk_details { clk_ident_t id; int32_t src_freq; @@ -325,7 +336,7 @@ .bit_offset = (bit), \ } -static const struct omap3_clk_details g_omap3_clk_details[] = { +static const struct ti_clk_details g_omap3_clk_details[] = { /* UART */ OMAP3_GENERIC_CLOCK_DETAILS(UART1_CLK, FREQ_48MHZ, CORE_CM_OFFSET, @@ -460,6 +471,34 @@ return (0); } +static int +omap3_clk_gptimer_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +{ + + return (0); +} + +static int +omap3_clk_gptimer_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc) +{ + + return (0); +} + +static int +omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq) +{ + + return (0); +} + + + + + + + + /** * omap3_clk_init - add a child item to the root omap3 device @@ -474,6 +513,7 @@ void omap3_clk_init(device_t dev, int prio) { +#if 0 device_t kid; struct omap_ivar *ivar; @@ -503,12 +543,13 @@ OMAP35XX_CM_HWBASE, 0x2000); bus_set_resource(kid, SYS_RES_MEMORY, PRM_INSTANCE_MEM_REGION, OMAP35XX_PRM_HWBASE, 0x2000); +#endif } static int omap3_prcm_probe(device_t dev) { - if (ofw_bus_is_compatible(dev, "am37x,prcm")) { + if (ofw_bus_is_compatible(dev, "ti,omap3_prcm")) { device_set_desc(dev, "OMAP3 Power and Clock Management"); return(BUS_PROBE_DEFAULT); } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 12:45:35 2012 (r237891) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 13:32:54 2012 (r237892) @@ -70,7 +70,7 @@ }; prcm@48004000 { - compatible = "am37x,omap3_prcm"; + compatible = "ti,omap3_prcm"; #address-cells = <1>; #size-cells = <1>; reg = < 0x48004000 0x2000 From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 17:31: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 246741065672 for ; Mon, 18 Jun 2012 17:31:45 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 17:31:45 +0000 Date: Mon, 18 Jun 2012 17:31:45 +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: <20120618173145.246741065672@hub.freebsd.org> Cc: Subject: socsvn commit: r237896 - in 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: Mon, 18 Jun 2012 17:31:47 -0000 Author: vchan Date: Mon Jun 18 17:31:44 2012 New Revision: 237896 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237896 Log: initial commit Added: soc2012/vchan/gtcp/ soc2012/vchan/gtcp/bwalex-tc-play/ soc2012/vchan/gtcp/bwalex-tc-play/LICENSE soc2012/vchan/gtcp/bwalex-tc-play/Makefile soc2012/vchan/gtcp/bwalex-tc-play/README.md soc2012/vchan/gtcp/bwalex-tc-play/crc32.c soc2012/vchan/gtcp/bwalex-tc-play/crc32.h soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c soc2012/vchan/gtcp/bwalex-tc-play/crypto-gcrypt.c soc2012/vchan/gtcp/bwalex-tc-play/crypto.c soc2012/vchan/gtcp/bwalex-tc-play/generic_xts.c soc2012/vchan/gtcp/bwalex-tc-play/generic_xts.h soc2012/vchan/gtcp/bwalex-tc-play/hdr.c soc2012/vchan/gtcp/bwalex-tc-play/humanize.c soc2012/vchan/gtcp/bwalex-tc-play/humanize.h soc2012/vchan/gtcp/bwalex-tc-play/io.c soc2012/vchan/gtcp/bwalex-tc-play/main.c soc2012/vchan/gtcp/bwalex-tc-play/pbkdf2-gcrypt.c soc2012/vchan/gtcp/bwalex-tc-play/pbkdf2-openssl.c soc2012/vchan/gtcp/bwalex-tc-play/safe_mem.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay.3 soc2012/vchan/gtcp/bwalex-tc-play/tcplay.8 soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay.h soc2012/vchan/gtcp/bwalex-tc-play/tcplay.map soc2012/vchan/gtcp/bwalex-tc-play/tcplay_api.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay_api.h soc2012/vchan/gtcp/bwalex-tc-play/tcplay_api_test.c Added: soc2012/vchan/gtcp/bwalex-tc-play/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/LICENSE Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,26 @@ +Copyright (c) 2011 Alex Hornung . +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 COPYRIGHT HOLDERS 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 +COPYRIGHT HOLDERS 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. Added: soc2012/vchan/gtcp/bwalex-tc-play/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/Makefile Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,66 @@ +# either linux or dragonfly +SYSTEM?=linux + +# either openssl or gcrypt +PBKDF_BACKEND?=openssl + +# system compiler, normally gcc +CC?=gcc + +# whether to enable debugging or not +DEBUG?=no + +WARNFLAGS= -Wsystem-headers -Werror -Wall -W -Wno-unused-parameter \ + -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ + -Wold-style-definition -Wreturn-type -Wcast-qual -Wwrite-strings \ + -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts \ + -Winline -Wnested-externs + +SRCS= tcplay.c crc32.c safe_mem.c io.c hdr.c humanize.c +SRCS+= crypto.c generic_xts.c +OBJS= tcplay.o crc32.o safe_mem.o io.o hdr.o humanize.o +OBJS+= crypto.o generic_xts.o + +CFLAGS+= $(WARNFLAGS) + +ifeq (${DEBUG}, yes) + CFLAGS+= -O0 -g -DDEBUG +else + CFLAGS+= -O3 +endif + +ifeq (${SYSTEM}, linux) + CFLAGS+= -D_GNU_SOURCE + LIBS+= -lgcrypt -ldevmapper -luuid + SRCS+= crypto-gcrypt.c + OBJS+= crypto-gcrypt.o + ifeq (${PBKDF_BACKEND}, gcrypt) + SRCS+= pbkdf2-gcrypt.c + OBJS+= pbkdf2-gcrypt.o + endif + ifeq (${PBKDF_BACKEND}, openssl) + SRCS+= pbkdf2-openssl.c + OBJS+= pbkdf2-openssl.o + LIBS+= -lcrypto + endif +endif + +ifeq (${SYSTEM}, dragonfly) + LIBS+= -lcrypto -ldm -lprop + SRCS+= crypto-dev.c + OBJS+= crypto-dev.o + SRCS+= pbkdf2-openssl.c + OBJS+= pbkdf2-openssl.o +endif + +program: + $(CC) $(CFLAGS) -o tcplay main.c $(SRCS) $(LIBS) +lib: + $(CC) $(CFLAGS) -c -fPIC tcplay_api.c $(SRCS) + $(CC) -shared -Wl,-version-script=tcplay.map -o libtcplay.so tcplay_api.o $(OBJS) + +test: + gcc -O0 -g -L. -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop +clean: + rm -f tcplay libtcplay.so tcplay.core *.o ktrace.out + Added: soc2012/vchan/gtcp/bwalex-tc-play/README.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/README.md Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,98 @@ +About +========== +tcplay is a free (BSD-licensed), pretty much fully featured (including multiple +keyfiles, cipher cascades, etc) and stable TrueCrypt implementation. + +This implementation supports mapping (opening) both system and normal TrueCrypt +volumes, as well as opening hidden volumes and opening an outer volume while +protecting a hidden volume. There is also support to create volumes, including +hidden volumes, etc. + +Since tcplay uses dm-crypt (or dm_target_crypt on DragonFly) it makes full use +of any available hardware encryption/decryption support once the volume has been +mapped. + +It is based solely on the documentation available on the TrueCrypt website, +many hours of trial and error and the output of the Linux' TrueCrypt client. +As it turns out, most technical documents on TrueCrypt contains mistakes, hence +the trial and error approach. + + + +Implementation notes +========== +DragonFly BSD uses the hybrid OpenSSL + cryptodev(9) approach that can be +found in crypto-dev.c. OpenSSL is only used for the hash/pbkdf2. The +encryption/decryption is performed via cryptodev(9) with enabled cryptosoft. + +On Linux gcrypt is used for the encryption and decryption. For the hash/pbkdf2 +either gcrypt or OpenSSL can be used. gcrypt only supports pbkdf2 since its +July 2011 release (1.5.0), while OpenSSL has had pbkdf2 since around December +2010, so its easier to find in most distros. + +The crypto options can be chosen with make/Makefile parameters. Building on Linux +is as easy as doing + + make SYSTEM=linux + +you can even skip the SYSTEM=linux, since that's the default. To choose the +PBKDF backend, you can use either, + + make PBKDF_BACKEND=openssl + +or + + make PBKDF_BACKEND=gcrypt + +The interface to device mapper is libdevmapper on Linux and libdm on DragonFly. +libdm is a BSD-licensed version of libdevmapper that I hacked together in a few +hours. + + + +OS Support +========== +tcplay is now available for both DragonFly BSD and Linux. It is a core part of +the DragonFly BSD operating system and is available in a number of linux +distros. + + + +Licensing +========== +The project is under a two-clause BSD license. I would consider dual-licensing +it if required. Drop me an email to discuss the options. + + + +Development +========== +tcplay is pretty much stable, but if you find a bug, please report it. +If anyone wants to add new features or port it to another OS, I'll gladly merge +your changes into this repository so that there is a single point of contact. + +I've noticed that sometimes bugs are only reported downstream (e.g. in the +distro's bugtracker). Please make sure those bugs are also reported upstream on +github, otherwise odds are they will never reach me. + +Coming features: + - restoring header from backup header + + + +Bugs in the TrueCrypt documentation +========== +The TrueCrypt documentation is pretty bad and does not really represent the +actual on-disk format nor the encryption/decryption process. + +Some notable differences between actual implementation and documentation: + - PBKDF using RIPEMD160 only uses 2000 iterations if the volume isn't a system + volume. + - The keyfile pool is not XOR'ed with the passphrase but modulo-8 summed. + - Every field *except* the minimum version field of the volume header are in + big endian. + - Some volume header fields (creation time of volume and header) are missing + in the documentation. + - All two-way cipher cascades are the wrong way round in the documentation, + but all three-way cipher cascades are correct. + Added: soc2012/vchan/gtcp/bwalex-tc-play/crc32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/crc32.c Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,109 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + */ + +#include +#include +#include "crc32.h" + +uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t +crc32(const void *buf, size_t size) +{ + const uint8_t *p; + uint32_t crc; + + p = buf; + crc = ~0U; + + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + + return crc ^ ~0U; +} + +uint32_t +crc32_intermediate(uint32_t crc, uint8_t d) +{ + return crc32_tab[(crc ^ d) & 0xFF] ^ (crc >> 8); +} Added: soc2012/vchan/gtcp/bwalex-tc-play/crc32.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/crc32.h Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,2 @@ +uint32_t crc32(const void *buf, size_t size); +uint32_t crc32_intermediate(uint32_t crc, uint8_t d); Added: soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/crypto-dev.c Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2011 Alex Hornung . + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "tcplay.h" + +static +int +getallowsoft(void) +{ + int old; + size_t olen; + + olen = sizeof(old); + + if (sysctlbyname("kern.cryptodevallowsoft", &old, &olen, NULL, 0) < 0) { + perror("accessing sysctl kern.cryptodevallowsoft failed"); + } + + return old; +} + +static +void +setallowsoft(int new) +{ + int old; + size_t olen, nlen; + + olen = nlen = sizeof(new); + + if (sysctlbyname("kern.cryptodevallowsoft", &old, &olen, &new, nlen) < 0) { + perror("accessing sysctl kern.cryptodevallowsoft failed"); + } +} + +static +int +get_cryptodev_cipher_id(struct tc_crypto_algo *cipher) +{ + if (strcmp(cipher->name, "AES-128-XTS") == 0) + 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 + return -1; +} + +int +syscrypt(struct tc_crypto_algo *cipher, unsigned char *key, size_t klen, unsigned char *iv, + unsigned char *in, unsigned char *out, size_t len, int do_encrypt) +{ + struct session_op session; + struct crypt_op cryp; + int cipher_id; + int cryptodev_fd = -1, fd = -1; + + cipher_id = get_cryptodev_cipher_id(cipher); + if (cipher_id < 0) { + tc_log(1, "Cipher %s not found\n", + cipher->name); + return ENOENT; + } + + if ((cryptodev_fd = open("/dev/crypto", O_RDWR, 0)) < 0) { + perror("Could not open /dev/crypto"); + goto err; + } + if (ioctl(cryptodev_fd, CRIOGET, &fd) == -1) { + perror("CRIOGET failed"); + goto err; + } + memset(&session, 0, sizeof(session)); + session.cipher = cipher_id; + session.key = (caddr_t) key; + session.keylen = klen; + if (ioctl(fd, CIOCGSESSION, &session) == -1) { + perror("CIOCGSESSION failed"); + goto err; + } + memset(&cryp, 0, sizeof(cryp)); + cryp.ses = session.ses; + cryp.op = do_encrypt ? COP_ENCRYPT : COP_DECRYPT; + cryp.flags = 0; + cryp.len = len; + cryp.src = (caddr_t) in; + cryp.dst = (caddr_t) out; + cryp.iv = (caddr_t) iv; + cryp.mac = 0; + if (ioctl(fd, CIOCCRYPT, &cryp) == -1) { + perror("CIOCCRYPT failed"); + goto err; + } + if (ioctl(fd, CIOCFSESSION, &session.ses) == -1) { + perror("CIOCFSESSION failed"); + goto err; + } + close(fd); + close(cryptodev_fd); + return (0); + +err: + if (fd != -1) + close(fd); + if (cryptodev_fd != -1) + close(cryptodev_fd); + return (-1); +} + +int +tc_crypto_init(void) +{ + int allowed; + + allowed = getallowsoft(); + if (allowed == 0) + setallowsoft(1); + + return 0; +} + Added: soc2012/vchan/gtcp/bwalex-tc-play/crypto-gcrypt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/crypto-gcrypt.c Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2011 Alex Hornung . + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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. + */ + +//#include +#include +#include +#include + +/* + * Yey for gcrypt and its broken includes... + * see http://lists.gnupg.org/pipermail/gcrypt-devel/2011-July/001830.html + * and http://seclists.org/wireshark/2011/Jul/208 + * for more details... + */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#include +#pragma GCC diagnostic warning "-Wdeprecated-declarations" + +#include "generic_xts.h" +#include "tcplay.h" + + +static int +gcrypt_encrypt(void *ctx, size_t blk_len, const uint8_t *src, uint8_t *dst) +{ + gcry_cipher_hd_t cipher_hd = (gcry_cipher_hd_t)ctx; + gcry_error_t gcry_err; + + gcry_err = gcry_cipher_encrypt( + cipher_hd, + dst, + blk_len, /* gcry_cipher_get_algo_blklen(GCRY_CIPHER_AES256) */ + src, + blk_len); + + return (gcry_err != 0); +} + +static int +gcrypt_decrypt(void *ctx, size_t blk_len, const uint8_t *src, uint8_t *dst) +{ + gcry_cipher_hd_t cipher_hd = (gcry_cipher_hd_t)ctx; + gcry_error_t gcry_err; + + gcry_err = gcry_cipher_decrypt( + cipher_hd, + dst, + blk_len /* gcry_cipher_get_algo_blklen(GCRY_CIPHER_AES256) */, + src, + blk_len); + + return (gcry_err != 0); +} + +static int +gcrypt_set_key(void **ctx, void *arg1, void *arg2 __unused, const u_int8_t *key, + int keybits __unused) +{ + gcry_cipher_hd_t *cipher_hd = (gcry_cipher_hd_t *)ctx; + int cipher = *((int *)arg1); + gcry_error_t gcry_err; + + gcry_err = gcry_cipher_open( + cipher_hd, + cipher, + GCRY_CIPHER_MODE_ECB, + 0); + + if (gcry_err) + return -1; + + gcry_err = gcry_cipher_setkey( + *cipher_hd, + key, + gcry_cipher_get_algo_keylen(cipher)); + + if (gcry_err) { + gcry_cipher_close(*cipher_hd); + *ctx = NULL; + return -1; + } + + return 0; +} + +static int +gcrypt_zero_key(void **ctx) +{ + gcry_cipher_hd_t *cipher_hd = (gcry_cipher_hd_t *)ctx; + + if (*cipher_hd == NULL) + return 0; + + gcry_cipher_close(*cipher_hd); + return 0; +} + +static +int +get_gcrypt_cipher_id(struct tc_crypto_algo *cipher) +{ + if (strcmp(cipher->name, "AES-128-XTS") == 0) + return GCRY_CIPHER_AES128; + else if (strcmp(cipher->name, "AES-256-XTS") == 0) + return GCRY_CIPHER_AES256; + else if (strcmp(cipher->name, "TWOFISH-128-XTS") == 0) + return GCRY_CIPHER_TWOFISH128; + else if (strcmp(cipher->name, "TWOFISH-256-XTS") == 0) + return GCRY_CIPHER_TWOFISH; /* XXX: really 256? */ + else if (strcmp(cipher->name, "SERPENT-128-XTS") == 0) + return GCRY_CIPHER_SERPENT128; + else if (strcmp(cipher->name, "SERPENT-256-XTS") == 0) + return GCRY_CIPHER_SERPENT256; + else + return -1; +} + +int +syscrypt(struct tc_crypto_algo *cipher, unsigned char *key, size_t klen, unsigned char *iv, + unsigned char *in, unsigned char *out, size_t len, int do_encrypt) +{ + struct xts_ctx *ctx; + int cipher_id; + int err; + + cipher_id = get_gcrypt_cipher_id(cipher); + if (cipher_id < 0) { + tc_log(1, "Cipher %s not found\n", + cipher->name); + return ENOENT; + } + + if ((ctx = (struct xts_ctx *)alloc_safe_mem(sizeof(struct xts_ctx))) == + NULL) { + tc_log(1, "Could not allocate safe xts_xts memory\n"); + return ENOMEM; + } + + err = xts_init(ctx, &cipher_id, NULL, gcrypt_set_key, gcrypt_zero_key, + gcrypt_encrypt, gcrypt_decrypt, + gcry_cipher_get_algo_blklen(cipher_id), + key, klen); + if (err) { + tc_log(1, "Error initializing generic XTS\n"); + return EINVAL; + } + + memcpy(out, in, len); + if (do_encrypt) + err = xts_encrypt(ctx, out, len, iv); + else + err = xts_decrypt(ctx, out, len, iv); + + if (err) { + tc_log(1, "Error encrypting/decrypting\n"); + xts_uninit(ctx); + return EINVAL; + } + + xts_uninit(ctx); + free_safe_mem(ctx); + + return 0; +} + +int +tc_crypto_init(void) +{ + gcry_control(GCRYCTL_SUSPEND_SECMEM_WARN); + gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0); + gcry_control(GCRYCTL_RESUME_SECMEM_WARN); + + gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); + + return 0; +} + Added: soc2012/vchan/gtcp/bwalex-tc-play/crypto.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/crypto.c Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2011 Alex Hornung . + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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. + */ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "crc32.h" +#include "tcplay.h" + +int +tc_cipher_chain_populate_keys(struct tc_cipher_chain *cipher_chain, + unsigned char *key) +{ + int total_key_bytes, used_key_bytes; + struct tc_cipher_chain *dummy_chain; + + /* + * We need to determine the total key bytes as the key locations + * depend on it. + */ + total_key_bytes = 0; + for (dummy_chain = cipher_chain; + dummy_chain != NULL; + dummy_chain = dummy_chain->next) { + total_key_bytes += dummy_chain->cipher->klen; + } + + /* + * Now we need to get prepare the keys, as the keys are in + * forward order with respect to the cipher cascade, but + * the actual decryption is in reverse cipher cascade order. + */ + used_key_bytes = 0; + for (dummy_chain = cipher_chain; + dummy_chain != NULL; + dummy_chain = dummy_chain->next) { + dummy_chain->key = alloc_safe_mem(dummy_chain->cipher->klen); + if (dummy_chain->key == NULL) { + tc_log(1, "tc_decrypt: Could not allocate key " + "memory\n"); + return ENOMEM; + } + + /* XXX: here we assume XTS operation! */ + memcpy(dummy_chain->key, + key + used_key_bytes/2, + dummy_chain->cipher->klen/2); + memcpy(dummy_chain->key + dummy_chain->cipher->klen/2, + key + (total_key_bytes/2) + used_key_bytes/2, + dummy_chain->cipher->klen/2); + + /* Remember how many key bytes we've seen */ + used_key_bytes += dummy_chain->cipher->klen; + } + + return 0; +} + +int +tc_cipher_chain_free_keys(struct tc_cipher_chain *cipher_chain) +{ + for (; cipher_chain != NULL; cipher_chain = cipher_chain->next) { + if (cipher_chain->key != NULL) { + free_safe_mem(cipher_chain->key); + cipher_chain->key = NULL; + } + } + + return 0; +} + +int +tc_encrypt(struct tc_cipher_chain *cipher_chain, unsigned char *key, + unsigned char *iv, + unsigned char *in, int in_len, unsigned char *out) +{ + struct tc_cipher_chain *chain_start; + int err; + + chain_start = cipher_chain; + + if ((err = tc_cipher_chain_populate_keys(cipher_chain, key))) + return err; + +#ifdef DEBUG + printf("tc_encrypt: starting chain\n"); +#endif + + /* + * Now process the actual decryption, in forward cascade order. + */ + for (; + cipher_chain != NULL; + cipher_chain = cipher_chain->next) { +#ifdef DEBUG + printf("tc_encrypt: Currently using cipher %s\n", + cipher_chain->cipher->name); +#endif + + err = syscrypt(cipher_chain->cipher, cipher_chain->key, + cipher_chain->cipher->klen, iv, in, out, in_len, 1); + + /* Deallocate this key, since we won't need it anymore */ + free_safe_mem(cipher_chain->key); + cipher_chain->key = NULL; + + if (err != 0) { + tc_cipher_chain_free_keys(chain_start); + return err; + } + + /* Set next input buffer as current output buffer */ + in = out; + } + + tc_cipher_chain_free_keys(chain_start); + + return 0; +} + +int +tc_decrypt(struct tc_cipher_chain *cipher_chain, unsigned char *key, + unsigned char *iv, + unsigned char *in, int in_len, unsigned char *out) +{ + struct tc_cipher_chain *chain_start; + int err; + + chain_start = cipher_chain; + + if ((err = tc_cipher_chain_populate_keys(cipher_chain, key))) + return err; + +#ifdef DEBUG + printf("tc_decrypt: starting chain!\n"); +#endif + + /* + * Now process the actual decryption, in reverse cascade order; so + * first find the last element in the chain. + */ + for (; cipher_chain->next != NULL; cipher_chain = cipher_chain->next) + ; + for (; + cipher_chain != NULL; + cipher_chain = cipher_chain->prev) { +#ifdef DEBUG + printf("tc_decrypt: Currently using cipher %s\n", + cipher_chain->cipher->name); +#endif + + err = syscrypt(cipher_chain->cipher, cipher_chain->key, + cipher_chain->cipher->klen, iv, in, out, in_len, 0); + + /* Deallocate this key, since we won't need it anymore */ + free_safe_mem(cipher_chain->key); + cipher_chain->key = NULL; + + if (err != 0) { + tc_cipher_chain_free_keys(chain_start); + return err; + } + + /* Set next input buffer as current output buffer */ + in = out; + } + + tc_cipher_chain_free_keys(chain_start); + + return 0; +} + +int +apply_keyfiles(unsigned char *pass, size_t pass_memsz, const char *keyfiles[], + int nkeyfiles) +{ + int pl, k; + unsigned char *kpool; + unsigned char *kdata; + int kpool_idx; + size_t i, kdata_sz; + uint32_t crc; + + if (pass_memsz < MAX_PASSSZ) { + tc_log(1, "Not enough memory for password manipluation\n"); + return ENOMEM; + } + + pl = strlen((char *)pass); + memset(pass+pl, 0, MAX_PASSSZ-pl); + + if ((kpool = alloc_safe_mem(KPOOL_SZ)) == NULL) { + tc_log(1, "Error allocating memory for keyfile pool\n"); + return ENOMEM; + } + + memset(kpool, 0, KPOOL_SZ); + + for (k = 0; k < nkeyfiles; k++) { +#ifdef DEBUG + printf("Loading keyfile %s into kpool\n", keyfiles[k]); +#endif + kpool_idx = 0; + crc = ~0U; + kdata_sz = MAX_KFILE_SZ; + + if ((kdata = read_to_safe_mem(keyfiles[k], 0, &kdata_sz)) == NULL) { + tc_log(1, "Error reading keyfile %s content\n", + keyfiles[k]); + free_safe_mem(kpool); + return EIO; + } + + for (i = 0; i < kdata_sz; i++) { + crc = crc32_intermediate(crc, kdata[i]); + + kpool[kpool_idx++] += (unsigned char)(crc >> 24); + kpool[kpool_idx++] += (unsigned char)(crc >> 16); + kpool[kpool_idx++] += (unsigned char)(crc >> 8); + kpool[kpool_idx++] += (unsigned char)(crc); + + /* Wrap around */ + if (kpool_idx == KPOOL_SZ) + kpool_idx = 0; + } + + free_safe_mem(kdata); + } + +#ifdef DEBUG + printf("Applying kpool to passphrase\n"); +#endif + /* Apply keyfile pool to passphrase */ + for (i = 0; i < KPOOL_SZ; i++) + pass[i] += kpool[i]; + + free_safe_mem(kpool); + + return 0; +} Added: soc2012/vchan/gtcp/bwalex-tc-play/generic_xts.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vchan/gtcp/bwalex-tc-play/generic_xts.c Mon Jun 18 17:31:44 2012 (r237896) @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2008, Damien Miller + * Copyright (C) 2011, Alex Hornung + * + * Permission to use, copy, and modify this software with or without fee + * is hereby granted, provided that this entire notice is included in + * all copies of any software which is or includes a copy or + * modification of this software. + * You may use this code under the GNU public license if you so wish. Please + * contribute changes back to the authors under this freer than GPL license + * so that we may further the use of strong encryption without limitations to + * all. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE + * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR + * PURPOSE. + */ + +#include +#include +#include +#include +#include + +#include "tcplay.h" +#include "generic_xts.h" + + + +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 17:50: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 178F31065670 for ; Mon, 18 Jun 2012 17:50:28 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 17:50:28 +0000 Date: Mon, 18 Jun 2012 17:50:28 +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: <20120618175028.178F31065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237897 - in soc2012/aleek/beaglexm-armv6/sys: arm/arm 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: Mon, 18 Jun 2012 17:50:30 -0000 Author: aleek Date: Mon Jun 18 17:50:27 2012 New Revision: 237897 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237897 Log: prcm driver is done, need to test Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c Mon Jun 18 17:50:27 2012 (r237897) @@ -1316,7 +1316,7 @@ rv = 1; } -#ifdef DEBUG +#ifdef DEBUGA /* * If 'rv == 0' at this point, it generally indicates that there is a * stale TLB entry for the faulting address. This happens when two or Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Mon Jun 18 17:50:27 2012 (r237897) @@ -58,6 +58,7 @@ options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC +options DEBUG # NFS support #options NFSCL Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c Mon Jun 18 17:50:27 2012 (r237897) @@ -52,12 +52,18 @@ #include #include +#include +#include +#include +#include + +#include +#include + #include #include #include - - static struct omap3_gptimer_softc *g_omap3_gptimer_sc = NULL; static unsigned int delay_loops_per_us = 100; @@ -792,9 +798,17 @@ static int omap3_gptimer_probe(device_t dev) { - printf( "GPTIMER HABABABA\n" ); - device_set_desc(dev, "TI OMAP3 General Purpose Timers"); - return (0); + struct omap3_gptimer_softc *sc; + sc = (struct omap3_gptimer_softc *)device_get_softc(dev); + device_printf(dev, "PROBING...\n"); + printf("gptimer: PROBING...\n"); + + if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer")) { + device_set_desc(dev, "OMAP3 General Purpose Timer"); + return(BUS_PROBE_DEFAULT); + } + + return (ENXIO); } static int Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Mon Jun 18 17:50:27 2012 (r237897) @@ -55,6 +55,7 @@ #include #include + #include @@ -142,18 +143,19 @@ struct omap3_prcm_softc { struct resource *res[2]; - bus_space_tag_t prm_bst, cm_bst; - bus_space_handle_t prm_bsh, cm_bsh; + bus_space_tag_t prm_bst; + bus_space_handle_t prm_bsh; + bus_space_tag_t cm_bst; + bus_space_handle_t cm_bsh; }; static struct resource_spec omap3_prcm_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_MEMORY, 1, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, { -1, 0, 0 } }; + static int omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); @@ -181,7 +183,17 @@ static int omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static const struct ti_clk_details* +omap3_clk_details(clk_ident_t id); +#define prm_read_4(reg) \ + bus_space_read_4(omap3_prcm_sc->prm_bst, omap3_prcm_sc->prm_bsh, reg) +#define prm_write_4(reg, val) \ + bus_space_write_4(omap3_prcm_sc->prm_bst, omap3_prcm_sc->prm_bsh, reg, val) +#define cm_read_4(reg) \ + bus_space_read_4(omap3_prcm_sc->cm_bst, omap3_prcm_sc->cm_bsh, reg) +#define cm_write_4(reg, val) \ + bus_space_write_4(omap3_prcm_sc->cm_bst, omap3_prcm_sc->cm_bsh, reg, val) @@ -433,27 +445,173 @@ omap3_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) { + uint32_t clksel; + uint32_t clknsel; + unsigned int oscclk; + unsigned int sysclk; + + /* Read the input clock freq from the configuration register */ + + clknsel = prm_read_4(CLOCK_CTRL_PRM_OFFSET + 0x40); + //clknsel = bus_read_4(mem_res[PRM_INSTANCE_MEM_REGION], CLOCK_CTRL_PRM_OFFSET + 0x40); + switch (clknsel & 0x7) { + case 0x0: + /* 12Mhz */ + oscclk = 12000000; + break; + case 0x1: + /* 13Mhz */ + oscclk = 13000000; + break; + case 0x2: + /* 19.2Mhz */ + oscclk = 19200000; + break; + case 0x3: + /* 26Mhz */ + oscclk = 26000000; + break; + case 0x4: + /* 38.4Mhz */ + oscclk = 38400000; + break; + case 0x5: + /* 16.8Mhz */ + oscclk = 16800000; + break; + default: + panic("%s: Invalid clock freq", __func__); + } + + /* Read the value of the clock divider used for the system clock */ + clksel = prm_read_4(CLOCK_CTRL_PRM_OFFSET + 0x70); + //clksel = bus_read_4(mem_res[PRM_INSTANCE_MEM_REGION], GLOBAL_PRM_OFFSET + 0x70); + switch (clksel & 0xC0) { + case 0x40: + sysclk = oscclk; + break; + case 0x80: + sysclk = oscclk / 2; + break; + default: + panic("%s: Invalid system clock divider", __func__); + } + + /* Return the value */ + if (freq) + *freq = sysclk; + return (0); } static int omap3_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq) { - + unsigned int sysclk; + unsigned int coreclk; + unsigned int mpuclk; + uint32_t clksel; + uint32_t clkout; + + /* Get the SYSCLK freq */ + omap3_clk_get_sysclk_freq(clkdev, &sysclk); + + /* First get the freq of the CORE_CLK (feed from DPLL3) */ + clksel = cm_read_4(CLOCK_CTRL_CM_OFFSET + 0x40); + clkout = (sysclk * ((clksel >> 16) & 0x7FF)) / (((clksel >> 8) & 0x7F) + 1); + coreclk = clkout / (clksel >> 27); + + + /* Next get the freq for the MPU_CLK */ + clksel = cm_read_4(MPU_CM_OFFSET + 0x40); + mpuclk = (coreclk * ((clksel >> 8) & 0x7FF)) / ((clksel & 0x7F) + 1); + + + /* Return the value */ + if (freq) + *freq = mpuclk; + return (0); } static int omap3_clk_generic_activate(struct ti_clock_dev *clkdev) { + const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); + uint32_t fclken, iclken; + + if (clk_details == NULL) + return (ENXIO); + + + /* All the 'generic' clocks have a FCLKEN, ICLKEN and IDLEST register which + * is for the functional, interface and clock status regsters respectively. + */ + + /* Enable the interface clock */ + //iclken = cm_read_4(clk_details->iclken_offset); + iclken = + bus_space_read_4( + omap3_prcm_sc->cm_bst, + omap3_prcm_sc->cm_bsh, + clk_details->iclken_offset); + iclken |= (1UL << clk_details->bit_offset); + cm_write_4(clk_details->iclken_offset, iclken); + + /* Read back the value to ensure the write has taken place ... needed ? */ + iclken = cm_read_4(clk_details->iclken_offset); + + + /* Enable the functional clock */ + fclken = cm_read_4( clk_details->fclken_offset); + fclken |= (1UL << clk_details->bit_offset); + cm_write_4(clk_details->fclken_offset, fclken); + + /* Read back the value to ensure the write has taken place ... needed ? */ + fclken = cm_read_4(clk_details->fclken_offset); + + + /* Now poll on the IDLEST register to tell us if the module has come up. + * TODO: We need to take into account the parent clocks. + */ + /* Try MAX_MODULE_ENABLE_WAIT number of times to check if enabled */ +// @TODO XXX trzeba to zrobic +#if 0 + if (omap3_clk_wait_on_reg(clk_mem_res, clk_details->idlest_offset, + (1UL << clk_details->bit_offset), 0) != 0) { + printf("Error: failed to enable module with clock %d\n", clkdev->id); + return (ETIMEDOUT); + } +#endif return (0); } static int omap3_clk_generic_deactivate(struct ti_clock_dev *clkdev) { + const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); + uint32_t fclken, iclken; + + if (clk_details == NULL) + return (ENXIO); + + /* All the 'generic' clocks have a FCLKEN, ICLKEN and IDLEST register which + * is for the functional, interface and clock status regsters respectively. + */ + + /* Disable the interface clock */ + iclken = cm_read_4(clk_details->iclken_offset); + iclken &= ~(1UL << clk_details->bit_offset); + cm_write_4(clk_details->iclken_offset, iclken); + + /* Disable the functional clock */ + fclken = cm_read_4(clk_details->fclken_offset); + fclken &= ~(1UL << clk_details->bit_offset); + cm_write_4(clk_details->fclken_offset, fclken); + + return (0); } @@ -467,31 +625,147 @@ static int omap3_clk_generic_accessible(struct ti_clock_dev *clkdev) { + const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); + uint32_t idlest; + + if (clk_details == NULL) + return (ENXIO); - return (0); + idlest = cm_read_4(clk_details->idlest_offset); + + /* Check the enabled state */ + if ((idlest & (1UL << clk_details->bit_offset)) == 0) + return (0); + + return (1); } static int 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); + + if (clk_details == NULL) + return (ENXIO); + /* Simply return the stored frequency */ + if (freq) + *freq = (unsigned int)clk_details->src_freq; + return (0); } static int omap3_clk_gptimer_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc) { + const struct ti_clk_details* clk_details = omap3_clk_details(clkdev->id); + uint32_t bit, regoff; + uint32_t clksel; + + if (clk_details == NULL) + return (ENXIO); + /* Set the source freq by writing the clksel register */ + switch (clkdev->id) { + case GPTIMER1_CLK: + bit = 0; + regoff = WKUP_CM_OFFSET + 0x40; + break; + case GPTIMER2_CLK ... GPTIMER9_CLK: + bit = (clkdev->id - GPTIMER2_CLK); + regoff = PER_CM_OFFSET + 0x40; + break; + case GPTIMER10_CLK ... GPTIMER11_CLK: + bit = 6 + (clkdev->id - GPTIMER10_CLK); + regoff = CORE_CM_OFFSET + 0x40; + break; + default: + return (EINVAL); + } + + /* Set the CLKSEL bit if then the SYS_CLK is the source */ + clksel = cm_read_4(regoff); + + if (clksrc == SYSCLK_CLK) + clksel |= (0x1UL << bit); + else + clksel &= ~(0x1UL << bit); + + cm_write_4(regoff, clksel); + + /* Read back the value to ensure the write has taken place ... needed ? */ + clksrc = cm_read_4(regoff); + return (0); } static int 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); + uint32_t bit, regoff; + uint32_t clksel; + unsigned int src_freq; + + if (clk_details == NULL) + return (ENXIO); + /* Determine the source freq by reading the clksel register */ + switch (clkdev->id) { + case GPTIMER1_CLK: + bit = 0; + regoff = WKUP_CM_OFFSET + 0x40; + break; + case GPTIMER2_CLK ... GPTIMER9_CLK: + bit = (clkdev->id - GPTIMER2_CLK); + regoff = PER_CM_OFFSET + 0x40; + break; + case GPTIMER10_CLK ... GPTIMER11_CLK: + bit = 6 + (clkdev->id - GPTIMER10_CLK); + regoff = CORE_CM_OFFSET + 0x40; + break; + default: + return (EINVAL); + } + + + /* If the CLKSEL bit is set then the SYS_CLK is the source */ + clksel = cm_read_4(regoff); + if (clksel & (0x1UL << bit)) + omap3_clk_get_sysclk_freq(NULL, &src_freq); + else + src_freq = FREQ_32KHZ; + + /* Return the frequency */ + if (freq) + *freq = src_freq; + return (0); } +/** + * omap3_clk_details - returns a pointer to the generic clock details + * @id: The ID of the clock to get the details for + * + * This function iterates over the g_omap3_clk_details array and returns a + * pointer to the entry that matches the supplied ID, or NULL if no entry + * is found. + * + * RETURNS: + * Pointer to clock details or NULL on failure + */ +static const struct ti_clk_details* +omap3_clk_details(clk_ident_t id) +{ + const struct ti_clk_details *walker; + + for (walker = g_omap3_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { + if (id == walker->id) + return (walker); + } + + return NULL; +} Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Mon Jun 18 17:50:27 2012 (r237897) @@ -91,7 +91,6 @@ #include #include -#define DEBUG #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) #else Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 17:31:44 2012 (r237896) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Jun 18 17:50:27 2012 (r237897) @@ -106,7 +106,7 @@ 0x49040000 0x1000 0x48086000 0x1000 0x48088000 0x1000 >; - interrupts = < 37 38 39 40 41 42 43 44 45 46 47 >; + interrupts = < 37 38 39 40 41 42 43 >; interrupt-parent = <&AINTC>; }; From owner-svn-soc-all@FreeBSD.ORG Mon Jun 18 23:49: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 9E0FD106564A for ; Mon, 18 Jun 2012 23:49:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 18 Jun 2012 23:49:42 +0000 Date: Mon, 18 Jun 2012 23:49: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: <20120618234942.9E0FD106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237914 - 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: Mon, 18 Jun 2012 23:49:44 -0000 Author: jhagewood Date: Mon Jun 18 23:49:41 2012 New Revision: 237914 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237914 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 18 22:17:28 2012 (r237913) +++ soc2012/jhagewood/diff/TODO Mon Jun 18 23:49:41 2012 (r237914) @@ -1,8 +1,7 @@ TASK STATUS NOTE --unified GNU compatibility COMPLETE Fixed timestamp. ---context GNU compatibility COMPLETE Fixed timestamp, will test more. ---ingnore-blank-lines INCOMPLETE +--context GNU compatibility COMPLETE Fixed timestamp, will test more. --left-column INCOMPLETE --show-function-line INCOMPLETE --unidirectional-new-file INCOMPLETE Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Mon Jun 18 22:17:28 2012 (r237913) +++ soc2012/jhagewood/diff/diff/diff.c Mon Jun 18 23:49:41 2012 (r237914) @@ -90,7 +90,6 @@ { "left-column", no_argument, NULL, OPT_LEFTC }, { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, - { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, { "from-file", required_argument, NULL, OPT_FFILE }, { "to-file", required_argument, NULL, OPT_TOFILE }, Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 22:17:28 2012 (r237913) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 23:49:41 2012 (r237914) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-18 23:44:16.000000000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -31,7 +31,7 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,14 +83,15 @@ enum +@@ -84,14 +83,14 @@ enum static struct option longopts[] = { @@ -45,13 +45,12 @@ { "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 }, -@@ -109,8 +109,7 @@ static struct option longopts[] = { +@@ -109,8 +108,7 @@ static struct option longopts[] = { { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, @@ -61,7 +60,7 @@ { "ed", no_argument, NULL, 'e' }, /* XXX: UNIMPLEMENTED { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +128,6 @@ static struct option longopts[] = { +@@ -129,7 +127,6 @@ static struct option longopts[] = { { "report-identical-files", no_argument, NULL, 's' }, { "initial-tab", no_argument, NULL, 'T' }, { "expand-tabs", no_argument, NULL, 't' }, @@ -69,7 +68,7 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -197,6 +195,7 @@ main(int argc, char **argv) +@@ -197,6 +194,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -77,7 +76,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +212,9 @@ main(int argc, char **argv) +@@ -213,6 +211,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -87,7 +86,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +298,13 @@ main(int argc, char **argv) +@@ -296,6 +297,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -101,7 +100,7 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +557,7 @@ print_status(int val, char *path1, char +@@ -548,7 +556,7 @@ print_status(int val, char *path1, char path1, entry ? entry : "", path2, entry ? entry : ""); break; case D_BINARY: From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 00: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 6C3DA106566B for ; Tue, 19 Jun 2012 00:24:04 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 00:24:04 +0000 Date: Tue, 19 Jun 2012 00:24: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: <20120619002404.6C3DA106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237916 - 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: Tue, 19 Jun 2012 00:24:06 -0000 Author: jhagewood Date: Tue Jun 19 00:24:03 2012 New Revision: 237916 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237916 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 18 23:18:49 2012 (r237915) +++ soc2012/jhagewood/diff/TODO Tue Jun 19 00:24:03 2012 (r237916) @@ -20,3 +20,4 @@ Notes: - When using large files as input, diff will only output "Files [file1] and [file2] differ." +- Needs function prototypes. (COMPLETE) Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Mon Jun 18 23:18:49 2012 (r237915) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 00:24:03 2012 (r237916) @@ -148,13 +148,17 @@ }; char **help_strs = (char **)help_msg; +static void * emalloc(size_t); +static int easprintf(char **, const char *, ...); +static void * erealloc(void *, size_t); +static char * estrdup(const char *); +static void print_only(const char *, size_t, const char *); +static void print_status(int, char *, char *, char *); +static void push_excludes(char *); +static void push_ignore_pats(char *); +static void read_excludes_file(char *); void set_argstr(char **, char **); - - -void usage(void); -void push_excludes(char *); -void push_ignore_pats(char *); -void read_excludes_file(char *); +static void usage(void); int main(int argc, char **argv) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 18 23:18:49 2012 (r237915) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 00:24:03 2012 (r237916) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-18 23:44:16.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-19 00:22:21.000000000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -68,7 +68,31 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -197,6 +194,7 @@ main(int argc, char **argv) +@@ -151,13 +148,17 @@ NULL, + }; + char **help_strs = (char **)help_msg; + ++static void * emalloc(size_t); ++static int easprintf(char **, const char *, ...); ++static void * erealloc(void *, size_t); ++static char * estrdup(const char *); ++static void print_only(const char *, size_t, const char *); ++static void print_status(int, char *, char *, char *); ++static void push_excludes(char *); ++static void push_ignore_pats(char *); ++static void read_excludes_file(char *); + void set_argstr(char **, char **); +- +- +-void usage(void); +-void push_excludes(char *); +-void push_ignore_pats(char *); +-void read_excludes_file(char *); ++static void usage(void); + + int + main(int argc, char **argv) +@@ -197,6 +198,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -76,7 +100,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +211,9 @@ main(int argc, char **argv) +@@ -213,6 +215,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -86,7 +110,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +297,13 @@ main(int argc, char **argv) +@@ -296,6 +301,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -100,7 +124,7 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +556,7 @@ print_status(int val, char *path1, char +@@ -548,7 +560,7 @@ print_status(int val, char *path1, char path1, entry ? entry : "", path2, entry ? entry : ""); break; case D_BINARY: From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 00:38: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 015AB1065672 for ; Tue, 19 Jun 2012 00:38:30 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 00:38:29 +0000 Date: Tue, 19 Jun 2012 00:38:29 +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: <20120619003830.015AB1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r237917 - 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: Tue, 19 Jun 2012 00:38:32 -0000 Author: jhagewood Date: Tue Jun 19 00:38:29 2012 New Revision: 237917 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237917 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Tue Jun 19 00:24:03 2012 (r237916) +++ soc2012/jhagewood/diff/TODO Tue Jun 19 00:38:29 2012 (r237917) @@ -20,4 +20,3 @@ Notes: - When using large files as input, diff will only output "Files [file1] and [file2] differ." -- Needs function prototypes. (COMPLETE) Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 00:24:03 2012 (r237916) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 00:38:29 2012 (r237917) @@ -148,17 +148,13 @@ }; char **help_strs = (char **)help_msg; -static void * emalloc(size_t); -static int easprintf(char **, const char *, ...); -static void * erealloc(void *, size_t); -static char * estrdup(const char *); -static void print_only(const char *, size_t, const char *); -static void print_status(int, char *, char *, char *); -static void push_excludes(char *); -static void push_ignore_pats(char *); -static void read_excludes_file(char *); void set_argstr(char **, char **); -static void usage(void); + + +void usage(void); +void push_excludes(char *); +void push_ignore_pats(char *); +void read_excludes_file(char *); int main(int argc, char **argv) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 00:24:03 2012 (r237916) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 00:38:29 2012 (r237917) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 00:22:21.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-19 00:37:42.000000000 -0400 @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -68,31 +68,7 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -151,13 +148,17 @@ NULL, - }; - char **help_strs = (char **)help_msg; - -+static void * emalloc(size_t); -+static int easprintf(char **, const char *, ...); -+static void * erealloc(void *, size_t); -+static char * estrdup(const char *); -+static void print_only(const char *, size_t, const char *); -+static void print_status(int, char *, char *, char *); -+static void push_excludes(char *); -+static void push_ignore_pats(char *); -+static void read_excludes_file(char *); - void set_argstr(char **, char **); -- -- --void usage(void); --void push_excludes(char *); --void push_ignore_pats(char *); --void read_excludes_file(char *); -+static void usage(void); - - int - main(int argc, char **argv) -@@ -197,6 +198,7 @@ main(int argc, char **argv) +@@ -197,6 +194,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -100,7 +76,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +215,9 @@ main(int argc, char **argv) +@@ -213,6 +211,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -110,7 +86,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +301,13 @@ main(int argc, char **argv) +@@ -296,6 +297,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -124,7 +100,7 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +560,7 @@ print_status(int val, char *path1, char +@@ -548,7 +556,7 @@ print_status(int val, char *path1, char path1, entry ? entry : "", path2, entry ? entry : ""); break; case D_BINARY: From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 03:09: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 DAA9A106566B for ; Tue, 19 Jun 2012 03:09:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 03:09:42 +0000 Date: Tue, 19 Jun 2012 03: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: <20120619030942.DAA9A106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237920 - 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: Tue, 19 Jun 2012 03:09:44 -0000 Author: jhagewood Date: Tue Jun 19 03:09:41 2012 New Revision: 237920 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237920 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 02:54:54 2012 (r237919) +++ soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 03:09:41 2012 (r237920) @@ -359,7 +359,6 @@ status |= 2; goto closem; } - switch (files_differ(f1, f2, flags)) { case 0: goto closem; @@ -754,14 +753,12 @@ static void check(char *file1, FILE *f1, char *file2, FILE *f2) { - int i, j, jackpot, c, d, spacetab; + int i, j, jackpot, c, d; long ctold, ctnew; - fpos_t position; rewind(f1); rewind(f2); j = 1; - spacetab = 1; ixold[0] = ixnew[0] = 0; jackpot = 0; ctold = ctnew = 0; @@ -829,33 +826,24 @@ } break; /* ignore-tab-expansion */ - } /*else if (Eflag) { - if (c == '\t' && d == ' ') { - fgetpos(f2, &position); - for (j = 1; j <= 7; j++) { - d = getc(f2); - if (d != " ") - spacetab = 0; - } - fsetpos(f2, &position); - if (spacetab) { - - } + } else if (Eflag) { + if (isspace(c) && isspace(d)) { + if (d == '\t') { + do { + if (c != ' ') + break; + ctold++; + } while (isspace(c = getc(f1))); } - if (d == '\t' && c == ' ') { - fgetpos(f1, &position); - for (j = 1; j <= 7; j++) { - c = getc(f2); - if (c != " ") - spacetab = 0; - } - fsetpos(f1, &position); - if (spacetab) { - - } + } + if (c == '\t') { + do { + if (d != ' ') + break; + ctnew++; + } while (isspace(d = getc(f2))); } - break; - } */ + } if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 02:54:54 2012 (r237919) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 03:09:41 2012 (r237920) @@ -123,7 +123,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-19 03:08:39.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -137,24 +137,26 @@ /* * diff - compare two files. */ -@@ -748,12 +754,14 @@ unravel(int p) +@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int + status |= 2; + goto closem; + } +- + switch (files_differ(f1, f2, flags)) { + case 0: + goto closem; +@@ -748,8 +753,8 @@ unravel(int p) static void check(char *file1, FILE *f1, char *file2, FILE *f2) { - int i, j, jackpot, c, d; - long ctold, ctnew; -+ int i, j, jackpot, c, d, spacetab; ++ int i, j, jackpot, c, d; + long ctold, ctnew; -+ fpos_t position; rewind(f1); rewind(f2); - j = 1; -+ spacetab = 1; - ixold[0] = ixnew[0] = 0; - jackpot = 0; - ctold = ctnew = 0; -@@ -766,7 +774,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -163,7 +165,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -803,29 +811,51 @@ check(char *file1, FILE *f1, char *file2 +@@ -803,29 +808,42 @@ check(char *file1, FILE *f1, char *file2 } } else if (Bflag) { @@ -191,39 +193,29 @@ } - break; -- } + /* ignore-tab-expansion */ -+ } /*else if (Eflag) { -+ if (c == '\t' && d == ' ') { -+ fgetpos(f2, &position); -+ for (j = 1; j <= 7; j++) { -+ d = getc(f2); -+ if (d != " ") -+ spacetab = 0; -+ } -+ fsetpos(f2, &position); -+ if (spacetab) { -+ -+ } ++ } else if (Eflag) { ++ if (isspace(c) && isspace(d)) { ++ if (d == '\t') { ++ do { ++ if (c != ' ') ++ break; ++ ctold++; ++ } while (isspace(c = getc(f1))); + } -+ if (d == '\t' && c == ' ') { -+ fgetpos(f1, &position); -+ for (j = 1; j <= 7; j++) { -+ c = getc(f2); -+ if (c != " ") -+ spacetab = 0; -+ } -+ fsetpos(f1, &position); -+ if (spacetab) { -+ -+ } + } ++ if (c == '\t') { ++ do { ++ if (d != ' ') ++ break; ++ ctnew++; ++ } while (isspace(d = getc(f2))); + } -+ break; -+ } */ ++ } if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -1551,16 +1581,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1569,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 Tue Jun 19 03:47: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 6EB88106566B for ; Tue, 19 Jun 2012 03:47:26 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 03:47:26 +0000 Date: Tue, 19 Jun 2012 03:47:26 +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: <20120619034726.6EB88106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237921 - 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: Tue, 19 Jun 2012 03:47:28 -0000 Author: jhagewood Date: Tue Jun 19 03:47:25 2012 New Revision: 237921 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237921 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 03:09:41 2012 (r237920) +++ soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 03:47:25 2012 (r237921) @@ -786,6 +786,7 @@ } ctold++; ctnew++; + /* ignore-space-change */ if (bflag && isspace(c) && isspace(d)) { do { if (c == '\n') @@ -797,6 +798,7 @@ break; ctnew++; } while (isspace(d = getc(f2))); + /* ignore-all-space */ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); @@ -806,7 +808,7 @@ d = getc(f2); ctnew++; } - + /* ignore-blank-lines */ } else if (Bflag) { if (c == '\n' && d != '\n') { do { @@ -827,21 +829,19 @@ break; /* ignore-tab-expansion */ } else if (Eflag) { - if (isspace(c) && isspace(d)) { - if (d == '\t') { - do { - if (c != ' ') - break; - ctold++; - } while (isspace(c = getc(f1))); - } - } - if (c == '\t') { - do { - if (d != ' ') - break; - ctnew++; - } while (isspace(d = getc(f2))); + if (isspace(c) && isspace(d)) { + if (d == '\t') { + while (c == ' ') { + c = getc(f1); + ctold++; + } + } + if (c == '\t') { + while (d == ' ') { + d = getc(f2); + ctnew++; + } + } } } if (chrtran[c] != chrtran[d]) { Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 03:09:41 2012 (r237920) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 03:47:25 2012 (r237921) @@ -123,7 +123,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-19 03:08:39.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-19 03:46:25.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -165,9 +165,28 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -803,29 +808,42 @@ check(char *file1, FILE *f1, char *file2 +@@ -781,6 +786,7 @@ check(char *file1, FILE *f1, char *file2 + } + ctold++; + ctnew++; ++ /* ignore-space-change */ + if (bflag && isspace(c) && isspace(d)) { + do { + if (c == '\n') +@@ -792,6 +798,7 @@ check(char *file1, FILE *f1, char *file2 + break; + ctnew++; + } while (isspace(d = getc(f2))); ++ /* ignore-all-space */ + } else if (wflag) { + while (isspace(c) && c != '\n') { + c = getc(f1); +@@ -801,31 +808,42 @@ check(char *file1, FILE *f1, char *file2 + d = getc(f2); + ctnew++; } - +- ++ /* ignore-blank-lines */ } else if (Bflag) { - if( c == '\n' && d != '\n') { - @@ -193,23 +212,22 @@ } - break; +- } + /* ignore-tab-expansion */ + } else if (Eflag) { -+ if (isspace(c) && isspace(d)) { -+ if (d == '\t') { -+ do { -+ if (c != ' ') -+ break; -+ ctold++; -+ } while (isspace(c = getc(f1))); -+ } - } -+ if (c == '\t') { -+ do { -+ if (d != ' ') -+ break; -+ ctnew++; -+ } while (isspace(d = getc(f2))); ++ if (isspace(c) && isspace(d)) { ++ if (d == '\t') { ++ while (c == ' ') { ++ c = getc(f1); ++ ctold++; ++ } ++ } ++ if (c == '\t') { ++ while (d == ' ') { ++ d = getc(f2); ++ ctnew++; ++ } ++ } + } + } if (chrtran[c] != chrtran[d]) { From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 04:44: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 E2B94106564A for ; Tue, 19 Jun 2012 04:44:24 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 04:44:24 +0000 Date: Tue, 19 Jun 2012 04:44: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: <20120619044424.E2B94106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237922 - 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: Tue, 19 Jun 2012 04:44:27 -0000 Author: jhagewood Date: Tue Jun 19 04:44:24 2012 New Revision: 237922 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237922 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 Tue Jun 19 03:47:25 2012 (r237921) +++ soc2012/jhagewood/diff/TODO Tue Jun 19 04:44:24 2012 (r237922) @@ -2,6 +2,7 @@ --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 INCOMPLETE --show-function-line INCOMPLETE --unidirectional-new-file INCOMPLETE @@ -14,9 +15,10 @@ --to-file INCOMPLETE --horizontal-lines INCOMPLETE --speed-large-file INCOMPLETE ---ignore-tab-expansion IN PROGRESS +--ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE Notes: - When using large files as input, diff will only output "Files [file1] and [file2] differ." +- With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 03:47:25 2012 (r237921) +++ soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 04:44:24 2012 (r237922) @@ -753,9 +753,10 @@ static void check(char *file1, FILE *f1, char *file2, FILE *f2) { - int i, j, jackpot, c, d; + int i, j, jackpot, c, d, int spacecount; long ctold, ctnew; - + fpos_t position; + rewind(f1); rewind(f2); j = 1; @@ -830,14 +831,36 @@ /* ignore-tab-expansion */ } else if (Eflag) { if (isspace(c) && isspace(d)) { - if (d == '\t') { - while (c == ' ') { + if (d == '\t' && c == ' ') { + /* + * Checks if file1 has 8 consecutive spaces, which is + * equal to 1 tab. + */ + getpos(f1, &position); + for (spacecount = 1; spacecount <= 8; spacecount++) { + c = getc(f1); + if (c != ' ') + break; + } + setpos(f1, &position); + while (c == ' ' && spacecount == 9) { c = getc(f1); ctold++; } } - if (c == '\t') { - while (d == ' ') { + if (c == '\t' && d == ' ') { + /* + * Checks if file2 has 8 consecutive spaces, which is + * equal to 1 tab. + */ + getpos(f2, &position); + for (spacecount = 1; spacecount <= 8; spacecount++) { + d = getc(f2); + if (d != ' ') + break; + } + setpos(f2, &position); + while (d == ' ' && spacecount == 9) { d = getc(f2); ctnew++; } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 03:47:25 2012 (r237921) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:44:24 2012 (r237922) @@ -123,7 +123,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-19 03:46:25.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-19 04:44:02.000000000 -0400 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -145,18 +145,21 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -748,8 +753,8 @@ unravel(int p) +@@ -748,9 +753,10 @@ unravel(int p) static void check(char *file1, FILE *f1, char *file2, FILE *f2) { - int i, j, jackpot, c, d; - long ctold, ctnew; -+ int i, j, jackpot, c, d; +- ++ int i, j, jackpot, c, d, int spacecount; + long ctold, ctnew; - ++ fpos_t position; ++ rewind(f1); rewind(f2); -@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2 + j = 1; +@@ -766,7 +772,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -165,7 +168,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -781,6 +786,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -781,6 +787,7 @@ check(char *file1, FILE *f1, char *file2 } ctold++; ctnew++; @@ -173,7 +176,7 @@ if (bflag && isspace(c) && isspace(d)) { do { if (c == '\n') -@@ -792,6 +798,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -792,6 +799,7 @@ check(char *file1, FILE *f1, char *file2 break; ctnew++; } while (isspace(d = getc(f2))); @@ -181,7 +184,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +808,42 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +809,64 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -216,14 +219,36 @@ + /* ignore-tab-expansion */ + } else if (Eflag) { + if (isspace(c) && isspace(d)) { -+ if (d == '\t') { -+ while (c == ' ') { ++ if (d == '\t' && c == ' ') { ++ /* ++ * Checks if file1 has 8 consecutive spaces, which is ++ * equal to 1 tab. ++ */ ++ getpos(f1, &position); ++ for (spacecount = 1; spacecount <= 8; spacecount++) { ++ c = getc(f1); ++ if (c != ' ') ++ break; ++ } ++ setpos(f1, &position); ++ while (c == ' ' && spacecount == 9) { + c = getc(f1); + ctold++; + } + } -+ if (c == '\t') { -+ while (d == ' ') { ++ if (c == '\t' && d == ' ') { ++ /* ++ * Checks if file2 has 8 consecutive spaces, which is ++ * equal to 1 tab. ++ */ ++ getpos(f2, &position); ++ for (spacecount = 1; spacecount <= 8; spacecount++) { ++ d = getc(f2); ++ if (d != ' ') ++ break; ++ } ++ setpos(f2, &position); ++ while (d == ' ' && spacecount == 9) { + d = getc(f2); + ctnew++; + } @@ -233,7 +258,7 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -1551,16 +1569,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 Tue Jun 19 04: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 7910D106566B for ; Tue, 19 Jun 2012 04:59:54 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 04:59:54 +0000 Date: Tue, 19 Jun 2012 04:59:54 +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: <20120619045954.7910D106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237923 - 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: Tue, 19 Jun 2012 04:59:56 -0000 Author: jhagewood Date: Tue Jun 19 04:59:53 2012 New Revision: 237923 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237923 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 04:44:24 2012 (r237922) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 04:59:53 2012 (r237923) @@ -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 @@ -159,10 +157,10 @@ int main(int argc, char **argv) { - char *ep, **oargv; - long l; - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; + char *ep, **oargv; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; oargv = argv; oargc = argc; @@ -410,7 +408,7 @@ void * emalloc(size_t n) { - void *p; + void *p; if (n == 0) errx(2, NULL); @@ -423,7 +421,7 @@ void * erealloc(void *p, size_t n) { - void *q; + void *q; if (n == 0) errx(2, NULL); @@ -439,8 +437,8 @@ 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); @@ -454,8 +452,8 @@ char * estrdup(const char *str) { - size_t len; - char *cp; + size_t len; + char *cp; len = strlen(str) + 1; cp = emalloc(len); @@ -547,52 +545,54 @@ 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 : ""); - break; - case D_BINARY: - printf("Files %s%s and %s%s differ\n", - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: - if (format == D_BRIEF) + 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 : ""); + break; + case D_BINARY: printf("Files %s%s and %s%s differ\n", - 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 : ""); - 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 : ""); - 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 : ""); - break; - case D_SKIPPED1: - printf("File %s%s is not a regular file or directory and was skipped\n", - 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 : ""); - break; + 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 : ""); + break; + case D_SAME: + if (sflag) + printf("Files %s%s and %s%s are identical\n", + 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 : ""); + 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 : ""); + break; + case D_SKIPPED1: + printf("File %s%s is not a regular file or directory and was skipped\n", + 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 : ""); + break; } } void usage(void) { + (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:44:24 2012 (r237922) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:59:53 2012 (r237923) @@ -1,7 +1,27 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 00:37:42.000000000 -0400 -@@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); ++++ jhagewood/diff/diff/diff.c 2012-06-19 04:59:23.000000000 -0400 +@@ -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,10 +43,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -14,7 +34,7 @@ char ignore_file_case = 0; int format, context, status; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -@@ -58,7 +58,7 @@ regex_t ignore_re; +@@ -58,7 +56,7 @@ regex_t ignore_re; int flag_opts = 0; @@ -23,7 +43,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -74,7 +74,6 @@ enum +@@ -74,7 +72,6 @@ enum OPT_LF, OPT_LLF, OPT_TSIZE, @@ -31,7 +51,7 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,14 +83,14 @@ enum +@@ -84,14 +81,14 @@ enum static struct option longopts[] = { @@ -50,7 +70,7 @@ { "from-file", required_argument, NULL, OPT_FFILE }, { "to-file", required_argument, NULL, OPT_TOFILE }, { "horizon-lines", required_argument, NULL, OPT_HLINES }, -@@ -109,8 +108,7 @@ static struct option longopts[] = { +@@ -109,8 +106,7 @@ static struct option longopts[] = { { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, @@ -60,7 +80,7 @@ { "ed", no_argument, NULL, 'e' }, /* XXX: UNIMPLEMENTED { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +127,6 @@ static struct option longopts[] = { +@@ -129,7 +125,6 @@ static struct option longopts[] = { { "report-identical-files", no_argument, NULL, 's' }, { "initial-tab", no_argument, NULL, 'T' }, { "expand-tabs", no_argument, NULL, 't' }, @@ -68,7 +88,22 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -197,6 +194,7 @@ main(int argc, char **argv) +@@ -162,10 +157,10 @@ 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; ++ long l; ++ int ch, lastch, gotstdin, prevoptind, newarg; ++ int oargc; + + oargv = argv; + oargc = argc; +@@ -197,6 +192,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -76,7 +111,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +211,9 @@ main(int argc, char **argv) +@@ -213,6 +209,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -86,7 +121,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +297,13 @@ main(int argc, char **argv) +@@ -296,6 +295,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -100,15 +135,139 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +556,7 @@ print_status(int val, char *path1, char - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_BINARY: +@@ -402,7 +408,7 @@ main(int argc, char **argv) + void * + emalloc(size_t n) + { +- void *p; ++ void *p; + + if (n == 0) + errx(2, NULL); +@@ -415,7 +421,7 @@ emalloc(size_t n) + void * + erealloc(void *p, size_t n) + { +- void *q; ++ void *q; + + if (n == 0) + errx(2, NULL); +@@ -431,8 +437,8 @@ 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); +@@ -446,8 +452,8 @@ 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); +@@ -539,52 +545,54 @@ 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 : ""); +- break; +- case D_BINARY: - printf("Binary files %s%s and %s%s differ\n", -+ printf("Files %s%s and %s%s differ\n", - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: +- path1, entry ? entry : "", path2, entry ? entry : ""); +- break; +- case D_DIFFER: +- if (format == D_BRIEF) ++ 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 : ""); ++ break; ++ case D_BINARY: + printf("Files %s%s and %s%s differ\n", +- 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 : ""); +- 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 : ""); +- 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 : ""); +- break; +- case D_SKIPPED1: +- printf("File %s%s is not a regular file or directory and was skipped\n", +- 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 : ""); +- break; ++ 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 : ""); ++ break; ++ case D_SAME: ++ if (sflag) ++ printf("Files %s%s and %s%s are identical\n", ++ 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 : ""); ++ 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 : ""); ++ break; ++ case D_SKIPPED1: ++ printf("File %s%s is not a regular file or directory and was skipped\n", ++ 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 : ""); ++ break; + } + } + + 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/diff.h jhagewood/diff/diff/diff.h --- jhagewood/diff/diff-orig/diff.h 2012-06-18 03:07:38.000000000 -0400 +++ jhagewood/diff/diff/diff.h 2012-06-18 03:07:38.000000000 -0400 From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 05:19:12 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 4A96D106566C for ; Tue, 19 Jun 2012 05:19:10 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 05:19:10 +0000 Date: Tue, 19 Jun 2012 05:19:10 +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: <20120619051910.4A96D106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237924 - 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: Tue, 19 Jun 2012 05:19:12 -0000 Author: jhagewood Date: Tue Jun 19 05:19:09 2012 New Revision: 237924 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237924 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 04:59:53 2012 (r237923) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 05:19:09 2012 (r237924) @@ -412,7 +412,6 @@ if (n == 0) errx(2, NULL); - if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); @@ -443,7 +442,6 @@ va_start(ap, fmt); len = vasprintf(ret, fmt, ap); va_end(ap); - if (len < 0 || *ret == NULL) errx(2, NULL); return (len); @@ -457,6 +455,7 @@ len = strlen(str) + 1; cp = emalloc(len); + strlcpy(cp, str, len); return (cp); } @@ -537,6 +536,7 @@ 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); @@ -547,45 +547,45 @@ { 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 : ""); - break; - case D_BINARY: + 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 : ""); + break; + case D_BINARY: + 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 : ""); - break; - case D_DIFFER: - if (format == D_BRIEF) - printf("Files %s%s and %s%s differ\n", - 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 : ""); - 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 : ""); - 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 : ""); - break; - case D_SKIPPED1: - printf("File %s%s is not a regular file or directory and was skipped\n", - path1, entry ? entry : ""); - break; - case D_SKIPPED2: - printf("File %s%s is not a regular file or directory and was skipped\n", + 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 : ""); - break; + 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 : ""); + 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 : ""); + break; + case D_SKIPPED1: + printf("File %s%s is not a regular file or directory and was skipped\n", + 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 : ""); + break; } } Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 04:59:53 2012 (r237923) +++ soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 05:19:09 2012 (r237924) @@ -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 @@ -300,13 +298,13 @@ 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; @@ -482,8 +480,8 @@ 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)) @@ -508,9 +506,9 @@ 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; @@ -546,7 +544,7 @@ char * splice(char *dir, char *file) { - char *tail, *buf; + char *tail, *buf; if ((tail = strrchr(file, '/')) == NULL) tail = file; @@ -560,8 +558,8 @@ prepare(int i, FILE *fd, off_t filesize) { struct line *p; - int j, h; - size_t sz; + int j, h; + size_t sz; rewind(fd); @@ -584,7 +582,7 @@ static void prune(void) { - int i, j; + int i, j; for (pref = 0; pref < len[0] && pref < len[1] && file[0][pref + 1].value == file[1][pref + 1].value; @@ -605,7 +603,7 @@ static void equiv(struct line *a, int n, struct line *b, int m, int *c) { - int i, j; + int i, j; i = j = 1; while (i <= n && j <= m) { @@ -634,7 +632,7 @@ static int isqrt(int n) { - int y, x = 1; + int y, x = 1; if (n == 0) return (0); @@ -652,9 +650,9 @@ static int stone(int *a, int n, int *b, int *c) { - int i, k, y, j, l; - int oldc, tc, oldl; - u_int numtries; + int i, k, y, j, l; + int oldc, tc, oldl; + u_int numtries; const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n)); k = 0; @@ -710,7 +708,7 @@ static int search(int *c, int k, int y) { - int i, j, l, t; + int i, j, l, t; if (clist[c[k]].y < y) /* quick look for typical case */ return (k + 1); @@ -735,7 +733,7 @@ unravel(int p) { struct cand *q; - int i; + int i; for (i = 0; i <= len[0]; i++) J[i] = i <= pref ? i : @@ -913,7 +911,7 @@ sort(struct line *a, int n) { struct line *ai, *aim, w; - int j, m = 0, k; + int j, m = 0, k; if (n == 0) return; @@ -957,7 +955,7 @@ static int skipline(FILE *f) { - int i, c; + int i, c; for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; @@ -967,7 +965,7 @@ static void output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) { - int m, i0, i1, j0, j1; + int m, i0, i1, j0, j1; rewind(f1); rewind(f2); @@ -1021,6 +1019,7 @@ static void range(int a, int b, char *separator) { + printf("%d", a > b ? b : a); if (a < b) printf("%s%d", separator, b); @@ -1029,6 +1028,7 @@ static void uni_range(int a, int b) { + if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) @@ -1040,8 +1040,8 @@ static char * preadline(int fd, size_t len, off_t off) { - char *line; - ssize_t nr; + char *line; + ssize_t nr; line = emalloc(len + 1); if ((nr = pread(fd, line, len, off)) < 0) @@ -1055,7 +1055,7 @@ static int ignoreline(char *line) { - int ret; + int ret; ret = regexec(&ignore_re, line, 0, NULL, 0); free(line); @@ -1073,8 +1073,8 @@ change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, int *pflags) { - static size_t max_context = 64; - int i; + static size_t max_context = 64; + int i; restart: if (format != D_IFDEF && a > b && c > d) @@ -1206,8 +1206,8 @@ static int fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { - int i, j, c, lastc, col, nc; - int newcol; + int i, j, c, lastc, col, nc; + int newcol; /* * When doing #ifdef's, copy down to current line @@ -1287,8 +1287,8 @@ static int readhash(FILE *f) { - int i, t, space; - int sum; + int i, t, space; + int sum; sum = 1; space = 0; @@ -1349,12 +1349,11 @@ static int asciifile(FILE *f) { - char buf[BUFSIZ]; - int i, cnt; + char buf[BUFSIZ]; + int i, cnt; if (aflag || f == NULL) return (1); - rewind(f); cnt = fread(buf, 1, sizeof(buf), f); for (i = 0; i < cnt; i++) @@ -1368,10 +1367,10 @@ static char * match_function(const long *f, int pos, FILE *file) { - char buf[FUNCTION_CONTEXT_SIZE]; - size_t nc; - int last = lastline; - char *state = NULL; + char buf[FUNCTION_CONTEXT_SIZE]; + size_t nc; + int last = lastline; + char *state = NULL; lastline = pos; while (pos > last) { @@ -1383,7 +1382,6 @@ if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; - if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) @@ -1414,9 +1412,9 @@ dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; - int lowa, upb, lowc, upd, do_output; - int a, b, c, d; - char ch, *f; + int lowa, upb, lowc, upd, do_output; + int a, b, c, d; + char ch, *f; if (context_vec_start > context_vec_ptr) return; @@ -1519,9 +1517,9 @@ dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; - int lowa, upb, lowc, upd; - int a, b, c, d; - char ch, *f; + int lowa, upb, lowc, upd; + int a, b, c, d; + char ch, *f; if (context_vec_start > context_vec_ptr) return; @@ -1592,7 +1590,7 @@ static void print_header(const char *file1, const char *file2) { - const char *time_format; + const char *time_format; char buf1[256]; char buf2[256]; char end1[10]; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:59:53 2012 (r237923) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 05:19:09 2012 (r237924) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 04:59:23.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-19 05:12:45.000000000 -0400 @@ -18,15 +18,13 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ @@ -135,7 +135,7 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -402,7 +408,7 @@ main(int argc, char **argv) +@@ -402,11 +408,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -144,7 +144,11 @@ if (n == 0) errx(2, NULL); -@@ -415,7 +421,7 @@ emalloc(size_t n) +- + if ((p = malloc(n)) == NULL) + errx(2, NULL); + return (p); +@@ -415,7 +420,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -153,7 +157,7 @@ if (n == 0) errx(2, NULL); -@@ -431,8 +437,8 @@ erealloc(void *p, size_t n) +@@ -431,13 +436,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -164,7 +168,12 @@ va_start(ap, fmt); len = vasprintf(ret, fmt, ap); -@@ -446,8 +452,8 @@ easprintf(char **ret, const char *fmt, . + va_end(ap); +- + if (len < 0 || *ret == NULL) + errx(2, NULL); + return (len); +@@ -446,11 +450,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -175,92 +184,77 @@ len = strlen(str) + 1; cp = emalloc(len); -@@ -539,52 +545,54 @@ print_only(const char *path, size_t dirl ++ + strlcpy(cp, str, len); + return (cp); + } +@@ -531,6 +536,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 +545,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", + 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 : ""); -- break; -- case D_BINARY: ++ 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 : ""); -- break; -- case D_DIFFER: -- if (format == D_BRIEF) -+ 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 : ""); -+ break; -+ case D_BINARY: ++ 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 : ""); -- break; -- case D_SAME: -- if (sflag) -- printf("Files %s%s and %s%s are identical\n", ++ 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 : ""); -- 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 : ""); + 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 : ""); -- 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 : ""); + 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 : ""); -- break; -- case D_SKIPPED1: -- printf("File %s%s is not a regular file or directory and was skipped\n", ++ 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 : ""); -- break; -- case D_SKIPPED2: -- printf("File %s%s is not a regular file or directory and was skipped\n", ++ 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 : ""); -- break; -+ 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 : ""); -+ break; -+ case D_SAME: -+ if (sflag) -+ printf("Files %s%s and %s%s are identical\n", -+ 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 : ""); -+ 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 : ""); -+ break; -+ case D_SKIPPED1: -+ printf("File %s%s is not a regular file or directory and was skipped\n", -+ 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 : ""); -+ break; ++ path2, entry ? entry : ""); + break; } } - +@@ -585,6 +592,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -282,8 +276,28 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-19 04:44:02.000000000 -0400 -@@ -90,6 +90,12 @@ __FBSDID("$FreeBSD"); ++++ jhagewood/diff/diff/diffreg.c 2012-06-19 05:18:57.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,12 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -296,7 +310,28 @@ /* * diff - compare two files. */ -@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -294,13 +298,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 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -304,7 +339,109 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -748,9 +753,10 @@ unravel(int p) +@@ -477,8 +480,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 +506,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 +544,7 @@ opentemp(const char *file) + char * + splice(char *dir, char *file) + { +- char *tail, *buf; ++ char *tail, *buf; + + if ((tail = strrchr(file, '/')) == NULL) + tail = file; +@@ -555,8 +558,8 @@ static void + prepare(int i, FILE *fd, off_t filesize) + { + struct line *p; +- int j, h; +- size_t sz; ++ int j, h; ++ size_t sz; + + rewind(fd); + +@@ -579,7 +582,7 @@ prepare(int i, FILE *fd, off_t filesize) + static void + prune(void) + { +- int i, j; ++ int i, j; + + for (pref = 0; pref < len[0] && pref < len[1] && + file[0][pref + 1].value == file[1][pref + 1].value; +@@ -600,7 +603,7 @@ prune(void) + static void + equiv(struct line *a, int n, struct line *b, int m, int *c) + { +- int i, j; ++ int i, j; + + i = j = 1; + while (i <= n && j <= m) { +@@ -629,7 +632,7 @@ equiv(struct line *a, int n, struct line + static int + isqrt(int n) + { +- int y, x = 1; ++ int y, x = 1; + + if (n == 0) + return (0); +@@ -647,9 +650,9 @@ isqrt(int n) + static int + stone(int *a, int n, int *b, int *c) + { +- int i, k, y, j, l; +- int oldc, tc, oldl; +- u_int numtries; ++ int i, k, y, j, l; ++ int oldc, tc, oldl; ++ u_int numtries; + const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n)); + + k = 0; +@@ -705,7 +708,7 @@ newcand(int x, int y, int pred) + static int + search(int *c, int k, int y) + { +- int i, j, l, t; ++ int i, j, l, t; + + if (clist[c[k]].y < y) /* quick look for typical case */ + return (k + 1); +@@ -730,7 +733,7 @@ static void + unravel(int p) + { + struct cand *q; +- int i; ++ int i; + + for (i = 0; i <= len[0]; i++) + J[i] = i <= pref ? i : +@@ -748,9 +751,10 @@ unravel(int p) static void check(char *file1, FILE *f1, char *file2, FILE *f2) { @@ -318,7 +455,7 @@ rewind(f1); rewind(f2); j = 1; -@@ -766,7 +772,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -766,7 +770,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -327,7 +464,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -781,6 +787,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -781,6 +785,7 @@ check(char *file1, FILE *f1, char *file2 } ctold++; ctnew++; @@ -335,7 +472,7 @@ if (bflag && isspace(c) && isspace(d)) { do { if (c == '\n') -@@ -792,6 +799,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -792,6 +797,7 @@ check(char *file1, FILE *f1, char *file2 break; ctnew++; } while (isspace(d = getc(f2))); @@ -343,7 +480,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +809,64 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +807,64 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -417,11 +554,171 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -872,7 +911,7 @@ static void + sort(struct line *a, int n) + { + struct line *ai, *aim, w; +- int j, m = 0, k; ++ int j, m = 0, k; + + if (n == 0) + return; +@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b) + static int + skipline(FILE *f) + { +- int i, c; ++ int i, c; + + for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) + continue; +@@ -926,7 +965,7 @@ skipline(FILE *f) + static void + output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) + { +- int m, i0, i1, j0, j1; ++ int m, i0, i1, j0, j1; + + rewind(f1); + rewind(f2); +@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file + static void + range(int a, int b, char *separator) + { ++ + 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) + static void + uni_range(int a, int b) + { ++ + if (a < b) + printf("%d,%d", a, b - a + 1); + else if (a == b) +@@ -999,8 +1040,8 @@ uni_range(int a, int b) + static char * + preadline(int fd, size_t len, off_t off) + { +- char *line; +- ssize_t nr; ++ char *line; ++ ssize_t nr; + + line = emalloc(len + 1); + if ((nr = pread(fd, line, len, off)) < 0) +@@ -1014,7 +1055,7 @@ preadline(int fd, size_t len, off_t off) + static int + ignoreline(char *line) + { +- int ret; ++ int ret; + + ret = regexec(&ignore_re, line, 0, NULL, 0); + free(line); +@@ -1032,8 +1073,8 @@ static void + change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, + int *pflags) + { +- static size_t max_context = 64; +- int i; ++ static size_t max_context = 64; ++ int i; + + restart: + if (format != D_IFDEF && a > b && c > d) +@@ -1165,8 +1206,8 @@ proceed: + static int + fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) + { +- int i, j, c, lastc, col, nc; +- int newcol; ++ int i, j, c, lastc, col, nc; ++ int newcol; + + /* + * When doing #ifdef's, copy down to current line +@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i + static int + readhash(FILE *f) + { +- int i, t, space; +- int sum; ++ int i, t, space; ++ int sum; + + sum = 1; + space = 0; +@@ -1308,12 +1349,11 @@ readhash(FILE *f) + static int + asciifile(FILE *f) + { +- char buf[BUFSIZ]; +- int i, cnt; ++ char buf[BUFSIZ]; ++ int i, cnt; + + if (aflag || f == NULL) + return (1); +- + rewind(f); + cnt = fread(buf, 1, sizeof(buf), f); + for (i = 0; i < cnt; i++) +@@ -1327,10 +1367,10 @@ asciifile(FILE *f) + static char * + match_function(const long *f, int pos, FILE *file) + { +- char buf[FUNCTION_CONTEXT_SIZE]; +- size_t nc; +- int last = lastline; +- char *state = NULL; ++ char buf[FUNCTION_CONTEXT_SIZE]; ++ size_t nc; ++ int last = lastline; ++ char *state = NULL; + + lastline = pos; + while (pos > last) { +@@ -1342,7 +1382,6 @@ match_function(const long *f, int pos, F + if (nc > 0) { + buf[nc] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; +- + if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { + if (begins_with(buf, "private:")) { + if (!state) +@@ -1373,9 +1412,9 @@ static void + dump_context_vec(FILE *f1, FILE *f2) + { + struct context_vec *cvp = context_vec_start; +- int lowa, upb, lowc, upd, do_output; +- int a, b, c, d; +- char ch, *f; ++ int lowa, upb, lowc, upd, do_output; ++ int a, b, c, d; ++ char ch, *f; + + if (context_vec_start > context_vec_ptr) + return; +@@ -1478,9 +1517,9 @@ static void + dump_unified_vec(FILE *f1, FILE *f2) + { + struct context_vec *cvp = context_vec_start; +- int lowa, upb, lowc, upd; +- int a, b, c, d; +- char ch, *f; ++ int lowa, upb, lowc, upd; ++ int a, b, c, d; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 06:06: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 7083A106564A for ; Tue, 19 Jun 2012 06:06:38 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 06:06:38 +0000 Date: Tue, 19 Jun 2012 06:06:38 +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: <20120619060638.7083A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237930 - 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: Tue, 19 Jun 2012 06:06:39 -0000 Author: jhagewood Date: Tue Jun 19 06:06:37 2012 New Revision: 237930 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237930 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Tue Jun 19 05:55:56 2012 (r237929) +++ soc2012/jhagewood/diff/TODO Tue Jun 19 06:06:37 2012 (r237930) @@ -7,7 +7,7 @@ --show-function-line INCOMPLETE --unidirectional-new-file INCOMPLETE --normal COMPLETE Sets format to D_NORMAL in getopt_long(). ---supress-common-lines INCOMPLETE +--suppress-common-lines IN PROGRESS --GTYPE-group-format INCOMPLETE --line-format IN PROGRESS --LTYPE-line-format INCOMPLETE Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 05:55:56 2012 (r237929) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 06:06:37 2012 (r237930) @@ -67,7 +67,7 @@ OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, - OT_SUPCL, + OPT_SUPCL, OPT_GTYPE, OPT_LF, OPT_LLF, @@ -84,9 +84,9 @@ { "normal", no_argument, NULL, OPT_NORMAL }, { "line-format", required_argument, NULL, OPT_LF }, + { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, /* XXX: UNIMPLEMENTED { "left-column", no_argument, NULL, OPT_LEFTC }, - { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, { "from-file", required_argument, NULL, OPT_FFILE }, @@ -102,7 +102,6 @@ /* 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' }, @@ -302,15 +301,18 @@ case OPT_NORMAL: format = D_NORMAL; break; + case OPT_SUPCL: + /* XXX To do: Complete --suppress-common-lines */ + 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; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 05:55:56 2012 (r237929) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 06:06:37 2012 (r237930) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 05:12:45.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-19 06:04:34.000000000 -0400 @@ -18,15 +18,13 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ @@ -43,7 +43,13 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -74,7 +72,6 @@ enum +@@ -69,12 +67,11 @@ enum + OPT_STRIPCR, + OPT_NORMAL, + OPT_LEFTC, +- OT_SUPCL, ++ OPT_SUPCL, + OPT_GTYPE, OPT_LF, OPT_LLF, OPT_TSIZE, @@ -59,18 +65,23 @@ + { "normal", no_argument, NULL, OPT_NORMAL }, - { "left-column", no_argument, NULL, OPT_LEFTC }, -+ { "line-format", required_argument, NULL, OPT_LF }, +- { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, +- { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, + { "line-format", required_argument, NULL, OPT_LF }, ++ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, +/* XXX: UNIMPLEMENTED + { "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 }, ++ { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, { "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 }, -@@ -109,8 +106,7 @@ static struct option longopts[] = { +@@ -105,12 +102,10 @@ static struct option longopts[] = { + /* 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' }, @@ -80,7 +91,7 @@ { "ed", no_argument, NULL, 'e' }, /* XXX: UNIMPLEMENTED { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +125,6 @@ static struct option longopts[] = { +@@ -129,7 +124,6 @@ static struct option longopts[] = { { "report-identical-files", no_argument, NULL, 's' }, { "initial-tab", no_argument, NULL, 'T' }, { "expand-tabs", no_argument, NULL, 't' }, @@ -88,7 +99,7 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -162,10 +157,10 @@ void read_excludes_file(char *); +@@ -162,10 +156,10 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -103,7 +114,7 @@ oargv = argv; oargc = argc; -@@ -197,6 +192,7 @@ main(int argc, char **argv) +@@ -197,6 +191,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -111,7 +122,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +209,9 @@ main(int argc, char **argv) +@@ -213,6 +208,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -121,7 +132,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +295,13 @@ main(int argc, char **argv) +@@ -296,15 +294,25 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -132,10 +143,30 @@ + case OPT_NORMAL: + format = D_NORMAL; + break; ++ case OPT_SUPCL: ++ /* XXX To do: Complete --suppress-common-lines */ ++ break; case OPT_TSIZE: - if (optarg != NULL) { - l = strtol(optarg, &ep, 10); -@@ -402,11 +408,10 @@ main(int argc, char **argv) +- 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; +@@ -402,11 +410,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -148,7 +179,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +420,7 @@ emalloc(size_t n) +@@ -415,7 +422,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -157,7 +188,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +436,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +438,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -173,7 +204,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +450,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +452,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -188,7 +219,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +536,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +538,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -196,7 +227,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +545,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +547,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -254,7 +285,7 @@ break; } } -@@ -585,6 +592,7 @@ print_status(int val, char *path1, char +@@ -585,6 +594,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 07:00: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 55E811065670 for ; Tue, 19 Jun 2012 07:00:03 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 07:00:03 +0000 Date: Tue, 19 Jun 2012 07:00:03 +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: <20120619070004.55E811065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237931 - in soc2012/scher/par_ports/remote: . 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: Tue, 19 Jun 2012 07:00:05 -0000 Author: scher Date: Tue Jun 19 07:00:01 2012 New Revision: 237931 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237931 Log: up-to-date Added: soc2012/scher/par_ports/remote/ soc2012/scher/par_ports/remote/Mk/ soc2012/scher/par_ports/remote/Mk/bsd.apache.mk soc2012/scher/par_ports/remote/Mk/bsd.autotools.mk soc2012/scher/par_ports/remote/Mk/bsd.cmake.mk soc2012/scher/par_ports/remote/Mk/bsd.commands.mk soc2012/scher/par_ports/remote/Mk/bsd.cran.mk soc2012/scher/par_ports/remote/Mk/bsd.database.mk soc2012/scher/par_ports/remote/Mk/bsd.destdir.mk soc2012/scher/par_ports/remote/Mk/bsd.drupal.mk soc2012/scher/par_ports/remote/Mk/bsd.efl.mk soc2012/scher/par_ports/remote/Mk/bsd.emacs.mk soc2012/scher/par_ports/remote/Mk/bsd.fpc.mk soc2012/scher/par_ports/remote/Mk/bsd.gcc.mk soc2012/scher/par_ports/remote/Mk/bsd.gecko.mk soc2012/scher/par_ports/remote/Mk/bsd.gnome.mk soc2012/scher/par_ports/remote/Mk/bsd.gnustep.mk soc2012/scher/par_ports/remote/Mk/bsd.gstreamer.mk soc2012/scher/par_ports/remote/Mk/bsd.java.mk soc2012/scher/par_ports/remote/Mk/bsd.kde.mk soc2012/scher/par_ports/remote/Mk/bsd.kde4.mk soc2012/scher/par_ports/remote/Mk/bsd.ldap.mk soc2012/scher/par_ports/remote/Mk/bsd.licenses.db.mk soc2012/scher/par_ports/remote/Mk/bsd.licenses.mk soc2012/scher/par_ports/remote/Mk/bsd.linux-apps.mk soc2012/scher/par_ports/remote/Mk/bsd.linux-rpm.mk soc2012/scher/par_ports/remote/Mk/bsd.local.mk soc2012/scher/par_ports/remote/Mk/bsd.lua.mk soc2012/scher/par_ports/remote/Mk/bsd.mail.mk soc2012/scher/par_ports/remote/Mk/bsd.ncurses.mk soc2012/scher/par_ports/remote/Mk/bsd.ocaml.mk soc2012/scher/par_ports/remote/Mk/bsd.octave.mk soc2012/scher/par_ports/remote/Mk/bsd.openssl.mk soc2012/scher/par_ports/remote/Mk/bsd.options.desc.mk soc2012/scher/par_ports/remote/Mk/bsd.options.mk soc2012/scher/par_ports/remote/Mk/bsd.parallel.mk soc2012/scher/par_ports/remote/Mk/bsd.perl.mk soc2012/scher/par_ports/remote/Mk/bsd.php.mk soc2012/scher/par_ports/remote/Mk/bsd.pkgng.mk soc2012/scher/par_ports/remote/Mk/bsd.port.mk soc2012/scher/par_ports/remote/Mk/bsd.port.options.mk soc2012/scher/par_ports/remote/Mk/bsd.port.post.mk soc2012/scher/par_ports/remote/Mk/bsd.port.pre.mk soc2012/scher/par_ports/remote/Mk/bsd.port.subdir.mk soc2012/scher/par_ports/remote/Mk/bsd.python.mk soc2012/scher/par_ports/remote/Mk/bsd.qt.mk soc2012/scher/par_ports/remote/Mk/bsd.ruby.mk soc2012/scher/par_ports/remote/Mk/bsd.scons.mk soc2012/scher/par_ports/remote/Mk/bsd.sdl.mk soc2012/scher/par_ports/remote/Mk/bsd.sites.mk soc2012/scher/par_ports/remote/Mk/bsd.tcl.mk soc2012/scher/par_ports/remote/Mk/bsd.wx.mk soc2012/scher/par_ports/remote/Mk/bsd.xfce.mk soc2012/scher/par_ports/remote/Mk/bsd.xorg.mk soc2012/scher/par_ports/remote/Mk/bsd.zenoss.mk Added: soc2012/scher/par_ports/remote/Mk/bsd.apache.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/remote/Mk/bsd.apache.mk Tue Jun 19 07:00:01 2012 (r237931) @@ -0,0 +1,546 @@ +#-*- tab-width: 4; -*- +# ex:ts=4 +# +# $FreeBSD: ports/Mk/bsd.apache.mk,v 1.36 2012/05/23 08:17:48 miwi Exp $ +# +# bsd.apache.mk - Apache related macros. +# Author: Clement Laforet +# Author: Olli Hauer +# +# Please view me with 4 column tabs! + +# ========================================================================= +# Parameter APACHE_PORT (user controlled): +# +# The parameter APACHE_PORT can be used in /etc/make.conf to +# overwrite the default apache port. +# +# This parameter should never be used in the Makefile of a port! +# +# Example entry in /etc/make.conf: +# APACHE_PORT= www/apache22 +# +# To get a list of "possible" valid values execute the command: +# $> egrep 'apache[12]' ports/www/Makefile | awk '{print "www/" $3}' +# +# ========================================================================= +# +# This script will be included if one of the following parameter +# is defined in the Makefile of the port +# +# USE_APACHE - Set apache and apxs as build and run dependency +# USE_APACHE_BUILD - Set apache and apxs as build dependency +# USE_APACHE_RUN - Set apache and apxs as run dependency +# +# The following example is representative of all three possible +# parameters to use. +# +# Examples: +# USE_APACHE= 22 # specify exact version +# USE_APACHE= 20+ # specify [min] version, no [max] version +# USE_APACHE= 20-22 # specify [min]-[max] range +# USE_APACHE= -22 # specify [max] version, no [min] version +# +# Note: +# - If "+" is specified and no apache is installed, then +# ${DEFAULT_APACHE_VERSION} will be used. +# +# - Valid version numbers are specified in the variable +# APACHE_SUPPORTED_VERSION below +# +# - The following values for USE_APACHE are reserverd and only valid +# in apache-server ports! +# USE_APACHE= common20, and common22 +# +# +# The following variables can be used (ro) in ports Makefile +# ========================================================================= +# - APACHE_VERSION +# - APACHEETCDIR +# - APACHEINCLUDEDIR +# - APACHEMODDIR +# - DEFAULT_APACHE_VERSION +# +# +# Parameters for building third party apache modules: +# ========================================================================= +# - AP_FAST_BUILD # automatic module build +# +# - AP_GENPLIST # automatic PLIST generation plus add +# # the module disabled into httpd.conf +# # (only if no pkg-plist exist) +# +# - MODULENAME # default: ${PORTNAME} +# - SHORTMODNAME # default: ${MODULENAME:S/mod_//} +# - SRC_FILE # default: ${MODULENAME}.c +# +# + +.if !defined(Apache_Pre_Include) + +Apache_Pre_Include= bsd.apache.mk + +DEFAULT_APACHE_VERSION= 22 +APACHE_SUPPORTED_VERSION= 22 20 # preferred version first + +# Print warnings +_ERROR_MSG= : Error from bsd.apache.mk. + +# Important Note: +# Keep apache version in ascending order! +# The "+" sign is only valid as last sign, not between +# two versions or in combination with range! +.if defined(USE_APACHE) && !empty(USE_APACHE) +. if ${USE_APACHE:Mcommon*} != "" +AP_PORT_IS_SERVER= YES +. elif ${USE_APACHE:C/\-//:S/^20//:S/^22//:C/\+$//} == "" +AP_PORT_IS_MODULE= YES +. if ${USE_APACHE:C/\-//:S/^20//:S/^22//} == "+" +AP_PLUS= yes +. endif +. else +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +# Catch unknown apache versions and silly USE_APACHE constructs +. if empty(AP_PORT_IS_SERVER) && empty(AP_PORT_IS_MODULE) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +# Catch USE_APACHE [min]-[max]+ +. if defined(AP_PLUS) && ${USE_APACHE:C/[.+0-9]//g} == "-" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +.elif defined(USE_APACHE) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( no version specified ) +.endif # defined(USE_APACHE) + +# =============================================================== +.if defined(AP_PORT_IS_SERVER) +# For slave ports: +.if defined(SLAVE_DESIGNED_FOR) && ${PORTVERSION} != ${SLAVE_DESIGNED_FOR} +IGNORE= Sorry, ${SLAVENAME} and ${PORTNAME} versions are out of sync ${PORTVERSION} != ${SLAVE_DESIGNED_FOR} +.endif + +.if defined(SLAVE_PORT_MODULES) +DEFAULT_MODULES_CATEGORIES+= SLAVE_PORT +ALL_MODULES_CATEGORIES+= SLAVE_PORT +.endif + +# Module selection +.for category in ${DEFAULT_MODULES_CATEGORIES} +DEFAULT_MODULES+= ${${category}_MODULES} +WITH_${category}_MODULES= YES +.endfor + +.for category in ${ALL_MODULES_CATEGORIES} +AVAILABLE_MODULES+= ${${category}_MODULES} +.endfor + +# Setting "@comment " as default. +.for module in ${AVAILABLE_MODULES} +${module}_PLIST_SUB= "@comment " +.endfor + +# Configure +# dirty hacks to make sure all modules are disabled before we select them +.if ${USE_APACHE} == common13 +CONFIGURE_ARGS+= --disable-module="all" +.elif ${USE_APACHE} == common20 +CONFIGURE_ARGS+= --disable-access --disable-auth \ + --disable-charset-lite --disable-include \ + --disable-log-config --disable-env --disable-setenvif \ + --disable-mime --disable-status --disable-autoindex \ + --disable-asis --disable-cgid --disable-cgi \ + --disable-negotiation --disable-dir --disable-imap \ + --disable-actions --disable-userdir --disable-alias +.elif ${USE_APACHE} == common22 +CONFIGURE_ARGS+= --disable-authn-file --disable-authn-default \ + --disable-authz-host --disable-authz-groupfile \ + --disable-authz-user --disable-authz-default \ + --disable-auth-basic --disable-charset-lite \ + --disable-include --disable-log-config --disable-env \ + --disable-setenvif --disable-mime --disable-status \ + --disable-autoindex --disable-asis --disable-cgid \ + --disable-cgi --disable-negotiation --disable-dir \ + --disable-imagemap --disable-actions --disable-userdir \ + --disable-alias --disable-filter --disable-substitute \ + --disable-proxy --disable-proxy-connect \ + --disable-proxy-ftp --disable-proxy-http \ + --disable-proxy-ajp --disable-proxy-balancer \ + --disable-proxy-scgi --disable-reqtimeout +.endif + +.if defined(OPTIONS) && !(make(make-options-list)) +.for module in ${AVAILABLE_MODULES} +. if defined(WITH_${module:U}) +_APACHE_MODULES+= ${module} +. endif +. if defined(WITHOUT_${module:U}) +WITHOUT_MODULES+= ${module} +. endif +.endfor +.elif defined(WITH_MODULES) +_APACHE_MODULES+= ${WITH_MODULES} +.else +.for category in ${ALL_MODULES_CATEGORIES} +. if defined (WITHOUT_${category}_MODULES) || defined (WITH_CUSTOM_${category}) +. if defined(WITH_${category}_MODULES}) +. undef WITH_${category}_MODULES +. endif +. if defined (WITH_CUSTOM_${category}) +_APACHE_MODULES+= ${WITH_CUSTOM_${category}} +. endif +. elif defined(WITH_${category}_MODULES) +_APACHE_MODULES+= ${${category}_MODULES} +. endif +.endfor +.if defined(WITH_EXTRA_MODULES) +_APACHE_MODULES+= ${WITH_EXTRA_MODULES} +.endif +.endif + +.if !defined(WITH_STATIC_APACHE) +. if ${USE_APACHE:Mcommon2*} != "" +# FYI +#DYNAMIC_MODULES= so +CONFIGURE_ARGS+= --enable-so +. endif +.else +. if ${USE_APACHE:Mcommon2*} != "" +CONFIGURE_ARGS+= --disable-so +. endif +WITH_ALL_STATIC_MODULES= YES +.endif + +.if defined(WITH_SUEXEC) || defined(WITH_SUEXEC_MODULES) +. if ${USE_APACHE} == common13 +SUEXEC_CONFARGS= suexec +CONFIGURE_ARGS+= --enable-suexec +. elif ${USE_APACHE:Mcommon2*} != "" +_APACHE_MODULES+= ${SUEXEC_MODULES} +SUEXEC_CONFARGS= with-suexec +. endif + +# From now we're defaulting to apache 2.* +SUEXEC_DOCROOT?= ${PREFIX}/www/data +SUEXEC_USERDIR?= public_html +SUEXEC_SAFEPATH?= ${PREFIX}/bin:${LOCALBASE}/bin:/usr/bin:/bin +SUEXEC_LOGFILE?= /var/log/httpd-suexec.log +SUEXEC_UIDMIN?= 1000 +SUEXEC_GIDMIN?= 1000 +SUEXEC_CALLER?= ${WWWOWN} +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-caller=${SUEXEC_CALLER} \ + --${SUEXEC_CONFARGS}-uidmin=${SUEXEC_UIDMIN} \ + --${SUEXEC_CONFARGS}-gidmin=${SUEXEC_GIDMIN} \ + --${SUEXEC_CONFARGS}-userdir="${SUEXEC_USERDIR}" \ + --${SUEXEC_CONFARGS}-docroot="${SUEXEC_DOCROOT}" \ + --${SUEXEC_CONFARGS}-safepath="${SUEXEC_SAFEPATH}" \ + --${SUEXEC_CONFARGS}-logfile="${SUEXEC_LOGFILE}" +. if ${USE_APACHE:Mcommon2*} != "" +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-bin="${PREFIX}/sbin/suexec" +. endif + +. if defined(WITH_SUEXEC_UMASK) +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-umask=${SUEXEC_UMASK} +. endif +.endif + +.if !defined(WITHOUT_MODULES) +APACHE_MODULES= ${_APACHE_MODULES} +.else +APACHE_MODULES!= \ + for module in ${_APACHE_MODULES}; do \ + ${ECHO_CMD} ${WITHOUT_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \ + ${ECHO_CMD} $${module}; \ + done +.endif + +.if defined(WITH_STATIC_MODULES) +. if ${USE_APACHE} == common13 +STATIC_MODULE_CONFARG= --enable-module=$${module} +DSO_MODULE_CONFARG= --enable-module=$${module} --enable-shared=$${module} +. else +STATIC_MODULE_CONFARG= --enable-$${module} +DSO_MODULE_CONFARG= --enable-$${module}=shared +. endif +_CONFIGURE_ARGS!= \ + for module in ${APACHE_MODULES} ; do \ + ${ECHO_CMD} ${WITH_STATIC_MODULES} | \ + ${GREP} -wq $${module} 2> /dev/null ; \ + if [ "$${?}" = "0" ] ; then \ + ${ECHO_CMD} "${STATIC_MODULE_CONFARG}"; \ + else \ + ${ECHO_CMD} "${DSO_MODULE_CONFARG}"; \ + fi; done +CONFIGURE_ARGS+= ${_CONFIGURE_ARGS} +.elif defined(WITH_STATIC_APACHE) || defined(WITH_ALL_STATIC_MODULES) +WITH_STATIC_MODULES= ${APACHE_MODULES} +. if ${USE_APACHE} == common13 +. for module in ${APACHE_MODULES} +CONFIGURE_ARGS+= --enable-module=${module} +. endfor +. else +CONFIGURE_ARGS+= --enable-modules="${APACHE_MODULES}" +. endif +.else +. if ${USE_APACHE} == common13 +. for module in ${APACHE_MODULES} +CONFIGURE_ARGS+= --enable-module=${module} --enable-shared=${module} +. endfor +. else +CONFIGURE_ARGS+= --enable-mods-shared="${APACHE_MODULES}" +. endif +.endif + +.if defined(WITH_STATIC_MODULES) +_SHARED_MODULES!= \ + for module in ${APACHE_MODULES} ; do \ + ${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \ + ${ECHO_CMD} $${module}; \ + done +SHARED_MODULES= ${_SHARED_MODULES} +.elif !defined(WITH_ALL_STATIC_MODULES) +SHARED_MODULES= ${APACHE_MODULES} +.endif + +.for module in ${SHARED_MODULES} +${module}_PLIST_SUB= "" +.endfor + +.for module in ${AVAILABLE_MODULES} +PLIST_SUB+= MOD_${module:U}=${${module}_PLIST_SUB} +.endfor +#### End of AP_PORT_IS_SERVER #### + +# =============================================================== +.elif defined(AP_PORT_IS_MODULE) || defined(USE_APACHE_RUN) || defined(USE_APACHE_BUILD) +APXS?= ${LOCALBASE}/sbin/apxs +HTTPD?= ${LOCALBASE}/sbin/httpd + +MODULENAME?= ${PORTNAME} +SHORTMODNAME?= ${MODULENAME:S/mod_//} +SRC_FILE?= ${MODULENAME}.c + +.if exists(${HTTPD}) +_APACHE_VERSION!= ${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p' +. if ${_APACHE_VERSION} > 13 +APACHE_MPM!= ${APXS} -q MPM_NAME +. endif +.elif defined(APACHE_PORT) +_APACHE_VERSION!= ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p' +.endif + +.if defined(USE_APACHE) +_USE_APACHE:= ${USE_APACHE} +.elif defined(USE_APACHE_BUILD) +_USE_APACHE:= ${USE_APACHE_BUILD} +.elif defined(USE_APACHE_RUN) +_USE_APACHE:= ${USE_APACHE_RUN} +.endif + +_APACHE_VERSION_CHECK:= ${_USE_APACHE:C/^([1-9][0-9])$/\1-\1/} +_APACHE_VERSION_MINIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/([1-9][0-9])[-+].*/\1/} +_APACHE_VERSION_MINIMUM:= ${_APACHE_VERSION_MINIMUM_TMP:M[1-9][0-9]} +_APACHE_VERSION_MAXIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/.*-([1-9][0-9])/\1/} +_APACHE_VERSION_MAXIMUM:= ${_APACHE_VERSION_MAXIMUM_TMP:M[1-9][0-9]} + +.if defined(_APACHE_VERSION) +# Validate Apache version whether it meets USE_APACHE version restriction. +. if !empty(_APACHE_VERSION_MINIMUM) && (${_APACHE_VERSION} < ${_APACHE_VERSION_MINIMUM}) +_APACHE_VERSION_NONSUPPORTED= ${_APACHE_VERSION_MINIMUM} at least +. elif !empty(_APACHE_VERSION_MAXIMUM) && (${_APACHE_VERSION} > ${_APACHE_VERSION_MAXIMUM}) +_APACHE_VERSION_NONSUPPORTED= ${_APACHE_VERSION_MAXIMUM} at most +. endif + +. if defined(_APACHE_VERSION_NONSUPPORTED) && !defined(AP_IGNORE_VERSION_CHECK) +IGNORE= ${_ERROR_MSG} apache${_APACHE_VERSION} is installed (or APACHE_PORT is defined) and port requires apache${_APACHE_VERSION_NONSUPPORTED} +. endif +.else # defined(_APACHE_VERSION) +. for ver in ${APACHE_SUPPORTED_VERSION} +__VER= ${ver} +. if !defined(_APACHE_VERSION) && \ + !(!empty(_APACHE_VERSION_MINIMUM) && ( ${__VER} < ${_APACHE_VERSION_MINIMUM} )) && \ + !(!empty(_APACHE_VERSION_MAXIMUM) && ( ${__VER} > ${_APACHE_VERSION_MAXIMUM} )) +_APACHE_VERSION= ${ver} +. endif +. endfor +.endif # defined(_APACHE_VERSION) + +APACHE_VERSION:= ${_APACHE_VERSION} + +.if exists(${APXS}) +APXS_PREFIX!= ${APXS} -q prefix 2> /dev/null || echo NULL +. if ${APXS_PREFIX} == NULL +IGNORE= : Your apache does not support DSO modules +. endif +. if defined(AP_GENPLIST) && ${APXS_PREFIX} != ${PREFIX} +IGNORE?= PREFIX must be equal to APXS_PREFIX. +. endif +.endif + +.if ${APACHE_VERSION} == 20 +AP_BUILDEXT= la +APACHEMODDIR= libexec/apache2 +APACHEINCLUDEDIR=include/apache2 +APACHEETCDIR= etc/apache2 +APACHE_PORT?= www/apache${APACHE_VERSION} +.elif ${APACHE_VERSION} >= 22 +AP_BUILDEXT= la +APACHEMODDIR= libexec/apache${APACHE_VERSION} +APACHEINCLUDEDIR=include/apache${APACHE_VERSION} +APACHEETCDIR= etc/apache${APACHE_VERSION} +APACHE_PORT?= www/apache${APACHE_VERSION} +.else +AP_BUILDEXT= so +APACHEMODDIR= libexec/apache +APACHEINCLUDEDIR=include/apache +APACHEETCDIR= etc/apache +APACHE_PORT?= www/apache13 +.endif + +PLIST_SUB+= APACHEMODDIR="${APACHEMODDIR}" \ + APACHEINCLUDEDIR="${APACHEINCLUDEDIR}" \ + APACHEETCDIR="${APACHEETCDIR}" + +APACHE_PKGNAMEPREFIX= ap${APACHE_VERSION}- +.if defined(AP_FAST_BUILD) +PKGNAMEPREFIX?= ${APACHE_PKGNAMEPREFIX} +.endif + +.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +.endif + +.if defined(USE_APACHE) || defined(USE_APACHE_RUN) +RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +.endif + +PLIST_SUB+= AP_NAME="${SHORTMODNAME}" +PLIST_SUB+= AP_MODULE="${MODULENAME}.so" + +.if defined(AP_GENPLIST) +PLIST?= ${WRKDIR}/ap-plist +.endif + +.if defined(AP_INC) +AP_EXTRAS+= -I ${AP_INC} +.endif +.if defined(AP_LIB) +AP_EXTRAS+= -L ${AP_LIB} +.endif + +.endif # End of AP_PORT_IS_SERVER / AP_PORT_IS_MOULE +.endif # End of !Apache_Pre_Include + +# =============================================================== +.if defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) +Apache_Post_Include= bsd.apache.mk + +.if defined(USE_APACHE_RUN) && !empty(USE_APACHE_RUN) +. if ${USE_APACHE_RUN:C/\-//:S/^20//:S/^22//:C/\+$//} != "" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( ${USE_APACHE_RUN} ) +. endif +.elif defined(USE_APACHE_RUN) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( no valid version specified ) +.endif + +.if defined(USE_APACHE_BUILD) && !empty(USE_APACHE_BUILD) +. if ${USE_APACHE_BUILD:C/\-//:S/^20//:S/^22//:C/\+$//} != "" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( ${USE_APACHE_BUILD} ) +. endif +.elif defined(USE_APACHE_BUILD) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( no valid version specified ) +.endif + +# Check if USE_APACHE(_BUILD|_RUN) are mixed together +.if defined(USE_APACHE) && ( defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) ) +IGNORE= ${_ERROR_MSG} specify only one of: USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN +.elif defined(USE_APACHE_BUILD) && defined(USE_APACHE_RUN) +IGNORE= ${_ERROR_MSG} use USE_APACHE instead of USE_APACHE_BUILD and USE_APACHE_RUN together +.endif + +.if defined(AP_PORT_IS_SERVER) +.if !target(print-closest-mirrors) +print-closest-mirrors: + @${ECHO_MSG} -n "Fetching list of nearest mirror: " >&2 + @MIRRORS=`${FETCH_CMD} -T 30 -qo - http://www.apache.org/dyn/closer.cgi/httpd/ 2> /dev/null\ + | ${GREP} /httpd/ | ${SED} 's/.*href="\(.*\)">&2; if [ "x$$MIRRORS" != "x" ]; then \ + ${ECHO_MSG} -n "MASTER_SITE_APACHE_HTTPD?= ";\ + ${ECHO_MSG} $$MIRRORS; else \ + ${ECHO_MSG} "No mirrors found!">&2 ; fi +.endif + +.if !target(show-categories) +show-categories: +.for category in ${ALL_MODULES_CATEGORIES} + @${ECHO_MSG} "${category} contains these modules:" + @${ECHO_MSG} " ${${category}_MODULES}" +.endfor +.endif + +.if !target(show-modules) +show-modules: + @for module in ${AVAILABLE_MODULES} ; do \ + ${ECHO_MSG} -n "$${module}: "; \ + if ${ECHO_CMD} ${APACHE_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; \ + then \ + ${ECHO_CMD} -n "enabled "; \ + if ${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; then \ + ${ECHO_CMD} "(static)" ; \ + else \ + ${ECHO_CMD} "(shared)" ;\ + fi;\ + else \ + ${ECHO_CMD} disabled ;\ + fi;\ + done +.endif + +.if !target(make-options-list) +make-options-list: + @${ECHO_CMD} OPTIONS+= \\; + @for module in ${AVAILABLE_MODULES} ; do \ + if ${ECHO_CMD} ${APACHE_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; \ + then \ + ${PRINTF} "\t `${ECHO_CMD} $${module} | ${TR} '[:lower:]' '[:upper:]'` \"Enable mod_$${module}\" ON \\"; \ + ${ECHO_CMD}; \ + else \ + ${PRINTF} "\t `${ECHO_CMD} $${module} | ${TR} '[:lower:]' '[:upper:]'` \"Enable mod_$${module}\" OFF \\";\ + ${ECHO_CMD}; \ + fi;\ + done; \ + ${ECHO_CMD}; +.endif + +.elif defined(AP_PORT_IS_MODULE) + +.if defined(AP_FAST_BUILD) +.if !target(ap-gen-plist) +ap-gen-plist: +.if defined(AP_GENPLIST) +. if !exists(${PLIST}) + @${ECHO} "===> Generating apache plist" +# apache22/20 + @${ECHO} "@unexec ${SED} -i '' -E '/LoadModule[[:blank:]]+%%AP_NAME%%_module/d' %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST} + @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST} + @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} + @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST} +. endif +.else + @${DO_NADA} +.endif +.endif + +.if !target(do-build) +do-build: ap-gen-plist + @cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE} +.endif + +.if !target(do-install) +do-install: + @${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} +.endif +.endif +.endif +.endif # defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) Added: soc2012/scher/par_ports/remote/Mk/bsd.autotools.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/remote/Mk/bsd.autotools.mk Tue Jun 19 07:00:01 2012 (r237931) @@ -0,0 +1,418 @@ +#-*- tab-width: 4; -*- +# ex:ts=4 +# +# $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.42 2012/05/23 08:17:48 miwi Exp $ +# +# Please view me with 4 column tabs! +# +# IMPORTANT NOTE: +# Before making any changes to this file, contact portmgr to arrange +# for an experimental ports run. +# Untested commits will almost certainly break the tree, incur the +# wrath of countless folks, and be unceremoniously backed out by +# the maintainer and/or portmgr. + +Autotools_Include_MAINTAINER= autotools@FreeBSD.org + +#--------------------------------------------------------------------------- +# USE_AUTOTOOLS= tool[:env] ... +# +# 'tool' can currently be one of the following: +# autoconf, autoheader +# autoconf213, autoheader213 (legacy version) +# automake, aclocal +# automake14, aclocal14 (legacy version) +# libtool, libtoolize, libltdl +# +# ':env' is used to specify that the environmental variables are needed +# but the relevant tool should NOT be run as part of the +# 'run-autotools' target +# +# In addition, these variables can be set in the port Makefile to be +# passed to the relevant tools: +# +# AUTOMAKE_ARGS=... +# - Extra arguments passed to automake during configure step +# +# ACLOCAL_ARGS=... +# - Arguments passed to aclocal during configure step +# +# AUTOCONF_ARGS=... +# - Extra arguments passed to autoconf during configure step +# +# AUTOHEADER_ARGS=... +# - Extra arguments passed to autoheader during configure step +# +# LIBTOOLFLAGS= +# - Arguments passed to libtool during configure step +# +# LIBTOOLFILES= +# - A list of files to patch during libtool pre-configuration +# +# AUTOTOOLSFILES= +# - A list of files to further patch with derived information +# post-patching to reduce churn during component updates +# +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +# NO USER-SERVICABLE PARTS BEYOND THIS POINT. REALLY. WE MEAN IT. +#--------------------------------------------------------------------------- + +# Known autotools components +_AUTOTOOLS_ALL= autoconf autoheader autoconf213 autoheader213 \ + automake aclocal automake14 aclocal14 \ + libtool libtoolize libltdl + +# Incompatible autotools mixing +_AUTOTOOLS_IGN_autoconf= autoconf213 autoheader213 +_AUTOTOOLS_IGN_autoheader= autoconf213 autoheader213 +_AUTOTOOLS_IGN_autoconf213= autoconf autoheader +_AUTOTOOLS_IGN_autoheader213= autoconf autoheader +_AUTOTOOLS_IGN_automake= automake14 aclocal14 +_AUTOTOOLS_IGN_aclocal= automake14 aclocal14 +_AUTOTOOLS_IGN_automake14= automake aclocal +_AUTOTOOLS_IGN_aclocal14= automake aclocal + +#--------------------------------------------------------------------------- +# Primary magic to break out the USE_AUTOTOOLS stanza into something +# more useful, along with substantial error checking to prevent +# foot-shooting +#--------------------------------------------------------------------------- + +# Break out the stanza +# +_AUTOTOOLS_IMPL= +.for stanza in ${USE_AUTOTOOLS} +_AUTOTOOLS_IMPL+= ${stanza:C/^([^:]+).*/\1/} +_AUTOTOOL_${stanza:C/^([^:]+).*/\1/}= ${stanza:C/^[^:]+:([^:]+)/\1/} +.endfor + +# Verify each component, normalize +# +_AUTOTOOLS_NOCOMP= +.for component in ${_AUTOTOOLS_IMPL} +. if ${_AUTOTOOLS_ALL:M${component}}=="" +_AUTOTOOLS_NOCOMP+= ${component} +. endif +. if ${_AUTOTOOL_${component}}==${component} +_AUTOTOOL_${component}= yes +. elsif ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes" +_AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}} +. endif +.endfor +.if !empty(_AUTOTOOLS_NOCOMP) +IGNORE+= Unknown autotool: ${_AUTOTOOLS_NOCOMP:O:u} +.endif + +# Check for anything other than 'yes' or 'env' +# +_AUTOTOOLS_BADCOMP= +.for component in ${_AUTOTOOLS_IMPL} +. if ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes" +_AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}} +. endif +.endfor +.if !empty(_AUTOTOOLS_BADCOMP) +IGNORE+= Bad autotool stanza: ${_AUTOTOOLS_BADCOMP:O:u} +.endif + +# Check for incompatible mixes of components +# +_AUTOTOOLS_IGN= +.for component in ${_AUTOTOOLS_IMPL} +. for ignore in ${_AUTOTOOLS_IGN_${component}} +. if defined(_AUTOTOOL_${ignore}) +_AUTOTOOLS_IGN+= ${component} +. endif +. endfor +.endfor +.if !empty(_AUTOTOOLS_IGN) +IGNORE+= Incompatible autotools: ${_AUTOTOOLS_IGN:O:u} +.endif + +#--------------------------------------------------------------------------- +# automake and aclocal +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_aclocal) && ${_AUTOTOOL_aclocal} == "yes" +_AUTOTOOL_automake?= env +_AUTOTOOL_rule_aclocal= yes +GNU_CONFIGURE= yes +.endif + +.if defined(_AUTOTOOL_automake) +AUTOMAKE_VERSION= 1.12 +AUTOMAKE_APIVER= 1.12 +AUTOMAKE_PORT= devel/automake + +. if ${_AUTOTOOL_automake} == "yes" +_AUTOTOOL_rule_automake= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(_AUTOTOOL_aclocal14) && ${_AUTOTOOL_aclocal14} == "yes" +_AUTOTOOL_automake14?= env +_AUTOTOOL_rule_aclocal14= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_automake14) +AUTOMAKE_VERSION= 1.4 +AUTOMAKE_APIVER= 1.4.6 +AUTOMAKE_PORT= devel/automake14 +AUTOMAKE_ARGS+= -i # backwards compatibility shim + +. if ${_AUTOTOOL_automake14} == "yes" +_AUTOTOOL_rule_automake= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(AUTOMAKE_VERSION) +AUTOMAKE= ${LOCALBASE}/bin/automake-${AUTOMAKE_VERSION} +AUTOMAKE_DIR= ${LOCALBASE}/share/automake-${AUTOMAKE_VERSION} +ACLOCAL= ${LOCALBASE}/bin/aclocal-${AUTOMAKE_VERSION} +ACLOCAL_DIR= ${LOCALBASE}/share/aclocal-${AUTOMAKE_VERSION} + +. if defined(_AUTOTOOL_aclocal) || defined(_AUTOTOOL_aclocal14) +ACLOCAL_ARGS?= --acdir=${ACLOCAL_DIR} +. endif + +AUTOMAKE_VARS= AUTOMAKE=${AUTOMAKE} \ + AUTOMAKE_DIR=${AUTOMAKE_DIR} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \ + AUTOMAKE_APIVER=${AUTOMAKE_APIVER} \ + ACLOCAL=${ACLOCAL} \ + ACLOCAL_DIR=${ACLOCAL_DIR} + +AUTOMAKE_DEPENDS= ${AUTOMAKE}:${PORTSDIR}/${AUTOMAKE_PORT} +BUILD_DEPENDS+= ${AUTOMAKE_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# autoconf and autoheader +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_autoheader) && ${_AUTOTOOL_autoheader} == "yes" +_AUTOTOOL_autoconf= yes +_AUTOTOOL_rule_autoheader= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_autoconf) +AUTOCONF_VERSION= 2.69 +AUTOCONF_PORT= devel/autoconf + +. if ${_AUTOTOOL_autoconf} == "yes" +_AUTOTOOL_rule_autoconf= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(_AUTOTOOL_autoheader213) && ${_AUTOTOOL_autoheader213} == "yes" +_AUTOTOOL_autoconf213= yes +_AUTOTOOL_rule_autoheader= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_autoconf213) +AUTOCONF_VERSION= 2.13 +AUTOCONF_PORT= devel/autoconf213 +AUTOM4TE= ${FALSE} # doesn't exist here + +. if ${_AUTOTOOL_autoconf213} == "yes" +_AUTOTOOL_rule_autoconf= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(AUTOCONF_VERSION) +AUTOCONF= ${LOCALBASE}/bin/autoconf-${AUTOCONF_VERSION} +AUTOCONF_DIR= ${LOCALBASE}/share/autoconf-${AUTOCONF_VERSION} +AUTOHEADER= ${LOCALBASE}/bin/autoheader-${AUTOCONF_VERSION} +AUTOIFNAMES= ${LOCALBASE}/bin/ifnames-${AUTOCONF_VERSION} +AUTOM4TE?= ${LOCALBASE}/bin/autom4te-${AUTOCONF_VERSION} +AUTORECONF= ${LOCALBASE}/bin/autoreconf-${AUTOCONF_VERSION} +AUTOSCAN= ${LOCALBASE}/bin/autoscan-${AUTOCONF_VERSION} +AUTOUPDATE= ${LOCALBASE}/bin/autoupdate-${AUTOCONF_VERSION} + +AUTOCONF_VARS= AUTOCONF=${AUTOCONF} \ + AUTOCONF_DIR=${AUTOCONF_DIR} \ + AUTOHEADER=${AUTOHEADER} \ + AUTOIFNAMES=${AUTOIFNAMES} \ + AUTOM4TE=${AUTOM4TE} \ + AUTORECONF=${AUTORECONF} \ + AUTOSCAN=${AUTOSCAN} \ + AUTOUPDATE=${AUTOUPDATE} \ + AUTOCONF_VERSION=${AUTOCONF_VERSION} + +AUTOCONF_DEPENDS= ${AUTOCONF}:${PORTSDIR}/${AUTOCONF_PORT} +BUILD_DEPENDS+= ${AUTOCONF_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# libltdl +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_libltdl) +LIB_DEPENDS+= ltdl.7:${PORTSDIR}/devel/libltdl +.endif + +#--------------------------------------------------------------------------- +# libtool/libtoolize +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_libtool) || defined(_AUTOTOOL_libtoolize) +LIBTOOL_VERSION= 2.4 +LIBTOOL_PORT= devel/libtool + +. if defined(_AUTOTOOL_libtool) && ${_AUTOTOOL_libtool} == "yes" +_AUTOTOOL_rule_libtool= yes +GNU_CONFIGURE?= yes +. endif +. if defined(_AUTOTOOL_libtoolize) && ${_AUTOTOOL_libtoolize} == "yes" +_AUTOTOOL_rule_libtoolize= yes +GNU_CONFIGURE?= yes +. endif + +.endif + +.if defined(LIBTOOL_VERSION) +LIBTOOL= ${LOCALBASE}/bin/libtool +LIBTOOLIZE= ${LOCALBASE}/bin/libtoolize +LIBTOOL_LIBEXECDIR= ${LOCALBASE}/libexec/libtool +LIBTOOL_SHAREDIR= ${LOCALBASE}/share/libtool +LIBTOOL_M4= ${LOCALBASE}/share/aclocal/libtool.m4 +LTMAIN= ${LOCALBASE}/share/libtool/config/ltmain.sh + +LIBTOOL_VARS= LIBTOOL=${LIBTOOL} \ + LIBTOOLIZE=${LIBTOOLIZE} \ + LIBTOOL_LIBEXECDIR=${LIBTOOL_LIBEXECDIR} \ + LIBTOOL_SHAREDIR=${LIBTOOL_SHAREDIR} \ + LIBTOOL_M4=${LIBTOOL_M4} \ + LTMAIN=${LTMAIN} + +LIBTOOLFLAGS?= # default to empty + +. if defined(_AUTOTOOL_rule_autoconf) || defined(_AUTOTOOL_rule_autoconf213) +LIBTOOLFILES?= aclocal.m4 +. elif defined(_AUTOTOOL_rule_libtool) +LIBTOOLFILES?= ${CONFIGURE_SCRIPT} +. endif + +LIBTOOL_DEPENDS= libtool>=2.4:${PORTSDIR}/${LIBTOOL_PORT} +BUILD_DEPENDS+= ${LIBTOOL_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# Add to the environment +#--------------------------------------------------------------------------- + +AUTOTOOLS_VARS= ${AUTOMAKE_VARS} ${AUTOCONF_VARS} ${LIBTOOL_VARS} + +.if defined(AUTOTOOLS_VARS) && !empty(AUTOTOOLS_VARS) +. for var in AUTOTOOLS CONFIGURE MAKE SCRIPTS +${var:U}_ENV+= ${AUTOTOOLS_VARS} +. endfor +.endif + +#--------------------------------------------------------------------------- +# Make targets +#--------------------------------------------------------------------------- + +.if !target(run-autotools) +.ORDER: run-autotools run-autotools-aclocal \ + patch-autotools-libtool run-autotools-autoheader \ + run-autotools-libtoolize run-autotools-autoconf \ + run-autotools-automake + +run-autotools:: run-autotools-aclocal \ + patch-autotools-libtool run-autotools-autoheader \ + run-autotools-libtoolize run-autotools-autoconf \ + run-autotools-automake +.endif + +.if !target(run-autotools-aclocal) +run-autotools-aclocal: +. if defined(_AUTOTOOL_rule_aclocal) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \ + ${ACLOCAL_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-automake) +run-autotools-automake: +. if defined(_AUTOTOOL_rule_automake) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \ + ${AUTOMAKE_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-autoconf) +run-autotools-autoconf: +. if defined(_AUTOTOOL_rule_autoconf) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \ + ${AUTOCONF_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-autoheader) +run-autotools-autoheader: +. if defined(_AUTOTOOL_rule_autoheader) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \ + ${AUTOHEADER_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-libtoolize) +run-autotools-libtoolize: +. if defined(_AUTOTOOL_rule_libtoolize) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${LIBTOOLIZE} \ + ${LIBTOOLIZE_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(patch-autotools-libtool) +patch-autotools-libtool:: +. if defined(_AUTOTOOL_rule_libtool) + @for file in ${LIBTOOLFILES}; do \ + ${REINPLACE_CMD} -e \ + "/^ltmain=/!s|\$$ac_aux_dir/ltmain.sh|${LIBTOOLFLAGS} ${LTMAIN}|g; \ + /^LIBTOOL=/s|\$$(top_builddir)/libtool|${LIBTOOL}|g" \ + ${PATCH_WRKSRC}/$$file; \ + done; +. else + @${DO_NADA} +. endif +.endif + +#--------------------------------------------------------------------------- +# Reduce patch churn by auto-substituting data from AUTOTOOLS_VARS +# into the correct places. Code shamelessly stolen from PLIST_SUB. + +AUTOTOOLSFILES?= # default to empty +AUTOTOOLS_VARS?= # empty if not already set + +.if !target(configure-autotools) +configure-autotools:: +. if ${AUTOTOOLS_VARS}!="" && ${AUTOTOOLSFILES} != "" + @for file in ${AUTOTOOLSFILES}; do \ + ${REINPLACE_CMD} ${AUTOTOOLS_VARS:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${WRKSRC}/$${file} ; \ + done +. else + @${DO_NADA} +. endif +.endif Added: soc2012/scher/par_ports/remote/Mk/bsd.cmake.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/remote/Mk/bsd.cmake.mk Tue Jun 19 07:00:01 2012 (r237931) @@ -0,0 +1,103 @@ +#-*- tab-width: 4; -*- +# ex:ts=4 +# +# USE_CMAKE - If set, this port uses cmake. +# +# CMAKE_ENV - Environment passed to cmake. +# Default: ${CONFIGURE_ENV} +# CMAKE_ARGS - Arguments passed to cmake +# Default: see below +# CMAKE_BUILD_TYPE - Type of build (cmake predefined build types). +# Projects may have their own build profiles. +# CMake supports the following types: Debug, +# Release, RelWithDebInfo and MinSizeRel. +# Debug and Release profiles respect system +# CFLAGS, RelWithDebInfo and MinSizeRel will set +# CFLAGS to "-O2 -g" and "-Os -DNDEBUG". +# Default: Release, if WITH_DEBUG is not set, +# Debug otherwise +# CMAKE_VERBOSE - Verbose build +# Default: not set +# CMAKE_OUTSOURCE - Instruct to perform an out-of-source build +# Default: not set +# CMAKE_SOURCE_PATH - Path to sourcedir for cmake +# Default: ${WRKSRC} +# CMAKE_INSTALL_PREFIX - prefix for cmake to use for installation. +# Default: ${PREFIX} +# *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 08:34: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 B613F106566C for ; Tue, 19 Jun 2012 08:34:29 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 08:34:29 +0000 Date: Tue, 19 Jun 2012 08:34:29 +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: <20120619083429.B613F106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237943 - 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: Tue, 19 Jun 2012 08:34:31 -0000 Author: scher Date: Tue Jun 19 08:34:28 2012 New Revision: 237943 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237943 Log: Merge with CVS ports tree Modified: soc2012/scher/par_ports/head/Mk/bsd.options.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.options.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.options.mk Tue Jun 19 07:34:13 2012 (r237942) +++ soc2012/scher/par_ports/head/Mk/bsd.options.mk Tue Jun 19 08:34:28 2012 (r237943) @@ -1,5 +1,5 @@ #-*- tab-width: 4; -*- -# $FreeBSD: ports/Mk/bsd.options.mk,v 1.8 2012/06/02 09:13:13 bapt Exp $ +# $FreeBSD: ports/Mk/bsd.options.mk,v 1.13 2012/06/06 11:47:29 bapt Exp $ # Global options # @@ -17,7 +17,10 @@ .if !defined(NOPORTDOCS) PORT_OPTIONS+= DOCS .endif + +.if !defined(WITHOUT_NLS) PORT_OPTIONS+= NLS +.endif # Set the default values for the global options, as defined by portmgr .if !defined(NOPORTEXAMPLES) @@ -38,12 +41,16 @@ #XXX to kill when old option framework won't be used anymore .if defined(OPTIONS) +NO_OPTIONS_SORT= yes . undef optname . for O in ${OPTIONS:S|\#|\\\#|g} opt:= ${O} . if !defined(optname) optname:= ${O} ALL_OPTIONS+= ${O} +.if !defined(OPTIONS_DEFINE) || empty(OPTIONS_DEFINE:M${O}) +OPTIONS_DEFINE+= ${O} +.endif PORT_OPTIONS+= ${O} . elif !defined(optdesc) optdesc:= ${opt} @@ -96,13 +103,13 @@ . endfor ## Set the options specified per-port (set by user in make.conf) -. for opt in ${${UNIQUENAME:U}_SET} +. for opt in ${${UNIQUENAME}_SET} PORT_OPTIONS+= ${opt} . endfor PORT_OPTIONS:= ${PORT_OPTIONS:O:u} ## Unset the options excluded per-port (set by user in make.conf) -. for opt in ${${UNIQUENAME:U}_UNSET} +. for opt in ${${UNIQUENAME}_UNSET} PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}} . endfor @@ -114,20 +121,16 @@ . include "${OPTIONSFILE}.local" . endif -# XXX(to be removed) -. if defined(OPTIONS) -. undef optname -. for O in ${OPTIONS:C/".*"//g} -. if defined(WITH_${O}) -PORT_OPTIONS+= ${O} +### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile +.for opt in ${ALL_OPTIONS} +.if defined(WITH_${opt}) +PORT_OPTIONS+= ${opt} PORT_OPTIONS:= ${PORT_OPTIONS:O:u} -. endif -. if defined(WITHOUT_${O}) -PORT_OPTIONS:= ${PORT_OPTIONS:N${O}} -. endif -. endfor -. endif -# XXX(end to be removed) +.endif +.if defined(WITHOUT_${opt}) +PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}} +.endif +.endfor ## Finish by using the options set by the port config dialog, if any . for opt in ${OPTIONS_FILE_SET} @@ -180,4 +183,4 @@ .endif . undef opt .endfor -### +### \ No newline at end of file Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 19 07:34:13 2012 (r237942) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 19 08:34:28 2012 (r237943) @@ -3351,7 +3351,8 @@ # target or not. # ################################################################ -.if (!defined(OPTIONS) || defined(CONFIG_DONE_${UNIQUENAME:U}) || \ +.if ((!defined(OPTIONS_DEFINE) && !defined(OPTIONS_SINGLE) && !defined(OPTIONS_MULTI)) \ + || defined(CONFIG_DONE_${UNIQUENAME:U}) || \ defined(PACKAGE_BUILDING) || defined(BATCH)) _OPTIONS_OK=yes .endif @@ -4811,12 +4812,12 @@ .if !target(fetch-urlall-list) fetch-urlall-list: - @LISTALL=yes ${MAKE} fetch-url-list-int + @cd ${.CURDIR} && LISTALL=yes ${MAKE} fetch-url-list-int .endif .if !target(fetch-url-list) fetch-url-list: - @${MAKE} fetch-url-list-int + @cd ${.CURDIR} && ${MAKE} fetch-url-list-int .endif # Generates patches. @@ -6302,18 +6303,39 @@ .undef opt .endif #pre-check-config -.if !target(check-config) -check-config: pre-check-config +.if !target(_check-config) +_check-config: pre-check-config .for multi in ${OPTIONS_WRONG_MULTI} @${ECHO_MSG} "====> You must check at least one option in the ${multi} multi" - @exit 1 .endfor .for single in ${OPTIONS_WRONG_SINGLE} @${ECHO_MSG} "====> You must select one and only one option from the ${single} single" - @exit 1 .endfor +.if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) +_CHECK_CONFIG_ERROR= true +.endif +.endif # _check-config + +.if !target(check-config) +check-config: _check-config +.if !empty(_CHECK_CONFIG_ERROR) + @exit 1 +.endif .endif # check-config +.if !target(sanity-config) +sanity-config: _check-config +.if !empty(_CHECK_CONFIG_ERROR) + @echo -n "Config is invalid. Re-edit? [Y/N] "; \ + read answer; \ + case $$answer in \ + [Nn]|[Nn][Oo]) \ + exit 0; \ + esac; \ + cd ${.CURDIR} && ${MAKE} config +.endif +.endif # sanity-config + .if !target(pre-config) pre-config: _COMPLETE_OPTIONS_LIST:= ${ALL_OPTIONS} @@ -6401,6 +6423,7 @@ ${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}; \ fi; \ ${RM} -f $${TMPOPTIONSFILE} + @cd ${.CURDIR} && ${MAKE} sanity-config .endif .endif # config @@ -6415,7 +6438,7 @@ .if !target(config-conditional) config-conditional: pre-config .if defined(_COMPLETE_OPTIONS_LIST) && !defined(NO_DIALOG) -. if ${_COMPLETE_OPTIONS_LIST} != "${_FILE_COMPLETE_OPTIONS_LIST}" +. if !defined(_FILE_COMPLETE_OPTIONS_LIST) || ${_COMPLETE_OPTIONS_LIST:O} != ${_FILE_COMPLETE_OPTIONS_LIST:O} @cd ${.CURDIR} && ${MAKE} config; . endif .endif @@ -6486,7 +6509,7 @@ .if !target(rmconfig) rmconfig: -.if defined(OPTIONS) && exists(${OPTIONSFILE}) +.if exists(${OPTIONSFILE}) -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \ optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ @@ -6496,7 +6519,7 @@ ${ECHO_MSG} "===> Returning to user credentials"; \ else \ ${RM} -f ${OPTIONSFILE}; \ - ${RMDIR} $${optionsdir} || return 0; \ + ${RMDIR} $${optionsdir} 2>/dev/null || return 0; \ fi .else @${ECHO_MSG} "===> No user-specified options configured for ${PKGNAME}" From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 09:26: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 9DD35106566C for ; Tue, 19 Jun 2012 09:26:05 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 09:26:05 +0000 Date: Tue, 19 Jun 2012 09:26:05 +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: <20120619092605.9DD35106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237945 - 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: Tue, 19 Jun 2012 09:26:07 -0000 Author: rudot Date: Tue Jun 19 09:26:04 2012 New Revision: 237945 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237945 Log: moving some defs Modified: soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c soc2012/rudot/sys/sys/rctl.h soc2012/rudot/sys/sys/sched.h Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Tue Jun 19 08:12:44 2012 (r237944) +++ soc2012/rudot/sys/kern/kern_racct.c Tue Jun 19 09:26:04 2012 (r237945) @@ -63,9 +63,6 @@ #ifdef RACCT -#define TDF_RACCT_PCTCPU TDF_SCHED2 -#define TDF_RACCT_RQ TDF_SCHED3 - FEATURE(racct, "Resource Accounting"); static struct mtx racct_lock; @@ -513,7 +510,7 @@ /* * This is basicly racct_set_force_locked(), but with the added * benefit that if we are over limits, we let the caller know - * via the return value. But we stil do set the resource to the + * via the return value. But we still do set the resource to the * specified amount. */ static int Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Tue Jun 19 08:12:44 2012 (r237944) +++ soc2012/rudot/sys/kern/sched_4bsd.c Tue Jun 19 09:26:04 2012 (r237945) @@ -107,10 +107,6 @@ /* flags kept in td_flags */ #define TDF_DIDRUN TDF_SCHED0 /* thread actually ran. */ #define TDF_BOUND TDF_SCHED1 /* Bound to one CPU. */ -#ifdef RACCT -#define TDF_RACCT_PCTCPU TDF_SCHED2 -#define TDF_RACCT_RQ TDF_SCHED3 -#endif /* flags kept in ts_flags */ #define TSF_AFFINITY 0x0001 /* Has a non-"full" CPU set. */ Modified: soc2012/rudot/sys/sys/rctl.h ============================================================================== --- soc2012/rudot/sys/sys/rctl.h Tue Jun 19 08:12:44 2012 (r237944) +++ soc2012/rudot/sys/sys/rctl.h Tue Jun 19 09:26:04 2012 (r237945) @@ -139,7 +139,7 @@ void rctl_rule_release(struct rctl_rule *rule); int rctl_rule_add(struct rctl_rule *rule); int rctl_rule_remove(struct rctl_rule *filter); -int rctl_enforce(struct proc *p, int resource, uint64_t amount); +int rctl_enforce(struct proc *p, int resource, int64_t amount); uint64_t rctl_get_limit(struct proc *p, int resource); uint64_t rctl_get_available(struct proc *p, int resource); const char *rctl_resource_name(int resource); Modified: soc2012/rudot/sys/sys/sched.h ============================================================================== --- soc2012/rudot/sys/sys/sched.h Tue Jun 19 08:12:44 2012 (r237944) +++ soc2012/rudot/sys/sys/sched.h Tue Jun 19 09:26:04 2012 (r237945) @@ -237,4 +237,10 @@ __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 Tue Jun 19 09:54: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 DE79D106566C for ; Tue, 19 Jun 2012 09:54:30 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 09:54:30 +0000 Date: Tue, 19 Jun 2012 09:54:30 +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: <20120619095430.DE79D106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237946 - in soc2012/scher/par_ports/head/fake_ports/with_options: . fake5 fake5a fake6 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, 19 Jun 2012 09:54:33 -0000 Author: scher Date: Tue Jun 19 09:54:30 2012 New Revision: 237946 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237946 Log: [new_feature] fake ports with dependencies and options for parallel options development Added: soc2012/scher/par_ports/head/fake_ports/with_options/ soc2012/scher/par_ports/head/fake_ports/with_options/fake5/ soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_options/fake5/pkg-descr soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/ soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/pkg-descr soc2012/scher/par_ports/head/fake_ports/with_options/fake6/ soc2012/scher/par_ports/head/fake_ports/with_options/fake6/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_options/fake6/pkg-descr Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,24 @@ +PORTNAME=fake5 +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + +WRKSRC= ${WRKDIR}/fake-1.0 + +OPTIONS_DEFINE= FAKE5_OPT1 FAKE5_OPT2 + +FAKE5_OPT1_DESC = Enable FAKE5_OPT1 support +FAKE5_OPT2_DESC = Use FAKE5_OPT2 + +.include + +do-install: + echo ${PORT_OPTIONS} + @echo "Port: "fake5" is installing now" + sleep 3; + touch ${PORTSDIR}/tmp/fake5; + +pre-clean: + rm -rf ${PORTSDIR}/tmp/fake5; + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5/pkg-descr Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/Makefile Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,30 @@ +PORTNAME=fake5a +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + + +WRKSRC= ${WRKDIR}/fake-1.0 + +OPTIONS_DEFINE= FAKE5A_OPT11 FAKE5A_OPT22 + +OPTIONS_SINGLE= SG_GROUP +OPTIONS_SINGLE_SG_GROUP= FAKE5A_OPT1 FAKE5A_OPT2 FAKE5A_OPT3 + +FAKE5A_OPT1_DESC= Some options +FAKE5A_OPT2_DESC= Enable this options +FAKE5A_OPT3_DESC= Use FAKE5A_OPT3 option + +OPTIONS_DEFAULT= FAKE5A_OPT2 + +.include + +do-install: + @echo "Port: "fake5a" is installing now" + sleep 3; \ + touch ${PORTSDIR}/tmp/fake5a; + +pre-clean: + rm -rf ${PORTSDIR}/tmp/fake5a; + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5a/pkg-descr Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake6/Makefile Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,29 @@ +PORTNAME=fake6 +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + +WRKSRC= ${WRKDIR}/fake-1.0 +FETCH_DEPENDS= ${PORTSDIR}/tmp/fake5:${PORTSDIR}/fake_ports/with_options/fake5 \ + ${PORTSDIR}/tmp/fake5a:${PORTSDIR}/fake_ports/with_options/fake5a + +NOCLEANDEPENDS= + +OPTIONS_MULTI= ML_GROUP +OPTIONS_MULTI_ML_GROUP= FAKE6_OPT1 FAKE6_OPT2 FAKE6_OPT3 + +FAKE6_OPT1_DESC= Some options +FAKE6_OPT2_DESC= Enable this options +FAKE6_OPT3_DESC= Use FAKE5A_OPT3 option + +OPTIONS_DEFAULT= FAKE6_OPT2 + +.include + +do-install: + @echo "Port: "fake6" is installing now"; \ + echo "Press any key to continue"; \ + read i + + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake6/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake6/pkg-descr Tue Jun 19 09:54:30 2012 (r237946) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Tue Jun 19 16:47: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 CED28106566C for ; Tue, 19 Jun 2012 16:47:14 +0000 (UTC) (envelope-from vchan@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 19 Jun 2012 16:47:14 +0000 Date: Tue, 19 Jun 2012 16:47:14 +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: <20120619164714.CED28106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237954 - 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, 19 Jun 2012 16:47:16 -0000 Author: vchan Date: Tue Jun 19 16:47:13 2012 New Revision: 237954 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237954 Log: Saving recent changes Modified: soc2012/vchan/gtcp/bwalex-tc-play/Makefile soc2012/vchan/gtcp/bwalex-tc-play/hdr.c soc2012/vchan/gtcp/bwalex-tc-play/io.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c soc2012/vchan/gtcp/bwalex-tc-play/tcplay.h Modified: soc2012/vchan/gtcp/bwalex-tc-play/Makefile ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/Makefile Tue Jun 19 15:15:35 2012 (r237953) +++ soc2012/vchan/gtcp/bwalex-tc-play/Makefile Tue Jun 19 16:47:13 2012 (r237954) @@ -1,5 +1,5 @@ -# either linux or dragonfly -SYSTEM?=linux +# either linux, dragonfly, or freebsd +SYSTEM?=freebsd # either openssl or gcrypt PBKDF_BACKEND?=openssl @@ -29,29 +29,13 @@ CFLAGS+= -O3 endif -ifeq (${SYSTEM}, linux) - CFLAGS+= -D_GNU_SOURCE - LIBS+= -lgcrypt -ldevmapper -luuid - SRCS+= crypto-gcrypt.c - OBJS+= crypto-gcrypt.o - ifeq (${PBKDF_BACKEND}, gcrypt) - SRCS+= pbkdf2-gcrypt.c - OBJS+= pbkdf2-gcrypt.o - endif - ifeq (${PBKDF_BACKEND}, openssl) - SRCS+= pbkdf2-openssl.c - OBJS+= pbkdf2-openssl.o - LIBS+= -lcrypto - endif -endif -ifeq (${SYSTEM}, dragonfly) LIBS+= -lcrypto -ldm -lprop SRCS+= crypto-dev.c OBJS+= crypto-dev.o SRCS+= pbkdf2-openssl.c OBJS+= pbkdf2-openssl.o -endif + program: $(CC) $(CFLAGS) -o tcplay main.c $(SRCS) $(LIBS) @@ -60,7 +44,8 @@ $(CC) -shared -Wl,-version-script=tcplay.map -o libtcplay.so tcplay_api.o $(OBJS) test: - gcc -O0 -g -L. -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop + echo $(SYSTEM) + gcc -O0 -g -L./usr/home/monty/vchan/gtcp/bwal-tc-play/ -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop clean: rm -f tcplay libtcplay.so tcplay.core *.o ktrace.out Modified: soc2012/vchan/gtcp/bwalex-tc-play/hdr.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/hdr.c Tue Jun 19 15:15:35 2012 (r237953) +++ soc2012/vchan/gtcp/bwalex-tc-play/hdr.c Tue Jun 19 16:47:13 2012 (r237954) @@ -28,12 +28,7 @@ */ #include - -#if defined(__DragonFly__) #include -#elif defined(__linux__) -#include -#endif #include #include #include Modified: soc2012/vchan/gtcp/bwalex-tc-play/io.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/io.c Tue Jun 19 15:15:35 2012 (r237953) +++ soc2012/vchan/gtcp/bwalex-tc-play/io.c Tue Jun 19 16:47:13 2012 (r237954) @@ -28,12 +28,7 @@ */ #include -#if defined(__DragonFly__) #include -#elif defined(__linux__) -#include -#include -#endif #include #include #include Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jun 19 15:15:35 2012 (r237953) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.c Tue Jun 19 16:47:13 2012 (r237954) @@ -28,11 +28,7 @@ */ #include - -#if defined(__DragonFly__) #include -#endif - #include #include #include @@ -42,13 +38,8 @@ #include #include #include -#if defined(__linux__) -#include -#include -#elif defined(__DragonFly__) #include #include -#endif #include "crc32.h" #include "tcplay.h" Modified: soc2012/vchan/gtcp/bwalex-tc-play/tcplay.h ============================================================================== --- soc2012/vchan/gtcp/bwalex-tc-play/tcplay.h Tue Jun 19 15:15:35 2012 (r237953) +++ soc2012/vchan/gtcp/bwalex-tc-play/tcplay.h Tue Jun 19 16:47:13 2012 (r237954) @@ -63,12 +63,7 @@ #endif #include - -#if defined(__DragonFly__) #include -#elif defined(__linux__) -#include -#endif struct pbkdf_prf_algo { const char *name; From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 05:23: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 A1523106566B for ; Wed, 20 Jun 2012 05:23:08 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 05:23:08 +0000 Date: Wed, 20 Jun 2012 05:23:08 +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: <20120620052308.A1523106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237969 - 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: Wed, 20 Jun 2012 05:23:10 -0000 Author: jhagewood Date: Wed Jun 20 05:23:07 2012 New Revision: 237969 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237969 Log: Modified: soc2012/jhagewood/diff/diff/diffdir.c soc2012/jhagewood/diff/diff/pathnames.h soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffdir.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffdir.c Wed Jun 20 04:11:34 2012 (r237968) +++ soc2012/jhagewood/diff/diff/diffdir.c Wed Jun 20 05:23:07 2012 (r237969) @@ -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 @@ 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) { @@ -255,8 +254,8 @@ 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 +266,7 @@ 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) { Modified: soc2012/jhagewood/diff/diff/pathnames.h ============================================================================== --- soc2012/jhagewood/diff/diff/pathnames.h Wed Jun 20 04:11:34 2012 (r237968) +++ soc2012/jhagewood/diff/diff/pathnames.h Wed Jun 20 05:23:07 2012 (r237969) @@ -23,4 +23,4 @@ #include #define _PATH_PR "/usr/bin/pr" -#define _PATH_SDIFF "/usr/bin/sdiff" +#define _PATH_SDIFF "/usr/bin/sdiff Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 20 04:11:34 2012 (r237968) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 20 05:23:07 2012 (r237969) @@ -305,6 +305,67 @@ sflag, tflag, Tflag, wflag; extern int Bflag, strip_cr, tabsize; extern int format, context, status; +diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-20 05:19:37.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) { +@@ -255,8 +254,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 +266,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/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 +++ jhagewood/diff/diff/diffreg.c 2012-06-19 05:18:57.000000000 -0400 @@ -795,3 +856,12 @@ + printf("%s %s\t%s\n", format == D_CONTEXT ? "---" : "+++", + file2, buf2); } +diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-18 03:07:38.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-20 05:22:32.000000000 -0400 +@@ -23,4 +23,4 @@ + #include + + #define _PATH_PR "/usr/bin/pr" +-#define _PATH_SDIFF "/usr/bin/sdiff" ++#define _PATH_SDIFF "/usr/bin/sdiff From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 15:37: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 0632B106564A for ; Wed, 20 Jun 2012 15:37:55 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 15:37:55 +0000 Date: Wed, 20 Jun 2012 15:37:55 +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: <20120620153755.0632B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238005 - in soc2012/aleek/beaglexm-armv6/sys: arm/conf 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: Wed, 20 Jun 2012 15:37:57 -0000 Author: aleek Date: Wed Jun 20 15:37:54 2012 New Revision: 238005 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238005 Log: Major refactoring to gptimer driver Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x 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 Wed Jun 20 14:47:39 2012 (r238004) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Wed Jun 20 15:37:54 2012 (r238005) @@ -58,7 +58,7 @@ options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC -options DEBUG +#options DEBUG # NFS support #options NFSCL Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c Wed Jun 20 14:47:39 2012 (r238004) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c Wed Jun 20 15:37:54 2012 (r238005) @@ -798,10 +798,7 @@ static int omap3_gptimer_probe(device_t dev) { - struct omap3_gptimer_softc *sc; - sc = (struct omap3_gptimer_softc *)device_get_softc(dev); - device_printf(dev, "PROBING...\n"); - printf("gptimer: PROBING...\n"); + //struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)device_get_softc(dev); if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer")) { device_set_desc(dev, "OMAP3 General Purpose Timer"); @@ -951,6 +948,6 @@ }; static devclass_t g_omap3_gptimer_devclass; -DRIVER_MODULE(omap3_gptimer, omap, g_omap3_gptimer_driver, g_omap3_gptimer_devclass, 0, 0); -MODULE_DEPEND(omap3_gptimer, ti_prcm, 1, 1, 1); +DRIVER_MODULE(omap3_gptimer, simplebus, g_omap3_gptimer_driver, g_omap3_gptimer_devclass, 0, 0); +///MODULE_DEPEND(omap3_gptimer, ti_prcm, 1, 1, 1); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Wed Jun 20 14:47:39 2012 (r238004) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Wed Jun 20 15:37:54 2012 (r238005) @@ -74,11 +74,13 @@ #define OMAP3_GPTIMER_ASSERT_LOCKED(_tmr) mtx_assert(&(_tmr)->mtx, MA_OWNED); #define OMAP3_GPTIMER_ASSERT_UNLOCKED(_tmr) mtx_assert(&(_tmr)->mtx, MA_NOTOWNED); -/* - * Data structure per Timer. +/** + * Timer driver context, allocated and stored globally, this driver is not + * intended to ever be unloaded (see g_omap3_gptimer_sc). + * */ -struct omap3_gptimer { - +struct omap3_gptimer_softc { + device_t sc_dev; /* Flags indicating current and configured status */ unsigned int flags; @@ -90,7 +92,7 @@ /* The memory resource for the timer register set */ struct resource* mem_res; - + ; /* The IRQ resource and handle (if installed) for the timer */ struct resource* irq_res; void* irq_h; @@ -106,60 +108,47 @@ /* The source clock to use */ unsigned int source; -}; - - -/** - * Timer driver context, allocated and stored globally, this driver is not - * intended to ever be unloaded (see g_omap3_gptimer_sc). - * - */ -struct omap3_gptimer_softc { - device_t sc_dev; - unsigned int sc_num_timers; - struct omap3_gptimer sc_timers[OMAP3_NUM_TIMERS]; - struct omap3_gptimer *sc_tick_timer; }; void -omap3_gptimer_intr_filter_ack(unsigned int n); +omap3_gptimer_intr_filter_ack(struct omap3_gptimer_softc *sc); static unsigned omap3_gptimer_tc_get_timecount(struct timecounter *tc); static inline uint32_t -omap3_gptimer_readl(struct omap3_gptimer *timer, bus_size_t off); +omap3_gptimer_readl(struct omap3_gptimer_softc *sc, bus_size_t off); static inline void -omap3_gptimer_writel(struct omap3_gptimer *timer, bus_size_t off, uint32_t val); +omap3_gptimer_writel(struct omap3_gptimer_softc *sc, bus_size_t off, uint32_t val); int -omap3_gptimer_activate(unsigned int n, unsigned int flags, unsigned int time_us, +omap3_gptimer_activate(struct omap3_gptimer_softc *sc, unsigned int flags, unsigned int time_us, void (*callback)(void *data), void *data); int -omap3_gptimer_start(unsigned int n); +omap3_gptimer_start(struct omap3_gptimer_softc *sc); int -omap3_gptimer_stop(unsigned int n); +omap3_gptimer_stop(struct omap3_gptimer_softc *sc); int -omap3_gptimer_get_freq(unsigned int n, uint32_t *freq); +omap3_gptimer_get_freq(struct omap3_gptimer_softc *sc, uint32_t *freq); static int omap3_calibrate_delay_loop(struct timecounter *tc); int -omap3_gptimer_set_intr_filter(unsigned int n, driver_filter_t filter); +omap3_gptimer_set_intr_filter(struct omap3_gptimer_softc *sc, driver_filter_t filter); static void omap3_gptimer_intr(void *arg); - +#if 0 static int omap3_timer_tick_intr(void *arg); - +#endif static int omap3_gptimer_probe(device_t dev); @@ -167,7 +156,8 @@ omap3_gptimer_attach(device_t dev); int -omap3_gptimer_write_count(unsigned int n, uint32_t cnt); +omap3_gptimer_write_count(struct omap3_gptimer_softc *sc, uint32_t cnt); int -omap3_gptimer_read_count(unsigned int n, uint32_t *cnt); +omap3_gptimer_read_count(struct omap3_gptimer_softc *sc, uint32_t *cnt); + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Wed Jun 20 15:37:54 2012 (r238005) @@ -0,0 +1,863 @@ + +/*- + * Copyright (c) 2012 Aleksander Dutkowski + * All rights reserved. + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Based on gptimer driver by Ben Gray + */ +#include +__FBSDID("$FreeBSD$"); + +#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 +#include +#include + +static struct omap3_gptimer_softc *g_omap3_gptimer_sc = NULL; + +static unsigned int delay_loops_per_us = 100; + + +/** + * Timer for tick counting. This is used to measure time by CPU + */ +//static struct omap3_gptimer *omap3_gptimer_tc_tmr = NULL; + +/** + * Struct used by tc_init(), to init the timecounter + */ +static struct timecounter omap3_gptimer_tc = { + /* Name of the timecounter. */ + .tc_name = "OMAP3 Timecouter", + /* + * This function reads the counter. It is not required to + * mask any unimplemented bits out, as long as they are + * constant. + */ + .tc_get_timecount = omap3_gptimer_tc_get_timecount, + .tc_poll_pps = NULL, + /* This mask should mask off any unimplemented bits. */ + .tc_counter_mask = ~0u, + /* Frequency of the counter in Hz. */ + .tc_frequency = 0, + /* + * Used to determine if this timecounter is better than + * another timecounter higher means better. Negative + * means "only use at explicit request". + */ + .tc_quality = 1000, +}; + +#define __omap3_delay(i) \ + do { \ + unsigned int cnt = (i); \ + __asm __volatile("1: subs %0, %0, 1\n" \ + " bne 1b\n" \ + : "+r" (cnt) : : "cc"); \ + } while(0) + +/** + * omap3_calibrate_delay_loop - uses the setup timecounter to configure delay + * + * This is not very scientfic, basically just use the timecount to measure the + * time to do 1000 delay loops (for loop with 1024 loops). + * + * + */ +static int +omap3_calibrate_delay_loop(struct timecounter *tc) +{ + u_int oldirqstate; + unsigned int start, end; + uint64_t nanosecs; + + /* Disable interrupts to ensure they don't mess up the calculation */ + oldirqstate = disable_interrupts(I32_bit); + + start = omap3_gptimer_tc_get_timecount(tc); + //__omap3_delay(10240); + for (int usec=10240; usec > 0; usec--) + for (int32_t counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + + end = omap3_gptimer_tc_get_timecount(tc); + + restore_interrupts(oldirqstate); + + /* Calculate the number of loops in 1us */ + nanosecs = ((uint64_t)(end - start) * 1000000000ULL) / tc->tc_frequency; + delay_loops_per_us = (unsigned int)((uint64_t)(10240 * 1000) / nanosecs); + + printf("OMAP3: delay loop calibrated to %u cycles\n", delay_loops_per_us); + + return (0); +} + + +static unsigned +omap3_gptimer_tc_get_timecount(struct timecounter *tc) +{ + uint32_t count; + omap3_gptimer_read_count(g_omap3_gptimer_sc, &count); + return(count); + +} + +/** + * omap3_gptimer_read_count - reads the current timer value + * @n: the number of the timer (first timer is number 1) + * @cnt: + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_read_count(struct omap3_gptimer_softc *sc, uint32_t *cnt) +{ + int ret; + + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + + /* Get a pointer to the individual sc struct */ + + OMAP3_GPTIMER_LOCK(sc); + + if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) { + ret = EINVAL; + } else { + *cnt = omap3_gptimer_readl(sc, OMAP3_GPT_TCRR); + ret = 0; + } + + OMAP3_GPTIMER_UNLOCK(sc); + + return (ret); +} + + +/** + * omap3_gptimer_write_count - writes a value into the current count + * @n: the number of the timer (first timer is number 1) + * @cnt: the value to put in the count register + * + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_write_count(struct omap3_gptimer_softc *sc, uint32_t cnt) +{ + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + + if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) + return (EINVAL); + + OMAP3_GPTIMER_LOCK(sc); + + omap3_gptimer_writel(sc, OMAP3_GPT_TCRR, cnt); + + OMAP3_GPTIMER_UNLOCK(sc); + + return (0); +} + + +/** + * omap3_gptimer_readl - reads a 32-bit value from one of the timer registers + * @timer: Timer device context + * @off: The offset of a register from the timer register address range + * + * + * RETURNS: + * 32-bit value read from the register. + */ +static inline uint32_t +omap3_gptimer_readl(struct omap3_gptimer_softc *sc, bus_size_t off) +{ + return (bus_read_4(sc->mem_res, off)); +} + +/** + * omap3_gptimer_writel - writes a 32-bit value to one of the timer registers + * @timer: Timer device context + * @off: The offset of a register from the timer register address range + * @val: The value to write into the register + * + * + * RETURNS: + * nothing + */ +static inline void +omap3_gptimer_writel(struct omap3_gptimer_softc *sc, bus_size_t off, uint32_t val) +{ + bus_write_4(sc->mem_res, off, val); +} + +/** + * omap_gptimer_get_freq - gets the frequency of an activated timer + * @n: the number of the timer (first timer is number 1) + * @freq: unpon return will contain the current freq + * + * The timer must be activated, if not this function will return EINVAL. + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_get_freq(struct omap3_gptimer_softc *sc, uint32_t *freq) +{ + unsigned int src_freq; + unsigned int tmr_freq; + unsigned int prescaler; + uint32_t tclr, tldr; + int rc; + + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + if (freq == NULL) + return (EINVAL); + + /* Get a pointer to the individual timer struct */ + if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) + return (EINVAL); + + /* We get the frequency by first reading the source frequency */ + if ((rc = ti_prcm_clk_get_source_freq(sc->source, &src_freq)) != 0) + return (rc); + + + OMAP3_GPTIMER_LOCK(sc); + + /* Determine if the pre-scalar is enabled and if so the prescaler value */ + tclr = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + if (tclr & TCLR_PRE) + prescaler = 1UL << (((tclr & TCLR_PTV_MASK) >> 2) + 1); + else + prescaler = 1; + + /* Get the reload count */ + tldr = omap3_gptimer_readl(sc, OMAP3_GPT_TLDR); + + OMAP3_GPTIMER_UNLOCK(sc); + + + /* Calculate the tick freq */ + tmr_freq = (src_freq / prescaler); + + /* If auto-reload mode is set and the reload count is not zero then the + * frequency is the period between overflows. + */ + if ((tclr & TCLR_AR) && (tldr != 0x00000000)) { + tmr_freq /= ((0xffffffff - tldr) + 1); + } + + + if (freq != NULL) + *freq = tmr_freq; + + return (0); +} + + + +/** + * omap3_gptimer_activate - configures the timer + * @n: the number of the timer (first timer is number 1) + * @flags: defines the type of timer to turn on + * @time_ns: the period of the timer in nanoseconds + * @callback: if defined this function will be called when the timer overflows + * @data: data value to pass to the callback + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_activate(struct omap3_gptimer_softc *sc, unsigned int flags, unsigned int time_us, + void (*callback)(void *data), void *data) +{ + uint32_t val; + uint64_t tickcount; + unsigned int freq; + uint64_t freq64; + uint32_t prescaler; + uint32_t startcount; + + + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + + /* Sanity check the timer is availabe and not activated */ + if (!(sc->flags & OMAP3_GPTIMER_AVAILABLE_FLAG)) { + device_printf(sc->sc_dev, "Error: timer not available\n"); + return (EINVAL); + } + if (sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG) { + device_printf(sc->sc_dev, "Error: timer already activated\n"); + return (EINVAL); + } + + /* Set up system clock information */ + if (ti_prcm_clk_valid(sc->source) != 0) { + device_printf(sc->sc_dev, "Error: failed to find source clock\n"); + return (EINVAL); + } + + OMAP3_GPTIMER_LOCK(sc); + + /* Enable the functional and interface clock */ + if (flags & OMAP3_GPTIMER_32KCLK_FLAG) + ti_prcm_clk_set_source(sc->source, F32KHZ_CLK); + else + ti_prcm_clk_set_source(sc->source, SYSCLK_CLK); + + ti_prcm_clk_enable(sc->source); + + + /* Store the flags in the timer context */ + sc->flags &= 0xFF000000; + sc->flags |= (0x00FFFFFF & flags); + + + /* Reset the timer and poll on the reset complete flag */ + if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { + omap3_gptimer_writel(sc, OMAP3_GPT_TIOCP_CFG, 0x2); + /* TODO: add a timeout */ + while ((omap3_gptimer_readl(sc, OMAP3_GPT_TISTAT) & 0x01) == 0x00) + continue; + + /* Clear the interrupt status */ + omap3_gptimer_writel(sc, OMAP3_GPT_TISR, TCAR | OVF | MAT); + } + + /* If the user supplied a zero value we set a free running timer */ + if (time_us == 0) { + /* Set the initial value and roll over value to 0 */ + startcount = 0x00000000; + } else { + /* We need to calculate the number of timer ticks in either the reload + * value (for periodic timers) or the overflow + */ + ti_prcm_clk_get_source_freq(sc->source, &freq); + freq64 = freq; + + /* Calculate the period of the timer, 64 bit calculations used to + * prevent rollover. + */ + tickcount = (freq64 * (uint64_t)time_us) / 1000000; + + /* Must have a count of at least 1 */ + if (tickcount == 0) + tickcount = 1; + + /* If the number is too large then see if by enabling the prescaler it + * will fit, otherwise just set the max count we can do. + */ + if (tickcount > 0xFFFFFFFFULL) { + + /* Try and find a prescaler that will match */ + for (prescaler = 0; prescaler < 7; prescaler++) { + if (tickcount < (0x1ULL << (32 + prescaler))) { + break; + } + } + + /* Adjust the count and apply the prescaler */ + tickcount >>= (prescaler + 1); + + val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val &= ~TCLR_PTV_MASK; + val |= TCLR_PRE | (prescaler << 2); + omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + } + + /* Calculate the start value */ + startcount = 0xFFFFFFFFUL - (uint32_t)(tickcount & 0xFFFFFFFFUL); + + printf("[BRG] %s, %d : freq64=%llu : tickcount=%llu : startcount=%u : time_us=%u\n", + __func__, __LINE__, freq64, tickcount, startcount, time_us); + } + + /* Load the start value into the count register */ + omap3_gptimer_writel(sc, OMAP3_GPT_TCRR, startcount); + + /* Enable autoload mode if configuring a periodic timer or system tick + * timer. Also set the reload count to match the period tick count. + */ + if (flags & OMAP3_GPTIMER_PERIODIC_FLAG) { + /* Enable auto reload */ + val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val |= TCLR_AR; + omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + + /* Set the reload value */ + omap3_gptimer_writel(sc, OMAP3_GPT_TLDR, startcount); + } + + /* If a callback function has been supplied setup a overflow interrupt */ + if (callback != NULL) { + + /* Save the callback function and the data for it */ + sc->callback = callback; + sc->callback_data = data; + + /* Activate the interrupt */ + if (bus_setup_intr(sc->sc_dev, sc->irq_res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, omap3_gptimer_intr, + (void*)sc, &sc->irq_h)) { + device_printf(sc->sc_dev, "Error: failed to activate interrupt\n"); + } + + /* Enable the overflow interrupts. */ + if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { + val = omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + val |= OVF; + omap3_gptimer_writel(sc, OMAP3_GPT_TIER, val); + } + } + + /* Finally set the activated flag */ + sc->flags |= OMAP3_GPTIMER_ACTIVATED_FLAG; + + OMAP3_GPTIMER_UNLOCK(sc); + + printf("[BRG] %s, %d\n", __func__, __LINE__); + + return (0); +} + +/** + * omap3_gptimer_start - starts a one-shot or periodic timer + * @n: the number of the timer (first timer is number 1) + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +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 = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val |= TCLR_ST; + omap3_gptimer_writel(sc, 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) + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_stop(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 = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val &= ~TCLR_ST; + omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + + OMAP3_GPTIMER_UNLOCK(sc); + + return 0; +} + +/** + * omap3_gptimer_set_intr_filter - sets a filter + * @n: the number of the timer (first timer is number 1) + * + * + * RETURNS: + * Returns 0 on success, otherwise an error code + */ +int +omap3_gptimer_set_intr_filter(struct omap3_gptimer_softc *sc, driver_filter_t filter) +{ + uint32_t val; + + /* Sanity checks */ + if (sc == NULL) + return (ENOMEM); + + OMAP3_GPTIMER_LOCK(sc); + + /* If a callback is already installed this won't work */ + if (sc->callback != NULL) { + OMAP3_GPTIMER_UNLOCK(sc); + return(EINVAL); + } + + /* Sanity check the timer is already activated and periodic type */ + if ((sc->flags & (OMAP3_GPTIMER_ACTIVATED_FLAG | OMAP3_GPTIMER_PERIODIC_FLAG)) + != (OMAP3_GPTIMER_ACTIVATED_FLAG | OMAP3_GPTIMER_PERIODIC_FLAG)) { + OMAP3_GPTIMER_UNLOCK(sc); + return(EINVAL); + } + + + /* Attempt to activate the interrupt for the tick */ + if (bus_setup_intr(sc->sc_dev, sc->irq_res, INTR_TYPE_CLK, + filter, NULL, NULL, &sc->irq_h)) { + device_printf(sc->sc_dev, "Error: failed to activate interrupt\n"); + OMAP3_GPTIMER_UNLOCK(sc); + return(EINVAL); + } + + + /* Enable the overflow interrupts */ + if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { + val = omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + val |= OVF; + omap3_gptimer_writel(sc, OMAP3_GPT_TIER, val); + } + + OMAP3_GPTIMER_UNLOCK(sc); + + return(0); +} + +/** + * omap3_gptimer_intr_filter_ack - acknowledges a timer interrupt + * @n: the number of the timer (first timer is number 1) + * + * This function should only be called from filter interrupt handler installed + * by calling the omap_gptimer_set_intr_filter() function. + * + * RETURNS: + * Nothing + */ +void +omap3_gptimer_intr_filter_ack(struct omap3_gptimer_softc *sc) +{ + uint32_t stat; + + OMAP3_GPTIMER_LOCK(sc); + + /* Read the interrupt status flag and clear it */ + /* Read the status and it with the enable flag */ + stat = omap3_gptimer_readl(sc, OMAP3_GPT_TISR); + stat &= omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + + /* Clear the status flag */ + omap3_gptimer_writel(sc, OMAP3_GPT_TISR, stat); + OMAP3_GPTIMER_UNLOCK(sc); +} + + + +/** + * cpu_initclocks - function called by the system in init the tick clock/timer + * + * This is where both the timercount and system ticks timer are started. + * + * RETURNS: + * nothing + */ +void +cpu_initclocks(void) +{ + cpu_initclocks_bsp(); +} + +/** + * DELAY - Delay for at least N microseconds. + * @n: number of microseconds to delay by + * + * This function is called all over the kernel and is suppose to provide a + * consistent delay. It is a busy loop and blocks polling a timer when called. + * + * RETURNS: + * nothing + */ +void +DELAY(int usec) +{ + int32_t counts; + //uint32_t first, last; + + if (g_omap3_gptimer_sc == NULL) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + return; + } +} + +static void +omap3_gptimer_intr(void *arg) +{ + struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)arg; + void (*callback)(void *data); + void* callback_data; + uint32_t stat = 0x0000; + + OMAP3_GPTIMER_LOCK(sc); + + /* Read the interrupt status flag and clear it */ + if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { + + /* Read the status and it with the enable flag */ + stat = omap3_gptimer_readl(sc, OMAP3_GPT_TISR); + stat &= omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + + /* Clear the status flag */ + omap3_gptimer_writel(sc, OMAP3_GPT_TISR, stat); + } + + /* Store the callback details before releasing the lock */ + callback = sc->callback; + callback_data = sc->callback_data; + + OMAP3_GPTIMER_UNLOCK(sc); + + /* Check if an actual overflow interrupt */ + if ((stat & OVF) && (callback != NULL)) + callback(sc->callback_data); +} + +/** + * omap3_clk_intr - interrupt handler for the tick timer (GPTIMER10) + * @arg: the trapframe, needed for the hardclock system function. + * + * This interrupt is triggered every hz times a second. It's role is basically + * to just clear the interrupt status and set it up for triggering again, plus + * tell the system a tick timer has gone off by calling the hardclock() + * function from the kernel API. + * + * RETURNS: + * Always returns FILTER_HANDLED. + */ +#if 0 +static int +omap3_timer_tick_intr(void *arg) +{ + struct trapframe *frame = arg; +#if defined(OMAP3_HEARTBEAT_GPIO) + static int heartbeat_cnt = 0; +#endif + + /* Acknowledge the interrupt */ + omap3_gptimer_intr_filter_ack(TICKTIMER_GPTIMER); + + /* Heartbeat */ +#if defined(OMAP3_HEARTBEAT_GPIO) + if (heartbeat_cnt++ >= (hz/2)) { + //printf("[BRG] ** tick **\n"); + gpio_pin_toggle(OMAP3_HEARTBEAT_GPIO); + heartbeat_cnt = 0; + } +#endif + + /* Do what we came here for */ + hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + + /* Indicate we've handed the interrupt */ + return (FILTER_HANDLED); +} +#endif + + +static int +omap3_gptimer_probe(device_t dev) +{ + //struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)device_get_softc(dev); + + if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer_tc")) { + device_set_desc(dev, "OMAP3 General Purpose Timer - Tick Counter"); + return(BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +omap3_gptimer_attach(device_t dev) +{ + struct omap3_gptimer_softc *sc = device_get_softc(dev); + char name[32]; + int rid=0; // resource id for device, unique + uint32_t rev; + u_int oldirqstate; + unsigned int timer_freq; + + device_printf( dev, "Attaching the device..." ); + + + // Setup the basics + //sc->sc_dev = dev; + //sc->sc_tick_timer = NULL; + + /* First try and get the register addresses, if this fails we assume + * there are no more timers. + */ + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if(sc->mem_res == NULL) + { + device_printf(dev, "could not allocate resources\n" ); + return (ENXIO); + } + + /* Next try and get the interrupt resource, this is not fatal */ + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); //@TODO XXX Why shareable? + + /* Mutex to protect the shared data structures */ + snprintf(name, 32, "omap_gptimer_tc"); + mtx_init(&sc->mtx, device_get_nameunit(dev), name, MTX_SPIN); + + // I decided to delete support for OMAP4 timers from the original code - aleek + rev = omap3_gptimer_readl(sc, OMAP3_GPT_TIDR); + switch (rev) { + case 0x00000013: /* OMAP3 without 1ms generation */ + case 0x00000015: + case 0x00000021: /* OMAP3 with 1ms generation */ + sc->profile = OMAP_GPTIMER_PROFILE_OMAP3; + break; + break; + default: + sc->profile = OMAP_GPTIMER_PROFILE_UNKNOWN; + break; + } + + if (sc->profile == OMAP_GPTIMER_PROFILE_UNKNOWN) { + device_printf(dev, "Error: failed to determine the type of " + "GPTIMER_tc, ignoring timer (rev: 0x%08x)\n", + rev); + return (ENXIO); + } + /* 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. + */ + sc->source = GPTIMER10_CLK; // @TODO XXX fix this - the timer number shouldn't be hardcoded + + /* Finally mark the timer as available */ + sc->flags = OMAP3_GPTIMER_AVAILABLE_FLAG; + + /* setup GPTIMER10 for system ticks, and GPTIMER11 for general purpose counter */ + oldirqstate = disable_interrupts(I32_bit); + + /* Setup another 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)) { + device_printf(dev, "Error: failed to start system tick timer\n"); + } + + /* Save the system clock speed */ + omap3_gptimer_get_freq(sc, &timer_freq); + omap3_gptimer_tc.tc_frequency = timer_freq; + + /* Setup the time counter */ + tc_init(&omap3_gptimer_tc); + + /* Calibrate the delay loop */ + omap3_calibrate_delay_loop(&omap3_gptimer_tc); + + /* Restore interrupt state */ + restore_interrupts(oldirqstate); + + g_omap3_gptimer_sc = sc; + + return 0; +} + +static device_method_t g_omap3_gptimer_methods[] = { + DEVMETHOD(device_probe, omap3_gptimer_probe), + DEVMETHOD(device_attach, omap3_gptimer_attach), + {0, 0}, +}; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 16:50:51 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 722FA106564A for ; Wed, 20 Jun 2012 16:50:50 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 16:50:50 +0000 Date: Wed, 20 Jun 2012 16:50:50 +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: <20120620165050.722FA106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238010 - 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: Wed, 20 Jun 2012 16:50:51 -0000 Author: rudot Date: Wed Jun 20 16:50:49 2012 New Revision: 238010 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238010 Log: scripts for visualising and collecting pcpu usage Added: soc2012/rudot/aux/plot.gnuplot soc2012/rudot/aux/psSum.sh (contents, props changed) Added: soc2012/rudot/aux/plot.gnuplot ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/plot.gnuplot Wed Jun 20 16:50:49 2012 (r238010) @@ -0,0 +1,5 @@ +set term postscript eps enhanced color +set style line 1 lt 1 lw 1 +set xlabel "CPU percentage" +set ylabel "frequency" +plot "dataSorted.txt" using 1:2 with imp ls 1 title '' Added: soc2012/rudot/aux/psSum.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/psSum.sh Wed Jun 20 16:50:49 2012 (r238010) @@ -0,0 +1,45 @@ +FILE_UNSORTED=data.txt +FILE_SORTED=dataSorted.txt + +if [ -z "$1" ]; then + echo "Usage: $0 user" + exit 1 +else + USER=$1 +fi + +user_pcpu() +{ + ps -U "$1" -o %cpu= | awk 'BEGIN{total = 0}{total = total + $1}END{print total}' +} + +sort_results() +{ + cat $FILE_UNSORTED | tr : "\t" | sort > $FILE_SORTED + rm $FILE_UNSORTED + exit 0 +} + +trap sort_results SIGINT + +echo "Type [Ctrl + c] to exit" +echo "Scanning..." + +while : +do + PCPU=`user_pcpu "$USER"` + LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU}:"` + + 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}/ + wq + EOF + else + echo "$PCPU:1" >> $FILE_UNSORTED + fi + + sleep 1 +done From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 21:52:09 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 33B471065672 for ; Wed, 20 Jun 2012 21:52:07 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 21:52:07 +0000 Date: Wed, 20 Jun 2012 21:52:07 +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: <20120620215207.33B471065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238024 - 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: Wed, 20 Jun 2012 21:52:09 -0000 Author: jhagewood Date: Wed Jun 20 21:52:05 2012 New Revision: 238024 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238024 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diffdir.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 20 20:01:51 2012 (r238023) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 20 21:52:05 2012 (r238024) @@ -81,57 +81,57 @@ static struct option longopts[] = { + + /* + * Commented-out options are unimplemented. + */ - { "normal", no_argument, NULL, OPT_NORMAL }, - { "line-format", required_argument, NULL, OPT_LF }, - { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, -/* XXX: UNIMPLEMENTED - { "left-column", no_argument, NULL, OPT_LEFTC }, - { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, - { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, - { "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' }, + { "brief", no_argument, NULL, 'q' }, { "context", optional_argument, NULL, 'C' }, - { "ifdef", required_argument, NULL, 'D' }, - { "minimal", no_argument, NULL, 'd' }, - { "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' }, + /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ + { "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 }, + /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ + { "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' }, + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "normal", no_argument, NULL, OPT_NORMAL }, + { "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' }, + { "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 },*/ + { "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'} }; Modified: soc2012/jhagewood/diff/diff/diffdir.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffdir.c Wed Jun 20 20:01:51 2012 (r238023) +++ soc2012/jhagewood/diff/diff/diffdir.c Wed Jun 20 21:52:05 2012 (r238024) @@ -168,17 +168,16 @@ 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); @@ -190,19 +189,17 @@ 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) { Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 20 20:01:51 2012 (r238023) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 20 21:52:05 2012 (r238024) @@ -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-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 06:04:34.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-20 21:51:36.000000000 -0400 @@ -18,15 +18,13 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ @@ -57,48 +57,108 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,14 +81,14 @@ enum +@@ -84,60 +81,57 @@ enum static struct option longopts[] = { -/* XXX: UNIMPLEMENTED -+ - { "normal", no_argument, NULL, OPT_NORMAL }, +- { "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 }, -+ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, -+/* XXX: UNIMPLEMENTED -+ { "left-column", no_argument, NULL, OPT_LEFTC }, -+ { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, - { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, +- { "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 }, -@@ -105,12 +102,10 @@ static struct option longopts[] = { - /* XXX: UNIMPLEMENTED */ - { "ignore-blank-lines", no_argument, NULL, 'B' }, - { "ignore-space-change", no_argument, NULL, 'b' }, +- { "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' }, { "context", optional_argument, NULL, 'C' }, - { "ifdef", required_argument, NULL, 'D' }, - { "minimal", no_argument, NULL, 'd' }, +- { "ifdef", required_argument, NULL, 'D' }, +- { "minimal", no_argument, NULL, 'd' }, -/* XXX: UNIMPLEMENTED - { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ -+ { "ignore-tab-expansion", no_argument, NULL, 'E' }, { "ed", no_argument, NULL, 'e' }, - /* XXX: UNIMPLEMENTED - { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +124,6 @@ static struct option longopts[] = { +-/* 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' }, ++ /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ ++ { "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 }, ++ /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ ++ { "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' }, ++ { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, ++ { "normal", no_argument, NULL, OPT_NORMAL }, ++ { "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' }, +- { "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 },*/ ++ { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, - /* XXX: UNIMPLEMENTED +-/* 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'} + }; + @@ -162,10 +156,10 @@ void read_excludes_file(char *); int main(int argc, char **argv) @@ -307,7 +367,7 @@ extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c --- jhagewood/diff/diff-orig/diffdir.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-20 05:19:37.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-20 05:43:28.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -346,7 +406,56 @@ dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); if (dirlen1 >= sizeof(path1) - 1) { -@@ -255,8 +254,8 @@ slurpdir(char *path, char **bufp, int en +@@ -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) { @@ -357,7 +466,7 @@ return (strcmp(dp1->d_name, dp2->d_name)); } -@@ -267,7 +266,7 @@ dircompare(const void *vp1, const void * +@@ -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) { From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 22:03:36 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 9DCA11065670 for ; Wed, 20 Jun 2012 22:03:34 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 22:03:34 +0000 Date: Wed, 20 Jun 2012 22:03:34 +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: <20120620220334.9DCA11065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238032 - soc2012/jhagewood/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: Wed, 20 Jun 2012 22:03:36 -0000 Author: jhagewood Date: Wed Jun 20 22:03:34 2012 New Revision: 238032 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238032 Log: Modified: soc2012/jhagewood/diff/diff-test.sh Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Wed Jun 20 21:38:16 2012 (r238031) +++ soc2012/jhagewood/diff/diff-test.sh Wed Jun 20 22:03:34 2012 (r238032) @@ -16,19 +16,35 @@ # Default diff diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt -# Unified output +# --unified output diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt -# Context output +# --context output diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt -# Normal format output +# --normal format output diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt +# --brief +diff -b 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff --brief 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# --ed +diff -ed 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff -e 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# --expand-tabs +diff --expand-tabs 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff -t 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + +# --forward-ed +diff --forward-ed 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff -f 1.txt 2.txt >> ./test_outputs/gnu/diff.txt + # # Run BSD diff with various options, direct output to a file. # @@ -36,19 +52,35 @@ # Default diff ./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt -# Unified output +# --unified output ./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt ./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt -# Context output +# --context output ./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt ./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt -# Normal format output +# --normal format output ./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt ./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt ./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt +# --brief +./diff -b 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff --brief 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# --ed +./diff -ed 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff -e 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# --expand-tabs +./diff --expand-tabs 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff -t 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + +# --forward-ed +./diff --forward-ed 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff -f 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + # # Get the diff between the GNU and BSD outputs. # From owner-svn-soc-all@FreeBSD.ORG Wed Jun 20 22:17: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 EC407106566B for ; Wed, 20 Jun 2012 22:17:05 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 20 Jun 2012 22:17:05 +0000 Date: Wed, 20 Jun 2012 22:17:05 +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: <20120620221705.EC407106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238033 - soc2012/jhagewood/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: Wed, 20 Jun 2012 22:17:08 -0000 Author: jhagewood Date: Wed Jun 20 22:17:05 2012 New Revision: 238033 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238033 Log: Modified: soc2012/jhagewood/diff/diff-test.sh Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Wed Jun 20 22:03:34 2012 (r238032) +++ soc2012/jhagewood/diff/diff-test.sh Wed Jun 20 22:17:05 2012 (r238033) @@ -30,20 +30,23 @@ diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt # --brief -diff -b 1.txt 2.txt >> ./test_outputs/gnu/diff.txt -diff --brief 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff -b 1.txt 2.txt >> ./test_outputs/gnu/brief.txt +diff --brief 1.txt 2.txt >> ./test_outputs/gnu/brief.txt # --ed -diff -ed 1.txt 2.txt >> ./test_outputs/gnu/diff.txt -diff -e 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff -ed 1.txt 2.txt >> ./test_outputs/gnu/ed.txt +diff -e 1.txt 2.txt >> ./test_outputs/gnu/ed.txt # --expand-tabs -diff --expand-tabs 1.txt 2.txt >> ./test_outputs/gnu/diff.txt -diff -t 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff --expand-tabs 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt +diff -t 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt # --forward-ed -diff --forward-ed 1.txt 2.txt >> ./test_outputs/gnu/diff.txt -diff -f 1.txt 2.txt >> ./test_outputs/gnu/diff.txt +diff --forward-ed 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt +diff -f 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt + +# --help +diff --help 1.txt 2.txt >> ./test_outputs/gnu/help.txt # # Run BSD diff with various options, direct output to a file. @@ -66,21 +69,23 @@ ./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt # --brief -./diff -b 1.txt 2.txt >> ./test_outputs/bsd/diff.txt -./diff --brief 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff -b 1.txt 2.txt >> ./test_outputs/bsd/brief.txt +./diff --brief 1.txt 2.txt >> ./test_outputs/bsd/brief.txt # --ed -./diff -ed 1.txt 2.txt >> ./test_outputs/bsd/diff.txt -./diff -e 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff -ed 1.txt 2.txt >> ./test_outputs/bsd/ed.txt +./diff -e 1.txt 2.txt >> ./test_outputs/bsd/ed.txt # --expand-tabs -./diff --expand-tabs 1.txt 2.txt >> ./test_outputs/bsd/diff.txt -./diff -t 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff --expand-tabs 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt +./diff -t 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt # --forward-ed -./diff --forward-ed 1.txt 2.txt >> ./test_outputs/bsd/diff.txt -./diff -f 1.txt 2.txt >> ./test_outputs/bsd/diff.txt +./diff --forward-ed 1.txt 2.txt >> ./test_outputs/bsd/foward-ed.txt +./diff -f 1.txt 2.txt >> ./test_outputs/bsd/forward-ed.txt +# --help +diff --help 1.txt 2.txt >> ./test_outputs/bsd/help.txt # # Get the diff between the GNU and BSD outputs. # From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 08:36: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 56B28106566B for ; Thu, 21 Jun 2012 08:36:50 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 08:36:50 +0000 Date: Thu, 21 Jun 2012 08:36: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: <20120621083650.56B28106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238050 - 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: Thu, 21 Jun 2012 08:36:52 -0000 Author: scher Date: Thu Jun 21 08:36:49 2012 New Revision: 238050 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238050 Log: [new_feature] ${PORT_DBDIR} locking [new_feature] redesign of OPTIONS checking OPTIONS are configured recursively for port and it's dependencies on non-parallel stages, before each of the default targets (pkg, fetch, extract, patch, configure, build, install, package and check-sanity). While configuring OPTIONS ${PORT_DBDIR} is locked, thus only one configuration per time may be implemented. Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 21 07:48:14 2012 (r238049) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 21 08:36:49 2012 (r238050) @@ -143,6 +143,7 @@ LOCK_DIR= /var/db/portlocks _parv_PKG_DBDIR_LOCK_FILE= .lock +_parv_PORT_DBDIR_LOCK_FILE= .lock _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} _parv_WAIT_FOR_LOCK_TIME?= 5 @@ -156,11 +157,12 @@ _parv_MAKE_LOCK_EXIT_STATUS= 158 -.for _lock_dir in PKG_DBDIR LOCK_DIR +.for _lock_dir in PKG_DBDIR PORT_DBDIR LOCK_DIR # ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR} # _parv_PKG_DBDIR_LOCK_SEQ # _parv_LOCK_DIR_LOCK_SEQ +# _parv_PORT_DBDIR_LOCK_SEQ # # Senquence of commands to lock a directory using ${_parv_${_lock_dir}_LOCK_FILE}. # During evaluation of the following commands lockf(1) is holding lock on @@ -177,6 +179,7 @@ ${CHMOD} ${_parv_UMASK} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \ if [ $${pid} ]; then \ + [ $${pid} -eq ${.MAKE.PID} ] && exit 0; \ ps -p $${pid} > /dev/null && status=$$? || status=$$?; \ if [ $${status} -eq 0 ]; then \ if [ ${_lock_dir} = "LOCK_DIR" ]; then \ @@ -217,6 +220,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. @@ -239,6 +243,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. @@ -279,6 +284,7 @@ # _parv_PKG_DBDIR_DO_UNLOCK # _parv_LOCK_DIR_DO_UNLOCK +# _parv_PORT_DBDIR_DO_UNLOCK # _parv_${_lock_dir}_DO_UNLOCK= \ lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} ${SH} -c '{ \ @@ -356,6 +362,26 @@ # End of Locking variables and tools section ##################################################### +locking-config-recursive: locking-config-message lock-port-dbdir config-conditional config-recursive unlock-port-dbdir + +locking-config-message: + @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; + +config-recursive: + @for dir in $$(${ALL-DEPENDS-LIST}); do \ + while true; do \ + ( cd $$dir; ${MAKE} config-conditional ) || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ + sleep ${_parv_LOCK_ATTEMPT_TIMEOUT}; \ + continue; \ + else \ + exit 1; \ + fi; \ + }; \ + break; \ + done; \ + done check-lock: @( pkg_name=${PKGNAME}; ${_parv_CHECK_LOCK} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; } @@ -388,9 +414,15 @@ fi .endif +lock-port-dbdir: + @attempts=-1; ${_parv_PORT_DBDIR_LOCK_LOOP} + lock-pkg-dbdir: @attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} +unlock-port-dbdir: + @${_parv_PORT_DBDIR_DO_UNLOCK} + unlock-pkg-dbdir: @${_parv_PKG_DBDIR_DO_UNLOCK} Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 21 07:48:14 2012 (r238049) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 21 08:36:49 2012 (r238050) @@ -1171,11 +1171,21 @@ _parv_PARALLEL_BUILDS_NUMBER= 1 .endif +.if !target(lock-port-dbdir) +lock-port-dbdir: + @${DO_NADA} +.endif + .if !target(lock-pkg-dbdir) lock-pkg-dbdir: @${DO_NADA} .endif +.if !target(unlock-port-dbdir) +unlock-port-dbdir: + @${DO_NADA} +.endif + .if !target(unlock-pkg-dbdir) unlock-pkg-dbdir: @${DO_NADA} @@ -1186,6 +1196,16 @@ @${DO_NADA} .endif +.if !target(locking-config-recursive) +locking-config-recursive: + @${DO_NADA} +.endif + +.if !target(locking-config-message) +locking-config-message: + @${DO_NADA} +.endif + ############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### # @@ -4339,11 +4359,11 @@ check-categories check-makevars check-desktop-entries \ check-depends check-active-build-conflicts identify-install-conflicts check-deprecated \ check-vulnerable check-license check-config buildanyway-message \ - options-message + options-message locking-config-recursive -_PKG_DEP= check-sanity +_PKG_DEP= check-sanity locking-config-recursive _PKG_SEQ= pkg-depends -_FETCH_DEP= pkg +_FETCH_DEP= pkg locking-config-recursive _FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ do-fetch post-fetch post-fetch-script _EXTRACT_DEP= fetch @@ -4400,7 +4420,7 @@ .if !target(${target}) && defined(_OPTIONS_OK) ${target}: ${${target:U}_COOKIE} .elif !target(${target}) -${target}: config-conditional +${target}: locking-config-recursive config-conditional @cd ${.CURDIR} && ${MAKE} CONFIG_DONE_${UNIQUENAME:U}=1 ${${target:U}_COOKIE} .elif target(${target}) && defined(IGNORE) .endif From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 12:24: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 DBA8810656DF for ; Thu, 21 Jun 2012 12:24:15 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 12:24:15 +0000 Date: Thu, 21 Jun 2012 12:24:15 +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: <20120621122415.DBA8810656DF@hub.freebsd.org> Cc: Subject: socsvn commit: r238078 - in soc2012/aleek/beaglexm-armv6/sys: 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: Thu, 21 Jun 2012 12:24:18 -0000 Author: aleek Date: Thu Jun 21 12:24:14 2012 New Revision: 238078 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238078 Log: added event timer Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 11:39:56 2012 (r238077) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 12:24:14 2012 (r238078) @@ -114,9 +114,6 @@ void omap3_gptimer_intr_filter_ack(struct omap3_gptimer_softc *sc); -static unsigned -omap3_gptimer_tc_get_timecount(struct timecounter *tc); - static inline uint32_t omap3_gptimer_readl(struct omap3_gptimer_softc *sc, bus_size_t off); @@ -137,18 +134,15 @@ int omap3_gptimer_get_freq(struct omap3_gptimer_softc *sc, uint32_t *freq); -static int -omap3_calibrate_delay_loop(struct timecounter *tc); - int omap3_gptimer_set_intr_filter(struct omap3_gptimer_softc *sc, driver_filter_t filter); static void omap3_gptimer_intr(void *arg); -#if 0 + static int omap3_timer_tick_intr(void *arg); -#endif + static int omap3_gptimer_probe(device_t dev); @@ -161,3 +155,6 @@ int omap3_gptimer_read_count(struct omap3_gptimer_softc *sc, uint32_t *cnt); +static unsigned +omap3_gptimer_tc_get_timecount(struct timecounter *tc); + Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Thu Jun 21 11:39:56 2012 (r238077) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Thu Jun 21 12:24:14 2012 (r238078) @@ -3,6 +3,7 @@ arm/ti/aintc.c standard arm/ti/am37x/am37x_prcm.c standard arm/ti/am37x/am37x_gptimer_tc.c standard +#arm/ti/am37x/am37x_gptimer_et.c standard arm/ti/am37x/am37x_scm_padconf.c standard arm/ti/ti_edma3.c standard arm/ti/ti_mmchs.c optional mmc Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Thu Jun 21 11:39:56 2012 (r238077) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Thu Jun 21 12:24:14 2012 (r238078) @@ -110,8 +110,8 @@ interrupt-parent = <&AINTC>; }; */ - gptimer_tc@48086000 { - compatible = "ti,omap3_gptimer_tc"; + gptimer_et@48086000 { + compatible = "ti,omap3_gptimer_et"; #address-cells = <1>; #size-cells = <1>; reg = < 0x48086000 0x1000 >; @@ -119,6 +119,15 @@ interrupt-parent = <&AINTC>; }; + gptimer_tc@48088000 { + compatible = "ti,omap3_gptimer_tc"; + #address-cells = <1>; + #size-cells = <1>; + reg = < 0x48088000 0x1000 >; + interrupts = < 47 >; + interrupt-parent = <&AINTC>; + }; + uart0: serial@49020000 { compatible = "ns16550"; reg = <0x49020000 0x1000>; From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 13:23: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 CA9E31065670 for ; Thu, 21 Jun 2012 13:23:44 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 13:23:44 +0000 Date: Thu, 21 Jun 2012 13:23:44 +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: <20120621132344.CA9E31065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238085 - in soc2012/gmiller/locking-head: . lib 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: Thu, 21 Jun 2012 13:23:46 -0000 Author: gmiller Date: Thu Jun 21 13:23:44 2012 New Revision: 238085 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238085 Log: r237899@FreeBSD-dev: root | 2012-06-19 01:41:59 -0500 Add libwitness to the build. Added: soc2012/gmiller/locking-head/lib/libwitness/ soc2012/gmiller/locking-head/lib/libwitness/Makefile soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/Makefile Modified: soc2012/gmiller/locking-head/lib/Makefile ============================================================================== --- soc2012/gmiller/locking-head/lib/Makefile Thu Jun 21 12:52:15 2012 (r238084) +++ soc2012/gmiller/locking-head/lib/Makefile Thu Jun 21 13:23:44 2012 (r238085) @@ -115,6 +115,7 @@ ${_libusbhid} \ ${_libusb} \ ${_libvgl} \ + libwitness \ libwrap \ liby \ libz \ Added: soc2012/gmiller/locking-head/lib/libwitness/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/Makefile Thu Jun 21 13:23:44 2012 (r238085) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include + +LIB= witness +SHLIB_MAJOR= 1 +SRCS= wrappers.c +DPADD= ${LIBTHR} +LDADD= -lthr + +CSTD?= c99 +WARNS?= 6 + +.include Added: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 21 13:23:44 2012 (r238085) @@ -0,0 +1 @@ + From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 15:37: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 970C0106564A for ; Thu, 21 Jun 2012 15:37:37 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 15:37:37 +0000 Date: Thu, 21 Jun 2012 15:37:37 +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: <20120621153737.970C0106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238093 - in soc2012/aleek/beaglexm-armv6/sys/arm: conf 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: Thu, 21 Jun 2012 15:37:39 -0000 Author: aleek Date: Thu Jun 21 15:37:36 2012 New Revision: 238093 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238093 Log: modified Event Timer Clock. Still not working Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Thu Jun 21 14:55:35 2012 (r238092) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Thu Jun 21 15:37:36 2012 (r238093) @@ -49,6 +49,8 @@ # Debugging makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +#makeoptions WERROR="-Werror" +#makeoptions WERROR="" options BREAK_TO_DEBUGGER #options VERBOSE_SYSINIT #Enable verbose sysinit messages options KDB Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 14:55:35 2012 (r238092) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 15:37:36 2012 (r238093) @@ -144,10 +144,16 @@ omap3_timer_tick_intr(void *arg); static int -omap3_gptimer_probe(device_t dev); +omap3_gptimer_probe_tc(device_t dev); static int -omap3_gptimer_attach(device_t dev); +omap3_gptimer_attach_tc(device_t dev); + +static int +omap3_gptimer_probe_et(device_t dev); + +static int +omap3_gptimer_attach_et(device_t dev); int omap3_gptimer_write_count(struct omap3_gptimer_softc *sc, uint32_t cnt); 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 Thu Jun 21 14:55:35 2012 (r238092) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Thu Jun 21 15:37:36 2012 (r238093) @@ -64,7 +64,8 @@ #include #include -static struct omap3_gptimer_softc *g_omap3_gptimer_sc = NULL; +static struct omap3_gptimer_softc *g_omap3_gptimer_sc_tc = NULL; +static struct omap3_gptimer_softc *g_omap3_gptimer_sc_et = NULL; static unsigned int delay_loops_per_us = 100; @@ -150,7 +151,7 @@ omap3_gptimer_tc_get_timecount(struct timecounter *tc) { uint32_t count; - omap3_gptimer_read_count(g_omap3_gptimer_sc, &count); + omap3_gptimer_read_count(g_omap3_gptimer_sc_tc, &count); return(count); } @@ -175,7 +176,7 @@ /* Get a pointer to the individual sc struct */ - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) { ret = EINVAL; @@ -184,7 +185,7 @@ ret = 0; } - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return (ret); } @@ -210,11 +211,11 @@ if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) return (EINVAL); - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); omap3_gptimer_writel(sc, OMAP3_GPT_TCRR, cnt); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return (0); } @@ -285,7 +286,7 @@ return (rc); - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); /* Determine if the pre-scalar is enabled and if so the prescaler value */ tclr = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); @@ -297,7 +298,7 @@ /* Get the reload count */ tldr = omap3_gptimer_readl(sc, OMAP3_GPT_TLDR); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); /* Calculate the tick freq */ @@ -363,7 +364,7 @@ return (EINVAL); } - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); /* Enable the functional and interface clock */ if (flags & OMAP3_GPTIMER_32KCLK_FLAG) @@ -462,6 +463,7 @@ sc->callback_data = data; /* Activate the interrupt */ + printf( "bus_setup_intr(): %s:%d\n", __func__, __LINE__ ); if (bus_setup_intr(sc->sc_dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, omap3_gptimer_intr, (void*)sc, &sc->irq_h)) { @@ -479,7 +481,7 @@ /* Finally set the activated flag */ sc->flags |= OMAP3_GPTIMER_ACTIVATED_FLAG; - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); printf("[BRG] %s, %d\n", __func__, __LINE__); @@ -505,13 +507,13 @@ if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) return (EINVAL); - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); val |= TCLR_ST; omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return 0; } @@ -535,13 +537,13 @@ if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) return (EINVAL); - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); val &= ~TCLR_ST; omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return 0; } @@ -563,27 +565,28 @@ if (sc == NULL) return (ENOMEM); - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); /* If a callback is already installed this won't work */ if (sc->callback != NULL) { - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return(EINVAL); } /* Sanity check the timer is already activated and periodic type */ if ((sc->flags & (OMAP3_GPTIMER_ACTIVATED_FLAG | OMAP3_GPTIMER_PERIODIC_FLAG)) != (OMAP3_GPTIMER_ACTIVATED_FLAG | OMAP3_GPTIMER_PERIODIC_FLAG)) { - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return(EINVAL); } /* Attempt to activate the interrupt for the tick */ + printf( "bus_setup_intr(): %s:%d\n", __func__, __LINE__ ); if (bus_setup_intr(sc->sc_dev, sc->irq_res, INTR_TYPE_CLK, filter, NULL, NULL, &sc->irq_h)) { device_printf(sc->sc_dev, "Error: failed to activate interrupt\n"); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return(EINVAL); } @@ -595,7 +598,7 @@ omap3_gptimer_writel(sc, OMAP3_GPT_TIER, val); } - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); return(0); } @@ -615,7 +618,7 @@ { uint32_t stat; - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); /* Read the interrupt status flag and clear it */ /* Read the status and it with the enable flag */ @@ -624,7 +627,7 @@ /* Clear the status flag */ omap3_gptimer_writel(sc, OMAP3_GPT_TISR, stat); - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); } @@ -659,7 +662,7 @@ int32_t counts; //uint32_t first, last; - if (g_omap3_gptimer_sc == NULL) { + if (g_omap3_gptimer_sc_tc == NULL) { for (; usec > 0; usec--) for (counts = 200; counts > 0; counts--) /* Prevent gcc from optimizing out the loop */ @@ -676,7 +679,7 @@ void* callback_data; uint32_t stat = 0x0000; - OMAP3_GPTIMER_LOCK(sc); + //OMAP3_GPTIMER_LOCK(sc); /* Read the interrupt status flag and clear it */ if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { @@ -693,7 +696,7 @@ callback = sc->callback; callback_data = sc->callback_data; - OMAP3_GPTIMER_UNLOCK(sc); + //OMAP3_GPTIMER_UNLOCK(sc); /* Check if an actual overflow interrupt */ if ((stat & OVF) && (callback != NULL)) @@ -712,7 +715,6 @@ * RETURNS: * Always returns FILTER_HANDLED. */ -#if 0 static int omap3_timer_tick_intr(void *arg) { @@ -722,7 +724,7 @@ #endif /* Acknowledge the interrupt */ - omap3_gptimer_intr_filter_ack(TICKTIMER_GPTIMER); + omap3_gptimer_intr_filter_ack(g_omap3_gptimer_sc_et); /* Heartbeat */ #if defined(OMAP3_HEARTBEAT_GPIO) @@ -739,33 +741,18 @@ /* Indicate we've handed the interrupt */ return (FILTER_HANDLED); } -#endif - -static int -omap3_gptimer_probe(device_t dev) -{ - //struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)device_get_softc(dev); - if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer_tc")) { - device_set_desc(dev, "OMAP3 General Purpose Timer - Tick Counter"); - return(BUS_PROBE_DEFAULT); - } - - return (ENXIO); -} static int -omap3_gptimer_attach(device_t dev) +omap3_gptimer_attach_common(device_t dev) { struct omap3_gptimer_softc *sc = device_get_softc(dev); - char name[32]; + //char name[32]; int rid=0; // resource id for device, unique uint32_t rev; - u_int oldirqstate; - unsigned int timer_freq; - device_printf( dev, "Attaching the device..." ); + device_printf( dev, "Generic attaching the device...\n" ); // Setup the basics @@ -786,8 +773,8 @@ sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); //@TODO XXX Why shareable? /* Mutex to protect the shared data structures */ - snprintf(name, 32, "omap_gptimer_tc"); - mtx_init(&sc->mtx, device_get_nameunit(dev), name, MTX_SPIN); + //snprintf(name, 32, "omap_gptimer_tc"); + //mtx_init(&sc->mtx, device_get_nameunit(dev), name, MTX_SPIN); // I decided to delete support for OMAP4 timers from the original code - aleek rev = omap3_gptimer_readl(sc, OMAP3_GPT_TIDR); @@ -809,10 +796,36 @@ rev); return (ENXIO); } + device_printf( dev, "done!\n" ); + + return 0; +} + +static int +omap3_gptimer_probe_tc(device_t dev) +{ + //struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)device_get_softc(dev); + + if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer_tc")) { + device_set_desc(dev, "OMAP3 General Purpose Timer - Tick Counter"); + return(BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +omap3_gptimer_attach_tc(device_t dev) +{ + u_int oldirqstate; + unsigned int timer_freq; + struct omap3_gptimer_softc *sc = device_get_softc(dev); + + omap3_gptimer_attach_common(dev); /* 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. */ - sc->source = GPTIMER10_CLK; // @TODO XXX fix this - the timer number shouldn't be hardcoded + sc->source = GPTIMER11_CLK; // @TODO XXX fix this - the timer number shouldn't be hardcoded /* Finally mark the timer as available */ sc->flags = OMAP3_GPTIMER_AVAILABLE_FLAG; @@ -832,7 +845,7 @@ omap3_gptimer_tc.tc_frequency = timer_freq; /* Setup the time counter */ - tc_init(&omap3_gptimer_tc); + //tc_init(&omap3_gptimer_tc); /* Calibrate the delay loop */ omap3_calibrate_delay_loop(&omap3_gptimer_tc); @@ -840,24 +853,100 @@ /* Restore interrupt state */ restore_interrupts(oldirqstate); - g_omap3_gptimer_sc = sc; + g_omap3_gptimer_sc_tc = sc; return 0; } -static device_method_t g_omap3_gptimer_methods[] = { - DEVMETHOD(device_probe, omap3_gptimer_probe), - DEVMETHOD(device_attach, omap3_gptimer_attach), +static device_method_t g_omap3_gptimer_methods_tc[] = { + DEVMETHOD(device_probe, omap3_gptimer_probe_tc), + DEVMETHOD(device_attach, omap3_gptimer_attach_tc), {0, 0}, }; -static driver_t g_omap3_gptimer_driver = { +static driver_t g_omap3_gptimer_driver_tc = { "omap3_gptimer_tc", - g_omap3_gptimer_methods, + g_omap3_gptimer_methods_tc, sizeof(struct omap3_gptimer_softc), }; -static devclass_t g_omap3_gptimer_devclass; +static devclass_t g_omap3_gptimer_devclass_tc; + +DRIVER_MODULE(omap3_gptimer_tc, simplebus, g_omap3_gptimer_driver_tc, g_omap3_gptimer_devclass_tc, 0, 0); +MODULE_DEPEND(omap3_gptimer_tc, ti_prcm, 1, 1, 1); + + +static int +omap3_gptimer_probe_et(device_t dev) +{ + //struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)device_get_softc(dev); -DRIVER_MODULE(omap3_gptimer, simplebus, g_omap3_gptimer_driver, g_omap3_gptimer_devclass, 0, 0); -///MODULE_DEPEND(omap3_gptimer, ti_prcm, 1, 1, 1); + if (ofw_bus_is_compatible(dev, "ti,omap3_gptimer_et")) { + device_set_desc(dev, "OMAP3 General Purpose Timer - Event Timer"); + return(BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +omap3_gptimer_attach_et(device_t dev) +{ + u_int oldirqstate; + unsigned int timer_freq; + 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. + */ + sc->source = GPTIMER10_CLK; // @TODO XXX fix this - the timer number shouldn't be hardcoded + + /* Finally mark the timer as available */ + sc->flags = OMAP3_GPTIMER_AVAILABLE_FLAG; + + /* setup GPTIMER10 for system ticks, and GPTIMER11 for general purpose counter */ + oldirqstate = disable_interrupts(I32_bit); + + /* Number of microseconds between interrupts */ + unsigned int tick = 1000000 / hz; + + /* Next setup one of the timers to be the system tick timer */ + if (omap3_gptimer_activate(sc, OMAP3_GPTIMER_PERIODIC_FLAG, tick, NULL, NULL)) { + panic("Error: failed to activate system tick timer\n"); + } + + /* Setup an interrupt filter for the timer */ + if (omap3_gptimer_set_intr_filter(sc, omap3_timer_tick_intr)) + 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"); + + omap3_gptimer_get_freq(sc, &timer_freq); + device_printf(dev, "tick: timer_freq = %u\n", timer_freq); + + /* Restore interrupt state */ + restore_interrupts(oldirqstate); + + g_omap3_gptimer_sc_et = sc; + + return 0; +} + +static device_method_t g_omap3_gptimer_methods_et[] = { + DEVMETHOD(device_probe, omap3_gptimer_probe_et), + DEVMETHOD(device_attach, omap3_gptimer_attach_et), + {0, 0}, +}; + +static driver_t g_omap3_gptimer_driver_et = { + "omap3_gptimer_et", + g_omap3_gptimer_methods_et, + sizeof(struct omap3_gptimer_softc), +}; +static devclass_t g_omap3_gptimer_devclass_et; +DRIVER_MODULE(omap3_gptimer_et, simplebus, g_omap3_gptimer_driver_et, g_omap3_gptimer_devclass_et, 0, 0); +MODULE_DEPEND(omap3_gptimer_et, ti_prcm, 1, 1, 1); From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 17: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 852001065673 for ; Thu, 21 Jun 2012 17:48:29 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 17:48:29 +0000 Date: Thu, 21 Jun 2012 17:48:29 +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: <20120621174829.852001065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238101 - 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: Thu, 21 Jun 2012 17:48:30 -0000 Author: scher Date: Thu Jun 21 17:48:28 2012 New Revision: 238101 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238101 Log: [bugfix] $$(${ALL-DEPENDS-LIST}) does not reflect changes, that were made my config related targets (in case if some option add dependency port, $$(${ALL-DEPENDS-LIST}) does not show this new ped port). It is necessary to call $$(make all-depends-list) to get actual deps list, after evaluating config-conditional target. [bugfix] if some dependency port(A), while processing config related targets, add new dependecy(Z) then parent port(P) does not reflect this change and will not config this new dependency(Z). It is important to config ALL dependency ports before actual parallel build of main port(P). It is necessary to call "${MAKE} locking-config-recursive" recursively for each of the dependecy ports of main port(P) after this port(P) has already been configured. Above mentioned issues allow us to implement processing of interactive stages for some port and all dependency ports before parallel execution flow, reflecting all dynamic changes (based on options processing) in port's dependency tree. 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 Thu Jun 21 16:53:52 2012 (r238100) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 21 17:48:28 2012 (r238101) @@ -182,7 +182,7 @@ [ $${pid} -eq ${.MAKE.PID} ] && exit 0; \ ps -p $${pid} > /dev/null && status=$$? || status=$$?; \ if [ $${status} -eq 0 ]; then \ - if [ ${_lock_dir} = "LOCK_DIR" ]; then \ + if [ ${_lock_dir} = "LOCK_DIR" ] || [ ${_lock_dir} = "PORT_DBDIR" ]; then \ cur_pid=${.MAKE.PID}; \ while true; do \ ppid=$$( ps -o ppid -p $${cur_pid} | ${AWK} "NR==2" ); \ @@ -362,15 +362,16 @@ # End of Locking variables and tools section ##################################################### + locking-config-recursive: locking-config-message lock-port-dbdir config-conditional config-recursive unlock-port-dbdir locking-config-message: @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; config-recursive: - @for dir in $$(${ALL-DEPENDS-LIST}); do \ + @for dir in $$(${MAKE} all-depends-list); do \ while true; do \ - ( cd $$dir; ${MAKE} config-conditional ) || { \ + ( cd $$dir; ${MAKE} locking-config-recursive ) || { \ status=$$?; \ if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ sleep ${_parv_LOCK_ATTEMPT_TIMEOUT}; \ From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 18:59: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 7799A1065670 for ; Thu, 21 Jun 2012 18:59:39 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 18:59:39 +0000 Date: Thu, 21 Jun 2012 18:59:39 +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: <20120621185939.7799A1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238102 - 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: Thu, 21 Jun 2012 18:59:41 -0000 Author: aleek Date: Thu Jun 21 18:59:38 2012 New Revision: 238102 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238102 Log: timer is working. FreeBSD boots to mounting rootfs Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 17:48:28 2012 (r238101) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Thu Jun 21 18:59:38 2012 (r238102) @@ -126,10 +126,10 @@ void (*callback)(void *data), void *data); int -omap3_gptimer_start(struct omap3_gptimer_softc *sc); +omap3_gptimer_start(struct eventtimer *et, struct bintime *first, struct bintime *period); int -omap3_gptimer_stop(struct omap3_gptimer_softc *sc); +omap3_gptimer_stop(struct eventtimer *et); int omap3_gptimer_get_freq(struct omap3_gptimer_softc *sc, uint32_t *freq); 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 Thu Jun 21 17:48:28 2012 (r238101) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Thu Jun 21 18:59:38 2012 (r238102) @@ -44,6 +44,8 @@ #include #include #include +#include +#include #include #include @@ -100,6 +102,8 @@ .tc_quality = 1000, }; +static struct eventtimer omap3_gptimer_et; + #define __omap3_delay(i) \ do { \ unsigned int cnt = (i); \ @@ -435,7 +439,7 @@ /* Calculate the start value */ startcount = 0xFFFFFFFFUL - (uint32_t)(tickcount & 0xFFFFFFFFUL); - printf("[BRG] %s, %d : freq64=%llu : tickcount=%llu : startcount=%u : time_us=%u\n", + printf("%s, %d : freq64=%llu : tickcount=%llu : startcount=%u : time_us=%u\n", __func__, __LINE__, freq64, tickcount, startcount, time_us); } @@ -482,9 +486,6 @@ sc->flags |= OMAP3_GPTIMER_ACTIVATED_FLAG; //OMAP3_GPTIMER_UNLOCK(sc); - - printf("[BRG] %s, %d\n", __func__, __LINE__); - return (0); } @@ -497,8 +498,9 @@ * Returns 0 on success, otherwise an error code */ int -omap3_gptimer_start(struct omap3_gptimer_softc *sc) +omap3_gptimer_start(struct eventtimer *et, struct bintime *first, struct bintime *period) { + struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)et->et_priv; uint32_t val; /* Sanity checks */ @@ -527,8 +529,9 @@ * Returns 0 on success, otherwise an error code */ int -omap3_gptimer_stop(struct omap3_gptimer_softc *sc) +omap3_gptimer_stop(struct eventtimer *et) { + struct omap3_gptimer_softc *sc = (struct omap3_gptimer_softc *)et->et_priv; uint32_t val; /* Sanity checks */ @@ -748,16 +751,10 @@ omap3_gptimer_attach_common(device_t dev) { struct omap3_gptimer_softc *sc = device_get_softc(dev); - //char name[32]; int rid=0; // resource id for device, unique - uint32_t rev; - - device_printf( dev, "Generic attaching the device...\n" ); - - // Setup the basics - //sc->sc_dev = dev; - //sc->sc_tick_timer = NULL; + //device_printf( dev, "Generic attaching the device...\n" ); + sc->sc_dev = dev; /* First try and get the register addresses, if this fails we assume * there are no more timers. @@ -771,32 +768,9 @@ /* Next try and get the interrupt resource, this is not fatal */ sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); //@TODO XXX Why shareable? - - /* Mutex to protect the shared data structures */ - //snprintf(name, 32, "omap_gptimer_tc"); - //mtx_init(&sc->mtx, device_get_nameunit(dev), name, MTX_SPIN); - - // I decided to delete support for OMAP4 timers from the original code - aleek - rev = omap3_gptimer_readl(sc, OMAP3_GPT_TIDR); - switch (rev) { - case 0x00000013: /* OMAP3 without 1ms generation */ - case 0x00000015: - case 0x00000021: /* OMAP3 with 1ms generation */ sc->profile = OMAP_GPTIMER_PROFILE_OMAP3; - break; - break; - default: - sc->profile = OMAP_GPTIMER_PROFILE_UNKNOWN; - break; - } - - if (sc->profile == OMAP_GPTIMER_PROFILE_UNKNOWN) { - device_printf(dev, "Error: failed to determine the type of " - "GPTIMER_tc, ignoring timer (rev: 0x%08x)\n", - rev); - return (ENXIO); - } - device_printf( dev, "done!\n" ); + + //device_printf( dev, "done!\n" ); return 0; } @@ -836,9 +810,9 @@ /* Setup another 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); @@ -896,7 +870,7 @@ struct omap3_gptimer_softc *sc = device_get_softc(dev); omap3_gptimer_attach_common(dev); - device_printf( dev, "Timer specyfic attaching...\n" ); + //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. */ @@ -921,14 +895,26 @@ 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); /* Restore interrupt state */ restore_interrupts(oldirqstate); + omap3_gptimer_et.et_name = "AM37x EventTimer0", + omap3_gptimer_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT; + omap3_gptimer_et.et_quality = 1000; + omap3_gptimer_et.et_frequency = tick; //@todo XXX naprawic to !! + omap3_gptimer_et.et_min_period.sec = 0; + 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_stop = omap3_gptimer_stop; + omap3_gptimer_et.et_priv = &omap3_gptimer_et; + et_register( &omap3_gptimer_et ); g_omap3_gptimer_sc_et = sc; From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 19:24:58 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 6C85A106566C for ; Thu, 21 Jun 2012 19:24:56 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 19:24:56 +0000 Date: Thu, 21 Jun 2012 19:24:56 +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: <20120621192456.6C85A106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238105 - in soc2012/scher/par_ports/head/fake_ports/with_options: fake5 fake5opt 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, 21 Jun 2012 19:24:58 -0000 Author: scher Date: Thu Jun 21 19:24:55 2012 New Revision: 238105 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238105 Log: Add new fake port (fake5opt) Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/ soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/pkg-descr Modified: soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile Modified: soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile ============================================================================== --- soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile Thu Jun 21 18:28:48 2012 (r238104) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5/Makefile Thu Jun 21 19:24:55 2012 (r238105) @@ -5,13 +5,18 @@ WRKSRC= ${WRKDIR}/fake-1.0 -OPTIONS_DEFINE= FAKE5_OPT1 FAKE5_OPT2 +OPTIONS_DEFINE= FAKE5_OPT1 FAKE5_OPT2 FAKE5_FAKE5OPT +FAKE5_FAKE5OPT_DESC = Add optional port fake5opt to BUILD_DEPENDS FAKE5_OPT1_DESC = Enable FAKE5_OPT1 support FAKE5_OPT2_DESC = Use FAKE5_OPT2 .include +.if ${PORT_OPTIONS:MFAKE5_FAKE5OPT} +BUILD_DEPENDS= ${PORTSDIR}/tmp/fake5opt:${PORTSDIR}/fake_ports/with_options/fake5opt +.endif + do-install: echo ${PORT_OPTIONS} @echo "Port: "fake5" is installing now" Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/Makefile Thu Jun 21 19:24:55 2012 (r238105) @@ -0,0 +1,23 @@ +PORTNAME=fake5opt +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + +WRKSRC= ${WRKDIR}/fake-1.0 + +OPTIONS_DEFINE= FAKE5OPT_OPT1 + +FAKE5OPT_OPT1_DESC= just option + + +.include + +do-install: + @echo "Port: "fake5opt" is installing now" + sleep 3; \ + touch ${PORTSDIR}/tmp/fake5opt; + +pre-clean: + rm -rf ${PORTSDIR}/tmp/fake5opt; + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_options/fake5opt/pkg-descr Thu Jun 21 19:24:55 2012 (r238105) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Thu Jun 21 22:02: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 033331065674 for ; Thu, 21 Jun 2012 22:02:05 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 21 Jun 2012 22:02:05 +0000 Date: Thu, 21 Jun 2012 22:02:05 +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: <20120621220205.033331065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238107 - 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: Thu, 21 Jun 2012 22:02:07 -0000 Author: rudot Date: Thu Jun 21 22:02:04 2012 New Revision: 238107 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238107 Log: plotting of collected data Deleted: soc2012/rudot/aux/plot.gnuplot Modified: soc2012/rudot/aux/psSum.sh Modified: soc2012/rudot/aux/psSum.sh ============================================================================== --- soc2012/rudot/aux/psSum.sh Thu Jun 21 21:47:08 2012 (r238106) +++ soc2012/rudot/aux/psSum.sh Thu Jun 21 22:02:04 2012 (r238107) @@ -10,17 +10,47 @@ user_pcpu() { - ps -U "$1" -o %cpu= | awk 'BEGIN{total = 0}{total = total + $1}END{print total}' + ps -U "$1" -o %cpu= | awk ' + BEGIN {total = 0} + {total = total + $1} + END {print total}' } sort_results() { cat $FILE_UNSORTED | tr : "\t" | sort > $FILE_SORTED rm $FILE_UNSORTED +} + +finalize() +{ + sort_results + command -v gnuplot > /dev/null && plot_graph exit 0 } -trap sort_results SIGINT +plot_graph() +{ + XLIMITA=`echo $PCPU_MIN | awk ' + { + if (int($1) == $1) print int($1) - 1; + else print int($1) + }'` + + XLIMITB=`echo $PCPU_MAX | awk '{print int($1) + 1}'` + + gnuplot > plot.eps <<-EOF + set term postscript eps enhanced color + set style line 1 lt 1 lw 1 + set xlabel "CPU percentage" + set ylabel "frequency" + set yrange [0:] + set xrange [${XLIMITA}:${XLIMITB}] + plot "$FILE_SORTED" using 1:2 with imp ls 1 title '' + EOF +} + +trap finalize SIGINT echo "Type [Ctrl + c] to exit" echo "Scanning..." @@ -28,6 +58,19 @@ while : do PCPU=`user_pcpu "$USER"` + + [ -z "$PCPU_MIN" ] && PCPU_MIN=$PCPU + [ -z "$PCPU_MAX" ] && PCPU_MAX=$PCPU + PCPU_MIN_MAX=`echo $PCPU_MIN $PCPU_MAX $PCPU | awk ' + { + if ($1 < $3) min = $1; else min = $3; + if ($2 > $3) max = $2; else max = $3; + print min ":" max + }'` + read PCPU_MIN PCPU_MAX <<-EOF + `IFS=:; echo $PCPU_MIN_MAX` + EOF + LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU}:"` if [ -n "$LINE" ]; then From owner-svn-soc-all@FreeBSD.ORG Fri Jun 22 11:35: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 3BB1A1065673 for ; Fri, 22 Jun 2012 11:35:15 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 22 Jun 2012 11:35:15 +0000 Date: Fri, 22 Jun 2012 11:35:15 +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: <20120622113515.3BB1A1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238138 - in soc2012/aleek/beaglexm-armv6: . lib/libc lib/libc/arm lib/libc/arm/gen sys sys/arm/arm sys/arm/ti/am335x sys/boot sys/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: Fri, 22 Jun 2012 11:35:17 -0000 Author: aleek Date: Fri Jun 22 11:35:14 2012 New Revision: 238138 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238138 Log: merge with armv6 branch Modified: soc2012/aleek/beaglexm-armv6/ (props changed) soc2012/aleek/beaglexm-armv6/lib/libc/ (props changed) soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S soc2012/aleek/beaglexm-armv6/sys/ (props changed) soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_scm_padconf.c soc2012/aleek/beaglexm-armv6/sys/boot/ (props changed) soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beaglebone.dts Modified: soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map ============================================================================== --- soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map Fri Jun 22 11:35:14 2012 (r238138) @@ -70,6 +70,7 @@ __divdf3; __floatsisf; __floatsidf; + __flt_rounds; __fixsfsi; __fixdfsi; __fixunssfsi; Modified: soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S ============================================================================== --- soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S Fri Jun 22 11:35:14 2012 (r238138) @@ -39,6 +39,8 @@ #endif RET +#ifdef ARM_TP_ADDRESS .Larm_tp_address: .word ARM_TP_ADDRESS +#endif Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/sys/arm/arm/pmap-v6.c Fri Jun 22 11:35:14 2012 (r238138) @@ -809,6 +809,12 @@ ptep = &l2b->l2b_kva[l2pte_index(va)]; pte = *ptep; + cpu_idcache_wbinv_range(va, PAGE_SIZE); +#ifdef ARM_L2_PIPT + cpu_l2cache_wbinv_range(pte & L2_S_FRAME, PAGE_SIZE); +#else + cpu_l2cache_wbinv_range(va, PAGE_SIZE); +#endif if ((pte & L2_S_CACHE_MASK) != pte_l2_s_cache_mode_pt) { /* * Page tables must have the cache-mode set to Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_prcm.c Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_prcm.c Fri Jun 22 11:35:14 2012 (r238138) @@ -118,6 +118,7 @@ static struct am335x_prcm_softc *am335x_prcm_sc = NULL; static int am335x_clk_generic_activate(struct ti_clock_dev *clkdev); +static int am335x_clk_gpio_activate(struct ti_clock_dev *clkdev); static int am335x_clk_generic_deactivate(struct ti_clock_dev *clkdev); static int am335x_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); static int am335x_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); @@ -136,6 +137,15 @@ .clk_get_source_freq = NULL \ } +#define AM335X_GPIO_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = am335x_clk_gpio_activate, \ + .clk_deactivate = am335x_clk_generic_deactivate, \ + .clk_set_source = am335x_clk_generic_set_source, \ + .clk_accessible = NULL, \ + .clk_get_source_freq = NULL \ + } + #define AM335X_MMCHS_CLOCK_DEV(i) \ { .id = (i), \ .clk_activate = am335x_clk_generic_activate, \ @@ -189,10 +199,10 @@ AM335X_GENERIC_CLOCK_DEV(DMTIMER7_CLK), /* GPIO */ - AM335X_GENERIC_CLOCK_DEV(GPIO0_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO1_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO2_CLK), - AM335X_GENERIC_CLOCK_DEV(GPIO3_CLK), + AM335X_GPIO_CLOCK_DEV(GPIO0_CLK), + AM335X_GPIO_CLOCK_DEV(GPIO1_CLK), + AM335X_GPIO_CLOCK_DEV(GPIO2_CLK), + AM335X_GPIO_CLOCK_DEV(GPIO3_CLK), /* I2C */ AM335X_GENERIC_CLOCK_DEV(I2C0_CLK), @@ -361,6 +371,30 @@ } static int +am335x_clk_gpio_activate(struct ti_clock_dev *clkdev) +{ + struct am335x_prcm_softc *sc = am335x_prcm_sc; + struct am335x_clk_details* clk_details; + + if (sc == NULL) + return ENXIO; + + clk_details = am335x_clk_details(clkdev->id); + + if (clk_details == NULL) + return (ENXIO); + + /* set *_CLKCTRL register MODULEMODE[1:0] to enable(2) */ + /* set *_CLKCTRL register OPTFCLKEN_GPIO_1_G DBCLK[18] to FCLK_EN(1) */ + prcm_write_4(clk_details->clkctrl_reg, 2 | (1 << 18)); + while ((prcm_read_4(clk_details->clkctrl_reg) & + (3 | (1 << 18) )) != (2 | (1 << 18))) + DELAY(10); + + return (0); +} + +static int am335x_clk_generic_deactivate(struct ti_clock_dev *clkdev) { struct am335x_prcm_softc *sc = am335x_prcm_sc; Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_scm_padconf.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_scm_padconf.c Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am335x/am335x_scm_padconf.c Fri Jun 22 11:35:14 2012 (r238138) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -65,16 +66,22 @@ #define SLEWCTRL (0x01 << 6) /* faster(0) or slower(1) slew rate. */ #define RXACTIVE (0x01 << 5) /* Input enable value for the Pad */ #define PULLTYPESEL (0x01 << 4) /* Pad pullup/pulldown type selection */ -#define PULLUDEN (0x01 << 3) /* Pullup/pulldown enabled */ +#define PULLUDEN (0x01 << 3) /* Pullup/pulldown disabled */ + +#define PADCONF_OUTPUT (0) +#define PADCONF_OUTPUT_PULLUP (PULLTYPESEL) +#define PADCONF_INPUT (RXACTIVE | PULLUDEN) +#define PADCONF_INPUT_PULLUP (RXACTIVE | PULLTYPESEL) +#define PADCONF_INPUT_PULLDOWN (RXACTIVE) +#define PADCONF_INPUT_PULLUP_SLOW (PADCONF_INPUT_PULLUP | SLEWCTRL) const struct ti_scm_padstate ti_padstate_devmap[] = { - {"output", 0 }, - {"output_pullup", PULLTYPESEL }, - {"input", RXACTIVE }, - {"input_pulldown", RXACTIVE | PULLUDEN }, - {"input_pullup", RXACTIVE | PULLUDEN | PULLTYPESEL }, - {"input_pullup_inact", RXACTIVE | PULLTYPESEL }, - {"input_pullup_inact_slow", RXACTIVE | PULLTYPESEL | SLEWCTRL }, + {"output", PADCONF_OUTPUT }, + {"output_pullup", PADCONF_OUTPUT_PULLUP }, + {"input", PADCONF_INPUT }, + {"input_pulldown", PADCONF_INPUT_PULLDOWN }, + {"input_pullup", PADCONF_INPUT_PULLUP }, + {"i2c", PADCONF_INPUT_PULLUP_SLOW }, { .state = NULL } }; @@ -101,10 +108,12 @@ _PIN(0x848, "gpmc_a2", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x84C, "gpmc_a3", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x850, "gpmc_a4", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x854, "gpmc_a5", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x858, "gpmc_a6", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x85C, "gpmc_a7", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x860, "gpmc_a8", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +#endif + _PIN(0x854, "GPMC_A5", 53, 7, "gpmc_a5", "gmii2_txd0", "rgmii2_td0", "rmii2_txd0", "gpmc_a21", "pr1_mii1_rxd3", "eQEP1B_in", "gpio1_21"), + _PIN(0x858, "GPMC_A6", 54, 7, "gpmc_a6", "gmii2_txclk", "rgmii2_tclk", "mmc2_dat4", "gpmc_a22", "pr1_mii1_rxd2", "eQEP1_index", "gpio1_22"), + _PIN(0x85C, "GPMC_A7", 55, 7, "gpmc_a7", "gmii2_rxclk", "rgmii2_rclk", "mmc2_dat5", "gpmc_a23", "pr1_mii1_rxd1", "eQEP1_strobe", "gpio1_23"), + _PIN(0x860, "GPMC_A8", 56, 7, "gpmc_a8", "gmii2_rxd3", "rgmii2_rd3", "mmc2_dat6", "gpmc_a24", "pr1_mii1_rxd0", "mcasp0_aclkx", "gpio1_24"), +#if 0 _PIN(0x864, "gpmc_a9", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x868, "gpmc_a10", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x86C, "gpmc_a11", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), @@ -178,8 +187,10 @@ _PIN(0x96c, "uart0_rtsn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x970, "uart0_rxd", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x974, "uart0_txd", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x978, "uart1_ctsn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0x97c, "uart1_rtsn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +#endif + _PIN(0x978, "uart1_ctsn", 12, 7, "uart1_ctsn", "timer6_mux1", "dcan0_tx", "I2C2_SDA", "spi1_cs0", "pr1_uart0_cts_n", "pr1_edc_latch0_in", "gpio0_12"), + _PIN(0x97c, "uart1_rtsn", 13, 7, "uart1_rtsn", "timer5_mux1", "dcan0_rx", "I2C2_SCL", "spi1_cs1", "pr1_uart0_rts_n ", "pr1_edc_latch1_in", "gpio0_13"), +#if 0 _PIN(0x980, "uart1_rxd", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0x984, "uart1_txd", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), #endif @@ -313,13 +324,50 @@ int ti_scm_padconf_set_gpioflags(uint32_t gpio, uint32_t flags) { - /* TODO */ - return (EINVAL); + unsigned int state = 0; + if (flags & GPIO_PIN_OUTPUT) { + if (flags & GPIO_PIN_PULLUP) + state = PADCONF_OUTPUT_PULLUP; + else + state = PADCONF_OUTPUT; + } else if (flags & GPIO_PIN_INPUT) { + if (flags & GPIO_PIN_PULLUP) + state = PADCONF_INPUT_PULLUP; + else if (flags & GPIO_PIN_PULLDOWN) + state = PADCONF_INPUT_PULLDOWN; + else + state = PADCONF_INPUT; + } + return ti_scm_padconf_set_gpiomode(gpio, state); } void ti_scm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags) { - /* TODO */ + unsigned int state; + if (ti_scm_padconf_get_gpiomode(gpio, &state) != 0) + *flags = 0; + else { + switch (state) { + case PADCONF_OUTPUT: + *flags = GPIO_PIN_OUTPUT; + break; + case PADCONF_OUTPUT_PULLUP: + *flags = GPIO_PIN_OUTPUT | GPIO_PIN_PULLUP; + break; + case PADCONF_INPUT: + *flags = GPIO_PIN_INPUT; + break; + case PADCONF_INPUT_PULLUP: + *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLUP; + break; + case PADCONF_INPUT_PULLDOWN: + *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLDOWN; + break; + default: + *flags = 0; + break; + } + } } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beaglebone.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beaglebone.dts Fri Jun 22 10:25:12 2012 (r238137) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beaglebone.dts Fri Jun 22 11:35:14 2012 (r238138) @@ -65,31 +65,31 @@ /* Set of triplets < padname, muxname, padstate> */ scm-pad-config = /* I2C0 */ - "I2C0_SDA", "I2C0_SDA","input_pullup_inact_slow", - "I2C0_SCL", "I2C0_SCL","input_pullup_inact_slow", + "I2C0_SDA", "I2C0_SDA","i2c", + "I2C0_SCL", "I2C0_SCL","i2c", /* Ethernet */ - "MII1_RX_ER", "gmii1_rxerr", "input", + "MII1_RX_ER", "gmii1_rxerr", "input_pulldown", "MII1_TX_EN", "gmii1_txen", "output", - "MII1_RX_DV", "gmii1_rxdv", "input", + "MII1_RX_DV", "gmii1_rxdv", "input_pulldown", "MII1_TXD3", "gmii1_txd3", "output", "MII1_TXD2", "gmii1_txd2", "output", "MII1_TXD1", "gmii1_txd1", "output", "MII1_TXD0", "gmii1_txd0", "output", - "MII1_TX_CLK", "gmii1_txclk", "input", - "MII1_RX_CLK", "gmii1_rxclk", "input", - "MII1_RXD3", "gmii1_rxd3", "input", - "MII1_RXD2", "gmii1_rxd2", "input", - "MII1_RXD1", "gmii1_rxd1", "input", - "MII1_RXD0", "gmii1_rxd0", "input", - "MDIO", "mdio_data", "input_pullup_inact", + "MII1_TX_CLK", "gmii1_txclk", "input_pulldown", + "MII1_RX_CLK", "gmii1_rxclk", "input_pulldown", + "MII1_RXD3", "gmii1_rxd3", "input_pulldown", + "MII1_RXD2", "gmii1_rxd2", "input_pulldown", + "MII1_RXD1", "gmii1_rxd1", "input_pulldown", + "MII1_RXD0", "gmii1_rxd0", "input_pulldown", + "MDIO", "mdio_data", "input_pullup", "MDC", "mdio_clk", "output_pullup", /* MMCSD0 */ - "MMC0_CMD", "mmc0_cmd", "input_pullup_inact", - "MMC0_CLK", "mmc0_clk", "input_pullup_inact", - "MMC0_DAT0", "mmc0_dat0", "input_pullup_inact", - "MMC0_DAT1", "mmc0_dat1", "input_pullup_inact", - "MMC0_DAT2", "mmc0_dat2", "input_pullup_inact", - "MMC0_DAT3", "mmc0_dat3", "input_pullup_inact"; + "MMC0_CMD", "mmc0_cmd", "input_pullup", + "MMC0_CLK", "mmc0_clk", "input_pullup", + "MMC0_DAT0", "mmc0_dat0", "input_pullup", + "MMC0_DAT1", "mmc0_dat1", "input_pullup", + "MMC0_DAT2", "mmc0_dat2", "input_pullup", + "MMC0_DAT3", "mmc0_dat3", "input_pullup"; }; prcm@44E00000 { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 22 13:31: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 84736106564A for ; Fri, 22 Jun 2012 13:31:24 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 22 Jun 2012 13:31:24 +0000 Date: Fri, 22 Jun 2012 13:31:24 +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: <20120622133124.84736106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238140 - 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, 22 Jun 2012 13:31:26 -0000 Author: oleksandr Date: Fri Jun 22 13:31:23 2012 New Revision: 238140 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238140 Log: Change implementation of function udf_read_anchor, add correct sectors number and some clean code Modified: 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_subr.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Fri Jun 22 12:15:38 2012 (r238139) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Fri Jun 22 13:31:23 2012 (r238140) @@ -337,7 +337,7 @@ struct vnode *devvp = ump->devvp; sector_size = ump->sector_size; - blks = sector_size / DEV_BSIZE; + blks = btodb(sector_size); while (sectors > 0 && error == 0) { if ((error = bread(devvp, start*blks, sector_size, NOCRED, Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 22 12:15:38 2012 (r238139) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 22 13:31:23 2012 (r238140) @@ -25,6 +25,8 @@ */ +#include +#include #include #include #include @@ -53,7 +55,8 @@ extern int (**udf_vnodeop_p)(void *); /* --------------------------------------------------------------------- */ -#if 0 + +//#ifdef DEBUG #if 1 #if 0 @@ -110,7 +113,8 @@ 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); - snprintb(bits, sizeof(bits), MMC_DFLAGS_FLAGBITS, di->disc_flags); +/* TODO: find analog function in Freebsd */ +// snprintb(bits, sizeof(bits), MMC_DFLAGS_FLAGBITS, di->disc_flags); printf("\tdisc flags %s\n", bits); printf("\tdisc id %x\n", di->disc_id); printf("\tdisc barcode %"PRIx64"\n", di->disc_barcode); @@ -118,12 +122,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); +// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cur); printf("\tcapabilities cur %s\n", bits); - snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cap); +// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cap); printf("\tcapabilities cap %s\n", bits); } - +#if 0 static void udf_dump_trackinfo(struct mmc_trackinfo *trackinfo) { @@ -136,7 +140,7 @@ 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); +// snprintb(bits, sizeof(bits), MMC_TRACKINFO_FLAGBITS, trackinfo->flags); printf("\tflags %s\n", bits); printf("\ttrack start %d\n", trackinfo->track_start); @@ -146,7 +150,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); #define udf_dump_trackinfo(a); @@ -157,29 +161,30 @@ /* not called often */ int -udf_update_discinfo(struct udf_mount *ump) +udf_update_discinfo(struct udf_mount *ump, uint64_t psize, uint32_t secsize) { struct vnode *devvp = ump->devvp; - struct partinfo dpart; + struct thread *td; struct mmc_discinfo *di; int error; DPRINTF(VOLUMES, ("read/update disc info\n")); di = &ump->discinfo; + td = curthread; memset(di, 0, sizeof(struct mmc_discinfo)); /* check if we're on a MMC capable device, i.e. CD/DVD */ - error = VOP_IOCTL(devvp, MMCGETDISCINFO, di, FKIOCTL, NOCRED); + error = VOP_IOCTL(devvp, MMCGETDISCINFO, di, FKIOCTL, NOCRED, td); if (error == 0) { udf_dump_discinfo(ump); return 0; } - +#if 0 /* disc partition support */ - error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED); + 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; @@ -194,8 +199,8 @@ di->disc_flags = MMC_DFLAGS_UNRESTRICTED; /* TODO problem with last_possible_lba on resizable VND; request */ - di->last_possible_lba = dpart.part->p_size; - di->sector_size = dpart.disklab->d_secsize; + di->last_possible_lba = psize; + di->sector_size = secsize; di->num_sessions = 1; di->num_tracks = 1; @@ -213,14 +218,16 @@ { struct vnode *devvp = ump->devvp; struct mmc_discinfo *di = &ump->discinfo; + struct thread *td; int error, class; DPRINTF(VOLUMES, ("read track info\n")); + td = curthread; class = di->mmc_class; if (class != MMC_CLASS_DISC) { /* tracknr specified in struct ti */ - error = VOP_IOCTL(devvp, MMCGETTRACKINFO, ti, FKIOCTL, NOCRED); + error = VOP_IOCTL(devvp, MMCGETTRACKINFO, ti, FKIOCTL, NOCRED, td); return error; } @@ -247,7 +254,7 @@ return 0; } - +#if 0 int udf_setup_writeparams(struct udf_mount *ump) { @@ -315,6 +322,7 @@ /* --------------------------------------------------------------------- */ +#endif /* track/session searching for mounting */ int udf_search_tracks(struct udf_mount *ump, struct udf_args *args, @@ -383,10 +391,11 @@ return EINVAL; } - assert(*last_tracknr >= *first_tracknr); +/* assert(*last_tracknr >= *first_tracknr); */ return 0; } +#if 0 /* * NOTE: this is the only routine in this file that directly peeks into the * metadata file but since its at a larval state of the mount it can't hurt. @@ -933,14 +942,11 @@ int udf_read_anchors(struct udf_mount *ump) { +#if 0 struct anchor_vdp **anchorsp; int error, anch, ok, first_anchor; uint32_t positions[4], track_start, track_end; -// struct udf_args *args = &ump->mount_args; -// struct mmc_trackinfo first_track; -// struct mmc_trackinfo second_track; - track_start = ump->session_start; track_end = ump->session_end; @@ -972,7 +978,7 @@ } return ok; -#if 0 +#endif struct udf_args *args = &ump->mount_args; struct mmc_trackinfo first_track; struct mmc_trackinfo second_track; @@ -1033,7 +1039,7 @@ ump->packet_size = MAXPHYS / ump->discinfo.sector_size; ump->packet_size = MIN(ump->packet_size, 64); } - KASSERT(ump->packet_size >= 1); + /*KASSERT(ump->packet_size >= 1); */ /* read anchors start+256, start+512, end-256, end */ positions[0] = track_start+256; @@ -1053,7 +1059,12 @@ ok++; } } -#endif + + /* VATs are only recorded on sequential media, but initialise */ + ump->first_possible_vat_location = track_start + 2; + ump->last_possible_vat_location = track_end + last_track.packet_size; + + return ok; } /* --------------------------------------------------------------------- */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Fri Jun 22 12:15:38 2012 (r238139) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Fri Jun 22 13:31:23 2012 (r238140) @@ -33,10 +33,10 @@ /* device information updating */ -//int udf_update_trackinfo(struct udf_mount *ump, struct mmc_trackinfo *trackinfo); -//int udf_update_discinfo(struct udf_mount *ump); -//int udf_search_tracks(struct udf_mount *ump, struct udf_args *args, -// int *first_tracknr, int *last_tracknr); +int udf_update_trackinfo(struct udf_mount *ump, struct mmc_trackinfo *trackinfo); +int udf_update_discinfo(struct udf_mount *ump, uint64_t psize, uint32_t secsize); +int udf_search_tracks(struct udf_mount *ump, struct udf_args *args, + 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); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 22 12:15:38 2012 (r238139) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 22 13:31:23 2012 (r238140) @@ -187,10 +187,12 @@ struct thread *td; struct vnode *devvp; struct nameidata nd; + struct vfsoptlist *opts; int error, len; char *fspec; td = curthread; + opts = mp->mnt_optnew; DPRINTF(CALL, ("udf_mount called\n")); /* * Unconditionally mount as read-only. @@ -209,7 +211,7 @@ return (0); fspec = NULL; - error = vfs_getopt(mp->mnt_optnew, "from", (void **)&fspec, &len); + error = vfs_getopt(opts, "from", (void **)&fspec, &len); if (!error && fspec[len - 1] != '\0') return (EINVAL); @@ -384,19 +386,22 @@ static int udf_mountfs(struct vnode *devvp, struct mount *mp) { + struct udf_args *args = NULL; struct g_consumer *cp; struct cdev *dev; struct udf_mount *ump = NULL; + struct vfsoptlist *opts; int num_anchors, error, len, *udf_flags; - uint32_t bshift, logvol_integrity; /*lb_size,*/ + 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. */ if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0))) return error; #endif + opts = mp->mnt_optnew; /* Open a consumer. */ dev = devvp->v_rdev; @@ -448,10 +453,13 @@ ump->dev = dev; 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(mp->mnt_optnew, "flags", (void **)&udf_flags, &len); + error = vfs_getopt(opts, "flags", (void **)&udf_flags, &len); if (error || len != sizeof(int)) return (EINVAL); ump->flags = *udf_flags; @@ -461,9 +469,9 @@ ump->anon_gid = 0; ump->nobody_uid = -1; ump->nobody_gid = -1; - +#if 0 optdata = NULL; - error = vfs_getopt(mp->mnt_optnew, "first_trackblank", &optdata, &len); + error = vfs_getopt(opts, "first_trackblank", &optdata, &len); if (error || len != sizeof(uint32_t)) { error = EINVAL; goto fail; @@ -471,7 +479,7 @@ ump->first_trackblank = *(uint32_t *)optdata; optdata = NULL; - error = vfs_getopt(mp->mnt_optnew, "session_start_addr", &optdata, &len); + error = vfs_getopt(opts, "session_start_addr", &optdata, &len); if (error || len != sizeof(uint32_t)) { error = EINVAL; goto fail; @@ -479,7 +487,7 @@ ump->session_start = *(uint32_t *)optdata; optdata = NULL; - error = vfs_getopt(mp->mnt_optnew, "session_end_addr", &optdata, &len); + error = vfs_getopt(opts, "session_end_addr", &optdata, &len); if (error || len != sizeof(uint32_t)) { error = EINVAL; goto fail; @@ -487,12 +495,12 @@ ump->session_end = *(uint32_t *)optdata; ump->last_possible_vat_location = ump->session_end; - +#endif if (ump->flags & UDFMNT_KICONV && udf2_iconv) { cs_disk = "UTF-16BE"; cs_local = NULL; - error = vfs_getopt(mp->mnt_optnew, "cs_local", (void **)&cs_local, &len); + error = vfs_getopt(opts, "cs_local", (void **)&cs_local, &len); if (error != 0 || cs_local[len-1] != '\0') { error = EINVAL; goto fail; @@ -503,27 +511,31 @@ udf2_iconv->open(cs_disk, cs_local, &ump->iconv_l2d); #endif } + + if ((error = udf_update_discinfo(ump, cp->provider->sectorsize, cp->provider->mediasize))) { + printf("UDF mount: error inspecting fs node\n"); + return error; + } /* inspect sector size */ ump->sector_size = cp->provider->sectorsize; - + sector_size = ump->discinfo.sector_size; bshift = 1; - while ((1 << bshift) < ump->sector_size) + while ((1 << bshift) < sector_size) bshift++; - if ((1 << bshift) != ump->sector_size) { + if ((1 << bshift) != sector_size) { printf("UDF mount: " "hit implementation fence on sector size\n"); return EIO; } /* temporary check to overcome sectorsize >= 8192 bytes panic */ - if (ump->sector_size >= 8192) { + if (sector_size >= 8192) { printf("UDF mount: " "hit implementation limit, sectorsize to big\n"); return EIO; } -#if 0 /* * Inspect if we're asked to mount read-write on a non recordable or * closed sequential disc. @@ -545,13 +557,14 @@ */ } /* double check if we're not mounting a pervious session RW */ +//#if 0 if (args->sessionnr != 0) { printf("UDF mount: updating a previous session " "not yet allowed\n"); return EROFS; } +//#endif } -#endif #if 0 /* initialise bootstrap disc strategy */ From owner-svn-soc-all@FreeBSD.ORG Fri Jun 22 13:33: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 6C3A7106564A for ; Fri, 22 Jun 2012 13:33:01 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 22 Jun 2012 13:33:01 +0000 Date: Fri, 22 Jun 2012 13:33:01 +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: <20120622133301.6C3A7106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238141 - 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, 22 Jun 2012 13:33:03 -0000 Author: oleksandr Date: Fri Jun 22 13:33:01 2012 New Revision: 238141 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238141 Log: Add struct mmc_discinfo and mmc_trackinfo and flags for this structure Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udfio.h Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udfio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udfio.h Fri Jun 22 13:33:01 2012 (r238141) @@ -0,0 +1,198 @@ + +/* Shared between kernel & process */ + +#ifndef _SYS_UDFIO_H_ +#define _SYS_UDFIO_H_ + +#ifndef _KERNEL +#include +#endif +#include + +struct udf_session_info { + uint32_t session_num; + + uint16_t sector_size; + uint16_t num_sessions; + uint32_t session_start_addr; + uint32_t session_end_addr; + + uint16_t num_tracks; + uint8_t first_track; + uint16_t session_first_track; + uint16_t session_last_track; +}; +#define UDFIOTEST _IOWR('c',300, struct udf_session_info) + +#if defined(_KERNEL) || defined(_EXPOSE_MMC) +/* not exposed to userland yet until its completely mature */ +/* + * MMC device abstraction interface. + * + * It gathers information from GET_CONFIGURATION, READ_DISCINFO, + * READ_TRACKINFO, READ_TOC2, READ_CD_CAPACITY and GET_CONFIGURATION + * SCSI/ATAPI calls regardless if its a legacy CD-ROM/DVD-ROM device or a MMC + * standard recordable device. + */ +struct mmc_discinfo { + uint16_t mmc_profile; + uint16_t mmc_class; + + uint8_t disc_state; + uint8_t last_session_state; + uint8_t bg_format_state; + uint8_t link_block_penalty; /* in sectors */ + + uint64_t mmc_cur; /* current MMC_CAPs */ + uint64_t mmc_cap; /* possible MMC_CAPs */ + + uint32_t disc_flags; /* misc flags */ + + uint32_t disc_id; + uint64_t disc_barcode; + uint8_t application_code; /* 8 bit really */ + + uint8_t unused1[3]; /* padding */ + + uint32_t last_possible_lba; /* last leadout start adr. */ + uint32_t sector_size; + + uint16_t num_sessions; + uint16_t num_tracks; /* derived */ + + uint16_t first_track; + uint16_t first_track_last_session; + uint16_t last_track_last_session; + + uint16_t unused2; /* padding/misc info resv. */ + + uint16_t reserved1[4]; /* MMC-5 track resources */ + uint32_t reserved2[3]; /* MMC-5 POW resources */ + + uint32_t reserved3[8]; /* MMC-5+ */ +}; +#define FKIOCTL 0x80000000 /* kernel original ioctl */ +#define MMCGETDISCINFO _IOR('c', 28, struct mmc_discinfo) + +#define MMC_CLASS_UNKN 0 +#define MMC_CLASS_DISC 1 +#define MMC_CLASS_CD 2 +#define MMC_CLASS_DVD 3 +#define MMC_CLASS_MO 4 +#define MMC_CLASS_BD 5 +#define MMC_CLASS_FILE 0xffff /* emulation mode */ + +#define MMC_DFLAGS_BARCODEVALID (1 << 0) /* barcode is present and valid */ +#define MMC_DFLAGS_DISCIDVALID (1 << 1) /* discid is present and valid */ +#define MMC_DFLAGS_APPCODEVALID (1 << 2) /* application code valid */ +#define MMC_DFLAGS_UNRESTRICTED (1 << 3) /* restricted, then set app. code */ + +#define MMC_DFLAGS_FLAGBITS \ + "\10\1BARCODEVALID\2DISCIDVALID\3APPCODEVALID\4UNRESTRICTED" + +#define MMC_CAP_SEQUENTIAL (1 << 0) /* sequential writable only */ +#define MMC_CAP_RECORDABLE (1 << 1) /* record-able; i.e. not static */ +#define MMC_CAP_ERASABLE (1 << 2) /* drive can erase sectors */ +#define MMC_CAP_BLANKABLE (1 << 3) /* media can be blanked */ +#define MMC_CAP_FORMATTABLE (1 << 4) /* media can be formatted */ +#define MMC_CAP_REWRITABLE (1 << 5) /* media can be rewritten */ +#define MMC_CAP_MRW (1 << 6) /* Mount Rainier formatted */ +#define MMC_CAP_PACKET (1 << 7) /* using packet recording */ +#define MMC_CAP_STRICTOVERWRITE (1 << 8) /* only writes a packet at a time */ +#define MMC_CAP_PSEUDOOVERWRITE (1 << 9) /* overwrite through replacement */ +#define MMC_CAP_ZEROLINKBLK (1 << 10) /* zero link block length capable */ +#define MMC_CAP_HW_DEFECTFREE (1 << 11) /* hardware defect management */ + +#define MMC_CAP_FLAGBITS \ + "\10\1SEQUENTIAL\2RECORDABLE\3ERASABLE\4BLANKABLE\5FORMATTABLE" \ + "\6REWRITABLE\7MRW\10PACKET\11STRICTOVERWRITE\12PSEUDOOVERWRITE" \ + "\13ZEROLINKBLK\14HW_DEFECTFREE" + +#define MMC_STATE_EMPTY 0 +#define MMC_STATE_INCOMPLETE 1 +#define MMC_STATE_FULL 2 +#define MMC_STATE_CLOSED 3 + +#define MMC_BGFSTATE_UNFORM 0 +#define MMC_BGFSTATE_STOPPED 1 +#define MMC_BGFSTATE_RUNNING 2 +#define MMC_BGFSTATE_COMPLETED 3 + + +struct mmc_trackinfo { + uint16_t tracknr; /* IN/OUT */ + uint16_t sessionnr; + + uint8_t track_mode; + uint8_t data_mode; + + uint16_t flags; + + uint32_t track_start; + uint32_t next_writable; + uint32_t free_blocks; + uint32_t packet_size; + uint32_t track_size; + uint32_t last_recorded; +}; +#define MMCGETTRACKINFO _IOWR('c', 29, struct mmc_trackinfo) + +#define MMC_TRACKINFO_COPY (1 << 0) +#define MMC_TRACKINFO_DAMAGED (1 << 1) +#define MMC_TRACKINFO_FIXED_PACKET (1 << 2) +#define MMC_TRACKINFO_INCREMENTAL (1 << 3) +#define MMC_TRACKINFO_BLANK (1 << 4) +#define MMC_TRACKINFO_RESERVED (1 << 5) +#define MMC_TRACKINFO_NWA_VALID (1 << 6) +#define MMC_TRACKINFO_LRA_VALID (1 << 7) +#define MMC_TRACKINFO_DATA (1 << 8) +#define MMC_TRACKINFO_AUDIO (1 << 9) +#define MMC_TRACKINFO_AUDIO_4CHAN (1 << 10) +#define MMC_TRACKINFO_PRE_EMPH (1 << 11) + +#define MMC_TRACKINFO_FLAGBITS \ + "\10\1COPY\2DAMAGED\3FIXEDPACKET\4INCREMENTAL\5BLANK" \ + "\6RESERVED\7NWA_VALID\10LRA_VALID\11DATA\12AUDIO" \ + "\13AUDIO_4CHAN\14PRE_EMPH" + +struct mmc_op { + uint16_t operation; /* IN */ + uint16_t mmc_profile; /* IN */ + + /* parameters to operation */ + uint16_t tracknr; /* IN */ + uint16_t sessionnr; /* IN */ + uint32_t extent; /* IN */ + + uint32_t reserved[4]; +}; +#define MMCOP _IOWR('c', 30, struct mmc_op) + +#define MMC_OP_SYNCHRONISECACHE 1 +#define MMC_OP_CLOSETRACK 2 +#define MMC_OP_CLOSESESSION 3 +#define MMC_OP_FINALISEDISC 4 +#define MMC_OP_RESERVETRACK 5 +#define MMC_OP_RESERVETRACK_NWA 6 +#define MMC_OP_UNRESERVETRACK 7 +#define MMC_OP_REPAIRTRACK 8 +#define MMC_OP_UNCLOSELASTSESSION 9 +#define MMC_OP_MAX 9 + +struct mmc_writeparams { + uint16_t tracknr; /* IN */ + uint16_t mmc_class; /* IN */ + uint32_t mmc_cur; /* IN */ + uint32_t blockingnr; /* IN */ + + /* when tracknr == 0 */ + uint8_t track_mode; /* IN; normally 5 */ + uint8_t data_mode; /* IN; normally 2 */ +}; +#define MMC_TRACKMODE_DEFAULT 5 /* data, incremental recording */ +#define MMC_DATAMODE_DEFAULT 2 /* CDROM XA disc */ +#define MMCSETUPWRITEPARAMS _IOW('c', 31, struct mmc_writeparams) + +#endif /* _KERNEL || _EXPOSE_MMC */ + +#endif /* !_SYS_UDFIO_H_ */ From owner-svn-soc-all@FreeBSD.ORG Fri Jun 22 21:29: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 7BB341065670 for ; Fri, 22 Jun 2012 21:29:20 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 22 Jun 2012 21:29:20 +0000 Date: Fri, 22 Jun 2012 21:29:20 +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: <20120622212920.7BB341065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238159 - in soc2012/jhagewood: diff diff/diff diff3 mdocml 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, 22 Jun 2012 21:29:22 -0000 Author: jhagewood Date: Fri Jun 22 21:29:19 2012 New Revision: 238159 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238159 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diff.h soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/diff/pathnames.h soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/TODO Fri Jun 22 21:29:19 2012 (r238159) @@ -9,7 +9,7 @@ --normal COMPLETE Sets format to D_NORMAL in getopt_long(). --suppress-common-lines IN PROGRESS --GTYPE-group-format INCOMPLETE ---line-format IN PROGRESS +--line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility --LTYPE-line-format INCOMPLETE --from-file INCOMPLETE --to-file INCOMPLETE @@ -17,8 +17,18 @@ --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE +Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and functionality. + Notes: -- When using large files as input, diff will only output "Files [file1] and [file2] differ." +- 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 in a file is printable, only check + the first character. + IMO, This is a sufficient test to check if a file is binary or 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. + + Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/diff/diff.c Fri Jun 22 21:29:19 2012 (r238159) @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 2003 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -43,13 +43,13 @@ #include "diff.h" #include "pathnames.h" -int aflag, bflag, cflag, dflag, Eflag, 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; +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; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; @@ -77,6 +77,9 @@ OPT_HLINES, OPT_LFILES, OPT_HELP, + OPT_NEW_LF, + OPT_OLD_LF, + OPT_UNCHGD_LF, }; @@ -112,8 +115,10 @@ /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ { "minimal", no_argument, NULL, 'd' }, { "new-file", no_argument, NULL, 'N' }, + { "new-line-format", required_argument, NULL, OPT_NEW_LF}, { "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}, { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, { "report-identical-files", no_argument, NULL, 's' }, @@ -128,6 +133,7 @@ { "tabsize", optional_argument, NULL, OPT_TSIZE }, { "text", no_argument, NULL, 'a' }, /*{ "to-file", required_argument, NULL, OPT_TOFILE },*/ + { "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' }, @@ -294,15 +300,19 @@ case 'y': yflag = 1; break; + case OPT_NEW_LF: + case OPT_OLD_LF: + case OPT_UNCHGD_LF: case OPT_LF: /* XXX To do: Complete --line-format. */ format = D_IFDEF; + ifdefname = optarg; break; case OPT_NORMAL: format = D_NORMAL; break; case OPT_SUPCL: - /* XXX To do: Complete --suppress-common-lines */ + suppress_cl = 1; break; case OPT_TSIZE: if (optarg != NULL) { @@ -340,16 +350,15 @@ 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; argv++); while(argv != &oargv[oargc]){ - *argv=*(argv+1); + *argv= *(argv+1); argv++; } oargv[0] = _PATH_SDIFF; *argv= "\0"; - execv(_PATH_SDIFF, oargv); _exit(127); } @@ -388,7 +397,10 @@ 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)) { Modified: soc2012/jhagewood/diff/diff/diff.h ============================================================================== --- soc2012/jhagewood/diff/diff/diff.h Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/diff/diff.h Fri Jun 22 21:29:19 2012 (r238159) @@ -77,7 +77,7 @@ extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, sflag, tflag, Tflag, wflag; -extern int Bflag, strip_cr, tabsize; +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; Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 22 21:29:19 2012 (r238159) @@ -200,7 +200,7 @@ 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); @@ -368,7 +368,7 @@ goto closem; } - if (!asciifile(f1) || !asciifile(f2)) { + if (!istextfile(f1) || !istextfile(f2)) { rval = D_BINARY; status |= 1; goto closem; @@ -751,7 +751,7 @@ static void check(char *file1, FILE *f1, char *file2, FILE *f2) { - int i, j, jackpot, c, d, int spacecount; + int i, j, jackpot, c, d, spacecount; long ctold, ctnew; fpos_t position; @@ -812,18 +812,16 @@ if (c == '\n' && d != '\n') { do { if (c == '\n') { - ixold[i] = ctold; - i++; + ctold++; } - } while ((c = getc(f1)) == '\n' && i <= len[0]); + } while ((c = getc(f1)) == '\n'); } if (d == '\n' && c != '\n') { do { if (d == '\n') { - ixnew[j] = ctnew; - j++; + ctnew++; } - } while ((d = getc(f2)) == '\n' && j <= len[1]); + } while ((d = getc(f2)) == '\n'); } break; /* ignore-tab-expansion */ @@ -834,13 +832,13 @@ * Checks if file1 has 8 consecutive spaces, which is * equal to 1 tab. */ - getpos(f1, &position); + fgetpos(f1, &position); for (spacecount = 1; spacecount <= 8; spacecount++) { c = getc(f1); if (c != ' ') break; } - setpos(f1, &position); + fsetpos(f1, &position); while (c == ' ' && spacecount == 9) { c = getc(f1); ctold++; @@ -851,13 +849,13 @@ * Checks if file2 has 8 consecutive spaces, which is * equal to 1 tab. */ - getpos(f2, &position); + fgetpos(f2, &position); for (spacecount = 1; spacecount <= 8; spacecount++) { d = getc(f2); if (d != ' ') break; } - setpos(f2, &position); + fsetpos(f2, &position); while (d == ' ' && spacecount == 9) { d = getc(f2); ctnew++; @@ -1004,7 +1002,7 @@ #define c i0 if ((c = getc(f1)) == EOF) return; - putchar(c); + printf("%c", c); } #undef c } @@ -1154,15 +1152,15 @@ case D_NORMAL: case D_EDIT: range(a, b, ","); - putchar(a > b ? 'a' : c > d ? 'd' : 'c'); + printf("%c", (a > b ? 'a' : c > d ? 'd' : 'c')); if (format == D_NORMAL) range(c, d, ","); - putchar('\n'); + printf("%c", '\n'); break; case D_REVERSE: - putchar(a > b ? 'a' : c > d ? 'd' : 'c'); + printf("%c", (a > b ? 'a' : c > d ? 'd' : 'c')); range(a, b, " "); - putchar('\n'); + printf("%c", '\n'); break; case D_NREVERSE: if (a > b) @@ -1178,7 +1176,7 @@ if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) - puts("---"); + printf("---"); } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { @@ -1189,14 +1187,14 @@ * it. We have to add a substitute command to change this * back and restart where we left off. */ - puts("."); + printf("."); printf("%ds/^\\.\\././\n", a); a += i; c += i; goto restart; } if ((format == D_EDIT || format == D_REVERSE) && c <= d) - puts("."); + printf("."); if (inifdef) { printf("#endif /* %s */\n", ifdefname); inifdef = 0; @@ -1218,7 +1216,7 @@ /* 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++) - putchar(getc(lb)); + printf("%c", getc(lb)); } if (a > b) return (0); @@ -1238,12 +1236,12 @@ fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; if (format != D_IFDEF && ch != '\0') { - putchar(ch); + printf("%c", ch); if (Tflag && (format == D_NORMAL || format == D_CONTEXT || format == D_UNIFIED)) - putchar('\t'); + printf("%c", '\t'); else if (format != D_UNIFIED) - putchar(' '); + printf("%c", ' '); } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { @@ -1252,13 +1250,13 @@ format == D_NREVERSE) warnx("No newline at end of file"); else - puts("\n\\ No newline at end of file"); + printf("\n\\ No newline at end of file"); return (0); } if (c == '\t' && tflag) { newcol = ((col/tabsize)+1)*tabsize; do { - putchar(' '); + printf("%c", ' '); } while (++col < newcol); } else { if (format == D_EDIT && j == 1 && c == '\n' @@ -1270,10 +1268,10 @@ * giving the caller an offset * from which to restart. */ - puts("."); + printf("."); return (i - a + 1); } - putchar(c); + printf("%c", c); col++; } } @@ -1347,7 +1345,7 @@ } static int -asciifile(FILE *f) +textfile(FILE *f) { char buf[BUFSIZ]; int i, cnt; @@ -1356,9 +1354,8 @@ return (1); rewind(f); cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) - return (0); + if (!isprint(buf[0]) && !isspace(buf[1])) + return (0); return (1); } @@ -1429,8 +1426,8 @@ if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { - putchar(' '); - fputs(f, stdout); + printf("%c", ' '); + printf("%s", f); } } printf("\n*** "); @@ -1530,19 +1527,19 @@ lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); - fputs("@@ -", stdout); + printf("@@ -"); uni_range(lowa, upb); - fputs(" +", stdout); + printf(" +"); uni_range(lowc, upd); - fputs(" @@", stdout); + printf(" @@"); if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { - putchar(' '); - fputs(f, stdout); + printf("%c", ' '); + printf("%s", f); } } - putchar('\n'); + printf("%c", '\n'); /* * Output changes in "unified" diff format--the old and new lines Modified: soc2012/jhagewood/diff/diff/pathnames.h ============================================================================== --- soc2012/jhagewood/diff/diff/pathnames.h Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/diff/pathnames.h Fri Jun 22 21:29:19 2012 (r238159) @@ -23,4 +23,4 @@ #include #define _PATH_PR "/usr/bin/pr" -#define _PATH_SDIFF "/usr/bin/sdiff +#define _PATH_SDIFF "/usr/bin/sdiff" Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 22 20:42:11 2012 (r238158) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 22 21:29:19 2012 (r238159) @@ -1,6 +1,12 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-20 21:51:36.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-17 23:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-22 17:14:38.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. */ @@ -21,20 +27,27 @@ #include #include -@@ -45,10 +43,10 @@ __FBSDID("$FreeBSD$"); +@@ -45,20 +43,20 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" -int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -+int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; - int sflag, tflag, Tflag, wflag; - int Bflag, yflag; +-int sflag, tflag, Tflag, wflag; +-int Bflag, yflag; -int strip_cr, tabsize=8; -+int strip_cr, tabsize = 8; - char ignore_file_case = 0; - int format, context, status; - char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -@@ -58,7 +56,7 @@ regex_t ignore_re; +-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; ++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; + struct stat stb1, stb2; + struct excludes *excludes_list; + regex_t ignore_re; int flag_opts = 0; @@ -43,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,12 +67,11 @@ enum +@@ -69,75 +67,77 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -57,7 +70,12 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,60 +81,57 @@ enum + OPT_LFILES, + OPT_HELP, ++ OPT_NEW_LF, ++ OPT_OLD_LF, ++ OPT_UNCHGD_LF, + }; static struct option longopts[] = { @@ -126,8 +144,10 @@ - { "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}, + { "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}, + { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, - { "starting-file", required_argument, NULL, 'S' }, @@ -146,6 +166,7 @@ + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "text", no_argument, NULL, 'a' }, + /*{ "to-file", required_argument, NULL, OPT_TOFILE },*/ ++ { "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' }, @@ -159,7 +180,7 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,10 +156,10 @@ void read_excludes_file(char *); +@@ -162,10 +162,10 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -174,7 +195,7 @@ oargv = argv; oargc = argc; -@@ -197,6 +191,7 @@ main(int argc, char **argv) +@@ -197,6 +197,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -182,7 +203,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +208,9 @@ main(int argc, char **argv) +@@ -213,6 +214,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -192,19 +213,23 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +294,25 @@ main(int argc, char **argv) +@@ -296,15 +300,29 @@ main(int argc, char **argv) case 'y': yflag = 1; break; ++ case OPT_NEW_LF: ++ case OPT_OLD_LF: ++ case OPT_UNCHGD_LF: + case OPT_LF: + /* XXX To do: Complete --line-format. */ + format = D_IFDEF; ++ ifdefname = optarg; + break; + case OPT_NORMAL: + format = D_NORMAL; + break; + case OPT_SUPCL: -+ /* XXX To do: Complete --suppress-common-lines */ ++ suppress_cl = 1; + break; case OPT_TSIZE: - if (optarg != NULL) { @@ -226,7 +251,39 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -402,11 +410,10 @@ main(int argc, char **argv) +@@ -332,16 +350,15 @@ main(int argc, char **argv) + 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; 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 +397,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)) { +@@ -402,11 +422,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -239,7 +296,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +422,7 @@ emalloc(size_t n) +@@ -415,7 +434,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -248,7 +305,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +438,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +450,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -264,7 +321,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +452,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +464,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -279,7 +336,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +538,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +550,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -287,7 +344,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +547,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +559,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -345,7 +402,7 @@ break; } } -@@ -585,6 +594,7 @@ print_status(int val, char *path1, char +@@ -585,6 +606,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -353,21 +410,9 @@ (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/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-18 03:07:38.000000000 -0400 -@@ -75,7 +75,7 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag; - extern int Bflag, strip_cr, tabsize; - extern int format, context, status; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-20 05:43:28.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-17 23:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-20 01:43:28.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -475,9 +520,24 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-17 23:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-22 14:44:50.000000000 -0400 +@@ -75,9 +75,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, + sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++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/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-19 05:18:57.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-17 23:07:38.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-22 17:05:42.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -511,6 +571,15 @@ /* * diff - compare two files. */ +@@ -196,7 +200,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 +298,13 @@ u_char cup2low[256] = { int diffreg(char *ofile1, char *ofile2, int flags) @@ -532,7 +601,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -540,6 +609,15 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; +@@ -365,7 +368,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 +480,8 @@ closem: static int files_differ(FILE *f1, FILE *f2, int flags) @@ -649,7 +727,7 @@ - int i, j, jackpot, c, d; - long ctold, ctnew; - -+ int i, j, jackpot, c, d, int spacecount; ++ int i, j, jackpot, c, d, spacecount; + long ctold, ctnew; + fpos_t position; + @@ -681,7 +759,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +807,64 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +807,62 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -693,22 +771,26 @@ + if (c == '\n' && d != '\n') { do { if (c == '\n') { - ixold[i] = ctold; - i++; +- ixold[i] = ctold; +- i++; ++ ctold++; } - - } while ((c = getc(f1)) == '\n' && i <= len[0]); +- } while ((c = getc(f1)) == '\n' && i <= len[0]); ++ } while ((c = getc(f1)) == '\n'); } - - if( d == '\n' && c != '\n') { + if (d == '\n' && c != '\n') { do { if (d == '\n') { - ixnew[j] = ctnew; - j++; +- ixnew[j] = ctnew; +- j++; ++ ctnew++; } - } while ((d = getc(f2)) == '\n' && j <= len[1]); +- } while ((d = getc(f2)) == '\n' && j <= len[1]); - ++ } while ((d = getc(f2)) == '\n'); } - break; @@ -721,13 +803,13 @@ + * Checks if file1 has 8 consecutive spaces, which is + * equal to 1 tab. + */ -+ getpos(f1, &position); ++ fgetpos(f1, &position); + for (spacecount = 1; spacecount <= 8; spacecount++) { + c = getc(f1); + if (c != ' ') + break; + } -+ setpos(f1, &position); ++ fsetpos(f1, &position); + while (c == ' ' && spacecount == 9) { + c = getc(f1); + ctold++; @@ -738,13 +820,13 @@ + * Checks if file2 has 8 consecutive spaces, which is + * equal to 1 tab. + */ -+ getpos(f2, &position); ++ fgetpos(f2, &position); + for (spacecount = 1; spacecount <= 8; spacecount++) { + d = getc(f2); + if (d != ' ') + break; + } -+ setpos(f2, &position); ++ fsetpos(f2, &position); + while (d == ' ' && spacecount == 9) { + d = getc(f2); + ctnew++; @@ -755,7 +837,7 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -872,7 +911,7 @@ static void +@@ -872,7 +909,7 @@ static void sort(struct line *a, int n) { struct line *ai, *aim, w; @@ -764,7 +846,7 @@ if (n == 0) return; -@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b) +@@ -916,7 +953,7 @@ unsort(struct line *f, int l, int *b) static int skipline(FILE *f) { @@ -773,7 +855,7 @@ for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; -@@ -926,7 +965,7 @@ skipline(FILE *f) +@@ -926,7 +963,7 @@ skipline(FILE *f) static void output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) { @@ -782,7 +864,16 @@ rewind(f1); rewind(f2); -@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file +@@ -965,7 +1002,7 @@ output(char *file1, FILE *f1, char *file + #define c i0 + if ((c = getc(f1)) == EOF) + return; +- putchar(c); ++ printf("%c", c); + } + #undef c + } +@@ -980,6 +1017,7 @@ output(char *file1, FILE *f1, char *file static void range(int a, int b, char *separator) { @@ -790,7 +881,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 +1026,7 @@ range(int a, int b, char *separator) static void uni_range(int a, int b) { @@ -798,7 +889,7 @@ if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) -@@ -999,8 +1040,8 @@ uni_range(int a, int b) +@@ -999,8 +1038,8 @@ uni_range(int a, int b) static char * preadline(int fd, size_t len, off_t off) { @@ -809,7 +900,7 @@ line = emalloc(len + 1); if ((nr = pread(fd, line, len, off)) < 0) -@@ -1014,7 +1055,7 @@ preadline(int fd, size_t len, off_t off) +@@ -1014,7 +1053,7 @@ preadline(int fd, size_t len, off_t off) static int ignoreline(char *line) { @@ -818,7 +909,7 @@ ret = regexec(&ignore_re, line, 0, NULL, 0); free(line); -@@ -1032,8 +1073,8 @@ static void +@@ -1032,8 +1071,8 @@ static void change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, int *pflags) { @@ -829,7 +920,53 @@ restart: if (format != D_IFDEF && a > b && c > d) -@@ -1165,8 +1206,8 @@ proceed: +@@ -1113,15 +1152,15 @@ proceed: + case D_NORMAL: + case D_EDIT: + range(a, b, ","); +- putchar(a > b ? 'a' : c > d ? 'd' : 'c'); ++ printf("%c", (a > b ? 'a' : c > d ? 'd' : 'c')); + if (format == D_NORMAL) + range(c, d, ","); +- putchar('\n'); ++ printf("%c", '\n'); + break; + case D_REVERSE: +- putchar(a > b ? 'a' : c > d ? 'd' : 'c'); ++ printf("%c", (a > b ? 'a' : c > d ? 'd' : 'c')); + range(a, b, " "); +- putchar('\n'); ++ printf("%c", '\n'); + break; + case D_NREVERSE: + if (a > b) +@@ -1137,7 +1176,7 @@ proceed: + if (format == D_NORMAL || format == D_IFDEF) { + fetch(ixold, a, b, f1, '<', 1); + if (a <= b && c <= d && format == D_NORMAL) +- puts("---"); ++ printf("---"); + } + i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); + if (i != 0 && format == D_EDIT) { +@@ -1148,14 +1187,14 @@ proceed: + * it. We have to add a substitute command to change this + * back and restart where we left off. + */ +- puts("."); ++ printf("."); + printf("%ds/^\\.\\././\n", a); + a += i; + c += i; + goto restart; + } + if ((format == D_EDIT || format == D_REVERSE) && c <= d) +- puts("."); ++ printf("."); + if (inifdef) { + printf("#endif /* %s */\n", ifdefname); + inifdef = 0; +@@ -1165,8 +1204,8 @@ proceed: static int fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { @@ -840,7 +977,61 @@ /* * When doing #ifdef's, copy down to current line -@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1177,7 +1216,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++) +- putchar(getc(lb)); ++ printf("%c", getc(lb)); + } + if (a > b) + return (0); +@@ -1197,12 +1236,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') { +- putchar(ch); ++ printf("%c", ch); + if (Tflag && (format == D_NORMAL || format == D_CONTEXT + || format == D_UNIFIED)) +- putchar('\t'); ++ printf("%c", '\t'); + else if (format != D_UNIFIED) +- putchar(' '); ++ printf("%c", ' '); + } + col = 0; + for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { +@@ -1211,13 +1250,13 @@ fetch(long *f, int a, int b, FILE *lb, i + format == D_NREVERSE) + warnx("No newline at end of file"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Fri Jun 22 22:12: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 296C3106566B for ; Fri, 22 Jun 2012 22:12:44 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 22 Jun 2012 22:12:44 +0000 Date: Fri, 22 Jun 2012 22:12:44 +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: <20120622221244.296C3106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238162 - 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: Fri, 22 Jun 2012 22:12:46 -0000 Author: rudot Date: Fri Jun 22 22:12:43 2012 New Revision: 238162 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238162 Log: minor fixes Modified: soc2012/rudot/aux/psSum.sh Modified: soc2012/rudot/aux/psSum.sh ============================================================================== --- soc2012/rudot/aux/psSum.sh Fri Jun 22 21:46:41 2012 (r238161) +++ soc2012/rudot/aux/psSum.sh Fri Jun 22 22:12:43 2012 (r238162) @@ -18,7 +18,7 @@ sort_results() { - cat $FILE_UNSORTED | tr : "\t" | sort > $FILE_SORTED + cat $FILE_UNSORTED | tr : "\t" | sort -n > $FILE_SORTED rm $FILE_UNSORTED } @@ -59,6 +59,9 @@ do PCPU=`user_pcpu "$USER"` + # Escape the decimal point because grep treats it as meta-character. + PCPU_GREP=`echo $PCPU | sed 's:\.:\\\.:'` + [ -z "$PCPU_MIN" ] && PCPU_MIN=$PCPU [ -z "$PCPU_MAX" ] && PCPU_MAX=$PCPU PCPU_MIN_MAX=`echo $PCPU_MIN $PCPU_MAX $PCPU | awk ' @@ -71,7 +74,7 @@ `IFS=:; echo $PCPU_MIN_MAX` EOF - LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU}:"` + LINE=`cat $FILE_UNSORTED 2> /dev/null | grep "^${PCPU_GREP}:"` if [ -n "$LINE" ]; then CNT=`echo "$LINE" | cut -d : -f 2` @@ -84,5 +87,5 @@ echo "$PCPU:1" >> $FILE_UNSORTED fi - sleep 1 + sleep 10 done From owner-svn-soc-all@FreeBSD.ORG Sat Jun 23 10:05: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 9724B1065679 for ; Sat, 23 Jun 2012 10:05:28 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 23 Jun 2012 10:05:28 +0000 Date: Sat, 23 Jun 2012 10:05:28 +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: <20120623100528.9724B1065679@hub.freebsd.org> Cc: Subject: socsvn commit: r238178 - 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: Sat, 23 Jun 2012 10:05:30 -0000 Author: oleksandr Date: Sat Jun 23 10:05:28 2012 New Revision: 238178 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238178 Log: Fix some bug Modified: 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_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Sat Jun 23 09:50:41 2012 (r238177) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Sat Jun 23 10:05:28 2012 (r238178) @@ -27,7 +27,6 @@ #include #include -#include #include #include #include /* KASSERT */ @@ -161,7 +160,7 @@ /* not called often */ int -udf_update_discinfo(struct udf_mount *ump, uint64_t psize, uint32_t secsize) +udf_update_discinfo(struct udf_mount *ump, uint32_t sector_size, uint32_t psize) { struct vnode *devvp = ump->devvp; struct thread *td; @@ -200,7 +199,7 @@ /* TODO problem with last_possible_lba on resizable VND; request */ di->last_possible_lba = psize; - di->sector_size = secsize; + di->sector_size = sector_size; di->num_sessions = 1; di->num_tracks = 1; Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Sat Jun 23 09:50:41 2012 (r238177) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Sat Jun 23 10:05:28 2012 (r238178) @@ -34,7 +34,7 @@ /* device information updating */ int udf_update_trackinfo(struct udf_mount *ump, struct mmc_trackinfo *trackinfo); -int udf_update_discinfo(struct udf_mount *ump, uint64_t psize, uint32_t secsize); +int udf_update_discinfo(struct udf_mount *ump, uint32_t sector_size, uint32_t psize); int udf_search_tracks(struct udf_mount *ump, struct udf_args *args, int *first_tracknr, int *last_tracknr); //int udf_search_writing_tracks(struct udf_mount *ump); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Sat Jun 23 09:50:41 2012 (r238177) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Sat Jun 23 10:05:28 2012 (r238178) @@ -514,26 +514,30 @@ if ((error = udf_update_discinfo(ump, cp->provider->sectorsize, cp->provider->mediasize))) { printf("UDF mount: error inspecting fs node\n"); - return error; + goto fail; } /* inspect sector size */ ump->sector_size = cp->provider->sectorsize; - sector_size = ump->discinfo.sector_size; + sector_size = ump->sector_size; bshift = 1; while ((1 << bshift) < sector_size) bshift++; if ((1 << bshift) != sector_size) { printf("UDF mount: " "hit implementation fence on sector size\n"); - return EIO; + error = EIO; + goto fail; + } /* temporary check to overcome sectorsize >= 8192 bytes panic */ if (sector_size >= 8192) { printf("UDF mount: " "hit implementation limit, sectorsize to big\n"); - return EIO; + error = EIO; + goto fail; + } /* @@ -543,12 +547,14 @@ if ((mp->mnt_flag & MNT_RDONLY) == 0) { if ((ump->discinfo.mmc_cur & MMC_CAP_RECORDABLE) == 0) { printf("UDF mount: disc is not recordable\n"); - return EROFS; + error = EROFS; + goto fail; } if (ump->discinfo.mmc_cur & MMC_CAP_SEQUENTIAL) { if (ump->discinfo.disc_state == MMC_STATE_FULL) { printf("UDF mount: disc is not appendable\n"); - return EROFS; + error = EROFS; + goto fail; } /* @@ -561,7 +567,8 @@ if (args->sessionnr != 0) { printf("UDF mount: updating a previous session " "not yet allowed\n"); - return EROFS; + error = EROFS; + goto fail; } //#endif }