Merge "Support an additional alias for 'adb shell.'"
diff --git a/include/netutils/dhcp.h b/include/netutils/dhcp.h
deleted file mode 100644
index 96798c5..0000000
--- a/include/netutils/dhcp.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- *
- *     http://www.apache.org/licenses/LICENSE-2.0 
- *
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-#ifndef _NETUTILS_DHCP_H_
-#define _NETUTILS_DHCP_H_
-
-#include <sys/cdefs.h>
-#include <arpa/inet.h>
-
-__BEGIN_DECLS
-
-extern int do_dhcp(char *iname);
-extern int dhcp_do_request(const char *ifname,
-                          in_addr_t *ipaddr,
-                          in_addr_t *gateway,
-                          in_addr_t *mask,
-                          in_addr_t *dns1,
-                          in_addr_t *dns2,
-                          in_addr_t *server,
-                          uint32_t  *lease);
-extern int dhcp_stop(const char *ifname);
-extern int dhcp_release_lease(const char *ifname);
-extern char *dhcp_get_errmsg();
-
-__END_DECLS
-
-#endif /* _NETUTILS_DHCP_H_ */
diff --git a/include/netutils/ifc.h b/include/netutils/ifc.h
deleted file mode 100644
index 2e502ab..0000000
--- a/include/netutils/ifc.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- *
- *     http://www.apache.org/licenses/LICENSE-2.0 
- *
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-
-#ifndef _NETUTILS_IFC_H_
-#define _NETUTILS_IFC_H_
-
-#include <sys/cdefs.h>
-#include <arpa/inet.h>
-
-__BEGIN_DECLS
-
-extern int ifc_init(void);
-extern void ifc_close(void);
-
-extern int ifc_get_ifindex(const char *name, int *if_indexp);
-extern int ifc_get_hwaddr(const char *name, void *ptr);
-
-extern int ifc_up(const char *name);
-extern int ifc_down(const char *name);
-
-extern int ifc_enable(const char *ifname);
-extern int ifc_disable(const char *ifname);
-
-extern int ifc_reset_connections(const char *ifname);
-
-extern int ifc_set_addr(const char *name, in_addr_t addr);
-extern int ifc_set_mask(const char *name, in_addr_t mask);
-extern int ifc_set_hwaddr(const char *name, const void *ptr);
-
-extern int ifc_add_host_route(const char *name, in_addr_t addr);
-extern int ifc_remove_host_routes(const char *name);
-extern int ifc_get_default_route(const char *ifname);
-extern int ifc_set_default_route(const char *ifname, in_addr_t gateway);
-extern int ifc_create_default_route(const char *name, in_addr_t addr);
-extern int ifc_remove_default_route(const char *ifname);
-
-extern int ifc_get_info(const char *name, in_addr_t *addr, in_addr_t *mask,
-                        in_addr_t *flags);
-
-extern int ifc_configure(const char *ifname, in_addr_t address,
-                         in_addr_t netmask, in_addr_t gateway,
-                         in_addr_t dns1, in_addr_t dns2);
-
-__END_DECLS
-
-#endif /* _NETUTILS_IFC_H_ */
diff --git a/include/pixelflinger/pixelflinger.h b/include/pixelflinger/pixelflinger.h
index dca0b90..8a2b442 100644
--- a/include/pixelflinger/pixelflinger.h
+++ b/include/pixelflinger/pixelflinger.h
@@ -315,7 +315,7 @@
 ssize_t gglInit(GGLContext** context);
 ssize_t gglUninit(GGLContext* context);
 
