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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux