Commit 089aecd6 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

vfs: make FsStat is a part of vfs interface

parent a50ff968
......@@ -131,7 +131,6 @@ import java.util.concurrent.TimeUnit;
import org.dcache.chimera.ChimeraFsException;
import org.dcache.chimera.FileNotFoundHimeraFsException;
import org.dcache.chimera.FsStat;
import org.dcache.chimera.IOHimeraFsException;
import org.dcache.chimera.UnixPermission;
import org.dcache.chimera.nfs.ChimeraNFSException;
......@@ -158,6 +157,7 @@ import org.slf4j.LoggerFactory;
import static org.dcache.chimera.nfs.v3.HimeraNfsUtils.defaultPostOpAttr;
import static org.dcache.chimera.nfs.v3.HimeraNfsUtils.defaultWccData;
import org.dcache.chimera.nfs.vfs.FsStat;
public class NfsServerV3 extends nfs3_protServerStub {
......
......@@ -93,9 +93,9 @@ import java.util.concurrent.TimeUnit;
import org.dcache.xdr.XdrAble;
import org.dcache.xdr.XdrBuffer;
import org.dcache.xdr.XdrEncodingStream;
import org.dcache.chimera.FsStat;
import org.dcache.chimera.UnixPermission;
import org.dcache.chimera.nfs.v4.xdr.nfs_resop4;
import org.dcache.chimera.nfs.vfs.FsStat;
import org.dcache.chimera.nfs.vfs.Inode;
import org.dcache.chimera.nfs.vfs.VirtualFileSystem;
import org.slf4j.Logger;
......
......@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.List;
import org.dcache.chimera.DirectoryStreamHelper;
import org.dcache.chimera.FsInode;
import org.dcache.chimera.FsStat;
import org.dcache.chimera.HimeraDirectoryEntry;
import org.dcache.chimera.JdbcFs;
import org.dcache.chimera.UnixPermission;
......@@ -143,7 +142,11 @@ public class ChimeraVfs implements VirtualFileSystem {
@Override
public FsStat getFsStat() throws IOException {
return _fs.getFsStat();
org.dcache.chimera.FsStat fsStat = _fs.getFsStat();
return new FsStat(fsStat.getTotalSpace(),
fsStat.getTotalFiles(),
fsStat.getUsedSpace(),
fsStat.getUsedFiles());
}
private FsInode toFsInode(Inode inode) throws IOException {
......
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.dcache.chimera.nfs.vfs;
/**
* File system stat information.
*/
/* Immutable */
public class FsStat {
private final long _totalSpace;
private final long _totalFiles;
private final long _usedSpace;
private final long _usedFiles;
public FsStat(long totalSpace, long totalFiles, long usedSpace, long usedFiles) {
_totalSpace = totalSpace;
_totalFiles = totalFiles;
_usedSpace = usedSpace;
_usedFiles = usedFiles;
}
public long getTotalFiles() {
return _totalFiles;
}
public long getTotalSpace() {
return _totalSpace;
}
/**
* @return total number of files. If a file has multiple replicas only one
* replica is counted.
*/
public long getUsedFiles() {
return _usedFiles;
}
/**
* @return total number of bytes off all files. If a file has a multiple
* replicas only one replica is counted.
*/
public long getUsedSpace() {
return _usedSpace;
}
}
\ No newline at end of file
......@@ -18,7 +18,6 @@ package org.dcache.chimera.nfs.vfs;
import java.io.IOException;
import java.util.List;
import org.dcache.chimera.FsStat;
public interface VirtualFileSystem {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment