Skip to content

Commit

Permalink
Rename onMount to beforeMount, and change its semantics to mean just …
Browse files Browse the repository at this point in the history
…that.
  • Loading branch information
EtiennePerot committed Nov 10, 2013
1 parent 4ca1ed4 commit 9cc3b8d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
23 changes: 15 additions & 8 deletions src/main/java/net/fusejna/FuseFilesystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
import net.fusejna.StructStat.StatWrapper;
import net.fusejna.StructStatvfs.StatvfsWrapper;
import net.fusejna.StructTimeBuffer.TimeBufferWrapper;
import net.fusejna.types.*;
import net.fusejna.types.TypeDev;
import net.fusejna.types.TypeGid;
import net.fusejna.types.TypeMode;
import net.fusejna.types.TypeMode.ModeWrapper;
import net.fusejna.types.TypeMode.NodeType;
import net.fusejna.types.TypeOff;
import net.fusejna.types.TypePid;
import net.fusejna.types.TypeSize;
import net.fusejna.types.TypeUInt32;
import net.fusejna.types.TypeUid;

import com.sun.jna.Function;
import com.sun.jna.Pointer;
Expand Down Expand Up @@ -348,6 +355,8 @@ final int _write(final String path, final Pointer buffer, final TypeSize size, f

public abstract void afterUnmount(final File mountPoint);

public abstract void beforeMount(final File mountPoint);

public abstract void beforeUnmount(final File mountPoint);

@UserMethod
Expand Down Expand Up @@ -532,17 +541,15 @@ public final void mount(final File mountPoint, final boolean blocking) throws Un
}
this.mountPoint = mountPoint;
mountLock.unlock();
beforeMount(mountPoint);
FuseJna.mount(this, mountPoint, blocking);
onMount(mountPoint);
}

public final void mount(final String mountPoint) throws FuseException
{
mount(new File(mountPoint), true);
}

public abstract void onMount(final File mountPoint);

@UserMethod
public abstract int open(final String path, final FileInfoWrapper info);

Expand Down Expand Up @@ -599,13 +606,13 @@ void setFinalMountPoint(final File mountPoint)
public final void unmount() throws IOException, FuseException
{
mountLock.lock();
if (!isMounted()) {
return;
}
try {
if (!isMounted()) {
return;
}
beforeUnmount(mountPoint);
FuseJna.unmount(this);
final File oldMountPoint = mountPoint;
FuseJna.unmount(this);
mountPoint = null;
afterUnmount(oldMountPoint);
}
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/net/fusejna/LoggedFuseFilesystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ public void invoke()
}, mountPoint.toString());
}

@Override
public void beforeMount(final File mountPoint)
{
log("beforeMount", new LoggedVoidMethod()
{
@Override
public void invoke()
{
filesystem.beforeMount(mountPoint);
}
}, mountPoint.toString());
}

@Override
public void beforeUnmount(final File mountPoint)
{
Expand Down Expand Up @@ -387,19 +400,6 @@ public Integer invoke()
}, path, mode, dev);
}

@Override
public void onMount(final File mountPoint)
{
log("onMount", new LoggedVoidMethod()
{
@Override
public void invoke()
{
filesystem.onMount(mountPoint);
}
}, mountPoint.toString());
}

@Override
public int open(final String path, final FileInfoWrapper info)
{
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/fusejna/util/FuseFilesystemAdapterFull.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public void afterUnmount(final File mountPoint)
{
}

@Override
public void beforeMount(final File mountPoint)
{
}

@Override
public void beforeUnmount(final File mountPoint)
{
Expand Down Expand Up @@ -155,11 +160,6 @@ public int mknod(final String path, final ModeWrapper mode, final long dev)
return create(path, mode, null);
}

@Override
public void onMount(final File mountPoint)
{
}

@Override
public int open(final String path, final FileInfoWrapper info)
{
Expand Down

0 comments on commit 9cc3b8d

Please sign in to comment.