svn commit: r1522119 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa: ./ client/ client/activity/ client/evo/ client/ioc/ client/mapper/ client/mvp/ client/ui/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:08:28 2013
New Revision: 1522119

URL: http://svn.apache.org/r1522119
Log:
Make the evo more clear.

Added:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/ActivityManagerInitializer.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/ActivityManagerInitializer.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/AppController.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/AppController.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/HupaEvo.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/HupaEvo.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo/HupaEvoCallback.java
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/AppPlaceHistoryMapper.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/AppPlaceHistoryMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/CachingTopActivityMapper.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/CachingTopActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/CachingWestActivityMapper.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/CachingWestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/MainContentActivityMapper.java
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainContentActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/TopActivityMapper.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/TopActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/WestActivityMapper.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/WestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/WidgetContainerDisplayable.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/WidgetContainerDisplayable.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/WidgetDisplayable.java~HEAD
  - copied, changed from r1522117, 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/WidgetDisplayable.java
Removed:

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

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

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

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

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/CachingTopActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/CachingWestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/Displayable.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainContentActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/TopActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/WestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/WidgetContainerDisplayable.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/WidgetDisplayable.java
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageSendActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/TopActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/WestActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/evo

svn commit: r1522116 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: ./ activity/ ioc/ mvp/ place/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:06:53 2013
New Revision: 1522116

URL: http://svn.apache.org/r1522116
Log:
At first make the inbox work, but only when click the refresh button. The page 
also be working, the other folder will be like the same.

Modified:

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

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/WestActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/CachingWestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainContentActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/MailInboxPlace.java

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java?rev=1522116&r1=1522115&r2=1522116&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java
 Thu Sep 12 02:06:53 2013
@@ -82,6 +82,12 @@ public class CachingDispatchAsync extend
 return;
 } else {
 running.add(clz);
+<<<<<<< HEAD
+===
+//if (action instanceof FetchMessages) {
+//new RuntimeException().printStackTrace();
+//}
+>>>>>>> At first make the inbox work, but only when click the refresh button. 
The page also be working, the other folder will be like the same.
 super.execute(action, new AsyncCallback() {
 public void onFailure(Throwable caught) {
 running.remove(clz);

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java?rev=1522116&r1=1522115&r2=1522116&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
 Thu Sep 12 02:06:53 2013
@@ -446,16 +446,14 @@ public class IMAPMessageListActivity ext
private final Displayable display;
private final EventBus eventBus;
private final PlaceController placeController;
-   private final Provider mailInboxPlaceProvider;
private DispatchAsync dispatcher;
 
@Inject
 public IMAPMessageListActivity(Displayable display, EventBus eventBus, 
PlaceController placeController,
-   Provider mailInboxPlaceProvider, 
DispatchAsync dispatcher){
+DispatchAsync dispatcher){
this.display = display;
this.eventBus = eventBus;
this.placeController = placeController;
-   this.mailInboxPlaceProvider = mailInboxPlaceProvider;
this.dispatcher = dispatcher;

 
@@ -471,8 +469,8 @@ public class IMAPMessageListActivity ext
}
@Override
public void start(AcceptsOneWidget container, EventBus eventBus) {
-   revealDisplay(user, folder, searchValue);
bind();
+   revealDisplay(user, folder, searchValue);
container.setWidget(display.asWidget());
}

@@ -691,9 +689,10 @@ public class IMAPMessageListActivity ext
 }
 }); 
 }
-   public IMAPMessageListActivity with(User user){
+   public IMAPMessageListActivity with(User user, IMAPFolder imapFolder, 
String string){
this.user = user;
-   this.folder = new 
IMAPFolder(user.getSettings().getInboxFolderName());
+   this.folder = imapFolder;
+   this.searchValue = string;
return this;
}
 

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java?rev=1522116&r1=1522115&r2=1522116&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/c

svn commit: r1522115 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: activity/ ioc/ mvp/ place/ ui/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:06:30 2013
New Revision: 1522115

URL: http://svn.apache.org/r1522115
Log: (empty)

Added:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/CachingTopActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/CachingWestActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/IMAPMessagePlace.java
Removed:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/MailPlace.java
Modified:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/TopActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/WestActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/MailInboxPlace.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/MessageSendPlace.java

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

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

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java?rev=1522115&r1=1522114&r2=1522115&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/IMAPMessageListActivity.java
 Thu Sep 12 02:06:30 2013
@@ -380,25 +380,53 @@ import java.util.ArrayList;
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
 
+import org.apache.hupa.client.HandlerRegistrationAdapter;
+import org.apache.hupa.client.HupaCallback;
+import org.apache.hupa.client.HupaEvoCallback;
 import org.apache.hupa.client.mvp.WidgetDisplayable;
 import org.apache.hupa.client.place.MailInboxPlace;
 import org.apache.hupa.client.widgets.HasDialog;
 import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.Message;
 import org.apache.hupa.shared.data.User;
+import org.apache.hupa.shared.data.Message.IMAPFlag;
 import org.apache.hupa.shared.events.DecreaseUnseenEvent;
 import org.apache.hupa.shared.events.ExpandMessageEvent;
+import org.apache.hupa.shared.events.FolderSelectionEvent;
+import org.apache.hupa.shared.events.FolderSelectionEventHandler;
+import org.apache.hupa.shared.events.IncreaseUnseenEvent;
+import org.apache.hupa.shared.events.LoadMessagesEvent;
 import org.apache.hupa.shared.events.LogoutEvent;
 import org.apache.hupa.shared.events.LogoutEventHandler;
+import org.apache.hupa.shared.events.MessagesReceivedEvent;
+import org.apache.hupa.shared.events.MessagesReceivedEventHandler;
+import org.apache.hupa.shared.events.MoveMessageEvent;
+import org.apache.hupa.shared.events.MoveMessageEventHandler;
+import org.apache.hupa.shared.events.NewMessageEvent;
+import org.apache.hupa.shared.rpc.DeleteAllMessages;
+import org.apache.hupa.shared.rpc.DeleteMessageByUid;
+import org.apache.hupa.shared.rpc.DeleteMessageResult;
+import org.apache.hupa.shared.rpc.GenericResult;
+import org.apache.hupa.shared.rpc.MoveMessage;
+import org.apache.hupa.shared.rpc.MoveMessageResult;
+import org.apache.hupa.shared.rpc.SetFlag;
 import org.apache.hupa.widgets.ui.HasEnable;
 
 import com.google.gwt.activity.shared.AbstractActivity;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasChangeHandlers;
 import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.gen2.table.event.client.HasPageChangeHandlers;
 import com.google.gwt.gen2.table.event.client.HasPageLoadHandlers;
 import com.google.gwt.gen2.table.event.client.HasRowSelectionHandlers;
+import com.google.gwt.gen2.table.event.client.PageChangeEvent;
+import com.google.gwt.gen2.table.event.client.PageChangeHandler;
+import com.google.gwt.gen2.table.event.client.RowSelectionEvent;
+import com.google.gwt.gen2.table.event.client.RowSelectionHandler;
 import com.google.gwt.place.shared.PlaceController;
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
 import com.google.gwt.user.client.ui.HasValue;
@@ -449,9 +477,220 @@ public class IMAPMessageListActivity ext
}

