about summary refs log tree commit diff
path: root/src/libstd/os/linux
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-05-27 16:29:55 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-06-09 17:44:13 -0700
commitec68c4a8351e65ec6e2d349aa103a457494ad814 (patch)
treec2892ce2b7f8c03971305aa1b74794052455cea0 /src/libstd/os/linux
parent71a8d313c8351771dc5507dde14f654ca4f0707d (diff)
downloadrust-ec68c4a8351e65ec6e2d349aa103a457494ad814.tar.gz
rust-ec68c4a8351e65ec6e2d349aa103a457494ad814.zip
std: Stabilize a number of new fs features
This commit stabilizes the following APIs, slating them all to be cherry-picked
into the 1.1 release.

* fs::FileType (and transitively the derived trait implementations)
* fs::Metadata::file_type
* fs::FileType::is_dir
* fs::FileType::is_file
* fs::FileType::is_symlink
* fs::DirEntry::metadata
* fs::DirEntry::file_type
* fs::DirEntry::file_name
* fs::set_permissions
* fs::symlink_metadata
* os::raw::{self, *}
* os::{android, bitrig, linux, ...}::raw::{self, *}
* os::{android, bitrig, linux, ...}::fs::MetadataExt
* os::{android, bitrig, linux, ...}::fs::MetadataExt::as_raw_stat
* os::unix::fs::PermissionsExt
* os::unix::fs::PermissionsExt::mode
* os::unix::fs::PermissionsExt::set_mode
* os::unix::fs::PermissionsExt::from_mode
* os::unix::fs::OpenOptionsExt
* os::unix::fs::OpenOptionsExt::mode
* os::unix::fs::DirEntryExt
* os::unix::fs::DirEntryExt::ino
* os::windows::fs::MetadataExt
* os::windows::fs::MetadataExt::file_attributes
* os::windows::fs::MetadataExt::creation_time
* os::windows::fs::MetadataExt::last_access_time
* os::windows::fs::MetadataExt::last_write_time
* os::windows::fs::MetadataExt::file_size

The `os::unix::fs::Metadata` structure was also removed entirely, moving all of
its associated methods into the `os::unix::fs::MetadataExt` trait instead. The
methods are all marked as `#[stable]` still.

As some minor cleanup, some deprecated and unstable fs apis were also removed:

* File::path
* Metadata::accessed
* Metadata::modified

Features that were explicitly left unstable include:

* fs::WalkDir - the semantics of this were not considered in the recent fs
  expansion RFC.
* fs::DirBuilder - it's still not 100% clear if the naming is right here and if
  the set of functionality exposed is appropriate.
* fs::canonicalize - the implementation on Windows here is specifically in
  question as it always returns a verbatim path. Additionally the Unix
  implementation is susceptible to buffer overflows on long paths unfortunately.
* fs::PathExt - as this is just a convenience trait, it is not stabilized at
  this time.
* fs::set_file_times - this funciton is still waiting on a time abstraction.
Diffstat (limited to 'src/libstd/os/linux')
-rw-r--r--src/libstd/os/linux/mod.rs3
-rw-r--r--src/libstd/os/linux/raw.rs135
2 files changed, 111 insertions, 27 deletions
diff --git a/src/libstd/os/linux/mod.rs b/src/libstd/os/linux/mod.rs
index d2f9bcc3bcf..146a74a4550 100644
--- a/src/libstd/os/linux/mod.rs
+++ b/src/libstd/os/linux/mod.rs
@@ -10,10 +10,11 @@
 
 //! Linux-specific definitions
 
-#![unstable(feature = "raw_ext", reason = "recently added API")]
+#![stable(feature = "raw_ext", since = "1.1.0")]
 
 pub mod raw;
 
 pub mod fs {
+    #![stable(feature = "raw_ext", since = "1.1.0")]
     pub use sys::fs::MetadataExt;
 }
diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs
index 9589f4cf099..3275ce07b48 100644
--- a/src/libstd/os/linux/raw.rs
+++ b/src/libstd/os/linux/raw.rs
@@ -10,8 +10,10 @@
 
 //! Linux-specific raw type definitions
 
-pub type dev_t = u64;
-pub type mode_t = u32;
+#![stable(feature = "raw_ext", since = "1.1.0")]
+
+#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
+#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
 
 #[doc(inline)]
 pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
@@ -25,34 +27,55 @@ mod arch {
     use os::raw::{c_long, c_short};
     use os::unix::raw::{gid_t, uid_t};
 
-    pub type blkcnt_t = i32;
-    pub type blksize_t = i32;
-    pub type ino_t = u32;
-    pub type nlink_t = u32;
-    pub type off_t = i32;
-    pub type time_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;
 
     #[repr(C)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
     pub struct stat {
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_dev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __pad1: c_short,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ino: ino_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mode: mode_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_nlink: nlink_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_uid: uid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_gid: gid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_rdev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __pad2: c_short,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_size: off_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blksize: blksize_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blocks: blkcnt_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __unused4: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __unused5: c_long,
     }
 }
@@ -64,34 +87,55 @@ mod arch {
     use os::raw::{c_long, c_ulong};
     use os::unix::raw::{gid_t, uid_t};
 
-    pub type blkcnt_t = i32;
-    pub type blksize_t = i32;
-    pub type ino_t = u32;
-    pub type nlink_t = u32;
-    pub type off_t = i32;
-    pub type time_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;
 
     #[repr(C)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
     pub struct stat {
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_dev: c_ulong,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_pad1: [c_long; 3],
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ino: ino_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mode: mode_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_nlink: nlink_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_uid: uid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_gid: gid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_rdev: c_ulong,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_pad2: [c_long; 2],
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_size: off_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_pad3: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blksize: blksize_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blocks: blkcnt_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_pad5: [c_long; 14],
     }
 }
@@ -102,33 +146,53 @@ mod arch {
     use os::raw::{c_long, c_int};
     use os::unix::raw::{gid_t, uid_t};
 
-    pub type blkcnt_t = i64;
-    pub type blksize_t = i32;
-    pub type ino_t = u64;
-    pub type nlink_t = u32;
-    pub type off_t = i64;
-    pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
 
     #[repr(C)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
     pub struct stat {
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_dev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ino: ino_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mode: mode_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_nlink: nlink_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_uid: uid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_gid: gid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_rdev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __pad1: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_size: off_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blksize: blksize_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __pad2: c_int,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blocks: blkcnt_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __unused: [c_int; 2],
     }
 }
@@ -139,32 +203,51 @@ mod arch {
     use os::raw::{c_long, c_int};
     use os::unix::raw::{gid_t, uid_t};
 
-    pub type blkcnt_t = i64;
-    pub type blksize_t = i64;
-    pub type ino_t = u64;
-    pub type nlink_t = u64;
-    pub type off_t = i64;
-    pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
 
     #[repr(C)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
     pub struct stat {
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_dev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ino: ino_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_nlink: nlink_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mode: mode_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_uid: uid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_gid: gid_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __pad0: c_int,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_rdev: dev_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_size: off_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blksize: blksize_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_blocks: blkcnt_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_atime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_mtime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime: time_t,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime_nsec: c_long,
+        #[stable(feature = "raw_ext", since = "1.1.0")]
         pub __unused: [c_long; 3],
     }
 }