Home | History | Annotate | Download | only in ntfs
History log of /src/sys/fs/ntfs/ntfs_subr.c
RevisionDateAuthorComments
 1.64  13-May-2021  hannken ntfs_loadntnode(): Use bread() when ntm_sysvn[NTFS_MFTINO] is NULL.

May happen when loading node 0 (MFT) during mount and some
attributes are stored in another ntnode.

PR kern/56160 (Mount ntfs usb disk)
 1.63  17-Jan-2020  ad branches: 1.63.10; 1.63.12;
VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.62  18-Oct-2019  hannken branches: 1.62.2;
When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.

Should fix PR kern/54598: mount ntfs panic
 1.61  28-Mar-2015  maxv branches: 1.61.10; 1.61.18; 1.61.22;
Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.60  20-Feb-2015  maxv Cosmetic changes:
- add a ffs-like ntfs_superblock_validate function
- remove unused includes
- fix some comments
- KNF

No functional change.
 1.59  16-Jan-2015  maxv Fix a node leak.

Sent on tech-kern@, tested by martin@
 1.58  06-Jan-2015  hannken No need to load a vnode/fnode pair to lookup attributes on a ntnode.
Use ntfs_ntlookup()/ntfs_ntput() instead.
 1.57  04-Jan-2015  christos add more debugging.
 1.56  29-Dec-2014  maxv Typos:
- "nessesary" -> "necessary" (comment)
- "UNEXISTED" -> "NON-EXISTENT" (dprintf)
- "NON-EXISTANT" -> "NON-EXISTENT" (dprintf)
- "reach" -> "reaches" (comment)
 1.55  28-Dec-2014  maxv Make this more readable (KNF).
 1.54  13-Nov-2014  hannken branches: 1.54.2;
Change ntfs to vcache.
- Use (inumber, attrtype, attrname) as key.
- Inline ntfs_fget() and ntfs_frele() as they only get called once.
 1.53  13-Nov-2014  hannken - Change ntfs_vgetex() to always load the ntnode and fnode.
- Take the vnode attributes from the NAME attribute.
- Remove now unused ntfs_times() and ntfs_filesize().
- Treat nodes without an unnamed DATA attribute as zero-sized regular files.
 1.52  13-Nov-2014  hannken - Fix ntfs_ntlookupattr() to make the examples from the man page work.
- Fix ntfs_loadntnode() to always read full cluster to prevent buffer
cache inconsistency.
- Change ntfs_vgetex() and ntfs_fget() to take a const attrname and
always pass a possibly empty string.
- Change printf to dprintf.
- Get rid of dead fields i_next, i_prev of struct ntnode.
 1.51  28-Jun-2013  matt branches: 1.51.8;
Make this compile again.
 1.50  28-Jun-2013  christos remove useless initialization, KNF
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
 1.49  20-Dec-2012  hannken Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.48  12-Jul-2012  dsl branches: 1.48.2;
Fix build - eg i386/ALL
 1.47  02-Jun-2012  christos - fix some mallocs not to have casts and specify sizeof(*var)
- if the index magic is 0, don't complain, just return an error.
- make dprintfs use __func__
 1.46  31-Aug-2011  plunky branches: 1.46.2;
NULL does not need a cast
 1.45  30-Jun-2011  wiz dependant -> dependent
 1.44  08-Jan-2010  pooka The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.43  01-Sep-2009  pooka Set vnode size after creation(*). Fixes cp(1) from ntfs, the
complaint in the "ntfs ubc_uiomove error" (ubc_uiomove error was
not coming from ntfs but instead the "to" file system) and PR
kern/38531 (well, I assume the submitter wanted cp(1) working on
ntfs instead of mangling ntfs the way the PR title suggests). Yes,
mmap works on ntfs like it always has.

*) well, um, and in other places too ... uuuh ... no comments.
but I guess this works as long as in-kernel ntfs doesn't grow write
support.
 1.42  18-Mar-2009  cegger bzero -> memset
 1.41  15-Mar-2009  cegger ansify function definitions
 1.40  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.39  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.38  17-Dec-2008  cegger branches: 1.38.2;
kill MALLOC and FREE macros.
 1.37  16-May-2008  hannken branches: 1.37.6; 1.37.8; 1.37.14;
Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write. Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller
intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
may clear the buffer and runs copy-on-write. Process possible errors
from getblk() or fscow_run(). Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
 1.36  29-Jan-2008  pooka branches: 1.36.6; 1.36.8; 1.36.10; 1.36.12;
