1
0
mirror of https://github.com/samba-team/samba.git synced 2025-10-22 07:33:16 +03:00
Files
samba-mirror/source/ntvfs/posix/pvfs_fsinfo.c
Andrew Tridgell f84c0af35c r2561: completely redid the ntvfs module chaining code, You can now do something like:
ntvfs handler = nbench posix

and the nbench pass-thru module will be called before the posix
module. The chaining logic is now much saner, and less racy, with each
level in the chain getting its own private pointer rather than relying
on save/restore logic in the pass-thru module.

The only pass-thru module we have at the moment is the nbench one
(which records all traffic in a nbench compatibe format), but I plan
on soon writing a "unixuid" pass-thru module that will implement the
setegid()/setgroups()/seteuid() logic for standard posix uid
handling. This separation of the posix backend from the uid handling
should simplify the code, and make development easier.

I also modified the nbench module so it can do multiple chaining, so
if you want to you can do:

   ntvfs module = nbench nbench posix

and it will save 2 copies of the log file in /tmp. This is really only
useful for testing at the moment until we have more than one pass-thru
module.
2007-10-10 12:59:06 -05:00

66 lines
1.9 KiB
C

/*
Unix SMB/CIFS implementation.
POSIX NTVFS backend - fsinfo
Copyright (C) Andrew Tridgell 2004
This program 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 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; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "include/includes.h"
#include "vfs_posix.h"
/*
return filesystem space info
*/
NTSTATUS pvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
{
NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
return ntvfs_map_fsinfo(req, fs, pvfs->ops);
}
if (sys_fsusage(pvfs->base_directory,
&fs->generic.out.blocks_free,
&fs->generic.out.blocks_total) == -1) {
return pvfs_map_errno(pvfs, errno);
}
fs->generic.out.block_size = 512;
if (stat(pvfs->base_directory, &st) != 0) {
return NT_STATUS_DISK_CORRUPT_ERROR;
}
fs->generic.out.fs_id = st.st_ino;
unix_to_nt_time(&fs->generic.out.create_time, st.st_ctime);
fs->generic.out.serial_number = st.st_ino;
fs->generic.out.fs_attr = 0;
fs->generic.out.max_file_component_length = 255;
fs->generic.out.device_type = 0;
fs->generic.out.device_characteristics = 0;
fs->generic.out.quota_soft = 0;
fs->generic.out.quota_hard = 0;
fs->generic.out.quota_flags = 0;
fs->generic.out.volume_name = talloc_strdup(req, pvfs->share_name);
fs->generic.out.fs_type = req->tcon->fs_type;
return NT_STATUS_OK;
}