FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Sun Nov 29, 2020 00:58



Post new topic Reply to topic  [ 4 posts ] 
No need to check for block device on FreeBSD in mkntfs.c 
Author Message

Joined: Sun Oct 18, 2015 10:12
Posts: 2
Post No need to check for block device on FreeBSD in mkntfs.c
There's a suggested patch to not check for block devices on FreeBSD in ntfsprogs/mkntfs.c

See

https://bugs.freebsd.org/bugzilla/show_ ... ?id=197301

for details. I tried to attach the patch to this topic, but the forum software does not like .c, .diff or no extension.


Sun Oct 18, 2015 10:37
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: No need to check for block device on FreeBSD in mkntfs.c
Hi,

I do not understand the rationale for this proposed patch.

Formatting an ntfs device depends on the sector size. If the device is a block device, its sector size can be determined automatically. Otherwise the sector size is either supplied in an option or forced to 512. The original code requires option -F to force a sector size.

IMHO the proposed patch skips defining the sector size for non block devices.

What is the use case leading to this proposal ?

Quote:
but the forum software does not like .c, .diff or no extension.

This forum requires the attachments to be compressed (.gz .zip, .bz2, etc.)

Regards

Jean-Pierre


Sun Oct 18, 2015 14:28
Profile

Joined: Sun Oct 18, 2015 22:47
Posts: 1
Post Re: No need to check for block device on FreeBSD in mkntfs.c
The patch just skips the check for a block device - FreeBSD doesn't have them (only raw devices).
Without it the only way to use it on FreeBSD is with the -F option which isn't very user friendly.

The patch should probably use #ifdef __FreeBSD__ instead of #if 0 though (I wrote the patch originally for adding to the FreeBSD port not upstreaming)

As for checking the sector size - I think on FreeBSD the only way to do that is an ioctl(.., DIOCGSECTORSIZE, ..). I don't have a 4k device I want to put NTFS on to check though.


Sun Oct 18, 2015 22:52
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: No need to check for block device on FreeBSD in mkntfs.c
Hi,

Quote:
The patch just skips the check for a block device - FreeBSD doesn't have them (only raw devices).

The the corresponding check should be for a character device (is this what you call a raw device ?).
Quote:
As for checking the sector size - I think on FreeBSD the only way to do that is an ioctl(.., DIOCGSECTORSIZE, ..).

This is how the sector size is retrieved (in libntfs-3g/device.c), called from function mkntfs_override_vol_params() in mkntfs.c, assuming DIOCGSECTORSIZE is defined.

Can you check the attached patch, in particular please check the sector size is retrieved correctly.

Regards

Jean-Pierre


Attachments:
mkntfs.freebsd.patch.gz [349 Bytes]
Downloaded 688 times
Mon Oct 19, 2015 13:53
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.