UFFS flags definition for open()

43 views
Skip to first unread message

Sergei Sharonov

unread,
Jul 15, 2015, 4:10:20 PM7/15/15
to uf...@googlegroups.com
Hello,
I am in the process of hooking uffs into newlib IO.

Is there any reason why some flags passed to open() have different definitions in (arm) gcc headers and uffs headers? For example:
UO_CREATE is 0x0100 while O_CREAT is 0x0200
UO_TRUNC is 0x0200 while O_TRUNC is 0x0400
UO_EXCL is 0x0400 while O_EXCL is 0x800
etc.

Can I safely redefined uffs.h defs to match _default_fcntl.h from my toolchain? Or do I need to write wrappers to translate flags?

Thanks,
Sergei

Ricky Zheng

unread,
Jul 15, 2015, 5:36:12 PM7/15/15
to uf...@googlegroups.com
Yes, it’s safe to redefine these flags.
- Ricky

--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uffs+uns...@googlegroups.com.
To post to this group, send email to uf...@googlegroups.com.
Visit this group at http://groups.google.com/group/uffs.
For more options, visit https://groups.google.com/d/optout.

Sergei Sharonov

unread,
Jul 15, 2015, 7:35:55 PM7/15/15
to uf...@googlegroups.com
On Wednesday, July 15, 2015 at 4:36:12 PM UTC-5, Ricky wrote:
Yes, it’s safe to redefine these flags.
Ricky, thanks for the prompt reply. I went ahead and made flag defs compliant with my arm gcc tool chain. Necessary changes are all in uffs.h and affect open() flags and lseek() flags:
#include <fcntl.h>
...
#define UO_RDONLY O_RDONLY /** read only */
#define UO_WRONLY O_WRONLY /** write only */
#define UO_RDWR O_RDWR /** read and write */
#define UO_APPEND O_APPEND /** append */
#define UO_BINARY 0x10000 /** no used in uffs */
#define UO_CREATE O_CREAT
#define UO_TRUNC O_TRUNC
#define UO_EXCL O_EXCL
#define UO_NOECC 0x100000 /** skip ECC when reading file data from media */
#define UO_DIR 0x200000 /** open a directory */
...
#define _SEEK_CUR SEEK_CUR /** seek from current position */
#define _SEEK_SET SEEK_SET /** seek from beginning of file */
#define _SEEK_END SEEK_END /** seek from end of file */

Error (errno) defs are also non-compliant too but I did not get a chance to fix these yet.
Regards,
Sergei


Reply all
Reply to author
Forward
0 new messages