public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_lsprojid: show quota project id for specified files
@ 2011-12-12 14:06 Arkadiusz Miśkiewicz
  2012-01-04 15:11 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Arkadiusz Miśkiewicz @ 2011-12-12 14:06 UTC (permalink / raw)
  To: xfs

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@maven.pl>
---
 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-04 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 14:06 [PATCH] xfs_lsprojid: show quota project id for specified files Arkadiusz Miśkiewicz
2012-01-04 15:11 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox