Recommended Posts

But if the drive is blank ^ then it won't detect an EFI table because the disk won't have one :/.

hmm, good point. I'm not too sure on that one. I found a small tidbit here:

Access to UEFI Runtime services is provided by "efivars" kernel module which is enabled through the CONFIG_EFI_VAR=m kernel config option. This module once loaded exposes the variables under the directory /sys/firmware/efi/vars. One way to check whether the system has booted in UEFI boot mode is to load the "efivars" kernel module and check for the existence of /sys/firmware/efi/vars directory with contents similar to :

So in theory, one could just do:

modprobe efivars && ls /sys/firmware/efi/vars

I've rewritten most of the code I was using to play around with reading partition tables so that it's more structured. The figures seem to be coming out right now, on my system at least. It's still somewhat buggy and I haven't tested it thoroughly, but if you want to play around with it, I've attached the code.

post-429662-0-72300800-1350242493_thumb.

disks.zip

The program needs to be run as a super user ( sudo ) if you wish to see the 'used' statistic of unmounted file systems. It temporarily mounts them if they aren't already mounted and registered in /etc/mtab.

Some outstanding problems:

1. The gtk widget I created for visualising the disk layout isn't perfect. Specifically, I need to fix the way it allocates space for each volume. Currently it runs out of space quickly. Perhaps I need to loop through the volumes and adjust the spacing before I do the actual rendering, but I'll try and fix that later.

2. I had a real hassle trying to programmatically mount the block device file systems so I could get statistics via statvfs (). Specifically, the mount () function requires file system specific esoteric arguments that I just couldn't get to work ( as of yet ), so for now I'm just calling out to the shell's mount command. It's not ideal, but it works.

Again, there are bugs, and the code is messy in parts. To compile you'll need your distro's gtk3 dev package. On arch, it's just extra/gtk3. On Ubuntu/Mint/others it's probably libgtk-3-dev or something like similar. Obviously, you'll need gcc/pkg-config installed as normal.

When I have more time, I'll fix the outstanding bugs.

That looks beautiful! Nice work! :D

