Bug 144852 - [patch] sysutils/ntfsprogs - improvements to mkntfs
Summary: [patch] sysutils/ntfsprogs - improvements to mkntfs
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Max Brazhnikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-18 11:10 UTC by Samuel Martín Moro
Modified: 2011-03-17 16:30 UTC (History)
0 users

See Also:


Attachments
file.txt (5.01 KB, text/plain)
2010-03-18 11:10 UTC, Samuel Martín Moro
no flags Details
patch-libntfs-unix_io_2.c (1.56 KB, text/x-csrc; charset=US-ASCII)
2010-03-23 16:27 UTC, Samuel Martín Moro
no flags Details
patch-libntfs-unistr.c (6.93 KB, text/x-csrc; charset=US-ASCII)
2010-03-24 16:03 UTC, Samuel Martín Moro
no flags Details
patch-include-ntfs-list.h (318 bytes, text/x-chdr; charset=US-ASCII)
2010-03-24 16:03 UTC, Samuel Martín Moro
no flags Details
patches (13.88 KB, application/octet-stream)
2010-03-26 16:26 UTC, Samuel Martín Moro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Martín Moro 2010-03-18 11:10:04 UTC
mkntfs do not work, whatever FreeBSD version.

badly ported from Linux, it wants block devices, and infinite loop when
forcing on character device (if using libublio).

also, the libntfs uses bad defines to get disk geometry.

Fix: I made these two patches (for libntfs, and mkntfs)

Also:
with the patch mkntfs, I correct the infinite loop using libublio.
The problem is that ublio reads out of disk, because of UBLIO_BLOCK_SIZE defined to 262144. When reading on a entire drive, there's no problem, but when working on parts, ublio returns a negative value, not handled by mkntfs.
but, my patch only avoid the infinite loop. the problem is still that mkntfs failed writing the end boot sector. user would have to chkdsk under windows to repair its partition.
I think a way to avoid that may be, for example, UBLIO_BLOCK_SIZE=`expr 63 '*' 255` mkntfs $dev.
Anyway, without libublio support, the partition is just fine.

There's still a thing I didn't fixed: when chkdsk on 'correct' partition, it says that the $UpCase file is invalid.
Indeed, a few differences.
I'll make an other patch to get rid of it (it's at my office, I don't work every day)


Patch attached with submission follows:
How-To-Repeat: mkntfs /dev/ad0s1
> not block device
mkntfs /dev/ad0s1
> infinite loop
also, warning about bad geometry (and using pointless default values)
Comment 1 Max Brazhnikov freebsd_committer freebsd_triage 2010-03-22 19:31:40 UTC
Responsible Changed
From-To: freebsd-ports-bugs->makc

I'll take it.
Comment 2 Samuel Martín Moro 2010-03-23 14:22:10 UTC
Hi

I just ran some tests, this patch seems to correct ntfsresize problems also.

I still didn't have time to look at the $UpCase problem.
ntfsprogs-2.0.0 is supposed to generate the Vista version of the $UpCase
file.
But I've got 3 different versions of this file (generated by Vista, XP, and
ntfsprogs-2.0.0)
Maybe the easier way to fix it would be to use the ntfsprogs-1 version of
that file (also different, I didn't test it, but I assume it have been
working some day)
Whatever, I'll take time to look at it.

The problem I'm trying to fix now is the libublio support.
I think the solution may looks like that:
--- libntfs/unix_io.c   2010-03-23 15:04:46.000000000 +0100
+++ libntfs/unix_io.c   2010-03-23 15:06:57.000000000 +0100
@@ -183,6 +183,7 @@
 #if USE_UBLIO
        struct ublio_param up;
        int use_ublio = 0;
+       u_int secpt = 0;
        char *xenv, *xgarbage;
 #endif

@@ -220,7 +221,15 @@
        if ((xenv = getenv("UBLIO_BLOCKSIZE")))
                up.up_blocksize = strtoul(xenv, &xgarbage, 10);
        if (!xenv || *xgarbage != '\0')
+       {
+#ifdef DIOCGFWSECTORS
+           if (ioctl(ufh->fd, DIOCGFWSECTORS, &secpt) == 0)
+               up.up_blocksize = secpt * 5 * 512;
+           else
+#endif
                up.up_blocksize = UBLIO_DEFAULT_BLOCKSIZE;
+       }
+fprintf(stdout, "tada: sec/track=%u; blksize=%u;\n", secpt,
up.up_blocksize);
        if ((xenv = getenv("UBLIO_ITEMS")))
                up.up_items = strtoul(xenv, &xgarbage, 10);
        if (!xenv || *xgarbage != '\0')

I don't understand why, but it's still not working.
Whatever, I'll forward you the correct patch, when I'll get it.


Cheers,

Samuel Martín Moro
{EPITECH.} tek4
CamTrace S.A.S
Comment 3 Samuel Martín Moro 2010-03-26 17:11:16 UTC
Sorry for the previous mails.
It seems that the previous quoted mails (or too long posts) are not
correctly handled by the PR site.
Whatever, the previous post provide the cat of my five patches.

for the record:
-ntfsresize is now working
-mkntfs is now working, with and without libublio, on usb sticks or drives
-$UpCase file as XP generates it
-less warnings about redefined macros

also:
it seems I was compairing the $UpCase file generated by ntfsprogs2
(Vista-like) with a Windows 7's one.
So, maybe the original ntfsprogs2 $UpCase file was correct.
(yep, pebkac, but since XP, I stoped using winwin)

But, when one run chkdsk on a ntfs filesystem, if we used vista or 7 to
generate the checked partition, it would fail on older windows versions, and
it would rewrite the $UpCase file to match current Window's version.
So, I still think it's a better way to format a NTFS device using XP $UpCase
file, wich would pass every chkdsk without causing any troubles.


Cheers,

Samuel Martín Moro
{EPITECH.} tek4
CamTrace S.A.S
Comment 4 Max Brazhnikov freebsd_committer freebsd_triage 2010-10-21 15:43:34 UTC
Responsible Changed
From-To: makc->freebsd-ports-bugs

Release, don't have ntfs now.
Comment 5 Max Brazhnikov freebsd_committer freebsd_triage 2011-03-14 14:05:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->makc

"Grab again."
Comment 6 dfilter service freebsd_committer freebsd_triage 2011-03-17 16:21:22 UTC
makc        2011-03-17 16:21:09 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/ntfsprogs   Makefile distinfo 
    sysutils/ntfsprogs/files patch-libntfs-device.c 
  Added files:
    sysutils/ntfsprogs/files patch-libntfs-unistr.c 
                             patch-ntfsprogs-mkntfs.c 
  Log:
  Fix mkntfs
  Replace Vista's $UpCase file by a Windows XP one
  Pass maintainership to submitter
  Remove md5 sum while I'm here
  
  PR:             ports/144852
  Submitted by:   Samuel Martin Moro <faust64 at gmail.com>
  
  Revision  Changes    Path
  1.39      +2 -2      ports/sysutils/ntfsprogs/Makefile
  1.9       +0 -1      ports/sysutils/ntfsprogs/distinfo
  1.4       +123 -24   ports/sysutils/ntfsprogs/files/patch-libntfs-device.c
  1.1       +138 -0    ports/sysutils/ntfsprogs/files/patch-libntfs-unistr.c (new)
  1.1       +31 -0     ports/sysutils/ntfsprogs/files/patch-ntfsprogs-mkntfs.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Max Brazhnikov freebsd_committer freebsd_triage 2011-03-17 16:24:42 UTC
State Changed
From-To: open->closed

Committed.