~ubuntu-branches/ubuntu/karmic/xmms2/karmic

« back to all changes in this revision

Viewing changes to src/xmms/compat/statfs_linux.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-05-29 10:14:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080529101425-ycw1nbd980uhvzfp
Tags: 0.4DrKosmos-4ubuntu1
* Merge from debian unstable (LP: #178477), remaining changes:
  - debian/control: Update Maintainer field
  - debian/control: add lpia to xmms2-plugin-alsa supported architectures
* This version reads AAC files (LP: #156359)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  XMMS2 - X Music Multiplexer System
 
2
 *  Copyright (C) 2003-2007 XMMS2 Team
 
3
 *
 
4
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
 
5
 *
 
6
 *  This library is free software; you can redistribute it and/or
 
7
 *  modify it under the terms of the GNU Lesser General Public
 
8
 *  License as published by the Free Software Foundation; either
 
9
 *  version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 *  This library is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 *  Lesser General Public License for more details.
 
15
 */
 
16
 
 
17
 
 
18
/** @file
 
19
 *  Linux statfs
 
20
 */
 
21
 
 
22
#include <stdio.h>
 
23
#include <unistd.h>
 
24
#include <stdlib.h>
 
25
#include <glib.h>
 
26
 
 
27
 
 
28
#include <sys/vfs.h>
 
29
 
 
30
#include "xmms/xmms_log.h"
 
31
#include "xmmspriv/xmms_statfs.h"
 
32
 
 
33
/**
 
34
 * This function uses the statfs() call to
 
35
 * check if the path is on a remote filesystem
 
36
 * or not.
 
37
 *
 
38
 * @returns TRUE if path is on a remote filesystem
 
39
 */
 
40
gboolean
 
41
xmms_statfs_is_remote (const gchar *path)
 
42
{
 
43
        struct statfs st;
 
44
 
 
45
        if (statfs (path, &st) == -1) {
 
46
                xmms_log_error ("Failed to run statfs, will not guess.");
 
47
                return FALSE;
 
48
        }
 
49
 
 
50
        if (st.f_type == 0xFF534D42 || /* cifs */
 
51
            st.f_type == 0x6969 || /* nfs */
 
52
            st.f_type == 0x517B) { /* smb */
 
53
                return TRUE;
 
54
        }
 
55
 
 
56
        return FALSE;
 
57
}