Author: rmottola Date: Tue Jul 12 14:39:54 2016 New Revision: 39984 URL: http://svn.gna.org/viewcvs/gnustep?rev=39984&view=rev Log: clean up comments and code a little
Modified: libs/gui/trunk/Source/NSWorkspace.m Modified: libs/gui/trunk/Source/NSWorkspace.m URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSWorkspace.m?rev=39984&r1=39983&r2=39984&view=diff ============================================================================== --- libs/gui/trunk/Source/NSWorkspace.m (original) +++ libs/gui/trunk/Source/NSWorkspace.m Tue Jul 12 14:39:54 2016 @@ -1193,15 +1193,18 @@ */ 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) - /* FIXME Check for presence of statfs call explicitly. - In particular, NetBSD offers - only a statvfs calls for compatibility with POSIX. Other BSDs and - Linuxes have statvfs as well, but this returns less information than - the 4.4BSD statfs call. The NetBSD statvfs, on the other hand, is just - a statfs in disguise, i.e., it provides all information available in - the 4.4BSD statfs call. Therefore, we go ahead an just #define statfs - as statvfs on NetBSD. + /* We use statvfs() if available to get information but statfs() + will provide more information on different systems, but in a non + standard way. Thus e.g. on Linux two calls are needed. + The NetBSD statvfs is a statfs in disguise, i.e., it provides all + information available in the 4.4BSD statfs call. + Other BSDs and Linuxes have statvfs as well, but this returns less + information than the 4.4BSD statfs call. Note that the POSIX statvfs is not really helpful for us here. The 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 @@ -1209,9 +1212,6 @@ The statvfs call on Solaris returns a structure that includes a non-standard f_basetype field, which provides the name of the 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) #define statvfs statfs @@ -1224,9 +1224,6 @@ return NO; uid = geteuid(); - *removableFlag = NO; // FIXME - if ([removables containsObject: fullPath]) - *removableFlag = YES; *writableFlag = 1; #if defined(HAVE_STRUCT_STATFS_F_FLAGS) || defined(HAVE_STRUCT_STATVFS_F_FLAG) @@ -1234,10 +1231,10 @@ #endif *unmountableFlag = NO; -#if defined(ST_ROOTFS) // new NetBSD, Linux +#if defined(ST_ROOTFS) // new NetBSD *unmountableFlag = (m.f_flag & ST_ROOTFS) == 0 && (uid == 0 || uid == m.f_owner); -#elif defined (MNT_ROOTFS) +#elif defined (MNT_ROOTFS) // FreeBSD *unmountableFlag = (m.f_flag & MNT_ROOTFS) == 0; #endif @@ -1275,14 +1272,11 @@ // *fileSystemType = [[NSString alloc] initWithCString: m.f_fstypename encoding: [NSString defaultCStringEncoding]]; #endif +#else /* no statfs() nor statvfs() */ + NSLog(@"getFileSystemInfoForPath not supported on your OS"); +#endif + return YES; -#else - NSLog(@"getFileSystemInfoForPath not supported on your OS"); - if ([removables containsObject: fullPath]) - *removableFlag = YES; - // FIXME - return NO; -#endif } /** _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs