Help with C code for detecting ext4 in VisParted (fork of GParted)
I'm having trouble detecting ext4 file systems in my fork of GParted called VisParted. It's the partitioning program for the Parted Magic distribution.
All I need to do is get it to detect the ext4 file system and full ext4 support in VisParted is done. The fix needs to be here around line 737: http://partedmagic-svn.cvsdude.com/p...Parted_Core.cc I'm not opposed to using external commands like blkid which detects ext4 flawlessly. I'm out of ideas and I'm even willing to pay to get this working. |
You have to read the superblock and look for features that are peculiar to ext4. The easiest way to do this is to do a bitwise and with ~EXT3_FEATURE_INCOMPAT_SUPP (you have to take into account endianness, or use the kernel macros which automatically account for it).
Or, you could use libblkid. |
This is how Bart detected reiser4:
char buf[512] ; ped_device_open( lp_device ); //reiser4 ped_geometry_read( & lp_partition ->geom, buf, 128, 1 ) ; ped_device_close( lp_device ); if ( Glib::ustring( buf ) == "ReIsEr4" ) return VisParted::FS_REISER4 ; This approach could work except parted thinks it's ext3 and therefore it returns "return VisParted::FS_EXT3". So it gets picked-up a few lines earlier as ext3. I can't find any obvious code that states it's ext4 like reiser4 does. I could use blkid, but I've been pulling my hair out trying to get blkid to execute the proper device. When I usually do external commands I don't have these issues because I call device from the predefined menus and use commands like: Utils::execute_command( "dumpe2fs -h " + partition .get_path() ); I can't get an external command like this to work mostly because I don't know exactly what's going on. Somebody with more experience could probably figure this out pretty easily. |
Quote:
Quote:
I haven’t deeply looked at the code, but you can use libblkid as follows: Code:
Index: src/VisParted_Core.cc |
Quote:
I'm a project manager more than a programmer and the project donations in part are supposed to go to paying programmers to "add to" / "fix" VisParted. Man, I wish I knew this stuff as well as you guys do. |
Quote:
Code:
char *path; |
Quote:
I tried "ped_partition_get_path(lp_partition)" and I couldn't get that to work either. Most likely because I wasn't doing it right. Probably the best solution would be to sit back and wait for parted to add the detection itself. I already have the ext3 code cloned for ext4 support and would work now if parted could detect ext4. Oh, well... |
All times are GMT -5. The time now is 07:30 PM. |