private void bind(){
-   
+   eventBus.addHandler(MessagesReceivedEvent.TYPE, new 
MessagesReceivedEventHandler() {
+
+   

svn commit: r1522114 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: ./ activity/ ioc/ mvp/ ui/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:06:04 2013
New Revision: 1522114

URL: http://svn.apache.org/r1522114
Log:
introduce the top activity

Added:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/TopActivityMapper.java
Modified:

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

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/AppController.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/activity/LoginActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/TopActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java

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

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

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

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

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ActivityManagerInitializer.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ActivityManagerInitializer.java?rev=1522114&r1=1522113&r2=1522114&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ActivityManagerInitializer.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ActivityManagerInitializer.java
 Thu Sep 12 02:06:04 2013
@@ -7,17 +7,19 @@ import com.google.inject.Inject;
 import com.google.inject.name.Named;
 
 /**
- * This class is responsible for ActivityManager instantiations through GIN,
- * it also associate every ActivityManager with the corresponding display 
region
+ * This class is responsible for ActivityManager instantiations through GIN, it
+ * also associate every ActivityManager with the corresponding display region
  */
 public class ActivityManagerInitializer {
 
-  @Inject
-  public ActivityManagerInitializer(AppLayout appPanelView,
-@Named("WestRegion") ActivityManager 
verticalMasterActivityManager,
-@Named("MainContentRegion") 
ActivityManager mainContentActivityManager) {
-verticalMasterActivityManager.setDisplay(appPanelView.getWestContainer());
-mainContentActivityManager.setDisplay(appPanelView.getMainContainer());
-  }
+   @Inject
+   public ActivityManagerInitializer(AppLayout appPanelView, 
+   @Named("TopRegion") ActivityManager topActivityManager,
+   @Named("WestRegion") ActivityManager 
westActivityManager,
+   @Named("MainContentRegion") ActivityManager 
mainContentActivityManager) {
+   topActivityManager.setDisplay(appPanelView.getTopContainer());
+   westActivityManager.setDisplay(appPanelView.getWestContainer());
+   
mainContentActivityManager.setDisplay(appPanelView.getMainContainer());
+   }
 
 }

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/AppController.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/AppController.java?rev=1522114&r1=1522113&r2=1522114&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/AppController.java 
(original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/AppController.java 
Thu Sep 12 02:06:04 2013
@@ -15,54 +15,57 @@ import com.google.inject.Inject;
 /**
  * This is the main controller of the application.
  */
-public class AppController{
+public class AppController {
 
-  private final PlaceController placeController;
-  private final PlaceHistoryHandler placeHistoryHandler;
-  private final AppLayout appPanelView;
-  private Place currentPlace;
-
-  /**
-   * All parameters are injected by GIN
-   *
-   * @param placeController the application's PlaceController
-   * @param eventBus the application's EventBus
-   * @param placeHistoryHandler the application's PlaceHistoryHandler
-   * @param appLayout this is the application's main panel
-   * @param mainMenuView this is the application's navigation top bar
-   * @param activityManagerInitializer unused parameter, it's here just to 
force GIN's initialization of ActivityManagers
-   */
-  @Inject
-  public AppController(PlaceController placeController,
-   EventBus eventBus,
-  

svn commit: r1522112 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: activity/ ui/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:05:26 2013
New Revision: 1522112

URL: http://svn.apache.org/r1522112
Log:
decorate the theme

Removed:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/maincontent.png
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/mainmenu.png
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/masterv.png
Modified:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java

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

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

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

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

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java?rev=1522112&r1=1522111&r2=1522112&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
 Thu Sep 12 02:05:26 2013
@@ -35,18 +35,26 @@ package org.apache.hupa.client.activity;
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
 
+import org.apache.hupa.client.HupaConstants;
 import org.apache.hupa.client.HupaEvoCallback;
 import org.apache.hupa.client.mvp.WidgetDisplayable;
 import org.apache.hupa.client.place.MailInboxPlace;
+import org.apache.hupa.shared.events.FlashEvent;
+import org.apache.hupa.shared.events.SessionExpireEvent;
+import org.apache.hupa.shared.events.SessionExpireEventHandler;
 import org.apache.hupa.shared.rpc.LoginUser;
 import org.apache.hupa.shared.rpc.LoginUserResult;
 
 import com.google.gwt.activity.shared.AbstractActivity;
 <<<<<<< HEAD
+<<<<<<< HEAD
 import com.google.gwt.core.client.GWT;
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 ===
 >>>>>>> Change to new mvp framework - first step
+===
+import com.google.gwt.core.client.GWT;
+>>>>>>> decorate the theme
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
@@ -83,6 +91,7 @@ public class LoginActivity extends Abstr
private final PlaceController placeController;
private final Provider mailInboxPlaceProvider;
private DispatchAsync dispatcher;
+private HupaConstants constants = GWT.create(HupaConstants.class);
 
@Inject
public LoginActivity(Displayable display, EventBus eventBus, 
PlaceController placeController,
@@ -125,6 +134,20 @@ public class LoginActivity extends Abstr
doLogin();
}
});
+   display.getResetClick().addClickHandler(new ClickHandler() {
+
+public void onClick(ClickEvent event) {
+doReset();
+}
+
+});
+   eventBus.addHandler(SessionExpireEvent.TYPE, new 
SessionExpireEventHandler() {
+
+public void onSessionExpireEvent(SessionExpireEvent event) {
+eventBus.fireEvent(new FlashEvent(constants.sessionTimedOut(), 
4000));
+}
+
+});
 
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
}
@@ -168,10 +191,14 @@ public class LoginActivity extends Abstr
public void callbackError(Throwable caught) {
display.setLoading(false);
Window.alert("error");
+<<<<<<< HEAD

LoginActivity.this.placeController.goTo(mailInboxPlaceProvider.get());
// eventBus.fireEvent(new 
FlashEvent(constants.loginInvalid(),
// 4000));
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+===
+   // eventBus.fireEvent(new 
FlashEvent(constants.loginInvalid(),4000));
+>>>>>>> decorate the theme
doReset();
}
});

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java?rev=1522112&r1=1522111&

svn commit: r1522111 - in /james/hupa/trunk: client/pom.xml mock/pom.xml pom.xml server/pom.xml shared/pom.xml src/site/resources/demo/index.html src/site/xdoc/index.xml widgets/pom.xml

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:05:02 2013
New Revision: 1522111

URL: http://svn.apache.org/r1522111
Log:
constantly changed by manolo

Modified:
james/hupa/trunk/client/pom.xml
james/hupa/trunk/mock/pom.xml
james/hupa/trunk/pom.xml
james/hupa/trunk/server/pom.xml
james/hupa/trunk/shared/pom.xml
james/hupa/trunk/src/site/resources/demo/index.html
james/hupa/trunk/src/site/xdoc/index.xml
james/hupa/trunk/widgets/pom.xml

Modified: james/hupa/trunk/client/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1522111&r1=1522110&r2=1522111&view=diff
==
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Thu Sep 12 02:05:02 2013
@@ -17,13 +17,12 @@
 specific language governing permissions and limitations
 under the License.
 -->
-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";>
+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";>
 4.0.0
 
 org.apache.hupa
 hupa-parent
-0.0.2-SNAPSHOT
+0.0.3-SNAPSHOT
 ../pom.xml
 
 hupa

Modified: james/hupa/trunk/mock/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/mock/pom.xml?rev=1522111&r1=1522110&r2=1522111&view=diff
==
--- james/hupa/trunk/mock/pom.xml (original)
+++ james/hupa/trunk/mock/pom.xml Thu Sep 12 02:05:02 2013
@@ -18,6 +18,7 @@
 under the License.
 -->
 <<<<<<< HEAD
+<<<<<<< HEAD
 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";>
 4.0.0
 
@@ -29,12 +30,19 @@
 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";>
+===
+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";>
+>>>>>>> constantly changed by manolo
 4.0.0
 
 org.apache.hupa
 hupa-parent
+<<<<<<< HEAD
 0.0.2-SNAPSHOT
 >>>>>>> first commit
+===
+0.0.3-SNAPSHOT
+>>>>>>> constantly changed by manolo
 ../pom.xml
 
 hupa-mock

Modified: james/hupa/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/pom.xml?rev=1522111&r1=1522110&r2=1522111&view=diff
==
--- james/hupa/trunk/pom.xml (original)
+++ james/hupa/trunk/pom.xml Thu Sep 12 02:05:02 2013
@@ -18,6 +18,7 @@
 under the License.
 -->
 <<<<<<< HEAD
+<<<<<<< HEAD
 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";>
 ===
 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";>
 >>>>>>> first commit
+===
+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";>
+>>>>>>> constantly changed by manolo
 4.0.0
 
 org.apache.james
 james-project
 1.8.1
 <<<<<<< HEAD
+<<<<<<< HEAD
+===
+>>>>>>> constantly changed by manolo
 
 
 org.apache.james.hupa
 hupa-parent
 0.0.3-SNAPSHOT
+<<<<<<< HEAD
 ===
 
 
@@ -43,6 +51,8 @@
 hupa-parent
 0.0.2-SNAPSHOT
 >>>>>>> first commit
+===
+>>>>>>> constantly changed by manolo
 pom
 Apache James Hupa Parent
 Hupa is a GWT based Webmail
@@ -137,7 +147,7 @@
 ===
 2.4.0
 2.4.0
-
+
 ERROR
 7.3.0.v20110203
 test
@@ -158,7 +168,7 @@

svn commit: r1522113 - /james/hupa/trunk/client/src/main/webapp/Hupa.html

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:05:39 2013
New Revision: 1522113

URL: http://svn.apache.org/r1522113
Log:
decorate the theme

Modified:
james/hupa/trunk/client/src/main/webapp/Hupa.html

Modified: james/hupa/trunk/client/src/main/webapp/Hupa.html
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/webapp/Hupa.html?rev=1522113&r1=1522112&r2=1522113&view=diff
==
--- james/hupa/trunk/client/src/main/webapp/Hupa.html (original)
+++ james/hupa/trunk/client/src/main/webapp/Hupa.html Thu Sep 12 02:05:39 2013
@@ -42,6 +42,7 @@
.loading img {
position: absolute;
 <<<<<<< HEAD
+<<<<<<< HEAD
top: 37%;
left: 50%;
}
@@ -50,6 +51,9 @@
}
 ===
top: 50%;
+===
+   top: 37%;
+>>>>>>> decorate the theme
left: 50%;
}
 <<<<<<< HEAD



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



