Revision: 5788 http://ipcop.svn.sourceforge.net/ipcop/?rev=5788&view=rev Author: dotzball Date: 2011-08-15 08:25:15 +0000 (Mon, 15 Aug 2011)
Log Message: ----------- Reduce disk size by 1MiB to reduce risk of partition errors caused by wrong disk size informations from /sys/block/DEVICE/size Modified Paths: -------------- ipcop/trunk/src/installer/partition.c Modified: ipcop/trunk/src/installer/partition.c =================================================================== --- ipcop/trunk/src/installer/partition.c 2011-08-15 06:35:21 UTC (rev 5787) +++ ipcop/trunk/src/installer/partition.c 2011-08-15 08:25:15 UTC (rev 5788) @@ -38,7 +38,7 @@ * partition2 /var/log * partition3 -- reserved, absolutely can't be used * - * In case of flash installation, /var/log will be /var/log_compressed with fixed size. + * In case of flash installation, /var/log will be /var/log_compressed with fixed size. * This to store the (regularly) compressed /var/log contents. * * $Id$ @@ -68,8 +68,8 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) -/* Make these module globals. - Since we are not multi-tasking, multi-threaded, multi-anything that is OK +/* Make these module globals. + Since we are not multi-tasking, multi-threaded, multi-anything that is OK and avoids passing pointers to pointers, addresses of pointers, etc. between functions. */ static int raid; @@ -103,7 +103,12 @@ snprintf(device, STRING_SIZE, "/dev/%s", dev); snprintf(device2, STRING_SIZE, "/dev/%s", dev2); - /* + /* + Reduce disk size by 1MiB to reduce risk of partition errors caused by wrong disk size informations from /sys/block/DEVICE/size + */ + disk_size -= 1; + + /* someday offer semi-manual partition here keep /, /var/log but allow user to set different sizes (> MINIMUM) or leave free space */ @@ -167,7 +172,7 @@ /* recalc log */ log_partition = disk_size - root_partition; - /* + /* We now have auto-partition data (in MiB) start: end: start_p root_p @@ -303,8 +308,8 @@ char *ptr; int percentage; - snprintf(command, STRING_SIZE, - "/sbin/mdadm --create /dev/md%d --homehost=ipcop --metadata=0.9 --level=1 --raid-devices=2 %s%d %s%d < /tmp/yes", + snprintf(command, STRING_SIZE, + "/sbin/mdadm --create /dev/md%d --homehost=ipcop --metadata=0.9 --level=1 --raid-devices=2 %s%d %s%d < /tmp/yes", i, device, partition_index[i]+1, device2, partition_index[i]+1); if (mysystem(command)) { newtPopWindow(); @@ -372,7 +377,7 @@ return FAILURE; } /* Need to create a temp. first, since /harddisk is not yet populated */ - if ((handletarget = fopen("/tmp/tmpfstab", "w")) == NULL) { + if ((handletarget = fopen("/tmp/tmpfstab", "w")) == NULL) { errorbox(ipcop_gettext("TR_UNABLE_TO_WRITE_ETC_FSTAB")); return FAILURE; } @@ -555,7 +560,7 @@ return FAILURE; } - /* We need to activate swap here + /* We need to activate swap here * depmod requires a lot of memory (~50-60 MB) which will fail on a 64 MB machine without swap */ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_MOUNTING_SWAP_PARTITION")); retcode = mysystem("swapon /harddisk/swapfile"); @@ -850,7 +855,7 @@ "chroot /harddisk /usr/sbin/eeprom boot-device=disk%d", devnum); } else { int devnum2 = device2[7] - 'a'; - snprintf(command, STRING_SIZE, + snprintf(command, STRING_SIZE, "chroot /harddisk /usr/sbin/eeprom boot-device=\"disk%d disk%d\"", devnum, devnum2); } mysystem(command); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn