svn commit: r1522441 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/rf/ server/src/main/java/org/apache/hupa/server/rf/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 05:04:54 2013
New Revision: 1522441

URL: http://svn.apache.org/r1522441
Log:
Remove unused stuff

Removed:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectProxy.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/rf/Subject.java
Modified:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java?rev=1522441r1=1522440r2=1522441view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java
 Thu Sep 12 05:04:54 2013
@@ -24,8 +24,11 @@ public interface HupaRequestFactory exte
  HEAD
  HEAD
  HEAD
+ HEAD
SubjectRequest subjectRequest();
 
+===
+ Remove unused stuff
ImapFolderRequest folderRequest();
 
CheckSessionRequest sessionRequest();



-
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org



svn commit: r1522439 - in /james/hupa/trunk/server/src/main/java/org/apache/hupa/server: service/GetMessageDetailsServiceImpl.java utils/MessageUtils.java

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 05:04:08 2013
New Revision: 1522439

URL: http://svn.apache.org/r1522439
Log:
Move method to Util class

Modified:

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java

Modified: 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java?rev=1522439r1=1522438r2=1522439view=diff
==
--- 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java
 (original)
+++ 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java
 Thu Sep 12 05:04:08 2013
@@ -63,14 +63,11 @@ import javax.mail.Flags.Flag;
 import javax.mail.Header;
 import javax.mail.Message;
 import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
 import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeUtility;
 
+import org.apache.hupa.server.utils.MessageUtils;
 import org.apache.hupa.shared.data.GetMessageDetailsResultImpl;
 import org.apache.hupa.shared.data.MailHeaderImpl;
-import org.apache.hupa.shared.data.MessageAttachmentImpl;
 import org.apache.hupa.shared.data.MessageDetailsImpl;
 import org.apache.hupa.shared.domain.GetMessageDetailsAction;
 import org.apache.hupa.shared.domain.GetMessageDetailsResult;
@@ -127,12 +124,12 @@ public class GetMessageDetailsServiceImp
MessagingException, UnsupportedEncodingException {
MessageDetails mDetails = new MessageDetailsImpl();
 
-   Object con = message.getContent();
+   Object content = message.getContent();
 
StringBuffer sbPlain = new StringBuffer();
ArrayListMessageAttachment attachmentList = new 
ArrayListMessageAttachment();
 
-   boolean isHTML = handleParts(message, con, sbPlain, 
attachmentList);
+   boolean isHTML = MessageUtils.handleParts(message, content, 
sbPlain, attachmentList);
 
  HEAD
  HEAD
@@ -150,115 +147,14 @@ public class GetMessageDetailsServiceImp
 
mDetails.setMessageAttachments(attachmentList);
 
-   for (@SuppressWarnings(unchecked)
-   EnumerationHeader en = message.getAllHeaders(); 
en.hasMoreElements();) {
+   for (@SuppressWarnings(unchecked) EnumerationHeader en = 
message.getAllHeaders(); en.hasMoreElements();) {
Header header = en.nextElement();
mDetails.setMailHeader(new 
MailHeaderImpl(header.getName(), header.getValue()));
-// mDetails.addHeader(header.getName(), header.getValue());
}
 
return mDetails;
}
 
-   /**
-* Handle the parts of the given message. The method will call itself
-* recursively to handle all nested parts
-* 
-* @param message the MimeMessage
-* @param con the current processing Content
-* @param sbPlain the StringBuffer to fill with text
-* @param attachmentList ArrayList with attachments
-* @throws UnsupportedEncodingException
-* @throws MessagingException
-* @throws IOException
-*/
-   protected boolean handleParts(MimeMessage message, Object con, 
StringBuffer sbPlain,
-   ArrayListMessageAttachment attachmentList) throws 
UnsupportedEncodingException, MessagingException,
-   IOException {
-   boolean isHTML = false;
-   if (con instanceof String) {
-   if 
(message.getContentType().toLowerCase().startsWith(text/html)) {
-   isHTML = true;
-   } else {
-   isHTML = false;
-   }
-   sbPlain.append((String) con);
-
-   } else if (con instanceof Multipart) {
-
-   Multipart mp = (Multipart) con;
-   String multipartContentType = 
mp.getContentType().toLowerCase();
-
-   String text = null;
-
-   if 
(multipartContentType.startsWith(multipart/alternative)) {
-   isHTML = handleMultiPartAlternative(mp, 
sbPlain);
-   } else {
-   for (int i = 0; i  mp.getCount(); i++) {
-   Part part = mp.getBodyPart(i);
-
-   String contentType = 
part.getContentType().toLowerCase();
-
-   Boolean bodyRead = sbPlain.length()  0

svn commit: r1522442 - /james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 05:05:13 2013
New Revision: 1522442

URL: http://svn.apache.org/r1522442
Log:
Disable InImapUserPreferencesStorage

Modified:

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java

Modified: 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java?rev=1522442r1=1522441r2=1522442view=diff
==
--- 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java
 (original)
+++ 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java
 Thu Sep 12 05:05:13 2013
@@ -48,6 +48,7 @@ import org.apache.hupa.server.guice.prov
 import org.apache.hupa.server.guice.providers.JavaMailSessionProvider;
 import org.apache.hupa.server.guice.providers.LogProvider;
 import org.apache.hupa.server.preferences.InImapUserPreferencesStorage;
+import org.apache.hupa.server.preferences.InSessionUserPreferencesStorage;
 import org.apache.hupa.server.preferences.UserPreferencesStorage;
 import org.apache.hupa.server.service.CheckSessionService;
 import org.apache.hupa.server.service.CheckSessionServiceImpl;
@@ -511,12 +512,17 @@ public class GuiceServerModule extends A

bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
bind(Session.class).toProvider(JavaMailSessionProvider.class);
  HEAD
+ HEAD
 // bind(HttpSession.class).toProvider(HttpSessionProvider.class);
  Make chechsession and login work with RF, with refactoring fetch 
  folders.
bind(Properties.class).toInstance(properties);
 ===
  forward and reply message to use RF
 
bind(UserPreferencesStorage.class).to(InImapUserPreferencesStorage.class);
+===
+//
bind(UserPreferencesStorage.class).to(InImapUserPreferencesStorage.class);
+
bind(UserPreferencesStorage.class).to(InSessionUserPreferencesStorage.class);
+ Disable InImapUserPreferencesStorage
bind(Properties.class).toInstance(properties);
}
 



-
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org



svn commit: r1522443 - /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 05:05:33 2013
New Revision: 1522443

URL: http://svn.apache.org/r1522443
Log:
make cursor pointer to the right place

Modified:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml?rev=1522443r1=1522442r2=1522443view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
 Thu Sep 12 05:05:33 2013
@@ -134,7 +134,6 @@
.moreHeaders {
position: absolute;
top: 8px;
-cursor: pointer;
right: 18px;
width: 18em;
text-align: right;
@@ -149,6 +148,7 @@
height: 13px;
text-indent: 1000px;
overflow: hidden;
+  cursor: pointer;
}
/ui:style
g:DockLayoutPanel unit=PX
@@ -174,5 +174,9 @@
/g:DockLayoutPanel
/g:center
/g:DockLayoutPanel
+ HEAD
  fixed issue#64, add attachments region in message content view
-/ui:UiBinder
\ No newline at end of file
+/ui:UiBinder
+===
+/ui:UiBinder
+ make cursor pointer to the right place



-
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org



svn commit: r1516486 [4/4] - in /james/hupa/trunk: ./ client/ client/src/main/java/org/apache/hupa/ client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/client/activity/ c

2013-08-22 Thread dongxu
Modified: 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java?rev=1516486r1=1516485r2=1516486view=diff
==
--- 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
 (original)
+++ 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
 Thu Aug 22 15:29:57 2013
@@ -34,20 +34,16 @@ import javax.activation.DataHandler;
 import javax.activation.DataSource;
 import javax.mail.Address;
 import javax.mail.BodyPart;
-import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
 import javax.mail.Part;
 import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeUtility;
 
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.logging.Log;
-import org.apache.hupa.shared.data.MessageAttachmentImpl;
-import org.apache.hupa.shared.domain.MessageAttachment;
 
 
 
@@ -124,104 +120,6 @@ public class MessageUtils {
 }
 return ret;
 }
-
-/**
- * Handle the parts of the given message. The method will call itself
- * recursively to handle all nested parts
- * 
- * @param message the MimeMessage
- * @param content the current processing Content
- * @param sbPlain the StringBuffer to fill with text
- * @param attachmentList ArrayList with attachments
- * @throws UnsupportedEncodingException
- * @throws MessagingException
- * @throws IOException
- */
-public static boolean handleParts(Message message, Object content, 
StringBuffer sbPlain,
-ArrayListMessageAttachment attachmentList) throws 
UnsupportedEncodingException, MessagingException,
-IOException {
-boolean isHTML = false;
-if (content instanceof String) {
-if 
(message.getContentType().toLowerCase().startsWith(text/html)) {
-isHTML = true;
-} else {
-isHTML = false;
-}
-sbPlain.append((String) content);
-
-} else if (content instanceof Multipart) {
-
-Multipart mp = (Multipart) content;
-String multipartContentType = mp.getContentType().toLowerCase();
-
-String text = null;
-
-if (multipartContentType.startsWith(multipart/alternative)) {
-isHTML = handleMultiPartAlternative(mp, sbPlain);
-} else {
-for (int i = 0; i  mp.getCount(); i++) {
-Part part = mp.getBodyPart(i);
-
-String contentType = part.getContentType().toLowerCase();
-
-Boolean bodyRead = sbPlain.length()  0;
-
-if (!bodyRead  contentType.startsWith(text/plain)) {
-isHTML = false;
-text = (String) part.getContent();
-} else if (!bodyRead  
contentType.startsWith(text/html)) {
-isHTML = true;
-text = (String) part.getContent();
-} else if (!bodyRead  
contentType.startsWith(message/rfc822)) {
-// Extract the message and pass it
-MimeMessage msg = (MimeMessage) 
part.getDataHandler().getContent();
-isHTML = handleParts(msg, msg.getContent(), sbPlain, 
attachmentList);
-} else {
-if (part.getFileName() != null) {
-// Inline images are not added to the attachment
-// list
-// TODO: improve the in-line images detection
-if (part.getHeader(Content-ID) == null) {
-MessageAttachment attachment = new 
MessageAttachmentImpl();
-
attachment.setName(MimeUtility.decodeText(part.getFileName()));
-
attachment.setContentType(part.getContentType());
-attachment.setSize(part.getSize());
-attachmentList.add(attachment);
-}
-} else {
-isHTML = handleParts(message, part.getContent(), 
sbPlain, attachmentList);
-}
-}
-
-}
-if (text != null)
-sbPlain.append(text);
-}
-
-}
-return isHTML;
-}
-
-private static boolean handleMultiPartAlternative(Multipart mp, 
StringBuffer sbPlain) throws MessagingException, IOException {
-String text = null;
-

svn commit: r1516500 - in /james/hupa/trunk: ./ client/ client/src/main/java/org/apache/hupa/ client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/client/bundles/ client/s

2013-08-22 Thread dongxu
Author: dongxu
Date: Thu Aug 22 16:17:04 2013
New Revision: 1516500

URL: http://svn.apache.org/r1516500
Log:
commit

Modified:
james/hupa/trunk/README.txt
james/hupa/trunk/client/pom.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/HupaProd.gwt.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/bundles/HupaImageBundle.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/dnd/PagingScrollTableRowDragController.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/preferences/UserPreferencesStorage.java

james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ReplyMessageEvent.java

Modified: james/hupa/trunk/README.txt
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/README.txt?rev=1516500r1=1516499r2=1516500view=diff
==
--- james/hupa/trunk/README.txt (original)
+++ james/hupa/trunk/README.txt Thu Aug 22 16:17:04 2013
@@ -1,9 +1,9 @@
-## Bulding ###
+## Bulding ##
 Hupa use maven2 as build tool. To build hupa download maven2 
(http://maven.apache.org), unpack maven2 and install it.
 After that change to hupa directory and execute the following cmd:
 $ mvn clean package
 
-## Configuring server side  
+## Configuring server side  
 Hupa uses a properties file to know the IMAP and SMTP servers configuration.
 There is an example configuration file in 
'server/src/main/webapp/WEB-INF/conf/config.properties'
 
@@ -13,7 +13,7 @@ There is an example configuration file i
 - Or in any other file if you start your application server with the parameter:
   -Dhupa.config.file=full_path_to_your_properties_file
 
-# Running Hupa #
+# Running Hupa ##
 Hupa comes packaged with a servlet-container, so once you have compiled the 
app just run:
 $ java -jar target/hupa-${version}.war
 
@@ -54,4 +54,5 @@ shared, mock, server, widget and client.
'GWT module hupa needs to be (re)compiled, please run a compile or use 
the Compile/Browse button in hosted mode'
  
   Configure the plugin to compile only the 'Hupa' module.
-  Properties - Google - Web Toolkit - Entry Point Modules - Hupa - 
org.apache.hupa 
+  Properties - Google - Web Toolkit - Entry Point Modules - Hupa - 
org.apache.hupa
+ 

Modified: james/hupa/trunk/client/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1516500r1=1516499r2=1516500view=diff
==
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Thu Aug 22 16:17:04 2013
@@ -17,12 +17,15 @@
 specific language governing permissions and limitations
 under the License.
 --
-project xmlns=http://maven.apache.org/POM/4.0.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;
+project
+xmlns=http://maven.apache.org/POM/4.0.0;
+xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
+xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;
 modelVersion4.0.0/modelVersion
 parent
-groupIdorg.apache.james.hupa/groupId
+groupIdorg.apache.hupa/groupId
 artifactIdhupa-parent/artifactId
-version0.0.3-SNAPSHOT/version
+version0.0.2-SNAPSHOT/version
 relativePath../pom.xml/relativePath
 /parent
 artifactIdhupa/artifactId
@@ -31,33 +34,15 @@
 descriptionA GWT based IMAP webmail/description
 dependencies
 dependency
-groupIdcom.google.gwt/groupId
-artifactIdgwt-user/artifactId
-exclusions
-exclusion
-groupIdjavax.validation/groupId
-artifactIdvalidation-api/artifactId
-/exclusion
-/exclusions
-/dependency
-dependency
-groupIdcom.google.gwt/groupId
-artifactIdgwt-dev/artifactId
-/dependency
-dependency
-groupId${project.groupId}/groupId
+groupIdorg.apache.hupa/groupId
 artifactIdhupa-server/artifactId
 /dependency
 dependency
-groupId${project.groupId}/groupId
-artifactIdhupa-mock/artifactId
-/dependency
-dependency
-groupId${project.groupId}/groupId
+groupIdorg.apache.hupa/groupId
 artifactIdhupa-shared/artifactId
 /dependency
 dependency
-groupId${project.groupId}/groupId
+groupIdorg.apache.hupa/groupId
 artifactIdhupa-widgets/artifactId

svn commit: r1516164 [20/20] - in /james/hupa/trunk: ./ client/ client/src/main/java/com/ client/src/main/java/com/google/ client/src/main/java/com/google/web/ client/src/main/java/com/google/web/bind

2013-08-21 Thread dongxu
Copied: 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java
 (from r1375909, 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java)
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.javap1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.javar1=1375909r2=1516164rev=1516164view=diff
==
--- 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java
 (original)
+++ 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java
 Wed Aug 21 14:08:19 2013
@@ -17,13 +17,11 @@
  * under the License.   *
  /
 
-package org.apache.hupa.shared.rpc;
+package org.apache.hupa.shared.events;
 
-public class MoveMessageResult extends GenericResult{
+import com.google.gwt.event.shared.EventHandler;
 
-/**
- * 
- */
-private static final long serialVersionUID = 341407423455525004L;
+public interface RefreshLabelListEventHandler extends EventHandler{
 
+public void onRefreshEvent(RefreshLabelListEvent event);
 }

Copied: 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java
 (from r1375909, 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java)
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.javap1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.javar1=1375909r2=1516164rev=1516164view=diff
==
--- 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java
 (original)
+++ 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java
 Wed Aug 21 14:08:19 2013
@@ -19,31 +19,30 @@
 
 package org.apache.hupa.shared.events;
 
-import org.apache.hupa.shared.data.User;
-
 import com.google.gwt.event.shared.GwtEvent;
 
-public class LoginEvent extends GwtEventLoginEventHandler{
+public class RefreshMessagesEvent extends 
GwtEventRefreshMessagesEventHandler {
+   public final static TypeRefreshMessagesEventHandler TYPE = new 
TypeRefreshMessagesEventHandler();
+
+   private String searchValue;
 
-public final static TypeLoginEventHandler TYPE = new 
TypeLoginEventHandler();
-private User user;
-
-public LoginEvent(User user) {
-this.user = user;
-}
-
-public User getUser() {
-return user;
-}
-
-@Override
-public TypeLoginEventHandler getAssociatedType() {
-return TYPE;
-}
-
-@Override
-protected void dispatch(LoginEventHandler handler) {
-handler.onLogin(this);
-}
+   public String getSearchValue() {
+   return searchValue;
+   }
+
+   public RefreshMessagesEvent() {
+   }
+   public RefreshMessagesEvent(String searchValue) {
+   this.searchValue = searchValue;
+   }
+   @Override
+   protected void dispatch(RefreshMessagesEventHandler handler) {
+   handler.onRefresh(this);
+   }
+
+   @Override
+   public 
com.google.gwt.event.shared.GwtEvent.TypeRefreshMessagesEventHandler 
getAssociatedType() {
+   return TYPE;
+   }
 
 }

Copied: 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java
 (from r1375909, 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java)
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.javap1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.javar1=1375909r2=1516164rev=1516164view=diff
==
--- 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java
 (original)
+++ 
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java
 Wed Aug 21 14:08:19 2013
@@ -17,13 +17,11 @@
  * under the License.   *
  /
 
-package org.apache.hupa.shared.rpc;
+package org.apache.hupa.shared.events;
 
-public class MoveMessageResult 

Browser reloading related issues in GWT

2013-06-11 Thread dongxu

Hi Manolo,
An issue #46 
https://code.google.com/a/apache-extras.org/p/hupa-evo/issues/detail?id=46#c1[1] 
email cc-ed you. Also ccing this thread to james-list since, I guess, 
the issue might be useful/helpful/returnable to others who are using GWT.
I agree with tbroyer's point about how to update the state of Activity 
without coupling both of activities and their places here 
http://stackoverflow.com/questions/12073123/gwt-mvp-updating-activity-state-on-place-change/12074549#12074549[2], 
but it seems not working if I reload the browser totally rather than 
just goTo another place. For example, if I push the F5 or Reload button 
of browser, the messages list should perform like Gmail's one that it 
will show loading progress bar then go to the right state what you were 
looking just now.
May I know how are you coping with such case, that is go to or reload 
one place with one or more STATEs.(seems Hupa is using EventBus, but in 
Evo the main panel's state can not bind to eventBus until the main 
Activity, which forwarded from Login Activity, get started).


Thanks in advance,
-echo



[1] 
https://code.google.com/a/apache-extras.org/p/hupa-evo/issues/detail?id=46#c1
[2] 
http://stackoverflow.com/questions/12073123/gwt-mvp-updating-activity-state-on-place-change/12074549#12074549


Re: [Qemu-devel] [PATCH V19 1/8] V18: docs: document for add-cow file format

2013-06-02 Thread Dongxu Wang

On 2013/6/3 9:48, Fam Zheng wrote:

On Thu, 05/30 18:00, Dongxu Wang wrote:

From: Dong Xu Wang wdon...@linux.vnet.ibm.com

Document for add-cow format, the usage and spec of add-cow are
introduced.

v18-v19:
1) backing_fmt and image_fmt NUL-terminated.
2) other fix.
V17-V18:
1) remove version field.
2) header size is maximum value and cluster size value.
3) fix type.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com


Changed git config? I suggest you could remove the old SOB line (if
respin).

Oh, yes, I changed my gitconfig file, and I did not notice these wrong 
SOB line, please ignore these boring lines. :)







[Qemu-devel] [PATCH V15 1/6] add def_value_str in QemuOptDesc struct and rewrite qemu_opts_print

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

qemu_opts_print has no user now, so can re-write the function safely.

qemu_opts_print will be used while using qemu-img create, it will
produce the same output as previous code.

The behavior of this function has changed:

1. Print every possible option, whether a value has been set or not.
2. Option descriptors may provide a default value.
3. Print to stdout instead of stderr.

Previously the behavior was to print every option that has been set.
Options that have not been set would be skipped.

v13-v14:
1) fix memory leak.
2) make opt_set do not accpet null value argument.

v12-v13
1) re-write commit message.

v11-v12
1) make def_value_str become the real default value string in opt_set
function.

v10-v11:
1) print all values that have actually been assigned while accept-any
cases.

v7-v8:
1) print elements = accept any params while opts_accepts_any() ==
true.
2) since def_print_str is the default value if an option isn't set,
so rename it to def_value_str.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 include/qemu/option.h |  3 ++-
 util/qemu-option.c| 32 ++--
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index bdb6d21..b928ab0 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -96,6 +96,7 @@ typedef struct QemuOptDesc {
 const char *name;
 enum QemuOptType type;
 const char *help;
+const char *def_value_str;
 } QemuOptDesc;
 
 struct QemuOptsList {
@@ -152,7 +153,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict);
 void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp);
 
 typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque);
-int qemu_opts_print(QemuOpts *opts, void *dummy);
+int qemu_opts_print(QemuOpts *opts);
 int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void 
*opaque,
   int abort_on_failure);
 
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 8b74bf1..84d8c8b 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -860,16 +860,36 @@ void qemu_opts_del(QemuOpts *opts)
 g_free(opts);
 }
 
-int qemu_opts_print(QemuOpts *opts, void *dummy)
+int qemu_opts_print(QemuOpts *opts)
 {
 QemuOpt *opt;
+QemuOptDesc *desc = opts-list-desc;
 
-fprintf(stderr, %s: %s:, opts-list-name,
-opts-id ? opts-id : noid);
-QTAILQ_FOREACH(opt, opts-head, next) {
-fprintf(stderr,  %s=\%s\, opt-name, opt-str);
+if (desc[0].name == NULL) {
+QTAILQ_FOREACH(opt, opts-head, next) {
+printf(%s=\%s\ , opt-name, opt-str);
+}
+return 0;
+}
+for (; desc  desc-name; desc++) {
+const char *value = desc-def_value_str;
+QemuOpt *opt;
+
+opt = qemu_opt_find(opts, desc-name);
+if (opt) {
+value = opt-str;
+}
+
+if (!value) {
+continue;
+}
+
+if (desc-type == QEMU_OPT_STRING) {
+printf(%s='%s' , desc-name, value);
+} else {
+printf(%s=%s , desc-name, value);
+}
 }
-fprintf(stderr, \n);
 return 0;
 }
 
-- 
1.7.11.7




[Qemu-devel] [PATCH V15 2/6] avoid duplication of default value in QemuOpts

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

This patch will move the default value entirely to QemuOptDesc.

When getting the value of an option that hasn't been set, and
QemuOptDesc has a default value, return that.  Else, behave as
before.

Example: qemu_opt_get_number(opts, foo, 42)

   If foo has been set in opts, return its value.

   Else, if opt's QemuOptDesc has a default value for foo, return
   that.

   Else, return 42.

   Note that the last argument is useless when QemuOptDesc has a
   default value.  Ugly.  If it bothers us, we could assert.

Example: qemu_opt_get(opts, bar)

   If bar has been set in opts, return its value.

   Else, if opt's QemuOptDesc has a default value for bar, return
   that.

   Else, return NULL.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com

v13-v14:
1) change code style.
2) assert errors.
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 util/qemu-option.c | 66 --
 1 file changed, 49 insertions(+), 17 deletions(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index 84d8c8b..bd2acdc 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -525,9 +525,31 @@ static QemuOpt *qemu_opt_find(QemuOpts *opts, const char 
*name)
 return NULL;
 }
 
+static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc,
+const char *name)
+{
+int i;
+
+for (i = 0; desc[i].name != NULL; i++) {
+if (strcmp(desc[i].name, name) == 0) {
+return desc[i];
+}
+}
+
+return NULL;
+}
+
 const char *qemu_opt_get(QemuOpts *opts, const char *name)
 {
 QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+
+if (!opt) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+return desc-def_value_str;
+}
+}
 return opt ? opt-str : NULL;
 }
 
@@ -546,9 +568,17 @@ bool qemu_opt_has_help_opt(QemuOpts *opts)
 bool qemu_opt_get_bool(QemuOpts *opts, const char *name, bool defval)
 {
 QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+Error *local_err = NULL;
 
-if (opt == NULL)
+if (opt == NULL) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+parse_option_bool(name, desc-def_value_str, defval, local_err);
+assert(!local_err);
+}
 return defval;
+}
 assert(opt-desc  opt-desc-type == QEMU_OPT_BOOL);
 return opt-value.boolean;
 }
@@ -556,9 +586,17 @@ bool qemu_opt_get_bool(QemuOpts *opts, const char *name, 
bool defval)
 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval)
 {
 QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+Error *local_err = NULL;
 
-if (opt == NULL)
+if (opt == NULL) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+parse_option_number(name, desc-def_value_str, defval, 
local_err);
+assert(!local_err);
+}
 return defval;
+}
 assert(opt-desc  opt-desc-type == QEMU_OPT_NUMBER);
 return opt-value.uint;
 }
@@ -566,9 +604,17 @@ uint64_t qemu_opt_get_number(QemuOpts *opts, const char 
*name, uint64_t defval)
 uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval)
 {
 QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+Error *local_err = NULL;
 
-if (opt == NULL)
+if (opt == NULL) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+parse_option_size(name, desc-def_value_str, defval, local_err);
+assert(!local_err);
+}
 return defval;
+}
 assert(opt-desc  opt-desc-type == QEMU_OPT_SIZE);
 return opt-value.uint;
 }
@@ -609,20 +655,6 @@ static bool opts_accepts_any(const QemuOpts *opts)
 return opts-list-desc[0].name == NULL;
 }
 
-static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc,
-const char *name)
-{
-int i;
-
-for (i = 0; desc[i].name != NULL; i++) {
-if (strcmp(desc[i].name, name) == 0) {
-return desc[i];
-}
-}
-
-return NULL;
-}
-
 static void opt_set(QemuOpts *opts, const char *name, const char *value,
 bool prepend, Error **errp)
 {
-- 
1.7.11.7




[Qemu-devel] [PATCH V15 0/6] replace QEMUOptionParameter with QemuOpts parser

2013-05-30 Thread Dongxu Wang
These patches will replace QEMUOptionParameter with QemuOpts. Change logs
please go to each patch's commit message.

V14-V15:
1) Only delete enum QEMUOptionParType.

Dong Xu Wang (6):
  add def_value_str in QemuOptDesc struct and rewrite qemu_opts_print
  avoid duplication of default value in QemuOpts
  Create four QemuOptsList related functions
  Create some QemuOpts functons
  Use QemuOpts support in block layer
  remove QEMUOptionParameter related functions and struct

 block.c   | 100 
 block/cow.c   |  52 ++---
 block/gluster.c   |  37 ++-
 block/iscsi.c |  31 ++-
 block/qcow.c  |  67 +++---
 block/qcow2.c | 199 
 block/qed.c   | 108 +
 block/qed.h   |   2 +-
 block/raw-posix.c |  59 +++--
 block/raw-win32.c |  31 +--
 block/raw.c   |  30 +--
 block/rbd.c   |  62 +++--
 block/sheepdog.c  |  81 ---
 block/ssh.c   |  29 ++-
 block/vdi.c   |  70 +++---
 block/vmdk.c  | 128 ++-
 block/vpc.c   |  65 +++---
 block/vvfat.c |  11 +-
 include/block/block.h |   5 +-
 include/block/block_int.h |   6 +-
 include/qemu/option.h |  56 ++---
 qemu-img.c|  65 +++---
 util/qemu-option.c| 571 +-
 23 files changed, 904 insertions(+), 961 deletions(-)

-- 
1.7.11.7




[Qemu-devel] [PATCH V15 4/6] Create some QemuOpts functons

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

These functions will be used in next commit.

qemu_opt_get_(*)_del functions are used to make sure we
have the same behaviors as before: in block layer, after
parsing a parameter value, parameter list will delete it
to avoid parsing it twice.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com

v13-v14:
1) rewrite commit message.
2) use def_value_str in qemu_opt_get_FOO_del() and qemu_opt_get_del().
3) delete redundant qemu_opt_del(opt).
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 include/qemu/option.h |  11 -
 util/qemu-option.c| 116 +++---
 2 files changed, 119 insertions(+), 8 deletions(-)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index c7a5c14..d63e447 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -108,6 +108,7 @@ struct QemuOptsList {
 };
 
 const char *qemu_opt_get(QemuOpts *opts, const char *name);
+const char *qemu_opt_get_del(QemuOpts *opts, const char *name);
 /**
  * qemu_opt_has_help_opt:
  * @opts: options to search for a help request
@@ -121,13 +122,18 @@ const char *qemu_opt_get(QemuOpts *opts, const char 
*name);
  */
 bool qemu_opt_has_help_opt(QemuOpts *opts);
 bool qemu_opt_get_bool(QemuOpts *opts, const char *name, bool defval);
+bool qemu_opt_get_bool_del(QemuOpts *opts, const char *name, bool defval);
 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t 
defval);
 uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
+uint64_t qemu_opt_get_size_del(QemuOpts *opts, const char *name,
+   uint64_t defval);
 int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
+int qemu_opt_replace_set(QemuOpts *opts, const char *name, const char *value);
 void qemu_opt_set_err(QemuOpts *opts, const char *name, const char *value,
   Error **errp);
 int qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val);
 int qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val);
+int qemu_opt_replace_set_number(QemuOpts *opts, const char *name, int64_t val);
 typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void 
*opaque);
 int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
  int abort_on_failure);
@@ -144,7 +150,10 @@ const char *qemu_opts_id(QemuOpts *opts);
 void qemu_opts_del(QemuOpts *opts);
 void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp);
 int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char 
*firstname);
-QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int 
permit_abbrev);
+int qemu_opts_do_parse_replace(QemuOpts *opts, const char *params,
+   const char *firstname);
+QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
+  int permit_abbrev);
 void qemu_opts_set_defaults(QemuOptsList *list, const char *params,
 int permit_abbrev);
 QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
diff --git a/util/qemu-option.c b/util/qemu-option.c
index e3f482f..3251adc 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -33,6 +33,8 @@
 #include qapi/qmp/qerror.h
 #include qemu/option_int.h
 
+static void qemu_opt_del(QemuOpt *opt);
+
 /*
  * Extracts the name of an option from the parameter string (p points at the
  * first byte of the option name)
@@ -553,6 +555,24 @@ const char *qemu_opt_get(QemuOpts *opts, const char *name)
 return opt ? opt-str : NULL;
 }
 
+const char *qemu_opt_get_del(QemuOpts *opts, const char *name)
+{
+QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+const char *str = NULL;
+
+if (!opt) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+str = g_strdup(desc-def_value_str);
+}
+} else {
+str = g_strdup(opt-str);
+qemu_opt_del(opt);
+}
+return str;
+}
+
 bool qemu_opt_has_help_opt(QemuOpts *opts)
 {
 QemuOpt *opt;
@@ -583,6 +603,27 @@ bool qemu_opt_get_bool(QemuOpts *opts, const char *name, 
bool defval)
 return opt-value.boolean;
 }
 
+bool qemu_opt_get_bool_del(QemuOpts *opts, const char *name, bool defval)
+{
+QemuOpt *opt = qemu_opt_find(opts, name);
+const QemuOptDesc *desc;
+Error *local_err = NULL;
+bool ret = defval;
+
+if (opt == NULL) {
+desc = find_desc_by_name(opts-list-desc, name);
+if (desc  desc-def_value_str) {
+parse_option_bool(name, desc-def_value_str, ret, local_err);
+assert(!local_err);
+}
+return ret;
+}
+assert(opt-desc  opt-desc-type == QEMU_OPT_BOOL);
+ret = opt-value.boolean;
+qemu_opt_del(opt);
+return ret;
+}
+
 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval

[Qemu-devel] [PATCH V15 3/6] Create four QemuOptsList related functions

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

This patch will create 4 functions, count_opts_list, qemu_opts_append,
qemu_opts_free and qemu_opts_print_help, they will be used in following
commits.

v12-v13:
1) simply assert that neither argument has merge_lists set.
2) drop superfluous paranthesesis around p == first.

v11-v12:
1) renmae functions.
2) fix loop styles and code styles.
3) qemu_opts_apend will not return NULL now.
4) merge_lists value is from arguments in qemu_opts_append.

v6-v7:
1) Fix typo.

v5-v6:
1) allocate enough space in append_opts_list function.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 include/qemu/option.h |  3 ++
 util/qemu-option.c| 82 +++
 2 files changed, 85 insertions(+)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index b928ab0..c7a5c14 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -157,4 +157,7 @@ int qemu_opts_print(QemuOpts *opts);
 int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void 
*opaque,
   int abort_on_failure);
 
+QemuOptsList *qemu_opts_append(QemuOptsList *first, QemuOptsList *second);
+void qemu_opts_free(QemuOptsList *list);
+void qemu_opts_print_help(QemuOptsList *list);
 #endif
diff --git a/util/qemu-option.c b/util/qemu-option.c
index bd2acdc..e3f482f 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -1218,3 +1218,85 @@ int qemu_opts_foreach(QemuOptsList *list, 
qemu_opts_loopfunc func, void *opaque,
 loc_pop(loc);
 return rc;
 }
+
+static size_t count_opts_list(QemuOptsList *list)
+{
+size_t i = 0;
+
+for (i = 0; list  list-desc[i].name; i++) {
+;
+}
+
+return i;
+}
+
+/* Create a new QemuOptsList and make its desc to the merge of first
+ * and second. It will allocate space for one new QemuOptsList plus
+ * enough space for QemuOptDesc in first and second QemuOptsList.
+ * First argument's QemuOptDesc members take precedence over second's.
+ * The result's name and implied_opt_name are not copied from them.
+ * Both merge_lists should not be set. Both list can be NULL.
+ */
+QemuOptsList *qemu_opts_append(QemuOptsList *first,
+   QemuOptsList *second)
+{
+size_t num_first_opts, num_second_opts;
+QemuOptsList *dest = NULL;
+int i = 0;
+int index = 0;
+QemuOptsList *p = first;
+
+num_first_opts = count_opts_list(first);
+num_second_opts = count_opts_list(second);
+
+dest = g_malloc0(sizeof(QemuOptsList)
++ (num_first_opts + num_second_opts + 1) * sizeof(QemuOptDesc));
+
+dest-name = append_opts_list;
+dest-implied_opt_name = NULL;
+assert((!first || !first-merge_lists)
+ (!second || !second-merge_lists));
+QTAILQ_INIT(dest-head);
+
+for (i = 0; p  p-desc[i].name; i++) {
+if (!find_desc_by_name(dest-desc, p-desc[i].name)) {
+dest-desc[index].name = g_strdup(p-desc[i].name);
+dest-desc[index].help = g_strdup(p-desc[i].help);
+dest-desc[index].type = p-desc[i].type;
+dest-desc[index].def_value_str =
+g_strdup(p-desc[i].def_value_str);
+index++;
+}
+if (p == first  p  !p-desc[i].name) {
+p = second;
+i = 0;
+}
+}
+dest-desc[index].name = NULL;
+return dest;
+}
+
+/* free a QemuOptsList, can accept NULL as arguments */
+void qemu_opts_free(QemuOptsList *list)
+{
+int i = 0;
+
+for (i = 0; list  list-desc[i].name; i++) {
+g_free((char *)list-desc[i].name);
+g_free((char *)list-desc[i].help);
+g_free((char *)list-desc[i].def_value_str);
+}
+
+g_free(list);
+}
+
+void qemu_opts_print_help(QemuOptsList *list)
+{
+int i = 0;
+printf(Supported options:\n);
+for (i = 0; list  list-desc[i].name; i++) {
+printf(%-16s %s\n, list-desc[i].name,
+list-desc[i].help ?
+list-desc[i].help : No description available);
+}
+}
-- 
1.7.11.7




[Qemu-devel] [PATCH V15 6/6] remove QEMUOptionParameter related functions and struct

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com


Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 include/qemu/option.h |  39 ---
 util/qemu-option.c| 285 --
 2 files changed, 324 deletions(-)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index d63e447..d2d3f16 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -31,24 +31,6 @@
 #include qapi/error.h
 #include qapi/qmp/qdict.h
 
-enum QEMUOptionParType {
-OPT_FLAG,
-OPT_NUMBER,
-OPT_SIZE,
-OPT_STRING,
-};
-
-typedef struct QEMUOptionParameter {
-const char *name;
-enum QEMUOptionParType type;
-union {
-uint64_t n;
-char* s;
-} value;
-const char *help;
-} QEMUOptionParameter;
-
-
 const char *get_opt_name(char *buf, int buf_size, const char *p, char delim);
 const char *get_opt_value(char *buf, int buf_size, const char *p);
 int get_next_param_value(char *buf, int buf_size,
@@ -58,27 +40,6 @@ int get_param_value(char *buf, int buf_size,
 int check_params(char *buf, int buf_size,
  const char * const *params, const char *str);
 
-
-/*
- * The following functions take a parameter list as input. This is a pointer to
- * the first element of a QEMUOptionParameter array which is terminated by an
- * entry with entry-name == NULL.
- */
-
-QEMUOptionParameter *get_option_parameter(QEMUOptionParameter *list,
-const char *name);
-int set_option_parameter(QEMUOptionParameter *list, const char *name,
-const char *value);
-int set_option_parameter_int(QEMUOptionParameter *list, const char *name,
-uint64_t value);
-QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,
-QEMUOptionParameter *list);
-QEMUOptionParameter *parse_option_parameters(const char *param,
-QEMUOptionParameter *list, QEMUOptionParameter *dest);
-void free_option_parameters(QEMUOptionParameter *list);
-void print_option_parameters(QEMUOptionParameter *list);
-void print_option_help(QEMUOptionParameter *list);
-
 /* -- */
 
 typedef struct QemuOpt QemuOpt;
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 3251adc..e1b2a3b 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -155,22 +155,6 @@ int check_params(char *buf, int buf_size,
 return 0;
 }
 
-/*
- * Searches an option list for an option with the given name
- */
-QEMUOptionParameter *get_option_parameter(QEMUOptionParameter *list,
-const char *name)
-{
-while (list  list-name) {
-if (!strcmp(list-name, name)) {
-return list;
-}
-list++;
-}
-
-return NULL;
-}
-
 static void parse_option_bool(const char *name, const char *value, bool *ret,
   Error **errp)
 {
@@ -244,275 +228,6 @@ static void parse_option_size(const char *name, const 
char *value,
 }
 }
 
-/*
- * Sets the value of a parameter in a given option list. The parsing of the
- * value depends on the type of option:
- *
- * OPT_FLAG (uses value.n):
- *  If no value is given, the flag is set to 1.
- *  Otherwise the value must be on (set to 1) or off (set to 0)
- *
- * OPT_STRING (uses value.s):
- *  value is strdup()ed and assigned as option value
- *
- * OPT_SIZE (uses value.n):
- *  The value is converted to an integer. Suffixes for kilobytes etc. are
- *  allowed (powers of 1024).
- *
- * Returns 0 on succes, -1 in error cases
- */
-int set_option_parameter(QEMUOptionParameter *list, const char *name,
-const char *value)
-{
-bool flag;
-Error *local_err = NULL;
-
-// Find a matching parameter
-list = get_option_parameter(list, name);
-if (list == NULL) {
-fprintf(stderr, Unknown option '%s'\n, name);
-return -1;
-}
-
-// Process parameter
-switch (list-type) {
-case OPT_FLAG:
-parse_option_bool(name, value, flag, local_err);
-if (!error_is_set(local_err)) {
-list-value.n = flag;
-}
-break;
-
-case OPT_STRING:
-if (value != NULL) {
-list-value.s = g_strdup(value);
-} else {
-fprintf(stderr, Option '%s' needs a parameter\n, name);
-return -1;
-}
-break;
-
-case OPT_SIZE:
-parse_option_size(name, value, list-value.n, local_err);
-break;
-
-default:
-fprintf(stderr, Bug: Option '%s' has an unknown type\n, name);
-return -1;
-}
-
-if (error_is_set(local_err)) {
-qerror_report_err(local_err);
-error_free(local_err);
-return -1;
-}
-
-return 0;
-}
-
-/*
- * Sets the given parameter to an integer instead of a string.
- * This function cannot be used to set string options.
- *
- * Returns 0 on success, -1 in error cases
- */
-int set_option_parameter_int(QEMUOptionParameter *list, const char *name,
-uint64_t value)
-{
-// Find a matching parameter
-list

[Qemu-devel] [PATCH V19 0/8] add-cow file format

2013-05-30 Thread Dongxu Wang
It will introduce a new file format: add-cow.

The add-cow file format makes it possible to perform copy-on-write on top of
a raw disk image.  When we know that no backing file clusters remain visible
(e.g. we have streamed the entire image and copied all data from the backing
file), then it is possible to discard the add-cow file and use the raw image
file directly.

This feature adds the copy-on-write feature to raw files (which cannot support
it natively) while allowing us to get full performance again later when we no
longer need copy-on-write.

add-cow can benefit from other available functions, such as path_has_protocol
and qed_read_string, so we will make them public.

snapshot_blkdev are not supported now for add-cow. Will add it in futher 
patches.

These patches are using QemuOpts parser, former patches could be found here:
http://patchwork.ozlabs.org/patch/247508/


v18-v19:
1) support parallel aio write.
2) fix flush method.
3) other small fix.
v17 - v18:
1) remove version field.
2) header size is maximum value and cluster size value.
3) fix type.
4) move struct to source file.
5) cluster_size-table_size.
6) use error_report, not fprintf.
7) remove version field from header.
8) header_size is MAX(cluster_size, 4096).
9) introduce s-cluster_sectors.
10) use BLKDBG_L2_LOAD/UPDATE.
11) add 037 and 038 tests.