svn commit: r1522109 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa: ./ client/ client/activity/ client/gin/ client/mvp/ client/place/ client/ui/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:03:52 2013
New Revision: 1522109

URL: http://svn.apache.org/r1522109
Log:
change the LOGIN progress using native MVP instead of gwt-presenter

Added:

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

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java

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

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml?rev=1522109&r1=1522108&r2=1522109&view=diff
==
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml 
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml Thu Sep 
12 02:03:52 2013
@@ -27,9 +27,11 @@
   
   
   
-  
+  
+  
+  
   
   
   

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java?rev=1522109&r1=1522108&r2=1522109&view=diff
==
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java 
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java Thu 
Sep 12 02:03:52 2013
@@ -20,6 +20,7 @@
 package org.apache.hupa.client;
 
 <<<<<<< HEAD
+<<<<<<< HEAD
 import org.apache.hupa.client.ioc.AppGinjector;
 
 import com.google.gwt.core.client.EntryPoint;
@@ -59,28 +60,64 @@ import net.customware.gwt.presenter.clie
 
 import org.apache.hupa.client.gin.HupaGinjector;
 import org.apache.hupa.client.mvp.AppPresenter;
+===
+import org.apache.hupa.client.gin.HupaEvoGinjector;
+import org.apache.hupa.client.mvp.AppPlaceFactory;
+import org.apache.hupa.client.mvp.AppPlaceHistoryMapper;
+import org.apache.hupa.client.place.LoginPlace;
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
+import com.google.gwt.activity.shared.ActivityManager;
+import com.google.gwt.activity.shared.ActivityMapper;
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.place.shared.PlaceHistoryHandler;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
 
 public class Hupa implements EntryPoint{
-private final HupaGinjector injector = GWT.create(HupaGinjector.class);
+//private final HupaGinjector injector = GWT.create(HupaGinjector.class);
+
+   private SimplePanel appWidget = new SimplePanel();
+  private final HupaEvoGinjector injector = GWT.create(HupaEvoGinjector.class);
 
 public void onModuleLoad() {
 // remove the loading message from the browser
 com.google.gwt.user.client.Element loading = 
DOM.getElementById("loading");
 
 DOM.removeChild(RootPanel.getBodyElement(), loading);
-
-AppPresenter aPres = injector.getAppPresenter();
-aPres.bind();
-   
-RootPanel.get().add(aPres.getDisplay().asWidget());
-
-PlaceManager placeManager = injector.getPlaceManager();
-placeManager.fireCurrentPlace();
+//
+//AppPresenter aPres = injector.getAppPresenter();
+//aPres.bind();
+//   
+//RootPanel.get().add(aPres.getDisplay().asWidget());
+//
+//PlaceManager placeManager = injector.getPlaceManager();
+//placeManager.fireCurrentPlace();
+
+   EventBus eventBus = injector.getEventBus();
+   PlaceController placeController = injector.get

svn commit: r1522108 - in /james/hupa/trunk: client/ client/src/main/java/org/apache/hupa/client/mvp/ client/src/main/webapp/ server/src/main/java/org/apache/hupa/server/handler/ server/src/main/java/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:03:24 2013
New Revision: 1522108

URL: http://svn.apache.org/r1522108
Log:
constantly changed by manolo

Modified:
james/hupa/trunk/client/pom.xml

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
james/hupa/trunk/client/src/main/webapp/Hupa.html

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java

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

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/MessageUtilsTest.java

james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java

Modified: james/hupa/trunk/client/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1522108&r1=1522107&r2=1522108&view=diff
==
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Thu Sep 12 02:03:24 2013
@@ -17,9 +17,7 @@
 specific language governing permissions and limitations
 under the License.
 -->
-http://maven.apache.org/POM/4.0.0";
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+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";>
 4.0.0
 
@@ -77,10 +75,10 @@
 com.google.gwt
 gwt-user
 
-  
-javax.validation
-validation-api
-  
+
+javax.validation
+validation-api
+
 
 
 
@@ -97,9 +95,9 @@
 provided
 
 
-  org.hibernate
-  hibernate-validator
-  4.2.0.Final
+org.hibernate
+hibernate-validator
+4.2.0.Final
 
 
 org.json
@@ -117,14 +115,14 @@
 org.slf4j
 slf4j-log4j12
 
-   
-   org.eclipse.jetty
-   jetty-server
-   
-   
-   org.eclipse.jetty
-   jetty-webapp
-   
+
+org.eclipse.jetty
+jetty-server
+
+
+org.eclipse.jetty
+jetty-webapp
+
 
 
 
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
@@ -135,7 +133,7 @@
 
 Hupa.html
 
--Xmx512M -Xss128M 
-Dhupa.config.file=${project.parent.basedir}/server/src/main/webapp/WEB-INF/conf/config.properties
+-Xmx512M -Xss128M
 
 1
 true
@@ -187,11 +185,11 @@
 
 
 ${project.artifactId}-${project.version}
-   
-  
- 
org.apache.hupa.Launcher
-  
-   
+
+
+org.apache.hupa.Launcher
+
+
 
 
 
@@ -246,7 +244,7 @@
 
 
 
-   org.apache.maven.plugins
+org.apache.maven.plugins
 maven-resources-plugin
 
 
@@ -275,33 +273,33 @@
 
 
 
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
- 
org/apache/hupa/Launcher.class
+
org/apache/hupa/Launcher.class
 
 
 
 
 
 
-   
-  org.apache.maven.plugins
-  maven-dependency-plugin
-  
- 
-jetty-classpath
-prepare-package
-  

svn commit: r1522107 - in /james/hupa/trunk/client/src/main: java/org/apache/hupa/client/HupaCSS.java java/org/apache/hupa/client/mvp/IMAPMessageListView.java java/org/apache/hupa/client/mvp/LoginView

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:02:42 2013
New Revision: 1522107

URL: http://svn.apache.org/r1522107
Log:
constantly changed by manolo

Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
james/hupa/trunk/client/src/main/webapp/Hupa.css
james/hupa/trunk/client/src/main/webapp/Hupa.html

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java?rev=1522107&r1=1522106&r2=1522107&view=diff
==
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java 
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCSS.java 
Thu Sep 12 02:02:42 2013
@@ -77,4 +77,6 @@ public class HupaCSS extends WidgetsCSS 
 public static final String C_dialog = "hupa-dialog-box";
 
 public static final String C_validate = "hupa-validate-error";
+
+public static final String C_button = "hupa-button";
 }

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java?rev=1522107&r1=1522106&r2=1522107&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
 Thu Sep 12 02:02:42 2013
@@ -474,7 +474,7 @@ public class IMAPMessageListView extends
 pageBox.setSelectedIndex(0);
 cTableModel.clearCache();
 cTableModel.setRowCount(CachedTableModel.UNKNOWN_ROW_COUNT);
-//mailTable.gotoFirstPage();
+mailTable.gotoPage(0, false);
 }
 
 /*

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java?rev=1522107&r1=1522106&r2=1522107&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java 
(original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java 
Thu Sep 12 02:02:42 2013
@@ -23,18 +23,23 @@ import org.apache.hupa.client.HupaCSS;
 import org.apache.hupa.client.HupaConstants;
 import org.apache.hupa.widgets.ui.Loading;
 import org.apache.hupa.widgets.ui.RndPanel;
-import org.cobogw.gwt.user.client.ui.Button;
-import org.cobogw.gwt.user.client.ui.ButtonBar;
 
 import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.event.dom.client.KeyUpEvent;
 import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.FormPanel;
+import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
 import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.Panel;
 import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.SubmitButton;
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
@@ -46,38 +51,52 @@ import com.google.inject.Inject;
  */
 public class LoginView extends Composite implements 
