HDFS-1322. Document umask in DistributedFileSystem#mkdirs javadocs. Contributed by Colin Patrick McCabe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1408532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-11-13 01:28:33 +00:00
parent b3e42a1ed5
commit 3492ab6de0
3 changed files with 35 additions and 3 deletions

View File

@ -184,7 +184,18 @@ public String toString() {
return str;
}
/** Apply a umask to this permission and return a new one */
/**
* Apply a umask to this permission and return a new one.
*
* The umask is used by create, mkdir, and other Hadoop filesystem operations.
* The mode argument for these operations is modified by removing the bits
* which are set in the umask. Thus, the umask limits the permissions which
* newly created files and directories get.
*
* @param umask The umask to use
*
* @return The effective permission
*/
public FsPermission applyUMask(FsPermission umask) {
return new FsPermission(useraction.and(umask.useraction.not()),
groupaction.and(umask.groupaction.not()),

View File

@ -464,6 +464,9 @@ Release 2.0.3-alpha - Unreleased
HDFS-4048. Use ERROR instead of INFO for volume failure logs.
(Stephen Chu via eli)
HDFS-1322. Document umask in DistributedFileSystem#mkdirs javadocs.
(Colin Patrick McCabe via eli)
OPTIMIZATIONS
BUG FIXES

View File

@ -509,14 +509,32 @@ public LocatedFileStatus next() throws IOException {
}
/**
* Create a directory with given name and permission, only when
* parent directory exists.
* Create a directory, only when the parent directories exist.
*
* See {@link FsPermission#applyUMask(FsPermission)} for details of how
* the permission is applied.
*
* @param f The path to create
* @param permission The permission. See FsPermission#applyUMask for
* details about how this is used to calculate the
* effective permission.
*/
public boolean mkdir(Path f, FsPermission permission) throws IOException {
statistics.incrementWriteOps(1);
return dfs.mkdirs(getPathName(f), permission, false);
}
/**
* Create a directory and its parent directories.
*
* See {@link FsPermission#applyUMask(FsPermission)} for details of how
* the permission is applied.
*
* @param f The path to create
* @param permission The permission. See FsPermission#applyUMask for
* details about how this is used to calculate the
* effective permission.
*/
@Override
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
statistics.incrementWriteOps(1);