summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2005-05-03 09:57:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:29 -0500
commit1199f5f561c44fb3075742b6795ac9f64d079742 (patch)
tree5f6f8cb8ca9d46e638d795451fa34c45f02c363e /source4/ntvfs/posix
parent17f1cf095022a88541c461f2ea66940daabcd9a8 (diff)
downloadsamba-1199f5f561c44fb3075742b6795ac9f64d079742.tar.gz
samba-1199f5f561c44fb3075742b6795ac9f64d079742.tar.bz2
samba-1199f5f561c44fb3075742b6795ac9f64d079742.zip
r6597: Make use of libblkid (part of e2fsprogs) for reporting volume GUID, if possible.
Implement smbclient's 'fsinfo' comand family which allows you to query file system information in all known levels. (This used to be commit 660d6e3915d0539dd78c77df6707ea84edb4d509)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/config.m47
-rw-r--r--source4/ntvfs/posix/pvfs_fsinfo.c28
2 files changed, 33 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/config.m4 b/source4/ntvfs/posix/config.m4
index 0fcc948a5b..7625f8ee81 100644
--- a/source4/ntvfs/posix/config.m4
+++ b/source4/ntvfs/posix/config.m4
@@ -31,3 +31,10 @@ AC_CHECK_FUNCS(flistxattr)
if test x"$ac_cv_func_flistxattr" = x"yes"; then
AC_DEFINE(HAVE_XATTR_SUPPORT,1,[Whether we have xattr support])
fi
+
+AC_CHECK_HEADERS(blkid/blkid.h)
+AC_SEARCH_LIBS(blkid_get_cache, [blkid])
+AC_CHECK_FUNCS(blkid_get_cache)
+if test x"$ac_cv_func_blkid_get_cache" = x"yes"; then
+ AC_DEFINE(HAVE_LIBBLKID,1,[Whether we have blkid support (e2fsprogs)])
+fi
diff --git a/source4/ntvfs/posix/pvfs_fsinfo.c b/source4/ntvfs/posix/pvfs_fsinfo.c
index 6d92713ac7..6046ecb6f8 100644
--- a/source4/ntvfs/posix/pvfs_fsinfo.c
+++ b/source4/ntvfs/posix/pvfs_fsinfo.c
@@ -22,7 +22,12 @@
#include "includes.h"
#include "vfs_posix.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+/* We use libblkid out of e2fsprogs to identify UUID of a volume */
+#ifdef HAVE_LIBBLKID
+#include <blkid/blkid.h>
+#endif
/*
return filesystem space info
@@ -136,8 +141,27 @@ NTSTATUS pvfs_fsinfo(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OK;
case RAW_QFS_OBJECTID_INFORMATION:
- ZERO_STRUCT(fs->objectid_information.out);
- return NT_STATUS_OK;
+ {
+#ifdef HAVE_LIBBLKID
+ NTSTATUS status;
+ blkid_cache blk_cache = NULL;
+ const char *uuid_value;
+ const char *blkid_devname;
+
+#endif
+ ZERO_STRUCT(fs->objectid_information.out);
+#ifdef HAVE_LIBBLKID
+ blkid_devname = blkid_devno_to_devname(st.st_dev);
+ if (!blk_cache && blkid_get_cache(&blk_cache,NULL) < 0 ) {
+ return NT_STATUS_DEVICE_CONFIGURATION_ERROR;
+ }
+ if ((uuid_value = blkid_get_tag_value(blk_cache, "UUID", blkid_devname))) {
+ GUID_from_string(uuid_value, &fs->objectid_information.out.guid);
+ free(uuid_value);
+ }
+#endif
+ return NT_STATUS_OK;
+ }
}
return NT_STATUS_INVALID_LEVEL;