Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | __attribute__ |
Functions | |
MFT_REF | ntfs_lookup_inode_by_name (ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len, ntfs_name **res) |
Variables | |
ntfschar | I30 [5] |
MFT_REF ntfs_lookup_inode_by_name | ( | ntfs_inode * | dir_ni, |
const ntfschar * | uname, | ||
const int | uname_len, | ||
ntfs_name ** | res | ||
) |
ntfs_lookup_inode_by_name - find an inode in a directory given its name : ntfs inode of the directory in which to search for the name : Unicode name for which to search in the directory : length of the name in Unicode characters : return the found file name if necessary (see below)
Look for an inode with name in the directory with inode . ntfs_lookup_inode_by_name() walks the contents of the directory looking for the Unicode name. If the name is found in the directory, the corresponding inode number (>= 0) is returned as a mft reference in cpu format, i.e. it is a 64-bit number containing the sequence number.
On error, a negative value is returned corresponding to the error code. In particular if the inode is not found -ENOENT is returned. Note that you can't just check the return value for being negative, you have to check the inode number for being negative which you can extract using MREC(return value).
Note, does not include the (optional) terminating NULL character.
Note, we look for a case sensitive match first but we also look for a case insensitive match at the same time. If we find a case insensitive match, we save that for the case that we don't find an exact match, where we return the case insensitive match and setup (which we allocate!) with the mft reference, the file name type, length and with a copy of the little endian Unicode file name itself. If we match a file name which is in the DOS name space, we only return the mft reference and file name type in . ntfs_lookup() then uses this to find the long file name in the inode itself. This is to avoid polluting the dcache with short file names. We want them to work but we don't care for how quickly one can access them. This also fixes the dcache aliasing issues.
Locking: - Caller must hold i_mutex on the directory.
ntfschar I30[5] |
dir.c - NTFS kernel directory operations. Part of the Linux-NTFS project.
Copyright (c) 2001-2007 Anton Altaparmakov Copyright (c) 2002 Richard Russon
This program/include file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program/include file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (in the main directory of the Linux-NTFS distribution in the file COPYING); if not, write to the Free Software Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The little endian Unicode string $I30 as a global constant.