The --create-group-mounts option takes a group name as an
argument and creates a subdir to /var/lib/hugetlbfs/ with
that group name.  It then creates a mount point for each
available huge page size under that directory with mode
070, mounts it with the appropriate pagesize argument and
chowns it to the specified group.

The --create-user-mounts option does the same as the
group-mounts option except it takes a username, the
mode is 700, and it is chowned to the specified user.

Signed-off-by: Eric B Munson <ebmun...@us.ibm.com>
---
Changes from V3:
Rebase to new mount point creation code

Changes from V2:
Update hugeadm man page with new options

Changes from V1:
Ensure that the base MOUNTS_DIR is readable by all

 hugeadm.c     |   28 +++++++++++++++++++++++++---
 man/hugeadm.8 |   15 +++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/hugeadm.c b/hugeadm.c
index e28fe78..3e492dc 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -73,6 +73,14 @@ void print_usage()
        CONT("Adjust pool 'size' upper bound");
        OPTION("--create-mounts", "Creates a mount point for each available");
        CONT("huge page size on this system under /var/lib/hugetlbfs");
+       OPTION("--create-user-mounts <user>", "");
+       CONT("Creates a mount point for each available huge");
+       CONT("page size under /var/lib/hugetlbfs/<user>");
+       CONT("usable by user <user>");
+       OPTION("--create-group-mounts <group>", "");
+       CONT("Creates a mount point for each available huge");
+       CONT("page size under /var/lib/hugetlbfs/<group>");
+       CONT("usable by group <group>");
 
        OPTION("--page-sizes", "Display page sizes that a configured pool");
        OPTION("--page-sizes-all",
@@ -98,9 +106,11 @@ int opt_dry_run = 0;
 #define LONG_PAGE_SIZES        (LONG_PAGE|'s')
 #define LONG_PAGE_AVAIL        (LONG_PAGE|'a')
 
-#define LONG_MOUNTS            ('m' << 8)
-#define LONG_CREATE_MOUNTS     (LONG_MOUNTS|'C')
-#define LONG_LIST_ALL_MOUNTS   (LONG_MOUNTS|'A')
+#define LONG_MOUNTS                    ('m' << 8)
+#define LONG_CREATE_MOUNTS             (LONG_MOUNTS|'C')
+#define LONG_CREATE_USER_MOUNTS                (LONG_MOUNTS|'U')
+#define LONG_CREATE_GROUP_MOUNTS       (LONG_MOUNTS|'G')
+#define LONG_LIST_ALL_MOUNTS           (LONG_MOUNTS|'A')
 
 #define MAX_POOLS      32
 
@@ -541,6 +551,8 @@ int main(int argc, char** argv)
                {"pool-pages-min", required_argument, NULL, LONG_POOL_MIN_ADJ},
                {"pool-pages-max", required_argument, NULL, LONG_POOL_MAX_ADJ},
                {"create-mounts", no_argument, NULL, LONG_CREATE_MOUNTS},
+               {"create-user-mounts", required_argument, NULL, 
LONG_CREATE_USER_MOUNTS},
+               {"create-group-mounts", required_argument, NULL, 
LONG_CREATE_GROUP_MOUNTS},
 
                {"page-sizes", no_argument, NULL, LONG_PAGE_SIZES},
                {"page-sizes-all", no_argument, NULL, LONG_PAGE_AVAIL},
@@ -611,6 +623,16 @@ int main(int argc, char** argv)
                        create_mounts(NULL, NULL, base, S_IRWXU | S_IRWXG);
                        break;
 
+               case LONG_CREATE_USER_MOUNTS:
+                       snprintf(base, PATH_MAX, "%s/user", MOUNT_DIR);
+                       create_mounts(optarg, NULL, base, S_IRWXU);
+                       break;
+
+               case LONG_CREATE_GROUP_MOUNTS:
+                       snprintf(base, PATH_MAX, "%s/group", MOUNT_DIR);
+                       create_mounts(NULL, optarg, base, S_IRWXG);
+                       break;
+
                case LONG_PAGE_SIZES:
                        page_sizes(0);
                        break;
diff --git a/man/hugeadm.8 b/man/hugeadm.8
index d3fcab5..8cf5b5a 100644
--- a/man/hugeadm.8
+++ b/man/hugeadm.8
@@ -39,6 +39,21 @@ This creates mount points for each supported huge page size 
under
 root:root with permissions set to 770.  Each mount point is named
 pagesize-<size in bytes>.
 
+.TP
+.B --create-user-mounts=<user>
+
+This creates mount points for each supported huge page size under
+/var/lib/hugetlbfs/user/<user>.  Mount point naming is the same as
+--create-mounts.  After creation they are mounted and are owned by
+<user>:root with permissions set to 700.
+
+.TP
+.B --create-group-mounts=<group>
+
+This creates mount points for each supported huge page size under
+/var/lib/hugetlbfs/group/<group>.  Mount point naming is the same as
+--create-mounts.  After creation they are mounted and are owned by
+root:<group> with permissions set to 070.
 
 The following options display information about the pools.
 
-- 
1.6.0.3


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to