freebsd-ports/deskutils/cairo-dock-plugins/files/patch-shortcuts
Pav Lucistnik 6ac0076929 - Update to 2.2.0-4
PR:		ports/153784, ports/153785
Submitted by:	Ivan Klymenko <fidaj@ukr.net> (maintainer)
Feature safe:	yes
2011-01-27 08:32:02 +00:00

78 lines
2.1 KiB
Text

--- shortcuts/src/applet-disk-usage.c.orig 2010-12-11 02:13:37.000000000 +0200
+++ shortcuts/src/applet-disk-usage.c 2010-12-11 02:21:43.000000000 +0200
@@ -18,10 +18,18 @@
*/
#include <string.h>
-#include <mntent.h>
#include <sys/types.h>
-#include <sys/statfs.h>
+#if defined(__FreeBSD__)
+#ifdef HAVE_MNTENT_H
#include <mntent.h>
+#endif
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#else
+#include <mntent.h>
+#include <sys/statfs.h>
+#endif
#include <math.h>
#include <cairo-dock.h>
@@ -160,12 +168,44 @@
static void _cd_shortcuts_get_fs_info (const gchar *cDiskURI, GString *sInfo)
{
const gchar *cMountPath = (strncmp (cDiskURI, "file://", 7) == 0 ? cDiskURI + 7 : cDiskURI);
- struct mntent *me;
- FILE *mtab = setmntent ("/etc/mtab", "r");
+#if defined(__FreeBSD__)
+ struct statfs *me;
+// FILE *mtab;
+#else
+ struct mntent *me;
+ FILE *mtab = setmntent ("/etc/mtab", "r");
+#endif
char *search_path;
int match;
char *slash;
+#if defined(__FreeBSD__)
+ int i;
+ int count = getfsstat(me, NULL, MNT_WAIT);
+// int count = getfsstat(me, NULL, MNT_NOWAIT);
+ if (count>0)
+ {
+ for (i=0; i<count; i++)
+ {
+ if (me->f_mntonname && strcmp (me->f_mntonname, cMountPath) == 0)
+ {
+ g_string_append_printf (sInfo, "Mount point : %s\nFile system : %s\nDevice : %s\nMount options : %s",
+ me->f_mntonname,
+ me->f_mntfromname,
+ me->f_fstypename,
+ me->f_charspare);
+// if (me->mnt_freq != 0)
+// g_string_append_printf (sInfo, "\nBackup frequency : %d days", me->mnt_freq);
+ break ;
+ }
+ }
+ }
+ else
+ {
+ cd_warning ("error getfsstat...");
+ return ;
+ }
+#else
if (mtab == NULL)
{
cd_warning ("couldn't open /etc/mtab");
@@ -189,6 +229,7 @@
}
endmntent (mtab);
+#endif
}
gchar *cd_shortcuts_get_disk_info (const gchar *cDiskURI, const gchar *cDiskName)