v16-v17):
1) Use stringify.

v15-v16):
1) Rebased on QEMU upstream source tree.
2) Judge if opts is null in add_cow_create function.

v14-v15:
1) Fix typo and make some sentences more readable in docs.
2) Introduce STRINGIZER macro.

v13-v14:
1) Make some sentences more clear in docs.
2) Make MAGIC from 8 bytes to 4 bytes.
3) Fix some bugs.

v12-v13:
1) Use QemuOpts, not QEMUOptionParameter
2) cluster_size configuable
3) Refactor block-cache.c
4) Correct qemu-iotests script.
5) Other bug fix.

v11-v12:
1) Removed un-used feature bit.
2) Share cache code with qcow2.c.
3) Remove snapshot_blkdev support, will add it in another patch.
5) COW Bitmap field in add-cow file will be multiple of 65536.
6) fix grammer and typo.

Dong Xu Wang (8):
  V18: docs: document for add-cow file format
  make path_has_protocol non static
  qed_read_string to bdrv_read_string
  rename qcow2-cache.c to block-cache.c
  Make block-cache.c be common interface
  add debug event for add-cow
  add-cow file format core code.
  qemu-iotests: add add-cow iotests support

 block.c  |  29 +-
 block/Makefile.objs  |   4 +-
 block/add-cow.c  | 812 +++
 block/blkdebug.c |   3 +
 block/block-cache.c  | 342 ++
 block/qcow2-cache.c  | 323 -
 block/qcow2-cluster.c|  52 +--
 block/qcow2-refcount.c   |  62 ++--
 block/qcow2.c|  21 +-
 block/qcow2.h|  24 +-
 block/qed.c  |  34 +-
 docs/specs/add-cow.txt   | 172 +
 include/block/block-cache.h  |  59 
 include/block/block.h|   6 +
 include/block/block_int.h|   2 +
 tests/qemu-iotests/017   |   2 +-
 tests/qemu-iotests/020   |   2 +-
 tests/qemu-iotests/037   |   2 +-
 tests/qemu-iotests/038   |   2 +-
 tests/qemu-iotests/common|   6 +
 tests/qemu-iotests/common.rc |  15 +-
 trace-events |  13 +-
 22 files changed, 1536 insertions(+), 451 deletions(-)
 create mode 100644 block/add-cow.c
 create mode 100644 block/block-cache.c
 delete mode 100644 block/qcow2-cache.c
 create mode 100644 docs/specs/add-cow.txt
 create mode 100644 include/block/block-cache.h

-- 
1.7.11.7




[Qemu-devel] [PATCH V19 1/8] V18: docs: document for add-cow file format

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

Document for add-cow format, the usage and spec of add-cow are
introduced.

v18-v19:
1) backing_fmt and image_fmt NUL-terminated.
2) other fix.
V17-V18:
1) remove version field.
2) header size is maximum value and cluster size value.
3) fix type.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 docs/specs/add-cow.txt | 172 +
 1 file changed, 172 insertions(+)
 create mode 100644 docs/specs/add-cow.txt

diff --git a/docs/specs/add-cow.txt b/docs/specs/add-cow.txt
new file mode 100644
index 000..fba74dd
--- /dev/null
+++ b/docs/specs/add-cow.txt
@@ -0,0 +1,172 @@
+== General ==
+
+The raw file format does not support backing files or copy on write
+feature. The add-cow image format makes it possible to use backing
+files with an image by keeping a separate .add-cow metadata file.
+Once all clusters have been written into the image it is safe to
+discard the .add-cow and backing files, then we can use the image
+directly.
+
+An example usage of add-cow would look like:
+(ubuntu.img is a disk image which has an installed OS.)
+1)  Create an image, such as raw format, with the same size of
+ubuntu.img:
+qemu-img create -f raw test.raw 8G
+2)  Create an add-cow image which will store dirty bitmap
+qemu-img create -f add-cow test.add-cow \
+-o backing_file=ubuntu.img,image_file=test.raw
+3)  Run qemu with add-cow image
+qemu -drive if=virtio,file=test.add-cow
+
+test.raw may be larger than ubuntu.img, in that case, the size of
+test.add-cow will be calculated from the size of test.raw.
+
+image_fmt can be omitted, in that case image_fmt is assumed to be
+raw. backing_fmt can also be omitted, add-cow should do a probe
+operation and determine what the backing file's format is. It is
+recommended to always specify the format for any raw file, because
+probing a raw file is a security hole.
+
+=Specification=
+
+The file format looks like this:
+
+ +---+---+
+ | Header|   COW bitmap  |
+ +---+---+
+
+All numbers in add-cow are stored in Little Endian byte order.
+
+== Header ==
+
+The Header is included in the first bytes:
+(HEADER_SIZE is defined in 40-43 bytes.)
+Byte0  -  3:magic
+add-cow magic string (ACOW). It is coded in
+free-form ASCII.
+
+4  -  7:backing file name offset
+Offset in the add-cow file at which the backing
+file name is stored (NB: The string is NOT
+NUL-terminated).
+If backing file name does NOT exist, this field
+will be 0. Must be between 76 and [HEADER_SIZE
+- 2](a file name must be at least 1 byte).
+
+8  - 11:backing file name size
+Length of the backing file name in bytes. It
+will be 0 if the backing file name offset is
+0. If backing file name offset is non-zero,
+then it must be non-zero. Must be less than
+[HEADER_SIZE - 76] to fit in the reserved
+part of the header. Backing file name offset
++ size must be no more than HEADER_SIZE.
+
+12 - 15:image file name offset
+Offset in the add-cow file at which the image
+file name is stored (NB: The string is NOT
+NUL-terminated). It must be between 76 and
+[HEADER_SIZE - 2]. Image file name size + offset
+must be no more than HEADER_SIZE.
+
+16 - 19:image file name size
+Length of the image file name in bytes.
+Must be less than [HEADER_SIZE - 76] to fit in
+the reserved part of the header.
+
+20 - 23:cluster bits
+Number of bits that are used for addressing an
+offset within a cluster (1  cluster_bits is
+the cluster size). Must not be less than 12
+(i.e. 4096 byte clusters).
+
+Note: qemu as of today has an implementation
+limit of 2 MB as the maximum cluster size and
+won't be able to open images with larger cluster
+sizes.
+
+24 - 31:features
+Bitmask of features. If a feature bit is set
+but not recognized, the opening add-cow file must
+fail.  No features bits are currently defined

[Qemu-devel] [PATCH V19 4/8] rename qcow2-cache.c to block-cache.c

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

Block layer will use qcow2-cache as common cache code, so rename
it to block-cache.c.

v18-v19:
1) only rename, did not touch other code.

Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block/Makefile.objs|   3 +-
 block/block-cache.c| 323 +
 block/qcow2-cache.c| 323 -
 block/qcow2-cluster.c  |  48 
 block/qcow2-refcount.c |  42 +++
 block/qcow2.c  |  18 +--
 block/qcow2.h  |  28 ++---
 trace-events   |  12 +-
 8 files changed, 399 insertions(+), 398 deletions(-)
 create mode 100644 block/block-cache.c
 delete mode 100644 block/qcow2-cache.c

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 5f0358a..16e574a 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -1,5 +1,6 @@
 block-obj-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o 
vvfat.o
-block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o 
qcow2-cache.o
+block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
+block-obj-y += block-cache.o
 block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
 block-obj-y += qed-check.o
 block-obj-y += vhdx.o
diff --git a/block/block-cache.c b/block/block-cache.c
new file mode 100644
index 000..bc057a8
--- /dev/null
+++ b/block/block-cache.c
@@ -0,0 +1,323 @@
+/*
+ * L2/refcount table cache for the QCOW2 format
+ *
+ * Copyright (c) 2010 Kevin Wolf kw...@redhat.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include block/block_int.h
+#include qemu-common.h
+#include qcow2.h
+#include trace.h
+
+typedef struct BlockCachedTable {
+void*   table;
+int64_t offset;
+booldirty;
+int cache_hits;
+int ref;
+} BlockCachedTable;
+
+struct BlockCache {
+BlockCachedTable*   entries;
+struct BlockCache*  depends;
+int size;
+booldepends_on_flush;
+};
+
+BlockCache *block_cache_create(BlockDriverState *bs, int num_tables)
+{
+BDRVQcowState *s = bs-opaque;
+BlockCache *c;
+int i;
+
+c = g_malloc0(sizeof(*c));
+c-size = num_tables;
+c-entries = g_malloc0(sizeof(*c-entries) * num_tables);
+
+for (i = 0; i  c-size; i++) {
+c-entries[i].table = qemu_blockalign(bs, s-cluster_size);
+}
+
+return c;
+}
+
+int block_cache_destroy(BlockDriverState* bs, BlockCache *c)
+{
+int i;
+
+for (i = 0; i  c-size; i++) {
+assert(c-entries[i].ref == 0);
+qemu_vfree(c-entries[i].table);
+}
+
+g_free(c-entries);
+g_free(c);
+
+return 0;
+}
+
+static int block_cache_flush_dependency(BlockDriverState *bs, BlockCache *c)
+{
+int ret;
+
+ret = block_cache_flush(bs, c-depends);
+if (ret  0) {
+return ret;
+}
+
+c-depends = NULL;
+c-depends_on_flush = false;
+
+return 0;
+}
+
+static int block_cache_entry_flush(BlockDriverState *bs, BlockCache *c, int i)
+{
+BDRVQcowState *s = bs-opaque;
+int ret = 0;
+
+if (!c-entries[i].dirty || !c-entries[i].offset) {
+return 0;
+}
+
+trace_block_cache_entry_flush(qemu_coroutine_self(),
+  c == s-l2_table_cache, i);
+
+if (c-depends) {
+ret = block_cache_flush_dependency(bs, c);
+} else if (c-depends_on_flush) {
+ret = bdrv_flush(bs-file);
+if (ret = 0) {
+c-depends_on_flush = false;
+}
+}
+
+if (ret  0) {
+return ret;
+}
+
+if (c == s-refcount_block_cache) {
+BLKDBG_EVENT(bs-file, BLKDBG_REFBLOCK_UPDATE_PART);
+} else if (c == s-l2_table_cache) {
+BLKDBG_EVENT(bs-file, BLKDBG_L2_UPDATE);
+}
+
+ret = bdrv_pwrite(bs-file, c-entries[i].offset, c-entries[i].table,
+s-cluster_size);
+if (ret  0) {
+return

[Qemu-devel] [PATCH V19 3/8] qed_read_string to bdrv_read_string

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

Make qed_read_string function to a common interface, so move it to
block.c.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block.c   | 27 +++
 block/qed.c   | 34 --
 include/block/block.h |  2 ++
 3 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/block.c b/block.c
index 5135044..65c5e76 100644
--- a/block.c
+++ b/block.c
@@ -210,6 +210,33 @@ int path_has_protocol(const char *path)
 return *p == ':';
 }
 
+/**
+ * Read a string of known length from the image file
+ *
+ * @bs: Image file
+ * @offset: File offset to start of string, in bytes
+ * @n:  String length in bytes
+ * @buf:Destination buffer
+ * @buflen: Destination buffer length in bytes
+ * @ret:0 on success, -errno on failure
+ *
+ * The string is NUL-terminated.
+ */
+int bdrv_read_string(BlockDriverState *bs, uint64_t offset, size_t n,
+ char *buf, size_t buflen)
+{
+int ret;
+if (n = buflen) {
+return -EINVAL;
+}
+ret = bdrv_pread(bs, offset, buf, n);
+if (ret  0) {
+return ret;
+}
+buf[n] = '\0';
+return 0;
+}
+
 int path_is_absolute(const char *path)
 {
 #ifdef _WIN32
diff --git a/block/qed.c b/block/qed.c
index 88daf22..077da76 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -217,33 +217,6 @@ static bool qed_is_image_size_valid(uint64_t image_size, 
uint32_t cluster_size,
 }
 
 /**
- * Read a string of known length from the image file
- *
- * @file:   Image file
- * @offset: File offset to start of string, in bytes
- * @n:  String length in bytes
- * @buf:Destination buffer
- * @buflen: Destination buffer length in bytes
- * @ret:0 on success, -errno on failure
- *
- * The string is NUL-terminated.
- */
-static int qed_read_string(BlockDriverState *file, uint64_t offset, size_t n,
-   char *buf, size_t buflen)
-{
-int ret;
-if (n = buflen) {
-return -EINVAL;
-}
-ret = bdrv_pread(file, offset, buf, n);
-if (ret  0) {
-return ret;
-}
-buf[n] = '\0';
-return 0;
-}
-
-/**
  * Allocate new clusters
  *
  * @s:  QED state
@@ -437,9 +410,10 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict 
*options, int flags)
 return -EINVAL;
 }
 
-ret = qed_read_string(bs-file, s-header.backing_filename_offset,
-  s-header.backing_filename_size, 
bs-backing_file,
-  sizeof(bs-backing_file));
+ret = bdrv_read_string(bs-file, s-header.backing_filename_offset,
+   s-header.backing_filename_size,
+   bs-backing_file,
+   sizeof(bs-backing_file));
 if (ret  0) {
 return ret;
 }
diff --git a/include/block/block.h b/include/block/block.h
index fd776a1..2989da6 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -175,6 +175,8 @@ int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset,
 const void *buf, int count);
 int coroutine_fn bdrv_co_readv(BlockDriverState *bs, int64_t sector_num,
 int nb_sectors, QEMUIOVector *qiov);
+int bdrv_read_string(BlockDriverState *bs, uint64_t offset, size_t n,
+ char *buf, size_t buflen);
 int coroutine_fn bdrv_co_copy_on_readv(BlockDriverState *bs,
 int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
 int coroutine_fn bdrv_co_writev(BlockDriverState *bs, int64_t sector_num,
-- 
1.7.11.7




[Qemu-devel] [PATCH V19 2/8] make path_has_protocol non static

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

We will use path_has_protocol outside block.c, so just make it public.

Reviewed-by: Michael Roth mdr...@linux.vnet.ibm.com
Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block.c   | 2 +-
 include/block/block.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 710362f..5135044 100644
--- a/block.c
+++ b/block.c
@@ -193,7 +193,7 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs,
 }
 
 /* check if the path starts with protocol: */
-static int path_has_protocol(const char *path)
+int path_has_protocol(const char *path)
 {
 const char *p;
 
diff --git a/include/block/block.h b/include/block/block.h
index 90f95ef..fd776a1 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -345,6 +345,7 @@ char *bdrv_snapshot_dump(char *buf, int buf_size, 
QEMUSnapshotInfo *sn);
 
 char *get_human_readable_size(char *buf, int buf_size, int64_t size);
 int path_is_absolute(const char *path);
+int path_has_protocol(const char *path);
 void path_combine(char *dest, int dest_size,
   const char *base_path,
   const char *filename);
-- 
1.7.11.7




[Qemu-devel] [PATCH V19 8/8] qemu-iotests: add add-cow iotests support

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

This patch will use qemu-iotests to test add-cow file format.

v17-v18:
1) add 037 and 038 tests.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 tests/qemu-iotests/017   |  2 +-
 tests/qemu-iotests/020   |  2 +-
 tests/qemu-iotests/037   |  2 +-
 tests/qemu-iotests/038   |  2 +-
 tests/qemu-iotests/common|  6 ++
 tests/qemu-iotests/common.rc | 15 ++-
 6 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017
index 45f2c0b..ae0e627 100755
--- a/tests/qemu-iotests/017
+++ b/tests/qemu-iotests/017
@@ -40,7 +40,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.pattern
 
 # Any format supporting backing files
-_supported_fmt qcow qcow2 vmdk qed
+_supported_fmt qcow qcow2 vmdk qed add-cow
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index 2fb0ff8..3dbb495 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -42,7 +42,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.pattern
 
 # Any format supporting backing files
-_supported_fmt qcow qcow2 vmdk qed
+_supported_fmt qcow qcow2 vmdk qed add-cow
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037
index c11460b..683e73d 100755
--- a/tests/qemu-iotests/037
+++ b/tests/qemu-iotests/037
@@ -38,7 +38,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt qcow qcow2 vmdk qed
+_supported_fmt qcow qcow2 vmdk qed add-cow
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038
index 36125ea..10bacfb 100755
--- a/tests/qemu-iotests/038
+++ b/tests/qemu-iotests/038
@@ -38,7 +38,7 @@ trap _cleanup; exit \$status 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt qcow2 qed
+_supported_fmt qcow2 qed add-cow
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 6826ea7..5110fc1 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -128,6 +128,7 @@ common options
 check options
 -rawtest raw (default)
 -cowtest cow
+-add-cowtest add-cow
 -qcow   test qcow
 -qcow2  test qcow2
 -qedtest qed
@@ -165,6 +166,11 @@ testlist options
xpand=false
;;
 
+-add-cow)
+IMGFMT=add-cow
+xpand=false
+;;
+
-qcow)
IMGFMT=qcow
xpand=false
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index e9ba358..b203f04 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -110,6 +110,16 @@ _make_test_img()
 fi
 if [ \( $IMGFMT = qcow2 -o $IMGFMT = qed \) -a -n $CLUSTER_SIZE 
]; then
 optstr=$(_optstr_add $optstr cluster_size=$CLUSTER_SIZE)
+elif [ $IMGFMT = add-cow ]; then
+local IMG=$TEST_IMG.raw
+if [ $1 = -b ]; then
+IMG=$IMG.b
+$QEMU_IMG create -f raw $IMG $image_size/dev/null
+extra_img_options=-o image_file=$IMG $extra_img_options
+else
+$QEMU_IMG create -f raw $IMG $image_size/dev/null
+extra_img_options=-o image_file=$IMG
+fi
 fi
 
 if [ -n $optstr ]; then
@@ -130,7 +140,8 @@ _make_test_img()
 -e s# zeroed_grain=\\(on\\|off\\)##g \
 -e s# subformat='[^']*'##g \
 -e s# adapter_type='[^']*'##g \
--e s# lazy_refcounts=\\(on\\|off\\)##g
+-e s# lazy_refcounts=\\(on\\|off\\)##g \
+-e s# image_file='[^']*'##g
 
 # Start an NBD server on the image file, which is what we'll be talking to
 if [ $IMGPROTO = nbd ]; then
@@ -152,6 +163,8 @@ _cleanup_test_img()
 rm -f $TEST_DIR/t.$IMGFMT
 rm -f $TEST_DIR/t.$IMGFMT.orig
 rm -f $TEST_DIR/t.$IMGFMT.base
+rm -f $TEST_DIR/t.$IMGFMT.raw
+rm -f $TEST_DIR/t.$IMGFMT.raw.b
 ;;
 
 rbd)
-- 
1.7.11.7




[Qemu-devel] [PATCH V19 7/8] add-cow file format core code.

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

add-cow file format core code. It use block-cache.c as cache code.
It lacks of snapshot_blkdev support.

v18-v19:
1) add aio parallel write support.
2) fix flush method.

v17-v18:
1) use error_report, not fprintf.
2) remove version field from header.
3) header_size is MAX(cluster_size, 4096).
4) introduce s-cluster_sectors.
5) use BLKDBG_L2_LOAD/UPDATE.

v16-v17:
1) Use stringify.

v15-v16:
1) Judge if opts is null in add_cow_create function.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com

Conflicts:
block/block-cache.c
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block/Makefile.objs |   1 +
 block/add-cow.c | 812 
 block/block-cache.c |  16 +-
 include/block/block-cache.h |   4 +
 include/block/block_int.h   |   2 +
 5 files changed, 831 insertions(+), 4 deletions(-)
 create mode 100644 block/add-cow.c

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 16e574a..f666a7a 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -1,6 +1,7 @@
 block-obj-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o 
vvfat.o
 block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
 block-obj-y += block-cache.o
+block-obj-y += add-cow.o
 block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
 block-obj-y += qed-check.o
 block-obj-y += vhdx.o
diff --git a/block/add-cow.c b/block/add-cow.c
new file mode 100644
index 000..290da3c
--- /dev/null
+++ b/block/add-cow.c
@@ -0,0 +1,812 @@
+/*
+ * QEMU ADD-COW Disk Format
+ *
+ * Copyright IBM, Corp. 2012
+ *
+ * Authors:
+ *  Dong Xu Wang wdon...@linux.vnet.ibm.com
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include qemu-common.h
+#include block/block_int.h
+#include qemu/module.h
+#include block/block-cache.h
+
+#define ACOW_CLUSTER_SIZE 65536
+
+typedef struct AddCowMeta
+{
+uint64_t start_sector;
+int remaining_sectors;
+CoQueue dependent_requests;
+struct AddCowMeta *next;
+
+QLIST_ENTRY(AddCowMeta) next_in_flight;
+} AddCowMeta;
+
+enum {
+/* compat_features bit */
+ACOW_F_ALL_ALLOCATED= 0X01,
+
+/* none feature bit used now */
+ACOW_FEATURE_MASK   = 0,
+
+ACOW_MAGIC  = 'A' | 'C'  8 | 'O'  16 | 'W'  24,
+ACOW_CACHE_SIZE = 16,
+DEFAULT_HEADER_SIZE = 4096,
+MIN_CLUSTER_BITS= 12,
+MAX_CLUSTER_BITS= 21,
+};
+
+typedef struct AddCowHeader {
+uint32_tmagic;
+
+uint32_tbacking_offset;
+uint32_tbacking_size;
+uint32_timage_offset;
+uint32_timage_size;
+
+uint32_tcluster_bits;
+uint64_tfeatures;
+uint64_tcompat_features;
+uint32_theader_size;
+
+charbacking_fmt[16];
+charimage_fmt[16];
+} QEMU_PACKED AddCowHeader;
+
+typedef struct BDRVAddCowState {
+BlockDriverState*image_hd;
+CoMutex lock;
+int cluster_size;
+int cluster_sectors;
+BlockCache  *bitmap_cache;
+uint64_tbitmap_size;
+AddCowHeaderheader;
+charbacking_fmt[16];
+charimage_fmt[16];
+BlockCache  *image_hd_cache;
+QLIST_HEAD(AddCowAlloc, AddCowMeta) cluster_allocs;
+} BDRVAddCowState;
+
+/* Convert sector_num to offset in bitmap */
+static inline int64_t offset_in_bitmap(int64_t sector_num,
+   int64_t cluster_sectors)
+{
+int64_t cluster_num = sector_num / cluster_sectors;
+return cluster_num / 8;
+}
+
+static inline bool is_cluster_head(int64_t sector_num,
+   int64_t cluster_sectors)
+{
+return sector_num % cluster_sectors == 0;
+}
+
+static inline bool is_cluster_tail(int64_t sector_num,
+   int64_t cluster_sectors)
+{
+return (sector_num + 1) % cluster_sectors == 0;
+}
+
+static void add_cow_header_le_to_cpu(const AddCowHeader *le, AddCowHeader *cpu)
+{
+cpu-magic  = le32_to_cpu(le-magic);
+
+cpu-backing_offset = le32_to_cpu(le-backing_offset);
+cpu-backing_size   = le32_to_cpu(le-backing_size);
+cpu-image_offset   = le32_to_cpu(le-image_offset);
+cpu-image_size = le32_to_cpu(le-image_size);
+
+cpu-cluster_bits   = le32_to_cpu(le-cluster_bits);
+cpu-features   = le64_to_cpu(le-features);
+cpu-compat_features= le64_to_cpu(le-compat_features);
+cpu-header_size= le32_to_cpu(le-header_size);
+
+memcpy(cpu-backing_fmt, le-backing_fmt, sizeof(cpu-backing_fmt));
+memcpy(cpu-image_fmt, le-image_fmt, sizeof(cpu-image_fmt));
+}
+
+static void add_cow_header_cpu_to_le(const AddCowHeader *cpu, AddCowHeader *le)
+{
+le-magic

[Qemu-devel] [PATCH V19 5/8] Make block-cache.c be common interface

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

To use block-cache.c be common cache interface, we need to add
some parameter to identify cache's type.

Define a struct named BlockTableType, pass BlockTableType and
table size parameters to block cache initialization function.

v17-v18:
1) move struct to source file.
2) cluster_size-table_size.

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block/block-cache.c | 75 ++---
 block/qcow2-cluster.c   | 30 +-
 block/qcow2-refcount.c  | 30 +-
 block/qcow2.c   |  7 +++--
 block/qcow2.h   | 24 ++-
 include/block/block-cache.h | 55 +
 trace-events|  1 +
 7 files changed, 139 insertions(+), 83 deletions(-)
 create mode 100644 include/block/block-cache.h

diff --git a/block/block-cache.c b/block/block-cache.c
index bc057a8..f5d75d1 100644
--- a/block/block-cache.c
+++ b/block/block-cache.c
@@ -1,4 +1,8 @@
 /*
+ * QEMU Block Layer Cache
+ *
+ * This file is based on qcow2-cache.c, see its copyrights below:
+ *
  * L2/refcount table cache for the QCOW2 format
  *
  * Copyright (c) 2010 Kevin Wolf kw...@redhat.com
@@ -24,11 +28,11 @@
 
 #include block/block_int.h
 #include qemu-common.h
-#include qcow2.h
 #include trace.h
+#include block/block-cache.h
 
 typedef struct BlockCachedTable {
-void*   table;
+void*table;
 int64_t offset;
 booldirty;
 int cache_hits;
@@ -36,30 +40,34 @@ typedef struct BlockCachedTable {
 } BlockCachedTable;
 
 struct BlockCache {
-BlockCachedTable*   entries;
-struct BlockCache*  depends;
-int size;
-booldepends_on_flush;
+BlockCachedTable*entries;
+struct BlockCache   *depends;
+int size;
+size_t  table_size;
+BlockTableType  table_type;
+booldepends_on_flush;
 };
 
-BlockCache *block_cache_create(BlockDriverState *bs, int num_tables)
+BlockCache *block_cache_create(BlockDriverState *bs, int num_tables,
+   size_t table_size, BlockTableType type)
 {
-BDRVQcowState *s = bs-opaque;
 BlockCache *c;
 int i;
 
 c = g_malloc0(sizeof(*c));
 c-size = num_tables;
 c-entries = g_malloc0(sizeof(*c-entries) * num_tables);
+c-table_type = type;
+c-table_size = table_size;
 
 for (i = 0; i  c-size; i++) {
-c-entries[i].table = qemu_blockalign(bs, s-cluster_size);
+c-entries[i].table = qemu_blockalign(bs, table_size);
 }
 
 return c;
 }
 
-int block_cache_destroy(BlockDriverState* bs, BlockCache *c)
+int block_cache_destroy(BlockDriverState *bs, BlockCache *c)
 {
 int i;
 
@@ -91,15 +99,13 @@ static int block_cache_flush_dependency(BlockDriverState 
*bs, BlockCache *c)
 
 static int block_cache_entry_flush(BlockDriverState *bs, BlockCache *c, int i)
 {
-BDRVQcowState *s = bs-opaque;
 int ret = 0;
 
 if (!c-entries[i].dirty || !c-entries[i].offset) {
 return 0;
 }
 
-trace_block_cache_entry_flush(qemu_coroutine_self(),
-  c == s-l2_table_cache, i);
+trace_block_cache_entry_flush(qemu_coroutine_self(), c-table_type, i);
 
 if (c-depends) {
 ret = block_cache_flush_dependency(bs, c);
@@ -114,14 +120,16 @@ static int block_cache_entry_flush(BlockDriverState *bs, 
BlockCache *c, int i)
 return ret;
 }
 
-if (c == s-refcount_block_cache) {
+if (c-table_type == BLOCK_TABLE_REF) {
 BLKDBG_EVENT(bs-file, BLKDBG_REFBLOCK_UPDATE_PART);
-} else if (c == s-l2_table_cache) {
+} else if (c-table_type == BLOCK_TABLE_L2) {
 BLKDBG_EVENT(bs-file, BLKDBG_L2_UPDATE);
+} else if (c-table_type == BLOCK_TABLE_BITMAP) {
+BLKDBG_EVENT(bs-file, BLKDBG_COW_WRITE);
 }
 
-ret = bdrv_pwrite(bs-file, c-entries[i].offset, c-entries[i].table,
-s-cluster_size);
+ret = bdrv_pwrite(bs-file, c-entries[i].offset,
+  c-entries[i].table, c-table_size);
 if (ret  0) {
 return ret;
 }
@@ -133,12 +141,11 @@ static int block_cache_entry_flush(BlockDriverState *bs, 
BlockCache *c, int i)
 
 int block_cache_flush(BlockDriverState *bs, BlockCache *c)
 {
-BDRVQcowState *s = bs-opaque;
 int result = 0;
 int ret;
 int i;
 
-trace_block_cache_flush(qemu_coroutine_self(), c == s-l2_table_cache);
+trace_block_cache_flush(qemu_coroutine_self(), c-table_type);
 
 for (i = 0; i  c-size; i++) {
 ret = block_cache_entry_flush(bs, c, i);
@@ -157,8 +164,9 @@ int block_cache_flush(BlockDriverState *bs, BlockCache *c)
 return result;
 }
 
-int block_cache_set_dependency(BlockDriverState *bs, BlockCache *c,
-BlockCache *dependency)
+int block_cache_set_dependency(BlockDriverState *bs

[Qemu-devel] [RFC] Check backing_file chain's loop

2013-05-30 Thread Dongxu Wang

Hi,

Now block layer does not check whether backing_file chain can be a 
circle, do you think it is necessary to do a check?


For example,  1.qcow2's backing_file is 2.qcow2 and 2.qcow2's 
backing_file is 1.qcow2, then any IO operation will be a fault.


If necessary, I will post a patch to fix.

[$] qemu-img create -f qcow2 1.qcow2
qemu-img: Image creation needs a size parameter
[$] qemu-img create -f qcow2 1.qcow2 8M
Formatting '1.qcow2', fmt=qcow2 size=8388608 encryption=off 
cluster_size=65536 lazy_refcounts=off

[$] qemu-img create -f qcow2 2.qcow2 -o backing_file=1.qcow2
Formatting '2.qcow2', fmt=qcow2 size=8388608 backing_file='1.qcow2' 
encryption=off cluster_size=65536 lazy_refcounts=off

[$] qemu-img create -f qcow2 1.qcow2 -o backing_file=2.qcow2
Formatting '1.qcow2', fmt=qcow2 size=8388608 backing_file='2.qcow2' 
encryption=off cluster_size=65536 lazy_refcounts=off

[$] qemu-io -c read -v 0 512 1.qcow2
^CSegmentation fault (core dumped)



Thanks.




[Qemu-devel] [PATCH V19 6/8] add debug event for add-cow

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang wdon...@linux.vnet.ibm.com

Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com
---
 block/blkdebug.c  | 3 +++
 block/block-cache.c   | 4 ++--
 include/block/block.h | 3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index 71f99e4..2bd6a53 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -182,6 +182,9 @@ static const char *event_names[BLKDBG_EVENT_MAX] = {
 [BLKDBG_CLUSTER_ALLOC]  = cluster_alloc,
 [BLKDBG_CLUSTER_ALLOC_BYTES]= cluster_alloc_bytes,
 [BLKDBG_CLUSTER_FREE]   = cluster_free,
+
+[BLKDBG_ADDCOW_READ]= add_cow_read,
+[BLKDBG_ADDCOW_WRITE]   = add_cow_write,
 };
 
 static int get_event_by_name(const char *name, BlkDebugEvent *event)
diff --git a/block/block-cache.c b/block/block-cache.c
index f5d75d1..454269c 100644
--- a/block/block-cache.c
+++ b/block/block-cache.c
@@ -125,7 +125,7 @@ static int block_cache_entry_flush(BlockDriverState *bs, 
BlockCache *c, int i)
 } else if (c-table_type == BLOCK_TABLE_L2) {
 BLKDBG_EVENT(bs-file, BLKDBG_L2_UPDATE);
 } else if (c-table_type == BLOCK_TABLE_BITMAP) {
-BLKDBG_EVENT(bs-file, BLKDBG_COW_WRITE);
+BLKDBG_EVENT(bs-file, BLKDBG_ADDCOW_WRITE);
 }
 
 ret = bdrv_pwrite(bs-file, c-entries[i].offset,
@@ -260,7 +260,7 @@ static int block_cache_do_get(BlockDriverState *bs, 
BlockCache *c,
 if (c-table_type == BLOCK_TABLE_L2) {
 BLKDBG_EVENT(bs-file, BLKDBG_L2_LOAD);
 } else if (c-table_type == BLOCK_TABLE_BITMAP) {
-BLKDBG_EVENT(bs-file, BLKDBG_COW_READ);
+BLKDBG_EVENT(bs-file, BLKDBG_ADDCOW_READ);
 }
 
 ret = bdrv_pread(bs-file, offset, c-entries[i].table,
diff --git a/include/block/block.h b/include/block/block.h
index 2989da6..3573e3e 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -451,6 +451,9 @@ typedef enum {
 BLKDBG_CLUSTER_ALLOC_BYTES,
 BLKDBG_CLUSTER_FREE,
 
+BLKDBG_ADDCOW_READ,
+BLKDBG_ADDCOW_WRITE,
+
 BLKDBG_EVENT_MAX,
 } BlkDebugEvent;
 
-- 
1.7.11.7




Re: [Qemu-devel] [RFC] Check backing_file chain's loop

2013-05-30 Thread Dongxu Wang

On 2013/5/30 20:48, Stefan Hajnoczi wrote:

hain 1.qcow2' don't crash.

qemu-img info --backing-chain detects cycles and returns an error, see
the hash table in collect_image_info_list().

We should protect bdrv_open() too.


Okay, will send a patch.

Stefan







Re: [Qemu-devel] [PATCH V15 1/6] add def_value_str in QemuOptDesc struct and rewrite qemu_opts_print

2013-05-30 Thread Dongxu Wang

On 2013/5/31 5:22, Eric Blake wrote:

On 05/30/2013 03:55 AM, Dongxu Wang wrote:

From: Dong Xu Wang wdon...@linux.vnet.ibm.com

qemu_opts_print has no user now, so can re-write the function safely.

qemu_opts_print will be used while using qemu-img create, it will
produce the same output as previous code.

The behavior of this function has changed:

1. Print every possible option, whether a value has been set or not.
2. Option descriptors may provide a default value.
3. Print to stdout instead of stderr.

Previously the behavior was to print every option that has been set.
Options that have not been set would be skipped.


Up to here is fine.



v13-v14:
1) fix memory leak.
2) make opt_set do not accpet null value argument.

v12-v13
1) re-write commit message.

v11-v12
1) make def_value_str become the real default value string in opt_set
function.

v10-v11:
1) print all values that have actually been assigned while accept-any
cases.

v7-v8:
1) print elements = accept any params while opts_accepts_any() ==
true.
2) since def_print_str is the default value if an option isn't set,
so rename it to def_value_str.


However, this chunk should be moved to appear after the '---' separator;
it's useful during review, but does not need to be part of qemu.git.


Okay.


Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com


And this looks fishy, having two S-o-B with slightly different spellings
of your name.  Pick one and stick with it.


Ah.. sorry, my mistake..

---


Here is where patch changelogs go.  For more hints, see
http://wiki.qemu.org/Contribute/SubmitAPatch


  include/qemu/option.h |  3 ++-
  util/qemu-option.c| 32 ++--
  2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index bdb6d21..b928ab0 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -96,6 +96,7 @@ typedef struct QemuOptDesc {
  const char *name;
  enum QemuOptType type;
  const char *help;
+const char *def_value_str;
  } QemuOptDesc;


Now that we have the 'query-command-line-options' QMP command, I think
it's worth expanding that command to expose the default value of an
option, when one is given.  It's probably content for a separate patch
(util/qemu-config.c:query_option_descs() and qapi-schema.json), but
still belongs as part of this series.

Reviewed-by: Eric Blake ebl...@redhat.com






Re: [Qemu-devel] [PATCH V15 3/6] Create four QemuOptsList related functions

2013-05-30 Thread Dongxu Wang

On 2013/5/31 5:43, Eric Blake wrote:

On 05/30/2013 03:55 AM, Dongxu Wang wrote:

From: Dong Xu Wang wdon...@linux.vnet.ibm.com

This patch will create 4 functions, count_opts_list, qemu_opts_append,


s/will create/creates/ - commit messages make the most sense when
written in present tense


qemu_opts_free and qemu_opts_print_help, they will be used in following
commits.



Again, this portion...


v12-v13:
1) simply assert that neither argument has merge_lists set.
2) drop superfluous paranthesesis around p == first.

v11-v12:
1) renmae functions.
2) fix loop styles and code styles.
3) qemu_opts_apend will not return NULL now.
4) merge_lists value is from arguments in qemu_opts_append.

v6-v7:
1) Fix typo.

v5-v6:
1) allocate enough space in append_opts_list function.


...belongs after '---', and



Signed-off-by: Dong Xu Wang wdon...@linux.vnet.ibm.com
Signed-off-by: Dongxu Wang wdon...@linux.vnet.ibm.com


your s-o-b is unusual.



+
+static size_t count_opts_list(QemuOptsList *list)
+{
+size_t i = 0;
+
+for (i = 0; list  list-desc[i].name; i++) {


No need to initialize i to 0 in two places.


Okay.

+;
+}
+
+return i;
+}
+
+/* Create a new QemuOptsList and make its desc to the merge of first
+ * and second. It will allocate space for one new QemuOptsList plus
+ * enough space for QemuOptDesc in first and second QemuOptsList.
+ * First argument's QemuOptDesc members take precedence over second's.
+ * The result's name and implied_opt_name are not copied from them.
+ * Both merge_lists should not be set. Both list can be NULL.
+ */
+QemuOptsList *qemu_opts_append(QemuOptsList *first,
+   QemuOptsList *second)
+{
+size_t num_first_opts, num_second_opts;
+QemuOptsList *dest = NULL;
+int i = 0;
+int index = 0;
+QemuOptsList *p = first;
+
+num_first_opts = count_opts_list(first);
+num_second_opts = count_opts_list(second);
+
+dest = g_malloc0(sizeof(QemuOptsList)
++ (num_first_opts + num_second_opts + 1) * sizeof(QemuOptDesc));
+
+dest-name = append_opts_list;
+dest-implied_opt_name = NULL;
+assert((!first || !first-merge_lists)
+ (!second || !second-merge_lists));
+QTAILQ_INIT(dest-head);
+
+for (i = 0; p  p-desc[i].name; i++) {


Again, a double-initialization of i [1]

Okay.



+if (!find_desc_by_name(dest-desc, p-desc[i].name)) {
+dest-desc[index].name = g_strdup(p-desc[i].name);
+dest-desc[index].help = g_strdup(p-desc[i].help);
+dest-desc[index].type = p-desc[i].type;
+dest-desc[index].def_value_str =
+g_strdup(p-desc[i].def_value_str);


Do we really have to strdup these elements, or are we guaranteed that
the scope of the original first/second list is always larger than the
scope of the merged list, and can thus share the existing pointer rather
than creating copies? [2]

I think yes, will use pointer directly in next version.



+index++;
+}
+if (p == first  p  !p-desc[i].name) {
+p = second;
+i = 0;
+}
+}
+dest-desc[index].name = NULL;
+return dest;
+}
+
+/* free a QemuOptsList, can accept NULL as arguments */
+void qemu_opts_free(QemuOptsList *list)
+{
+int i = 0;
+
+for (i = 0; list  list-desc[i].name; i++) {


[1] and again for double initialization of i


+g_free((char *)list-desc[i].name);
+g_free((char *)list-desc[i].help);
+g_free((char *)list-desc[i].def_value_str);


[2] The fact that you have to cast away const is a sign that maybe you
shouldn't be storing strdup'd data in these pointers in the first place.


+}
+
+g_free(list);
+}
+
+void qemu_opts_print_help(QemuOptsList *list)
+{
+int i = 0;
+printf(Supported options:\n);
+for (i = 0; list  list-desc[i].name; i++) {


[1] and another


+printf(%-16s %s\n, list-desc[i].name,
+list-desc[i].help ?
+list-desc[i].help : No description available);
+}
+}








[Libreoffice] LibreCAD as part of LibreOffice suite

2011-10-12 Thread Dongxu Li
Hello,

I'm a LibreCAD ( http://www.librecad.org ) developer.

Is it a good idea to include LibreCAD as part of the LibreOffice suite?

The good: LibreCAD provides feature rich drawing (more than CAD, I use it to
draw general 2D geometry shapes)

The bad: no shared code with LibreOffice yet

The ugly: LibreCAD is GPLv2

Thank you for you time!

Regards,

Dongxu Li
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[nox-dev] NOX installation problem: openssl/md

2011-03-03 Thread Dongxu Zhang
 text/html; charset="GBK": Unrecognized 
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


[nox-dev] NOX installation problem: openssl/md5.h is not found

2011-03-03 Thread Dongxu Zhang
Hi everyone,Sorry about the previous incomplete letter sent by mistake...I am quite new to NOX and openflow. Weeks ago, following the instructions on the HOTITutorial2010, I succeeded to create a learning switch, using a VM image and tools(mininet, etc.) within it. Now I want to deploy an OpenFlow network with several PCs, but faced some problems when I tried to install NOX on the "controller".The Linux distribution I used is Fedora14.These packages are installed: xerces-c-devel python-twisted libpcap-devel I just do following:git clone git://noxrepo.org/nox./boot.sh and that seems OK, thenmkdir build/cd build/../configureAfter a while I got a messages :configure: error: openssl/md5.h not found. NOX requires OpenSSLand the configure process quit.At first I thought this may be caused by missing openssl or openssl-devel, so I execute:sudo yum install openssl openssl-develbut I find these are already installed. Then I execute:find / -name md5.hand I got a directory: /usr/include/openssl/md5.hThis directory shouldn't have any problem and could be found by the ../configure, I guess.So, what should I do now? (maybe a little stupid getting stuck on this problem, but it realy bothered me for a long time...)Maybe there are some other nox-dependencies package I should install ? Attached please find the config.log, if it is helpful.Looking forword for your reply.RegardsDongxu ZhangBeijing University of Posts and TelecommunicationChina___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


[nox-dev] [Attachment added]NOX installation problem: openssl/md5.h is not found

2011-03-03 Thread Dongxu Zhang
Attached is the config.logThanks

config.log
Description: 
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


Re: Audio-TagLib

2011-02-08 Thread Dongxu Ma
Hi Geoffrey,

Great news. I am very happy to hand it over.
I am really busy on my fulltime job in past 3 years.
Will make you co-maintainer, please release it under your cpan id.

cheers,

On Mon, Feb 7, 2011 at 10:04 PM, Geoffrey Leach ge...@hughes.net wrote:

 Hello.

 I've worked on Audio-TagLib 1.50_01 to the point where it installs with
 taglib v1.5 without any test failures.  I'd like to release this as
 version 1.50 and then go on to make it compatible with taglib v1.6.x.

 This would be easiest if you would authorize me to be co-maintainer.
 Alternatively, if you would prefer to maintain sole control of the
 source, I'd be happy to forward to you the modified sources.

 Either way, I'd appreciate a reply.

 Best regards,

 Geoffrey Leach (gle...@cpan.org)




-- 
-Dongxu


[no subject]

2011-01-25 Thread Dongxu Wang



[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li
Hi Gursimran,

yes, I'm positive that this bug doesn't affect VT. I tested it again and
again, the pointer moved properly throughout the test.

Again, since the pointer can be recovered by Alt-F7 (or Alt-F8), it's
unlikely a synaptics bug. More likely, it's an X bug but only triggered
by some types of touchpad.

xev log clearly shows the bug, position root:(0,0) never changes with
MotionNotify events.

As I mentioned, when the pointer is trapped at root:(0,0), the touchpad
basically works, I can still tap-2-click, xev records MotionEvents as
well. This explains how I took the xev log mentioned.

still, is there a way to make X more verbose on events?

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li
Hi Fabio,

the 6003C8 error is a well known consequence of touchpad's second query
as /dev/input/mouse*, is harmless, and can be easily avoided, as shown
in the attached Xorg.0.lo

anyway, I'm sending the syslog kern.log still.

Also, it's confirmed that archlinux is free from this bug, seems to be a
ubuntu bug.

** Attachment added: Xorg.0.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730811/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li

** Attachment added: kern.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730812/+files/kern.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li

** Attachment added: syslog
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730814/+files/syslog

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li
Hi Gursimran,

yes, I'm positive that this bug doesn't affect VT. I tested it again and
again, the pointer moved properly throughout the test.

Again, since the pointer can be recovered by Alt-F7 (or Alt-F8), it's
unlikely a synaptics bug. More likely, it's an X bug but only triggered
by some types of touchpad.

xev log clearly shows the bug, position root:(0,0) never changes with
MotionNotify events.

As I mentioned, when the pointer is trapped at root:(0,0), the touchpad
basically works, I can still tap-2-click, xev records MotionEvents as
well. This explains how I took the xev log mentioned.

still, is there a way to make X more verbose on events?

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li
Hi Fabio,

the 6003C8 error is a well known consequence of touchpad's second query
as /dev/input/mouse*, is harmless, and can be easily avoided, as shown
in the attached Xorg.0.lo

anyway, I'm sending the syslog kern.log still.

Also, it's confirmed that archlinux is free from this bug, seems to be a
ubuntu bug.

** Attachment added: Xorg.0.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730811/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li

** Attachment added: kern.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730812/+files/kern.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-11 Thread Dongxu Li

** Attachment added: syslog
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1730814/+files/syslog

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li
Hi Gursimran,

I tried to troubleshoot by evtest, and the log files are attached.

the evtest-good.txt file was taken when the touchpad worked properly in X
the evtest-stuck.txt was taken while the pointer in X stayed at root 
window(0,0) and can not be moved by touchpad.

** Attachment added: Xorg.0.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729158/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: evtest while the mouse pointer can not be moved by 
touchpad
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729160/+files/evtest-stuck.txt

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: evtest while mouse pointer can be moved by touchpad
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729159/+files/evtest-good.txt

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li
as I mentioned, there's no error message in logs. Even with -logverbose
6 when running X.

dmesg reports no error from synatpics either. I'm attaching those log
files anyway.


** Attachment added: Xorg.0.log from -logverbose 6
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729621/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: dmesg.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729622/+files/dmesg.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: sorry, the previous Xorg.0.log was from a normal X 
session, this is the one from verbose level 6
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729637/+files/Xorg.failsafe.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: evtest while mouse pointer can be moved by touchpad
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729159/+files/evtest-good.txt

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: evtest while the mouse pointer can not be moved by 
touchpad
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729160/+files/evtest-stuck.txt

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li
Hi Gursimran,

I tried to troubleshoot by evtest, and the log files are attached.

the evtest-good.txt file was taken when the touchpad worked properly in X
the evtest-stuck.txt was taken while the pointer in X stayed at root 
window(0,0) and can not be moved by touchpad.

** Attachment added: Xorg.0.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729158/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li
as I mentioned, there's no error message in logs. Even with -logverbose
6 when running X.

dmesg reports no error from synatpics either. I'm attaching those log
files anyway.


** Attachment added: Xorg.0.log from -logverbose 6
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729621/+files/Xorg.0.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: dmesg.log
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729622/+files/dmesg.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 500658] Re: Pointer stuck in upper-left corner while using touchpad on the upper left corner in emachines 2350

2010-11-10 Thread Dongxu Li

** Attachment added: sorry, the previous Xorg.0.log was from a normal X 
session, this is the one from verbose level 6
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1729637/+files/Xorg.failsafe.log

-- 
Pointer stuck in upper-left corner while using touchpad on the upper left 
corner in emachines 2350
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Ubuntu-x-swat] [Bug 500658] Re: pointer stuck in upper-left corner while using touchpad

2010-11-09 Thread Dongxu Li
yes, I can confirm this bug exists in 10.10 maverick.

To reproduce the bug:
randomly touch the upper-left corner of the touchpad, usually within seconds, 
the mouse pointer jumps to X root:(0,0), i.e., the upper-left corner of screen, 
and trying to move the pointer is futile thereafter.

A way to workaround, hit Alt-F7 (move window), then, the pointer jumps
and can be moved again.

I found no error message in logs, so I try to log X events using xev. A
sample of xev output is attached. When the pointer stuck, pointer moving
events are recorded as,

MotionNotify event, serial 31, synthetic NO, window 0x381,
root 0xaf, subw 0x0, time 2940111, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES

MotionNotify event, serial 31, synthetic NO, window 0x381,
root 0xaf, subw 0x0, time 2940120, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES


** Attachment added: xev output showing mouse pointer stuck to root window 
(0,0)
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1728495/+files/xev.txt

-- 
pointer stuck in upper-left corner while using touchpad
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-input-synaptics in ubuntu.

___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Bug 500658] Re: pointer stuck in upper-left corner while using touchpad

2010-11-09 Thread Dongxu Li
yes, I can confirm this bug exists in 10.10 maverick.

To reproduce the bug:
randomly touch the upper-left corner of the touchpad, usually within seconds, 
the mouse pointer jumps to X root:(0,0), i.e., the upper-left corner of screen, 
and trying to move the pointer is futile thereafter.

A way to workaround, hit Alt-F7 (move window), then, the pointer jumps
and can be moved again.

I found no error message in logs, so I try to log X events using xev. A
sample of xev output is attached. When the pointer stuck, pointer moving
events are recorded as,

MotionNotify event, serial 31, synthetic NO, window 0x381,
root 0xaf, subw 0x0, time 2940111, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES

MotionNotify event, serial 31, synthetic NO, window 0x381,
root 0xaf, subw 0x0, time 2940120, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES


** Attachment added: xev output showing mouse pointer stuck to root window 
(0,0)
   
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/500658/+attachment/1728495/+files/xev.txt

-- 
pointer stuck in upper-left corner while using touchpad
https://bugs.launchpad.net/bugs/500658
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


Re: Perl 6 Microgrants. Now accepting proposals.

2007-03-23 Thread Dongxu Ma

Hi all,

I am recently working on the QT4/KDE4 bindings for p5.
First cpp headers are parsed by a grammar based on Parse::RecDescent,
The production of latest dev release Parse-QTEDI-0.02_01 is quite stable,
presenting all related interface information of cpp .h.

I will continue to make it available in p5. And myself do have a plan to
introduce them in p6. It will be nice if someone can do so in parallel with
me (I mean, for p6). Since: 1. my knowledge on p6 sucks ;-) 2. currently
I haven't got enough time.

PS: It is very glad to see such information, really. In my opinion p6 indeed

needs trying to draw as many connections as possible with other
outstanding tool/project outside perl world. KDE is such a place too.

PS2: my project page:
   http://code.google.com/p/dongxu/wiki/QTEDI
   http://code.google.com/p/dongxu/wiki/PerlQT

-- Forwarded message --
From: Jesse Vincent [EMAIL PROTECTED]
Date: Mar 22, 2007 11:04 AM
Subject: Perl 6 Microgrants. Now accepting proposals.
To: perl6-internals@perl.org, perl6-language@perl.org,
perl6-compiler@perl.org, perl5-porters@perl.org

I'm pleased to announce the inaugural Perl 6 Microgrants program.
Best Practical Solutions (my company) has donated USD5,000 to The
Perl Foundation to help support Perl 6 Development.  Leon Brocard,
representing The Perl Foundation's grants committee, will work with
me to select proposals and evaluate project success.  We'll be making
USD500 grants to worthy Perl 6 related efforts. We're hoping to fund
a range of Perl 6-related projects over the life of the grant
program.  Accepted grants might be for coding, documentation, testing
or even writing articles about Perl 6. The program isn't tied to any
one implementation of Perl 6 -- We're interested in seeing proposals
related to Pugs, Perl 6 on Parrot, Perl 6 on Perl 5 or any other Perl
6 implementation.  Generally, we're interested in seeing projects
that can be completed in 4-6 calendar weeks.

Submitting a grant proposal
---

To submit a grant proposal, please email us at perl6-
[EMAIL PROTECTED] with the following information:

* A two to three paragraph summary of the work you intend to do
* A quick bio - Who are you? Is there opensource work you've done
that we should have a look at?
* A brief description of what success will mean for your project -
How will we know you're done?
* Where (if anywhere) you've discussed your project in the past
* Where you'll be blogging about your progress. (Twice-weekly blog
posts are a requirement for getting your grant money)

We'll be accepting proposals on a rolling schedule. We expect to pay
out these first 10 grants over the course of the summer. Depending on
how things go, we'll then either find more money for more grant
programs or we'll wind up the program and move on to other endeavors.

We're really excited to get rolling. Submit your proposals early and
often. Don't let somebody else beat you to the punch ;)

Best,

Jesse



--
Cheers, Dongxu
__END__
http://search.cpan.org/~dongxu


PGP.sig
Description: PGP signature


Re: Perl 6 Microgrants. Now accepting proposals.

2007-03-22 Thread Dongxu Ma

Hi all,