Only problem with it is that it needs GTK3, and PHP-GTK is GTK2 only :(

EDIT: Ah you've done it as C... Guess we could run that seperately somehow and output a command list the installer could read?

Edited by n_K

That looks beautiful! Nice work! :D

Only problem with it is that it needs GTK3, and PHP-GTK is GTK2 only :(

Thanks. It's a start at least.

As far as gtk goes, it's easy enough to convert it to gtk2. The only major changes needed to convert it revolve around:

PRIVATE void
disk_layout_class_init ( DiskLayoutClass *in )
{
	GtkWidgetClass *base;

	base = GTK_WIDGET_CLASS ( in );
	base->draw  = disk_layout_draw;

	g_type_class_add_private ( in, sizeof ( disk_info ) );
}

Just change the 'base->draw' override to 'base->expose_event'. There are a few other minor changes like retrieving the widget's allocation, and container v/h boxes.

EDIT: Ah you've done it as C... Guess we could run that seperately somehow and output a command list the installer could read?

The code is quite modular. You could stick some of it ( block_dev.c, partition.c, fs.c ) into a shared library and call it from php perhaps. Or as you say, run it separately. The code I have here already prints the tables to stdout, so I suppose you could redirect that or parse it in some way.

The widget could easily be implemented in php I would think.

Edit: The same information can probably be obtained from /proc/partitions and /sys/block if you prefer the directory iteration / parsing static text files route. I opted for reading the partition tables directly from the block devices just to see if I could do it ;). I get the list of block devices from /sys/block myself.

I've fixed the widget problem (mostly). As I thought, it was as simple as reserving space for each volume:

post-429662-0-84184100-1350303874.png

PRIVATE int
disk_layout_calc_reserved ( PartitionTable * t )
{
	Partition *p;
	int	   res = 0;

	p = NULL;
	while ( NULL != ( p = LIST_ITER ( t, p ) ) )
		res += VOLUME_LINE_WIDTH + VOLUME_SPACING;

	res += VOLUME_SPACING;
	return res;	
} 
...
PRIVATE gboolean
disk_layout_draw ( GtkWidget *layout, cairo_t *cr )
...
geometry.width -= disk_layout_calc_reserved ( info->table ); 

There might be an easier or better way of doing it without pre-calculating space to reserve, but I haven't thought of one yet, so this will do for now.

  • Like 3
  • 2 weeks later...
  • 2 weeks later...

OK so I just quickly added the PHP-GD code to the installer code (after compiling php-gd twice!) and made it change the first image to see if it'd work. It did! So then I got it working via a GDKPixBuf using a GD image instead of having to save the file at all, so it's pretty nifty!

look in to the https://gitorious.org/chakra/tribe it the Chakra installer witch is a arch based distro witch you might be able to make use of

b

im just saying use the installer code and use gnome if you want

No, it's been discussed and it'd be pointless, might as well just use their distro if that's all we were doing. And having GTK3 and QT on an installer ISO would make it massive for no real reason and confuse people.

Installer's still at the same progress as it was, don't really have the time to work on it much now plus the update has borked this arch OS so I can't startx to run things on the VM remotely for testing so until arch bucks up and I get more free time it's completely stale.

Yeah you're missing the point, why just stick that on arch, make an ISO and distribute it? There's nothing to be learnt by doing that, anyone can do it. Making a GUI etc. is all experience and gets you up to scratch with the base of the OS.

  • 9 months later...
This topic is now closed to further replies.
  • Posts

    • We need a game update frequency setting. * Right now your recent games will be auto updated overnight, and your unrecent games won't be updated. The bifurcation of recent and unrecent is fine, but we should be able to control the update frequency for both, with any of the following options: 1. Don't auto update 2. Auto update weekly 3. Auto update overnight 3. Auto update immediately (push) i.e. When I'm playing a lot, I want my recently played games to have push updates, so if a dev releases an update at 4pm, it's already downloaded on my Xbox by the time I get home. The current overnight cadence leaves a lot of wasted time waiting for updates on slow connections. My infrequently played games in ok with deferring to overnight, or maybe weekly, but let the users control their frequency. Basing it on data and last played sounds smart but ignores the human reality that often when I'm busiest and have the least time for games is when it sucks the most to come home and find a huge update list waiting for you.
    • Genocide is intent to exterminate and both the Israeli government AND its people openly declare, even boast about their intent to exterminate Arabs. This society of sick psychopaths has even made songs about it. Zionist means believing Israel should exist as an religious ethno-state where only Jews have rights and everyone else is second class citizen. As for the blood libel thing, we already know zionists get off on killing children. We also know Israel is a safe heaven for all the pedophiles and rapists of the world. Honestly, after what we saw in the Epstein files, I wouldn't put anything past this depraved death cult. Of course all atrocities committed by tHe wOrLds mOsT mOrAl aRmY are always "unproven or taken out of context". Unfortunately for them, their soldiers are dumb enough to leave a trail of their war crimes all over social media. Then again, when you live in a society that's obsessed with death and destruction, posting videos of yourself in the act of ransacking homes and desecrating religious monuments earns you brownie points I guess. Israel is the only society in the world where people come out on the roads for the right to **** prisoners. Also claiming that the BBC said this and AP said that without so much as a link has gotten me curious. Are all zionists this dumb? I really hope you aren't getting paid for this because this is some low effort propaganda.
    • Microsoft is bringing big performance improvements to OneDrive on Mac by Taras Buria Microsoft has announced a major update for the OneDrive client on macOS. Today, the company released version 26.098, promising significantly faster sync, optimized CPU usage, a smaller memory footprint, and better energy efficiency. In a newly published blog post, Microsoft acknowledged that changes implemented in OneDrive for Mac in 2022 brought some unwanted side effects. Due to architectural changes and the need to keep the OneDrive sync engine unchanged, Microsoft created a hidden cache folder. With time, it would cause reliability and performance issues for customers. Now, Microsoft is ditching the old engine for native sync, delivering a faster, more reliable experience. As a result of this change, OneDrive for Mac now integrates more deeply into the operating system, offers about two times faster sync performance, and uses fewer system resources. While the hidden folder still exists, the app only uses it to store files that have not been uploaded yet, link file types, and macOS-related packages. In total, even when holding hundreds of files, the temporary folder does not take more than a couple of megabytes on the drive. Besides optimizations, the new sync engine enables external drive support, allowing you to keep your OneDrive folder on a removable drive (it should meet all the requirements). Microsoft is now rolling out the updated OneDrive client for Microsoft 365 Insiders. To check if your Mac has the new sync engine, go to the About tab and check the app version. If it ends with something like 26H, you are on the new engine. If not, you are on the old one. Microsoft says it will take a few weeks to complete the rollout to Insiders, but it won't say when to expect the update in the stable channel. Big performance updates for OneDrive on Mac came right after Microsoft confirmed it would soon kill document editing in Office 2019 for Mac due to expiring certificates. This change will force users to look for alternatives or switch to Microsoft 365.
    • Sorry but that makes no sense. What does using the same laptop have to do with anything? 
  • Recent Achievements

    • Week One Done
      StaticMatrix earned a badge
      Week One Done
    • Rookie
      lamborghiniv10 went up a rank
      Rookie
    • One Month Later
      pinnclepd earned a badge
      One Month Later
    • First Post
      X-No-file earned a badge
      First Post
    • One Month Later
      johnjacobb40 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      516
    2. 2
      PsYcHoKiLLa
      211
    3. 3
      +Edouard
      147
    4. 4
      Steven P.
      92
    5. 5
      ATLien_0
      82
  • Tell a friend

    Love Neowin? Tell a friend!