KeyUpHandler,LoginPresenter.Display{
 
-private Button loginButton;
+private Button loginButton = new Button();
+private SubmitButton submitButton;
 private Button resetButton;
-private TextBox usernameTextBox = new TextBox();
-private PasswordTextBox passwordTextBox = new PasswordTextBox();
 private Loading loading;
+
+// We wrap login/password boxes with a form which must be in the html 
document, 
+// in this way, the browser knows that we are sending a login form and 
+// offers the save password dialog to the user
+private TextBox usernameTextBox = 
TextBox.wrap(DOM.getElementById("email"));
+private PasswordTextBox passwordTextBox = 
PasswordTextBox.wrap(DOM.getElementById("password"));
+// wrap the form after inputs so as they are in the dom when are wrapped
+fin

svn commit: r1522104 - in /james/hupa/trunk: mock/src/main/java/org/apache/hupa/server/mock/ server/src/main/java/org/apache/hupa/server/ server/src/main/java/org/apache/hupa/server/guice/ server/src/

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:01:24 2013
New Revision: 1522104

URL: http://svn.apache.org/r1522104
Log:
constantly changed by manolo

Modified:

james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServletConfig.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
james/hupa/trunk/src/site/xdoc/index.xml

Modified: 
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java?rev=1522104&r1=1522103&r2=1522104&view=diff
==
--- 
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
 (original)
+++ 
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
 Thu Sep 12 02:01:24 2013
@@ -20,11 +20,14 @@
 package org.apache.hupa.server.mock;
 
 <<<<<<< HEAD
+<<<<<<< HEAD
 ===
 import com.sun.mail.imap.IMAPFolder;
 import com.sun.mail.imap.IMAPStore;
 
 >>>>>>> first commit
+===
+>>>>>>> constantly changed by manolo
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -33,15 +36,20 @@ import java.util.List;
 import javax.mail.FetchProfile;
 import javax.mail.Flags;
 <<<<<<< HEAD
+<<<<<<< HEAD
 import javax.mail.Flags.Flag;
 ===
 >>>>>>> first commit
+===
+import javax.mail.Flags.Flag;
+>>>>>>> constantly changed by manolo
 import javax.mail.Folder;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.Store;
 <<<<<<< HEAD
+<<<<<<< HEAD
 import javax.mail.internet.MimeMessage;
 import javax.mail.search.SearchTerm;
 
@@ -54,6 +62,14 @@ import javax.mail.internet.MimeMessage;
 import javax.mail.search.SearchTerm;
 
 >>>>>>> first commit
+===
+import javax.mail.internet.MimeMessage;
+import javax.mail.search.SearchTerm;
+
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPStore;
+
+>>>>>>> constantly changed by manolo
 public class MockIMAPFolder extends IMAPFolder {
 
 public static final char SEPARATOR = '.';
@@ -273,6 +289,7 @@ public class MockIMAPFolder extends IMAP
 
 @Override
 <<<<<<< HEAD
+<<<<<<< HEAD
 public synchronized Message[] search(SearchTerm search)
 throws MessagingException {
 checkExists();
@@ -289,6 +306,18 @@ public class MockIMAPFolder extends IMAP
 checkExists();
 return getMessages();
 >>>>>>> first commit
+===
+public synchronized Message[] search(SearchTerm search)
+throws MessagingException {
+checkExists();
+ArrayList ret = new ArrayList();
+for (Message m : messages) {
+   if (search.match(m)) {
+   ret.add(m);
+   }
+}
+return ret.toArray(new Message[0]);
+>>>>>>> constantly changed by manolo
 }
 
 @Override

Modified: 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java?rev=1522104&r1=1522103&r2=1522104&view=diff
==
--- 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
 (original)
+++ 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
 Thu Sep 12 02:01:24 2013
@@ -97,6 +97,9 @@ public class InMemoryIMAPStoreCache impl
  */
 public IMAPStore get(User user) throws MessagingException {
 <<<<<<< HEAD
+<<<<<<< HEAD
+===
+>>>>>>> constantly changed by manolo
IMAPStore ret =  get(user.getName(),user.getPassword());

// TODO: this is a hack, we should have a default domain suffix in 
configuration files
@@ -104,9 +107,12 @@ public class InMemoryIMAPStoreCache impl
user.setName(user.getName() + "@gmail.com");
}
return ret;
+<<<<<<< HEAD
 ===
 return get(user.getName(),user.getPassword());
 >>>>>>> first commit
+===
+>>>>>>> constantly changed by manolo
 }
 
 /*

Modified: 

svn commit: r1522103 - in /james/hupa/trunk: ./ client/ client/src/main/java/org/apache/hupa/client/mvp/ server/src/main/java/org/apache/hupa/server/handler/ server/src/test/java/org/apache/hupa/serve

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:00:55 2013
New Revision: 1522103

URL: http://svn.apache.org/r1522103
Log:
constantly changed by manolo

Modified:
james/hupa/trunk/client/pom.xml

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
james/hupa/trunk/pom.xml

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java

Modified: james/hupa/trunk/client/pom.xml
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1522103&r1=1522102&r2=1522103&view=diff
==
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Thu Sep 12 02:00:55 2013
@@ -39,6 +39,10 @@
 
 
 org.apache.hupa
+hupa-mock
+
+
+org.apache.hupa
 hupa-shared
 
 
@@ -300,19 +304,4 @@

 
 
-
-  
-prod
-
-  Prod
-  true
-  true
-  TRACE
-
-  
-
-
-  
-  ERROR
-
 

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java?rev=1522103&r1=1522102&r2=1522103&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java 
(original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java 
Thu Sep 12 02:00:55 2013
@@ -117,6 +117,7 @@ public class MainView extends Composite 
 // Not used so far
 // createNorth();
 // dockPanel.add(north, DockPanel.NORTH);
+// dockPanel.setCellHorizontalAlignment(north, DockPanel.ALIGN_RIGHT);
 
 createWest();
 dockPanel.add(west, DockPanel.WEST);
@@ -124,7 +125,6 @@ public class MainView extends Composite 
 
 createCenter();
 dockPanel.add(center, DockPanel.CENTER);
-dockPanel.setCellHorizontalAlignment(north, DockPanel.ALIGN_RIGHT);
 dockPanel.setCellHorizontalAlignment(center, DockPanel.ALIGN_LEFT);
 
 initWidget(dockPanel);

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java?rev=1522103&r1=1522102&r2=1522103&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
 (original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
 Thu Sep 12 02:00:55 2013
@@ -294,13 +294,17 @@ public class MessageSendPresenter extend
 if (type.equals(Type.NEW) && mailto != null) {
 display.getToText().setText(mailto);
 } else if (type.equals(Type.FORWARD)) {
-if (oldmessage.getSubject() != null && 
!oldmessage.getSubject().toLowerCase().startsWith("fwd:")) {
-display.getSubjectText().setText("Fwd: " + 
oldmessage.getSubject());
-}
+   String subject = oldmessage.getSubject() != null ? 
oldmessage.getSubject().trim() : "";
+   if (!subject.toLowerCase().startsWith("fwd:")){
+   subject = "Fwd: " + subject;
+   }
+   display.getSubjectText().setText(subject);
 } else if (type.equals(Type.REPLY) || type.equals(Type.REPLY_ALL)) {
-if (oldmessage.getSubject() != null && 
!oldmessage.getSubject().toLowerCase().startsWith("re:")) {
-display.getSubjectText().setText("Re: " + 
oldmessage.getSubject());
-}
+   String subject = oldmessage.getSubject() != null ? 
oldmessage.getSubject().trim() : "";
+   if (!subject.toLowerCase().startsWith("re:")){
+   subject = "Re: " + subject;
+   }
+   display.getSubjectText().setText(subject);
 if (type.equals(Type.REPLY)) { 
 if (oldmessage.getReplyto() != null && 
!oldmessage.getFrom().contains(oldmessage.getReplyto())) {
 display.getToText().setText(oldmessage.getReplyto());

Modified: 
james/hupa/trunk/

svn commit: r1522102 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/mvp/ server/src/main/java/org/apache/hupa/server/handler/ server/src/main/java/org/apache/hupa/server/preferenc

2013-09-11 Thread dongxu
Author: dongxu
Date: Thu Sep 12 02:00:24 2013
New Revision: 1522102

URL: http://svn.apache.org/r1522102
Log:
constant changed by manolo

Modified:

james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java

james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java

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

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java

james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java

james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java

Modified: 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java?rev=1522102&r1=1522101&r2=1522102&view=diff
==
--- 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java 
(original)
+++ 
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java 
Thu Sep 12 02:00:24 2013
@@ -114,13 +114,15 @@ public class MainView extends Composite 
 dockPanel.setSpacing(10);
 dockPanel.setWidth("100%");
 
-createNorth();
+// Not used so far
+// createNorth();
+// dockPanel.add(north, DockPanel.NORTH);
+
 createWest();
-createCenter();
-
-dockPanel.add(north, DockPanel.NORTH);
 dockPanel.add(west, DockPanel.WEST);
 dockPanel.setCellWidth(west, "160px");
+
+createCenter();
 dockPanel.add(center, DockPanel.CENTER);
 dockPanel.setCellHorizontalAlignment(north, DockPanel.ALIGN_RIGHT);
 dockPanel.setCellHorizontalAlignment(center, DockPanel.ALIGN_LEFT);
@@ -161,6 +163,7 @@ public class MainView extends Composite 
 west.add(panel);
 }
 
+@SuppressWarnings("unused")
 private void createNorth() {
 north = new VerticalPanel();
 north.setWidth("100%");

Modified: 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
URL: 
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java?rev=1522102&r1=1522101&r2=1522102&view=diff
==
--- 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
 (original)
+++ 
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
 Thu Sep 12 02:00:24 2013
@@ -126,25 +126,13 @@ public abstract class AbstractFetchMessa
 Message m = messages[i];
 String from = null;
 if (m.getFrom() != null && m.getFrom().length >0 ) {
-from = m.getFrom()[0].toString().trim();
-try {
-from = MimeUtility.decodeText(from);
-userPreferences.addContact(from);
-} catch (UnsupportedEncodingException e) {
-logger.debug("Unable to decode from " + from + " " + 
e.getMessage());
-}
+from = decodeText(m.getFrom()[0].toString());
 }
 msg.setFrom(from);
 
 String replyto = null;
 if (m.getReplyTo() != null && m.getReplyTo().length >0 ) {
-replyto = m.getReplyTo()[0].toString().trim();
-try {
-replyto = MimeUtility.decodeText(replyto);
-userPreferences.addContact(replyto);
-} catch (UnsupportedEncodingException e) {
-logger.debug("Unable to decode replyto " + replyto + " " + 
e.getMessage());
-}
+replyto = decodeText(m.getReplyTo()[0].toString());
 }
 msg.setReplyto(replyto);
 
@@ -153,27 +141,17 @@ public abstract class AbstractFetchMessa
 Address[] toArray = m.getRecipients(RecipientType.TO);
 if (toArray != null) {
 for (Address addr : toArray) {
-String mailTo = null;
-try {
-mailTo = MimeUtility.decodeText(addr.toString());
-userPreferences.addContact(mailTo);
-} catch (UnsupportedEncodingException e) {
-logger.debug("Unable to decode mailTo " + mailTo + " " 
+ e.getMessage());
-}
-if (mailTo != n

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=1516500&r1=1516499&r2=1516500&view=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=1516500&r1=1516499&r2=1516500&view=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.
 -->
-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";>
+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";>
 4.0.0
 
-org.apache.james.hupa
+org.apache.hupa
 hupa-parent
-0.0.3-SNAPSHOT
+0.0.2-SNAPSHOT
 ../pom.xml
 
 hupa
@@ -31,33 +34,15 @@
 A GWT based IMAP webmail
 
 
-com.google.gwt
-gwt-user
-
-
-javax.validation
-validation-api
-
-
-
-
-com.google.gwt
-gwt-dev
-
-
-${project.groupId}
+org.apache.hupa
 hupa-server
 
 
-${project.groupId}
-hupa-mock
-
-
-${project.groupId}
+org.apache.hupa
 hupa-shared
 
 
-${project.groupId}
+org.apache.hupa
 hupa-widgets
 
 
@@ -65,6 +50,14 @@
 cobogw
 
 
+net.customware.gwt.dispatch
+gwt-dispatch
+
+
+net.customware.gwt.presenter
+gwt-presenter
+
+
 com.google.code.gwt-dnd
 gwt-dnd
 
@@ -77,22 +70,32 @@
 gwtupload
 
 
+com.google.gwt
+gwt-user
+
+  
+java

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=1516486&r1=1516485&r2=1516486&view=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,
-ArrayList 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: 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.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java&r1=1375909&r2=1516164&rev=1516164&view=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.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java&r1=1375909&r2=1516164&rev=1516164&view=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 GwtEvent{
+public class RefreshMessagesEvent extends 
GwtEvent {
+   public final static Type TYPE = new 
Type();
+
+   private String searchValue;
 
-public final static Type TYPE = new 
Type();
-private User user;
-
-public LoginEvent(User user) {
-this.user = user;
-}
-
-public User getUser() {
-return user;
-}
-
-@Override
-public Type 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.Type 
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.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java&r1=1375909&r2=1516164&rev=1516164&view=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 extends GenericResult{
+import com.google.gwt.event.shared.EventHandler;
 
-/**
- * 
- */
-private static final long serialVersionUID = 341407423455

Browser reloading related issues in GWT

2013-06-11 Thread dongxu

Hi Manolo,
An issue #46 
[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 
[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 

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 
Signed-off-by: Dongxu Wang 


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. :)







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 

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 
Signed-off-by: Dongxu Wang 


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");
+}
+}








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 

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 
Signed-off-by: Dongxu Wang 


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 






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







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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

Signed-off-by: Dong Xu Wang 
Signed-off-by: Dongxu Wang 
---
 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




[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 5/8] Make block-cache.c be common interface

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
Signed-off-by: Dongxu Wang 
---
 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 
@@ -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_d

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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 

Conflicts:
block/block-cache.c
Signed-off-by: Dongxu Wang 
---
 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 
+ *
+ * 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->i

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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
Signed-off-by: Dongxu Wang 
---
 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 3/8] qed_read_string to bdrv_read_string

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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

Signed-off-by: Dong Xu Wang 
Signed-off-by: Dongxu Wang 
---
 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 

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

Reviewed-by: Michael Roth 
Signed-off-by: Dong Xu Wang 
Signed-off-by: Dongxu Wang 
---
 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 ":" */
-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 4/8] rename qcow2-cache.c to block-cache.c

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
---
 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 
+ *
+ * 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_UPDA

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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
Signed-off-by: Dongxu Wang 
---
 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.
+
+Bits 0-63:

[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 V15 6/6] remove QEMUOptionParameter related functions and struct

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 


Signed-off-by: Dongxu Wang 
---
 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_opt

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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
Signed-off-by: Dongxu Wang 
---
 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 4/6] Create some QemuOpts functons

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 

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 
---
 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 *

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

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 

v13->v14:
1) change code style.
2) assert errors.
Signed-off-by: Dongxu Wang 
---
 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 1/6] add def_value_str in QemuOptDesc struct and rewrite qemu_opts_print

2013-05-30 Thread Dongxu Wang
From: Dong Xu Wang 

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 
Signed-off-by: Dongxu Wang 
---
 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 : "");
-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 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




[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] [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


[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, then mkdir 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.h and 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] 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


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  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

** 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

** 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-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


[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


[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


[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


[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


[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


[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


[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


[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


[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


[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


[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


[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
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


[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

** 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
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


[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


Re: script binding for reiserfs?

2006-04-07 Thread Dongxu Ma
On 4/8/06, Peter van Hardenberg <[EMAIL PROTECTED]> wrote:
Dongxu,Reaching into the filesystem itself for a project like this is not a very good idea. A wiki is a set of files -- let the filesystem do the hard work for you and use the standard API that is already in existence -- the VFS. You'll get all the benefits of the Reiser filesystem without having to break compatibility with other systems.
my own thought is that one can operate the filesystem, or at least query it via programming interface, you know, introduce shell is really a bad idea. There are already some examples on CPAN such as Filesys::Ext2.
 I think a DBI/DBD interface to a Reiser-friendly file format is a really neat idea. You could create table rows as individual files within a directory and do foreign keys with links! I wonder what on-disk form would leverage Reiser4's dancing trees and intelligent allocation the most efficiently?
Yeah, I can store  each  field  into a file, and creat view and table structure from directory and links. With the help of reiserfs, I assume this could be possible to try.
I must say though, there is no binding to the Reiser4 API, and the Namesys team is very busy right now working towards getting R4 included in the mainline kernel. Hopefully once they have achieved this, the more exciting development can continue. 
2.6.16 is a big step;-P
As for your second question, my experience is strictly with R4, so someone else will have to comment on that issue.Anyway, great help for me, thanks.
All the best,Peter van HardenbergOn 4/6/06, 

Dongxu Ma <[EMAIL PROTECTED]> wrote:

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

-- Peter van HardenbergVictoria, BC, Canada"The wise man proportions his belief to the evidence." -- David Hume

-- Cheers, Dongxu__END__dongxu.wordpress.comsearch.cpan.org/~dongxu



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 wrap a c++ static object

2005-09-16 Thread Dongxu Ma
Hi all,

In a c++ class, there is a static object. I'd like to wrap it as a sub in perlxs. Just like this:

foo *
foo::bar()
CODE:
 RETVAL = &(foo::bar);
OUTPUT:
 RETVAL

Of course, the RETVAL will be blessed in typemap and finally return a RV in perl code. 
Each time I invoke the sub in perl, it will cause a segfault. But the same idea works in c++ code.
Does anyone know the reason? Thanks in advance.-- Bst Rgrs, 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


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
Hi All,

I am learning how to use XS (C). 
Firstly, I wrote a simple C++ class, compiled to libtest.so. A simple
main proved the test lib works fine.
test.h---
#ifndef _TEST_H
#define _TEST_H
class Test 
{
  public:
Test();
~Test();
void print(void);
  private:
int i;
};
#endif
--
test.cpp---
#include "test.h"
#include 

Test::Test()
{
i = 1;
cout<<"new inst created"<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


segfault while invoking C++ class destructor

2005-08-10 Thread Dongxu Ma
Hi there,

I am learning how to port C++ interface to Perl by perlxs. At first, I
wrote a simple C++ class,which has one public method only, compiled as
libtest.so.
--test.h
---
#ifndef _TEST_H
#define _TEST_H
class Test 
{
  public:
Test();
~Test();
void print(void);
};
#endif

test.cpp--
#include "test.h"
#include 
Test::Test()
{
cout<<"new inst created"< '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' 
libtest.so under subdir clib
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
);
---
---Test.xs---
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"
#include "clib/test.h"

#include "stdio.h"

MODULE = Test   PACKAGE = Test  

Test *
Test::new()

void
Test::DESTROY()
CODE:
delete THIS;
fprintf(stdout, "here\n");

NO_OUTPUT void
Test::print()
CODE:
THIS->print();
-
-typemap
TYPEMAP
Test *  T_OBJECT


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


OUTPUT
T_OBJECT
sv_setref_pv($arg, \"Test\", (void*)$var);
-

After running `perl Makefile.PL` and `make`, I got Test.so
Finally, I wrote a test script:
-test.plx---
#! /usr/bin/perl
use warnings;
use strict;

use blib q(blib);
use Test ();

my $inst = Test::->new();
$inst->print();

undef $inst;
--

ran it in shell I got:
---output of
`test.plx`-
[EMAIL PROTECTED] ~/tmp/Test $ ./test.plx 
new inst created
Test::print called
inst destroyed
Segmentation fault
[EMAIL PROTECTED] ~/tmp/Test $ 
--

while running the same script in perldb, I got:
---output of `perl -d -MDevel::Peek test.plx`

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(test.plx:9): my $inst = Test::->new();
  DB<1> n
new inst created
main::(test.plx:10):$inst->print();
  DB<1> Dump $inst
SV = PVMG(0x844b680) at 0x81aea98
  REFCNT = 2
  FLAGS = (PADBUSY,PADMY,ROK)
  IV = 0
  NV = 0
  RV = 0x852a01c
  SV = PVMG(0x844b700) at 0x852a01c
REFCNT = 1
FLAGS = (OBJECT,IOK,pIOK)
IV = 135961544
NV = 0
PV = 0
STASH = 0x8416f74   "Test"
  PV = 0x852a01c ""
  CUR = 0
  LEN = 0

  DB<2> s
Test::print called
main::(test.plx:12):undef $inst;
  DB<2> s
inst destroyed
here
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.  
  DB<2> 
---

As seen, in debug mode, "DELETE THIS;", which calls Test::~Test() in
c++ code, returned successfully. While in normal shell, it caused a
segfault.
Is there any error in my code above? Does anyone know the reason?
Thanks in advance.
--
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]



Data Service

2001-08-30 Thread Dongxu Data Service


ÄúºÃ£¬

Õâ·âÐÅÈç¹û¸øÄúÔì³É²»±ã£¬Çë¶àÔ­Á²¢É¾³ý´ËÐÅ¡£

ÎÒÃÇÊÇÒ»¼ÒÊý¾Ý´¦Àí¹«Ë¾£¬Ìṩרҵ¼¶µÄÎÄ×Ö¼Èë¡¢Êý¾Ý¿â
ÖÆ×÷¡¢Ê鿯ÅÅУ¡¢Í¼Æ¬É¨Ãè¡¢ÅúÁ¿Ö÷Ò³ÖÆ×÷¡¢Èí¼þ²âÊԵȷþ
Îñ¡£´¦ÀíËÙ¶ÈΪºº×Ö¼Èë40Íò×Ö/Ì죬ӢÎÄ200Íò×Ö·û/Ìì,ͼ
ƬɨÃèÐÞÕû4000·ù/ÌìµÄ¹¤×÷ÄÜÁ¦¡£

µäÐÍ¿Í»§£º

ÁªÏë-±±´ó¸½ÖÐÔ¶³Ì½ÌÓý¹«Ë¾  ÖÐѧ½Ì³ÌÊý¾Ý´¦Àí
ÁªÏëFM365ÍøÕ¾¹ºÎïƵµÀ Êé¼®ÒôÏñɨÃèÈë¿â
ÁªÏëFM365ÍøÕ¾½ÌÓýƵµÀ Ï£Íû¹¤³ÌÐÅÏ¢¿â¼Èë²¢½¨¿â
΢Èí±±¾©ÓÐÏÞ¹«Ë¾  ÍøÕ¾·­ÒëÖÐÎÄÄÚÈݼÈë
¹ú¼Ò»úе¹¤ÒµÐÅÏ¢Ñо¿Ôº ¹ú¼Ò»úµç²úÆ·Ñù±¾É¨Ã輰¼Èë
¹ú¼ÒµçÁ¦ÉÌÎñÍøÃû¼¼°²úÆ·Êý¾Ý¿â¼Èë
ÖйúÇàÉÙÄê·¢Õ¹»ù½ð»á   ¾è¿îÈËÃûµ¥Êý¾Ý¿â¼Èë
21ICµç×ÓÍøÄÚÈݼÈë¼°Ö÷Ò³ÖÆ×÷
±±¾©µçÊǪ́ÐÅÏ¢×é   15ÍòÕÅͼƬɨÃè´¦Àí

¹«Ë¾Î»ÓÚ±±¾©Àí¹¤´óѧУÄÚ£¬¹«Ë¾µçÄÔÈ«²¿½ÓÈ뻥ÁªÍø£¬¹¤
×÷ЧÂʸߣ¬ÈËÔ±ÔðÈÎÐÄÇ¿, ÎÒÃÇÌṩרҵƷÖÊ·þÎñºÍ¼«¾ß¾º
ÕùÁ¦µÄ±¨¼Û¡£±±¾©¿Í»§ÉÏÃÅ·þÎñ£¬ÍâµØ¿Í»§µç»°ÁªÏµ¡£

ÄúÈç¹û¸ÐÐËȤÇëÖ±½Óºô£¨010£©288-96071


---
¸ÃÓʼþÓÉ¡¶½ð·æÓʼþȺ·¢ 2.4¡··¢ËÍ£¬ÓʼþÄÚÈÝÓëÈí¼þ×÷ÕßÎÞ¹Ø 
---
½ð·æÈí¼þ£¬ÖµµÃÐÅÀµµÄÈí¼þ http://www.jinfengnet.com







<    1   2   3   4   5