I am recently working on the QT4/KDE4 bindings for p5.
First cpp headers are parsed by a grammar based on Parse::RecDescent,
The production of latest dev release Parse-QTEDI-0.02_01 is quite stable,
presenting all related interface information of cpp .h.

I will continue to make it available in p5. And myself do have a plan to
introduce them in p6. It will be nice if someone can do so in parallel with
me (I mean, for p6). Since: 1. my knowledge on p6 sucks ;-) 2. currently
I haven't got enough time.

PS: It is very glad to see such information, really. In my opinion p6 indeed

needs trying to draw as many connections as possible with other
outstanding tool/project outside perl world. KDE is such a place too.

PS2: my project page:
   http://code.google.com/p/dongxu/wiki/QTEDI
   http://code.google.com/p/dongxu/wiki/PerlQT

-- Forwarded message --
From: Jesse Vincent [EMAIL PROTECTED]
Date: Mar 22, 2007 11:04 AM
Subject: Perl 6 Microgrants. Now accepting proposals.
To: perl6-internals@perl.org, perl6-language@perl.org,
perl6-compiler@perl.org, perl5-porters@perl.org

I'm pleased to announce the inaugural Perl 6 Microgrants program.
Best Practical Solutions (my company) has donated USD5,000 to The
Perl Foundation to help support Perl 6 Development.  Leon Brocard,
representing The Perl Foundation's grants committee, will work with
me to select proposals and evaluate project success.  We'll be making
USD500 grants to worthy Perl 6 related efforts. We're hoping to fund
a range of Perl 6-related projects over the life of the grant
program.  Accepted grants might be for coding, documentation, testing
or even writing articles about Perl 6. The program isn't tied to any
one implementation of Perl 6 -- We're interested in seeing proposals
related to Pugs, Perl 6 on Parrot, Perl 6 on Perl 5 or any other Perl
6 implementation.  Generally, we're interested in seeing projects
that can be completed in 4-6 calendar weeks.

Submitting a grant proposal
---

To submit a grant proposal, please email us at perl6-
[EMAIL PROTECTED] with the following information:

* A two to three paragraph summary of the work you intend to do
* A quick bio - Who are you? Is there opensource work you've done
that we should have a look at?
* A brief description of what success will mean for your project -
How will we know you're done?
* Where (if anywhere) you've discussed your project in the past
* Where you'll be blogging about your progress. (Twice-weekly blog
posts are a requirement for getting your grant money)

We'll be accepting proposals on a rolling schedule. We expect to pay
out these first 10 grants over the course of the summer. Depending on
how things go, we'll then either find more money for more grant
programs or we'll wind up the program and move on to other endeavors.

We're really excited to get rolling. Submit your proposals early and
often. Don't let somebody else beat you to the punch ;)

Best,

Jesse



--
Cheers, Dongxu
__END__
http://search.cpan.org/~dongxu


PGP.sig
Description: PGP signature


Re: Perl 6 Microgrants. Now accepting proposals.

2007-03-22 Thread Dongxu Ma

Hi all,

I am recently working on the QT4/KDE4 bindings for p5.
First cpp headers are parsed by a grammar based on Parse::RecDescent,
The production of latest dev release Parse-QTEDI-0.02_01 is quite stable,
presenting all related interface information of cpp .h.

I will continue to make it available in p5. And myself do have a plan to
introduce them in p6. It will be nice if someone can do so in parallel with
me (I mean, for p6). Since: 1. my knowledge on p6 sucks ;-) 2. currently
I haven't got enough time.

PS: It is very glad to see such information, really. In my opinion p6 indeed

needs trying to draw as many connections as possible with other
outstanding tool/project outside perl world. KDE is such a place too.

PS2: my project page:
   http://code.google.com/p/dongxu/wiki/QTEDI
   http://code.google.com/p/dongxu/wiki/PerlQT

-- Forwarded message --
From: Jesse Vincent [EMAIL PROTECTED]
Date: Mar 22, 2007 11:04 AM
Subject: Perl 6 Microgrants. Now accepting proposals.
To: perl6-internals@perl.org, perl6-language@perl.org,
perl6-compiler@perl.org, perl5-porters@perl.org

I'm pleased to announce the inaugural Perl 6 Microgrants program.
Best Practical Solutions (my company) has donated USD5,000 to The
Perl Foundation to help support Perl 6 Development.  Leon Brocard,
representing The Perl Foundation's grants committee, will work with
me to select proposals and evaluate project success.  We'll be making
USD500 grants to worthy Perl 6 related efforts. We're hoping to fund
a range of Perl 6-related projects over the life of the grant
program.  Accepted grants might be for coding, documentation, testing
or even writing articles about Perl 6. The program isn't tied to any
one implementation of Perl 6 -- We're interested in seeing proposals
related to Pugs, Perl 6 on Parrot, Perl 6 on Perl 5 or any other Perl
6 implementation.  Generally, we're interested in seeing projects
that can be completed in 4-6 calendar weeks.

Submitting a grant proposal
---

To submit a grant proposal, please email us at perl6-
[EMAIL PROTECTED] with the following information:

* A two to three paragraph summary of the work you intend to do
* A quick bio - Who are you? Is there opensource work you've done
that we should have a look at?
* A brief description of what success will mean for your project -
How will we know you're done?
* Where (if anywhere) you've discussed your project in the past
* Where you'll be blogging about your progress. (Twice-weekly blog
posts are a requirement for getting your grant money)

We'll be accepting proposals on a rolling schedule. We expect to pay
out these first 10 grants over the course of the summer. Depending on
how things go, we'll then either find more money for more grant
programs or we'll wind up the program and move on to other endeavors.

We're really excited to get rolling. Submit your proposals early and
often. Don't let somebody else beat you to the punch ;)

Best,

Jesse



--
Cheers, Dongxu
__END__
http://search.cpan.org/~dongxu


PGP.sig
Description: PGP signature


Re: Perl 6 Microgrants. Now accepting proposals.

2007-03-22 Thread Dongxu Ma

Hi all,

I am recently working on the QT4/KDE4 bindings for p5.
First cpp headers are parsed by a grammar based on Parse::RecDescent,
The production of latest dev release Parse-QTEDI-0.02_01 is quite stable,
presenting all related interface information of cpp .h.

I will continue to make it available in p5. And myself do have a plan to
introduce them in p6. It will be nice if someone can do so in parallel with
me (I mean, for p6). Since: 1. my knowledge on p6 sucks ;-) 2. currently
I haven't got enough time.

PS: It is very glad to see such information, really. In my opinion p6 indeed

needs trying to draw as many connections as possible with other
outstanding tool/project outside perl world. KDE is such a place too.

PS2: my project page:
   http://code.google.com/p/dongxu/wiki/QTEDI
   http://code.google.com/p/dongxu/wiki/PerlQT

-- Forwarded message --
From: Jesse Vincent [EMAIL PROTECTED]
Date: Mar 22, 2007 11:04 AM
Subject: Perl 6 Microgrants. Now accepting proposals.
To: perl6-internals@perl.org, perl6-language@perl.org,
perl6-compiler@perl.org, perl5-porters@perl.org

I'm pleased to announce the inaugural Perl 6 Microgrants program.
Best Practical Solutions (my company) has donated USD5,000 to The
Perl Foundation to help support Perl 6 Development.  Leon Brocard,
representing The Perl Foundation's grants committee, will work with
me to select proposals and evaluate project success.  We'll be making
USD500 grants to worthy Perl 6 related efforts. We're hoping to fund
a range of Perl 6-related projects over the life of the grant
program.  Accepted grants might be for coding, documentation, testing
or even writing articles about Perl 6. The program isn't tied to any
one implementation of Perl 6 -- We're interested in seeing proposals
related to Pugs, Perl 6 on Parrot, Perl 6 on Perl 5 or any other Perl
6 implementation.  Generally, we're interested in seeing projects
that can be completed in 4-6 calendar weeks.

Submitting a grant proposal
---

To submit a grant proposal, please email us at perl6-
[EMAIL PROTECTED] with the following information:

* A two to three paragraph summary of the work you intend to do
* A quick bio - Who are you? Is there opensource work you've done
that we should have a look at?
* A brief description of what success will mean for your project -
How will we know you're done?
* Where (if anywhere) you've discussed your project in the past
* Where you'll be blogging about your progress. (Twice-weekly blog
posts are a requirement for getting your grant money)

We'll be accepting proposals on a rolling schedule. We expect to pay
out these first 10 grants over the course of the summer. Depending on
how things go, we'll then either find more money for more grant
programs or we'll wind up the program and move on to other endeavors.

We're really excited to get rolling. Submit your proposals early and
often. Don't let somebody else beat you to the punch ;)

Best,

Jesse



--
Cheers, Dongxu
__END__
http://search.cpan.org/~dongxu


PGP.sig
Description: PGP signature


script binding for reiserfs?

2006-04-06 Thread Dongxu Ma
Hi all,As reiserfs more and more popular, is there any binding package for use in script languages? I did a search on Google and nothing found.Curently I am thinking about writing a binding for Perl, which can offer:
1) script-level operation against reiserfs2) DBI  DBD for reiserfs binding to treat the fs as a database. My aim is constructing a mid-and-small wiki directly on reiserfs without employing any real database
However, after some seeking on source. I got several issues:1) is there any so-called official userspace api exported? On gentoo there is a package named progsreiserfs introducing an api set under /usr/include/reiserfs, but I am not very sure if it is stable and the project is still alive.
2) regarding reiser3, where could I start to port? since exporting something in kernelspace is quite risky. Any advice and hint?-- Cheers, Dongxu__END__
dongxu.wordpress.comsearch.cpan.org/~dongxu


how to deal with static c++ object

2005-09-13 Thread Dongxu Ma
Hi all,

In some case, a class will have a static object for special purpose. For 
instance:
static foo foo::bar
I want to port this object to perl by wrapping it as a sub like this:
foo * 
foo::bar()
CODE:
RETVAL = (foo::bar);
OUTPUT:
RETVAL

This will always cause a segfault while invoking the sub in perl script.
Does anyone know the reason?

Another question, is there any better way to port a class method which 
returns 
an object. Like this:
foo foo::bar2()
since the returned object is local, which is usually allocated on stack, I 
have to 
new an object on heap and copy the content from the local one in my perlxs 
code. Is there a better way to handle this case?

Great thanks.
-- 
Bst Rgrs, Dongxu


how to specify namespace in perlxs

2005-09-07 Thread Dongxu Ma
Hi all,

Does any one know why I can't add 'using namespace brabra;' in .xs file? The 
xsubpp can't recognize while generating the .c file.

-- 
Bst Rgrs, Dongxu


Re: segfault while DELETE THIS

2005-08-18 Thread Dongxu Ma
Yes, you are right. I should dereference first. But now, the issue is,
who can explain why the wrong code could also invoke class' public
method via THIS-print() successfully.

_wrong code_ : $var = ($type) SvIV($arg);

On 8/17/05, Nicholas Clark [EMAIL PROTECTED] wrote:
 On Thu, Aug 11, 2005 at 11:55:49AM +0800, Dongxu Ma wrote:
 
  According to typemap in ExtUtils and perl.h, casting IV to pointer
  should be safe in this case, since on my machine(32bit, kernel
  2.6.12), sizeof(int) == 4, which is the same as a  pointer. Does
  anyone have any idea about this issue?
 
 I think that there's a bug in the typemap you're using:
 
  -typemap---
  TYPEMAP
  Test *T_OBJECT
 
  
  INPUT
  T_OBJECT
if(sv_isa($arg, \Test\)  sv_isobject($arg)) {
$var = INT2PTR($type, SvIV($arg));
 
   SvIV(SvRV($arg))
} else {
warn(\$arg is not a blessed object\);
XSRETURN_UNDEF;
}
 
 
 If I make the above change to use SvRV then I can avoid getting a segfault.
 
 Nicholas Clark
 


-- 
Bst Rgrs, Dongxu


segfault while DELETE THIS

2005-08-11 Thread Dongxu Ma
:
THIS-print();

-typemap---
TYPEMAP
Test *  T_OBJECT


INPUT
T_OBJECT
if(sv_isa($arg, \Test\)  sv_isobject($arg)) {
$var = INT2PTR($type, SvIV($arg));
} else {
warn(\$arg is not a blessed object\);
XSRETURN_UNDEF;
}


OUTPUT
T_OBJECT
sv_setref_pv($arg, \Test\, (void*)$var);
-
--Makefiel.PL-
use 5.008007;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME  = 'Test',
VERSION_FROM  = 'lib/Test.pm', # finds $VERSION
PREREQ_PM = {}, # e.g., Module::Name = 1.1
($] = 5.005 ? ## Add these new keywords supported since 5.005
  (ABSTRACT_FROM  = 'lib/Test.pm', # retrieve abstract from module
   AUTHOR = 'A. U. Thor ') :
 ()),
CC= 'g++',
LD= 'g++',
LDFLAGS   = '-g',
LDDLFLAGS = '-shared -g',
LIBS  = ['-Lclib -ltest'], # e.g., '-lm'
DEFINE= '', # e.g., '-DHAVE_SOMETHING'
INC   = '-I.', # e.g., '-I. -I/usr/include/other'
XSOPT = ' -C++ ',
# Un-comment this if you add C files to link with later:
# OBJECT= '$(O_FILES)', # link all the C files too
);
--
-- 
Bst Rgrs, Dongxu


(newbie), sysklogd freezes for minutes in booting

2003-10-09 Thread Dongxu Li
Hello All,

I saw this before, but forgot the solution.

My Debian/testing just spends minutes in starting sysklogd, when there's 
no network interface presents.

The similar things happened to sendmail, xdm also.

Thanks a lot!

Regards,

Dongxu Li

--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



<    1   2   3   4   5