-GGLint gglBitBlti(
+GGLint gglBitBlit(
         GGLContext* c,
         int tmu,
         GGLint crop[4],
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index 903f99f..57d6761 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -161,6 +161,7 @@
     { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/main.conf" },
     { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/input.conf" },
     { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/audio.conf" },
+    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/network.conf" },
     { 00444, AID_NET_BT,    AID_NET_BT,    "system/etc/bluetooth/blacklist.conf" },
     { 00640, AID_SYSTEM,    AID_SYSTEM,    "system/etc/bluetooth/auto_pairing.conf" },
     { 00444, AID_RADIO,     AID_AUDIO,     "system/etc/AudioPara4.csv" },
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index cb0960f..0f8a6c4 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -115,14 +115,6 @@
     }
 }
 
-static const char *ipaddr_to_string(in_addr_t addr)
-{
-    struct in_addr in_addr;
-
-    in_addr.s_addr = addr;
-    return inet_ntoa(in_addr);
-}
-
 /*
  * Start the dhcp client daemon, and wait for it to finish
  * configuring the interface.
@@ -173,13 +165,7 @@
         return -1;
     }
     if (strcmp(prop_value, "ok") == 0) {
-        char dns_prop_name[PROPERTY_KEY_MAX];
         fill_ip_info(interface, ipaddr, gateway, mask, dns1, dns2, server, lease);
-        /* copy the dhcp.XXX.dns properties to net.XXX.dns */
-        snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", interface);
-        property_set(dns_prop_name, *dns1 ? ipaddr_to_string(*dns1) : "");
-        snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", interface);
-        property_set(dns_prop_name, *dns2 ? ipaddr_to_string(*dns2) : "");
         return 0;
     } else {
         snprintf(errmsg, sizeof(errmsg), "DHCP result was %s", prop_value);
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index ff00432..6755ba1 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -36,8 +36,8 @@
 
 #include <dirent.h>
 
-#include <netutils/ifc.h>
 #include "dhcpmsg.h"
+#include "ifc_utils.h"
 #include "packet.h"
 
 #define VERBOSE 2
@@ -85,12 +85,16 @@
 //    exit(1);
 }
 
-const char *ipaddr(in_addr_t addr)
+const char *ipaddr(uint32_t addr)
 {
-    struct in_addr in_addr;
+    static char buf[32];
 
-    in_addr.s_addr = addr;
-    return inet_ntoa(in_addr);
+    sprintf(buf,"%d.%d.%d.%d",
+            addr & 255,
+            ((addr >> 8) & 255),
+            ((addr >> 16) & 255),
+            (addr >> 24));
+    return buf;
 }
 
 typedef struct dhcp_info dhcp_info;
@@ -124,11 +128,31 @@
     *lease = last_good_info.lease;
 }
 
-static int dhcp_configure(const char *ifname, dhcp_info *info)
+static int ifc_configure(const char *ifname, dhcp_info *info)
 {
+    char dns_prop_name[PROPERTY_KEY_MAX];
+
+    if (ifc_set_addr(ifname, info->ipaddr)) {
+        printerr("failed to set ipaddr %s: %s\n", ipaddr(info->ipaddr), strerror(errno));
+        return -1;
+    }
+    if (ifc_set_mask(ifname, info->netmask)) {
+        printerr("failed to set netmask %s: %s\n", ipaddr(info->netmask), strerror(errno));
+        return -1;
+    }
+    if (ifc_create_default_route(ifname, info->gateway)) {
+        printerr("failed to set default route %s: %s\n", ipaddr(info->gateway), strerror(errno));
+        return -1;
+    }
+
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", ifname);
+    property_set(dns_prop_name, info->dns1 ? ipaddr(info->dns1) : "");
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", ifname);
+    property_set(dns_prop_name, info->dns2 ? ipaddr(info->dns2) : "");
+
     last_good_info = *info;
-    return ifc_configure(ifname, info->ipaddr, info->netmask, info->gateway,
-                         info->dns1, info->dns2);
+
+    return 0;
 }
 
 static const char *dhcp_type_to_name(uint32_t type)
@@ -425,7 +449,7 @@
                 printerr("timed out\n");
                 if ( info.type == DHCPOFFER ) {
                     printerr("no acknowledgement from DHCP server\nconfiguring %s with offered parameters\n", ifname);
-                    return dhcp_configure(ifname, &info);
+                    return ifc_configure(ifname, &info);
                 }
                 errno = ETIME;
                 close(s);
@@ -506,7 +530,7 @@
             if (info.type == DHCPACK) {
                 printerr("configuring %s\n", ifname);
                 close(s);
-                return dhcp_configure(ifname, &info);
+                return ifc_configure(ifname, &info);
             } else if (info.type == DHCPNAK) {
                 printerr("configuration request denied\n");
                 close(s);
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 296d617..bde336f 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -27,8 +27,6 @@
 #include <arpa/inet.h>
 
 #include <linux/if.h>
-#include <linux/if_ether.h>
-#include <linux/if_arp.h>
 #include <linux/sockios.h>
 #include <linux/route.h>
 #include <linux/wireless.h>
@@ -47,7 +45,7 @@
 static int ifc_ctl_sock = -1;
 void printerr(char *fmt, ...);
 
-static const char *ipaddr_to_string(in_addr_t addr)
+static const char *ipaddr_to_string(uint32_t addr)
 {
     struct in_addr in_addr;
 
@@ -90,7 +88,7 @@
     r = ioctl(ifc_ctl_sock, SIOCGIFHWADDR, &ifr);
     if(r < 0) return -1;
 
-    memcpy(ptr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+    memcpy(ptr, &ifr.ifr_hwaddr.sa_data, 6);
     return 0;    
 }
 
@@ -145,17 +143,6 @@
     return ioctl(ifc_ctl_sock, SIOCSIFADDR, &ifr);
 }
 
-int ifc_set_hwaddr(const char *name, const void *ptr)
-{
-    int r;
-    struct ifreq ifr;
-    ifc_init_ifr(name, &ifr);
-
-    ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
-    memcpy(&ifr.ifr_hwaddr.sa_data, ptr, ETH_ALEN);
-    return ioctl(ifc_ctl_sock, SIOCSIFHWADDR, &ifr);
-}
-
 int ifc_set_mask(const char *name, in_addr_t mask)
 {
     struct ifreq ifr;
@@ -442,9 +429,9 @@
 
     ifc_close();
 
-    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", ifname);
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "dhcp.%s.dns1", ifname);
     property_set(dns_prop_name, dns1 ? ipaddr_to_string(dns1) : "");
-    snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", ifname);
+    snprintf(dns_prop_name, sizeof(dns_prop_name), "dhcp.%s.dns2", ifname);
     property_set(dns_prop_name, dns2 ? ipaddr_to_string(dns2) : "");
 
     return 0;
diff --git a/libnetutils/ifc_utils.h b/libnetutils/ifc_utils.h
new file mode 100644
index 0000000..49b8747
--- /dev/null
+++ b/libnetutils/ifc_utils.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+#ifndef _IFC_UTILS_H_
+#define _IFC_UTILS_H_
+
+int ifc_init(void);
+
+int ifc_get_ifindex(const char *name, int *if_indexp);
+int ifc_get_hwaddr(const char *name, void *ptr);
+
+int ifc_up(const char *name);
+int ifc_down(const char *name);
+
+int ifc_set_addr(const char *name, unsigned addr);
+int ifc_set_mask(const char *name, unsigned mask);
+
+int ifc_create_default_route(const char *name, unsigned addr);
+
+int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags);
+
+#endif
diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk
index 6491d24..ed2ab5e 100644
--- a/libpixelflinger/Android.mk
+++ b/libpixelflinger/Android.mk
@@ -2,17 +2,6 @@
 include $(CLEAR_VARS)
 
 #
-# ARMv6 specific objects
-#
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_ASFLAGS := -march=armv6
-LOCAL_SRC_FILES := rotate90CW_4x4_16v6.S
-LOCAL_MODULE := libpixelflinger_armv6
-include $(BUILD_STATIC_LIBRARY)
-endif
-
-#
 # C/C++ and ARMv5 objects
 #
 
@@ -77,10 +66,6 @@
 LOCAL_SHARED_LIBRARIES += libhardware_legacy
 LOCAL_CFLAGS += -DWITH_LIB_HARDWARE
 endif
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_WHOLE_STATIC_LIBRARIES := libpixelflinger_armv6
-endif
 include $(BUILD_SHARED_LIBRARY)
 
 #
@@ -91,9 +76,6 @@
 LOCAL_MODULE:= libpixelflinger_static
 LOCAL_SRC_FILES := $(PIXELFLINGER_SRC_FILES)
 LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_WHOLE_STATIC_LIBRARIES := libpixelflinger_armv6
-endif
 include $(BUILD_STATIC_LIBRARY)
 
 
diff --git a/libpixelflinger/raster.cpp b/libpixelflinger/raster.cpp
index d751202..32b2a97 100644
--- a/libpixelflinger/raster.cpp
+++ b/libpixelflinger/raster.cpp
@@ -143,7 +143,7 @@
 
 using namespace android;
 
-GGLint gglBitBlti(GGLContext* con, int tmu, GGLint crop[4], GGLint where[4])
+GGLint gglBitBlit(GGLContext* con, int tmu, GGLint crop[4], GGLint where[4])
 {
     GGL_CONTEXT(c, (void*)con);
 
diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp
index a2f43eb..931d648 100644
--- a/libpixelflinger/scanline.cpp
+++ b/libpixelflinger/scanline.cpp
@@ -1518,26 +1518,3 @@
 // ----------------------------------------------------------------------------
 }; // namespace android
 
-using namespace android;
-extern "C" void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1)
-{
-#if ANDROID_ARM_CODEGEN
-    GGLContext* c;
-    gglInit(&c);
-    needs_t needs;
-    needs.n = n;
-    needs.p = p;
-    needs.t[0] = t0;
-    needs.t[1] = t1;
-    sp<ScanlineAssembly> a(new ScanlineAssembly(needs, ASSEMBLY_SCRATCH_SIZE));
-    GGLAssembler assembler( new ARMAssembler(a) );
-    int err = assembler.scanline(needs, (context_t*)c);
-    if (err != 0) {
-        printf("error %08x (%s)\n", err, strerror(-err));
-    }
-    gglUninit(c);
-#else
-    printf("This test runs only on ARM\n");
-#endif
-}
-
diff --git a/libpixelflinger/tests/codegen/Android.mk b/libpixelflinger/tests/codegen/Android.mk
index 1bc4214..aa320fc 100644
--- a/libpixelflinger/tests/codegen/Android.mk
+++ b/libpixelflinger/tests/codegen/Android.mk
@@ -2,12 +2,15 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:= \
-	codegen.cpp
+	codegen.cpp.arm
 
 LOCAL_SHARED_LIBRARIES := \
 	libcutils \
     libpixelflinger
 
