Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 184433 | Differences between
and this patch

Collapse All | Expand All

(-)natives/unix/localfile.c (+16 lines)
Lines 11-16 Link Here
11
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
11
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
12
 * Corey Ashford (IBM) - [177400] fix threading issues on Linux-PPC
12
 * Corey Ashford (IBM) - [177400] fix threading issues on Linux-PPC
13
 * Martin Oberhuber (Wind River) - [183137] liblocalfile for solaris-sparc
13
 * Martin Oberhuber (Wind River) - [183137] liblocalfile for solaris-sparc
14
 * Martin Oberhuber (Wind River) - [184433] get attributes from native lib
14
 *******************************************************************************/
15
 *******************************************************************************/
15
#include <jni.h>
16
#include <jni.h>
16
#include <sys/types.h>
17
#include <sys/types.h>
Lines 61-66 Link Here
61
62
62
/*
63
/*
63
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
64
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
65
 * Method:    nativeAttributes
66
 * Signature: ()I
67
 */
68
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_nativeAttributes
69
  (JNIEnv *env, jclass clazz) {
70
#if defined(EFS_SYMLINK_SUPPORT)
71
    return ATTRIBUTE_READ_ONLY | ATTRIBUTE_EXECUTABLE | ATTRIBUTE_SYMLINK | ATTRIBUTE_LINK_TARGET;
72
#else
73
    return ATTRIBUTE_READ_ONLY | ATTRIBUTE_EXECUTABLE;
74
#endif
75
}
76
77
78
/*
79
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
64
 * Method:    internalIsUnicode
80
 * Method:    internalIsUnicode
65
 * Signature: ()Z
81
 * Signature: ()Z
66
 */
82
 */
(-)src/org/eclipse/core/internal/filesystem/local/LocalFileSystem.java (+9 lines)
Lines 10-15 Link Here
10
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
10
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
11
 * Martin Oberhuber (Wind River) - [183137] liblocalfile for solaris-sparc
11
 * Martin Oberhuber (Wind River) - [183137] liblocalfile for solaris-sparc
12
 * Martin Oberhuber (Wind River) - [184433] liblocalfile for Linux x86_64
12
 * Martin Oberhuber (Wind River) - [184433] liblocalfile for Linux x86_64
13
 * Martin Oberhuber (Wind River) - [184433] get attributes from native lib
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.core.internal.filesystem.local;
15
package org.eclipse.core.internal.filesystem.local;
15
16
Lines 82-88 Link Here
82
		attributes = 0;
83
		attributes = 0;
83
		if (!LocalFileNatives.usingNatives())
84
		if (!LocalFileNatives.usingNatives())
84
			return attributes;
85
			return attributes;
86
		
87
		//try to query supported attributes from native lib impl
88
		int nativeAttributes = LocalFileNatives.attributes();
89
		if (nativeAttributes >= 0) {
90
			attributes = nativeAttributes;
91
			return attributes;
92
		}
85
93
94
		//fallback for older lib: compute attributes as known before
86
		//all known platforms with native implementation support the read only flag
95
		//all known platforms with native implementation support the read only flag
87
		attributes |= EFS.ATTRIBUTE_READ_ONLY;
96
		attributes |= EFS.ATTRIBUTE_READ_ONLY;
88
97
(-)src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java (-1 / +40 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-16 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Martin Oberhuber (Wind River) - [184433] get attributes from native lib
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.core.internal.filesystem.local;
12
package org.eclipse.core.internal.filesystem.local;
12
13
13
import org.eclipse.core.filesystem.IFileInfo;
14
import org.eclipse.core.filesystem.IFileInfo;
15
import org.eclipse.core.filesystem.IFileSystem;
14
import org.eclipse.core.filesystem.provider.FileInfo;
16
import org.eclipse.core.filesystem.provider.FileInfo;
15
import org.eclipse.core.internal.filesystem.Messages;
17
import org.eclipse.core.internal.filesystem.Messages;
16
import org.eclipse.core.internal.filesystem.Policy;
18
import org.eclipse.core.internal.filesystem.Policy;
Lines 36-41 Link Here
36
	}
38
	}
37
39
38
	/**
40
	/**
41
	 * Return the bit-mask of EFS attributes that this native
42
	 * file system implementation supports.
43
	 * <p>
44
	 * This is an optional method: if it has not been compiled
45
	 * into the native library, the client must catch the 
46
	 * resulting UnsatisfiedLinkError and handle attributes
47
	 * as known by older version libraries.
48
	 * </p>
49
	 * @see IFileSystem#attributes()
50
	 * @return an integer bit mask of attributes.
51
	 */
52
	private static final native int nativeAttributes();
53
54
	/**
55
	 * Return the value that the native library thinks
56
	 * {@link IFileSystem#attributes()} should return.
57
	 * 
58
	 * Returns -1 when the native library has not been
59
	 * loaded, or is a version that does not support
60
	 * this investigation method yet.
61
	 * 
62
	 * @return an positive value that is a bit-mask
63
	 *    suitable for use in {@link IFileSystem#attributes},
64
	 *    or -1 if native attributes are not available. 
65
	 */
66
	public static int attributes() {
67
		try {
68
			return nativeAttributes();
69
		} catch (UnsatisfiedLinkError e) {
70
			//older native implementations did not support this
71
			//call, so we cannot return supported attribute
72
			//information for them.
73
			return -1;
74
		}
75
	}
76
	
77
	/**
39
	 * Copies file attributes from source to destination. The copyLastModified attribute
78
	 * Copies file attributes from source to destination. The copyLastModified attribute
40
	 * indicates whether the lastModified attribute should be copied.
79
	 * indicates whether the lastModified attribute should be copied.
41
	 * @param source 
80
	 * @param source 
(-)natives/localfile.h (-3 / +12 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
10
 * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
11
 * Martin Oberhuber (Wind River) - [184433] get attributes from native lib
11
 */
12
 */
12
/* DO NOT EDIT THIS FILE - it is machine generated */
13
/* DO NOT EDIT THIS FILE - it is machine generated */
13
#include <jni.h>
14
#include <jni.h>
Lines 40-51 Link Here
40
#define SET_LAST_MODIFIED 0x02l
41
#define SET_LAST_MODIFIED 0x02l
41
42
42
/*
43
/*
43
 * Class:     org_eclipse_core_internal_localstore_CoreFileSystemLibrary
44
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
45
 * Method:    nativeAttributes
46
 * Signature: ()I
47
 */
48
JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_nativeAttributes
49
  (JNIEnv *, jclass);
50
51
/*
52
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
44
 * Method:    internalIsUnicode
53
 * Method:    internalIsUnicode
45
 * Signature: ()Z
54
 * Signature: ()Z
46
 */
55
 */
47
JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_localstore_CoreFileSystemLibrary_internalIsUnicode
56
JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalIsUnicode
48
  (JNIEnv *, jclass);  
57
  (JNIEnv *, jclass);
49
58
50
/*
59
/*
51
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
60
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives

Return to bug 184433