helpers.cpp: simplify check_dir(); ported from martii

Origin commit data
------------------
Branch: ni/coolstream
Commit: 44cddc05d9
Author: vanhofen <vanhofen@gmx.de>
Date: 2013-11-22 (Fri, 22 Nov 2013)

Origin message was:
------------------
- helpers.cpp: simplify check_dir(); ported from martii

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2013-11-22 12:10:26 +01:00
parent a6137cadce
commit 2b6a6c4898

View File

@@ -212,30 +212,15 @@ int check_dir(const char * dir, bool allow_tmp)
int ret = -1;
struct statfs s;
if (::statfs(dir, &s) == 0) {
switch (s.f_type) /* f_type is long */
{
case 0xEF53L: /*EXT2 & EXT3*/
case 0x6969L: /*NFS*/
case 0xFF534D42L: /*CIFS*/
case 0x517BL: /*SMB*/
case 0x52654973L: /*REISERFS*/
case 0x65735546L: /*fuse for ntfs*/
case 0x58465342L: /*xfs*/
case 0x4d44L: /*msdos*/
case 0x0187: /* AUTOFS_SUPER_MAGIC */
#if 0
case 0x72b6L: /*jffs2*/
#endif
ret = 0;//ok
break;
case 0x858458f6L: /*ramfs*/
case 0x1021994: /*TMPFS_MAGIC*/
switch (s.f_type) {
case 0x858458f6L: // ramfs
case 0x1021994L: // tmpfs
if(allow_tmp)
ret = 0;//ok
case 0x72b6L: // jffs2
break;
default:
fprintf(stderr, "%s Unknown filesystem type: 0x%x\n", dir, (int)s.f_type);
break; // error
ret = 0; // ok
}
}
return ret;