+LOCAL_C_INCLUDES := \
+	system/core/libpixelflinger
+
 LOCAL_MODULE:= test-opengl-codegen
 
 LOCAL_MODULE_TAGS := tests
diff --git a/libpixelflinger/tests/codegen/codegen.cpp b/libpixelflinger/tests/codegen/codegen.cpp
index 1865888..94e2481 100644
--- a/libpixelflinger/tests/codegen/codegen.cpp
+++ b/libpixelflinger/tests/codegen/codegen.cpp
@@ -1,9 +1,54 @@
 #include <stdio.h>
 #include <stdint.h>
 
-extern "C" void ggl_test_codegen(
-        uint32_t n, uint32_t p, uint32_t t0, uint32_t t1);
+#include "private/pixelflinger/ggl_context.h"
 
+#include "buffer.h"
+#include "scanline.h"
+
+#include "codeflinger/CodeCache.h"
+#include "codeflinger/GGLAssembler.h"
+#include "codeflinger/ARMAssembler.h"
+
+#if defined(__arm__)
+#   define ANDROID_ARM_CODEGEN  1
+#else
+#   define ANDROID_ARM_CODEGEN  0
+#endif
+
+#define ASSEMBLY_SCRATCH_SIZE   2048
+
+using namespace android;
+
+class ScanlineAssembly : public Assembly {
+    AssemblyKey<needs_t> mKey;
+public:
+    ScanlineAssembly(needs_t needs, size_t size)
+        : Assembly(size), mKey(needs) { }
+    const AssemblyKey<needs_t>& key() const { return mKey; }
+};
+
+static void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1)
+{
+#if ANDROID_ARM_CODEGEN
+    GGLContext* c;
+    gglInit(&c);
+    needs_t needs;
+    needs.n = n;
+    needs.p = p;
+    needs.t[0] = t0;
+    needs.t[1] = t1;
+    sp<ScanlineAssembly> a(new ScanlineAssembly(needs, ASSEMBLY_SCRATCH_SIZE));
+    GGLAssembler assembler( new ARMAssembler(a) );
+    int err = assembler.scanline(needs, (context_t*)c);
+    if (err != 0) {
+        printf("error %08x (%s)\n", err, strerror(-err));
+    }
+    gglUninit(c);
+#else
+    printf("This test runs only on ARM\n");
+#endif
+}
 
 int main(int argc, char** argv)
 {
diff --git a/netcfg/netcfg.c b/netcfg/netcfg.c
index 9cd883a..fc9cf48 100644
--- a/netcfg/netcfg.c
+++ b/netcfg/netcfg.c
@@ -19,13 +19,17 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <dirent.h>
-#include <netinet/ether.h>
-
-#include <netutils/ifc.h>
-#include <netutils/dhcp.h>
 
 static int verbose = 0;
 
+int ifc_init();
+void ifc_close();
+int ifc_up(char *iname);
+int ifc_down(char *iname);
+int ifc_remove_host_routes(char *iname);
+int ifc_remove_default_route(char *iname);
+int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags);
+int do_dhcp(char *iname);
 
 void die(const char *reason)
 {
@@ -33,12 +37,16 @@
     exit(1);
 }
 
-const char *ipaddr(in_addr_t addr)
+const char *ipaddr(unsigned addr)
 {
-    struct in_addr in_addr;
-
-    in_addr.s_addr = addr;
-    return inet_ntoa(in_addr);
+    static char buf[32];
+    
+    sprintf(buf,"%d.%d.%d.%d", 
+            addr & 255,
+            ((addr >> 8) & 255),
+            ((addr >> 16) & 255), 
+            (addr >> 24));
+    return buf;
 }
 
 void usage(void)
@@ -78,15 +86,6 @@
     return 0;
 }
 
-int set_hwaddr(const char *name, const char *asc) {
-    struct ether_addr *addr = ether_aton(asc);
-    if (!addr) {
-        printf("Failed to parse '%s'\n", asc);
-        return -1;
-    }
-    return ifc_set_hwaddr(name, addr->ether_addr_octet);
-}
-
 struct 
 {
     const char *name;
@@ -98,7 +97,6 @@
     { "down",   1, ifc_down },
     { "flhosts",  1, ifc_remove_host_routes },
     { "deldefault", 1, ifc_remove_default_route },
-    { "hwaddr", 2, set_hwaddr },
     { 0, 0, 0 },
 };
 
diff --git a/nexus/DhcpClient.cpp b/nexus/DhcpClient.cpp
index 713059d..a5654d2 100644
--- a/nexus/DhcpClient.cpp
+++ b/nexus/DhcpClient.cpp
@@ -27,15 +27,35 @@
 
 #include <sysutils/ServiceManager.h>
 
