FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Wed Nov 25, 2020 10:23



Post new topic Reply to topic  [ 5 posts ] 
UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared 
Author Message

Joined: Wed Mar 05, 2014 00:40
Posts: 2
Post UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared
I am trying to compile ultradefrag for use on ubuntu to defrag my ntfs volumes. I have ntfs-3g-dev and ntfs-3g packages installed. But when I run a make in the ultradefrag src folder I get the following error:

cd wincalls; make wincalls.a
make[1]: Entering directory `/home/myusername/Desktop/ultradefrag-5.0.0AB.7/src/wincalls'
gcc -DLXGC=1 -O2 -I/usr/include/ntfs-3g -I/usr/include -I../include -I../dll/zenwinx -c ntfs-3g.c
ntfs-3g.c: In function ‘ntfs_open’:
ntfs-3g.c:147:27: error: ‘MS_RDONLY’ undeclared (first use in this function)
vol = ntfs_mount(device,MS_RDONLY);
^
ntfs-3g.c:147:27: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [ntfs-3g.o] Error 1
make[1]: Leaving directory `/home/myusername/Desktop/ultradefrag-5.0.0AB.7/src/wincalls'
make: *** [wincalls.a] Error 2

Why am I getting this error and how can I work around it?

Thanks
Brad


Wed Mar 05, 2014 03:27
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared
Hi,

Quote:
ntfs-3g.c: In function ‘ntfs_open’:
ntfs-3g.c:147:27: error: ‘MS_RDONLY’ undeclared (first use in this function)
vol = ntfs_mount(device,MS_RDONLY);

The MS_* values have been renamed as NTFS_MNT_*, so you have to change MS_RDONLY to NTFS_MNT_RDONLY. You may have to change other similar names, please report back the changes you may have to do.

Note in http://jp-andre.pagesperso-orange.fr/tools.zip there is a compiled version of ultradefrag which is usable with most Linux releases.

Regards

Jean-Pierre


Wed Mar 05, 2014 09:27
Profile

Joined: Wed Mar 05, 2014 00:40
Posts: 2
Post Re: UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared
Thanks for the reply. Given that I'm a bit of a linux newbie I generally prefer the pre-build binary option to modifying source files and repeatedly attempting to re-compile. The good news is that after installing some libraries I've been able to get the prebuilt binaries of udefrag to work on my ubuntu system. The bad news is I can't seem to work out how to properly defrag my NTFS partition.

Here's what sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL shows:

NAME FSTYPE SIZE MOUNTPOINT LABEL
sda 111.8G
├─sda1 ext4 87.9G /
├─sda2 1K
└─sda5 23.9G
└─cryptswap1 (dm-4) swap 23.9G [SWAP]
sdb isw_raid_member 931.5G
└─isw_deddgdcgbi_Volume0 (dm-1) 2.7T
├─isw_deddgdcgbi_Volume0p1 (dm-2) 128M
└─isw_deddgdcgbi_Volume0p2 (dm-3) ntfs 2.7T /media/brad/60BACBAFBACB8050
sdc isw_raid_member 931.5G
└─isw_deddgdcgbi_Volume0 (dm-1) 2.7T
├─isw_deddgdcgbi_Volume0p1 (dm-2) 128M
└─isw_deddgdcgbi_Volume0p2 (dm-3) ntfs 2.7T /media/brad/60BACBAFBACB8050
sdd isw_raid_member 931.5G
└─isw_deddgdcgbi_Volume0 (dm-1) 2.7T
├─isw_deddgdcgbi_Volume0p1 (dm-2) 128M
└─isw_deddgdcgbi_Volume0p2 (dm-3) ntfs 2.7T /media/brad/60BACBAFBACB8050
sde isw_raid_member 931.5G
isw_deddgdcgbi_Volume0_err_target (dm-0) 931.5G
└─isw_deddgdcgbi_Volume0 (dm-1) 2.7T
├─isw_deddgdcgbi_Volume0p1 (dm-2) 128M
└─isw_deddgdcgbi_Volume0p2 (dm-3) ntfs 2.7T /media/brad/60BACBAFBACB8050

I've tried different variations but none seem to work:

bradbaker@localhost:~/Desktop$ ./udefrag -a /dev/isw_deddgdcgbi_Volume0p2
UltraDefrag 5.0.0AB.7, Copyright (c) UltraDefrag Development Team, 2007-2011.
UltraDefrag comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.

Could not open /dev/isw_deddgdcgbi_Volume0p2


bradbaker@localhost:~/Desktop$ ./udefrag -a /dev/isw_deddgdcgbi_Volume0
UltraDefrag 5.0.0AB.7, Copyright (c) UltraDefrag Development Team, 2007-2011.
UltraDefrag comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.

Could not open /dev/isw_deddgdcgbi_Volume0


bradbaker@localhost:~/Desktop$ ./udefrag -a /media/bradbaker/60BACBAFBACB8050
UltraDefrag 5.0.0AB.7, Copyright (c) UltraDefrag Development Team, 2007-2011.
UltraDefrag comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.

Could not read the boot sector of /media/bradbaker/60BACBAFBACB8050

I'm sure I'm doing something stupid. :) Could you please help me understand what device/mount point I'm supposed to feed to udefrag?

By the way sdb, sdc, sdd, and sde are part of a hardware raid5 array (in case thats not evident) and the raid array is running NTFS.

Thanks
Brad


Wed Mar 05, 2014 13:14
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared
Hi,

Quote:
bradbaker@localhost:~/Desktop$ ./udefrag -a /dev/isw_deddgdcgbi_Volume0p2
UltraDefrag 5.0.0AB.7, Copyright (c) UltraDefrag Development Team, 2007-2011.
UltraDefrag comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.

Could not open /dev/isw_deddgdcgbi_Volume0p2

You can only defrag a volume when running as root. With Ubuntu, you just have to prefix the command by "sudo"
Quote:
Could you please help me understand what device/mount point I'm supposed to feed to udefrag?

You are supposed to mention a device and not a mount point, and the device must be unmounted. To determine the device name while the device is mounted, you can execute the command "mount" with no argument. You can also use "df" designating any file from the mounted volume.
Quote:
By the way sdb, sdc, sdd, and sde are part of a hardware raid5 array (in case thats not evident) and the raid array is running NTFS.

This is a slippery road (never tested myself, I have no such configuration). You should first try a dummy test (use option -n). Also be sure you have a reliable backup.
Code:
# this is a safe way to make sure the designated (unmounted) device is correct
sudo ntfsinfo -m /dev/something
# this will just show the current state
sudo ./udefrag -anm /dev/something
# this will simulate a defragmentation
sudo ./udefrag -onm /dev/something
# real defragmentation, only after having made a full backup
sudo ./udefrag -om /dev/something


Regards

Jean-Pierre


Wed Mar 05, 2014 13:48
Profile

Joined: Tue Mar 25, 2014 06:08
Posts: 1
Post Re: UltraDefrag Port on Linux - error: ‘MS_RDONLY’ undeclared
I was able to trace back your steps and compile the code.

I had to modify a lot of the makefile to port it back to an i386 machine.

I have included my patch so you can see what files I made changes in.

So far the program seems to be running fine. I am planning on a full degrament of a NTFS drive tonight.

Code:
diff -rauB ultradefrag-5.0.0AB.7/doc/spec/ntfs_layout.h.htm ultradefrag-5.0.0AB.7n/doc/spec/ntfs_layout.h.htm
--- ultradefrag-5.0.0AB.7/doc/spec/ntfs_layout.h.htm   2010-10-20 22:51:32.000000000 -0700
+++ ultradefrag-5.0.0AB.7n/doc/spec/ntfs_layout.h.htm   2014-03-24 20:27:02.819663803 -0700
@@ -1375,28 +1375,28 @@
  * The predefined ACE types (8-bit, see below).
  */</span>
<span class="enscript-type">enum</span> {
-   ACCESS_MIN_MS_ACE_TYPE      = 0,
+   ACCESS_MIN_NTFS_MNT_ACE_TYPE      = 0,
   ACCESS_ALLOWED_ACE_TYPE      = 0,
   ACCESS_DENIED_ACE_TYPE      = 1,
   SYSTEM_AUDIT_ACE_TYPE      = 2,
   SYSTEM_ALARM_ACE_TYPE      = 3, <span class="enscript-comment">/* Not implemented as of Win2k. */</span>
-   ACCESS_MAX_MS_V2_ACE_TYPE   = 3,
+   ACCESS_MAX_NTFS_MNT_V2_ACE_TYPE   = 3,

   ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4,
-   ACCESS_MAX_MS_V3_ACE_TYPE   = 4,
+   ACCESS_MAX_NTFS_MNT_V3_ACE_TYPE   = 4,

   <span class="enscript-comment">/* The following are Win2k only. */</span>
-   ACCESS_MIN_MS_OBJECT_ACE_TYPE   = 5,
+   ACCESS_MIN_NTFS_MNT_OBJECT_ACE_TYPE   = 5,
   ACCESS_ALLOWED_OBJECT_ACE_TYPE   = 5,
   ACCESS_DENIED_OBJECT_ACE_TYPE   = 6,
   SYSTEM_AUDIT_OBJECT_ACE_TYPE   = 7,
   SYSTEM_ALARM_OBJECT_ACE_TYPE   = 8,
-   ACCESS_MAX_MS_OBJECT_ACE_TYPE   = 8,
+   ACCESS_MAX_NTFS_MNT_OBJECT_ACE_TYPE   = 8,

-   ACCESS_MAX_MS_V4_ACE_TYPE   = 8,
+   ACCESS_MAX_NTFS_MNT_V4_ACE_TYPE   = 8,

   <span class="enscript-comment">/* This one is for WinNT/2k. */</span>
-   ACCESS_MAX_MS_ACE_TYPE      = 8,
+   ACCESS_MAX_NTFS_MNT_ACE_TYPE      = 8,
} __attribute__((__packed__));

<span class="enscript-type">typedef</span> u8 ACE_TYPES;
Only in ultradefrag-5.0.0AB.7n/src/console: console.a
Only in ultradefrag-5.0.0AB.7n/src/console: defrag.o
Only in ultradefrag-5.0.0AB.7n/src/console: map.o
Only in ultradefrag-5.0.0AB.7n/src/console: options.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: analyze.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: defrag.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: map.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: move.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: optimize.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: options.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: reports.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: search.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: tasks.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: udefrag.a
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: udefrag.o
Only in ultradefrag-5.0.0AB.7n/src/dll/udefrag: volume.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: dbg.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: env.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: event.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: file.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: ftw_ntfs.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: ftw.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: ldr.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: list.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: lock.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: mem.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: misc.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: path.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: prb.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: string.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: thread.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: time.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: volume.o
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: zenwinx.a
Only in ultradefrag-5.0.0AB.7n/src/dll/zenwinx: zenwinx.o
Only in ultradefrag-5.0.0AB.7n/src: .l
diff -rauB ultradefrag-5.0.0AB.7/src/Makefile ultradefrag-5.0.0AB.7n/src/Makefile
--- ultradefrag-5.0.0AB.7/src/Makefile   2011-11-24 11:57:56.000000000 -0800
+++ ultradefrag-5.0.0AB.7n/src/Makefile   2014-03-24 20:49:43.927653764 -0700
@@ -20,12 +20,12 @@
GCC=gcc
LD=ld
AR=ar
-INCL=-I/usr/sparc-include -Iinclude
+INCL=-I/usr/include -Iinclude
COPT=-DPPGC=1 -O2
GCCOPT=-DPPGC=1 -O2
-LIB1=/usr/lib64
-LIB2=/usr/lib/gcc/x86_64-redhat-linux/4.6.0
-NTFSLIB=/lib64/libntfs-3g.so.*.0.0
+LIB1=/usr/lib/i386-linux-gnu
+LIB2=/usr/lib/gcc/i686-linux-gnu/4.8.1
+NTFSLIB=/lib/i386-linux-gnu/libntfs-3g.so.*.0.0

A=console.a udefrag.a zenwinx.a wincalls.a

@@ -62,7 +62,7 @@
   cd wincalls; make clean

udefrag : $(A)
-   $(LD) -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o udefrag -M \
+   $(LD) -dynamic-linker /lib/ld-linux.so.2 -o udefrag -M \
      $(LIB1)/crt1.o $(LIB1)/crti.o $(LIB2)/crtbegin.o \
      console/console.a dll/udefrag/udefrag.a dll/zenwinx/zenwinx.a \
      wincalls/wincalls.a $(NTFSLIB) \
Only in ultradefrag-5.0.0AB.7n/src: Makefile~
Only in ultradefrag-5.0.0AB.7n/src: .map
Only in ultradefrag-5.0.0AB.7n/src: .s
Only in ultradefrag-5.0.0AB.7n/src: udefrag
Only in ultradefrag-5.0.0AB.7n/src: udefrag.map
Only in ultradefrag-5.0.0AB.7n/src/wincalls: curses.o
diff -rauB ultradefrag-5.0.0AB.7/src/wincalls/ntfs-3g.c ultradefrag-5.0.0AB.7n/src/wincalls/ntfs-3g.c
--- ultradefrag-5.0.0AB.7/src/wincalls/ntfs-3g.c   2011-11-26 14:56:38.000000000 -0800
+++ ultradefrag-5.0.0AB.7n/src/wincalls/ntfs-3g.c   2014-03-24 20:27:08.391663762 -0700
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <sys/stat.h>
+#include <sys/mount.h>
#include <errno.h>

#include "layout.h"
@@ -144,7 +145,7 @@
   ntfs_volume *vol;

   if (do_nothing)
-      vol = ntfs_mount(device,MS_RDONLY);
+      vol = ntfs_mount(device,NTFS_MNT_RDONLY);
   else
      vol = ntfs_mount(device,0);
#ifdef NVolSetNoFixupWarn
Only in ultradefrag-5.0.0AB.7n/src/wincalls: ntfs-3g.c~
Only in ultradefrag-5.0.0AB.7n/src/wincalls: ntfs-3g.o
Only in ultradefrag-5.0.0AB.7n/src/wincalls: wincalls.a
Only in ultradefrag-5.0.0AB.7n/src/wincalls: wincalls.o


Tue Mar 25, 2014 06:16
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.