Drop unused path_conv::ndisk_links method

* fhandler_disk_file.cc (path_conv::ndisk_links): Drop unused method.
        (fhandler_base::fstat_helper): Drop unused call to ndisk_links.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2015-12-09 23:56:47 +01:00
parent ab73edc056
commit a0e7563eb0
3 changed files with 5 additions and 89 deletions

View File

@ -1,3 +1,8 @@
2015-12-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (path_conv::ndisk_links): Drop unused method.
(fhandler_base::fstat_helper): Drop unused call to ndisk_links.
2015-12-10 Corinna Vinschen <corinna@vinschen.de> 2015-12-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (path_conv::get_ino_by_handle): Rename fai to * fhandler_disk_file.cc (path_conv::get_ino_by_handle): Rename fai to

View File

@ -233,88 +233,6 @@ path_conv::get_ino_by_handle (HANDLE hdl)
return 0; return 0;
} }
#if 0
/* This function is obsolete. We're keeping it in so we don't forget
that we already did all that at one point. */
unsigned __stdcall
path_conv::ndisk_links (DWORD nNumberOfLinks)
{
if (!isdir () || isremote ())
return nNumberOfLinks;
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
HANDLE fh;
if (!NT_SUCCESS (NtOpenFile (&fh, SYNCHRONIZE | FILE_LIST_DIRECTORY,
get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_FOR_BACKUP_INTENT
| FILE_DIRECTORY_FILE)))
return nNumberOfLinks;
unsigned count = 0;
bool first = true;
PFILE_BOTH_DIR_INFORMATION fdibuf = (PFILE_BOTH_DIR_INFORMATION)
alloca (65536);
__DIR_mounts *dir = new __DIR_mounts (get_posix ());
while (NT_SUCCESS (NtQueryDirectoryFile (fh, NULL, NULL, NULL, &io, fdibuf,
65536, FileBothDirectoryInformation,
FALSE, NULL, first)))
{
if (first)
{
first = false;
/* All directories have . and .. as their first entries.
If . is not present as first entry, we're on a drive's
root direcotry, which doesn't have these entries. */
if (fdibuf->FileNameLength != 2 || fdibuf->FileName[0] != L'.')
count = 2;
}
for (PFILE_BOTH_DIR_INFORMATION pfdi = fdibuf;
pfdi;
pfdi = (PFILE_BOTH_DIR_INFORMATION)
(pfdi->NextEntryOffset ? (PBYTE) pfdi + pfdi->NextEntryOffset
: NULL))
{
switch (pfdi->FileAttributes
& (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT))
{
case FILE_ATTRIBUTE_DIRECTORY:
/* Just a directory */
++count;
break;
case FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT:
/* Volume mount point or symlink to directory */
{
UNICODE_STRING fname;
RtlInitCountedUnicodeString (&fname, pfdi->FileName,
pfdi->FileNameLength);
InitializeObjectAttributes (&attr, &fname,
objcaseinsensitive (), fh, NULL);
if (is_volume_mountpoint (&attr))
++count;
}
break;
default:
break;
}
UNICODE_STRING fname;
RtlInitCountedUnicodeString (&fname, pfdi->FileName,
pfdi->FileNameLength);
dir->check_mount (&fname, 0, false);
}
}
while (dir->check_missing_mount ())
++count;
NtClose (fh);
delete dir;
return count;
}
#endif
/* For files on NFS shares, we request an EA of type NfsV3Attributes. /* For files on NFS shares, we request an EA of type NfsV3Attributes.
This returns the content of a struct fattr3 as defined in RFC 1813. This returns the content of a struct fattr3 as defined in RFC 1813.
The content is the NFS equivalent of struct stat. so there's not much The content is the NFS equivalent of struct stat. so there's not much
@ -573,11 +491,7 @@ fhandler_base::fstat_helper (struct stat *buf, DWORD nNumberOfLinks)
/* The number of links to a directory includes the number of subdirectories /* The number of links to a directory includes the number of subdirectories
in the directory, since all those subdirectories point to it. However, in the directory, since all those subdirectories point to it. However,
this is painfully slow, so we do without it. */ this is painfully slow, so we do without it. */
#if 0
buf->st_nlink = pc.ndisk_links (nNumberOfLinks);
#else
buf->st_nlink = nNumberOfLinks; buf->st_nlink = nNumberOfLinks;
#endif
/* Enforce namehash as inode number on untrusted file systems. */ /* Enforce namehash as inode number on untrusted file systems. */
if (ino && pc.isgood_inode (ino)) if (ino && pc.isgood_inode (ino))

View File

@ -396,9 +396,6 @@ class path_conv
void close_conv_handle () { conv_handle.close (); } void close_conv_handle () { conv_handle.close (); }
ino_t get_ino_by_handle (HANDLE h); ino_t get_ino_by_handle (HANDLE h);
#if 0 /* obsolete, method still exists in fhandler_disk_file.cc */
unsigned __stdcall ndisk_links (DWORD);
#endif
inline const char *get_posix () const { return posix_path; } inline const char *get_posix () const { return posix_path; }
void __reg2 set_posix (const char *); void __reg2 set_posix (const char *);
DWORD get_symlink_length () { return symlink_length; }; DWORD get_symlink_length () { return symlink_length; };