Author: mladen.turk(a)jboss.com
Date: 2007-09-05 11:19:36 -0400 (Wed, 05 Sep 2007)
New Revision: 973
Modified:
trunk/sight/native/os/linux/volume.c
Log:
Linux drive types
Modified: trunk/sight/native/os/linux/volume.c
===================================================================
--- trunk/sight/native/os/linux/volume.c 2007-09-05 10:08:21 UTC (rev 972)
+++ trunk/sight/native/os/linux/volume.c 2007-09-05 15:19:36 UTC (rev 973)
@@ -205,9 +205,10 @@
return;
if (getmntent_r(e->fp, &ent, buf, SIGHT_MBUFFER_LEN)) {
int flags = 0;
+ int dtype = sight_get_fs_type(ent.mnt_type);
SET_IFIELD_S(0000, thiz, ent.mnt_fsname);
SET_IFIELD_S(0002, thiz, ent.mnt_dir);
- CALL_METHOD1(0000, thiz, sight_get_fs_type(ent.mnt_type));
+ CALL_METHOD1(0000, thiz, dtype);
if (!statvfs(ent.mnt_dir, &sv)) {
SET_IFIELD_I(0004, thiz, sv.f_bsize);
@@ -217,12 +218,31 @@
}
else
SET_IFIELD_I(0003, thiz, -1);
- if (strstr(ent.mnt_opts, "ro"))
+ if (hasmntopt(&ent, MNTOPT_RW))
+ flags |= SIGHT_READ_WRITE_VOLUME;
+ if (hasmntopt(&ent, MNTOPT_RO))
flags |= SIGHT_READ_ONLY_VOLUME;
- if (strstr(ent.mnt_opts, "rw"))
- flags |= SIGHT_READ_WRITE_VOLUME;
-
- CALL_METHOD1(0001, thiz, flags);
+ if (hasmntopt(&ent, MNTOPT_SUID))
+ flags |= SIGHT_SUID_VOLUME;
+ CALL_METHOD1(0001, thiz, flags);
+ switch (dtype) {
+ case SIGHT_FS_UNKNOWN:
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_UNKNOWN);
+ break;
+ case SIGHT_FS_ISO9660:
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_CDROM);
+ break;
+ case SIGHT_FS_DEV:
+ case SIGHT_FS_PROC:
+ case SIGHT_FS_SYSFS:
+ case SIGHT_FS_TMPFS:
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_RAMDISK);
+ break;
+ default:
+ CALL_METHOD1(0002, thiz, SIGHT_DRIVE_FIXED);
+ break;
+ }
+
}
}
Show replies by date