xfs
[Top] [All Lists]

[PATCH] xfs_lsprojid: show quota project id for specified files

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs_lsprojid: show quota project id for specified files
From: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Date: Mon, 12 Dec 2011 15:06:32 +0100
Cc: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maven.pl; s=maven; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=4zswMYSUYxkZH+ORBlODanI0rjXnX6bP6kMEbWTvJSs=; b=qT6uN0PlvtwEJfgiCc91hGPLnJQRis2YZmVrbfqxgrrVuOc6TMbDXgTFzUCQo2sgxP b2RNBR/aJYc3X8/Aa5saKxeo05Sq04MnrYw/GFARAlod3VAoYKyaSMHWBPJqPjfxyMPl EK238YWItz0YIRnHt6Q8s9QZG3DMlSotJgZl0=
There is no simple way for extracting quota project id for specified
files, so here is a shell wrapper which makes this easy thing:

/home/something/aaa: 107919
/home/something/bbb: 107923

Signed-off-by: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
---
 quota/Makefile        |    4 +++-
 quota/xfs_lsprojid.sh |    9 +++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)
 create mode 100755 quota/xfs_lsprojid.sh

diff --git a/quota/Makefile b/quota/Makefile
index 9c6411e..d813005 100644
--- a/quota/Makefile
+++ b/quota/Makefile
@@ -12,7 +12,8 @@ CFILES = init.c util.c \
 
 CFILES += $(PKG_PLATFORM).c
 PCFILES = darwin.c freebsd.c irix.c linux.c
-LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
+LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g") \
+       xfs_lsprojid.sh
 
 LLDLIBS = $(LIBXCMD)
 LTDEPENDENCIES = $(LIBXCMD)
@@ -35,6 +36,7 @@ include $(BUILDRULES)
 install: default
        $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
        $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+       $(INSTALL) -m 755 xfs_lsprojid.sh $(PKG_SBIN_DIR)/xfs_lsprojid
 install-dev:
 
 -include .dep
diff --git a/quota/xfs_lsprojid.sh b/quota/xfs_lsprojid.sh
new file mode 100755
index 0000000..4404de5
--- /dev/null
+++ b/quota/xfs_lsprojid.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Copyright (c) 2011 Arkadiusz Miśkiewicz.
+#
+
+xfs_io -p "$0" -c "stat" $@ | awk '
+/^fd\.path =/ { projid=""; path=$3; gsub(/^\"/, "", path); gsub(/\"$/, "", 
path); }
+/^fsxattr\.projid =/ { projid=$3; print path ": " projid; }
+'
-- 
1.7.8

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfs_lsprojid: show quota project id for specified files, Arkadiusz MiÅkiewicz <=