Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add free/total inode counts #659

Merged
merged 19 commits into from
Oct 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
- Implement and use copy constructors
  • Loading branch information
jogi committed Oct 21, 2018
commit 9768e6d162d388c0dc93131420b36e37ab79949a
49 changes: 15 additions & 34 deletions oshi-core/src/main/java/oshi/software/os/OSFileStore.java
Original file line number Diff line number Diff line change
@@ -57,42 +57,23 @@ public OSFileStore() {
}

/**
* Creates an OSFileStore with the specified parameters.
* Creates a copy of an OSFileStore.
*
* @param newName
* Name of the filestore
* @param newVolume
* Volume of the filestore
* @param newMount
* Mountpoint of the filestore
* @param newDescription
* Description of the file store
* @param newType
* Type of the filestore, e.g. FAT, NTFS, etx2, ext4, etc.
* @param newUuid
* UUID/GUID of the filestore
* @param newUsableSpace
* Available/usable bytes
* @param newTotalSpace
* Total bytes
* @param newFreeInodes
* Available / free inodes
* @param newTotalInodes
* Total / maximum number of inodes in filesystem
* @param fileStore
* OSFileStore which is copied
*/
public OSFileStore(String newName, String newVolume, String newMount, String newDescription, String newType,
String newUuid, long newUsableSpace, long newTotalSpace, long newFreeInodes, long newTotalInodes) {
setName(newName);
setVolume(newVolume);
setLogicalVolume("");
setMount(newMount);
setDescription(newDescription);
setType(newType);
setUUID(newUuid);
setUsableSpace(newUsableSpace);
setTotalSpace(newTotalSpace);
setFreeInodes(newFreeInodes);
setTotalInodes(newTotalInodes);
public OSFileStore(OSFileStore fileStore) {
setName(fileStore.getName());
setVolume(fileStore.getVolume());
setLogicalVolume(fileStore.getLogicalVolume());
setMount(fileStore.getMount());
setDescription(fileStore.getDescription());
setType(fileStore.getType());
setUUID(fileStore.getUUID());
setUsableSpace(fileStore.getUsableSpace());
setTotalSpace(fileStore.getTotalSpace());
setFreeInodes(fileStore.getFreeInodes());
setTotalInodes(fileStore.getTotalInodes());
}

/**
30 changes: 5 additions & 25 deletions oshi-json/src/main/java/oshi/json/software/os/OSFileStore.java
Original file line number Diff line number Diff line change
@@ -45,33 +45,13 @@ public class OSFileStore extends AbstractOshiJsonObject {
private oshi.software.os.OSFileStore fileStore;

/**
* Creates an OSFileStore with the specified parameters.
* Create an json OSFileStore from OSFileStore.
*
* @param newName
* Name of the filestore
* @param newVolume
* Volume of the filestore
* @param newMount
* Mountpoint of the filestore
* @param newDescription
* Description of the file store
* @param newType
* Type of the filestore, e.g. FAT, NTFS, etx2, ext4, etc.
* @param newUuid
* UUID/GUID of the filestore
* @param newUsableSpace
* Available/usable bytes
* @param newTotalSpace
* Total bytes
* @param newFreeInodes
* Available / free inodes
* @param newTotalInodes
* Total / maximum number of inodes in filesystem
* @param origFileStore
* Original filestore
*/
public OSFileStore(String newName, String newVolume, String newMount, String newDescription, String newType,
String newUuid, long newUsableSpace, long newTotalSpace, long newFreeInodes, long newTotalInodes) {
this.fileStore = new oshi.software.os.OSFileStore(newName, newVolume, newMount, newDescription, newType,
newUuid, newUsableSpace, newTotalSpace, newFreeInodes, newTotalInodes);
public OSFileStore(oshi.software.os.OSFileStore origFileStore) {
this.fileStore = new oshi.software.os.OSFileStore(origFileStore);
}

/**
Original file line number Diff line number Diff line change
@@ -63,10 +63,7 @@ public OSFileStore[] getFileStores() {
oshi.software.os.OSFileStore[] fs = this.fileSystem.getFileStores();
OSFileStore[] fileStores = new OSFileStore[fs.length];
for (int i = 0; i < fs.length; i++) {
fileStores[i] = new OSFileStore(fs[i].getName(), fs[i].getVolume(), fs[i].getMount(),
fs[i].getDescription(), fs[i].getType(), fs[i].getUUID(), fs[i].getUsableSpace(),
fs[i].getTotalSpace(), fs[i].getFreeInodes(), fs[i].getTotalInodes());
fileStores[i].setLogicalvolume(fs[i].getLogicalVolume());
fileStores[i] = new OSFileStore(fs[i]);
}
return fileStores;
}