-#include <netutils/ifc.h>
-#include <netutils/dhcp.h>
-
 #include "DhcpClient.h"
 #include "DhcpState.h"
 #include "DhcpListener.h"
 #include "IDhcpEventHandlers.h"
 #include "Controller.h"
 
+extern "C" {
+int ifc_disable(const char *ifname);
+int ifc_add_host_route(const char *ifname, uint32_t addr);
+int ifc_remove_host_routes(const char *ifname);
+int ifc_set_default_route(const char *ifname, uint32_t gateway);
+int ifc_get_default_route(const char *ifname);
+int ifc_remove_default_route(const char *ifname);
+int ifc_reset_connections(const char *ifname);
+int ifc_configure(const char *ifname, in_addr_t ipaddr, in_addr_t netmask, in_addr_t gateway, in_addr_t dns1, in_addr_t dns2);
+
+int dhcp_do_request(const char *ifname,
+                    in_addr_t *ipaddr,
+                    in_addr_t *gateway,
+                    in_addr_t *mask,
+                    in_addr_t *dns1,
+                    in_addr_t *dns2,
+                    in_addr_t *server,
+                    uint32_t  *lease);
+int dhcp_stop(const char *ifname);
+int dhcp_release_lease(const char *ifname);
+char *dhcp_get_errmsg();
+}
+
 DhcpClient::DhcpClient(IDhcpEventHandlers *handlers) :
             mState(DhcpState::INIT), mHandlers(handlers) {
     mServiceManager = new ServiceManager();
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index a534dae..82e6354 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <sys/uio.h>
 #include <dirent.h>
 
@@ -41,7 +42,7 @@
  * usage:  sdcard <path> <uid> <gid>
  *
  * It must be run as root, but will change to uid/gid as soon as it
- * mounts a filesystem on /sdcard.  It will refuse to run if uid or
+ * mounts a filesystem on /mnt/sdcard.  It will refuse to run if uid or
  * gid are zero.
  *
  *
@@ -72,6 +73,8 @@
 
 #define FUSE_UNKNOWN_INO 0xffffffff
 
+#define MOUNT_POINT "/mnt/sdcard"
+
 struct handle {
     struct node *node;
     int fd;
@@ -143,7 +146,12 @@
     attr->ino = s->st_ino;
     attr->size = s->st_size;
     attr->blocks = s->st_blocks;
-        /* TODO: time */
+    attr->atime = s->st_atime;
+    attr->mtime = s->st_mtime;
+    attr->ctime = s->st_ctime;
+    attr->atimensec = s->st_atime_nsec;
+    attr->mtimensec = s->st_mtime_nsec;
+    attr->ctimensec = s->st_ctime_nsec;
     attr->mode = s->st_mode;
     attr->nlink = s->st_nlink;
 
@@ -580,7 +588,30 @@
         fuse_reply(fuse, hdr->unique, &out, sizeof(out));
         goto oops;
     }
-//    case FUSE_STATFS:
+    case FUSE_STATFS: { /* getattr_in -> attr_out */
+        struct statfs stat;
+        struct fuse_statfs_out out;
+        int res;
+
+        TRACE("STATFS\n");
+
+        if (statfs(fuse->root.name, &stat)) {
+            fuse_status(fuse, hdr->unique, -errno);
+            return;
+        }
+
+        memset(&out, 0, sizeof(out));
+        out.st.blocks = stat.f_blocks;
+        out.st.bfree = stat.f_bfree;
+        out.st.bavail = stat.f_bavail;
+        out.st.files = stat.f_files;
+        out.st.ffree = stat.f_ffree;
+        out.st.bsize = stat.f_bsize;
+        out.st.namelen = stat.f_namelen;
+        out.st.frsize = stat.f_frsize;
+        fuse_reply(fuse, hdr->unique, &out, sizeof(out));
+        return;
+    }
     case FUSE_RELEASE: { /* release_in -> */
         struct fuse_release_in *req = data;
         struct handle *h = id_to_ptr(req->fh);
@@ -729,7 +760,7 @@
     path = argv[1];
 
         /* cleanup from previous instance, if necessary */
-    umount2("/sdcard", 2);
+    umount2(MOUNT_POINT, 2);
 
     fd = open("/dev/fuse", O_RDWR);
     if (fd < 0){
@@ -740,7 +771,7 @@
     sprintf(opts, "fd=%i,rootmode=40000,default_permissions,allow_other,"
             "user_id=%d,group_id=%d", fd, uid, gid);
     
-    res = mount("/dev/fuse", "/sdcard", "fuse", MS_NOSUID | MS_NODEV, opts);
+    res = mount("/dev/fuse", MOUNT_POINT, "fuse", MS_NOSUID | MS_NODEV, opts);
     if (res < 0) {
         ERROR("cannot mount fuse filesystem (%d)\n", errno);
         return -1;
diff --git a/toolbox/ps.c b/toolbox/ps.c
index bc50cfa..2aa3efb 100644
--- a/toolbox/ps.c
+++ b/toolbox/ps.c
@@ -27,6 +27,7 @@
 #define SHOW_PRIO 1
 #define SHOW_TIME 2
 #define SHOW_POLICY 4
+#define SHOW_CPU  8
 
 static int display_flags = 0;
 
@@ -41,7 +42,7 @@
     int ppid, tty;
     unsigned wchan, rss, vss, eip;
     unsigned utime, stime;
-    int prio, nice, rtprio, sched;
+    int prio, nice, rtprio, sched, psr;
     struct passwd *pw;
     
     sprintf(statline, "/proc/%d", pid);
@@ -122,7 +123,7 @@
     nexttok(&ptr); // nswap
     nexttok(&ptr); // cnswap
     nexttok(&ptr); // exit signal
-    nexttok(&ptr); // processor
+    psr = atoi(nexttok(&ptr)); // processor
     rtprio = atoi(nexttok(&ptr)); // rt_priority
     sched = atoi(nexttok(&ptr)); // scheduling policy
     
@@ -142,7 +143,9 @@
     
     if(!namefilter || !strncmp(name, namefilter, strlen(namefilter))) {
         printf("%-9s %-5d %-5d %-6d %-5d", user, pid, ppid, vss / 1024, rss * 4);
-        if(display_flags&SHOW_PRIO)
+        if (display_flags & SHOW_CPU)
+            printf(" %-2d", psr);
+        if (display_flags & SHOW_PRIO)
             printf(" %-5d %-5d %-5d %-5d", prio, nice, rtprio, sched);
         if (display_flags & SHOW_POLICY) {
             SchedPolicy p;
@@ -207,6 +210,8 @@
             display_flags |= SHOW_POLICY;
         } else if(!strcmp(argv[1],"-p")) {
             display_flags |= SHOW_PRIO;
+        } else if(!strcmp(argv[1],"-c")) {
+            display_flags |= SHOW_CPU;
         }  else if(isdigit(argv[1][0])){
             pidfilter = atoi(argv[1]);
         } else {
@@ -216,7 +221,8 @@
         argv++;
     }
 
-    printf("USER     PID   PPID  VSIZE  RSS   %s %s WCHAN    PC         NAME\n", 
+    printf("USER     PID   PPID  VSIZE  RSS   %s%s %s WCHAN    PC         NAME\n",
+           (display_flags&SHOW_CPU)?"CPU ":"",
            (display_flags&SHOW_PRIO)?"PRIO  NICE  RTPRI SCHED ":"",
            (display_flags&SHOW_POLICY)?"PCY " : "");
     while((de = readdir(d)) != 0){