Commit Graph

32 Commits

Author SHA1 Message Date
Damien George f7816188b7 extmod/vfs_fat: Fix calculation of total blocks in statvfs. 2017-03-29 12:53:35 +11:00
Damien George 12d0731b91 extmod/vfs_fat: Remove obsolete and unused str/len members. 2017-03-10 19:09:42 +11:00
Andrew Gatt 10dbf2383f extmod/vfs_fat.c: Use explicit include path for timeutils.h. 2017-01-30 23:10:16 +11:00
Damien George b697c89009 extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h.
vfs.h is for generic VFS declarations, and vfs_fat.h is for VfsFat
specific things.
2017-01-30 12:26:08 +11:00
Damien George 0bd61d23b9 extmod/vfs_fat: Remove MICROPY_FATFS_OO config option.
Everyone should now be using the new ooFatFs library.  The old one is no
longer supported and will be removed.
2017-01-30 12:26:07 +11:00
Damien George 8aa8a0a660 extmod/vfs_fat: Use SECSIZE macro to determine FatFs sector size. 2017-01-27 23:22:15 +11:00
Damien George fb3ae1784e extmod/vfs_fat: Rework to support new generic VFS sub-system.
The VfsFat object can now be mounted by the generic VFS sub-system.
2017-01-27 17:19:06 +11:00
Damien George 32a1138b9f extmod: Rename vfs_fat_file.h to vfs_fat.h.
And move declaration of mp_fat_vfs_type to this file.
2017-01-27 15:04:17 +11:00
Damien George f5f4cdae89 extmod/vfs_fat: Rework so it can optionally use OO version of FatFS.
If MICROPY_VFS_FAT is enabled by a port then the port must switch to using
MICROPY_FATFS_OO.  Otherwise a port can continue to use the FatFs code
without any changes.
2017-01-27 13:19:10 +11:00
Damien George b7df3e541a extmod/vfs_fat: Implement POSIX behaviour of rename, allow to overwrite.
If the destination of os.rename() exists then it will be overwritten if it
is a file.  This is the POSIX behaviour, which is also the CPython
behaviour, and so we follow suit.

See issue #2598 for discussion.
2016-12-02 15:06:09 +11:00
Alex March d02f3a57f4 extmod/vfs_fat: Add file and directory checks for remove and rmdir. 2016-10-11 16:03:52 +11:00
Damien George 620c4c32bf extmod/vfs_fat: Use mp_raise_OSError helper function. 2016-10-07 13:44:55 +11:00
Alex March dcf14c1b18 extmod/vfs_fat: Add fat_vfs_statvfs(), reused from stmhal. 2016-09-27 13:48:45 +10:00
Radomir Dopieralski d29ca28288 esp8266/modous: Add os.umount method to unmount a filesystem.
This is an object-oriented approach, where uos is only a proxy for the
methods on the vfs object.  Some internals had to be exposed (the STATIC
keyword removed) for this to work.

Fixes #2338.
2016-08-26 12:45:21 +10:00
Paul Sokolovsky 0a6f599cf2 extmod/vfs_fat: Implement rmdir() method.
Shares the code with remove() method due to the same underlying f_unlink()
FatFs operation.
2016-07-16 03:46:42 +03:00
Robert HH 23067a1422 esp8266: Use RTC to set date & time stamps for files.
The time stamp is taken from the RTC for all newly generated
or changed files. RTC must be maintained separately.
The dummy time stamp of Jan 1, 2000 is set in vfs.stat() for the
root directory, avoiding invalid time values.
2016-06-16 19:31:58 +03:00
Paul Sokolovsky 298c2ae2c7 extmod/vfs_fat: Mark anused "self" arg for fat_vfs_stat(). 2016-05-31 15:42:08 +03:00
Robert HH ee009d713a extmod/vfs_fat.c: Add vfs.stat().
The call to stat() returns a 10 element tuple consistent to the os.stat()
call. At the moment, the only relevant information returned are file
type and file size.
2016-05-31 13:03:12 +03:00
Paul Sokolovsky 480159ca8b extmod/vfs_fat: getcwd(): Use mp_obj_new_exception_arg1().
Copy-paste issue, with the original mistake in stmhal.
2016-05-29 20:04:53 +03:00
Paul Sokolovsky ee5e3f6527 extmod/vfs_fat: chdir(), getcwd() methods should accept VFS object (self). 2016-05-29 18:52:41 +03:00
Paul Sokolovsky cac6c9704e extmod/vfs_fat: Add getcwd() method.
Ported from stmhal.
2016-05-29 18:23:59 +03:00
Paul Sokolovsky f12146cbf6 extmod/vfs_fat: Add chdir() method.
Ported from stmhal.
2016-05-29 18:17:00 +03:00
Robert HH 7c004e794c extmod/vfs_fat*: Replace text error messages by POSIX error numbers.
These changes are in line with similar changes in other modules, and
with standard Python interface.
2016-05-27 23:57:01 +03:00
Damien George f9dc644017 extmod: When including extmod headers, prefix path with extmod/. 2016-05-20 12:46:20 +01:00
Paul Sokolovsky e0821830b0 extmod/vfs_fat: Add .rename() method. 2016-02-29 01:23:53 +02:00
Paul Sokolovsky bbe832a0b2 extmod/vfs_fat: Add .mkdir() method. 2016-02-29 00:03:20 +02:00
Paul Sokolovsky 6f469209e9 extmod/vfs_fat: Fix unused param warning/error. 2016-02-28 20:45:51 +02:00
Paul Sokolovsky 19749db7bf extmod/vfs_fat: Add .remove() method.
Based on stmhal implementation - rather small, so just duplicating.
2016-02-28 20:30:07 +02:00
Paul Sokolovsky cd6d189f48 extmod/vfs_fat: Move listdir() method from stmhal for reuse. 2016-02-28 17:17:24 +02:00
Paul Sokolovsky 6b0c88256b extmod/vfs_fat_file: Reusable FatFs module, move from stmhal/file. 2016-02-15 00:16:46 +02:00
Paul Sokolovsky 1bb15ca427 extmod/fsusermount,vfs_fat: Nanbox cleanness. 2016-02-14 19:15:22 +02:00
Paul Sokolovsky e9be6a378c extmod/vfs_fat: Object-oriented encapsulation of FatFs VFS.
This implements OO interface based on existing fsusermount code and with
minimal changes to it, to serve as a proof of concept of OO interface.

Examle of usage:

bdev = RAMFS(48)
uos.VfsFat.mkfs(bdev)
vfs = uos.VfsFat(bdev, "/ramdisk")
f = vfs.open("foo", "w")
f.write("hello!")
f.close()
2016-02-14 19:15:21 +02:00