sdcard: Allow building as a static library

 * Split main() out in order to allow linking with a multi-call
   executable such as recovery.

Change-Id: I3325135e47e4dd5af3912f5ce67ec64007d54a63

Conflicts:
	sdcard/Android.mk
sdcard: fix usage for -w and -s options

Change-Id: I0ef4299d2ccf99a18970f02d4bd4e7c28dc5335e
sdcard: Respect check_caller_access_to_name on readdir() calls

While looking at a blocked path failed as expected when trying
to access it with a stat(), read(), or getattr(), readdir() still
returned the entry, making devices with mounted external storage fail
com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite
by trying to interact with otherwise invisible paths.

Fixit by skipping all entries that would've been made invisible at
LOOKUP

Change-Id: Ia8afac0703fa10f78c89046f029776bd290e4846
sdcard: Link to cutils and libc as DSOs

There's no reason to link this statically, especially since we're
building a shared binary anyway. Reduce binary size from 108k to 18k

Change-Id: I0622f039080fa088348570048314121ea4e14587