mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 13:30:48 +00:00
clean up comments and code a little
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39984 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
170c923b33
commit
90bcf2389a
1 changed files with 16 additions and 22 deletions
|
@ -1193,15 +1193,18 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
*/
|
*/
|
||||||
removables = [[[NSUserDefaults standardUserDefaults] persistentDomainForName: NSGlobalDomain] objectForKey: @"GSRemovableMediaPaths"];
|
removables = [[[NSUserDefaults standardUserDefaults] persistentDomainForName: NSGlobalDomain] objectForKey: @"GSRemovableMediaPaths"];
|
||||||
|
|
||||||
|
*removableFlag = NO;
|
||||||
|
if ([removables containsObject: fullPath])
|
||||||
|
*removableFlag = YES;
|
||||||
|
|
||||||
#if defined (HAVE_SYS_STATVFS_H) || defined (HAVE_SYS_VFS_H)
|
#if defined (HAVE_SYS_STATVFS_H) || defined (HAVE_SYS_VFS_H)
|
||||||
/* FIXME Check for presence of statfs call explicitly.
|
/* We use statvfs() if available to get information but statfs()
|
||||||
In particular, NetBSD offers
|
will provide more information on different systems, but in a non
|
||||||
only a statvfs calls for compatibility with POSIX. Other BSDs and
|
standard way. Thus e.g. on Linux two calls are needed.
|
||||||
Linuxes have statvfs as well, but this returns less information than
|
The NetBSD statvfs is a statfs in disguise, i.e., it provides all
|
||||||
the 4.4BSD statfs call. The NetBSD statvfs, on the other hand, is just
|
information available in the 4.4BSD statfs call.
|
||||||
a statfs in disguise, i.e., it provides all information available in
|
Other BSDs and Linuxes have statvfs as well, but this returns less
|
||||||
the 4.4BSD statfs call. Therefore, we go ahead an just #define statfs
|
information than the 4.4BSD statfs call.
|
||||||
as statvfs on NetBSD.
|
|
||||||
Note that the POSIX statvfs is not really helpful for us here. The
|
Note that the POSIX statvfs is not really helpful for us here. The
|
||||||
only information that could be extracted from the data returned by
|
only information that could be extracted from the data returned by
|
||||||
that syscall is the ST_RDONLY flag. There is no owner field nor a
|
that syscall is the ST_RDONLY flag. There is no owner field nor a
|
||||||
|
@ -1209,9 +1212,6 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
The statvfs call on Solaris returns a structure that includes a
|
The statvfs call on Solaris returns a structure that includes a
|
||||||
non-standard f_basetype field, which provides the name of the
|
non-standard f_basetype field, which provides the name of the
|
||||||
underlying file system type.
|
underlying file system type.
|
||||||
|
|
||||||
Always prefer the POSIX statvfs() call if available because more standard.
|
|
||||||
Specific features to be added specifically.
|
|
||||||
*/
|
*/
|
||||||
#if !defined(HAVE_STATVFS)
|
#if !defined(HAVE_STATVFS)
|
||||||
#define statvfs statfs
|
#define statvfs statfs
|
||||||
|
@ -1224,9 +1224,6 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
uid = geteuid();
|
uid = geteuid();
|
||||||
*removableFlag = NO; // FIXME
|
|
||||||
if ([removables containsObject: fullPath])
|
|
||||||
*removableFlag = YES;
|
|
||||||
|
|
||||||
*writableFlag = 1;
|
*writableFlag = 1;
|
||||||
#if defined(HAVE_STRUCT_STATFS_F_FLAGS) || defined(HAVE_STRUCT_STATVFS_F_FLAG)
|
#if defined(HAVE_STRUCT_STATFS_F_FLAGS) || defined(HAVE_STRUCT_STATVFS_F_FLAG)
|
||||||
|
@ -1234,10 +1231,10 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
#endif
|
#endif
|
||||||
*unmountableFlag = NO;
|
*unmountableFlag = NO;
|
||||||
|
|
||||||
#if defined(ST_ROOTFS) // new NetBSD, Linux
|
#if defined(ST_ROOTFS) // new NetBSD
|
||||||
*unmountableFlag =
|
*unmountableFlag =
|
||||||
(m.f_flag & ST_ROOTFS) == 0 && (uid == 0 || uid == m.f_owner);
|
(m.f_flag & ST_ROOTFS) == 0 && (uid == 0 || uid == m.f_owner);
|
||||||
#elif defined (MNT_ROOTFS)
|
#elif defined (MNT_ROOTFS) // FreeBSD
|
||||||
*unmountableFlag =
|
*unmountableFlag =
|
||||||
(m.f_flag & MNT_ROOTFS) == 0;
|
(m.f_flag & MNT_ROOTFS) == 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1275,14 +1272,11 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
// *fileSystemType = [[NSString alloc] initWithCString: m.f_fstypename encoding: [NSString defaultCStringEncoding]];
|
// *fileSystemType = [[NSString alloc] initWithCString: m.f_fstypename encoding: [NSString defaultCStringEncoding]];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return YES;
|
#else /* no statfs() nor statvfs() */
|
||||||
#else
|
|
||||||
NSLog(@"getFileSystemInfoForPath not supported on your OS");
|
NSLog(@"getFileSystemInfoForPath not supported on your OS");
|
||||||
if ([removables containsObject: fullPath])
|
|
||||||
*removableFlag = YES;
|
|
||||||
// FIXME
|
|
||||||
return NO;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue