Commit graph

166 commits

Author SHA1 Message Date
Ken Sumrall
9791965680 Add support for the utime(2) family of system calls to the sdcard fuse filesystem.
Add support for the utime(2) family of system calls to change the modify
and access time of files.  Requires an updated bionic with support for
the utimensat(2) system call.

Change-Id: I8cc0c0e6671c5708849752f47e4c3d4be2858b61
2011-03-24 18:29:41 -07:00
Terry Heo (Woncheol)
8349cce829 Fix uninitialized variable bug in sdcard emulator
- Following members were not initialized in fuse_init().
  fuse->root.actual_name
  fuse->root.gen
- Initialize fuse->root with memset().

Change-Id: I4bce754ace608b526961f59049b2d780fd99756f
2011-03-16 13:10:08 +09:00
Mike Lockwood
75e17a8908 sdcard: Fix readdir implementation so rewinddir will work correctly
Fixes problem with "ls -R" in /mnt/sdcard

BUG: 3309556

Change-Id: Ie2246585439116de3cb40f4005f3b44a0439f54c
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-25 17:22:47 -08:00
Mike Lockwood
575a2bbee3 sdcard: Remove lower case squashing of file names
sdcard daemon will now create new files and directories using
the actual name passed in by the client.
For existing files, sdcard will do case insensitive matching
when case sensitive lookup fails.

Change-Id: I89f995ea01beb2c63a9b36943dbcfaa16e7cd972
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-23 16:20:28 -08:00
Mike Lockwood
b94d320b1e sdcard: Fix lower case squashing for case insensitivity support.
The fuse layer in the kernel does not support case insensitive file systems.
But the sdcard daemon's fuse_lookup was returning the same file object for
different file names, which caused problems in the kernel fuse layer's dcache,
resulting in EBUSY errors if the same directory was opened twice under different
names differing only by case.

To fix this, the sdcard daemon will return different file objects for files or directories
that differ only by case. Now the squashing occurs only in the interaction between
the sdcard daemon and the underlying file system in /data/media, and sdcard maintains
the illusion for the kernel fuse layer that there are two separate files.

Example:  Suppose both /mnt/sdcard/foo.txt and /mnt/sdcard/FOO.TXT are opened.
Previously, the sdcard would squash this to a single node, and return the same
node to the kernel fuse implementation twice, and would open the underlying file
/data/media/foo.txt only once.   Now sdcard will create two separate nodes will open
/data/media/foo.txt twice, once for mnt/sdcard/foo.txt and again for /mnt/sdcard/FOO.TXT.

Change-Id: I70e36b7822142750d3eeeb75edd6464ec7c79f2a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-17 21:06:26 -08:00
Mike Lockwood
1bedb73f9f sdcard: Have the -f option fix user/group permissions as well as file name case
Change-Id: I280ded6ce79fb11752c89ebafa663d7ee29edebc
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-13 13:38:42 -05:00
Mike Lockwood
4f35e623a2 sdcard: Add command line options for lowercase file name squashing:
-l   squash all file names to lower case when creating new files
-f   rename existing files to make them lower case

Change-Id: I3245deb690228cf577bdc9bd4b0fcf0306ea3e16
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-12 17:29:02 -05:00
Mike Lockwood
51b3a2d77a sdcard: Force file names to lower case in order to provide case insensitivity
Change-Id: I2cdb12c7e296e1c28b66e32c7037dce060eecd67
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-12 12:55:05 -05:00
Kenny Root
90749774ed Use pread64/pwrite64 instead of pread/pwrite
>2GB files were failing strangely when pread was used instead of
pread64. Also writing to files should use pwrite64 in case they grow
over 2GB.

Bug: 3205336
Change-Id: I0c9619de35680093d7777ca132ce488eae502216
2011-01-11 16:05:10 -08:00
Paul Eastham
77085c570e Fix refcounting in the rename case.
Change-Id: I59dbac8c92bda450e6d89f7f180241fd4b5bbae6
2011-01-04 21:06:03 -08:00
Paul Eastham
11ccdb3be6 Properly reflect RENAME ops in FUSE internal state
In response to a RENAME, we actually need to rename and move the virtual
node.  To support this, filenames are now allocated separately, as reallocing
the whole node to accommodate a longer filename would break the direct
mapping of fhs and inodes to fuse pointers.

Change-Id: I71e5a965f875dedc5f58f9d182156734b29ca179
2010-10-14 11:04:26 -07:00
Paul Eastham
f43219e0b1 Partially implement SETATTR for sdcard/FUSE
Handle truncate cases within SETATTR so that truncate() and ftruncate() call
will work.

Change-Id: I5a9862dcaa6ca7b5e9115cb5d3bfed88787fa7ac
Signed-off-by: Paul Eastham <eastham@google.com>
2010-09-24 08:13:49 -07:00
Mike Lockwood
fc1a13bfdd sdcard: Add support for the O_TRUNC open() flag
BUG: 2935163

Change-Id: I9f76b24147b2f87ddb7869bb72baac03e86ef7e6
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-08-20 10:30:15 -04:00
Mike Lockwood
4553b08d75 sdcard: Implement statfs, stat time values and change mount point to /mnt/sdcard
Change-Id: Iac2c4ec47af7d47d76a82916866ad36782caf25c
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-08-16 14:16:13 -04:00
Brian Swetland
b14a2c6e34 fix up permissions
Change-Id: I93c828ebc755ad2a2055066c8af65dfde7dc7b2e
2010-08-12 18:22:23 -07:00
Brian Swetland
03ee9479a4 sdcard: a program to create a "virtual" /sdcard pointed at a path
sdcard is a program that uses FUSE to emulate FAT-on-sdcard style
directory permissions (all files are given fixed owner, group, and
permissions at creation, owner, group, and permissions are not
changeable, symlinks and hardlinks are not createable, etc.

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
gid are zero.

Change-Id: I9a5d2e5daaebeee632f8470172cbb77b7fa689f8
Signed-off-by: Brian Swetland <swetland@google.com>
2010-08-12 18:01:08 -07:00