Nuke #ifdef __OtherOS__ clutter to make maintaining slightly easier.
 1.35  27-Jan-2008  ad Replace use of lockmgr().
 1.34  02-Jan-2008  ad Merge vmlocking2 to head.
 1.33  10-Oct-2007  ad branches: 1.33.4; 1.33.6; 1.33.10;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.32  08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.31  30-Jun-2007  pooka branches: 1.31.6; 1.31.8; 1.31.10;
Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.
 1.30  04-Mar-2007  christos branches: 1.30.2; 1.30.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.29  15-Feb-2007  ad branches: 1.29.2;
Fix error in previous.
 1.28  15-Feb-2007  ad Replace some uses of lockmgr() / simplelocks.
 1.27  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.26  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25  14-May-2006  elad branches: 1.25.8; 1.25.10;
integrate kauth.
 1.24  11-May-2006  mrg ntfs_runtovrun takes u_int8_t * not caddr_t
 1.23  15-Apr-2006  christos Coverity CID 1138: Add KASSERT before deref.
 1.22  17-Mar-2006  christos don't use MALLOC with a non-constant size; use malloc instead.
 1.21  11-Dec-2005  christos branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
merge ktrace-lwp.
 1.20  23-Oct-2005  christos make debugging code compile after 64 bit inode changes.
 1.19  30-Aug-2005  xtraeme branches: 1.19.2;
Remove __P()
 1.18  19-Aug-2005  christos 64 bit inode changes.
 1.17  25-Jul-2005  christos PR/30823: Dave Huang: Panic reading files larger than 4GB on NTFS
 1.16  29-May-2005  christos branches: 1.16.2;
- rename variables to avoid shadowing.
- add a few const.
 1.15  22-May-2005  christos Don't print 0x in front of %p. From FreeBSD/OpenBSD
 1.14  26-Feb-2005  perry nuke trailing whitespace
 1.13  13-Feb-2005  jdolecek use MIN()/MAX() rather than min()/max(), to avoid possible truncation
of 64bit values to 'int'
 1.12  13-Feb-2005  jdolecek read always single cluster of data, to avoid confusing the buffer
cache; this appears to fix the random file content corruption which
happens when more than one cluster is read at the same time, i.e. for
files > 3*cluster_size

Fixes PR kern/23835

change obtained from FreeBSD ntfs_subr.c rev. 1.31
 1.11  27-Dec-2004  jdolecek branches: 1.11.2; 1.11.4;
change wget_utf8() to not require NUL-terminated string as input (added
'size' parameter), and adjust callers appropriately
 1.10  24-Jun-2004  drochner fix some questionable pointer arithmetics; gcc-3.4.x
didn't like it
 1.9  12-May-2004  jrf caddr_t -> void * and removal of some more casts.
 1.8  22-Mar-2004  jdolecek g/c redundant debug printf
 1.7  29-Jun-2003  fvdl branches: 1.7.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.6  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.5  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.4  10-Apr-2003  jdolecek change some printf()s on easily-triggerable codepaths to dprintf()
 1.3  01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.2  06-Jan-2003  wiz Typo and grammar fixes in comments and a printf string.
 1.1  23-Dec-2002  jdolecek branches: 1.1.2;
move NTFS code from sys/ntfs to sys/fs/ntfs
 1.1.2.3  07-Jan-2003  thorpej Sync with HEAD.
 1.1.2.2  29-Dec-2002  thorpej With with HEAD.
 1.1.2.1  23-Dec-2002  thorpej file ntfs_subr.c was added on branch nathanw_sa on 2002-12-29 19:56:16 +0000
 1.7.2.9  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.8  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.7  15-Feb-2005  skrll Sync with HEAD.
 1.7.2.6  17-Jan-2005  skrll Sync with HEAD.
 1.7.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.7.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.7.2.2  03-Aug-2004  skrll Sync with HEAD
 1.7.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.11.4.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.2.1  29-Apr-2005  kent sync with -current
 1.16.2.7  04-Feb-2008  yamt sync with head.
 1.16.2.6  21-Jan-2008  yamt sync with head
 1.16.2.5  27-Oct-2007  yamt sync with head.
 1.16.2.4  03-Sep-2007  yamt sync with head.
 1.16.2.3  26-Feb-2007  yamt sync with head.
 1.16.2.2  30-Dec-2006  yamt sync with head.
 1.16.2.1  21-Jun-2006  yamt sync with head.
 1.19.2.1  26-Oct-2005  yamt sync with head
 1.21.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.12.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.21.10.3  11-May-2006  elad sync with head
 1.21.10.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.21.10.1  19-Apr-2006  elad sync with head.
 1.21.8.2  24-May-2006  yamt sync with head.
 1.21.8.1  01-Apr-2006  yamt sync with head.
 1.21.6.2  01-Jun-2006  kardel Sync with head.
 1.21.6.1  22-Apr-2006  simonb Sync with head.
 1.21.4.1  09-Sep-2006  rpaulo sync with head
 1.25.10.2  10-Dec-2006  yamt sync with head.
 1.25.10.1  22-Oct-2006  yamt sync with head
 1.25.8.1  18-Nov-2006  ad Sync with head.
 1.29.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.30.4.1  11-Jul-2007  mjf Sync with head.
 1.30.2.3  15-Jul-2007  ad Sync with head.
 1.30.2.2  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.30.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.31.10.1  14-Oct-2007  yamt sync with head.
 1.31.8.3  23-Mar-2008  matt sync with HEAD
 1.31.8.2  09-Jan-2008  matt sync with HEAD
 1.31.8.1  06-Nov-2007  matt sync with HEAD
 1.31.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.33.10.1  02-Jan-2008  bouyer Sync with HEAD
 1.33.6.2  27-Dec-2007  ad lockdestroy(&ip->i_lock); XXX Why does this have inode locks?
 1.33.6.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.33.4.1  18-Feb-2008  mjf Sync with HEAD.
 1.36.12.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.10.3  11-Mar-2010  yamt sync with head
 1.36.10.2  16-Sep-2009  yamt sync with head
 1.36.10.1  04-May-2009  yamt sync with head.
 1.36.8.1  18-May-2008  yamt sync with head.
 1.36.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.36.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.37.14.1  21-Apr-2010  matt sync to netbsd-5
 1.37.8.1  10-Sep-2009  snj Pull up following revision(s) (requested by pooka in ticket #942):
sys/fs/ntfs/ntfs_subr.c: revision 1.43
sys/fs/ntfs/ntfs_vfsops.c: revision 1.79
Set vnode size after creation(*). Fixes cp(1) from ntfs, the
complaint in the "ntfs ubc_uiomove error" (ubc_uiomove error was
not coming from ntfs but instead the "to" file system) and
PR kern/38531 (well, I assume the submitter wanted cp(1) working on
ntfs instead of mangling ntfs the way the PR title suggests). Yes,
mmap works on ntfs like it always has.
*) well, um, and in other places too ... uuuh ... no comments.
but I guess this works as long as in-kernel ntfs doesn't grow write
support.
 1.37.6.2  28-Apr-2009  skrll Sync with HEAD.
 1.37.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.38.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.46.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.2  23-Jan-2013  yamt sync with head
 1.46.2.1  30-Oct-2012  yamt sync with head
 1.48.2.3  03-Dec-2017  jdolecek update from HEAD
 1.48.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.2.1  25-Feb-2013  tls resync with head
 1.51.8.1  14-Feb-2015  snj Pull up following revision(s) (requested by maxv in ticket #513):
sys/fs/ntfs/ntfs_vfsops.c: revision 1.99, 1.100
sys/fs/ntfs/ntfs_subr.c: revision 1.59
Ensure bps != 0 to prevent a division by zero. Zero byte per sector makes
no sense.
--
Prevent another division by zero in ntfs_loadntnode() by ensuring
spc != 0.
--
Fix a node leak.
Sent on tech-kern@, tested by martin@
 1.54.2.1  06-Apr-2015  skrll Sync with HEAD
 1.61.22.2  17-May-2021  martin Pull up following revision(s) (requested by hannken in ticket #1272):

sys/fs/ntfs/ntfs_subr.c: revision 1.64

ntfs_loadntnode(): Use bread() when ntm_sysvn[NTFS_MFTINO] is NULL.

May happen when loading node 0 (MFT) during mount and some
attributes are stored in another ntnode.

PR kern/56160 (Mount ntfs usb disk)
 1.61.22.1  21-Oct-2019  martin Pull up following revision(s) (requested by hannken in ticket #354):

sys/fs/ntfs/ntfs_vfsops.c: revision 1.108
sys/fs/ntfs/ntfs_subr.c: revision 1.62

It is not possible to call vflush() from xxx_mount().
Replace with a vnode iterator and use vrecycle().

-

When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.
Should fix PR kern/54598: mount ntfs panic
 1.61.18.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.61.18.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.61.10.1  21-Oct-2019  martin Pull up following revision(s) (requested by hannken in ticket #1410):

sys/fs/ntfs/ntfs_vfsops.c: revision 1.108
sys/fs/ntfs/ntfs_subr.c: revision 1.62

It is not possible to call vflush() from xxx_mount().
Replace with a vnode iterator and use vrecycle().

-

When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.
Should fix PR kern/54598: mount ntfs panic
 1.62.2.1  17-Jan-2020  ad Sync with head.
 1.63.12.1  31-May-2021  cjep sync with head
 1.63.10.1  17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed